Arc Forumnew | comments | leaders | submitlogin
Auto coercing?
5 points by binx 6139 days ago | 4 comments
(annotate 'cons 'x) now makes an object that is different to an actural pair.

Would it be more consistent that in:

(annotate t x)

if t is a built-in type, then it coerce x to the new type t? If it's a good idea, can we find a proper way to eliminate coerce?



6 points by nex3 6139 days ago | link

It would be nice if both annotate and coerce had a shorter name - especially if they were compressed into a single function. Maybe something like "make?" I like how (make "foo" 'cons) reads. If you really wanted to get short, you could do something like "mk" or "to," which would work better with the annotate ordering.

-----

1 point by absz 6138 days ago | link

I liked the "old" name (in http://www.paulgraham.com/ilc03.html) of "tag", but that appears to have gone away so the web library could use it as a name. "make" isn't bad, though.

-----

3 points by bogomipz 6138 days ago | link

This would be great. I suggest naming it "to" or "as";

  arc> (as 'point '(1 . 2))
  #3(tagged point (1 . 2))
  arc> (as 'int "34")
  34
  arc>

-----

3 points by pg 6139 days ago | link

Good idea.

-----