[Pharo-dev] Why do we have doublequoting for "?

stepharong stepharong at free.fr
Sun Feb 26 17:16:42 EST 2017


I hate my mail client....
Apparently I wrote email to explain what I finally understood and it never  
sent it nor archive it :(
So I will try to summarize it and take some time tomorrow to reexplain it.

Now I understand why I got confused

printit is currently a function from
	objects -> literals (this handles the self-evaluating objects) + (and  
this is unfortunate non literals such as string objects by opposition to  
literal strings)

It means that there ares case where we can have
	object -> a string object (and not a literal) in that case we use the  
string object as a mediocre "reference" to the object.


If we would have
	printgraphics
		we would have objects -> graphics and unknow objects would be  
represented by a little blue square and clicking on it would bring
		and object representation (inspectors or whatever)

Now how to we improve the situation. I have the impression that it would  
be good to have instead of printOn: which is used to do too many things.

- first printOn: should not be used for list/combo or any widgets (this  
will avoid some friends I know to get interfaces with ' inside their  
comboxchoice) but to use displayString

- second I would introduce
	asLiteralOn:
	which garantee that you cannot escape
	
	this way printIt will only prints strings as literal strings and the  
contract is clear.
	
	objects -> literals (this handles the self-evaluating objects)
	
		1
		>>> 1

		false
		>>>
		false

		but
		(Directory name: 'comics')
		>>> 'comics'

		{ 1 . Browser new}
		>>> 'anArray with (1, a Browser')

		now we can ask ourselves if

		{  (Directory name: 'comics') }
		>>>
		{ 'comics' } I do not like it
		or
		>>> 'anArray with ( comics )
	

back to my confusion:

I was confused about the fact that I was hijacking the textual  
representation
	'comics' is not a directory but a string
	now may be I should have return a storeOn: representation
	or 'aDirectory (comics)'

	and introduce displayString
	'comics'	

Probably that printOn: should not be used the way I did it.
but I do not know.

I think that this is a subtle domain and we should provide better  
guidelines.

Do you understand my points?
What do you think?

Stef



More information about the Pharo-dev mailing list