Arc Forumnew | comments | leaders | submitlogin
Arc design question: whilet vs. awhile
2 points by zck 3314 days ago | 2 comments
Why does whilet exist? It seems a generalization of anaphoric while; it lets you put in your own var. It seems one could make that argument for any of the anaphoric operations. You could have ift, where the first argument is the variable to bind the guard's value to. Other than allowing nested whilets, does this give us anything useful? Why was this choice made?

I ask because I was trying to use awhile, and it didn't occur to me that it could be something else; it seemed that arc didn't have the concept. This brings me to another question I have about arc, that I'll submit as another discussion.

3 points by rntz 3314 days ago | link

Well, Arc does have 'iflet, 'whenlet, etc (which are generalizations of 'aif, 'awhen, etc). As for why, I dunno, it just seems cleaner to me to, whenever you have an anaphoric macro, always have the corresponding explicit macro. It's more flexible if you do need or want to name your variables, it allows for nesting, etc.


3 points by zck 3313 days ago | link

I suppose that's true. And obviously, one could create awhile from whilet. But from a language design perspective, shouldn't there be the entire set of anaphoric operations?

(I was going to complain how whilet doesn't make sense, and isn't at all like iflet or whenlet, but then I realized whilet isn't "while t", it's "while-let" with the overlapping "le" compressed into "whilet". Well, chalk one up for pg et al. Cool name.)