2016-02-23 12:00 GMT+01:00 Ben Coman <[email protected]>:

> On Tue, Feb 23, 2016 at 5:33 PM, Tudor Girba <[email protected]> wrote:
> > Hi,
> >
> > At the moment, it is used for documentation purposes in Bloc. It is part
> of the effort of Alex to document Bloc thoroughly. I think it is an
> interesting idea, in that we would have a significant case study for that
> can be used later as optional types information to improve static tool
> support. And it does not hurt at the moment.
> >
> > What do you think?
>
> I have often wonder what a system would be like if you *only* typed
> the return values of selectors, defined globally so each selector has
> just *one* return type (but it wouldn't a particular object, more a
> method-set-fingerprint, you might be able to statically check that the
> each message in a chain would be understood - but I never think deep
> enough on it to understand the benefit/cost of it.
>

It feels it does not really work well as for example #at: is used in many
places, and on Array the return type is Object whereas on ByteArray it is
SmallInteger. Other frequent messages have the same problems (#add:, #+
etc) and they are the most used.

Usually for partial typing, one types only:
- return type of methods/closures
- parameters of methods/closures
- instance variables

Hack (optionally typed PHP by Facebook) is done like that, one can type
only these 3 aspects and all the types are fully optional. Reportedly it is
very good.
You can read about it here: https://docs.hhvm.com/hack/types/annotations.

If one follows the microsoft guidelines to develop in C#, one also types
these 3 aspects only. Although in the case of C# those 3 aspects have to be
typed, they can't remain untyped as in Hack, and even if it's optional,
typing is available for the rest of the code.

That implies that according to development guidelines, no temporary
variables or literal variables are typed in both languages.

Typed people are not confused, as the IDE infers for them the type of any
variable they mouse over. Untyped people have little constraints compared
to typing everything.

The Hack direction is probably the direction to go to introduce types in
Pharo like the Hack guys did for PHP. Untyped people can keep typing
nothing, while typed people still have all the information they need. With
a setting to display or not the type annotations in the source code in the
core libraries, everyone is happy.


> cheers -ben
>
> >
> > Cheers,
> > Doru
> >
> >
> >> On Feb 23, 2016, at 10:25 AM, Alain Plantec via Pharo-dev <
> [email protected]> wrote:
> >>
> >>
> >> From: Alain Plantec <[email protected]>
> >> Subject: Re: [Pharo-dev] [Bloc] Do we want <return: #Point> or <return:
> Point>
> >> Date: February 23, 2016 at 10:23:33 AM GMT+1
> >> To: Pharo Development List <[email protected]>
> >>
> >>
> >> I don’t like it too.
> >> Alain
> >>
> >>> Le 23 févr. 2016 à 09:50, Nicolai Hess <[email protected]> a
> écrit :
> >>>
> >>>
> >>>
> >>> 2016-02-23 9:47 GMT+01:00 stepharo <[email protected]>:
> >>> Hi
> >>>
> >>> I saw that something <return: #Point> or <return: Point>
> >>> I do not know why but I have the impression that <return: #Point> is
> better.
> >>> Because we may have code not present and still want to load the code.
> >>>
> >>> I would like to know for what this is used.
> >>> I don't like it.
> >>>
> >>>
> >>> Stef
> >>>
> >>>
> >>
> >>
> >>
> >
> > --
> > www.tudorgirba.com
> > www.feenk.com
> >
> > "We are all great at making mistakes."
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>

Reply via email to