News for hackers. Stuff that matters.

ngnk

Re:J for C Programmers on Thursday June 04, 2020 @02:15PM (#23419895)
Re:ngn/k, an AGPL K interpreter on Monday January 13, 2020 @02:32AM (#22032561)
ktye says it compiles with msys2/mingw (msys2.org). i haven't tried it as i don't use windows at all.
Re:ngn/k, an AGPL K interpreter on Sunday January 12, 2020 @02:44AM (#22025072)
Re:ngn/k, an AGPL K interpreter on Sunday January 12, 2020 @12:14AM (#22024625)
ianal. to the best of my knowledge the project is clean from a legal perspective. ofc, you don't have to be doing something wrong to become a target of copyright trolling.
Re:ngn/k, an AGPL K interpreter on Saturday January 11, 2020 @03:12PM (#22021986)
1:x uses mmap, so it would return instantly no matter how large a file you give it

0:x uses 1:x and then it splits the content into lines. unfortunately splitting requires copying, so you'd be limited by the amount of ram (let's ignore "swap").

i don't use mmap for writing/amendment yet. i'll be working on it.

the way modern hardware works is like this: every process run by the os has its own view of the (typically 48-bit) address space. a process can request from the os that a part of that address space be "backed" by a certain file. this means that every time the process touches (i.e. tries to read or write) a virgin memory page there (usually page=4k, always aligned), the os will be automatically notified and will make sure to fill it in with actual content from the file, before the process even knows. from that point on, the page will occupy physical ram. if the os is low on memory later, it may decide to free up the page and return it to its previous state.

in effect, data from disk (or any disk-like storage) can be "streamed" while your program uses ordinary array indexing. the word "streaming" though implies reading from start to end in order (which is additionally sped up by prefetch, but that's a different story..); memory mapping is more general - it allows random access.

Re:ngn/k, an AGPL K interpreter on Saturday January 11, 2020 @12:03AM (#22018260)
reading is done with mmap. it returns instantly and then loads memory pages from disk only when you use them.
Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @07:21PM (#22017020)

    0:"path"                  /read  lines
    "path"0:("line1";"line2") /write lines
    1:"path"                  /read  bytes
    "path"1:"content"         /write bytes
Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @03:43PM (#22015320)
i can confirm, geocar's understanding of the code is correct
Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @03:17PM (#22014995)
the agpl is not so much about making concise code pleasant for the masses, as it is about making its freedom viral
Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @07:02AM (#22010376)
that's a good read, thanks. afaik zeroing %rbp here plays no role other than to assist debuggers. i'm not sure if alignment makes any measurable difference. if it does, it'll be worth doing. i jmp to main() because i wrote it and i know it never returns. it exit()-s.
Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @06:24AM (#22010219)
i'd encourage people to compile from source. the binary in "downloads" was compiled without the "-march=native" flag, in order to support older cpus, so it's a bit slower. also, i don't intend to update it regularly - i'll probably remove it in a couple of days.
Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @06:14AM (#22010170)
i changed it to "telemetry". i'm not really sure what to call it. they are upfront about it in the clickwrap eula but the data is not anonymized (see section 1.5a - in k ".z.u" means username) and you are not allowed to obstruct connectivity. it's not quite spyware either, as it happens with your consent.
Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @05:48AM (#22010059)
across architectures: you're right, as of now it's x86_64 only

across operating systems: it works on linux and freebsd as-is (thanks bakul), and with a few changes on windows+libc (thanks ktye) - https://github.com/ktye/i/tree/master/_/ngn though i personally never use windows

Re:ngn/k, an AGPL K interpreter on Friday January 10, 2020 @04:39AM (#22009715)
any ideas for a more compact and efficient way to get argc and argv on both linux and freebsd without bringing in libc?