Re: JavaScript for automations: bug or correct behavior
Re: JavaScript for automations: bug or correct behavior
- Subject: Re: JavaScript for automations: bug or correct behavior
- From: has <email@hidden>
- Date: Tue, 03 Feb 2015 11:25:10 +0000
Deivy Petrescu wrote:
> I understand what is going on on both cases, my point is, for
someone like me who does things compartmentalized, AS is AS and JS
is JS.
Your understanding is broken. There are _three_ separate
technologies at work here:
1. the AppleScript language
2. the _javascript_ language
3. the Apple event Inter-Process Communication system.
AppleScript's original designers tried to disguise the joins between
#1 and #3 to make it simpler for users to understand and use. While
well-intentioned, this has caused no end of confusion and
misconceptions amongst its users: I can count on my fingers the
number of AppleScript users who *truly* understand how these
technologies work, and still have fingers to spare. Ironically, the
worst affected are experienced programmers[1], who are fooled into
thinking #3 is OOP (which it isn't), so end up totally frustrated
and furious when it behaves in ways that contradict those beliefs.
BTW, given that this arrogant, parochial strategy of intentionally
lying to users has been attempted multiple times over the years and
has failed _every single time_, perhaps you could ask Chris and
David why they've chosen to repeat it yet again in JXA, instead of
being honest with their users and just telling them the truth?
> When I write an AppleScript script, I do it with AS in my mind,
while I translate to JSA and it would be great to clear the quirks
out of the way from the get go.
There are no "quirks". There is an inherent mismatch between Apple
event semantics and AS/JS semantics. Once users correctly understand
how each technology works, it is trivial for them to understand and
deal with those mismatches themselves. The result is users who truly
understand and appreciate the technology and can use it at its best
when given an AE bridge that can actually talk Apple events
correctly. Appscript proved in real-world field use that this
strategy works, so again perhaps you can ask Chris and David why
they ignored that work and instead doubled down on an approach
that's already known to fail?
One more thing: 99% of "How do I translate AS to JS?" questions are
instantly, automatically, answered when you have 1. an AE bridge
that correctly supports AE semantics, and 2. an event log that can
display outgoing Apple events in either syntax [2]. I strongly
recommended this enhancement to Sal and was completely ignored, but
feel free to request it yourself. (Just don't expect too much from
it, since half the stuff you can do in AS can't translate
correctly/at all to JXA.)
Regards,
has
[1] Non-programmers find AppleScript easier to learn simply because
they come to it without any preconceptions, so accept it on its own
terms instead of trying to shoehorn it into their existing
knowledge. Thus while they may not truly understand it, they don't
actively *misunderstand* it.
[2] ASTranslate was just a quick-n-dirty hack, and appscript users
absolutely *adored* it - it was the single most useful tool I ever
did. It would be trivial for SE to provide separate Language menus
for both editor and result/log panes, allowing users to run an AS
script and display its outgoing events and result value in JS
syntax.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden