Code Monkey home page Code Monkey logo

config.ml's People

Contributors

gpetiot avatar kfoxder avatar leostera avatar metame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

config.ml's Issues

Support @@cfg within module & signatures

Right now we can't use @cfg in elements defined within modules and signatures.

The expected behavior is that @cfg can be used in places like this:

module A : sig
 val a : unit -> unit [@@cfg disable = true]
end =
 let a () = () [@@cfg disable = true]
end

and interface files:

module A : sig
 val a : unit -> unit [@@cfg disable = true]
end

Support @@cfg in match cases

Currently, this is unsupported:

let foo a =
  match a with
  | 0 -> "0"
  | 1 -> "1"
  [@@cfg (disable=true)]

And the expected behavior is that we can remove that match case with the annotation.

This is mostly important for having good support for conditional constructors and variants, so that we can disable in tandem the pattern matching branches for them.

Support @@cfg in function branches

Currently, this is unsupported:

let foo a = function
  | 0 -> "0"
  | 1 -> "1"
  [@@cfg (disable=true)]

And the expected behavior is that we can remove that function branch with the annotation.

not(expr) broken

It looks like annotating [@config (not(a = 1))] actually breaks at evaluation time with:

   $ dune clean
   $ dune build
+  File "cond_type_var_constructor.ml", line 16, characters 17-48:
+  16 |   | `KingCrimson [@config (not(made_up = true))]
+                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+  Error: Not expressions must have a single parameter
+         
+  [1]

And using a variable to test for it being unset like [@config (not(a))], failed with:

   $ dune clean
   $ dune build
+  File "cond_type_var_constructor.ml", line 16, characters 17-41:
+  16 |   | `KingCrimson [@config (not(made_up))]
+                        ^^^^^^^^^^^^^^^^^^^^^^^^
+  Error: Forms any/all/not must parenthesize its arguments
+         
+  [1]

The expected behavior is that both of these parse correctly and evaluate as follows:

  • not(expr) is equals to false if the expression is true, or true if it is false
  • not(varName) is equals to true if the varName is not defined in the environment or has no value, or false if varName has a value

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.