Live data from Hacker News

IcedCoffeeScript

maxtaco.github.com

21–30 of 63 posts

Re: IcedCoffeeScript

#22
post #20
post #12

The aim of your docs should be to show how simple and readable IcedCoffeeScript is: using multi character variable names in your examples would help to achieve that.

When you see a two-liner of for k, i in keywords search k, defer out[i] Do you really get lost or confused? Are you actually complaining about a problem, or just a violation of your favorite style guide? Personally, I'm looking for what makes IcedCoffeeScript unique; all else is just cruft, so keeping that terse is just fine with me.

Yes, I lose a few milliseconds. You'll notice your example had to include the loop for 'search k' to have any meaning, so I suspect you did too.

Re: IcedCoffeeScript

#24

Why didn't the "iced" feature just get added to CoffeeScript? Why have two separate packages?

This is one of the great things about doing language work on GitHub -- folks can start experimenting in their own directions, and some of it will make it back into the original project (ES5 strict mode early warnings: https://github.com/jashkenas/coffee-script/issues/1547) ... and some of it doesn't: https://github.com/satyr/coco

There's currently an open pull request for Iced to be merged with CoffeeScript, and the merge will happen if the fork manages to:

* Provide a seamless veneer over sync patterns in async code: defer in loops, with try/catch, within the middle of an expression...

* Handle both synchronous and parallel style "maps"...

* Prove to be more pleasant / powerful to use than callbacks and promises, in practice.

* And then the hardest bit -- do it all without breaking CoffeeScript's golden rule: it has to compile into straightforward JavaScript -- i.e., the callbacks you would have written in the first place.

It's a tall order, but if Max manages to pull all that off, it'll be pretty great.

Re: IcedCoffeeScript

#25
post #22
post #20

Earlier quoted context omitted.

When you see a two-liner of for k, i in keywords search k, defer out[i] Do you really get lost or confused? Are you actually complaining about a problem, or just a violation of your favorite style guide? Personally, I'm looking for what makes IcedCoffeeScript unique; all else is just cruft, so keeping that terse is just fine with me.

Yes, I lose a few milliseconds. You'll notice your example had to include the loop for 'search k' to have any meaning, so I suspect you did too.

I'm still confused. Are those key-value pairs? What is "i" actually doing?

Re: IcedCoffeeScript

#26
post #22

Earlier quoted context omitted.

Yes, I lose a few milliseconds. You'll notice your example had to include the loop for 'search k' to have any meaning, so I suspect you did too.

I'm still confused. Are those key-value pairs? What is "i" actually doing?

k is the value, i is the index.

Re: IcedCoffeeScript

#27
post #11

Earlier quoted context omitted.

As a user, you don't really need to walk away from anything. There isn't any difference between Iced CoffeeScript output that doesn't use await and vanilla CoffeeScript output. You could literally switch out somebody's name-brand CoffeeScript for Iced and he'd never know the difference unless he had a function called await. It's purely an ideological concern, not a practical one.

You’re preaching to the choir! But one objection we will both encounter repeatedly is that if a language supports feature X, and you work on a team/inherit code/use libraries, there will always be people who don’t want to use feature X but wind up dealing with it any ways because someone else used it. So the naysayers will claim that if it’s added to the core language, it’s only a matter of time before they wind up d…

Maybe. Tail recursion optimizes itero-recursive algorithms, turning them into iterative algorithms by eliminating the overhead.

Confused? Here are the iterative, recursive, and itero-recursive ways of writing the factorial function:

    function fact_r(N) {
        return N 
So the accumulator variable becomes an argument variable which may have to be separately initialized. The key feature which makes something optimized for "tail calls" is that when f(something) wants to recurse, it returns f(something else). In other words, certain conditional logics can happen, but don't leave an operation like the "n " in "n recurse(n - 1)" on the stack or else you can't get rid of the function call. It's not even a special optimization -- basically you can move one line in the compiler a couple steps ahead of where you might have automatically written it, and it suddenly treats iteration and tail-recursion the same.

So that's the difference. If you can understand fact_ir, which does the iterative idea in a recursive syntax, then you can understand tail recursion.

Re: IcedCoffeeScript

#28
I like the generality of the defer/await concepts of TameJs (and by extension, iced coffee). But I was curious if these concepts could be used without code generation, as in Async.js. So I came up with Queue.js:

https://github.com/mbostock/queue

I haven't tried it in production code yet, but it looks like a convenient abstraction with tunable parallelism.

Re: IcedCoffeeScript

#29
This fork brings some up deep issues, perhaps intractable, around about the development of syntax-y languages. Useful source transformations require marginalized forks of the compiler and all the development burden and risks that entails. In some sense CoffeeScript inherits the actual problem with JavaScript - a select few determine the introduction of language features. Perhaps these language features are best shipped as libraries?

Maybe it doesn't matter. Perhaps most users don't need it. Or perhaps as we continue to develop software we'll find that we'd rather defer work to the compiler / macros and the high cost of syntax is simply not worth it.

I'm looking forward to see how 3 languages I immensely enjoy (JavaScript, CoffeeScript, ClojureScript) co-evolve :)

Re: IcedCoffeeScript

#30
post #2

I was going to complain that I could find no mention of TameJS (from which the await and defer keywords/features clearly originated). Then I noticed that the IcedCoffeeScript author is also the author of TameJS.

[deleted]
Post reply on HN