Arc Forumnew | comments | leaders | submit | kens's commentslogin
2 points by kens 6494 days ago | link | parent | on: New version

pipe-from is (still?) broken on Windows since it uses /dev/urandom. Maybe use make-temporary-file instead? (pipe-from is not really a pipe; it directs command output into a file, and then reads from the file; having a real pipe would be nice. Also, it does a rm -f, which isn't too good on Windows either.)

-----

5 points by kens 6495 days ago | link | parent | on: New version

I'd expect that "abc".1 would return #\b?

-----

5 points by pg 6494 days ago | link

No, it would read as two separate things, a string and the number .1; symbol-syntax has lower "precedence" than Lisp read.

-----

4 points by sjs 6494 days ago | link

  arc> (= s "abc")
  "abc"
  arc> s.1
  #\b

-----

1 point by kens 6495 days ago | link | parent | on: Bug converting a procedure to string

According to the spec :-), coerce returns unchanged anything that is not tagged, char, integer, number, string, pair, nil, or symbol:

  arc> (coerce (table) 'potato)
  #hash()
Except for arguments of unexpected types (e.g. thread); then coerce fails.

-----

4 points by kens 6495 days ago | link | parent | on: Stupid noob question

I think the lack of good debugging support eliminates the current version of Arc as a teaching language. DrScheme is probably a reasonable choice; it's built on MzScheme. http://www.plt-scheme.org/software/drscheme/

-----

1 point by kennytilton 6495 days ago | link

Do either of those support CL-style defmacro?

-----

1 point by Jekyll 6495 days ago | link

Dr Scheme does. Fire it up, click language then choose language. Pick "pretty big", then (define-macro ...) will do pretty much what you expect. http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-...

-----

1 point by mec 6495 days ago | link

Side question here, is there a keybinding anywhere in DrScheme to close all open parentheses? It's driving me crazy trying to find it.

-----

1 point by danielprager 6494 days ago | link

Dunno, but the '[' and ']' keys in DrScheme are clever enough to give you '(' and ')' when you need them (and '[' and ']' at other times).

Since discovering this I just keep tapping ']' until the highlighting tells me I'm done.

-----

1 point by kens 6495 days ago | link | parent | on: prn drops quotes on string?

One more output question:

  arc> (= x '`(a ,b ,@c))
  (quasiquote (a (unquote b) (unquote-splicing c)))
How can I print x in its original short form, rather than expanded out (as prn does)? Is there an easy function I'm missing, or do I need to write my own?

-----

1 point by kens 6496 days ago | link | parent | on: prn drops quotes on string?

Thanks; I didn't see "write".

A couple more problems:

  arc> (= x (thread (fn () nil)))
  #<thread>
  arc> (prn x)
  #<thread>Error: "Type: unknown type #<thread>"
  arc> (prn (exact 1))
  #tError: "Type: unknown type #t"
  
It looks like the Scheme types are leaking through, breaking things that use them, not just prn.

-----


I noticed that colon syntax is broken when used with strings-as-functions:

  arc> (pr:"abc" 2)
  Error: "car: expects argument of type <pair>; given ()"
I was expecting that to work the same as (pr ("abc" 2))

-----

5 points by sjs 6496 days ago | link

Indeed, and it does when you call compose directly. The good news is that if you name the string it works as expected.

  arc> (= s "abc")
  "abc"
  arc> (prn:s 1)
  b
  #\b
The reader splits expressions such as (prn:"foo":[idfn _] 2) into (prn: "foo" : (make-br-fn (idfn _) 2). You could check for trailing : in the car or a leading : in the cadr, and if found then wrap strings and tables in id fns. Stash them (as well as literal fns and make-br-fns) under a uniq name. Finally, add the uniq name to the end of the head symbol and repeat if necessary. This would be done before expand-ssyntax. I'm not sure it's worth the effort.

I think the final result would be very cool, mostly to allow things like (prn:[_ 3] "hello").

-----

2 points by drcode 6496 days ago | link

Yeah, the colon operator has many limitations, I've noticed... I haven't been able to get it to work for any case that doesn't involve simple symbol names for functions...

-----

2 points by kens 6497 days ago | link | parent | on: f~g hangs

A bug that causes a core dump(!):

  arc> (= x '(1 2)) 
  arc> (sref x x 1)
    GC Warning: Out of Memory!  Returning NIL!
  ./arc.sh: line 16: 13045 Segmentation fault      $mzscheme -m -d "$arc_dir/as.scm"
I was expecting to create a circular list. (This is unrelated to my earlier bug, but I figure no point starting a new thread.)

-----

1 point by absz 6497 days ago | link

I tried it on my machine, and got the same error (well, I ^Ced out before it finished, but it was the same thing). However, the segfault isn't in the creation--it's in the display. Observe:

  arc> (= x '(1 2))
  (1 2)
  arc> (do (sref x x 1) t)
  t
Of course, this makes it difficult to test if there is a bug somewhere...

-----

2 points by pg 6497 days ago | link

Ok, will look into it.

-----

11 points by kens 6500 days ago | link | parent | on: First Priority: Core Language

What gets defined as the "axioms" of Arc? One way to think about it is that ac.scm provides the axioms, and arc.arc builds the language out of them. But ac.scm defines about 87 functions, which seems like a large axiom set.

The ac.scm functions range from primitives such as "car" to OS library operations such as "client-ip" to scaffolding operations such as "annotate" and "ccc". (By scaffolding, I mean that annotate and ccc seem to be there only to support mac and point, which seem like the "real" axioms. Am I right about this? Is mac just something built out of the axiom annotate, or is annotate just something to suport the axiom mac?) And why is rand implemented but not cosine?

If one is building an axiomatic language, there's a big gap between the seven axioms of Lisp described in http://www.paulgraham.com/ilc03.html and the 87 functions of ac.scm. (These seven basic words of Lisp inexplicably makes me think of George Carlin's seven words you can't say on TV; one could build a Lisp-like language "carlin" using his seven words as the primitives. But I digress.) For instance, cons seems much more fundamental than current-gc-milliseconds or break-thread.

The (cool) JavaScript port omits lots of things (e.g. thread), but still seems to have the "Arc nature". This would suggest that there's a thinner Arc trying to escape from the existing Arc. Going the opposite direction, there's the demand for a full-functioned Arc.

It seems to me that there are at least 4 different Arcs: there's Arc the 100-year language, Arc the exploration of axiomatic programming language theory, Arc the powerful Web 1.5 framework, and Arc the language for exploratory programming. It's not obvious to me that these are all the same, or should have the same axioms.

Am I going down the wrong path considering ac.scm to be axioms and arc.arc the language implemented from the axioms? Are some things in arc.arc axioms and some things in ac.scm just optimizations? What parts of Arc count as axioms?

-----

7 points by kens 6500 days ago | link | parent | on: Fix: UFT-8 in app server

Not indicating the encoding leaves you vulnerable to an XSS attack. For instance, the following looks harmless, but if you don't set the encoding explicitly it can get executed if your browser is set to UTF-7, or auto-detects to UTF-7:

+ADw-script+AD4-alert('XSS')+ADw-/script+AD4-

Edit to add some explanation: if displayed as UTF-7, the above will pop up a "XSS" alert box. It's just an example; it doesn't actually do anything bad but it shows the potential for malicious XSS. A key point is that HTML-escaping your output or filtering out HTML tags isn't enough, since innocuous-looking characters can cause problems if the encoding is misinterpreted.

-----

More