What do you think should be the standard naming in Arc for destructive operations?
The CL way: prepend a 'n' to the name, join -- njoin
2 points
The Scheme way: append a '!', join -- join!
18 points
The module way: put every destructive function in a module named 'd', join -- d!join or d@join or whatever -- please note that there is no standard module system yet.
The scheme way is also the ruby way, so it's probably the most conventional. I could see us using join/d though, as it looks kinda like the w/link method in the arc challenge, so we could be starting our own convention. Personally, I'd love to see a convention for predicates to end in '?', which would go along with the '!' convention quite well.
Except that the ruby way isn't consistent. ! is used to warn people that this method is destructive for sure. The lack of ! doesn't imply non-destructiveness.
It is probably best to avoid any standard that involves non-alphanums, because that character could become a part of the syntax if pg feels like it one day.
There's already one existing syntax for !, and I think it's unlikely that pg will add another. We're taking advantage of something which is, essentially, defined to be meaningless in arc2.tar but which we can make work on Anarki and using it. And of course, pg can do anything he wants, but that could involve both new ssyntax and new functions. We have been warned that what we're doing is "unsafe," after all. If we do avoid alphanumerics and choose, say, djoin, what happens if pg choose njoin for arc3.tar? Or uses the d prefix for something else? Using existing ssyntax characters is probably pretty safe.
As you might have guessed, by the way, I support the join! standard :)
> If we do avoid alphanumerics and choose, say, djoin, what happens if pg choose njoin for arc3.tar? Or uses the d prefix for something else?
We say "I suggest running a poll on this, pg" ^^
But I still like module syntax T.T However the appended ! convention is winning by a really large margin (waaa hopeless!). So we need to modify the builtin ssyntax/ssexpand to ignore trailing "!" and/or standardize on my ssyntaxes.arc
OK, another point. There is a virtue in having a standard that is backwards compatible with the base Arc release.
For example, I recently borrowed classifier.arc from anarki and ran it with the base release of arc with no troubles. If people start using the ! standard, then to use anarki libs one would have to run all of anarki. Which may be OK, it just has to be accepted that this is the case.
(As a matter of style I like ! too)
(somewhat related tangent:
[One of the best of these is a Gosperism. Once, when we were at a Chinese restaurant, Bill Gosper wanted to know whether someone would like to share with him a two-person-sized bowl of soup. His inquiry was: "Split-p soup?" -- GLS]
We're already not backwards compatible. Things like ssyntax.arc, for an extreme example, but also our additions of functions to places like arc.arc, e.g.butlast. That doesn't exist in arc2.tar, but we have it anyway. Anything that uses such functions requires Anarki. This is more extreme (you wouldn't be able to copy just those functions over), but not unique.
Well, it has to do with the ssyntaxes.arc precedence rules and how they work: basically, split according to the current ssyntax, then go to next ssyntax. Since #\. is listed before #\!, symbols are first split by #\. into (foo! x), so it works properly.
It won't work with a type that ends in ! and if you use the ? ssyntax:
(def my-type! (x)
(annotate 'my-type! x))
(my-type!? my-type!.1) ; will transform to (my-type '?)