HyperCard Mailing List

[HC] XTalk -> JavaScript converter
(Msg 1 of 23)
D <dannygelder@[redacted].com>
Tuesday, 02-Apr-2013 23:07 GMT
Hi everyone,

I made a few improvements to that project I've been working on. As before, it's like a colorizing script editor for xTalk. It reads the script you type and converts it into JavaScript. As always, it's just a web page with no dependencies on anything else, so if you want to play with it when you're not connected to the Internet, just Save As in your browser.

http://thirdhandapp.com/xtalk/

New improvements include a button called "Execute converted JavaScript now", support for repeat statements, much better coloring and error checking, and significant speed enhancement. It's also just a lot more smooth, and coded in a way that is much easier for me to update, so if you get the urge, you can post bits of xTalk you'd most like to be able to translate.

Have fun!

Dan
[HC] XTalk -> JavaScript converter
(Msg 2 of 23)
Eric Engle <eric.engle@[redacted].com>
Wednesday, 03-Apr-2013 04:46 GMT
wow! that's realy wonderful! thank you so much!!!

[Non-text portions of this message have been removed]
[HC] XTalk -> JavaScript converter
(Msg 3 of 23)
Eric Engle <eric.engle@[redacted].com>
Wednesday, 03-Apr-2013 10:21 GMT
"the number" does not seem to be implemented as in:
put the number of letters in thisIsAString

put as an assignment seems to work but put as a way to output to console does not seem to work.

the number is pretty important since it allows string manipulations (which imo hypertalk implements more nicely than javascript).

"find" is also not implemented.

"function" also does not seem to be implemented.

still - thank you!
--------


I made a few improvements to that project I've been working on. As
before, it's like a colorizing script editor for xTalk. It reads the
script you type and converts it into JavaScript. As always, it's just a
web page with no dependencies on anything else, so if you want to play
with it when you're not connected to the Internet, just Save As in your
browser.

http://thirdhandapp.com/xtalk/

New improvements include a button called "Execute converted JavaScript
now", support for repeat statements, much better coloring and error
checking, and significant speed enhancement. It's also just a lot more
smooth, and coded in a way that is much easier for me to update, so if
you get the urge, you can post bits of xTalk you'd most like to be able
to translate.

Have fun!

[Non-text portions of this message have been removed]
[HC] XTalk -> JavaScript converter
(Msg 4 of 23)
D <dannygelder@[redacted].com>
Wednesday, 03-Apr-2013 15:05 GMT


--- In HyperCard-Mailing-List, Eric Engle <eric.engle@...> wrote:
>
> "the number" does not seem to be implemented as in:
> put the number of letters in thisIsAString

the number of characters in <value>
the number of chars in <value>

Done.

> "function" also does not seem to be implemented.

on batsignal param, param2
answer param && param2
end batsignal

function identity hero
if hero is batman then return "bruce wayne"
end identity

batsignal "we need", the identity of "batman"

Done.

> put as an assignment seems to work but put as a way to output to console does not seem to work.

Well, there's no console.

> the number is pretty important since it allows string manipulations (which imo hypertalk implements more nicely than javascript).
>
> "find" is also not implemented.

Well, there's no fields. :-)


> still - thank you!
> --------
>
>
> I made a few improvements to that project I've been working on. As
> before, it's like a colorizing script editor for xTalk. It reads the
> script you type and converts it into JavaScript. As always, it's just a
> web page with no dependencies on anything else, so if you want to play
> with it when you're not connected to the Internet, just Save As in your
> browser.
>
> http://thirdhandapp.com/xtalk/
>
> New improvements include a button called "Execute converted JavaScript
> now", support for repeat statements, much better coloring and error
> checking, and significant speed enhancement. It's also just a lot more
> smooth, and coded in a way that is much easier for me to update, so if
> you get the urge, you can post bits of xTalk you'd most like to be able
> to translate.
>
> Have fun!
>
> [Non-text portions of this message have been removed]
>
[HC] XTalk -> JavaScript converter
(Msg 5 of 23)
richard g <Ambassador@[redacted].com>
Wednesday, 03-Apr-2013 15:33 GMT
Nice work, Danny.

