Re: hash arrays and other mysteries
Re: hash arrays and other mysteries
- Subject: Re: hash arrays and other mysteries
- From: "AppleScripter" <email@hidden>
- Date: Fri, 19 Oct 2001 14:38:47 -0500
I feel like I just gotta put my 4 ha'pennies in.
>
> But who wants to write:
>
>
>
> property [handler name] : [handler name] of (load script "Hard
Disk:System
>
> Folder:Scripts:ModFiles:[name of file]")
>
>
>
>
Not me.
>
Not me either. And frankly, I don't see any reason why we should until I
picked up my copy of Learning Cocoa and I realized that the underlying
structure is that everything is an object, each object receives certain
messages and sends certain messages to and from other objects (a system
which helps protect the objects from each others polymorphic and data
binding behaviors). Whew! (Did I get that right, Chris?) That doesn't
mean to say that my lament on the applemods mailing list that there isn't a
command like
initialize handlers from AppleMod "readIn"
is in any way ameliorated by understanding why it hasn't been like that in
the past. I want an include statement in AppleScript. Plain and simple
that would make modular scripting a boon to the entire community. I also
want hash arrays but I digress. There is no reason why we can't load
handlers with a simple include/import statement just as you can with
Objective-C. Won't soemone just write the damn osax that does that? I
would gladly pay for it.
>
Don't give in! I have found the Perl mods to be my greatest
temptation.
>
But I don't like writing Perl. I just decided to make my own mods for
>
AppleScript. maybe I'll let em run free once I feel they're ready. Maybe
on
>
Applemods
>
Applemods does have a great concept in creating a space for this type
of
>
effort. I think that the freeform nature of most scripter's coding and
lack
>
of any call-return standard is going to limit it's usefulness though.
>
If you have to open the handler and read it to understand what it
wants
>
and what it will give you back, then it won't grow properly. I don't know
>
about what others do, but when I get a handler from someone, I open it,
>
'fix' the variables to my style, read through the code trying to compile
it
>
in my head; and the take the whole thing apart and rebuild it. Now I can't
>
take that new code and feed it back into the system. All of the scripts
that
>
anyone has written that call that handler will break if they DL my new and
>
improved version. Re-coding every script that uses asciiSort() because
>
someone's new faster code wants different input or returns a record
instead
>
of a list ain't gonna happen.
Okay this is weird. Do you pick apart CGI.pm in Perl? If you do, you're
nuts. If you don't, then why would you in AppleScript? The whole idea of
mods is that you don't have to do that. Check out the docs at CPAN, that
kind of documentation and use is just what we should be providing with the
mods (and soon we will). You don't have to pull apart a Perl module to
figure out what it wants. Just use them and be done with it. (I get to this
point in a minute). If everyone is waiting for handlers to be given to them
so they can be rewritten again and again, then what's the point in sharing
anything in the first place other than, "Yes I can do x because I wrote a
handler to do it. You can too. Go code."
>
Now if there was a way to get everyone to agree on 'standard' input
and
>
output for handlers, we might even get the idea of mods for AppleScript
off
>
the ground.
>
Actually, for the scripters, there is no need to worry about a standard
input per se. As mod writers though we shoudl be aware of what gets passed
to us. And, as Serge has suggested, if we always return values of the same
type, like say a record, then when we make changes to the mod the scripter
will always know what comes out and that can scale or stay the same becaus
ewe are merely adding more labels to the output and not changing the
fundamental return of the handler. It's up to the mod writers not the
scripters as such. It's not so much about standards at that point, it's
about good coding practices and scalability internally.
>
BAHAHahahah! Well, I TRIED to say 'standard' with a straight face. We all
>
know that it isn't likely that everyone will use any standard even if some
>
people could agree on what that should be.
>
We all agree on standards all the time. And we all disagree on standards
all the time. It's a question of meeting a need. Frankly, I would love to
have the access to hundreds of handlers and script libraries like I do in
Perl, Python and countless other scripting languages available on the Mac
these days. But it comes down to you and me, Paul, and all the other
scripters who want to move beyond writing their own (perhaps) inefficient
handler for the "entire contents of" bug. That's where we shoudl be pulling
together to increase AppleScript's value and robustness.
That and include/import statements and hash arrays.
Greg Strange