You're right, but it can be dangerous too : we would end up having two (or more) competing implementations of the language and have libraries compatible with "PG Arc" and others compatible with "Anarki".
We finally would have to choose which implementation to work on (the official one ? Or the one with cool features missing from the official ?) and have to port every missing library to our chosen version. Something current in the Lisp world, but that's also one of the reasons why Lisp seems frightening to others and why Python or Perl have more users.
Although I'm a Lisp newbie, the more I learn about Lisp, the more I like it. However, one of my frustrations (which seems to be all too common), is dealing with the myriad of implementation choices, libraries, etc. There are pros and cons to those choices, but more cons ;)
For me, the BDFL model has worked quite well for Ruby, Python, etc. I expect I'm very biased since I'm a Ruby programmer currently, but I think it's fair to say the model works well to avoid dividing and conquering itself.
There are many things to like about Arc, but I think the fact that it could potentially unify a large community around a single implementation is very powerful.
I've also heard that it's better to put systems in place before you need them instead of afterward.
The only practical alternative to BDFL is design by committee. For Anarki, the committee is anyone with git installed. Much as I love the work being done on Anarki, the model won't scale and either pg, nex3 or someone else will end up having to make the decisions.
So I'm sort of saying... it'll work out in the end, maybe.
The conflict I see is between pg releasing Arc at this very early stage because he found it useable vs you all going batsh*t over the volatility. You are both right! It is great that the users are chomping at the bit for something stable, but pg warned everyone that this was an experimental release and he planned to trash all our code at will. :)
Looking at Arc as a Lisp veteran I can assure you all that you totally need to reset your expectations and sign up for a fun exploration of a possible (emphasis on possible, because the more I learn of Lisp-1 the more I consider it a grave error) ... of a possible sweet spot in the abstract Lisp language space.
If Lisp-1 does turn out to be a grave error, it doesn't seem like it would be that difficult to either add the Scheme features that make Lisp-1 work, or turn it into a Lisp-2, given the side of the Arc codebase.
Right now, I'm just looking for the best Lisp to develop web applications with. Ruby on Rails is my benchmark, and I think it can be improved on with Lisp, but that remains conjecture at this point.
Just to be clear. I'm not asking for stability at this point. I agree that maintaining backward compatibility would waste time & effort. Arc can still evolve like crazy and break existing code, but it would be nice to have a way for the community to feed patches & bug fixes to pg besides the Arc forum.
No, it does not work that way, although people who do not understand macros (such as Guido) live in fear of that hobgoblin.
Macros are not used to create unrecognizable languages. They are used when an API has grown to the point where writing the code to use it can be automated. That is probably hard to parse if you fear macros, because you can only fear macros if you do not know how they are used. But the idea is simple.
This little call tends to require this little call before it and this little call after it, or something like that. And this pattern appears often enough, or the Lisp developer recognizes it as the sort of thing that will appear again and again, and they just say, macro time!
They then give the macro a totally comprehensible name derived from the bits of the API being hit and, golly, no confusion.
The other time you see macros is in things like aif. There will only be so many of these, and they will confuse people not at all.
It seems to me some people want macros to be a problem. They never are.
Yes, well. In the office no one wants to touch my code, because it's built from bunches of macros, and no one else here knows how macros work. Oh well. Could be just me, I suppose.
Edit: gets even worse when I use C macros in C code ^^, they even instated a rule that loops should use for(i=0;i<limit;++i) and not my otherwise shorter repeat(i,limit) macro
We almost agree. :) I don't know, when they look at your functions do they know what they do? When they see a class name do they understand the class hierarchy? Or do they start browsing? As for repeat(i, limit) being banned, I presume because no one could guess what it does, well, I am looking at bartender's school. The more I learn about software the harder it is to work with some people. :) But I don't blame Dilbert on the C preprocessor.
LOL. I think the problem, partly, is the fact that we're attached to a Japanese company and the Japanese might not have that good a grasp of what "repeat" means (they tend to have a sneering attitude to anything non-Japanese, which means they suffer in the english-language department). I did manage to talk some guys into using repeat, but they got ordered by the Japanese to change it to "for", presumably because the Japanese knew "for", didn't know what "repeat" meant, and couldn't figure out how #define worked.
Edit: Too bad I'm a teetotaler, I'd have gone to bartender school too.
"one of my frustrations ... is dealing with the myriad of implementation choices"
As Sartre said, you are not free to be not free. Have fun with Arc, use Common Lisp. Lisp-1 buys you nothing but aggravation, minimal just means you end up building your own full tool chest that is incompatible with anyone else's so you can never share code.
The idea that Lisp's greatest strength - the inherent ability to transform to whatever you want it to be - is also its greatest weakness, since it prevents you from easily communicating with others what you intend - that is, one man's 'let (CL, Scheme) is another man's 'with (Arc).
Having ported my groovy Cells project to Arc, I can confirm that it was a pain where I sit that "only the names have been changed" in several cases. :) But pg gets the benefit of the doubt from me because I own both his books and he kinda rocks when it comes to Lisp.
The funny thing is that perhaps unbeknownst to you all the Lisp establishment is ragging on pg for Arc being too much like Lisp, you (and I a little) are hosed that he diverged from Lisp, so him being smart I would guess he is now ignoring everyone. :)
The only thing I can offer is that it totally sucks to have an installed base and not be able to change things cuz you will break all the code ofyour users. Only at times like this is an inventor free to change everything and anything, I guess pg did.
I don't really see Anarki as a fork of Arc, and certainly not as a competing implementation. I see it as a place to put bug-fixing patches, to experiment with crazy implementation ideas, to keep libraries and add-ons, and so forth. I keep it up-to-date with the latest arcn.tar, and we all try not to make the API incompatible. If PG ever says that there's some feature in it that he won't include in the official distribution, at least one that involves patching ac.scm, we'll get rid of it. The rest can be included as arcn-compatible libraries.
So I don't predict that there'll really be incompatibility issues in the future.
Well, as far as I know, there are some improvements (bug fixes & efficiency issues) made in ac.scm from arc2 that have been ignored on the anarki version (where other patches & fixes were previously applied). In other words, anarki's current version of ac.scm is much closer to anarki's "arc1+" version than to arc2's version. I tried to merged them a few days ago, but apparently it broke in some versions of mzscheme. I might try again later.
No big deal however, these are only minor issues, but it might get harder as pg improves his own version while we get addicted to (and improve) the cool features implemented in the version we're working on. One day or another, it will be almost impossible to merge them. (Animal species work that way btw)
There shouldn't be anything in arc2 that isn't in Anarki except maybe a couple srv.arc improvements that are more or less a subset of the improvements made earlier in Anarki.
I did a full merge of arc2 when it was released (see http://www.arclanguage.org/item?id=3427), and when there were conflicts, generally favored PG's solutions to the ones already present. If there is anything missing, I'd love to know what it is.
That one is not crucial, as it only brings a minor performance gain in most of the cases. However, I'm more skeptical about that :
(define (ac-fn args body env)
(if (ac-complex-args? args)
(ac-complex-fn args body env)
`(lambda ,(let ((a (ac-denil args))) (if (eqv? a 'nil) '() a))
'nil
,@(ac-body body (append (ac-arglist args) env)))))
Versus the code from Anarki, still the original arc1's version :
(define (ac-fn args body env)
(if (ac-complex-args? args)
(ac-complex-fn args body env)
`(lambda ,(let ((a (ac-denil args))) (if (eqv? a 'nil) '() a))
,@(ac-body* body (append (ac-arglist args) env)))))
Isn't it a bug fix ? The one someone told about, with '(), () and nil not being always equivalent ? If so, that's more problematic. I tried to merge these codes together, but it was obviously broken and was reverted later in the git.
Those do seem to be mistakes. It looks like this might have been caused by the Windows-newlining of ac.scm, which screwed with the Git history a little. I'll change these to the arc2 versions... if you see any other inconsistencies, let me know.
I've changed ac-call to the arc2 version, but I think you're wrong about ac-fn. The following:
(define (ac-fn args body env)
(if (ac-complex-args? args)
(ac-complex-fn args body env)
`(lambda ,(let ((a (ac-denil args))) (if (eqv? a 'nil) '() a))
'nil
,@(ac-body body (append (ac-arglist args) env)))))
is how it's been in arc0, arc1, and arc2. The following:
(define (ac-fn args body env)
(if (ac-complex-args? args)
(ac-complex-fn args body env)
`(lambda ,(let ((a (ac-denil args))) (if (eqv? a 'nil) '() a))
,@(ac-body* body (append (ac-arglist args) env)))))
is unique to Anarki, and was added as part of a patch for MzScheme compatibility.
After getting rid of all the trailing-whitespace-removal that was clogging the diffs, I think ac-call was the only non-purposeful difference between ac.scm in Anarki and arc2. Let me know if you notice any more, though.
Well, the future will tell us, but for the moment, Anarki is a non-official experiment around the "real" Arc, and as far as I know none of the propositions made in Anarki can be found in the official versions (it's very early for that, I know). On the contrary, debian stable & unstable are both official and the vocation of unstable is to become the next stable version.
"as far as I know none of the propositions made in Anarki can be found in the official versions"
There are a few bug fixes that appeared first in Anarki, were brought up on the forums, and ended up being added to arc1 or arc2. But you're right, I don't believe PG pulls changes from the repo directly.
I'm no lawyer and I haven't read the artistic license very closely, but Anarki's under the same license as the original codebase, so I'm pretty sure there shouldn't be a problem...
I understand your point, but I am sure you'll agree that Paul definitely will accept a feature if it is really cool. Thereby Anarki is de facto Arc Unstable.
I chose "call" because that's how "help" was named. The setters hash is just "setters," though, I believe. I dunno, if you come up with a better name, feel free to rename it.
I don't really care that much, (at least not enough to bother changing it), just thought we might want to follow pg's conventions (in so far as those conventions exist).
Excellent submission. Didn't think it was possible to deal with that only through pure HTML... As for length, well, no matter whether it is pure markup language only on client side or not, the point is, to make it work, you had to type n lines of code, and pg's motto is : "the shorter the better"
Ah, touche. However, pg claimed that the length of the program should be measured in terms of the length of its parse tree, not the number of lines of code. In everyone's submissions here, their code is generating one or more webpages in HTML (as, of course, is pg's). The parse tree being measured (at least in pg's original arc example) appears to be that of the server-side language used to do the scripting and generate the HTML and does not include the parse tree of the HTML itself, which is, of course, generated and executed in the client-side webbrowser for everyone's example and shouldn't be counted toward the server-side parse tree.
So then, to sum it all up, I'd have to say that this "program" to meet pg's requirements requires no server-side code (and thus a server-side parse tree of size 0) since it's just being served up as a static page. If you want to count the DOM parse tree length of my HTML/CSS, then you must also count that generated by every other submission here, which essentially adds some constant factor to all the metrics in this forum and thus becomes essentially a non-useful piece of information in comparing the entries.
pg claimed that you don't need to include your template libraries or other magical exotic web framework code. You can just assume it's there, so most folks aren't showing their HTML, and of course, it wouldn't make sense to count it towards their program's parse trees on a tag-by-tag basis since it's likely just a bunch of strings in most of their systems. But hey, like I said, in the end they're all making webpages, and if that's the case then I still think I've got a bit of a headstart on a lot of folks.
Then again, maybe not. What do you folks think? Am I just a big fat cheater or what? prepares to dodge ballistic tomatoes
Does it really matter where the code runs? Or does it just matter who writes it?
In most examples, HTML runs on client machines which may be roughly comparable to your example, but who cares, because the code (whether measured in lines or nodes) the author had to write to generate that HTML was presumably superior in some way compared to writing HTML manually. (Otherwise why not just code straight HTML, all the time?)
In your example, even though the server side code consisted of 0 lines/nodes, the code written by you consisted on an entire HTML page. So did you really save any time or effort in writing the HTML? Maybe, that's why we compare the code trees. But even in that case, the HTML itself will count toward the code tree.
Perhaps this means that HTML templates (not HTML generated by server-side scripts) used in other entries should also be included in their code tree count, if they had to be coded manually by the author. But even if this is the case, it doesn't just add a constant factor to all entries (I believe the arc entry did not require any HTML to be written by the author), and thus is still useful information, although perhaps the two should be considered separately.
P.S. Really liked your submission. I just don't think it counts as 0 lines of code.
Thanks, eds. I think that's a pretty fair judgment, and you're right that it wouldn't be a constant factor because different people are generating different amounts of HTML in the end. My example only has one page, and though it should be valid HTML4, I do include some CSS and div's that other folks wouldn't need. Admittedly, to keep theirs valid, they'd also need a lot more html, head, title, and body tags than me if they're making multiple pages.
The thing that strikes me as being kind of a funny metric here with code length is that if the author wrote the HTML and imported it into their code, you have to count it, but if some other author wrote the HTML and you import it, then you don't have to count it. Seems kind of weird to me, seeing as this opens the door to somebody else saying:
Alright, maybe gjohnson's code count includes all that silly HTML and CSS, but my program uses his HTML template file (which isn't much of a template in this case, of course, being kind of the whole shebang), and has a parse tree of length 1.
Here it is:
<!--#include virtual="gjohnsons_magic.html" -->
Tada! I mean, heck. It's true that pg didn't write the HTML in his arc challenge submission code, but wait a minute! He did write it in his function library when he was defining the language. So being the author of the original HTML, does he have to include it after all?
You're right. That was one of the main objection against this challenge, from what I read on many forums. Well, the really convincing test is to use Arc for real. I wrote a small webapp with Arc and I never wrote such an app so fast. Quite amazing for a language I didn't know.
Point taken. This stuff about parse trees and who-wrote-what is after all just an academic argument. You're absolutely right that it's what we can write and how he enables us to write it in the end that makes this stuff all so interesting.
Anyway, keep going everyone. Those submissions are rockin' on. I've got my mind wrapped around a pretty perversely heinous challenge response that I may get to in the next couple of days. Keep your eyes peeled!
P.S. Did anybody notice that those class="page" attributes are unnecessary in my HTML/CSS code above? Just checking. Looks like I forgot to remove'em before posting.
Oops. You're right. It might not work with different versions of mzscheme.
So I removed arc.arcc from Anarki. Now, arc-exe generates it automatically if it cannot find it on startup. And the -cc flag doesn't write anymore on stdout but directly in file foo.arcc (if you called arc-exe -cc foo.arc).
Your point about date diffs between .arc and .arcc files is also interesting. Python does work this way. I might add it later (if nobody does it before me :)
Thats better. But its a little strange that when you run it the first two times, it compiles the arc.arc and libs.arc instead of starting up, I would expect it to both compile and start up.
I get the following errors when I try to start arc-exe:
C:\User\Programming\Arc\arc-wiki>arc-exe
Use (quit) to quit, (tl) to return here after an interrupt.
arc>
now arc-exe starts properly.
EDIT: Actually, arc-exe doesn't seem to be working properly. I can't access any of the predefined functions:
C:\User\Programming\Arc\arc-wiki>arc-exe
Use (quit) to quit, (tl) to return here after an interrupt.
arc> prn
Error: "reference to undefined identifier: _prn"
arc> (prn "hello world")
Error: "reference to undefined identifier: _prn"
arc> quit
Error: "reference to undefined identifier: _input-history-update"
arc> (quit)
although at least I can quit. This problem doesn't occur with mzscheme -mf as.scm.
This is using Anarki cloned on Wed Feb 27 22:36:04 PST 2008.
The problem ended up being that the definition (xdef 'ref ...) was missing from arc-exe.scm for some reason. Copying it over from ac.scm fixed all the problems I was encountering. Pushed the fix to Anarki.
That would be because I defined ref, and only thought to put it in ac.scm. We should come up with a way of dealing with this. I suppose we could admonish everyone to make changes to both files, but that seems a little annoying and apt to fall victim to forgetfulness.
Would you be willing to take on the responsibility of running "git log ac.scm" periodically and copying stuff over?
Wouldn't it be possible for arc-exe to just (load "ac.scm") somewhere? Admittedly I don't know enough about the mzscheme compilation process to figure out why it won't work that way - something to do with modules not being able to use (load ...), maybe?
No, it's not possible. There are problems with mzscheme's namespaces. I had to fight with them to make arc-exe work, and simply importing ac.scm in an englobing file will just not work.
Hmm. How about a macro which reads in the code from ac.scm and inserts it into a progn form? Would that work?
(defsyntax insert-file-here ()) ; dunno, never figured out scheme macros
(module arc-exe mzscheme
(insert-file-here "ac.scm")
)
Where (insert-file-here "ac.scm") would expand to:
(progn
(provide (all-defined))
...
(define (ac s env)
...)
)
Would putting the defines in (progn ...) work? Sorry, I'm not very good at macros in scheme, never managed to grok hygiene.
The alternative is to have the macros generate the (module ...) code, and insert the code inside the modules of ac.scm and as.scm and what else arc needs.
Basically what I'm proposing is writing a macro which does what you originally did in creating arc-exe.scm. The unfortunate part is that I never managed to grok Scheme macros, otherwise I'd offer to do it for you if you describe how you built arc-exe.scm.
Looks like an excellent proposition. I'm not very good with scheme macros either, however I think mzscheme has an à la Common Lisp define-macro extension. I'll look about that more precisely.
Is it really namespaces that are a problem, or modules?
I hacked together a short version of arc-exe.scm that worked just fine importing from ac.scm. The only problem with that version was that it wasn't a module, and thus couldn't be compiled by mzc. I couldn't make it a module because scheme complained when brackets.scm tried to override read and read-syntax. (Apparently overriding imported bindings only works outside modules.) And when I tried to modify or not include brackets.scm, it would complain that it couldn't find the module ac.
So did you encounter this particular problem or something else? My guess is that if I could make brackets.scm behave, I could make the rest of it fall in line. But maybe I am mistaken about this.
I just read back http://www.paulgraham.com/ilc03.html and found intersting things dealing with what we are talking about (pg doesn't answer, so I'll make hime talk myself ;)
"Letting people rewrite your language is a good idea. You, as the language designer, can't possibly anticipate all the things programmers are going to want to do with it. To the extent they can rewrite the language, you don't have to."
"If you want to overload existing operators to do the right thing when given your new type, you don't need anything new in the core. As long as you have lexical scope, you can just wrap a new definition of the operator around the old one."
" At the conference [pg gave this talk], John McCarthy pointed out that a function to invert a matrix might be better described by writing "inverts a matrix" than by giving the source."
Thanks for your answers ! I think that might be an interesting functionnality to add in the core functions. I used it a few times, in quite different contexts. Partitioning a list from a given criteria looks like a frequent action...
See the parent of that link for other ways to patch. I just used one of the original patches and modified slightly for arc1. For arc2, I justed used ediff in emacs and copied the old date block over.
Instead of patching each release, maybe it would be better to simply redefine the date function in separate file and always load that.
Anarki works on Windows as of yesterday. (I think the solution was to use scheme's date and mkdir functions, which should fix the problem on all platforms.)
I can't blame him. Cutting bloat in the language core is clearly a goal. Nothing should go into the official Arc release unless it has proven its value in real code (which is basically News.YC at the moment).
Sure, he has to keep the control over the things. The point is that a few bug fixes (the mkdir problem for example), simple conveniences (see arc.sh) and even trivial optimisations (arc< to name it) available in anarki are of interest even in the official release. I'm not talking about experimental stuff (infix numeric notation, vectors, standalone exe, maybe docstrings, experimental module systems, ...)
But I think the few fixes and conveniences should really be taken into consideration. I can't believe none of them are of interest.
They probably are of interest, but let's not forget he's running a company in his spare time, and 3 releases in about 3 weeks is a pretty good work rate.
Of course, as someone running Arc in Windows, I'd love it if a bit more stuff worked out of the box (e.g. the blog, which didn't work in Arc1 IIRC). That's why I'm probably going to switch to developing on Anarki and then testing it on vanilla Arc afterwards.
Note that I don't criticize Paul's attitude there. 3 releases in less than a month is much more than what I expected. He didn't release early, but at least he releases often :) I just meant a few things would deserve a little more consideration, at least in the next few weeks/months ?