4 ms·
Something has to be said for the uniformity of syntax. The lisp reader macro is used throughout the language; I have never used this syntax before (I prefer to
by mahmud 17y ago
Something has to be said for the uniformity of syntax. The lisp reader macro is used throughout the language; I have never used this syntax before (I prefer to explicitly make objects, that way I know if the call succeeded right away) but grepped the PURI sources to see if it had a reader-macro, and sure enough it did. If there was no uniformity, I would have waited for a blog post to tell me something exists.
You are complaining a Lisp URL needs to be quoted to distinguish it from other input tokens; how would you feel when you have more than one URL, say 10, on the screen and all of them are being echo'ed in a debug backtrace without visual aid or syntax highlighting? How about if you forget to delimit one with a space (oops, now you have a syntactically valid URL that's broken; the type checker wont help you verify URLs)
Plus you can "merge" Lisp URLs, forming absolute URLs from a base URL and appending paths to it or building query parameters in an elegant fashion.
- draegtun 17y agoI totally agree with mahmud about uniformity of syntax and the fragility of doing things like this. However the original post/gist was just a bit of fun! So here is the same bit of fun in Perl: http://gist.github.com/256992 http://gist.github.com/256992 use Modern::Perl; use Url; use JSON qw(decode_json); # output the json as is say http://twitter.com/statuses/show/6592721580.json; # => He nose the truth. say decode_json( http://twitter.com/statuses/show/6592721580.json )->{text}; First time I've played with Devel::Declare module (http://search.cpan.org/dist/Devel-Declare/ http://search.cpan.org/dist/Devel-Declare/) and I found it to be straightforward & an extremely powerful beast for mangling with the perl5 parser in a robust and safe way.