[Pharo-dev] , for vector creation

Tudor Girba tudor at tudorgirba.com
Thu Oct 26 04:23:47 EDT 2017


> On Oct 26, 2017, at 8:52 AM, Peter Uhnák <i.uhnak at gmail.com> wrote:
> 
> Automatic formatting will turn it into
> 
> vector := 1,3,4,5,7,-2.
> 
> Which is not as nice.

While this can be an issue, I see it as secondary, because formatting should help recognize intention, not force us to comply with a standard created by someone else.

> And even though it looks ok for literal numbers (#(1 3 4 5 7 -2) asVector would work too), this starts to look quite generic:
> 
> vector := width, height, depth.

I am not sure I understand this point. Could you explain?

> 
> Question: why not extend @ notation?
> 
> x @ y @ z?

We do not want that specific one because Vectors are not Points. At least not in our context.

Doru


> Peter
> 
> 
> 
> On Thu, Oct 26, 2017 at 8:22 AM, phil at highoctane.be <phil at highoctane.be> wrote:
> I also like the , message for those vectors and the concatenation of dimensions makes sense.
> 
> vector := (1,3,4,5,7,-2).
> 
> looks how it should be.
> 
> Readable, easy to translate vector stuff from reference text.
> 
> Phil
> 
> 
> On Thu, Oct 26, 2017 at 7:00 AM, Nicolai Hess <nicolaihess at gmail.com> wrote:
> 
> 
> Am 25.10.2017 10:50 PM schrieb "Torsten Bergmann" <astares at gmx.de>:
> Hi,
> 
> there might be reasons for an own 2D vector class (instead of using Point).
> But still I dislike the reimplementation of  "," because for me so far it
> has the meaning of "concatenating things".
> 
> 
> Like concatenating coordinates :-)
> 
> 
> 
> Here you redefine it to create vector instances and it works only up to three
> so far. Right?
> 
> I understand that this gives some similarities with the math notation (1,2)
> but I personally would prefer to use:
> 
>     1 at 2 asVector
> 
> or  Vector2D x: 1 y: 2
> 
> Thx
> T.
> 
> 
> 
> > Gesendet: Mittwoch, 25. Oktober 2017 um 20:06 Uhr
> > Von: "Tudor Girba" <tudor at tudorgirba.com>
> > An: "Pharo Development List" <pharo-dev at lists.pharo.org>
> > Betreff: [Pharo-dev] , for vector creation
> >
> > Hi,
> >
> > As mentioned in the separate thread, we played with introducing the extension:
> >
> > , aNumber
> >       ^ BlVector2D x: self y: aNumber
> >
> > This means that (10,20) will return a 2D vector.
> >
> > We also have (10,20,30) which returns a 3D vector.
> >
> > , is used for different meanings already in the image beside the collection concatenation. For example, in FileReference is adds a file extension. And Exceptions create a collection. In other packages, PetitParser uses it as a sequence operator.
> >
> > Please voice your concerns.
> >
> > Cheers,
> > Doru
> >
> >
> > --
> > www.tudorgirba.com
> > www.feenk.com
> >
> > "Every thing should have the right to be different."
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 

--
www.tudorgirba.com
www.feenk.com

"Reasonable is what we are accustomed with."





More information about the Pharo-dev mailing list