From: Dominic Fandrey on
Ed Morton wrote:
> On Nov 10, 2:25 pm, Dominic Fandrey <kamik...(a)bsdforen.de> wrote:
>> Ed Morton wrote:
>>> On Nov 10, 11:10 am, Dominic Fandrey <kamik...(a)bsdforen.de> wrote:
>>>> I am working on a rather complex application and the cleaner
>>>> data structures safe enough computation time to outweigh the
>>>> considerable overhead caused by the framework.
>>> Maybe you're trying to do too much in shell if the design paradigm
>>> makes such a big difference!
>> No dependencies outside the base system. The one rule I must not
>> break.
>
> Doesn't creating an object-based middleware framework that has to be
> implemented on your base contradict that requirement? I mean, what's
> the difference between doing that and just installing Java or similar?
> ...

Do you really think using a 758 lines (19kB) shell script framework
is an act comparable to installing a JDK?

OpenJDK uses 124MB on my hard disk, that's more than 6500 times
the space required by my little framework.

> ... but at least they might know Java already, and
> there's probably already a version of Java that'll run on whatever
> your next "base" is other than freeBSD if it's portability you care
> about.

Sure I could write my scripts in Java. However no one would use them
if I did. Not even me.

Ah, I enjoy these pointless discussions.

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: Ed Morton on
On Nov 10, 5:27 pm, Dominic Fandrey <kamik...(a)bsdforen.de> wrote:
> Ed Morton wrote:
> > On Nov 10, 2:25 pm, Dominic Fandrey <kamik...(a)bsdforen.de> wrote:
> >> Ed Morton wrote:
> >>> On Nov 10, 11:10 am, Dominic Fandrey <kamik...(a)bsdforen.de> wrote:
> >>>> I am working on a rather complex application and the cleaner
> >>>> data structures safe enough computation time to outweigh the
> >>>> considerable overhead caused by the framework.
> >>> Maybe you're trying to do too much in shell if the design paradigm
> >>> makes such a big difference!
> >> No dependencies outside the base system. The one rule I must not
> >> break.
>
> > Doesn't creating an object-based middleware framework that has to be
> > implemented on your base contradict that requirement? I mean, what's
> > the difference between doing that and just installing Java or similar?
> > ...
>
> Do you really think using a 758 lines (19kB) shell script framework
> is an act comparable to installing a JDK?

No, I think you'd be significantly better off with the JDK.

> OpenJDK uses 124MB on my hard disk, that's more than 6500 times
> the space required by my little framework.
>
> > ... but at least they might know Java already, and
> > there's probably already a version of Java that'll run on whatever
> > your next "base" is other than freeBSD if it's portability you care
> > about.
>
> Sure I could write my scripts in Java. However no one would use them
> if I did. Not even me.
>
> Ah, I enjoy these pointless discussions.

Well, good luck with your enterprise anyway.

Regards,


>
> --
> A: Because it fouls the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing on usenet and in e-mail?- Hide quoted text -
>
> - Show quoted text -

From: Stachu 'Dozzie' K. on
On 10.11.2009, Dominic Fandrey wrote:
> Ed Morton wrote:
>> On Nov 10, 2:25 pm, Dominic Fandrey <kamik...(a)bsdforen.de> wrote:
>>> Ed Morton wrote:
>>>> On Nov 10, 11:10 am, Dominic Fandrey <kamik...(a)bsdforen.de> wrote:
>>>>> I am working on a rather complex application and the cleaner
>>>>> data structures safe enough computation time to outweigh the
>>>>> considerable overhead caused by the framework.
>>>> Maybe you're trying to do too much in shell if the design paradigm
>>>> makes such a big difference!
>>> No dependencies outside the base system. The one rule I must not
>>> break.
>>
>> Doesn't creating an object-based middleware framework that has to be
>> implemented on your base contradict that requirement? I mean, what's
>> the difference between doing that and just installing Java or similar?
>> ...
>
> Do you really think using a 758 lines (19kB) shell script framework
> is an act comparable to installing a JDK?
>
> OpenJDK uses 124MB on my hard disk, that's more than 6500 times
> the space required by my little framework.

But digging through your 20kB framework plus the rest of your code would
be much harder than reading Python or Ruby[*] scripts of the same size
(minus 20kB framework). And you gain the same execution speed as shell,
compared to Java. I think Ed just unnecessarily mentioned Java.

[*] I would suggest Perl, but you need to be really good Perl programmer
already to write readable and maintainable code in it.

--
Stanislaw Klekot
From: Dominic Fandrey on
Janis Papanagnou wrote:
> Dominic Fandrey wrote:
>> I have written a framework for object oriented shell scripting.
>> It doesn't provide type safety or inheritance or access control,
>> but it has classes, objects and some other nice features like
>> automatic creation of getters and setters or return by reference.
>
> I think the getter and setter is the most unimportant feature in an
> object based approach. And all the Real OO Features are missing?

To me inheritance and access control are only useful tools, not
necessary for the concept to work. Especially access control is
not required at all, it can completely be substituted with discipline.

Inheritance can be VERY useful, but often is not required at all.
Though it's not supported by my little framework, you can at least
reuse methods from other classes simply by creating an alias or
directly calling them as a static function. In that case, they
won't get their own stack layer, though and everything they return
by reference will not be returned to you, but to whomever called
your method.

> BTW, you may want to have a look into a newer ksh93 and its typeset
> builtin command with its options...

Those really sound like interesting options. ksh is not part of
the FreeBSD base system, can you name a system where it is? Do you
think it's possible to port Bourne Shell code or even write code
that works on both shells?

Or do those features make my framework entirely obsolete for
this shell?
From: Maxwell Lol on
Ed Morton <mortonspam(a)gmail.com> writes:

> And what newsgroup would it be where we respond to a comp.unix.shell
> post about someone creating an object-oriented language in shell and
> simply ask why they didn't just use an existing object-oriented
> language if they wanted to do OOP?

I think this is a fine newsgroup for the discussion.

Of course there's a big difference between inventing a new OO language
and inventing an object oriented language for interactive scripting,
especially if it can be mixed with POSIX shell commands.

A OO shell might be useful on the command line. If, for example, one
could pass objects between shell commands instead of text, and where
one can mix objects with text. Think of somelike like an object
oriented awk (which might be built into the shell):


grep -v 'DEBUG' <file | encapsulate oclass |\
ooawk '{ .func && .ip->print, .date->print}' |\
oosort .date| decapsulate | lpr


Where oclass is an object class definition that has
function func
date is a timestamp. perhaps from a log file
ip is an IP address field

Encapsulate(1) converts from text into OO format. Decapsulate does the
opposite. Perhaps these could be symbols instead of functions.

We just had a case where people wanted to sort by dotted IP addresses.
It should have it's specialized print function. And oosort would know
how to sort an IP address, a time stamp, etc.

I certainly don't want to use a language like Java for one- or
two-line shell scripts. Buf if I could mix POSIX shell with OO stuff,
that would be interesting.

AIR, others have tried OO shells. I admit I never looked into these
in detail, but google pointed me to:.

http://geophile.com/osh/
http://mediakey.dk/~cc/bash-shell-object-oriented/


You know, I often have to use perl or shell to parse log files. If
would be nice to have an object class that one can take any log file,
and convert a text file into a consistent data structure, thst a small
set of tools could operate one.