-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rethink about JS object method name encoding #999
Comments
I think it is okay to consume reason bindings from OCaml even we de-mangling after type checking. Since reason bindings already provide types, so we only need expression to be capable of expressing keyword properties. In that case, I only need allow |
current name mangling rules are documented here: http://bloomberg.github.io/bucklescript/Manual.html#_object_label_translation_convention |
Based on what we described above: We introduce two cases where name mangling will be introduced
note if it is a keyword, it is perfectly fine to have this
how about such cases, the simple rule is always apply rule 2 first, then rule 1
|
PR #999 changed the status line to be printed when edges finish on dumb teerminals, but the default status message includes the number of started edges, resulting in sequential status lines with identical edge counts. Change the default status to show the number of finished edges, which will keep the count incrementing on every line. This will slightly change the output on smart terminals. Previously a build that was just starting would show a count equal to the number of concurrent jobs, and a build waiting for the final jobs to finish would show a count equal to the total number of edges. Now a starting build will show 0, and build waiting for the final jobs will show a count less than the total number of edges by the number of remaining jobs. Fixes: #1142
PR #999 made dumb terminals only output when edges finish. BuildStatus::overall_rate_ stopwatch is only initialized to the current time when PrintStatus is called with finished_edges_ == 0, but on a dumb terminal it will be called for the first time when finished_edge_ = 1, which results in very long elapsed times: NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es ] " [0 processes, 2/2 @ 0.0/s : 1461869902.367s ] Reset the stopwatches in BuildEdgeFinished before finshed_edges_ is incremented instead.
PR #999 made dumb terminals only output when edges finish. PrintStatus is called after finished_edges_ is incremented, which means the calculation for running edges will always return 1 less than the real number of running processes. This happens on smart terminals too, but ninja will immediately print the status for the next edge with starting_edges_ incremented, so the incorrect value is never visible. Pass a boolean specifying whether the status is being printed on an edge finishing, and if so count the edge that just finished as being running.
relevant reasonml/reason#849
cc @chenglou @hhugo (Jordan name does not auto-complete..)
This is a design issue, lets not rush to make the decision. So currently the name mangling serves two purpose: (we currently reuse the same mangling scheme for the two different purposes which might not be good)
open
With regard to purpose 2, we should de-mangling after type checking, otherwise it defeats the purpose of name mangling.
With regard to purpose 1, we also need consider when we do the de-mangling,
Ideally we should de-mangling as soon as we can, for example if Reason allows
x."Foo"
and it is inferred as type{ "Foo" }
this bindingcan not be consumed on OCaml side, we have to write
x##_Foo
, but the type checker will refuse to type check those programs. (we can allowx##"Foo"
too).But if we de-mangle at the syntax level, it will enforce us to provide a solution for type level de-mangling, currently user only need write
< _Foo : .. > Js.t
without ppx, in this case, we should ppx object types and class types (more complexity introduced), maybe we should completely hideJs.t
by saying [%bs: < _Foo : > ]Another issue is that current name mangling
_
is too short that it is confusing to people sincecreate_name
is a normal name, maybe we should make it__
for purpose 2.The text was updated successfully, but these errors were encountered: