Arc Forumnew | comments | leaders | submitlogin
New Version of Arc (ycombinator.com)
28 points by pg 5685 days ago | 51 comments


15 points by pg 5685 days ago | link

Many thanks to CatDancer and dfranke for prerelease help, and to all the others who pointed out bugs and/or made design suggestions.

Please let me know if there are any conspicuous bugs in the new version.

-----

7 points by rntz 5683 days ago | link

'med doesn't use its optional 'test argument. It is:

    (def med (ns (o test >)) ((sort > ns) (round (/ (len ns) 2))))
It probably should be:

    (def med (ns (o test >)) ((sort test ns) (round (/ (len ns) 2))))

-----

3 points by pg 5683 days ago | link

Oops, yes, that's correct.

-----

8 points by lg 5683 days ago | link

hmm, this bit me... can't use each within an afn because each uses afn internally, and it leaks the 'self binding into the body. I changed it to use an rfn with a uniq name and it works.

-----

5 points by pg 5683 days ago | link

Oops, fixed:

    (mac each (var expr . body)
      (w/uniq (gseq gf gv)
        `(let ,gseq ,expr
           (if (alist ,gseq)
                ((rfn ,gf (,gv)
                   (when (acons ,gv)
                     (let ,var (car ,gv) ,@body)
                     (,gf (cdr ,gv))))
                 ,gseq)
               (isa ,gseq 'table)
                (maptable (fn (,gv ,var) ,@body)
                          ,gseq)
                (for ,gv 0 (- (len ,gseq) 1)
                  (let ,var (,gseq ,gv) ,@body))))))

-----

5 points by jmatt 5681 days ago | link

Are you going to fix this and other small bugs in the tar or are we just going to patch them on the fly? If the plan is to patch maybe we need a thread with patches - so people can get up and running fast.

Personally I think using Anarki is fast, straightforward and community friendly... So that may be my choice in the end when arc3/mz372 has some time to stabilize.

Is there a reason you are avoiding source control?

EDIT: Added the last question.

-----

4 points by shader 5684 days ago | link

Say, would you mind giving us a preliminary change list?

-----

5 points by thaddeus 5684 days ago | link

Here's for hoping the super talented Ken Shirriff will publish a similar write up to his arc2 post.

http://arcfn.com/2008/02/whats-new-in-arc2.html

-----

3 points by pg 5684 days ago | link

I don't have such a list myself. Your best bet is to diff the source files.

-----

4 points by rntz 5684 days ago | link

Here's the diff: http://www.rntz.net/files/arc2to3.patch

Just giving it a preliminary look over, it seems like you changed 'set to 'assign. Any reason for this in particular, pg? It seems like it changes a lot of code, and as 'set is fairly common, it kind of goes against the philosophy of short names for common operators.

-----

2 points by CatDancer 5684 days ago | link

"set" actually wasn't common at all; in arc2 it is used only a handful of times in arc.arc, mostly to implement "=".

-----

2 points by rntz 5684 days ago | link

Eh, when I think about code use, I usually think about anarki — which is probably the problem itself, now that I think about it.

    $ find anarki/ -name '*.arc' -print0 | xargs -0 grep "[(']set[[:space:])]" | wc -l
    180
It's not so many uses that it's impossible to update. Many if not most of these uses could admittedly be replaced with '=, and arguably this was the correct thing to do in the first place. It just seems like an odd decision, and I'm wondering if there's any specific reason for it.

-----

3 points by CatDancer 5684 days ago | link

In my opinion "set" is a better name for what "assert" used to do, and I think "set" was available since it was being used for a low-level operation for which in user code "=" is a better and shorter name.

Also, don't forget http://www.paulgraham.com/arc0.html:

"I worry about releasing it, because I don't want there to be forces pushing the language to stop changing. Once you release something and people start to build stuff on top of it, you start to feel you shouldn't change things. So we're giving notice in advance that we're going to keep acting as if we were the only users. We'll change stuff without thinking about what it might break, and we won't even keep track of the changes."

-----

5 points by anarcer 5684 days ago | link

MzScheme v4.1.5 $ mzscheme -f as.scm ac.scm:1164:19: compile: unbound identifier in module in: set-car!

-----

8 points by pg 5684 days ago | link

Oops, should have mentioned you have to use MzScheme v372.

Arc has mutable conses, so it would have been hard to make it work with versions of MzScheme after they switched to making lists immutable.

-----

3 points by w8lvn 5682 days ago | link

Install doc at top of arclanguage.org says to use 352, turns out to be issue with 64 bit systems.

-----

3 points by pg 5682 days ago | link

Use 352 with arc2.tar (the old, stable release), 372 with arc3.tar (the latest release, still being fixed).

-----

1 point by w8lvn 5682 days ago | link

Trying arc for the first time. Unable to get version 372 on my 64 bit systems.

Any way to get this to work with a later version of mzscheme?

-----

2 points by CatDancer 5682 days ago | link

How about http://download.plt-scheme.org/drscheme/plt-372-bin-x86_64-l... ?

Sadly Arc hasn't been ported to mzscheme version 4 yet.

-----

1 point by w8lvn 5682 days ago | link

Ach.

Thanks. For some reason was trying 352.

Thanks.

-----

1 point by anarcer 5684 days ago | link

ya, it works, all ok for now... nice...

-----

1 point by thaddeus 5684 days ago | link

in news.arc

    (def load-items ()
      (system (+ "rm " storydir* "*.tmp"))
; errors when there are no .tmp files. not a biggie since it still goes on.

rm: .../news/story/*.tmp: No such file or directory

Still working on it but so far the newsforum only displays when I am logged in. otherwise it's blank.

-----

1 point by pg 5684 days ago | link

Yeah, I didn't try to suppress error messages because I'm curious how often it actually finds something.

When you say blank, do you mean completely blank, or just no stories? Because caching means that stories take a minute to show up to nonlogged-in users.

-----

1 point by thaddeus 5684 days ago | link

Re-installed. Works fine. I will look at further, but all is good so far. Thanks, T.

-----

2 points by thaddeus 5684 days ago | link

Ok now it's not my environment. I have made no changes just the arc3 files and mzscheme372.

* I have only 3 posts and 3 comments, if I log in as admin and keep hitting the comments link - not crazily like, but right after the page load completes - about the 10th time or so the hyperlinks change format then the whole forum get locked and goes blank.

I am using mac osx.

After about an hour I'm getting the impression the forum is glitchy. There's just a bunch of quirky behavior like the above (pages are slower to load - page painting is noticeable.... etc etc)

Not like the old arc2 forum on the same machine.

T.

-----

3 points by pg 5684 days ago | link

You're probably setting off the code that protects against overly aggressive clients. See abusive-ip in srv.arc.

Try restarting Arc and evaluating this expression

    (def abusive-ip (x) nil)
before starting up News, and see if you still have a problem.

This will show you requests that have been ignored, by ip address:

http://localhost:8080/spurned

-----

2 points by thaddeus 5684 days ago | link

LoL. And here I was thinking I was helping by doing a little bit of stress testing :)

That fixed it. T.

-----

1 point by thaddeus 5684 days ago | link

stopped; rebooted. this time without even logging in - on the 4rth time clicking the comments link - it froze up.

-----

2 points by shader 5684 days ago | link

How hard do you think it's going to be to integrate the changes with Anarki? Is it even worth it?

-----

2 points by rntz 5684 days ago | link

I've already pushed arc3.tar to anarki's "official" branch and merged the changes into "stable". Merging them into the master branch may prove more difficult and tedious, but I think it can be done.

-----

1 point by CatDancer 5684 days ago | link

Hmm, as an interim step you could make a macro called "set" which you loaded after Arc and before Anarki. That way you could try out Anarki with arc3 and get things working before going on to do all the tedious renaming.

-----

1 point by rntz 5684 days ago | link

The trouble is, I wouldn't know where to start with testing anarki as a whole. There's just too many different parts, because anarki has so many things:

- Forks and compilers (arc2c, arc-f)

- Pet projects and examples (LightMakesRight, wiki-arc)

- Utility libraries (lib/util, defpat, settable-fn)

- Extensions to arc (help strings, function signatures, compilation)

- Bugfixes to arc (making 'atomic work even on exception throw)

I think I can probably update the latter three, but the former will just have to rely on whoever contributed them. Perhaps it's time for a new anarki - throw out the unmaintained cruft and try and separate changes to core arc functionality (bugfixes, extensions) from additions/libraries from standalone projects.

-----

2 points by thaddeus 5684 days ago | link

I don't know why you would want to.

From my cursory look, pg has fixed many if not most of the core issues that anarki resolved. (ie cut fn not handling -1, providing a static directory for files to be published, added some basic math functions - sin cos etc..).

I would suggest starting a new branch with arc3 and if the libraries from anarki are still relevant then people will incrementally add them. This way were not integrating a bunch of code just because it's there - even though it's no longer useful.

+ just because you make them work with core arc3 files doesn't mean there will not be conflicts - as example the int function in the anarki math.arc library conflicts with news.arc only (as pg added an int function).

T.

-----

1 point by rntz 5683 days ago | link

Some of the things anarki adds that are not in arc3 are tremendously useful. For example, help strings and the 'help macro to access them, and similarly, the ability to call up any function or macro's source with 'src.

I do think the idea of integrating anarki code incrementally is probably the right way to do it. To this end, I've forked anarki's "official" branch (http://github.com/rntz/arc), and I've been applying CatDancer's "minimum-distance-from-arc" patching philosophy (http://catdancer.github.com/sharing-hacks.html). We'll see how many things from anarki I end up converting this way.

-----

1 point by shader 5679 days ago | link

When you're done with you're patching process (I wouldn't mind helping) we should probably merge it back into nex3's copy, as his has public commit access.

-----

2 points by CatDancer 5684 days ago | link

One approach is to only port over things that you personally use and care about; and let other people port over things they care about. That's a pretty good filter for separating out the important from the unimportant.

-----

1 point by kens 5674 days ago | link

In srv.arc, the timed-aform2 function seems entirely useless; it's timed-aform with an extra unused argument.

-----

1 point by pg 5659 days ago | link

Ok, it's gone.

-----

1 point by antiismist 5684 days ago | link

That's great, I'll check it out. On http://www.arclanguage.org/install it still references mzscheme version 352.

-----

3 points by zck 5684 days ago | link

It still says to get arc2.tar; they haven't updated the page yet. Maybe it's because pg says, on Hacker news (http://news.ycombinator.com/item?id=634113) that it's a "preliminary release".

-----

1 point by pg 5684 days ago | link

I wanted to give people using Arc a little time to try this out. If there are no disastrous bugs I'll switch over in a day or so.

-----

2 points by projectcloud 5684 days ago | link

How much of CatDancer's hacks made it in? He's got some great stuff... oh well, I guess I'll read the code. :) Thanks for the release.

-----

2 points by CatDancer 5684 days ago | link

I'll be posting my hacks to arc3 in a day or two ^_^

-----

1 point by venizio 5684 days ago | link

a bit surprised there isn't a sync call in writefile before the rename. how come? if there is data in user space buffer (there's no fflush) and the rename gets committed it could lead to corruption if the process crashes. maybe?

-----

1 point by CatDancer 5684 days ago | link

The data will be flushed when the file is closed, which happens before the rename. This means that the mzscheme process can be hard killed (kill -9) or can crash right after the rename, and the data will still be saved safely by the operating system.

sync, now, is completely different issue: that's for when you want to crash your operating system or power off your computer and have had your data physically written out to disk already. I've heard it said (though I don't know if this is true) that sync will really slow down your write performance, unless you carefully use a complicated technique such as first writing your updates to a journal log file (which can be replayed if your computer crashes) and then writing those changes to their permanent location (file or database tables).

-----

1 point by venizio 5684 days ago | link

hello,

i was missing the flush upon close. so for instance in this scenario:

1. write

2. close (flush happens, buffers sit on kernel space but not disk)

3. rename

4. a soft-update commit happens so the rename is already out on disk.

5. process crashes

the big question is then: will the os then eventually sync the data flushed in step 2? even after a process crash? i would think yes, but not sure.

an os crash at this point will probably just zero the file out. http://www.freebsd.org/doc/en/books/handbook/configtuning-di... (11.12.2.1)

i get your point regarding performance. arc does it right. it basically leverages file system magic to sync asynchronously at the (small) risk of zeroing out files on an os crash or power failure.

thanks.

-----

1 point by CatDancer 5684 days ago | link

Yes, once the operating system has the data it will write it out to disk, regardless of what happens to the process.

-----

1 point by venizio 5684 days ago | link

out of curiosity, do you know what is the backup policy? thanks @CatDancer.

-----

1 point by CatDancer 5684 days ago | link

the backup policy? of what?

-----

[deleted]
1 point by CatDancer 5684 days ago | link

Is your question, "how do I back up my data files written by my Arc program?"

In Unix, rename is an atomic operation in the kernel. Renaming a file does not immediately delete the old contents of the file, instead, the old contents are deleted when no process no longer has the file open.

Say you have some file "data" which contains "foo". You have some process B such as tar or rsync which is reading your files to back them up. Meanwhile Arc is writing "bar" to "data".

B opens "data" for reading.

Arc creates "data.tmp" and writes "bar" to it. Then Arc renames "data.tmp" to "data".

A process which now opened "data" would read "bar" from it. However B is still reading the previous version of the file, and so reads "foo".

Thus the backup process will always read either the complete previous version of the file, or the complete next version of the file.

(Whether or not the data has already been physically written out to disk makes no difference to what the processes see).

-----

1 point by kailoa2 5684 days ago | link

I just wrote up some detailed install instructions for myself yesterday and you go and do this.

:)

I'll update and share after checking this out. (First time arc'er here).

-----