Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Roelof Wobben
Thanks, for the discusson and lessons. I will think about it and also think if smalltalk is for me. I did the pharo Mooc and still have a lot of problems making the smalltalk way click in my head so I can solve little problems like this.

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Richard O'Keefe
You are expected to use my code fragments for *ideas*, not to incorporate them *literally* in your code. As I explained, *without seeing the specification*, I have no way to tell whether the specification uses a left-handed or right-handed coordinate system. For what it's worth, here's a

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Roelof Wobben
yes,  this is a real  tests from the pharo track on exercism.io I understand what you mean but maybe I overthinking things. But if we have a robot facing north and the robot turns to the left  , im my oponion it faces now to the east. like

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Richard O'Keefe
The basic issue here is abstraction. An instance of "Robot" in your program is not a physical object. How could it possibly point North, South, or Nor-nor-west? It cannot. Its location and direction are abstract values *metaphorically* related to real world notions like position vectors and

Re: [Pharo-users] How to catch and handle multiple exceptions

2019-04-08 Thread Esteban Maringolo
Maybe the abstraction needed wraps everything within a single handler, but internally does a switch like statement dispatching to a particular error handler block. handledBlock exceptionDispatcher on: NotFoundError do: [:ex | ...]; on: MessageNotUnderstood do: [:ex | .. ].

Re: [Pharo-users] How to catch and handle multiple exceptions

2019-04-08 Thread jtuc...@objektfabrik.de
Am 08.04.19 um 14:39 schrieb Richard O'Keefe: > > It's easy enough to add your own methods like > on: exn1 do: act1 on: exn2 do: act2 >     "An imperfect emulation of VAST's #when:do:when:do:" >     ^[self on: exn1 do: act1] on: exn2 do: act2 > > on: exn1 do: act1

Re: [Pharo-users] How to catch and handle multiple exceptions

2019-04-08 Thread Tim Mackinnon
Thanks Richard - indeed it was that VisualAge Smalltalk pattern that I was remembering and looking for in Pharo, and was a bit surprised it wasn’t there - and hence thought there’re was possibly a different way. I might propose we add this, if no-one else comes up with a better alternative.

Re: [Pharo-users] How to catch and handle multiple exceptions

2019-04-08 Thread Richard O'Keefe
It won't be fast because it creates multiple blocks, whereas a "native" version would not. To be honest I have not implemented exceptions in my Smalltalk yet, but I want to inline []on:do: constructions. The VAST system I have is 8.6.3, and it supports ANSI Exceptions. On Tue, 9 Apr 2019 at

Re: [Pharo-users] How to catch and handle multiple exceptions

2019-04-08 Thread Esteban Maringolo
Richard, I was going to comment the #when:do:[when:do:] approach of VAST [1]. Why do you say it won't be fast? Because of the multiple exception handlers in the call stack? I think that some construct might be used to obtain the same as the #when:do:when:do: but using a chained approach

Re: [Pharo-users] Iceberg for files other than code?

2019-04-08 Thread Konrad Hinsen
Hi Tim, > Hi Konrad - I think you can do what you describe - I think the > ICeRepository entry for your project will have the path you want. Indeed. Here's how to get the repository for class MyClass: repo := IceRepository registeredRepositoryIncludingPackage: MyClass package. And then the

Re: [Pharo-users] can I do something like this with Double Dispatch

2019-04-08 Thread Roelof Wobben
it is almost the same. here exercism challenge looks like this : Scoring Bowling The game consists of 10 frames. A frame is composed of one or two ball throws with 10 pins standing at frame initialization. There are three

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Roelof Wobben
Richard thanks. One thing I do not see direct. you said : A direction could be represented by a pair of integers dx, dy such that |dx|+|dy| = 1.  It could also be represented by a Point with

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Roelof Wobben
Op 8-4-2019 om 10:57 schreef Richard O'Keefe: One thing I have often seen and lamented is students writing excessively complicated code with way too many classes.  There is a huge difference between

Re: [Pharo-users] can I do something like this with Double Dispatch

2019-04-08 Thread Richard O'Keefe
Remember, we cannot see the Smalltalk exercises in exercism. We cannot help you without knowing what problem you are trying to solve. Is this problem basically the same as https://www.reddit.com/r/dailyprogrammer/comments/3ntsni/20151007_challenge_235_intermediate_scoring_a/?ref=share_source=link

Re: [Pharo-users] difference between double dispatch and the method explains here

2019-04-08 Thread Richard O'Keefe
One thing I have often seen and lamented is students writing excessively complicated code with way too many classes. There is a huge difference between "A Robot knows its position and direction." and "A Robot has-a Position and has-a Direction." The first is the important one. The second is