[Seaside] Re: What do you think about Ruby on Rails ?
David T. Lewis
lewis at mail.msen.com
Sat Aug 13 03:22:11 CEST 2005
On Fri, Aug 12, 2005 at 10:55:01AM +0200, stephane ducasse wrote:
> But why because this is in XXX we cannot have it in Smalltalk.
> I would like to be able to write
> Directory default filesAndFoldersDo: [:file | Output show: file
> size ; cr]
> and not manipulate strings as in python.
Well, terseman is nowhere in sight, and somebody has to start
somewhere, so...in a Squeak startup script, to be run headless as
in "squeak -headless squeak.image file:///foo/bar/myStartupScript",
you could do this:
| dirStack stdout |
stdout _ FileStream fileNamed: '/dev/tty'.
dirStack _ OrderedCollection with: FileDirectory default.
[dirStack isEmpty] whileFalse:
[ | dir |
dir _ dirStack first.
dirStack addAll: (dir entries
select: [:d | d isDirectory]
thenCollect: [:dd | FileDirectory on: dir pathName, dir slash, dd name]).
(dir entries reject: [:d | d isDirectory])
do: [:f | stdout nextPutAll: dir pathName, dir slash, f name , ': ', f fileSize asString, String lf].
Smalltalk snapshot: false andQuit: true
I'm assuming that "Output" refers to stdout in the hypothetical example,
and of course in Seaside you would be doing something else, perhaps a
table of file names and file sizes I suppose. But as long as we are
this far off topic, what's the difference?
More information about the Seaside