10,780 karma · joined July 2, 2009
Submissions are not endorsements.
I haven't tried it yet, but I don't believe it would get very far since I haven't yet exposed ways to load Lua code from Lua modules (`dofile`, `load`, `require`, etc.). I've been building up my own test suite[1] while working through the reference manual[2]. I had never really used Lua before this, so it's been pretty interesting learning the language while implementing it.
> Do you have some benchmarks to compare the speed?
I've been using programs from the benchmarks game[3] and comparing them against regular Lua on my machine. On these programs, the overhead is usually somewhere around 2-3x. I believe that's mostly because these programs tend to be very mutation heavy. It's also possible that the way I'm compiling things down to Racket is defeating optimizations, but I haven't yet dug in.
If you're curious, you can get it to print the code it generates for any given module by setting the `RACKET_LUA_DEBUG` env var to `x` before running some code. Eg:
$ echo -e '#lang lua\nprint(1)' > test.lua
$ env RACKET_LUA_DEBUG=x racket test.lua
<<test.lua>>
'((#%provide #%chunk)
(#%define _ENV (#%global))
(#%load-stdlib! _ENV)
(#%define (#%lua-module . #%rest) (#%begin (#%begin (print 1)) (#%values)))
(#%define #%chunk (#%adjust (#%lua-module))))
1
> What is the problem with scientific notation? Racket can parse floating point numbers, including some weird cases [1], but I guess Lua has a slightly different set of weird cases.Yup. I just haven't gotten around to it. My goal this week has been to get it to a usable spot for embedding in my app and then iterate from there.
[1]: https://github.com/Bogdanp/racket-lua/tree/master/lua-test/l...
[2]: https://www.lua.org/manual/5.4/manual.html
[3]: https://benchmarksgame-team.pages.debian.net/benchmarksgame/
> Secretul scrisorilor, al telegramelor, al altor trimiteri poştale, al convorbirilor telefonice şi al celorlalte mijloace legale de comunicare este inviolabil.
> Secrecy of the letters, telegrams and other postal communications, of telephone conversations, and of any other legal means of communication is inviolable.
[1]: http://www.cdep.ro/pls/dic/site2015.page?den=act2_1&par1=2&i...
https://github.com/python/cpython/blob/4395ff1e6a18fb26c7a66...
isn’t exactly pure Python, because, under a different runtime (eg PyPy), the code would take a different path (the “pure Python” implementation of _count_elements[1] instead of the C implementation[2][3]). Yes, it's hard to draw exact lines when it comes to Python, especially as the language is so tied to its implementation. However, I think in this case it's relatively clear that the code that specific line is calling is an optimization in CPython, specifically intended to get around some of the VM overhead. Said optimization comes into play in the OP.
[1]: https://github.com/python/cpython/blob/4395ff1e6a18fb26c7a66...
[2]: https://github.com/python/cpython/blob/4395ff1e6a18fb26c7a66...
[3]: https://github.com/python/cpython/blob/4395ff1e6a18fb26c7a66...
* it’s a subclass of dict
* its update method (used by the code in the post) dispatches to a C implementation on its fast path
I would say the package story is more complicated in CL as a consumer of packages. As a package creator, they're similarly complex.
[1]: https://www.youtube.com/watch?v=wWj7OPvXGgA [2]: https://www.youtube.com/watch?v=7uGJJmjcxzY&t=495s
I agree it is slower than the fastest CL implementations, depending on what you test, because some of the features present in the language make optimizations harder. The compiler is definitely also slow. As far as dynamic languages go, however, Racket is very fast in general and you can push it very far.
> use in production was not its main focus.
What makes you say this/what do you think it's missing as far as "use in production" goes? Instrumentation? Something else? I've deployed both production web apps and desktop apps with Racket, and the experience has been as good or better than other languages I've deployed similar things in.
Racket has a nice runtime (much nicer than what you get with CL, though with some downsides (eg. memory usage is higher in Racket)), a large standard library, a comparable number of packages (~1800 on pkgs.racket-lang.org versus ~2100 on quicklisp), good editor support and a pretty great distribution story (via `raco exe`, `raco distribute` and the relatively-new `raco cross` for cross-compilation). All things that make it very practical in my book.
No, that item means Racket CS runs on platforms where native code generation isn't available via a portable bytecode backend.
[1]: https://docs.racket-lang.org/buid/index.html?q=buid#%28part....
Yes, there's an example of this in the section "Cross-compile Racket modules for iOS".
> Assuming that JIT is still not possible on iOS.
JIT on iOS is not possible for non-side-loaded apps, like you mentioned downthread. That's part of the caveats[1] I mention at the top of the article and the more complex part of the change: when compiling new code (eg. via `eval`), we flip the protection bits between W and X for the minimum set of memory segments necessary based on certain heuristics.
[1]: https://github.com/racket/racket/blob/351c0047d6371e36cf422b...
Yup! There’s an example of just that at the very end.
(response/xexpr #:code 404 '(h1 "Not Found"))This article might help: https://defn.io/2020/02/12/racket-web-server-guide/
I have to say, though, this looks uncannily like my own app, Remember, that I launched a few months ago:
* https://apps.apple.com/ro/app/remember-quick-reminders/id149...
* https://github.com/bogdanp/remember
Right down to the key bindings and some of the marketing copy[1].
EDIT to clarify: what makes me uncomfortable about this is not the broad range of salaries. I don't find that surprising at all. It's gathering all this information together and associating it with people's names (and complete bios!) that bothers me. Some of them may find they want to delete those tweets later.
If you log into your gumroad account and go to gum.co/rememberapp you should have the option to "purchase again" under the download button.
Thanks! I wrote the core in Racket to make it easy to port the app to other platforms and because I'm a lot more productive when writing Racket code.
> One feature a user might want is an overview of stashed notes.
You can actually see your stashed entries by pressing the up/down arrows or ctrl+n :D
Pre-built versions are available (for pay-what-you want (including $0)) on Gumroad[1].
[0]: https://docs.racket-lang.org/ts-guide/optimization.html