candor icon indicating copy to clipboard operation
candor copied to clipboard

language design questions

Open dvv opened this issue 13 years ago • 5 comments

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

dvv avatar Apr 02 '12 18:04 dvv

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 !==.

creationix avatar Apr 02 '12 18:04 creationix

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

dvv avatar Apr 02 '12 18:04 dvv

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.

creationix avatar Apr 02 '12 18:04 creationix

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

dvv avatar Apr 02 '12 19:04 dvv

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

creationix avatar Apr 02 '12 19:04 creationix