sweet-core icon indicating copy to clipboard operation
sweet-core copied to clipboard

Add back --readable-names flag

Open disnet opened this issue 8 years ago • 6 comments

By default hygiene gives all bindings a new name with _<number> appended to it. In most cases you can just drop the unique suffix; it is only needed in cases where multiple bindings with the same name mix. In pre 1.0 the --readable-names flag did this.

Adding it back now is probably much easier with the Shift scope analyser.

disnet avatar Mar 28 '16 02:03 disnet

This discussion has probably happened elsewhere but any reason not to make the --readable-names behavior the default instead and provide a flag to uniquify everything if they want that?

jayphelps avatar Apr 12 '16 07:04 jayphelps

Ah good call. That's probably a better default.

disnet avatar Apr 12 '16 15:04 disnet

+1

bearnshaw avatar Dec 22 '16 16:12 bearnshaw

Doesn't seem to have been addressed. A "fix" which probably breaks things but works for me is in my branch https://github.com/gkovacs/sweet.js at https://github.com/gkovacs/sweet.js/commit/94f637476f0d8a74f37a5047491a3e55a9b4aec6

gkovacs avatar Feb 17 '17 19:02 gkovacs

@gkovacs indeed that will avoid the renaming but hygiene is obviously broken now.

disnet avatar Feb 19 '17 02:02 disnet

yes I mean obviously the system should optimally check to see if a rename is required and only rename if necessary. none of my macros declare new variables so it seems to work for my purposes.

gkovacs avatar Feb 19 '17 18:02 gkovacs