Arc Forumnew | comments | leaders | submit | kens's commentslogin
2 points by kens 6477 days ago | link | parent | on: Macros: Arc internals part 2

I appreciate the nitpick; I've changed the text to be clearer. (In general, I welcome feedback on how to improve the docs, especially if I'm blatantly wrong about anything.)

-----


I'm hoping that some day internet forums will have the functionality of Usenet c. 1985.

In particular, the system should keep track of which messages I've read, and just show me new messages.

-----

7 points by kens 6479 days ago | link | parent | on: Defcall

I've been thinking that the Scheme code (ac.scm) should be split in two parts: an "axiomatic" part that defines car, cdr, set, annotate, etc; and a "library" part. The "library" part would define OS stuff like current-gc-milliseconds, open-socket, probably atomic-invoke, etc. There would probably be a "math" library that defines exp, sqrt, and all the missing math functions.

This structure would make it clear what parts of the language are really axioms, and what parts are in Scheme for performance, convenience, or because they are OS things that require low-level hooks.

-----

3 points by sacado 6478 days ago | link

"in Scheme for performance" : in never thought I would ever read that sentence :) (You're right, by the way)

-----

1 point by CatDancer 6479 days ago | link

Being able to call out to MzScheme from Arc would be cool. Then all the "library" parts could be written in Arc.

  (def file-exists (name)
    (scheme-istrue ((scheme-fn file-exists?) name)))
Here "scheme-fn" is a macro that returns an Arc function that calls the named Scheme function, but still expects to be passed Scheme values and returns a Scheme value. Then various functions such as "scheme-istrue" can be used to convert Arc values to Scheme values and back again.

-----

5 points by kens 6479 days ago | link

Anarki provides the $ operator, which allows callout to MzScheme.

I've been thinking that support for a foreign function interface such as SWIG would also be good.

-----

6 points by nex3 6479 days ago | link

Anarki has a macro, $, for just this. In general, I've taken to using $ for what kens refers to as the "library" part. Note, for example, files.arc.

-----

1 point by CatDancer 6479 days ago | link

Very nice!

-----

4 points by kens 6480 days ago | link | parent | on: Arc's templates: documentation

Any suggestions on what you'd like to see documented next?

-----

3 points by almkglor 6479 days ago | link

The docstring system, so that hopefully it becomes reasonably standard?

-----

3 points by eds 6479 days ago | link

You never got around to Arc Internals, Part 2. I would be interested in seeing that done.

-----

2 points by zin 6479 days ago | link

Yes, Arc Internals, Part 2.

-----

1 point by CatDancer 6479 days ago | link

Have you documented zap yet? That would be helpful to me.

-----

2 points by kens 6480 days ago | link | parent | on: Arc2.tar

It looks like "on" is broken for tables. I'd expect "on" to get the values, like "each", rather than nil.

  arc> (each x (obj k1 'v1 k2 'v2) (prn x))
  v1
  v2

  arc> (on x (obj k1 'v1 k2 'v2) (prn index " " x))
  0 nil
  1 nil

-----

1 point by Jesin 6451 days ago | link

I think that's because on works like this:

  (for index 0 (- len.foo 1) ...)
Because the hash table you used didn't have any entries for 0 or 1, it gave nil.

  arc> (= a (table))
  #hash()
  arc> a!foo
  nil
  arc> (= a!foo 'bar)
  bar
  arc> a!foo
  bar
  arc> a.0
  nil

-----

5 points by kens 6480 days ago | link | parent | on: Ask PG : are they axioms or core functions ?

I think the redef macro is in the Anarki version, not official Arc

As an aside, has Paul Graham shown any enthusiasm for the Anarki changes?

-----

5 points by sacado 6480 days ago | link

"As an aside, has Paul Graham shown any enthusiasm for the Anarki changes?"

Obviously not.

-----

3 points by cchooper 6480 days ago | link

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).

-----

6 points by sacado 6480 days ago | link

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.

-----

2 points by cchooper 6480 days ago | link

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.

-----

3 points by sacado 6480 days ago | link

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 ?

-----

3 points by cchooper 6480 days ago | link

I'm hoping things will speed up now that the News.YC code is in.

-----

2 points by jbert 6479 days ago | link

You might increase the chances of stuff getting merged back into PG's arc if you separate the different types of changes into different git branches.

That reduces the burden of code review/merging/demerging on the person you'd like to pull the changes (PG).

e.g. have a bugfix branch containing only "obvious" fixes.

It can be difficult to disentangle a bunch of different changes (what depends on what). That's a barrier to adoption.

-----

3 points by byronsalty 6480 days ago | link

Somebody is reading my mind.

-----

1 point by absz 6480 days ago | link

So it is. Thanks.

That's a good question--I'm not really sure, since I just use the Anarki.

-----


I'm trying to write some Arc documentation, and the lack of consistency and orthogonality is rather vexing.

For instance, there's no (char "a") to create a character. (string "a" 'b #\c 1) combines all those into a string, but (sym "a" "b") doesn't work. There's also newstring to create a string.

(table) creates an empty table, not a table of its arguments. If you want to convert arguments into a table, you use the inexplicably named "obj". The positive function works on any random type (string, table, whatever) except for a complex number. And coerce pseudo-succeeds for some things: (coerce (table) 'int) returns a table.

And don't get me started on operations that work on lists, vs operations that work on lists or strings, vs operations that work on lists, strings, or tables - it seems pretty random.

-----

1 point by cooldude127 6480 days ago | link

table does make a table out of it's arguments:

  arc> (table 'a 'b 'c 'd)
  #hash((c . d) (a . b))

-----

3 points by almkglor 6480 days ago | link

^^ LOL, I modified that ^^. Didn't want to use (obj ...) because (obj ...) was a macro, and I might want to do things in a function-form.

-----

2 points by kens 6480 days ago | link

Is this the Anarki version? The official version of table takes no arguments.

-----

5 points by cooldude127 6480 days ago | link

yes it is. i didn't realize that table was different in anarki. well, there is always listtab, but seriously, table should work like the anarki version.

-----

1 point by CatDancer 6480 days ago | link

Fixing bugs instead of documenting them is probably better.

-----

6 points by byronsalty 6480 days ago | link

This what is broken in Arc right now - essentially we can't fix anything of this scale (or arguably anything non-trivial). If we do there will be merge nightmares when PG releases the next official version (and every subsequent release). All we can do is mention problems on the forum and hope he notices and changes things in the next official release.

I believe this would be solved if we shared a repository system (git) with PG in which we could sumbit patches which he would hopefully approve and merge in. Or not approve. Or delegate the sifting out the good patches to someone who knows what they're doing / shares the proper vision of arc.

Honestly this is very disheartening.

-----

5 points by cchooper 6480 days ago | link

I don't think that would fix it, as PG would probably refuse most of the patches anyway. It's not like this forum has a lot of traffic. Patches are unlikely to get lost in the flood (12 articles in the last 24 hours, and PG last commented 18 hours ago).

The two ways to get changes into Arc, as far as I can see, are to find a bug or write some real-world code that proves your suggestion is a good one. With so little real-world code around, that means very few changes will make it.

On the other hand, the last release was all about merging News.YC so there's no surprise that it lacks new features. Who knows, perhaps the next one will incorporate half the stuff from Anarki? We have very few data points from which to draw a conclusion.

-----

3 points by projectileboy 6479 days ago | link

Don't be disheartened, brother. It seems to me Mr. Graham gave us all a first cut to get exactly this kind of feedback, but the core language isn't yet fully baked, and so we should acknowledge that we're at the very beginning of a long journey. I'd be surprised if Linus Torvalds was merging in kernel patches from anyone besides himself in 1992.

-----


Thanks; I've updated my blog posting.

-----

6 points by kens 6482 days ago | link | parent | on: Arc omptimization, again

When I looked at benchmarking earlier (http://arclanguage.org/item?id=2455) I discovered that the performance hits were very different from what I was expecting. (I.e. in my case, it wasn't the function call overhead, but the < operator of all things.) My point is that if you optimize Arc, make sure you measure carefully, rather than assume you know where the performance goes. (I also found that performance is one of those things you're not supposed to discuss, a la http://www.paulgraham.com/say.html)

In my brief examination of the Arc internals, I didn't see any obvious optimizations. The ac-niltree/ac-denil stuff seems like there should be a better way. The conversion between nil and #f (e.g. ar-false? in your code above) seems like excessive overhead. But I don't see any better alternative.

-----


Am I the only person who keeps trying to use t as a variable name? It's the perfect name for a temporary, a table, a test value, ...

-----

2 points by kennytilton 6483 days ago | link

I have to be coding pretty fast and furious in CL but it has happened a few times over the years. Nice warning or error (I forget) from the compiler, tho.

-----

1 point by cooldude127 6483 days ago | link

also the perfect name for a true value :D

but yeah, i've done that in my CL code before. so annoying.

-----

More