The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Please ignore the wizard behind the curtain

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Phil Tomson

Posts: 16
Nickname: philtomson
Registered: Mar, 2006

Phil Tomson is working on strange (and hopefully wonderful) things often Ruby-related.
Please ignore the wizard behind the curtain Posted: Mar 13, 2006 5:07 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Phil Tomson.
Original Post: Please ignore the wizard behind the curtain
Feed Title: Thoughtfiz
Feed URL: http://wiki.railsplayground.net//xml/rss/feed.xml
Feed Description: Thoughtfiz: lots of tiny thought bubbles, mostly Ruby-related.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Phil Tomson
Latest Posts From Thoughtfiz

Advertisement
As I said earlier, the more Ruby-ness that can be hidden from the user of RHDL (or any DSL, for that matter), the better. It's not that Ruby is bad, it's mostly an issue of aesthetics and consistency within the DSL as well as hiding details that the user doesn't care about. Consider the following RHDL circuit desciption:
class AndGate < RHDL
  inputs  a, b
  outputs out
  define_behavior {
    out <= a & b
  }
end
If I'm a user of RHDL who doesn't know any Ruby I'm going to think "What the heck is the class AndGate < RHDL all about?"... the wizard is not fully hidden. When designing a DSL we need to anticipate those kinds of questions and proactively eliminate them, so I've eliminated the explicit class definition and replaced it with a def_circuit method:
AndGate = def_circuit {
  inputs  a,b
  outputs out
  define_behavior {
    out <= a & b
  }
}
where def_circuit is defined as follows:
def def_circuit &b
  klass = Class.new(RHDL, &b)
  #... lots of other code to deal with define_behavior & init blocks ...
  #... also, initialize for klass is created here
  klass
end
[hmm... I should change define_behavior to def_behavior to save some keystrokes and match def_circuit.]

Read: Please ignore the wizard behind the curtain

Topic: Hodel provides a datapoint on Rails scalability Previous Topic   Next Topic Topic: Smircer, Clone of the Little Tcl IRC Client

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use