[Cuis-dev] unnecessary punctuation

Juan Vuletich juan at cuis.st
Fri Jun 14 06:35:58 PDT 2024


On 6/13/2024 9:43 PM, Luciano Notarfrancesco via Cuis-dev wrote:
> Right, it’s not a good idea to implement value in Object like this, it 
> doesnt really generalize anything, I suggest we remove it.

Ok. Let's do an experiment. I defined Object >> #value like this:

value
Z ifNil: [ Z := 0 ].
Z < 10 ifTrue: [
     Z := Z + 1.
     '-----' print.
     thisContext printStack: 10 ].
     ^self

The limit to 10 is important, or you'll need to kill the image. It seems 
that if we define #value as the empty method in UndefinedObject, 
Boolean, Number, CharacterSequence and Text, then Object's is not called 
too often.

This could reduce the (mis)use of Object>>#value on arbitrary objects. 
It may be worth doing.

Cheers,

>
> On Fri, Jun 14, 2024 at 03:14 Vanessa Freudenberg via Cuis-dev 
> <cuis-dev at lists.cuis.st <mailto:cuis-dev at lists.cuis.st>> wrote:
>
>     On Thu, Jun 13, 2024 at 12:38 PM Ezequiel Birman via Cuis-dev
>     <cuis-dev at lists.cuis.st <mailto:cuis-dev at lists.cuis.st>> wrote:
>
>             Wouldn't the same concern exist for blocks?
>
>         It is /expected/ of blocks to understand *#value*. There is no
>         concern; if you redefine *BlockClosure >> value*, the image
>         will crash.
>
>
>     Right. Also, look at all the implementors of #value. None of the
>     ~30 classes only return self.
>
>     That means if you write
>
>         x := cond ifTrue: a ifFalse: b.
>
>     and you expect x to be either a or b, you might be in for a
>     surprise if you happen to pass in a or b that implements value.
>
>     Whereas with
>
>         x := cond ifTrue: [a] ifFalse: [b].
>
>     you do get a or b.
>
>     – Nessa
>     -- 
>     Cuis-dev mailing list
>     Cuis-dev at lists.cuis.st <mailto:Cuis-dev at lists.cuis.st>
>     https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240614/b16631dd/attachment-0001.htm>


More information about the Cuis-dev mailing list