Administrator
|
Per a recent thread, I added #display: aBlock to MAElementDescription, so you can now say e.g.
MAFileDescription new accessor: accessor; label: 'Attachment'; defaultDirectory: attachmentFolder; display: [ :e | e basename ]; kind: AbstractFileReference; priority: 300; yourself. I tried not to subvert the design of Magritte, but had to dig pretty deep to find a place where the right objects were able to communicate. MAStringWriter>>#visitStringDescription: sends #displayStringFor: to the description to convert the object into a string. The default is still to send it #greaseString. If someone could load the bleeding edge packages and review the design I'd appreciate it. It's worked so far in my projects and with some hand testing. Thanks.
Cheers,
Sean |
Hi Sean,
Thank you for your efforts. I agree this is a pain point. I see that you have modified the implementation of string writer to implement you solution, that allows all normal functionality to function. So this is good. To make it more in the style of Magritte, as I understand it, > display uses a local variable instead of using a property. Accessing this property should return a default value that can be class dependent. This also makes the initialization code redundant. > display now only takes a block, it would be nicer if it also would allow for symbols (as a simple accessor). If you want me to try and make these improvements, I probably have time for this on Friday. Regards, Diego On Sep 29, 2013, at 10:11 PM, Sean P. DeNigris wrote: > Per a recent thread, I added #display: aBlock to MAElementDescription, so you > can now say e.g. > > MAFileDescription new > accessor: accessor; > label: 'Attachment'; > defaultDirectory: attachmentFolder; > display: [ :e | e basename ]; > kind: AbstractFileReference; > priority: 300; > yourself. > > I tried not to subvert the design of Magritte, but had to dig pretty deep to > find a place where the right objects were able to communicate. > > MAStringWriter>>#visitStringDescription: sends #displayStringFor: to the > description to convert the object into a string. The default is still to > send it #greaseString. > > If someone could load the bleeding edge packages and review the design I'd > appreciate it. It's worked so far in my projects and with some hand testing. > > Thanks. > > > > ----- > Cheers, > Sean > -- > View this message in context: http://forum.world.st/Code-Review-Request-tp4711242.html > Sent from the Magritte, Pier and Related Tools mailing list archive at Nabble.com. > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Administrator
|
Thanks for the feedback, Diego. I'm glad you found it promising. Any improvements are definitely welcome...
- S -------- Original message -------- From: "DiegoLont [via Smalltalk]" <[hidden email]> Date: 10/01/2013 3:37 AM (GMT-05:00) To: "Sean P. DeNigris" <[hidden email]> Subject: Re: Code Review Request Hi Sean, Thank you for your efforts. I agree this is a pain point. I see that you have modified the implementation of string writer to implement you solution, that allows all normal functionality to function. So this is good. To make it more in the style of Magritte, as I understand it, > display uses a local variable instead of using a property. Accessing this property should return a default value that can be class dependent. This also makes the initialization code redundant. > display now only takes a block, it would be nicer if it also would allow for symbols (as a simple accessor). If you want me to try and make these improvements, I probably have time for this on Friday. Regards, Diego On Sep 29, 2013, at 10:11 PM, Sean P. DeNigris wrote: > Per a recent thread, I added #display: aBlock to MAElementDescription, so you > can now say e.g. > > MAFileDescription new > accessor: accessor; > label: 'Attachment'; > defaultDirectory: attachmentFolder; > display: [ :e | e basename ]; > kind: AbstractFileReference; > priority: 300; > yourself. > > I tried not to subvert the design of Magritte, but had to dig pretty deep to > find a place where the right objects were able to communicate. > > MAStringWriter>>#visitStringDescription: sends #displayStringFor: to the > description to convert the object into a string. The default is still to > send it #greaseString. > > If someone could load the bleeding edge packages and review the design I'd > appreciate it. It's worked so far in my projects and with some hand testing. > > Thanks. > > > > ----- > Cheers, > Sean > -- > View this message in context: http://forum.world.st/Code-Review-Request-tp4711242.html > Sent from the Magritte, Pier and Related Tools mailing list archive at Nabble.com. > _______________________________________________ > Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Code-Review-Request-tp4711242p4711555.html
Cheers,
Sean |
Hi Sean,
I converted my comments into code. Please take a look at Magritte-Model, and test if it works for you. I do not know if you have added a test for this? All tests are green. Regards, Diego On Oct 1, 2013, at 1:17 PM, Sean P. DeNigris wrote: Thanks for the feedback, Diego. I'm glad you found it promising. Any improvements are definitely welcome... _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Administrator
|
Thanks, Diego! I merged your changes. I just made a few minor edits - removed the type check since blocks and symbols are polymorphic wrt #value:, and changed the name to displayBlockOrSymbol (ugly I know, but displayBlock seemed misleading). I also wrote tests after you shamed me into it ;)
Cheers,
Sean |
Free forum by Nabble | Edit this page |