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.
