Git Product home page Git Product logo

Comments (5)

munificent avatar munificent commented on May 28, 2024

This is effectively a separate proposal, so I don't think it belongs here as a bug.

from dep-configured-imports.

mezoni avatar mezoni commented on May 28, 2024

This is an alternative to the proposal.
I do not think that the main purpose of the "configured-imports" is just to have them as they are proposed here.
The main reason is satisfy the requirement to "import by condition".
What means word "configured" in your proposal?
Condition directives allows "to configure imports".
I don't think that your proposal have some advantages over the "conditional directives".
Parsing constant expression in the directive is not harder than parsing that what you propose.
I am talk about the multi-branch analysing.
If analyzer detect an unknown identifiers and a compared values then it also can warn about that.

Eg.

#if some_predefined_id == expected_literal
#endif

No problem. If analyzer cannot recognize a "predefined_id" as an identifier that it expected to find here then it can send warning "Cannot recognize id. Analysys would not be performed for this condition".

from dep-configured-imports.

mezoni avatar mezoni commented on May 28, 2024

I can wrote it for you if don't know how to implement it.
I am about the detection of "multi-branching" for Dart analyzer.
You should only specify the proposed identifier, their values and what this combination means.

Eg.

dart.platform:
  values:
   "browser" # Browser engine
   "server" # Server engine
dart.vm:
  true: # Dart VM present, maybe in the browser
  false: # Not native engine, maybe javascript

from dep-configured-imports.

lrhn avatar lrhn commented on May 28, 2024

We could allow compound conditions in the import.
If we also have conditional exports, it's not technically necessary since you can import something if test1 && test2 by using test1 to conditionally import something that uses test2 to conditionally export what we want. It requires more library files, but it is possible.
The problem with expressions is that it's hard to stop. Using "!", "&&" and "||" to combine tests and parentheses to group them is an easy extension to this proposal, but to begin with, I'd like to keep things simple. If you have a complex condition for importing a library, there might be an abstraction missing somewhere.

from dep-configured-imports.

zoechi avatar zoechi commented on May 28, 2024

Is there some agreement what values are available for the comparsion in the expression?
Somewhere features where mentioned, is this still part of this DEP?
I poked around in some Ruby code a few days ago, they have a lot of if version >= x ...
If it is only platform, the mentioned operators should do.
Of course someone could still demand other operations like platform.startsWith('xxx'), platform.contains((math.pi * 42).toString()), ... or even http.get()...contains(...) ;-)

from dep-configured-imports.

Related Issues (11)

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.