Ayende @ Rahien

Unnatural acts on source code

By the DSL, guess what I am reading

I am toying with this DSL:

recieve:
	message msg as ChangeAddressMessage if msg.AddressId is null:
		transaction:
			address = Address.FromMessage(msg)
			address.Create()		
	message msg as ChangeAddressMessage:
		transaction:
			address = LoadAddress(msg.AddressId)
			Address.FromMessage(address, msg)
			address.Save()
	message other:
		raise MessageNotUnderstood()

What book am I reading now?

Comments

Ken Egozi
10/14/2007 11:48 AM by
Ken Egozi

The Yellow Pages

Ha ha gotcha.

David
10/14/2007 12:33 PM by
David

Joe Armstrong's book on erlang (which I've just read).

Ayende Rahien
10/14/2007 01:04 PM by
Ayende Rahien

Hehe, yeah.

I am going to finish it and post about, very interesting.

Thomas Eyde
10/14/2007 01:21 PM by
Thomas Eyde

That DSL is just gibberish to me. The only thing I could parse was MessageNotUnderstood().

Chad Myers
10/14/2007 03:48 PM by
Chad Myers

What is that trying to accomplish?

I thought DSLs were supposed to present something that a mere mortal (non-IT user) could understand.

Heck, I can barely understand that. I think old if(){ } statements would better. I've had luck in the past showing well-constructed, simple business logic in C# to non-IT folks and having them understand it.

It seems like this might be preferable:

public void OnReceive( Message message )

{

if( message.AddressID == null )

{

Address.FromMessage(message).Create();

} 

else if

{

    Address addr = LoadAddress(message.AddressID);

    Address.FromMessage(addr, message).Save();

}

else

{

    throw new MessageNotUnderstoodException();

}    

}

Chad Myers
10/14/2007 03:49 PM by
Chad Myers

Blasted whitespace stripping...

Ayende Rahien
10/14/2007 04:35 PM by
Ayende Rahien

Chad,

There are several purposes for creating a DSL.

This is not one that I will show to a business user, it is something that I want to do for myself.

The idea here is that the receive / message primitives are going to handle non-blocking waits on the thread, erlang style.

This is very powerful concept when you are talking about concurrent programming

Evan Hoff
10/14/2007 10:01 PM by
Evan Hoff

enterprise integrations patterns...great book

Evan Hoff
10/14/2007 10:03 PM by
Evan Hoff

haha..looks like i should have read the other comments first..lol

i'd like to hear what you thought of the erlang book..been eyeing it myself..

Comments have been closed on this topic.