How far you do intend to take the project, and under what terms will it be licensed?


--- In HyperCard-Mailing-List, "D" <dannygelder@...> wrote:
>
> Hi everyone,
>
> I made a few improvements to that project I've been working on. As before, it's like a colorizing script editor for xTalk. It reads the script you type and converts it into JavaScript. As always, it's just a web page with no dependencies on anything else, so if you want to play with it when you're not connected to the Internet, just Save As in your browser.
>
> http://thirdhandapp.com/xtalk/
>
> New improvements include a button called "Execute converted JavaScript now", support for repeat statements, much better coloring and error checking, and significant speed enhancement. It's also just a lot more smooth, and coded in a way that is much easier for me to update, so if you get the urge, you can post bits of xTalk you'd most like to be able to translate.
>
> Have fun!
>
> Dan
>
[HC] XTalk -> JavaScript converter
(Msg 6 of 23)
Eric Engle <eric.engle@[redacted].com>
Wednesday, 03-Apr-2013 18:29 GMT
repeat with i = j down to 1

?

:)

[Non-text portions of this message have been removed]
[HC] XTalk -> JavaScript converter
(Msg 7 of 23)
D <dannygelder@[redacted].com>
Wednesday, 03-Apr-2013 19:16 GMT
Done.

--- In HyperCard-Mailing-List, Eric Engle <eric.engle@...> wrote:
>
> repeat with i = j down to 1
>
> ?
>
> :)
>
> [Non-text portions of this message have been removed]
>
[HC] XTalk -> JavaScript converter
(Msg 8 of 23)
D <dannygelder@[redacted].com>
Wednesday, 03-Apr-2013 19:28 GMT


--- In HyperCard-Mailing-List, "richard g" <Ambassador@...> wrote:
>
> Nice work, Danny.
>
> How far you do intend to take the project, and under what terms will it be licensed?
>
>

In what sense can a web page even be licensed? If a page is up then the source code is there to look at; I can't hide anything. I think the courts have said we can't copyright a language so that's out. But all that aside, if you know what to look for, a thorough look at the page will show how good my own position is. Would you like me to add anything?

Dan

> --- In HyperCard-Mailing-List, "D" <dannygelder@> wrote:
> >
> > Hi everyone,
> >
> > I made a few improvements to that project I've been working on. As before, it's like a colorizing script editor for xTalk. It reads the script you type and converts it into JavaScript. As always, it's just a web page with no dependencies on anything else, so if you want to play with it when you're not connected to the Internet, just Save As in your browser.
> >
> > http://thirdhandapp.com/xtalk/
> >
> > New improvements include a button called "Execute converted JavaScript now", support for repeat statements, much better coloring and error checking, and significant speed enhancement. It's also just a lot more smooth, and coded in a way that is much easier for me to update, so if you get the urge, you can post bits of xTalk you'd most like to be able to translate.
> >
> > Have fun!
> >
> > Dan
> >
>
[HC] XTalk -> JavaScript converter
(Msg 9 of 23)
richard g <Ambassador@[redacted].com>
Wednesday, 03-Apr-2013 20:10 GMT


--- In HyperCard-Mailing-List, "D" <dannygelder@...> wrote:
>
> --- In HyperCard-Mailing-List, "richard g" <Ambassador@> wrote:
> >
> > Nice work, Danny.
> >
> > How far you do intend to take the project, and under what terms
> > will it be licensed?
> >
>
> In what sense can a web page even be licensed? If a page is up then
> the source code is there to look at; I can't hide anything. I think
> the courts have said we can't copyright a language so that's out.
> But all that aside, if you know what to look for, a thorough look
> at the page will show how good my own position is. Would you like
> me to add anything?

If you would like others to use your code, it may be helpful to add a notice defining the terms of use. Your note here almost sounds like you're placing it in the public domain, but I'm not sure.

As for implementation, do you intend to have it create and manipulate objects on the page?
[HC] XTalk -> JavaScript converter
(Msg 10 of 23)
D <dannygelder@[redacted].com>
Wednesday, 03-Apr-2013 22:02 GMT
Since I don't know what advantage I get from declaring or not declaring an answer to any of these questions -- I just won't. :)

