Hacker News new | ask | show | jobs
by tikhonj 5175 days ago
Using # for both comments and colors does not sound like a good idea! Just stick to --, I think. It looks prettier anyhow :P.

Also, how do you do scoping without a var or val keyword? E.g. what if I want to have a variable local to a function (or method, I guess?). Or what if I want to reassign a variable outside of the current scope?

1 comments

Definitely a good point and I'll make that change. I was hesitating to only use -- because I thought it might be unfamiliar to some. But it works great for Lua & Haskell!

For variable scoping, if you use the same name inside a "for" or "if" block then it'll assign that name in the outer scope. A function however can't assign to names outside of the function - each function needs to explicitly declare its inputs & outputs. There's some holes in the current design, so adding a "val" keyword is the current plan.