[MacRuby-devel] 0.3 available for testing

Richard Kilmer rich at infoether.com
Mon Sep 8 16:59:04 PDT 2008


On Sep 8, 2008, at 7:27 PM, Ernest N. Prabhakar, Ph.D. wrote:

> Hi Charles,
>
> Have you looked at Shoes lately?

I have looked closely at Shoes and I have worked for many years
on UI abstraction libraries.  We did one for Ruby in 2002 (named
Rouge) which we tried to work from the top down (abstraction to
eventual binding).  Unfortunately the bindings (other than FXRuby)
did not really exist.  Anyway, I have a problem with the way
Shoes does implicit containment based on blocks.  The main
problem is scope.  In order to pull off this:

Shoes.app do
   background "#EFC"
   border "#BE8", :strokewidth => 6
   stack(:margin => 12) do
     para "Enter your name"
     flow do
       edit_line
       button "OK"
     end
   end
end
You need to muck with instance_eval.  That type of implicit DSL
is fine when you are talking about a closed-world simple domain
but the minute this has to scale to very large apps and write
complex models behind them you don't want to have to be confused
about what scope your code it running in.

In HotCocoa you have blocks, but the blocks are for convenience,
not magic:

application do
   window :title => "Hello" do |win|
     win << label(:title => "Enter your name:")
     win << text_field
     win << button(:title => "OK")
   end
end

Drawing the background is a bit more complex right now but
we are hoping to have a nice drawing libraries in HotCocoa to make
drawing backgrounds and other things very simple.

So the blocks yield the object that is created (window yields an
NSWindow instance that is configured)

Anyway, I have done the implicit thing a lot and it bites me every
time (eventually) unless it is a very limited domain which
in my experience UIs are not.

Best,

Rich


>
>
> http://shoooes.net/tutorial/
>
> It is very minimalist, and I think it would be straightforward to port
> over to HotCocoa.
>
> I second the idea that HotCocoa should use Shoes as a role model, even
> if it goes well beyond it.
>
> -- Ernie P.
>
> On Sep 8, 2008, at 4:08 PM, Charles Oliver Nutter wrote:
>
>> Joshua Ballanco wrote:
>>> Call it the Shoes challenge. I've started looking at doing something
>>> like this primarily to figure out where HotCocoa needs the most  
>>> work/
>>> focused attention. Originally I was thinking that Shoes could, some
>>> day, be a subset of HotCocoa, but I've changed my mind. I think
>>> HotCocoa should do it's best to encapsulate the full range of what's
>>> possible with Cocoa, and Shoes should stay a tiny-toolkit that makes
>>> GUI development easy.
>>
>> I've mostly given up on the idea of anyone ever creating a usable API
>> wrapper that works seamlessly across toolkits and platforms without
>> totally sucking. UI APIs seem to be one of those areas impossible to
>> wrap in a backend-agnostic API without a hell of a lot of hassle. See
>> SWT, which does a great job, looks mostly consistent, and yet has
>> constant portability problems and has taken dozens of man-years to
>> implement. Not worth it IMHO.
>>
>> What I would see as a better value is creating API wrappers that are
>> comprehensive, clean, ruby-like, and trying to cooperate on some  
>> vague
>> standards how what UI design/development in Ruby is supposed to look
>> like. Doing all that would mean a few things to me:
>>
>> - The APIs individually would be small enough that if someone *did*
>> want
>> to maintain multiple backends/platforms it would not be a big deal.
>> - Each API would be true to its backend, hiding nothing a user would
>> eventually need access to.
>> - The general "feel" of these APIs would be consistent across
>> backends,
>> even if developed independently, and so the general community  
>> benefits
>> from a bit more consistency in how these different classes of UI APIs
>> look and behave.
>>
>> - Charlie
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list