Dan

--- In HyperCard-Mailing-List, "richard g" <Ambassador@...> wrote:
>
>
>
> --- In HyperCard-Mailing-List, "D" <dannygelder@> wrote:
> >
> > --- In HyperCard-Mailing-List, "richard g" <Ambassador@> wrote:
> > >
> > > Nice work, Danny.
> > >
> > > How far you do intend to take the project, and under what terms
> > > will it be licensed?
> > >
> >
> > In what sense can a web page even be licensed? If a page is up then
> > the source code is there to look at; I can't hide anything. I think
> > the courts have said we can't copyright a language so that's out.
> > But all that aside, if you know what to look for, a thorough look
> > at the page will show how good my own position is. Would you like
> > me to add anything?
>
> If you would like others to use your code, it may be helpful to add a notice defining the terms of use. Your note here almost sounds like you're placing it in the public domain, but I'm not sure.
>
> As for implementation, do you intend to have it create and manipulate objects on the page?
>
[HC] XTalk -> JavaScript converter
(Msg 11 of 23)
richard g <Ambassador@[redacted].com>
Wednesday, 03-Apr-2013 22:13 GMT
Well, that's one option. :)

As the creator of a work, you own it. True, because it's JavaScript it's possible for others to simply lift the code and use it anyway, but no earnest professional would do that without your permission.

So if you want others to use the code it'll be helpful to disclose the terms under which you would expect such use to take place.

But as the owner of the code, it's certainly within your rights to keep your intentions for such use to yourself if you prefer.



--- In HyperCard-Mailing-List, "D" <dannygelder@...> wrote:
>
> Since I don't know what advantage I get from declaring or not declaring an answer to any of these questions -- I just won't. :)
>
> Dan
>
> --- In HyperCard-Mailing-List, "richard g" <Ambassador@> wrote:
> >
> >
> >
> > --- In HyperCard-Mailing-List, "D" <dannygelder@> wrote:
> > >
> > > --- In HyperCard-Mailing-List, "richard g" <Ambassador@> wrote:
> > > >
> > > > Nice work, Danny.
> > > >
> > > > How far you do intend to take the project, and under what terms
> > > > will it be licensed?
> > > >
> > >
> > > In what sense can a web page even be licensed? If a page is up then
> > > the source code is there to look at; I can't hide anything. I think
> > > the courts have said we can't copyright a language so that's out.
> > > But all that aside, if you know what to look for, a thorough look
> > > at the page will show how good my own position is. Would you like
> > > me to add anything?
> >
> > If you would like others to use your code, it may be helpful to add a notice defining the terms of use. Your note here almost sounds like you're placing it in the public domain, but I'm not sure.
> >
> > As for implementation, do you intend to have it create and manipulate objects on the page?
> >
>
[HC] XTalk -> JavaScript converter
(Msg 12 of 23)
Tim Selander <selander@[redacted].jp>
Thursday, 04-Apr-2013 01:57 GMT
Hi Dan,

This is a really neat tool you've made! Thanks!

I do a lot of (psuedo) array type stuff with items in a text
string. This code
put "one, two, three, four, five" into vholder
repeat with x = 1 to 5
answer item x of vholder
end repeat

doesn't seem to work on your page. Is it because I'm trying to
get items out of the variable?

I don't have any current projects that I can use your tool on,
but it's so neat that I'm trying to think of one just so I can
use it!

Thanks,

Tim Selander
Tokyo, Japan

On 4/4/13 12:05 AM, D wrote:
>
>
> --- In HyperCard-Mailing-List
> <mailto:HyperCard%40yahoogroups.com>, Eric Engle <eric.engle@...>
> wrote:
> >
> > "the number" does not seem to be implemented as in:
> > put the number of letters in thisIsAString
>
> the number of characters in <value>
> the number of chars in <value>
>
> Done.
>
[HC] XTalk -> JavaScript converter
(Msg 13 of 23)
D <dannygelder@[redacted].com>
Thursday, 04-Apr-2013 03:10 GMT
Hi Tim,

item <expression> of <value>
item <expression> in <value>

Done.

