Arc Forumnew | comments | leaders | submitlogin
Jarc 17 and Rainbow rapid-fire bug report
3 points by rocketnia 4994 days ago | 11 comments
Both Jarc 17 and Rainbow think the name of '|.| is "|.|" rather than ".", both choke on 'peekc, both seem to have 'w/appendfile overwrite the file, neither raises errors of type 'exception, and neither lets me use '~ and '~~ instead of 'no and '~no.

Rainbow's 'writec returns nil rather than the character written, and Jarc's 'pr and 'prn do that as well, although I really don't mind in cases where it's a conscious design choice.

Jarc's 'on-err treats escape continuations as errors, and even though Jarc supports (let (x (y)) z ...), it can't handle (let ((x) y) z ...).

Rainbow chokes on (stdin) and considers (string '("")) to be "\"\"" rather than "".

Happy hair-pulling. ^_^ I'll gladly elaborate or write tests if you want me to.



2 points by rocketnia 4978 days ago | link

I've found a few more bugs.

- Jarc doesn't support coercion from 'sym to 'int.

- Jarc's 'readc returns a spurious -1 character rather than the given end-of-file value. This has further consequences, like causing (readline:instring "") and (prf "anything") to go into infinite loops.

- Rainbow doesn't support 'macex1.

- Rainbow doesn't accept the syntax [].

- Rainbow chokes on (after (err "ignored") errsafe!ignored). In general, it's frustrating to do anything nontrivial with 'after (or 'protect), because an 'on-err anywhere in the "finally" call tree will mess things up.

- Rainbow raises an error when 'rep is called with an untagged argument.

- Both Rainbow and Jarc 17 handle (annotate 'a (annotate 'b 'c)) so that it's distinct from (annotate 'a 'c). Actually, the official Arc behavior is what caught me by surprise here, and I've ended up using the workaround (annotate 'a (list:annotate 'b 'c)) with my own tagged types, but maybe this tag-collapsing behavior is something you'd like to emulate anyway.

-----

1 point by conanite 4945 days ago | link

(stdin) and (string '("")) are fixed now in rainbow, as well as 'writec returning nil. Other bugs ... are noted ...

What is the issue with [] in rainbow? This works:

  arc> ([* _ 2] 3)
  6
Do you have an example?

I added macex1 as an arc fn (it's a builtin in arc3) -

  (def macex1 (expr)
    (let macro car.expr
      (if (and (isa macro 'sym)
               (bound macro)
               (isa (eval macro) 'mac))
        (let mac-impl (rep:eval macro)
          (apply mac-impl cdr.expr))
        expr)))

-----

2 points by rocketnia 4944 days ago | link

What is the issue with [] in rainbow? ... Do you have an example?

I think you'll find it's a very simple example. :-p

  arc> []
  rainbow.parser.ParseException: Encountered "]" at line 1, column 2.
As for 'macex1, there's definitely one inconsistency, which is that it doesn't work unless car.expr works. I also briefly worried about ssyntax, but I'm not sure it's a problem; official Arc lets (assign a.b nil) cause (bound 'a.b) to be true, but I don't blame Rainbow for not emulating that.

-----

1 point by conanite 4944 days ago | link

aha ... fixed []. Changed a "+" to a "*" to allow empty bodies ...

-----

1 point by rocketnia 4948 days ago | link

- Jarc doesn't support coercion from 'sym to 'int.

I don't remember what I meant by this. Official Arc doesn't support this either. XD

I must have done some test that behaved one way on official Arc 3.1, Anarki, and Rainbow and a different way on Jarc (17), but I guess I discarded too many necessary details here.

-----

1 point by rocketnia 4975 days ago | link

- Both Rainbow and Jarc 17 handle (annotate 'a (annotate 'b 'c)) so that it's distinct from (annotate 'a 'c).

Whoops, official Arc does that too. I should have given the examples (annotate 'a (annotate 'a 'b)) and (annotate 'sym 'b); official Arc's 'annotate doesn't wrap the value if it's already of the given type.

-----

1 point by conanite 4944 days ago | link

fixed

-----

2 points by rocketnia 4954 days ago | link

I finally tried out Rainbow's profiler a bit. Awesome!

Of course, since I'm commenting here, it's because I found a bug. Rainbow's profiler chokes on function calls in optional arguments:

  arc> (profiler ((fn ((o x (do 1 2 3))) x)))  ; good
  3
  arc> (profiler ((fn ((o x [list])) x.0)))    ; good
  nil
  arc> (profiler ((fn ((o x (list))) x)))      ; not good
  Message    : Unhandled exception on thread#0: Unhandled exception on thread#0: null
  (...big stack trace...)
Also, the (system "open ...") call that opens the browser to the generated report page doesn't work on my current system (Windows XP without Cygwin). I was able to get around that by replacing it with a call to java.awt.Desktop.open(). ^_^

-----

1 point by conanite 4945 days ago | link

Cool, I'm glad you like it! Bugs noted ...

-----

2 points by rocketnia 4965 days ago | link

I don't remember if I've brought this up before, but in Jarc, (catch:list:point ignored throw.nil) returns (nil) instead of nil. This means we can't really use escape continuations in a library function if the (catch ...) form surrounds a call to a parameter, 'cause doing that changes the effective behavior of the function when the library user is also using escape continuations.

That said, please don't fix this unless you also change 'on-err so that it doesn't catch escape continuations. I'm currently using this bug to work around that one, by re-throwing caught escape continuations with a (catch.throw value.the-error) idiom. :-p

-----

1 point by rocketnia 4960 days ago | link

Hmm...

  Jarc> (type:car:keys:obj (a) 1)
  java.lang.String
I suppose this inconsistency (if not bug) will have been smoothed out as a side effect if you ever end up fully supporting (def racket-equal? (a b) (.a:copy (obj) b t)). ^_-

As a general workaround guideline, I only use symbols as keys, 'cause I expect unexpected behavior like this if I don't. This case was an exception, but the workaround was still really easy, so don't worry about me too much. :-p

-----