[Pharo-project] Still more problems with underscore
Hi guys. I still have problems with underscore in Pharo 1.3. I want to use underscore in both ways: in selectors and as assigment. If I do: Scanner allowUnderscoreAsAssignment: true. then it works in selectrs but not in assigment. If I do String allowUnderscore. then it works for assigment but stops working for selector. can someone help me to fix this? thanks -- Mariano http://marianopeck.wordpress.com
Hi guys. I still have problems with underscore in Pharo 1.3. I want to use underscore in both ways: in selectors and as assigment.
Who would tell the system what you mean?
If I do: Scanner allowUnderscoreAsAssignment: true. then it works in selectrs but not in assigment.
If I do String allowUnderscore. then it works for assigment but stops working for selector.
This is the point of the design. Maybe the prefix "allow" is not quite revealing enough, because you cannot have both. You load the old code with the setting set to true. You fix your broken assignments and you switch to false to use underscores. Squeak has decided to go another way and allow both cases kind of simultaneous. What a broken mess! Lukas -- Lukas Renggli www.lukas-renggli.ch
If I do String allowUnderscore. then it works for assigment but stops working for selector.
This is the point of the design. Maybe the prefix "allow" is not quite revealing enough, because you cannot have both.
You load the old code with the setting set to true. You fix your broken assignments and you switch to false to use underscores.
Squeak has decided to go another way and allow both cases kind of simultaneous. What a broken mess!
I don't agree that having both at the same time is a mess. In fact, I need exactly that: 1) Sometimes I load code which uses _ as assigment 2) Sometimes I load packages which use _ as selector (like Glorp). So now I cannot have both. It means that if I load Glorp, I cannot load code that needs _ as assigment. If I load code that needs _ as assigment, I cannot load Glorp. THAT means a "broken mess" for me. Thanks anyway.
Lukas
-- Lukas Renggli www.lukas-renggli.ch
-- Mariano http://marianopeck.wordpress.com
Le 30/10/2011 19:22, Mariano Martinez Peck a écrit :
1) Sometimes I load code which uses _ as assigment 2) Sometimes I load packages which use _ as selector (like Glorp).
So now I cannot have both. It means that if I load Glorp, I cannot load code that needs _ as assigment. If I load code that needs _ as assigment, I cannot load Glorp.
maybe I'm wrong but can't you load them as follow: 1: allow _ as assignment 2: then load the code that have _ as assignment 3: vorbid _ as assignment 4: then load Glorp Alain
THAT means a "broken mess" for me.
Thanks anyway.
Lukas
-- Lukas Renggli www.lukas-renggli.ch <http://www.lukas-renggli.ch>
-- Mariano http://marianopeck.wordpress.com
I don't agree that having both at the same time is a mess. In fact, I need exactly that:
1) Sometimes I load code which uses _ as assigment 2) Sometimes I load packages which use _ as selector (like Glorp).
So now I cannot have both. It means that if I load Glorp, I cannot load code that needs _ as assigment. If I load code that needs _ as assigment, I cannot load Glorp.
THAT means a "broken mess" for me.
Why? You can change the setting before you load each individual package. It only affects code that is newly parsed, existing code continues to work the way it was compiled. This should encourage you to clean up the underscore assignment mess. There is really no reason to keep an underscore assignment. Lukas -- Lukas Renggli www.lukas-renggli.ch
+1 I like the idea that we removed _ in assignment.
I don't agree that having both at the same time is a mess. In fact, I need exactly that:
1) Sometimes I load code which uses _ as assigment 2) Sometimes I load packages which use _ as selector (like Glorp).
So now I cannot have both. It means that if I load Glorp, I cannot load code that needs _ as assigment. If I load code that needs _ as assigment, I cannot load Glorp.
THAT means a "broken mess" for me.
Why? You can change the setting before you load each individual package. It only affects code that is newly parsed, existing code continues to work the way it was compiled.
This should encourage you to clean up the underscore assignment mess. There is really no reason to keep an underscore assignment.
Lukas
-- Lukas Renggli www.lukas-renggli.ch
Mariano, As much as I don't like to adopt the position, all too common in other forums, that "you can't do that because I think it's ugly," I am forced to agree with Lucas. It's not that I care whether or not *you* have underscore assignments at your disposal, but having both really would be a broken mess. Is it simply that you want to type _ and get :=? YEARS ago, I offered a near optimal solution to the problem. Never did I hear anyone say they wanted _ in their sources; they wanted to see a back-arrow, and they especially didn't want type the extra character. So, the fix is obvious: an *optional* editor feature that hijacks a key (probably _), inserts :=, and when the option is set, deleting = takes with it any preceding :. Then one has "underscore assignment" with the reduced typing and the compiler and sources are never burdened with the ambiguities that can arise, and the hijacking of _ is optional for those who do not want it. If you want to simultaneously load code with and w/o underscore assignment, I agree with Lucas that you really need to fix the legacy code, maybe in a separate image(??) and then load the fixed code. Am I missing something? I'm trying to be helpful and honest at the same time. Bill ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] on behalf of Lukas Renggli [renggli@gmail.com] Sent: Sunday, October 30, 2011 2:16 PM To: Pharo-project@lists.gforge.inria.fr Cc: Benjamin Van Ryseghem Subject: Re: [Pharo-project] Still more problems with underscore
Hi guys. I still have problems with underscore in Pharo 1.3. I want to use underscore in both ways: in selectors and as assigment.
Who would tell the system what you mean?
If I do: Scanner allowUnderscoreAsAssignment: true. then it works in selectrs but not in assigment.
If I do String allowUnderscore. then it works for assigment but stops working for selector.
This is the point of the design. Maybe the prefix "allow" is not quite revealing enough, because you cannot have both. You load the old code with the setting set to true. You fix your broken assignments and you switch to false to use underscores. Squeak has decided to go another way and allow both cases kind of simultaneous. What a broken mess! Lukas -- Lukas Renggli www.lukas-renggli.ch
On Sun, 30 Oct 2011, Lukas Renggli wrote:
Hi guys. I still have problems with underscore in Pharo 1.3. I want to use underscore in both ways: in selectors and as assigment.
Who would tell the system what you mean?
If I do: Scanner allowUnderscoreAsAssignment: true. then it works in selectrs but not in assigment.
If I do String allowUnderscore. then it works for assigment but stops working for selector.
This is the point of the design. Maybe the prefix "allow" is not quite revealing enough, because you cannot have both.
You load the old code with the setting set to true. You fix your broken assignments and you switch to false to use underscores.
Squeak has decided to go another way and allow both cases kind of simultaneous. What a broken mess!
It's definitely not broken and it's far from mess. If you enable bot preferences, then you still have an unambiguous grammar, which lets you use undescores both in selectors and for assignment. Levente
Lukas
-- Lukas Renggli www.lukas-renggli.ch
participants (6)
-
Alain Plantec -
Levente Uzonyi -
Lukas Renggli -
Mariano Martinez Peck -
Schwab,Wilhelm K -
Stéphane Ducasse