[Pharo-users] DBXTalk code changes / band-aides

Cam S camsanders at aol.com
Sat Jun 9 20:32:51 EDT 2012

>> I have a few fixes for DBXTalk: the Magritte descriptions generation (I 
>>> switched Array output code-generation to the {...} format instead of #( 
>>> ...) which was not allowing #conditions: to be properly formatted, which 
>>> may be a problem for other smalltalk environments), and other trivial fixes.
> Excellent!!! :)  Thanks. Can you send us the changes or directly commit? 

Band-aide approach...

DBXMagritteWriterVisitor>>writeDescription: aMADescription onClass: aClass
| properties descriptionMethod classes |
properties := ';
(aMADescription properties associations
collect: [ :assoc | 
'{1}: {2}'
{(assoc key). "assoc value printString"
((assoc value isKindOf: Array)
ifTrue: ['{', ('. ' join: assoc value  ), '}' ]
ifFalse: [ assoc value printString ])} ]).
- <clipped>

Mine is a horrible solution. Given that there are blocks in the conditions 
loops, the traditional array notation, #( ... ), will not work anyway, so 
the curly-brace approach is fine. I played around with #respondsTo: and 
tried to generalize, but hit problems because the value is often a symbol 
or string. so in the end, to get my classes generated, I just did the above 
quick-n-dirty patch.

The only other changes I have gone ahead and made were to make certain that 
more methods of DBXEntity  return the newly created attribute/entity, so 
that I could say something like the following:

(e hasOne: #DpAddress as: #mailingAddress)
label: 'Mailing Address';
priority: 400.

So all of the #hasOne:as:, #hasMany:as:, etc.  .... Oops... looks like late 
last night, when I was updating packages to see if i was missing anything, 
I lost my changes to those methods! There were only 4 or 5 such changes, 
and they were trivial.

Cheers. I like the DBXTalk approach. And Magritte too. In the two major 
projects I worked on over the years, and even on a couple of small side 
projects, I/we ended up using meta-language tools to add runtime behavior; 
and the starting code for new objects, at least in the one big project, was 
generated from a short-hand table of the meta-language specs. Very 
powerful. And lazy people like me are drawn to such things.

Nice work guys!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20120609/4db50927/attachment.html>

More information about the Pharo-users mailing list