Hi,
I'm playing with php and js as target languages and I must say it looks awesome. However, I'm wondering, is it possible to have REPL on target language: e.g. invoke gsi with '-target php', where Gambit will in runtime compile scheme code to php and run it in php interactive shell? Something like ClojureScript is doing with javascript.
Also, is there an way to write multiple lines of target language specific code, like is done with c-declare? I'm not able to find any target language primitives in manual...
Thanks, Sanel
Afficher les réponses par date
Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Marc
On Nov 2, 2015, at 4:34 AM, Sanel Zukan sanelz@gmail.com wrote:
Hi,
I'm playing with php and js as target languages and I must say it looks awesome. However, I'm wondering, is it possible to have REPL on target language: e.g. invoke gsi with '-target php', where Gambit will in runtime compile scheme code to php and run it in php interactive shell? Something like ClojureScript is doing with javascript.
Also, is there an way to write multiple lines of target language specific code, like is done with c-declare? I'm not able to find any target language primitives in manual...
Thanks, Sanel _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
2015-11-04 12:05 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca:
Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Someone could implement a REPL specific to the respective language and target environment.
Hm. Are there green threads?
Feature-full green threads (as in Gambit-C) are not currently supported by the universal backend, but they are on the TODO and definitely doable.
To get this moving faster, I’d need some help from people interested in specific targets of the universal backend. So if you are interested in JavaScript, PHP, Python, Ruby, Java please let me know.
Marc
On Nov 3, 2015, at 11:09 PM, Adam adam.mlmb@gmail.com wrote:
2015-11-04 12:05 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca: Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Someone could implement a REPL specific to the respective language and target environment.
Hm. Are there green threads?
Marc - I am not experienced with Gambit internals, but I am interested in using green threads in JavaScript and Python using the universal backend. Let me know what I can do to help. Thanks,Bob
On Wednesday, November 4, 2015 10:30 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Feature-full green threads (as in Gambit-C) are not currently supported by the universal backend, but they are on the TODO and definitely doable.
To get this moving faster, I’d need some help from people interested in specific targets of the universal backend. So if you are interested in JavaScript, PHP, Python, Ruby, Java please let me know.
Marc
On Nov 3, 2015, at 11:09 PM, Adam adam.mlmb@gmail.com wrote:
2015-11-04 12:05 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca: Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Someone could implement a REPL specific to the respective language and target environment.
Hm. Are there green threads?
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Nice to hear you want to help! To be maximaly useful, asynchronous I/O has to be implemented so that threads waiting for I/O don’t block other threads.
So the first step is to figure out how to do asynchronous I/O in JavaScript and Python (and PHP, etc). For JavaScript this will be different in the browser, where the only async I/O really is through XMLHttpRequest, and server-side JavaScript, a.k.a. node.js .
Basically, for each source/sink of I/O, there needs to be an “open” method (for example, opening a file, or network connection, or pipe, etc). This has to return some handle to be passed to a “read”/“write” method with a buffer of bytes. These methods need to return the number of bytes actually transferred, if the I/O can be done right away, or some code (say -1) if it is necessary to try again later. A callback specified when the “open” method was called is called when the operation should be tried again.
Moreover, for implementing preemptive threads, there needs to be a way to set a heartbeat timer that calls a callback at regular intervals (1ms to 20ms range, configurable). For example, a wrapper around setTimeout could be used for client-side JS.
I could dig through the docs of Python and client-side and server-side JS to see what is available, but if you could look into this that would be helpful.
Marc
On Nov 9, 2015, at 2:11 PM, Bob Coleman bobcolem@yahoo.com wrote:
Marc -
I am not experienced with Gambit internals, but I am interested in using green threads in JavaScript and Python using the universal backend. Let me know what I can do to help.
Thanks, Bob
On Wednesday, November 4, 2015 10:30 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Feature-full green threads (as in Gambit-C) are not currently supported by the universal backend, but they are on the TODO and definitely doable.
To get this moving faster, I’d need some help from people interested in specific targets of the universal backend. So if you are interested in JavaScript, PHP, Python, Ruby, Java please let me know.
Marc
On Nov 3, 2015, at 11:09 PM, Adam adam.mlmb@gmail.com wrote:
2015-11-04 12:05 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca: Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Someone could implement a REPL specific to the respective language and target environment.
Hm. Are there green threads?
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
I've started using GopherJS, the compiler for Go to Javascript. The corresponding runtime supports Go's "goroutines" which are concurrent, semi-cooperative coroutines. This runtime could be a source of inspiration. There isn't timed pre-emption but in addition to certain blocking IO and "channel" operations, pre-emption will also occur after some number of non-inlined function calls.
On Mon, Nov 9, 2015 at 3:11 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Nice to hear you want to help! To be maximaly useful, asynchronous I/O has to be implemented so that threads waiting for I/O don’t block other threads.
So the first step is to figure out how to do asynchronous I/O in JavaScript and Python (and PHP, etc). For JavaScript this will be different in the browser, where the only async I/O really is through XMLHttpRequest, and server-side JavaScript, a.k.a. node.js .
Basically, for each source/sink of I/O, there needs to be an “open” method (for example, opening a file, or network connection, or pipe, etc). This has to return some handle to be passed to a “read”/“write” method with a buffer of bytes. These methods need to return the number of bytes actually transferred, if the I/O can be done right away, or some code (say -1) if it is necessary to try again later. A callback specified when the “open” method was called is called when the operation should be tried again.
Moreover, for implementing preemptive threads, there needs to be a way to set a heartbeat timer that calls a callback at regular intervals (1ms to 20ms range, configurable). For example, a wrapper around setTimeout could be used for client-side JS.
I could dig through the docs of Python and client-side and server-side JS to see what is available, but if you could look into this that would be helpful.
Marc
On Nov 9, 2015, at 2:11 PM, Bob Coleman bobcolem@yahoo.com wrote:
Marc -
I am not experienced with Gambit internals, but I am interested in using green threads in JavaScript and Python using the universal backend. Let me know what I can do to help.
Thanks, Bob
On Wednesday, November 4, 2015 10:30 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Feature-full green threads (as in Gambit-C) are not currently supported by the universal backend, but they are on the TODO and definitely doable.
To get this moving faster, I’d need some help from people interested in specific targets of the universal backend. So if you are interested in JavaScript, PHP, Python, Ruby, Java please let me know.
Marc
On Nov 3, 2015, at 11:09 PM, Adam adam.mlmb@gmail.com wrote:
2015-11-04 12:05 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca: Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Someone could implement a REPL specific to the respective language and target environment.
Hm. Are there green threads?
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
GopherJS looks very interesting. Sounds like they've already implemented just the type of threading system we're looking for. I'll see if we could use a similar approach.
On Monday, November 9, 2015 5:45 PM, Patrick Logan patrickdlogan@gmail.com wrote:
I've started using GopherJS, the compiler for Go to Javascript. The corresponding runtime supports Go's "goroutines" which are concurrent, semi-cooperative coroutines. This runtime could be a source of inspiration. There isn't timed pre-emption but in addition to certain blocking IO and "channel" operations, pre-emption will also occur after some number of non-inlined function calls.
On Mon, Nov 9, 2015 at 3:11 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Nice to hear you want to help! To be maximaly useful, asynchronous I/O has to be implemented so that threads waiting for I/O don’t block other threads.
So the first step is to figure out how to do asynchronous I/O in JavaScript and Python (and PHP, etc). For JavaScript this will be different in the browser, where the only async I/O really is through XMLHttpRequest, and server-side JavaScript, a.k.a. node.js .
Basically, for each source/sink of I/O, there needs to be an “open” method (for example, opening a file, or network connection, or pipe, etc). This has to return some handle to be passed to a “read”/“write” method with a buffer of bytes. These methods need to return the number of bytes actually transferred, if the I/O can be done right away, or some code (say -1) if it is necessary to try again later. A callback specified when the “open” method was called is called when the operation should be tried again.
Moreover, for implementing preemptive threads, there needs to be a way to set a heartbeat timer that calls a callback at regular intervals (1ms to 20ms range, configurable). For example, a wrapper around setTimeout could be used for client-side JS.
I could dig through the docs of Python and client-side and server-side JS to see what is available, but if you could look into this that would be helpful.
Marc
On Nov 9, 2015, at 2:11 PM, Bob Coleman bobcolem@yahoo.com wrote:
Marc -
I am not experienced with Gambit internals, but I am interested in using green threads in JavaScript and Python using the universal backend. Let me know what I can do to help.
Thanks, Bob
On Wednesday, November 4, 2015 10:30 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Feature-full green threads (as in Gambit-C) are not currently supported by the universal backend, but they are on the TODO and definitely doable.
To get this moving faster, I’d need some help from people interested in specific targets of the universal backend. So if you are interested in JavaScript, PHP, Python, Ruby, Java please let me know.
Marc
On Nov 3, 2015, at 11:09 PM, Adam adam.mlmb@gmail.com wrote:
2015-11-04 12:05 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca: Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Someone could implement a REPL specific to the respective language and target environment.
Hm. Are there green threads?
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
I'll first lay out a sample of this in Python 2.7, since that's what I'm most familiar with. I think we'll be able to use the built in asyncore or select modules to handle sockets, but I don't believe asynchronous file I/O is supported on Windows (posix only) without an extension. I will look into this deeper and see if I can find a work around.
On Monday, November 9, 2015 3:14 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Nice to hear you want to help! To be maximaly useful, asynchronous I/O has to be implemented so that threads waiting for I/O don’t block other threads.
So the first step is to figure out how to do asynchronous I/O in JavaScript and Python (and PHP, etc). For JavaScript this will be different in the browser, where the only async I/O really is through XMLHttpRequest, and server-side JavaScript, a.k.a. node.js .
Basically, for each source/sink of I/O, there needs to be an “open” method (for example, opening a file, or network connection, or pipe, etc). This has to return some handle to be passed to a “read”/“write” method with a buffer of bytes. These methods need to return the number of bytes actually transferred, if the I/O can be done right away, or some code (say -1) if it is necessary to try again later. A callback specified when the “open” method was called is called when the operation should be tried again.
Moreover, for implementing preemptive threads, there needs to be a way to set a heartbeat timer that calls a callback at regular intervals (1ms to 20ms range, configurable). For example, a wrapper around setTimeout could be used for client-side JS.
I could dig through the docs of Python and client-side and server-side JS to see what is available, but if you could look into this that would be helpful.
Marc
On Nov 9, 2015, at 2:11 PM, Bob Coleman bobcolem@yahoo.com wrote:
Marc -
I am not experienced with Gambit internals, but I am interested in using green threads in JavaScript and Python using the universal backend. Let me know what I can do to help.
Thanks, Bob
On Wednesday, November 4, 2015 10:30 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
Feature-full green threads (as in Gambit-C) are not currently supported by the universal backend, but they are on the TODO and definitely doable.
To get this moving faster, I’d need some help from people interested in specific targets of the universal backend. So if you are interested in JavaScript, PHP, Python, Ruby, Java please let me know.
Marc
On Nov 3, 2015, at 11:09 PM, Adam adam.mlmb@gmail.com wrote:
2015-11-04 12:05 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca: Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');”)
or
(##inline-host-statement "print(@1@);" "hello")
Someone could implement a REPL specific to the respective language and target environment.
Hm. Are there green threads?
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Thanks!
Best, Sanel
Marc Feeley feeley@iro.umontreal.ca writes:
Eval is implemented, but I/O is currently very limited (only println is usable). So the REPL does not currently work.
For your second question, you can use
(##inline-host-declaration "print('hello');â)
or
(##inline-host-statement "print(@1@);" "hello")
Marc
On Nov 2, 2015, at 4:34 AM, Sanel Zukan sanelz@gmail.com wrote:
Hi,
I'm playing with php and js as target languages and I must say it looks awesome. However, I'm wondering, is it possible to have REPL on target language: e.g. invoke gsi with '-target php', where Gambit will in runtime compile scheme code to php and run it in php interactive shell? Something like ClojureScript is doing with javascript.
Also, is there an way to write multiple lines of target language specific code, like is done with c-declare? I'm not able to find any target language primitives in manual...
Thanks, Sanel _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list