Closed hikari-no-yume closed 10 years ago
Don't worry about the suggestions, they are all welcome :)
About the syntax, I like the idea of making [a, b] = c
compile to list($a, $b) = $c
. As for the for
syntax, I borrowed it from CoffeeScript and I really liked it. Changing it to k: v
wouldn't be hard, to be honest, my decision was somewhat conservative to not make developers learn too many new things about the syntax, if you already know python or coffeescript that should be familiar, but I really like that your syntax feels like JSON, and thus in Blueberry you can create associative arrays like that it might make sense to change it! :+1:
It turns out your k, v
implementation didn't actually work! See: https://github.com/gosukiwi/Blueberry/pull/17
So there's no reason not to change it, I suppose.
Uhm, maybe it was just a placeholder for an implementation? Or is it broken? Well I guess the fix should just embrace the new syntax.
Yeah, it may well have been a placeholder.
I'm not sure it's a problem, but you might look at
for k, v in array
and expect it to meanforeach ($array as list($k, $v))
instead offoreach ($array as $k => $v)
. Not that I think it should, I think explicit unpacking like that would be better asfor [a, b] in array
(and we could havelist($a, $b) = $c
in normal assignments as[a, b] = c
, maybe? :D). If we were to change the syntax, it could befor k: v in array
, to match the{k:v}
literal syntax.But, on the other hand, the current style could stay.
(Sorry for spamming you with all these suggestions!)