Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Ruby thread

Name: Anonymous 2013-08-06 1:50

What are the good and bad things about Ruby, in your opinion?

Name: Anonymous 2013-08-16 15:35

>>7
lol, 'with' is a keyword in python.


(defmacro define-with-macro (name allocate-func cleanup-func)
  `(defmacro ,name ((var-name &optional initial-value) &body body)
     `(let ((,var-name (,',allocate-func ,initial-value)))
        (unwind-protect
             ,@body)
        (,',cleanup-func ,var-name))))


(define-with-macro with-file open close)


(with-file (in "/Users/erik/test.txt")
           (print (read-line in)))

=>  "XMJYAUZ;MZJAWXU"

(macroexpand '(with-file (in "/Users/erik/test.txt")
           (print (read-line in))))

(LET ((IN (OPEN "/Users/erik/test.txt")))
  (UNWIND-PROTECT (PRINT (READ-LINE IN)))
  (CLOSE IN))


Don't need no fucking special purpose keywords
Don't need no forced indentation of code

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List