Arc Forumnew | comments | leaders | submitlogin
1 point by CatDancer 5423 days ago | link | parent

Am I using the Anarki version here correctly?

  arc> (dynvar a 3)
  3
  arc> (a)
  3
  arc> (let* (a) 5 (a))
  5


1 point by rntz 5423 days ago | link

Ayup. That's the idea.

-----

1 point by CatDancer 5423 days ago | link

You may be interested in my "autocall" patch, that I'm renaming to "defvar" and will be writing some documentation for soon. It extends the Arc compiler to allow you to provide your own implementation for a global variable, so that you can type "a" instead of "(a)".

-----

1 point by rntz 5423 days ago | link

Sounds vaguely similar to symbol macros, which are a more general facility in which you can make a given symbol expand to arbitrary code (rather than just the invocation of a given symbol). I'd be more interested in seeing a hack to implement those in arc; you can do some interesting things with them

In this case, I honestly don't find that writing the extra parens is much of a bother to me (and I have used dynvars quite a bit in one of my projects) - it actually helps remind me "oh hey, this is a dynamic variable". It's like an enforced naming convention; "(foo)" is just as succinct as 'foo, really.

Edit: dammit, that's supposed to be 'foo surrounded by stars - the CL dynamic variable naming convention. Unfortunately it's misinterpreted as italics. Is there some way around this?

-----

1 point by shader 5423 days ago | link

pg's convention in the arc code is to just have one star after the name, instead of one on either side. Less typing, and it doesn't conflict with italics ;)

-----