Arc Forumnew | comments | leaders | submitlogin
1 point by Pauan 5188 days ago | link | parent

Right, I was referring to your def-extension-type: http://arclanguage.org/item?id=14338

Whether you would actually use such a macro in practice, I don't know, but it was relevant to my point that you can use a macro to make extending less verbose.

My apologies for using the term "rulebooks", I couldn't recall the name of the macro you were describing.



2 points by rocketnia 5188 days ago | link

Oh, I implemented 'def-extension-type in lathe.js as lathe.deftype().

  // Define a constructor _.Seq and a rulebook _.iffirstRb.
  lathe.deftype( _, "Seq", "iffirstRb" );
  
  // Define a constructor _.Seq using an existing rulebook.
  lathe.deftype( _, "Seq", _.iffirstRb );
This is not to be confused with the 'deftype I was talking about in that thread. >.>

I use it in exactly two places so far, and the rest of the time I've been cheating by defining types in a more traditional OO JavaScript way. But I'm totally interested in figuring out things like this that could help. I think Traits.js is a pretty interesting option for this, and I'm not against message-passing at this point either. ^_^

-----