[Pharo-dev] Smalltalk = strongly typed

Hernán Morales Durand hernan.morales at gmail.com
Sat Aug 3 16:08:00 EDT 2013


Hi Ben,
Even if you adopt a type system or definition as part of Smalltalk, it 
is not coherent nor intuitive with the system usage. Types are not 
identifiable in Smalltalk, they belong to other systems semantics (both 
formal and informal) and probably scientific corpus. Because of that, 
you are having problems to cite those concepts. And type system 
definitions are inherently unstable because there is no scientific 
consensus.

Does typing correspond with common reality in Smalltalk developement? 
Why would you need to think in terms of type checking in an object 
environment? It is ok if you don't want to break contractualism in your 
thesis, although to me talking about type checking in Smalltalk is the 
same as talking about L2 cache hits ;)

Cheers,

Hernán

El 03/08/2013 14:35, btc at openinworld.com escribió:
> btc at openinworld.com wrote:
>> greetings all,
>>
>> I'm in the final weeks of writing up my Masters dissertation and
>> seeking some scholarly references to Smalltalk being "Strongly Typed."
>>
>> I my review of Smalltalk I was surprised to find that [1] describes
>> Smalltalk as Strongly Typed, since Smalltalk is sometimes denigrated
>> as being untyped / weakly typed. From reviewing discussion forums this
>> now makes sense, but I can only find one of scholarly reference that
>> briefly mentions this [2].  The most enlightening is [3] which defines
>> Type Strength as:
>>
>> "A strongly typed language prevents any operation on the wrong type of
>> data. In weakly typed languages there are ways to escape this
>> restriction: type conversions"
>>
>> meaning that getting a MNU is a form of Strong Typing since you can't
>> make a Smalltalk object run a method that is not its own.  The problem
>> appears to be that Strong Typing has been synonymous with Static
>> Typing for a long time, and Static Typing strongly ties types to
>> variables, except in Dynamically Typed languages, I think types can be
>> considered independently from variables, in which case the definition
>> of [3] has some merit, hence Smalltalk is Strongly Typed.
>>
>> Sounds controversial, so I'm just hoping for some peer reviewed backup
>> - but only you have something easily to hand. This is just a small
>> thing I can just leave out if necessary.
>>
>> cheers -ben
>>
>> [1] http://www.squeak.org/Features/
>> [2] p15,
>> http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.35.7507&rep=rep1&type=pdf
>>
>> [3] http://www.cs.kuleuven.ac.be/publicaties/rapporten/cw/CW415.pdf
>>
>>
>
> Thank you all for you responses.  I am integrating it all into a section
> of my report, which I'll paste in a bit for you to pick holes in.  I few
> quick responses....
>
> I agree with Igor and Camille, statically-typed & strongly-typed should
> not be synonyms - but as Esteban says, it is common usage - but I think
> that doesn't make it right.  I think this is due to statically-typed
> languages tightly associating types with variables, whereas types exist
> independently from variables.
> Milan, To clarify, it doesn't prevent the *error*.  What it does is
> prevent the *operation*.  Since a MNU is produced the specified
> operation did not execute.  Igor gives a good example of why C is weakl
> typed.
>
> Camille, I take your point about defining "Strongly Typed" , which I
> will do in my report.
>
> Kilon, I agree with most of you writeup, except that I think Smalltalk
> has types - except the types are not associated with variables, rather
> they are associated with objects.  This aligns with Igor's comment  "in
> smalltalk, assignment is not copying value, but changing the reference".
>
> Enrico, I will cover Duck Typing, thanks.  The implication is, if Duck
> Typing applies to Smalltalk, then types *are* part of Smalltalk.
> Alain, Thanks for the link. To much to respond to here. Bits should end
> up in my report.  I found this compelling, as it clarify my own thinking
> along the same lines "Statically typed languages assign types to
> variables, while dynamically typed languages assign types to values"
>
> Hernan, I disagree that Smalltalk has no types.  But they apply to
> objects rather than variables, which is where it breaks down for the
> explicitly/statically typed crowd.
>
> Carla, I am thinking along those lines.  A type groups data and valid
> operations. In non-OO languages, the data and operations are separated,
> so the type is associated with a variable, which defines what operations
> are valid on the variable, and hence on the data within the variable. In
> OO/Smalltalk, the data and operations a combined, so type is associated
> with the object, which defines what operations are valid on the object,
> and hence the data within the object.
>
> Juan, I agree with your first post that Smalltalk is strongly typed.
> Discussing of multi-typed is beyond what I need to consider for my report.
>
> German, That paper states "Smalltalk, although an untype language" but
> the goes on to indicate many times that Smalltalk has types eg "subtype
> polymorphism of Smalltalk"
> I think it is common to say "Smalltalk is untyped" but actually the
> correct statement should be "In Smalltalk, the *variables* are untyped"
>
>
> I'll paste something in more detail soon.
>
> Thanks again.  All good points to round out my discussion.
>
> cheers -ben
>
>
>
>
>





More information about the Pharo-dev mailing list