David Bogus on 6 Sep 2007 04:56:42 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] "Ruby for microcontrollers" a short list...

  • From: "David Bogus" <davidbogus@gmail.com>
  • To: talk@phillyonrails.org
  • Subject: Re: [PhillyOnRails] "Ruby for microcontrollers" a short list...
  • Date: Thu, 6 Sep 2007 00:56:31 -0400
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=poBb8hL4C+D00t8quJ217UKaJPKRSH0DW/bsOfx1pu0=; b=bDc/EeWvFc+f9ufiEsLCVA6axyCUSBsO15za1n8Q/bg9rCvBZyLMsDIlWsvjDRfK5Q54z4mTee0e5FFDRAO2AKK5Dl8cDpdG4M8kCepdRUFh03c9MSPgd8E9HqD9/Xjuv140K7ARoqJE5IGr8F2ab1m7giDjeRjVb8sKSV0AMts=
  • List-archive: <http://lists.phillyonrails.org/pipermail/talk>
  • Reply-to: talk@phillyonrails.org
  • Sender: talk-bounces@phillyonrails.org

Advantages of using language with introspection or reflection to
generate code in a language or subset that doesn't have it.

First off testing.

Testing where you don't have to register your tests or suites is taken
for granted until you have to do every time every test. Its about once
every other week that you forget to register a test, When working in
that environment step one is write a test with explicit fail and watch
it fail. That verses extend some class and follow a naming convention,
and let the automagic happen.

Changing behavior of things for tests.
Lets say we are using a simplistic widget library on some small device
lets say a dvd player. So just for grins we want to make sure that
people can use it in many languages. Here is the kind of test I would
like to write.

def testSwitchLanguage
  languages.each do |language|
     all_menus = menu.new(language).menu.recursive_text
     all_menus.each do | menu |

Now suppose when we call our simplistic widget library it takes the
string  but doesn't allow us to get it back. (Imaginary reason it
generates a bitmap immediately and frees the string )  So we go and
write wrapper that delegates to the simplistic widget library but
records the calls and can tell us what text the widget contains.

Now I'm sure using introspection in your generated code would be
awesome but thats a bit more complicated. Its not all that hard to
have your dsl generate some defalut method on your objects like ones
that says what method the object understands.

  Then you can start with just tracking pointers and keeping a
"omniscient" object that keeps all objects. Next thing you know you'll
start wanting to be able to do dynamic composition.
 So you take two pointers and check that no messages collide then you
generate an code that delegates to on to the appropriate pointer.

 Of course this is part way along that slippery slope to writing your
own language.

Question for Greg, what is the type of problem your solving?  I'm
unclear about "controller models" and what that means to you.


Dave's Definitions: Morning, is after I've slept for more than four
hours. Lunch is the second meal of the day no matter the hour of
consumption. A long drive is one longer then you have last slept.
Ineffable, if you don't understand I couldn't possibly explain it.
To unsubscribe or change your settings, visit: