[Newbies] Re: error trap

2006-08-14 Thread Klaus D. Witzel

On Sun, 13 Aug 2006 18:31:23 +0200, Damien Cassou wrote:

Yes. And, into the other direction, even in good core methods one often  
finds things like

  ^ dict at: aKey ifAbsent: [nil]
 There seems to be a natural confusion between object value and  
block value.


What's the problem with that ?


The lack of understanding the expressive power of the software developer  
is the problem. Why always use a hammer? Because everything looks like  
nails?


Yes, 'nil value' answers nil but 'nil' is not a block and #at:ifAbsent:  
waits for a block (the parameter is called aBlock).


No, #at:ifAbsent: doesn't wait for an instance of BlockContext. Smalltalk  
is typeless and, if at all, only has *one* (the universal) type.



It is shorter to write 'nil' directly I agree.


And the compiler is not forced to emit code for a BlockContext and the VM  
is not forced to create a BlockContext only for throwing it away unused  
(unused in the sense that nil == [nil] value). It is like writing (x)  
versus (0+x) or (1*x).



What is more problematic in my point of view is code like this:

AbstractLauncherparameterAt: parName ifAbsent: aBlock
   Return the parameter named parName.
 Evaluate the block if parameter does not exist.
   ^self parameters
 at: parName asUppercase
 ifAbsent: [aBlock value]

It may be me (still a beginner), but it looks equivalent to

   ^self parameters
 at: parName asUppercase
 ifAbsent: aBlock


Yes, anObject == [anObject] value.


which is faster and clearer in my opinion.


Sure.

/Klaus

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Why hasn't Smalltalk been wildly accepted?

2006-08-14 Thread stéphane ducasse

you are right!

BTW did you try http://smallwiki.unibe.ch/Botsinc for your kids and  
also Plop (but that this is really for the total fun).

You should have a look at Dolphin this is even slicker :)

Stef

On 14 août 06, at 07:46, christo wrote:


Hi All,

I'm VERY new to Smalltalk and I'm currently cherishing my first  
impressions of Squeak (because they are informative not because  
they are positive) and further I am paid to write Java at work.  
With that out of the way I'd like to agree with Keith Hodges here.


Its all down to marketing marketing and more marketing.

Very true. It's something I've observed many brilliant programmers  
utterly fail to grasp.


For those of you who fail likewise this try this exercise: Imagine  
your first experience of something new. Imagine you can't stand the  
smell of it. You have such a visceral response to it that you  
really don't want to consider any other worthy attributes of it.  
The only thing that can occupy your mind is that it stinks and you  
want to throw up and please can someone just get it away from you.


Now imagine something that has not been expertly marketed and  
designed (though not necessarily commercially marketed and  
designed). To the vast majority of people (perhaps not people like  
you and perhaps not rightly) this new thing smells just like the  
thing you imagined. Until that marketing happens (either virally  
through personal recommendation or through more traditional means)  
that thing will stink for anyone else who goes near it.


I hope this metaphor isn't too way out but for me it captures the  
problem with Squeak (and other good technical things that have not  
had their due attention in the world). I know squeak isn't  
Smalltalk but I ultimately tried Squeak because I wanted to teach  
my kids programming and learn a nice language myself. So far so  
good but I decided to carefully capture some of my initial  
impressions. Squeak definitely lacks any kind of capable graphic  
design or usability sense. It's not a criticism because of course I  
can try to help fix it etc etc. But it is intended to serve as an  
explanation to those who just can't imagine why others wouldn't  
fall instantly in love with it.


I've lumped visual design and marketing together in this discussion  
which is usually an oversimplification, but I think it contrasts  
with the purist engineering aspect.


The name Smalltalk also smells by the way. Java used to smell a  
bit because it sounds kinda funky and unprofessional on first  
hearing to a middle manager, but over time this reaction has been  
marketed away. Smalltalk sounds to those folk like something  
feeble, uncapable. It can be overcome but only with attention paid  
to promotion.


Marketing forms preconceptions and prejudices. Lack of marketing  
makes things seem suspect and unworthy in comparison to those  
things that get good press (however unworthily).


I do intend to follow advice I've received from professional  
Smalltalk developers and get Cincom's IDE but I don't think that's  
going to be part of my project to teach my kids to program.



You should have a look at Dolphin this is even slicker :)





