Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    andrewchambers
    @andrewchambers
    andrewchambers
    @andrewchambers
    Woo
    now we can redirect into core/file
    andrewchambers
    @andrewchambers
    it's done
    andrewchambers
    @andrewchambers
    Another fun idea
    expand core/file instances on the command line to /dev/fd/N
    (that is why I was thinking about multimethods)
    so users can define how their own types get expanded into command line arguments
    pauldub
    @pauldub
    That would be a very nice feature
    andrewchambers
    @andrewchambers
    yeah, not too sure what other uses there are
    but there must be some good ones
    pauldub
    @pauldub
    It would be a nice interaction point between tools written in janet and the shell itself
    andrewchambers
    @andrewchambers
    One example I can think of is a bit like the nix package manager. A nix package is like table, but when expanded into a command line it becomes a path to the package
    the fd one is still the most useful, it lets you work around poorly written tools
    tool-with-only-file-args -f ($-pipe foo | sort | ... )
    Calvin Rose
    @bakpakin
    You could use prototypes on tables for that and add something like :sh-expand to any table
    andrewchambers
    @andrewchambers
    yeah
    I was thinking also for redirects
    foo > t
    and t can define how to get the file
    with the same mechanism
    @bakpakin basically the only feature I can't quite do in janetsh is exit traps
    but I think I have a work around
    something like (on-exit (fn [] ($ rm some-dir)))
    andrewchambers
    @andrewchambers
    I think an exit trap will need to be a forked janetsh that waits for a signal
    from the cleanup atexit handler before doing the action
    andrewchambers
    @andrewchambers
    the main problem being you can be told to exit from a SIGTERM
    and you can't reenter janet code from a signal handler
    but it is possible to send a coprocess a message to do something
    from C
    andrewchambers
    @andrewchambers
    andrewchambers
    @andrewchambers
    scaling back janet shell development a bit - gotta go back to day job
    andrewchambers
    @andrewchambers
    Heres a fun thing that works in latest janet shell:
     (let [[a b] (sh/pipes)
            [c d] (sh/pipes)]
        ($ janetsh > [b] < [c] &) ($ nc -l 9888 < [a] > [d]))
    I think an irc bot written in janet shell would be pretty small lol
    andrewchambers
    @andrewchambers
    Maybe that is an idea for the next blog post
    or gitter
    andrewchambers
    @andrewchambers
    Test of api
    Yeah, we can make a gitter bot in like 20 lines of code
    or less
    using janet shell and curl
    @bakpakin Dunno if there are any things useful for the main janet channel
    but you can literally curl a url to get a stream of messages, and another curl to post a message :D
    and it is just json
    andrewchambers
    @andrewchambers
    I can sense the power of janet coming to the front page again
    andrewchambers
    @andrewchambers
    some thoughts
    andrewchambers
    @andrewchambers
    @bakpakin yeah - I basically just came to the conclusion that issue isn't worth fixing
    apart from putting some documentation
    worse it better or w.e.
    :P