Re: String to multiple-item list coercion
Re: String to multiple-item list coercion
- Subject: Re: String to multiple-item list coercion
- From: has <email@hidden>
- Date: Thu, 26 Sep 2002 19:23:42 +0100
[going off-list because I'm sure everyone on digest is bored to death of it
by now]
>
On 26/9/02 9:28 PM, "has" <email@hidden> wrote:
>
>
> set {a, b, c, d, e} to "abcdefgh"
>
>
> Meanwhile:
>
>
>
> set {day:a, month:b, year:c} to date "Sunday, September 1, 2002
>
> 12:00:00am"
>
>
> If we follow Steven's original logic that a multiple assignment with list
>
> on left and string on right invokes an atypical item->list invisible
>
> coercion, then by extension there must be an invisible date->record
>
> coercion happening in my date example as well.
>
>
Non sequitur. I am not sure how you make that leap with your date-property,
>
multiple-assignment record example.
Maybe. However, drawing the comparison was not unreasonable. Different data
types on the left and right. Yet both have sufficient in common with each
other that the exchange of data is possible without any fancy behaviour.
>
It has nothing to do with the string
>
"coercion/multiple assignment" behaviour I originally mentioned.
>
But you won't even allow that your invisible coercion theory might be
>
wrong, so how can you hope to see any similarity?
>
Your date
>
example explicitly gets several properties of the date object (day, month,
>
year).
Well I'm glad we both agree on what's happening there.
And 'set [list] to [string]' is following the exact same principle as is
seen with the 'set [record] to [date]' example. The only difference is that
with list-string we have two ordered compound data types, so assignments
are made according to position; and with record-date both types are
unordered, thus assignments are made by label.
>
My string example was different; it queried no properties; it asked
>
for no elements.
*Yes it did*. It asked for item 1, item 2, item 3, item 4 and item 5 of the
object on the right side. And it got them, because the string data type
knows how to respond to such requests. How do you not see that? There is
nothing alien or bizarre in such behaviour: the notion that two different
classes may respond to the same message is nothing new - just pick up any
good book on OOD and read about polymorphism.
I honestly don't know any other way to explain that you're going to follow
if you can't follow this.
--
The only basis you have for saying that the multiple assignment shouldn't
work is what you said about 'item n of "string"' shouldn't work, because
it's not a documented feature and got slipped in at some point without
telling anyone. And that's it. Totally different debate.
--
>
Expecting my string example to get the results it does
>
means one should also expect:
>
>
set {a,b,c} to date "Sunday, September 1, 2002 12:00:00am"
>
return {a,b,c}
>
--> {"September", 1, 2002}
Pardon? Now _you're_ the one with the non-sequiteurs. An ordered type on
the left and an unordered one on the right - since when did anything I've
said ever suggest this would work?
--
>
I think you flatter us both by presuming anyone impressionable is bothering
>
to reading this thread.
Correct, and if either of us had any damn sense _we_ wouldn't be bothering
to read it either. :p
--
>
BTW: its not documented because its a bug; and the bug is that a string can
>
be coerced to a list of items.
No, the "bug", such as it is, is that the string type responds to 'item',
which is not documented. Take _that_ issue up with Apple if you want, but
really, I've had enough of this thread and it's obviously not going to go
anywhere useful.
Okay: a hundred bucks to you if you can get an AS engineer to state
truthfully, officially and and on the record that your explanation is the
correct one and mine is wrong. (And vice-versa if the error is yours.)
Otherwise let's please agree to drop the issue before we drive each other
to _total_ distraction...
Regards,
has
--
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.