[Newbies] Re: Smalltalk Data Structures and Algorithms

2009-07-29 Thread Klaus D. Witzel

On Wed, 29 Jul 2009 16:57:22 +0200, David Mitchell wrote:


I don't think there is a misunderstanding. There is disagreement. You
don't correct disagreement.

Alan Kay feels his influence was from biology (and other things,
including LISP).

Richard finds flaws in the analogy.

No misunderstanding.


+1

Only disagreement and lots of ... in Smalltalk ... missing from the  
listing of the six core principles' POV.


And thank you very much Ben for writing this all up. I love it :)

/Klaus



On Wed, Jul 29, 2009 at 12:38 AM, Benjamin L.
Russelldekudekup...@yahoo.com wrote:

Below is a message I posted to correct Richard O'Keefe's
misunderstanding in understanding the significance of biology as one
of the origins of Smalltalk [1] (see
http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/61718):


Incidentally, just for the record, in response to my forwarding your
claim, Alan Kay, the inventor of Smalltalk, just refuted your
refutation [1] (see
http://lists.squeakfoundation.org/pipermail/beginners/2009-July/006331.html);
_viz._:

I most definitely still think of OOP at its best as being  
biological.


[1] Kay, Alan. [Newbies] Re: Smalltalk Data Structures and
Algorithms. The Beginners Archives. Squeak.org. 24 July 2009. 27 July
2009.  
http://lists.squeakfoundation.org/pipermail/beginners/2009-July/006331.html.


Nevertheless, O'Keefe now still insists that Smalltalk did not
originate in biology [2] (see
http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/61749);
_viz._:

On Tue, 28 Jul 2009 13:35:09 +1200, in gmane.comp.lang.haskell.cafe
Richard O'Keefe o...@cs.otago.ac.nz wrote:



On Jul 27, 2009, at 6:30 PM, Benjamin L.Russell wrote:

Incidentally, just for the record, in response to my forwarding your
claim, Alan Kay, the inventor of Smalltalk, just refuted your
refutation [1] (see
http://lists.squeakfoundation.org/pipermail/beginners/2009-July/006331.html)
;
_viz._:


If you read carefully what he wrote there,
it doesn't actually contradict what I said.
(For what it's worth, I _have_ read a good deal of
Alan Kay's writings.)

Molecular biology may very well have been an influence
on Alan Kay, but there are no traces of it in Smalltalk.
The concepts of Smalltalk have their roots in Lisp,
including the original version using nil as false, and
the meta-circular interpreter.

Sketchpad and Simula also have no trace of biology in them.

As for the claim that Smalltalk had its roots in Lisp,
this is not my opinion.  It's straight from the horse's
mouth.  Visit

http://www.smalltalk.org/smalltalk/TheEarlyHistoryOfSmalltalk_IV.html
whose title is The first real Smalltalk, and you will read
this paragraph:

I had orignally made the boast because McCarthy's
 self-describing LISP interpreter was written in itself.
 It was about a page, and as far as power goes,
 LISP was the whole nine-yards for functional languages.
 I was quite sure I could do the same for object-oriented
 languages plus be able to do a resonable syntax for the
 code a loa some of the FLEX machine techiques.
[Errors in the page.]

So clearly Alan Kay _was_ influenced by Lisp,
and the initial Smalltalk-72 implementation _was_
influenced by the Lisp meta-circular interpreter.

While we're on that page, here are the six core principles:
  1. Everything is an object
     [Where's the biology in that?  Rocks are objects.]
  2. Objects communicate by sending and receiving messages
     (in terms of objects)
     [Where's the biology in that?  Sounds more like the
     telephone system.  And when organisms send messages
     to other organisms, those messages are not themselves
     organisms, although that might make a neat gimmick for
     a science fiction story.]
  3. Objects have their own memory (in terms of objects)
     [Many organisms have memory.  But their memories are
     not themselves organisms.  Again that might make a
     nice science fiction gimmick, and Brin's hydrogen
     breathers in the Uplift series come close.  Not in THIS
     biology though.]
  4. Every object is an instance of a class
     (which must be an object)
     [Maybe here's the biology?  But no, Simula 67 had
     single-inheritance classes, with never a trace of
     biology.  There's certainly no biology-talk in the
     Simula Common Base manual that I can find.  Again, in
     THIS biology, a taxon is not itself an organism,
     so if anything, Smalltalk is contradicting biology.]
  5. The class holds the shared behavior for its instances
     (in the form of objects in a pogram list)
     [Errors in the page.  Where's the biology here?
     Organisms behave, but their behaviour isn't made of
     organisms held in another organism.  Class as site of
     shared behaviour is straight Simula (and of course
     other sources).]
  6. To eval a program list, control is passed to the first
     object and the remainder is treated as its message
     [Does that look like biology to you?]

A PDF of the whole thing is

[Newbies] Re: [Q] Best way of doing ...

2009-05-06 Thread Klaus D. Witzel

On Tue, 05 May 2009 15:29:30 +0200, Edgar J. De Cleene wrote:


People:
I need a way for two collections of different size could be tested for  
all elements in both.


A quick and dirty (a prototype) is, to put both into the same new  
IdentitySet (or set, depends on your #=) and then just compare sizes.


Then you also don't need to sort, the set (of both) will free you from  
sorting. And #copyWithoutAll: can then give you things in B which are not  
in A, etc.


HTH.


Example:

A  := #(a1 a2 a3).
B := #(b1 b2 b3 b4 b5).

Some similar to

with: otherCollection do: twoArgBlock
Evaluate twoArgBlock with corresponding elements from this  
collection

and otherCollection.
otherCollection size = self size

But for different size

Very thanks


--
If at first, the idea is not absurd, then there is no hope for it.  
Albert Einstein


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


[Newbies] Polymorph (formerly UIEnhancements) [was: Squeak Guilt]

2008-12-17 Thread Klaus D. Witzel

On Tue, 16 Dec 2008 21:43:41 +0100, Claus Kick wrote:


Klaus D. Witzel wrote:

On Tue, 16 Dec 2008 20:50:58 +0100, Claus Kick wrote:


Mark Volkmann wrote:

That sounds great for applications with a web interface, but I wish
there was a more attractive, easier way to do the same thing with
Squeak-based non-web applications.


I think that is mainly a problem of Squeak though, not Smalltalk in   
general. I fully agree though, the UI system of Squeak is just not  
good.
  Does it just look not good to you (have you checked   
UI-Enhancements/Polymorph) or what part of it do you mean?


No, I have yet to check Polymorph. I must be blind, but I dont see it on  
SqueakMap - where is it?


Polymorph (formerly UIEnhancements) is mentioned here,

-  
http://lists.squeakfoundation.org/pipermail/squeak-dev/2008-December/133171.html


Other than the looks, I do not like the feeling, the speed, the  
absence of native widgets (why do everything yourself? you have an OS to  
participate from!)


I'd appreciate your feedback on polymorph (feeling, widgets, native,  
themes).


/Klaus

I know, even Cincom canned their first new owner-drawn system, then on  
top of that native widgets if the platform allows-Projects  
(Pollock/Panda/Chagall). Having worked a bit in that direction, I also  
know how tedious or more likely impossible a task this is.


Still, one has dreams or graphics contexts being written to the GPU  
directly ... hm, sounds like OpenGL, doesnt it?


--
If at first, the idea is not absurd, then there is no hope for it.  
Albert Einstein


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


[Newbies] Re: [OT] If programming languages were religions...

2008-12-17 Thread Klaus D. Witzel

On Wed, 17 Dec 2008 20:50:09 +0100, Edgar J. De Cleene wrote:


On 17/12/2008, at 15:17, Klaus D. Witzel wrote:


[... then]
Smalltalk is the ancient Egyptian religion. The Initiated know it  
already had all the important concepts working long ago and most  
popular modern languages are incomplete subsets of it that obsess over  
artificial restrictions of their own creation while entirely missing  
the reason their code exists in the first place.


And the heart of your code will be judged against the Feather of Truth  
before it can join the message passing afterlife.


---

This was slashdotted, originated here

- http://www.aegisub.net/2008/12/if-programming-languages-were- 
religions.html


Could nor resist mentioning for the squeak-list records ;)

/Klaus

...

Very good , read this old

http://www.scribd.com/doc/320372/How-to-kill-a-Dragon-with-Programming


I tried the link, the page says iPaper loading, please wait but nothing  
else happens (except perhaps a virus infection is attempted?)


So what's this about?

--
If at first, the idea is not absurd, then there is no hope for it.  
Albert Einstein


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


[Newbies] Re: Squeak Guilt

2008-12-16 Thread Klaus D. Witzel

On Tue, 16 Dec 2008 20:50:58 +0100, Claus Kick wrote:


Mark Volkmann wrote:

That sounds great for applications with a web interface, but I wish   
there was a more attractive, easier way to do the same thing with   
Squeak-based non-web applications.


I think that is mainly a problem of Squeak though, not Smalltalk in  
general. I fully agree though, the UI system of Squeak is just not good.


Does it just look not good to you (have you checked  
UI-Enhancements/Polymorph) or what part of it do you mean?


/Klaus

--
If at first, the idea is not absurd, then there is no hope for it.  
Albert Einstein


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


[Newbies] Re: A browser for the WordNet lexical db in Smalltalk, anybody?

2008-12-12 Thread Klaus D. Witzel

Hi Steve,

on Fri, 12 Dec 2008 03:07:34 +0100, you wrote:


On Thu, Dec 11, 2008 at 10:03 AM, Klaus D. Witzel wrote:

Hi Steve,

on Thu, 11 Dec 2008 11:44:57 +0100, you wrote:


Hi Klaus,

This is a great idea!  I'll be glad to test anything you create.


:)


Unfortunately I don't have any time for development.


Do you happen to know Norberto, he emailed that he made an object model  
in

Squeak some time ago. Perhaps he can find it and send it to me over the
weekend.


Don't know Norberto.  I hope he sends you an object model.  Maybe
you're different but the blank sheet of paper is the hardest part of
creating anything for me.


Na, that's the easier part ;) took objects without pointers (words -  
Strings, synset id's - SmallIntegers, synsets - subclass of LookupKey)  
and Dictionary, easy and extendible.


Only performance of Dictionary is poor (unrelated to object model).


P.S. suggestions for a WordNet browser GUI in Squeak, anybody ?


Typeahead for search,


Oh. Have you seen some (re-)usable code for that? This seems not to be soo  
straight-forward with morphic Squeak (example: Preferences browser).



mouseover for everything in the WN archive,


Nah, too many WN entries have more than a screen-full of info (all the  
relations, all the synsets they point to, etc). I thought about a  
*browser* like the Smalltalk browsers, with panes for categories/relations  
and scrollable info-area.



and
an easy-to-extend model.  I'm interested in poetry so one thing I've
thought about is adding some of poetry's technical details to a word's
information---syllables, stresses, rhymes, etc.


This I do not understand. WordNet is about semantical relations of  
synsets, not about isolated *words* (despite word in its name). There is  
nothing one could store for one word, only for a synset/sense (multiple  
words).


Of course a relation like rhymes_with could be added easily but, there's  
nothing in WordNet for morphology, affixes, syllables and such.



 With the right kind
of interface, I could enter a poem I like and enter (some or all of)
the information along the way, or just after.  Half an hour at a time.


So you think about a poetry text editor? well, I thought about a browser  
for information retrival.



On Wed, Dec 10, 2008 at 1:30 PM, Klaus D. Witzel wrote:


Hi list,

has anyone started with/plans for a browser for a WordNet lexical db  
in

Smalltalk? I checked their Prolog formatted files,

- http://wordnet.princeton.edu/obtain

actually read them into a Squeak .image; they need only a handful of
memory MB (7.5, strings as yet not symbolized) plus less than 10MB of
disk
space if gloss texts would be stored in the .changes file.

Also, if anyone already has (or had) ideas for a GUI for a WordNet
browser
in Squeak please let me know (!) I cannot say I like their basic Web
interface (it has nothing that a Smalltalk browser offers)

-

http://wordnet.princeton.edu/perl/webwn?o0=1o1=1r=1s=small+talki=1h=100#c

and think that can be done better for local use, for example in class
rooms (and of course when authoring documentation for Squeak ;) but,
unlikely for the OLPC because of the footprint.

Thanks in advance for your feedback.

/Klaus

--
If at first, the idea is not absurd, then there is no hope for it.
Albert Einstein











--
If at first, the idea is not absurd, then there is no hope for it.  
Albert

Einstein










--
If at first, the idea is not absurd, then there is no hope for it.  
Albert Einstein


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


[Newbies] A browser for the WordNet lexical db in Smalltalk, anybody?

2008-12-10 Thread Klaus D. Witzel

Hi list,

has anyone started with/plans for a browser for a WordNet lexical db in
Smalltalk? I checked their Prolog formatted files,

- http://wordnet.princeton.edu/obtain

actually read them into a Squeak .image; they need only a handful of
memory MB (7.5, strings as yet not symbolized) plus less than 10MB of disk
space if gloss texts would be stored in the .changes file.

Also, if anyone already has (or had) ideas for a GUI for a WordNet browser
in Squeak please let me know (!) I cannot say I like their basic Web
interface (it has nothing that a Smalltalk browser offers)

-
http://wordnet.princeton.edu/perl/webwn?o0=1o1=1r=1s=small+talki=1h=100#c

and think that can be done better for local use, for example in class
rooms (and of course when authoring documentation for Squeak ;) but,
unlikely for the OLPC because of the footprint.

Thanks in advance for your feedback.

/Klaus

--
If at first, the idea is not absurd, then there is no hope for it.
Albert Einstein

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


[Newbies] Nothing much [was: what is holding back Smalltalk?]

2008-11-21 Thread Klaus D. Witzel

On Fri, 21 Nov 2008 00:02:47 +0100, Mark Volkmann [EMAIL PROTECTED] wrote:

I don't have a lot of experience with Smalltalk yet, but I really love  
what I've seen so far.


I'm curious what experienced Smalltalkers see as some of the reasons why  
it doesn't attract more attention.


Me thinks that the Smalltalk community is healthy and vibrant--it is  
just a community form one would not expect for Ruby or Python or Perl,  
etc. To get impression of my impression take a look at what *actually*  
happened during the *recent* months:


- Exupery (native x86 methods) powers Huemul
- Seaside (web++ framework++) powers GLASS
- Hydra (multiple parallel .images) powers Croquet .images
- Google hires developers with deep Smalltalk experience
- two more gods to be worshipped in the VM temple ;)
- Squeak powers NewSpeak
- new book Squeak by Example (creative commons license)
- port of OpenDBX to Squeak (still not on windoze)
- port of Squeak/VM to another smartphone platform ;)
- DrGeo made it to the XO (OLPC)
- fresh new subcommunity Pharo
- attempt? to port Moose (world class sw analysis) to Squeak
- Google hires developers with deep Smalltalk experience
- Squeak web site migrated to/powered by Aida/Web Squeak
- 4 (four) projects run through 2008's Goggle Summer of Code
- the everybody needs it Safara from GSoC as yet not in mainstream
- the everybody needs it Squeak GTK from GSoC as yet not in mainstream
- IBM builds Smalltalk IDE inside Eclipse
- Google hires developers with deep Smalltalk experience
- ESUG 2008 conference draws more attendands than ever

That list is of course incomplete, for example one wants to add the many  
noobs who joined #squeak and the beginners mailing list.


I do not think that *soo* much is holding back Smalltalk ;)

/Klaus

--
If at first, the idea is not absurd, then there is no hope for it.  
Albert Einstein


I understand the issues with Smalltalk in the past related to license  
costs and performance, but those have been addressed now. Have you tried  
to convince someone to consider Smalltalk and failed to convince them?  
Why do you think they rejected it? What improvements could be made to  
current Smalltalk environments, especially Squeak, that might sway them?


For me the biggest issue has been trying to run my code from outside  
Squeak. This includes running Squeak headless to do something script- 
like and configuring a GUI application to run in a way that doesn't  
require the user to know they are running Squeak. Both of these are  
supposedly possible, but very difficult to get right.


---
Mark Volkmann




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


[Newbies] Re: Nothing much [was: what is holding back Smalltalk?]

2008-11-21 Thread Klaus D. Witzel

On Fri, 21 Nov 2008 21:23:13 +0100, Claus Kick wrote:


Klaus D. Witzel wrote:

Me thinks that the Smalltalk community is healthy and vibrant--it is   
just a community form one would not expect for Ruby or Python or  
Perl,  etc. To get impression of my impression take a look at what  
*actually*  happened during the *recent* months:


Why would one not expect this community for Ruby or Python or Perl?  
Could you please explain what you mean, for this puzzles me ...


There are (almost uncountable ;) many things which shape these  
communities; perhaps I focus on some of the obvious from a day-to-day  
perspective:


- starting+using Smalltalk is always starting+using the whole system,  
there are no parts, in an absolute sense, and there is no way to change  
that


- the Smalltalker has generally broader knowledge about his *whole*  
system, think of navigating implementers of as an example


- the Smalltalker has generally deeper knowledge about his *whole* system,  
think of navigating senders of as an example


This (and more ;) naturally orients the community along completely  
different dimensions, beginning with the learning curve, through things  
you can change+reuse, up to things you can achieve (like VMMaker+Simulator  
or Etoys or Scratch or Croquet or Moose or DabbleDB or Sophie), with a  
handful of people, in the Smalltalk community.


/Klaus

--
If at first, the idea is not absurd, then there is no hope for it.  
Albert Einstein


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


[Newbies] Re: Binary file I/O performance problems

2008-09-03 Thread Klaus D. Witzel

Hi David,

let me respond in reverse order of your points:


I find it troubling that I am having to write code below the
abstraction level of C to read and write data from a file.  I thought
Smalltalk was supposed to free me from this kind of drudgery? Right
now, Java looks good and Python/Ruby look fantastic by comparison.


Here the difference to Squeak/Smalltalk is, that the intermediate level  
routines like #uint32 are made available at the Smalltalk language level  
where users can see them, use them and modify them. Such an approach is  
seen as part of an invaluable resource by Smalltalk users. It has a price,  
yes.


But Squeak/Smalltalk can do faster, dramatically faster than what you  
observed. The .image file (10s - 100s MB) is read from disk and  
de-endianessed in a second or so. Of course this is possible only because  
the file is in a ready-to-use format, but this can be a clue when you  
perhaps want to consider alternative input methods.



This (I think) cleans up some of the code smell, but for only marginal
performance improvements. It seems that I may need to implement a
buffer on the binary stream. Is there a good example on how this
should be done in the image or elsewhere?


I don't know of a particular example (specialized somehow on your problem  
at hand, for buffered reading of arbitrary structs) but this here is  
easy to do in Squeak:


  byteArray := ByteArray new: 2  20.
  actuallyTransferred :=
binaryStream readInto: byteArray startingAt: 1 count: byteArray size

You may perhaps want to check that GBs can be brought into Squeak's memory  
in a matter of seconds, just #printIt in a workspace:


[1024 timesRepeat: [[
(binaryStream := (SourceFiles at: 1) readOnlyCopy) binary.
byteArray := ByteArray new: 2  20.
  actuallyTransferred :=
binaryStream reset; readInto:
byteArray startingAt: 1 count: byteArray size]
 ensure: [binaryStream close]]] timeToRun

When reading from disk 4-byte-wise this makes a huge difference for sure.  
From here on you would use the ByteArray protocol (#byteAt:*, #shortAt:*,  
#longAt:*, #doubleAt:*) but as mentioned earlier these methods are perhaps  
not optimal (when compared to other languages and their implementation  
libraries) for you.


Last but not least, when doing performance critical i/o or conversions,  
Squeak users sometimes write a Squeak plugin (which then extends the  
Squeak VM), still at the Smalltalk/Slang language level but with it they  
can do/call any hw-oriented routine for speeding up things dramatically,  
and this indeed compares well to other languages and their implementation  
libraries :)


HTH.

/Klaus


On Wed, 03 Sep 2008 08:00:54 +0200, David Finlayson wrote:

OK - I made some of the suggested changes. I broke the readers into two  
parts:


uint32
returns the next unsigned, 32-bit integer from the binary
stream
isBigEndian
ifTrue: [^ self nextBigEndianNumber: 4]
ifFalse: [^ self nextLittleEndianNumber: 4]

Where nextLittleEndianNumber looks like this:

nextLittleEndianNumber: n
Answer the next n bytes as a positive Integer or
LargePositiveInteger, where the bytes are ordered from least
significant to most significant.
Copied from PositionableStream
| bytes s |
[bytes := stream next: n.
s := 0.
n
to: 1
by: -1
do: [:i | s := (s bitShift: 8)
bitOr: (bytes at: i)].
^ s]
on: Error
do: [^ nil]



David



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


[Newbies] Re: if absent put nil (Riaan)

2008-08-06 Thread Klaus D. Witzel

On Wed, 06 Aug 2008 13:47:39 +0200, Riaan van Aarde wrote:


I have the following code

renderAttendeesOn: html
self workSession attendees do: [:each | html text: each person
displayString]
separatedBy: [html text:'; '.]

if there is no attendees for my worksession, it needs to display : NO
ABSENTEES.


You can assign subexpression (self workSession attendees) to a temporary  
variable wsa and after the statement (wsa #do: ...) have another statement  
like this
  wsa ifEmpty ifTrue: [what you would like to do if there is no  
attendees].


HTH.

/Klaus


Please assist.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 05 August 2008 07:33 PM
To: beginners@lists.squeakfoundation.org
Subject: Beginners Digest, Vol 28, Issue 6

Send Beginners mailing list submissions to
beginners@lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than Re: Contents of Beginners digest...


Today's Topics:

   1. true/false defined where? (Sean Allen)
   2. Re: true/false defined where? (Derek O'Connell)
   3. Re: true/false defined where? (Michael Rueger)
   4. Re: true/false defined where? (Sean Allen)
   5. Re: true/false defined where? (Randal L. Schwartz)
   6. Re: true/false defined where? (Sean Allen)
   7. Re: Problems getting started with OpenGL in Squeak (Ken G. Brown)
   8. Fighting again with MC (Giuseppe Luigi Punzi)


--

Message: 1
Date: Tue, 5 Aug 2008 08:48:24 -0400
From: Sean Allen [EMAIL PROTECTED]
Subject: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed

where do true and false spring into existence?

i've been poking around and cant figure it out.



--

Message: 2
Date: Tue, 5 Aug 2008 13:53:18 +0100
From: Derek O'Connell [EMAIL PROTECTED]
Subject: Re: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

Have a look in Kernel-Objects

On Tue, Aug 5, 2008 at 1:48 PM, Sean Allen [EMAIL PROTECTED]
wrote:

where do true and false spring into existence?

i've been poking around and cant figure it out.

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




--

Message: 3
Date: Tue, 05 Aug 2008 14:54:45 +0200
From: Michael Rueger [EMAIL PROTECTED]
Subject: Re: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Sean Allen wrote:

where do true and false spring into existence?


They have been around longer than some people on this mailing list ;-)


i've been poking around and cant figure it out.



true and false and some of the very few objects known to the VM and they
where instantiated when the parent of all current images was created.
All images are basically cloned and not re-created from source, and
that's why you don't see any initialization code for them, they just  
are.


Hope this doesn't add to any confusion...

Michael


--

Message: 4
Date: Tue, 5 Aug 2008 09:09:01 -0400
From: Sean Allen [EMAIL PROTECTED]
Subject: Re: [Newbies] true/false defined where?
To: A friendly place to get answers to even the most basic questions
about   Squeak. beginners@lists.squeakfoundation.org
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Aug 5, 2008, at 8:54 AM, Michael Rueger wrote:


Sean Allen wrote:

where do true and false spring into existence?


They have been around longer than some people on this mailing list ;-)


i've been poking around and cant figure it out.



true and false and some of the very few objects known to the VM and
they where instantiated when the parent of all current images was
created.
All images are basically cloned and not re-created from source, and
that's why you don't see any initialization code for them, they just
are.

Hope this doesn't add to any confusion...


How is this for a confusing answer... it both 

[Newbies] Re: Another extension proposal - subsets

2008-07-24 Thread Klaus D. Witzel

On Thu, 24 Jul 2008 18:27:48 +0200, Cedrick wrote:


or withNicolas suggestion:

SetasPowerset
| subset |
subset := (OrderedCollection new: (2 raisedTo: self size))
add: Set new;
yourself.
1 to: self size do: [:subSize | don't copy anymore as there is the
Set conversion
self asArray combinations: subSize atATimeDo: [:subArray | subset
add: subArray asSet]].
^ subset asSet


Ah, you francophones always want to see Blaise Pascal's triangle at work ;)

Didn't check #combinations:* implementation, does it avoid #includes: ?

I'd still prefer #combinationsSize:do:   instead of 
#combinations:atATimeDo:


+1 but it looks alt-w friendly already (like #detectSum: looks ;)



How about naming

Collection#asPowerset
   ^ self asSet powersetInto: (Set new: (2 raisedTo: self size))

with Set#powersetInto: and putting that into the next release.

/Klaus




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


[Newbies] Re: Proper object removal

2008-06-04 Thread Klaus D. Witzel

On Wed, 04 Jun 2008 09:55:11 +0200, Norbert Hartl wrote:


On Wed, 2008-06-04 at 00:04 -0400, Rob Rothwell wrote:

Hello,

After much help already, I think I need some training in proper object
removal.

When my application creates an object and stores it in an
OrderedCollection, and than wants to delete it, I am trying to do so
quite explicitly with something like:

DataManagerdeleteSelectedAbstractors
self selected do: [:each |
self abstractors remove: each.
each := nil.
]

which removes the object from my application (it's collection), and
yet when I look for my object in the system with




DataAbstractor allInstances.

I still see the object I removed, even with an explicit Smalltalk
garbageCollect or garbageCollectMost.  Anything I create just seems to
hang around forever.

Any help understanding what I need to do to make sure my objects
really go away when I am done with them would be greatly appreciated!


The objects are still referenced in the collection you get
from self selected. The line with each := nil is useless
as each is only a temporary variable.


Not 100% useless, since temporary variables (and arguments, for that  
matter) survive any attempt, from within the same method, to garbage  
collect them:


{'this ', 'and ', 'that'} collect: [:each | ].
Smalltalk garbageCollect.
{thisContext tempAt: 1} inspect

first line: create some object and make a temp var point to it.
second line: invoke GC.
third line: see what's still pointed to by the temp var.

/Klaus


I assume that you want
to empty the selected collection as well. you could do

DataManagerdeleteSelectedAbstractors
   self selected copy do: [:each |
   self abstractors remove: each.
   self selected remove: each.
]

regards,

Norbert



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


[Newbies] Re: Proper object removal

2008-06-04 Thread Klaus D. Witzel

On Wed, 04 Jun 2008 12:12:59 +0200, Bert Freudenberg wrote:


On 04.06.2008, at 10:32, Klaus D. Witzel wrote:


On Wed, 04 Jun 2008 09:55:11 +0200, Norbert Hartl wrote:


The objects are still referenced in the collection you get
from self selected. The line with each := nil is useless
as each is only a temporary variable.


Not 100% useless, since temporary variables (and arguments, for that  
matter) survive any attempt, from within the same method, to garbage  
collect them:


{'this ', 'and ', 'that'} collect: [:each | ].
Smalltalk garbageCollect.
{thisContext tempAt: 1} inspect

first line: create some object and make a temp var point to it.
second line: invoke GC.
third line: see what's still pointed to by the temp var.



Yikes. Klaus, please keep the hair-splitting to squeak-dev if possible.


Ah. Didn't know that enumerating+removing with a block with argument  
+ GC'ing in the same method, belongs to hair-splitting. Instead, I always  
thought that's one of the reasons that at least one to-be-removed object  
is guaranteed to not go away.


But anyways, thanks for letting me know ;)


Assigning to a block parameter is just wrong.


You better read before you write (the way you most often do indeed ;) then  
you'd find that I didn't write any assignment to anything. Instead, I  
ignored that and pointed to a potential beginner's problem. Sorry you  
didn't like that ;)


Setting temps to nil is unnecessary in any normal method. If your code  
actually needs to worry about this, then you left the beginner  
playground.


And if he does removal+GC+check for success in the same method? I cannot  
see whether someone just copies arbitrary statements given in a response  
to a question, or carefully puts them into separate methods, in his code  
in his .image, now or never ;)


Rob: Here's a recipe to find out what is keeping your instances from  
being garbage-collected:


http://wiki.squeak.org/squeak/2631

- Bert -



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


[Newbies] Re: Proper object removal

2008-06-04 Thread Klaus D. Witzel

On Wed, 04 Jun 2008 15:20:05 +0200, Rob Rothwell wrote:


On Wed, Jun 4, 2008 at 8:41 AM, Klaus D. Witzel wrote:


{'this ', 'and ', 'that'} collect: [:each | ].

Smalltalk garbageCollect.
{thisContext tempAt: 1} inspect

first line: create some object and make a temp var point to it.
second line: invoke GC.
third line: see what's still pointed to by the temp var.





So...if I do line 1, then line 3, should I see items in the Array, or  
just the Array itself.


What you want to see (according to your question about object removal) is  
just the empty array; and what I wanted to point out (without  
hair-splitting ;) is, that when you GC+check this within the same method,  
it *must* fail.


In Smalltalk it's very easy to script the removal+GC+check, for example in  
a workspace or add GC+check temporarily in a debugger session; that was my  
concern.


This is all very interesting, because in my application I am creating  
lots

of collections of objects maintaining parent/child pointers, and I have
obviously just done it WRONG!


A good example for maintaining parent/child objects, which works  
perfectly, is Smalltalk's #addSubclass: #removeSubclass: (both on the  
instance side of Class); when you check these two methods think that  
'superclass' is your parent pointer.


Chasing pointers and objects is showing me that when I remove objects  
from

my collections, I need to do that all the way down, I think...

Thank you for helping my brain move in the right direction.

Rob



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


[Newbies] Explorer and MessageTally [was: remembering variables]

2008-06-03 Thread Klaus D. Witzel

On Tue, 03 Jun 2008 05:57:48 +0200, peter h meadows wrote:

Ah. Well, more often than not the variables in my code stay as one  
'type' of thing. And I thought that generally they would otherwise  
things would get really confusing!?


For this part of your question use Squeak's explorer. Try (World explore)  
to get an idea what it is about, for example expand the submorph branches  
that you see there.


Sometimes when I try to understand how a program is working I get lost  
in the debugger. What I'd like is a kind of overview of what's going on.


For this part of your question try (MessageTally spyOn: [Object  
compileAll]).



Something I can browse and focus in on the parts that seem interesting.


For MessageTally the parts of a computation which really do something are  
interesting.


In theory I can do this with the system browser but it doesn't tell me  
how everything fits together. I want to see an overview of how all the  
parts fit together.. Who uses what.. Which bits are connected.. The  
order in which things are done, etc.


MessageTally tells you how the parts of your computation fit together,  
who's using what, and the order in which things are done.


Can I get the debugger to show a tree of message sends, that I can  
browse? Something like that?


Yes, MessageTally does that for you: a tree of message sends. From the Spy  
results, you can select a class and browse it for more details, or a  
method and browse its senders or implementors for more details.



Any ideas? thx.




peter == peter h meadows [EMAIL PROTECTED] writes:


peter Oh. I'm still very new to smalltalk. It seemed like it would  
help me to
peter understand what's going on. I wanted it to remember everything.  
E.g if
peter the thing is an array it will tell me what has been stored in  
it. Also,
peter wouldn't it help with code completion? If it knows what type of  
object

peter it was in the past it can guess which messages I want to send to
peter it. That would be useful.

But the problem is that a given type in the past is not any indication  
of

a type in the future.

You're not thinking smalltalk yet.  Stop worrying about types. :)

Oh, and they aren't types.  They're instances of classes.

If you want to see what's going on, learn to single step in the  
debugger.

It's quite informative.




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


[Newbies] Re: Does create class prompt on save actually record to the changes file?

2008-05-14 Thread Klaus D. Witzel

On Wed, 14 May 2008 01:39:24 +0200, Tim M wrote:



When I save a method that references a new class, it prompts me if I  
want to create the class when I save


e.g.  initialize

  super initialize.

  self menuComponent: StMenuComponent new

If I let Squeak create the STMenuComponent class, i don't think it gets  
added to the change log - as when I crashed my image several minutes  
later and tried to follow the recovery instructions  
(http://www.eli.sdsu.edu/courses/spring01/cs683/notes/crash/crash.html)  
I wasn't able to recover source in that class as it didn't get created  
in the listed changes (although the subsequent methods I added to it  
were offered as changes to load). I think its possibly that the helpful  
prompt to create a class didn't put it in the change log? does this  
sound correct and is it a bug?


Yes, by using the fresh sq3.10-7159dev08.05.2.image I just reproduced that  
bug, there's nothing about the new class in the .changes file :(


This is easy to see with FileList = recent changes button on the .changes  
file.


Please enter a bug report @ http://bugs.squeak.org also report which  
.image you're using.



This was in the Seaside one-click install image.


/Klaus

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


[Newbies] Re: squeak 'wysiwyg' application?

2008-04-12 Thread Klaus D. Witzel

On Sat, 12 Apr 2008 20:55:49 +0200, David Goldstrom wrote:


Hi,
   I'm working through a beginner tutorial, and like what I see so far,


Welcome David :)


but I have a side question...

   Is there a wysiwyg editor for squeak? I guess I can live without
(and use LaTEX outside of Squeak) but it would be nice to have. I don't
need Word or OpenOffice but I'd like something more like Wordpad.

  Is SqueakMap the place to look for something like that, or is there
someplace else?


There's a video about Sophie in action, a Squeak wysiwyg application,

- http://www.youtube.com/watch?v=Ag59IDi3dgQ

and Sophie's home page is here,

- http://sophieproject.org/


  Are there enough tools to really 'live' in a squeak environment? One
example would be a web-browser inside Squeak so that I could access
google apps?


Look for Scamper, I think it's on SqueakMap (it may depend on your Squeak  
version).


Enjoy Squeak :)

/Klaus


Thanks in advance,
David G.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



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


[Newbies] SoC idea: Futuristic New Browser View

2008-03-08 Thread Klaus D. Witzel

Dear Squeakers,

is anybody out there who wants to do a futuristic new browser view during  
this year's SoC. It's not about the browser itself, this machinery is  
supposed to be (re-)used from existing browsers.


Also, not everything in the futuristic new browser view can be done in the  
first phase; especially the tuples for what is selectable/shown in the  
panes are supposed to be addressed in another project phase.


This can be your chance to create a new browser view which many developers  
would like to see and use :)


Drop me an email in case that is interesting to you.

/Klaus

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


[Newbies] Re: Old local changes on a new image

2008-02-23 Thread Klaus D. Witzel

On Sun, 24 Feb 2008 03:40:20 +0100, Juan José Evangelista wrote:


Hello

I'm working on an app hosted in monticello. I made a heavy work on my  
classes in an image during the last three months. Some days ago, I need  
to create a new image and load my code from monticello.
Everything goes ok, but I lose all my local version history. When I  
click on versions, I only see changes from the creation of the new image.
I want to know if there are some way to incorporate all my changes made  
to the old image to the new one.


@Keith
This looks like a job for Installer :) Could you post a script on how to  
achieve that with Installer from an MC repository, TIA.



Thanks in advance, and I hope you can understand my english.

---
Para estar bien, primero hay que aprender a estar.



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


[Newbies] Re: ordinary #hash and Dictionary [was: Recap: How to empty a collection]

2008-02-21 Thread Klaus D. Witzel

On Thu, 21 Feb 2008 21:44:05 +0100, nicolas cellier wrote:


Klaus D. Witzel a écrit :


Wouldn't this deserve a longer (Dictionary comment) ?
 You're right, the invariant is *essential* for Set and its subclasses,  
alas no word about it in its class comment. Please open a bug report  
(with severity text); current policy is that this then gets included  
in the next release.




Feel free to correct or complete http://bugs.squeak.org/view.php?id=6942


Done, added the ANSI wording :)



Maybe a reminder 'See also Set comment in Dictionary comment' would be  
welcome.


Sure.


Cheers

Nicolas



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


[Newbies] ordinary #hash and Dictionary [was: Recap: How to empty a collection]

2008-02-20 Thread Klaus D. Witzel

On Wed, 20 Feb 2008 00:59:57 +0100, nicolas cellier wrote:

...
I see, become: does exchange #identityHash, and that makes our  
IdentityDictionary work, god thanks, but there is no such provision for  
ordinary #hash and Dictionary...


But there are sufficient provisions in place, since Smalltalk-80, and most  
Dictionary users know about them :)


However, there are plenty of ordinary things that would have the same  
result:


| key1 key2 dic |
key1 := 'abc' copy.
key2 := 'abd' copy.
dic := Dictionary new.
dic at: key1 put: 1.
dic at: key2 put: 2.
key1 at: 1 put: $z.


 dic rehash synopsis: re-establish hash invariants, if any .


{dic includesKey: key1.
dic keys includes: key1.}

So i propose newbies do not use #at:put: considering the danger about  
Dictionary not finding their keys...


There's no danger with Dictionary not finding its keys, unless you  
yourself do not follow the protocol.


Smalltalk has no such problems; developers use #rehash after they changed  
the #= of keys in Set and subclasses; and please, don't tell the newcomers  
the contrary :)



That's too much.


No not too much; in other languages (especially the popular ones) you  
are not even allowed to change you strings-now *that* is too much ;-)


But in Smalltalk you are supported, right from the beginning; happy  
Smalltalking everybody :)


/Klaus

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


[Newbies] Re: is 0.1 a Float or a ScaledDecimal ?

2008-02-20 Thread Klaus D. Witzel

On Wed, 20 Feb 2008 18:27:09 +0100, cdrick wrote:

...

I think all this is premature optimization for me :) as I'm only
building an early prototype (I'm doing a start of Dempster Shafer
Theory [1] implementation (actually Transferable Belief Model)... and
it's won't reach a big size for a while. It allows to have an
imprecise, incomplete even uncertain value for a proposition (sort of
multi-valued attribute with confidence...).


Waaah, belief and plausibility as sum over numbers; shudder;  
political-systems-failure through machine calculations; market-meltdown  
through machine calculations; poverty-for-everyone through machine  
calculations :( Anyways, have you compared to Pei Wang's NARS (or perhaps  
his The limitation of Bayesianism), that would be interesting [OT].  
Tried to convince him that fractions are sufficient for him but he liked  
floats more (his early J* prototype had no system support for fractions  
...).


Do you have calculations of your model's epsilon on which you base your  
imprecise, uncertain, etc ? Or do you at present (for the prototype)  
just stab in the dark.



I use it to get expert
opinion on values, it's a known technique for different captor data
fusion, but in my case, it doesn't demand too much performance as the
combination is not that important (compared to sensor data fusion) ;)

...


Cédrick

[1] http://en.wikipedia.org/wiki/Dempster-Shafer_theory



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


[Newbies] Re: ordinary #hash and Dictionary [was: Recap: How to empty a collection]

2008-02-20 Thread Klaus D. Witzel

On Wed, 20 Feb 2008 22:12:57 +0100, nicolas cellier wrote:


Klaus D. Witzel a écrit :

On Wed, 20 Feb 2008 00:59:57 +0100, nicolas cellier wrote:
 ...
I see, become: does exchange #identityHash, and that makes our  
IdentityDictionary work, god thanks, but there is no such provision  
for ordinary #hash and Dictionary...
 But there are sufficient provisions in place, since Smalltalk-80, and  
most Dictionary users know about them :)


However, there are plenty of ordinary things that would have the same  
result:


| key1 key2 dic |
key1 := 'abc' copy.
key2 := 'abd' copy.
dic := Dictionary new.
dic at: key1 put: 1.
dic at: key2 put: 2.
key1 at: 1 put: $z.

  dic rehash synopsis: re-establish hash invariants, if any .


{dic includesKey: key1.
dic keys includes: key1.}

So i propose newbies do not use #at:put: considering the danger about  
Dictionary not finding their keys...
 There's no danger with Dictionary not finding its keys, unless you  
yourself do not follow the protocol.
 Smalltalk has no such problems; developers use #rehash after they  
changed the #= of keys in Set and subclasses; and please, don't tell  
the newcomers the contrary :)




Agree.
Thanks for this good lesson based on my so dumb example.
Wouldn't this deserve a longer (Dictionary comment) ?


You're right, the invariant is *essential* for Set and its subclasses,  
alas no word about it in its class comment. Please open a bug report (with  
severity text); current policy is that this then gets included in the  
next release.



That's too much.
 No not too much; in other languages (especially the popular ones)  
you are not even allowed to change you strings-now *that* is too much  
;-)
 But in Smalltalk you are supported, right from the beginning; happy  
Smalltalking everybody :)

 /Klaus


Too much was the idea of forbidding #become: or #at:put: for a wrong  
reason (Dictionary rehash).


Nicolas



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


[Newbies] Re: Recap: How to empty a collection

2008-02-20 Thread Klaus D. Witzel

On Wed, 20 Feb 2008 23:05:47 +0100, nicolas cellier wrote:


Klaus D. Witzel a écrit :

On Wed, 20 Feb 2008 02:01:49 +0100, nicolas cellier wrote:

Some proposed an alternative based on (self removeAll: self), and  
started writing optimized versions of #removeAll:.
 No, (anOrderedCollection removeAll: anOrderedCollection) was not  
optimized. It had a *very* long known bug, which was fixed. Please do  
less mixing of subjects in threads.




OK, I'm extrapolating.


O.K. the fix from OrderedCollection *could* be applied to Set (the fix  
requires #copyEmpty), but see Heap below.



In this case, while you are at it:

| aSet |
aSet :='Klaus' asSet.
aSet removeAll: aSet.
aSet

| aHeap |
aHeap := Heap withAll: 'Witzel'.
aHeap removeAll: aHeap.
aHeap


Don't use Heap much, it is not very conformant; example: (Heap withAll:  
'array') reject: [:x | x = $r] = an Array. Perhaps people didn't know  
about *all* senders of #species ...




I would have used my name, but it seems i am removeable ;-)
| aSet |
aSet :='Cellier' asSet.
aSet removeAll: aSet.
aSet

Try with the collection of your choice.

In the mean time, don't use (self removeAll: self)...


One step after the other :) no doubt #removeAll: gets fixed, perhaps in  
the next release?



Yes i'm mixing threads,should be How to NOT empty a collection ;-)

Nicolas

I think our biggest problem is that we have plenty possible ways to do  
it... Finding a balance between genericity and efficiency...

 No, more correctness at the price of less efficiency :)


Nicolas


Agree on this one.
Then allow removeAllSuchThat: as default implementation.

Nicolas



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


[Newbies] Re: Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 17:21:57 +0100, Klaus D. Witzel wrote:


On Tue, 19 Feb 2008 16:56:48 +0100, cdrick wrote:



 Or maybe, if aCollection == self, a warning could be raised ?

 What do you think ?

Thumbs down, I do not want anybody copy a collection behind my back
(however small or large it is) just because remove* has nothing to do  
with copy.



Ok, I can understand.
What about the error ?


This is a bug, Smalltalk cannot compromise its fundamental structures  
(#removeAll is ANSI). Enter the report if not already on mantis  attach  
your fix.


Sorry, s/#removeAll /#removeAll: /


/Klaus




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


[Newbies] Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 16:06:50 +0100, cdrick wrote:

...

I forgot that in my first attemp (and I knew that !)...

col := #(1 2 3) asOrderedCollection.
col  removeAll: col.
^col   returns an OrderedCollection(2)

col  removeAll: col copy is ok.

So, following Bert suggestion, would it be possible to change removeAll:  
from...


removeAll: aCollection
aCollection do: [:each | self remove: each].
^ aCollection
to

removeAll: aCollection
aCollection copy do: [:each | self remove: each].
^ aCollection
or

removeAll: aCollection
aCollection == self
ifTrue: [aCollection copy do: [:each | self remove: each]]
ifFalse: [aCollection do: [:each | self remove: each]].
^ aCollection

or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove: each]].

Or maybe, if aCollection == self, a warning could be raised ?

What do you think ?


Thumbs down, I do not want anybody copy a collection behind my back  
(however small or large it is) just because remove* has nothing to do with  
copy.



Cédrick



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


[Newbies] Re: Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 16:56:48 +0100, cdrick wrote:



 Or maybe, if aCollection == self, a warning could be raised ?

 What do you think ?

Thumbs down, I do not want anybody copy a collection behind my back
(however small or large it is) just because remove* has nothing to do  
with copy.



Ok, I can understand.
What about the error ?


This is a bug, Smalltalk cannot compromise its fundamental structures  
(#removeAll is ANSI). Enter the report if not already on mantis  attach  
your fix.


/Klaus


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


[Newbies] Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 21:01:14 +0100, nicolas cellier wrote:


cdrick a écrit :

 or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove: each]].
 Or maybe, if aCollection == self, a warning could be raised ?
 What do you think ?
 Cédrick



aCollection == self is not the only case that can fail.
Imagine i pass a wrapper collection on self, like a MappedCollection.

When i will change self with remove:, i will also change the argument  
which is just a wrapper on self.


Hope my explanations are not too much confusing...


Let's see: Remove each element of aCollection from the receiver. If  
successful for each, answer aCollection. Otherwise create an error  
notification.


What mapping would *not* raise the error notification ;-)

BTW: MappedCollection does not exist in sq3.10-7159dev08.02.1.image ...

/Klaus


Nicolas



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


[Newbies] Re: [Squeak 0006937]: removeAll: aCollection doesn't do what we expect if aCollection==self

2008-02-19 Thread Klaus D. Witzel

Hi nicolas,

in your counter example you have forgotten that this bug is about  
failure of removal, but your example does not fail, instead it removes all  
elements (in Squeak 3.9, where MappedCollection still exists).


Can you tell us why? And please only add code to bug reports which does  
what you claim; things which don't work can be discussed here :)


/Klaus

On Tue, 19 Feb 2008 21:28:25 +0100 a NOTE has been added to this issue:

==
http://bugs.squeak.org/view.php?id=6937
==
Reported By:cdrick
Assigned To:
==
Project:Squeak
Issue ID:   6937
Category:   Collections
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
==
Date Submitted: 02-19-2008 18:12 UTC
Last Modified:  02-19-2008 20:28 UTC
==
Summary:removeAll: aCollection doesn't do what we  
expect if

aCollection==self
Description:
This known error has had a revival originating from a mail of Sophie in  
the

beginnner list... and I ended up opening a bug report...

The problem is:

col := #(1 2 3) asOrderedCollection.
col  removeAll: col.
^col   returns an OrderedCollection(2) instead of an empty one as we  
would

expect...
==

--
 kwl - 02-19-08 18:51
--
OrderedCollection-removeAll-kwl-6937.st tested with the 441 cases in the
CollectionTests category, all green.

--
 nicolas cellier - 02-19-08 20:28
--
As posted in beginners list, self == aCollection does not handle case  
when

aCollection is just a wrapper on self...
So the change won't removeAll problems...
in a 3.9 image try this:

| collec1 collec2 |
collec1 := OrderedCollection with: 'a' with: 'b' with: 'c'.
collec2 := MappedCollection collection: collec1 map: (3 to: 1 by: -1).
collec1 removeAll: collec2.
collec1 inspect

Agree, yet, the problem lies in super...
Note: MappedCollection was removed from 3.10, but in spirit there can be
other wrapper collections (i used some myself).

Issue History
Date Modified   Username   FieldChange
==
02-19-08 18:12  cdrick New Issue
02-19-08 18:51  kwlFile Added:
OrderedCollection-removeAll-kwl-6937.st
02-19-08 18:51  kwlNote Added: 0011843
02-19-08 20:28  nicolas cellierNote Added: 0011846
==



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


[Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 22:14:49 +0100, Blake wrote:

I've been following this debate with some interest, but I think it's  
gone beyond a noob discussion.


Is there a noob answer to this question? There ought to be. I'm sort of  
leaning toward:


Q. How do you empty a collection.
A. You don't, you replace it with a new instance.

Q. What if you have references to the collection in multiple places?
A. Wrap the collection in another class, and reference that.

??


 Q. can I use #become: instead of wrapper?
 A. yes but the pro's don't like solutions with #become:, it smells

/Klaus



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


[Newbies] Re: How to empty a collection?

2008-02-19 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 22:00:09 +0100, nicolas cellier wrote:


Klaus D. Witzel a écrit :

On Tue, 19 Feb 2008 21:01:14 +0100, nicolas cellier wrote:


cdrick a écrit :

 or again
removeAll: aCollection
aCollection == self
ifTrue: [self removeAll: aCollection copy]
ifFalse: [aCollection do: [:each | self remove:  
each]].

 Or maybe, if aCollection == self, a warning could be raised ?
 What do you think ?
 Cédrick



aCollection == self is not the only case that can fail.
Imagine i pass a wrapper collection on self, like a MappedCollection.

When i will change self with remove:, i will also change the argument  
which is just a wrapper on self.


Hope my explanations are not too much confusing...
 Let's see: Remove each element of aCollection from the receiver. If  
successful for each, answer aCollection. Otherwise create an error  
notification.

 What mapping would *not* raise the error notification ;-)



My interpretation of the comment was rather for the case when we try to  
remove an element which is not in the collection...

But OK, I take it as is...

However i can construct a test case that will not do what is expected  
and will not raise a notification, wanna bet?


No, just let the next people who attempt to bring MappedCollection back to  
Squeak  3.10 take care ;-)


BTW: do you have as much energy for fixing problems as you seem to have  
for imagine the currently non-existing ;-) This would help Squeak jump  
forward :)



| collec1 collec2 |
collec1 := OrderedCollection with: 'a' with: 'b' with: 'c'.
collec2 := MappedCollection collection: collec1 map: (1 to: 2).
collec2 only map first two elements 'a' and 'b'
collec1 removeAll: collec2.
this should remove 'a' and 'b' from collec1
self assert: collec1 first = 'c'
too bad... it's 'b'


BTW: MappedCollection does not exist in sq3.10-7159dev08.02.1.image ...



MappedCollection is just an example of possible wrapper collection, even  
if there is none in core images nowadays, that's a classical pattern  
which avoid copying for example.


MappedCOllection is in 3.9 image.


/Klaus


Nicolas



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


[Newbies] Re: Recap: How to empty a collection

2008-02-19 Thread Klaus D. Witzel

On Wed, 20 Feb 2008 02:01:49 +0100, nicolas cellier wrote:

...

Bert's suggestion is simple and works well.
The only question is about efficiency.
Up to (Down to?) subclasses to optimize it.

Some proposed an alternative based on (self removeAll: self), and  
started writing optimized versions of #removeAll:.


No, (anOrderedCollection removeAll: anOrderedCollection) was not  
optimized. It had a *very* long known bug, which was fixed. Please do less  
mixing of subjects in threads.


I think our biggest problem is that we have plenty possible ways to do  
it... Finding a balance between genericity and efficiency...


No, more correctness at the price of less efficiency :)


Nicolas



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


[Newbies] Re: Questions about primitives - how to avoid one ?

2008-02-18 Thread Klaus D. Witzel

Hi C'edrick,

on Mon, 18 Feb 2008 01:10:41 +0100, you wrote:


David T. Lewis wrote:

If you comment out the primitive like this is should definitely work:



If I comment out the primitive, in Float= ... and put a self halt
after, the halt point has no effect.


This is correct, both your observation and the corresponding behavior of  
Squeak's VM. There are some message selectors whose method is only looked  
up if receiver/args don't match, for performance reason. To this belongs  
#= (bytecode #182) which is first tried for SmallInteger receiver/args,  
then if that fails tried for Float receiver/args, and if that also fails  
then routine #bytecodePrimEqual in Squeak's VM performs a normal send  
(which would then find the primitive number and/or the Smalltalk code if  
the primitive where absent or failed).


Looks complicated but works *fast* (only less failure is more speed :)

For what you want to do I'd suggest you duplicate method Float#= as  
Float#~=~ (just add the two ~ in Float's #= selector and alt-s) and then  
you can do


 1.234 ~=~ 1.234

and the changes you do to your #~=~ method then do what you want (it's  
Smalltalk land :)


HTH.

/Klaus

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


[Newbies] Re: How to empty a collection?

2008-02-18 Thread Klaus D. Witzel

On Tue, 19 Feb 2008 02:35:34 +0100, Marcin Tustin wrote:


Isn't Cedrick's aida solution going to be significantly faster?


No, solutions based on #become: are the slowest possible. The VM has to  
sweep the whole memory, for all variables in the system, to find all  
references during #become:, like this


 | oop |
 oop := self someObject.
 [check+replace reference in variables of oop, then
  oop := oop nextObject.
  oop = 0
  ] whileFalse.

Now think that you (and every other user of your software ;-) have an  
.image with 2-4gigs every time you use #become: ...


If you want something faster, look at Bert's

 myCollection removeAllSuchThat: [:each | true]

and try to make it faster but keep still it correct (old elements must be  
nil'ed).


/Klaus


On Feb 19, 2008 1:02 AM, Ron Teitelbaum [EMAIL PROTECTED] wrote:


Hi Sophie,

aCollection copy do: [:anElement |
   aCollection remove: anElement
].

Why copy?  If you start removing items from the collection, increasing  
the

index will cause you to skip elements.

Ron

 -Original Message-
 From: itsme213

 I want to clear its contents (size goes back to zero), and can't seem  
to

 find something like #clear or #empty. Cannot use a new collection as
there
 are shared references to it.

 Thanks - Sophie


___
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: block in recursion, Any cure for that kind of situation?

2008-01-23 Thread Klaus D. Witzel

Hi Hilaire,

on Wed, 23 Jan 2008 09:49:07 +0100, you wrote:



Le mardi 22 janvier 2008 à 22:16 +, Marcin Tustin a écrit :

I'm an idiot. That doesn't work either. Why not?


Because still nested, I guess.
Anyway I want to use that for teacher to design programmaticaly
interactige geometry figure for Drgeo. So it have to keep simple and be
usable in a Workspace.

The only alternative I see is to define a class with methods, but it is
a bit more complex for the target audiance.


You don't have to. I use recursive blocks in Smalltalk workspace all the  
time. The trick is from the Self language, which always clones  
activation record before using them. Example:


 recursiveBlock := [:argV |
   argV  1
ifFalse: [argV + (recursiveBlock clone value: argV - 1)]
ifTrue: [argV]].

 recursiveBlock clone value: 17

You could send #copy instead of #clone but I prefer the latter in honor of  
Self.


Enjoy!

/Klaus

P.S. beware of the #fixTemps symptom in Squeak's implementation of blocks,  
was discussed several times over in squeak-dev.



Hilaire




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


[Newbies] Object copyFrom: [was: Object clone]

2008-01-15 Thread Klaus D. Witzel

Hi Jakub,

on Tue, 15 Jan 2008 18:29:53 +0100, you wrote:


yeah a, b instance of same class and i want copy all instance variables
values to a i want do a := b but i dont want to a is same object as b. In
memory will be two objects a, b with same values ..


If you mean to have class Person and (aPerson := Person new), (bPerson :=  
Person new) and later you want that aPerson has exactly the same instance  
variables as bPerson, then you might want


 aPerson copyFrom: bPerson

This is not often used (it's rather at the system level), because most  
Smalltalk developers set instance variables by mutators, like


 aPerson name: bPerson name.
 aPerson address: bPerson address.
 ...

See also the comment in #copyFrom: on the instance side of Object.

Enjoy Smalltalk :)

/Klaus


but if i change a i dont
change b.

regards

2008/1/15, Mathieu Suen [EMAIL PROTECTED]:


Hi Jakub

I don't really understand your question.
What is a and b? Are they instance of the same class?

On Jan 14, 2008, at 10:42 PM, Jakub wrote:

 hello,

 i want do i want set var a as all instance vars of b. Something s
 clone - coppy of one object. I look for clone command in SBE book
 but i found nothing.

 Thnx.

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

Mth



___
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: Switching between Browser views in the middle of (incomplete) edit - advice?

2007-12-09 Thread Klaus D. Witzel

Hi Sophie itsme213,

have you tried alt-o which spawns a method browser on the partly-edited  
code and unlocks the main browser.


/Klaus

On Sun, 09 Dec 2007 00:50:10 +0100, itsme213 wrote:


I frequently start to edit a method, then realize I need to look at or
change something elsewhere. The method I was editing will not Accept  
as-is;

and opening a new browser interrupts my flow. What is best practice here?
Anything equivalent to a tabbed browser, or hold this partly-edited  
code,

I'll be right back ?

Sophie



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


[Newbies] Re: Linux and Squeak server help

2007-11-06 Thread Klaus D. Witzel

Hi Edgar,

[switched the thread back to the list.]

So, everything *on*the*machine* works as expected (and this includes  
Squeak :-)


If you still can't reach the machine from outside then it must be so that  
you haven't obeyed the Goddess of network connectivity sometime in the  
recent past :)


/Klaus

On Tue, 06 Nov 2007 12:54:32 +0100, Edgar J. De Cleene wrote:




El 11/6/07 8:25 AM, Klaus D. Witzel escribió:


From your resume I assume you have Squeak on Linux running in a desktop
environment.


Yes

So in Squeak on the Linux desktop, copypaste the following into a
workspace (I wrote the code in 3.7 and tested it in 3.8 and 3.9):

  | connection |
(connection := Socket newTCP)
setPort: 9090.
  connection

When you inspect this, selecting *self* in the inspector shows

  a Socket[waitingForConnection]


Yes with the 3.8 full image the system install via synaptic

While the above still runs, telnet to the Linux and logon as root and do
what Norbert wrote:


[EMAIL PROTECTED] netstat -atn | grep 9090
tcp0  0 0.0.0.0:90900.0.0.0:*
LISTEN

[EMAIL PROTECTED]


So is listening, also I was :=)

Very thanks !

Edgar




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


[Newbies] Re: Save project thumbnail as image

2007-09-30 Thread Klaus D. Witzel

Hi Juliano,

you can try the following expression (in a browser or a workspace)

 World asSnapshotThumbnail openInWorld

and if that's what you wanted then find out what #asSnapshotThumbnail does.

HTH.

/Klaus

On Sat, 29 Sep 2007 20:49:41 +0200, Juliano Bittencourt wrote:




Hi everybody,

I'm interested in create a script that takes an .pr and outputs a  
project thumbnail as a png image. I searched the code that loads the  
project to etoys, but was unable to find were it generates the project  
thumbnails that is showed up after loading. Any hints?


 Best,

 Juliano



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


[Newbies] Re: Traits

2007-09-25 Thread Klaus D. Witzel

Hi Nick,

on Tue, 25 Sep 2007 02:00:50 +0200, you wrote:



Armed with new knowledge of Traits gained from the excellent Squeak By
Example I tried:
Smalltalk allClasses select: [:each | each hasTraitComposition]

which gave:

an OrderedCollection(ActionSequence BalloonBezierSimulation BalloonEngine
BalloonEngineConstants BasicRequestor Behavior BrowserProvider
WorldMenuProvider XMLTokenizer ZipConstants ZipFileConstants)

However browsing to a random class say ActionSquence, doesn't show any
evidence of Trait composition. Is this a problem with the current  
browser?


You're right, (TraitComposition allInstances reject: [:each | each  
isEmpty]) size gives just 17 in my squeak-web image but TraitComposition  
allInstances size reports 325. Could you report your find on  
bugs.squeak.org, this should be investigated if empty TraitComposition  
should really populate the image. Perhaps #traitComposition was used  
unconditional.



Also is there a way to browse a Trait say TPureBehavior


Just select that name and alt-b opens a browser on TPureBehavior.

/Klaus


My image is based on: sq3.9-7067web07.08.1

Thanks

Nick



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


[Newbies] Re: overwriting #new

2007-07-13 Thread Klaus D. Witzel

Hi Daniel,

on Thu, 12 Jul 2007 22:56:22 +0200, you wrote:


Hello,

I have a class Foo inherited from Object. When I try to create a user
defined #new (newFoo), to avoid the #initialize instance method to run
as part of the object instantiation, I get the following error:
... class(Object)doesNotUnderstand: #newFoo ...


When you select the word newFoo and ask for implementors (alt-m), is this  
the only one in the result list which has Foo class in it?


If so then we must know more, can you post a fileOut of the definition of  
Foo class and its #newFoo method.


/Klaus


method definition:
- --
newFoo
  | model|
  model := self basicNew.
  .. do something ..
  model initialize.
  ^model
- --
usage:
someMethod
  | foo |
  foo := Foo newFoo.
  .. do something ..
- --

Is there something that I missed to overwrite the #new method?

Cheers,
Daniel.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGlpV2gUMEmDMCeAARA5uvAKCDAw6ag+qHEDrFce8EjNKjD+QYbQCfZVLw
OypIlyLFBLJOLB/rIktphwI=
=Rfyg
-END PGP SIGNATURE-



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


[Newbies] Re: Where is BytecodeGenerator?

2007-06-05 Thread Klaus D. Witzel

Hi Damian,

class BytecodeGenerator in the NewCompiler.image ('Squeak3.9 of 7 November  
2006'). Download NewComiler.zip from


- http://www.iam.unibe.ch/~scg/Research/NewCompiler/

and enjoy.

/Klaus

P.S. the owner of NewCompiler is not subscribed to this list :|

On Tue, 05 Jun 2007 20:55:20 +0200, Damian Dobroczyn'ski wrote:


Matthew Fulmer napisa?(a):

On Tue, Jun 05, 2007 at 02:31:40PM +0200, Damian Dobroczy??ski wrote:

Documentation says
that it should be Squeak 3.7 which means VM v. 3.7 or image v. 3.7?


That always means an image version 3.7. VM version is
independent of image version, even though they mirror each
other. Any image version should work with any VM between the
latest VM, and the VM that was released with it.



Thx for the explanation. I've just downloaded sources of Squeak v. 3.7
(the image) and it DOES NOT contain BytecodeGenerator (should it?)

So, I downoladed full installation of Squeak3.7 (binaries and image),
ran SqueakMap Package Loader andended up with dialog which happily  
says:

Reading an instance of ByteSymbol. Which modern class should it
translate to? a) Let me type the new name now; b) Let me think about it;
c) Let me find a conversion file on the disk. !!. The system
browser poped-up with its whole majesty  glory displaying such a piece
of miracle code:

byteSymbolx0

^ PutNewClassHere

Of course SqueakMap Package Loader IS NOT installing anything any more.
Thanx.

Does it mean something? The image is corrupted? The sources file is
corrupted? It's a joke, isn't it?

It's becoming funnier every minute I spent on Squeak...really. Simply,
anything which I'm interested in is unusable. First Magma smart start-up
objects strangle the whole system, now GOODS Smalltalk interface calls
for enigmatic BytecodeGenerator which exists - somewhere in space. When
I politely download the required version (with this
BytesomethingGenerator) - I'm expected to find a class for a symbol
?? It's a joke for sure but I do not have enough sense of humor...

So, my question is still valid: WHERE IS the BytecodeGenerator ? How
can I install this class and its heirs on current, modest, three point
seve/eight/nine image? Somebody help me please.

D.



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


[Newbies] Re: Tracing back objects

2007-05-25 Thread Klaus D. Witzel

On Fri, 25 May 2007 12:18:38 +0200, subbukk wrote:


Hi,

The following code:
 CompiledMethod allInstances inject: (CompiledMethod allInstances first)  
into:

[:m :i | i size  m size ifTrue: [i] ifFalse: [m]].

gives the largest method as an object. Is there an efficient way to  
trace back

the method selector and its class without doing a brute force lookup?


On pre-traits images you'd need (aMethod who) but from 3.9 on #who is  
deprecated. If you're on 3.9 the comment in #who tells the fast way.


/Klaus


TIA .. Subbu



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


[Newbies] Re: string search

2007-04-24 Thread Klaus D. Witzel

Open a workspace and type+select 'My Squeak' without the quotes.

Then do a right click, select more ... and one of the 'with it' options.

HTH

/Klaus

On Tue, 24 Apr 2007 07:17:20 +0200, subbukk wrote:


Hi,

How do I do string searches in Squeak environment? For example, how do I
search which method refers to 'My Squeak'?

Thanks in advance .. Subbu



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


[Newbies] Re: Adding methods to Integers...

2007-04-13 Thread Klaus D. Witzel

On Fri, 13 Apr 2007 13:39:08 +0200, Bert Freudenberg wrote:


On Apr 13, 2007, at 13:27 , Klaus D. Witzel wrote:


Hi Bert,

on Thu, 12 Apr 2007 18:31:55 +0200, you wrote:


This is actually wrong.


:)


Only SmallIntegers are special [*].

What happens is this: When you add two SmallIntegers (like 3 + 4),  
and the result is a SmallInteger, the result is calculated in the  
bytecode directly. Otherwise, a regular send of #+ is performed.


Right.


From there, everything else happens in the image,


Not really. (Integer#+ aNumber) sends (self digitAdd: aNumber) which  
is implemented as primitive: 'primDigitAdd' module: 'LargeIntegers'  
which is part of the VM. Of course the LargeIntegers module may be  
absent, have failed to load, may not like the argument, etc.


No, this is an *optional* primitive. It's there purely to speed up  
computation and can be safely removed.


Sure, but this thread is not about what happens when the optional  
primitive is removed, and I was not reflecting that, either. I was rather  
discussing the point when the primitive does *not* fail on one of  
Patrick's subclasses and, what the returned species is.


You could change the Integer classes to handle subclasses properly (via  
species etc.). So far, this has not been necessary. My point was that  
this (unlike SmallIntegers) is *not* hard-coded in the VM.


I think it depends on operand order. When the LargeIntegers module is  
invoked (in my previous example when sending + myLargeInteger to  
SmallInteger 1) then a hard-coded instance of LargePositiveIntegers is  
returned.


The attached class can be used (together with my previous example) to  
illustrate my point. The class does not inherit from some default large  
integer class and the primitive does not fail, regardless of operand  
order. I hope I didn't base my argument on a bug or mistake.


FWIW I do not disagree with anything about your argument, except a bit  
with hard-coded.



- Bert -




MyPositiveInteger.st
Description: Binary data
___
Beginners mailing list
[EMAIL PROTECTED]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Adding methods to Integers...

2007-04-12 Thread Klaus D. Witzel

Hi Patrick,

some of the symptoms you describe have to do with a small set of classes  
being hardwired in Squeak's virtual machine. To see which they are,  
evaluate (printIt)


 Smalltalk specialObjectsArray select: [:each | each isBehavior]

So when you do primitive arithmethic with your own subclass of  
LargePositiveInteger, the VM returns an instance of LargePositiveInteger  
(and not your subinstance of it).


Of course the specialObjectsArray can be changed and from then on the VM  
(after being notified) will use your subclass but, I think this is not  
what you really want ;-)


Putting your methods into Integer is fine as long as they do not conflict  
with anything else. Yes, this is the usual approach for adding new  
behavior to all the integers :)


/Klaus

On Thu, 12 Apr 2007 17:28:01 +0200, you wrote:



Background:
::

The most recent MathFactor Podcast ( http://mathfactor.uark.edu/ )
ended with a request to write a computer program that could, in
principal, given enough time and memory, compute Graham's Number
( http://mathworld.wolfram.com/GrahamsNumber.html ).

Smalltalk was a natural choice since it already supports LargeIntegers.

Problem:
:::

Being new to Smalltalk, my first thought was that I should make my
own class as a subclass of LargePositiveInteger, put my methods there,
and violá.  Alas, no love.

I ran into the following problems:
* I couldn't find a way to give a value to myself.
* I couldn't find a way to get integers to adapt to my class 
anyway.

I ended up just adding my methods to the Integer class.  But, this felt
very naughty.  Is it the usual approach?

Thanks,
Patrick


___
Beginners mailing list
[EMAIL PROTECTED]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] PC World: What do you think is the greatest tech product ever?

2007-04-03 Thread Klaus D. Witzel

List,

it's time again to tell the world, at the bottom of the list on

- http://www.pcworld.com/article/id,130277/article.html

there is a radio button which is labelled other followed by a text box  
in which you can enter Squeak, Smalltalk and any variant you like (and hit  
the vote button :)


Thanx for your help on the marketing front!

/Klaius

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


[Newbies] Re: Re: A Question of Style

2007-04-01 Thread Klaus D. Witzel

+ 1

and I couldn't have worded it better :)

IHMO (and perhaps only there) an object is allowed to pretend to *also* be  
something else (aVendor pretends to be aPricebook, in the #priceAt:put:  
example) *only if* it could effectively take that role.


If not or in doubt: delegate to someone who lives that role [talk small  
and create great things].


/Klaus

On Sun, 01 Apr 2007 12:05:35 +0200, Stuart Herring wrote:


On 4/1/07, Klaus D. Witzel [EMAIL PROTECTED] wrote:

 Smalltalk With Style makes this very clear.  It definitely
 prefers that I communicate with Vendor in the language of a Vendor,  
and

 not in the language of a Dictionary.

The #at:put: vocabulary is part of the language of Smalltalk, which is
universal and independent of Vendor language. You do not implement
Smalltalk in the labguage of Vendor but, the opposite direction is the
case. This is inevitable and the language direction is irreversable.


If I were examining the methods of Vendor, and I saw priceAt: put:
then yes, I'd realise that I was witnessing some sort of Dictionary
like API, but my two questions would be at what? and what am I
putting?.  You could probably guess that it wanted an item and a
price, but the wording seems to imply it wants the price as the key,
and the item as the value.  I'd probably have to end up looking at the
implementation to make sure which way round it wanted it.
If I saw #priceOf:is: or #setPriceOf:to:,it'd be far more obvious what
was going on.

To insist on #at:put simply because it's what's used by a Dictionary
seems wrong, because it's not the interface to the price book that's
in question, it's the interface to the Vendor, and in this case
creates an awkward feeling API - much like dogmatic adherence to some
English style guides creates awkward sentences (as in the apocryphal
Churchill quote: This is the sort of English up with which I will not
put).

Maybe this discussion is a sign that it would make more sense to
expose the price book separately, rather than put the price setting
messages on the vendor itself?
The pricebook would then have #at:put, because it certainly is a
collection, and by being a pricebook it's obvious what the key and
value should be.

so rather than aVendor priceOf: #foo is: price or aVendor priceAt:
#foo put: price,
you'd have:  aVendor pricebook at: #foo put: price

This seems to satisfy both the condition of using the language of the
domain, and provides the familiarity of the dictionary interface.

Regards,
Stuart



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


[Newbies] Re: A Question of Style

2007-03-31 Thread Klaus D. Witzel

On Sat, 31 Mar 2007 19:08:08 +0200, you wrote:



I've seen the suggestions in other responses to this and I don't like
them.

Calling everything a setter/getter seems to be J-zeitgeist but, what  
you
have here is a collection of prices, indexed by a symbolic key, rooted  
at

instances of Vendor.

Translated to Smalltalk language this is a variant of #at:put:

VendorpriceAt: aSymbol put: newPrice

Even more Smalltalk-ish, you'd have

  aVendor pricebook at: aSymbol put: newPrice

People with an education in Smalltalk will immediately understand what's
happening when seeing a piece of your code which sends #priceAt:put:,  
even

in the absence of class comments :)


Something I read in Smalltalk With Style, though, says that you should
hide the implementation details.


This is satisfied by #priceAt:put: since nobody knows how you do that.

Some analogies: #attributeAt: #categoryAt: #childAt: #colorAt: #digitAt:  
#fontAt: #lineAt: #sourceMethodAt: #compiledMethodAt: (the list is much  
longer).



Your method names should not refer to
the data structures behind them.


Without doubt the pricebook is a collection. And the traditional access  
protocol, which everybody who's familiar with Smalltalk is aware of, it  
some variant of #at:put:.


This Smalltalk style maximizes the convenience of the reader / maintainer  
/ re-user / novice / convert / etc, of course.



Even though my Vendor's pricelist is a
Dictionary,


I don't care that it's a Dictionary, as long as the pricebook is a  
collection (more than *one* thing and accessible by some sort of key).



I do not need to expose that implementation to the user of
Vendor.


Since #at:put: does not expose any implementation detail, #priceAt:put:  
does not expose its secrets either.



Smalltalk With Style makes this very clear.  It definitely
prefers that I communicate with Vendor in the language of a Vendor, and
not in the language of a Dictionary.


The #at:put: vocabulary is part of the language of Smalltalk, which is  
universal and independent of Vendor language. You do not implement  
Smalltalk in the labguage of Vendor but, the opposite direction is the  
case. This is inevitable and the language direction is irreversable.


It is similar to if I went to a GroceryStore.  I would not log in to  
their
SuperMainframe5000 and type in SQL code to query the price of an apple.   
I

would ask their sales representative, how much is an apple?


Comparing SQL to Smalltalk is not appropriate here, since for some form of  
comparision between apples and oranges both must be on par at least in  
terms of capabilities, expressibility and usability. SQL lacks all that.



Also, I am not a Java user so I am not trying to Java-tize Squeak :)


Sorry if that was not clear enough: I was talking about the responses :)

/Klaus


Thanks,
Tim



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


[Newbies] Re: A Question of Style

2007-03-30 Thread Klaus D. Witzel

On Fri, 30 Mar 2007 18:22:22 +0200, Tim Johnson wrote:


Hi,

I know the rules for naming accessor and setter methods.  But what do I  
do

when the accessor method needs a parameter?  I'll try to provide an
example.

A vendor sells an item called #apple.  If I want to get the vendor's  
price

for that #apple, I use a method such as the following:

VendorpriceOf: aSymbol

Now, to make the setter method, I have followed this pattern:

VendorpriceOf: aSymbol is: newPrice


I've seen the suggestions in other responses to this and I don't like them.

Calling everything a setter/getter seems to be J-zeitgeist but, what you  
have here is a collection of prices, indexed by a symbolic key, rooted at  
instances of Vendor.


Translated to Smalltalk language this is a variant of #at:put:

VendorpriceAt: aSymbol put: newPrice

Even more Smalltalk-ish, you'd have

 aVendor pricebook at: aSymbol put: newPrice

People with an education in Smalltalk will immediately understand what's  
happening when seeing a piece of your code which sends #priceAt:put:, even  
in the absence of class comments :)


/Klaus


Does this follow traditional patterns?  I'll admit I have read the first
half of Smalltalk with Style but not the second.  Should I instead make
the setter method look like this:

VendorsetPriceOf: aSymbol to: newPrice

?

Thanks,
Tim

[PS - Thanks to everyone who has been helping me on here lately, I have
been lax in responding.  You all bring up some good ideas and tips.]



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


[Newbies] Re: Re: A do with ONLY index? (plus,. a style question)

2007-02-09 Thread Klaus D. Witzel

Hi Blake,

on Fri, 09 Feb 2007 09:15:43 +0100, you wrote:


On Thu, 08 Feb 2007 22:58:32 -0800, Klaus D. Witzel wrote:

Sure. Evaluate Object halt; new with doIt and then in the debugger,  
in the DoIt method line push the buttons Through then Into.


Aha.

Huh.

Why doesn't this:

^ self basicNew initialize

cause a DNU? Object doesn't have an initialize method.


Really ? :) It is inherited from ProtoObject ;-)

/Klaus

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


[Newbies] Re: anObject select: #aMethodName -- is this good Squeak?

2007-02-08 Thread Klaus D. Witzel

On Thu, 08 Feb 2007 10:21:53 +0100, Giovanni Corriga wrote:


Il giorno gio, 08/02/2007 alle 07.53 +0100, Lukas Renggli ha scritto:

 That was one of the things that I originally thought would weigh
 against this idiom, but found to my surprise that Senders of
 identified these references correctly-- I'd previously found symbols
 being included in my results and wondered why, but it looks as though
 someone was aware of this gotcha.

Yes, browsing senders also works. Squeak puts all the data needed by a
compiled method into a special place called literal array. So all
selectors you send (expect special ones like #ifTrue:, #ifFalse:,
#and:, #or, #whileTrue, ...) are in there, all symbols you use, all
classes you reference, all strings and numbers. If you browse for
senders, the system just looks at this literal array and doesn't make
the difference if this is just a symbol or an actual selector of a
message send.


Does it? I tried browsing for senders on a 3.9 image before sending my
message, and it didn't work.


What was that symbol (for reproduction)?

FWIW in #thoroughWhichSelectorsReferTo:special:byte: it is sought for  
#allButLast of the method's literals. This can be a problem if the method  
wasn't (re-)created after the image was traitified.


Also, SystemNavigation#allCallsOn: is influenced by (Preferences  
thoroughSenders).


/Klaus


Giovanni



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


[Newbies] Re: anObject select: #aMethodName -- is this good Squeak?

2007-02-08 Thread Klaus D. Witzel

On Thu, 08 Feb 2007 12:15:34 +0100, Giovanni Corriga wrote:

Il giorno gio, 08/02/2007 alle 11.37 +0100, Klaus D. Witzel ha scritto:

On Thu, 08 Feb 2007 10:21:53 +0100, Giovanni Corriga wrote:



 Does it? I tried browsing for senders on a 3.9 image before sending my
 message, and it didn't work.

What was that symbol (for reproduction)?

FWIW in #thoroughWhichSelectorsReferTo:special:byte: it is sought for
#allButLast of the method's literals. This can be a problem if the  
method

wasn't (re-)created after the image was traitified.

Also, SystemNavigation#allCallsOn: is influenced by (Preferences
thoroughSenders).


Ok, looking for senders from the Method Finder and/or the Message Finder
works. But clicking on the Senders button on the browser doesn't show
the symbol with the other selectors.

I tested this by creating a bogus class and adding a method with this:

#(1 2 3) select: #even.

thoroughSenders is set.


I tested: in IntegerTest#testEven I added a line at the end
.
self assert: (1 perform: #odd)

Now senders of #odd, when selecting 'odd' and doing alt-n, includes the  
changed method.


But the browser's senders button apparently is not in sync with the much  
better capabilities of #allCallsOn: and #thoroughSenders. I must say that  
this was the first time ever that I used this particular button ;-)


/Klaus


Giovanni



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


[Newbies] Re: question on differences between images

2007-01-30 Thread Klaus D. Witzel

Hi Jordi,

you could try  Transcript show: 'Put 1'; cr; endEntry  without anything  
around it. This should guarantee that something is send to Transcript  
*and* displayed (#endEntry forces to display things which are as yet not  
displayed).


It is perhaps so that older Squeak does not do #endEntry when you just use  
#show: (as it was the case with Squeak's anchestors).


If #endEntry doesn't help then replace it by #halt to get an idea if your  
code is really executed.


HTH.

/Klaus

On Tue, 30 Jan 2007 13:31:50 +0100, Jordi wrote:


Hi,

Thanks for your answer. I guess I understand now
why it is image 3.9 who provides the right answer.


Now... back to that code of yours, it is a serious mess. :)
(...)

So... I wonder what the 2.5 image does to end up with a BlockContext,
don't have one handy. Perhaps it does some funny stuff if the argument
to Compiler is an Array?


Yes, the code was a mess. The same result is obtained by printing the
result of:

(Compiler evaluate: #([ Transcript show: 'Some Text' ])) class

image 2.5 -- BlockContext
image 3.9 -- Array

I've been playing a little bit more with Squeak, and I found another
strange (to me; please, consider that I am still a newbie) thing.
In some lectures by Stephane Ducasse there is an example illustrating the
difference between literal arrays and arrays created with new:. In  
particular,

adding the following method to class SmallInteger:

m1

| anArray |
anArray := #( nil ).
(anArray at: 1) isNil
ifTrue: [ Transcript show: 'Put 1'; cr.  anArray at: 1 put: 1. ]

and executing

1 m1

should display the message 'Put 1' only once. And this is how it works...
in image 3.9

But if we repeat the experiment in image 3.0, it displays nothing in the
Transcript (not even the first execution). Again, I am puzzled by this
behavior (I am always assuming that these experiments that behave  
differently

in different Squeak images are standard Smalltalk).

One more thing. Perhaps there is people wondering why someone should  
worry
about the behavior of an old image. The answer is that I am using a  
stripped
version of image 3.0 to play with Squeak on a Jornada 720. More recent  
complete
images are too heavy for the J720 (at least that is my experience; any  
clue

on how to improve that?).

Well, thanks in advance for your answers

Bests

Jordi



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


[Newbies] Re: Re: Growing image

2006-11-29 Thread Klaus D. Witzel

Hi Norbert,

you may want to put one of your app names {seaside. magritte. magma} and  
one of the class names into google search. The search result connects you  
immediately to the collective knowledge of the Squeak community, example:


- http://www.google.com/search?q=weakarray+seaside

Besides of that, you can look for class references and find the guilty who  
send #new or #new: to one of the classes.


/Klaus

On Wed, 29 Nov 2006 13:00:59 +0100, Norbert Hartl [EMAIL PROTECTED]  
wrote:



On Wed, 2006-11-29 at 01:52 +0100, Klaus D. Witzel wrote:

Hi Norbert,

the tool is Smalltalk, just inspect

(((Smalltalk allClasses collect: [:each | each name - each  
instanceCount

])
reject: [:each | each value = 0])
asSortedCollection: [:a :b | b value  a value]) asArray

This gives # of objects per class, in a nice GUI :-)


Thanks, this is quite good. I have now a statistic like:

246565 WeakArray
241929 WeakKeyAssociation
179848 ByteString
171165 Array
159003 Association
130254 WeakValueAssociation

What is the best way to determine where this instances are
referenced. Do I have to use PointerFinder or Smalltalk
browseAllObjectReferencesTo: or is there better way?

thanks for your help, this goes also to Ramon and David.
You are very helpful, guys.

Norbert



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


[Newbies] Re: Bugging out of Squeak

2006-11-15 Thread Klaus D. Witzel

Hi lanas,

there are 4 possibilities which come to my mind:

1 - you're using an image which we don't know, alternately: I can see a  
message somiliar to your's only if on windows and hit alt-f4.


2 - you're indeed on windows doing alt-f4 then there is a bug

3 - the message says Save changes before quitting? then this is so  
because you selected plain Quit from the World menu. In case you did the  
latter, perhaps your mouse thinks it clicks 1-2 pixels off and the menu is  
not what you expected?


4 - I cannot reproduce the message you cite 'Quit without saving the  
image', can you tell us precisely where and what you click and what kind  
of widget is then talking to you.


/Klaus

On Wed, 15 Nov 2006 13:32:41 +0100, lanas wrote:


Le Dimanche 12 Novembre 2006 13:00, Michael Haupt a écrit :


On 11/12/06, Another Dave [EMAIL PROTECTED] wrote:
 Let's say you're totally lost, and want to exit Squeak without saving
 anything from the mess you've just made.



Are you absolutely sure you haven't accidentally, in the last second,
hit one of the wrong pixels, i.e., one belonging to yes?


There's a UI loop in there which is nevertheless not very graceful I  
think.


The first option in this sequence is the user clicking the choice:

'Quit without saving the image' (or somesuch, I do not want to change  
language

just to get the right string that is displayed)

And then, very surprisingly, after the user has made this choice, another
choice pops up that asks: 'Save image ? yes/no/cancel (idem).

I find this to be squarly not straight, so to speak.  It is confusing  
for any
user to be asked about saving the image when the user has already  
expressed

the will of NOT saving the image.  Either remove this option in the first
place, or remove the additional choice of saving the image.

My two cents.

Cheers,
Al



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


[Newbies] Re: Bugging out of Squeak

2006-11-15 Thread Klaus D. Witzel

IC.

But then he is correct, the text *must* include three dots Quit ...  
because there is another step in that particular dialog.


Good find.

Release-team, please add the three dots to the world menu, thank you.

/Klaus

On Wed, 15 Nov 2006 15:21:19 +0100, Ralph Johnson wrote:


4 - I cannot reproduce the message you cite 'Quit without saving the
image', can you tell us precisely where and what you click and what kind
of widget is then talking to you.


In the final 3.9 image, at the bottom of the world menu, there is a
Save and quit option followed by a Quit option.  The quit option
does what he says, it asks if you want to save before you quit, quit
without saving, or cancel.  When you see save and quit followed by
quit, it is confusing to have quit ask you if you want to save.

Squeak has been this way for a long time.

-Ralph



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


[Newbies] Re: squeak and the jvm

2006-11-10 Thread Klaus D. Witzel

Hi Ben,

on Wed, 08 Nov 2006 20:33:49 +0100, you wrote:

On Nov 8, 2006, at 12:43 PM, Klaus D. Witzel wrote:

Hi Mike,
on Wed, 08 Nov 2006 18:13:17 +0100, you wrote:

Yes, this is what I was referring to.  Hotswapping is sort of there
for the jvm.  When I use Eclipse, it tries to hotswap.  Sometimes it
fails.  Sometimes it doesn't.  But, referring the criteria in my reply
to Ron's email, would loosing guaranteed hotswapping cause Squeak to
lose it's soul?  I dunnknow.  I'm a newbie.  And I don't write
Squeak for a living.


Having read your response to Ron's I think that all you ask for is to  
compile Squeak source code into JVM bytecode such that your application  
code can access the existing Java API's.


If what you want to do is to access Java objects from Squeak (and vice  
versa), you could also consider running the two VMs in parallel, and  
setting up a sort of bridge to communicate between them.


Having thought over this for a while, I must say that a VM^2 solution  
sounds intriguing for folks who are in need of the static j* libraries  
(for some reason) but at the same time do not want to miss incremental  
development, image based persistence and BlockContexts :)


This might help you even if your eventual goal is to port Squeak to run  
in JVM bytecode.


:) Sure.


We did a bridge for Squeak and .NET:

http://www.saltypickle.com/SqueakDotNet


Yes, I'm an admirer of that effort. I know people have asked for Sq/.Net  
and (hopefully) are using it (Hans, this is what I was talking about,  
perhaps you already have this URL?).


/Klaus

That program is a port of a similar bridge we did for Ruby. In both  
cases, we started out running the two VMs in different processes, and  
just sending socket-based messages between them; later, we got things  
working in a single process. Getting the basics up and running for one  
of these things is actually pretty quick, in my experience.


I think that the bridge approach has a lot to recommend it, in that you  
retain the advantages of both environments, and can use the regular  
production VM of both. (There are of course still some difficulties.)


Benjamin Schroeder



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


[Newbies] Re: Navigator tab, PUBLISH IT!

2006-11-10 Thread Klaus D. Witzel

Hi Dooright,

on the World menu there is a flaps... where you can ask Squeak to show  
the Navigator flap.


/Klaus

On Fri, 10 Nov 2006 19:32:21 +0100, Dooright wrote:


I'm trying to do the
http://www.dmu.com/squeak/sq1.html Learning Squeak
tutorial. How do I find the Navigator tab and/or the
PUBLISH IT! command in Squeak 3.9?





Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited



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


[Newbies] Re: Re: Navigator tab, PUBLISH IT!

2006-11-10 Thread Klaus D. Witzel
... and I wouldn't have know one bit of that if there hadn't been a  
remove Morphic and/or Etoys? thread, around the corner, where people  
where concerned about removing flaps together with Etoys and I had to  
educate myself what for+whether the flap feature is used by Etoy-less  
squeakers ;-)


On Fri, 10 Nov 2006 19:54:07 +0100, Brad Fuller wrote:


Klaus D. Witzel wrote:

Hi Dooright,

on the World menu there is a flaps... where you can ask Squeak to
show the Navigator flap.

heck, I never saw that before. That's easier.



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


[Newbies] Re: squeak and the jvm

2006-11-08 Thread Klaus D. Witzel

Hi Mike,

if by more message oriented opcode you mean Gilad Bracha's Invokedynamic  
opcode


- http://www.google.com/search?q=jvm+Invokedynamic

this is not sufficient for full Smalltalk/Squeak. Though it may be  
sufficient for scripting languages (languages in which, usually, types are  
unknown at compile-time).


What is also needed is full hotswapping

- http://blogs.sun.com/gbracha/entry/jsr292_and_hotswapping

and support for Smalltalk's #become: ...

But, perhaps, you had something else in mind?

/Klaus

On Wed, 08 Nov 2006 16:55:50 +0100, Michael Kohout wrote:


I suppose this is more of a pie in the sky type question, but with the
changes coming to the Java virtual machine in version 7, where the jvm
itself provides a more message oriented opcode, has any consideration
gone into perhaps porting squeak to run on the jvm?

I'm aware of talks2 but it seems as if development on that
effort(based on the public releases/news) is at a standstill.

thanks
Mike Kohout



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


[Newbies] Re: squeak and the jvm

2006-11-08 Thread Klaus D. Witzel

Hi Mike,

on Wed, 08 Nov 2006 18:13:17 +0100, you wrote:

Yes, this is what I was referring to.  Hotswapping is sort of there
for the jvm.  When I use Eclipse, it tries to hotswap.  Sometimes it
fails.  Sometimes it doesn't.  But, referring the criteria in my reply
to Ron's email, would loosing guaranteed hotswapping cause Squeak to
lose it's soul?  I dunnknow.  I'm a newbie.  And I don't write
Squeak for a living.


Having read your response to Ron's I think that all you ask for is to  
compile Squeak source code into JVM bytecode such that your application  
code can access the existing Java API's.


Is this correct?

If so, you'd need no hotswapping: your classes, inst vars and methods  
don't change when your app runs in production mode.


In my previous response I considered running *all* of the Squeak .image on  
the JVM, that would be quite a difference and would rely on 100%[tm]  
hotswapping (etc) being supported.



But in a Java environment I can tell you it isn't that bad.  And it's
downsides could be mitigated so long as Squeak/JVM could provide some
runtime mechanism to register some services to begin at startup(like
Commanche, etc).  Maybe this would be a tolerable compromose to most
Squeak developers if it provides more opportunities to use Squeak in
the wider world and enlarges it's user base.

But I don't have a clue about #become.  What does it do?


It changes the object identity of receiver and argument regardless of  
where they are referenced (in the Squeak .image), like in

 before := 'Klaus'.
 after := 'kwl'.
 before become: after.
 after printString prints 'Klaus' 

There are applications in Smalltalk/Squeak which depend on #become: for  
example when growing an OrderedCollection.


But if in such cases (like OrderedCollection) you'd always use a  
corresponding Java class then, again, it wouldn't matter.


I can say so because I have written a compiler for Smalltalk source code  
into JVM bytecode, which works and can compile itself, but it's not ready  
for prime time yet (and all the limitations of the JVM like #become: and  
hotswapping, etc, apply).


/Klaus


On 11/8/06, Klaus D. Witzel [EMAIL PROTECTED] wrote:

Hi Mike,

if by more message oriented opcode you mean Gilad Bracha's  
Invokedynamic

opcode

- http://www.google.com/search?q=jvm+Invokedynamic

this is not sufficient for full Smalltalk/Squeak. Though it may be
sufficient for scripting languages (languages in which, usually, types  
are

unknown at compile-time).

What is also needed is full hotswapping

- http://blogs.sun.com/gbracha/entry/jsr292_and_hotswapping

and support for Smalltalk's #become: ...

But, perhaps, you had something else in mind?

/Klaus

On Wed, 08 Nov 2006 16:55:50 +0100, Michael Kohout wrote:

 I suppose this is more of a pie in the sky type question, but with the
 changes coming to the Java virtual machine in version 7, where the jvm
 itself provides a more message oriented opcode, has any consideration
 gone into perhaps porting squeak to run on the jvm?

 I'm aware of talks2 but it seems as if development on that
 effort(based on the public releases/news) is at a standstill.

 thanks
 Mike Kohout


___
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: squeak and the jvm

2006-11-08 Thread Klaus D. Witzel

On Wed, 08 Nov 2006 19:07:40 +0100, Michael Kohout wrote:


Thanks Klaus.  Sodoes #become change the address of what 'after'
points to,


Yes, and vice versa, simultaneously.


so these two references now point to the same location in
memory,


No, but there is a variant of #become: which can do that if needed.


or does it clone what 'before' references and point 'after' to
it?


No, there is no cloning (copying) involved, just a pointer swap whereever  
these two pointers appear in the .image (so in every object pointing to  
them).



Or does it do something more complex?


No, it's just one of the two straight forward cases above.

/Klaus


On 11/8/06, Klaus D. Witzel [EMAIL PROTECTED] wrote:

Hi Mike,

on Wed, 08 Nov 2006 18:13:17 +0100, you wrote:
 Yes, this is what I was referring to.  Hotswapping is sort of there
 for the jvm.  When I use Eclipse, it tries to hotswap.  Sometimes it
 fails.  Sometimes it doesn't.  But, referring the criteria in my reply
 to Ron's email, would loosing guaranteed hotswapping cause Squeak to
 lose it's soul?  I dunnknow.  I'm a newbie.  And I don't write
 Squeak for a living.

Having read your response to Ron's I think that all you ask for is to
compile Squeak source code into JVM bytecode such that your application
code can access the existing Java API's.

Is this correct?

If so, you'd need no hotswapping: your classes, inst vars and methods
don't change when your app runs in production mode.

In my previous response I considered running *all* of the Squeak .image  
on

the JVM, that would be quite a difference and would rely on 100%[tm]
hotswapping (etc) being supported.

 But in a Java environment I can tell you it isn't that bad.  And it's
 downsides could be mitigated so long as Squeak/JVM could provide some
 runtime mechanism to register some services to begin at startup(like
 Commanche, etc).  Maybe this would be a tolerable compromose to most
 Squeak developers if it provides more opportunities to use Squeak in
 the wider world and enlarges it's user base.

 But I don't have a clue about #become.  What does it do?

It changes the object identity of receiver and argument regardless of
where they are referenced (in the Squeak .image), like in
  before := 'Klaus'.
  after := 'kwl'.
  before become: after.
  after printString prints 'Klaus' 

There are applications in Smalltalk/Squeak which depend on #become: for
example when growing an OrderedCollection.

But if in such cases (like OrderedCollection) you'd always use a
corresponding Java class then, again, it wouldn't matter.

I can say so because I have written a compiler for Smalltalk source code
into JVM bytecode, which works and can compile itself, but it's not  
ready

for prime time yet (and all the limitations of the JVM like #become: and
hotswapping, etc, apply).

/Klaus

 On 11/8/06, Klaus D. Witzel [EMAIL PROTECTED] wrote:
 Hi Mike,

 if by more message oriented opcode you mean Gilad Bracha's
 Invokedynamic
 opcode

 - http://www.google.com/search?q=jvm+Invokedynamic

 this is not sufficient for full Smalltalk/Squeak. Though it may be
 sufficient for scripting languages (languages in which, usually,  
types

 are
 unknown at compile-time).

 What is also needed is full hotswapping

 - http://blogs.sun.com/gbracha/entry/jsr292_and_hotswapping

 and support for Smalltalk's #become: ...

 But, perhaps, you had something else in mind?

 /Klaus

 On Wed, 08 Nov 2006 16:55:50 +0100, Michael Kohout wrote:

  I suppose this is more of a pie in the sky type question, but with  
the
  changes coming to the Java virtual machine in version 7, where the  
jvm
  itself provides a more message oriented opcode, has any  
consideration

  gone into perhaps porting squeak to run on the jvm?
 
  I'm aware of talks2 but it seems as if development on that
  effort(based on the public releases/news) is at a standstill.
 
  thanks
  Mike Kohout


 ___
 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




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


[Newbies] Re: Beginners questions

2006-11-08 Thread Klaus D. Witzel

Hi Jeff,

this is because you post in the HTML format, in which your messages  
appears quite nice


-  
http://permalink.gmane.org/gmane.comp.lang.smalltalk.squeak.beginners/1368


But all these mailing lists are run in plain text mode. So perhaps you  
switch your mail client to plain text mode, like we all do, and everybody  
will be happy :)


/Klaus

On Wed, 08 Nov 2006 19:22:59 +0100, Jeffhombreviii@myway.com wrote:

I've noticed on the list my mailings don't seem to parse correctly. I  
don't know why that is, but I can't blame you for not being tempted to  
wade through them. I wouldn't be either. If anyone can tall me how to  
solve this, I'd appreciate it.Thanks,Jeff --- On Wed 11/08, lanas lt;  
[EMAIL PROTECTED] gt; wrote:From: lanas [mailto:  
[EMAIL PROTECTED]: [EMAIL PROTECTED]: Wed, 8  
Nov 2006 07:27:57 -0500Subject: Re: [Newbies] Beginners questionsLe  
Lundi 6 Novembre 2006 18:09, Jeff a écrit :gt; Hello group!I'm hoping  
that this beginners list is a good place for agt; beginner to get  
answers to... well, beginner's questions. And so, with thatgt; in mind,  
I'll ask a few questions. But first, experience has taught me thatgt; I  
should be a little more clear in what I'm looking for as an answer.gt;  
Imagine a total newbie to computers asked a group of experts the qu
 estiongt; quot;How do I run a program under windows?quot;. One  
member of the groupgt;
decided to respond by handing him a 400 page technical manual on  
windowsgt; and telling him that everything he wants to know is in  
there. Upon seeinggt; that the rest of the group decides that his  
question has been answered andgt; sees no need to offer additional  
assistance. This newbie's question wasn'tgt; actually answered by the  
group, ultimately what they did was say quot;askgt; the manualquot;.  
The manual naturally can't hear him so it can't directlygt; respond to  
his question, he has to start searching it. After skimming agt; bunch  
of pages and not seeing what he's looking for, (or anything hegt;  
understands), he looks in the index. It isn't there. He looks in the  
tablegt; of contents to see a chapter called quot;Getting started  
withgt; windowsquot;. Thinking that looks like what he needs, he flips  
to it andgt; it starts out by telling him that the first thing he nee
 ds to do is installgt; windows. Ok, so he looks for this Windows disk.  
[snip]For what
it's worth, your message appeared as a large chunck of dense text (worse  
than quoted above) without any paragraphs, filling the windows' text  
screen like a wall brick.I must be frank and I must say that it was not  
tempting to wade through and read it.This being said, no, I can't answer  
your question  
;-)Cheers,Al___Beginners  
mailing  
[EMAIL PROTECTED]://lists.squeakfoundation.org/mailman/listinfo/beginners


___
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com



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


[Newbies] Re: Underscore in 3.9

2006-10-24 Thread Klaus D. Witzel

Thank you Andy!

On Tue, 24 Oct 2006 13:36:30 +0200, Andrew Tween wrote:


Hi,
The syntaxHighlightingAsYouType* Preferences relate to the Shout  
package, which
is NOT  part of the 3.9 release. As you say, the preference values have  
been
fixed in the squeak-dev image (which includes Shout), and are also fixed  
in the

latest squeaksource version of Shout.

Unfortunately, the SqueakMap version of Shout is not up-to-date, and has  
the old
(confusing) default preference values. I will soon update the SqueakMap  
release

with the latest from squeaksource, and then everything should be ok.

Cheers,
Andy

- Original Message -
From: Klaus D. Witzel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: beginners@lists.squeakfoundation.org
Sent: Tuesday, October 24, 2006 12:12 PM
Subject: Re: Underscore in 3.9


Stef  Marcus,

would it be possible to change all syntaxHighlightingAsYouType*
Preferences to values that do not cause confusion for beginners.

This was already done so for the Squeak-dev image.

Thank you very much in advance!

/Klaus

On Tue, 24 Oct 2006 12:38:29 +0200, Ramiro Diaz Trepat wrote:


Thank you Klaus.
Everything is fine now.
Probably that defaullt setting should be changed before the release,
shouldn't it?


On 10/24/06, Klaus D. Witzel [EMAIL PROTECTED] wrote:

Hi Ramiro,

on Tue, 24 Oct 2006 00:30:23 +0200, you wrote:

 Hello everyone,
 I started using the latest 3.9 image and there are no := there :)
 Only underscores.
 Even when I write := it turns into _ when I save.
 I am sure there is a very silly option out there to deactivate
 this behaviour.  Anyone can tell me?
 Thanks

Open Preference Browser and in the searchbox type
syntaxHighlightingAsYouType.

This will show up three underscore and := related preferences.

Unfortuntely the initial preferences in the stock 3.9 image are as you
desribed.

Have a look at the developer's image, there this (and other  
preferences)

are pre-set for meeting the expectations of developers, the image also
comes with cool tools pre-loaded

- http://damiencassou.seasidehosting.st/seaside/pier

/Klaus

___
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: Underscore in 3.9

2006-10-23 Thread Klaus D. Witzel

Hi Ramiro,

on Tue, 24 Oct 2006 00:30:23 +0200, you wrote:


Hello everyone,
I started using the latest 3.9 image and there are no := there :)
Only underscores.
Even when I write := it turns into _ when I save.
I am sure there is a very silly option out there to deactivate
this behaviour.  Anyone can tell me?
Thanks


Open Preference Browser and in the searchbox type  
syntaxHighlightingAsYouType.


This will show up three underscore and := related preferences.

Unfortuntely the initial preferences in the stock 3.9 image are as you  
desribed.


Have a look at the developer's image, there this (and other preferences)  
are pre-set for meeting the expectations of developers, the image also  
comes with cool tools pre-loaded


- http://damiencassou.seasidehosting.st/seaside/pier

/Klaus

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


[Newbies] Re: binary streams, how to

2006-10-22 Thread Klaus D. Witzel

Hi Petr,

on Mon, 23 Oct 2006 00:02:28 +0200, you wrote:

Hi,

which methods shall I use for binary (fast) reads/writes to file
(stream)?
I need to write Boolean (1byte), Integers (4 or 8 bytes), Floats (?) and
Strings into big files, but standard way via storeOn: (text
representation) is inefficient for me.


You may want to look into the #'data get/put' messages category of  
PositionableStream, implementors of #int32: then alt-B


/Klaus


Thanks, pf



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


[Newbies] Re: problem with big dictionary

2006-10-18 Thread Klaus D. Witzel

Hi Petr,

it just passed 1 250 000 here, without the symptoms you describe, on a 1GB  
WinXP notebook.


What platform are you using?

/Klaus

P.S. I always declare temps explicitly in a workspace, I don't like the  
possible surprise and also because I want to see the temps when I  
interrupt the DoIt with alt-.


On Wed, 18 Oct 2006 14:35:42 +0200, Petr Fischer  
[EMAIL PROTECTED] wrote:



Hi, what is wrong with this code:
-
cnt := 500.
s := ' jasdfh afhahkjasdf asdf sd'.
d := Dictionary new: cnt.
1 to: cnt do: [ :i |
d at: i put: (i asString, s).
(i \\ 5 = 0) ifTrue: [ Transcript show: i; cr. ].
].
d size.
-

Squeak (latest 3.9) hangs randomly after 600 000 - 1 000 000 iterations
(about 129MB of RAM [2GB] used before hang).

hang = white squeak window, no interaction possible, 100% of cpu usage

Thanks for suggestions, pf



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


[Newbies] Re: problem with big dictionary

2006-10-18 Thread Klaus D. Witzel

Hi Petr,

hm, I think that I've seen that, have a look at

- http://bugs.impara.de/view.php?id=4709

Find the word workaround on that page. Perhaps this helps you, too.

/Klaus

On Wed, 18 Oct 2006 16:04:39 +0200, Petr Fischer wrote:


Klaus D. Witzel píše v St 18. 10. 2006 v 15:45 +0200:

Hi Petr,

it just passed 1 250 000 here, without the symptoms you describe, on a  
1GB

WinXP notebook.

What platform are you using?



Ubuntu Linux (Dapper)
kernel: 2.6.15-27-686 #1 SMP PREEMPT
PentiumM (Sonoma) 1.86GHz, 2GB RAM

squeak -version
---
3.7-7 #1 Fri Apr 14 11:44:44 UTC 2006 gcc 4.0.3
Squeak3.7 of '4 September 2004' [latest update: #5989]
Linux vernadsky 2.6.12 #1 SMP Mon Jan 2 16:52:14 UTC 2006 i686 GNU/Linux
default plugin location: /usr/lib/squeak/3.7-7/*.so




/Klaus

P.S. I always declare temps explicitly in a workspace, I don't like the
possible surprise and also because I want to see the temps when I
interrupt the DoIt with alt-.

On Wed, 18 Oct 2006 14:35:42 +0200, Petr Fischer wrote:

 Hi, what is wrong with this code:
 -
 cnt := 500.
 s := ' jasdfh afhahkjasdf asdf sd'.
 d := Dictionary new: cnt.
 1 to: cnt do: [ :i |
d at: i put: (i asString, s).
(i \\ 5 = 0) ifTrue: [ Transcript show: i; cr. ].
 ].
 d size.
 -

 Squeak (latest 3.9) hangs randomly after 600 000 - 1 000 000  
iterations

 (about 129MB of RAM [2GB] used before hang).

 hang = white squeak window, no interaction possible, 100% of cpu usage

 Thanks for suggestions, pf


___
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: problem with big dictionary

2006-10-18 Thread Klaus D. Witzel

Petr,

yes, there seems to be a limit = 1GB in the 32bit VM's. It is perhaps  
possible to bypass the problem by using the -mmap argument but I have no  
experience with that.


Perhaps you find a more recent VM executable which fits:

- http://www.squeakvm.org/unix/

IIRC  1GB of memory is addressed in the 64bit VM's.

/Klaus

On Wed, 18 Oct 2006 17:23:00 +0200, Petr Fischer wrote:


Thanks for this workaround - it works now.

But highest value for -memory parameter is 880MB (on my Ubuntu Linux).
If I try greater value than 880MB, squeak falls down with message:
bad address: negative.

pf

Klaus D. Witzel píše v St 18. 10. 2006 v 16:31 +0200:

Hi Petr,

hm, I think that I've seen that, have a look at

- http://bugs.impara.de/view.php?id=4709

Find the word workaround on that page. Perhaps this helps you, too.

/Klaus

On Wed, 18 Oct 2006 16:04:39 +0200, Petr Fischer wrote:

 Klaus D. Witzel píše v St 18. 10. 2006 v 15:45 +0200:
 Hi Petr,

 it just passed 1 250 000 here, without the symptoms you describe, on  
a

 1GB
 WinXP notebook.

 What platform are you using?


 Ubuntu Linux (Dapper)
 kernel: 2.6.15-27-686 #1 SMP PREEMPT
 PentiumM (Sonoma) 1.86GHz, 2GB RAM

 squeak -version
 ---
 3.7-7 #1 Fri Apr 14 11:44:44 UTC 2006 gcc 4.0.3
 Squeak3.7 of '4 September 2004' [latest update: #5989]
 Linux vernadsky 2.6.12 #1 SMP Mon Jan 2 16:52:14 UTC 2006 i686  
GNU/Linux

 default plugin location: /usr/lib/squeak/3.7-7/*.so



 /Klaus

 P.S. I always declare temps explicitly in a workspace, I don't like  
the

 possible surprise and also because I want to see the temps when I
 interrupt the DoIt with alt-.

 On Wed, 18 Oct 2006 14:35:42 +0200, Petr Fischer wrote:

  Hi, what is wrong with this code:
  -
  cnt := 500.
  s := ' jasdfh afhahkjasdf asdf sd'.
  d := Dictionary new: cnt.
  1 to: cnt do: [ :i |
d at: i put: (i asString, s).
(i \\ 5 = 0) ifTrue: [ Transcript show: i; cr. ].
  ].
  d size.
  -
 
  Squeak (latest 3.9) hangs randomly after 600 000 - 1 000 000
 iterations
  (about 129MB of RAM [2GB] used before hang).
 
  hang = white squeak window, no interaction possible, 100% of cpu  
usage

 
  Thanks for suggestions, pf


 ___
 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




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


[Newbies] Re: Inserting special characters?

2006-09-17 Thread Klaus D. Witzel

Hi Simon,

in Squeak (Smalltalk) everything is always available, especially to  
developers :)


You may want to print this expression (with printIt)

 Character characterTable

Enjoy.

/Klaus

On Sun, 17 Sep 2006 21:57:27 +0200, Simon Guest wrote:


Hi,

How do I insert special characters in a text morph in Squeak?  I guess
I'm after an equivalent to the Windows character picker, for
characters which cannot be typed on the keyboard.

It would be nice to see all the symbols available in a font, and pick
from that list.

cheers,
Simon



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


[Newbies] Re: what does Squeak leave out?

2006-09-14 Thread Klaus D. Witzel

On Thu, 14 Sep 2006 18:13:08 +0200, Ramon Leon wrote:



Cincom Smalltalk is a 640Meg download. Squeak is a 17Meg download.
What's missing from Squeak?

 Jerry Muelver


Bloat ;)


More Bloat 8-)


___
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 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


[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


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

2006-08-11 Thread Klaus D. Witzel

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.

/Klaus

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


[Newbies] Re: error trap

2006-08-11 Thread Klaus D. Witzel

On Fri, 11 Aug 2006 23:00:03 +0200, stéphane ducasse wrote:
Klaus wrote:

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

  ^ dict at: aKey ifAbsent: [nil]


this is much better.


Why do you call failures in understanding things like this better, Stef?  
Whoever writes such statements, has no idea about an object's value versus  
a block's value and especially no idea about when and why execution of a  
block of code can and should be delayed (not to speak about performance  
impact).



I would like to see caseOf:...removed from the system


And replace it by what? Why would you limit the expressive power of the  
software developer, Stef?


/Klaus


stef



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


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

2006-08-10 Thread Klaus D. Witzel

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-)


One of the things that prevents me from even considering it at work is
the lack of Oracle driver support.  Of course, I could write that
support myself using named primitives(and I've tried), but the
documentation on how to use all the modern Slang features and tie the
whole thing into XCode is much too sparse.

When this changes I might be able to use squeak for more than just  
amusement.


Michael, have you seen the SQLite3 package on SqueakMap. It is more than  
easy to interface an external library from Squeak, no Slang, no C-compiler  
needed (if you don't depend on callbacks). The SQLite3 Squeak code is  
authored for calling into an external library on Mac OS X but it's a  
matter of minutes to change that to MS$ windoze or linux (I know that  
you're using Squeak on OS X...)


Hope that it's a rainy day at your site ;-)

/Klaus

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


[Newbies] Re: error trap

2006-08-10 Thread Klaus D. Witzel

On Thu, 10 Aug 2006 17:27:09 +0200, Roel Wuyts wrote:

Note: no need for the endEntry when using show: it does it already (see  
TranscriptStream#show: )


Use a 'manual' endEntry when you would use nextPutAll: or print: etc. on  
the Transcript (which most people do not use anyway).


Right you are! But I'm writing on recycled web pages, those with  
notoriously small margin, therefore I tend to believe that people point to  
the methods mentioned (like #endEndtry) and curiously look for  
implementors and other good things in the same message category, the  
famous cmd-m followed by a cmd-b and/or cmd-m :p


/Klaus

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


[Newbies] Re: error trap

2006-08-10 Thread Klaus D. Witzel

Hi Ron,

on Thu, 10 Aug 2006 17:02:11 +0200, you wrote:

From: Klaus D. Witzel
... You didn't inspectIt for verifying


No I didn't!  The { } just looked so wrong and like C!


Yes, same for me when I saw that for the first time in Squeak. Never saw  
that in Smalltalk/2.x (didn't look for it in VW).


But nowaday's I wonder how we have done it for so many decades without  
handsome {expression. 'constant'. [block]} select: [:everything |  
everything isAnObject].


/Klaus

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


[Newbies] Re: error trap

2006-08-09 Thread Klaus D. Witzel

On Wed, 09 Aug 2006 19:59:41 +0200, Brian Murphy-Dye wrote:

Ron, another crazy possibility comes to mind when reading your
excellent description: making each line it's own block.

{[10/0].
  [2 raisedToInteger: 1/2].
  [-5 raisedTo: 1.5]
} do: [:each | [each value] on: Exception do: [:ex | Transcript show:
ex; cr]].


Excellent, Brian. Why do you still write in the beginners list ;-)
...
Ah, now I can see why: Transcript endEntry is missing from the above :)  
/joke


/Klaus


Brian.


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


[Newbies] Re: Re: error trap

2006-08-09 Thread Klaus D. Witzel

On Wed, 09 Aug 2006 21:11:40 +0200, Ron Teitelbaum wrote:

Brian,

Yes I agree it's a great suggestion, although a few changes:
Literal blocks to not parse into collections automatically.


Ron, please: a literal Array is a subclass of Collection and so the blocks  
in


 { [nil]. [true]. [false] }

parse into collections automatically. You didn't inspectIt for verifying  
your (false) claim, didn't you. Also, have a look at the implementors of  
#caseOf: and #caseOf:otherwise:, they are heavy users of literal blocks in  
Collections ...


...

Each in this case is already a block.


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. Not a big surprise since Java and other procedural-oriented  
friends do not offer block values. So any demo of using blocks as if  
they where any other object, as Brian has shown, is a sign for the ability  
to master the subject 8-)



Only each is needed.


Absolutely.


So here is a version that works.

(OrderedCollection new
add: [10/0];
add: [2 raisedToInteger: 1/2];
add: [-5 raisedTo: 1.5]; yourself
) do: [:each | each on: Exception do: [:ex | Transcript show: ex; cr;
endEntry]].

endEntry is for Klaus!


Hhm, endEntry is too expensive within any and every loop. Just put  
Transcript endEntry after the loop. I mentioned endEntry because  
Transcript almost always does not display the last lines (they are  
buffered) and people get confused and believe that either their code or  
Squeak is wrong (but both is not the case).



It is a very good suggestion Brian!


Indeed, and Briant's use of literal blocks in a literal Array is perfect  
(in the sense of: cannot be made better).


/Klaus


Ron Teitelbaum


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


[Newbies] Re: Can't file in project with SqueakMap code in it

2006-07-29 Thread Klaus D. Witzel
Mike, thank you for sharing this experience. In another world at another  
time I'm investigating the dont's and do's of the (most likely rotten)  
interplay between the classic changes mechanism and SqMap and MC. You  
experience made it onto my toDo list, thank you.


/Klaus

On Sat, 29 Jul 2006 00:59:18 +0200, Mike O'Brien wrote:


Is this a problem with the order in which Project files
are written?  It's just possible that I first loaded XPMReadWriter
before creating this project, then loaded it in again.  Would
this result in such a Project file?


It's possible this is what happened.  I just tried
an experiment where I started with a clean image of 3.8-6665,
updated SqueakMap, created a new Project, entered it, loaded
XPMReadWriter, wrote out a Project file, then abandoned the image
and loaded the new Project file into a clean image with
an updated SqueakMap.  That project file loaded without error.
It looks like if you reload a class into an image that already
has the class defined, what goes into the changeSet won't
file in correctly to an image that's never seen the new
class before.  I suppose I shouldn't be surprised.

On my original image that gave rise to this problem,
I also got a popup about blocks playing with instance variables,
which I didn't understand even after browsing the debugger
that resulted.  Pointers as to what that's all about would be
appreciated: I couldn't even make enough sense of what it
was trying to tell me (the Debugger opened on methods deep
inside the squeak parser) to determine whether this was
related to the problem of filing in the Project file.

Mike O'Brien



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


[Newbies] My favourite strange expression [was: Challenge]

2006-07-20 Thread Klaus D. Witzel

On Thu, 13 Jul 2006 12:39:53 +0200, Bert Freudenberg wrote:


Heh. My favourite strange expression is this:

# hi there :== '_'

1) Who can guess what the result is WITHOUT trying it?
2) Who can explain what's happening?
3) Do we need to fix it?

- Bert -


Found another one (relative to #7042):

| philosopher mathematicians |
  mathematicians := 2.
  philosopher := philosopher == mathematicians.
  OrderedCollection new
addLast: philosopher;
removeLast: mathematicians;
size

Questions 1-3 from Bert applicable to *both* issues ;-)

/Klaus

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


[Newbies] Re: implementation

2006-07-09 Thread Klaus D. Witzel

Hi Math,

on Sun, 09 Jul 2006 23:42:28 +0200, you wrote:


Hi,

I was reading code when I find several implementation of # selector.


You have perhaps seen that in a recent 3.9 image?


But they all have the same body. (Except for Integer).


You can switch on the preference to show annotation panes in browsers,  
then you'd see that the methods (except for CArray and Integer) are indeed  
the same code+version: there's only one # method propagated by the  
traits system.



So why?


Hope that helps.

/Klaus


Math






___
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son  
interface révolutionnaire.

http://fr.mail.yahoo.com



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


[Newbies] Shouldn't 7r6.5 be the same as 7r65 * 0.1

2006-07-03 Thread Klaus D. Witzel

Would some good soul please explain what

Number readFrom: '7r6.5'

should return. It is apparently not the same as 7r65 * 0.1 and before I  
dig deeper (why does this happen, is it a bug or feature) I'd appreciate  
that someone confirms or rejects (bug | feature).


Thank you.

/Klaus

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


[Newbies] Re: Shouldn't 7r6.5 be the same as 7r65 * 0.1

2006-07-03 Thread Klaus D. Witzel

Hi Ken,

on Mon, 03 Jul 2006 20:51:00 +0200, you wrote:

On Mon, 2006-07-03 at 20:30 +0200, Klaus D. Witzel wrote:

Would some good soul please explain what

Number readFrom: '7r6.5'

should return. It is apparently not the same as 7r65 * 0.1 and before I
dig deeper (why does this happen, is it a bug or feature) I'd appreciate
that someone confirms or rejects (bug | feature).

Thank you.

/Klaus


Because in the expression

7r65 * 0.1

the first value is in base 7 whereas the second is in base 10

7r65 * 7r0.1 IS the same valus as 7r6.5.


Ah! This equation cut my knot, thank you Ken.

/Klaus


Ken



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


[Newbies] Demystifying most Smalltalk’s don 't directly support multiple inheritance

2006-06-22 Thread Klaus D. Witzel

List,

haven't you heard that Smalltalk and Squeak do not directly support  
multiple inheritance, time and again? But that Perl, Python and Ruby do  
(to some extent)?

- http://www.google.com/search?q=python+ruby+multiple+inheritance

Well, that is not the case for Smalltalk since the time that VMs are  
implemented by using the specs of the Blue Book.


I have attached a small .st file which demonstrates that the *unchanged*  
VM *must* support multiple inheritance (for message sends), or else it  
won't work properly. It's a matter of view on what the VM does for you :-D


With the exception of support code for exceptions [pun intended] the  
attached examples work on VMs which implement the super send from the Blue  
Book.


The first example demonstrates that multiple inheritance works; in this  
example it is also checked that the requesting method qualifies (that the  
instances qualify is checked at fileIn time).


The second example does a message tally and shows that there is less than  
50% overhead when possible walkbacks are guarded at every multiple  
inheritance message send.


The third example employs the existing method cache of the VM (the  
original Squeak VM) for multiple inheritance message sends and thus  
minimizes the overhead to less than 5% (and the demo is written in .st  
code :-)


Again, this all exists *unchanged* for decades. It only had to be brought  
to the surface?


---

I would be very interested to see if my examples run on other platforms  
and VMs, please post your experience. Thank you.


It'd be equally interesting if the approach had been used before.

/Klaus

Multiple-Inheritance.st
Description: Binary data
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: Accessing projects from a Web page

2006-06-10 Thread Klaus D. Witzel

On Sat, 10 Jun 2006 11:04:48 +0200, Bert Freudenberg wrote:


Am 10.06.2006 um 05:49 schrieb Klaus D. Witzel:

Would some good soul please have a look a the plugintest.html page,  
which on my platform starts with the following text in the plugin  
window: Hello Plugin World!


This window was opened by some code in the file plugintest.sts, which  
was downloaded by your web browser. The browser started the Squeak  
Virtual Machine (C:\Program Files\Opera\Program\Plugins\Squeak.exe)  
with a default object image (C:\Program Files\Opera 
\Program\Plugins\SqueakPlugin.image).


Since you are reading this I guess all is okay then ...

Click FIND in the Navigator bar below to load some example projects.  
You can get a larger view by clicking Escape Browser.


my observations:

1) there is no Navigation bar (so no escape from the browser)
2) the heigth of the plugin is insufficient for reaching all items of  
the world menu (i.e. the desktop menu)


Since this is a test page, me too would like to see it work.

BTW the Fullwindow mode link works here and let me access the desktop  
menu from the world menu.



This test page assumes you actually use Squeakland's SqueakPlugin.image.  
That image has the golden navigator flap enabled by default.


I believe that is indeed the case, it says 'Squeakland 3.8-05 of 1  
September 2005'. I use it for the Petri net demo

- http://www.iam.unibe.ch/~scg/Teaching/CP/PetriNets/

The code that opens the workspace is in the file plugintest.sts, it  
could be made more intelligent to test for enabled flaps. However, I  
can't update that website easily anymore.


Thank you anyways for taking care.


Using the Squeakland image, the world menu fits on the screen for me.


Not that I did expect the following but, enlarging the Opera web page to  
150% did the job, the menu now fits :)



If it does not in your image, you could use Alt-Drag to move it.


Tried it but that stalls the VM (no reaction to mouse or keyboard) and one  
has to reload the web page.



- Bert -


Thanks again.

/Klaus





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


Re: [Newbies] Re: Accessing projects from a Web page

2006-06-10 Thread Klaus D. Witzel

On Sat, 10 Jun 2006 12:45:37 +0200, Bert Freudenberg wrote:


Am 10.06.2006 um 11:29 schrieb Klaus D. Witzel:
This test page assumes you actually use Squeakland's  
SqueakPlugin.image. That image has the golden navigator flap enabled  
by default.


I believe that is indeed the case, it says 'Squeakland 3.8-05 of 1  
September 2005'. I use it for the Petri net demo

- http://www.iam.unibe.ch/~scg/Teaching/CP/PetriNets/


Using the Squeakland image, the world menu fits on the screen for me.


Not that I did expect the following but, enlarging the Opera web page  
to 150% did the job, the menu now fits :)


I suspect that you ran that image manually and saved it (accidentally)  
with some non-default preferences.


No (did not run the image manually) and yes (saved the image from the  
Opera browser after install+update code from server) and no (non-default  
preferences): downloading a fresh copy from

 - http://squeakland.org/installers/SqueakPlugin.image.zip
this one says 'Squeakland 3.8-05 latest update: #481 Current Change Set:  
Unnamed1' and also has no golden navigator flap (but show shared flaps  
are enabled on the world menu, as before).


Perhaps a platform (Opera, WinXP) specific difference? Should there be any  
other files (besides SqueakPlugin.image) on startup?


NB: after successfully doing an update code from server on the fresh  
copy, when saving the resulting image, FileDirectory startUp does  
DosFileDirectory assureDirectory: 'C:\My Squeak' which raises a debugger  
but, the directory exists (and is populated) and on the next start (browse  
page refresh), #systemInformationString still says update: #481. Saved  
SqueakDebug.log if that is of interest.


/Klaus


- Bert -


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


[Newbies] Re: Accessing projects from a Web page

2006-06-09 Thread Klaus D. Witzel

Hi Mark,

on Thu, 08 Jun 2006 23:40:09 +0200, you wrote:


Hi,

Is there a trick to accessing Squeak projects from a Web page?

I built a Web page and linked to a project I put on my Web server which
is hosted by a third party ISP.

Instead of opening the project when the link is clicked the Windows
download dialog box displays.
I have to click the Open button to display
the project. It works but I'd rather have the project display without
the dialog box.


Since you mention Windows[tm], they attempt to protect you from opening
unknown content type from the internet. Have a look at

-
http://www.google.com/search?q=explorer+option+disable+%22open+confirmation%22

the tipps on the non microsoft pages.


Any ideas?


Hope this helps.

/Klaus


Thanks in advance.

Mark


Mark McCarty
Technology Teacher
Winterhaven School
3830 SE 14th Ave.
Portland, OR  97202
503-916-6200


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


[Newbies] Re: Accessing projects from a Web page

2006-06-09 Thread Klaus D. Witzel
Would some good soul please have a look a the plugintest.html page, which  
on my platform starts with the following text in the plugin window: Hello  
Plugin World!


This window was opened by some code in the file plugintest.sts, which was  
downloaded by your web browser. The browser started the Squeak Virtual  
Machine (C:\Program Files\Opera\Program\Plugins\Squeak.exe) with a default  
object image (C:\Program Files\Opera\Program\Plugins\SqueakPlugin.image).


Since you are reading this I guess all is okay then ...

Click FIND in the Navigator bar below to load some example projects. You  
can get a larger view by clicking Escape Browser.


my observations:

1) there is no Navigation bar (so no escape from the browser)
2) the heigth of the plugin is insufficient for reaching all items of the  
world menu (i.e. the desktop menu)


Since this is a test page, me too would like to see it work.

BTW the Fullwindow mode link works here and let me access the desktop menu  
from the world menu.


Thank you in advance.

/Klaus

On Fri, 09 Jun 2006 15:40:52 +0200, Bob Courchaine [EMAIL PROTECTED]  
wrote:



Hi, Mark!

It's not really clear below how you linked to a project.

Here's a test and an example of the HTML you use to access the Squeak
Plugin, which is what Squeak Projects need to run in a browser:

http://wwwisg.cs.uni-magdeburg.de/~bert/squeak/plugin/test/plugintest.html

Hope that helps!

Bob

Mark McCarty wrote:

Hi,

Is there a trick to accessing Squeak projects from a Web page?

I built a Web page and linked to a project I put on my Web server which
is hosted by a third party ISP.

Instead of opening the project when the link is clicked the Windows
download dialog box displays. I have to click the Open button to display
the project. It works but I'd rather have the project display without
the dialog box.

Any ideas?



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


[Newbies] Re: self executable with squeak

2006-06-07 Thread Klaus D. Witzel

Hi Benjamin,

on Wed, 07 Jun 2006 07:48:52 +0200, you wrote:


hello,
I apologize if this question has already been posted, but i did not find  
it.
i wanted to know if it is possible to make a self executable file with a  
squeak package or more packages. Just so that someone can use it without  
using squeak or even without having it. I heard about stripers what is  
it and how does it work?


Have a look at http://www.amazon.de/exec/obidos/ASIN/3898353664 (sorry,  
only in German). This is a Squeak application which runs out of the box.


Is this what you mean?

/Klaus


thanks for the time you'll take.

benjamin



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