Arc Forumnew | comments | leaders | submitlogin
If I were in charge of Arc...
7 points by LaurieCheers 6132 days ago | 6 comments
Yeah, yeah, everyone has their own ideas about what features Arc should have. Just thought I'd cons mine on there.

1. The layout for function declarations ought to match the layout for function calls.

So instead of (def myfunc (x y) ...), you would write (def (myfunc x y) ...).

Doesn't it just feel better? I mean, that is what you're defining: the meaning of (myfunc x y).

This also means you can write (def (myfunc . args) ...) for a function with only an arbitrary argument list. Much more consistent.

2. Hygenic macros by default

Scheme's strictly hygenic macros may have been a mistake, but you have to admit: unhygenic macros are the wrong default. On the rare occasion that you actually want unhygenic behaviour, it should be something you can explicitly request... not something you have to explicitly turn off, every damn time.

3. List splicing

At the moment there are two different ways to express "splice a list in here". When back-quoting, you write: `(a b ,@others)

In a function declaration, you write: (def foo (a b . others) ...)

Ok, these in different contexts (one builds the list, the other destructures it)... but conceptually they're the same.

I suggest @ should become a "list splice" operator, able to be used anywhere.

  arc> (let others '(17 18 19)
         (1 2 @others 3))
  (1 2 17 18 19 3)
This makes the apply function completely redundant, by the way: instead of (apply f args), you can say (f @args).


5 points by simonb 6132 days ago | link

Replacing apply with @ is a great idea.

I am not so sure about unifying . and @ though. I would say . is the inverse of @. One splices the other appends [a tail].

-----

3 points by icemaze 6132 days ago | link

1. Seems unimportant to me. Probably it's mostly an aesthetical matter, thus very subjective.

2. I like the default. Macros are hard and the last thing I wanna do is learn TWO macro systems. Also, I really can't get scheme-style macros. They just won't click.

"Turning off" variable capture is pretty straightforward once you get it. And there are tools that can help you do it easily. It's not the most convenient thing in the world, I admit, but it's good enough for me.

3. Yes, I like uniformity too. Why not `(a b . ,others) instead? Would be more similar to what we do elsewhere. Oh, well...

-----

1 point by bogomipz 6130 days ago | link

You can already do `(a b . ,others) in any Lisp. I just checked PLT, Arc and SBCL.

-----

1 point by maxwell 6132 days ago | link

If it's only "good enough," it's probably not good enough...

-----

1 point by bogomipz 6130 days ago | link

One could also wish that (apply f args) could be written as (f . args). This makes perfect sense to me, even more so than (f @args), although logically they would mean the same.

The difference is that . is a notation for CONS, while @ may be used anywhere in a list. This means that (1 2 @others 3) cannot reuse others, and therefore shouldn't do so when the splice happens to be at the end either.

  (1 . 2) means (cons 1 2)
  (1 2 . foo) means (cons 1 (cons 2 foo))
  (1 2 @foo) is slightly more complicated as it needs to loop over foo

-----

1 point by shizzy0 6130 days ago | link

Ou, I like the '@' as a general splice operator.

-----