Re: Scripting Style (was: Re: Hiding Slaves)
Re: Scripting Style (was: Re: Hiding Slaves)
- Subject: Re: Scripting Style (was: Re: Hiding Slaves)
- From: has <email@hidden>
- Date: Thu, 19 Sep 2002 17:39:43 +0100
Arthur J. Knapp wrote:
>
> Being a thoroughly uncharitable and unkind sort, I'd tend to attribute it
>
> not to "taste" but to faddishness, cargo cult, cleverness for its own sake,
>
> deliberate obfuscation, L33Tness, etc. [1]
>
>
No, that isn't fair. (And please stop having interesting discussions over
>
the weekend when I can't participate). ;-)
Hey, if you don't wish to work weekends too then that's your own faute. ;)
>
> 'As string' is entirely unambiguous, dirt simple to read and understand.
>
>
"" & variable
>
>
is also entirely unambiguous, dirt simple to read and understand
There's a textbook way, and a second way. What does using the second way
infer, except that there's a reason for not using the textbook way?
(Unless you're in Perl, in which case it infers only that there's yet room
to add third, fourth and fifth ways of doing it as well?;)
>
One only has to learn [...] to both understand and to remember the empty
>
string "trick".
Hah! You said '"trick"'! Avast, ye scurvy knave, I have you know!
>
> That empty string concatenation is not (as Ken's post has just
>
> demonstrated). It's just bad programming. [2]
>
>
To me, it's learning how to use an operator with a deep understanding
>
of it's function, which is very good programming.
...as opposed to using the simplest tool for the job. Really, the whole
"I'll teach 'em this for their own damn good even if it kills them" schtick
is _my_ game, not yours, so hands off or else I'll bite your fingers.
>
set i to 3.14159
>
set j to " Hello"
>
set k to " World "
>
set l to boolean
>
>
-- i itself will cause the & operator to create a list
>
--
>
i & j & k & l --> {3.14159, " Hello", " World ", boolean}
>
>
-- We can use "as string", but this looks and "feels"
>
-- inefficient, as AppleScript is first creating a list:
>
--
>
(i & j & k & l) as string
<klik-klatch>BANG!!! If you do this, you _deserve_ shooting. [Newbies
everywhere, don't look at this man, he's showing you something very rude
that you should never ever do yourselves! "TIDs, Knapp, TIDs! Write on the
blackboard, 100 times, 'I shall always respect the TIDs.'"]
>
"" & i & j & j & l
(i as string) & j & j & l
Or:
(i as Unicode text) & j & j & l
for the bright young things amongst you.
Frankly, I'd much prefer some kind of concat() call: something that takes a
list of items and a type to cast to, and concatenating those items without
the user ever having to worry about the details. All this mucking about
with details we're doing here is, arguably, another flaw with the whole
"programming for the rest of us" thing that AS is meant to stand for. There
is _nothing_ intuitive or simple about the way AS concatenates items, and
the single-item-list silent coercion that booby-traps concats when the
first item is a number is itself a basic flaw in the language design imho.
>
Look, concatenation is the most simply and basic of all things
>
one can do in AppleScript. Intimately learning how the operator
>
works is an essential first step in moving from newbie to
>
mastery.
Actually, more a step moving from newbie to slightly less newbie, but I
digress. ;)
>
>> property u : ("" as Unicode text)
>
>>
>
>> set hidFolderPath to ((u & (path to scripts folder)) & ".hid")
>
>
> First person to do this, I kill just on General Principles.
>
>
Why? I'm not quite clear on what the General Principles are.
"Don't obfuscate. Particularly, don't obfuscate "tricks". Especially
particularly, don't obfuscate "tricks" when a perfectly good, standard
textbook form exists. Otherwise I kill you." Simple.:)
>
> [1] No doubt endearing myself even less to those folk who use it... But
>
> diplomacy never was my strong point...
>
>
Typically, I don't use it except for coercing multiple non-string items
>
together. As some have pointed out, there is the slightest speed to be
>
gained, (and I'm a sucker for speed),
This is such an invalid... nay, flawed... nay, dangerous argument, I'm not
even going to touch it here, preferring instead to direct a remote control
bomb-disposal robot to drive up to it and detonate it safely. Duck.
!!!!!!!!!KABOOOOM!!!!!!!!
Now PLEASE DON'T use it again.
>
no more difficult to learn, use, and remember than working with the text
>
item delimiters, considering/ignoring statements, etc.
WORST. LANGUAGE FEATURES. EVER.
'Nuff said.
has :p
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.