Why not just implement your own #asDictionary message on
SequencableCollection, if it's that much of an issue? asDictionary "Answer a Dictionary with receivers elements. Assumes all elements are associations" | dict | dict := Dictionary new. self do: [:each | dict add: each]. ^dict That will do what you're asking. John. Jason Johnson wrote: > On Wed, Mar 5, 2008 at 10:23 PM, David Mitchell > <[hidden email]> wrote: >> Brace notation for dynamic arrays! > > So instead of: > > dictionary := { $a -> 1. $b -> 2. $c -> 3 } asDictionary. > > I need to type: > > dictionary := Dictionary new > add: $a -> 1; > add: $b -> 2; > add: $c -> 3; > yourself. > > ? In my opinion the other dialects should adopt this or propose > another way of doing it. No concise syntax for dynamically creating a > collection seems a problem to me, and easy to remedy in a language > where one has access to the reader/compiler. So why would it be bad > to do so? > > > > > -- John Thornborrow http://www.pinesoft.co.uk ****************************************************************************************************************************************** This email is from Pinesoft Limited. Its contents are confidential to the intended recipient(s) at the email address(es) to which it has been addressed. It may not be disclosed to or used by anyone other than the addressee(s), nor may it be copied in anyway. If received in error, please contact the sender, then delete it from your system. Although this email and attachments are believed to be free of virus, or any other defect which might affect any computer or IT system into which they are received and opened, it is the responsibility of the recipient to ensure that they are virus free and no responsibility is accepted by Pinesoft for any loss or damage arising in any way from receipt or use thereof. ******************************************************************************************************************************************* Pinesoft Limited are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA |
John: that was not the question at all ;)
Folks: if you continue this thread, can you *please* rename it appropriately? Thanks, - Bert - On 20.05.2008, at 12:28, John Thornborrow wrote: > Why not just implement your own #asDictionary message on > SequencableCollection, if it's that much of an issue? > > asDictionary > "Answer a Dictionary with receivers elements. > Assumes all elements are associations" > | dict | > dict := Dictionary new. > self do: [:each | dict add: each]. > ^dict > > That will do what you're asking. > > John. > > Jason Johnson wrote: >> On Wed, Mar 5, 2008 at 10:23 PM, David Mitchell >> <[hidden email]> wrote: >>> Brace notation for dynamic arrays! >> So instead of: >> dictionary := { $a -> 1. $b -> 2. $c -> 3 } asDictionary. >> I need to type: >> dictionary := Dictionary new >> add: $a -> 1; >> add: $b -> 2; >> add: $c -> 3; >> yourself. >> ? In my opinion the other dialects should adopt this or propose >> another way of doing it. No concise syntax for dynamically >> creating a >> collection seems a problem to me, and easy to remedy in a language >> where one has access to the reader/compiler. So why would it be bad >> to do so? >> > > -- > John Thornborrow > http://www.pinesoft.co.uk > > > ****************************************************************************************************************************************** > This email is from Pinesoft Limited. Its contents are confidential > to the intended recipient(s) at the email address(es) to which it > has been addressed. It may not be disclosed to or used by anyone > other than the addressee(s), nor may it be copied in anyway. If > received in error, please contact the sender, then delete it from > your system. Although this email and attachments are believed to be > free of virus, or any other defect which might affect any computer > or IT system into which they are received and opened, it is the > responsibility of the recipient to ensure that they are virus free > and no responsibility is accepted by Pinesoft for any loss or damage > arising in any way from receipt or use thereof. > ******************************************************************************************************************************************* > > > Pinesoft Limited are registered in England, Registered number: > 2914825. Registered office: 266-268 High Street, Waltham Cross, > Herts, EN8 7EA > |
In reply to this post by jgfoster
On Wed, May 14, 2008 at 8:12 PM, James Foster <[hidden email]> wrote:
> On May 14, 2008, at 6:47 PM, Jason Johnson wrote: > > I don't think that Dolphin or GemStone/S have ways of modifying the parser. You misunderstand me. You have the parser code in your image and you can modify it. I meant that there is probably a "standard" way to do it in many of the Smalltalks. Though in Dolphin it isn't needed since they already have macros (the ## syntax). > I thought that with Smalltalk we claim that the more verbose code was > helpful for maintenance. I'd much rather have keyword selectors than > comma-separated arguments. Well, you are applying the "verbose" label to something different then I am. Personally I prefer the keyword arguments and actually find it concise and self documenting. By verbose I meant "how many lines of code to do something" and "how much of this code is just silly boiler-plate that I just don't have a way to avoid". I used to have a link of a study comparing Java, C++ and Smalltalk. At that time Java was 3 times more productive then C++ and Smalltalk 3 times more productive then Java, based on how much code the developer had to write. >Also, I don't care much for syntactic shortcuts > like dynamic constructors. Although people describe Lisp as simple, I keep > getting lost on the meaning of a single forward quote, a single backward > quote, a double quote, a comma, etc. One of the early languages I learned > was M (aka, MUMPS), where the semicolon had four different meanings, > depending on the context. Of course, we weren't conserving characters for > the programmers or for the maintainers, but for the machine--each user had 2 > KB for code and data. > > James Foster > > |
Free forum by Nabble | Edit this page |