--- In HyperCard-Mailing-List, Tim Selander <selander@...> wrote:
>
> Hi Dan,
>
> This is a really neat tool you've made! Thanks!
>
> I do a lot of (psuedo) array type stuff with items in a text
> string. This code
> put "one, two, three, four, five" into vholder
> repeat with x = 1 to 5
> answer item x of vholder
> end repeat
>
> doesn't seem to work on your page. Is it because I'm trying to
> get items out of the variable?
>
> I don't have any current projects that I can use your tool on,
> but it's so neat that I'm trying to think of one just so I can
> use it!
>
> Thanks,
>
> Tim Selander
> Tokyo, Japan
>
> On 4/4/13 12:05 AM, D wrote:
> >
> >
> > --- In HyperCard-Mailing-List
> > <mailto:HyperCard%40yahoogroups.com>, Eric Engle <eric.engle@>
> > wrote:
> > >
> > > "the number" does not seem to be implemented as in:
> > > put the number of letters in thisIsAString
> >
> > the number of characters in <value>
> > the number of chars in <value>
> >
> > Done.
> >
>
[HC] XTalk -> JavaScript converter
(Msg 14 of 23)
Tim Selander <selander@[redacted].jp>
Thursday, 04-Apr-2013 05:41 GMT
Very cool! Thanks!!


On 4/4/13 12:10 PM, D wrote:
> Hi Tim,
>
> item <expression> of <value>
> item <expression> in <value>
>
> Done.
>
> --- In HyperCard-Mailing-List
> <mailto:HyperCard%40yahoogroups.com>, Tim Selander <selander@...>
> wrote:
> >
> > Hi Dan,
> >
> > This is a really neat tool you've made! Thanks!
> >
> > I do a lot of (psuedo) array type stuff with items in a text
> > string. This code
> > put "one, two, three, four, five" into vholder
> > repeat with x = 1 to 5
> > answer item x of vholder
> > end repeat
> >
> > doesn't seem to work on your page. Is it because I'm trying to
> > get items out of the variable?
> >
> > I don't have any current projects that I can use your tool on,
> > but it's so neat that I'm trying to think of one just so I can
> > use it!
> >
> > Thanks,
> >
> > Tim Selander
> > Tokyo, Japan
> >
> > On 4/4/13 12:05 AM, D wrote:
> > >
> > >
> > > --- In HyperCard-Mailing-List
> <mailto:HyperCard%40yahoogroups.com>
> > > <mailto:HyperCard%40yahoogroups.com>, Eric Engle <eric.engle@>
> > > wrote:
> > > >
> > > > "the number" does not seem to be implemented as in:
> > > > put the number of letters in thisIsAString
> > >
> > > the number of characters in <value>
> > > the number of chars in <value>
> > >
> > > Done.
> > >
> >
>
>



[HC] XTalk -> JavaScript converter
(Msg 15 of 23)
Eric Engle <eric.engle@[redacted].com>
Thursday, 04-Apr-2013 06:47 GMT
Well... if you're taking requests =)

I don't think "down to" is implemented? E.g.

repeat with i = j down to 1
if character i of "thisisaliteralstring" = "i" then
delete character i of "thisisaliteralstring"
put "I" before character i of "thisisaliteralstring"
end repeat
put it

One of the things about hypertalk is that PUT is both an assignment operator (x=1;) _and an output function document.writeln('text');
It would be really nice if your script would use PUT as an output operator (as an alert? or to the status bar? or the address bar?)

[Non-text portions of this message have been removed]
[HC] XTalk -> JavaScript converter
(Msg 16 of 23)
D <dannygelder@[redacted].com>
Sunday, 07-Apr-2013 17:19 GMT
--- In HyperCard-Mailing-List, Eric Engle <eric.engle@...> wrote:
>
> Well... if you're taking requests =)
>
> I don't think "down to" is implemented? E.g.
>
> repeat with i = j down to 1

Done.

> One of the things about hypertalk is that PUT is both an assignment operator (x=1;) _and an output function document.writeln('text');
> It would be really nice if your script would use PUT as an output operator (as an alert? or to the status bar? or the address bar?)