Feedback encouraged.

Regards,

Chris.

--
Chris Mountford

In theory, there is no difference between theory and practice.  
But, in practice, there is. -- Jan L. A. van de Snepscheut

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: error trap

2006-08-14 Thread Klaus D. Witzel
On Mon, 14 Aug 2006 10:17:40 +0200, Damien Cassou  
[EMAIL PROTECTED] wrote:

Klaus D. Witzel wrote:

For an example try a printIt on
  ^ true ifTrue: #a ifFalse: [false ifTrue: #b ifFalse: #c]
 Again, a natural confusion between an object's value and a block's  
value.



  - argument of ifTrue: must be a block or variable -



In VW, there is no Objectvalue method. But #value is implemented in  
Boolean and UndefinedObject. Is this Smalltalk-standard to have #value  
on Object ?


Just scanned SmalltalkV2.sources and SqueakV1.sources: #value is not  
implemented by Object nor by UndefinedObject.


/Klaus

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Why hasn't Smalltalk been wildly accepted?

2006-08-14 Thread Blake
On Fri, 11 Aug 2006 02:20:08 -0700, Klaus D. Witzel  
[EMAIL PROTECTED] wrote:



Hi Blake,

on Fri, 11 Aug 2006 09:48:58 +0200, you wrote:
On Thu, 10 Aug 2006 05:58:54 -0700, Klaus D. Witzel  
[EMAIL PROTECTED] wrote:

On Thu, 10 Aug 2006 14:43:46 +0200, Michael Kohout wrote:


When I get home(and if the weather isn't too nice) I play with Squeak.
 But when I go to work, I write Java(like a lot of people on this
list, I'd imagine).


  8-)


I can pretty much choose whatever I want to work in. I'm looking for an  
in for Smalltalk, but I have to interact with a lot of MS products


Then, how about doing something for the opposite direction, Squeak as a  
COM-server (like MS$ had done the Java extensions in their MSJAVA VM)?  
See for example


- http://www.visoracle.com/squeakfaq/com-activex.html

which mentions the Squeak .NET bridge from SqueakMap.


That's a very interesting idea, Klaus. I'll check it out!
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] HTTPSocketargString:args

2006-08-14 Thread ernst

Is there a bug in this method?
An association in the  args dictionary will contain the name of a prameter
and its value as a string. The iterationassoc value do: [ :value |   
will operate on characters of the value which I think is not intended.

args associationsDo: [ :assoc |
assoc value do: [ :value |
first ifTrue: [ first := false ] ifFalse: [ argsString 
nextPut: $ ].
argsString nextPutAll: assoc key encodeForHTTP.
argsString nextPut: $=.
argsString nextPutAll: value encodeForHTTP. ] ].

should be?

args associationsDo: [ :assoc |
first ifTrue: [ first := false ] ifFalse: [ argsString 
nextPut: $ ].
argsString nextPutAll: assoc key encodeForHTTP.
argsString nextPut: $=.
argsString nextPutAll: assoc value encodeForHTTP ].

-- 
View this message in context: 
http://www.nabble.com/HTTPSocket%3E%3EargString%3Aargs-tf2102777.html#a5794952
Sent from the Squeak - Beginners forum at Nabble.com.

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] HTTPSocketargString:args

2006-08-14 Thread ernst

Just found out about HTTPSocket. It seems to be the class which should be
used for http requests. It also can do basic authentication.
Thanks
ernst



ernst wrote:
 
 Is there a bug in this method?
 An association in the  args dictionary will contain the name of a prameter
 and its value as a string. The iterationassoc value do: [ :value |   
 will operate on characters of the value which I think is not intended.
 
 args associationsDo: [ :assoc |
   assoc value do: [ :value |
   first ifTrue: [ first := false ] ifFalse: [ argsString 
 nextPut: $ ].
   argsString nextPutAll: assoc key encodeForHTTP.
   argsString nextPut: $=.
   argsString nextPutAll: value encodeForHTTP. ] ].
 
 should be?
 
 args associationsDo: [ :assoc |
   first ifTrue: [ first := false ] ifFalse: [ argsString 
 nextPut: $ ].
   argsString nextPutAll: assoc key encodeForHTTP.
   argsString nextPut: $=.
   argsString nextPutAll: assoc value encodeForHTTP ].
 

-- 
View this message in context: 
http://www.nabble.com/HTTPSocket%3E%3EargString%3Aargs-tf2102777.html#a5795456
Sent from the Squeak - Beginners forum at Nabble.com.

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Instance Creation Howto

2006-08-14 Thread stéphane ducasse

Hi

this solution is not really adequate since initializer is an instance  
method therefore the ComplexClass new is created but to receive

the message initializer we need to already have an instance. :)

