Hi all,
Vivide has the following small Object extension:
<- anObject
^ anObject -> self
I find it quite useful for reasons of symmetry.
Killer feature: #(one two three) withIndexCollect: #<-
How would you think about integrating it into Trunk? :-)
Best, Christoph
Carpe Squeak!
|
Thiede, Christoph <[hidden email]> schrieb am So., 15. Dez. 2019, 12:14:
I find this hard to read. You have to wrap your head around it to understand what happens. In which situations is <- more practical than ->? Can you give more examples? |
Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the latter but I despise it for the former. Jakob Reschke <[hidden email]> schrieb am So., 15. Dez. 2019, 12:36:
|
In reply to this post by Christoph Thiede
> <- anObject
> ^ anObject -> self Please don't. The <- selector can be useful in other contexts (I use in muO for example, in very specific classes). Stef |
In reply to this post by Christoph Thiede
On Sat, Dec 14, 2019 at 07:59:43PM +0000, Thiede, Christoph wrote:
> Hi all, > > > Vivide has the following small Object extension: > > > <- anObject > ^ anObject -> self > > > I find it quite useful for reasons of symmetry. > > > Killer feature: > > #(one two three) withIndexCollect: #<- > > > How would you think about integrating it into Trunk? :-) > From the perspective of reading and cemprehension, I find it easier to read this: #(one two three) withIndexCollect: [ :e :i | i -> e ] Why? Because I already understand what is meant by #-> and I can directly read the expression without needing to check the meaning of #<-. So for me it is slightly more verbose, but faster to read and easier to understand. Also, while it is easy to add something to Object, it is extremely difficult to take it out later. Nice features like this tend to accumulate over time, and eventually make the system harder to understand. Have a look at Morph for a notorious example :-) Dave |
In reply to this post by Jakob Reschke
> On 2019-12-15, at 3:38 AM, Jakob Reschke <[hidden email]> wrote: > > Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the latter but I despise it for the former. Also +1. What next - 1 value: 4 value: 'two' being handled by converting the 1 to #one, sending #isKindOf: to the second arg and then coercively converting the first argument to a compatible class via an indirection dictionary provided by a database lookup from the receiver? tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Useful random insult:- Ought to have a warning label on his forehead. |
Hi, thanks for your arguments!
I think that #<- would be symmetric to #->, such as #< and #>, etc. ... Another example would be [Dictionary newFrom: {1 <- #one. 2 <- #two. 3 <- #three}], but I agree, readability is quite subjective here.
@Jakob: > Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the
latter but I despise it for the former.
Interesting statement! From a scripting perspective, it would be great to have a maximum number of convenient utils. However, I find it always confusing when you start building a solution via scripting and then need to rephrase your code because scripting
syntax is not available for real programs. This compromises the idea of the One Uniform Smalltalk.
Best,
Christoph
Von: Squeak-dev <[hidden email]> im Auftrag von tim Rowledge <[hidden email]>
Gesendet: Sonntag, 15. Dezember 2019 19:59:19 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] #<- > On 2019-12-15, at 3:38 AM, Jakob Reschke <[hidden email]> wrote: > > Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the latter but I despise it for the former. Also +1. What next - 1 value: 4 value: 'two' being handled by converting the 1 to #one, sending #isKindOf: to the second arg and then coercively converting the first argument to a compatible class via an indirection dictionary provided by a database lookup from the receiver? tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Useful random insult:- Ought to have a warning label on his forehead.
Carpe Squeak!
|
> From my point of view, Stef, implementing #<- with a completely > different meaning would be confusing. This is really a personal preference. From my own point of view, I do not see why a formal symmetry in a method selector should imply a symmetry in the method semantics. For example, would you implement #\ in Number, so that 2\3 is 3/2 ? Anyway my actual point is that what you propose here is that #<- would be implemented in Object, making it unavailable to all classes in the system. This represents a very important cost for no new semantics, just syntactic sugar. Stef |
In reply to this post by Christoph Thiede
I think #-> was not a good idea. I personally use it fairly rarely, and
it's just a shorthand variant of Association>>key:value:. It was probably more useful when brace arrays were not part of the language, but I find the latter way superior for creating tuples. Levente On Mon, 16 Dec 2019, Thiede, Christoph wrote: > > Hi, thanks for your arguments! > > > I think that #<- would be symmetric to #->, such as #< and #>, etc. ... > > Another example would be [Dictionary newFrom: {1 <- #one. 2 <- #two. 3 <- #three}], but I agree, readability is quite subjective here. > > > From my point of view, Stef, implementing #<- with a completely different meaning would be confusing. I guess this depends on your specific domain. > > > @Jakob: > > > Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the latter but I despise it for the > former. > > > Interesting statement! From a scripting perspective, it would be great to have a maximum number of convenient utils. However, I find it always confusing when you start building a solution via scripting and then need to > rephrase your code because scripting syntax is not available for real programs. This compromises the idea of the One Uniform Smalltalk. > > Best, > Christoph > > _________________________________________________________________________________________________________________________________________________________________________________________________________________________________ > Von: Squeak-dev <[hidden email]> im Auftrag von tim Rowledge <[hidden email]> > Gesendet: Sonntag, 15. Dezember 2019 19:59:19 > An: The general-purpose Squeak developers list > Betreff: Re: [squeak-dev] #<- > > > > On 2019-12-15, at 3:38 AM, Jakob Reschke <[hidden email]> wrote: > > > > Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the latter but I despise it for the > former. > > Also +1. What next - > 1 value: 4 value: 'two' > being handled by converting the 1 to #one, sending #isKindOf: to the second arg and then coercively converting the first argument to a compatible class via an indirection dictionary provided by a database lookup from the > receiver? > > tim > -- > tim Rowledge; [hidden email]; http://www.rowledge.org/tim > Useful random insult:- Ought to have a warning label on his forehead. > > > > > |
I use associations with #-> quite often - for example, with Dictionary class >> #newFrom::
Dictionary newFrom: {1 -> #one. 2 -> #two}
In Contrast to #at:put:, the above version checks that each key is unique.
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Levente Uzonyi <[hidden email]>
Gesendet: Montag, 16. Dezember 2019 15:52:12 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] #<- I think #-> was not a good idea. I personally use it fairly rarely, and
it's just a shorthand variant of Association>>key:value:. It was probably more useful when brace arrays were not part of the language, but I find the latter way superior for creating tuples. Levente On Mon, 16 Dec 2019, Thiede, Christoph wrote: > > Hi, thanks for your arguments! > > > I think that #<- would be symmetric to #->, such as #< and #>, etc. ... > > Another example would be [Dictionary newFrom: {1 <- #one. 2 <- #two. 3 <- #three}], but I agree, readability is quite subjective here. > > > From my point of view, Stef, implementing #<- with a completely different meaning would be confusing. I guess this depends on your specific domain. > > > @Jakob: > > > Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the latter but I despise it for the > former. > > > Interesting statement! From a scripting perspective, it would be great to have a maximum number of convenient utils. However, I find it always confusing when you start building a solution via scripting and then need to > rephrase your code because scripting syntax is not available for real programs. This compromises the idea of the One Uniform Smalltalk. > > Best, > Christoph > > _________________________________________________________________________________________________________________________________________________________________________________________________________________________________ > Von: Squeak-dev <[hidden email]> im Auftrag von tim Rowledge <[hidden email]> > Gesendet: Sonntag, 15. Dezember 2019 19:59:19 > An: The general-purpose Squeak developers list > Betreff: Re: [squeak-dev] #<- > > > > On 2019-12-15, at 3:38 AM, Jakob Reschke <[hidden email]> wrote: > > > > Sometimes I think one should separate Smalltalk the programming language from Smalltalk as a scripting language (in Vivide or your spreadsheets, Christoph). I find such brevity cool for the latter but I despise it for the > former. > > Also +1. What next - > 1 value: 4 value: 'two' > being handled by converting the 1 to #one, sending #isKindOf: to the second arg and then coercively converting the first argument to a compatible class via an indirection dictionary provided by a database lookup from the > receiver? > > tim > -- > tim Rowledge; [hidden email]; http://www.rowledge.org/tim > Useful random insult:- Ought to have a warning label on his forehead. > > > > >
Carpe Squeak!
|
In reply to this post by Christoph Thiede
Thiede, Christoph <[hidden email]> schrieb am Mo., 16. Dez. 2019, 12:16:
And introducing all the scripting shortcuts to the main language compromises the idea of the well readable source code ;-) whenever I look at shell script or Perl I am reminded that they are apparently not made to be read by humans. For example, I again found your Dictionary newFrom: { 1 <- #one. 2 <- #two } very confusing. Keys usually come first in the Smalltalk "literature" (other code), now whaaat?? In my opinion, it is like allowing people to occasionally write English right-to-left if the author thinks it is appropriate. |
> On 2019-12-16, at 9:57 AM, Jakob Reschke <[hidden email]> wrote: > > > And introducing all the scripting shortcuts to the main language compromises the idea of the well readable source code ;-) whenever I look at shell script or Perl I am reminded that they are apparently not made to be read by humans. Exactly. If anyone goes down the path of making Smalltalk accept nonsense like that, or makes it look like APL etc, then I will reach down the internet and flick their earlobes until they scream uncle. > > For example, I again found your Dictionary newFrom: { 1 <- #one. 2 <- #two } very confusing. Keys usually come first in the Smalltalk "literature" (other code), now whaaat?? > > In my opinion, it is like allowing people to occasionally write English right-to-left if the author thinks it is appropriate. > puY. tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Receptacle: a very playful welcome from a receptionist |
I don't buy #<- neither. We don't expect symmetry here probably because keys and values have very asymetrical role. Le lun. 16 déc. 2019 à 21:45, tim Rowledge <[hidden email]> a écrit :
|
+1000
I can't believe we're having a discussion about that nonsense! On 2019-12-16 16:08, Nicolas Cellier wrote: > I don't buy #<- neither. > We don't expect symmetry here probably because keys and values have > very asymetrical role. -- ----------------- Beno??t St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth GitHub: bstjean Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein) |
Sorry for wasting your time - I found it as always very interesting to hear your arguments to such design questions. I understand that the side effects of such a selector would probably outweigh the scripting convenience. Thanks for your patience!
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Benoit St-Jean via Squeak-dev <[hidden email]>
Gesendet: Montag, 16. Dezember 2019 22:16:43 An: [hidden email] Betreff: Re: [squeak-dev] #<- +1000
I can't believe we're having a discussion about that nonsense! On 2019-12-16 16:08, Nicolas Cellier wrote: > I don't buy #<- neither. > We don't expect symmetry here probably because keys and values have > very asymetrical role. -- ----------------- Beno??t St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth GitHub: bstjean Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
Carpe Squeak!
|
On Mon, Dec 16, 2019 at 10:15:28PM +0000, Thiede, Christoph wrote:
> Sorry for wasting your time - I found it as always very interesting to > hear your arguments to such design questions. I understand that the > side effects of such a selector would probably outweigh the scripting > convenience. Thanks for your patience! > > > Best, > > Christoph > Don't apologize, you are exploring and asking interesting questions. The rest of us old guys can stop debating any time we want to ;-) Dave |
> Don't apologize, you are exploring and asking interesting questions.
Agreed. It's nice to have some fresh brainstorming at times... Stef |
This is how I make use of #<- in Vivide: Why this effort? 1) The tool builder can concisely express read/write operations on method objects for a #text property. 2) Interactive views - such as text fields - can just call "model node text: newText" to trigger -- here -- the recompilation of that method. Here is more: https://github.com/hpi-swa/vivide Best, Marcel
|
Free forum by Nabble | Edit this page |