#1117 Naming amber expandos with less possibility to nameclash.

Closed
opened 8 years ago by nero · 1 comments

Originally at 2014-12-19T20:40:37Z by Herbert Vojčík

There are a few expandos (leaving out methods now, then there would much more than a few) amber uses to work ('expando' meaning setting a property on foreign JS object for our own uses, aka 'monkey patching'):

  • klass holdind a pointer to Smalltalk class of an object (set in prototype, so instances inherit it via standard JS prototype chain).
  • isNil set in a nil object so isNil works cross-frame
  • allowJavaScriptCalls is switch settable by user for some allowing JS behaviour on ST-wrapped objects

(hopefully I did not miss more of them).

Now, this would be really breaking change (so it can be introduced in 0.14 with backward compatibiilty code, and removed in 0.15), but I feel like these names are too generic ('klass' and 'clazz' are first names one uses for class-thing, since 'class' itself is reserved; and there is at least one framework out there using 'isNil' though I am lazy to search it again ;-) ), so there should be more crazy names used there instead, for example $amber$klass and $amber$isNil and $amber$jsFallback.

What do you think?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Originally at 2014-12-19T20:40:37Z by Herbert Vojčík There are a few expandos (leaving out methods now, then there would much more than a few) amber uses to work ('expando' meaning setting a property on foreign JS object for our own uses, aka 'monkey patching'): - `klass` holdind a pointer to Smalltalk class of an object (set in prototype, so instances inherit it via standard JS prototype chain). - `isNil` set in a `nil` object so `isNil` works cross-frame - `allowJavaScriptCalls` is switch settable by user for some allowing JS behaviour on ST-wrapped objects (hopefully I did not miss more of them). Now, this would be really breaking change (so it can be introduced in 0.14 with backward compatibiilty code, and removed in 0.15), but I feel like these names are too generic ('klass' and 'clazz' are first names one uses for class-thing, since 'class' itself is reserved; and there is at least one framework out there using 'isNil' though I am lazy to search it again ;-) ), so there should be more crazy names used there instead, for example `$amber$klass` and `$amber$isNil` and `$amber$jsFallback`. What do you think? <bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/7145251-naming-amber-expandos-with-less-possibility-to-nameclash?utm_campaign=plugin&utm_content=tracker%2F79201&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F79201&utm_medium=issues&utm_source=github). </bountysource-plugin>
Herby Vojčík commented 6 years ago
Owner

.klass is now .a$cls, .isNil is now .a$nil, .allowJSC is removed.

`.klass` is now `.a$cls`, `.isNil` is now `.a$nil`, `.allowJSC` is removed.
Sign in to join this conversation.
No Label
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.