Arc Forumnew | comments | leaders | submit | CatDancer's commentslogin
2 points by CatDancer 6220 days ago | link | parent | on: Thank you pg and rtm!

Though there is the compensating power of the Internet in that I was able to instantly place a disclaimer at the top of my piece :-)

-----

1 point by CatDancer 6222 days ago | link | parent | on: Last call for Arc bugs

Oh right, now I remember the sticky bit problem! http://arclanguage.org/item?id=2716

. . . .

-----

1 point by CatDancer 6222 days ago | link | parent | on: Last call for Arc bugs

If someone wants to implement this, make-directory* in the file.ss library (http://download.plt-scheme.org/doc/352/html/mzlib/mzlib-Z-H-...) looks like it might do it for you. But I haven't tried it myself (I'm not running Windows either).

-----

5 points by CatDancer 6223 days ago | link | parent | on: Last call for Arc bugs

Aha, I finally realized that with respect to my specific complaint of obj expanding into uses of atomic, there's no need to protect the setting of the values in the table with atomic since the newly created table will not be visible to other threads at least until obj returns. The fix is easy:

   (mac obj args
     (w/uniq g
       `(let ,g (table)
  -       ,@(map (fn ((k v)) `(= (,g ',k) ,v))
  +       ,@(map (fn ((k v)) `(sref ,g ,v ',k))
                 (pair args))
          ,g)))
with this (catch (obj a (throw nil))) now works and there's no danger that doing something like (obj a (readfile "foo")) will hang other threads.

-----

5 points by CatDancer 6222 days ago | link

A third perspective is that the bug isn't in the use of =, but that obj evaluates its value arguments too late.

In a function call

  (f (g) (h))
g and h are evaluated before f is called. A user might expect obj to work the same way for its value arguments (though, as a macro, of course it doesn't have to):

  (obj a (g) b (h))
This expectation can be fulfilled by evaluating the value arguments before storing them in the table. The existing macro could be modified to do that, though perhaps this implementation would be simpler:

  (mac obj args
    `(listtab (list ,@(map (fn ((k v))
                             `(list ',k ,v))
                           (pair args)))))
codetree of the arc2 obj definition => 48 this definition => 36

-----

3 points by CatDancer 6222 days ago | link

If we allow table to take arguments to populate the table...

  -(xdef 'table (lambda () (make-hash-table 'equal)))
  +(xdef 'make-table (lambda () (make-hash-table 'equal)))

  -(set setter (table))
  +(set setter (make-table))

  ;; inserted before "def memo"

  +(def table args
  +  (let h (make-table)
  +    (map (fn ((k v)) (= (h k) v))
  +         (pair args))
  +    h))

  arc> (table 'a 1 'b 2)
  #hash((a . 1) (b . 2))
then the definitions of obj and listtab are simplified:

  (mac obj args
    `(table ,@(mappend (fn ((k v))
                         (list (list 'quote k) v))
                       (pair args))))

  arc> (macex1 '(obj a 1))
  (table (quote a) 1)

  (def listtab (al)
    (apply table (apply + '() al)))
and the value arguments to obj are evaluated early, like a function call, so there are no problems with atomic.

-----

2 points by pg 6221 days ago | link

Thanks, we switched to this definition.

-----

3 points by CatDancer 6221 days ago | link

Wow, it's a pretty good deal for me to get my patches tested by thousands of HN users! ^___^

-----

2 points by CatDancer 6224 days ago | link | parent | on: Last call for Arc bugs

If anyone wants to take on being a distributor for a Windows port (or for different variants of Linux, for that matter), I do have a patch for date here: http://catdancer.github.com/date.html

-----

2 points by eds 6223 days ago | link

Another option is the Anarki stable branch (http://github.com/nex3/arc/commits/stable/), which has most of fixes necessary to make most of Arc work portably on Windows and other OSes. (And, being a bug-fix branch, the amount of other random material is limited.)

-----

4 points by thaddeus 6223 days ago | link

I agree with the option, but I also think these posts will fall off the deep end in about 2 months. By then new members may only discover the option after they've discovered the problem. So we're not really saving new members wasted efforts unless the install page guides people.

T.

-----

2 points by pmarin 6223 days ago | link

Why not to setup some kind of wiki under arcelanguage.org? The Tclers Wiki is a great example. http://wiki.tcl.tk/

-----

1 point by eds 6223 days ago | link

pg: Even if you'd rather not think about supporting Windows portability yourself, providing a link to the Anarki stable branch would help new Windows users. Finding this stuff on the forum after it's fallen off the top couple of pages is not very easy.

-----


Youch! ^__^

I'll add that to my docs.

-----

2 points by CatDancer 6225 days ago | link | parent | on: Request for Bugs

I use rev:accum often enough that I'd use an operator that did that (whether it was called accum or something else).

-----

5 points by pg 6225 days ago | link

Ok, I just changed accum to do the rev.

-----

1 point by thaddeus 6224 days ago | link

thanks. T.

-----

2 points by CatDancer 6227 days ago | link | parent | on: How do I untar the Arc file?

What operating system are you using?

-----

1 point by CatDancer 6227 days ago | link | parent | on: Request for Bugs

One option is to make it illegal to mutate rest arguments.

Currently, in arc.arc, list is defined as

  (def list args args)
so this would need to change if rest arguments couldn't be mutated. (Which would be OK with me, I can't think of a single case where I ever mutated a rest argument).

Another is to hook on the fact that rest arguments are not modified often -- ... they can be converted only when needed

How could this possibly work??

  ((fn args
     (= (cadr args) 'X)
     args)
   'a 'b 'c)
sure, it would be easy for set-cdr! to see that the second pair is immutable and decide to create a new mutable cons. But args is still going to be pointing to the original list of immutable pairs!

As a side benefit it can be used to deal with nil too, which will make that run faster as well.

Can you explain? (I need smaller steps to be able to follow you :-)

(BTW, this will be much faster than using r6rs or r5rs modes.)

Yes, I was getting that impression browsing through the r6rs and r5rs code.

The way I'm leaning right now is to first rewrite the Arc compiler to generate PLT 4 code in the simplest possible way, for example to always convert rest arguments to mutable lists. Then, things like making rest arguments immutable could be done as an optimization if desired.

-----

1 point by elibarzilay 6226 days ago | link

For the "on-demand" conversion some PLT magic will be needed -- I'm basically talking about doing something at the level of the PLT function that is the result of compiling an arc function. In any case, explaining more through this medium will be hard for me...

-----

1 point by CatDancer 6226 days ago | link

Send me an email at cat@catdancer.ws, or use a pastebin and post the link here.

-----

3 points by CatDancer 6227 days ago | link | parent | on: PG's syntax patches pushed to git

I don't know, but the ac.scm source does mention "no error-checking!" :-)

-----

More