[Cuis] String concatenation with non-strings
Juan Vuletich
juan at jvuletich.org
Sun Dec 8 11:36:11 CST 2013
Hi David,
This was never discussed... I think that going too far in that direction
could make Cuis look like Perl. Is there a god reason to do it?
Cheers,
Juan Vuletich
On 12/6/2013 2:16 PM, David Graham wrote:
> Hi All,
> I occasionally run into this issue when porting code and was curious
> if there is a specific reason why the String>>, method doesn't send an
> "asString" message to any non-String objects being concatenated?
>
> For example, if I open a workspace and do a print-it on the following:
> 'test: ', 5
> It errors and the debugger shows that the message ends up being
> handled by Sequenceable collection which fails.
>
> Here is the Cuis code from String>>,:
> , aStringOrText
> ^ (aStringOrText is: #Text)
> ifTrue: [ self asText , aStringOrText ]
> ifFalse: [ super , aStringOrText ].
>
> Squeak:
> , anObject
> "Concatenate the argument to the receiver.
> Transcript cr; show: 'The value is: ', 3.
> "
> ^ self copyReplaceFrom: self size + 1
> to: self size
> with: anObject asString
>
> Regards,
> David
>
> _______________________________________________
> Cuis mailing list
> Cuis at jvuletich.org
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
More information about the Cuis
mailing list