Open GoogleCodeExporter opened 9 years ago
More comments:
Band-aide approach...
DBXMagritteWriterVisitor>>writeDescription: aMADescription onClass: aClass
| properties descriptionMethod classes |
properties := ';
'
join:
(aMADescription properties associations
collect: [ :assoc |
'{1}: {2}'
format:
{(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.
Original comment by guillermopolito@gmail.com
on 13 Jun 2012 at 9:06
Original issue reported on code.google.com by
guillermopolito@gmail.com
on 13 Jun 2012 at 9:05