indutny / candor

Experimental VM for a `Candor` language
http://candor-lang.org/
177 stars 16 forks source link

language design questions #21

Open dvv opened 12 years ago

dvv commented 12 years ago

Please, consider answering some naive ones:

  1. why coercing comparison retains: ==, !=. they are known as source of subtle bugs in JS, and every tutorial i read said i should use ===, !== instead.
  2. delete foo[bar] can be replaced with foo[bar] = nil, which frees rather useful keyword and can internally behave equally.
  3. string concatenation is done via ambiguous +, which is known to be another source of subtle bugs.

TIA, --Vladimir

creationix commented 12 years ago

delete is not the same as setting to nil. This is not lua. Candor allows having properties that point to nil. This makes JSON interop much easier for example.

As far as type coercion, I agree, == and != should be the same as JS === and !==.

dvv commented 12 years ago

will candor distinguish between delete foo[bar] and delete(foo[bar]) and {delete: (foo) { bar } }?

creationix commented 12 years ago

I believe so yes. If not, it should. I know I asked for this with "new" and I assume the logic is the same for all keywords.

dvv commented 12 years ago

hmm. i saw no new in keywords. i thought we construct objects literally, no?

creationix commented 12 years ago

right, "new" was renamed to "clone". But it was "new" when I had @indutny make sure it could be used for other stuff.