[Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Yuriy Tymchuk
Hi, sorry if there was already this question, but I couldn’t find it anywhere. I’m looking in the OO-design concerns and it seams that Java guys are crazy about returning the collection that is used for state of an objects. The only acceptable option is returning it in the immutable wrapper.

Re: [Pharo-dev] a Pharo talk from a ruby conference

2014-05-13 Thread Göran Krampe
On 05/12/2014 10:54 PM, Nicolas Cellier wrote: But Smalltalk V was cheap, small, fairly well documented and worked on windows (DOS even). Yes, I even used it IIRC, but it was not gratis. And IMHO the only way to compete back then with the big boys (MS, Borland etc) was to either be gratis or

[Pharo-dev] Alt-Space is Non-breaking S

2014-05-13 Thread Henrik Johansen
… Which is extremely annoying when writing blocks with arguments on a norwegian OSX keyboard. | is Alt - 7, when I don’t release the Alt key before the following space, and a NBSP is inserted instead of a space character, which breaks both the parser and syntax highlighting. When doit’ing, you

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Sergi Reyner
2014-05-13 10:53 GMT+01:00 Yuriy Tymchuk yuriy.tymc...@me.com: I’m looking in the OO-design concerns and it seams that Java guys are crazy There's your answer :D Cheers, Sergi

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Esteban A. Maringolo
I think it is more an issue of design. If your Invoice has a collection of Items, you shouldn't manipulate the collection directly and instead use accessor/operator methods. I wouldn't restrict having the option of direct manipulation of the collection, but it is a nice thing to have covered by

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread David Astels
Well, an issue of good OO design or not. Returning a mutable collection breaks encapsulation. My initial question is whether the collection is simply a detail of the implementation or part of the external interface you want to expose. If the former, hide the collection and expose operations

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Yuriy Tymchuk
Ok, I also forgot to tell my own opinion. If you as something for it’s model (or some other thing), you get it. Now it’s up to you if you want to modify it or not. The idea behind encapsulation rules is that you don’t force someone to rely on your internal data. So to allow someone add thing to

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Igor Stasenko
indeed. simply don't expose unwanted operations to the user. there's many ways to do that and wrapping it is just one of it. On 13 May 2014 15:47, David Astels dast...@icloud.com wrote: Well, an issue of good OO design or not. Returning a mutable collection breaks encapsulation. My initial

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Alexandre Bergel
I got an interest some years ago, to see if Context-Oriented-Programming would help to have immutable collections. Apparently, Java supports immutability at runtime (i.e., there is no class ImmutableArrayList as far as I know). So, there is no good design for immutable collections as far as I

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Alexandre Bergel
Also, I know that side-effect (e.g., adding or removing an element to a collection) does not work well with type-safety. E.g., Side-effect prevents many type system from being type-safe -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Jan Vrany
On 13/05/14 15:50, Alexandre Bergel wrote: I got an interest some years ago, to see if Context-Oriented-Programming would help to have immutable collections. Apparently, Java supports immutability at runtime (i.e., there is no class ImmutableArrayList as far as I know). Actually there is.

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Chris Muller
You could answer a copy of the collection, so it won't matter internally if they try to add to it. Or you could wrap the collection with operations too. However, doing that, I suppose someone could still write, (someObject instVarNamed: 'internalCollection') add: junk. So, why bother? Writing

Re: [Pharo-dev] a Pharo talk from a ruby conference

2014-05-13 Thread Craig Latta
Hoi! Eliot wrote: Pharo isn't inspired by Smalltalk; it /is/ a Smalltalk. Trying to be mealy-mouthed about it and claiming inspiration, rather than proudly declaring its a Smalltalk is IMO as bad as apologizing for it being dead... We don't need to avoid the S word... Sean later

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Alexandre Bergel
Well, this is not what I exactly meant: http://www.tutorialspoint.com/java/util/collections_unmodifiablelist.htm The class Collection define the method: public static T ListT unmodifiableList(List? extends T list) It returns an instance of List. I do not think there is a type

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread David Astels
If someone uses your class by using instVarNamed, they deserve any pain that results. Your job is to publish a clean public interface to your class, their job is to use that interface. On May 13, 2014, at 10:29 AM, Chris Muller asquea...@gmail.com wrote: You could answer a copy of the

Re: [Pharo-dev] developing games in Pharo

2014-05-13 Thread Hilaire Fernandes
Good evening, Le 11/05/2014 17:21, Eliot Miranda a écrit : Hilaire, perhaps you can tell me whether touch support is OK or whether work needs to be done in the VM? I don't really know regarding the VM. I remember Bert did some experiment with multitouch on Etoys, but I can't tell if it was a

Re: [Pharo-dev] developing games in Pharo

2014-05-13 Thread Hilaire Fernandes
Le 11/05/2014 17:21, Eliot Miranda a écrit : On iPhone Apple expressly forbid JITs other than their own so until that changes the fastest VM on iPhone will be the Stack VM. When the iPad came out, I remember about anxiety in the community deploying Smalltalk application will be rejected by

Re: [Pharo-dev] Github Pharo.org

2014-05-13 Thread Esteban Lorenzano
fixed (since yesterday, but I forgot to send the mail :P) thanks for report Esteban On 13 May 2014, at 00:09, Nicolai Hess nicolaih...@web.de wrote: link for windows vm is wrong(Custom Downloads): http://files.pharo.org/vm/pharo/win/Pharo-VM-linux-stable.zip correct one:

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Sergi Reyner
2014-05-13 14:28 GMT+01:00 Esteban A. Maringolo emaring...@gmail.com: I wouldn't restrict having the option of direct manipulation of the collection, but it is a nice thing to have covered by some LINT rules. :) That´s what I meant, in a convoluted way, with they are crazy. For me, Java is

Re: [Pharo-dev] Alt-Space is Non-breaking S

2014-05-13 Thread Eliot Miranda
On Tue, May 13, 2014 at 4:08 AM, Henrik Johansen henrik.s.johan...@veloxit.no wrote: … Which is extremely annoying when writing blocks with arguments on a norwegian OSX keyboard. | is Alt - 7, when I don’t release the Alt key before the following space, and a NBSP is inserted instead of a

Re: [Pharo-dev] a Pharo talk from a ruby conference

2014-05-13 Thread Jimmie Houchin
On 05/13/2014 10:45 AM, Craig Latta wrote: Hoi! Eliot wrote: Pharo isn't inspired by Smalltalk; it /is/ a Smalltalk. Trying to be mealy-mouthed about it and claiming inspiration, rather than proudly declaring its a Smalltalk is IMO as bad as apologizing for it being dead... We don't

Re: [Pharo-dev] Immutable collections and encapsulation

2014-05-13 Thread Carlo
Hi The advantage is that there is a standard library for implementing efficient unmodifiable “read-only” collections. Just because the Java ‘crowd’ have it doesn’t mean they misuse it (or that they do not understand OO); there are the odd occasions when it is useful to tighten down your