Live data from Hacker News

Kal – a clean JavaScript alternative without callbacks

rzimmerman.github.io

31–40 of 130 posts

Re: Kal – a clean JavaScript alternative without callbacks

#32

So instead of encouraging you to actually fix the bad nested callback code, you can dress it over with fancy syntax. Well done on making a whole language though. It's pretty challenging and I hope you do well. Aside: This seems very similar to narrativeJS in concept http://www.neilmix.com/narrativejs/doc/

Thanks. I think the main issue with JS callback syntax is that it quickly becomes unmaintainable. Hopefully this fixes a lot of that by abstracting away the mechanics. I don't think there's something fundamentally wrong with the "relinquish control and wait for I/O" model, so I tried to make that explicit here.

Re: Kal – a clean JavaScript alternative without callbacks

#33
post #22

Earlier quoted context omitted.

I also vote for 'await' here. The 'wait for friends from' construct looks too much like BASIC for my liking. It's not clear which terms are built into the language ('wait', 'for', 'from') and which are not ('friends'). Also, since the eventual result of that line is an assignment to 'friends', using the existing = operator makes the language more consistent.

Thanks for the feedback. It seems like a lot of people would prefer a more normal looking assignment. If you get a chance (and use TextMate or Sublime Text), please give syntax highlighting a try ( https://github.com/rzimmerman/kal.tmbundle )!

Unfortunately I don't use those editors — maybe you can write a Vim highlighter next? Might also be worth adding syntax highlighting to the website (even if you have to do it manually for now), if you're set on the current syntax and think highlighting will make that much of a difference.

Re: Kal – a clean JavaScript alternative without callbacks

#34
post #19

Excellent work. Especially useful since it appears to throw exceptions. That means it's a step up from Iced Coffeescript. The syntax is a little verbose and might be shortened to something like C#: `user = await db.users.findOne {name:userName}`. Would be a lot more clear to me.

Definitely play with the exception handling. Latent bugs aside, asynchronous statements (wait fors) work in any crazy horrible nested combination of ifs, fors (parallel or series), and trys that you can think of. Take a look at the JS output with:

kal -o output.js -f beautify input.kal

to see the sausages being made. The http server demo is a good example (https://github.com/rzimmerman/kal/blob/master/examples/async...)

Re: Kal – a clean JavaScript alternative without callbacks

#35

So instead of encouraging you to actually fix the bad nested callback code, you can dress it over with fancy syntax. Well done on making a whole language though. It's pretty challenging and I hope you do well. Aside: This seems very similar to narrativeJS in concept http://www.neilmix.com/narrativejs/doc/

Thanks. I think the main issue with JS callback syntax is that it quickly becomes unmaintainable. Hopefully this fixes a lot of that by abstracting away the mechanics. I don't think there's something fundamentally wrong with the "relinquish control and wait for I/O" model, so I tried to make that explicit here.

[deleted]

Re: Kal – a clean JavaScript alternative without callbacks

#36

rzimmerman I like it! and would consider using it for my next big project. If I were you I would make a slight course correction follow in the footsteps of Python and Go and have one and only one correct way to do something. When you say use two spaces, but you can use more if you want, make it an error to use more. Pick the correct way to call a function. Pick the correct way to declare a function. Keep up the good…

Thanks! I wouldn't call it stable or production ready by any means, just as a disclaimer.

Oh hey, another idea, if you keep the project really tight and small, I wont be too intimidated to get into it and help fix issues if I start using it.

Re: Kal – a clean JavaScript alternative without callbacks

#37
post #22

Earlier quoted context omitted.

I also vote for 'await' here. The 'wait for friends from' construct looks too much like BASIC for my liking. It's not clear which terms are built into the language ('wait', 'for', 'from') and which are not ('friends'). Also, since the eventual result of that line is an assignment to 'friends', using the existing = operator makes the language more consistent.

Thanks for the feedback. It seems like a lot of people would prefer a more normal looking assignment. If you get a chance (and use TextMate or Sublime Text), please give syntax highlighting a try ( https://github.com/rzimmerman/kal.tmbundle )!

It's more than assignments looking normal. "await x" is better since it's an expression and not a statement. That is, "await x" will be a placeholder for a value (after the appropriate CPS, of course), while the assignment syntax forces you to use a temporary variable, even if you don't need it.

Re: Kal – a clean JavaScript alternative without callbacks

#38
post #7

The title is kinda funny to the russian ear because kal means feces in Russian :)

That is really unfortunate... I chose it because it in Hebrew it roughly means something like easy/simple/BASIC. edit: More importantly, does that make you more or less likely to use it?

I'm Russian and I didn't blink reading the title. I never stopped to contemplate the fece-ness of iCal either, until today (thank you, 10098). Anyway, keep the name. It's a fun easter egg as far as I'm concerned.

Also, note that kal is mere `faeces` in Russian, not `shit`. I don't remember when I've last used the word outside of a hospital... or inside, for that matter.

Post reply on HN