Done.
[HC] XTalk -> JavaScript converter
(Msg 17 of 23)
Eric Engle <eric.engle@[redacted].com>
Sunday, 07-Apr-2013 21:09 GMT
thank you!
but...

put "Gelder" after "Danny "


i.e. "put ... after ..." does not seem to be implemented.
[HC] XTalk -> JavaScript converter
(Msg 18 of 23)
D <dannygelder@[redacted].com>
Monday, 08-Apr-2013 06:52 GMT
Obviously that is not legal syntax; you can't put into a constant string. But maybe there is a way to make that work. Let's say the final string built from the put statement always goes into the result, and the target is only set if it is a valid target. Then therefore:

put "Gelder" after "Danny "
answer the result -- shows "Danny Gelder"

put "Danny " into myName
put "Gelder" after myName
answer the result && myName -- shows "Danny Gelder Danny Gelder"

Extrapolating to other statements like "add":

add three to five
answer the result -- shows 8

put 3 into myVar
add five to myVar
answer the result && myVar -- shows "8 8"

Interesting, probably doable, and since JS is modern enough to use immutable strings, not slow. Huh.

--- In HyperCard-Mailing-List, Eric Engle <eric.engle@...> wrote:
>
> thank you!
> but...
>
> put "Gelder" after "Danny "
>
>
> i.e. "put ... after ..." does not seem to be implemented.
>
>
>
>
> ________________________________
> From: D <dannygelder@...>
> To: HyperCard-Mailing-List
> Sent: Sunday, April 7, 2013 7:19 PM
> Subject: [HC] Re: XTalk -> JavaScript converter
>
>
>  
> --- In HyperCard-Mailing-List, Eric Engle <eric.engle@> wrote:
> >
> > Well... if you're taking requests =)
> >
> > I don't think "down to" is implemented? E.g.
> >
> > repeat with i = j down to 1
>
> Done.
>
> > One of the things about hypertalk is that PUT is both an assignment operator (x=1;) _and an output function document.writeln('text');
> > It would be really nice if your script would use PUT as an output operator (as an alert? or to the status bar? or the address bar?)
>
> Done.
>
>
>
>
> [Non-text portions of this message have been removed]
>
[HC] XTalk -> JavaScript converter
(Msg 19 of 23)
Eric Engle <eric.engle@[redacted].com>
Monday, 08-Apr-2013 08:09 GMT
Was my xtalk syntax wrong?

put "danny" && "gelder" into yourName

yourname="danny" + " " + "gelder";


thing is... I don't know how to add that to your page.



________________________________
From: D <dannygelder@[redacted].com
To: HyperCard-Mailing-List
Sent: Monday, April 8, 2013 8:52 AM
Subject: [HC] Re: XTalk -> JavaScript converter


 
Obviously that is not legal syntax; you can't put into a constant string. But maybe there is a way to make that work. Let's say the final string built from the put statement always goes into the result, and the target is only set if it is a valid target. Then therefore:

put "Gelder" after "Danny "
answer the result -- shows "Danny Gelder"

put "Danny " into myName
put "Gelder" after myName
answer the result && myName -- shows "Danny Gelder Danny Gelder"

Extrapolating to other statements like "add":

add three to five
answer the result -- shows 8

put 3 into myVar
add five to myVar
answer the result && myVar -- shows "8 8"

Interesting, probably doable, and since JS is modern enough to use immutable strings, not slow. Huh.

--- In HyperCard-Mailing-List, Eric Engle <eric.engle@...> wrote:
>
> thank you!
> but...
>
> put "Gelder" after "Danny "
>
>
> i.e. "put ... after ..." does not seem to be implemented.
>
>
>
>
> ________________________________
> From: D <dannygelder@...>
> To: HyperCard-Mailing-List
> Sent: Sunday, April 7, 2013 7:19 PM
> Subject: [HC] Re: XTalk -> JavaScript converter
>
>
>  
> --- In HyperCard-Mailing-List, Eric Engle <eric.engle@> wrote:
> >
> > Well... if you're taking requests =)
> >
> > I don't think "down to" is implemented? E.g.
> >
> > repeat with i = j down to 1
>
> Done.
>
> > One of the things about hypertalk is that PUT is both an assignment operator (x=1;) _and an output function document.writeln('text');
> > It would be really nice if your script would use PUT as an output operator (as an alert? or to the status bar? or the address bar?)
>
> Done.
>
>
>
>
> [Non-text portions of this message have been removed]
>




