IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New On what makes it easy to do little languages.
Double plus agreement on the "little language" explaination.

Ruby "makes it easy" because you can override almost any primitive (even builtin types) to create the behavior that you want. Python doesn't allow you to override builtin types; you have to subclass them.

I've done several "little languages" in Ruby and although the primitive thing can help, the biggest aid in doing a little language in Ruby is its ability to control the execution of a block of code. I've used Ruby to define mini-languages to (1) control build processes ([link|http://rake.rubyforge.org|http://rake.rubyforge.org]), (2) define data base schemas, (3) define FSM state transitions ([link|http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/118962|http://blade.nagaoka.../ruby-talk/118962]) and (4) build XML structures ([link|http://onestepback.org/index.cgi/Tech/Ruby/BuilderObjects.rdoc|http://onestepback.o...ilderObjects.rdoc]). In all cases it was the Ruby block that made the resulting mini-language natural and easy to use.

The builder example (#4 above) is particularly telling. The idea came from Groovy (another language that supports code block) and was insanely easy to implement in Ruby. I can imagine that doing it in Lisp would also be easy. But I've seen attempts to reproduce it in languages that don't support code blocks (e.g. Python at [link|http://users.binary.net/thehaas/cgi-haas/blosxom.cgi/comp/python/xmlbuilder.html|http://users.binary....n/xmlbuilder.html]) and the results have always been less than the original.
--
-- Jim Weirich jim@weirichhouse.org [link|http://onestepback.org|http://onestepback.org]
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
New Good point.
Python comes closest to that by having first-class functions (meaning, you can pass them around as objects). But Ruby's blocks are still miles ahead. Of course, LISP macros take the cake in that department. ;)

Something else I thought of in the shower: dynamic languages win in the little language department because they allow the developer to express a concept in the most appropriate syntax/semantics. For example, you're not stuck implementing go_around(person, community.get_block(13)). By dynamically adding/trapping attributes, and by overriding/subclassing builtins, you can write (Python examples):


  • go_around(person, community.block[13]), or even

  • go_around(person, community[13])

  • person.go_around(community[13])

  • blocks(13, person)

  • community.blocks.13.tour(person)

  • person.morning_walk += blocks[13]



...etc., any of which "does the same thing". This allows the designer to make a "little language" which is easier to use and extend. If you like TIMTOWTDI, you could implement them all simultaneously (but you probably shouldn't).


The Sig:
"Despite the seemingly endless necessity for doing
so, it's actually not possible to reverse-engineer intended invariants
from staring at thousands of lines of code (not in C, and not in
Python code either)."

Tim Peters on python-dev
     Time for good anti-OO battle to take minds off of election - (tablizer) - (77)
         Sorry cant go there - (daemon) - (32)
             How is being locked to a DB more evil than being locked to - (tablizer) - (31)
                 It's best to fit the tool to the job - (FuManChu) - (30)
                     Thanks for that ... +5 insightful - (drewk) - (6)
                         For various definitions of "start" ;) - (FuManChu)
                         On writing the "little language thing ..." - (systems) - (4)
                             Suggestion - (ben_tilly)
                             "Little Language" definition, components - (FuManChu) - (2)
                                 On what makes it easy to do little languages. - (JimWeirich) - (1)
                                     Good point. - (FuManChu)
                     Orthogonal to DB usage - (tablizer) - (22)
                         That's actually a good idea - (drewk) - (17)
                             *Snork* beat me to it :) -NT - (FuManChu)
                             Cure worse than the medicine. - (tablizer) - (15)
                                 "tends to bloat up code" - (admin) - (14)
                                     Your "solution" to such bloat was HQL, yes or no? -NT - (tablizer) - (13)
                                         It was a solution, yes. -NT - (admin)
                                         Since you seem to be slow... - (ben_tilly) - (11)
                                             I did NOT "lose". His solution was variation on SQL - (tablizer) - (10)
                                                 In your universe, perhaps - (ben_tilly) - (9)
                                                     The mapper did not reduce his code size - (tablizer) - (8)
                                                         Bryce, you lost this one already. - (ben_tilly) - (7)
                                                             I did NOT fscken lose. He gave no code-size proof. Zilch. - (tablizer) - (6)
                                                                 Why is code size your (apparently) sole criterion? - (drewk) - (5)
                                                                     You are welcome to present ANY metric you can justify - (tablizer) - (4)
                                                                         Thank you - (drewk) - (1)
                                                                             Usually people don't question those much - (tablizer)
                                                                         We've already been over change scenarios - (admin) - (1)
                                                                             re: We've already been over change scenarios - (tablizer)
                         "Orthogonal" in exactly the same sense as differential gears - (FuManChu) - (3)
                             You just shortened this thread by 200 posts. Cut & Paste. - (Another Scott) - (1)
                                 "[Nobody] ...points out that the cut-and-paste method... - (FuManChu)
                             No, you got me all wrong, dude - (tablizer)
         Repeat after me: - (admin) - (1)
             I never said OO was JUST about inheritance. - (tablizer)
         Amusing to note... - (JimWeirich) - (41)
             re: nouns and noun grouping - (tablizer) - (40)
                 Bryce: control tables are bad - (admin) - (37)
                     Time will erase performance differences - (tablizer) - (36)
                         That's not the main reason why they're bad. - (admin) - (35)
                             Because VC tools are hierarchy-biased. - (tablizer) - (34)
                                 Go read the thread. - (admin) - (33)
                                     You always talk as if I push a grand conspiracy - (tablizer) - (32)
                                         Relational has its place. - (admin) - (31)
                                             Math and Boolean expressions - (tablizer) - (30)
                                                 Ever use Zachary? - (admin) - (29)
                                                     I will believe it only when I see it with my own eyes - (tablizer) - (28)
                                                         - said the blind man (ducks and runs) -NT - (Arkadiy)
                                                         NO. - (admin) - (26)
                                                             You never identified an in-born fault of tables. -NT - (tablizer) - (25)
                                                                 Tables don't make good chairs. - (Another Scott) - (24)
                                                                     Vacuum Tubes - (tablizer) - (23)
                                                                         You can pry my tube guitar amp outta my cold, dead fingers. - (Steve Lowe) - (22)
                                                                             Digital precision can be boring - (tablizer) - (18)
                                                                                 Yes - tubes are IT man - (tuberculosis) - (17)
                                                                                     Heh! That was my first bass amp! - (jb4) - (16)
                                                                                         I don't know whether to be amused or appalled - (tuberculosis) - (15)
                                                                                             Both actually - (jb4) - (14)
                                                                                                 In negotiations - (jake123) - (13)
                                                                                                     Drooooooooool - (Steve Lowe) - (12)
                                                                                                         Didn't get it - (jake123) - (11)
                                                                                                             Bum R! -NT - (jb4) - (10)
                                                                                                                 Oh well. - (jake123) - (9)
                                                                                                                     Talk to your amp tech - (Steve Lowe) - (8)
                                                                                                                         Oh yeah - (jake123) - (1)
                                                                                                                             Had a teacher who did that - (drewk)
                                                                                                                         Re: Talk to your amp tech - (Ashton) - (5)
                                                                                                                             What I'm gaining - (jake123) - (4)
                                                                                                                                 Have you considered an attenuator? - (Steve Lowe) - (3)
                                                                                                                                     Yes I have - (jake123) - (2)
                                                                                                                                         New thread time, maybe...? -NT - (admin)
                                                                                                                                         This might not cost a bundle.. (new thread) - (Ashton)
                                                                             Mesa Boogie Forever -NT - (tuberculosis) - (2)
                                                                                 That'll prolly be my second choice - (jake123)
                                                                                 Feh! The Ultimate was... - (jb4)
                 re: nouns and noun grouping - (JimWeirich) - (1)
                     Can't do a whole lot with your hidden anecdotes - (tablizer)

Everything is terrible.
160 ms