Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 17 15:37
    ishehadeh commented #912
  • Jan 16 21:41
    andrewchambers commented #912
  • Jan 16 21:39
    andrewchambers commented #912
  • Jan 16 20:09
    ishehadeh commented #912
  • Jan 16 03:28
    andrewchambers commented #912
  • Jan 16 03:27
    andrewchambers commented #912
  • Jan 16 03:26
    andrewchambers commented #912
  • Jan 16 03:25
    andrewchambers commented #912
  • Jan 16 03:24
    andrewchambers commented #912
  • Jan 16 03:24
    andrewchambers commented #912
  • Jan 15 23:38
    eko234 commented #912
  • Jan 15 22:32
    bakpakin commented #912
  • Jan 15 20:12
    ishehadeh opened #912
  • Jan 14 23:14
    bakpakin closed #889
  • Jan 14 21:15
    sogaiu commented #911
  • Jan 14 18:14
    pyrmont edited #911
  • Jan 14 18:13
    pyrmont opened #911
  • Jan 14 18:06
    pyrmont commented #889
  • Jan 14 15:16
    elimisteve commented #898
  • Jan 14 14:16
    sogaiu commented #898
ahungry
@ahungry:matrix.org
[m]
Janet in docker is a nice sandbox, perhaps easier to setup than a chroot for web janet and so small via alpine
Janet cross platform is fun but tricky
andrewchambers
@andrewchambers
i uninstalled docker after i started doing backups and seeing all the shit it does pointlessly every second to my filesystem, even when idle. Not a fan haha.
I liked rocket a lot more, too bad it died
sogaiu
@sogaiu:matrix.org
[m]
isn't there a docker replacement from redhat that can handle docker files?
andrewchambers
@andrewchambers
theres podman, probably some other things
sogaiu
@sogaiu:matrix.org
[m]
podman or something
lol
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
Yes… k8s too has moved off docker proper isn’t it? The thing that makes it all go is containerd, and docker is just one rather clunky way of constructing images for containerd to run. That’s my extremely poorly informed understanding
Never thought I'd be reading the best blog/history of containers I've seen yet on a banking website
saikyun
@saikyun
Is there a way to replace c functions while running Janet?
Eg if I have a function pointer, recompile some c code, and somehow replace the content of that pointer
Using dlload or something like that
andrewchambers
@andrewchambers
you can make a new module and import it
at a different path i guess
janet doesn't currently let you unload modules
you could also use something like my tcc bindings to make a C function that is an asbtract type
this can be garbage collected
so you can swap it out i guess
saikyun
@saikyun
The second one sounds interesting. How would I do that? :D
to be concrete, I have a callback function that I give to miniaudio (used by raylib) in order to generate sound. What I would like to do is to switch out the contents of that function, and I figured the easiest way would be to have it call a function pointer, and I'd change out that function pointer somehow
andrewchambers
@andrewchambers
i dunno, this package is just a prototype
if you've done some C stuff before extracting and casting C function pointers is not that hard
but im sure the libtcc api would let you do some other stuff too
saikyun
@saikyun
I have done it, but I've forgotten most, haha
Okay, thanks
andrewchambers
@andrewchambers
i've seen some other stuff around regarding hot reloading C code
maybe google that a bit haha
saikyun
@saikyun
I'll do that :) thanks for the feedback
saikyun
@saikyun
Is there a way to expose c struct fields for modifications? Eg change a float
andrewchambers
@andrewchambers
not sure what you mean
if you have an instance of a C struct in memory somewhere you likely can access it using a c function
saikyun
@saikyun
right, I was just thinking if there was ways to access it without having to create c functions for it
I just to seem to remember that one is able to do something like (:field struct) somehow, but I might be misremembering
ie make the structs less opaque
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
Abstract types do expose fields like that (for instance you can call pairs to view the available methods on one) but I wouldn’t necessarily extend that metaphor to anything with a native implementation
MikeBeller
@MikeBeller
Why do some releases of Janet not have full sets of assets associated with them? Specifically 1.15.1 and 1.16.1 only have single zip/gzip files. I ask because Janet playground "update" mechanism downloads janet.c and janet.h from the link https://github.com/janet-lang/janet/releases/vXXXX/janet.[ch] -- but it doesn't exist for 1.16.1 (or 1.15.1 for that matter).
saikyun
@saikyun
@subsetpark what constitutes an abstract type? And is this documented somewhere? :)
2 replies
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
As of right now, it's only possible to create new abstract types from the C layer; but there's a kind of "middle layer" of Janet built-ins that are neither native data types (eg :number, :string) but are still implemented in C and can't be trivially reproduced at the Janet layer. Eg:
repl:9:> (def conn (net/listen "localhost" 100084))
<core/stream 0x56166ACCEBF0>
repl:10:> (abstract? conn)
true
But, because right now, abstract types are extremely opaque and basically an implementation detail, I don't think they're really documented.
(net/listen is actually a really good refutation of my previous example, as well, because if you call pairs or keys on a core/stream, it will block indefinitely)
saikyun
@saikyun
Hm, okay, so maybe it's not worth trying to create them myself?
Eric Shimizu Karbstein
@GrayJack
If you want to expose some external type to Janet, Abstract type is the way to go
saikyun
@saikyun
Okay, but how? :)
Are there any code examples of people having done this?
yumaikas-
@yumaikas:matrix.org
[m]
I mean, there's the Janet standard library, no?
Eric Shimizu Karbstein
@GrayJack
I think the simplest example is the Janet core library for the 64bit integers