[Non-text portions of this message have been removed]
[HC] XTalk -> JavaScript converter
(Msg 20 of 23)
Eric Engle <eric.engle@[redacted].com>
Monday, 08-Apr-2013 08:10 GMT
Oh! you have implemented concatenation!

:)
[HC] XTalk -> JavaScript converter
(Msg 21 of 23)
Eric Engle <eric.engle@[redacted].com>
Monday, 08-Apr-2013 12:01 GMT
It's really good! :) Thank you so much!


I wonder if it could


set the name of card button 1 to "D Gelder"
send mouseup to card button 1
set the title of this window to "Mr. Gelder's Famous Now!"

?


[Non-text portions of this message have been removed]
[HC] XTalk -> JavaScript converter
(Msg 22 of 23)
D <dannygelder@[redacted].com>
Tuesday, 09-Apr-2013 00:00 GMT
Unofficially, this will work:

on setWindowTitle newTitle
eval "document.title = newTitle_var;"
end setWindowTitle

ask "What is the new title?" with "Mr. Gelder's Famous Now!"
if the result then setWindowTitle the result

As you can see that is not the most intuitive thing, and you can expect it to stop working exactly that way at some point.

Dan


--- In HyperCard-Mailing-List, Eric Engle <eric.engle@...> wrote:
>
> It's really good! :) Thank you so much!
>
>
> I wonder if it could
>
>
> set the name of card button 1 to "D Gelder"
> send mouseup to card button 1
> set the title of this window to "Mr. Gelder's Famous Now!"
>
> ?
>
>
> [Non-text portions of this message have been removed]
>
[HC] XTalk -> JavaScript converter
(Msg 23 of 23)
D <dannygelder@[redacted].com>
Wednesday, 10-Apr-2013 01:05 GMT
Eric,

My previous answer I gave you bugged me for a while. Then I realized that translating xtalk into a javascript function that referenced the xtalk to change a javascript property was maybe a little too complicated for what I'm doing here, and found a solution that may not be simple but is definitely honest. Instead, you can just put javascript functions in the translator directly, and they will be dutifully translated into....exactly what you put in. So this is the best way to set the window title now:

-- sets the window title
function setWindowTitle(newTitle) { document.title = newTitle; }

-- testing it
ask "What is the new title?" with "Mr. Gelder's Famous Now!"
if the result is not empty then setWindowTitle the result

It's a little weird to mix the languages like that, but I am sure it is a better solution than making you translate anything yourself. After all that is what my page is supposed to do.

Here is another example of how useful this is (if you know Javascript):

-- implements the stalk function offset(text,source)
function offset(text, source) { return new String(source).indexOf(text) + 1; }

-- try it. works just like hyper talk!
answer offset("dan", "Mr. dan")

Have fun!
Dan
http://thirdhandapp.com/xtalk/

--- In HyperCard-Mailing-List, "D" <dannygelder@...> wrote:
>
> Unofficially, this will work:
>
> on setWindowTitle newTitle
> eval "document.title = newTitle_var;"
> end setWindowTitle
>
> ask "What is the new title?" with "Mr. Gelder's Famous Now!"
> if the result then setWindowTitle the result
>
> As you can see that is not the most intuitive thing, and you can expect it to stop working exactly that way at some point.
>
> Dan
>
>
> --- In HyperCard-Mailing-List, Eric Engle <eric.engle@> wrote:
> >
> > It's really good! :) Thank you so much!
> >
> >
> > I wonder if it could
> >
> >
> > set the name of card button 1 to "D Gelder"
> > send mouseup to card button 1
> > set the title of this window to "Mr. Gelder's Famous Now!"
> >
> > ?
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
HyperCard® and HyperTalk™ remain trademarks of Apple, Inc.; other trademarked products and terms mentioned in this archive are the property of their respective trademark holders. Individual messages remain the intellectual property of their respective authors.