Arc Forumnew | comments | leaders | submitlogin
4 points by almkglor 6096 days ago | link | parent

Translate this to your syntax, then:

  (afn (bigtree)
    (let trav
         (fn (node)
             (self node!l)
             (do-something node!v)
             (self node!r)))
    (map trav bigtree))


1 point by binx 6096 days ago | link

  (fn (bigtree)
    (let o-self self
    (let trav
         (fn (node)
             (o-self node!l)
             (do-something node!v)
             (o-self node!r)))
    (map trav bigtree)))
I admit that it's more verbose, but I insist that separating fn and afn is unnecessary.

-----

6 points by almkglor 6096 days ago | link

I insist that having every function implicitly have a self-reference is bad. Sometimes I want a function's sense of self as being some other object - say a table representing a set of functions. Sorry, but I want control over the names I'm using - and the separation of 'afn, 'fn, and 'rfn gets me that control.

The above just gets worse when I need several nested afn's each with a few dozen fn's that need to recurse on the parent. Being able to select or not select the implicit shadowing of 'self is important to me.

-----

2 points by almkglor 6096 days ago | link

"All processes are impermanent ... All processes are afflicted ... All phenomena are not ‘Self’; when this is seen with knowledge, one is freed from the illusion of affliction. This is the pathway to purity." ^^ ^^ >.<

-----

1 point by binx 6096 days ago | link

I finally agree. But maybe afn should be the default choice instead of fn.

'Self' in buddism is different to 'self' in common sense. Of course it's not the topic of this forum. :)

-----

5 points by pg 6095 days ago | link

In this example it's not the end of the world, but it would cause problems in code that's generated by other code, e.g. by macros.

I experimented for a while with having if just be aif, and it was not good. There are times you want to back off from maximally using anaphoric variants, just as there are times you don't want to use [] or ./! notation even though you could. E.g. when it's nested. And if you don't have the non-anaphoric variants, you never can.

-----