libera/#commonlisp - IRC Chatlog
Search
19:31:11
nij-
Are there any project that lets us to call a JS engine from CL? Something like py4cl (but py->js).
19:31:40
nij-
I'm not asking for a transpiler, but rather I want the CL runtime and the JS runtime (browser?) to interact with each other.
19:35:23
pjb
nij-: if the CL runtime can run on the server, then the usual tools, like WebSockets, or AJAX, etc.
21:06:40
nij-
contrapunctus But I'd like to hack website that's made and running in my browser already.
21:08:27
dbotton
nij you can hack existing sites with CLOG - you just add boot.js and have full access CLOG style to the page
21:10:28
contrapunctus
nij-: there's also Reblocks (fork of Weblocks), which IIUC has the same aims and architecture as CLOG - https://40ants.com/reblocks/
21:14:37
dbotton
nij if you look at the source of any .clog file you produce with builder there is a working example of attaching to html - you design the builder page and html is output as a single block when you show a panel, then the generated code attaches to the existing html
21:15:36
dbotton
the basic idea for an existing html page, is that you use attach-as-child and pass it the html-id and now you can set events, manipulate the element etc
21:17:23
dbotton
nij, went back to your previous lines of conversation, CLOG is exacgly what you are talking about
21:18:09
nij-
I think so. Heard of great words about it several times. And today is when it really hit me. Thanks :)
21:18:11
dbotton
CLOG works but using websockets (well for "webpages' it also uses html so can be googled)
21:20:28
dbotton
but html5 provides a way to establish a live connection to a server called websockets
21:29:53
nij-
dbotton That also means I can setup a keybinding in my fav browser, which injects boot.js.. and I can hack whatever webpage on the fly...... in common lisp...... I'm dead.
21:48:36
nij-
"Security restrictions will not allow websockets from different domain" what do you mean by this? Who is the one that disallows?
21:56:29
nij-
And, usually, it's the browser who owns the websocket server? And that's why if my browser is hackable enough, there's a chance of workaronud?
22:38:03
nij-
dbotton WOOOW I went through all the tutorials! It's truly amazing <3 Thanks for making my day!
22:38:51
nij-
Two questions! (1) After I run (open-browser), the repl doesn't return until I close the browser. How then can I change the lisp code on the fly, and see it changes in the browser? (Or is that impossible?)
22:40:07
nij-
(2) Suppose I've written a website with CLOG, with an expensive lisp backend, and I want to compile the lisp code.. how would I ship my website as a whole? Do my users need to have a lisp installed in their computer?
22:40:11
dbotton
if that is case though don't run open browser, instead just point your browser to the server http://127.0.0.1:8080
22:41:00
nij-
It did open the browser, and I can interact with the browser. The reason I asked (1) is that CL is great in interactive development. So I wonder if I can interact with the browser from the repl too.
22:41:02
dbotton
this would create a stand alone application - (ql:quickload :clog/tools) (sb-ext:save-lisp-and-die #P"./builder" :toplevel (lambda () (clog-tools:clog-builder)(loop (sleep 10))) :executable t :compression t)
22:41:44
dbotton
you would still need to provide (if you use) your www directory with any resources you need to provide
22:43:06
dbotton
So no you don't have to deliver your source, and they don't have to install sbcl or ecl
22:43:47
nij-
For (1) still, suppose I want to change the def of #'on-new-window on the fly in the lisp repl, and see the browser updates on the fly too. Is it possible?
22:44:20
nij-
(2) But it also means when the user loaded the page, it's going to download a binary that's >40MB :D :D!
22:44:33
dbotton
so 1 - use instead 'on-new-window not #' so this way it looks up each browser refresh
22:46:03
dbotton
also if the place you update is the on-new-window handler you need to refresh your browser, however other parts of the system, you would just need to recompile and say click again
22:48:11
dbotton
and there are techniques to get tighter smaller binaries, if speed less of an issue, ecl creates much smaller binaries
22:50:15
dbotton
not sure understand 2 part you wrote, going to download - normally no user would download your lips code on browsing your content
0:01:35
nij-
Has anyone used this C->CL compiler? Written in its doc is "C memory is backed by regular Common Lisp arrays." .. I wonder if this lowers the performance of the C code?
0:23:19
dbotton
nij- I plan on trying it out at some point to offer the ability (for marketing purposes) to add events in the builder in C :)
0:24:23
dbotton
You can already add events in JS by using (js-execute target "") in the buidler, and plan also on playing with Python and maybe Basic
0:34:10
nij-
But, in theory.. should that kind of C compiler slower than native C? I mean, Lisp array is a kind of abstraction already.. I'd be surprised if the performance'd be similar.
0:37:35
White_Flame
casting contents of a byte array into longer ints & floats in standard CL would be slow
0:38:48
White_Flame
also, you'd need bounds checking on all the time for every "memory" access, unless you're willing to crash or you run a 32-bit C with 4GB allocated
2:10:08
White_Flame
nij-: the original question about what performance might mean if backed with a big numeric array for the memory space
2:10:56
White_Flame
ah, it explains that it has sizeof 1 for everything, so it's probably an array of type T
2:11:48
White_Flame
but still, having to bounds check accesses to the memory will add a very fundamental overhead compared to C