Posted by matijs
Thu, 15 Apr 2010 05:42:00 GMT
You can implement a programming language in assembly. C is an example. This
has the advantage of being able to leave your language and use assembly
when necessary. You drop down to assembly for speed.
You can also implement a programming language in lisp. CLPython is an
example. This has the advantage of being able to leave your language and
use lisp when necessary. You drop down to lisp for expressiveness.
If lisp is the ultimate language, does this not make it the best option for
implementing other languages?
Posted in software | Tags design, language, lisp | no comments | no trackbacks
Posted by matijs
Sun, 17 Feb 2008 21:14:00 GMT
Hm, so Arc is here, and Paul Graham gives the Arc challenge. The answer in Arc is short indeed. First, let’s see an answer in Rails (loading a framework is allowed according to the challenge), with said_controller.rb:
class SaidController < ApplicationController
def index; end
def click; session[:it] = params['what']; end
def show; end
end
and some templates, for the first page, index.html.erb:
<% form_tag '/said/click' do %>
<%= text_field_tag 'what' %>
<%= submit_tag %>
<% end %>
second page, click.html.erb:
<%= link_to 'click here', {:action => 'show'} %>
third page, show.html.erb:
You said <%= session[:it] %>
The Rails answer may be a little longer (although by how much is hard to say due to the different syntax — is end a token?), but it not a case of the same but longer.
First, the Rails version is in temporal order, the Arc version is not. Perhaps there’s a way of reading the Arc version that makes this order natural, but right now, it looks confusing.
But the most striking difference is that it is based on a completely different philosophy of how web applications should be developed. The Arc answer is great if you want a web application based on continuations. The Rails answer is what you would use if you want to use REST.
I’m definitely in the REST camp, which makes this example meaningless as a demonstration of Arc. It shows me that Arc can be used to write a short program that does something I don’t want to do.
The ultimate question of course is whether brevity (in terms of number of tokens, not characters) is the single best metric for language power.
Update: Someone wrote a Ruby version that is about as short as the Arc version, uses the same paradigm, and is in temporal order:
def said
aform(input("foo"), submit) {
w_link("click here") {
"you said: #{arg :foo}"}}
end
Posted in software | Tags arc, continuations, design, language, rest, ruby | 2 comments | no trackbacks