Re: [Pharo-dev] Abotu FileReference objects as autoevaluating ones
Richard Sargent wrote > In many Smalltalk implementations, there are (at least) three behaviours > for this kind of thing: #storeString, #printString, and #displayString. I > would argue against conflating them. +1. There was a reason we added the "File @" prefix (although I don't remember the details at the moment) - Cheers, Sean -- View this message in context: http://forum.world.st/Abotu-FileReference-objects-as-autoevaluating-ones-tp4911694p4912085.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Re: [Pharo-dev] Abotu FileReference objects as autoevaluating ones
stepharo wrote > about > https://pharo.fogbugz.com/f/cases/18956/FileReference-printString-should-be-auto-evaluable > > > 'tmp/foo.txt' asFileReference > > > File @ tmp/foo.txt > > and it would be much much better to get back > 'tmp/foo.txt' asFileReference > > So that we can get > { 'tmp/foo.txt' asFileReference } > > { 'tmp/foo.txt' asFileReference } > > and not > "an Array(File @ tmp/foo.txt)" > > > In addition we should turn the current printOn: method into a > displayString method so that > a list of fileReference can be well display with File @ tmp/foo.txt for > example In many Smalltalk implementations, there are (at least) three behaviours for this kind of thing: #storeString, #printString, and #displayString. I would argue against conflating them. Examples: (I am not saying this is how each should work, just providing examples of how each /might/ differ to suit the different constituencies for each one's use case.) 1) #displayString '/directory/file' asFileReference displayString ==> '/directory/file' '/directory' asFileReference displayString ==> '/directory/' 2) #storeString '/directory/file' asFileReference storeString==> '/directory/file' asFileReference '/directory' asFileReference storeString==> '/directory/' asFileReference 3) #printString '/directory/file' asFileReference printString ==> FileReference(/directory/file) '/directory' asFileReference printString ==> FileReference(/directory/) -- View this message in context: http://forum.world.st/Abotu-FileReference-objects-as-autoevaluating-ones-tp4911694p4911974.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
[Pharo-dev] Abotu FileReference objects as autoevaluating ones
about https://pharo.fogbugz.com/f/cases/18956/FileReference-printString-should-be-auto-evaluable 'tmp/foo.txt' asFileReference > File @ tmp/foo.txt and it would be much much better to get back 'tmp/foo.txt' asFileReference So that we can get { 'tmp/foo.txt' asFileReference } > { 'tmp/foo.txt' asFileReference } and not "an Array(File @ tmp/foo.txt)" In addition we should turn the current printOn: method into a displayString method so that a list of fileReference can be well display with File @ tmp/foo.txt for example