Stef

On 14 août 06, at 16:18, Thiyagarajan wrote:


hello


aComplex := ComplexClass new.

and create a method new which override new

new
^ super new initializer

and create a another method initializer

initializer
| aVariable |
aVariable := ComplexClass new.
aVariable firstVariable: 22.
aVariable secondVariable: 23.
^aVariable





--

Message: 10
Date: Sun, 13 Aug 2006 23:23:43 +0200
From: hypolit [EMAIL PROTECTED]
Subject: [Newbies] Instance Creation Howto
To: beginners@lists.squeakfoundation.org
Message-ID:
[EMAIL PROTECTED] 
Content-Type: text/plain; charset=iso-8859-1

Hello,

I am new to Smalltalk and Squeak in general. After having started  
to read

Inside Smalltalk and Smalltalk by Example i came along two similar
examples, which sound quite reasonable but don't seem to work in  
Squeak.

I want to create an instance of my own class ComplexClass.

It is defined like this:
Object subclass: #ComplexClass
instanceVariableNames: 'firstVar secondVar'
classVariableNames: ''
poolDictionaries: ''
category: 'TestClass'


I can create instances with
aComplex := ComplexClass new.
normally.

But what if i wanted to call another method instead of new to  
create an

instance?
Take, for example, my method initializer:

initializer
| aVariable |
aVariable := ComplexClass new.
aVariable firstVariable: 22.
aVariable secondVariable: 23.
^aVariable


In both books there are methods quite similar to my initializer  
method.

But if execute:

aComplex2 := ComplexClass initializer.

I get an error message, something like Undefined Object does not  
understand

#initializer.
Do i have to write:

aComplex2 := ComplexClass new.
aComplex2 := aComplex2 initalizer.

That would work but it is quite ugly.


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Why hasn't Smalltalk been wildly accepted?

2006-08-14 Thread christo
Thanks all for the feedback.I think marketing tends to focus on very simple positive aspects. Something like it's just better will usually suffice. It's precisely the thing that is very difficult to argue in detail about and it has an unambiguous emotional impact.
Getting into language comparisons is often beside the point since people are making an emotional reaction and then perhaps rationalising things post hoc (justifying by finding reasons for their emotional choices). Not everyone does this but I suspect a large number of people do.
Look at Macintosh. When the thing was first released it had no hard drive, no colour, no software and it was expensive. Apple's marketing was it's a macintosh. That was enough! It wasn't marketed as a computer. It's a whole new thing for which there is no comparison. Many sober comparisons of Mac against alternatives didn't fall in favour of Mac. The formula is working. People love their macs! By the way I'm not suggesting they aren't great machines in their own right.
Thanks for the pointers about Botsinc, Blake and Dolphin, Stéphane I'll check them out.Regards,-- Chris MountfordIn theory, there is no difference between theory and practice. But, in practice, there is. -- Jan L. A. van de Snepscheut

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Squeak and Pocket PC questions

2006-08-14 Thread Yoshiki Ohshima
  Hello, Petr,

 I have some questions about the use of Squeak on Pocket PC (Windows
 Mobile 5 [WM5]).

  I don't have any experience with WM5, but...

 1) how to detect tap and hold event?

  If I remember correctly, it is reported as a blue button
click. (But since you're asking this, I may be wrong.)  What should
it do?

 2) how to disable fullscreen display mode? (is it possible? is it
 possible to show squeak GUI form on screen with WM5 taskbar and
 start-menu visible?)

  It should have been possible, if the image is not configured to
start up in full-screen mode.  (But again, it may not be the case on
WM5).  Try 'full screen on' and 'full screen off' in the 'help...'
menu and see what happens.

 3) how to show standard WM5 keyboard on screen if squeak appliaction is
 running?

  Same as above.

 4) will be Squeak 3.9 image for Pocket PC available in the future?

  Did you try?  It may work just fine.

-- Yoshiki
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners