[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] HOWTO redirect a i/o-port in Unix??



>>>>> "MF" == Matthew Flatt <mflatt@cs.utah.edu> writes:

    MF> So why *do* you use Scheme when Perl does everything already?

    MF> To me, it's an aesthetic and engineering argument. I use Scheme because
    MF> I belive the code will be more reliable, maintainable, and reusable.
    MF> Those benefits have a lot to do with the careful design of the
    MF> language.

I started learning/using Scheme a month ago for exactly the same reasons and I
am *NOT* disappointed. To make my case in favor of Scheme more understandable I
would like to outline what is my agenda regarding Scheme.  We are designing and
implementing simulation software to study wireless cellular networks. It is
heavy number crunching. Therefore, the core of the simulator is programmed in
C++ for efficiency. But simulator does not live all by itself. It needs some
input data and it spits out lots of output. Thus, there is a need for a
scripting language for pre/post processing of data.  Also one would like to use
the simulator to quickly try out some new ideas and concepts. Therefore, it is
beneficiary to have an embedded extension language which allows an engineer to
play with cool stuff.

Here is my arguments for Scheme:
* nice, exact and concise advocacy found in your message goes here!
* simple, yet powerful and well designed language
* interpreted version is suitable for scripting 
* can be relatively easy embedded in another application
* relatively flat learning curve for doing simple things 

Here is my personal and might be arguable observation: Perl code does not scale
well when it comes to maintainability. It is very simple to write little Perl
scripts but then the complexity builds exponentially with the number of lines in
your Perl program. I am currently still have to use Perl but I am really looking
forward to drop it down.

Another aspect: I think that because of its better design one can extend and
hand-tailor Scheme easier than Perl (not to mention Tcl).

    MF> The same aesthetic and engineering sense leads me to design decisions
    MF> in MzScheme that don't match the Unix way of doing things. Unix's
    MF> stream model is great in abstract, but the details are complex. It's
    MF> taken me *years* to really understand how things are supposed to work,
    MF> and I still find it difficult to write (and understand!) truly general
    MF> Unix I/O code. The key problem, I think, is that basic stream model has
    MF> been augmented in many ad hoc ways (for non-blocking I/O, movable
    MF> stream positions, etc.).

We as People cannot isolate ourselves from our Society no matter how much we are
dissatisfied with it. The same is applicable to Programming Languages and
Operating Systems. Like it or not but a Programming Language cannot abstract
itself away from the Operation System it is running upon unless it implements an
OS in itself:-)

    MF> Using lseek on stdout? That sounds pretty strange. Actually, it seems
    MF> like a good example of where the Unix I/O model breaks down: many
    MF> strange things are possible since *some* streams have movable positions
    MF> tacked onto them.

No it doesn't sound strange. You should not think of stdout as always being tied
to a TTY.  Being seekable is a run-time property of a file descriptor. If file
descriptor 1 (stdout) is connected to a regular file it is seekable, if to a
pipe or a TTY it is not seekable. There are several practical situations when
you would like to reposition your output stream. For example, when you write a
sparse binary database file or a sparse hash table. It will be a disaster if I
would try to use read/write copy-stream on several sparse files of about 500MB
in size each.

    MF> To repeat the non-rant part of my message: I agree that it would be
    MF> great to have an extension that lets you do everything that is possible
    MF> in Unix. I'm very much in favor of a Scsh port, or other efforts in
    MF> that direction. I think that's what you're talking about, and we're
    MF> with you!
    MF> Matthew

I perfectly understand that Unix is far from being good (less so perfect). But
in today's situation people in the Unix/Linux community are mentally more
receptive to new ideas and approaches than the folks from WinNT or Mac land
(please, do not flame me:-).  IMHO one has better chances to recrute Scheme
followers in the Unix/Linux camp than in other OS domains.  What do you think?

thanks,
-- Leo

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  Leonid Razoumov,               +  E-mail: lrazoumov@qualcomm.com   +
+  Qualcomm Inc.,                 +  http://www.qualcomm.com          +
+  5775 Morehouse Drive,          +                                   +
+  San Diego, CA 92121-1714,      +  VOICE:  +1-858/651-5163          +
+        USA                      +    FAX:  +1-858/658-2113          +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++