123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- (post
- :title "Introducing Arguile: a terse, hygenic lisp"
- :date (make-date* 2016 11 9)
- :tags '("arguile" "guile" "arc" "scheme" "lisp")
- (h3 [Update])
- (p [
- It's been a while since my last post! In the meantime, I've been
- monkeying around with two great lisps: Arc and Guile, and am combining
- them into a new dialect, Arguile. Right now, the code base is still
- highly experimental, but I'd like to explain my though process and why
- I think it's needed.
- ])
- (h3 [Specification])
- (ul
- (li
- (h4 [Terse])
- (p [
- This one I hadn't though of much until investigating Arc, but it
- seems obvious now. Lisp, and in particular the committee ratified
- lisp Scheme, favors explicitness over simplicity. Even after just
- replacing define with def,
- define-syntax with mac, and lambda with fn, I was saving an enormous
- number of keystrokes. In addition, macros often overuse parens.
- This is particularly noticeable with the let macro, where we go
- from])
- (code-block-scheme
- (car
- [(let ((a 1) a)) to (let a 1 a)
- (let ((a 1) (b 2)) (+ a b)) to (with (a 1 b 2) (+ a b))])))
- (li
- (h4 [Hygienic])
- (p [
- Hygienic macros are probably the main reason why I wasn't satisfied
- with Arc, and why I chose Arguile to be more Scheme oriented, than CL
- oriented. While I am not enough of a macro guru to refute Doug Hoyte
- in his book, Let Over Lambda, that CL macros are more
- intuitive and powerful BECAUSE they are unhygenic, I do love
- scheme's syntax pattern matching, and I have yet to see a CL macro feature
- that can't be constructed in a hygienic system. Once I learn
- more, though, an un-hygenic macro system could be added.
- ]))
- (li
- (h4 [Generic])
- (p [
- Generics are supported in Arc, and handles type coercion quite well.
- However, I believe they should have incorporated CLOS
- (common lisp object system) to make the system more extensible.
- Arguile follows Arc's type coercion approach, but also integrates it with
- GOOPS, Guiles object system. For those who don't like generics, the type
- specific functions are also exposed.]))
- (li
- (h4 [Data Structures])
- (p [
- Data structure manipulation in Scheme is extremely verbose, and IMO,
- its greatest weak point.
- Other languages, like Arc and Clojure combat this by allowing
- data-structures to be applicable, meaning they
- can be put in the function position:])
- (code-block-scheme (car
- [(vector-ref vec 1) becomes (vec 1)
- (vector-set! vec 0 (vector-ref vec 1)) is now (vec 0 (vec 1))]))
- (p [
- The issue I found with Arc, however, is that 1.
- there is no standard way to define new data types, and 2. new data types
- cannot easily become applicable. In Arguile, new data types follow Scheme's
- standardized define-record-type, but can be made applicable, and are easier to write.
- Compare])
- (code-block-scheme
- (car [
- (define-record-type mydata
- (make-mydata a b) mydata?
- (a my-data-a)
- (b my-data-b))]))
-
- (p [with])
- (code-block-scheme
- (car [(data mydata a b)]))
- (p [Although not yet implemented, Arguile will
- support algebraic data-types, like Haskell:])
- (code-block-scheme
- (car
- [(data mylist (mycons a b)
- (mynull))])))
- (li
- (h4 [Compatible])
- (p [Fragmentation is a problem in Scheme. Arc continues this tradition by redefining
- many of the core functions and by not inter-oping with rnrs code. This has some
- severe drawbacks. By defining an
- entirely different evaluation scheme, it misses out on all the great features
- developed in its parent language, Racket, which is why you won't see a native
- module system in Arc. Rebuilding one only requires wasteful re-implementation.
- Arguile's approach is to be a thin wrapper on top of Guile. This means
- that not only does Arguile
- get all of Guile's features for free, but Guile can run anything built in Arguile.
- Most Arguile features can be developed with macros, but when Guile itself must be
- modified, care is taken to add features that Guile could also benefit from. Never will we purposely break Guile code to add a feature.])))
- (h3 [Conclusion])
- (p [I really do think Arguile is needed. We need a modern lisp, one that is
- as powerful as any other, as terse as Arc, and as hackable as Python.]))
|