leorize: Prestige: doesn't most C proc that write into a buffer gives you the amount it wrote afterwards? awr1: some do awr1: seems that Xlib just returns a status awr1: the issue is that a /0 gets put in the middle of the string awr1: thus it needs to be resized to a smaller extent awr1: `cstring.len` finds the nullchar disruptek: i thought we solved this problem a few days ago. disruptek: good evening, peeps. Prestige: o/ dadada: Nim provides a OS independend method to get the config dir, getConfigDir dadada: but for application data there isn't an analog proc Rika: who are you answering dadada: I'm observing dadada: I'd like to get $HOME/.local/share/ OS independently.... Rika: theres no counterpart for that in windows i dont think dadada: Rika, not a regular Windows user here, but I think I've seen something like user specific application data folders Rika: AppData/Roaming? Rika: thats gotten with getConfigDir dadada: well... I really don't care if Windows has a sane directory structure, but I do care about keeping my Linux environment strange, and if there was a getApplicationContentDir(), even if it would simply return the same as getConfigDir() for Windows, it would make the whole thing more streamlined, when having to think about cross-platform dadada: s/strange/straight dadada: lol Rika: in windows theres no distinction for config file and data file storage, but afaik usually you put config in USERPROFILE/AppData/Roaming dadada: it's always strange I gotta admit Rika: USERPROFILE is an env Rika: and regular data (non portable data) in AppData/Local dadada: well, so there is a distinction Rika: you can always create a new proc with the data i now told you Rika: not exactly Rika: portable data (not only config) can go in Roaming Rika: anything that doesnt make sense moving goes into Local Rika: like some sort of large cache or something, though that goes elsewhere (i dont have a good example basically) dadada: lucky that less than 2% worldwide uses Windows dadada: oh wait, I live in a dreamworld, ... Never Listen To Beef: lol Never Listen To Beef: Hey linux went up a bit over the past bit Never Listen To Beef: Sooo close to 1% of steam users! dadada: you actually have to care about idiosyncracies of Windows, just because so many people use it... dadada: Never Listen To Beef: it's probably a little higher when you account for Wine being confused with Windows Never Listen To Beef: Wut? dadada: maybe 1.2% :-) Never Listen To Beef: Steam stats is from hardware surveys and with steam play nobody is using steam through wine that often dadada: there are even people using virtualization to play Windows games on Linux, so they technically use both dadada: GPU pass through Never Listen To Beef: Yea i know that Never Listen To Beef: but the wine thing isnt really a thing with steam proton anymore, except a few cases of games dadada: I wont go into a discussion of steam proton being a beefed up (get the pun?) wine Never Listen To Beef: Well the thing is though you arent running steam through wine, so steam runs natively, which is why i said that isnt an issue as much Never Listen To Beef: The virtualization is an issue for accuracy though leorize: if they use virtualization to use steam, just count them in as a windows user dadada: don't forget people dual booting into Windows for playing games, this changes stats definitely Never Listen To Beef: Im certainly not, it also matters who steam asks for a survey Never Listen To Beef: And when Never Listen To Beef: It's a large iffy data noise dadada: leorize: accepted, but if they're using Linux for 50% or more of everything else, they're at least a 50:50 user, and not a 100% Windows user leorize: steam data is correct only when you use it to account for steam users leorize: don't try to extrapolate the amount of linux users from steam lol Never Listen To Beef: Hey im a gamer/gamedev it's the only base that matters 😛 leorize: be a real dev and release a linux version leorize: :P dadada: I second that Never Listen To Beef: I uh, always do release a linux version for anything i make dadada: :P fine Never Listen To Beef: 100% of my gamejam games have linux versions Never Listen To Beef: So fight me! dadada: okay, enough ranting, I' dadada: ve some work to do skrylar[m]: heh. must be fun to do things other than shave yaks :B Never Listen To Beef: So uh @clyybber gary's got me testing his vulkan project and on build with linux i get these nice issues Never Listen To Beef: https://hatebin.com/tzsjbrfuiq Never Listen To Beef: No one said im an employed gamedev 😄 Never Listen To Beef: I do have libvulkan.so.1 and also have modern vulkan drivers leorize: you have them leorize: you just didn't link to them Never Listen To Beef: I mean it should link, i did ` {.link: "/usr/lib/x86_64-linux-gnu/libvulkan.so.1".}` leorize: yea that's why it didn't link leorize: do this instead `{.link: "-lvulkan".}` leorize: or `{.passL: "-lvulkan".}` leorize: try both and see what works Never Listen To Beef: Latter worked leorize: technically you'd have to use `{.passL: staticExec("pkg-config --libs vulkan").}` leorize: but "-lvulkan" should work for most system leorize: use the above if you want cross-distro compatibility skrylar[m]: this potato only runs gl 2.1 :X leorize: (though the only distro this would add support for is NixOS) Never Listen To Beef: Nah gotta support the only good gaming distro Ubuntu Never Listen To Beef: 😛 skrylar[m]: shuttleworth is too cozy with MS these days for my taste Never Listen To Beef: If i werent using a ubuntu derived i'd probably use debian, cause im too silly Rika: i was thinking of trying out nixos skrylar[m]: its painful for a desktop disruptek: i thought you just use it for your dev env. Prestige: @Elegant Beef I have no idea why ff won't fullscreen in our WMs, spent about 5 hours today trying to figure out why Prestige: Going to try digging through ff's source code disruptek: the bot crashed because it opened too many files. Rika: nice Rika: skrylar: theres a reason i never went past thinking about it disruptek: rika: chickened out? Rika: ya damn troll lmao zacharyc1rter: ooph someone at work just said JSON returned from curl was not human readable zacharyc1rter: I wonder what they think when they open a binary in a text editor nisstyre: pipe it to jq zacharyc1rter: no I realize that zacharyc1rter: but json is definitely human readable zacharyc1rter: jq just pretty prints it nisstyre: it depends on your definition of human readable zacharyc1rter: the definition is that a human can read it lol nisstyre: ok I can read a hex dump from wireshark nisstyre: does that make it "human readable" ? zacharyc1rter: yes nisstyre: ok fair enough then awr1: https://github.com/ebran/grim this is really interesting, it reminds me of DOT zacharyc1rter: looks neat Never Listen To Beef: Everything is human readable assuming the human is smart enough zacharyc1rter: I mean true but I just mean representations that don't require the assistance of tooling to interpret zacharyc1rter: and json, when it's not pretty printed, is certainly decipherable bung87: anyone intersted ? https://github.com/bung87/ts2nim/blob/master/__tests__/compiler-spec.ts bung87: typescript to nim transpiler Rika: ooo Rika: bung87 make /** comments into ## comments, perhaps? bung87: yeah ,that's right, checked std comment style just now Rika: also why are `number`s `int`s? there arent any int types in js bung87: js internal number is int64 Rika: well it literally says here https://www.typescriptlang.org/docs/handbook/basic-types.html#number Rika: that theyre all floats Rika: bung87: more issues, ## is not multiline comment, it is for documentation comment, just like /** (double asterisk) js comment bung87: ok, that's a plobem, I thought int is more common for practice. Rika: so no matter if they are multiline or single line, theyre still ##s bung87: thanks , change it then Rika: i dont know any typescript but i can fix the test bung87: I'll fix current problem you reported Rika: i wish i could help XD but its in typescript not nim so i really cannot bung87: I just thought someone has compiler experience could help me design the code pattern, make it more maintainable, Rika: i dont have that either, sorry 😦 Rika: anyone know if theres a code quality service that supports nim? bung87: that's fine ,any other help also welcome. silvernode: I can't figure out why I am not getting any output on line 24 https://play.nim-lang.org/#ix=2l6S silvernode: I'm basically just playing with objects and passing data around Rika: because x and y are 0? Rika: changing them to 1 gives a seq seq int w/ 0 silvernode: I thought that might be it, but I thought it would still print 0 Rika: why would it? Rika: it makes 0 seqs with 0 0-values in it Rika: x = 0, 0 seqs in the seq Rika: y = 0, 0 0-values inside the nested seq silvernode: Ah, I thought I was just creating seqs with some numbers in it. Previously I used newSeqWith with an iterator and it worked fine. I guess I don't know what newSeqWith actually does Rika: newSeqWith(n, things) Rika: it creates a new seq with n things in it Rika: newSeq[type](n) Rika: it creates a new seq with n of type (uses default values) Rika: so basically newSeq[int](20) == newSeqWith(20, default(int)) silvernode: I see now, hmm, all I want to do is set some values for the x and y in a grid layout by using some seqs and custom types. I think I need to do it a different way silvernode: I need to not use the position coordinates as the basis for the seq creation. I need to create the seqs before hand and then populate them with data. Rika: if the array isnt sparse it would just be better to have an array of positions Rika: i mean if it ***is*** sparse Rika: because if you have a 100x100 grid with just 4 or 10 entities then that's a lot of 0'd out memory for so little entities silvernode: I can't change arrays in Nim though, correct? Rika: i mean, array in terms of general terminology Rika: you cant change the size of an array but you can change the contents silvernode: ah ok silvernode: So for a grid I would want an array inside of an array Rika: okay lets go back to nim terminology now Rika: so if your grid has many entities maybe a seq in a seq is better Rika: many meaning like half the thing is filled Rika: (also know that im no game programmer) Rika: but if it's just a few entities like let's say 30 entities Rika: then a single seq storing positions should be fine, no? Rika: also your choice if you want SoA or AoS, but SoA is much harder to use Rika: https://en.wikipedia.org/wiki/AoS_and_SoA Never Listen To Beef: I typically use 1D arrays regardless Rika: (though this might be overwhelming, since this is only a console game, no?) Rika: ah yeah, forgot that Rika: if your field is square just store the length of one row and modulo the index Rika: to get the column Never Listen To Beef: You can map n dimensiona arrays into a single dimension array Rika: yeah yeah yeah totally forgot about that Never Listen To Beef: I was actually thinking about a 2D/3D array module that did that but i feel like it'd be sorta silly Rika: there probably are silvernode: Well the new design I want to have is basically tiles in a grid and tiles can have events and other data. So when you land on a tile, things can happen to the player silvernode: My boss came up to my car and started talking my head off, so now I am reading all the messages here. silvernode: So it seems like I would want to use AoS since it is generally more intuitive and supported by most languages according to Wikipedia Rika: thats a big oof silvernode: I wish I didn' have to work today. Time to clock in now, have a good day everyone. Rika: see you PMunch: Hmm, how technically difficult would it be to make macros/templates be able to accept branches? I know we can use `do` but they can really make stuff hard to read. E.g. I have a "withCustomOpts" macros in my code, it checks some structure if we have custom options, and if they match what we expect, it then injects a variable that is cast to the correct type from the data. Simple stuff. But I also have an `else` part which is if we don't have any PMunch: custom options. But `withCustomOpts: do: ` reads really weird.. PMunch: Allowing withCustomOpts to have an `else` clause would be amazing Rika: "branches"? Rika: oh PMunch: Of course as an extension it would be even better if it could take elif and of branches as well.. Rika: ***its boring dsl time*** PMunch: Yeah, DSLs could solve this, but then everything would be in a block Rika: block? not really no? PMunch: Yes? Rika: anything within the "macro block" can either resolve into the block the macro is in or you can add the block yourself Rika: right? PMunch: Like you would need something that took all the code `else` branch included Rika: ah thats what you mean, well yes PMunch: Yes Rika: a visual block is what you mean PMunch: Yes Rika: i dont see the issue but thats my opinioon PMunch: Like you would need one macro customOpts: Rika: mm PMunch: Where could be something like if hasCustomOpts: else: PMunch: Which might be fine for this case PMunch: But I've definitely missed this in the past.. PMunch: And I don't like to wrap everything in DSLs.. skrylar[m]: well its nothing special, but logs. https://git.sr.ht/~skrylar/sklog PMunch: Hmm, that seems cool PMunch: How would you say it compares to e.g. chronicles? skrylar[m]: never heard of PMunch: https://github.com/status-im/nim-chronicles PMunch: Oh damn, kodkuce, I didn't mean to not respond to you yesterday. I was hopping back and forth between VPNs and for me it looks like I typed repiles to you :( Prestige: PMunch: How familiar are you with xlib? Running into some weird issues with my wm, think it's related to propertynotify events. Trying to find ways to research particular errors PMunch: I've worked a fair bit with it, but it's been a while Prestige: I think mostly gimp and firefox have been an issue, been trying to listen for events to make applications fullscreen Prestige: ff has been a "special" case, seems like I'm not receiving anything PMunch: Yeah, some applications don't behave very well.. Prestige: Just going a little crazy, spent about 2 days trying to get some sort of indication from ff that it wants to be fullscreen lol. Gotta try again tomorrow. PMunch: I unfortunately haven't gotten as far with mine as to try and run too many different programs under it.. Prestige: I have tags and a single tiling layout finished, borders indicating active windows, closing and fullscreening applications. trying to listen for application messages now, been a headache PMunch: Tags? Prestige: Yeah, using a tag system as opposed to workspaces PMunch: Hmm, interesting Prestige: sort of allows you to add windows to multiple "workspaces" or view multiple workspaces at the same time PMunch: That's why you were asking about showing one window on multiple workspaces? PMunch: Haha, yeah Prestige: I've been waist deep in xlib for a while, I feel like last time we spoke was over a month ago but it's probably only been a week lol PMunch: Haha, yea wasn't that last Friday or something? :P Prestige: Probably lol PMunch: I have kind of the same feeling, everything feels super long ago. But the days feel super short Prestige: I am still planning on helping with nimlsp but I want to get my wm to beta first PMunch: I was actually planning on doing something on nimlsp today PMunch: I've realised I need to rewrite quite a bit in my WM to go forwards with it.. Prestige: oh one random thing about nimlsp I was curious about, if I go to definition, I will go to a forward declaration of a proc. I noticed in other LSPs with C, it jumps to the implementation.. Idk which is correct Rika: it should do the latter Rika: imo Prestige: hm I think there's also 'go-to-implementation' so I'm unsure. But, it is the way other languages' lsps seem to behave Prestige: Perhaps I should just read the docs again Prestige: when it isn't 3am PMunch: Haha, remember that all of this is built on top of nimsuggest PMunch: So issues like that are likely to stem from there PMunch: Well, it might actually give both now that I think about it PMunch: And in that case it shouldn't be that hard PMunch: Hint: 21944 LOC; 865.383 sec; 20.771GiB peakmem PMunch: Tihi Prestige: :o PMunch: Just the same shenanigans as yesterday Prestige: Oh, lol PMunch: GCC was also using a solid 15Gb at the same time Prestige: That's nuts skrylar[m]: grin might have been neat for some of the debug dumps i had to deal with skrylar[m]: yea chronicles has a lot more going on PMunch: Wait, is "grin" a program, or was that meant as an expression? :P PMunch: But yeah, chronicles is pretty neat. Very featured skrylar[m]: its a lib that was linked earlier PMunch: Oh PMunch: I was just wondering how sklog was different skrylar[m]: 12-factors argument is you just dump to stdout because if you want log rotation or shipping or beautification you ... get another program to do it, because thats code that doesn't matter to a microserver. PMunch: I can see it is standalone, that is neat PMunch: Oh yeah, I can totally see that argument skrylar[m]: i would like to add in hawktracer-esque telemetry skrylar[m]: basic tracing https://www.hawktracer.org/ PMunch: Huh, can't find anyone mentioning grin.. skrylar[m]: FromGitter https://github.com/ebran/grim this is really interesting, it reminds me of DOT PMunch: Dot is such a nice tool PMunch: Basically turn anything that can output to stdout to pretty graphs :) Zevv: dot++ skrylar[m]: oh that is a lot of machinery in chronicles PMunch: Yardanico, I managed to compile and run the generated code! PMunch: Took ~35Gb of RAM, and had to increase the stack limit of the machine to 128Mb, but it does actually work! Prestige: PMunch: how much ram do u have man, lol PMunch: Haha, this is my work machine. It has 64Gb Prestige: Ah, nice. Araq: PMunch, cool... :-) PMunch: I think the IT guy just wanted to build a really high-spec machine, it's waaaay to overpowered for what I do PMunch: But it's nice to not have to worry about RAM when I'm running multiple virtual machines and docker containers (and my FF instance with waay to many tabs..) bung87: 64Gb mem, fit working deep learnning things... Recruit_main707: in nim? PMunch: Recruit_main707, what in Nim? skrylar[m]: >multiple virtual machines ... thats probably why they stuffed it with ram PMunch: Probably :P I have definitely noticed that I now only have 8Gb when working from home PMunch: I've ordered some more to put it that way.. Never Listen To Beef: I have 16GB and i've rarely ever gon over 10GB Never Listen To Beef: People that use a lot scare me Prestige: I go over 3 sometimes when I play games, I'm usually under 1 PMunch: I'm currently sitting at 3.2, closing FF brings me down to 0.4.. Rika: i'm at 5 right now, because firefox Rika: i have a little under 600 tabs LO Never Listen To Beef: I almost never have more like 2 tabs Recruit_main707: my average is 40 PMunch: I'm at 114 now I think PMunch: I don't really use bookmarks PMunch: I just leave stuff open Rika: same here Recruit_main707: 22 only today, im improving Rika: well i am too considering that i can go up to a thousand lol Never Listen To Beef: Ah i use bookmarks, and close my browser completely Rika: i also close my browser completely, its just that i save sessions Never Listen To Beef: Yea i dont count that as completely Never Listen To Beef: Im a weird person that dislikes saved sessions Rika: then you have a faulty definition Never Listen To Beef: eh i never said i was dictionary PMunch: Araq, what are your thoughts on solving 14253? PMunch: !issue 14253 disbot: https://github.com/nim-lang/Nim/issues/14253 -- 3Assignment to `default` leads to assignment for `nodecl` Araq: it should just work, it would be a simple C backend improvement PMunch: What should work though? Not assigning a value, or assigning `default`? Araq: let x = 0 Araq: assigning default Araq: no need to change the language definition for better C interop PMunch: But `= 0` not doing anything is just weird Araq: oh hmmm Araq: good point PMunch: I would expect `let somevar {.nodecl, cimport.} = 10` to work with a global variable in C that just hasn't been initialised in the C code. But `let SOMECONST {.nodecl, importc.}: cint` makes sense as it we don't actually assign it a value. Araq: the old way is var UPP {.importc, header.}: cint PMunch: Same as importing a procedure without giving it a body PMunch: Yeah, but if it is a const in C Nim will still allow you to generate an assignment for it.. Araq: maybe you're right and 'let UPP' is the most natural way to write it PMunch: Which would throw a C error PMunch: It was the first thing I tried, so definitely the most natural to me :) PMunch: It would tell Nim to not allow assignment to it, which is exactly what we want for C consts. And it would allow you to import things like error codes much easier (looking at you manpages that only lists the constant names for error codes without ever mentioning their actual values) Araq: write an RFC already PMunch: Will do! timotheecour: => https://github.com/nim-lang/Nim/issues/14253#issuecomment-625110027 disbot: ➥ Assignment to `default` leads to assignment for `nodecl` ; snippet at 12https://play.nim-lang.org/#ix=2l7t PMunch: Wait, how did you get those working on C-time? timotheecour: for the common case where the symbol is defined via a C macro, I call the preprocessor (with proper caching etc) to get the value; it’s available at nim CT ; for the case where it’s a compile time const. (eg C enum) it’s also doable but more complicated and that I haven’t done yet; for the other cases, you can just use the `let`variant, eg `let difficultCase {.importc: “DifficultCase", header: FromGitter: ... “".}: int = discard` Never Listen To Beef: Clearly we needd Cconst just to keep people on their feet Never Listen To Beef: need* Rika: c-c-c-c-const skrylar[m]: c-c-c-cant you see. Araq: '= discard' is not acceptable to me, it's like D's '= void', re-using keywords because keywords are expensive to add PMunch: Exactly PMunch: The more I thought about it the less I liked it timotheecour: i also suggested `auto` in that thread Araq: 'auto' is the same problem, the better solution is PMunch: auto is definitely better Araq: let x {.importc.} Araq: without the '=' Araq: or maybe use the existing .noinit pragma timotheecour: that’d be a redundant pragma; it should be implied by importc. Araq: well you can import a variable from C, set its value and claim afterward it should be immutable :-) Araq: which is what 'let x {.importc.} = value' does :-) timotheecour: I’m also fine with changing the parser so there’s no RHS after `=`; the downside you may want to consider is that I don’t see how it’d work with backward compatibility in mind, eg: ⏎ this won’t compile for nim < 1.3.5 despite the `when` because lexer will complain ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb3cd5322f9c45c2a753e72] Araq: but we should allow to not have the '= value' part Araq: iirc correctly the existence of '=' is done in sema, not in the parser skrylar[m]: is there even a lot of nim code in the wild in the first place (re: version restrictions) skrylar[m]: altho.. alpine was still sporting an insanely outdated version. redid all the packaging and mailed to maintainer but i think that person is dead or something PMunch: Yeah, you can get an empty LetSection in a macro, so it can't be an error in the parser Araq: skrylar[m], it doesn't matter, we won't get a "lot of Nim" code when we constantly break things timotheecour: @araq I meant for `const`, not `let`; see: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb3ce50d898fe7a376f3031] skrylar[m]: humm the go folk break builds constantly and nobody seems to care as long as they have the big g logo on it ^^;;;;;; Araq: when false: Araq: let x: int Araq: compiles fine, no parser change required PMunch: Better to break things to make them better than to be stuck with bad stuff. Sometimes you have to rip the band-aid off timotheecour: but then you loose on the ability to have it work at CT, as i mentioned. Araq: timotheecour: that's the point, you don't know the value, it comes from C timotheecour: `when false: const TEST {.importc, nodecl.}: cint` fails clyybber: maybe we should steal "undefined" from zig? Araq: skrylar[m], Golang doesn't break anything PMunch: It's not undefined though, it's just not defined by us timotheecour: my point is we can, in many cases, and I have a branch that does exactly that (that’s the whole point of proposal 5) clyybber: Yeah, emitting the `=` makes most sense here Never Listen To Beef: What skyrlar mentioned makes me wonder will unmaintained packages that are outdated and no longer work get replaced with maintained versions if one is made? Never Listen To Beef: on nimble ofc timotheecour: however we can simply backport the parser change to 1.0 and 1.2, in which case I’d be fine with skipping `=` (but only in this case) PMunch: That is the consensus I think beef Never Listen To Beef: If so nice skrylar[m]: people sometimes send pr's for version updates Araq: timotheecour: 'const' for importc is a design with unknown problems Araq: 'let' doesn't have any obvious problems, that's the difference Araq: plus it doesn't need a parser patch at all Araq: so even if you want 'const' so badly, let's please not conflate these two Rika: haha, `let`'s timotheecour: well ok, we can have `let x: {.importc.}` and another syntax for const (`const x: {.importc.} = auto`) Rika: how would a compile time importc work? timotheecour: (i meant `let x: {.importc.}: int` and `const x: {.importc.}: int = auto`) timotheecour: That was discussed earlier; i guess i shoudl just go ahead and submit that PR... clyybber: disruptek, Araq: Regarding try: finally: scoping, the only way to accomplish it is to extract all declarations out of try: to before the try: clyybber: Everything else is insanity (telling you as I'm currently working on the DFA :p) Recruit_main707: is it me or updating NimStudio would be as easy as: https://devblogs.microsoft.com/visualstudio/how-to-upgrade-extensions-to-support-visual-studio-2019/ Recruit_main707: aka: changing a few numbers Yardanico: Good morning/day/night :P Recruit_main707: hello PMunch: Hello Yardanico :) Recruit_main707: is gravityzwell in this server?? Yardanico: lemme check Yardanico: no Recruit_main707: time to send a few emails then PMunch: Yardanico, did you see that I was able to compile and run the 5 letter version? Yardanico: PMunch: yeah, impressive :) Yardanico: both on Nim and at the C compiler PMunch: Yeah Yardanico: btw https://github.com/nim-lang/fusion/pull/3 how did this even happen disbot: ➥ Hot Fix Bug PMunch: I'm trying with 6 now, but I don't have very high hopes :P Yardanico: btreetables.mim Yardanico: https://github.com/nim-lang/fusion/blob/master/src/fusion/btreetables.mim Yardanico: XD PMunch: Hahaha Yardanico: btw, I am kinda noobish in the mathematical/algorithm side of things, so what are the advantages of a b-tree tables over normal ones? Yardanico: oh wait they don't need hashing? Yardanico: damn Yardanico: oh, so it's a performance/memory tradeoff PMunch: The benefit of hash tables is that if your `hash` procedure is cheap you can find pin-point exactly where in memory an entry in a table should be. So optimally it's a single pointer dereference to get there. This is a gross oversimplification of course :P PMunch: I was actually thinking about implementing a table system I made for a seminar on green computing in Nim narimiran: Yardanico: they are sorted by default narimiran: btw, the current implementation is just a "proof of concept", and it should be optimized narimiran: see https://github.com/nim-lang/Nim/pull/13890 for a bit more detail disbot: ➥ [WIP, help needed] introduce BTree-based Tables Yardanico: matrix spam again, yay Rika: matrix spam? Yardanico: matrix-freenode bridge is not that stable, sometimes it crashes and 20-30 people leave (because they're connected from matrix), and then they join PMunch: Rika, people using Matrix can connect directly to IRC. But it's a bit flaky, so sometimes all matrix users drop and reconnect Yardanico: ofc you can disable showing join/leave messages in the IRC client though PMunch: But it can be useful for regular use.. Yardanico: yeah Rika: i have it disabled, osu's irc is pretty insane Rika: well, when i do use irc Rika: of course right now i am not lol supakeen: I use weechat's smart thingy which works well and I have a shortcut to show/hide them at will. supakeen: I think it only shows quits if someone leaves shortly after a message/mention. Yardanico: btw nim-regex now works with arc (with that nfamacro) just fine, thanks to @cooldome for fixing it :P Yardanico: there's https://github.com/nim-lang/Nim/issues/14251 but it's not really related to nim-regex disbot: ➥ [ARC] Undeclared variable in C with inline pragma and iterators ; snippet at 12https://play.nim-lang.org/#ix=2l7S Yardanico: left* clyybber: \o/ Yardanico: lets try the nim-regex benchmark Yardanico: seems to be around the same which is ok Yardanico: and in some benchmarks arc is faster Yardanico: hmm, in some ones it's slower though :P clyybber: Surprises me that it works at all Yardanico: email regex is 3x slower with arc seems like clyybber: I assumed a regex engine would use a lot of case statements clyybber: with early exits ala break and return Yardanico: it constructs an NFA at compile-time by default Yardanico: so at runtime it already has the parsed regex pattern Yardanico: but yeah clyybber: Yeah, so it constructs case statements clyybber: probably Yardanico: it does use case statements with early returns :P clyybber: Got lucky then :D PMunch: Hmm, how does ./koch test decide what to run? PMunch: I added a test-case (not checked in to git) and tried to run it but it gives me the same number of total tests with and without the file PMunch: https://github.com/nim-lang/Nim/pull/14258 disbot: ➥ Allow let to not have value when using importc clyybber: PMunch: Hmm, I don't know, I always use testament clyybber: ./koch test is probably testament I suppose PMunch: Araq, what `s` are you talking about? clyybber: what was the recent bug that had to do with arc/exceptions and nimble? clyybber: @Yardanico I think you discovered that one Yardanico: yep Vindaar: @voltist: are you around? Yardanico: basically nimble relies on UB in nim clyybber: Yardanico: Did you open an issue for it? Yardanico: yes Yardanico: https://github.com/nim-lang/nimble/issues/798 disbot: ➥ Nimble doesn't work with --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2kKF clyybber: thanks Yardanico: I really consider that as an UB :P Yardanico: " Nimble relies on the fact that after catching the exception the variable initialized in the "try" block still contains useful info (for validation)" clyybber: Yeah, I wonder how I should treat it in the DFA Yardanico: 4raq told that it's strange this works with default GC clyybber: Ok, so raising does not lead to an implicit return clyybber: of the result variable I mean waghanza: hi, is this ok to build an app on *alpine* (with `musl`), but to run it on *linux* (with `glibc`) waghanza: ? Rika: if its possible in c, its prolly possible in nim Yardanico: @waghanza if you compile the app with musl _statically_ - yes dadada__: are there any official pretty printers for variables in Nim that work on all variables? or do I need to resort to https://nimble.directory/pkg/print Yardanico: if you link to musl dynamically, no Yardanico: since if you link to musl dynamically then you'll need to have musl available on your system Yardanico: although some distros (even if they're glibc based) have musl in their repos, for example arch does PMunch: dadada, most variables can be printed just with $, or you can use .repr dadada: yes, I know, most, I need something that works on all! PMunch: reprshould work on all PMunch: But it might not fit your definition of "pretty" dadada: well, it does need to show the contents of things, that would be pretty PMunch: There is also `dump` from the sugar module PMunch: Which does something like this: https://play.nim-lang.org/#ix=2l88 PMunch: It still requires $ though Vindaar: @voltist: my curiosity got the better of me: https://gist.github.com/Vindaar/72bc67ff93613619bba2fdeffc3a24e9 Vindaar: i.e. neither the formula, nor the parameters seem to make sense Vindaar: though the parameters as they are fitted by me certainly have big errors attached to them based on how I extracted data points from their plot PMunch: I feel like this should at least throw a warning.. https://play.nim-lang.org/#ix=2l8c Yardanico: fyi, I enabled bridge betwee #nim-news on IRC and #news on Discord (and also fixed color code stripping in ircord :P) PMunch: This is just confusing: https://play.nim-lang.org/#ix=2l8j disruptek: agree. zacharyc2rter: what's confusing about it? zacharyc2rter: oh I see zacharyc2rter: maybe look at the generated C code? zacharyc2rter: but uh basically the second assignment doesn't happen is my guess zacharyc2rter: `let test2 {.nodecl, importc.}: cint = 42` that one PMunch: Yes, that is what happens PMunch: But it is confusing that it doesn't PMunch: It happens with cstrings as well: https://play.nim-lang.org/#ix=2l8r PMunch: Why are literals ignored in this way? zacharyc2rter: because of nodecl zacharyc2rter: however in the first assignment it's the result of that expression PMunch: I know it's because of nodecl, but why only in the case of literals? PMunch: Looking at that code I would assume both assigned the variable. Or since they are nodecl, neither of them. zacharyc2rter: file an issue I guess - I know the same thing happens with typedefs and types zacharyc2rter: let me show you what i mean zacharyc2rter: PMunch: not exactly the same issue, but it's hard to reason about what's going on here as well: https://play.nim-lang.org/#ix=2l8y zacharyc2rter: err sorry let me fix that zacharyc2rter: https://play.nim-lang.org/#ix=2l8B zacharyc2rter: actually I don't think it's the same thing at all, nevermind. zacharyc2rter: I do think your example is confusing but I have a feeling the reason it's happening is because of the assignment of an expression vs an int literal PMunch: Yeah it's obvious why it happens, but it looks very strange and it should be consistent kaushalmodi: nim-regex just got even more awesome! https://github.com/nitely/nim-regex/commit/fdeb60ef9980f2ac46e28598efda6f4b6d68b7f5#diff-0c88c9acc6458974b569d4f97da31c85R1657 shashlick: nim doc doesn't seem to suppress hints with `--hints:off` shashlick: never mind zacharyc2rter: if I have a type with a function pointer field - why can't I use the `discardable` pragma on that field? Yardanico: wdym discardable pragma on a field? Yardanico: ah I understand zacharyc2rter: I think it's a bug - you should be able to do this Yardanico: yeah seems so Yardanico: but discardable itself is generally not considered good in nim :P Yardanico: so maybe there's not much support for it in some cases zacharyc2rter: I think it's up to the programmer clyybber: zacharycarter: Whats the error? Yardanico: @clyybber invalid pragma: discardable Yardanico: https://play.nim-lang.org/#ix=2l8T liblq-dev: is it possible to disable doc generation for some symbol? liblq-dev: like, iirc Rust has #[no_doc] clyybber: Ok, yeah thats a bug Yardanico: i'll open the issue or someone else? :P zacharyc2rter: I was filling it out but sure go for it :) Yardanico: ah nvm Yardanico: go yourself, it's your issue after all ;) zacharyc2rter: haha okay Yardanico: I have 15 open issues in nim tracker anyway Yardanico: half of them are low priority though zacharyc2rter: beast mode clyybber: Yardanico: And the other half are showstopper :D Yardanico: XD clyybber: Its a good mix Yardanico: well 4 of my arc issues are already closed, and I didn't submit any arc issues today, so I gotta find them alehander92: ooi clyybber: zacharycarter: Somehow you opened it twice clyybber: I closed one PMunch: What's the best way to iterate over the keys of an ordered table and deleting those that don't meet some predicate? PMunch: I can't do a normal for loop over the keys, because it complains that the size changes PMunch: I can store the keys in a sequence, but that feels a bit heavy handed.. liblq-dev: this is what I usually do, and I don't know of another method liblq-dev: you can write a keepItIf for tables, if you really want to Rika: Loop through the table and add the keys to a result instead or something liblq-dev: but then you're allocating another table, which feels even more expensive than allocating a seq disruptek: make it work and move on. PMunch: Hmmm zacharyc2rter: clyybber: thanks - github 404'd for me when I pressed the open button the first time clyybber: yeah, github is really wonky today Yardanico: yeah I noticed it too a bit earlier Yardanico: https://github.com/treeform/staticglfw sounds nice Yardanico: now we also need to do the same for cimgui :) Yardanico: and then we'll have single-binary gui apps with imgui and glfw zacharyc2rter: just use sokol and not glfw :P zacharyc2rter: and then you just need to link an object file zacharyc2rter: is disruptek streaming yet? disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek Yardanico: zacharyc2rter: he indeed is zacharyc2rter: niceeeee clyybber: zacharycarter: I have a fix clyybber: zacharyc2rter: Right here: https://github.com/nim-lang/Nim/pull/14262 :) disbot: ➥ Fix #14260 liblq-dev: so, uhh, recursive module dependencies when? liblq-dev: they constantly piss me off liblq-dev: I can't structure my project in a sensible way because Nim lacks support for them clyybber: never had that problem clyybber: I actually think it forces you to structure your project in a sensible way liblq-dev: yeah, and make all your fields public even though they should be private. funny joke. clyybber: umm.. liblq-dev: look, I don't want to expose my implementation details to the end user liblq-dev: and have to tell them "don't look it's internal" everywhere around the code liblq-dev: this would've been a million times easier if Nim has a {.nodoc.} pragma or similar, where I could just hide them from the docs, but sadly it doesn't alehander92: hm alehander92: but cant you write one alehander92: weren't the doc comments just nodes in the tree alehander92: ah you're talking about fields appearing there alehander92: <3 clyybber: or just leave them private? clyybber: and structure your project "better"? Prestige: dom96: Your book just arrived :) dom96: Prestige, pictures! Yardanico: Prestige: that was fast :P Yardanico: I only received their email yesterday Yardanico: that they shipped my book Prestige: https://i.ibb.co/NZ9NtxB/IMG-20200507-123954.jpg zacharyc2rter: so much wasted potential Prestige zacharyc2rter: could have put anything in that pic zacharyc2rter: everyone would have opened it Prestige: Lol zacharyc2rter I'll do a photoshoot after work :P zacharyc2rter: niceeeeee dom96: Prestige, beautiful! What is that WM? :D Yardanico: @Clyybber hooray! Yardanico: btw I'm thinking of trying ircord on the mail channel in a few days Yardanico: most stuff is fixed Yardanico: like mentions Prestige: Unfortunately it's my work macbook hooked up to a monitor D: running yabai to make it somewhat bearable lol Yardanico: and dimscord by @KrispPugg is also getting fixes Prestige: dom96: I usually run awesome or dwm on my personal machines dom96: Yardanico, awesome dom96: Prestige, might be time for me to dive back into the Linux world :) Prestige: Things have really gotten better in the past few years for Linux. Everything else feels clunky to me livcd: Any frontend person that can compare Karax to whatever they usually use? zacharyc2rter: Karax has a virtual dom and does dom diffing zacharyc2rter: so in that sense it is similar to react / vuejs / angular zacharyc2rter: however it differs in that it follows the elm philosophy that components should be stateless zacharyc2rter: I think though stateful components are also supported zacharyc2rter: I don't think Karax has anything like redux / vuex etc... IE an application wide state store dom96: afaik karax has no philosophy dom96: in fact, it has no components zacharyc2rter: meh I haven't used it in a while dom96: I'm starting to seriously consider setting up a patreon/github support/something like that for myself dom96: The amount of projects I have to maintain, and the amount of things that would be very valuable to the community that I developed but is stuck as part of another project is far too high dom96: (One example being routing for karax) dom96: Having a patreon would give enough motivation to get these things out there and would hopefully enable me more and more to work on these things into the future alehander92: sounds good Willyboar: especially for httpbeast :) dom96: I could give Patreons a vote on what they want me to work on :) dom96: but httpbeast is pretty much done :D dom96: Willyboar: what do you think it needs? Willyboar: I don't know :P Willyboar: Is it ready for production? dom96: I don't consider it ready to be put naked to the internet dom96: so I could work on that disruptek: dom96: i'll sponsor some nimph bugfixing if you have some time to write nim professionally. dom96: but to be put behind nginx it's veyr much ready dom96: *very dom96: disruptek, not sure if serious, but if you are: I think working on a codebase that I don't have much context on would not allow me to have the most impact disruptek: so it's not about the money? dom96: not primarily dom96: but I do think having another source of income would be both good for me and for Nim disruptek: so the reason you don't fix bugs in software you're familiar with is because you don't want to. dom96: Right now a lot of donations to Nim are being unused Yardanico: yeah I saw Yardanico: I contribute to opencollective and the budget just seems to be unused (?) Yardanico: https://opencollective.com/nim/expenses is empty xd dom96: disruptek, sure, that's about right. Prestige: Would be pretty awesome getting paid to work on nim libs zacharyc2rter: start a patreon disruptek: would be pretty awesome to have a job, full stop. Yardanico: i guess an idea where nim lib devs are getting paid (even a bit) for changes might be a kinda good idea Prestige: True Yardanico: from opencollective for example Recruit_main707: someone wants to help transpile this to nim?? Recruit_main707: there are more options than go if youd rather have other references Recruit_main707: https://github.com/google/flatbuffers/blob/712866d57b5e95b64858db31425816eb97ea7630/go/builder.go#L107 dom96: disruptek, what's blocking you? disruptek: my pleasant disposition. Prestige: vvifuigvkdjndcrdkjhugrvhgfjtjngjitujjibuljiu Prestige: ignore that :P supakeen: I will find deeper meaning, Prestige and you can't stop me. dom96: disruptek, tried going after the job offers posted in the monthly HN threads? Prestige: Lol supakeen Recruit_main707: specially this: `for i := len(b.vtables) - 1; i >= 0; i-- {...}` what the hell is this?? supakeen: Likely iterates over b.vtables in reverse, @Recruit_main707. supakeen: But depends on what it is doing in the {...}. dom96: Recruit_main707: reverse iteration? Yardanico: you need countdown Yardanico: countdown(b.vtables.len - 1, 0): Yardanico: for x in * Recruit_main707: or reversing the sequence right? Yardanico: ? Yardanico: depends on what you do inside the code dom96: reversing the sequence is costly Prestige: ^ Yardanico: for ; i >= 0 && b.vtable[i] == 0; i-- {} Recruit_main707: then say no more Recruit_main707: thank you Yardanico: they just decrement i as long as b.vtable[i] == 0 Yardanico: while i >= 0 and b.vtables[i] == 0: dec i dom96: for i in countdown(b.len, 0): ... Recruit_main707: thats the 1st for loop, i mean the second one Recruit_main707: (have i highlighted the wrong one? Yardanico: for i := len(b.vtables) - 1; i >= 0; i-- { is just countdown Recruit_main707: ok Yardanico: damn go sure has weird loop syntax Yardanico: gcc 10.1 released Recruit_main707: hype Yardanico: https://gcc.gnu.org/gcc-10/porting_to.html does the -fno-common affect nim? clyybber: Nim doesn't generate headers clyybber: So I don't think we are affected disruptek: shashlick: i just had to move the toast binary into nimterop/ in order to build golden. clyybber: aha! clyybber: maybe thats teh same issue? clyybber: disruptek: What error did you get without doing that? disruptek: /home/adavidoff/nims/1.3/lib/system/fatal.nim(49, 5) Error: unhandled exception: cimport.nim(131, 12) `fileExists(toastExe)` toast not compiled: /home/adavidoff/git/golden/deps/pkgs/nimterop-0.4.4/nimterop/toast make sure 'nimble build' or 'nimble install' built it [AssertionDefect] clyybber: Ah, ok clyybber: Nevermind then Yardanico: I think we should soon start testing important packages with arc too? on the CI i mena Yardanico: *mean Yardanico: once we have deepCopy and shallowCopy in arc :) Yardanico: https://github.com/nim-lang/Nim/issues/13997 disbot: ➥ ARC: deepCopy in new runtime feature missing, do we have alternatives? shashlick: disruptek: made some more fixes for clyybber shashlick: it will be 0.5.0 now since the nimble version has changed, still haven't tagged since i'm midway fixing the noHeader issue shashlick: clyybber had issues with specifying --path dom96: My god, what has CanYa done to the Bountysource site Recruit_main707: is while more or less eficient than a for loop? its not right? they are just goto in asm dom96: We're still getting $600 there (amazing) but the site is so badly broken I cannot access any admin-side info alehander92: heyy alehander92: is it ok to call an async function alehander92: in a callback procedure for another future? alehander92: i get some gc errors like http://ix.io/2laO PMunch: dom96, well that sucks.. Yardanico: mumble be like Yardanico: https://i.imgur.com/2P698o2.png PMunch: Hmm, how hard would it be to set up a neural network that takes one byte of input and tries to draw a character of fixed size? Basically a reverse OCR. Zevv: not harder them am OCR network I guess Zevv: it'll have to look at its own output to learn from that Technisha Circuit: Is there a hjson package for Nim? someunknownuser: PMunch: You would probably want to use a GAN architecture for that. Technisha Circuit: Json != Hjson PMunch: Zevv, I mean it would be super easy to generate images of what each character is supposed to look like PMunch: So the training data set should be pretty simple PMunch: Hmm, GAN sounds familiar.. Been way too long since I've looked at this kind of stuff.. someunknownuser: I was recently looking into GANs and stumbled upon this article (using Keras and Python): https://medium.com/@mattiaspinelli/simple-generative-adversarial-network-gans-with-keras-1fe578e44a87 I however did not try the example myself. PMunch: Oh right, one of those thingss PMunch: Yes, that might be what you'd need PMunch: "without making identical copies", I wouldn't mind that though.. someunknownuser: I do not know how difficult it might be to translate / replicate something like this in nim. I am aware that there are some deep learning frameworks for nim, but I am not too familiar with any of them sadly. InventorMatt: arraymancer is probably the best framework for it in nim PMunch: @mratsim, any pointers? leorize: it somehow concerns me that a parser need deepCopy leorize: then I realised that it doesn't and the author just assumed that Nim has python semantics :P PMunch: leorize, are you looking at parsetoml? leorize: yep Zevv: I might be naive here, but what is the technical issue with deepcopy? cycles? mratsim: GANs are too complex for Arraymancer right now PMunch: Yeah that entire project is a bit of a mess.. mratsim: I didn't implement, the Instance Normalization layer iirc PMunch: It was inherited from someone else, and with new TOML versions it has grown increasingly hairy.. leorize: PMunch: I started writing my own toml parser because I was scared of that code leorize: but I never wrote more than the lexer :P PMunch: mratsim, could a more traditional network work for this? leorize: Zevv: the issue is RTTI PMunch: leorize, yes it isn't the best.. But it has 100% coverage of the TOML spec IIRC mratsim: an autoencoder would work leorize: Zevv: not much of a problem for simple types, but it's a problem for inherited refs afaict mratsim: but I would miss deconvolution in Arraymancer I think :p Zevv: leorize: Ah right, that makes sense mratsim: have to check out, it's been a while that I looked into those deep learning arch mratsim: Basically, it's a super pain to write gradients manually and then go and do them on CPU, Cuda and OpenCL and then optimize them without breaking the gradient mratsim: so I wanted to write a compile mratsim: compiler* mratsim: but then I need multithreading that is better than OpenMP mratsim: and then you don't have time anymore :p PMunch: Haha, classic skrylar[m]: Yardanico: hash tables allocate blocks of memory and not all of that is used (fill rate), although some linear probing ones will push the fill rate a bit more (ex. robinhoods, the one i did a port for.) trees don't alloc more than they need but they also aren't O(1) skrylar[m]: @Recruit_main707 i largely did that (https://github.com/Skrylar/skflatbuffers) but somehow people keep forgetting and then mentioning it again xD alehander92: mratsim, ohh mratsim: @treeform do you plan to publish Greenlet on nimble? treeform: No they don't work well. mratsim: ah, what's the issue? treeform: there no i/o code that uses them. treeform: so its only a switching mechanism, it needs whole i/o stack written. mratsim: well, I think it's perfect fit for my need 😛 treeform: Also GC issues. treeform: but I think arc made them work. treeform: they did not work with refc gc mratsim: not a problem for me either but I can submodule your repo treeform: After greenlets, I looked into windows fibers treeform: I had more luck with fibers, but windows only. mratsim: Use case is described here: https://github.com/nim-lang/RFCs/issues/222 mratsim: mratsim: But basically to debug concurrent data structures, I need precise control of threads interleaving. disbot: ➥ Correct-by-construction Nim programs ; snippet at 12https://play.nim-lang.org/#ix=2lbm treeform: Fibers is a low level threading like API that works on windows. That give you more control. It works with windows I/O. treeform: I wish linux had a similar API but linux does not. treeform: After all this learning I just use threads... treeform: Threads work well enough for me. treeform: @mratsim thats RFC is pretty cool. treeform: @mratsim that RFC is pretty cool. mratsim: (on something, back in 10min) mratsim: Basically I need to find bugs on concurrent data structure I need to simulate threads and need to control when they suspend and when they resume treeform: My recommendation is to still try to use real threads. mratsim: So I replace atomics/locks/condition variables with my own type that would suspend the "fake thread" (a coroutines) in order I decide mratsim: I can't debug concurrent data structure with real threads treeform: maybe try https://nim-lang.org/docs/coro.html treeform: its part of the standard library mratsim: I need to control their resume and suspend according to the the atomics "relaxed/acquire/release" semantics mratsim: there is no GC-ed type because they are not threadsafe so that's not an issue and there is no IO either you don't hsare IO between threads mratsim: also it needs very high performance because for example 3 threads that access 3 variables, it's all permutations of access A-B-C A-C-B B-A-C that needs to be explored to find concurrency bugs mratsim: i.e. ucontext is problematic mratsim: also x86-only is fine, that's something that is run for testing and it "simulate" so if simulation is good, it would work on any platforms mratsim: but i'll submodule your lib that's fine treeform: ok treeform: My plan for greenlet was slowly transform the C parts into nim. treeform: making it mostly nim with some assembly mratsim: as an example, when I formally verified this data structure that wakeups sleeping threads, it's 9million states to explore: https://github.com/mratsim/weave/blob/master/weave/cross_thread_com/event_notifiers.nim mratsim: and it's very very simple treeform: neat treeform: I think you are more qualified to write some thing like "greenlet" then I am. mratsim: well the IO part I'm unfamiliar with it so ... mratsim: anyway, for now I'll just use greenlet mratsim: at least now you know that it actually has a perfect use-case 😉 treeform: I also feel like most programs spend their time not in io... unless you are chat server or some thing. Most servers do some work so too... you want real threads for most things to utilize the cores. treeform: I also really like UDP... which does not need epoll/kpoll stuff. treeform: I also really like UDP... which does not need epoll/kpoll stuff that TCP needs. mratsim: you can't do interesting things without IO though: no networking, no file, no display treeform: I was thinking of experimenting of a model where you have single threaded TCP proxy that talks to your servers over UDP. treeform: This way your process never does streaming io. treeform: It only gets a large packet and responds with a large packet. mratsim: I'm looking at coro, but it doesn't have the same API has createThread while greenlet does so minus point (perf not withstanding) dadada: there's no proc to convert a treeRepr() string into code again or into a astGenRepr form? Araq: dadada: macros.parseExpr deech: Dumb q, how do I write a seq of strings to a file using the standard library? I only see a `writeLine` that takes `varargs[string ...]`. mratsim: seq can be passed to varargs deech: noice! dadada: survey, who here uses vim keybindings (independend from editor) besides me? skrylar[m]: i used to have the whole emacs+evil thing for a while dadada: me, too, that's how I started to learn vim :-) voltist: @Vindaar I think the issue is just with SHL1. The other channels still have the problem with the form of the equation, but once that is corrected they seem to match the graphs. voltist: Although I've only tried two more Vindaar: @voltist: That's good to hear. It's also possible the shape for SHL1 isn't actually as different as my plot makes it appear, because of my approach to get the data voltist: It's different enough that I'm hesitant to actually implement anything for my research until the authors get back to me Vindaar: yeah, I understand that. are you working on something that builds on this? Willyboar: hmmm this is strange. Does asynchttpserver has problem with 1.2.0? disruptek: show us the paste. treeform: Araq, could you merge some of my fixes for cairo? https://github.com/nim-lang/cairo/pull/15/files I also added CI system to run tests. disbot: ➥ Couple of typo fixes with "_". Araq: haven't you heard? I'm taking a holiday Yardanico: Araq: is it because it's holidays in Russia ? :P Yardanico: krux clyybber disruptek me in mumble, i like that activity Willyboar: Araq: https://www.youtube.com/watch?v=IBtGmxU1wzs Araq: no... because of my mother voltist: @Vindaar Yeah I'm interested in using their experimentally-acquired parameters for my simulations liblq-dev: I'm getting an error with concepts that I can't quite understand liblq-dev: I have a proc called `draw` in one module, it's public liblq-dev: then there's this concept https://github.com/liquid600pgm/aglet/blob/master/src/aglet/target.nim#L13 liblq-dev: but for some reason it doesn't match my proc liblq-dev: http://ix.io/2lbT ← this is the error message Vindaar: @voltist: Would be interested in hearing more about it, if you can share. ⏎ But first I gotta sleep.. Good night everyone! queersorceress: hmmm, @dom96 i'm working on writing a test case for the PR i put up and i'm curious as to why the test site for nimble is setup to run the binary and interpolate the behavior/output rather than attaching tests to the interfaces directly Yardanico: because it's not that easy to do with nim :) queersorceress: why not? it just requires the symbols be exported disruptek: gonna grab some food; bbiab. disruptek: no, enemas. Rika: liblq-dev: -> ; afaik draw must definitely be only 2 parameters and the order must bethe same skrylar[m]: aren't concepts broken in nim o_O skrylar[m]: last i tried you can just wing it and the nim compiler let you try to call stuff that may not be available on the type your generic resolves to; it will be happy if it can, and just treat it like the resolved generic wrote bum code if it can't, so. skrylar[m]: which is nice because so many languages try to make you specify every litle thing and then half the complexity comes from the specification to be allowed to do the thing you already know is gonna work if it just tried it xD Avahe: @Elegant Beef so I just accidentally fixed the issue with fullscreen applications skrylar[m]: accidental fixing o/ Never Listen To Beef: lol Never Listen To Beef: How? Avahe: Removed SubstructureRedirectMask from clients' event mask Avahe: It actually fixed like 5 bugs at once Avahe: 100% accidental after spending 2.5 days trying to fix this Never Listen To Beef: so now you get the property change notification when you fullscreen a window? Avahe: Well a ClientMessage Avahe: I'm not listening for PropertyNotify at all Never Listen To Beef: What mask is required for Client Messages? Avahe: Just ClientMessage (same way you add a listener for map requests, etc) skrylar[m]: hmmh. seems i should look over MuVM and WASM skrylar[m]: altho i don't think wasm is meant for self mutating systems. skrylar[m]: anyway if some mu-esque vm were to hypothetically appear, wouldn't that solve the nimscript/repl/compile time evaluation feature set zacharycarter: gg zacharycarter: whoops sorry Rika: but im not sure of the `=destroy` one zacharycarter: yeah you can destroy things in Nim whenever you want by calling `=destroy` zacharycarter: and you can defer it if you want to as well I'm pretty sure zacharycarter: and you can write custom destructors zacharycarter: so what's the beef? zacharycarter: in all seriousness beef looks cool but way less mature than Nim zacharycarter: and I don't like IDEs Rika: Beef is a developing open source, statically-typed programming language, designed and developed by Brian Fiete (one of PopCap founders), whose syntax is mainly derived from C# programming language and targeted for high-performance execution. Rika: 😛 skrylar[m]: the universe is trying to keep me honest tho :p any temptation i had for beef died with making several attempts to get it to work, and me not wanting to debug llvm dependencies zacharycarter: Red looks interesting zacharycarter: but no x86-64 support yet skrylar[m]: i liked red until they became a buttcoin skrylar[m]: weird. i tried hcr on windows again and in 0.20 it doesn't crash on aftercodereload, but it also doesn't work zacharycarter: I wouldn't use hcr skrylar[m]: or rather hasmodulechanged doesn't work, but aftercodereload does. zacharycarter: if you want to hot reload - do what I did and use cr.h and look at frag zacharycarter: all the code is there skrylar[m]: no idea why devel crashes and 0.20 works except for `has_module_changed` KingDarBoja: PopCap? Plants vs Zombies company right-? zacharycarter: no idea skrylar[m]: yes. successful casual games place skrylar[m]: beef has a lot of weird memory stuff because memory fragmentation is a big deal for AAA-devs zacharycarter: wait - do they develop beef? skrylar[m]: the ex-head dev does zacharycarter: ah skrylar[m]: i suspect thats also why append allocators exist zacharycarter: some of these features just don't make sense to me skrylar[m]: because they make an instance claim a variable size, and any beef object can be forced to the stack with `scope` zacharycarter: like leak detection in real time - there are already tools for this zacharycarter: custom allocators w/ manual memory management I mean is that even something to brag about? skrylar[m]: they are AAA devs. so, yes zacharycarter: mixing optimization levels is cool I guess but if you're debugging the app just make a debug build? skrylar[m]: eh you'll understand someday i guess zacharycarter: what will I understand? skrylar[m]: AAA devs have more problems than indie devs on pc's do. they can't just tell people to buy more ram for their xbox. so stuff like memory fragmentation is a reality in their world skrylar[m]: which is why custom allocators and arenas are a thing for them zacharycarter: I wasn't talking about memory fragmentation zacharycarter: I was talking about realitime leak detection and custom allocators - like you can do this with C/C++ already skrylar[m]: mixed optim happens over there too :\ zacharycarter: which you also have to manually allocate memory for zacharycarter: hell you can write custom allocators with Nim too skrylar[m]: ey probably mentions it because so many new langs are GC, so he has to say "look, no GC" zacharycarter: I guess skrylar[m]: defer is nicec skrylar[m]: he may do okay when they get the rough edges out of the tooling. i can see it being an easier sell to disgruntled unity users "hey its still C#, but it compiles." since a lot of people wanted ... C#, on bare metal zacharycarter: well they won't want to use it if they have to manually manage memory zacharycarter: they don't have to do that in C# skrylar[m]: i dunno. gamedev tend to fight the gc anyway zacharycarter: yeah but not unity users haha skrylar[m]: ours with the incremental mode turned on is nice skrylar[m]: haven't tested doing custom allocs in nim yet though. ex. the items that live in a custom allocator for a single frame part skrylar[m]: janet does have an API for this where you can ask for scratch space zacharycarter: I guess the difference is you won't be able to use the stdlib in Nim with custom allocators zacharycarter: I don't know if that's the case with beef or not zacharycarter: but lots of people don't use C++'s stdlib zacharycarter: so I think this is fine zacharycarter: I like Nim's flexibility - if I want to use a custom allocator / manual memory management in certain situations I am free to do so zacharycarter: and then in other areas of my program I can rely on the stdlib zacharycarter: just like I can in C++ zacharycarter: but I have the benefit of ARC / the GC skrylar[m]: some of those get annoying when strings implicitly call stdlib stuff and you are trying to go gcless skrylar[m]: D had this problem zacharycarter: write your own string impl then skrylar[m]: I'm sure someone did leorize: I'm pretty sure nim strings don't implicitly call anything leorize: but I'm not following the conversation so :P skrylar[m]: string concat does iirc leorize: ahhh you're talking about custom allocators zacharycarter: yeah zacharycarter: just don't use any of Nim's memory management if you want to use custom allocators zacharycarter: pretend Nim is C and you're fine skrylar[m]: i do tend to separate the init from alloc for that reason but.. eh. leorize: it's not too hard to write your own string implementation either, now that we have enough type hooks for basically everything skrylar[m]: nothing sells users on a toolchain like "write it yourself" ;) leorize: specialize use cases require specialize tooling :P yumaikas: Question: Is there a known way to make async/thread safe globals? yumaikas: (I'd be fine with a mutex or the like, just wondering if there's a way to do that and convince the compiler it's safe) zacharycarter: yumaikas: do you mean the global is using GC'd memory? yumaikas: zacharycarter: If there's a way to eval a function once, and then let the global be constant, that would work too yumaikas: (Basically, a nim version of C#'s Lazy would be ideal) zacharycarter: yeah but is the global using GC'd memory or is the memory manually allocated / allocated on the stack? yumaikas: zacharycarter: it'd be in global scope. I'm assuming that's GC'd? yumaikas: https://github.com/yumaikas/tabulaScripta/blob/master/webConfig.nim disruptek: {.gcsafe.} yumaikas: Example of things that I want to do, in some form yumaikas: -----------------------------------------------------------^ zacharycarter: what type is the variable? yumaikas: string/int, in most cases zacharycarter: int is fine zacharycarter: string is not zacharycarter: you could move the string to the thread but the original reference to the string would become unusable zacharycarter: if you're using `--gc:arc` yumaikas: I'm not planning on using arc, due to this being a webapp, where non-arc would probably be a better fit zacharycarter: otherwise look at this issue" https://github.com/nim-lang/RFCs/issues/142 yumaikas: Hrm.... Willyboar: disruptek i am here if you need feedback for your game :P yumaikas: dom96: Do you have any recommendations on how to handel global/config type things in jester? Zed: disruptek's making a game?? what sort? Willyboar: I dont know yet Zed: lol Willyboar: maybe is a secret yumaikas: dom96: Or do you just live with globals giving memory access warnings? zacharycarter: yumikas: jester uses httpbeast which relies on multiple threads - maybe look into its implementation zacharycarter: ultimately if memory is accessed by threads and it's allocated on the heap, it's access needs to be synchronized zacharycarter: and remember Nim's default GC uses a thread local heap so threads can't access eachother's heap zacharycarter: so you need to either pass pointers and ensure lifetimes of allocations or you need to use channels zacharycarter: or you can manually manage memory and allocated from the shared heap zacharycarter: or use `--gc:arc` / `--gc:orc` which will eventually become the default memory management solution for Nim zacharycarter: yumaikas ^ sorry I misspelled your handle skrylar[m]: huh. well a logfmt module went a lot faster than i thought skrylar[m]: i suppose telemtry would be the same as defer ... macro to bolt on to functions or blocks, have it just write the enter/exit calls disruptek: i hate defer. Rika: why? disruptek: !rfc try scope author:disruptek disbot: https://github.com/nim-lang/RFCs/issues/218 -- 3try/except scope -- should it be a thing? shashlick: @leorize took your advice on the ABI issue, see my last comment Yardanico: Guess it was easier than I expected (compiling Nim for KolibriOS) https://i.imgur.com/IiJUw2G.png Yardanico: os:any ftw Yardanico: now need to port the simplest GUI example from C to Nim :P Yardanico: oh, I don't even have to use makefiles now, can do it fully with nim.cfg Yardanico: https://i.imgur.com/6BVHzyN.png Yardanico: https://i.imgur.com/nLI6wYh.png Yardanico: although I still need to do "objdump hello -O binary" manually after that Avahe: @Elegant Beef So I accidentally fixed an issue with maim which I thought had to do with xatoms, but didn't. What application were you using to test fullscreen requests? Never Listen To Beef: Firefox/chrome Prestige: Cool, thanks Yardanico: new day, new bug reports :P https://github.com/nim-lang/Nim/issues/14240 disbot: ➥ [ARC] C compiler error with dynlib pragma calling a proc ; snippet at 12https://play.nim-lang.org/#ix=2kY9 Prestige: @Elegant Beef got it working for a couple browsers but firefox seems to be doing something different with atoms Never Listen To Beef: Interesting Never Listen To Beef: I dont get a fullscreen property Never Listen To Beef: So i guess i do something wrong dadada__: can I get a value from every proc/func/expr, even if the expression doesn't return something, ie. void type, pseudo code: let valOrVoid = funcReturnsValOrVoid() Yardanico: "let valOrVoid" there's your problem Yardanico: variables can only have one type ;) Yardanico: unless you're in a generic proc of course Yardanico: or something like that dadada__: I know, I'm looking for a workaround, doesn't need to be beautiful Yardanico: well I don't understand on what do you need it for :P dadada__: probably can use https://nim-lang.org/docs/system.html#compiles%2Cuntyped dadada__: to make the workaround Yardanico: well yeah but the variable still only can have one type in most contexts Prestige: @Elegant Beef still need to figure out why ff is sending different atoms.. vivaldi is sending the correct atoms but it doesn't seem to launch properly at all (invisible ui and errors in the console) Yardanico: I would've recommended compiles if you explained better :P Prestige: I'll link my current branch when I push so you can see what I did Never Listen To Beef: Yea idk im putting my wm on brak for a bit Never Listen To Beef: break* Prestige: Oh ok Never Listen To Beef: I've got issues with gnome software Never Listen To Beef: well GTK stuff Never Listen To Beef: Also im glad math contains Tau Never Listen To Beef: Im happy for tau Prestige: Tau? Yardanico: yeah and my mathexpr lib uses and exposes it to the user :P https://github.com/Yardanico/nim-mathexpr/blob/master/src/mathexpr.nim#L230 Never Listen To Beef: Yea tau is the best circle constant Yardanico: Prestige: https://en.wikipedia.org/wiki/Turn_(angle)#Tau_proposals Rika: wow. that sucks, i always did think tau was more intuitive than pi Rika: when it came to circles Prestige: Oh, neat Never Listen To Beef: Yea tau is, considering it's a direct degrees/360 to get it to a tau ration Never Listen To Beef: ratio* Rika: ayy, client.py of slider (an osu (the game) utility library) has been fully translated now Rika: https://cdn.discordapp.com/attachments/371759389889003532/707477569695645716/unknown.png Prestige: @Elegant Beef if you're interested anyway: https://github.com/avahe-kellenberger/nimdow/commit/1a9cfd1cc8c2b818a7812cade141dc8735ccffab Never Listen To Beef: So wait you get proper fullscreen properties inside the property change event? Prestige: That's the next step I suppose, atm I'm just listening for ClientMessages Never Listen To Beef: Oh Never Listen To Beef: That's a thing?! Prestige: Read this: https://github.com/avahe-kellenberger/nimdow/issues/12 I made a summary disbot: ➥ Fullscreen windows are not respected Never Listen To Beef: I dont get why we have client messages and property changes Prestige: Idk but it's probably one of the reasons Wayland exists lol Never Listen To Beef: Lol voltist: Anybody got any idea why `1/(1-exp(-(V-v2)/ka))` would give drastically different results to equation 4 in https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0218738&type=printable Rika: what page is equation 4 Prestige: Can you put it on play.nim-lang.org for us lazy folk? Rika: 5? voltist: Could it be that I have to write those ones as 1.0 to make the nim get it? voltist: Yeah I'll put a sample up voltist: It's on page 5 Rika: no, / is float div Rika: it should be the same, what are you getting from eq.4 narimiran: voltist: put in the comments what do you get from a calculator, so we can see the difference voltist: I'll have to look through the paper to find one of the points the equation was fitted to in order to do a proper comparison voltist: Because the nim playground won't do graphs Rika: afaik nim playground has popular packages installed Yardanico: well not a lot voltist: https://play.nim-lang.org/#ix=2gcb voltist: Does that work? I've never used nim playground before Yardanico: try to patse again Yardanico: it seems to be the wrong link Yardanico: http://ix.io/2gcb is not nim :D voltist: No it's right narimiran: copy-paste in your own browser before pasting a link here ;) Yardanico: ? voltist: https://play.nim-lang.org/#ix=2kYw voltist: That should work narimiran: yeah, that one is better :) voltist: This could just be a case of me missreading and typing it in wrong, but I haven't been able to find any mistakes yet narimiran: my calculator gives the same value as nim voltist: Weird narimiran: for first case narimiran: for the second one i get waaaay different result Yardanico: because it should be + and not narimiran: oh no wait Yardanico: - narimiran: no, my parentheses were wrong Yardanico: ah wait nvm narimiran: the same result in both cases narimiran: voltist: are you sure that your article didn't use lower-precision floats so the article is wrong(er)? voltist: I doubt it voltist: More likely they just haven't labelled things right voltist: I'm comparing it to the red line (m subscript infinity) on the top left chart on here: https://ndownloader.figshare.com/files/15665561/preview/15665561/preview.jpg PMunch: Where do you get ka and vh from? voltist: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0218738 -> supplementary information -> second document voltist: Top section voltist: First section* voltist: SHL1 voltist: The figure I get is pretty whacky: https://liamsc.com/figure.png PMunch: Aren't their voltages measured in mV though? PMunch: According to the label on the graph voltist: Yep voltist: But I'm working entirely in mV so it shouldn't matter PMunch: I still don't see where you get ka and vh from.. voltist: ka is k subscript a PMunch: Ah, nvh found the document you were talking about voltist: And VH is "V subscript 0.5" voltist: Yeah PMunch: What is vh.. It's given as 11.2 (-6.8) which is weird.. voltist: Thats the variation I cover in the snippet on nim playground voltist: Either way, it produces weird results PMunch: Yes, I can't get it to give anything close to that table.. Rika: is that calculated or empirical :thonk: voltist: What could be calculated or empirical? Rika: no clue, its been a few weeks since ive read a published work voltist: Yeah this is really weird voltist: It seems the equation and parameters they gave don't at all describe what they show dadada__: is there any standard way to catch stuff that is going to stdout in a variable instead dadada__: like a macro stdoutTo var: dadada__: writing unit tests currently, and it could be useful there Vindaar: @voltist: it really doesn't make any sense. It can't be `1 / (1 - e^-x)`, because that as a singularity at 0, which their function obviously doesn't have. I'd be pretty surprised if they had such a typo in it, but the function they plot is `1 / (1 + e^-x)`(in contrast to h_inf which is `1 / (1 + e^x)`). Vindaar: but maybe I'm just still too tired and can't think properly... :) Yardanico: @dadada__ I don't think so, although I guess you could shadow echo and/or `stdout` in your macro/template voltist: @Vindaar It is very weird Vindaar: in addition they talk about "boltzmann-like functions". To be honest, I don't know the term boltzmann function for something like this. But googling brings up a boltzmann sigmoid: https://www.graphpad.com/guides/prism/7/curve-fitting/reg_classic_boltzmann.htm and that's also what I said above voltist: So you think they accidentally swapped one of the symbols around? eagledot: Could somebody be please able to look at this . voltist: Also thanks for the link eagledot: https://play.nim-lang.org/#ix=2kYM eagledot: It is crashing with default gc used and giving different results with arc.Only works everytime if i donot use any gc. ⏎ I posted this yesterday also.I am stuck on this donot know what am i doing wrong or is it NIM bug. Vindaar: @voltist: I have no idea. I've seen all sorts of craziness in papers, but something so obvious in so many different places seems fishy. I'd have to properly read what they're writing. Can take a look later. Gotta be in a meeting now voltist: @Vindaar Ok, cya round voltist: @Vindaar Hmmm, putting their values into that general Boltzmann sigmoid doesn't work either. Unfortunately they haven't published the code for their simulation, so we can't check that Vindaar: this is what I get for different ka: Vindaar: (https://files.gitter.im/nim-lang/Nim/3JOq/activation.png) Vindaar: V_h is just the position at which m_inf = 0.5 PMunch: @eagledot, where does it crash? PMunch: Do you get any stack trace? PMunch: Can you share the test4.wav file so we can try the code? PMunch: Is this a minimal sample? voltist: @Vindaar That seems reasonable voltist: As you say, the consistently contradictory equation in the paper is strange Vindaar: @voltist: code I used: https://play.nim-lang.org/#ix=2kYZ Vindaar: would be interesting to extract data points from the plot they show, fit this function and see what the resulting fit parameters would be for vh, ka voltist: Yeah eagledot: it just says out of memory with default eagledot: https://gitlab.com/eagledot/webrtcvad-nim ⏎ Everything is in there voltist: I might contact the authors and inquire about the apparent mistake voltist: Once I'm sure that we aren't just missing something dom96: yumaikas, yeah, global with threadvar if you want to use threads PMunch: Not sure how the Nim GC handles stuff like this: https://gitlab.com/eagledot/webrtcvad-nim/-/blob/master/webrtcvad_nim.nim#L100 eagledot: what do you mean?? ⏎ How should i change it?? PMunch: And does new even work with regular object types? I thought that was supposed to only work for ref types.. Yardanico: !eval type A = object; echo typeof(new(A)) Recruit_main707: it doesnt, does it? NimBot: ref A Yardanico: it creates a reference to an object PMunch: Huh, so it creates it on the heap and gives you a reference when you do that? PMunch: Didn't know Yardanico: neither did I, but I really don't use new() PMunch: But what he does, casts it to a ptr and returns that ptr, that doesn't work right? Yardanico: yeah I don't think that it's correct PMunch: Or it works, but it would trip up the GC voltist: @Vindaar It's also strange that the V0.5 of their plots seems very different from their parameters Yardanico: right now I'm trying to hack the copied jsgen backend to output processed nim AST as Nim code :P Recruit_main707: !eval type A = object; var a: A = A(); echo(typeof(a)) NimBot: A Yardanico: yeah that's not a reference PMunch: eagledot, basically what you want to do is to return simply a vadObj or a ref vadObj and then use .addr to get a pointer that you can pass to the C stuff Recruit_main707: i know :p PMunch: (And may I suggest reading the NEP1? This code is a bid hard to read) eagledot: Ok:) ⏎ Will try that. ⏎ I am a newbie just trying to make it work:) eagledot: Can u confirm that was the only error.Could u run it? PMunch: Sorry, I haven't tried it PMunch: Okay, did the changes and tested it. Seems to run, but not sure if it does what it is supposed to do :P PMunch: eagledot: http://ix.io/2kZ9 eagledot: I think it is working:) ⏎ was Stuck on it for two days. ⏎ Seems like `new ` was not a great idea? PMunch: Well, the problem here is that you create a garbage collected object (new(vadObj)) then just get a pointer to that and leave the reference behind. So the garbage collector comes around, sees that no-one is referring to the object, and cleans it up. PMunch: More or less eagledot: I get it...but i think i tried first using reference as a pointer on a sample code .Seemed to work that's why i used ,didnot know it would trip the gc so bad!! dadada__: Error: unhandled exception: sempass2.nim(396, 19) `b[j].kind == nkType` [AssertionError] dadada__: potential compiler bug` dadada__: ? dom96: any assertion failure in the compiler is a bug eagledot: But i understand now that i returned only the pointer disturbing the normal way. PMunch: eagledot, the reference object isn't really the issue: http://ix.io/2kZc PMunch: As you can see that also works fine PMunch: But just discarding the reference object in favour of a ptr to the object doesn't work PMunch: Because Nim now thinks you're not using it Recruit_main707: dadada: i think its not, i remember something about this, i feel its how macros should work, but its not, this is how i do it: https://play.nim-lang.org/#ix=2kZd maybe its the same case as yours Yardanico: modifying the AST in macros usually is not good Yardanico: it's much better/safer to create new AST nodes in macros and returns these instead Yardanico: i mean modifying the AST you got as arguments eagledot: Yes i understand more clearly now. Thanks:) dadada__: Recruit_main707: did you really mean me? PMunch: You could also use the system/ansi_c module to use malloc directly, and then free it yourself manually later on. But of course then you're back to C style manual memory management eagledot: Yes I used malloc when i couldnot figure out. ⏎ If i create something in a function and doesnot return it then it means gc can collect that ? Recruit_main707: yes, node kinds sometimes dont match ehst you would intuitively think PMunch: eagledot, yes PMunch: Of course if they are created on the stack they will be automatically cleaned up when the stack frame pops. If they are on the heap then the references will go out of scope when the stack frame pops and the GC will be able to free them. PMunch: This might help a bit: https://peterme.net/nim-types-originally-a-reddit-reply.html eagledot: OK.Yes. ⏎ I saw your talk . ⏎ Then read it. ⏎ I understand a quite bit about stacks and heaps...but i this case i was in doubt that gc will not free this and takes care even if i am casting..Well i was wrong:) [https://gitter.im/nim-lang/Nim?at=5eb28690f0377f16316d6a8b] eagledot: I was hoping more from the talks for running nim from microcontrollers and IOt..but nonetheless enjoyed it. eagledot: on* PMunch: I want to do more on the topic PMunch: But it's a bit limited how much fun you can go through during a 20 minute talk eagledot: Well,if you have more resources for running nim on microcontrollers or can let me know if develop more on this topic.Please let me know. ⏎ I found nim quite fascinating after knowing enough python and C. PMunch: Not so much in terms of resources unfortunately.. PMunch: But that's just because I haven't found the time to write all of it down yet :P EdgyNerd: what's the best garbage collector if I want more performance and don't really care about memory usage (as long as there isn't any leaks)? Recruit_main707: arc Recruit_main707: if you use async, orc Yardanico: if you don't have cycles, compare default vs arc Yardanico: if you do, default (refc) vs orc Yardanico: arc is still sometimes slower than the default GC, but it's really better since it's deterministic PMunch: EdgyNerd, the one that performs best when you benchmark you code clyybber: @EdgyNerd memory regions :p clyybber: Or essentially, arc but use your own refs clyybber: If you don't care about memory usage, you can do arena allocation clyybber: Useful for games clyybber: Since you can just do whatever you want in a frame/tick and only free at the end of the frame/tick clyybber: If you simply use objects more and have an updateTick proc, then stack allocation will do fine clyybber: arena allocation is a bit like stack allocation but independent from the stack clyybber: But you don't need to care about all this, just use arc or boehm or the default gc :) EdgyNerd: just tested them all, they're all basically the same (within 0.08 seconds) clyybber: \o/ EdgyNerd: apart from boehm which is 0.1 seconds slower dom96: clyybber: what guarantee do you have that the `free` won't take too long? :P dom96: what you really want is Nim's amazing soft real-time GC Yardanico: @EdgyNerd can you try with -d:boehmNoIntPtr just for fun? clyybber: dom96: I don't have any, but a single free at the end of the frame is simpler than a full blown GC clyybber: And if you use a simple bump allocator dom96: clyybber: it'll never be a single free though, you'll always have many different objects to free clyybber: dom96: If you use a bump allocator then its a single free clyybber: You would free all at once liblq-dev: does Nim have any limit on a proc's parameter count? dom96: cool, can we implement that in Nim? clyybber: dom96: Sure EdgyNerd: -d:boehmNoIntPtr is 1.5 seconds slower EdgyNerd: @ Yardanico Yardanico: ah ok Yardanico: liblq-dev: lemme try :P PMunch: liblq-dev, good question. I guess it might depend on the OS? mratsim: @EdgyNerd performance depends on the application, if you optimize for throughput it's Boehm or markandsweep, if you optimize for latency it's the default GC liblq-dev: like, the largest amount of params I ever had was 15 which is not that much considering it's really just a constructor clyybber: dom96: Actually its pretty much already there: https://github.com/nim-lang/Nim/blob/devel/lib/system/gc_regions.nim mratsim: if you now the max memory reserved, just use an Arena dom96: clyybbeer: ahh yes, I remember that. There was an idea that Araq had to free memory after every request for http servers dom96: which could work Recruit_main707: why do slices use gced memory? mratsim: they own their memory mratsim: use `toOpenArray` instead (yeah it sucks) clyybber: dom96: Yeah, nowadays it is possible to implement it via =destroy hooks in arc mratsim: but there are comment in multiple RFCs related to openarray as value types to change slicing to return openarray instead of seq Recruit_main707: isnt toOpenArray slow? clyybber: no dom96: mratsim: is zah on holiday? Haven't been able to get in touch with him over gitter clyybber: dom96: Try telegram clyybber: he was active yesterday I think EdgyNerd: also, --gc:regions is 4.5x slower for some reason dom96: clyybber: don't know his username mratsim: toOpenArray is basically moving a pointer + length mratsim: He is on the Nim FOSDEM groups 😉 clyybber: dom96: I'll ping you on telegram Yardanico: liblq-dev: doesn't seem so Yardanico: well it depends on the C compiler too Yardanico: by the C standard the C compiler should allow for at least 256 arguments iirc Yardanico: https://i.imgur.com/99lTPRt.png PMunch: dom96, he was here yesterday according to the IRC logs PMunch: Oh wait PMunch: Not zah.. Yardanico: the compiled C file loogs amazing Yardanico: looks* https://gist.github.com/Yardanico/1147d47c20d9c47a9df170d5e0c81c70 mratsim: 256 arguments seem ... excessive ... clyybber: liblq-dev: Why though? liblq-dev: idk, I was asking out of curiosity Yardanico: lemme try to add the 4th letter PMunch: Haha, that looks amazing PMunch: Imagine finding that in some project Yardanico: nim https://gist.github.com/Yardanico/6adb800ca7419a7351ef4fe7ab6e39d4 Yardanico: poor github gave up on trying to highlight the first line Yardanico: I think I went a little overboard Yardanico: the nim source file is 724kb Yardanico: let's see if the compiler crashes or not Yardanico: vscode kinda gives up Yardanico: oh right nim compiler gave up too, it doesn't show the colon number anymore Yardanico: but it still reports if there are keywords, let's see if I can fix them all Yardanico: poor poor vscode Yardanico: vscode froze, nice kodkuce: hmm i wish micro head plugin for nim 😦 PMunch: Haha, what script are you using to generate these Yardanico? Recruit_main707: can we use nim slp w/ visual studio?? Recruit_main707: lsp* PMunch: Why not? Recruit_main707: its just that i dont know how it works :p Recruit_main707: no highlight though 🤔 Yardanico: PMunch: it actually worked 0_0 PMunch: What? Yardanico: both nim compiler and C compiler somehow compiled it Yardanico: lemme count number of arguments PMunch: With all four letter combinations? Yardanico: not all PMunch: I guess the answer is "don't worry about it" Yardanico: 123 thousand Yardanico: XDDDDDDD Yardanico: and nim compiler actually handles that perfectly fne Yardanico: lemme try exportc Yardanico: still works Recruit_main707: can you use them though Yardanico: yes Recruit_main707: nim op Yardanico: I'm using the random argument and returning it Recruit_main707: finally all the people that need to pass 123 thousand arguments to their functions can code PMunch: Haha :P PMunch: Okay that is pretty amazing PMunch: Do you have your script? PMunch: I want to try 5 letters Yardanico: yeah I'll improve it a bit and share Yardanico: but it's inefficient anyway PMunch: 5 letters, the nim source file comes out to 102M PMunch: Compiling.. Yardanico: PMunch: https://play.nim-lang.org/#ix=2kZu Yardanico: seems like collect + newSeqOfCap made it much faster Yardanico: I only use lowercase because case insensitivity ;) PMunch: Well look at you Mr. fancypants :P Yardanico: I get 80mb with all lowercase for 5 letters Yardanico: trying to compile PMunch: This is the script I'm using: http://ix.io/2kZv Yardanico: nim compiler uses 900mb ram Yardanico: 1gb Yardanico: its still growing XD Yardanico: 1.2gb Yardanico: I think at this point the C compiler may fail PMunch: 1882Mb here atm Yardanico: 1.4gb PMunch: 2Gb Yardanico: lol PMunch: I'm going to run out of RAM at this rate.. Yardanico: I have plenty of ram left :P PMunch: This poor machine only have 8Gb PMunch: But I've got 8 more in the mail Yardanico: nice Yardanico: 1.6gb, seems to grow slow PMunch: Yeah.. PMunch: Mine is at 2.3Gb now Yardanico: I couldn't find info on most allowed number of arguments in GCC PMunch: 2.4Gb narimiran: i have no idea what two of you are doing, but it seems like you're having a blast :) PMunch: Haha, we're trying to see how many arguments you can have in a Nim procedure Yardanico: narimiran: compiling a 80mb nim file with a single proc which has A LOT of arguments narimiran: :D Yardanico: yeah my compiler at 1.9gb now PMunch: Currently trying all five letter (lowercase) combinations of arguments PMunch: Mine is 102M PMunch: I wonder why mine is so much bigger.. PMunch: Do you not have spaces between your commas? Yardanico: I have spaces PMunch: 2.7Gb here Yardanico: data.join(", ") kodkuce: lol Yardanico: well nim compiler seems flexlible enough Yardanico: PMunch: but did you account for keywords? Yardanico: :D PMunch: Nah, I put them all in `` Yardanico: ah lol Yardanico: that's smart PMunch: ;) Yardanico: btw https://github.com/nim-lang/Nim/pull/14241 disbot: ➥ make `from` an operator PMunch: Or temple rather.. PMunch: Can't open that until I'm done Yardanico: xd PMunch: My browser has a few too many tabs open Yardanico: 2.2gb ram now PMunch: Currently at 3Gb Yardanico: wtf Yardanico: will it ever end PMunch: Who knows PMunch: I wonder how far along it is PMunch: brb Yardanico: well it takes 7 secs to compile (including the C step) a 3.5mb file dom96: hehe, I tried to obfuscate Nim's C code using my obfuscator and it crashed Recruit_main707: its already pretty obfuscated Recruit_main707: :P Yardanico: well not really Yardanico: if you compile --gc:arc -d:danger it'll be pretty clean PMunch: Damn it.. Yardanico: https://github.com/nim-lang/Nim/commit/b8e6ea7547344389b5e45c3af249fee9642f028e nice Yardanico: bit slices PMunch: When I generated the file I ran it with `nim c -r test > outp.nim` Yardanico: PMunch: yeah I did that at first too PMunch: And Nim sometimes outputs the CC: test.nim line into the file when you do that.. PMunch: Not always, but sometimes Yardanico: hahaha I understand PMunch: But it had in this case, and it crashed.. Yardanico: rip Yardanico: my PC crashed because I launched the second one with 20mb nim file but for some reason my RAM usage spiked to 100% and OOM doesn't work well on Linux :P Yardanico: OOM killer* PMunch: Hahaha PMunch: Mine is getting back up there, currently at 2.3Gb memory PMunch: 3.4Gb Recruit_main707: PMunch, can you help me setting up lsp for vs? PMunch: Sure Recruit_main707: i case you know that is PMunch: Huh? Recruit_main707: i was not sure if you knew how to do it in vs PMunch: Just let me grab some lunch first, I'm getting quite hungry sealmove: Hey, I have a seq[byte] and I want to be able to read various integer lengths. Currently I do this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ But it's most likely inefficient. How do I involve casts correctly? [https://gitter.im/nim-lang/Nim?at=5eb29d200b23797ec065c96c] sealmove: My type being: ⏎ ⏎ ``` BitStream = ref object ⏎ data: seq[byte] ⏎ pos: int``` [https://gitter.im/nim-lang/Nim?at=5eb29d5c3d58de7a38f9aa61] PMunch: Holy moly! It jubped to 7.3G Yardanico: PMunch: yeah probably that's why my PC died federico3: Yardanico: try oomd PMunch: 11.1G virtual.. Yardanico: well virtual is virtual Yardanico: apps can use 20TB of virtual memory with no problem PMunch: At this rate it'll fill my swap as well.. PMunch: It's gone down to 7.1Gb now Yardanico: inb4 C compiler segfaults PMunch: Haha yeah Yardanico: "Error: internal error: environment misses: mixNumOpened" huh Yardanico: guess a yet another arc-related bug, need to investigate more :P Yardanico: yeah nice I reproduced it Yardanico: :DD PMunch: Hmm, now it's just chilling at 15% CPU but at 7Gb memory consumption.. PMunch: And the file in cache isn't growing, so it doesn't appear to do io PMunch: @Recruit_main707, you wanted help setting up nimlsp? Recruit_main707: ye, i asked it in offtopic so that i dont fill this channel with dumb questions PMunch: Ah you, pinged me with the wrong name :P PMunch: Hmm, the compiler just quit with error code 137 PMunch: No explanation.. Yardanico: that's SIGKILL PMunch: If anyone with some spare RAM wants to give it a go: http://ix.io/2kZJ Yardanico: probably OOM killed it Yardanico: OOM killer* PMunch: Yeah I'm guessing so kodkuce: i have 16gb can test if want kodkuce: just giv me script kodkuce: tough free gives me Mem: 13Gi 676Mi 11Gi 51Mi 1.1Gi 12Gi duno why it reports 13 insted 16 PMunch: kodkuce http://ix.io/2kZJ PMunch: Compile that, and run it with output to another Nim file PMunch: Then compile and run that Nim file kodkuce: nim c >> tada.txt ? kodkuce: any flags or just this kodkuce: flags/args arc danger ... ? kodkuce: with run? kodkuce: nim c -r > report.txt kodkuce: ok will run it like this kodkuce: hmm it finished wtf Yardanico: that's just creating the file Yardanico: now you need to "nim c -r report.txt" kodkuce: to run it or to ouput it again to somwere? kodkuce: i change it to report.nim cuz beh kodkuce: anyway kodkuce: ok will run it now kodkuce: its running duno if i should have used > so terminal output does not slowdown kodkuce: anyway atm 800mbs kodkuce: is there some multythread option fo compiling kodkuce: my cpu usage only 14% and i have broswer opend PMunch: --parallelBuild PMunch: With a number of processors PMunch: But it default to 0 which is auto-detect kodkuce: oh , duno if should restart now just reached 1.7 GB Yardanico: PMunch: that won't help Yardanico: nim compiler itself is single-threaded PMunch: Oh, that is only for passing to the C compiler? kodkuce: nim compile time sux 😄 Yardanico: PMunch: yeah kodkuce: ok i go cook something to eat Yardanico: be careful Yardanico: you might hit 100% ram usage mratsim: The nim compiler speed is OK though, much faster than C++ or Rust mratsim: The slow things are generics, especially recursive (but they are still OK), and concepts dom96: what about macros? Anyone did any benchmarks? mratsim: I didn't but macro that don't involve types (getTypeInst in particular) are fast Araq: dom96: IME macros are fine, the VM is good. but of course you can run arbitrarily complex code inside a macro mratsim: the main issue with macros is that they tend to make nimsuggest run to 100%CPU ... kodkuce: 2.4 GB 😦 mratsim: Arraymancer needed 3GB of RAM to compile with the whole suite in 0.20 after adding complex supports, now it's back to 1.2GB iirc on 1.2 kodkuce: anyway Nim has incremental compiler right so its not issue like in C++ where you w8 forewer mratsim: it's not implemented kodkuce: oh 😦 clyybber: @kodkuce Not yet clyybber: But we are still faster :p mratsim: way faster dom96: we should really write an article explaining this clyybber: @kodkuce So no, nim compiler is not slow, but your generated code is crazy :) clyybber: of course slow is subjective, so.. dom96: most people assume that since we have two compilers effectively that we have the slowness of C++ and whatever speed Nim has dom96: but I assume that we actually generate C++ that compiles quickly mratsim: I'm surprised someone managed to generate code crazier than zero-functional, npegs or the macro I have in Arraymancer/Laser kodkuce: i know this is crazy test i did not have any copiler slownest issue at least for my simple stuff, duno how would it be on big project kodkuce: anyway hope incremental will be a thing 1 day kodkuce: it really sux week ago i compiled godot head to w8 20 mins Yardanico: @mratsim nim-regex macro is also pretty "interesting" :P mratsim: I hope the compiler doesn't try to recompile files added via {.compile: "foo.c".} over and over. That's one thing that is slow Yardanico: @kodkuce enough with jokes :P kodkuce: 2.7gb Araq: mratsim: it doesn't do that, it uses checksums on the .c files to see if they changed Araq: however, it puts the object files into nimcache/ and nimcache is project specific shashlick: Araq how about compiling Nim stdlib files in a global namespace, that way those are only recompiled occasionally clyybber: shashlick: But we also have dead code elminiation clyybber: The generated C files aren't the same most of the time Araq: shashlick: the stdlib is one thing, external .c files another Araq: there is no reason why we don't use nimcache/external for all external .c files shashlick: Ah dead code Araq: dead code and also generics, use a fresh Table and see tables.nim.c grow :P shashlick: Thinking about https://github.com/nimterop/nimterop/issues/205 disbot: ➥ using zig to generate cross platform wrappers Araq: shashlick: why not instead copy "zig"'s idea, use clang to parse the C(++) code Araq: (it's not like nobody else had this idea before...) shashlick: The clang ast? kodkuce: wtf it stoped before it reached full mem kodkuce: Hint: report [Processing] kodkuce: /home/me/Downloads/NimTest/report.nim(1, 1) Error: undeclared identifier: 'CC' Yardanico: yes Yardanico: because your file contained output from nim itself too kodkuce: hmm what what kodkuce: did i do something wronk? Yardanico: kinda clyybber: Yardanico: Yay, my fix works for the return case too now :D Yardanico: nice :) Yardanico: I'm in the process of minimizing another crash with --gc;arc (ICE in the compiler) Yardanico: ok done :P Yardanico: hmm clyybber: oh nice :D Yardanico: actually it might be not a bug, but just a fact that destructors don't support -d:nimOldCaseObjects or something kodkuce: so hmm kodkuce: should i rerun or what kodkuce: if you need me still Yardanico: https://github.com/nim-lang/Nim/issues/14244 not sure if this is supposed to compile at all disbot: ➥ [ARC] ICE when changing the discriminant of a return value ; snippet at 12https://play.nim-lang.org/#ix=2l06 Yardanico: I wasn't able to make an example without object variants Yardanico: I mean it fails at runtime with default GC and asks to add -d:nimOldCaseObjects dom96: shashlick, I don't get it, what does Zig buy here? zacharyc1rter: ooo Zig talk Yardanico: dom96: I think it's about using zig to cross-compile the libraries themselves Yardanico: ah no Yardanico: I didn't understand shashlick: So nimterop relies on the build tools and preprocessor doing their thing and cleaning up the headers Araq: and then what, this is all so stupid. so yeah, here is a Windows binary for you that I built on my Linux machine. Does it work for you? - Nope, it crashes, now what? - Oh, I think I don't support Windows then, sorry shashlick: See https://github.com/nimterop/nimterop/blob/master/README.md#why-nimterop Araq: and that my friends is the new hot shit in 2020 when you can setup a CI to build and test (!) on every major OS shashlick: His idea is to use zig so that it can be done across many platforms disruptek: honestly, i would rather leverage as much outside tech as possible. Yardanico: good morning disruptek Araq: his "idea" amounts to spam. disruptek: parsing C++ is not a competitive advantage. shashlick: It still doesn't address the fact that libraries often depend on the presence of other libraries disruptek: howdy, folks. zacharycarter: I cross compiled from MacOS to Windows but I didn't use zig and the windows binary worked zacharycarter: so you don't need Zig for this, just a cross compilation toolchain zacharycarter: I'd rather install that than LLVM and Zig shashlick: And cmake and similar do a lot of package detection as well which will won't be covered disruptek: i would rather target zig. Yardanico: @zacharycarter well the point with zig is that it's all already precompiled with static binaries for you Yardanico: just easier to use zacharycarter: is it? Yardanico: so you don't have to install llvm separately and whatnot Yardanico: yes Yardanico: you download a single archive disruptek: why not have a whole community of developers implement and support our backend? zacharycarter: yeah but then I have to learn how to use Zig Yardanico: ? Yardanico: wdmy Yardanico: wdym* Yardanico: "zig cc" acts *almost* like clang zacharycarter: if I just download a Zig binary I still have no idea of it's cl interface shashlick: It's a convenience factor of being able to run the library thru cmake and the preprocessor on one configuration shashlick: export CC="zig cc" is all that's needed dom96: bah, of course, because the header files that nimterop generates are OS specific shashlick: They are os, compiler and package specific Araq: disruptek: I'd use c2nim and maybe replace its parser by libclang Araq: nothing else really works and our ecosystem *needs* the quality of hand written wrappers dom96: Araq: I literally wrote a Uni dissertation which uses libclang in a Nim program Araq: it's just my opinion, of course, but this idea that having 20 fragile wrappers instead of 5 good ones seems madness to me dom96: I've had my eye on reusing my wrapper to generate C/C++->Nim wrappers. dom96: I can open source it if someone wants to give it a shot Araq: Yardanico: I don't care about this "almost like", if we support it, me must ensure it keeps working. Araq: and I don't want another factor of 2 for our CI matrix dom96: `zig cc` is literally a C compiler dom96: I don't see what is "almost like" about it Araq: yeah, an *unsupported* one. zacharyc1rter: wait but if you change the compiler assembler and linker wouldn't nimterop use those instead? zacharyc1rter: isn't there a way to override and say nimteorp work for this specific os / arch? shashlick: Yes that's my whole point shashlick: I delegate to cmake to discover and configure shashlick: I delegate to the preprocessor zacharyc1rter: so this is specifically a cmake issue? zacharyc1rter: if you're not using nimterop with cmake it doens't matter? shashlick: Nimterop only processes headers after all that is done zacharyc1rter: also you can pass options to CMAKE shashlick: That makes the wrapper platform specific zacharyc1rter: liek `set(CMAKE_SYSTEM_NAME Linux) zacharyc1rter: set(CMAKE_SYSTEM_PROCESSOR arm) shashlick: But I don't see why it makes it fragile Araq: please (and I'm getting mad here), please understand why in the real world Super Mario Brothers 10 doesn't run on FreeBSD. Araq: hint: it's not because the devs cannot setup a cross compiler... dom96: shashlick that sounds extremely more fragile than a known-to-work wrapper that is committed to git dom96: if I have to depend on cmake of all things then I really do not have a lot of trust in the software zacharyc1rter: a lot of projects use cmake though Araq: it's because you then need to support the software commercially on an OS no gamer is interested in shashlick: C library authors rely on such tools dom96: Why can't nimterop generate a wrapper ala c2nim's? dom96: shashlick there is a reason I avoid building my own libraries with a passion dom96: and use pre-built binaries whenever I can dom96: Pretty sure most people are like this Araq: dom96: I don't anymore but I upload my DLLs to github now mratsim: C++ libraries are successful despite cmake, not thanks to ... clyybber: shashlick: I'm currently trying building nimph and I'm getting this: /home/clyybber/.cache/nim/nimterop/cPlugins/nimterop_790929175.nim(1, 24) Error: cannot open file: nimterop/plugin clyybber: [AssertionDefect] [AssertionDefect] mratsim: Compiling any C++ library that depends on Cmake requires booking a weekend for that mratsim: even popular ones like OpenCV clyybber: shashlick: Do I need to compiler plugin too? shashlick: Clyybber that's fixed in head clyybber: I am on head clyybber: I just git cloned zacharyc1rter: mratsim that's not true, come on shashlick: Nimterop head? zacharyc1rter: usually compiling with cmake involves `mkdir .build && cd .build && cmake .. & make clyybber: shashlick: Yeah, on the default branch zacharyc1rter: maybe a make install clyybber: shashlick: I didn't use nimble build tho clyybber: But instead nim c clyybber: to compile toast clyybber: And that worked fine clyybber: Do I also need to compile nimterop/plugin.nim? dom96: zacharyc1rter: mratsim is completely right zacharyc1rter: C++'s build tool scene is a nightmare in general and CMake isn't that offensive zacharyc1rter: no, he's not... you're bashing CMake when in reality all of the project generators are annoying clyybber: generators generating files for other generators is indeed crazy Araq: the only problem with cmake is that generates a makefile. it's like somebody wrote a dependency graph analysis in 1970 and everybody is too scared to simply re-implement it. I did it in Python, was under 100 lines of code clyybber: So yeah, at least CMake is simpler than a lot of the other stuff zacharyc1rter: I'm not advocating that CMake is ther ight tool zacharyc1rter: but this is what almost every C++ project generator does zacharyc1rter: premake, cmake GENie, etc... Araq: but at least cmake runs on Windows without cygwin crap zacharyc1rter: CMake is simply the most widely used one mratsim: 2 days trying to get OpenCV to compile and link properly mratsim: https://cdn.discordapp.com/attachments/371759389889003532/707586616381800499/unknown.png zacharyc1rter: if it was premake you'd all be complaininga bout that mratsim: and then 6 months later, CXX11 ABI changes or whatever, I couldn't link with openexr clyybber: shashlick: Any idea? zacharyc1rter: well that's C++'s fault shashlick: Sorry laptop crashed and phone is lagging shashlick: Brb Araq: there was literally a single cmake setup that lead me build Z3 mratsim: I also lots of issues due to those "findCUDA" "findFFMPEG" etc scripts mratsim: it's really awful zacharyc1rter: okay those are annoying I'll give it that zacharyc1rter: the CMake modules Araq: oh yeah, the scripts are much worse than anything I've ever added to koch.nim :P zacharyc1rter: but I still think that you guys are trashing CMake when every other C++ build tool is just as bad zacharyc1rter: and if you want something that makes CMake better use fips Araq: cmake is better than most clyybber: make is best, fite shashlick: This is no different than folks complaining about nimble, choosenim or even nim for not solving every scenario perfectly. zacharyc1rter: I guess I missed where this all started shashlick: My point is that this is how the C/C ecosystem works today, I just don't see the point in circumventing them and doing it in some nth unsupported way zacharyc1rter: I came in around the point Zig started to be brought up I guess? shashlick: fact of the matter is that every C/C++ project that is cross platform has to deal with discovery shashlick: nim does that discovery for us so we can happily sit and write mostly cross platform code without effort dom96: zacharyc1rter I didn't interpret it as bashing cmake, I interpreted it as bashing needing to compile any big C project. It's always a nightmare no matter what make you use Araq: shashlick: and nimterop fights Nim's design, but we don't have to discuss it yet again shashlick: i don't think it fights nim's design at all, it is a practical way to make these libraries available to the user base dom96: The fact is that Nim has been designed to work with DLLs shashlick: even for DLLs, you need a wrapper dom96: And doing so side-steps the C ecosystem Araq: it's practical for you but the end user experience is bad, ask disruptek dom96: which is a great thing shashlick: disruptek had problems because he avoids nimble dom96: so I do not want to bring in a package that will bring that whole ecosystem into my build Araq: shashlick: well we can let him answer clyybber: I think you meant me? shashlick: i fixed his bug by discovering nim configuration with nim dump shashlick: clyybber: you on irc? clyybber: nope, currently not clyybber: are you in offtopic? shashlick: gitter? clyybber: yeah, or irc doesn't matter clyybber: its bridged shashlick: can you join https://gitter.im/nimterop/Lobby we can see what the issue is without cluttering #nim clyybber: sure Araq: Yardanico: https://forum.nim-lang.org/t/6295 how much does it speed the Nim compiler? shashlick: long story short, people have issues all the time and you fix them Araq: *speed up disruptek: it's one thing or another. why not sidestep the issues with a smarter design? Araq: shashlick: the issues are a symptom of an underlying systemic issue disruptek: i'm the most expert user of my software and i have problems with it /ALL THE TIME/. shashlick: that could very well be the case shashlick: in this case, it is a choice to accelerate with leverage instead of reimplementing everything Yardanico: Araq: I didn't test it with the compiler yet - what's the good nim project for the PGO run? compiler itself? Araq: shashlick: I completely agree and I've tried to outline the way to a good nimterop shashlick: yes and it's been a crawl to get there Araq: I'm sorry shashlick: it may never get done or be perfect but that's not my goal, it is to enable quick wrappers when users ask Araq: Yardanico: or compile arraymancer Yardanico: ah right shashlick: maintaining top quality wrappers requires talent and a lot of patience - it is not a glamorous job clyybber: Actually it just requires c2nim and some perl to patch it up :p Yardanico: disruptek: stream today or not? Yardanico: I'll try with the compiler itself first just to test shashlick: clyybber: try wrapping large cross platform projects shashlick: you can definitely make a one time wrapper disruptek: i stream every day, all day. mratsim: https://pldi20.sigplan.org/program/program-pldi-2020 mratsim: mratsim: Some stuff on MT solver and verified ranges mratsim: SMT* shashlick: anyway, the point is not to obsolete c2nim or something, it is to offer choice clyybber: shashlick: I am wrapping vulkan shashlick: ultimately I want the user to succeed in his project, not create some wrapping masterpiece clyybber: shashlick: Yeah, you are right, but thats also kind of the problem I guess; It wont obsolete c2nim clyybber: And for example with awr's cpu package I can't choose shashlick: that never was the goal, c2nim can convert C to nim outright clyybber: Or with nimph Araq: shashlick: I don't mind obsoleting c2nim, I'm not married to the software. but the replacement should be better ;-) shashlick: your issues with nimph aren't due to wrapping shashlick: it is since you don't want to use nimble clyybber: They are due to nimterop clyybber: Because it's too complex IMO Araq: that's simply not true, I don't mind running 'nimble install nimph' and it didn't work for me disruptek: he can't build nimph because of nimble? 🤣 shashlick: again, that's like asking for perfection disruptek: does the bootstrap work or not? Araq: 'nimble install nimph' is a pretty basic command shashlick: it works for me Araq: well I got it to work too, eventually shashlick: but that's cause all the fixes are in #head and not tagged yet Araq: now I cannot use it because 'nim dump' because 10x slower and nimph is too slow now (just kidding, disruptek ) disruptek: do you need a replacement for `bump` that works better for your use-case, shashlick? shashlick: its like asking for zero bugs, as all developers here, i don't see how that should discourage usage altogether Araq: shashlick: we're not asking for zero bugs, we're asking for a development process that makes the bugs easier to spot, rather than hidden in layers beyond our comprehension disruptek: it's not even a code issue, it's an environment issue. disruptek: too many assumptions. Araq: I ask for a bike and rather than giving me a bike with a broken tire, you give me a broken bike factory disruptek: i'm still getting reproducable crashes in compiler code in nimph. Yardanico: ok so with default nim build "time nim c -d:danger --hints:off -w:off --compileOnly tests/tests_cpu.nim" (arraymancer) takes ~3.7-3.8 seconds Yardanico: now gonna build nim with PGO+LTO and try again PMunch: Hmm, what does the "dynlib" pragma actually do? Araq: Yardanico: btw -d:danger --panics:on the new way to get fastest code Yardanico: I know, but we want a fair comparison right? :P Yardanico: I mean I'll use -d:release for the compiler mratsim: dynlib is for dynamically linking 😉 disruptek: also, it's compiler code that is compiling system module and running nimscript. Araq: Yardanico: sure, but you can use -d:danger --panics:on for both runs Yardanico: hmm, right Araq: oh er Araq: you don't run the compiler under arc so it doesn't matter, sorry Yardanico: well there's still difference between -d:release and -d:danger I guess disruptek: it's harmless. Araq: why can't we run the Nim compiler under arc? what is everybody doing all day long? discussing silly tool chains? Araq: :P clyybber: Araq: Maybe we'll get there today :D clyybber: Let me try Yardanico: well I opened 3 new arc-related bugs today :P mratsim: does createThread works with arc now? disruptek: yes. clyybber: Heh, nevermind, still get errors Araq: well you need to fix the move optimizer Yardanico: "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" :D guess I'll build with -d:release after all Yardanico: the compiler seems to either crash or say some gibberish about illformed AST Yardanico: it's gone crazy with lto+pgo+danger Yardanico: maybe PGO optimizes too much stuff? anyway will try with -d:release now disruptek: i guess i need to stream earlier for danny's benefit. dom96: nim-lang.org should have a "live now" section dom96: anyone want to implement one? clyybber: should it? Araq: Yardanico: gah, that's nasty so PGO breaks the Nim compiler? Yardanico: so with -d:release with lto+pgo tests_cpu from arraymancer takes around 0.2s less to compile :P (--compileOnly), building nim itself takes 0.6s less time Yardanico: Araq: maybe PGO just messed up that one time, with -d:release now it's fine Yardanico: and doing "time ~/testsp/compiler/nim c -d:release --compileOnly -w:off --hints:off compiler/nim.nim" is ~0.5s faster (3.9s vs 4.4s) Araq: wow Araq: that's pretty good Araq: can we store this profiling info somewhere? is it platform agnostic? Yardanico: hmm, I don't really know, need to search or ask someone who knows clang well :P Araq: create a pull request and see if it breaks our builds :P Yardanico: well I'm using clang's LTO+PGO, I don't know if it's available on the CI Araq: the CI uses clang on OSX at least Yardanico: for GCC it seems to be harder since GCC outputs the profiling data in the ~/.cache/nim/project directory Yardanico: and clang just does it in current dir Yardanico: but I'll try Araq: er, sorry, just forget about it, the Nim compiler changes all the time Yardanico: well nightlies maybe can make use of LTO+PGO I guess? Araq: true mratsim: still no channels in arc :/ https://github.com/nim-lang/Nim/issues/13936 disbot: ➥ Simple channels with --gc:arc Araq: but wow 3.9s vs 4.4s is quite a speedup. many would heavily refactor the compiler to get that Araq: (myself included) Yardanico: yeah, and especially the fact that I used the profile data the arraymancer tests_cpu, not from building the compiler Yardanico: from the * Yardanico: even when building my simple mathexpr lib (the repl example) it takes 60ms less (510ms vs 570ms) disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: unfunner stuff. stefantalpalaru: Is there any known memory leak involving tables with tuples as keys? Like this one: https://github.com/status-im/nim-beacon-chain/blob/621c2e38a6f073c1c4bb9cf2e6b430796490a6ef/beacon_chain/beacon_node_types.nim#L137 Araq: stefantalpalaru: no dom96: can we get a wrapper for this? https://microsoft.github.io/microsoft-ui-xaml/ Yardanico: Araq: results for compilation time of arraymancer's tests_cpu and compiler with -d:danger and -d:danger + PGO Yardanico: https://gist.github.com/Yardanico/e5ef5130b43f3d4e6f8c308ee910c1c3 Yardanico: 3.64s 4s vs 3.22s 3.27s oz: dom96: just compile to JS and use "React Native for Windows". :> liblq-dev: does offsetOf return the byte offset of a field in an object? liblq-dev: there's no docs for it in system.nim awr1: hello all Yardanico: github announced github discussions Yardanico: basically forums in the repositories dom96: nice, so they're finally following their "social" mission Yardanico: example https://github.com/zeit/next.js/discussions dom96: cool, some pretty awesome features dom96: Guess we can shut down the Nim forum :P awr1: now i can finally get rickrolled on github Zevv: how does one enable that? Yardanico: I don't think you can yet Zevv: right Yardanico: but I guess it'll be open beta soon Conlaoch: Dang it awr1... now I'm gonna have that tune stuck in my head for a couple hours... awr1: https://github.com/nim-lang/Nim/pull/14247 can someone merge this when it passes CI? thanks disbot: ➥ Fix runnable examples for bitops (should fix CI) narimiran: @awr1 ping me when it is green kaushalmodi: For a closed source project, few days back, I compiled it with `--gc:arc` and it compiled fine. Today I get this error: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ It does not give a deeper backtrace. ... [https://gitter.im/nim-lang/Nim?at=5eb2e8da3d58de7a38fab92f] kaushalmodi: How can I get a report-worthy backtrace? Yardanico: oh yeah I know the error Yardanico: I already reported it Yardanico: lemme give you the issue link kaushalmodi: The project compiled and compiles fine without `--gc:arc`. Yardanico: https://github.com/nim-lang/Nim/issues/14236 Yardanico: that's the one disbot: ➥ [ARC] ICE with static objects ; snippet at 12https://play.nim-lang.org/#ix=2l1f Yardanico: stack trace helps but by a bit, the best way is to always make a short example to reproduce ;) Yardanico: check, maybe you use nim-regex yourself Yardanico: you can workaround it by not using the nfa macro Yardanico: -d:forceRegexAtRuntime for nim-regex kaushalmodi: Yardanico: I need the stack trace to understand what part of that huge project is breaking :) kaushalmodi: Just those 2 lines lead me nowhere kaushalmodi: *2 lines of those error messages Yardanico: well you'll only be able to get the compiler stacktrace anyway Yardanico: use ./koch temp c Yardanico: or whatever your backend is kaushalmodi: My project uses cligen and cligen uses regex so probably it's caused by regex Yardanico: try with -d:forceRegexAtRuntime queersorceress: is there a way to force the `dynlib` pragma to rely on a dlopen call rather than forcibly linking a library to the resulting binary? queersorceress: i'm running into an issue where a third party library wraps the stdlib's db_[mysql|postgres|sqlite] and i only use sqlite, but the binary that gets built is wanting all three libraries to be linkable at run-time queersorceress: so i want to short-cut it and while i could probably do some magic with linker scripts and rewriting symbols, i really don't want to do that if an easier solution exists Solitude: its already using dlopen Solitude: so there is no easy way to conditionally load a library at runtime EdgyNerd: I tried using the go garbage collector, but got the error 'could not load: libgo.so', where do I get that file? Yardanico: @EdgyNerd gccgo Yardanico: you need that SolarOmni: Okay so I'm really rusty with Nim and haven't used it in like 2 years, it seems to have changed a bit. But anyway, I can't remember the flags for the compiler and I can't seem to find them in the manual. Can anyone tell me how to use set where the executable is exported to? luis_: Hi guys, how do I set nimble to generate a windows binary? luis_: Where do I set the binary type? leorize: SolarOmni: --out:/path/to/where/you/want Yardanico: luis_: nim uses the c compiler, so you need to have a cross-compiler from your platform to windows SolarOmni: Thanks leorize zacharyc1rter: just use Zig Yardanico: ^^^ Yardanico: use zig to cross-compile nim for windows Yardanico: ez EdgyNerd: I installed gccgo and it still doesn't work for some reason kaushalmodi: Yardanico: After I using that define to enable regex at runtime, I see: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb2f4df9f0c955d7daa2985] Yardanico: nice Yardanico: now minify it and create a bug report ;) Yardanico: oh its glob\ kaushalmodi: yeah Yardanico: hmmm Yardanico: https://github.com/citycide/glob ? kaushalmodi: yes kaushalmodi: I will see if can reproduce that error in a minimal example kaushalmodi: but that error is different from that earlier "unhandled exception: ccgexprs.nim(777, 11) `ty.kind in {tyTuple, tyObject}` [AssertionDefect]" kaushalmodi: I don't know if and how they are related Yardanico: yeah I can replicate it Yardanico: lemme try to make a repro Yardanico: so I can report it luis_: thanks kaushalmodi: yes! This gives me the same error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb2f5b4adb0ec5c2beb042c] kaushalmodi: Do we need another report so that nim would give more info than just "unhandled exception: ccgexprs.nim(777, 11) ty.kind in {tyTuple, tyObject} [AssertionDefect]"? Yardanico: I already have it in the issue I linked Yardanico: but these two are separate issues, one is internal compiler error, other is codegen, although they're maybe related , but probably not kaushalmodi: I added this to that issue thread for packages not working with arc: https://github.com/nim-lang/Nim/issues/14224#issuecomment-624795102 disbot: ➥ Libraries which don't work with ARC ; snippet at 12https://play.nim-lang.org/#ix=2l1L Yardanico: well you don't need to add that Yardanico: this crash is related to nim-regex and I already reported it separately Yardanico: https://github.com/nim-lang/Nim/issues/14236 is literally this issue disbot: ➥ [ARC] ICE with static objects ; snippet at 12https://play.nim-lang.org/#ix=2l1f Yardanico: from nim-regex Yardanico: and if you look at https://github.com/nim-lang/Nim/issues/14224 I actually opened it because of nim-regex :) disbot: ➥ Libraries which don't work with ARC ; snippet at 12https://play.nim-lang.org/#ix=2l1L kaushalmodi: ok :) Yardanico: and this bug with glob seems to be in nim-regex too, but it's different Yardanico: related to inline iterators again Yardanico: like https://github.com/nim-lang/Nim/issues/14219 but that PR didn't fix it disbot: ➥ ARC codegen bug with inline iterators ; snippet at 12https://play.nim-lang.org/#ix=2gcb Yardanico: I mean that PR doesn't fix this problem Yardanico: @kaushalmodi you should use ./koch temp Yardanico: clone nim compiler git repo (--depth=1) will work Yardanico: and do ./koch temp c --gc:arc otherarguments path/to/your/file.nim Yardanico: If the release version of the compiler will have stack traces enabled it'll be MUCH slower Yardanico: I tested and it makes the compiler ~3x slower even with -d:release --stackTrace:on --lineTrace:on kaushalmodi: You said that it will show stacktrace only in the compiler, so I didn't pursue that; I do have `koch` as I build from git. Trying it out .. Yardanico: well wdym "only in the compiler", if you mean where it crashed in the code - there's no such thing Yardanico: I don't think nim compiler has that at all Yardanico: if it actually *crashes*, it crashes kaushalmodi: ok, I thought we can know which user Nim file the compiler was attempting to compile before it crashed Yardanico: @kaushalmodi and I know a temporary fix to solve your codegen issue Yardanico: in nim-regex nodematch.nim line 116 remove {.inline.} pragma Yardanico: then it actually works kaushalmodi: I did this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ and recompiled that glob snippet, but still the same crash [https://gitter.im/nim-lang/Nim?at=5eb2ffbcadb0ec5c2beb2a80] Yardanico: which crash? Yardanico: do you run it with -d:forceRegexAtRuntime ? kaushalmodi: ugh, no Yardanico: well you nee to Yardanico: :P Yardanico: *need kaushalmodi: yep, confirm your fix :) kaushalmodi: *I confirm Yardanico: well I need to reproduce it now Yardanico: with a shorter example Yardanico: it's something to do with inline and inline iterators Willyboar: I just saw httpbeast is no.1 in web frameworks benchmark Willyboar: This is very cool Willyboar: But we lack web frameworks to kick their a** totally waghanza: their is also `jester` and `rosencrantz` (pending in https://github.com/the-benchmarker/web-frameworks/issues/335) disbot: ➥ Introduce rosencrantz Yardanico: jester uses httpbeast waghanza: yep and is from the same author Yardanico: yes Willyboar: I really want to see rosencrantz results waghanza: i'll be glad to reviw any PR Willyboar: there are more Willyboar: whip is fast too Willyboar: it uses httpbeast too queersorceress: @Solitude turns out it was simplier than i thought it would be; i was mistaken on one of the dynlibOverride names, so with that plus one linker flag i was able to circumvent the issue entirely. dom96: Willyboar: :o dom96: It's #3 it seems dom96: beaten by a JS framework lol waghanza: any contribution for https://github.com/the-benchmarker/web-frameworks waghanza: disclaimer : this version is not really accurate (I mean I use a local docker), I'm working on a cloud version (backed by digitalocean) Willyboar: you can beat them @dom96 Willyboar: :PP waghanza: ;-) dom96: the differences are so small that I don't really see much point :P dom96: honestly, the top 25 are fast enough. Willyboar: hm crystal lucky drop a lot for a crystal framework waghanza: tep strange dom96: thanks for getting httpbeast in there waghanza queersorceress: if it can load web pages for a user when requested, i think that is considered "fast enough" 😛 waghanza: you're welcome ❤️ r dom96: oooh https://github.com/features/codespaces dom96: I hope Nim is supported Yardanico: well if they support extensions and you can add your own binaries - yes Willyboar: !!! Looks Great Willyboar: I suppose any VS extension will work Yardanico: well Nim extension requires nimsuggest Yardanico: for autocompletion and stuff Yardanico: otherwise you'll just have simple syntax highlighting dom96: Nim support would require at least the compiler dom96: if you can get the compiler onto these online editors then you can surely get nimsuggest Willyboar: When will be available? queersorceress: if the compiler can be built to a JS target rather than a C target, then that probably would be much easier to make happen Yardanico: that's not exactly easy Yardanico: with wasm it's much more feasible Yardanico: btw reported 4 arc bugs, enough for today I guess :p Yardanico: I mean today's total count :P Recruit_main707: good job Yardanico: you can help too Recruit_main707: Araq is probably very happy about this Yardanico: just test random libs/apps in nim with arc Yardanico: ez Recruit_main707: first make my things work Willyboar: I just test arc with whip and with arc is 7-10% faster PMunch: https://play.nim-lang.org/#ix=2l3Y PMunch: Hmm kaushalmodi: I have an internal CLI app.. is it possible to update the app executable by itself? PMunch: So is there a way to tell Nim about a const that doesn't involve copying the variable value? PMunch: kaushalmodi, what do you mean? Do you want to run it and it will update itself? Never Listen To Beef: If so on linux you can just fetch the new version overtop the old one, on windows you'd need to move the old one, then fetch and delete the old one kaushalmodi: I am thinking like "when user runs the self update subcommand, download the latest version from my const download url, quit the app and then overwrite itself in the "post quit phase or something" " kaushalmodi: Just curious Yardanico: yeah that should be possible dom96: choosenim does this Yardanico: some apps do this PMunch: Definitely doable kaushalmodi: So what is that "post quit phase"? dom96: but it fails on Windows IIRC dom96: because it just overwrites itself Never Listen To Beef: Well you have to do what i said on windows kaushalmodi: On Linux, I get Oserror PMunch: Are you allowed to move a running program though? dom96: Might be worth creating a package that makes this nice and easy across all platforms Never Listen To Beef: Move the file then fetch and then remove the original leorize: PMunch: a const that doesn't involve copying the value? Never Listen To Beef: On windows it's a file that is loaded into shared memory, so it can be moved safely afaik kaushalmodi: How do I remove the original while it is running? dom96: you don't dom96: the usual solution is to download to myapp.exe.update PMunch: Yeah, let's say that there is a `const int VERSION` in the C file. I want to wrap this in Nim, but I don't want to copy the value that is assigned to VERSION, I want it to be whatever the file I link it with is. Never Listen To Beef: You create a small batch file and invoke that whilst you kill the app inside the batch wait for it to end 😄 dom96: Actually, I dunno, google how they do it :P kaushalmodi: Yeah, plan B is to deploy an update script leorize: PMunch: var VERSION {.importc, header: "the_header_that_defines_it.h".} leorize: oh you need to specify the type to dom96: and please create a package out of this so I can use it in choosenim PMunch: But that is a var leorize: PMunch: you can't importc a const leorize: const is strictly nim compile-time PMunch: I know leorize: and let requires initialization :P PMunch: But a let would work PMunch: If Nim would allow me to not give it a value when nodecl is defined leorize: you should really just copy the value over to nim leorize: @kaushalmodi: I haven't tried this again, but IIRC you can move the executable that's running PMunch: That might be hard if it is in a large tree of C macros/conditions leorize: then replace it with the other leorize: PMunch: found a way to make it immutable leorize: make it a template or proc leorize: use {.emit.} :P PMunch: But apparently `let TEST {.importc, nodecl.}: cint = 0` works PMunch: Hmm, a template with {.emit.} would work as well PMunch: Annoying if you need to do many of them though.. leorize: whip up a generator for them liblq-dev: is fields()/fieldPairs() guaranteed to yield all fields in the correct order? leorize: or template-generating templates :P PMunch: Curiously `let TEST {.importc, nodecl.}: cint = default(cint)` doesn't work PMunch: It tries to assign 0 to TEST leorize: liblq-dev: yes, but it doesn't "yield" the fields per-se leorize: it unrolls the loop leorize: so careful with that liblq-dev: I know, that's what I want liblq-dev: I was just wondering if I need a macro to preserve the exact order they are declared in an object leorize: now that for loop macros are a thing maybe we can reimplement those things outside of the compier leorize: compiler* PMunch: Oh right, I forgot about for loop macros kaushalmodi: leorize: I'll try moving the executable PMunch: A feature I've yet to abuse :P kaushalmodi: leorize: It works!!! kaushalmodi: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb31d2014b48f0698b33997] leorize: nice :) kaushalmodi: Thanks :) This is a sweet feature.. no need to tell folks to curl and change perms PMunch: https://github.com/nim-lang/Nim/issues/14253 disbot: ➥ Assignment to `default` leads to assignment for `nodecl` ; snippet at 12https://play.nim-lang.org/#ix=2l45 leorize: on 1.2.0 that one looks even weirder leorize: Error: identifier expected, but got '[EOF]' PMunch: leorize, my error? leorize: yea, check the playground PMunch: Oh, that is from a stray ` at the end of line 3 PMunch: I have edited it out already PMunch: IMO the fix should be to make all assignments create an assignment in C. But let should be able to use `nodecl` and/or `importc` (doesn't nodecl imply importc? in a way) and not have to assign a value. PMunch: But I should really get to bed PMunch: See ya! queersorceress: i thought emit was deprecated\ Yardanico: wdym? Yardanico: it won't be deprecated as long as nim has any of its current backends queersorceress: https://nim-lang.org/docs/macros.html#emit.t%2Cstatic%5Bstring%5D Yardanico: thats macros.emit Yardanico: not the emit pragma Avahe: @Elegant Beef Trying out propertynotify events now, were you getting any wm state changes? I am not Never Listen To Beef: Nope Avahe: I actually am getting an error on this call you are doing: https://github.com/beef331/goodwm/blob/master/src/goodwm.nim#L595 Avahe: You are probably just ignoring the error I think.. you're giving a pointer to an array but it should be a pointer to a cstring Avahe: Oh jk that is correct because it is an array of longs. Hm, wonder what's happening Prestige: I'm attempting to call XGetErrorText https://tronche.com/gui/x/xlib/event-handling/protocol-errors/XGetErrorText.html which takes a cstring as an out param, and I also need to specify the size (sort of like a buffer to fill). How should I go about doing this in nim? Prestige: If I don't init the cstring nothing is returned, but if I fill the string I get an Illegal storage access error Prestige: Unless I'm doing it correctly and there just isn't an error message, lol awr1: working on a C++ thing again, trying to mess with C++ macros makes me long deeply for nim templates Never Listen To Beef: @Avahe what file is the error method in? Never Listen To Beef: Ah nvm Avahe: I fixed the XChangeProperty part, I was just doing something dumb Avahe: but am now onto trying to get XGetErrorText to work Avahe: Need a nim guru to take a look, not sure how this is supposed to work with cstring awr1: do you know the size of the buffer or not Never Listen To Beef: The C method takes a char array, so i dont exactly know Never Listen To Beef: Well you pass it a buffer and it returns the size with the changed buffer Avahe: I don't, it seems I just need to declare a buffer with some arbitrary size and pass it in awr1: if you don't know the size of the output, you will need to allocate a cstring of a certain "large size" Avahe: Is there a way to declare a string with some size rather than filling " ... "? like char[255]? awr1: i did something like this for a PR recently awr1: https://github.com/nim-lang/Nim/pull/13950/files#diff-bf62676d6697cd4a45cd6e35f6b5468cR35 disbot: ➥ added extended msg for failed library loads w/ incorrect DLL formats Yardanico: @Avahe it really depends on what do you need that for awr1: this is with a stack allocation, fyi awr1: but you can do `var msg: array[1000, char]` for a stack alloc or `var msg = cast[cstring](alloc0(1000))` awr1: for a heap one awr1: and then `dealloc` the underlying pointer. Prestige: looking like I'll have to do that latter since the param specifies a cstring awr1: `var cMsg :array[1000, char]; XGetErrorText(display, code, cast[cstring](addr cMsg[0]), cMsg.len); let msg = $cast[cstring](addr cMsg[0])` Prestige: oh maybe that awr1: you can get a cstring from both awr1: get address to the first ele and cast it awr1: `msg` will allocate a normal nim `string` awr1: via $ Prestige: That worked, thanks! awr1: glad to hear mratsim: I hate generic sigmatch bug mratsim: https://cdn.discordapp.com/attachments/371759389889003532/707714906748878878/unknown.png liblq-dev: why are types in generic procs not bound from declaration site? liblq-dev: I have this generic proc https://github.com/liquid600pgm/aglet/blob/master/src/aglet/gl.nim#L304 liblq-dev: and I'm trying to call it from a macro liblq-dev: but I'm getting undeclared field errors liblq-dev: I have to import the `gl` module from my main module which is bad mratsim: use bindSym instead of ident in your macro awr1: ^ this liblq-dev: but it's not a problem with the macro liblq-dev: look at this https://github.com/liquid600pgm/aglet/blob/master/src/aglet/arraybuffer.nim#L57 liblq-dev: where'd I even use bindSym? awr1: your issue is the `quote do:` awr1: you need to make a call from scratch awr1: `quote do:` i believe is untyped so it won't perform symbol binding liblq-dev: dang it, and there I was hoping I could make my code shorter Rika: is it a good idea to import the compiler just to use int128 leorize: Prestige: you can declare a string with the size you need then use it as a buffer disruptek: yep. disruptek: DOOOOOIT liblq-dev: @awr1 doesn't work disruptek: MOAR MOAR MOAR leorize: liblq-dev: just bindsym then quote it in? liblq-dev: as I said the error occurs in vertexAttrib not the macro awr1: you could maybe do that too awr1: what is your code Prestige: leorize: in another way than awr1 said? leorize: yea leorize: var str = newString(size_here) liblq-dev: @awr1 just sent it… https://github.com/liquid600pgm/aglet/blob/master/src/aglet/gl.nim#L304 leorize: str.cstring is your buffer Prestige: oh nice, thanks Prestige: I was afk awr1: ah i didn't think of that leorize: remember to setLen() after you got the correct size awr1: no i meant for the macro liblq-dev: I can't just use `bind` in the proc liblq-dev: because it only works for templates liblq-dev: what I'm getting is: /home/daknus/Coding/Nim/aglet/src/aglet/gl.nim(306, 35) Error: undeclared field: 'GlUint' for type system.int [declared in /home/daknus/.choosenim/toolchains/nim-1.2.0/lib/system/basic_types.nim(2, 3)] Recruit_main707: !eval echo("i dont think so") NimBot: i dont think so Rika: someone else answer me T_T Rika: disruptek says ok but i dont trust that dude disruptek: wtf awr1: i mean what did you change here awr1: https://github.com/liquid600pgm/aglet/blob/master/src/aglet/arraybuffer.nim#L66 leorize: Rika: it's ok, as long as the compiler version is new enough liblq-dev: @awr I made it construct the AST using basic procs like newCall etc clyybber: @Rika IMO no disruptek: don't listen to clyybber. clyybber: Just copy the Int128 file disruptek: import the whole thing. clyybber: Oh key leorize: we should move int128 into fusion disruptek: the compiler needs it. awr1: "disruptek says ok but i dont trust that dude" awr1: disruptek is a secret agent /s clyybber: If int128 gets added to the stdlib it must be made more convinient to use disruptek: rika is a secret asian. awr1: int128 should probably get added imo awr1: it's a weird point of contention because it isn't super well supported in C but there is def. a desire for it awr1: @liblq-dev did you use `newCall(bindSym("vertexAttrib"), ...` etc. liblq-dev: yes disruptek: i'm just finishing up a PR to add int130 to fusion. disruptek: should enough integers to last me through june. awr1: hm awr1: this is weird awr1: shot in the dark: you may want to try `GlUint(index)` and `GlSizei(stride)` liblq-dev: @awr1 well, that seems to have worked awr1: may want to raise an issue then awr1: i feel like i have maybe encountered this issue, that the compiler sometimes doesn't like method syntax for converting to user defined types federico3: https://github.com/FedericoCeratto/nim-httpauth/issues/5 urgh disbot: ➥ postgres and mysql shared libs required even when not used skrylar[m]: that looks like a way higher effort wrapper than the one i use. lol liblq-dev: skrylar[m]: are you talking about aglet? skrylar[m]: correct liblq-dev: well my philosophy is to create a wrapper that does not make you deal with low-level C state machine cruft awr1: i have a minimal example awr1: im gonna make an issue skrylar[m]: i just have a very thin layer for things like mapping gl types to distinct ints and then unifying the procs on top of that skrylar[m]: everything is 'use' mostly because bind was already a keyword liblq-dev: I named binding-related stuff 'use', too liblq-dev: but it's meant to be hidden away from the end user liblq-dev: I'm mainly inspired by the API design from glium, but I decided to add some cool features that weren't possible there because of safety and all that Rust stuff liblq-dev: well anyways I'm out for today. good night everyone skrylar[m]: gnight awr1: https://github.com/nim-lang/Nim/issues/14254 disbot: ➥ Cross-module refusal of method call syntax for type conversion in generic ; snippet at 12https://play.nim-lang.org/#ix=2l4Q Prestige: Is there a whitespace trimming proc for strings? I haven't found anything Yardanico: strip or unindent depending on what you mean Prestige: Thanks Prestige: Looks like that isn't how I should go about finding the "real size" of the filled string.. string returning 1024 instead of the length of the message I received Rika: what're you trying to do Prestige: This is what's happening https://play.nim-lang.org/#ix=2l57 Prestige: trying to get the length of the actual string contents so I can reduce errorMessage to a proper length Prestige: @Rika for context the function on line 2 has errorMessage as an out param Rika: i know Rika: are you sure its not supposed to be a ptr cstring Rika: or a ptr char Prestige: I mean the call is working and I get the message back just fine, but len(errorMessage) is still 1024 and I want to reduce it once it's been partially filled awr1: try maybe awr1: `errorMessage.setLen(errorMessage.cstring.len)` Rika: try echoing just the strip Rika: and then repr that too Prestige: ah errorMessage.cstring.len is what I needed, thanks bedwardly-down: @Never Listen To Beef , well of course, you’re a dog beef hybrid afterall idrialite: Can someone help me with a compile error? I'm getting invalid indentation: https://pastebin.com/1Qxh2cVg (line 23) leorize: it's `not` in Nim, not `!` leorize: also `and`, not `&&` idrialite: Changed them and still getting the error leorize: also `.inc`, not `++` idrialite: That fixed it, thank you leorize: you can also use `+=`, though the `inc` proc is more popular Yardanico: Yeah I like using inc KingDarBoja: Do you come from Python? idrialite: Me? No, I usually use C#/C++/Java Never Listen To Beef: Ah fellow C# dev 😄 idrialite: Love C# <3 Never Listen To Beef: I love that in nim we dont need to write extension methods ever Never Listen To Beef: Cause normal methods function the same Yardanico: UFCS is the best, yeah Never Listen To Beef: For us that dont speak in abbreviations? Yardanico: universal function call syntax, in nim it's called MCS (method call syntax) KingDarBoja: Welcome 😄 Yardanico: Ah sorry *uniform Never Listen To Beef: Ah the techincal term for why i can do a.b() or b(a) Never Listen To Beef: ? Yardanico: Yes KingDarBoja: So you heavy OOP guy? Yardanico: UFCS Never Listen To Beef: I mean i am considering i use unity engine mostly, and that's all C# Never Listen To Beef: I prefer data oriented design though Yardanico: https://en.m.wikipedia.org/wiki/Uniform_Function_Call_Syntax check the first two languages as an examples xd KingDarBoja: I am being converted into OV Yardanico: Ah seems like D and Nim are the only ones who have real UFCS Yardanico: Out of the "bigger" languages Never Listen To Beef: I really love it, it's so frigging nice to just have procs be procs and not specific use case procs idrialite: It confused me at first cuz I was looking for a way to put methods into the objects lol Never Listen To Beef: Ah i did the same Never Listen To Beef: You can have objects with named procs for an event system Kurinoku: may i ask something, im trying to use a single-header c library with nim, i cant make the .h file a dynamic library so what do i do Never Listen To Beef: No clue if there is a proper alternative for delgates outside of a `seq[proc]` Yardanico: @Kurinoku {.compile: "file.h".} should work Kurinoku: ok thank you Never Listen To Beef: Is there a type you can add procs to and have them all call in at once? Yardanico: Put it at top level Yardanico: At the start of the file (you can do it after imports if you want) Kurinoku: @Yardanico okeh-okeh Kurinoku: imma try now Yardanico: Well actually it doesn't matter where you put it in the file, at the start or in the end, but the former is nicer Kurinoku: c2nim translates const wchar_t* to ptr wchar_t should i use mangle to make wchar_t*, WideCString as provided by widestrs idrialite: Can I have multiline while statements Never Listen To Beef: No clue why'd you want to but yes Never Listen To Beef: https://play.nim-lang.org/#ix=2kPD bedwardly-down: Is inc(1) an incremental operator? Never Listen To Beef: you can do `inc i` or `inc(i)` and yes it just increments by 1 Never Listen To Beef: *and i guess `i.inc`* Yardanico: Not only by 1 bedwardly-down: That looks kind of convenient Yardanico: inc(i, 2) Never Listen To Beef: oh Yardanico: 1 is the default second argument Never Listen To Beef: nice Never Listen To Beef: Is in cthe idiomatic method of `+=` then? Never Listen To Beef: inc the* Yardanico: Both are fine I guess bedwardly-down: Looks kind of like for(i = 0; i++; i < 10) in haxe Yardanico: For that we have for i in 0 ..< 10: stuff Never Listen To Beef: the nim of that would be `for i in 0..9` bedwardly-down: Or the new for(i in 0..10) bedwardly-down: That’s very similar to the Haxe 4 new incremental stuff. Nice Yardanico: and by the way the first example you did is the default in most C-like languages Yardanico: It's been around for tens of years :P bedwardly-down: Mine? Yardanico: The for(i= 0; ....) one Never Listen To Beef: I've never seen the middle be the conditional though Yardanico: Ah right Never Listen To Beef: not be i mean* bedwardly-down: It’s the default in Java, Haxe, c# and even a variant of it exists in bash and other shell scripting languages Never Listen To Beef: Well C# it's val, conditional, increment Yardanico: It's *also* the default in C, C++, JS bedwardly-down: Now but about 10 years ago at least, it was how i showed. Never Listen To Beef: Ah i've never seen it in anywhere leorize: @Never Listen To Beef: `inc` is not the same as `+=`, though the effect is the same Never Listen To Beef: Can nim abuse the for loop into a while loop Never Listen To Beef: In what way is it different? Yardanico: @bedwardly-down is it really that way? The increment being in the middle Yardanico: It's really the first time seeing the for me leorize: inc() is "increase by this amount (default 1)", and `+=` is "add this amount into the var" bedwardly-down: It was. It’s just not as used in tutorials anymore but still valid Never Listen To Beef: C# doesnt even compile with that leorize: the "technical" difference would be that `inc` works with enum and `+=` doesn't :p Never Listen To Beef: Well the difference is minimal leorize: yea, it's only for the reading flow leorize: like how people use `++` instead of `+= 1` Never Listen To Beef: Inc still takes a negative secondary parameter so i'd argue it's illdesigned 😛 disruptek: see also succ() leorize: lol Yardanico: Btw funny thing that https://haxe.org/manual/lf-iterators.html can be implemented in Nim just fine without any classes disruptek: leorize: how well do you understand versioned symbols? leorize: enough to curse them bedwardly-down: @Never Listen To Beef last time i used c# XNA just was created for Xbox Live Indie program leorize: you having trouble with them? Yardanico: You just create your own object and define items for it (and pairs if you want two values like key: value) Never Listen To Beef: Yea i just had to see if it was possible since it seemed unlikely Never Listen To Beef: in C# the second param has to be a bool or else it complains disruptek: leorize: we should scheme about if there's a "best" way to exploit them going forward. leorize: I have always considered them a bad design leorize: it existed for the sole idea of "using multiple version of the same library" bedwardly-down: They changed that then, beef Yardanico: Uhh no leorize: and then it never worked out bedwardly-down: I’m talking about c#. Sorry Yardanico: C# always had C style for loops (they added the foreach and friends though) disruptek: i'm wondering if we couldn't support multiple architectures or something. there's something there but i'm not sure what. Yardanico: C# never had for loops with increment in the middle Yardanico: Maybe you're confusing it with something else leorize: disruptek: wdym? Yardanico: it's for(variable, condition, operation) bedwardly-down: You’re probably right. Xna wasn’t pure c# but a subset disruptek: i dunno. just looking for ideas on how to exploit the feature in the backend. Never Listen To Beef: or if you're abusing it for(;;) Never Listen To Beef: Cause why not! Never Listen To Beef: *Can i abuse nim for loops?* Yardanico: just use while true leorize: go did the for(;;) thing then call it "a clever design" leorize: I say that's a retarded one Never Listen To Beef: No that's too smart Never Listen To Beef: While is intended for that Never Listen To Beef: for;; is a silly while loop Never Listen To Beef: You dont understand, one is for purposely making your code silly, the other is for serious work Never Listen To Beef: Also im sorta offended you actually suggested while true, like i didnt know about it Never Listen To Beef: 😦 disruptek: i'm more of a while false: guy, myself. disruptek: faster. Never Listen To Beef: Im more of a `quit 1` on line 1 of my main file Never Listen To Beef: It's the quickest program i can make shashlick: @leorize I think I have a fix for https://github.com/nim-lang/nimble/pull/768 disruptek: amateur. leorize: disruptek: well we can exploit symbol versioning to walkaround our static library situation, but I don't see any good way to use it leorize: shashlick: what's your idea? disruptek: #12480 bedwardly-down: Haxe and Java seem to iterate weirdly then or I’ve been using it the wrong way and it still compiled and worked disruptek: i forgot i killed the bot. disruptek: #12480 disbot: https://github.com/nim-lang/Nim/issues/12480 -- 5an admittedly silly compiler crash one-liner ; snippet at 12https://play.nim-lang.org/#ix=2kPM shashlick: It's the same as my fix for disruptek's nimph issue with nimterop leorize: do you have a link? shashlick: https://github.com/nim-lang/nimble/pull/768 disbot: ➥ nimscript{wrapper,api}: don't copy generated script to package directory shashlick: Ugh shashlick: https://github.com/nimterop/nimterop/commit/33d77f82e878c86c0edf3bd21d359e5f40492ad2 shashlick: I added nimconf.nim which does most of the work shashlick: Basically we can run Nim dump in the target folder and create a cfg for the nims script disruptek: but can we get a tag? disruptek: why so stingy with the version tags? disruptek: shashlick, take care of yourself. looks like texas is getting bad. leorize: shashlick: but this would make nimble requires nim >= 1.2 shashlick: Yes unless we can get 4raq to backport the nim dump stuff to 1.0 shashlick: @disruptek almost there, last few tests remain shashlick: https://github.com/nimterop/nimterop/blob/master/CHANGES.md leorize: I'm quite certain that it won't be backported KingDarBoja: Hi guys bedwardly-down: @Never Listen To Beef make any progress on that window manager? I’m debating on learning more nim when i get home or crashing. bedwardly-down: Sup, @KingDarBoja ? Never Listen To Beef: nope i've been polishing my last game jam game a bit Never Listen To Beef: The atoms are annoying to deal with so i've been putting it off KingDarBoja: Doing some TS stuff before continuing my journey bedwardly-down: I need to figure out how to decouple some haxe code i worked on earlier that i had a fridge epiphany with. Ha bedwardly-down: Atoms, @Never Listen To Beef ? Never Listen To Beef: X uses atoms to mark features and states Never Listen To Beef: They're annoying as hell Never Listen To Beef: They're basicaly just strings and data, but again are annoying as hell bedwardly-down: Ewww. Gotya Never Listen To Beef: And for some reason i dont get fullscreen propert changes like awesomewm or any other wm Never Listen To Beef: so idk Never Listen To Beef: Could always just torch it and restart it bedwardly-down: If it’s anything like other Linux software, you’re most likely forgetting some obscure flag that makes no sense bedwardly-down: That’s not all software but there are a few out there Never Listen To Beef: Yea i've added the property changed flags, and also added the supported atoms though so i know it's trying just not working 😄 bedwardly-down: What was your git repo again? shashlick: @leorize lmk if you think this can work Never Listen To Beef: @bedwardly-down https://github.com/beef331/goodwm Never Listen To Beef: Probably should rename it "Disaster WM" bedwardly-down: Super sexy nim nim time is more like it. 🤪 bedwardly-down: I’m going to be honest, you could probably cut down the goodwm.nim file in size, but most of the atoms are in there, right? bedwardly-down: @Never Listen To Beef , is this shell dependent? ‘execShellCmd("notify-send FullScreen it")’ Never Listen To Beef: Well that's for debugging Never Listen To Beef: Some things dont send inside Xephyr Never Listen To Beef: Such as mouse movement Never Listen To Beef: I do have to replace the Xrandr call with the xrandr lib since it is inside the nim x11 bedwardly-down: Does that print to shell or log or what? That might have issues for non-bash shells bedwardly-down: I’d have to test it out Never Listen To Beef: I mean it sends a nitfication Never Listen To Beef: notification Never Listen To Beef: It's again for debugging Never Listen To Beef: So it doesnt matter for non bashshells bedwardly-down: Ah, gotya. bedwardly-down: The proc name confused me since that sounds like you’re actually passing a command to be ran by the shell and not more of a console trace bedwardly-down: Is that your own name or what your api uses? Never Listen To Beef: That is sending a message for debugging Never Listen To Beef: It's not proper debugging Never Listen To Beef: It's print log debugging Never Listen To Beef: Since im a fuckwit bedwardly-down: 🤮🤪 bedwardly-down: I’m almost home. I’m gonna eat. Then I’ll see what i can read more. I’m not good at nim right now but could check into it more Never Listen To Beef: Im not good at nim either bedwardly-down: We’re idiots, so let’s try to be smart together! Lmao Never Listen To Beef: Nah i think that just increases the idiot density bedwardly-down: And dead work nights cause me to get grumpy, so maybe doing something not related to me might be a good distraction. Ha kayabaNerve: PMunch: You around? kayabaNerve: Have something to discuss with you leorize: he 's not online kayabaNerve: Oof. Damn Gitter side of things. KingDarBoja: Hi leo 😄 leorize: o/ voltist: Is there a way to specify a single proc that accepts either an int or a float, without having to specify the type every time in [square brackets]? leorize: proc foo(val: int | float) voltist: Ooo thats nice and simple, thanks bedwardly-down: Leo, is that applicable to more than two options? leorize: yes Yardanico: If you want to accept *any* number type you might why to use SomeNumber bedwardly-down: Nice. leorize: it's a shorthand for proc foo[T: int | float](i: T) Yardanico: @bedwardly-down it's implicit generics basically bedwardly-down: Does nim have a dynamic type? leorize: `int | float` here is a typeclass, and not a sum type Yardanico: No voltist: Features like that sit in a strange place where guides don't cover them, and they dont have a dedicated documentation (that one might, but just in general) Yardanico: Nim manual covers that though leorize: usually people don't know the terms, that why they can't find them leorize: the manual covers like 95% of the features Never Listen To Beef: Reading is too hard, just get a brain siphon and give me the knowledge Yardanico: https://nim-lang.org/docs/manual.html#generics-type-classes voltist: "usually people don't know the terms" yeah that's a better way of putting it voltist: It's not signposted like you might get with more fundimental features KingDarBoja: But to use that, one must use generics KingDarBoja: I am right? KingDarBoja: Ofc union types aren't allowed leorize: that is generics Never Listen To Beef: That's a shorthand of a generic bedwardly-down: In haxe, this is a common way to take anything for a value: https://haxe.org/manual/types-dynamic.html KingDarBoja: Dart uses that too Yardanico: In Nim you can have a raw pointer too Yardanico: With no type attached to it bedwardly-down: https://haxe.org/manual/type-system-generic.html Never Listen To Beef: Generic variables are always weird to me in static languages bedwardly-down: And generic is a weird thing leorize: dynamics reminds me of pascal's Variant type leorize: in here we have it too, called JsonNode :) KingDarBoja: I always confuse its purpose with being able to return union types on proc calls KingDarBoja: But ofc that is a big NO Yardanico: Not really you l Never Listen To Beef: Idk in my years of C# i've never needed a generic variable Yardanico: *you can have "a | b" as the return type Yardanico: If the proc itself is generic KingDarBoja: That's a whole different situation 🧠 KingDarBoja: My brain is gonna get OVERLOADED voltist: It's very annoying that ``*`(v: A, r: B)` doesn't support `someB * someA`. Is there a helper for this? leorize: write a template :P voltist: So just define ``*`(v: B, r: A)`? leorize: we need a macro for this in sugar then leorize: `{.permutate.}` KingDarBoja: https://dart.dev/guides/language/sound-dart#type-inference leorize: shouldn't be too hard voltist: I'll leave that to someone who knows how to write macros well :) leorize: I can actually write you one rn :P Never Listen To Beef: I still think the tables module needs a macro/template to automatically hash objects so objects can always be used as keys leorize: nah, it's a stupid idea KingDarBoja: wtf? KingDarBoja: I don't get the idea... KingDarBoja: objects as keys... what? Never Listen To Beef: Mine? All hashable fields of an object gets hashed so you can use objects as keys if you so wish without having to manually hash their fields Prestige: What do other languages do to automatically hash objects? voltist: leorize: That would be wonderful, thanks! I should really get to know macros better, because it seems that people make contributions because of needs I have more than I do :/ Never Listen To Beef: Idk prestige i just suggest illadvised ideas i have Prestige: Lol beef Never Listen To Beef: I could be wrong but could be similar to what i said Prestige: It sounds like a good idea for the end users but I have no idea of the drawbacks KingDarBoja: We need a beef emoji, just saying Never Listen To Beef: Why? KingDarBoja: Because I am getting hungry Prestige: 🥩 KingDarBoja: 🥩 Yardanico: 🥩 KingDarBoja: that works Never Listen To Beef: Never Listen To Beef: https://cdn.discordapp.com/attachments/371759389889003532/707072914683330601/Beef256.png KingDarBoja: RIP IRC Yardanico: ? Never Listen To Beef: They get a url Never Listen To Beef: to that discord upload KingDarBoja: Is that true? Never Listen To Beef: That's what i've been told Yardanico: Of course lol Prestige: Beef: I was looking into it and I think xrandr is probably the best choice for multihead btw, found a nim wrapper as well Yardanico: and emojis work fine since it's just utf8 Prestige: so you don't have to execute a shell command iirc Never Listen To Beef: Yea the nim wrapper is with x11 Never Listen To Beef: I've already mentioned this multiple times and said it's dumb that i did Prestige: Just trying to be helpful :P Never Listen To Beef: Yea sorry i guess, if it came off aggressive 😄 Prestige: Hehe np voltist: Doesn't the Discord have an unrelated discussion channel you can use for beef related discussion? IRC users like myself don't really have anywhere to go to escape to when beef emojis start flowing :) Never Listen To Beef: I mean if you want me to shutup just tell me to, ill call you rude, but i'll understand KingDarBoja: Yes, it is offtopic KingDarBoja: We went offtopic for a brief moment, sorry pal shashlick: there's a #nim-offtopic for that Prestige: is that bridged to irc as well? Never Listen To Beef: Yea voltist: Nah I don't have a problem with off topic stuff, but just spam is kinda... spammy Never Listen To Beef: I feel like i need to say "that's the joke" but i dont want to be considered a total asshole 😄 Yardanico: https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-pragma-pragma pragma pragma pragma pragma pragma! Prestige: That's a great url KingDarBoja: pragmatic... Yardanico: Pragmagic :P https://github.com/pragmagic Never Listen To Beef: Interesting a lot of nim stuff, and they're an abathur main in Heroes of the Storm voltist: Does the Nim compiler tolerate special characters like Δ? shashlick: ya Never Listen To Beef: it's utf8 Prestige: Beef do you have a roadmap for your wm? voltist: Neat Never Listen To Beef: Yea, im going to drive it to a ocean dock and drop it in there with cement tied to it's legs Never Listen To Beef: No i dont have a sincere map Never Listen To Beef: I dont plan i just do Prestige: lmao, ok KingDarBoja: Wtf has to do abathur with Nim? Never Listen To Beef: KingDarBoja: Clever name Never Listen To Beef: Clearly a cool person 😛 KingDarBoja: genetics related == abathur KingDarBoja: Noise! voltist: How is that repo genetics related other than through the name? Never Listen To Beef: > A genetically modified database Never Listen To Beef: Dont ask what that means Never Listen To Beef: Just accept it bedwardly-down: Was the WM stuff off topic or what came from it? My roommate needed my help a bit Never Listen To Beef: The WM is between me and prestige who are both making WMs in nim Never Listen To Beef: His is clearly going to be better since he actually reads docs Prestige: Lol we'll see, you're making much more progress bedwardly-down: It’s not a race to make Nim a common household name in the WM space, is it? Prestige: First one to do it wins 1,000 internet points Never Listen To Beef: I mean my intial idea was to use nim for the base and nimscript for the widget programming but that seems like a pipedream, but we'll see voltist: I don't think WM development is the kind of space where people would use a language because someone else did Never Listen To Beef: Yea WM is the most use whatever language you want KingDarBoja: Never stop dreaming, you can do it 🙂 Never Listen To Beef: Looks at awesome WM having a ton of lua Never Listen To Beef: It's not an issue of doing it, it's more of doing it right 😄 Never Listen To Beef: Embedded nimscript would let me pass primitives but that's clearly not enough for me Never Listen To Beef: Well like it'd work but it'd be a pain to setup KingDarBoja: Well, what disruptek told me once time ago: make it work, then improve KingDarBoja: Any doubt, feel free to ask Never Listen To Beef: Might as well just use json instead of that Never Listen To Beef: Well my biggest issue is xlib atm, and i doubt many people here are well accustomed in that 😄 bedwardly-down: Fix the x11 Wayland issue by building a full rendering stack in nim Never Listen To Beef: lol Never Listen To Beef: Yea im way less qualified then the xorg devs working on wayland, and less of a man Never Listen To Beef: *They've got how many people contributing?* bedwardly-down: And how much money coming in to support development? Never Listen To Beef: Not a clue, anywho prestige you've got some time to play catchup since im polishing up a gamejam game i did, so do it quick, so we can both assist eachother later 😛 Prestige: Sounds good :) bedwardly-down: So, I'm at my laptop. Basic way to get started is figuring out hwo the xlibs interact with each other, right? KingDarBoja: ok enough TS stuff for today Never Listen To Beef: Yea bedwardly this is basically the best thing i've found to get a quick grasp of xlib Never Listen To Beef: https://tronche.com/gui/x/xlib/ bedwardly-down: Thanks. bedwardly-down: @Never Listen To Beef and prestige, did you guys see this: https://github.com/jichu4n/basic_wm Never Listen To Beef: I've voltist: Does anybody know to get in contact with SSPkrolik? One of their packages is slowly deteriorating because they aren't responding to issues/PRs Prestige: Yep Never Listen To Beef: If they arent maintaing it you always could fork it and maintain it 😄 bedwardly-down: He also has a paper that was part of Google Summer of Docs linked on how Xorg and Window Management work. Did you read that link? bedwardly-down: https://jichu4n.com/posts/how-x-window-managers-work-and-how-to-write-one-part-i/ Never Listen To Beef: That is where i found basic_wm bedwardly-down: Gotya voltist: Thing is, they have the nimble listing for the neat, recognizable name `nimongo`, so it might confuse people if it doesn't work and they actually have to go for some other library Never Listen To Beef: Ah Never Listen To Beef: The annoying thing there bedwardly is they stop that wm before they implement anything that is actually needed in a TWM Never Listen To Beef: > In our next installment, we will improve the user-facing functionality of our window manager by adding ways to move, resize and close windows. bedwardly-down: Voltist, is this the same guy? https://twitter.com/SSPkrolik voltist: I'd say so yeah Never Listen To Beef: Seems so with his big ol' nim image there voltist: They have made contributions on GitHub recently voltist: But obviously not seeing/acknowledging issues bedwardly-down: I got no idea Avatarfighter: just curious is there any reason why a variable wouldn't change its value when you "-=" from it? Avatarfighter: I know this may sound weird but I'm getting weird behavior where a mutable variable isn't modifying leorize: voltist: https://play.nim-lang.org/#ix=2kQ2 leorize: that's a rough version leorize: I'll have to copy it to my machine and clean it up leorize: the playground is not a nice editor Avatarfighter: playground best IDE 😛 Never Listen To Beef: *intergrated* doesnt mean into the web browser Avatarfighter: hahah voltist: leorize: Neat, thanks! Are you going to make a pull request once you have it cleaned up a bit? leorize: I'll once I figured out this permutations iterator :P leorize: I copied it from wikipedia :P voltist: Ah right :) Avatarfighter: oh nvm ik why im getting my weird behavior, I did change the value of the variable lmao leorize: voltist: does it work well? :P leorize: I designed it to work with arbitrary amount of params, so it might be a bit overkill voltist: leorize: Yes it does voltist: leorize: It took me a minute to remember my Ohms law from highschool science and figure out what procs should actually be permutable bedwardly-down: Do any of you guys actually use playground to pigure out production level code for your projects? bedwardly-down: Do any of you guys actually use playground to figure out production level code for your projects? leorize: nah leorize: I just use it when I wanna draft something out for the chat Avatarfighter: I use it when I'm on my phone tbh leorize: my trusty neovim setup trumps all bedwardly-down: When I'm bored at work, I might need to do just that, @Avatarfighter leorize: voltist: currently it doesn't copy the doc comments, but if you want I can add it Avatarfighter: @bedwardly-down I really like doing that since I get to try new things AND ask here for that realtime spoonfeeding lmao Never Listen To Beef: I tend to use it as an alternative to makeing a nim file on my pc for quick things bedwardly-down: That actually seems fairly useful, especially for ED users like me Never Listen To Beef: I've gotta be honest i doubt users needs to be puralized there bedwardly-down: You would be surprised at how many ED users are out there in my online circles Avatarfighter: welp I just realized I messed up the implementation of salsa20poly1305 800 lines in :L bedwardly-down: What is that, @Avatarfighter? leorize: it's a crypto algo Avatarfighter: ^ bedwardly-down: Gotya Avatarfighter: salsa20 is a symmetric stream cipher while poly1305 is a message authentication code Avatarfighter: I forgot that passing stuff in as a variable makes it mutable out of the scope of the proc its in and it broke everything lmfao Never Listen To Beef: Photsynthetical quantum mechanical engineering. I too can say random big words together 😛 Avatarfighter: lmao Avatarfighter: basically salsa20 takes in bytes in sequence and as long as you also have salsa20 you can read my bytes in the correct sequence while poly1305 makes sure the bytes were by me bedwardly-down: Gotya kayabaNerve: Can I attach a macro to an object field without a macro surrounding the object definition? leorize: yes leorize: I think kayabaNerve: So dumpTree shows the pragma, but getTypeInst doesn't leorize: how are your custom pragmas defined kayabaNerve: I was checking it wasn't check applying the pragma; removing the pragma def causes a compilation error kayabaNerve: template {.pragma.} kayabaNerve: Tried checking if I had to write a body and manually re-attach the pragma; I do not. {.pragma.} aren't allowed bodies. kayabaNerve: Huh. I may not want the pragma pragma kayabaNerve: So, the pragma pragma is for your custom pragma to be macro-detectable. That said, the macro calling getType and getTypeImpl strip them. kayabaNerve: Removing the pragma pragma causes this to error; so does removing commenting the pragma out (I thought maybe if it couldn't resolve, it'd be kept as a label) Avatarfighter: I'm going to be so proud when I'm done with this library lmao it looks like spaghetti, but its my spaghetti 😉 kayabaNerve: Yep. Think I need a wrapping macro. leorize: maybe a new issue then? Never Listen To Beef: When ever i write code avatar im always happy because of the phrase "A face only a mother could love" and that defends my terrible code! Avatarfighter: @Never Listen To Beef that is what I think every time I write something 😛 I also wonder why my stuff is always defective tho 😛 kayabaNerve: Oh. Never mind. Found a way kayabaNerve: nim-stew has a shim for it. No idea how it works, just that it does. Never Listen To Beef: All my code works, just dont pick at it or it may explode KingDarBoja: Good night! Avatarfighter: gn Never Listen To Beef: Buh bye Avatarfighter: what is the best way of converting a seq[char] to seq[uint8?] leorize: @seq[char].toOpenArrayByte() leorize: lemme try first Avatarfighter: I've never seen "@" prefixed before something what does that mean? leorize: !eval echo `@`(@['a', 'b', 'c'].toOpenArrayByte) NimBot: Compile failed: /usercode/in.nim(1, 26) Error: type mismatch: got leorize: !eval echo `@`(@['a', 'b', 'c'].toOpenArrayByte(0, 3)) NimBot: /usercode/in.nim(1) in↵/playground/nim/lib/system/fatal.nim(49) sysFatal↵Error: unhandled exception: index out of bounds [IndexError] leorize: !eval echo `@`(@['a', 'b', 'c'].toOpenArrayByte(0, 2)) Avatarfighter: 0,2 should work? NimBot: @[97, 98, 99] Avatarfighter: lit kayabaNerve: Cam I overload a generic so one has T, U, and one only has T? D leorize: so `@` is the array -> seq operator kayabaNerve: Doesn't look like it, just double checking because I can't supply a default type with T, U leorize: you can overload like that leorize: it's done all the time with types leorize: Avatarfighter: .toOpenArray is our zero-copy slicing operator leorize: pretty useful leorize: there's also a shorter way to do the same thing leorize: `cast[seq[byte]](seq[char])` kayabaNerve: leorize: Nim says it's a redef leorize: but it's dangerous so :P leorize: kayabaNerve: how are you doing it? Avatarfighter: yeah i try to avoid casting when i can Prestige: leorize: does toOpenArray just point to that location in memory? kayabaNerve: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb0f8415cd4fe50a3ed9c5a] leorize: Prestige: pretty much leorize: an openArray is a pointer to the data + the length kayabaNerve: inline doesn't make a difference to be clear Prestige: Hmm but I guess assigning a var to it would copy kayabaNerve: And sorry for causing two people to be asking for help at the same time; happy to come back in 10 :P Avatarfighter: Prestige: thats actually what I'm trying to do and it complains about openArray being unassignable to vars lol Prestige: openArray isnt really a type though leorize: not a first class yet leorize: toOpenArray is our stop gap solution Avatarfighter: Stupid question once again(i've had many of these today), but byte = uint8 right? leorize: yea Avatarfighter: so why does uint8 != byte lmao leorize: ? leorize: !eval uint8 is byte NimBot: Compile failed: ???(0, 0) Error: expression 'true' is of type 'bool' and has to be discarded leorize: ^ it's true Avatarfighter: i parameterized my procs only parameter with "openarray[uint8]" but when i pass a "openarray[byte]" I'm getting an error that says... Prestige: !eval uint8(1) == byte(1) NimBot: Compile failed: /usercode/in.nim(1, 10) Error: expression 'true' is of type 'bool' and has to be discarded Prestige: Hmm yeah Avatarfighter: "type mismatch: got" is the official error Avatarfighter: I hope that was one line leorize: I need some sample code Avatarfighter: uhh Avatarfighter: its like Avatarfighter: 800+ lines atm Prestige: Is that the whole error? Avatarfighter: yeah that is the whole error from what I can tell Avatarfighter: let me get a paste of a snippet of my code leorize: just copy the function prototypes leorize: and how you called it leorize: use discard as impl Avatarfighter: oh wait I got it Avatarfighter: the error was not descriptive at all, its because my proc takes "var openarray[uint8]" but I'm feeding it "openarray[uint8]" leorize: :P leorize: 4raq would disagree with you but I can agree that the compiler bites you a lot with the error messages Avatarfighter: honestly I blame myself for not reading more carefully Avatarfighter: I'm just used to python which outputs the entire stack and a story to figure out what went wrong lol leorize: the compiler could always put up some highlights so you can spot the errors easier leorize: we should learn from some of the more mature compilers out there, though that's pretty low on my list for now Avatarfighter: I mean the compiler does provoke your critical thinking as to what might've gone wrong lmao Avatarfighter: how do you reference something? Avatarfighter: is it []? Avatarfighter: dereference* leorize: yea Avatarfighter: dang I think I need to make everything I just wrote referenced :L Avatarfighter: nope I just need to use vars correctly haha Avatarfighter: leorize: if you're still here, going back to "toOpenArrayByte" what would be the correct way of storing the openarray in a var? leorize: you can't store an openarray :) leorize: turn it into a seq if you may leorize: the `@` operator can be used for that Avatarfighter: for once I was doing this correctly and concisely haha Avatarfighter: Ok well I think I'm going to head out and finish this tomorrow and then hopefully I'll get a willing soul to do a codereview Avatarfighter: thank you very much for the help as always leorize 🙂 Avatarfighter: gn everyone sealmove: Do we have in-place sort? Vindaar: sure: https://nim-lang.github.io/Nim/algorithm.html#sort%2CopenArray%5BT%5D sealmove: Rephrasing: do we have `sortByIt` similarly to `sortedByIt`? sealmove: Instead of passing an anonymous function to `sort`... Vindaar: ah, no I don't think so Benumbed: I don't know who mantains c2-nim, but the link on the github page to the docs (http://nim-lang.org/docs/c2nim.html) is broken, and 404s Araq: Benumbed: that is the wrong URL, where did you get it from? Benumbed: Github page: https://github.com/nim-lang/c2nim Benumbed: Project description up at the top Araq: thanks, fixed Benumbed: :thumbsup: Benumbed: Has anyone tried the `importcpp` pragma stuff? Up until this point I've only used C, but I'm messing around with C++ dynamic libraries and it's not going so well for me :/ leorize: it's not an easy pragma to use Benumbed: so I've discovered lol PMunch: I used it a bit for Arduino stuff, it's not that hard to use kayabaNerve: PMunch: There you are. kayabaNerve: I need to talk to you about something. PMunch: Oh, sounds ominous kayabaNerve: Yeah, shall I hop on IRC or do you want to PM me on Gitter? PMunch: And I'm almost always here :P But I guess you don't see my IRC status on Gitter kayabaNerve: I reached out earlier; leorize said you weren't here :P Benumbed: PMunch: Was your Arduino stuff open (aka is there asomething I can look at?) PMunch: Whatever is easiest PMunch: Benumbed, ah unfortunately not. But it's just not open because the code quality isn't quite there kayabaNerve: I would prefer you get on Gitter, personally. Been a while since I used IRC :P Benumbed: damn, k PMunch: kayabaNerve, just a sec kayabaNerve: All good mratsim: @Araq, after thinking more on how to use both asyncdispatch and Weave, hear you go: https://github.com/mratsim/weave/issues/123 disbot: ➥ Handling blocking tasks and long-running tasks ; snippet at 12https://play.nim-lang.org/#ix=2kQT mratsim: here* Araq: Benumbed: we used it in production for the Urho3D wrapper fwiw Araq: mratsim: will read it later Araq: so ... if (and that's a big if) my idea works out the potential speedup is from 4.3s down to 0.5s for bootstrapping leorize: https://play.nim-lang.org/#ix=2kQW leorize: I think I did it leorize: the ultimate permutable macro leorize: generates only meaningful permutations leorize: and completely support any weird kind of proc you can throw at it leorize: voltist: ^ leorize: don't use it though, even I'm scared of it leorize: now I gotta sleep :P Hammer2900: hey, how about dependency text file like in python requirements.txt ? any advice to read about this ? Benumbed: Hammer2900: If you're using nimble as your pkg manager, it provides a 'requires' directive you can use in your .nimble file alehander92: Araq huh alehander92: whats your idea Hammer2900: > ** Hammer2900: If you're using nimble as your pkg manager, it provides a 'requires' directive you can use in your .nimble file ⏎ ⏎ ooo, ok thank you, now i check this information )) beater if this information store in first doc pages sealmove: Are 32bit integers more effecient than 16bit? sealmove: (speed-wise) Benumbed: That would depend on the hardware you're running on sealmove: I have a type with 4+8 bits, how to align it? Never Listen To Beef: Vertically sealmove: :D Benumbed: That depends on the surrounding data IIRC sealmove: Well, I use only this type repetedly in an array PMunch: @kayabaNerve, you wanted to talk? sealmove: So I am considering either padding the first field (4+8 -> 8+8) or padding both to make 32bit integer (4+8 -> 16+16). Which one do you recommend? PMunch: If you don't have any other data and memory isn't an issue I'd say go 32bit PMunch: Should be faster on "normal" CPUs Benumbed: Well my padding stuff is rusty, but padding to the highest bitcount within the structure is 'recommended' but there's some other alignment gotchas that for the life of me I can't bring to mind PMunch: (I believe 32 bit reading is still faster than 16 bit reading on 64 bit machines, correct me if I'm wrong..) sealmove: Thanks! I though so, but wanted a confirmation from an expert :) Benumbed: I think you're right PMunch, but I'm too tired to remember why 😄 PMunch: The CPU instructions to read/write bytes are still the same for 32bit, it has been extended for 64bit. So it's just a matter of using the 32bit instructions instead. There are 16bit instructions as well, but I'm not entirely sure how they perform Never Listen To Beef: Being a dumb dumb i would've thought that since most machines cache line is 64 bit having 4 being on 1 line instead of 2 would've been faster. But i know nothing about actual cpus and just aimlessly guess PMunch: Disclaimer, been a looong while since I've done this kind of stuff :P Benumbed: There's a good article on this but I can't find it for the life of me sealmove: Oh makes sense, I see Never Listen To Beef: i guess i meant byte size and larger multiples 😄 PMunch: If it's a 16bit one then a write could potentially be "read 32 bit, copy high/low 16 bits, mask out the area we want to write to, mask in our data, write back 32 bit" PMunch: I guess the real answer is "try both, benchmark" PMunch: If speed is really important sealmove: It's a decompression routine so quite important... PMunch: Then I guess it's benchmarking time! PMunch: I mean all of this could be made null and void if your application hits the cache a certain way PMunch: Modern CPUs are getting so complex it's not always trivial to give "always do X" advice sealmove: I always try to avoid benchmark. It's a lot of work x_x Araq: alehander92: it's an old idea from Zahary, re-interpreted for IC Araq: but it's too early to talk about it :P liblq-dev: shashlick: why does nimterop not generate .importc pragmas for bound objects? liblq-dev: it breaks the ABI and causes segfaults with soundio alehander92: Araq i am *just* reading another interesting IC idea alehander92: but it seems a bit radical Araq: link? alehander92: https://github.com/ziglang/zig/pull/5158#issue-408356035 disbot: ➥ beginnings of (non-LLVM) self-hosted machine code generation and linking ; snippet at 12https://play.nim-lang.org/#ix=2kR9 mratsim: @PMunch, @Never Listen To Beef , 16 bytes instructions are the worse on 64-bit CPU: They take more space to encode, They take somewhat more time due to more expensive zero-extension liblq-dev: does Nim reorder object fields somehow? alehander92: basically it requires writing a special incremental linker etc from zero PMunch: @mratsim, so my memory didn't fail me this time, wohoo :) mratsim: but that is valid only if everything you need is CPU-bound mratsim: usually workload are either bottlenecked by IO or memory mratsim: if bottlenecked by memory, as @Never Listen To Beef said, it's more important to pack more data in a single cache line Araq: alehander92: ok, well "figure out how comptime code will work" means it's rather unfinished ;-) Yardanico: Well Zig itself has much less "advanced" stuff dom96: Yardanico, keep in mind that Zig is much much younger Yardanico: Well yeah, but also the ecosystem for stuff like LLVM is much better than when Nim was started ;) alehander92: Araq oh i agree alehander92: i just was wondering for my own alehander92: side project idea and IC alehander92: and comparing stuff i saw randomly alehander92: but aren't those a bit separated? e.g. caching in a smart way compile time code is one problem, optimizing the backend work for regenerating the final binary another one eagledot: Is it possible to get different code behaviour based on the garbarge collector used?? Araq: yes Araq: that's usually kinda the point of using a different algorithm, to get different runtime behaviour ;-) alehander92: probably the linking/binary thing isn't such a bottleneck tho, after all redoing 1 of 50 objects is a big win anyway Araq: but it also affects edge cases wrt GC_ref etc eagledot: I have trying to make this code work but it is getting compiled properly ..but it works only when "arc" is used not with default garbage collector... ⏎ https://play.nim-lang.org/#ix=2kRf Araq: so use arc, it's the future eagledot: I have been wanting to ask that using different garbage collector should not influence the result of programmes? eagledot: shouldn't the programme's results be same independent of GC used? Araq: ideally yes, but your program is full of low level stuff, run it with -d:useMalloc --gc:arc under valgrind already eagledot: So nim doesnot take care of this if i am writing code in nim??If this is so when should i change gc. ⏎ Code works prefectly everytime when i use no GC...so i think logic is correct!! Yardanico: if code works "perfectly" when you don't use a gc it doesn't mean that the code is correct :P Yardanico: when you use "gc:none" all GC'd memory is simply being leaked Araq: you might as well claim "my C++ code works perfect in debug mode" Yardanico: you should really try using nim c -d:useMalloc --gc:arc --debugger:native file.nim Yardanico: valgrind --leak-check=full ./file Yardanico: debugger:native for source code lines :P Araq: "and it fails in release, so the C++ compiler isn't working!" eagledot: I understand that GC main function is release memory automatically. But why some code works with one GC and not with other. alehander92: it's a good question in general alehander92: a lot of code never really accounts for what gc mode is used Araq: as I said, if you have bugs the program might appear to work under various conditions for a long time eagledot: low level C code i am calling does not allocate in memory..i do it in nim.But it is behaving weirdly even if add an extra line `echo(variable)` it start working. Araq: does the C code run it in a different thread? eagledot: No Yardanico: hmm NiGui seems to be crashing with arc (uses methods for GUI controls and stuff), wonder why, crashes even with sink inference off eagledot: I CAN post even the C code..if u want. eagledot: nim code is here. ⏎ https://play.nim-lang.org/#ix=2kRf eagledot: Can u tell me if i am doing something gravely wrong??I have been upto this for 2 days. Yardanico: well we can't try without the webrtcvad_nim eagledot: https://gitlab.com/eagledot/webrtcvad-nim/ eagledot: i was trying to writ nim-bindings for google's opensource webrtcvad (voice activity detector). liblq-dev: shashlick: I reported this as a bug in nimterop: https://github.com/nimterop/nimterop/issues/202 disbot: ➥ ABI break due to the lack of .importc in struct definitions ; snippet at 12https://play.nim-lang.org/#ix=2kRm Yardanico: @eagledot it works with the default GC for me just as fine Yardanico: "total heap usage: 3 allocs, 3 frees, 5,608 bytes allocated" with default GC and no -d:useMalloc Yardanico: "All heap blocks were freed -- no leaks are possible" eagledot: you tested with different wave files?? Yardanico: tested with 60seconds one, with 10 seconds one, with 3 seconds one Yardanico: although the program seems to SIGSEGV with valgrind if compiled with arc and -d:useMalloc Yardanico: doesn't sigsegv without valgrind at all though Yardanico: and yes valgrind itself crashed Yardanico: not the program Yardanico: XD Yardanico: "valgrind: the 'impossible' happened: Killed by fatal signal" eagledot: For me i used that nim code with corresponding python code ..even though the nim code works but results donot match with the equivalent python code. ⏎ https://github.com/wiseman/py-webrtcvad/blob/master/example.py eagledot: For me by now it has been a hit and miss. Yardanico: oh also found a simple compiler crash with kinda invalid code eagledot: So is it a problem with my code or some nim internal bug ... just confirming..i am a newbie?? Yardanico: I honestly don't really know, I'm doing a different thing right now, so sorry :) eagledot: OK. Thanks. eagledot: If you have any advice to avoid such cases ..please let me know. sealmove: Is `newSeq[int](512)` slower than `array[512, int]`? krux02: sealmove: can't say completely out of context. krux02: array is always stack allocated, where newSeq is always heap allocated. sealmove: Hmm, I always have 512 elements but then I want to drop some (with the `keepItIf` proc) krux02: yea that doesn't work with array. sealmove: Also I want to order them (either before or after dropping some elements) krux02: sorting is no problem with arrays. sealmove: Should I first make an array, use `sort` and then allocate a seq and use `keepItIf` on it? Or make a seq from the beginning and not use array? krux02: dropping isn't possible, but you can reorder then in a way that all "dropped" items are at the end and then you only iterate until you reach those "dropped" elements. krux02: no krux02: I can't even tell you if "keepItIf" is the right thing to do. narimiran: just use seq Bennyelg: Hi, Anyway I can echo all the procs names inside customType ? krux02: what procs names? sealmove: Oh actually sort does take care of it as you suggested, I don't really need to drop anything! Bennyelg: yes procs names Bennyelg: which assosicated to him Bennyelg: it* krux02: I don't think that there is an api to get all procs that take "CustomType" as first argument. krux02: But it would certainly be valuable. Bennyelg: yea well, need to write macro for it right ? krux02: I don't think there is a macro api so that you could implement it. krux02: it is only possible the other way around. "give me all the overloads with the name "myCustomProc" Recruit_main707: getting all your code into the macro and checking for all procs and their args maybe? krux02: Recruit_main707: That could work, but solution like that can seriously hurt compile time. Yardanico: how do I output an address of a procedure with --gc:arc ? Yardanico: you wouldn't believe it but echo cast[array[2, int]](control.fOnClick)[0] worked because in C it was defined like "static NIM_CONST tyProc__Jv1U9bAA9aOQah3FXJraBXHg TM__v6sMqsqcQidqukQ1qgYXEQ_58 = {NIM_NIL,NIM_NIL};" Yardanico: i just need this for debugging why nigui doesn't work with arc Yardanico: seems like that arc doesn't like when you try to access nil procs in an object Yardanico: nigui has a lot of stuff like "let callback = checkbox.onToggle" "if callback != nil: stuff" alehander92: krux02 alehander92: i need to fix printing case objects in gdb too krux02: yes? alehander92: can you remember what blocked you alehander92: afaik this code was disabled in nim-gdb krux02: well, gdb needs some form of runtime type information. alehander92: yeah, but does the nti contain enough info for case objects? krux02: if things are mapped to something that exists in the backend directly, then the debug information that is generated by the C/C++ compiler is enough. alehander92: iirc one mostly needs to know which branch corresponds to which enum range krux02: but if the construct is crafted then you need to generate other forms of runtime type information. alehander92: ok krux02: and last time I based something on NDI it was broken, because NDI is a singking ship. krux02: sinking ship alehander92: yeah, that seems to be bad Bennyelg: Newbie question: When I should also export my module ? krux02: Bennyelg: when you feel like doing so. alehander92: krux02 it would be good to standartize this krux02: no honestly I don't know what you are talking about. krux02: what do you want to export. alehander92: i also used some of that info for making better async stepping actions Bennyelg: when I do export it will pass the import along to the other module without explicitly import it again right? alehander92: and are the ndi and nti info-s in some kind of sync? dadada: hey krux02: Bennyelg: if you export a module all symbol of that module will be avaiable through another module. Bennyelg: exactly thanks krux02: if you have a.foo and in b you export a you can access a.foo as b.foo dadada: I want multiline strings that includes triple quotes strings themselves... so triple quotes bite triple quotes dadada: what can I do about it? dadada: s/includes/include krux02: dadada: nothing Yardanico: dadada: have text files in your project and read them at compiletime :P krux02: you can use something else that is not """ and then replace it with tripple quotes as a post process. alehander92: ok alehander92: how can a void async procedur yield nil Rika: it shouldnt nothratal: just out of curiosity, can someone help me transform this here: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb1577b7a24ff01b001c9d6] Yardanico: pairs is an iterator, so you can't use UFCS for it Yardanico: instead do it like toSeq(tParam.pairs).stuff Recruit_main707: you are also in gitter? Yardanico: i am Yardanico: every Yardanico: where Recruit_main707: i think you got a bit confused nothratal: ahh! UCFS again :P ⏎ I already tried: ⏎ pairs(tParam).toSeq.map(proc(x,y:string):string= x & "=" & y).join("&") ⏎ but not toSeq(...) [https://gitter.im/nim-lang/Nim?at=5eb1581ed898fe7a37685713] Yardanico: https://nim-lang.org/docs/manual.html#templates-limitations-of-the-method-call-syntax Yardanico: there's an example with an iterator here, and why it's not possible Yardanico: you can do something like proc toKv(data: Table[string, string]): string = toSeq(data.pairs).mapIt(it[0] & "=" & it[1]).join("&") Yardanico: but I don't like this kinda-functional style ;) Rika: so this can be another reason why nim doesnt default to fully qualifying functions from imports Yardanico: yep Yardanico: there's also https://nim-lang.org/docs/uri.html#encodeQuery%2CopenArray%5B%5D Yardanico: if you don't actually need tables you can just use it as encodeQuery({"a": "b", "c": "d"}) Yardanico: {} syntax is sugar openArray[tuple[val1: keytype, val2: valtype]] in Nim Yardanico: for* Yardanico: also encodeQuery automatically escapes strings so it'll be a valid part of URL Yardanico: A cool thing is https://github.com/zero-functional/zero-functional by the way Yardanico: "A library providing (almost) zero-cost chaining for functional abstractions in Nim." Rika: is it better than pure sequtils Rika: maybe itll become yet-another-dependency of circa xd Yardanico: well it should be more performant since it doesn't create temporary sequences Yardanico: it's a really cool example of what can be done with nim macros Yardanico: https://github.com/zero-functional/zero-functional/tree/master/benchmarks XDDD nothratal: @Yardanico , thx the encodeQuery is new to me. It does the same thing. Yardanico: yes, just don't forget that you don't need tables for the {} syntax Yardanico: [("hello", "world"), ("yes", "no")] is the same as {"hello": "world", "yes": "no"} Rika: {} even saves order if thats important Yardanico: uhh wat Yardanico: it's the same for both [] and {} since {} is sugar over [] Yardanico: and arrays/seqs are ordered Yardanico: tables are not unless you use OrderedTable Rika: yeah i know Rika: what do you mean lmao Yardanico: ? Rika: i was talking about {} and tables Yardanico: you didn't say so Rika: not your last message Yardanico: "{} even saves order if thats important" Rika: if you didnt send that message then it'd make sense xd alehander92: it was a fun benchmark to do but its old and probably was very inexact alehander92: overally we need first-class iterators, zero-functional is a huge hack Yardanico: but will they be fast? :P alehander92: with amazing work on writing custom operations by @micheal72 alehander92: but still the approach is hacky alehander92: well it seems rust was basically the same speed in those very strange benchmarks so why not Yardanico: ok time to continue debugging nigui with arc (it sigsegvs because it can't access the control object for some reason) Yardanico: the problem is that it's not easy to create a small example when the lib is a lot of lines, I've managed to strip it to 2.5k loc single file but that's still a lot Yardanico: ok down to 1.3k loc alehander92: how do you debug it Yardanico: run with/without arc :DD Yardanico: basically nigui does some casts and uses methods so maybe there's some bug here Yardanico: or arc behaves differently Yardanico: I also checked with --sinkInference:off and it doesn't help Yardanico: oh so apparently the method event handler gets a null pointer of control Yardanico: nice Yardanico: without arc it has a proper pointer Yardanico: not null one :P Yardanico: I mean gdb is pretty nice even without nim-gdb Yardanico: https://i.imgur.com/DTC11Gv.png Yardanico: so apparently in that proc after evt.control = control control is zeroed out lol clyybber: so its sinked Yardanico: but it also doesn't work with --sinkInference:off Yardanico: so I was a bit confused :P clyybber: yeah, its still incorrectly sinked. I think Yardanico: ah ok, I'll try to create a shorte example now clyybber: can you look in the C code and see what that evt.control = control translates to? Yardanico: to this if I correctly understand https://gist.github.com/Yardanico/9476cf354c39a7d04a95307ccf251a7b Yardanico: the whole c function https://gist.github.com/Yardanico/aab2a8e0b42ce76601bfad71d6e9dd89 Yardanico: -d:danger --gc:arc Yardanico: and nim source for the proc https://gist.github.com/Yardanico/529540799c9455907852abf0e134006f liblq-dev: @Bennyelg I know I'm late, but if it's your API you may be able to create a custom pragma that adds the procs to some `var procs {.compileTime.}: seq[NimNode]` clyybber: Yardanico: Looks like somehow we sink even though its used later. Yardanico: well yeah I'm still minimizing it, right now it's 1.2k loc and requires gtk :/ dom96: In case anyone wants to bike shed: https://github.com/TechEmpower/FrameworkBenchmarks/issues/5680 disbot: ➥ New classification for implementation types Yardanico: @clyybber I think I managed to repro it :) PMunch: dom96, did you ever try to wrap picohttp in Nim and see how that compares to the V wrapper? dom96: nope Rika: are we calling it pico.nim? lmao PMunch: I was just curious how much overhead V has when wrapping stuff Yardanico: phew, this one took a few hours to reproduce https://github.com/nim-lang/Nim/issues/14233 disbot: ➥ [ARC] Incorrect sinking of an argument? ; snippet at 12https://play.nim-lang.org/#ix=2kSu Yardanico: @clyybber ^ clyybber: nice, thanks!! clyybber: yeah, the dfa is not detecting the read/use of control in the last line correctly Yardanico: yeah I also posted a bit smaller example Yardanico: you guys can join arc bug hunting too, it's fun :P Yardanico: https://i.imgur.com/fYvgymp.png clyybber: actually, nevermind. The dfa has the last use of control.. clyybber: huh. this is a wierd one.. clyybber: I think its to do with type conversions Yardanico: well my second repro doesn't really do type conversions and doesn't use pointers Yardanico: or you mean type conversions in C? clyybber: hmm nope, I'm probably wrong Yardanico: btw if I remove the case statement it works Yardanico: ah wait clyybber: oh Yardanico: yes Yardanico: it works if I remove the case statement clyybber: hmm, somehow isLastRead can't deal with these forks then.. Yardanico: it also works if I replace "else: return" with "else: discard" :P clyybber: thanks, thats actually really helpful clyybber: so its the goto generated by the return clyybber: but the fork happening before should reach L22.. Yardanico: well it's nice that 1.4 (or next 1.2 release?) will have quite a lot of arc bugfixes :P clyybber: yeah 😄 disruptek: i smell a horse. Yardanico: oh hi disruptek Yardanico: are you motivated today? clyybber: hyo Rika: maybe you smell like a horse disruptek: eh i haven't had a shower this month. disruptek: wait, it's still april, right? Yardanico: ye disruptek: oh shit. Rika: time traveler Yardanico: ntw NiGui seems to work fine with arc if I replace two instances of "else: return" with "else: discard" Yardanico: hmm, had another crash, but we'll deal with it later I guess :D clyybber: yeah ::D disruptek: yardinco: the important list holds packages that /don't/ work. Yardanico: ? disruptek: we need a culture of assuming that things work. disruptek: #13912 disbot: https://github.com/nim-lang/Nim/issues/13912 -- 3Regression: hintConf exclusion no longer prevents hints ; snippet at 12https://play.nim-lang.org/#ix=2kSE Yardanico: @clyybber can you mark this one as ARC just for the sake of reference? 😛 https://github.com/nim-lang/Nim/issues/14219 (I guess I should ask 4raq to make me a collaborator in the repo again so I could label issues lol) disbot: ➥ ARC codegen bug with inline iterators ; snippet at 12https://play.nim-lang.org/#ix=2kLa clyybber: done 🙂 alehander92: oh well i found a waitFor in my async function Yardanico: xdd alehander92: but i wouldnt have found it anyway probably its indirect disruptek: agenda: compiler or game programming? Rika: `rg waitFor` ? shashlick: @liblq-dev - you around? liblq-dev: ye shashlick: i replied to the issue you opened shashlick: can you test with `-H`? shashlick: also, can you post the type which is getting messed up? I am wondering if the type generated is wrong or if it is wholly importc related alehander92: disruptek compiler ? disruptek: one vote for compiler. 😁 clyybber: count me for compiler too disruptek: damnit. clyybber: you cannot escape Willyboar: if i had to choose one i want to watch web but from those 2 of course game programming disruptek: YES disruptek: you are my man. zacharyc1rter: web dev bleh zacharyc1rter: game programming all the way zacharyc1rter: although you're not really programming games are you disruptek? zacharyc1rter: you sneaky sneaky bastard Willyboar: alehanders dont count because of the question mark liblq-dev: shashlick: http://ix.io/2kSM/nim, the C type is defined here: https://github.com/andrewrk/libsoundio/blob/master/soundio/soundio.h#L497 liblq-dev: I checked and the order seems to be correct on the Nim side disruptek: i don't program games anymore. disruptek: i program to make games unfun. zacharyc1rter: you're good at sucking the fun out of things disruptek: i'm a champion sucker, that's for sure. zacharyc1rter: :D clyybber: Araq: ping liblq-dev: shashlick: just tested with -H, seems to work fine Willyboar: zachary why not web dev Willyboar: ? zacharyc1rter: no web dev is the worst zacharyc1rter: let's light the web on fire and never look back at it again liblq-dev: my man zacharyc1rter: actually it's already on fire so let's just add gasoline liblq-dev: lol shashlick: liblq-dev - is SoundIoFormat defined as a `distinct cint` liblq-dev: it's a defineEnum() liblq-dev: not sure what the underlying type is shashlick: can you check types.nim - should be distinct int alehander92: disruptek just do whatever you want :D zacharyc1rter: he's going to anyway, don't worry alehander92: democracy is optional! Yardanico: @clyybber so there's a guy in telegram doing bindings for some C library, and basically he encountered a kind of memory leak with arc (or maybe it's just how it should work) clyybber: I'm in the group I'll look there Yardanico: ah ok zacharyc1rter: we have wayyyyy too many communication channels zacharyc1rter: let's just all use IRC k? liblq-dev: shashlick: yup, it's distinct int zacharyc1rter: it's like now we have a manual bridge to telegram lol Yardanico: zacharyc1rter: well telegram is less active than irc/discord/gitter combined of course Yardanico: I mean for nim shashlick: libliq-dev you need to pull latest head shashlick: it should be distinct cint, sorry zacharyc1rter: Yardanico: they should all just join IRC Yardanico: zacharyc1rter: that's true but some people think that irc is bad/hard and dislike it :D shashlick: liblq-dev - from the change log - Enums were originally being mapped to `distint int` - this has been changed to `distinct cint` since the sizes are incorrect on 64-bit and is especially noticeable when types or unions have enum fields. krux02: IRC is a bit crude. But that is what I like about it. zacharyc1rter: yeah I know - but pretty soon some new chat app is going to come out krux02: No images, no animations. zacharyc1rter: like soon we'll have a Nim facebook messenger group chat clyybber: oh no krux02: I think there is an xkcd about this zacharyc1rter: lol Yardanico: we need an instagram account for nim as well zacharyc1rter: yeah and a twitter group DM zacharyc1rter: bridge all the things Yardanico: don't forget to bridge the forum too zacharyc1rter: lol Yardanico: but who uses forums in 2020 am i right :D zacharyc1rter: we should have just gone the TempleOS route we were discussing yesterday krux02: https://xkcd.com/1782/ shashlick: @liblq-dev - can you try with latest head and remove the `-H` and see what happens zacharyc1rter: no community, we just get messages directly from God liblq-dev: shashlick: installing it right now zacharyc1rter: could have saved ourselves a lot of bridge construction time krux02: zacharyc1rter, only works if we have a holy bible of Nim. zacharyc1rter: haha Yardanico: HolyNim Yardanico: by krux02 zacharyc1rter: oh no zacharyc1rter: death to the heretics liblq-dev: featuring: a functional REPL disruptek: crude wins. nothing to complain about. zacharyc1rter: actually that's probably possible now with arc krux02: I am talking about a book, not a Nim fork. krux02: or -derivative/implementation Yardanico: zacharyc1rter: also see https://github.com/arnetheduck/nlvm/pull/18 https://github.com/nim-lang/Nim/issues/8927#issuecomment-580456200 disbot: ➥ [Grant Proposal] Make Nim suitable for interactive programming (Implement hot code-reloading, a REPL and a Jupyter kernel) ; snippet at 12https://play.nim-lang.org/#ix=2kSQ disruptek: arc of the covenimt. liblq-dev: shashlick: works now. thanks for that liblq-dev: I still believe that .header and .importc should be default though, it would save a lot of headaches if gcc suddenly decides to reorder fields for no reason shashlick: okay, i need to release soon so i'm worried about this issue shashlick: just to confirm, you tried without `-H` right shashlick: i think making it opt out is safer for folks anti[m]: #matrixforthewin zacharyc1rter: Yardanico: I saw that a few weeks ago but I think it's possible even without NLVM now Yardanico: how? zacharyc1rter: using dlopen / dlclose liblq-dev: shashlick: yes, that's without -H Yardanico: isn't that what hcr does shashlick: okay cool Yardanico: btw c2nim works with gc:arc just fine :P zacharyc1rter: Yardanico: no not exactly HCR works with the default gc Yardanico: well I still don't understand how gc:arc will allow repl to work Yardanico: without any shared libs zacharyc1rter: but it does used shared libraries and trampolines Yardanico: then what is the difference from hcr? zacharyc1rter: no you will still need shared libraries Yardanico: can't you use hcr with arc alehander92: hmm zacharyc1rter: I don't know - probably not zacharyc1rter: but I'm using shared libraries for hot code reloading without hcr zacharyc1rter: Nim's hcr rather zacharyc1rter: so a repl should be doable zacharyc1rter: but there are still complexities - like you need to use cstrings which are not Nim strings zacharyc1rter: but that's relatively easy to overcome zacharyc1rter: I'm using this library to do hot reloading - https://github.com/fungos/cr clyybber: Yardanico: Any way to not deal with this telegram slowmode thing? Yardanico: @clyybber the only way is to ask dom96 to disable it :P narimiran: slowmode? what do you mean? dom96: huh? narimiran: you mean that you cannot send multiple message one after the other? clyybber: Once you write a message you have a 10 sec cooldown clyybber: Yeah Rika: that subtitle tho on the xkcd narimiran: i added that because we had some spammy users Yardanico: yeah it's sad there's no 3s or 5s slowmode narimiran: you can edit your message (up arrow on computer) and then add stuff there narimiran: shift+enter for multiline clyybber: ah right Yardanico: although with editing other people won't see that the chat has a new message, but I guess that's not an issue when a discussion is ongoing narimiran: that way you can also avoid "* correction" messages - just correct the original one narimiran: people will notice if a message posted < 10 seconds ago was edited ;) zacharyc1rter: is there a good cross platform filewatcher yet for Nim? Yardanico: not with a permissive license ;) zacharyc1rter: I guess I get to write one zacharyc1rter: and it will work on macOS first :P zacharyc1rter: since that's the only OS my game engine works on atm Yardanico: look into https://github.com/snowlt23/nimwatch and fsmonitor from stdlib for some inspiration :P Yardanico: ah right its not in stdlib anymore Yardanico: https://github.com/nim-lang/graveyard/tree/master/fsmonitor Yardanico: such a depressing repo name zacharyc1rter: where projects go to die shashlick: does -d:checkAbi not work in `nim cpp` mode? Vindaar: zacharyc1rter: feel free to add support for osx here: https://github.com/Vindaar/fsmonitor2 ⏎ Been meaning to do it, but well .. :( shashlick: `/nimbase.h:547:17: error: expected constructor, destructor, or type conversion before ‘(’ token shashlick: _Static_assert(sizeof(typ) == sz, "Nim & C disagree on type size")` zacharyc1rter: Vindaar oh cool - I will do that Vindaar: I haven't used in in almost a year though, so I hope it didn't break in the meantime. Was working fine for my use case on linux PMunch: Hmm, any reason a non-nil cstring can segfault when converted to a Nim string? PMunch: Not null terminated? zacharyc1rter: I just need to run a sidecar with my game engine for recompiling game code zacharyc1rter: when a game source file changes zacharyc1rter: so I think as long as OSX support is added it should work perfectly file zacharyc1rter: and I can update to work with Nim devel Vindaar: cool! :) zacharyc1rter: fine not file PMunch: The graveyard, where the cool kids go to smoke and listen to emo music PMunch: Hmm, something funky is up here.. The cstring I should've gotten isn't a pointer to anything I can access. I get a segfault as soon as I try to get the first character.. PMunch: Problem is I can swear that this used to work.. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: rika: you awake? disruptek: !last rika disbot: Rika spoke in 12#nim 27 minutes ago clyybber: @Rika forward ping Rika: hello Rika: am awake yes disruptek: c'mon the stream and explain your gender. Rika: why? disruptek: we're talking about you and dunno which pronoun to use. Rika: use whatever PMunch: Haha Rika: why are you talking about me disruptek: trying to think of folks who are easterly. PMunch: Isn't "they" the sorta accepted non-gendered pronoun? disruptek: further east than yardanico. Rika: i am asian Rika: just use they or she or he Rika: i guess i'm considered gender fluid PMunch: Hmm, can confirm. It works with Nim 1.2.0.. disruptek: "does it ping they?" Rika: them PMunch: "them" disruptek: "does it ping they?" clyybber: wtf is going on Rika: dunno disruptek: i took a shower. Rika: installing mumble right now PMunch: disruptek is low on gender fluid, needs to top up Rika: hahaha dom96: everyone is on a spectrum when it comes to gender Danny Fritz: Does Nim HCR work as expected right now? Was reading through the RFC and it seems unclear if it does. Danny Fritz: I guess I should just try it out this evening. XD Rika: dom: i apologize if its annoying dom96: Rika: You've got nothing to apologise for Rika: i know some people are annoyed at it though so eh disruptek: let it be known: disruptek: rika is the shit. bedwardly-down: Disruptek, here’s some of my gender fluid in exchange for your nim compiler knowledge in full solitudesf: that doesnt sound right disruptek: i thought i felt something damp. bedwardly-down: 👀 Rika: "range types need to be constructed with '..', '..<' is not supported" i'd like to know why ..< isnt supported with range mratsim: lack of time mratsim: (just a guess) narimiran: because Ar4q doesn't like exclusive ranges :) Rika: i see Rika: thats fine was just wondering Araq: it's ...er... surprisingly difficult to do this in today's compiler :P Araq: no personal feelings involved bedwardly-down: Nim’s compiler or the others? Yardanico: there's only one compiler for nim as of today ;) Yardanico: you are free to implement another one if you want :D bedwardly-down: 🤮 bedwardly-down: Not anytime soon bedwardly-down: When i said others, i meant c++ and whatnot. I’m still not 100% sure how transpiling works Rika: those are backends shashlick: seeking feedback - https://github.com/nimterop/nimterop/issues/202 disbot: ➥ ABI break due to the lack of .importc in struct definitions ; snippet at 12https://play.nim-lang.org/#ix=2kRm Dankrad: I've a question regarding to gintro. Does anyone know if one of the following gtk procs are called before my main proc: gtk_init, gtk_init_check, gtk_init_with_args and gtk_parse_args? I'm trying to set the language on windows and it seems that the language has been set (calling setlocale(LC_ALL, nil) retrieves me the currently language I've set previously). I'm also calling disableSetlocale before any of the language relating procs. But my Dankrad: But my gui displayes everything in my system language. leorize: Dankrad: you should post on the forum, gintro author is more active there shashlick: meh, checkAbi worked fine in my older devel snapshot, now fails on head Dankrad: Thank you for your reply leorize, i'll if i dont get it by myself shashlick: says **`typedef int A13(int, int, void (**func)(void));` != `*A13* = proc (a1: cint; a2: cint; 'func': proc () {.cdecl.}): cint {.cdecl.}` shashlick: wish i had saved my devel hash before updating, now no idea what broke leorize: shashlick: looks like that's a pointer to a pointer of a function? shashlick: c2nim gives me **`A13** = proc (a1: cint; a2: cint; 'func': proc ()): cint`* shashlick: pretty much the same except the cdecl shashlick: added --cdecl flag and i get the cdecl as well leorize: yea, that one is pointer to pointer for real shashlick: okay bisecting, found a working commit shashlick: yep - @timotheecour fix for checkAbi broke this - https://github.com/nim-lang/Nim/commit/66db9de714be7c2f4cf1f2fb0a0a99145baf6acb leorize: shashlick: uhmmm but that's a wrong typedef for real dadada: hey dadada: oh man, I'm spending the whole day with debugging something that shouldn't be a problem in the first place ... wtf dadada: I copied docopt.nim from its github repository into my own project, made only a few slight changes, that shouldn't hinder it from working like it used to krux02: dadada: what did you debug on? krux02: what broke? dadada: and now with the exact same inputs, my version fails, while the original works, my testcases fail, their's work shashlick: @leorize: looks like changing to `(*A13)` gets it working dadada: I diffed the files, and the only changes I made are trivial... made some import changes, merged a util file into the main file shashlick: what should the wrapper look like for **`typedef int A13(int, int, void (**func)(void))`* dadada: and now I wanted to go full gdb debugger ... but sadly the vscode integration doesn't work ... shashlick: gcc doesn't mind that leorize: `type A13 = proc(cint, cint, func: ptr proc() {.cdecl.}) {.cdecl.}` dadada: krux02: it throws an exception, that it shouldn't throw leorize: don't trust gcc, it's C leorize: to it pointers are pointers krux02: dadada: I really can't help you with vscode, I tried it, but vscode is one of those gdb integrations that want to be visual studio debugger instead. krux02: ignoring the fact that they are actually using gdb, but faking the behavior of visual studio krux02: and that does work to some extend, but it makes it incompatible to gdb extensions and other benefits of gdb that you simply can't use at all if you use vscode. krux02: The only gdb integration that I know about that works correct is as far as I know emacs. krux02: But it is a super slim gdb wrapper krux02: you basically have gdb, but with an emacs window displaying everything. dadada: emacs is great, I just don't have the time to tinker with my editor all day :D krux02: dadada, I don.t do that either nor do I want to. dadada: after 2 weeks of using emacs I started to write my own elisp scripts ... krux02: emacs is more of a lisp machine environment that runs on other operating systems. And also an editor. And all sorts of other things. dadada: INSTEAD of working of on the code I should work on krux02: then don't do that. krux02: but it also isn't wrong to work on tools to help you do your job. krux02: But emacs is sophisticated in its base version. krux02: it is just very unconventional. krux02: And that is annoying. krux02: And not something that you can just get used to. dadada: spacemacs fixes a lot, but adds alot of complexity too krux02: Every time you switch an application, you need to remember that your keys work differently. krux02: Not very pleasing. krux02: I don.t use spacemacs as I never really liked vim. krux02: or modal editing krux02: anyway, using emacs just as a debugger is possible. dadada: okay, I'll think about it, let me see if emacs is still installed dadada: yeah, it's there :D krux02: set gdb-many-windows to true krux02: no, customize it to "on" krux02: M-x gdb will ask you for how you would like to run gdb krux02: nim-gdb -i=mi --args myprogram arg1 arg2 arg3 ... krux02: that is what you should enter there krux02: and then you are good to go dadada: nim-gdb? krux02: yes nim-gdb dadada: why don't I have that? krux02: that is the starter script to start gdb dadada: where is that script? krux02: I have it in the bin folder of my Nim installation krux02: (I install from source) dadada: hmm, it's not in my PATH krux02: is nim in your path? krux02: it should be in the same directory? dadada: yeah, nim is installed by choosenim krux02: fuck choosenim disruptek: lol dadada: nim is in .nimble/bin/ dadada: but no nimgdb krux02: yea, then you should stop using choosenim krux02: well you can continue to use choosenim krux02: I don't know what it does, but I never liked it. dadada: wasn't dom96 responsible for choosenim? leorize: dom96 is not really active here nowadays dadada: it was recommended in this channel leorize: and shashlick have his hands filled with tons of projects krux02: do you gave a nim git repository clone? krux02: if you have that, it is in there. krux02: and then it should work krux02: and then you can file a bug in choosenim that it doesn't provide nim-gdb properly. krux02: I really dislike choosenim, and my disliking already starts with the name. dadada: you're right, I will file a report krux02: nim-gdb after all is a bash script that starts gdb in a way, so that the python pretty printers are loaded. krux02: (python meaning they are implemented in python, not for python or something) dadada: this may be the bug https://github.com/nim-lang/Nim/issues/13104 disbot: ➥ nim-gdb is missing from all released packages krux02: well then comment that the bug isn't fixed. shashlick: yes that's the bug dadada: choosenim downloads over 45MB of c sources from github... (building from head with it) dadada: seems excessive? or is that really the size of Nim when it's compiled to C? shashlick: it gets deleted after build is complete federico3: yep :( shashlick: @leorize: would you be able to test your kmod wrapper with `-f:ast2`? dadada: shashlick: the issue is not disk space, but download time, and download speed, provider caps for some shashlick: choosenim downloads the .xz file which is very small in comparison leorize: dadada: csources is big because it contain c code for all supported os shashlick: if you mean choosenim devel then ya, it downloads a tgz which is bigger dadada: leorize: my hunch is that the real reason is that old versions of the files my be downloaded with the git index dadada: may leorize: nah, it fetches the release tarball from github dadada: 61mb and counting leorize: that thing is 2Gb btw leorize: :) mratsim: @dadada, 45MB is really small compared to other lang. Go is 300MB+ and Rust 1GB, Haskell is also a couple hundreds iirc leorize: jk, just around 100+Mb leorize: or is it 1 gig leorize: not sure if I remember leorize: shashlick: I will when I have time, if you want to test it, just verify that the examples compiles and run mratsim: Rust is 200MB compressed on Arch actually federico3: my binary package is 3MB and uses 12MB on disk NerdRat: Alo Alo! dadada: httpclient.nim(271) httpError dadada: Error: unhandled exception: Server terminated connection prematurely [ProtocolError] NerdRat: Choosenim is nice, I love it. It has some obscure and esoteric errors, that's why I love it! dadada: this is when you want to give up dadada: choosenim should use something like aria2 to not be in trouble when that happens shashlick: @leorize: it works ya mratsim: I don't think choosenim reaches the level of nimble errors, especially the dreaded single dot ".". I'll even call that the singularity PMunch: Huh, this is super weird PMunch: So I have a procedure marked with nodecl PMunch: It run just fine, and returns a pointer. But accessing the pointer fails. PMunch: By removing nodecl it works just fine zacharyc1rter: I SEE zacharyc1rter: lol whoops Recruit_main707: when having multiple threads accesing a variable, is there some kind of special thing you must do? disruptek: nah, just wing it. Yardanico: @Recruit_main707 pray to Nim Gods Yardanico: but really you need to have locks Yardanico: or atomic variables I guess Yardanico: I'm not really into the threading stuff, I only know locks :P Araq: locks are fine, use them Recruit_main707: can you briefly explain me locks then? PMunch: Locks are a way to gain exclusive access PMunch: A lock can only be "locked" once, any subsequent lock operation will wait until the lock is open again before getting past liblq-dev: @Recruit_main707, they're available in the locks module PMunch: So if you have two threads that both try to manipulate variable A, but they have lock/unlock around the so-called "critical section" you are guaranteed that only one thread at a time can execute the code in this section at the same time. liblq-dev: Nim has extra support for them, there's the {.guard: someLock.} pragma you can apply to variables and then you use withLock(someLock): liblq-dev: and the compiler will not allow you to modify (?) the variable outside of the withLock template call Recruit_main707: makes sense PMunch: Think of it as a way of saying "Hey I'm going to work on this right now, so don't touch anything I'm working on" Yardanico: yeah, common usecase is to use locks for IO for example Recruit_main707: that probably fucked up my async client :P liblq-dev: this is actually implemented using the {.locks: [someLock].} pragma which can be used to implement custom locks Recruit_main707: multithreaded* PMunch: Hmm, so nodecl does something weird.. dadada: I never really liked any debugger 12345: just add echo("here"); echo("here1") ... between lines PMunch: Hmm, why would a call with nodecl give me something other than a call without it? dadada: 12345: usually enough, but not always 12345: oh lel, im recruit let me change my name back, we were testing something cyraxjoe: Hi o/ Avatarfighter: Stupid question is there an easy way of converting seq[uint8] to seq[uint]? I'm casting atm but I just wanted to know if there was a better way cyraxjoe: I have basically the same question as in https://www.reddit.com/r/nim/comments/g3kpuz/exportc_javascript_object_method/ not sure if a lot of people already saw that... Recruit_main707: Avararfighter, it depends on what you are doing Rika: theSeq.mapIt(it.uint) is what i would do lol Yardanico: cyraxjoe: output of JavaScript backend isn't really tailored to be used in other JS code Yardanico: so you'll probably have to deal with JS prototypes and stuff Avatarfighter: @Recruit_main707 I need to pass a seq of uint8s as uints from one proc to another Recruit_main707: can you show us the code? Avatarfighter: its a tiny bit long hence why I was asking :L Yardanico: @Avatarfighter maybe you can just use implicit generics? cyraxjoe: Yardanico: it seems that is good enough with {.exportc.} (at least for vars and procs), but the prototype integration is missing indeed Avatarfighter: yeah I'll do that I've been dancing around that @Yardanico Recruit_main707: or safely cast whenever you use the uint8 and need them as uints Yardanico: cyraxjoe: well because nim has UFCS and doesn't need it ;) Yardanico: I mean you probably can make it work Recruit_main707: for instance: `theSeq[0].uint` Avatarfighter: yeah I can also do that Avatarfighter: I have a few ways of doing what I need but wasn't sure which is best lol Yardanico: implicit generics: https://play.nim-lang.org/#ix=2kUC Recruit_main707: i dont know which in is the best either :P Yardanico: i don't know either, nim doesn't have the "best" way always Yardanico: there's the fastest way usually, the most elegant way, the straightforward way Yardanico: sometimes these intersect Yardanico: (which is good) cyraxjoe: Yardanico: I was thinking in the use case of making the "core" in nim and exposing some _clean_ js object, it seems that currently that can be done, but you have to manually couple the type/procs into JsObject/bindMethod (from jsffi) Yardanico: yeah Yardanico: you can make a library to help others :P Recruit_main707: i have some homework to do, but after that, i would apreciate some help for transpiling a function from either go/python/js and maybe more options PMunch: What does N_STDCALL do? Yardanico: __stdcall Technisha Circuit: How do i turn a JavaScript object (like a string or an int) into a Nim object? Yardanico: JsObject Yardanico: PMunch: for example https://github.com/nim-lang/nim/blob/master/lib/nimbase.h#L166 Yardanico: search for it in the file Technisha Circuit: If I'm using Nim with C? PMunch: Right, but when I do nodecl the only change in my code is that that the call that declares it like that disappears. But it is still able to call the procedure and get a result, but it fails to read from the result. PMunch: But with nodecl the only definition of it should be in the original header file, right? Zevv: Technisha Circuit: ParseJson in the json module PMunch: So why does Nim try to call it with something it was not declared with? Does it somehow force fastcall, even for procs imported from C? Zevv: https://nim-lang.github.io/Nim/json.html#overview-parsing-json Recruit_main707: he talks about javascript objects though Technisha Circuit: > Technisha Circuit: ParseJson in the json module Technisha Circuit: For JavaScript objects? Rika: he means to go from JS objects to Nim Technisha Circuit: Yeah Zevv: oh right I wasn't reading properly, sorry Zevv: let me shut up now Recruit_main707: happens to the best of us :p Technisha Circuit: Like a JS string to a Nim string Technisha Circuit: Don't worry man/woman/person of no gender Prestige: Hm what is wrong with this? https://play.nim-lang.org/#ix=2kUE Prestige: do I just have to create an empty table then populate it? Zevv: Pmunch: , -> : Zevv: line 6 Technisha Circuit: ^^ PMunch: Zevv, what? Zevv: No, Prestige I ment, wrong tab completion PMunch: Haha :P Zevv: P is usually you Prestige: woops typo Prestige: huh my example works, what's going on in my actual code.. PMunch: I guess I'm flattered Zevv :) PMunch: Well, I'm not sure how your tab complete works, but apparently it's not last message Technisha Circuit: Maybe it's most common Technisha Circuit: Or if the next char is closer to A Yardanico: it's the next char of course Yardanico: I get PMunch first for P too Technisha Circuit: So how would i turn a JavaScript string, int, or float into the Nim equivalent? Technisha Circuit: And how about for JavaScript functions too? Prestige: PMunch: You're familiar with x11 Atoms yeah? Yardanico: depends on what you mean @Technisha Recruit_main707: from the c backend? Yardanico: i don't understand the context Technisha Circuit: Yes Yardanico: json Yardanico: JSON is literally a JS subset Yardanico: for data Rika: js functions? Rika: you can only call them in nim no? Yardanico: js fuinctions aren't exactly data Yardanico: and you can't call JS functions from C backend unless you embed a JS runtime in your app PMunch: Prestige, yup Yardanico: like duktape PMunch: Well, define "familiar" Prestige: PMunch: Attempting to do this: https://play.nim-lang.org/#ix=2kUJ Getting a strange error on the toTable call Technisha Circuit: I want to make a JavaScript module in Nim using the C backend using cffi, but I'd have to convert strings, ints and other data types into the Nim equivalents Prestige: I was thinking it may have to do with the pragma on TAtom but am unsure Recruit_main707: remember about the python interop? Yardanico: well @Technisha there should be some kind of API Yardanico: or the JS side manages things itself Prestige: Oh I bet it has something to do with hasing, eh Araq: use '.emit' to gain more control over the JS output Technisha Circuit: Okay, thanks Yardanico: Prestige: you have to define hash proc for object types yourself Yardanico: the simplest way is to hash all fields ( PMunch: Prestige, on runtime? Yardanico: wait wat Prestige: just from nimlsp, seemed I was able to compile the file though Yardanico: @Prestige you don't need tables here Yardanico: enums are just integers PMunch: Oh, I have the same thing.. Yardanico: you can just use an array Yardanico: or a sequence PMunch: That is a weird error indeed.. Yardanico: and use enum members as indexes Prestige: I'm going to be accessing the values by name later on Prestige: hmm Prestige: ok Prestige: Good point, thanks Yardanico Prestige: PMunch: when I saw a similar error before, the compilation failed and revealed a more verbose error about hasing PMunch: Seems to be a bug in nimsuggest: http://ix.io/2kUM Prestige: ah, rip Technisha Circuit: Is there something like Nimpy but for NodeJS? Yardanico: no Yardanico: what about using https://github.com/node-ffi/node-ffi ? Yardanico: idk Rika: node.js is pretty badly supported in nim afaik Technisha Circuit: Oof Yardanico: that too Yardanico: nodejs is mainly used for testsuite Prestige: Yardanico: I suppose the only slightly annoying part is, I need to keep the array declaration in the same order as the enums are defined Yardanico: the primary target of nim JS backend is browsers Yardanico: Prestige: I wouldn't call that annoying really :P Zevv: narimiran: "change 'iff' to 'if' to stop "corrections" once and for all", haha PMunch: More minimal example, doesn't seem to have anything to do with X PMunch: http://ix.io/2kUN Never Listen To Beef: @mratsim holy shit, my guesses arent always silly guesses?! That scares me that i was right Yardanico: daily reminder: please test your libraries with arc and open issues if they don't work or add it there https://github.com/nim-lang/Nim/wiki/Status-of-gc:arc-and-gc:orc-(library-compatibility) :P Yardanico: just so we can fix all the arc bugs narimiran: Zevv: ;) Prestige: PMunch: I think I have a knack for breaking things PMunch: Prestige, please report this, you can use my minimal example if you want PMunch: Yardanico, ooh, it's that stable now? Prestige: Sure, I'm using your paste though :P Yardanico: PMunch: well I mean a lot of libs work with it Zevv: Yardanico: yay, npeg is at #1 \o/ Yardanico: I reported 5 arc bugs in the last few days :D Yardanico: just was testing stuff out of boredom Zevv: I think Ar4q found 4 AR Zevv: ARC bugs because npeg is in the default test suite Yardanico: nice Zevv: nothing I had to do to fix it :) PMunch: Oh, some of my packages are already there :) Yardanico: yeah I tried nimlsp Yardanico: nimsuggest compiles with arc after adding nosinks but it doesn't actually work Yardanico: shows random strange errors everywhere PMunch: Although all of them in the "A bug or not yet sure" category.. Yardanico: also parsetoml/persvec use deepCopy which is not available on arc (yet) PMunch: Yardanico, as you can see above it does that even without gc:arc :P PMunch: But wouldn't nimsuggest working pretty much mean that the compiler would be working with gc:arc? Yardanico: well that's the ultimate goal Yardanico: with orc thoughj PMunch: Yeah, isn't orc the better choice? Yardanico: they're different Yardanico: orc is arc with a cycle collector PMunch: Yeah I know PMunch: So isn't it "better" Yardanico: well with arc cycles will just leak I think clyybber: it is probably better for nimsuggest 🙂 PMunch: Yeah, which isn't good.. PMunch: Is the penalty of using orc that big? Araq: orc is for applications, arc is for libraries PMunch: Huh, why does this error appear twice? http://ix.io/2kUS Rika: so libraries shouldnt have cycles? clyybber: Ideally no PMunch: (That error message is from a library for what it's worth..) clyybber: If they do, they should best take care of them themselves Araq: Rika: never seen a library here cycles are good design clyybber: (if possible of course) Araq: *where Rika: guess thats an extra todo for my library clyybber: tbf compiler as a library will still have cycles :p PMunch: What does "cursor" mean? clyybber: its a reference which doesn't contribute to the refcount. Araq: PMunch, "don't perform RC ops" clyybber: Its essentially the same as lent IMO leorize: cursor is unsafe btw :P Araq: leorize, well in debug mode we can add a second RC field to make it safe chapl: disruptek: irssi ftw. :P disruptek: say goodnight, gracie disruptek: Yardanico: same time every year. Yardanico: That's a good answer dom96: dadada, please do report choosenim problems you're having on github dom96: mratsim: I don't get the hate for the dots output by Nimble. dadada: dom96: I did report it... dom96: I don't see any new choosenim bug reports Vindaar: @dom96 pretty sure mratsim is referring to these kind of errors: https://github.com/nim-lang/nimble/issues/756 disbot: ➥ Very poor error messages when evaluating .nimble files ; snippet at 12https://play.nim-lang.org/#ix=2kVC dom96: oh, i think you're right chapl: "/Users/dom/projects/nim/lib/pure/streams.nim(274, 9) Error: undeclared identifier: 'copyMem'" ?? dom96: That's a really silly thing to criticise to be honest :P dom96: I spent time to make a custom error message to explain that Nimble is attempting to read the .nimble file as an ini file and a nimscript file dom96: You cannot get clearer than that exelotl: woww I found an ancient copy of Nim on my external hard drive exelotl: https://cdn.discordapp.com/attachments/371759389889003532/707330912697843763/unknown.png Yardanico: Wow Rika: nice Yardanico: Well tbf you can get the same awr1: doing this PR - is the next version of the lang supposed to be 1.4 or 1.3? exelotl: this was back when I was making games in `ooc` which was another language that compiles to C leorize: 1.4 Yardanico: Nim repo has commits since 2008 Yardanico: @awr1 you should use since 1.3.1 dom96: exelotl: hah, I've had friends that used ooc awr1: i'm writing up `since` annotations, should i use `.since: (1,4)`? Yardanico: 1.3.1 I think Yardanico: You should account for devel version awr1: oh okay leorize: awr1: write `since: (1, 3)` Yardanico: (1, 3, 1) will work dom96: exelotl: I even wrote up a gist a while ago outlining why I prefer Nim :P dom96: Cannot find it though dom96: I should have said "friends that used and contributed to ooc" Yardanico: See https://github.com/nim-lang/Nim/pull/14197#discussion_r419789724 disbot: ➥ Make the fields of `times.DateTime` private dom96: honestly, to me (1, 3) doesn't make sense dom96: it should be (1, 4) clyybber: odd is #devel narimiran: if you ask about `since`, use `(1, 3)` clyybber: and you wouldn't want to exclude the users who use #devel from features being introduced in #devel :p exelotl: at the time I totally bounced off Nimrod, it mainly cause of the docs and the way that so much stuff is named differently compared to C-like languages dom96: the only use that the since annotations have to me are to let me know which version procs have been introduced in dom96: in that sense odd versions make no sense dom96: since they are never released Yardanico: Well they are still used between releases in devel Yardanico: And since actually disables features if your version is lower than specified dom96: I find that use case silly awr1: you know i'm looking at bitops again and i don't get it, there are all these masking operations but no one that maps directly to `and` which is really... "the masking op" awr1: `setMask` actually is just an `or` which is weird awr1: https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/bitops.nim#L73 awr1: i will have to improve this API a bit liblq-dev: how should I name an "unsafe" leaked implementation detail procedure? Rika: leaked? nothratal: can someone explain me how timezones in nim are working? ⏎ ⏎ ```2020-04-27T00:00:00+02:00==>1587938400 ⏎ 2020-04-28T02:00:00+02:00==>1588032000``` ⏎ ⏎ I expected that the first line contains the timezone but not the second one. Instead both have the timezone and the second line also has +2 hours [https://gitter.im/nim-lang/Nim?at=5eb1d64c7a24ff01b0031f44] liblq-dev: yes, leaked. because it should be private but can't liblq-dev: I was thinking about prefixing it with IMPL_ Rika: you cant??? liblq-dev: no, because it's used in another module Rika: export except not working? liblq-dev: I have one module which is an abstract interface and then modules that use the interface Rika: then the exporter file cant except the interface? Rika: i usually have a file that exports everything needed or so liblq-dev: I don't have such an exporter file, it would hurt documentation kaushalmodi: @nothratal By default the time will always be converted to your local time zone kaushalmodi: looking at that output, your local time zone is probably +2:00 kaushalmodi: You will need `inZone` to get the time from the perspective of a different zone kaushalmodi: Copying @GULPF as he's the expert in this field (I forget the difference between the "time zone" and "time offset") nothratal: I read that in the documentation, yes +2:00 is correct nothratal: but nothratal: why do I have a time difference? I changed "+02:00" to "+00:00" nothratal: this should only affect the time zone displayed but not the time itself kaushalmodi: someone can correct me here.. but what your code essentially did is "hey, here's this time in +00:00 time offset, what's the effective time in my local timezone" kaushalmodi: that code keeps the time absolute based on the time offset you provided kaushalmodi: it just printed the corresponding time in your time zone nothratal: ahhhh ok, that could make sense Rika: wait Rika: let me understand your code first Bennyelg: do we have builtin function in nim which convert camelCase to snake_case ? Avatarfighter: dang I love js as a language but porting js -> nim is the biggest hassle I've ever had because I can't tell what size the ints are :L Rika: https://nim-lang.org/docs/times.html#parse%2Cstring%2CTimeFormat%2CTimezone%2CDateTimeLocale @nothratal Rika: default for `zone` is `local()` Rika: you can assume what these mean Rika: ah yes, js, the language where integers dont exist Avatarfighter: its not that they don't exist its that they morph to different sizes lmao leorize: Avatarfighter: if you want a constant size, use a sized int lol Avatarfighter: leorize: lmao I wish it was that easy Rika: @Avatarfighter but afaik most js implementations do not store numbers as ints at all, theyre all floats leorize: Avatarfighter: what's the problem then? Avatarfighter: I converted some bitwise operations from js to nim directly and the outputs aren't exciting lmao leorize: well you probably did something wrong :P Bennyelg: Why del not working from request.params as its : Table[string, string] ⏎ requestParams.del["key1"] leorize: because that's not the syntax :) leorize: use `()`, not `[]` Bennyelg: tried leorize: del is a procedure Bennyelg: not working leorize: !eval import tables; var t: Table[string, string]; t.del "hi" NimBot: leorize: seems to work just fine here Bennyelg: (https://files.gitter.im/nim-lang/Nim/QMRp/image.png) Avatarfighter: leorize: I always do something wrong its my style 😛 here is where I'm having fun https://hastebin.com/mowiwapoje.makefile I made a custom operator for "^=" xor assignment Avatarfighter: I know what the issue is though its the same as last night, I gave one of the variables the wrong size leorize: :P leorize: make sure your constants are typed leorize: ie. 0u8 or 0u32 Avatarfighter: wym constants I don't think I have any 😛 leorize: Bennyelg: try compiling it leorize: sometimes the linter can be weird leorize: Bennyelg: actually I think I know your problem Bennyelg: no no it didnt work maybe because something related to const leorize: !eval import tables; let t: Table[string, string]; t.del "hi" NimBot: Compile failed: /usercode/in.nim(1, 20) Error: 'let' symbol requires an initialization Bennyelg: I saved it in different variiable and it works leorize: yea, Table is a value type Bennyelg: I mean : I got request.params and it probably can't modified leorize: https://nim-lang.org/docs/manual.html#procedures-var-parameters Bennyelg: do we have something which snake_case string? leorize: ? Rika: ? Bennyelg: Nvm I'll write a new proc Avatarfighter: I'm actually so hyped for when I'm done with this lmao nim is about to get the sketchiest crypto it has ever seen 😛 kaushalmodi: @nothratal I am not sure if this helps or confuses more, but I quickly extracted this from a different project of mine: https://play.nim-lang.org/#ix=2kVW dadada: staticExec isn't calling a shell to call commands, is it? dadada: cause that would be very handy right now leorize: dadada: it's calling a shell dadada: ooh, nice, should be documented in https://nim-lang.org/docs/system.html#staticExec%2Cstring%2Cstring%2Cstring leorize: I think it's kinda common knowledge that any call that takes only a string will use the shell dadada: put yourself into a beginners mind, maybe it's common knowledge for you and your friends dadada: I assumed it could use a shell, but wasn't 100% sure, so I asked dadada: documentation needs to be written in a way that somebody new to programming can catch up to that common knowledfge dadada: knowledge leorize: was just stating my opinion :P Rika: does `object of` (note, no ref) only copy the fields from the base? Rika: or does it do something else leorize: it makes a new object type that's inherited from the base leorize: this mean it carry with it some RTTI Rika: is there a way to make 2 objects where one also takes the fields of the other and nothing else? Rika: or must i make a pragma leorize: wdym? leorize: distinct object? Rika: no Rika: i want the other object to have its own unique fields too leorize: then inheritance? Rika: no Rika: i dont need that Rika: i legitimately only need it to copy the fields leorize: then no you have to copy the fields leorize: I can't imagine a situation where you would need to do this though Rika: i want to make an object that i can use `json.to` with and another that's the main type Rika: (very lazy, yes) leorize: that is hacky as hell leorize: treat your data structure with some respect :p Rika: naw leorize: why would there be two types with the same fields but one has a bit more? Rika: maybe i can write a template w/ typeInstance.fields Rika: because one of its fields cannot be serialized in json Yardanico: Guess I'll try to run Nim on https://wiki.kolibrios.org/wiki/Main_Page tomorrow , it has GCC and it's own libc (that OS is mostly written in assembly) Yardanico: Really cool small thing Yardanico: --os:any ftw :D leorize: Rika: then write your own `%` for it? Rika: leorize: you think theres a sensible way to serialize a DbConn leorize: write a `%` for the object type itself Yardanico: Isn't there no runtime impact if you use inheritance with ordinary procs leorize: then ignore the DbConn field Yardanico: Without methods leorize: Yardanico: he seems to want a way to partially serialize a data structure into json Rika: no, deserialize actually leorize: a custom overload for `.to`? Yardanico: @leorize well I'm asking generally :) leorize: signature should be: `proc to(json: JsonNode, yourType: typedesc[YourType]): YourType` leorize: Yardanico: yea, afaik the rtti overhead only incur when you use methods leorize: or when you use things that need it, like `of` Rika: leorize: found what i must overload, `initFromJson` is what i must overload it seems Rika: will overload them now Recruit_main707: i am experimenting with threads, and i have this code here, but when it finishes, nothing its printed, why? https://play.nim-lang.org/#ix=2kW2 clyybber: Recruit_main707: Because you commented out the print? Recruit_main707: im not stupid, i mean at the end clyybber: kk clyybber: works for me Recruit_main707: hmmm clyybber: are you on windows? Recruit_main707: ye clyybber: where are you running it from? Recruit_main707: terminal clyybber: but you see the "done" being printed? Recruit_main707: no, nothing at all clyybber: thats weird clyybber: try powershell maybe Recruit_main707: neither... clyybber: try nim r yourfile.nim Recruit_main707: i dont understand, why does counting up to x take longer with multiple threads stefantalpalaru: I think getTotalMem() and getOccupiedMem() are lying to me. They claim a few MiB are used, while dumpHeapInstances() reports hundreds of MiB in the GC-managed heap. leorize: Recruit_main707: because threads have a huge overhead dadada: oh, I hate it when I hit on something that may be a Nim bug :-( It's so much nicer when the fault is mine leorize: stefantalpalaru: I think those numbers are the amount of GC owned memory that's used Recruit_main707: leorize: then threads are only worth it (for performance reasons) when single thread cant keep up? leorize: threads only worth their performance cost when you can max out all of them leorize: this is because you aren't the only person spawning threads on your system Recruit_main707: that sounds a bit abstract :p leorize: if your threads don't take a large amount of computing power to function, then the OS will schedule other threads that need it first Recruit_main707: So, threads are basically more useful the more you need them? dadada: is there a way to tell the parser that code generated by a macro is valid? dadada: Nim complains about something being wrong, that's clearly right dadada: and I'd like to preemptively tell it that it needs to shut it leorize: dadada: if the compiler complains that it's wrong, it's wrong dadada: leorize: no, it's not always, Nim has bugs leorize: don't use `repr` to print out your macro result leorize: use `treeRepr` leorize: the AST on the other hand is pretty solid leorize: invalid AST will trip the compiler, but valid AST will always pass Recruit_main707: macros are hard, it’s rather unlikely you found a compiler bug :) dadada: leorize: it's complaining about code that definitely should work, in this case I'm certain leorize: well can I see the code? skrylar[m]: i think i've given up hope of ever using the nim forums. poked password reset again and it sends the email, says it changed the pw, then login says "invalid." and its been like this for like .. two years now, people just say ping dom, and then he never does anything. and it stays broken. *hops down pot of coffee in shrugs* leorize: dom96: ^ leorize: you really need to fix nimforum, dom Recruit_main707: I’ll @ him on discord, he has been active over here recently @dom96 ^ Rika: dadada: can we have code then, im interested in fixing it dadada: leorize: https://pastebin.com/UaYvLHuz dadada: I used treeRepr, because you forbade repr dadada: with repr it was even clearer dadada: basically I generate a simple test proc leorize: yea it's wrong :) dadada: (which in my actual code is just a transformation from a real proc that I take in with a macro in the stmtlist) dadada: the proc returns bool Recruit_main707: I didn’t specify that dadada: so the infix a == b should be no problem clyybber: > threads are basically more useful the more you need them? clyybber: Goes for everything in life :p leorize: I really hate nnkStmtList for this leorize: sometimes it work as an expression, sometimes it doesn't :P dadada: 1) written by hand it works dadada: 2) written by macro it doesn't dadada: 3) ??? wtf clyybber: nnkStmtListExpr is what you want leorize: I think you need nnkStmtExpr for this leorize: ah yea nnkStmtListExpr dadada: why are there two and not one that JUST WORKS leorize: though shouldn't the compiler take care of this if the output is untyped? clyybber: because legacy leorize: I hate the compiler for that too Recruit_main707: Bc one is an expression I guess :P leorize: in the right context nnkStmtList can be an expression :) leorize: how fun Recruit_main707: Nevertheless, despite this being wonky, if you want it as an expression you should use the one for expression, if not, the other one, that avoids confusing the compiler leorize: it's a PITA when you are transforming things though leorize: lemme try to make a reproduction code Recruit_main707: (But that should be fixed) and if you ask me, just don’t let nnkStmtList be an expression leorize: usually an untyped output should have the compiler fix all of these issues leorize: so I'm kinda surprised actually dadada: https://github.com/oilshell/oil/issues/740#issuecomment-624259000 dadada: help me dispell this guys myths dadada: he would make the right choice by selecting Nim and believes in a few wrong "issues" that aren't really issues dadada: I think he confuses Nim with a transpiler dadada: and don't tell him about the Nim bugs :-) skrylar[m]: nim is a transpiler Rika: i dont see him mention it dadada: no, but I think it's implicit, Vala doesn't hold a candle to Nim leorize: dadada: ok now you got a problem leorize: I can't reproduce it skrylar[m]: vala does a fine job if you want a C# that is welded to GObject and you have no aspirations of ever supporting windows or mac dadada: leorize: what did you do? Never Listen To Beef: I dont even know what this guy's point is Recruit_main707: skylar, I think it’s not, a transpire would grab nim code and spit it’s c clone, but nim optimizes it, that’s why I consider it compiler leorize: dadada: generated that exact AST https://play.nim-lang.org/#ix=2kWh skrylar[m]: people consider a transpiler anything that doesn't ultimately emit a binary skrylar[m]: it outputs c, so its a transpiler leorize: Recruit_main707: the idea of a transpiler is stupid anyway skrylar[m]: haxe also (attempts to) optimize, but it ultimately doesn't make exe's leorize: you can say gcc is a transpiler and you wouldn't be wrong leorize: gcc don't make exe either Recruit_main707: > it outputs c, so its a transpiler Recruit_main707: Ppl is sometimes dumb though :) Rika: dadada: imo thats a minor detail, the vala thing Rika: he's not against the idea skrylar[m]: anyway i dunno why having readable C matters in this case, but eh leorize: people be like: it outputs C, so it has to write C for me skrylar[m]: eys not upset at outputting C, ey's upset that the output C looks godawful Rika: tbh, i'd be against the idea of switching language after ive already translated part of it in the language i chose leorize: we should stop advertising outputting C Never Listen To Beef: I mean if im not writting asm am i even writting code? dadada: skrylar[m]: transpilers to me are things like coffeescript, I'd like to have different terminology for different things, to me a transpiler makes a 1:1 translation, and a compiler uses the target simply as a means to an end, and not the end skrylar[m]: V claims readable C output but it looks just as horrible dadada: skrylar[m]: even if I were to agree with you, what different name for a coffeescript like thingy would you then choose? skrylar[m]: ¯\_(ツ)_/¯ i dun really need you to agree with me. that's just what people call the things Rika: i dont believe transpilation is a word at all Never Listen To Beef: I dont think it really matters Never Listen To Beef: 😛 skrylar[m]: i would just call it a meta-language if its whole point is to let you write some other language easier skrylar[m]: which is what coffeescript and icedcoffeescript are for Rika: thats almost like calling translating a dialect into its "ancestor" not translation Rika: imo Never Listen To Beef: If you complain about something transpiling vs compiling, shouldnt you complain about writting C instead of asm? Joshua S. Grant: The hype around V (even the amount of stars it has) blows my mind tbh Rika: @Joshua S. Grant its just really good advertisment Rika: which nim doesnt really do skrylar[m]: well V is teeeensy and fast, like Go tried to be Never Listen To Beef: Like to my uneducated brain compiling C results in the same issue of converting from C to asm, unless im dead wrong? Recruit_main707: But it’s optimized Sam skrylar[m]: it also sounds like they want nice stacktraces Joshua S. Grant: Kinda sad that http://libcello.org/ never took off in this space :^P Recruit_main707: > which nim doesnt really do Recruit_main707: We are doing smart propaganda with memes though :p skrylar[m]: beef is tempting but good god anything llvm based is a nightmare Rika: whats so bad about llvm Joshua S. Grant: @Recruit_main707 Worked for Rust (or at least, made it more known) as-long as we don't get a reputation of "the annoying RIIR" crowd from other communities I'm fine with it / think it's overall a good-thing, yeah. skrylar[m]: @Rika well in beefs case it got spotlit by a big youtube channel so people flooded in, but the sole dev is a windozer so none of the advertised nix stuff even works Recruit_main707: I’m already the nim boi of the server, the memes are another way to torture them skrylar[m]: so you have to build this monsterous llvm checkout which takes hours Joshua S. Grant: What is the excitement for a llvm based Nim; That it's an already thriving ecosystem / near-standard at this point and there's no real maintance costs besides your own stack? skrylar[m]: and then it uses an older version, so look forward to a long heave of an updateat some point skrylar[m]: something amuses me about how fossil and v almost fit on a floppy but yet are almost an entire devstack leorize: Joshua S. Grant: better debugger integration Joshua S. Grant: I've guess I just haven't seen it -- but I assume it would be "as competent" as source-to-source compilation / transpiling? Joshua S. Grant: Like you could still Nim -> LLVM -> C++ Joshua S. Grant: ? Recruit_main707: llvm is as promising as Vulkan in graphics, it’s definitely the way, but they still don’t offer something that big for people to massively use them and abandon what we have (imho) skrylar[m]: eeh when you are tied in to the code generator you can get away with more silly low level stuff, whereas transpiling to c means it has t ofit in whatever c wants you to do skrylar[m]: this problem came up with chicken scheme where a lot of engineering went in to conning C to let you do things Scheme allows but C doesn't, like their crazy continuation bullshit Joshua S. Grant: @Recruit_main707 So the argument is the 'architecture is better' but it's not so-much-so that it's worth throwing everything away for it? Recruit_main707: That’s more or less how I see it Joshua S. Grant: "cons-ing C" * lol Never Listen To Beef: @Recruit_main707 steam did branch mesa to include ACO over LLVM for vulkan to increase performance of game. I dont know the context of your comment though skrylar[m]: i dont tend to use debuggers anyway so :f Joshua S. Grant: Think that was already a pun anyways (scheme x conning) but still; Need to double up! Recruit_main707: Anyway gn all Joshua S. Grant: Oh, peace Recruit skrylar[m]: i did spend a few moments thinking about how one could have abusive fun with a wasm backend skrylar[m]: and looking at how one might HCR wasm Rika: doesnt nim work well with gdb? Rika: so the gdb part of the dude's comment isnt too accurate Rika: why does he need to step through the *generated* code, and not the code that was *written*? Joshua S. Grant: Can't wait for like 5-10 years from now when we start seeing Nim-x-Wasm games start popping up itch.io and 'just work' like a lot of these native-web-games that get embeded skrylar[m]: eh. i'm just curious to try it for stuff really. skrylar[m]: but i've seen a research group using wasm to do smart contracts and then the haxe nightmare where they transpile to js to run on charka to livecode 3d apps skrylar[m]: or make those crazy time travelling debuggers like elm once had Joshua S. Grant: I really need to look into HCR more; Have no clue what the actual limitations are -- and I'm imagining "nim, basically one-removed for a scripting-language" for Gamedev ... which I think is being way-too-optimistic at this point, probably lol dadada: leorize: can you show me your code ... dadada: please? dadada: leorize: I can't get it to work, even when using StmtListExpr skrylar[m]: @grant nim makes the process load itself like a dll so when you run a reload function it re-dlsym/getprocs everything and functions go through a jump table skrylar[m]: downside is when i tried it on windows, the aftercodereload hook caused segfaults leorize: dadada: I sent you the paste? leorize: you probably missed it skrylar[m]: but since you have to sit theough 5-30sec of build time to trip hcr, it's only worthwhile for stuff that has a lot of heavy persistent state like socket connections or textures and stuff Joshua S. Grant: Hm. sounds interesting; Wonder how this compares to other compiled languages with similar features -- namely CL (no idea how that magic works lol) leorize: dadada: https://play.nim-lang.org/#ix=2kWh dadada: leorize: ah, thanks! yeah I was writing about how great Nim is skrylar[m]: CL is amazing magic Joshua S. Grant: Also, gonna change my nick to '@jsgrant' on discord so it's not as-crazy to type out lol Never Listen To Beef: @Joshua S. Grant i imagine using the nim VM with an underlying nim code base would be a more worthwile method, but idk Never Listen To Beef: Could just be my Unity brain talking skrylar[m]: its basically an interpreter/compiler and when you define an object or a proc, CL runs a compile proc in the image and that outputs a new set of bytecode/assembly and sticks a reference in the image, kind of like how forth has the dictionary of words. so CL is literally a script that writes itself incrementally skrylar[m]: the image is then the result of that self-writing skrylar[m]: its also why a common lisper will never wait 30 minutes to test a build ^^; dadada: leorize: I'm doing that in a subproc of a macro, there it's NimNode and not untyped, could that be a reason? leorize: no idea skrylar[m]: (on the off chance you look at smalltalk; don't. their magic is the same as CL.) zacharycarter: I've used CL and I don't find it that amazing skrylar[m]: (declaim (shunned 'zacharycarter)) zacharycarter: yes lisps and schemes are cool Joshua S. Grant: I've 'played' with Pharo a few times; And it was pretty fun, but I don't know how much of it was the language or the crazy "almost an operating-system 'ide'" zacharycarter: but the ecosystems and portability is not great zacharycarter: nor is using emacs zacharycarter: the last time I tried using CL I couldn't even get SDL2 working on my mbp skrylar[m]: pharo is kind of trying but they are constrained by being funded by research grants and not actual business users JSGrant: Think the ecosystem, for being like 30 years old and being a LOT MORE niche than other similarly aged ecosystems is pretty-solid. It's just super-modular / tacked on zacharycarter: and it wasn't due to user error it was due to an issue with SDL2 bindings for CL skrylar[m]: i am using janet bolted on to nim dadada: leorize: private message! zacharycarter: The language should have a better ecosystem if it's been around for 30 years JSGrant: If it was popular, maybe lol JSGrant: Most advancements I've seen have been since it's niche growth over the past 10 or-so years zacharycarter: I think CL is fine if you want to write everything yourself - lispers claim amazing productivity but they end up authoring everything themselves zacharycarter: Nim might be more popular than CL at this point JSGrant: Roswell itself is such a big boon, it's unbelievable to oversell it JSGrant: Same with Quicklisp JSGrant: and later qlot skrylar[m]: you mean like.. we are doing. (<_< ) zacharycarter: no we're not zacharycarter: we have the advantage of being able to easily consume C/C++'s ecosystems zacharycarter: as well as JavaScripts if that's your thing JSGrant: Lol, tbh Skylar; Nim is compartiviely very new and CL does like re-implementing stuff over-and-over historically but I don't see that as a bad thing personally (and not what is holding CL back). skrylar[m]: CL is held back by the part where all the free runtimes are convinced 70mb hello worlds are not a problem JSGrant: Gotta be honest, unless on an embedded system -- which CL is not really aiming for ... I kina belong to that club skrylar[m]: they are literally blind to ex. gamedevs needs and will attack you if you say hello i am from gamedev how do i do these things i absolutely cannot compromise on and their response is you are too stupid for lisp and should compromise on everything leorize: CL is held back by the fact that you need their super custom setup just to write code :P skrylar[m]: treeshakers are also bad because only corporate people use those and if you are a company you shuld just buy frans or lispworks and gtfo skrylar[m]: i've seen more than a few developers say they were excited for lisp but the lack of being able to actually use it in a game engine killed the decision in minutes JSGrant: I personally see a lot of testimonies about agressive 'smug lisp weenies' and the like, but being involved in that orbit more than any other language-family thusfar -- I haven't really seen it. zacharycarter: I have skrylar[m]: i did in sbcl skrylar[m]: i was attacked for even mentioning the importance of c abis zacharycarter: not mentioning any names but I think we just had one who said some pretty negative things about Nim zacharycarter: regarding it as a language they wouldn't use even if it was the last one in existence skrylar[m]: i have this https://git.sr.ht/~skrylar/janim but it needs some smoothing over Rika: cough Rika: jsg. should know who you're referring to covidian: what is the optimum number of pgming languages to have ? like how many ought the universities teach ? JSGrant: Who I'm refering to or who they are? skrylar[m]: covidian: smalltalk =p zacharycarter: I'd be more interested in diving further into Chicken / Guile / Racket or checking out scopes honestly zacharycarter: than spending another minute using CL Rika: who they are skrylar[m]: racket seemed okay but.. not a schemer here. Rika: covidian: that is an unfortunate name skrylar[m]: naughty dog uses racket for their custom lispy stuff now skrylar[m]: (they also suck now, for unrelated reasons) zacharycarter: actually I really want to get more into forth zacharycarter: I think the next language I spend a lot of time using will be forth Rika: how about factor? Rika: forth's child or something skrylar[m]: factor is kill skrylar[m]: dev was eaten by googlebucks Rika: oof JSGrant: Also, not trying to write anyone off here; And maybe arguing that they're not agressive is the wrong way to go about it -- I think I'm more-so saying most are not TRYING to be agro / rude. I've just interacted with a fair bit of them (and probably the person in-question (who has personally dm'd me borderline agro)), but I've more-so noticed that hardcore common-lisp people are often both really opinionated and really conservative (about th JSGrant: skrylar, are they still using Racket? I've heard conflicting stuff; Like evidently they stopped after they were bought out by Sony but then have here-and-there afterwards for the dialogue / interaction system in some games mratsim: That's true for many communities actually mratsim: Arch is the same skrylar[m]: they used franz lisp when sony bought them, made one game with c++ that sucked, then went to racket and started winning awards again mratsim: Nim also somewhat skrylar[m]: they only use racket to transpile tho skrylar[m]: (obviously they can't use racket proper because it has funny licensing and they are console devs who can't make weird lgpl-ish compromises) JSGrant: I know Jak & Daxter used GOAL pretty extensively, which was a scheme-like written in franz lisp to compile to assembly -- allowed them to dynamically load part of the map and get rid of most of the loading-screens JSGrant: I thought Racket was dual-licensed Apache2 / MIT? skrylar[m]: if its apache and mit thats new 'cause when i last checked it wasn't that liberal JSGrant: Okay, now I have to re-read this because I'm confused more now; lol skrylar[m]: i have an unfinished transpiler that turns sexps in to a shitty game-specific language that is suffering to code for lol. need to write another one for glsl JSGrant: "Racket is primarily distributed under the Apache License, version 2.0 and the MIT License, at your option. Some components of the Racket distribution, including the compiled racket executable for the "Regular" variant of Racket and packages that distribute third-party libraries, are distributed under the GNU Lesser General Public License (LGPL) version 3.0." skrylar[m]: well glsl is not bad. but does have some silliness skrylar[m]: anyway. no funcoding today. logging and tracing ._. zacharycarter: what are you working on? skrylar[m]: game engine/game zacharycarter: ooo zacharycarter: in Nim? skrylar[m]: it is zacharycarter: nice zacharycarter: any screenshots? Rika: or a repo link ;; JSGrant: @mratsim Also yeah, I think it's any community that is "moderately successful overtime" just to differeing degrees. And also, probably made worse by if the operating paradigm used is significantly different than what's popular; Because there's people who come in and go "why isn't there x,y,z?" and there very-well maybe be good reasons for it or 'you can do it this way, there's no reason for this' and there's an inherent friction there skrylar[m]: zacharycarter: nothing fun https://media.discordapp.net/attachments/643402542000373761/706457747360841849/unknown.png skrylar[m]: i read over corona sdk, love2d, libgdx, and less recently heaps.io, and sort of shrugged at how little all these "engines" actually "do" zacharycarter: better than mine currently skrylar[m]: well libgdx has a large pile of random stuff that kind of works JSGrant: corona just got renamed, didn't it (because all of them unfournate association to covid)? zacharycarter: https://imgur.com/dQThyOU JSGrant: Solar2D now evidently zacharycarter: well mine currently has hot reloading / plugins and a fiber based job system skrylar[m]: i remember at one point their approach to skeletal animation was "buy a proprietary program with web activation" :| which i guess is fine because monogame's answer to shaders is "just use windows to compile them rofl" zacharycarter: https://github.com/zacharycarter/frag skrylar[m]: mine just has pretty linebreaks zacharycarter: working now on draw call command buffers skrylar[m]: debating on doing rich text inside of simpletext. it occured to me that since it already does vbox and hboxes for tex, that changing typefaces is just indexing a typeface array when calculating bounds skrylar[m]: and coloring text is just changing a palette code that the GLES-izer reads JSGrant: Forgot to ask; Is this version of frag mostly a reimplementation or what; Noticed the organization's version was archived still? zacharycarter: it's a new version - I wrote the original skrylar[m]: ey keeps rewriting it =p zacharycarter: we made an organization because there were two of us involved, but the other guy only ended up writing about 10 lines of code zacharycarter: it was also my first game project in Nim JSGrant: News about Frag a few years-ago was my first introduction to Nim, actually. :^) zacharycarter: this is also the final version :P skrylar[m]: also need a tweener ._.; zacharycarter: haha, well hopefully this will turn out a lot better mratsim: coming soon, frag_final_final_v2 zacharycarter: :D skrylar[m]: i just write little modules for particular things and then shunt those on to sourcehut/github JSGrant: Is the goal still ultimately 2D / 3D or just going with one or the other now? skrylar[m]: the heaps stack is the way to go zacharycarter: I'm developing a 3d game along side with th eengine JSGrant: oh sweet skrylar[m]: plus adding the font array makes it so emojis and stuff works xD zacharycarter: most important feature ^ skrylar[m]: i saw a game called Max Gentleman and they uh, have a lot of fun with text. Color changes, rainbows, sometimes words wiggle for emphasis. skrylar[m]: haven't decided on an image format yet. eyeing avif or jpeg-xl zacharycarter: https://www.gridsagegames.com/blog/ - I love this devblog - really makes me appreciate what can be done with ascii skrylar[m]: will have to give it a read. zacharycarter: just scroll through and watch gifs skrylar[m]: thought about an ascii display component ... they're not that hard maybe. zacharycarter: amazing stuff he does skrylar[m]: just a grid that indexes a texture atlas, accept a stack of change codes throughout the logic frame and then issue a pile of vbo updates for changed cells skrylar[m]: i worry for the memory use all this vbox/hbox crap does though skrylar[m]: i *really* appreciate that beef lets you do defer or destructors tho. `var blah = makesomething() ~ specifically_blow_it_up()` is a thing skrylar[m]: when it goes out of scope, blows up, but you can pick which detonator it uses Rika: hm, nim was supposed to have that at one point no? mratsim: it does mratsim: like right now Rika: `=destroy`1? Rika: disregard the 1 KingDarBoja: That's pretty neat! KingDarBoja: Awesome ASCII stuff leorize: isn't `defer` also the solution? Rika: yeah defer too Avahe: @Elegant Beef Does your wm support multiple monitors? Never Listen To Beef: Yep Never Listen To Beef: I used xrandr through shell since i didnt realize there was an xrandr lib in the x11 Avahe: Oh okay, I'm just now starting to look into it Never Listen To Beef: But again i dont know how to properly do xlib stuff Never Listen To Beef: so no clue if what i did is a bodge Avahe: I'll check dwm to see what they do Avahe: @Elegant Beef they are using xinerama somehow Avahe: XineramaQueryScreens, probably has a nim wrapper zacharyc1rter: why doesn't this compile? https://play.nim-lang.org/#ix=2kGT zacharyc1rter: maybe I need to do `addr data[0]` Prestige: I think because Foo isn't an array? It's a type that has that array zacharyc1rter: yeah I do Prestige: oh I misread zacharyc1rter: C arrays are just pointers zacharyc1rter: that's why it works in C and not nim Varriount: zacharyc1rter: `Foo` is an object. You can't modify object values in parameters. zacharyc1rter: just need to do `cast[ptr FooBar](addr f.data[0]) zacharyc1rter: ` Varriount: Oh, wait, I misread. codenoid: stay healthy Rika: well i've already failed that KingDarBoja: What Rika? codenoid: :( Rika: i've been pretty heavily underweight much before the lockdowns started KingDarBoja: :/ KingDarBoja: That sucks skrylar[m]: hmm we have cooking utensils so its mostly just been a case of having to fire up the pressure cooker every couple days to process more beans or something. but this is ranching state and they are opening stuff back up, so i don't suspect the beef shortages are going to get that bad here. zacharyc1rter: woot zacharyc1rter: my fiber based job system works now on osx skrylar[m]: i feel odd for being one of the few people who hasn't done any task/async work on nim. closest i came was the overwatch ecs, but that's not a task system either. xD zacharyc1rter: of course I'm not using real fibers there skrylar[m]: am quite tired of text processing though. Rika: is your line-breaker optimized for raggedness? skrylar[m]: no i tweaked it last night; remembered there was a special trick to it, then git reset it by accident and coded it again. skrylar[m]: its a small pile of optimizations from a couple people and a very tiny bit from me, basically does greedy fill to the margin and then does the dynamic programming pass to cut words back from the margin until that stops getting improvements, and then added an optional fork limit from adobe so you can pretty well box in its worst case performance skrylar[m]: otherwise it just tries to minimize distance of all lines to the margin within as many lines its permitted to scan at one time, so its basically the tex breaker-lite zacharyc1rter: https://gist.github.com/zacharycarter/ce87fc63641f51d713b7b15b5603b6d2 Rika: have you seen this? Rika: https://xxyxyz.org/line-breaking/ skrylar[m]: not this specifically no Rika: maybe it'll be helpful skrylar[m]: need to do some memory tweaks and get the amount of fields down cause each letter uses more memory than i'd really like, but meh. and then need a style field for the shaders skrylar[m]: hm. the binary search one sounds weird skrylar[m]: https://gist.github.com/Skrylar/179648d5856ae49087ad34a87d0740f9 right now it just uses the dynamic programming one with some opportunistic a-b pruning Araq: Yardanico: now it works silvernode: Does anyone recall off the type of their head how to get the type of a variable and echo it back? I tried the proc: 'typeof(myVar)' but nothing printed back when using echo silvernode: Never mind, I think I figured it out Rika: try it again Araq: leorize, if you write osproc2 please keep the 'startX' vs 'execX' distinction Yardanico: @Araq wow amazing, thanks Araq: in the end, it was a hard to find DFA bug Araq: bug every fix brings us closer to 'koch boot --gc:arc' working Araq: wow this new 'nim r foo.nim' is *nice* Yardanico: Yeah finally I won't have to add weird gitignore rules to ignore files without extensions Zevv: what is new about "nim r"? narimiran: Zevv: notice the lack of `c` between `nim` and `r` kodkuce: rror: getAppFilename failed. (Error was: Unable to read /home/me/.choosenim/current. (Error was: No installation has been chosen. (File missing: /home/me/.choosenim/current))) kodkuce: Info: If unexpected, please report this error to https://github.com/dom96/choosenim Zevv: narimiran: oh right :) kodkuce: @dom96 hmm i put choosenim in other dir 😦 Yardanico: @Zevv binary is put into nimcache dir Yardanico: Not the directory with the source file Zevv: ah sweet! kodkuce: my choosenim path /home/me/Documents/Apps/Nim/Choosenim 😦 i did not wanted to blaot home Yardanico: Now I only need to figure out how to change c -r to r in vscoee Yardanico: *vscode XeroOl: hello XeroOl: is there an idiomatic way to create a two dimensional array in nim? XeroOl: ie seq[seq[int]] Rika: what do you mean? XeroOl: it seems like initializing this is going to need loops Rika: var a: seq[seq[int]] = @[@[]]? Rika: does that even work actually hmm XeroOl: well that's just a list in a list XeroOl: I'm hoping for more of like a 100x100 grid of 0's Rika: 2d arrays are lists in lists XeroOl: yeah that's what I mean XeroOl: is there a constructor for a list that just says to do a thing a bunch of times? Rika: import sequtils; @[0.repeat y].repeat x Rika: i think? XeroOl: I will look into sequtils Recruit_main707: var a: array[100, array[100, int]] is initialised to 0s iirc Rika: actually no, just 0.repeat(y).repeat(x) XeroOl: yeah that looks probably ideal Rika: @Recruit_main707 thats if the number is defined compile-time XeroOl: I need it to be seq in my particular case, but the array example is good to keep in mind Rika: if its always 100x100, then go with array Recruit_main707: if its a seq, newSeq wont initialise it also? Rika: no, you'll need at least one loop for that Rika: lets see XeroOl: I think you can do an initializer list maybe XeroOl: I think you can do an initializer list maybe? Araq: for big matrixes like that use a special Nimble package like arraymancer Rika: !eval import sequtils; echo 0.repeat(2).repeat(2) NimBot: @[@[0, 0], @[0, 0]] Araq: don't tinker with nested seqs for that, it's messy and slow XeroOl: what would you recommend then? Rika: oh yeah, you did mention it was rectangular Rika: use arraymancer Araq: arraymancer XeroOl: I'm hoping to have a growable two dimensional grid Yardanico: https://github.com/mratsim/Arraymancer XeroOl: I just need a two dimensional array XeroOl: is this useful even if I'm not planning on doing machine learning magic? Araq: then you might go with the nested seqs Yardanico: @XeroOl yeah it's useful even if you don't do machine learning XeroOl: hmm, I could maybe try applying gpu magic XeroOl: I'm not even sure what I want to do for this problem XeroOl: I'll definitely look into arraymancer, thanks a lot XeroOl: how do I use a nim package in my code? XeroOl: sorry, I'm entirely new to nim, so it's my first time figuring out third party libraries Araq: nimble install arraymancer XeroOl: okay XeroOl: and then do I just `import arraymancer` in the code? Araq: depends but yes. Recruit_main707: the readme in github has a few examples XeroOl: ahh, I see the examples now XeroOl: I scrolled too far down before I decided to use it, and the later examples didn't have the import XeroOl: okay, I've got it working, thank you very much Never Listen To Beef: I always forget people actually use multidimensional arrays Recruit_main707: you could try using something like this: Recruit_main707: https://play.nim-lang.org/#ix=2kIy Recruit_main707: it probably fits better your problem Recruit_main707: (i didnt change the name of populate_array, it should be populate_matrix) XeroOl: the (0).repeat(a).repeat(b) seemed more concise to me Yardanico: Time to test more Nim libraries and apps with arc/orc I guess XeroOl: for the seq case Recruit_main707: up to you :) Araq: Yardanico: definitely Recruit_main707: you canot change the gc in playground can you?? dom96: Ahh, what a fun AMA Yardanico: dom96: maybe you already saw but Araq fixed arc for irc module (it turned out to be not related to async at all) :) dom96: cool, what was the issue? Yardanico: https://github.com/nim-lang/Nim/issues/14207 disbot: ➥ wrong sink parameter passing Yardanico: this snipped outputted "abc" before Araq: was a "fun" bug Yardanico: yeah i'm really surprised, I would've never thought it wouldn't be related to async at all Araq: it's your coding style man, it sux ;-) Araq: you use methods, for example Yardanico: ? Yardanico: i don't really use them, wdym :P Araq: nah, I'm kidding. but it is true that different styles trigger different codepaths, unfortunately Yardanico: ah Araq: so this time 'return x' was worse than 'result = x; return' Yardanico: ok so apparently jester doesn't compile with orc Araq: why not? Yardanico: " Error: type mismatch: got .}, Settings>" but expected ... "proc run(onRequest: OnRequest)" Yardanico: sink inference again I guess, will try to understand where it fails Yardanico: its a proc accepting an async proc as an argument Yardanico: oh well found where to put nosinks Yardanico: i'll try to minimize Araq: ah that one is known Yardanico: ah okay Araq: and that one is sink *inference*, it doesn't understand proc types Araq: and it cannot without breaking modularity so we'll probably only enable for the stdlib... sucks Yardanico: yeah compiling nimble with arc fails for relatively same reason Yardanico: sequtils.map accepts a proc(s: string) but the passed proc is proc(s: sink string) Yardanico: after adding nosinks to two proc arguments it compiles fine Yardanico: I mean to two procs passed as arguments (in different places) * Araq: the old .procvar design would have helped us :-/ Yardanico: hmm what could go wrong if I add --gc:arc as the default one in my user-wide nim config :P Araq: nothing do it. Araq: likewise, what could go wrong if I re-implement nimscript from scratch Yardanico: also seems like nimble test suite fails for --gc:arc, not sure why Yardanico: " Error: Downloaded package's version does not satisfy requested version range: wanted 0.6 got " :P Yardanico: "... got ." * Yardanico: dot Araq: ^ now that looks like a move optimizer bug. again Yardanico: yay Araq: create a snippet reproducing the problem please Yardanico: well yeah I'll try again but nimble isn't exactly very small :D Araq: but nimble's version parsing code is Yardanico: ah right Yardanico: yeah I can reproduce it with "nimble install https://github.com/nimble-test/packagebin2", now gonna read nimble src Yardanico: or even better "nimble install https://github.com/babel-test/[email protected]" dom96: just run the version.nim file dom96: there are tests in there AFAIK dom96: they might already fail Yardanico: you're right Yardanico: there are Yardanico: i'll try Yardanico: but they all pass :P Yardanico: so it's not as simple Araq: fwiw all GC tests are green with --gc:orc Araq: so it's not exactly vaporware Araq: but now it's time to run bigger projects, yes Zevv: like, the nim compiler, just to pick one Yardanico: Zevv: well yeah that's one of the targets, but it's too early for that I guess :P Yardanico: it's better to debug some other smaller projects before the compiler Zevv: haha that would be the ultimate test, right Araq: Zevv, clyybber is doing that Araq: and I will too but today's todo is "reimplement nimscript" Yardanico: ok found a bit of clue, getPkgInfo returns an empty PackageInfo object with arc Yardanico: let pkginfo = getPkgInfo(result[0], options) Yardanico: hmm I'll just try copying some procs to try to reproduce it dom96: Araq, ehh wat? dom96: why are you reimplementing nimscript Araq: cause the current impl sucks and causes on-going costs dom96: just kill the feature :P Araq: you probably misinterpret what 're-implement' implies dom96: I've been playing with the idea of just writing a simple parser for "above the fold" metadata in Nimble dom96: and compiling each `task` into an exe Araq: just work on lockfiles instead please Araq: or any other of the improvements we wrote RFCs for dom96: I'd love to work on lockfiles, but there is someone who has a grant from Status working on them dom96: I'm still waiting for news Araq: parsing the code is as simple as 'import compiler / parser' anyway, we had the code Araq: but we decided it's better to let Nim do the parsing Araq: dom96, ok, so do this instead: dom96: hah, was just looking at the map on gitter.im and saw FromIRC on #nim pop up Araq: make Nimble not swallow the compiler's warning messages dom96: in what context? Araq: 'nimble build/c/cpp/js' dom96: I'm pretty sure compiler's messages are not swallowed for c/cpp/js Araq: they are also put into red dots and stuff dom96: so which is it? dom96: the red dots or that warnings are swallowed Araq: both dom96: I cannot take you seriously if I cannot trust that this actually affects you dom96: since you do not seem to know in which instances this actually happens for me to fix it dom96: make an issue with a paste Araq: well currently I'm not running Nimble dom96: showing the problem Araq: the problem is already in Nimble's issue tracker Araq: I don't need to prove you that I use Nimble because I haven't used it in the last months. I might use it again though dom96: link me to the issue at least so that I know what you're referring to dom96: like I said, it shouldn't happen for `c/cpp/js` Araq: https://github.com/nim-lang/nimble/issues/572 disbot: ➥ `nimble build` should display warnings produced by the nim compiler ; snippet at 12https://play.nim-lang.org/#ix=2kJ4 jorjun_twitter: Three.js first webGL demo dom96: right, so it's just `nimble build` dom96: and like I said in that issue jorjun_twitter: https://pastebin.com/aJbtUsyk dom96: it is up for the debate dom96: if you want that to happen then make your case known in the issue Araq: I did, now what? are you gonna ignore it for 2 more years dom96: Replied dom96: it comes down to `build` being a nimble-only command capocasa: Is there a common way to use "try" without an extra scope, the better to use let? ⏎ ⏎ Right now I do: ⏎ ⏎ var a ... [https://gitter.im/nim-lang/Nim?at=5eafed517975db7ebfe272e1] dom96: Also, FYI `build` is called when installing packages Rika: jorjun: time to show this to my js friends dom96: I don't want to see warnings spammed in my CLI when installing packages dom96: so no, I will not fix this. Rika: what if some people do dom96: unless you can give me a good argument why I should Rika: (i think i do, i wanna see if some package is beyond fixing) Araq: well how about Araq: "nimble build is for end-users of Nim software." is completely unreasonable as Nimble is not for end-users of Nim software at all, therefore are installers/bundlers Rika: capocasa: https://play.nim-lang.org/#ix=2kJ6 dom96: Nimble is for end-users of Nim software Yardanico: ok managed to reduce it to a single 1.4k loc file (copying stuff from different source files into one) Araq: and if you won't fix it, close the issue dom96: fair enough Araq: and it implies that I keep to have in mind *all the time* not to use 'nimble build' Araq: but instead to use 'nimble c', I fail to see how that is a good user experience for anybody alehander92: morning alehander92: lunch& alehander92: * Rika: capocasa: did you see what i posted? or is gitter like discord where you need to ping them with some id or something dom96: Araq, you can clearly see that `nimble build` gives you no compiler messages dom96: it surely doesn't take much to make the leap that it won't show you warnings Rika: one can assume that it just has verbosity lowered Rika: instead of having it off dom96: that is a fair assumption, and that is the case AFAIK Araq: dom96, it's ok, moving on Araq: https://github.com/nim-lang/nimble/issues/130 I'd close this, no idea what people want plus semver is crap disbot: ➥ Require Semantic Versioning ("Semver") ; snippet at 12https://play.nim-lang.org/#ix=2kJ8 capocasa: @Rika Cool, thanks!!! (I think gitter looks for @username) Araq: or this one https://github.com/nim-lang/nimble/issues/315 'nimble init' does that now disbot: ➥ Standardising nimble package structure ; snippet at 12https://play.nim-lang.org/#ix=2kJa Araq: just go through your issues and clean them up Rika: `Test for features, not for versions` damn this is actually really smart dom96: Araq, I do that when I have time to work on Nimble dom96: But so far I didn't have the time Araq: dom96, sorry you were talking about implementing yet another parser dom96: Nimble is an official Nim-lang project, it may be time to commit some of your time to it Araq: so I figured I'd give you better tasks dom96: I'm not actually going to do it lol Araq: ok, misunderstanding here dom96: Lack of lock files is actually hindering me, so I would consider working on it assuming that nothing comes of the work from the Status grant dom96: I pinged zah to ask what's going on with it dom96: Can we get a similar HCR demo? https://twitter.com/v_language/status/1257256122647482370 Rika: has anyone actually seen someone talk about v in a non-controversial way? Yardanico: dom96: we had a similar demo years ago, even before HCR existed :P Yardanico: I think I saw it on youtube dom96: Rika: plot-twist, I'm actually writing my game in V :P Rika: got a link? how would this exist if not for HCR... Rika: dom96: o_o Yardanico: @Rika because you can make it without HCR Yardanico: just do a separate lib and watch if that file changes Yardanico: if it does - reload that dynamic library at runtime Yardanico: ofc for more complex projects that makes things really hard, but for demos it's ok alehander92: which is what hcr does internally, right? dom96: what is the state of HCR in Nim? dom96: It would actually be pretty sweet to use for my game Recruit_main707: non existent? :p Yardanico: https://www.youtube.com/watch?v=48X4PeHxkNg Yardanico: 2016 euantor: All I know is that the tests fail on the BSD systems I've tested on, as that's the only time I've looked at HCR alehander92: it should be usable alehander92: but probably there might be some issues setting it up alehander92: trying to use it for an actual usecase would probably help a lot :P shashlick: Araq what's your plan for nimscript Rika: question: why is there a `DateTime`, a `Time`, but not `Date` in the `times` module? Yardanico: Araq: I think I got a rough idea of the bug, basically nimble does "try: result = readPackageInfo(file, options) except ValidationError: check if it's a warning and output, if it's an error - raise" Yardanico: and with default GC this "result = readPackageInfo(file, options)" is still set even if the exception is raised Yardanico: I mean the result contains package info even if the exception was raised Yardanico: maybe that's not the primary cause though, I still didn't made it into a smalle xample dom96: what's more likely is that the `result` is not being initialised with a default value under arc Yardanico: well if nimble doesn't throw an exception it works fine Yardanico: I mean the ValidationError dom96: yeah, because the `result` gets set dom96: if it throws an exception it doesn't get set Yardanico: well it throws an exception without arc as well Yardanico: but "result" is still set to the info from the .babel file Yardanico: but with arc it's being reset to defaut value or something like that clyybber: @Recruit_main707 no. Its very well existant. Recruit_main707: w/ dlls from what ive saaw clyybber: yeah, so? Yardanico: i forgot, how do I make nim don't output ANYTHING? clyybber: There is no other way to do it. Yardanico: just silently compile the binary and run clyybber: In a compiled language dom96: clyybber: how difficult is the setup? Recruit_main707: i just didnt know dlls could be recompiled that way clyybber: dom96: Its pretty easy. I think it has a section in the manual Yardanico: @Recruit_main707 it's not about recompilation really Yardanico: basically your main app has a watch dog to check if a library changed Yardanico: if it changed - reloads that library clyybber: @Recruit_main707 Binaries like .exe can't on windows. But dll's can. So thats why it uses dlls clyybber: *executable Recruit_main707: is there some kind of guide on this or it just works out of the box? Recruit_main707: hot reloading would be very helpful for my project clyybber: Basically, you first need to compile the nimhcr.nim file clyybber: And then compile your project with --hotcodereloading:on dom96: hrm, I'll have to try that clyybber: Oh, maybe I'm stupid and compiling nimhcr manually isn't required anymore clyybber: dom96: See https://nim-lang.github.io/Nim/hcr.html clyybber: Ah, no its still required. See the Native Targets section alehander92: Yardanico you should turn hints and warnings off alehander92: i think Yardanico: yeah I've done it now Yardanico: --hints:off -w:off alehander92: does it still output stuff Yardanico: no Yardanico: silent alehander92: yeah we do it in our tup file watcher build setup Yardanico: Araq: I reproduced it but IDK if it's an error or incorrect usage of exceptions Araq: Yardanico, show me alehander92: much easier when you build many files (but warnings should be ideally on .. indeed ..) Yardanico: https://gist.github.com/Yardanico/374439055ce14b8115a0846d94d87145 Yardanico: outputs "testlol" with default GC, nothing with arc Yardanico: i mean empty string Yardanico: is that what you call undefined behaviour? :D Araq: huh Araq: I don't know what --gc mode produces the correct behaviour Yardanico: lol Araq: the new impl seems better Araq: why would result.mypath have any info when there was an exception Yardanico: well yeah I was confused too, but nimble relies on this for validation errors Araq: so Nimble relies on old Nim bug Araq: we should fix Nimble Yardanico: so to track it should I open the bug in nimble or nim? Araq: nimble Yardanico: yeah I made https://github.com/nim-lang/nimble/issues/798 disbot: ➥ Nimble doesn't work with --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2kKF Yardanico: well time to test something else then I guess :D Rika: i've been using nim for so long, yet still do not know how to fix a `Cannot prove that 'result' is initialized.` Yardanico: result = Object(fields) Rika: why? Rika: why is that needed? Yardanico: well you don't have to specify all fields there Yardanico: result = Object(); result.fieldA = stuff Yardanico: I guess Rika: still dont understand why its needed, isnt result default(type) at start? Yardanico: what's the type of "type" ? alehander92: if its ref Object its nil by default iirc Yardanico: yeah alehander92: ref object* Yardanico: and that's not really "initialized" :P Rika: its not a ref Rika: which is why im baffled alehander92: so what is it Rika: its just an object, no variants either Araq: Rika: it contains something that needs explicit inits, like a range[1..3] Rika: oh, so if it *contains* a ref object, itll warn this too? Yardanico: Araq: ok, compiler crash with --gc:arc for nim-regex :P Rika: oh, i see, so DateTimes require initialization Rika: perhaps due to the ranges Yardanico: https://github.com/nitely/nim-regex and compiler stacktrace https://gist.github.com/Yardanico/14e9d16fafe59198c43e2e1b1a5ec218 Yardanico: that's interesting is what it fails in C backend Yardanico: nim c --gc:arc src/regex.nim alehander92: so probably the error message alehander92: should somehow hint at what type is unitialized alehander92: i agree it seems a bit hard to debug otherwise alehander92: (what is the chain of "uninitializated" fields but maybe thats hard) Rika: alehander92: it only shows if you use the `Type()` style initialization and not rely on result being default'ed alehander92: yeah, but i guess it just shows one level further? alehander92: which is natural alehander92: if its A.b.c.d.e alehander92: from A -> unitialized you just get to A() -> b: unitialized Rika: i guess yeah alehander92: but still the error would be good to show b.c.d.e alehander92: but i guess "PRs would be welcome" :P :D Yardanico: oh loool Yardanico: lookupFieldAgain for some reason gets this as a type: https://gist.github.com/Yardanico/1e8c54a798b2989751ab8bac076c3276 Yardanico: well it's understandable, nim-regex works at compile-time Yardanico: but that's some heavy static usage :P Yardanico: I tried to do "ty = ty.skipTypes(skipPtrs + {tyStatic})" (that's obviously incorrect) and got tons of errors at c compiler stage instead :P Yardanico: "error: conversion to non-scalar type requested" Yardanico: Araq: found another arc bug with iterators (default inline ones) and imports Yardanico: https://gist.github.com/Yardanico/77cc01f12fcc37ee6c31cbfe03b2ca19 Yardanico: found in nimcrypto (it uses import for importing all tests) Yardanico: nimcrypto itself works btw Yardanico: ah wait wrong example I think Yardanico: ah nvm it's the right one Yardanico: works with default GC (compiles fine), errors at C compiler stage with arc Yardanico: https://github.com/nim-lang/Nim/issues/14219 just to track it disbot: ➥ ARC codegen bug ; snippet at 12https://play.nim-lang.org/#ix=2kLa Yardanico: fails on 1.2 too, so not a regression I guess Rika: just noticed httpbeast's being beat by pico.v, is that normal? is it normal for microframeworks to be faster than platforms Yardanico: almost nothing beats picohttpparser Yardanico: but it's not so useful for real world usage dom96: orly dom96: link? Yardanico: I mean for parsing http Yardanico: https://github.com/h2o/picohttpparser dom96: no, link to the bench results Rika: yardanico, are you referring to me? Rika: https://www.techempower.com/benchmarks/#section=test&runid=f9cc9020-a381-4cb0-9614-4fc27c033b5c&hw=ph&test=json Rika: json and plaintext, pico.v is super high Rika: in fact pico.v is top on plaintext PMunch: Good AMA by the way dom96 dom96: Rika: these benchmark results look a bit broken to me Rika: yeah which is why i was questioning if it was normal dom96: httpbeast going from 92% on plaintext to 58%? dom96: seems unlikely Rika: it does say something about a "realistic implementation approach" or so dom96: but who knows Yardanico: this is the run results for next to last commit Yardanico: https://www.techempower.com/benchmarks/#section=test&runid=64be2110-3011-48ae-8416-30c0ac0609c1&hw=ph&test=json Yardanico: its quite flaky Yardanico: now some Java http lib is #1 xd Yardanico: idk if you guys consider that "a realistic approach", but I don't :D Yardanico: https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/V/pico.v/main.v Rika: do they conduct many tests or do they just run it once per and call it a day? Yardanico: once per commit, that's like CI Rika: also i got the link from a tweet from vlang's twitter, and theres a tweet under it that says this Rika: https://twitter.com/Beranek1582/status/1235303139470868482 Yardanico: it takes like 100 hours in total for one commit to complete Yardanico: yes ikr Yardanico: that's why it's not really realistic at all Yardanico: check out https://github.com/S-YOU/pico.v for source, I can implement the same in nim lol Yardanico: just wrap picoev and picohttpparser alehander92: well its not like python isnt based on C libs alehander92: for all kinds of things alehander92: thats why its so hard to define good benchmarks Rika: maybe next time benchmarks must require pure implementations or something, though its just as hard to define those alehander92: but this would compare ecosystems, not languages Yardanico: these are synthetic bencmarks anyway :P alehander92: which might be valid :P alehander92: but thats the thing: its very hard to measure everything in the same time alehander92: on theory you could probably write similarly-quick code for many things in most system langs bung87: why not try nodejs/http-parser alehander92: so it is probably indeed better to just compare real world projects dom96: yeah, this is ridiculous lol alehander92: and keep in mind that language used is just one part of the whole thing dom96: I'll create a compiler which compiles only enough to support the bare essentials of routing and calling C functions Yardanico: :P Rika: idk i really just found it sketchy that vlang was proud of this alehander92: dom96 that's a lame argument dom96: then wrap pico and put it to the top of the leaderboard alehander92: just wrapping pico might be lazy, but it reveals a much bigger problem with benchmarks dom96: also I'm suspicious of V's use of [inline] alehander92: that overally its not really about the language alehander92: but about the engineering / domain effort put in a certain lib dom96: yes, it is dom96: these benchmarks mean nothing when it comes to being in the top 50 Rika: isnt that the point of a benchmark Yardanico: "realistic approach" :D Araq: here is an idea dom96: as long as you're there you can be confident that languages are in the same ballpark Rika: i should really stop trusting benchmarks at all alehander92: yeah, ballparks is all it matters for probably 75% of cases Araq: let's come up with a set of benchmarks that doesn't suck Yardanico: and make nim the fastest in them lol dom96: it's impossible alehander92: you'll receive the nobel peace prize Rika: how about serving a static page like nim's docs? Rika: that would certainly be realistic, no? Yardanico: that's even stupidier Araq: I can give you decent benchmarks Araq: but I have no clue how we get people to stop looking at stupid benchmarks Araq: and no, Nim wouldn't win every benchmark alehander92: i think people need "science " studies alehander92: or just to make peace with comparing projects, not languages alehander92: realistically, the most sensible small benchmarks would be ones comparing idiomatic usage alehander92: at least thats a good proposal i read about such a site dom96: PMunch, oh yeah, thanks btw! Glad you enjoyed the AMA :) Araq: which is btw what I'm working on all day long, make idiomatic Nim fast, not the C-like Nim you can write since a decade reyan: Hi, I'm trying to pick up nim and thought I could create a program to patch a binary file, using a filestream. However when I call writeData as in the stream module documentation (with var buffer = 0x0D for instance), it writes 0x0D where expected but also zeroes out multiple bytes after. Did I miss something? sizeof(buffer) is 8 which seems correct Araq: and even the C-like Nim isn't bad at all zacharycarter: Araq: I'm going to author an RFC to extend codegendecl to work with type definitions. Do you have any major issues with this idea, before I write the RFC? Araq: motivate it well, zacharycarter zacharycarter: Okay alehander92: Araq yeah, but one can always just emit C Yardanico: reyan: what proc are you using? alehander92: so its very hard to compare languages imo alehander92: if one cant put a boundary on what is unidiomatic usually Yardanico: by default nim number literals are of "int" type alehander92: on the other hand just putting a single emit somewhere as a 5x speedup can still be idiomatic Yardanico: !eval echo typeof(0x0D) NimBot: int Araq: alehander92: I never used 'emit' for speed in my entire life reyan: yardanico: I'm using proc writeData(s: Stream; buffer: pointer; bufLen: int) Yardanico: reyan: why? Yardanico: just use https://nim-lang.org/docs/streams.html#write%2CStream%2CT Rika: sizeof gives byte size, not bit size, no? Yardanico: it gives byte size of course Rika: i dont know why i asked that Yardanico: int64 is 8 bytes on 64-bit :) Rika: i'm a special person dom96: hah, why does that proc's docs state its implementation reyan: wow ok reyan: I thought it was bit size sorry reyan: thanks a lot Yardanico: reyan: if you want to write a byte, do it like alehander92: => cant define idiomatic super well => people cant agree on rules => no benchmarks Rika: yes, i totally asked that because i thought reyan thought it was bit size, not that i am stupid, of course Yardanico: "let byt = byte(0x0D); mystream.write(byt)" Yardanico: or "let byt = 0x0D'b" and then the same write Yardanico: ah wait no, there's no "b" suffix Rika: i8? Yardanico: 'u8 for uint8 Yardanico: or 'i8 for int8 Rika: ah ofc unsigned Rika: man i am on a stupidity roll reyan: ok that makes sense. By the way I really like nim so for so thanks for your work Rika: the apostrophe is optional btw Yardanico: @Rika wdym Rika: you can write 0i8 just fine afaik Yardanico: !eval echo typeof 0x0Di8 NimBot: int8 Yardanico: lol Rika: told ya Yardanico: ah found it " For notational convenience the apostrophe of a type suffix is optional if it is not ambiguous (only hexadecimal floating point literals with a type suffix can be ambiguous)" reyan: Well that works perfectly. Thanks again and have a great day alehander92: Araq ok, i am just giving an example alehander92: that people can often argue about what is idiomatic in language X alehander92: it might be a different pattern in other lang Araq: well you need precise rules about what code is allowed in benchmarks Araq: usually inline asm isn't and neither should be 'emit' alehander92: yeah, but what is e.g. C-like in Nim or Java-like in Clojure etc alehander92: is not so obvious alehander92: after all, what is an idiomatic lib or program or dsl is almost always subjective for real world code alehander92: and success can even change that: e.g. probably rails changed some things about how people write ruby dom96: I wonder if we could have a "it has to be written purely in that language" rule dom96: of course, there will always be edge cases dom96: but I think they can be managed Araq: if you want to benchmark *language* implementations, you must not use libraries dom96: maybe we can suggest that to techempower Yardanico: dom96: well V can translate c code to V alehander92: a kernel running a filesystem and a server written all in language :D Yardanico: and if you do that all your code will be technically in V Yardanico: same goes for Zig for example Araq: same for Nim dom96: Yardanico, I seriously doubt this process is easy Araq: if I understand the problem well enough. but anyhow, as I said alehander92: dom96 ok ... and nim imports C headers , stdlib, libc Araq: if you want to benchmark languages, don't benchmark libraries dom96: alehander92: yes, which is why I talked about edge cases dom96: libc is fair game Yardanico: dom96: well zig for example uses clang itself to translate C to Zig alehander92: but people will disagree about what is edge case :) alehander92: thats the whole thing dom96: alehander92: quite likely, but probably some sort of concensus can be reached Araq: edge cases exist but "nim's regex handling is slow" is not benchmark for nim dom96: you could even have multiple purity categories alehander92: e.g. if X can emit everything by itself, e.g. go didnt even use libc IIRC in some cases alehander92: and go fans can say "ah this is cheating" dom96: that's called being petty IMO alehander92: and petty people love benchmarks dom96: In fact, a good rule could be: if every program written in a a language requires that library then it's fair game dom96: you certainly cannot say that about pico dom96: for V Araq: it's true though, the Go people redefined what "dependency free" meant so now you have to statically link libc Rika: requires that function (as in functionality, not proc) can also be a good rule dom96: I think that's a fool proof rule to be honest skrylar[m]: think i liked v over zig. beef seems okay but getting a working beef compiler is a pita alehander92: dom96 ok, but many programs dont really need a lot of libc stuff dom96: I might suggest it later today to them Rika: it has to be a broad definition though for what i mentioned Araq: for reasons unknown to mankind (on an OS with /usr/include I consider libc part of the deal...) Rika: like "emit pragma" and not "this specific proc" Rika: why'd you like v over zig? dom96: alehander92: they need some stuff though dom96: doesn't matter how much alehander92: i overally like those ideas dom96 , just i expect that almost any benchmark setup would always lead to disagreements and pettiness dom96: they always need something alehander92: it is just how it is :D dom96: if they don't like this idea I'll just write a blog post with a list that excludes impure implementations ;) Araq: dom96: not that's the spirit! :-) Rika: pico.v just feels like a library specifically made for benchmark "cheating" in my eyes Araq: bbl alehander92: Rika what i dont agree with in your sentiment is that alehander92: it showcases a real world valid usage alehander92: a lot of python's success is based literally on glueing fast c libs Rika: that is true alehander92: so even if you have such benchmarks Rika: okay so now i have a new though Rika: t* alehander92: and you exclude e.g. Xframework in python Rika: some benchmarks are only really meant to compare library implementations and not languages or backends or whatever alehander92: final users wouldnt care as they dont care for "pure language usage" but for ease+speed Rika: maybe there can be a benchmark meant to showcase a language's performance, but i know of none alehander92: maybe alehander92: but then i think you need to either measure small programs like the shooting game(?) dom96: the problem with many of these is that they are not made for real-world usage dom96: I would need to see proof to believe it dom96: For example, httpbeast is actually used by Jester alehander92: dom96 but e.g. if you compare ML frameworks alehander92: you would exclude many python ones dom96: and runs in production alehander92: and you again wouldn't really show useful results dom96: This would just be another filter, people can choose to use it or not alehander92: agree, it would be interesting for sure dom96: I think giving users a different way to look at the results is always good clyybber: zig invents. V doesn't clyybber: well V invents on the PR side I guess :p stefantalpalaru: How do you get the next value from an iterator explicitly, outside a "for" loop? alehander92: and also another valid argument after all is that if language X makes it very easy to base stuff on language Y's code Yardanico: stefantalpalaru: I think you can't really do that alehander92: that's still useful, nim also markets that Yardanico: nim iterators are inline by default Yardanico: you probably can with a closure iterator though clyybber: stefantalpalaru: I don't think there is a way. Even for closure iterators clyybber: As in its not exposed. stefantalpalaru: There must be an internal method/proc that the compiler calls in for loops, right? alehander92: you just call the iterator alehander92: until its finished, or not? clyybber: Oh, maybe its just a matter of a proc taking a closure iterator and doing `for i in iterator: return i` clyybber: I think that may work dom96: stefantalpalaru, var state = myIterClosure(); state() # if it returns default(RetType) then it's finished IIRC Rika: you can do myIterClosure.finished afaik dom96: yeah stefantalpalaru: What I want is someIterator.next(), dom96. dom96: state() is that Rika: if it is finished after getting the value, the value is junk Rika: oh if state is the closure then its state.finished disruptek: i hate the corner this compiler has put me in. clyybber: disruptek: WDYM? narimiran: stefantalpalaru: related? https://github.com/nim-lang/RFCs/issues/1 disbot: ➥ [RFC] Better iterators syntax stefantalpalaru: Yes. PMunch: Damn it, I found another thing I need in the OpenSSL wrapper that's not there.. PMunch: Why is it only partially wrapped? federico3: PMunch: please open bugs and I'll add stuff disruptek: clyybber: i now have to undo/redo/debug/rebug the backend mutations i introduced. PMunch: I can just add them myself and create a PR like I did last time federico3: https://mastodon.in.th/@sirn/104110103788846643 we need "demos" like this somewhere on the website PMunch: But I'm using this for production and it looks a bit sketchy to depend on a development version of Nim PMunch: (Not that I think anyone at work has actually looked at the code or my build scripts :P) Yardanico: https://c3po.bashell.com/media/5eb02254e206d26b7aa4ff41 seems like nim in haiku is really outdated :P bung87: any idea about js generated code `chckRange(s_7355039[0],-2147483648, 2147483647)` where `is` string `M` Yardanico: wdym "any idea"? Yardanico: it checks if the first value is in "int32" range Yardanico: first element of s_7355039, whatever that is bung87: that's a long string bung87: it will get first char bung87: then throw error Yardanico: show the nim code which makes this error :P Yardanico: federico3: btw related to nimpy - a fully statically (yes again :D) linked with musl example from the nimpy readme is only 100kb Yardanico: with -d:danger --gc:arc Yardanico: (yes nimpy seems to work with arc) Yardanico: ah right, nimpy even has tests for it bung87: hold on ,I write a simple example Yardanico: federico3: https://i.imgur.com/4hwL1Vw.png Yardanico: :D Yardanico: with --panics:on I get 4kb less bung87: https://github.com/bung87/datetime_parse nimble testjs federico3: why using musl and optimizing for size tho? It's not really the use case for nimpy Yardanico: well yeah I know nimpy is for speeding up python usually Yardanico: @bung87 lemme check Rika: oh damn that looks cool disruptek: leorize: ping Rika: does the zig compiler makes musl easier to use? Yardanico: it bundles a lot of libc headers and musl Yardanico: so you don't have to use different cross-compilers and just use different targets Yardanico: you can cross-compile for windows too Yardanico: https://i.imgur.com/0cRDcPY.png Yardanico: -d:windows is not needed though Bennyelg: hey, how can I mimic abstract class in him ? Bennyelg: nim disruptek: why? disruptek: ~concepts disbot: concepts: 11user-defined type classes; documented in the experimental section of the manual: https://nim-lang.org/docs/manual_experimental.html#concepts -- disruptek Rika: theyre not exactly the same though, no? disruptek: i dunno; i'm terrible with lingo. livcd: What happened today in Nim's world? Any drama? Yardanico: @treeform yeah it works just fine https://i.imgur.com/Q6SZoxd.png bung87: @Yardanico it's like code gen bug? no idea why it using first char as index Bennyelg: I wangt to do something like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eb02d1ef0377f163167b5dd] Bennyelg: what is the correct way :/ disruptek: you cannot dispatch on return type. Yardanico: uprof also has system-wide profiling Bennyelg: @disruptek disruptek: if all you do is discard, then simply remove all the `[T]` and `: T` and you're done. Bennyelg: but I do want to return things Bennyelg: as the signature probably implies somehow Bennyelg: get -> T will be seq[Student] Bennyelg: or something similar disruptek: then write that. Bennyelg: I want to overwrite it on the StudentRepository Rika: make them getStudent(): seq[Student] or something Bennyelg: but is it the correct way ? disruptek: you need to make Repository generic. Bennyelg: I want some single interface that everyone will implement disruptek: type Repo[T] ... members: seq[T] or whatever. Bennyelg: ```type ⏎ Repository*[T] = ref object ⏎ db: Database``` [https://gitter.im/nim-lang/Nim?at=5eb02dbeb6dd230697a5479b] Bennyelg: cool Bennyelg: and how I overwrite repository[T] methods ? Bennyelg: or procs if to be correct Yardanico: https://i.imgur.com/mFJJ3wp.png really nice stuff Yardanico: guess I'll use it when benchmarking :D bung87: @Bennyelg https://github.com/bung87/db_adapter/blob/master/src/db_adapter.nim check this Rika: damn that looks nice disruptek: Yardanico: what are we looking at? disruptek: uprof? Yardanico: yes Yardanico: amd uprof PMunch: https://github.com/nim-lang/Nim/pull/14223 disbot: ➥ Add procedures to read RSA keys from BIO format PMunch: federico3 ^ federico3: PMunch: lil' bit of tests perhaps? :) PMunch: Are there tests for this module? PMunch: I did test it with my usecase though, so I know that it works right now PMunch: Like it's not a blind wrap federico3: there are federico3: including https://github.com/nim-lang/Nim/tree/devel/tests/untestable federico3: https://github.com/nim-lang/Nim/blob/d5b7e9902cf9ac2c24be8792555cb017d268ce91/tests/stdlib/thttpclient_ssl.nim and so on bung87: @Yardanico have you checked? Yardanico: not yet, I'll try to see now :P Yardanico: oh I see what you're trying to do bung87: ok,thanks! Yardanico: you're trying to use a JS string Yardanico: nim strings in JS are not simply JS strings bung87: so how to pass js string to the parse bung87: it's just js primitve type Yardanico: I guess you could try with makeNimstrLit Yardanico: yeah it works that way Yardanico: you have to do " module.exports = {parse, makeNimstrLit}" Yardanico: and then create nim string like const s = parse.makeNimstrLit("your string") Yardanico: and then parse.parse(s) Yardanico: but really you should understand that nim's compiled JS is not really supposed to be used in other JS code jason_koch_twitter: inotify Yardanico: @bung87 https://gist.github.com/Yardanico/4d10f2f44e7fb1a0bb7b6b9683e28487 Yardanico: it seems to actually work bung87: yeah, got it work Yardanico: but yeah, as I said Nim's compiled JS code is not supposed to be used in other JS code, so you're in undiscovered territory :) bung87: hmm, the problem I leave it for months, finally it solved, thank you. bung87: I'll keep that in mind, I thought primitve type will be translate during compile time... and also there's -d:nodejs bung87: anyway it could generate a js module, just need extro proc export Yardanico: also beware that -d:nodejs isn't supported that wel Yardanico: well(* Yardanico: main target for nim's JS backend is browser bung87: I get it, better to write all in nim and generate single one bundle file. bung87: I have a idea, if have a js ast parser in nim ,that would be well support? reyan: Hi. I'm still trying to work on an application to patch binary files, however while it's really easy to replace a byte, I don't see how I could do to add some bytes in the middle of the file. Should I create a new file and merge byte arrays from the original file around the data I want to add? Yardanico: did you see https://nim-lang.org/docs/streams.html#setPosition%2CStream%2Cint ? reyan: Yeah I did but when I setPosition() somewhere and then write data it just replaces data that was there before. I don't see how I could add new data (changing the file size) Yardanico: oh nothratal: hello together nothratal: is there a naming convention for nim packages? zacharycarter: Nim doesn't have packages zacharycarter: it's not like Java kaushalmodi: hmm? kaushalmodi: I called them packages/modules/etc zacharycarter: well I'm not really sure what you mean by packages either zacharycarter: they are modules yes kaushalmodi: what's the difference Yardanico: packages can have multiple files zacharycarter: but packages in my mind is like - com.foo.bar zacharycarter: yes Yardanico: @nothratal did you mean packages as in libraries? Yardanico: or as in individual files? zacharycarter: yeah I'm really not sure what he means kaushalmodi: Yardanico: Ah. I see. TIL bung87: bad question kaushalmodi: That's correct: It's not clear naming convention of what exactly. kaushalmodi: If it's naming the modules, then you usually name them in snake-case and you cannot use hyphens in the names. kaushalmodi: Some people name modules in lower camelCase, but that's not very common kaushalmodi: It's usually all lower or lower snake-case nothratal: ohh sorry, of course I mean libraries :D Yardanico: well all libraries have a main nim file anyway Yardanico: or you import files Yardanico: so usually lowercasename Yardanico: or snake_case_name bedwardly-down: Morning all. How's the nim stuff going? skrylar[m]: currently studying a few older game engines and remarking how little a lot of them do skrylar[m]: well libgdx does some amount. corona and love2d quite small disruptek: ~stream Yardanico: ~stream Yardanico: :c krtekz: Does Nim plan to target wasm? Yardanico: krtekz: not via a yet another backend Yardanico: you can already use emscripten zacharycarter: or nlvm skrylar[m]: i dunno. a wasm backend would be nice if it just happened to be there leorize: disruptek: pong audiofile: can someone bounce some ideas off me for some nim project during the hols? audiofile: I'm not an expert by any means, not even intermediate rn so tempered expectations please! >_> leorize: try to fix some simple compiler bugs? :P mratsim: bounce(idea) Yardanico: audiofile: I think you might like https://github.com/florinpop17/app-ideas audiofile: yeeees, nice ty Yardanico audiofile: leorize I almost flunked my compilers course :/ if I could, I definitely would! leorize: don't worry, building a compiler is different from fixing a built one audiofile: oh, I'm all ears now then Yardanico: spoiler: it's easier audiofile: are they the issues tagged with Yardanico: there are Yardanico: but that's subjective :P audiofile: I bet haha Yardanico: https://github.com/nim-lang/nim/issues?q=is%3Aopen+is%3Aissue+label%3AEasy audiofile: thanks, honestly most of them dont make much sense to me right now but I've bookmarked this audiofile: some issues refer to other fixes as they are similar so I can give that a go audiofile: https://github.com/nim-lang/Nim/issues/8212#issuecomment-402985473 sounds easy >_> mratsim: It's a trap mratsim: you can {.emit:"__FUNC__".} in the C code but without emit you need to modify the compiler audiofile: ouch audiofile: we need an 'easy but trap' tag haha mratsim: well the compiler modification is explained https://github.com/nim-lang/Nim/issues/8212#issuecomment-493944503 mratsim: but you need to create a new proc because modifying `instantiationInfo` return type is not backward compatible mratsim: so the hard thing is coming up with a new name audiofile: ah I see audiofile: yeah mratsim: something like procContext or callingContext audiofile: oh right, there's the proper naming convention which must not be ignored leorize: mratsim: do you think there's anything from nim-stew that can find a new home here? https://github.com/nim-lang/fusion leorize: nim stew has been collecting some really useful modules and I think we should start adding them to the "external stdlib" now that the barrier is lowered reyan: Well I'm almost finished it's probably not how it should be done but at least it seems to work. I've got all I need in a seq[byte] and I'm not sure how to write it back to a binary file. Maybe I missed something in IO or stream module? leorize: writeData should work leorize: actually you can do this too, but it's undocumented: s.write(cast[string](your seq[byte])) leorize: this is because string and seq[byte] has the same underlying representation leorize: it's a supported thing but we don't document it reyan: When using writeData I'm forced to use a fixed length array as a buffer right? Because right now I'm filling the buffer byte by byte from the seq which is probably not how it should be done leorize: you can use a seq leorize: writeData is a low-level proc reyan: s.write(cast[string](your seq[byte])) worked perfectly. Thanks. And I can use a seq as a buffer? I didn't manage to while reading the file leorize: https://play.nim-lang.org/#ix=2kNj leorize: where's a proc that should have been in the stdlib instead leorize: it works with both strings and seqs reyan: Thanks a lot! mratsim: @leorize, endians2, byteutils leorize: should this be discussed on nim-stew issue tracker first? leorize: or should I just add it then tag people in? mratsim: the second solution seems good Avatarfighter: Hello everyone Yardanico: Araq: is this supposed behaviou for ARC? the error is in the comment https://gist.github.com/Yardanico/5a9f7e9842101443ebf662c58340f406 shashlick: does anyone know how to autolink issues on github from a markdown file? Avatarfighter: Leorize, any chance you could be my saviour with endians again like last time? I believe I'm just doing what I'm going wrong leorize: sure Avatarfighter: might take a minute I lost the file I had an issue with in the labyrinth known as my current project Avatarfighter: https://www.paste.org/104912 so I'm like 90% sure that I'm doing this wrong but I'm trying to convert an array holding int8s from one endian to the other but having some issues on the expected output Avatarfighter: I forgot to add but I'm using the std endians lib leorize: you failed the moment you cast :) Avatarfighter: i knew it Avatarfighter: I was so sure it was that leorize: hmmm actually Recruit_main707: he should pass the 0th element address shouldnt he? Avatarfighter: i still don't see what I would do even when I converted the endian without casting :L leorize: Avatarfighter: lol leorize: I found the problem leorize: 64 bits is 8 bytes Avatarfighter: fuck Avatarfighter: yeah that definitely helps Avatarfighter: welp that was meant to be int32 Avatarfighter: I got so used to writing 64 I guess I just autocompleted what I was writing and wrote it, thanks again for the help leorize lol Avatarfighter: welp I give up the endian lib is nice but nim stew has a nicer api for their endian lib mratsim: the nicest part is that it works at compile-time mratsim: so you can pre-serialize things bedwardly-down: @disruptek `Downloading https://github.com/genotrance/nimterop using git bedwardly-down: Tip: 40 messages have been suppressed, use --verbose to show them. bedwardly-down: Error: Could not read package info file in /tmp/nimble_25781/githubcom_genotrancenimterop_0.3.3/nimterop.nimble; bedwardly-down: ... Reading as ini file failed with: bedwardly-down: ... Invalid section: . bedwardly-down: ... Evaluating as NimScript file failed with: bedwardly-down: ... /tmp/nimble_25781/githubcom_genotrancenimterop_0.3.3/nimterop/docs.nim(80, 19) Error: undeclared identifier: 'paramCount' bedwardly-down: ... printPkgInfo() failed. bedwardly-down: /home/justa/Source/git/nimph/nimph` PMunch: Please don't paste stuff into Discord shashlick: please update your nim to latest devel PMunch: It comes through on IRC alehander92: no problem arnetheduck: fwiw, fusion seems to have the same issues as stdlib in its stated goals, in terms of maintenance: it thinks it's a good idea not to remove code - this means that it'll be full of unmaintained crap that's not up to date with recent nim versions, idioms or the world at large.. preserving the past is great: git does that, and really really well - you get an immutable copy of some file at some point and you can rely on it not changing - yo arnetheduck: ie the berlin wall fell - the same thing happens with code - some things that were though of as great ideas by someone at some point in time really.. weren't dom96: https://github.com/TechEmpower/FrameworkBenchmarks/issues/5680 dom96: As promised, let's see what they say arnetheduck: what would be nice for fusion would be a tracked release system: these modules work well with nim 1.x - so there's a fusion-1.0, fusion-1.2 etc for every module, and things only make it to the next version when they actually work with that version idiomatically - ie use or at the very least don't contradict features introduced in newer versions - and modules shouldn't qualify automatically: they should be ported to the new version only leorize: Araq ^ dom96: My opinion is still that fusion really does not seem like something worth investing time into Avatarfighter: Question for anyone who knows but does "shr" zerofill? mratsim: zerofill? Yardanico: https://forum.nim-lang.org/t/4891 relevant mratsim: ugh, the shr changes were ugly. Not much on the forum changes, but compile-time shr and constant-folded shr had consistency issues Avatarfighter: Yardanico: Thanks for the forum post 🙂 Yardanico: which one? Yardanico: mathexpr? :P Avatarfighter: The one you posted about right shift 😛 Yardanico: oh ok Avatarfighter: I'm having trouble figuring out if the shr is arithmetic or not so I'm just going to pretend it isn't unless something breaks lmao Yardanico: by mathexpr I meant https://forum.nim-lang.org/t/3196 Avatarfighter: but I'm interested in the mathexpr one if you have a link Avatarfighter: I'll give it a read thanks for the link 👍 mratsim: is there a use case for right shifting on negative int? Araq: arnetheduck: well I don't agree and time will prove me right/wrong. programming languages are more like OSes, they gain traction when old stuff continues to run Avatarfighter: @mratsim the only use case I've personally seen is in cryptographic functions and even then it would take me a bit to find an example Araq: they never renamed 'cp' to 'copy' in Unix land or 'man' to something sane. And here we are, Unix dominating everything. Araq: and what used to be sloppy naming is now something "cultural", enjoy mratsim: @Avatarfighter you don't use signed integer in cryptography Araq: meanwhile in Nim land, the old AssertionError just became an AssertionDefect, wtf mratsim: Next step, finding a more descriptive name for typedesc leorize: Araq: C++ also got rid of COW strings in C++11, citing safety issues and potential performance problem in threaded environment Avatarfighter: @mratsim I stand corrected I went to look for an example because I thought that signed integers could be used but I found none thanks for the clarification 🙂 Araq: leorize, I know but it's not directly applicable leorize: well, if you ever write an RFC for how you want this to be implemented, I can give it a go mratsim: Rust seems to also be struggling with strings and/or allocator: https://www.christianfscott.com/making-rust-as-fast-as-go/ leorize: isn't there a huge update about how the two algo are not comparable? leorize: and yes I did an implementation here yesterday leorize: still not as fast as go, but it's the best I can do while preserving the algo krux02: mratsim: typeargument, because they are used for arguments only. krux02: (by now) mratsim: I think a memory pool in the standard library would be helpful (especially given the number of gamedevs) mratsim: and then we can have PooledStrings leorize: https://irclogs.nim-lang.org/03-05-2020.html#18:55:59 mratsim: @krux02 typeargument is loooooong leorize: I think memory pool should be a nim-fusion thing krux02: you didn't ask for "short" leorize: typearg? :P krux02: tArg krux02: trg mratsim: typeArg is not bad leorize: Type[T] :) krux02: I am actually ok with `typedesc`. krux02: It is ok, not great. But not worth the hassle to change. mratsim: and that's how you get "mv" and "cp" 😉 mratsim: QED alehander92: ok, so down between the compiler dsl POC lib/singularity-inspired kernel toy/algo2cartoon generator/inim+hcr combo to try to propose for the conf mratsim: I'm quite interesting in REPL / HCR mratsim: interested* mratsim: no idea about what is a singularity kernel but that sounds like something that hacker news might enjoy alehander92: no, its an older microsoft research os which Araq reminded me sounds like my dreamy toyings alehander92: the other day alehander92: but my idea is just to run some nim code on bare metal and map processes and filesystem data just to bare nim values+functions Yardanico: if you guys test your libraries (or other people's libraries) with arc/orc, please report it in https://github.com/nim-lang/Nim/wiki/Status-of-gc:arc-and-gc:orc-(library-compatibility) krux02: Araq: I have problems with printing enum values from gdb krux02: for some reason the types of the enums are now just unsigned integers integers. krux02: do you know if something in the code generator for enums and sets changed? Araq: krux02, we didn't really change that krux02: hmm Araq: we did change $ for enums though, it's now done via a macro krux02: well the gdb script depends on the NTI runtime type information of enums krux02: if that isn't generated anymore gdb can't print enums anymore. Araq: NTI isn't used anymore by $ Araq: I think, so that's what's going on krux02: But it is also that the enum value itself does not have an enum type anyomore. krux02: The generated type is just an usigned char. krux02: At least that is what gdb tells me now. krux02: so it can't look up NTI, even if it would be there. krux02: In other words gdb pretty printing for enums is now completely broken. krux02: But I guess it is my fault. I wrote a test for it. But I didn't integrate it the test suite. Araq: we can generate enums for C just like we do for C++ Araq: then gdb should be able to pick it up krux02: what is the difference there? Araq: mostly ((EnumType)8) vs 8 Araq: in the produced code Araq: C enums are always int though in C89 and Nim's enums are most often bytes krux02: ok krux02: let me test c++ mode then Araq: it would be nice if we don't have to use NTI, NTI is also gone for arc Araq: NTI is not exactly future-proof :-) Araq: and I said it before but here it is once again, if we get typeArg and its spec/implemetnation right, I'm all for it. then we can deprecate typedesc but don't have to "fix" its broken behaviour (and thus breaking so much stuff out there) Araq: seems to be much more feasible and less work then changing typedesc mratsim: @Yardanico, AFAIK async and threads are still a pending issue with arc Yardanico: well async leaks memory, but yeah it kind of works with orc bedwardly-down: @Never Listen To Beef , this should have a nim target: https://github.com/rusthon/Rusthon krux02: yea I know NTI is not future-proff, but it is all I have krux02: what I wonder though is, why Nim enums are not compiled to C enums Araq: as I said, because C enums are 'int' and that's too big krux02: ok that is true, I forgot about that. krux02: only c++ for the help here. krux02: would be nice if the c++ backend would just use the c++11 enums, then I would not need to create a hack for printing. krux02: sets would not be solved though. krux02: but theu would not be a problem. mratsim: @Yardanico, but async programs, like servers tend to run for a long time, those are not missiles so leaking memory is problematic Yardanico: yeah Araq: they don't leak with 'orc', current bugs not considered mratsim: I would love to have resumable function as first-class Araq: you need to write an rfc so that everybody understands why resumable functions are not closure iterators mratsim: Btw, I've had some thoughts on how to have Weave play well with async, here is an easy idea: https://github.com/mratsim/weave/issues/22#issuecomment-623408684 Araq: yeah I read it. it's a bit what I suggested Araq: *a bit like Generic: well what is the difference between resumable functions and closure iterator. I always thought of of the first being an exploitation of the latter Generic: ? Generic: or are resumeable functions basically like threads with their own stack and context except they are cooperative? Araq: probably something like proc resumable(state: var int; otherArgs) so that you get the goto state machine inside but without the closure allocation overhead Generic: I see, so basically like a closure iterator except you have to manage the state yourself? Araq: not really "manage" but it's exposed so that you can start/stop/continue it exelotl: resumable functions -- so coroutines? exelotl: usage being similar to e.g. Lua? https://www.lua.org/pil/9.1.html mratsim: My use case would be to make it easier to implement IO-tasks and CPU-bound tasks mratsim: for example if I have a task that is actually a `while True` loop, I basically lose a thread. alehander92: hm is nti being removed Yardanico: it's not in arc Never Listen To Beef: @bedwardly-down you clearly overestimate my knowledge, i can barely write nim code nevermind write a transpiler Rika: oh no, recursion, i have to make it a ref object or make the field take in a ref Rika: hmm which one would be better KingDarBoja: make it a ref KingDarBoja: `ref object` Rika: i know how but i'm asking which would be better Rika: ref object ... field: TheObject Rika: or Rika: object ... field: ref TheObject Rika: i assume the latter would be just fine to use Rika: i dont really have a use for ref objects on this datatype KingDarBoja: Doesn't the latter force you to deref everytime you want to use it on TheObject? Rika: can just make a proc for that Yardanico: for [] ? Rika: no, i mean, an accessor proc Rika: proc fieldName(obj: TheObject): TheObject = obj.fieldName[] Rika: something like that no? zacharycarter: how can I make this work? https://play.nim-lang.org/#ix=2kxb Rika: make a proc == that accepts an AtomicInt Rika: same thing for SpinLock Rika: or if you think conversion would work then maybe try converting them back into int32s Yardanico: zacharycarter: proc `==`[T: SomeNumber](a: AtomicInt, b: T): bool = stuff Yardanico: that'll work for any number type Yardanico: you can just do b: int though zacharycarter: iproc `==`[T: SomeNumber](a: AtomicInt, b: T): bool = stuff zacharycarter: oops thanks zacharycarter: I'll try that Yardanico: do you need to compare for different number types? zacharycarter: probably just int32 but I can modify it for that Yardanico: well yeah Yardanico: proc `==`(a: AtomicInt, b: int32): bool = stuff Yardanico: also don't forget to export it with * zacharycarter: I don't think that's really a solution though... zacharycarter: because what am I going to replace stuff with Yardanico: ? zacharycarter: in C I can call `==` on an int32 and a fe_lock_t because they're both just int32's zacharycarter: but Nim's type system is preventing me from doing that Yardanico: well use casts zacharycarter: going to have to I guess Yardanico: well if you're already doing {.emit.} and {.importc.} cast is nothing :P zacharycarter: it's not that I"m worried about using casts it's just the volatile typedef qualifier and the alignment attribute zacharycarter: `The volatile type qualifier declares an item whose value can legitimately be changed by something beyond the control of the program in which it appears, such as a concurrently executing thread.` zacharycarter: so I guess it doesn't matter too much zacharycarter: if I cast it to an int32 dumjyl: nim has volatile and align pragmas that may help: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-align-pragma zacharycarter: neither can be used on a type zacharycarter: nor can codgenDecl skrylar[m]: bleh. was dealing with someone who doesn't seem to understand the morale consequences for not writing a language in itself :eyes: skrylar[m]: had to point out that every major player does it, and most minor players do, which means its expected, and differing from expectation requires a good reason, and often they can't affirmatively excuse it and only negatively excuse it ("well you are just dumb for wanting that.") skrylar[m]: i'm not entirely sure why you're expected to write things in themselves; i think its a social proof thing, but. shurgs bedwardly-down: Might also be so that the end user doesn’t need to juggle multiple languages to get up and running with one or to fix issues when they appear? skrylar[m]: i listed some reasons like that and they just said "oh but you can get around all that" and its like, whatevs dood skrylar[m]: you don't get a whole lot of space to allay people's fears in the narrow selection period of a new project, and if you have to waste some of it on "why isn't it self hosted?" "because its a one man project and he doesn't see it as a valuable use of his time" "Oh so its a one man project? Guess we need something more mature." RIP. skrylar[m]: but yeah the haxe cope of "if you aren't smart enough to learn OCaml, you are too dumb to work on compilers" hasn't won them any friends when it came to backend ports skrylar[m]: i dunno if nim has gotten 'more' help because its written in itself zacharycarter: probably not Yardanico: i think yes Yardanico: a bit :P skrylar[m]: to be fair i did try to use beef on windows until it complainde about msvc, then on linux without the ide until it complained about some deep llvm internals, and then went well this is more effort than anyone in their right mind would have spent, so. 🤣 zacharycarter: beef does look interesting but yeah Nim seems much more mature zacharycarter: I guess not even seems, is Yardanico: https://www.beeflang.org/ ? zacharycarter: hmm so I guess I need to emit this stuff not in the file I'm defining the wrapper types in zacharycarter: but everywhere that the wrapper types are imported zacharycarter: that's annoying :/ zacharycarter: there has to be a better way skrylar[m]: Yardanico: thats the one dayl1ght: Hey, I'm completely new to nim and I'm having trouble doing basic imports: https://ghostbin.co/paste/7hx6h Rika: you need to export it dayl1ght: I've also tried from "./types" Rika: type MyType* = int dayl1ght: * exports identifiers? Rika: see that asterisk? codic: https://github.com/Yardanico/nimpylib is just amazing Rika: thats to export it Yardanico: @codic don't use it for real code XD Rika: you can export a lot of things Yardanico: it's just shows how to (ab)use generics and stuff Yardanico: type MyType* = int codic: Haha yeah, the only useful thing is the class support dayl1ght: perfect, so all identifiers are private to a file except when I add an asterisk Yardanico: yes Yardanico: https://nim-lang.org/docs/tut1.html#modules codic: i'm gonna split classes into a seperate module hahaha codic: then add inheritance if i can dayl1ght: oh well that's what I get for not reading the whole tutorial, I was just skimming through the code examples :p Rika: yardanico, i've started committing everything to circa's temp-all branch now Yardanico: @codic well it shouldn't be too hard dayl1ght: thanks folks Yardanico: @Rika nice codic: yeah codic: do nim objects have inheritance? Rika: my files are a mess though xd Rika: yes they do Yardanico: "object of AnotherType" Yardanico: but inheritance is mostly useful with methods codic: boom https://github.com/Yardanico/nimpylib/blob/master/src/pylib/class.nim Yardanico: so you gotta change it so it makes methods instead of procs codic: what's the difference? Yardanico: runtime dispatch vs static dispatch Rika: *imo*, nim's oop isnt as strong as most other languages', but OOP is meh to me anyway so im not super annoyed Yardanico: the latter is of course faster codic: so how do i change it to make methods/ codic: Since i don't see anything making a proc in there haha Yardanico: https://nim-lang.org/docs/macros.html Yardanico: https://github.com/Yardanico/nimpylib/blob/master/src/pylib/class.nim#L76 Yardanico: https://nim-lang.org/docs/macros.html#newProc%2CopenArray%5BNimNode%5D%2CNimNode%2CNimNode codic: O codic: hmm, that page doesn't have newMethod when ctrl-fing Yardanico: basically change nnkProcDef to nnkMethodDef and it *might* work codic: does have nnkMethodDef tho codic: oh Yardanico: @codic last argument is routine type Yardanico: well, not the last one Yardanico: "procType = nnkProcDef;" Rika: you still need to make {.base.} methods though Rika: gl, hf wit hthat Yardanico: yeah codic: hm Yardanico: @codic if you really want to extend it you gotta read a lot of stuff in https://nim-lang.org/docs/macros.html :P Yardanico: and experiment Yardanico: i'm surprised pylib has that much stars Yardanico: although https://github.com/metacraft-labs/py2nim has even more stars which is completely justified (the code is in https://github.com/metacraft-labs/py2nim_deprecated/ ) codic: Hahaha codic: I have a very quick question, does your class implementation support classmethods? Yardanico: well this class macro is reaaally simple Yardanico: it doesn't do advanced stuff codic: also, instead of the `type whatever = ref object(param: type)` could I use `var self.thing="O"` as a replacement for `self.thing="O"` codic: yeah i know :P Yardanico: var self.thing="O" no Yardanico: that's not how it works Yardanico: with "var" you declare a new variable, and fields must be known in object type definitions Yardanico: you can't declare new fields with "var" codic: oh Rika: you cant declare new fields on runtime codic: welpy codic: the main thing that's missing is classmethods, once i understand pragmas i'll allow `def thing(params) {.classmethod.}` if that's possible? Yardanico: python decorator syntax is valid nim syntax so you can have it the same as in python originally Yardanico: like "@classmethoddef from_string(stuff)" Rika: but you'll have to wrap the file in a megamacro no? Yardanico: yes ofc Yardanico: but really I'd suggest to not extend this class macro, not all python syntax is correct nim syntax Rika: now i see how them C# source generators come into play... Yardanico: e.g. "a, b = stuff" is not valid nim syntax Rika: i mean technically it is Yardanico: @Rika well with "class" you basicall write stuff like in Python Yardanico: @Rika it's not Yardanico: I just checked Rika: var a, b = stuff just sets both a and b to stuff's value Rika: ah ou mean w/o the var? Yardanico: yes Rika: yeah Rika: why would you want to convert nim into python anyway Yardanico: ikr Yardanico: pylib is just a PoC :P Rika: just use python if you're that hungry for it codic: idk codic: for fun Rika: if you need speed use pypy with python codic: i like the class syntax, that's all Rika: its not gonna be fun to implement Yardanico: the only useful thing in it is https://github.com/Yardanico/nimpylib/blob/master/src/pylib/range.nim Yardanico: replicates python-like range object Yardanico: python3-like* KingDarBoja: .-. Rika: hello KingDarBoja: Hi, just saw the chat KingDarBoja: I will be back, working on OOP + OV KingDarBoja: Object variants* codic: Fiiiiiiiine codic: i won't KingDarBoja: So far so good Rika-sensei KingDarBoja: Just hit a nested object variant need but I do think I will scrap the parent type KingDarBoja: At the end, I am doing all leaf types by groups Rika: im here absolutely dying from beatmap difficulty calculation Rika: like, its such a massive project converting oop to ov for me KingDarBoja: Then all of them will inherit of a single Node base KingDarBoja: D: KingDarBoja: I know that feeling KingDarBoja: Going backwards until I reach the parent base type KingDarBoja: Hummmm KingDarBoja: https://imgur.com/cBhadHR Rika Rika Yardanico: @KingDarBoja you know you can basically have really much less kinds and just have a generic "sons" field of seq[Node] ? Yardanico: see https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim#L723 KingDarBoja: That's what I am doing Yardanico: no? Yardanico: that's the node ast definition for nim AST KingDarBoja: Yup, I saw that Yardanico: "else: sons: TNodeSeq" KingDarBoja: Not that part KingDarBoja: > Then all of them will inherit of a single Node base KingDarBoja: So all my leafs will have the Node as root 🙂 Yardanico: then you'll have one object Yardanico: i mean object type KingDarBoja: Yup, just doing backward refactoring KingDarBoja: So first grouping the leafs by parent types KingDarBoja: Then scraping it and make it Node KingDarBoja: The screenshot I sent was more a question, but forgot to ask KingDarBoja: In case I had something like left side (nested Object variants), how I can provide the second kind `tdKind` ? Yardanico: ? KingDarBoja: So `Parent` has a kind, one of its kind has a subkind KingDarBoja: So If I do `Parent(kind: ChildTwo)`, how I can set the kind of the Child? KingDarBoja: Like ChildTwo has a `cKind` field (subkind) Yardanico: you can have as much kinds as you want in object variants Yardanico: @KingDarBoja I don't understand without code :P codic: earlier here, someone referened me to https://github.com/trustable-code/NiGui/blob/84a2b5c326658460d213b540e4f122b422deb5d6/examples/example_10_drawing.nim#L54 to change the font family and size in nigui. however i don't have a canvas, what would the other way to do it be? Yardanico: idk :P it was me, but I don't use nigui realy codic: (if there are docs please link me to em) Yardanico: fontFamily is only for canvas Yardanico: https://github.com/trustable-code/NiGui/search?q=fontFamily&unscoped_q=fontFamily Yardanico: nigui is quite simple, it might not have some advanced stuff codic: awww so I can't change the font of regular windows? Yardanico: doesn't seem so codic: Yesssss! codic: app.defaultFontFamily Yardanico: ? codic: that worked Yardanico: ah I see codic: and app.defaultFontSize codic: yay KingDarBoja: https://play.nim-lang.org/#ix=2kxN KingDarBoja: This is what I meant Yardanico: so what's the issue here? Yardanico: ah I see KingDarBoja: If I wanted something like that... Yardanico: that's how you do it Yardanico: https://play.nim-lang.org/#ix=2kxO Yardanico: if you have nested object variants it's still the same object KingDarBoja: Oh ok KingDarBoja: Also, I noticed the `repr` does print the subkind but it has a different formatting Yardanico: repr shouldn't really be used for normal printing KingDarBoja: [count = 5, germanyidkProp = "", lightspeed = 0] Yardanico: it's for debugging KingDarBoja: Ok KingDarBoja: Oh, a simple echo is enough KingDarBoja: Thank you 🙂 KingDarBoja: 😗 KingDarBoja: I am happy with how I got rid of those type conversions by using OV Rika: no kissing, its social distancing rn Rika: smh KingDarBoja: 👐 Rika: yeah i guess it is Rika: it feels so good consolidating many types into one Yardanico: although object variants is still runtime dispatch in a way, but yeah, it's certainly better than 100500 types Yardanico: because you do different stuff based on different kinds of objects and kind is decided at runtime KingDarBoja: I like when my tests still passing after each refactor step KingDarBoja: I am getting closer to one single kind Yardanico: object* Rika: > tests Rika: me: ._. Yardanico: XDD Rika: "what tests: Rika: man i have to write tests for so many beatmaps its pretty insane Yardanico: well nim itself has around 1.8k test files Yardanico: and that's ~100k cloc of of Nim code Yardanico: the compiler itself is 60k cloc Yardanico: stdlib 80k cloc Rika: ``` ~> find /home/deodex/Documents/CODE/Nim/circa/test_suite/ -type f | wc -l 2020年05月03日 09時58分13秒 Rika: 5975``` Rika: oops, left the date Yardanico: well but you mostly test the same software and stuff :P Yardanico: but yeah, cool that there's a lot of tests Rika: its not tests Rika: its just beatmap files Rika: i still have to write the tess Yardanico: automatically generate them Rika: not easy wrt. difficulty calc tests KingDarBoja: `if Rika not lazy then do tests else be lazy` Rika: because i need to query the API for that, for each map, each gamemode, and each mod combination Rika: which is a lot of queries Yardanico: doesn't the osu db contain diff calculation? Yardanico: just use the osu database lol Rika: i dont need to do all mod combinations, but i'll need all game modes Yardanico: it'll calculate all diffs and then you just query the DB Rika: hmm actually osu has a tool Yardanico: it uses sqlite Rika: yeah okay thisll be easier than i though Rika: first, ill finish the code KingDarBoja: I am adding comments to the spec, that's why I am slower KingDarBoja: So anyone willing to look at it, just need to look at each url lol KingDarBoja: Question Yardanico: Answer KingDarBoja: Style guide says KingDarBoja: > Unless marked with the {.pure.} pragma, members of enums should have an identifying prefix, such as an abbreviation of the enum's name. Yardanico: yeah that's outdated Yardanico: you don't need pure pragma to specify enum members without full qualification KingDarBoja: But it is okay to prefix my kinds like nkChild Yardanico: yeah ofc KingDarBoja: As my parent type is Node lol KingDarBoja: Ok Yardanico: style guide is not mandatory KingDarBoja: Just curious 🙂 KingDarBoja: bollocks, the same field name on shared kinds is annoying KingDarBoja: Need to rename them 😢 Yardanico: just prefix them Yardanico: sField Yardanico: objField Yardanico: propField KingDarBoja: Jum, I can't put `##` comments before each `of kind` KingDarBoja: Only after the KingDarBoja: after them* Yardanico: ofc lol Yardanico: what did you expet Yardanico: expect* KingDarBoja: I didn't know lol dayl1ght: in vscode, is there a way to view the typesof a nim variable/expression? Yardanico: yes, hover over it Yardanico: ctrl+lmb to go to definition dayl1ght: hover doesn't work for me 😐 https://imgur.com/a/2Ipy67p Yardanico: ah, in this case it won't work Yardanico: when you reference "test" somewhere else and hover over that - it'll show the type exelotl: maybe the warning is swallowing the other useful information Yardanico: nah dayl1ght: ah referencing works, thanks dayl1ght: so apparently toTable doesn't work when {.experimental: "codeReordering".} is set dayl1ght: oh I had tabs in my source file and that affected the .toTable call somehow lol Cerberus|The Enby: Can nim build a disassembler? Rika: why not bedwardly-down: Possibly. I mean any language can do pretty anything with the right design and will bedwardly-down: Possibly. I mean any language can do pretty much anything with the right design and will KingDarBoja: and patient, don't forget that dayl1ght: is it possible to have stack-allocated objects with mutable fields? I'm getting the following error https://ghostbin.co/paste/nw3gu Rika: no need to make them variable in the type Rika: all fields are var if the type is instantiated in a `var` Rika: fields immutable if in a `let` dayl1ght: ah my full code had `let object = ...` so that was the problem dayl1ght: thanks! dayl1ght: is it possible to make _some_ of the fields immutable though? Rika: no Rika: well, technically Rika: with accessor procs and the like then making the field itself not exported Rika: within the same file, not at all leorize: !repo nim-final Rika: dead Rika: rest in peace, disbot leorize: nimble.directory is also dead federico3 leorize: https://github.com/Quelklef/nim-finals leorize: here it is dayl1ght: nice! leorize: this module could probably use some updates skrylar[m]: interesting skrylar[m]: i do on rare occasion wonder why nim doesn't have proper constness, but then usually shrug skrylar[m]: in rust they have this pattern of builders where you have a sequence of mutable calls on the builder object, and then a "build" that gives you the final const-y version audiofile: pmunch does your vim-lsp not work with ale? audiofile: oh hes not here audiofile: frowny face audiofile: s/vim/nim Prestige: audiofile: it should if ale supports lsp Prestige: nimlsp just doesn't support a ton of features yet, and only evaluates the buffer on write Prestige: but you should get diagnostics and autocomplete, at least audiofile: oh ok, I'll have to look into it then, thanks for confirming, Prestige Prestige: Sure thing - fwiw I'm using coc-nvim and have it working. PMunch and I fixed a bug in nimlsp recently so make sure it's up to date as well bung87: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eae4584d898fe7a37615a25] bung87: what wrong with this? audiofile: I've been hearing a lot about 'coc' what is it -- is it an lsp? Prestige: audiofile: yeah, lsp client. It's pretty great but nothing is perfect Prestige: I prefer it to ale personally audiofile: what am I missing? audiofile: just curious =) bung87: `expression 'await read(future)' has no type (or is ambiguous)` Rika: its not an async proc? bung87: `asyncstreams.read: proc (future: FutureStream[read.T]): Future[tuple of (bool, T)]` Rika: the callback proc Rika: isnt Rika: did that fix it? bung87: ok, I am trying disruptek: tonight's devel is still producing nil derefs in async. disruptek: i'll run the bot w/o orc for now, i guess. bung87: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eae48e522f9c45c2a67941f] skrylar[m]: after peering over some of the memory stuff in beef i guess i slightly understand newruntime better skrylar[m]: i do kind of like the way they handle stack/arena allocators and pointer ownership bung87: `discard dest.writeFromStream(future)` solved Prestige: audiofile: tbh I don't remember the differences, but it's worth checking out imo skrylar[m]: https://media.discordapp.net/attachments/239881657908330499/706377233958174742/unknown.png not sure this was worth the effort :nervous: audiofile: ??? Prestige: what bung87: ```Exception message: Empty deque. ⏎ Exception type: [IndexError]``` ⏎ ⏎ any idea what causes this problem? [https://gitter.im/nim-lang/Nim?at=5eae5bdb22f9c45c2a67b181] zacharyc2rter: how do I deal with - is not GC-safe as it performs an indirect call and `--gc:arc`? audiofile: no, I ??? that image by skrylar[m] skrylar[m]: text engine in nim =p zacharyc2rter: I guess there's now way to do this now? ughhhh zacharyc2rter: https://github.com/nim-lang/RFCs/issues/142 disbot: ➥ Proposal to remove the `.gcsafe` effect from Nim ; snippet at 12https://play.nim-lang.org/#ix=26qX audiofile: you mean like markove sentence generators? skrylar[m]: no, knuth-plass linebreaking audiofile: oh Yardanico: @zacharyc2rter well you can use gcsafe in the proc body itself zacharyc2rter: yeah it's just annoying Yardanico: I know, it just needs to be disabled for arc/orc/boehm guess Yardanico: Not sure how much work is that leorize[m]: the ones with shared heaps can lax the requirements, but you can't fully remove it zacharyc2rter: yeah bung87: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eae60e19f0c955d7d9f3035] bung87: `Exception message: No handles or timers registered in dispatcher. ⏎ Exception type: [ValueError]` what's wrong with the code ? Yardanico: This usually means that the future already completed and you're still trying to run global dispatcher Yardanico: Or run that future bung87: ok , let me think of it bung87: no idea, if I dont using `waitFor`, process finish before complete, if I using it error throw. bung87: using `copyFile` for now,just one line :( Yardanico: anyway you should never call waitFor in async procedures bung87: ok, I leave this for now,thanks Rika: flatmap not in sequtils? Rika: odd Araq: I don't understand open source software Araq: so now the obsolete, unsupported -d:useWinAnsi switch got bugfixes :-) Araq: maybe Windows RT only supports the ansi versions? Zevv: don't unsupport or obsolete, just throw it out already! Araq: well it is useful to the one guy who now maintains it Araq: it is fine skrylar[m]: Zevv: no, bad. *hits with newspaper* skrylar[m]: you can only delete stuff after its been deprecated a cycle Araq: skrylar[m]: it's been deprecated for a long time and it's not documented anymore, but maybe there is a reason it got PRs Araq: as I said, iirc Windows RT is built upon the ansi char versions Araq: zacharyc1rter: your problem is easily solved with a ``{.gcsafe}: ...`` block bung87: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eae8a407a24ff01b0fb4676] bung87: what's wrong with this code? Yardanico: you're discarding a future Yardanico: "discard src.readToStream(destStream)" should be "await src.readToStream(destStream)" bung87: but await , waitFor also not wrok Yardanico: or if you don't want to wait for completion, asyncCheck Yardanico: @bung87 well discard is wrong here anyway bung87: `template/generic instantiation of `await` from here` Yardanico: give full error from the compiler itself please Recruit_main707: i remember this bung87: I only have `copyFile ` one solution, I just want figure it out bung87: `Error: Await only available within .async` bung87: editor also mark `{.async.}` as error Yardanico: i don't need editor Yardanico: please post full output from the compiler itself when trying to compile this example bung87: ok let me find some place to paste bung87: https://pastebin.com/0ddTUxgs bung87: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eae8bfcadb0ec5c2be04f62] bung87: full code is here https://github.com/bung87/icon/blob/master/src/iconpkg/favicon.nim bung87: oh, I solved it jorjun_twitter: beginning to adore this language. My current thankyou is to send a link to great new English musick. Later when I know more I will try to help out. jorjun_twitter: https://www.youtube.com/watch?v=IoVqSk4cloI skrylar[m]: alright i forgot there was a clever trick to this. coded it in and now things work okay. Yardanico: i guess that's a good enough documentation :P https://yardanico.github.io/nim-mathexpr/mathexpr.html Yardanico: apparently github pages won't display any files unless you set a default jekyll theme (even if you're not using one) lol Yardanico: wow I didn't know using the VM in custom code was so easy https://forum.nim-lang.org/t/6287 Araq: Yardanico: awaiting your bug report :-) Yardanico: Araq: well I tried to minimize it a bit, only got to the point where I made the output of the async macro work (expandMacros and then removing gensym things and some other fixes) Yardanico: it still depends on quite a lot of stuff and quite big (~600 loc), and most of all it depends on the network Araq: submit it anyway I'm bored and it's Sunday Yardanico: wait I thought today was monday lol Yardanico: it's https://gist.github.com/Yardanico/0b5fd6a630bb2a99ba2dce320a9a0d05, IDk if you would prefer the original async version or this one Yardanico: this one doesn't use the async macro and only needs asyncdispatch for the dispatcher (and asyncfutures for futures) Yardanico: with default GC it connects to #nim-test without issues, with arc/orc it either stops executing after "No ident response" (exists with 0 exit code) or throws an error "Exception message: File descriptor not registered." Yardanico: *exits Yardanico: well ofc it's due to sink inference as well (it works without it) Araq: well the sinkInference exposed bugs but is usually not the root cause Yardanico: oh Araq: see my tests, I used 'sink T {.nosinks.}' in your other bug report to trigger the same bug Yardanico: ohh Yardanico: I'll try poking random procs with {.nosinks.} :P Araq: awesome, thanks federico3: leorize: looks pretty alive to me ;) Araq: Yardanico: I get Yardanico: Araq: seems like adding nosinks to wasBuffered solves the issue Araq: [":beckett.freenode.net NOTICE * :*** Looking up your hostname..."] Araq: [":beckett.freenode.net NOTICE * :*** Checking Ident"] Araq: [":beckett.freenode.net NOTICE * :*** Found your hostname"] Araq: [":beckett.freenode.net NOTICE * :*** No Ident response"] Yardanico: yeah after that it hangs and then exits with exit code 0 or crashes Yardanico: with default GC it further connects to the channel #nim-test Araq: ah ok, it took a while but now it crashed Yardanico: yeah I checked, wasBuffered with {.nosinks.} makes it work for some reason Yardanico: ah wait no Yardanico: maybe not it, I have nosinks in a few other places too Yardanico: ah no, after all it really is wasBuffered Araq: same here, seems to work with .nosinks for wasBuffered, how strange Araq: wasBuffered is pretty simple dom96: cool, thanks for looking at fixing IRC with orc Yardanico: dom96: well it already works with --sinkInference:off :P Araq: we want sink inference though, it's excellent dom96: Next step, test nimforum? :) Yardanico: Araq: well adding nosinks to "send" (which is just below the wasBuffered) instead of wasBuffered solves it too Araq: and you can always trigger the same bugs with explicit 'sink T' anyway Araq: Yardanico: yeah I see it, send is also getting 'sink' inference otherwise dom96: what does `sink` mean again? Araq: dom96: "I am stealing this parameter" Yardanico: btw my old social network bot seems to work with orc, although it only uses async httpclient for async stuff Araq: for example, put(h: var Table; key: sink K; value: sink V) # h takes over the (key, value) pair Araq: you don't have to use it, but it can make the code faster dom96: takes it over in what sense? any docs on this? Yardanico: https://nim-lang.org/docs/destructors.html#sink-parameters Araq: dom96: it was part of my fosdem talk too Yardanico: basically it doesn't make a copy I guess Yardanico: or something like that dom96: ahh, so it ensures that the calling code does not modify those parameters Araq: it's about moving things into the right place rather than copying them, yes dom96: so what happens if I write var x = 42; table.put("foo", x); x = 52? Araq: dom96: no, "mutability" doesn't play a role here Yardanico: dom96: it'll work as expected Yardanico: because control flow analysis will understand that you still need x afterwards :P (my guess) Araq: dom96: it's then turned into table.put("foo", copyof(x)) dom96: so `sink` enables this analysis? Yardanico: or automatic sink inference dom96: i.e. if no `sink` is specified we always get `copyof` Yardanico: which is enabled by default dom96: (assuming `sink` is not inferred) Araq: dom96: not quite... :-) dom96: explain :) Araq: if you don't have the 'sink', inside the *body* of 'put' the copy has to be made Araq: but if you have the 'sink' the compiler can the copy into a move inside the body of 'put' Yardanico: "As a nice bonus, files and sockets and the like will not require manual close calls anymore." btw this will be added to stdlib right? Yardanico: even for stuff like HttpClient Yardanico: so we don't need to close it explicitly :P Araq: but this move must be sound, so the caller must ensure it's not used afterwards. if it is used afterwards then the 'copyof' kicks in, saving the soundness of the design Araq: in the end, the copies bubble up to the places where they really are required and we end up with the minimal amount of required copies dom96: so we annotate the types, but what matters is when that parameter is used in the body dom96: or do we annotate it with `sink` in the body too? Araq: no, 'sink' is only for parameters Yardanico: dom96: there's also "lent" btw Araq: and also, the inference ensures that you don't have to do anything, the compiler does it all for you Araq: Yardanico: we are also getting 'lent' inference :P Yardanico: lol Yardanico: Araq: also is there a reliable way to check if orc leaks memory or not? do GC_fullCollect() at the end of the program and -d:useMalloc ? Araq: yeah but the async event loop leaks memory Yardanico: oh Araq: as it creates a large seq in a thread local variable iirc Araq: dom96 can fix it for us :-) Yardanico: hah dom96: 90% sure I wasn't the one who added whatever large seq you're talking about :P Araq: I know dom96: maybe we should ask the person that did to fix it? :D Yardanico: orc with async with threads Yardanico: the ultimate dream is near Araq: doesn't have to be fixed, only needs an API 'nukeSelectors' dom96: you'll still need a way to await channels/FlowVars afaik dom96: Araq, but why would this seq leak, it surely doesn't grow forever? Araq: dom96: right but it does make things harder to measure Araq: Yardanico: I'm using Araq: proc wasBuffered(irc: Irc; message: sink string; sendImmediately: bool): bool Araq: proc send(irc: Irc; message: string; sendImmediately = false): Future[void] {.nosinks.} Araq: and it's also stable with that variation Yardanico: yeah works for me too Araq: bbl dom96: Araq, how so? You can still get the memory usage and if it grows you've got a leak Recruit_main707: can you manually manage memory with arc to avoid leaks with async? (its just hypothetical, i am not using async yet) Yardanico: that would be really complicated Yardanico: you clearly haven't seen output of the async macro with all of its iterators and closures (it's cool, but it's not that easy :P) dom96: it's a fair question dom96: AFAIK the problem is with the fundamental building blocks of async: iterator closures Yardanico: seems like ircord is relatively stable, it can run for 2 days straight (the current one runs in #nim-offtopic for since 1th of May from 16:00) Yardanico: and when it crashes it's easy to restart with a script :P Recruit_main707: good job :) Yardanico: well setting intents and fixes in dimscord itself helped that quite a lot Yardanico: last crash was maybe due to my PC losing internet connection or something (yes it still runs on my PC, the PC already has a 10 day uptime lol) Yardanico: "Error: unhandled exception: Device or resource busy" "Additional info: "No address associated with hostname" [OSError]" leorize[m]: getaddrinfo crashing again lol leorize[m]: ignore the errno, it's not supposed to make sense for that error Yardanico: well it seems to be related to websocket lib "Error while reading websocket data ::" zacharycarter: morning Yardanico: why do you have 3 IRC accounts? :D zacharycarter: I have lost tmux sessions I think zacharycarter: and they're probably still connected to irc lol zacharycarter: or I guess one still is at least zacharycarter: but at least I got my nick back! Yardanico: well register it on freenode to not lose it :P zacharycarter: I'm almost ready to show off this fiber based job system zacharycarter: oh I am registered zacharycarter: it's just the account was still connected so it changed my nick to zacharyc1rter or whatever Joshua S. Grant: Is discord's offtopic channel and #nim-offtopic bridged? It doesn't seem like it zacharycarter: no they'r enot zacharycarter: I think gitter and Nim are though Yardanico: they are zacharycarter: oh sheerluck: I'm in gitter Yardanico: I run ircord on my own PC right now which bridges #nim-offtopic with discord Yardanico: for debugging/testing stuff KrispPurg: Yardancio, what is your common WS Error. KrispPurg: Yardancio, what is your common ws Error? Yardanico: Error while reading websocket data :: socket closed KrispPurg: Ah Yardanico: a lot of times there's also "An error occurred while parsing data: �" but it doesn't seem to crash with that KrispPurg: I am aware of that one. livcd: Yardanico: oh so in theory we can own you through ircord right now! Yardanico: wat? KrispPurg: wut KrispPurg: Also, I fixed a bug of ratelimits for shards that over 2, now. (The commit hasn't been pushed yet.) Yardanico: what happens if we compile nim compiler with LTO and PGO? hmm Yardanico: well for PGO we'll use compiler itself to generate profiled data Yardanico: linking takes quite a while as expected :P livcd: https://github.com/christianscott/levenshtein-distance-benchmarks livcd: https://www.christianfscott.com/making-rust-as-fast-as-go/ Yardanico: wat Yardanico: "making-rust-as-fast-as-go" did i read that correctly livcd: TLDR: default osx mem allocator that Rust uses is slower than Go's allocator leorize: Yardanico: I'd not recommend PGO though leorize: the nim compiler doesn't do that much metaprogramming leorize: for quality profiles compile some of mratsim's projects Yardanico: oh Yardanico: so I guess the VM will benefit a lot from PGO? Yardanico: well yeah that's understandable Yardanico: that's why most interpreted languages ship binaries with PGO :P disruptek: disbot: you alive? disbot: yep. 😊 Yardanico: #14159 disbot: https://github.com/nim-lang/Nim/issues/14159 -- 5[ARC] Segfault with cyclic references (?) ; snippet at 12https://play.nim-lang.org/#ix=2k4U Yardanico: yay Yardanico: disruptek: you alive? disruptek: the bot crashes with orc and sinkinference off. disruptek: bbiab Yardanico: wow disruptek: Araq: i could use some direction today. Zevv: I could use some direction in my life, in genal Zevv: general disruptek: zevv, you're back Zevv: I was never away disruptek: how are you holdin' up in the midst of this pandemic? disruptek: it must really chaffe your ass that you cannot mingle with the throngs at the shops. Zevv: oh well, life is not too different from usual I guess. I kind of stopped being social long ago, working from home has always been part of my life. So hey, it could be worse. Zevv: I do miss concerts and making music the most I think Bennyelg: Hi @dom96 Can I how can I wrap the resp object in jester ? Zevv: although I do the latter online these days Yardanico: wdym by that @Bennyelg disruptek: lemme hear your music. Zevv: it's volatile Zevv: it plays and then its gone disruptek: i'm okay with that. zacharycarter: I have an emit statement at the top of a module that emtis some C code and then I have an object that I bind to that type via importc zacharycarter: when I compile though, I get an error about the c type being unknown from stdlib_system.nim.c zacharycarter: dafuq? why is a reference to that type in that file? Yardanico: zacharycarter: maybe you pass your object to some template or something like that from system zacharycarter: hmmm leorize: maybe don't use emit? :P zacharycarter: add a way to add volatile qualifiers to types and I will :P zacharycarter: can we just make codegenDecl work with types too? zacharycarter: that would solve all my problems dom96: Bennyelg: not sure what you mean by "wrap" leorize: zacharycarter: what are you using volatile for? disruptek: zacharycarter: make an issue, it might be something in my neck of the woods. disruptek: i would need a test, though. zacharycarter: leorize - to mark the C type as volatile which to my understanding tells the compiler that its value can be changed legitimately by something beyond the program's control like a concurrently executing thread zacharycarter: it'd also be nice for adding attributes to typedefs like alignment attributes zacharycarter: to declare minimum alignment for types zacharycarter: disruptek: it probably needs to go through an RFC first right? zacharycarter: maybe Araqq would have reservations disruptek: ideally. maybe someone has a workaround. leorize: {.align.} is already a thing? disruptek: i'm thinking it's a pragma. zacharycarter: but it doesn't work for types zacharycarter: only procs and member variables - which is fine zacharycarter: err sorry member properties and variables zacharycarter: I'm fine with not having {.align.} and {.volatile.} for types - but I should at least be able to modify the generated C code for them I think leorize: well RFC then :P zacharycarter: okay :) leorize: though I'm not sure if volatile is the solution to your problem leorize: actually I'm not even sure what's the problem :P zacharycarter: Well my original complaint was that my emitted code is being referenced in a system source file. zacharycarter: I'm marking an int32 alaias as volatile because I'm using it in atomic builtins Bennyelg: how can I avoid something like this: ⏎ import ../models/model1 ⏎ import ../db_models/model1 ⏎ import ../utils/utils [https://gitter.im/nim-lang/Nim?at=5eaed4987a24ff01b0fbdf58] Yardanico: ? Yardanico: how would you like it instead? leorize: zacharycarter: shouldn't you be able to use atomic without volatile? zacharycarter: like - `__sync_lock_test_and_set` Bennyelg: I'll explain the problem: zacharycarter: two threads might share the volatile int though Bennyelg: create router with jester and import some models there.. ⏎ go outside and create the route: with all the routes and extend model1, "/" zacharycarter: but sure I guess I can zacharycarter: I don't think anything will blow up if I dont' mark the type alias as being volatile Bennyelg: you get error since functions are not there (but they are - its probably an import errors) leorize: zacharycarter: the edits inside same program doesn't need volatile afaict disruptek: don't actually make a pr to rfcs; just create an issue. leorize: you need volatile when nothing even try to touch that variable and it can still change :) leorize: I might be wrong though :P zacharycarter: hmm yeah I'm not 100% sure either Bennyelg: you get something like: ⏎ /Users/benny/DLM/backend/src/routes/model1.nim(10, 33) Error: undeclared identifier: 'getModel1' zacharycarter: I'll do more research - in a lot of example code i read online though they're using volatile zacharycarter: but a lot of example code is wrong too Bennyelg: but if you compile the file directly - all passes leorize: though this is the kind of thing you'd use memory barriers on leorize: volatile is a bit too broad and will prevent certain optimizations zacharycarter: okay yeah that makes sense could be more precise with types of barriers zacharycarter: need to take the doggos out for a walk, bbl dom96: Nim in Action is 50% off today in case anyone wants to grab a copy: https://book.picheta.me Yardanico: i will :P (yes I still haven't bought it) Yardanico: want a printed book about nim dom96: awesome Recruit_main707: 25 bucks is something i might be able to afford dom96: also, likes and RTs on my tweet appreciated, I wonder if I can beat a similar tweet about Rust in Action :P Bennyelg: ```code paste, see link``` ⏎ ⏎ failed with the reason of undeclared identifier but when I run r1 individually it compiled and all right ⏎ any helpp [https://gitter.im/nim-lang/Nim?at=5eaed72022f9c45c2a68a103] Yardanico: although shipping to Russia costs quite a bit with manning, but it's ok I guess :P Yardanico: $35 total ($10 shipping to Russia lol :P) leorize: one day I'll have the money to buy it :P dom96: Yardanico, is amazon operating in Russia? Yardanico: dom96: kinda yes Yardanico: I mean there's no russian amazon Yardanico: but you can order from other countries' amazon websites to ship to russia dom96: might be worth checking if it's cheaper that way dom96: I've seen it much cheaper in UK amazon for example Yardanico: can't ship to russia from UK amazon for some reason :P supakeen: Pfft Russians are much more inventive. Yardanico: and anyway I already paid for it, now comes the wait :D supakeen: I often get the option 'we can ship from $nearest-eu country for 5 dollars more'. Yardanico: well I mean I can access the ebook right away supakeen: And then I guess they drive over the border and ship it from there. supakeen: It's much faster than goign through customs. supakeen: Things shipping from Ukraine or Russia always take forever otherwise :( Yardanico: my biggest international order was my PC (3700X with wraith prism + mobo + 16gb ram) from Germany (computeruniverse) Yardanico: it's cheaper because I didn't have to pay for 20% russian VAT lol supakeen: Hehe. supakeen: I order a lot of ex-Soviet electronics on ebay. leorize[m]: the german didn't tax you or do they tax less? :p Yardanico: they didn't tax me Yardanico: since i'm not from EU Yardanico: although some european stores already add russian VAT (and it's kinda required, idk why CU doesn't do that) Yardanico: for example hetzner already does 20% russian VAT automatically supakeen: probably depends if they have a russian entity as well? leorize[m]: you get to abuse it while you still can :p supakeen: (or did enough business with russians to figure it out) leorize[m]: probably because too many used the loophole Yardanico: well that "loophole" if you call it that was around for at least 6 years leorize[m]: where I'm from they just close the loophole with a huge import tax :) supakeen: yea over here if i send stuff to outside-the-EU i only need to register it as export supakeen: the rest of it is up to the receiving country supakeen: if they don't check incoming packages/do other stuff hey no taxes Yardanico: well yeah we have import tax in russia too Yardanico: and before 1st january 2020 it was 30% if you order something over 500 euro supakeen: that's steep Yardanico: now it's 15% if you order over 200 euro supakeen: we pay no import fees and vat for things under 25, no import fees but vat for up to 150, over 150 you pay both supakeen: and this only applies to things coming from outside the EU supakeen: because those are all exempt from everything :p Yardanico: well before 1st january it was 500 euro limit _monthly_ for all your orders Yardanico: now it's individual so you can order as many 199 euro deliveries as you want Araq: so ... if you think C++ templates are misdesigned junk because they are Turing complete, here is the bad news: https://arxiv.org/pdf/1605.05274.pdf supakeen: i see a new business here, drop shipping for russia by splitting shipments to fall below the limit leorize[m]: Araq: lol Yardanico: Araq: what about Nim? :P Yardanico: well i guess there's no need to question that since we already have a compile-time VM :P Yardanico: but I just wonder about generics/static leorize[m]: it's turing complete until you hit a generics bug Bennyelg: @Yardanico https://github.com/dom96/jester/issues/178 this is the bug - I wanted to open one but found an issue (2018) Araq: it's probably both undecidable and unsound, just like Java. leorize[m]: @Bennyelg: put everything in a template, then call that template in the router leorize[m]: we should probably implement that in jester too Araq: https://docs.microsoft.com/en-us/archive/blogs/ericlippert/lambda-expressions-vs-anonymous-methods-part-five disruptek: Araq: mumble? Araq: disruptek: I'm on the wrong computer fro mumble, what's up? disruptek: so the sealing is done, i guess. now i need to figure out how the backend works. disruptek: we just let it mutate locations? or move those into a new backend ast? disruptek: not sure how ambitious you want the next step to be. disruptek: the caching is a state machine now, which feels much more workable. Araq: don't touch the backend, the backend should read the database and keep doing what it always did Bennyelg: not exactly followed, can you show me a quick example ? disruptek: the problem is in the backend, though, afaik. disruptek: just let it do whatever? Araq: yeah disruptek: okay Araq: don't cache snippets or anything like that disruptek: lemme get this working, then. disruptek: i wanna gut loc so bad. Araq: it's only the backend, we all know it sucks Araq: if you want to, give it a decent IR leorize: question: should I create multiple API for different kinds of process execution? disruptek: yeah, lemme make it work then i'll make it correct. leorize: currently I'm having an `exec()` API that takes the process configuration DSL and execute the process accordingly leorize: but then there are use cases like only caring about the output, exitcode, etc. leorize: should I make more API or should I add something like: `capture(output)` to the DSL? treeform: When did nim's error messages get this good? `Error: the syntax for tuple types is 'tuple[...]', not 'tuple(...)' Bennyelg: I triied this: Bennyelg: `````` Bennyelg: `````` Bennyelg: import jester ⏎ import ../utils/util ⏎ ⏎ template tp*(body: untyped): untyped = ⏎ ... [https://gitter.im/nim-lang/Nim?at=5eaedef87a24ff01b0fbf438] Bennyelg: `````` [https://gitter.im/nim-lang/Nim?at=5eaedf00adb0ec5c2be0f718] leorize: Bennyelg: looks like the indentation is all broken Araq: treeform: when the survey told us to make them better treeform: Survey did good Araq: leorize: make the API complete with streams etc and then add a simple DSL on top of the API Araq: don't do things that only the DSL allows leorize: yea I have that planned leorize: too bad we don't have an async version of streams leorize: and the name asyncstreams has been taken for something completely unrelated Araq: when we wrote it, we thought these are async streams :P disruptek: lol dom96: "Its api is still experimental and so is subject to change" dom96: and "Unstable api" in the docs dom96: means backwards compat rules don't apply dom96: (Don't really see much of a reason why what exists can't be kept for backwards compat though) Yardanico: well same goes for "endians" but if you suddenly change its api some packages will break :P Yardanico: wonder why endians is "unstable api" though leorize: can we import chronos's asyncbuffers and friends? :P Araq: leorize: try it Yardanico: https://github.com/loloicci/nimly was really surprised to find out it's GPLv3 :P Yardanico: btw, just a question - what would be the license of the code generated by the macro which is a part of a GPLv3 library? Yardanico: in nim mratsim: I suppose you can refer to GCC which is GPLv3 and can generate assembly from MIT code. Araq: Yardanico: ask nimly's author but usually code generators have no influence on the license Yardanico: well seems like nimly was initially under MIT but then the author made it GPLv3 :P Yardanico: not that i need to use it though Araq: it can only be different for code you need to compile/link with your code Yardanico: ah ok Araq: if your code A is in MIT and you run it through an obfuscator/macro/compiler it's still MIT afterwards Araq: I think... leorize[m]: gcc license permits it to be used without changing whatever it consumes into GPL leorize[m]: however the AST from gcc is GPL :) leorize[m]: https://www.gnu.org/licenses/gpl-faq.html#OOPLang Yardanico: lol leorize[m]: ^ might be related Yardanico: it's nice when searching for "lexbase" in google the nim docs is 4th result (although google knows about what I search so my results are biased) Bennyelg: :/ disruptek: i'm streaming, btw disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek Yardanico: your titles are getting increasingly creative Bennyelg: I modify jester code, how do i re-compile and make my in version to run with it ? Yardanico: "nimble develop" in the folder with your modified jester is the simplest way dom96: I created a gamedev channel on Discord in case anyone is interested in joining :) Yardanico: I can try to bridge it to the same #nim irc Yardanico: or no? Yardanico: or maybe bridge to #nim-offtopic instead Recruit_main707: or just use discord and accept that irc is dying :P Yardanico: not gonna happen anytime soon dom96: nooo dom96: don't bridge dom96: this one is Discord-only Yardanico: lol ok Yardanico: I see what you're trying to do dom96 :P Recruit_main707: its free premium leorize[m]: dom96: can I bridge it with matrix then? :P Araq: dom96: discord? why not telegram? Chiqqum_Ngbata: I tried a direct translation of the python/go code here just for fun and nim didn't perform well https://github.com/christianscott/levenshtein-distance-benchmarks Recruit_main707: -d:release and gc:arc? Yardanico: show the code Yardanico: -d:danger * Chiqqum_Ngbata: Yeah, I added all the fixin's Yardanico: well show the code :P Yardanico: as a paste Willyboar: It would be nice to have specific channel for game, desktop, web etc Chiqqum_Ngbata: Paste inbound. go: 1.772757 javascript: 7.016 nim: 4.774278109 rust: 2.154426004 Yardanico: and did you see https://nim-lang.org/docs/editdistance.html leorize[m]: gimme code and it will be as fast if not faster that the fastest :p Chiqqum_Ngbata: https://play.nim-lang.org/#ix=2kE3 Chiqqum_Ngbata: Like I say, it's a translation of the go/python which doesn't seem very optimal either.. I'll look at editdistance for fun Varriount: @Chiqqum_Ngbata If I had to guess, it's doing lots of string slicing and assignment Chiqqum_Ngbata: Yeah, editdistance makes it faster than the rest by a healthy margin leorize: why does it have to be run via node... leorize: I don't have node leorize: fine I'll just optimize the nim version :P leorize: then I'll leave the benchmarking to you Chiqqum_Ngbata: Will do Araq: Yardanico: any progress? which 'send' call is it? leorize: Yardanico, Chiqqum_Ngbata: wanna guess the bottleneck? :) Araq: console output? leorize: toRunes() Araq: lol Yardanico: right there's an iterator leorize: 3.9 seconds was spent converting the string to runes leorize: that's 90% of the runtime Yardanico: so you changed it to utf8 iterator? Yardanico: Araq: trying to figure it out, sorry, I didn't look before :P i still have quite a lot of time leorize: Yardanico: if I wanna win against Go fair and square, I got to keep the algo Araq: on a related note I did improve my best time by 30s today Yardanico: best time of what? :P Yardanico: benchmarks? Yardanico: or running? Araq: my 10km run Araq: but I think it's pretty bad, practisising for 6 weeks only to become 30s faster :D leorize: Araq: what is this Marker_ proc? Araq: leorize: the GC leorize: arc saved the day :p Araq: but in my defense I swallowed a big beetle and had to recover from that during my run Yardanico: Araq: also seems like if I remove wasBuffer call at all (and result = newFuture and complete) and basically only call send(irc.sock, ...) inside of that send it works Yardanico: I mean if the send in that file will only be as "return send(irc.sock, message & "\c\n", {SocketFlag.SafeDisconn})" it works without any nosinks Yardanico: maybe it's due to wasBuffered adding stuff to messageBuffer and then something happens with that one dom96: Since my book is 50% off today I'm going to post an AMA on reddit for it Araq: dom96: I can register under a new account and ask questions (just kidding) leorize: Chiqqum_Ngbata: do you happen to know that's Go's string semantics? Yardanico: Araq: lol leorize: what's* Yardanico: i wonder how long will I wait till pBook comes to me to Russia :P Araq: leorize: immutable with O(1) slicing leorize: no wonder why this style of loop favors them Araq: yeah it's optimized for the moron's version, well it's Go... leorize: is lent T a thing? clyybber: yeah leorize: I mean as value type leorize: nope it's not Araq: leorize: you can always use 'ptr', it exists dom96: https://www.reddit.com/r/nim/comments/gcv88z/dominik_picheta_here_writer_of_nim_in_action_and/ Yardanico: should've made it in r/programming :P Yardanico: or cross-post, idk dom96: Yardanico, good idea, wanna cross post it yourself? :) Yardanico: sure clyybber: dom96: Why not bridge the gamedev channel? Yardanico: dom96: ah "This community does not allow for crossposting of text posts" Yardanico: for r/programming dom96: Yardanico, lol, just submit a link and give it a title like "Dominik Picheta, core developer of Nim is doing an AMA in r/nim right now" dom96: or something dom96: clyybber: I don't really care that much tbh dom96: but having all these messages from IRC breaks the inclusiveness IMO clyybber: huh? But its not exactly inclusive to exclude IRC users either :p Yardanico: dom96: ok I'll post :P Yardanico: i hope i don't get downvoted lol leorize: ahh, rust cheat with a slightly different algo leorize: might as well borrow that :) Araq: leorize: you can also implement COW O(1) slicing strings for arc/orc leorize: that's overkill for a microbench Araq: it's rather simple since the new implementation is cleaner leorize: and I'm not sure if O(1) is a good idea leorize: sorry, COW Araq: it's not overkill for Nim Araq: it's the future, should write an RFC though leorize: the last time I hang around free pascal mailing list they were talking about how COW strings were a mistake to be in the language clyybber: Araq: One could consider it part of the lent RFC clyybber: or the view one Araq: leorize: they do atomic RC though, we don't Araq: leorize: also do you have a link to the discussion? leorize: no, it's been a couple of years since leorize[m]: Araq: https://play.nim-lang.org/#ix=2kEp <- is that a bug? Araq: you cannot pass inline iterators around leorize[m]: so basically I'd need to write a macro for this Araq: for enumerate use the for loop macro Araq: why isn't this in the stdlib already? probably forgot about it? Willyboar: @dom96 better start answering.... :P livcd: Where is this AMA? livcd: ah reddit Recruit_main707: AMA? livcd: American Muscle Asses Recruit_main707: ah Yardanico: "What would be the best resource to learn more about mom and it's many garbage collection models?" Yardanico: lmao Yardanico: i know its autocorrection but still KingDarBoja: lool KingDarBoja: > _Also do you think the lead developers will begin to create videos to discuss new or exciting aspects of the language to provide a lower barrier to entry?_ leorize[m]: Yardanico, @Chiqqum_Ngbata: https://play.nim-lang.org/#ix=2kEC leorize[m]: -d:danger --gc:arc and this thing will be close to go KingDarBoja: I don't think lead devs bother about making videos 😢 leorize[m]: without both then should be as fast as rust livcd: Well Araq streams. Just not the type of stuff beginners are interested in KingDarBoja: I could watch the stream if I weren't working as my time zone is always 7 hours behind Germany Araq: can't stream anymore, Corona Yardanico: lol Araq: my kids are around all day long disruptek: wut Yardanico: ahh disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: king: you can ask me whatever you want, buddy. Araq: Yardanico: I wrote a sendSafe proc that is .nosinks KingDarBoja: Sure bro! Araq: and used it inside 'connect' and then the crash is gone KingDarBoja: I have switched to Object variants as you previously stated 😄 Araq: so we fail to pass '&' expressions to 'sink' inside 'connect', so weird leorize[m]: lol the rust ver uses `include_str!` leorize[m]: they cheated a hell lo leorize[m]: lot* Yardanico: wait what Yardanico: "The file is located relative to the current file. (similarly to how modules are found)" Yardanico: compile-time string include lol? leorize[m]: yes :) leorize[m]: go is the king in this benchmark leorize[m]: immutable strings let them win points in the main loop leorize[m]: and their string to rune implementation seems to be really fast KingDarBoja: Hey 4raq, just curious, has been any progress regarding this -> https://github.com/nim-lang/RFCs/issues/19#issuecomment-173529871 disbot: ➥ Allow usage of the same attribute name in different branches within variant types leorize[m]: though I'm not sure of that's the case or their optimizer just inlined the string-to-rune and the loop after that leorize[m]: if* KingDarBoja: I installed gary nim extension but I really miss some colors on the syntax highlight lol Recruit_main707: you can add them with an small change in your settings.json Recruit_main707: ill dm it to you KingDarBoja: Thanks 😄 Recruit_main707: np KingDarBoja: So now all basic types are red, clever Recruit_main707: you can change the color Recruit_main707: i have it to fit my color theme KingDarBoja: I know, but I like the red 😄 Araq: KingDarBoja: only in the sense that the arc/orc allow us to make the impl more flexible KingDarBoja: Okie Dokie 😄 KingDarBoja: Does autocompletion for OV works in VSCode? seems like not :/ Yardanico: it does Recruit_main707: its just the original extension with the syntax color problems fixed KingDarBoja: Yardanico: did you saw the link on offtopic channel? Yardanico: yes Yardanico: but it works for me KingDarBoja: 🤔 KingDarBoja: I am screwed KingDarBoja: I see it will start showing possible fields after typing `.someCharacter` KingDarBoja: But hard to guess which kind I do have 🤔 KingDarBoja: Unless I am misunderstanding how OV works Yardanico: object variants work at runtime Yardanico: compiler can't know which kinds will be for which fields without a lot of analysis KingDarBoja: Ahhh that why... KingDarBoja: So I have to guess which kind it is and use the proper fields KingDarBoja: Thank you Yard 😗 KingDarBoja: This is a whack-a-mole now x.x dom96: yay lots of questions dom96: damn, these are good questions KingDarBoja: lmao mahfiles: Is there a method to find the current directory of an executable? Not the directory it's being run from, but the directory it's actually in. disruptek: see the os module. mahfiles: I tried checking the documentation before asking; but only found getting the current directory it's being run from, rather than where the executable actually is disruptek: getAppDir, getAppFilename? disruptek: which manual are you reading? mahfiles: I was reading off the doc page; and i somehow just missed it; but it is on there. thanks, sorry about that disruptek: it's okay, i thought maybe the docs were br0xored. KingDarBoja: Okay I pushed the OV thing into another branch so I don't mess up master on my repo KingDarBoja: https://github.com/KingDarBoja/Phosphate/commit/ac6f2a47e1b318642bdf7eb4b7d0ff4ca5ccbc8e still not happy about having to guess the field names :/ covidian: kewl covidian: nim roxx! KingDarBoja: Whereas the mixed OOP + OV seems to be okay to get rid of type conversions and also bring me type inference at compile time KingDarBoja: https://github.com/KingDarBoja/Phosphate/commit/2242dfbefb35b26b8cf0ae272e6a0d6624666b6e KingDarBoja: what do you think disruptek? Araq: looks ok Araq: covidian: thanks Prestige: dom96: Just purchased your book, thanks for the discount code :) covidian: kewl... which book is it ? (newbie here) covidian: though I dabbled in nim already dom96: Prestige, yay, thanks for picking it up! dom96: covidian, https://book.picheta.me covidian: OK covidian: nice website dude dom96: thanks :) covidian: I always thought nim is kinda nice. now we need to bring the GuixSD people onboard ;-) covidian: they have a böner for guile / LISP covidian: for whatever reason... Yardanico: Well you know it's kinda expected considering Guix is in Guile covidian: but can't they see? ;-) covidian: maybe we have to put up with guile/LISP for packaging. it is truely amazing what they do. Yardanico: NixOS uses Nix dom96: TIL an AMA is hard work Yardanico: It's a functional DSL, not lisp family covidian: yes they are kinda linked guix + nixos Yardanico: GuixSD was initially based on NixOS covidian: OK covidian: I would really like an AMA against those pro-covid doctors Never Listen To Beef: A pro covid doctor is called a mortician covidian: lawl or a former unemployed or sth. Never Listen To Beef: A pro covid doctor is like a pro bullet soldier covidian: dude u drank the Kool Aid... Never Listen To Beef: What? covidian: were you joking? I think there is a mega hysteria ongoing. bedwardly-down: Ummmm... I might be hopping on at the wrong time. 😮 Never Listen To Beef: Im both joking and questioning what a pro covid doctor is, seems like doctors would be against a virus since you know they're doctors covidian: in fact, those covid numbers are less reliable than the estimates on POTUS IQ. Never Listen To Beef: I dont even get what you're saying covidian: well take Prof Drosten, the covid pope from Germany. in an AMA I would ask him how many million €€ his portfolio grew recently. covidian: in stock options of Big Pharma covidian: POTUS = president o0f the united states Never Listen To Beef: Are you explaining that for yourself? covidian: so what do u not get? Never Listen To Beef: The entirety of what you've said Never Listen To Beef: "Pro covid doctor" is one im really stuck on covidian: Mr. Drosten PhD is a doctor and makes his money with covid. he is a pro-covid doctor in a manner of speaking. solitudesf: cool. there is offtopic channel for that. Never Listen To Beef: Yea i was going to say, but felt that'd be silly to say after enticing them Never Listen To Beef: Anywho, uhh nim eh? covidian: you mean my nickname "covidian" sounds like I myself drank the KOOL AID ? lol covidian: nim roxx, let me tell u covidian: will the covid19 hoax ever end? Never Listen To Beef: Offtopic, but "hoax" the virus doesnt exist? Never Listen To Beef: Like go spew you silly illinformed bullshit elsewhere that isnt nim related in the slightist jorjun_twitter: Bit of JS backend help pls pls jorjun_twitter: https://pastebin.com/98HsMbM6 jorjun_twitter: couldn’t see how to refer to the proc for requestAnimationFrame.. almost got my first three.js demo working. dom96: jorjun_twitter: pretty sure dom defines a `window` dom96: also your `render` proc needs to take a float parameter jorjun_twitter: Thanks @dom96 removed the window def, tried this: proc render(time: float = 30.0): int = ⏎ ⏎ ```requestAnimationFrame(window, render)``` [https://gitter.im/nim-lang/Nim?at=5eaf3f2270a7fb75e6232576] jorjun_twitter: Error: type mismatch: got ⏎ but expected one of: ⏎ proc requestAnimationFrame(w: Window; function: proc (time: float)): int dom96: hm, not sure. I use it like this in my game library in case the example helps you figure out the problem: https://github.com/dom96/gamelight/blob/master/gamelight/graphics.nim#L495 dom96: good night covidian: gn jorjun_twitter: merci Araq: Yardanico: found the problem Araq: Yardanico: https://github.com/nim-lang/Nim/issues/14207 your bug Technisha Circuit: Is there an easy way to call NodeJS and Python in Nim? Technisha Circuit: For Python i can use Nimpy Technisha Circuit: But how about NodeJS? Araq: you can compile to JS and import libraries from NodeJS Technisha Circuit: But then i wouldn't be able to call Python, would i? codic: not in the same file, no Technisha Circuit: :/ Technisha Circuit: I just want to be able to use multiple languages that i like in one file so i can make them interact with eachother Technisha Circuit: I could use websockets but i don't want to mess with websockets rn Rika: isnt websockets for uh Rika: the web leorize: technically you can make it work, it just that you wouldn't want to Technisha Circuit: > isnt websockets for uh Technisha Circuit: You can get websockets to work with other stuff codic: websockets can be used for sharing data between programs Rika: also i realized you changed your name from technicae to technisha Rika: i mean yeah Technisha Circuit: Hahaha Rika: but is that a good idea codic: although, for the case of *Linux* specifically, dbus is a much better way Technisha Circuit: What's dbus? 😅 codic: and windows and mac probs have similar things codic: Data-Bus Rika: raw sockets 😛 codic: it allows programs to interface with each other by sharing data Technisha Circuit: > but is that a good idea Technisha Circuit: No, but I'm stupid so :P Technisha Circuit: Oh? So how would i do it for NodeJS, Nim and Python? codic: Yup, windows has an IPC mechanism called COM leorize: dbus is a "simple" specification for an ipc system :p codic: and macos has distributed notification codic: yeah haha Rika: is dbus easy to use codic: don't know, never used it KingDarBoja: sigh Rika: i might just use that for a plugin system lol codic: @KingDarBoja what? Technisha Circuit: Hm codic: It's linux only though leorize: dbus is so easy to use it's author put a warning that you should never use it in the C api :) Rika: oh lord leorize: dbus is cross platform actually codic: anyways https://github.com/zielmicha/nim-dbus codic: Yeah but it requires ports Technisha Circuit: Oh? Why should you not use it in the C API? codic: it's not natively available on every windows and mac system covidian: bash likes dbus LOL codic: XD Technisha Circuit: I wonder why i am so stupid 🤦 codic: hmmm.... Technisha Circuit: So what would be the best way for me to share data between the three langs? codic: Hold on leorize: Technisha Circuit: it's not about three langs codic: codic: https://cdn.discordapp.com/attachments/371759389889003532/706632972748587159/unknown.png leorize: it's about how you have three runtimes :) Technisha Circuit: Wdym? leorize: nim <-> python is easy, because python has a C interface that we can hook into Rika: what RPC protocol do yall recommend then, if not dbus? leorize: find one for js and you're set leorize: Rika: depends on what you're doing covidian: eschew JS! Rika: i dont know what it depends on covidian: espouse nim! leorize: well, why do you need an ipc system? codic: websockets codic: 😂 😂 😂 codic: best ipc system leorize: and what can access this system? codic: if you're asking me, any language supporting websockes leorize: I'm asking Rika :P codic: ah Rika: well i can always use the `plugin` package, but i dont have confidence in it leorize: use the plugin package Rika: i want to be able to withstand someone suddenly removing the plugin's dll Rika: and not crash in that case leorize: doesn't the plugin package support that? leorize: I mean, that's the whole point of a plugin system? Rika: im not sure leorize: if you worry about someone removing the dll at runtime then don't worry, once a file is opened it will stay alive until all handles to it are gone Araq: don't write plugin systems before you have something to plug into Technisha Circuit: NodeJS has a C api Technisha Circuit: But I can't find a lib to let me interact with it Rika: araq, what do you mean? Araq: don't write plugin systems if you can avoid it. by construction they make code impossible to follow Rika: okay Araq: but worse than that, they encourage you to worry about the wrong things. first get your app running, then optimize the user experience and only then offer your users a plugin ecosystem. Araq: and keep in mind that most of us don't enjoy hunting for adblockers as plugins KingDarBoja: Can I use a OV kind as type? Araq: we're happier when the browser simply ships with a good one by default... Araq: same with editors, editors are better when they ship with syntax highlighting etc out of the box instead of making me hunt for extensions that then don't work Rika: i'm more of thinking "how do i make this bot run 24/7 with at least some of its functionality all the time" or so Rika: aka i want to make sure i dont lose all service because i was swapping out one of the services Araq: so use a load balancer Rika: ill think about that Araq: „As always: depends on the use case. Araq: We're using Erlang as the primary language environment for our IoT product for a lot of reasons but one big one is: Hot code loading and a very robust release upgrade environment with a lot of control over the process (including restarting everything inside the VM if that's what we wish to do). Araq: For our product, a digital light switch / dimmer, high uptime guarantees is a very important requirement and Erlang has it all plus many other wonderful features.“ Araq: er ... is that a joke? jorjun_twitter: So all this stuff in the jsffi module should be generic typed, then. Think it is holding me back. jorjun_twitter: proc `+=` *(x, y: JsObject): JsObject {.importcpp: "(# += #)", discardable.} ⏎ proc `-=` *(x, y: JsObject): JsObject {.importcpp: "(# -= #)", discardable.} ⏎ proc `*=` *(x, y: JsObject): JsObject {.importcpp: "(# *= #)", discardable.} jorjun_twitter: better go bed codic: i have a quick question, if I have this code `import json; echo %*["O"][0]`, why is O printed literally in quotes (`"O"` instead of `O`)? Araq: because json.`$` returns the JSON stuff in its ascii representation Araq: and echo uses `$` codic: ah, so how can I not have the quotes? codic: modify echo? Prestige: Is there a way to have nullable culongs? I'm wanting a value to be nil by default for a type I'm creating codic: or should I make a different function `jsonecho` haha dayl1ght: I'm debugging nim code using lldb. Is it possible to run nim expressions in lldb? Araq: Prestige: use the Option[T] type Prestige: Thanks! Araq: codic: you should understand the json api leorize: dayl1ght: we don't have lldb support yet Araq: dal1ght: no, you need to use C syntax, unfortunately dayl1ght: ah 😐 is there any trick to print nim arrays? Araq: nim arrays are just C arrays dayl1ght: oops I mean seq codic: araq: ah, where can i find the docs? Just the nim ones? codic: so https://nim-lang.org/docs/json.html Araq: yeah Rika: look for how strings are stored in JsonNodes Araq: you're looking for .getStr codic: Oh great there's also getInt getBiggestInt GetFloat getBool etc codic: *getFloat Rika: look at the type def not the procs Rika: (though the procs are recommended) Rika: @codic why not just use getStr Rika: also why is it called getStr and not getString? codic: I am gonna use getStr codic: I was looking at the others in case I wanted the other types Rika: i see codic: Aw `echo %*["O"][0].getStr` fails codic: type mismatch leorize: !eval import json; echo `%`(["0"][0].getStr) NimBot: Compile failed: /usercode/in.nim(1, 31) Error: type mismatch: got leorize: !eval import json; echo `%`(["0"][0]).getStr NimBot: 0 leorize: it's due to operator precedence codic: ahhhh codic: okay, thanks! shashlick: Oh - some interest in the plugin system Yardanico: metaprogramming be like https://i.imgur.com/y7F7jeB.png Yardanico: and yes I took this print macro from nimpylib XD KingDarBoja: https://github.com/nim-lang/Nim/wiki/Nim-for-Java-programmers disruptek: ot disruptek: er, there's nothing inherently wrong with discarding a future. alehander92: but there is alehander92: it seems that an error can just stay hidden alehander92: which seems as a bad thing alehander92: maybe i am wrong, but if that's wrong, then we need to fix the "Futures should *never* be discarded." docs disruptek: unless they MUST never be discarded, i'm okay with it. disruptek: should we also deny except:? alehander92: well, never makes it sounds like it should've been alehander92: must never alehander92: the problem is that i can easily imagine cases where you discard an async call and this leads to annoying non-obvious bug alehander92: and i cant imagine situation where you're like "oh no i need to discard this future" disruptek: i guess i have a vivid imagination. alehander92: ok, give such a case alehander92: i am just trying to understand it, sorry disruptek: i like to think that i'm god when it comes to software. unless i'm going to break the laws of physics, the machine should kowtow to me -- not the other way around. disruptek: if i chose to type `discard` in front of a future, damnit what do you think i want to do with it? alehander92: but many users would just discard asyncCall() as the first obvious way alehander92: to run in background Rika: @exelotl ok so after reading a bit of the article you sent, i have a question; how would i ensure that what objects i allocate on the heap are adjacent to each other? alehander92: thats just bad language design disruptek: i'm going to give them all your cell-phone number so you can tutor them. disruptek: isn't that what you want? alehander92: to make the easiest thing a buggy thing disruptek: a better user-experience? alehander92: i want less bugs disruptek: discard should be introduced later in the manual. that's a patch i'd support. alehander92: language design is not about "order in manuals" Rika: then we'd have a lot of random people asking how to have an empty block disruptek: it's not introduced in that context. alehander92: its about less "surprises which woudlnt be surprises if you read manual #2.7" disruptek: better would be to really explain what it is. alehander92: dont we have enough with tax laws disruptek: i think your argument might make sense for some languages, but not nim. exelotl: if you have a seq of ref objects, where each one is allocated individually with new(), then you have no guarantee where each object will end up in memory alehander92: i dont want bugs in my programs in any language alehander92: its as simple as that disruptek: then don't program. exelotl: but if you have a seq of non-ref objects, then those objects are guaranteed to be contiguous Never Listen To Beef: Damn it disruptek, stealing my jokes Rika: but non-ref are stackk alehander92: the other option is to make discard asyncCall() actually do what asyncCheck does Rika: ? exelotl: not if they're in a seq Never Listen To Beef: Was going to say "Cant have any bugs in your programs if you dont make any" alehander92: but to just swallow errors Rika: well i never mentioned a seq disruptek: if i cannot discard a future, i cannot use async. disruptek: that's just nuts. alehander92: you cant philosophy your way out of it Rika: okay, how would i make ref objects be contiguous with each other disruptek: use memory regions or perform your own alloc. Rika: memory regions? alehander92: i dont care about the discard, i care about the "raise error from it if it fails" part disruptek: --gc:regions Rika: if i perform my own alloc then am i really using nim at this point disruptek: asyncCheck is terrible. i never use it and i cannot imagine why it exists. exelotl: if it's a worthwhile optimisation then sure rika alehander92: ok, i am stupid alehander92: so, what should happen alehander92: when you do discard a() disruptek: having related data nearby in memory is almost always an optimization. Rika: okay, ill just keep that in mind; i fear that i am totally doing premature optim. right now alehander92: and a completes with fail disruptek: make it work, make it correct, make it fast. Rika: disruptek: the thing is whether it is worthwhile or not disruptek: if it's not worthwhile, don't even bother to make it work. alehander92: disruptek stop with the slogans disruptek: that's how i hack on the compiler. alehander92: this isnt a socialist demonstration alehander92: even if its 1 may alehander92: :D KingDarBoja: Who said socialism? alehander92: this really doesnt answer a question KingDarBoja: ☭ disruptek: you haven't asked one worthy of answer. alehander92: and you can always do alehander92: let ignorename = future alehander92: here alehander92: you have it, discard workaround disruptek: uh, no. alehander92: so this is bad alehander92: but *ignoring* errors on purpose alehander92: is fine disruptek: that's why we have discard. disruptek: because programmers know better than us sometimes. alehander92: discard is for ignoring *values* disruptek: dude. disruptek: read the code. alehander92: dude, you can still ignore an error if you want exelotl: throwback to the time I saw discard in a shader and assumed it was the same as discard in nim Never Listen To Beef: lol Never Listen To Beef: It sorta is, you say you dont want that pixel 😛 alehander92: the problem is that i've seen that in node alehander92: writing several random background calls, never seeing any actual error, random stuff breaks alehander92: its just super annoying bugs alehander92: you cant discard an exception in sync code alehander92: if you could, then ok disruptek: sure you can. Rika: try: code except: discard Rika: ???? disruptek: nailed it. alehander92: and .. you use .. except Rika: with that code you've essentially discarded an exception alehander92: totally the same code disruptek: uh, no. alehander92: that's exactly what i am saying alehander92: make it raise alehander92: then yeah, use try except Never Listen To Beef: ``` Never Listen To Beef: a Never Listen To Beef: defer: discard Never Listen To Beef: ``` alehander92: somehow KingDarBoja: From past disruptek: _basically, it's a nice feature and discard discards it. keep it and use it instead._ disruptek: but it's fine. i know araq agrees with me. 😁 Rika: @Never Listen To Beef what's that supposed t odo KingDarBoja: Still no idea what he meant hahaha alehander92: but araq agreeing with you doesnt make it correct Never Listen To Beef: i mean that'd put all the stuff inside a try block then discard the finally disruptek: i'm saying that i'm not terribly motivated to convince you. Never Listen To Beef: I mean it's silly cause it's silly Rika: @Never Listen To Beef it wouldnt catch the exception Never Listen To Beef: Doesnt he want to discard the exception? Rika: thats what he said disruptek: i want to discard /futures/ Rika: oh, you mean disruptek Rika: well i dont understand why you want to but eh i might just not know Never Listen To Beef: I mean i dont either Never Listen To Beef: Exceptions exist to help you alehander92: which you can Never Listen To Beef: Although the xlib library stuff i dont catch any of the errors directly alehander92: ok disruptek alehander92: you need to then solve for me disruptek: unlikely. alehander92: how can i detect if "background" async calls alehander92: in my codebase alehander92: written from other random people alehander92: dont error alehander92: detect on runtime* disruptek: how do you detect any runtime error? alehander92: by seeing the exception alehander92: or crash disruptek: well, do that. alehander92: or *explicitly* handling it in try except alehander92: but i *cant* do that alehander92: if somebody just goes discard a() disruptek: a future is not an exception. alehander92: but an async call can be disruptek: show me your problematic code. alehander92: every code that does discard aCall() disruptek: oh, i see. we should break discard for just this one library in stdlib. disruptek: that's your position? disruptek: because someone /could/ write something that has an unexpected effect. disruptek: because they didn't read the manual. alehander92: every time you write discard asyncCall() # you just say "go silent errors" alehander92: the language doesnt work that way alehander92: it doesnt happen when you call sync calls alehander92: when you await normal calls disruptek: if you don't understand it after your work on await, i don't think i can explain it to you. alehander92: oh, i understand it disruptek: but, look. we don't /have/ to agree. alehander92: but does one need to be an expert in async alehander92: or to have been bitten 5 times by it? disruptek: they do if they cannot discard a future, i guess. alehander92: ok, lets differentiate alehander92: i am ok with discarding a future variable alehander92: i dont want to discard an async call disruptek: dude, i am trying to invent a new try/except. i really don't want to argue with you. alehander92: if it was possible to make the difference somehow alehander92: i would be ok with it Rika: disruptek: do you think its a stupid idea to introduce a `new` proc that can be passed a count to initialize x ref objects of that type contiguously? alehander92: well if you dont want to, dont block useful additions disruptek: there's no point to argue because it won't be changed. leorize: Rika: newSeqWith? disruptek: i'm not blocking anything. alehander92: ok, sorry for the wrong way to word it Rika: leorize: ? Rika: hm? alehander92: probably we still kinda misunderstand each other disruptek: discarding an async call... that's another story. disruptek: discarding a future... this is something else. leorize: Rika: `newSeqWith` seems to be what you're looking for :P alehander92: i agree, sorry, i should've separated them early alehander92: but is there a way to detect that on compile time? disruptek: you could have a macro that detects it. alehander92: maybe term rewriting macros can Rika: leorize: i dont see how alehander92: but i am very unfamiliar with them Rika: does it guarantee that the objects are near each other in memory? disruptek: yes. disruptek: the refs, anyway. disruptek: not their values. Rika: i mean their values disruptek: use value types if you want values? disruptek: value types are better. Rika: that'd be a bit difficult Rika: ill think about it more leorize: if you want object next to each other, use a seq of values? leorize: don't copy C's broken semantics Never Listen To Beef: You say value types are better but my OOP brain says, suuuuure 😄 KingDarBoja: You mean object variants? 😄 KingDarBoja: Btw, what's the recommended way of documenting a type, right after the type Rika = enum line? leorize: when I first pick up programming I avoided OOP at all costs :P KingDarBoja: Or between type and MyHumbleType (separated lines) leorize: one indent, then a doc comment KingDarBoja: Okie Dokie 🙂 KingDarBoja: `type MyHumble = enum` KingDarBoja: ` ## My docstirng` exelotl: Pick two: by-reference semantics, contiguity, resizable container KingDarBoja: ` north, west, etc..` KingDarBoja: Like that? leorize: yea KingDarBoja: 😗 exelotl: by which I mean, you can have a seq of values and take pointers to those values, but all the pointers will become invalid if the sequence is ever reallocated Rika: i dont think i need resizing Rika: man this is a headache leorize: what are you trying to do? leorize: maybe I can figure out a way leorize: are you by any chance attempting object pooling? Never Listen To Beef: I am sorta interested on how you guys would design a system where Screens have positions, sizes, Workspaces and a selected workspace, and those workspaces have windows, and a selected window Never Listen To Beef: *I feel like you guys wouldnt use ref objects* 😄 alehander92: disruptek sorry again alehander92: and thanks for the direction, i think i found a way disruptek: we're cool, dude. alehander92: to adapt this guy's macro disruptek: you could use the effect system. alehander92: no https://github.com/nim-lang/Nim/issues/11912 disbot: ➥ Add undiscardable pragma and forbid Futures from being discarded alehander92: it seems it works Rika: i think i know what to do now alehander92: sorry https://github.com/nim-lang/Nim/issues/11912#issuecomment-622645281 disbot: ➥ Add undiscardable pragma and forbid Futures from being discarded Rika: `object`s in a seq act like a `ref object` no? alehander92: yeah it seems this sould be an ok version alehander92: do we have a way to say "dont rewrite that more" leorize: Rika: no, they don't have ref semantics leorize: you can "refer" to them via indices though disruptek: alehander92: the best solution is to not add the code in the first place. Rika: leorize: i misphrased Rika: ill just do whatever and see if i get issues alehander92: disruptek its like public safety alehander92: sometimes its ok to forbid people entering the hazard zone alehander92: otherwise i am ok with giving `ignoreErrors a()` instead of discard alehander92: so at least one can grep alehander92: (which one can still do now just by using try/empty except around await and run that in the background) alehander92: and this way we dont break one such "law" of physics: exceptions travel up to an except clause alehander92: not to an except clause or one case of discard disruptek: discarding a future isn't an exception. alehander92: yes, i am not talking about this alehander92: i am talking about discard asyncCall() disruptek: what's the difference? alehander92: it is that now suddenly my exception alehander92: never gets to an except clause alehander92: because it is .. discarded ?? alehander92: it doesnt make sense alehander92: it breaks the laws of physics disruptek: what exception? disruptek: i'm talking about futures. alehander92: the one somewhere inside asyncCall children disruptek: y'know, the value you want to discard. alehander92: i agreed with you for futures alehander92: i changed the title of my issue disruptek: what do your async procs return? alehander92: futures disruptek: okay? alehander92: so then alehander92: discard asyncCall() should register an error callback. disruptek: what's the error? alehander92: possibly an exception raised inside disruptek: so what? alehander92: so your whole argument is that discard should not be broken for one case alehander92: and my whole argument is that i also want raise to not be broken for one case disruptek: it shouldn't be broken at all. alehander92: i want my raise alehander92: to raise leorize[m]: what is this discard argument? disruptek: raise isn't broken. alehander92: and the exception to travel until an except alehander92: not until a discard disruptek: it does. leorize[m]: can someone fill me in on this? alehander92: it does not disruptek: not really, it's silly. alehander92: i do asyncCall() = .. raise disruptek: #11912 disbot: https://github.com/nim-lang/Nim/issues/11912 -- 3Add undiscardable pragma and forbid Futures from being discarded (EDIT: only async calls maybe) alehander92: discard asyncCall() # bam no error alehander92: no except: alehander92: still no error alehander92: broken law disruptek: you just don't understand async. alehander92: so, explain it to me disruptek: it's okay; i'm pretty sure dom doesn't understand it, either. alehander92: this is bullshit alehander92: with all my love for ya disruptek: it's a closure. if you don't iterate over it, it doesn't run. if it does except, it stores the exception in the future. disruptek: you can query it if you want, or don't. disruptek: you can raise it in sync code, or not. disruptek: ima go play video games. maybe leorize can convince you. alehander92: i know well the code which is generated disruptek: i need to learn PoE for work. disruptek: gotta get those exalts. alehander92: but this doesnt address my concerns at all alehander92: you still have silent bugs disruptek: i'm okay with that. alehander92: and raise still works unexpectedly alehander92: and it shoudln't have anything to do with "its a closure" imho disruptek: there are lots of fair criticisms to be made of async. alehander92: closures dont know of "Futures" alehander92: this is not a property of closures alehander92: the whole "stores exception" thing is just an asyncmacro invention alehander92: and my problem is alehander92: i can see how let a = asyncCall() # ignore errors but maybe later do something about them somehow alehander92: can be useful alehander92: but discard asyncCall() just doesnt serve any useful purpose in my mind, it's just "lets not write let ignored = so people can suffer by silent bugs" alehander92: but maybe i am too emotional about it, sorry again, have a great night :D KingDarBoja: Rika, Yard? Rika: hi Rika: @KingDarBoja wat bung87: how to do seq equals? Rika: ==? bung87: hmm, my bad , there's one item not equals. KingDarBoja: Rika, I am back, sorry 😄 KingDarBoja: Was going to ask if it is possible to create methods at runtime bedwardly-down: @Never Listen To Beef , so i spent part of the day learning how parsing works and some of the weird basic stuff that’s actually pretty intuitive Rika: @KingDarBoja but? KingDarBoja: Just that, 🙂 KingDarBoja: I swear I need another monitor KingDarBoja: Can't look at multiple windows, only two max and it is still small Rika: you cannot KingDarBoja: Ah, okay KingDarBoja: Right now comparison 3 different implementations of same module KingDarBoja: The original in JS, the Python one and GO one, this last one seems intuitive as it is strong typed Rika: go will be easiest to port i assume KingDarBoja: But it is the longest one lol skrylar[m]: Go is cute. I didn't mind writing some of it KingDarBoja: https://github.com/graphql-go/graphql/blob/master/language/visitor/visitor.go KingDarBoja: Source implementation in JS -> https://github.com/graphql/graphql-js/blob/master/src/language/visitor.js KingDarBoja: I feel like it is a mess hahaha skrylar[m]: when i tried to look up how graphql worked what i found was that apparently its just the whole query string jammed in a GET request o.O KingDarBoja: Oh yeah KingDarBoja: It is KingDarBoja: The parser and lexer works, just need to get the rest of stuff done skrylar[m]: should probably experiment with it some time; never actually got around to using it for anything. :X KingDarBoja: And ofc use object variants skrylar[m]: was thinking of toying around with beeflang but the ide is required for some hcr stuff, and the ide doesn't work on linux, so rip. KingDarBoja: It is awesome as it will give u better error responses and type safety KingDarBoja: Did you saw the visitor on JS? KingDarBoja: They using Flow with JS, I really hope the Typescript migration happens on the short term KingDarBoja: x.x skrylar[m]: whats wrong with flow skrylar[m]: i gave typescript a light poke and was not impressed waiting 5 seconds for hello world to 'build' KingDarBoja: They had to rely on workarounds for some type definitions KingDarBoja: Remember that TS does Type checking and transpile into JS KingDarBoja: So everything will take a bit to transpile into JS then execute skrylar[m]: yeah so does nim and v KingDarBoja: You're right skrylar[m]: i still need to check what the opengl module is doing because when i imported it my import stack exploded and my builds went from 1s to 5-7s ... which is weird because it SHOULD just be a pile of innocent getproc's KingDarBoja: Anyway, I will try to port that module, seems messy lol skrylar[m]: it looks pretty gnarly which is weird for a visitor KingDarBoja: gnarly? KingDarBoja: Also, what you guys recommend for exporting proc / vars on a module KingDarBoja: use `*` or declare at top level using export ? skrylar[m]: it looks like a hot mess to me; i'm used to seeing visitors just like. switch on a type and then call accept_foo to recurse skrylar[m]: pretty sure `export` has to do with making it C accessible and `*` is about making it public in the module to other nim code leorize[m]: @KingDarBoja: export at top level is not designed for exporting proc inside your module KingDarBoja: Ah ok KingDarBoja: Thanks KingDarBoja: skylar: at some part (the visit function) seems to do that but very messy KingDarBoja: Also, do you know Go right? I think you mentioned that few comments ago skrylar[m]: i dunno enough about what they are doing. i've just seen very clean visitors in Pharo/Squeak and i write them the same way they did elsewhere. it might be more clogged looking because they have to do some extra reflecting or something :shrug: skrylar[m]: closures in nim are very nice and its pretty easy to do sax style visitors with a struct of them and then just call those. bedwardly-down: How noobish are you? Day 2 here KingDarBoja: 1 month I think skrylar[m]: https://github.com/Skrylar/skcbor/blob/master/skcbor.nim#L66 =p KingDarBoja: 2 months to be honest KingDarBoja: Ahhhh bedwardly-down: Nothing wrong with that if you're willing to learn and improve bedwardly-down: 😄 KingDarBoja: Skrylar: pretty clever approach KingDarBoja: I am worried about the visit function as it returns `Any` on JS-base implementation KingDarBoja: Python does the same and Golang defines interface{} KingDarBoja: Which I have no idea what that means on GO lol skrylar[m]: `interface{}` is basically `void*` Rika: so nim's `pointer` xd bedwardly-down: Is that the same as Void in most languages where it returns nothing and cannot be returned? Rika: no skrylar[m]: no the star makes it a pointer bedwardly-down: Most languages like Java or Haxe Rika: it is the same as "literally any data type" KingDarBoja: Wait calm down Rika: and "good luck figuring out what this type is" bedwardly-down: I missed the pointer comment. I was refering to Void skrylar[m]: go interfaces have automatic membership and `interface{}` is an interface with no required method, thus every struct is a valid member skrylar[m]: although go still type checks casting from `interface{}` so there is some safety and runtime overhead KingDarBoja: JS -> Any , Python -> Any (it is just a type hint), Go -> interface{}, Nim -> ? Rika: `pointer` KingDarBoja: Ok skrylar[m]: not quite bedwardly-down: How do you guys find time to understand as many languages as you do and then apply them in this context? Rika: its the closest thing skrylar[m]: i think we do have an "any" module but its a little screwy skrylar[m]: nim's equivalent would be ref rootobj Rika: just dont use it, convert it into a proper static typing system KingDarBoja: I do know Python and TS skrylar[m]: because if you put something in a pointer it doesn't inform the gc what you did KingDarBoja: Rika: yup KingDarBoja: So anything like skrylar shared KingDarBoja: right? I mean -> https://github.com/Skrylar/skcbor/blob/master/skcbor.nim#L66 skrylar[m]: this problem is why that skcbor module has a box type skrylar[m]: but nims equivalent to `interface{}` is `ref RootObj` KingDarBoja: So the idea should be KingDarBoja: Use the kind (object variants) and call a proc per kind leorize[m]: skrylar[m]: Nim do have typesafe conversion between ref object types skrylar[m]: unrelatedly should probably bother someone that `after_code_reload:` causes segfaults on windows in devel leorize: can you file an issue? KingDarBoja: I like the Golang impl organization of the AST lol skrylar[m]: go and v are cute. KingDarBoja: https://github.com/graphql-go/graphql/blob/master/language/ast/node.go KingDarBoja: I assume this is equivalent to the object variants skrylar[m]: are you just parsing graphql? KingDarBoja: By parsing what u mean? KingDarBoja: Porting? leorize: parsing leorize: like read the language and understand it kind of thing :P KingDarBoja: Yes KingDarBoja: It does silvernode: good morning KingDarBoja: Or not sure if you mean reading the spec and doing that skrylar[m]: if you're just trying to get a nim program to read graphql queries you're probably better off looking at references for parsing in static languages (like npeg or mratsim's thing) than trying to copy how dynamic languages do it KingDarBoja: That's why I started to look at Go KingDarBoja: But the source implementation was done in JS so that's why it gets harder to understand things and how stuff got implemented skrylar[m]: yea parsing used to be my nemesis leorize: if you write a parser, lexbase is an excellent base KingDarBoja: It's not only a parser 😛 silvernode: Can anyone explain what scenario I might want to use a reference object? Still trying to make my grid map for my game and someone here recommened making a position type that takes a reference to the grid type but I am not really sure how to approach this or why I would want to. KingDarBoja: But been able to overcome some stuff and learn Nim on the way KingDarBoja: Thanks to you guys ofc leorize: silvernode: you use a ref object when you need the reference semantics skrylar[m]: well when it comes to ASTs they are purely there for the convenience of a program trying to understand stuff; there is often no point in trying to be exactly close to another AST leorize: silvernode: the "I want this to reference the same thing when I 'copy' it" and not "I want to optimize" skrylar[m]: @silvernode references are pointers but garbage collected silvernode: hmm, this all sort of makes sense to me but I'll be honest, I am still trying to comprehend the concept of pointers/refs. leorize: there's the low level and the high level aspect of them leorize: let me see if I can still find this documentation Zevv wrote silvernode: leorize: thanks KingDarBoja: skrylar: https://graphql.org/code/ look at all the current graphql implementation languages leorize: silvernode: http://zevv.nl/nim-memory/ silvernode: leorize: hopefully this will help me understand, thank you :) leorize: I don't think I remember how I understood pointers, but I think what I did was that I played a lot with them KingDarBoja: That's a neat doc KingDarBoja: Bookmarked leorize: ~memory leorize: disbot? KingDarBoja: Rip leorize: disruptek: your bot is dead again leorize: playing with pointers seem to be the way. I've just read some of the materials I used back when I step in programming and none of them fully explain the concept skrylar[m]: beef has some interesting memory operators skrylar[m]: mostly around letting you muck with custom mallocs for certain purposes skrylar[m]: but they are explicitly gc-less so they can get away with more silly things easier leorize: Rika: we do actually have a way to allocate a block of GC-ed memory leorize: not that I recommend it Rika: which is leorize: unsafeNew leorize: but note that this is for allocating a block leorize: not for "a bunch of refs side by side" leorize: what would be a sane default for a process spawning interface? leorize: what do people use the most? bung87: `execCmdEx` seems good bung87: it return exitcode and stdout , quite common use case. Never Listen To Beef: If i see another person talk about the beef programming language i think i have to change my name KingDarBoja: Beeeef KingDarBoja: I can't belive it is actually a language KingDarBoja: With a beef logo lol Rika: ref seqs are identical to seqs in memory? Rika: cool Rika: ah nvm, zev's article is outdated? leorize: not that outdated leorize: actually it's super up to date regarding old runtime Rika: hmm, i think its just how nim's repr prints seqs now Rika: i dont think repr for seqs show that its from a ptr anymore? leorize: !eval echo repr @[ 0x30, 0x40, 0x50 ] NimBot: [email protected][48, 64, 80]↵ disruptek: ~memory disbot: no footnotes for `memory`. 🙁 disruptek: when was that ever a thing? leorize: I was checking to see if it's free Rika: so why doesnt nim show that seqs are pointers tho leorize: ~memory: The Nim memory model: https://zevv.nl/nim-memory/ Rika: in repr disbot: no footnotes for `memory:`. 🙁 leorize: ~memory The Nim memory model: https://zevv.nl/nim-memory/ disbot: no footnotes for `memory`. 🙁 Rika: its memory is leorize: ~memory is The Nim memory model: https://zevv.nl/nim-memory/ disbot: memory: 11The Nim memory model: https://zevv.nl/nim-memory/ leorize: thanks :P dawkot: Is VSCode Nim extension popular? dawkot: Seems pretty inactive on github Yardanico: well it's ok Yardanico: I think it's still the most popular choice for nim Never Listen To Beef: Use gary's branch for nicer syntax highlighting Never Listen To Beef: https://marketplace.visualstudio.com/items?itemName=garym.nim-alt Yardanico: well syntax highlighting isn't the main issue with it Never Listen To Beef: Sure, well i didnt say it was, just saying it has better syntax highlighting 😄 KingDarBoja: Installing rightnow KingDarBoja: Done, seems ok KingDarBoja: good night bung87: how to do async test? Benumbed: Can anyone spot what I'm doing wrong here? https://play.nim-lang.org/#ix=2kqM as far as I undersood, default params are fine in templates... Rika: @Benumbed `(ref exceptn)(class: class, meth: meth, code: code, msg: message)` becomes `(ref exceptn)(0: 0, 0: 0, 0: 0, msg: message)` Rika: rename the variables to something ele Rika: else* Benumbed: oh my god I feel quite stupid, thanks @Rika Benumbed: I should go to bed I think lol voltist: It seemed only fitting that my website, made with Nim, should use the Dracula theme: https://liamsc.com/ Prestige: voltist: bad gateway voltist: Prestige: Seems fine to me Prestige: huh weird Prestige: https://0x0.st/i2qs.png solitudesf: 502 for me too Araq: Yardanico: your bug is killing me... :P Araq: ah no Araq: found it Araq: lol Zed: is it faster to return a new object or edit the object passed into a proc as a variable? Zed: is it bad practice to edit the parameter rather then returning a new object? Araq: a good rule is that inplace mutation is fine if there is only a single owner Araq: and in general inplace mutation is faster unless the optimizer can remove the spurious copies but it's hard to tell without seeing any code bung87: edit param is programming like c way, that depends, on the other hand programming like functional, just get input and put output, logical simple Araq: in general optimizers in 2020 are still disappointing unless you're into heavy number crunching code Araq: IME anyway, ymmv Araq: on the other hand just today I fixed Nim's move optimizer to be less aggressive dom96: good afternoon Prestige: o/ bung87: optimizer? is it about compiler? Araq: bung87: yes. Nim does optimize too, not only the C step, but you can't disable it dom96: Why are we still arguing about disallowing `discard`? Zed: thanks Araq! Araq: dom96, we aren't, the discussion is over :P bung87: oh,I have no idea about compiler optimizer, I just know react and parcel's optimization dom96: Araq, so your problem is with how it's implemented dom96: I don't really care how, do you at least agree that discarding futures should be disallowed? dom96: The bottom line is, either we disallow it or we make `asyncCheck` implicit Araq: I don't agree that it should be disallowed Araq: not anymore. dom96: I'm pretty sure the latter was tried and it caused bugs Araq: it would only introduce a subtle case where 'let _ = f()' is not the same as 'discard f()' anymore dom96: This is an obvious source of bugs dom96: no, and that should be disallowed as well. Araq: I don't agree, today I can write 'discard posix_api_call()' and it's a code smell too dom96: but really if someone tries `discard future` and they see "Do not use this in async procs, it's a stupid thing to do" dom96: then if they work around it then it's their own stupid fault bung87: discard async proc will make it like js behavior? dom96: how is someone meant to know that discarding futures is bad without that message? Araq: it's all their own stupid fault to begin with Araq: it's like "'cast' needs more hand holding from the compiler", no it doesn't need that, it's a dangerous sharp weapon. dom96: Okay, it's a fair argument to correlate it to discarding posix API return values (which can indicate errors) Araq: having said that, can we improve the tooling in other ways? how about we add future leak detection at runtime. or "warn me for blocking calls" at runtime dom96: I think in the end we may need to be pragmatic here. The compiler's current error messages are not good enough. dom96: https://play.nim-lang.org/#ix=2kse dom96: Error: expression 'foo()' is of type 'Future[system.void]' and has to be discarded dom96: The compiler leads the user in the wrong path Araq: aha dom96: Implying the use of `discard` Araq: 'and has to be *used* ' dom96: ideally we should mention `asyncCheck` Araq: that's acceptable, library specific error messages / filters should be a thing zedeus: +1 for a pragma to specify custom "dont discard" message as the reason can vary Araq: but in the general case replacing 'discarded' with 'used' would be a nice improvement dom96: sure, seems like a quick and easy fix zedeus: 'discarded' serves as a hint to new users that may not be very familiar with the discard keyword Araq: zedeus, yeah that was the idea but for async is counter productive advice zedeus: yeah I agree, it's a pretty ironic error message :) dom96: I updated #11912 to reflect what we discussed dom96: disbot down? zedeus: can anything be done for cases where async is used, but the return value is optional and rarely used? example is Redis where for most commands 0 or 1 is returned, and you very rarely need it. {.discardable.} doesn't work since that would apply to the future. I'd like to avoid `discard await ..` everywhere, gets hairy quickly zedeus: I guess it's less of a problem now with await being a template dom96: how does `await` being a template affect this? zedeus: you could make a `dawait` template that just does `discard await` dom96: yeah, that's a problem, because you want the result of future.read to be discardable not the result of the async call zedeus: yep dom96: which we have no way to model, and likely won't :/ dom96: zedeus, please don't do that :( Araq: zedeus, do that, it's cool :-) zedeus: I might.. it almost kept me from using redis because 10 lines of `discard await` isn't nice to read zedeus: oh you're gonna love this one. for my chat bot I made a `safeAsync` proc that's basically `asyncCheck` but it ignores exceptions :) dom96: yeah.. have fun with that dom96: hopefully by "ignores" you mean it at least logs them zedeus: sure. the problem with asyncCheck exceptions is it crashes the program with nothing to catch them zacharyc1rter: is it possible to do `amd64.macosx.gcc.linkerexe` in a nims file? or on a nim.cfg file? zacharyc1rter: can I just use - `switch("amd64.macosx.gcc.linkerexe", "clang++")` ? dom96: zedeus, yep, the intention is actually to allow people to create their own `asyncCheck` variants dom96: we should probably add some common ones, I for example have one in my game that uses the logging module to log the exceptions zedeus: that would be great, asyncCheck is useful as a way to say "go do that elsewhere", but also often useless because of the exceptions dom96: btw you could have defined a dawait before await became a template, you just need to use `yield` in the template Araq: zacharyc1rter, I think so, yes, try it Araq: 'dawait', come on, it's awesome. it almost sounds like a real word zacharyc1rter: Araq: I think I'm doing something wrong anyway as I'm trying to get clang++ to link my program but whether I use nim.cfg or config.nims it doesn't work Araq: use 'nim cpp --cc:clang' zacharyc1rter: well I'm compiling with clang but I want to link with clang++ zacharyc1rter: since I have an objectfile that was comiled with C++ zacharyc1rter: compiled* zacharyc1rter: I'm not sure it even matters because things seem to work even when I just link with clang zacharyc1rter: but I thought it would... Araq: had the same problem with DrNim and my solution was 'nim cpp' zacharyc1rter: unfortunatley that breaks nimterop and what I"m using that for :/ zacharyc1rter: I guess I could compile that code separately and link it Araq: you can also link with C++'s stdlib, somehow zacharyc1rter: oh yeah I'm doing that already `--passL:-lc++` Araq: well then you should be fine zacharyc1rter: ah okay - thanks bedwardly-down: Tbf, dawait sounds very catchy and rolls well off the tongue. It also describes how async can feel, since you have “the wait” until it hits bedwardly-down: I like puns in code i read Araq: 1 showstopper bug left :-) zacharyc1rter: \o/ disruptek: the bot isn't stable on orc/arc. 🙁 bedwardly-down: Nice. Morning all. O7 Araq: disruptek, fixed an important bug zacharyc1rter: morning disruptek: cool, i will try new builds. Araq: wait until I merged my PR bedwardly-down: Got a link? Disruptek was a pleasant host yesterday during his stream dom96: Araq, you asked me a while ago about which Nimble to bundle with the new release disruptek: i saw you fixed the cyclic error. dom96: never replied to my questions, which version are you releasing? Araq: disruptek, it was not just a cycle error, it was a 'sink' parameter bug Araq: dom96, read the top of koch.nim disruptek: oh wow. Araq: but we already updated it disruptek: that's kinda critical. Araq: disruptek, I know :-) dom96: you're bundling a non-released Nimble commit? Araq: dom96, in devel dom96: okay, what about the release, that was what your question was about AFAIK Araq: not in an official release Araq: well make a Nimble release please for us Araq: gah, it's raining again. :-( Araq: anyhow the real question I wanted to ask if we should ship the new cycle collector in 1.2.2 dom96: sure, why not? Araq: dom96, because some might say it's a new feature dom96: so release 1.4.0? dom96: or 1.3.0 or however the versioning works these days disruptek: if you don't cut a new minor then other software cannot easily /require/ your new feature. disruptek: that's the point. Araq: dom96, it would be 1.4.0 indeed and the versioning works as it always worked disruptek: "my async code leaks", "what ver?", "1.3", "use >=1.4.0 and --gc:orc", "ah, cool, thanks" dom96: https://github.com/nim-lang/nimble/releases/tag/v0.11.2 Araq: disruptek, *shrug* what about it, we never said --gc:arc is production ready for async. we're working hard to make it production ready disruptek: costs us nothing to use fresh integers; there are plenty left. dom96: Araq, be sure to include that Nimble 0.11.2 in the new release. Araq: what's new in Nimble 0.11.2? Araq: never mind, I was blind mratsim: I'm really interested in your plans to make closures gc-safe so that we can pass them through channels. bedwardly-down: I love the changelog. It's slim enough that it's easy to parse and understand but detailed enough that I can decide whether or not to upgrade since it's such a minor release. \o/ Araq: mratsim: with orc we have a new tool 'proc isIsolated[T: ref|closure](x: T): bool' available. isolated subgraphs can be transferred to a different thread safely Araq: that's the plan. dom96: bedwardly-down: thanks, glad someone appreciates my changelogs :) zedeus: it would be real nice if you could do a new jester release disruptek: zacharyc1rter: anyone can make new rooms on the mumble server so they have low-latency voice chat on their stream. disruptek: i disruptek: i'm happy to see it get used by the community. zacharyc1rter: that's awesome thanks mannnnn zacharyc1rter: I will do that today when I start streaming disruptek: cool. zedeus: what are you going to do on stream? zacharyc1rter: continue working on game engine dev from yesterday - still trying to figure out why the f this code works in one project and not in this new one zacharyc1rter: I don't want to bore users with this debugging zedeus: ah cool disruptek: it's not that easy, is it? zacharyc1rter: streaming? disruptek: yeah. bedwardly-down: dom96, are you the core maintainer of nimble? I appreciate the TAB cycling approach for going through its interactive options. Not many devs have that down. zacharyc1rter: yeah it's a task for sure dom96: bedwardly-down: I'm the one that originally created it, nowadays I have very little time to maintain it, but I do what I can. That particular feature was contributes by our community :) dom96: *contributed bedwardly-down: Zachary, if you're streaming, I'd be interested in seeing some debugging stuff. Debugging is very much where I struggle in all languages I dabble in zacharyc1rter: disruptek: I think I need to be an admin to create channels zacharyc1rter: could you create one for me? zacharyc1rter: bedwardly-down: wish granted - I'm about to start my stream dawkot: Is there a way to make compiler check if a method has been overloaded on all subclasses? disruptek: yeah, i was hoping you'd figure it out for me. 🤣 zacharyc1rter: lol zacharyc1rter: https://www.twitch.tv/zachary_carter bedwardly-down: I'm there. Zach bedwardly-down: @Zachary Carter https://gettc.xyz/ that's pleasantly easy to setup on Linux bedwardly-down: It's a straight Appimage. Just make sure you close out the stream preview or else you'll get audio feedback shashlick: @zacharycarter why is nimterop breaking zacharyc1rter: it only is when I'm using C++ zacharyc1rter: or at least it was in previous versions shashlick: Any details you can share? Am curious zacharyc1rter: I can put up an example later today zacharyc1rter: with sokol shashlick: Ok thanks zacharyc1rter: np! Araq: any love for type (Node, NodeKind) = ref object ? Araq: see https://github.com/nim-lang/RFCs/issues/219 for the context disbot: ➥ Object variant kind field type inference ; snippet at 12https://play.nim-lang.org/#ix=2ksV disruptek: thanks, i hate it. dom96: no, if you want to improve it then go all the way and add some syntax inspired by sum types in other langs dom96: maybe we can come up with something that feels like idiomatic Nim disruptek: one field two branches is the more important feature. companion_cube: sum types ♥ Araq: dom96, we can also simply add patty to the stdlib dom96: disruptek, +1 Araq: but it's worth exploring how to change today's syntax Araq: type Araq: T = case kind Araq: of intVal: x: int Araq: meh Araq: the ref vs non-ref distinction alone indicates the old syntax is good dom96: heh, nice, we're actually mentioned in https://en.wikipedia.org/wiki/Tagged_union#2000s dom96: Maybe we should copy Haxe's syntax: https://play.nim-lang.org/#ix=2ksZ companion_cube: it's a bit cheating because nim doesn't check for invalid field access :> dom96: in fact, I really like that syntax Araq: companion_cube, it does check, use warn[ProveField]:on bedwardly-down: Amen to that, dom96. There are things that drive me nuts about Haxe and its development at times, but the syntax is spot on, at least to me bedwardly-down: That's part of why I love using it as my main companion_cube: ok, but why is it opt in?! Araq: companion_cube, because a day only has 24 hours bedwardly-down: dom, `/usercode/in.nim(3, 12) Error: identifier expected, but got '('` dom96: The English language should have a word for "because a day only has 24 hours" bedwardly-down: that's what running it as C gets me in the link dom96: Many things are not so because they simply haven't been implemented yet disruptek: ~features disbot: features: 11begin in the unfortunate state of /unimplemented/ -- disruptek dom96: bedwardly-down: it's a syntax proposal, of course it doesn't work companion_cube: but in this case it's implemented, right? dom96: companion_cube, presumably it needs refining and testing dom96: Araq, what do you think about that syntax? Araq: it's implemented but probably needs more refinement if we enable it for everybody zedeus: dom96: that syntax is pretty much what patty does, it's great. I think it doesn't support multiple branch values (of a, b: ...) and it makes it more strict since you can't have other shared fields in the object Araq: dom96, as I said, how to make the 'ref object' vs object distinction with your syntax? dom96: hm dom96: `ref enum` :P Araq: Swift uses 'indirect enum' fwiw Araq: 'ref enum' could work though dom96: what does the `indirect` imply? disruptek: i don't want to define both at once. Araq: dom96, that it's a 'ref' ;-) disruptek: i personally won't use the inference, either. i like that it's explicit, unambiguous. bedwardly-down: Gotya, dom. 😓 dom96: Araq, yeah, meh, I prefer `ref` dom96: but I suppose the point is that Swift also has this additional keyword dom96: using `ref` for us would be nicely consistent Araq: indeed, looks lovely dom96: on the other hand, it would put the Nim philosophy of "Small core and macros" in the coffin :P dom96: We have a macro for this, why don't we use it? dom96: Language features are more official and therefore are easier to adopt Araq: true but maybe it's time to grow up and accept that Nim is more about what is practical rather than theoretically perfect dom96: yep disruptek: what a lame argument. Araq: and we don't do type system extensions via macros Araq: we never did that, it's too hard to let the macro writers do it Araq: type systems are beasts disruptek: i'm doing it in my persistence project. disruptek: and disruptek: !repo nesm disbot: https://github.com/xomachine/NESM -- 9NESM: 11NESM stands for Nim's Easy Serialization Macro. The macro that allowing generation of serialization functions by one line of code! (It is a mirror of https://gitlab.com/xomachine/NESM) 15 40⭐ 2🍴 disruptek: technically, that's not a type extension. Araq: exactly Araq: but you're right, the big problem is how to do serialization of sum types in a composable manner disruptek: write it as a macro. disruptek: prove that it cannot be done correctly. 😉 dom96: that's not a problem Araq: dom96, it is dom96: what does "in a composable manner" mean? Araq: I know code that uses .push fieldChecks: off in order to accomplish it Araq: dom96, it means you can construct via 'obj.kind = X; obj.field = value' Araq: instead of 'obj = Constr(field: value)' dom96: hrm zedeus: json's `to` can do it Araq: zedeus, it can do it because Nim's case objects allow for it Araq: we need to be careful that the new, superior way can also do it... dom96: json's `to` would be able to do it if you allowed expressions in these Constructor nodes zedeus: hm, msgpack4nim can't do it so I'm a little confused dom96: but json's `to` doesn't really scale well dom96: but yeah, this does pose a problem Araq: dom96, I cannot easily allow it if we're after more static checking dom96: My thrift deserializer uses fieldPairs so it also suffers from this disruptek: i'm all for improvements, but this isn't a priority right now and the community could make more progress with an RFC until the priority increases. Araq: disruptek, indeed. bbl dom96: true bedwardly-down: Nimble init does something goofy when a project directory has a '-' in it. It creates a subdirectory with the root directory's name but replaces '-' with '_' disruptek: imports cannot contain '-' bedwardly-down: Example: `nimble-echo` becomes `nimble-echo/nimble_echo` bedwardly-down: Gotya disruptek: s/imports/identifiers/ bedwardly-down: Substitute? bedwardly-down: And in the global config I'm guessing? bedwardly-down: Solved the issue by just passing it as an argument when initting Zed: has anybody had any trouble using nim with emacs? Zed: I cant seem to get indentation working properly zedeus: hey other Zed, yeah I'm using nim with emacs, you're probably missing the nimsuggest settings dom96: bedwardly-down: you shouldn't force the naming, you will need to use underscores silvernode: So I got a Raspberry Pi 4 and tried a Nim nightly version. I think 1.3.0, but it complained about my nimble file that works fine on earlier versions. Not a big deal, just wanted to share my experience. I can load it up again if someone wants the error. zedeus: @Zed: http://ix.io/2kta Zed: hey other zed :), i downloaded nim-mode from melpa, is it not included? Vindaar: @Zed: I'm using NIm with emacs without nimsuggest. Aside from a couple of cases where indentation is messed up it works well dom96: silvernode, yes please Vindaar: @zedeus: does nimsuggest work well with emacs nowadays? zedeus: yes, sometimes, sort of Zed: ok you know whats creepy silvernode: dom96: Oh ok, I should have it going in a few minutes here then. Will report back. Zed: other zeds home directory is the same as mine dom96: silvernode, please report such things on the issue tracker, I might not always be here to ask for details :) Zed: are you my fbi agent? zedeus: seeing a Zed here made me feel the same way, man silvernode: dom96: I suspected the problem was just a known change between versions or something Zed: lol, it's good to meet you, i have never met anybody else called zed before zedeus: yeah, we're a rare breed bedwardly-down: Maybe you two are twins from different parents? 😄 bedwardly-down: Or even clones? 😮 Zed: lol maybe zedeus: what are you working on? Zed: i am trying to build a ray tracer with nim and and set up bloody spacemacs to work with nim properly. Zed: you? dom96: when I see the name Zed I think of Zed Shaw. You're not that Zed right? :) zedeus: oh cool. my main project is nitter.net but I'm working on a syncplay/cytube replacement (90% done), that supports mpv and a web client Zed: no Zed: i cna change my name if you want? Zed: what is nitter.net? zedeus: https://github.com/zedeus/nitter zedeus: afaik the most popular Nim project besides the compiler Zed: damn that's impressive Zed: looks really clean as well!! zedeus: thanks :) i'll be back later, food is calling Zed: haha, sleep is calling me zacharyc1rter: shashlick: nimterop isn't working for me with sokol anymore, the latest version zacharyc1rter: I saw all of the overrides that get generated and passed to toast, but I"m running into an error that one of the overridden types is undeclared zacharyc1rter: will post an example later Zed: hey @vindarr how have you got emacs setup? Vindaar: @Zed: pretty much close to default (regarding nim specific settings that is). Added a couple of minor modes, but other than that using just normal `nim-mode` and having set the `nimsuggest-path` to `""` via `M-x customize-variable` Vindaar: mostly rely on helm functionality to find stuff tbh Vindaar: my emacs settings are here: https://github.com/Vindaar/emacs.d/ ⏎ But probably rather check out @kaushalmodi's settings: https://github.com/kaushalmodi/.emacs.d dom96: zedeus, got any nitter usage numbers you're willing to share? :) Zed: awesome thanks, ill test them out and see what works shashlick: @zacharycarter sounds good, will fix once we have some detail bedwardly-down: I'm live at https://www.twitch.tv/bedwardly_down . I'm not really a streamer, but I'm trying to get back into it. shashlick: @zacharycarter latest version of nimterop or sokol zacharyc1rter: shashlick both shashlick: Head? shashlick: Of nimterop zacharyc1rter: whatever nimble installs shashlick: Ok that's old shashlick: Then it sounds like a sokol change that's breaking shashlick: But 0.5.0 is coming very soon zedeus: dom96: sure, according to nginx, since the 12th of april there has been 400k unique visitors, 36m requests dom96: zedeus, any DAU/MAU numbers? Broadwell: I'm trying to write unit tests for my macros, and it seems that I cannot (1) run unittest at compile time or (2) manipulate NimNodes at runtime. Are there any tools to facilitate this? zedeus: dom96: about 15k daily Recruit_main707: https://play.nim-lang.org/#ix=2ktM is that go code the same as the nim one? (both in there) zedeus: maybe. depends on what "Unique visitors per day" means dom96: zedeus, I guess you don't have Google analytics on it? zedeus: indeed zedeus: and ofc that doesn't include usage stats from the other 10 instances, I know some of them also get a nice amount of traffic disruptek: broadwell: run your ct tests in a static: in your unittest file or w/e. bedwardly-down: How types and variables of those types work with nim is definitely not something I've seen before. I'm going to have to stew on them a bit bedwardly-down: Not terrible but definitely different to me zacharyc1rter: hmm - so I'm importing a module in my host app and my plugin and now I get errors about a class being implemented in both places disruptek: nodecl? zacharyc1rter: well the module being imported is using nimterop zacharyc1rter: actually I'm importing a module that's importing a module that uses nimterop zacharyc1rter: in the plugin zacharyc1rter: I tried using `import except` but that doesn't solve the problem either zacharyc1rter: but yeah maybe I can just redefine the type with nodecl shashlick: any details? zacharyc1rter: I have a single nimterop module that creates bindings for `sokol_app.h` and `sokol_gfx.h` zacharyc1rter: I used one module because I need to compile the implementations for these header files - which are in the header files shashlick: are both pulling in the same header zacharyc1rter: so in the nimterop module i use `cCompile` and I have a `.m` file which includes those two header files and defines some preprocessor directives like `#define SOKOL_IMPL` so that the implementations are included when I compile the header files zacharyc1rter: I included both APIs in a single nimterop module, because I only want to define `SOKOL_IMPL` once and breaking them up into two nim modules seems to break everything zacharyc1rter: here let me commit and I can point you to the relevant files zacharyc1rter: https://github.com/zacharycarter/frag/blob/master/lib/sokol.nim shashlick: but what's the actual error zacharyc1rter: the way I have it now I don't get an error from nimterop zacharyc1rter: the problem is when I import a module in my plugin code that imports this module which uses nimterop zacharyc1rter: I get an error about the same class being implemented twice zacharyc1rter: I'd break the nimterop module into two modules and only import the one I need - except them the nimterop module fails to compile shashlick: output zacharyc1rter: one sec I need to redo splitting it zacharyc1rter: will take a moment shashlick: no problem zacharyc1rter: I think it was user error - I wasn't defining one of the preprocessor directives in both source files and I needed to - now it's compiling shashlick: okay cool zacharyc1rter: thanks for offering to help shashlick: you're still using v0.4.4 right? not [email protected]#master zacharyc1rter: 0.4.3 I think zacharyc1rter: I'll try with master later today shashlick: okay big release coming soon zacharyc1rter: and report any issues I encounter shashlick: need to publish the changelog zacharyc1rter: okay I'll just wait for that :) federico3: https://github.com/nim-lang/Nim/wiki/BuildServices updated Broadwell: disruptek: https://play.nim-lang.org/#ix=2kuP Vindaar: shashlick: just tried out nimterop for the first time. Have to say I'm *very* impressed! disruptek: broadwell: you cannot use unittest for it; just write your tests differently. you can also check a result value at runtime after storing it in a const, etc. zacharyc1rter: first example works with hot reloading now - https://github.com/zacharycarter/frag/blob/master/examples/00-minimal/minimal.nim - on osx anyway KingDarBoja: Hi guys Weaponized Lego: Hey guys. I'm s little curious about nim, i wanted to pick up a novelty language as i haven't really had the need to pick up a second one as JavaScript and node.js pretty much solves all my problems right now. Weaponized Lego: Weaponized Lego: What are some ideas / problems where nim can be applied? I prefer to work on issues presented and work from there rather than video tutorials. clyybber: just work an what you want. I for example use it for gamedev clyybber: its a general purpose language though, so you should be able to use it for pretty much everything clyybber: from webdev to embedded Weaponized Lego: I'll start with data manipulation then, I have a few CSV files I need to process KingDarBoja: Welcome Zoiberg! KingDarBoja: And yeah, pretty much you can use it for whatever you want KingDarBoja: Someone said it was the lego language as you can build powerful stuff using macros and all that KingDarBoja: Arrghh I lost the example of nested object kinds, anyone can share it? KingDarBoja: Nvm I think I got it planetis[m]: Imo, case object syntax is fine as is. Biggest nuisance is not being able to define same object field for different branches. Can this ever be fixed? leorize: currently it's fixable with a macro, as long as you different branches share the same type for that field leorize: there were proposed syntax but I think no one was bothered enough to actually work on it planetis[m]: Does patty implements it? planetis[m]: Or any other macro zedeus: patty does not, but you can use the intended names with `match` zacharyc1rter: stream is back online - https://www.twitch.tv/zachary_carter Varriount: @Zachary Carter Are you on Mumble? Varriount: Or zacharyc1rter KingDarBoja: https://github.com/nim-lang/RFCs/issues/19 KingDarBoja: leorize: too bad you have to use the same type on the same field for different branches :/ planetis[m]: Oh my god, idont care about the syntax i want that 🥺 inv2004: Hello, is it possible to point nimble requires to local directory ? Never Listen To Beef: Why would you want to? zedeus: run `nimble develop` in the directory then add the package name to your .nimble mratsim: inv2004: export NIMBLE_DIR=path/to/local/nimbledir mratsim: ah sorry misunderstood, do as zedeus said inv2004: `nimble develop` in package directory I am going to require ? zedeus: yes leorize[m]: KingDarBoja: it's a reasonable limitation leorize[m]: same field of the same type with different type per branch is a nightmare KingDarBoja: Still I like the suggestion of 4raq of shared fields, which seems to fit my need leorize: no strongly typed language have return type overloading for a good reason KingDarBoja: Getting used to the strong typing, I like it Never Listen To Beef: IIRC dont you come from python? Never Listen To Beef: That's strongly typed 😛 KingDarBoja: I come from Python lol KingDarBoja: I do TypeScript but ain't the same at all Never Listen To Beef: I come from C# so i have the type system down, the big issue i have is C# is a heavy OOP language and nim is certainly not KingDarBoja: right Never Listen To Beef: *that and compile time vs runtime* KingDarBoja: TS is more like C# KingDarBoja: But ofc has the JS things Never Listen To Beef: Yea i know what TS is, not that i've ever touched it KingDarBoja: That's why they said "Composition oevr Inheritance" KingDarBoja: Just saying 🙂 leorize: I come from pascal, which has a lot of concepts in common with Nim leorize: I'd say that makes Nim really easy to pick up for me Never Listen To Beef: I tend to write nim code like i would in C# then realize that C#'s OOP has more features so then have to reevaluate KingDarBoja: Yeah, if you go OOP in Nim, you need to be careful with child types Yardanico: well nim OOP has it's advantages too Yardanico: like multimethods Never Listen To Beef: I mean my biggest gripe is runtime interfaces, since im used to having runtime mutable things leorize: multimethods is deprecated Never Listen To Beef: Yea but it's foreign to me inv2004: next question: the requires from nimble tries to compile the develop package, but cannot find .h header KingDarBoja: I hate casting everytime I need to get a property of a child type as the code on cimpile time will thell me it doesn't exist inv2004: Locally everything is ok in the package KingDarBoja: But I know it does but it is using the base type leorize: casting? you means converting, right? :P KingDarBoja: Not really `cast` but doing `childType(myVarW)` leorize: yea KingDarBoja: 😛 Yardanico: well that's very different from "casting" Never Listen To Beef: Coming from C# you're wrong 😛 leorize: the C family of language bundles all kind of conversion into one thing leorize: iirc only C++ have different operators for different kinds of conversions KingDarBoja: As `myVarW` is truly `childType` butbeing recognized as the base type due to proc call Never Listen To Beef: Yea idk why you get a compiletime error, i know my ECS converted components to their true type seemlessly Yardanico: Araq: thanks, with #14159 fixed nimes works with sink inference on, although nimes for some reason generally doesn't perform that well with arc (it's like 2-3x slower than with default gc) Yardanico: although 70% of the time is still spent in __strstr_sse2 from libc KingDarBoja: @Never Listen To Beef too lazy to explain now leorize: note that Nim's proc use static binding, so "seamless" conversion isn't a thing here KingDarBoja: Pretty much what leorize said KingDarBoja: Doing the object variant conversion now mratsim: you are supposed to use methods on inherited stuff Yardanico: oh seems like strstr is called by isObj Yardanico: hmm maybe it due to nimes using inheritance for different mappers, lemme try without them leorize: shashlick: #14180 is merged :) Yardanico: lol wtf Yardanico: I was right Yardanico: after removing inheritance for mappers it now performs like 3x better (same as with default gc) 7815: if i'd want to statically link with sdl2, what do i do? leorize: what sdl2 wrapper are you using? 7815: the "standard one" leorize: nim-lang/sdl2? 7815: the one that comes with `nimble install sdl2` leorize: then --dynlibOverride:SDL --passL:"" 7815: very thanks Yardanico: Araq: sorry for pinging again, so is it expected that --gc:arc performs much slower with ref objects with inheritance than default GC? in nimes it's a hot path since for PPU and for some CPU addresses it has to call a [] method for Mapper (so for one of its inherited objects) Yardanico: a lot of time is spent in strstr (which is called from isObj) with that Yardanico: without inheritance it performs just as well as in the default gc (I don't have specific benchmarks, but 5fps vs 30 fps can be noticed by a naked eye :D) Yardanico: although I guess it won't be hard to fully remove inheritance for mappers from nimes Never Listen To Beef: Well leorize my components were just data holder so i was accessing the properties on child not using procs on them KingDarBoja: Hey guys, how I can call a type which is going to be declared later on the object variant? Yardanico: wdym "call a type"? Yardanico: well you can have recursive dependencies in types if you declare them in the same type block KingDarBoja: I am using the same type block KingDarBoja: But hold on leorize: Yardanico: I think it's kinda unexpected. reading refs_v2 it seems that it's expected that the performance will be the same Yardanico: leorize: well yeah I was initially suprised too, literally 69% of the time was spent in __strstr_sse2 from libc KingDarBoja: https://imgur.com/VprFPUu Yardanico: in C there are lines like "if (!((m) && (isObj((*m).Sup.m_type, "|nimes.mapper3.Mapper3:ObjectType|nimes.types.Mapper:ObjectType"" Yardanico: and isObj does T1_ = strstr((*obj).name, subclass); leorize: turns out pointer tracing is still faster than substring search :P Yardanico: @KingDarBoja then you'll have to declare these types separately Yardanico: you couldn't do what you showed in a screenshot Yardanico: can't* KingDarBoja: Ugh leorize: KingDarBoja: you can't enforce which variant goes where leorize: at least you can't do that in the type system KingDarBoja: So I must declare them separately before using KingDarBoja: On a separate object variant type leorize: your type system is creepily complex Yardanico: leorize: it's a port from JS afaik Yardanico: of graphql KingDarBoja: ye KingDarBoja: It works with OOP as I mentioned KingDarBoja: Just seeing if I can replace the OOP approach with the object variants leorize: well your system is just too complex leorize: simplify it to the barebones leorize: conversion from inheritance to variants requires rethinking some of the approach leorize: don't be overspecific, be "just specific enough" Rika: its really hard for me to convert inheritance to variants Yardanico: just think in the nim way :P KingDarBoja: How is the Nim way? leorize: yea, you don't "convert" Rika: it'd be easier with the "same field same type" thing for 2 different variants KingDarBoja: I am once again requesting your help 😄 leorize: I can help with that Rika: like, much easier for me KingDarBoja: Hold on leorize: "same field same type" thing KingDarBoja: https://github.com/graphql/graphql-js/blob/master/src/language/ast.js#L135 scroll down and see what I can't see Rika: leorize: see only "Individual" and "Overall" Rika: https://cdn.discordapp.com/attachments/371759389889003532/706247061271740487/unknown.png KingDarBoja: So far I made it with OOP but the drawback is that my proc calls are using the base type for some of them Yardanico: @KingDarBoja I'm not saying it's easy, but do you really think that if Nim's own AST can be constructed with object variants, graphql's AST can't? :) Rika: `column` and `column count` are intentionally (meant to be) different KingDarBoja: Wdym Yard? KingDarBoja: I mean, it can be, just probably lacking the thinking leorize: Rika: yea I have an idea Rika: other than renaming the two fields? ;; Rika: maybe ill just take the "rename the two fields" or smth leorize: Rika: use genSym to generate a field that can't be accessed normally, then generate an accessor template that yield it for the fields you'd like Rika: oh yeah, macros exist Rika: what a big brain Rika: forgive me for i am a brainlet leorize: I've seen no one actually attempted that path though Rika: ill prolly even just do it manually... Araq: accessor templates are totally a thing 7815: can you even link sdl2 statically? i'm getting tons of `__declspec(dllimport)` errors leorize: yes you can leorize: how did you link and what's the full output? Araq: you can also just ship software that consists of more than a single file though Araq: static linking is the new cargo cult 7815: `--dynlibOverride:SDL2 --passL:-lSDL2` 7815: libSDL2 is in my directory 7815: `--dynlibOverride:SDL2 --passL:-lSDL2` 7815: libSDL2 is in my cwd Araq: number of software I use daily consisting of a single file: 0 7815: `--dynlibOverride:SDL2 --passL:-lSDL2` 7815: libSDL2.a is in my cwd 7815: araq, i don't think you forcing your ideals on others is a helpful trait for anybody Araq: I'm saving your time Araq: and that's helpful for anybody 7815: dependencies are certainly fun to deal with Araq: copy sdl.dll next to your .exe, done. 7815: https://hastebin.com/eyinoxurex.shell inv2004: zedeus, Do you know what to do with C-header from develop package ? Rika: how do i make a fail on compile time? Yardanico: {.error.} Rika: okay thanks Yardanico: !eval {.error: "no".} NimBot: Compile failed: /usercode/in.nim(1, 8) Error: no Yardanico: @7815 well if you cross-compile for windows you should have a static version of SDL2 for windows Yardanico: also you need to pass --os:windows 7815: it links correctly with my zig project Yardanico: well nim is not zig Yardanico: you should also tell nim that you're compiling to windows Yardanico: and in the paste you only tell zig to compile to windows, and nim still thinks you're compiling for linux 7815: `--os:windows` doesn't stop it from compiling `src\timer\windows\SDL_*.c` 7815: `--os:windows` doesn't give `src\timer\windows\SDL_*.c` its necessary link symbols... Yardanico: Araq: would you like a relatively short code example for inheritance where --gc:arc is ~5x slower? Araq: Yardanico, ok inv2004: how to include imported c-header into package? Yardanico: Araq: https://gist.github.com/Yardanico/61384b0fe3a7913eb231cc0c9d3b996a Yardanico: the slowest part there is ppu.mapper.step() Yardanico: (for arc) Yardanico: although it's not so high priority since I think it can be reworked to avoid methods Araq: any idea why it's 5x slower? Yardanico: Araq: because it calls isObj for each step call Yardanico: and isObj calls strstr Yardanico: inv2004: it should work by default, is your header in the src folder too? Yardanico: Araq: https://i.imgur.com/MdMqIki.png there shashlick: @Vindaar: glad to hear shashlick: what were you wrapping shashlick: and which version of nimterop Yardanico: and full c src https://gist.github.com/Yardanico/6173219bfd29544087d055650e13388d inv2004: @Yardanico, yep, here it is https://github.com/inv2004/kdb_nim inv2004: I just removed bin in nimble if it matters Araq: Yardanico, 'won't fix'? :P Yardanico: Araq: well I'm really not sure if that's intended behaviour or not :D Araq: but hmm my suspicion was that isObj is fast enough in practice Araq: strstr vs pointer chasing Yardanico: well nimes is using methods in an a bit surprising way Yardanico: for each PPU step or some CPU step it calls a method of a mapper (NES roms can have different mappers) Araq: though the old implementation also was tuned to remember the hot path Yardanico: oh Araq: maybe it's time to embrace VTables KingDarBoja: leorize, u around? Yardanico: inv2004: read https://forum.nim-lang.org/t/2668 Rika: man this new template thing idea works SWELL Yardanico: https://forum.nim-lang.org/t/2668#22111 inv2004: @Yardanico, thx Yardanico: also you don't have to do importc, header for every proc Yardanico: you can just do {.push importc, header: "yourheader.h".} Yardanico: importc by default uses the same nim proc name for the relevant C function mratsim: Before embracing VTables I want private imports. Yardanico: :P mratsim: Having proc public just for testing is so so annoying when refactoring Araq: so write an include file for testing Araq: "I need X to be public for testing" is so far among my top ten of the least convincing issues ever brought up mratsim: As I said, include hides generic bugs mratsim: This bug is caught with import but not with include: https://github.com/nim-lang/Nim/issues/6387 Vindaar: @shashlick: I wanted to call a function from the GNU scientific library and thought nimterop might make that easier. It certainly did. Vindaar: https://github.com/Vindaar/gsl-nim Vindaar: I'll turn that into a full wrapper when I have a better idea on how to properly use nimterop. Rika: ??? Rika: https://cdn.discordapp.com/attachments/371759389889003532/706256845517619212/unknown.png Rika: oops Rika: it says "expected float" Yardanico: show errors from the nim compiler itself :) Yardanico: when compiling mratsim: template + return is a recipe for bugs Yardanico: ah you're in a template Rika: Rika: https://cdn.discordapp.com/attachments/371759389889003532/706257064120418334/unknown.png mratsim: you should use a proc, otherwise you will return from the caller Yardanico: you can't call return in templates Rika: i know Yardanico: it'll be inserted as-is to the original proc Rika: but im unsure why it wouldnt give me the Duration w/o return Rika: which is odd Yardanico: you should remove "return" statements from the template Yardanico: then it might work Rika: it just "expects a discard mratsim: remove the "return" and replace discard by `@[]` Rika: Rika: https://cdn.discordapp.com/attachments/371759389889003532/706257388843565107/unknown.png Rika: hmm Rika: seems good Rika: ill runtime error the discard instea Yardanico: you can compile-time error it mratsim: also template chaining via method call syntax is buggy because one of the template is not properly triggered Rika: compile time erroring it doesnt work i dont think mratsim: i.e. holdEndTimes.anyIt might give you undeclared identifier Rika: i tried it and it doesnt work Yardanico: what does it say? Rika: it just compile time errors no matter correct usage or not mratsim: are you writing a Stepmania clone? Rika: no Yardanico: @mratsim https://github.com/de-odex/circa Rika: i really havent committed in a while Rika: because i've been traumatized by git too much Yardanico: well I really see no issue with git even if you do spontaneous commits and stuff like that Yardanico: just commit at the end of the day lol Yardanico: it's still better than not commiting Rika: i dont know, im not a fan of not properly using it Yardanico: commits help you discover regressions and stuff Rika: if there were a good sourcetree equivalent on linux that isnt gitkraken Rika: i'd deffo fix it up right now Yardanico: i don't think it's really hard to use git from terminal for simple commits KingDarBoja: Having big brain time trying to figure out object variant simplification lol Yardanico: VSCode has GitLens too btw Rika: i can use TUI, not git TUI Rika: git subcommand names make 0 sense to me Yardanico: use vscode with gitlens plugin then Never Listen To Beef: I tend to use git cli and then use vscode's git tools to ensure im not pushing useless files cause it's a nice easy method imo Rika: will do, just installed Rika: does it have gitflow stuff? Rika: not that i cant do it myself KingDarBoja: Gitlens is awesome imo Araq: mratsim: I don't see the connection as the symbol binding rules within generics do not depend on private vs public exelotl: "git subcommand names make 0 sense to me" saaaame exelotl: been using git for like 7 years now and I still have to google how to do the most basic things Rika: struggle of a non-english native i guess? exelotl: nah I'm a native speaker Rika: :monkaHmm: exelotl: it's actually ridiculous how bad the interface is KingDarBoja: lol Araq: exelotl: but it's pretty simple, 'git checkout' does everything ;-) Araq: for a system created by a guy who cannot stand GCs or overloading git's commands are surprisingly overloaded and git also has a GC... Rika: i cant seem to stage a folder for some reason... Never Listen To Beef: I mean linus started git, he went pretty hands off rather quickly from my understanding Never Listen To Beef: No clue when the GC was implemented so my point is irrelevant yes leorize: to be fair, linus is not that against a gc leorize: the kernel have a gc itself leorize: KingDarBoja: you called? Araq: leorize, which kind of GC does the kernel have? Araq: so ... number of showstopper bugs: 0 :-) leorize: simple ref counting the last time I checked Araq: leorize, doesn't count Yardanico: Araq: new 1.2 release soon? :P leorize: 1.4 when? :P Araq: Yardanico, who knows. maybe we should make 'koch boot --gc:orc' work and release 1.4 supakeen: gc:orc supakeen: mrm supakeen: i like it KingDarBoja: Yeah, was going to ask something but I think I got it KingDarBoja: The idea of simplify stuff shashlick: @Vindaar: awesome - let me know when you need any help with nimterop shashlick: And feedback obviously to make it easier to get up to speed KingDarBoja: Instead of specifying the node kind on some child, I just put the base type Rika: haa, pushed to temp-all branch now KingDarBoja: `Node` and let the proc handle the leaf kind 🤔 Yardanico: in the meantime I guess I'll fork nimes and replace inheritance with something else + use computedGoto for CPU opcodes to possibly speed it up even more (right now it uses an array of procedures, I guess that's already quite fast) Araq: embrace computedGoto Yardanico: yeah it's a very cool optimization Vindaar: @shashlick: Thanks, will do! Yardanico: but why nim vm has it disabled? :P https://github.com/nim-lang/Nim/blob/devel/compiler/vm.nim#L543 leorize: Yardanico: have you reported the async bug with gc:orc for the irc module? Yardanico: leorize: it turns out it's a bug with sink inference Yardanico: not gc:arc or gc:orc themselves Yardanico: it works with --sinkInference:off leorize: so... did you report it? :P Yardanico: no, actually lemme try to run it again, who knows, maybe it was solved by #14183 Yardanico: btw what happened with disbot? :P Yardanico: it doesn't reference PRs now leorize: it bugs out once in awhile leorize: ping disruptek I guess Araq: disbot was built with --gc:arc, that's why :-) Yardanico: well it's async, doesn't it leak memory this way Yardanico: also yeah, irc module doesn't work in async mode with gc:orc, works with sink inference disabled Yardanico: although the error is different than before Araq: well we'll soon build it with orc leorize: guess you should report that bug now so we can tackle it Araq: Yardanico, produce a reduced test case please, it really speeds up our development Yardanico: well I'll try :P Yardanico: irc module itself is ~700 loc Araq: lol but async is a big lib Yardanico: ah xd Araq: anyhow, good night Yardanico: good night leorize: g'night leorize: why does fork() on linux have to be so ridiculously inefficient... Rika: huh, what does "expression has no address" mean now... leorize: that means you're trying to take an address of a const Rika: but im not? Rika: hm leorize: can I see the code? Rika: https://play.nim-lang.org/#ix=2kwB Rika: error at `case` Generic: that is an unfortunate short coming leorize: can I have the typedef too? Generic: https://github.com/nim-lang/Nim/issues/13033 leorize: though this is probably just due to the `var` thingy leorize: try result = leorize: should work Rika: https://play.nim-lang.org/#ix=2kwD Rika: bah, the result fixed it Rika: i see leorize: can you merge maniaIndividual and maniaOverall? leorize: the diff seems to be the column thingy only :P leorize: though I'm for certain don't understand how this code work or what it's used for leorize: why does this look like an osu! parser :P Rika: it is. KingDarBoja: 😄 KingDarBoja: From desperation comes innovation leorize: well I still don't understand osu! beatmaps so I can't say much about this code :P Rika: leorize: maniaIndividual and maniaOverall are totally separate Rika: this isnt parsing the beatmap its the difficulty calculation code Rika: im still having difficulty converting the heavy OOP of C# leorize: I don't know how the game work is the point actually :P Rika: i see Rika: i still dont know if this code will work Yardanico: ok I started minimizing it, now I managed to use expandMacros to get output of the async macro stuff Yardanico: and yes I managed to compile it after removing tons of `gensym things Yardanico: right now it's 600 lines but at least it only needs asyncdispatch for the dispatcher and asyncfutures for futures, now I need to start removing functionality :P Yardanico: compiled C is 6.4k lines though KingDarBoja: I am mixing OOP with object variants KingDarBoja: and so far, so good KingDarBoja: Using it to group leaf types KingDarBoja: And OOP to keep parent types inherit from a single base KingDarBoja: Also, I noticed I can't declared shared fields using multiple kinds on same case then another different for a specific field KingDarBoja: 🤔 Yardanico: https://github.com/nim-lang/RFCs/issues/19 KingDarBoja: Yeah I saw that KingDarBoja: https://github.com/nim-lang/RFCs/issues/19#issuecomment-173529871 this comment is what I am looking for KingDarBoja: But still RFC 😢 KingDarBoja: https://imgur.com/4met1K4 pretty much had to use a different name for that KingDarBoja: But after running the test, I will get an error as I am trying to access `value` on `IntValueNode` KingDarBoja: But the funny thing is that the terminal doesn't point me to the error :S bedwardly-down: Not even with —verbose flag on? KingDarBoja: Had no idea about that flag KingDarBoja: Let me try KingDarBoja: `nimble tests --verbose` ? bedwardly-down: Should be KingDarBoja: Nope bedwardly-down: I’m not able to test but nimble —verbose c *somenimfile* works for me bedwardly-down: That stinks. KingDarBoja: I have defined it like `exec "nim c -r tests/language/test_parser"` on my packageName.nimble file KingDarBoja: @bedwardly-down your approach works KingDarBoja: Thank you 🙂 KingDarBoja: `Error: undeclared field: 'strValue' for type ast.NameNode` this is what I was looking for bedwardly-down: Depending on what system you’re on, you could possibly create an alias for your shell where nim and nimble always run with that flag on when you call them KingDarBoja: I use Windows KingDarBoja: All my tests are defined at the .nimble file with the above script bedwardly-down: Using Powershell, you could possibly do the same. I’m just not sure on specifics there KingDarBoja: using `nimble test --verbose` works lol KingDarBoja: I had a typo bedwardly-down: Did you put 1 - instead of 2? KingDarBoja: It is 1 by default Rika: can i make an object variant based on a field of a field? i know the answer's pretty much no, but i'd like to know of alternatives bedwardly-down: For -v in most apps yeah Yardanico: ? bedwardly-down: @KingDarBoja Yardanico: "object variant based on a field of a field" the only way to know that is to embed the other object variant in your own object variant if I understood you correctly Yardanico: show code :P KingDarBoja: Wait KingDarBoja: Object variant based on a filed of a field ? Nested? Rika: one moment bedwardly-down: How deep can you even go with that anyway? KingDarBoja: Deeper as long as you don't need previous object variant kinds Rika: something like this? https://play.nim-lang.org/#ix=2kx0 Yardanico: yeah as I said the only way for that is to embed modeHitObject definition inside of your DifficultyHitObject Rika: but theyre separate objects Yardanico: then no Rika: okay codic: In nim, how would I write something like this c? `int test = *t;` codic: Wait no codic: i meant `int *t;` bung87: `ptr int` codic: Where's the `t` in that codic: Would it be `ptr int t`? codic: or `ptr t int`? codic: or `ptr t:int`? bung87: var a:ptr int = t codic: oh thank you! codic: So `var var1:ptr char = t` would be `char *t`? codic: Fail codic: Undeclared identifier exelotl: `var var1:ptr char = t` would be equivalent to `char *var1 = t` exelotl: however, what are you planning to use var1 for in this case? bung87: @codic you comming from c? codic: i am not, just trying to make a friend that loves c to use vim codic: I'm taking this https://www.tutorialspoint.com/cprogramming/c_pointers.htm bung87: you may need clearify your question , it's about type declaration or assignment? codic: not sure what ya mean, I don't know c, haha codic: I'm just trying to find the direct equivalent of `type *something` bung87: then it is `ptr type` codic: but where is the `something` codic: that's what I don't get codic: for example codic: let's take this codic: https://hastebin.com/wamayeporu.cs codic: I want to do something like that in nim codic: I get that &var is addr var codic: but I don't get what char *var is codic: yes the quotes are wrong lol bung87: `char *var` it's combine the type and variable declaration exelotl: well first off you don't want to name a var "var" in nim dawkot: https://i.imgur.com/afr6frt.png Rika: ```var `var`: ptr char```? dawkot: What did they mean by this exelotl: (unless you do what rika did) Rika: dawkot: theyre planning to target nim? codic: Wait, so `var thing: ptr char` == `char *thing`? dawkot: That's what it says Rika: codic, yes codic: great Rika: dawkot: i dont seem to understand what you dont understand dawkot: I'm just surprised codic: Nooooooo codic: "template/generic instantiation of `&` from here" codic: for `echo &"The address of the variable var1 is {var1.addr}" codic: ` Rika: import strformat Rika: oh codic: i did Rika: oh dawkot: I think you need to cast var1.addr to int Elegant Beef: isnt `&""` short form of `fmt""`? codic: ah Elegant Beef: is * Rika: @Elegant Beef not exactly codic: @Elegant Beef It isn't a raw string KingDarBoja: Not exactly codic: fmt is a raw string, & isn't KingDarBoja: fmt does not escape KingDarBoja: & does KingDarBoja: Yup Rika: try `var1.addr` -> `var1.addr.int` Rika: or something codic: that casts to int? Rika: then feel free to also add a `:h` too if you want codic: Arghhhhhhhhh. "got but expected int" dawkot: if it doesn't work than castint (va1.addr) dawkot: whoops Rika: `cast[int](var1.addr)` dawkot: `castint (var1.addr) dawkot: whew Rika: brackets dont seem to like you right now codic: finallyyy exelotl: @codic also I'd say, in Nim you do different things depending on what semantics you're going for. For example when wrapping a C API you'd normally use `cstring` instead of `ptr char` codic: true true codic: just an example KingDarBoja: How can I shortcircuit and assign? Rika: @codic ok, just realized something KingDarBoja: Like `let a = not someInstance.isNil and someIstance.someProp` ? exelotl: and if you have a pointer to some other type and you want to be able to index it (as in `myArray[5]`, you'd use `var myArray:ptr UncheckedArray[T]` instead of `var myArray: ptr T` Rika: you're getting the pointer of the pointer of the character codic: oh Rika: so if you want the first pointer, do `cast[int](var1)` codic: Ohh codic: wait what codic: now it's saying the address of the variable is 0 Rika: var1 is a `ptr char` no? Rika: really? huh codic: yes Rika: :thonk: codic: lemme put it in playground exelotl: wow that's a high quality thonk codic: import strformat codic: var var1: ptr char codic: echo &"The address of the variable var1 is {cast[int](var1)}" codic: https://play.nim-lang.org/#ix=2keL codic: there ya go codic: even the playground says 0 Rika: ah Rika: yeah Rika: its not initialized codic: what isnt? Rika: so it's currently `nil` Rika: the ptr char Rika: its nil right now codic: ah codic: so `var var1: ptr char = 'o'` codic: For it to be something? codic: nvm codic: That gives got char but expected ptr har codic: *char codic: Cant I just get the addr? bung87: you misunderstood declaration and initialization Rika: @codic https://play.nim-lang.org/#ix=2keM Rika: now the ptr has no char assigned to it (zeroed out char \0) but it has a pointer now Rika: this is not idiomatic by the way Rika: we dont use raw ptrs for just (nonffi) nim code codic: i know codic: thanks KingDarBoja: What about my question Rika? KingDarBoja: 😄 Rika: i missed it Rika: one moment Rika: i dont get what you're trying to do Rika: you're assigning a bool? KingDarBoja: No, a type Rika: huh? can you describe what you're trying to do exactly KingDarBoja: I know this is gonna sound annoying but Rika: dont worry Rika: ive dealt with a lot of annoying KingDarBoja: In python, you can check if a type exist and use `and` to perform short-circuit assignment KingDarBoja: In this case, if the loc prop is not nil, then assign the loc.startToken value to the variable KingDarBoja: But probably better use if-else uh? Rika: use an inline if else Rika: we're not python Rika: we're not dynamic KingDarBoja: Just curious, calm down mate :d Rika: im not mad im just sayin yo KingDarBoja: yo codic: how do I make the equal of a `char[length]` from c codic: Just char[length]? 🤔 Rika: what is char[length] Rika: please describe, since im not well versed in c codic: creates a char of length *length* Rika: a char array? codic: yes codic: which is basically what a C string (from string.h) is Rika: that would be var a = newSeq[char](length) Rika: if you need to interop with C, use a cstring codic: ah ok codic: yeah I know codic: this is just for a line by line port of some c Rika: ive done that once codic: haha codic: Okay, now I have `for (size_t i = 0; i < 20; i++)`. I'm not very sure on how nim for loops work but do know that size_t is csize_t. Any tips on how I could port that for? Rika: `for i in 0..<20` Rika: dont forget colon and indent instead of bracket codic: that uses ints though codic: yeah of course haha Rika: size_t is an int is it not Rika: `size_t is an unsigned integer type of at least 16 bit (see sections 7.17 and 7.18.3).` codic: oh is it, alright codic: not a c expert haha Rika: you only need to know a bit of c to know this but thats fine, c isnt a language id expect most people to know codic: true codic: Can I do ` var alphabet: ptr string = "abc";`? codic: Or will I have to do it another way Rika: you need to allocate the pointer first codic: Because I remember doing that with a char gave me a type mismatch codic: ah, how? Rika: same way i did before Rika: var alphabet: ptr string; alphabet = create string; alphabet[] = "abc" codic: ah Rika: a string is already internally a pointer though, so this is a double indirection codic: wdym Rika: internally a `string` is represented by a `ptr something` where something is the thing i do not know of LOL Rika: so by doing `ptr string` you are doing `ptr ptr something` Rika: double pointer; double indirection codic: oh skrylar[m]: strings are seqs of chars or somesth codic: Is it the same concept in c? KingDarBoja: https://imgur.com/QC5Wm9s ❤️ Rika-sensei codic: because I'm just porting the c code with no knowledge skrylar[m]: yes seqs are your usual stretchy buffer/vector codic: ? codic: no I'm talking about double indirection Rika: those are more suites that i have tests xd Rika: i dont like writing tests.... KingDarBoja: Bro, that's 2 suites for one module test KingDarBoja: And the second one is WIP KingDarBoja: Writing the missing ones right now 😄 KingDarBoja: But happy to see them passing as I port the tests Rika: yeah i have 0 tests because i have to write them myself (for my osu lib) codic: Hm. "Tabs are not allowed" but...but... I don't have tests Rika: @codic wdym? Rika: > Hm. "Tabs are not allowed" but...but... I don't have tests Rika: @codic use space indentation Rika: wdym about the double indirection btw? codic: wait why did i say tests codic: I meant spaces, I do have spaces codic: I was asking if in C Rika: are you totally sure Rika: C can do double indirection but its really not a good sign codic: a `string` is a `*something` Rika: yeah thats 1 pointer only codic: pretty sure codic: ah Rika: since youre writing the internal representation itself Rika: and not pointer of string codic: https://play.nim-lang.org/#ix=2keV codic: there's my code that nim is saying uses tabs codic: strangee Rika: see where my cursor is Rika: https://cdn.discordapp.com/attachments/371759389889003532/705586949020188712/unknown.png codic: yes codic: can't have trailing whitespace? Rika: can but thats a tab Rika: not even a trailing tab is allowed codic: Yay codic: fixe codic: *fixed codic: to be met by a new error codic: identifier expected, but got keyword end codic: Ohhh Rika: well of course, the proc isnt finished in terms of conversion codic: Nvm I know the fix Rika: end is a keyword Gary M: hey so, I'm trying to learn how to use threads but nimsuggest doesn't like any of it Gary M: it compiles and runs but the ide experience is fucked codic: frick codic: Still same error codic: i thought it was cuz my var on line 7 was messed up codic: Ohhhh end is a keyword so I have to do \`end` Rika: yeah threads are super fucky with nimsuggest from what i recall Rika: yes codic: ah ok codic: welp. failed with this line ` *(str++) = alphabet[counter % alen]` Rika: this really isnt super idiomatic nim codic: At least I was closed codic: for sure it's not Rika: that is super fucky c code that line codic: is it `ptr str++`? Rika: okay Rika: can i do it instead? Rika: its a kinda complicated fix codic: sure Rika: you shouldnt be doing this at all... Rika: but i wanna try my hand at doing it codic: i agree codic: But fun is fun Rika: i wont make it idiomatic codic: haha Rika: got a new paste? codic: https://play.nim-lang.org/#ix=2keW Rika: uh nothing changed Rika: still have the broken alen KingDarBoja: Should I worry about this hint after running the test suite? KingDarBoja: "Hint: 116259 LOC; 3.285 sec; 155.301MiB peakmem; Debug build;" Rika: i dont see whats worrying codic: oof KingDarBoja: That's why I am asking, I don't understand at all the first thing codic: aaaaah die, stupid `*(str++)` KingDarBoja: the sec is the compile time right? codic: maybe `ptr str + 1` KingDarBoja: The second parameter ofc Rika: codic, dont worry about that, its much more complicated than you think codic: hm codic: welp Rika: can i see the original code? codic: Sure codic: gimme a sec codic: https://hatebin.com/dbvnqqvlkh codic: Gotta head out, brb in 15 min Gary M: if threads is a system module why can't nimsuggest see it zacharycarter: My first suggestion is not using nimsuggest zacharycarter: but I don't know - maybe because you didn't import the module zacharycarter: and it's only included when a compile flag is set Gary M: threads > Note: This is part of the system module. Do not import it directly. Gary M: I can't not use nimsuggest... it's the only thing that's making vs code support work lol KingDarBoja: F Gary M: so I'm trying to work with threads, which do compile and run with the threads flag as intended zacharycarter: it used to annoy the hell out of me when I used VS Code Gary M: https://i.imgur.com/8oooeyn.png Gary M: but everything is broken really bad trying to work with it zacharycarter: I'm not sure :/ I don't use VS Code anymore zacharycarter: I do use threads though Gary M: this is a little depressing lol treeform: I think creating a config.nims and adding a line `--d:threads` will help the VS Code treeform: @Gary M ^ treeform: sorry its `--threads:on` not the other other thing treeform: treeform: https://cdn.discordapp.com/attachments/371759389889003532/705593296512221245/unknown.png treeform: No Thread errors. Gary M: ahh that seems to do it yeah Gary M: now I just have the errors in the nims file 😄 Rika: https://play.nim-lang.org/#ix=2kf4 @codic Gary M: https://i.imgur.com/iSh0lKF.png Rika: its horrible btw, this proc you made me write treeform: I don't have that. Strange. codic: > its horrible btw, this proc you made me write treeform: well just close the nims file zacharycarter: Rika: do you want to fill us in on why axion would rather die than use Nim again? codic: But... but.... I didn't make you do anything zacharycarter: he made you his proxy Rika: zacharycarter: axion really dislikes how araq handles nim codic: haha Rika: @codic i mean, this proc Rika: not that you made me write it Rika: but its just horrible codic: lol codic: you expanded my dowhile 😢 Rika: axion just really doesnt like his stubbornness Rika: codic: i did it just to make sure it wasnt doing the error treeform: @Rika your proc looks like C not nim. Rika: you can collapse it back codic: haha Rika: @treeform it is intentional Rika: codic wants it to look like C Rika: i think treeform: then they should use C? Rika: he doesnt want idiomatic nim Rika: I DONT KNOW Rika: ask codic zacharycarter: Rika: gotcha, thanks for the explanation codic: i don't, this is just to see how far nim can go zacharycarter: treeform: maybe he's not trying to use the GC? Gary M: wait nvm the errors went away magically Gary M: everything is good now Rika: he (ax) also fears that nim will die because of this stubbornness, he thinks ar is making nim his experimental playfield Gary M: @treeform thank you 😄 zacharycarter: Rika: mfiano should hang out with krux-2 Rika: yeah he also said that he likes krux zacharycarter: haha I like krux too but Nim wouldn't exist without Araq and Araq is smarter than mfiano zacharycarter: and krux as well Rika: i cant say for sure that ar is smarter than ax Rika: because i dont know them too well Rika: im just a dumb highschooler damn it zacharycarter: I can - the latter often wants to be the smartest in the room and isn't codic: anyways rika your proc works perfectly zacharycarter: I've interacted with him in multiple IRC channels Rika: i hope i can trust your word codic: just one difference - instead of one line with everything comma seperated each thing is on a different line Rika: and i really hope nim doesnt die out codic: i think i can fix that codic: yeah it'd be sad to see it go Rika: codic: is that not how its supposed to work??? codic: No, turns out the code the person gave me is wrong because hes an idiot codic: hahaha Rika: nice. Rika: give me the updated code, ill write idiomatic nim this time codic: how do I write to stdout without an extra newline? codic: sure after i get this Rika: stdout.write theString codic: o zacharycarter: Rika: mfiano uses common lisp lol, which is arguably more niche than Nim at this point Rika: im not a fan of bashing languages Rika: even if i do it, some half of me dislikes me doing that zacharycarter: it's not an attempt to bash a language - I dont really have a dislike of common lisp Rika: i suspect i have some sort of fragmented personality issue or something Rika: but its just a suspicion Rika: anyway zacharycarter: I'm just pointing out that worrying about a language disappearing would be a more valid worry based on the size of its community Rika: what's wrong with common lisp? zacharycarter: I think its ecosystem is probably smaller than Nims and I think it probably has less people writing code in it currently than Nim zacharycarter: I was just commenting on your statment regarding worrying about Nim disappearing zacharycarter: Nim already has a 1.0 release behind its belt and there's a ton of work going into the next major release, ala the new memory management Zed: How many keywords does nim have? dawkot: Isn't Nim kind of at it's peak popularity, excluding right after 1.0 release? zacharycarter: it is I imagine dawkot: If true, it was much more in danger of dying out then than now codic: lemme get the error codic: /usercode/in.nim(21, 9) Error: ambiguous call; both io.write(f: File, a: varargs[string]) [declared in /playground/nim/lib/system/io.nim(396, 6)] and io.write(f: File, c: cstring) [declared in /playground/nim/lib/system/io.nim(188, 6)] match for: (File, ptr char) zacharycarter: yeah Nim's been in development for over a decade codic: Also tried `write stdout, str` Zed: write(stdout,"string here") codic: sad codic: oh codic: let's see codic: same error codic: this is a seq not a string btw codic: Oohhhhhhh codic: That's why it prints on multiple lines Zed: convert it to a string? codic: Is there something like Seq.join? Rika: its a seq? Zed: using .repr Rika: im so confused to what you're trying to do Zed: write(stdout, sequence.repr) codic: trying codic: Uhhhh KingDarBoja: Okay I am getting tired of casting cuz OOP Rika: sometimes i just wish i could see what the hell your code looks like right now codic: I get a buncha `ptr thing -> 't'` codic: Lo codic: *lol codic: wait Zed: iterate over the sequence codic: https://play.nim-lang.org/#ix=2kf6 Zed: and print each value codic: `for t in str: echo t` codic: let's try that codic: Nope codic: That is *not* what I want codic: Never mind Rika: i dont get what you're doing codic: I am just plain utter stupid Rika: the reason there are newlines is because of the for loop codic: yeah, ignore me codic: I'm just stupid as stupidness codic: lol codic: The person who wrote the original c code piped it thru `tr` codic: and replaced all newlines with commas Rika: smh Rika: smh smh Rika: double stupid, your friend is codic: ayy codic: final code if you want to idiomacize it codic: https://hatebin.com/ffoyvjeaut Rika: hey! you stole my code! 1/2jk codic: lol codic: oh yeah codic: it is the same code codic: posting that was useless codic: wasted 2-3b on hatebin's server wherever it is codic: smh bedwardly-down: So, a guy ruined my nostalgia trip by telling me that i need to come this discord to nerd out without having to jump on the irc channel... i mean, hello all. 👋 treeform: hello KingDarBoja: WAT codic: Hey! codic: lol bedwardly-down: Hello Gary M: I didn't say you "needed to" Rika: hello down bedwardly-down: 🤪 KingDarBoja: Hello up KingDarBoja: 🍭 bedwardly-down: He really didn’t. I just figured I’d jump in with a splash. 😂 Rika: https://play.nim-lang.org/#ix=2kfb @codic semi-idiomatic, i can make it better but i am out of thinking juice codic: if nim has an inbuilt function to get permutations... *sigh* codic: alright thanks Gary M: Welcome to the nimmuity bedwardude Gary M: I know it's not quite what you're used to with haxe but hope you end up liking it lol codic: Why `var alphabet:string = "abc"`? type inference Rika: https://nim-lang.org/docs/algorithm.html#nextPermutation%2CopenArray%5BT%5D ?????? @codic codic: same with str:string codic: nooooooooooooooooooooo codic: my whole purpose has died Rika: bruh bedwardly-down: Actually, Haxe has its levels of cringe woth awesomeness bedwardly-down: With* codic: wait, I meant for a string codic: not seq Rika: haxe legit looks interesting but i dont like langs w/ braces treeform: what are you guys doing every combinations of a,b and c? Rika: its just too ingrained in me to not use braces codic: tbh the one thing I hate about nim is no braces Gary M: Lol codic: @treeform i was tryna port a permutation function from codic: *from C Gary M: Nobody ever seems to be 100% satisfied with any language they use treeform: I am pretty satisfied with Nim. treeform: I am pretty satisfied with Nim. Rika: rest in peace irc users Elegant Beef: Yea but you actually know how to use it 😄 Rika: @codic always search the standard library first before you port something 😛 Gary M: Mr. Elegant "Doesn't like spaces over tabs" Beef codic: :P bedwardly-down: Honestly c and c++ make me cringe codic: eh codic: was more fun anyways Rika: why? Rika: whats so cringe w/ c bedwardly-down: But that’s because I haven’t spent enough time with either doing things that interest me. 🤪 Elegant Beef: I mean tabs allow customizabillity Elegant Beef: So this is why i will never say spaces are better Gary M: It looks and feels old and c "strings" are annoying codic: go ftw Rika: > go codic: What's the use of the go gc for nim anyways? Rika: if you want to ffi with go w/ nim Rika: in* Rika: not w/ Gary M: Interop with go Gary M: I wouldn't use it otherwise Rika: man im too mentally exhausted to argue about spaces and tabs and languages and braces and shit codic: wait you can interop with go? codic: :gasp: Rika: that shits tiring and leads to no good conclusion KingDarBoja: I haveno issues with braces codic: my opinion of nim is just rising and rising bedwardly-down: I kind want to try out making nim bindings for haxe simply to learn how to make bindings for future purposes KingDarBoja: I use Typescript / Python so Rika: i can use a language w/ braces, i just dont like them codic: i like braces because copy paste issues with indentation not being consistent treeform: it looks like your function does not permute correctly? Its missing permutations? What should the real output be? Elegant Beef: Rika it's purely about customizabillity for me spaces mean that it's the same on everyone which is inheritely bad since it's not to what they like Rika: i dont care what you use, i use spaces, go convert that to what you use if you want KingDarBoja: 🔝 Rika: dont fucking make me convert to what you use KingDarBoja: What codic said KingDarBoja: I am not going to convert you ❤️ Rika: > it looks like your function does not permute correctly? Its missing permutations? What should the real output be? Rika: @treeform its intentional because theres the counter variable that limits output Rika: SIGSEGV codic: yeah, I can remove the counter Gary M: cast[object](Rika) Rika: Segmentation Fault: core dumped codic: cast[cstring]("Rika") codic: if i understand what casting is that'll convert you to a cstring Gary M: Well Rika: dont do that though Gary M: You don't need to do that kind of cast for that Elegant Beef: That's a last resort KingDarBoja: Speaking of casting Rika: you really should read the manual Gary M: cast[] is essentially like a reinterpret cast you'd find in C++ codic: i should codic: I know I don't Gary M: It'll treat the memory as though it was another type without doing any type conversion Elegant Beef: This bit stream is now that type, congrats, you fucked it! codic: how does nim cross compile? bedwardly-down: Does cast work pretty similar to how it does in Java, though? Gary M: Idk KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/tests/language/test_parser.nim Elegant Beef: normal type casting is done TypeB(obj) KingDarBoja: Scroll down and face the cast hell KingDarBoja: Darn OOP KingDarBoja: Going to switch to object variants codic: i saw an article somewhere but forgot it codic: oof bedwardly-down: If it does, then it’s comparable to haxe’s cast system Gary M: cstring("Rika") Rika: how does java do cast? Elegant Beef: The cast[TypeB](ob) just says it's typeB and doesnt care about the data there codic: found the basics `nim c --cpu:arch --os:os thing.nim` codic: all based on https://www.reddit.com/r/nim/comments/avtq1u/nim_cross_compile_osx_to_linux_how_to/, lol Rika: cast[]() is like the "i made this" meme KingDarBoja: @Elegant Beef in my case, it is to force the type to be what's expected KingDarBoja: As my objects have the correct type Rika: this meme Rika: https://cdn.discordapp.com/attachments/371759389889003532/705603093722824724/iu.png KingDarBoja: But the "wrapper" proc will return it's parent type Rika: "meme" Rika: just a comic more of bedwardly-down: Cast in Java - cast(var, new type) for the most part Rika: @bedwardly-down what does it do exactly? Elegant Beef: @bedwardly-down https://play.nim-lang.org/#ix=2kfg Elegant Beef: Run that bedwardly-down: Allows you to transition types between variables that come from the same base inheritance Elegant Beef: That's not what cast[]() does bedwardly-down: That’s not the same cast. bedwardly-down: Point proven KingDarBoja: Errr... bedwardly-down: And it ran on mobile too with no issues Elegant Beef: cast[]() just says this is type is a new type without any assurance KingDarBoja: Guys KingDarBoja: Thta's what I did lol Rika: yes KingDarBoja: -> Allows you to transition types between variables that come from the same base inheritance codic: you can make mobile apps with nim?? KingDarBoja: That's why I am using it Rika: you do type(var) instead of cast[] for that KingDarBoja: 🤔 bedwardly-down: Cast in Java and Haxe is like getting a gender change in real life except not as permanent Rika: nim can compile to objective c KingDarBoja: Hold on, I will try Gary M: Ok well we're talking about casting in nim codic: that is only ios not android though codic: And even in the ios scope do you have access to the UIKit apis? Rika: @bedwardly-down see image i sent above to know what nim cast does Rika: nim can compile to android target too yes Elegant Beef: Also my nimplayground example codic: codic: https://cdn.discordapp.com/attachments/371759389889003532/705604110409400381/iu.png codic: for convienence codic: Ah, but do we have access to ui kit or whatever android uses bedwardly-down: I saw. I get the impression of an identity complex there codic: PreviousMessage.replace("or", "and") KingDarBoja: Rika, u right Gary M: 9 times out of 10 you just want a normal type cast int(someFloat) KingDarBoja: But anyway, I don't want to use it (cast or type(var) ) if I have same types with the same parent type KingDarBoja: That's why I need object variants afaik Gary M: But sometimes you're dealing with some C API that is extra shitty and wants it to be a really specific type Elegant Beef: Typically you'll only use the cast[]() from my experience with library bindings that return weird values Elegant Beef: For instance the glfw bindings returning just `pointer` from a GetX11Window KingDarBoja: Rip Rika Rika: im still alive bedwardly-down: Glfw is still much easier for me to get around than sdl2 the few times I’ve tried. Good to know Rika: barely zacharycarter: https://github.com/zacharycarter/frag/blob/master/src/frag.nim#L8-L31 - is there a better way to do this? zacharycarter: https://github.com/zacharycarter/frag/blob/master/examples/00-minimal/minimal.nim#L3-L4 zacharycarter: is the associated code bedwardly-down: Although, using a straight getX11Window is cringe as a Linux user, @Elegant Beef zacharycarter: all the code is in that repo - but I think it will probably only work on osx, I haven't tried it on any other OS yet Elegant Beef: I mean i created a GLFW window and i wanted it as a X11 window Elegant Beef: Since it was my status bar for my shitty wm 😄 bedwardly-down: Gotya. I thought you meant explicitly stated in the code. When i see that, it can definitely lead to bad outcomes if the xorg versions aren’t compatible or someone is using straight Wayland or has shitty drivers Elegant Beef: Yea was making a Xserver only wm bedwardly-down: Got it Elegant Beef: Which i guess is a dumpster fire that will be abandonwae Elegant Beef: abandonware* Gary M: Vaporware Elegant Beef: Well no cause it works gary Gary M: 👀 bedwardly-down: Not really. Xserver is so deeply embedded in so much stuff that it’s not going anywhere for a good while still KingDarBoja: Synthwave Gary M: Sorry I meant trashware Elegant Beef: Bedwardly i mean my WM is a dumpster fire bedwardly-down: It’s like systemd. Unless you choose an os that has some crazy smart people that are capable of stripping systemd completely out, you’re kind of stuck with it treeform: @codic @Rika This is how I would do that strange code in nim style: https://play.nim-lang.org/#ix=2kfj Gary M: Where's that fullscreen support in your wm haha Elegant Beef: Feck off Rika: bruh Gary M: Is it perhaps literally crashing the wm Rika: i said i have no more think juice Elegant Beef: I got _NET_SUPPORTED atoms working bedwardly-down: Does your wm at least play doom? Elegant Beef: But it doesnt seem to send the _NET_WM_STATE_FULLSCREEN event that awesomewm gets Rika: im out for now, i just wanna do nothing rn Elegant Beef: Ok buh bye? bedwardly-down: Night, rika Rika: you're assuming its night Elegant Beef: badwardly come work on goodwm with me and help me fix it up to be fully compliant! Rika: when its actually 10 am Elegant Beef: hey it's night somewhere in the world Gary M: Just come back to the land of winblows Elegant Beef: Lol Elegant Beef: Or i could just use any number of WMs Gary M: Gross Elegant Beef: Sorry i dont need small weeble wobbles when i move windows with my keyboard Gary M: Windows explorer is the best wm bedwardly-down: Where would i start, Beef? Gary M: Learning Nim, probably Elegant Beef: *If you're serious, after learning nim go look at xlib and learn how Xlib works Elegant Beef: I'll properly setup my nimble stuff anyway been pushing that off for too long 😄 Rika: bruh dont actually do what he says bedwardly-down: Xlib shouldnt be super difficult since i least know the basics of how the xserver stack works Rika: why am i still here Rika: i really need to do something else bedwardly-down: Because you want me, Rika. I’m new and everybody wants me always. 😈 Elegant Beef: Cant tell why rika is saying dont do what i say KingDarBoja: Because we love you 🙂 KingDarBoja: But yeah, you should take a rest 😄 bedwardly-down: I miss beef, tbh. It’s just straight up too expensive right now to buy bedwardly-down: A 16 ounce tube of ground chuck is like $6 right now. It’s nuts Gary M: Beef why did you raise your prices Elegant Beef: Im elegant, im worth it trust me Rika: how did beef suddenly convert into nuts Elegant Beef: We obviously have spoken much, i am crazy Gary M: cast[nuts](groundChuck) KingDarBoja: cast[cast[cast[...]]] bedwardly-down: Hamburgers with peanut butter and swiss on a wheat bun - 🤤 Gary M: Wouldn't it be more like cast[](cast[](cast[]))) Gary M: Wouldn't it be more like cast[](cast[](cast[]())) Rika: why is the nim discord so magnetic for me Gary M: Sorry for edit irc rip u guys Elegant Beef: Rika you just know a good chat group when you see them Rika: why do you think im in 100 discord servers Elegant Beef: But you're currently active here, that says a lot what you think about us Prestige: Hey Beef, I tried destroying windows with a ClientMessage and atom like you do. I noticed something strange - If I do not explicitly focus a new window after that window is destroyed, XGetInputFocus returns the ID of the destroyed window. Did you see the same behavior? Elegant Beef: Yes but i just call refocus after Elegant Beef: Yes but i'll just call refocus after KingDarBoja: 100 discord KingDarBoja: Dudeee wtf Elegant Beef: I have a "get focus" proc which will get the currently selected window and make it the active one codic: @treeform Thanks! codic: I'll look at that and see the diferences Prestige: I was planning on tracking the previous window and selecting that one, manually Elegant Beef: ie `screens[selected].workspaces[selectedWorkspace].rawWindow` will be active Rika: > 100 discord Rika: i'm also mod in a considerable amount of those servers xd Gary M: Easy way to destroy Windows is still install a virus KingDarBoja: I have Windows KingDarBoja: 😄 Gary M: Is to* Gary M: You can also destroy Windows by damaging the hard drive KingDarBoja: Why my status isn't set to VSCode 😢 KingDarBoja: nvm found it codic: There's an easier way codic: hold on codic: Easy! codic: Open cmd.exe or powershell and `DISKPART` Prestige: Beef: How are you deciding which window is active if the active window is deleted, and an EnterNotify event isn't fired for another? bedwardly-down: Prestige, if it’s calling after the window closes, that means it’s not actually destroying the window properly. Elegant Beef: if the index isnt at a window i move it down codic: type `list disk` when the prompt comes up. find your disk, then type `SELECT DISK 0` to select it. codic: then type `clean` and restart. Prestige: Ah ok, I was going to do something similar. Thanks codic: you should not be able to boot unless you have a dualboot or live usb codic: :) Prestige: bedwardly: I'm explicitly calling it in order to close a window, it seems like the window still exists though.. or else XGetInputFocus wouldn't be returning the same ID of the window I tried to destroy bedwardly-down: @Elegant Beef , are you caching the Windows to make it quicker for them to pop back up or what? bedwardly-down: That’s what I’m saying. It shouldn’t be doing that Elegant Beef: I mean i store the windows in workspaces Prestige: Yeah, so I must need something else to destroy it Elegant Beef: Those workspaces are then stored inside a screen Elegant Beef: So i guess yes? Elegant Beef: My workspaces arent setup x complaint since i didnt read anything about it Elegant Beef: I just started making/moving windows Elegant Beef: then learned about atoms and went, well damn bedwardly-down: Why not write them to a session file that gets called when reopening specific windows? That’s how a small handful of other wms do it for the same effect Prestige: Beef: Why do you use a client message w/atoms instead of just calling XDestroyEvent? I'm trying to figure out the proper way I should be doing this bedwardly-down: That way the windows get destroyed but can be recreated with the same parameters Elegant Beef: I do not like saving layouts Elegant Beef: I like mathematical layouts Elegant Beef: If i open a window i expect it to be added to the bottom of the stack Elegant Beef: Unless it's a specific window meant to go to a specific workspace bedwardly-down: Systems with shitty drivers could have some issues if they’re still running in the background Elegant Beef: Prestige that was just off of something i read Elegant Beef: Again i have 0 clue how to properly use xlib Elegant Beef: i just stumble around since i am very bad about reading Elegant Beef: I much prefer face ramming over reading docs Prestige: I'll see if XDestroyWindow works better and let you know bedwardly-down: I don’t really have specifically any direct clue either but know how trash Linux display drivers and memory management can be at times Elegant Beef: On destroy notify you should remove the window and refocus if it was the focued window Elegant Beef: That's what i do Elegant Beef: Look at my OnDestroyWindow Elegant Beef: I believe that handles it Prestige: Cool, I'll take a look codic: I have officially died. Nim is faster than c???? Prestige: What? codic: program in nim: codic: Executed in 2.40 millis fish external codic: usr time 2.38 millis 408.00 micros 1969.00 micros codic: sys time 0.15 millis 154.00 micros 0.00 micros codic: and in c: codic: Executed in 2.40 millis fish external codic: usr time 2.38 millis 408.00 micros 1969.00 micros codic: sys time 0.15 millis 154.00 micros 0.00 micros codic: wait what Elegant Beef: Depends on use case Elegant Beef: https://github.com/kostya/benchmarks codic: I mean codic: In nim: ________________________________________________________ codic: Executed in 2.40 millis fish external codic: usr time 2.38 millis 408.00 micros 1969.00 micros codic: sys time 0.15 millis 154.00 micros 0.00 micros codic: and in c codic: ________________________________________________________ codic: Executed in 3.77 millis fish external codic: usr time 3.75 millis 421.00 micros 3.32 millis codic: sys time 0.16 millis 160.00 micros 0.00 millis Elegant Beef: In this benchmark nim is slower and more memory hungry than python Elegant Beef: for json* Prestige: I mean it compiles to C so it depends on how efficiently written it is, right? shashlick: Python is written in C and has had years to optimize bedwardly-down: @codic , are you using fish shell too? Elegant Beef: It's only json where it really loses shashlick codic: @bedwardly-down yeah Prestige: Beef: I finished my first milestone for my wm last night. Have tags and a master/stack layout with gaps Elegant Beef: nice bedwardly-down: Fack yeah!!! Elegant Beef: Mine is mostly functional minus a few things Prestige: feelsgood Prestige: Need to clean up focus behavior, and find out why launch dmenu gives my an invalid pointer error lol codic: How do I get *one* C file from a nim program? Elegant Beef: Yea i need to figure out how to be properly compliant Elegant Beef: what do you mean one C file? bedwardly-down: Fish may not be compatible with bash and other shells directly without some fiddling around, it’s definitely been my shell for like 5 years now codic: Compile one nim program to one c program codic: @bedwardly-down True haha, just switched a week or two ago codic: there were some hitches at the beginning but i managed to port everything to fish bedwardly-down: Have you started using the function capabilities yet? codic: Yup codic: I used them to define `!!` since i often used it in zsh bedwardly-down: I haven’t fully ported everything yet but am slowly moving over. bedwardly-down: Alias being released was a godsend Gary M: Hey bed what's your ide codic: Argh I'm tryna get c 😢 Elegant Beef: he's going to say nvim treeform: @codic I can always make nim faster. I like that about nim. Elegant Beef: in 3..2...1 bedwardly-down: Me? No ide. I go straight ed with some script wrangling additions added Gary M: What Prestige: nvim here codic: lmao codic: My nimcache with my project has codic: ` hw.json '@mhw.nim.c' '@mhw.nim.c.o' stdlib_io.nim.c stdlib_io.nim.c.o stdlib_system.nim.c stdlib_system.nim.c.o codic: ` codic: Which one is the one I should be looking at bedwardly-down: Ed and fish go hand in hand super well codic: hahahaha bedwardly-down: @Elegant Beef and @Gary M , did I catch you off guard? Gary M: No I just don't know what that is Elegant Beef: No i was close bedwardly-down: Not close at all Gary M: Probably super close Elegant Beef: I mean close enough Elegant Beef: TUI editor bedwardly-down: Ed is what was built for computers that were made out of typewriters before screens appeared Elegant Beef: Same thing to me Gary M: Why are you masochistic codic: .c codic: file codic: must codic: be codic: passed codic: into codic: [email protected] Gary M: Less spam please codic: haha bedwardly-down: I’m long term wanting to get good at server admin stuff and ed is almost guaranteed to be on all linux and older servers codic: vi/vim KingDarBoja: RIP IRC Gary M: Rip codic: I'ma just post this one more time and then go codic: https://discordapp.com/channels/371759389889003530/371759389889003532/705614451919028224 Gary M: Does irc reflect delete events or something bedwardly-down: I’m a freak, @Gary M codic: irc doesn't have deleting iir codic: irc doesn't have deleting iirc codic: *IRC* *IIRC* codic: welp. no response 😢 bedwardly-down: Rip ric Zed: is there a way to make an array with an unditermined size? Zed: actually that would be a sequence Elegant Beef: yep arrays require a compiletime constant for the length Elegant Beef: *Atleast that's what i understand, i have no clue why i speak* codic: rip me Zed: in compilation are sequences converted to arrays? codic: I'ma just give this question another shot tommorow Elegant Beef: I'd doubt it Zed, but againt i am a big ol' numpty bung87: no seq has store its size Zed: How do you add a value to the sequence? Zed: i cant find anything in the docs for it bedwardly-down: Almost home. @Elegant Beef , I’ll see about getting nim setup and go from there bedwardly-down: Doesn’t look like it would be hard to setup on my “arch btw” desktop. 😂 bedwardly-down: Although, Artix > Arch. 🤪 disruptek: zed: someseq.add somevalue Zed: thanks disruptek disruptek: seqs isn't something you're likely to find good documentation for; you kinda have to feel your way through it the first time. disruptek: some shit you just can't learn from a book. Elegant Beef: Yea you will need to compile cimgui for the imgui stuff and get the required libs for nimgl Gary M: sequences are like C# lists or C++ vectors.... basically bedwardly-down: Why use imgui, though? bedwardly-down: I haven’t heard about that in forever but last time i saw it used, the devs were working to move away from it. It’s predominately for game development and used to be super finicky bedwardly-down: I don’t know how it is now Elegant Beef: I mean cause im silly Gary M: sequences are also allocated on the heap and gc'd Elegant Beef: Im using it for the status bar for no real reason Elegant Beef: *I went hey this could work ok, let's do it, and i did it* Gary M: bed what would you do instead Gary M: and do you mean specifically dear imgui being finicky, or the concept of immediate mode gui's being finicky? Gary M: because really they're simpler to get things done in a basic program loop Gary M: https://games.greggman.com/game/imgui-future/ haven't read this through yet but it gives some good comparison bedwardly-down: Imgui was messy about 5 years ago. I haven’t followed it since Gary M: Still I'm not sure what you mean by messy Gary M: Unless you're referring specifically to an imgui library like dear imgui. That's not clear lol bedwardly-down: I honestly don’t know. I was a different person 5 years ago with different opinions only knowing of imgui through a random project bedwardly-down: I’m pretty certain it was qgears, the dead Gears engine open source project to get Xenogears, ff7, 8 and 9 all running on everything Gary M: Unity's gui used to be an imgui bedwardly-down: http://q-gears.sourceforge.net/ Gary M: Not a *dear imgui*, just an *immediate mode gui* KingDarBoja: Guys I want to create a dictionary of heterogeneous values and string keys KingDarBoja: But no idea, looking at the table modules examples KingDarBoja: Let's say I want { "key1": int, "key2": seq[someType], "key3": Table[string,int] } Prestige: Beef: If I invoke the same code you use in closeWindow and then call XDestroyWindow, looks like it is actually destroyed and I also don't receive a BadDrawable error Gary M: Wow sourceforge that's still a thing Gary M: @Elegant Beef Elegant Beef: Uhh Elegant Beef: Weird bedwardly-down: Honestly, one flaw i have is I’m super out of the loop in tech with many different things. 😰 bedwardly-down: Although, I’m always super on top of Linux issues that could make my pc use a nightmare at times. 🤪 Prestige: bed: You don't really use ed, do you? KingDarBoja: _The main difference between Python dictionaries and Nim tables is that Nim is typed, so tables are homogeneous_ Scrap my question Rika: > Unity's gui used to be an imgui Rika: you'd usually say imm.gui for that bedwardly-down: Prestige, https://youtu.be/JXdShuIjvbs Elegant Beef: damn Elegant Beef: Madlad Prestige: bedwardly wow Prestige: seems crazy tho tbh bedwardly-down: It’s not. ☺️ Prestige: Why not use vim? bedwardly-down: Honestly, I've been a Vim / Neovim user for a long time, so wanted a change and found it slowed me down a bit too much Prestige: Huh, interesting bedwardly-down: 🤷‍♂️ Gary M: @Elegant Beef hey you basically did guess right just that he *used to* use vim/nvim Gary M: I'll chalk that up as beef - 1 / bedwardly - 0 Elegant Beef: Eh that's pretty common with linux users, especially those TWM users Gary M: You would know that more than me Gary M: The only thing I know about Linux users is that they'll tell you they're Linux users without you asking bedwardly-down: Often, there's a legit reason for that. You want us to try something out and we either can't or won't because you didn't support us. 😛 Gary M: Gary M: https://cdn.discordapp.com/attachments/371759389889003532/705643181185695754/u8wa9kyh8jjy.jpg Elegant Beef: Gotta make comments about how linux is a better designed developer environment wherever possible bedwardly-down: It's not always better but does require a certain kind of madman. 😛 Elegant Beef: I mean for developers i'd say it's clearly better bedwardly-down: Honestly, if Tristan or Beef here hadn't pointed it out, I wouldn't have really said I was a Linux dev as long as possible in GDL. Elegant Beef: lol Elegant Beef: *Sorry* 😄 bedwardly-down: Also, nim is available in the Artix main repositories? Nice Elegant Beef: I mean i say use choosenim always Elegant Beef: Choosenim makes life great bedwardly-down: *too lazy and tired to struggle with extra hard downloading of libraries* bedwardly-down: 😛 Prestige: Beef: I agree about Linux being a better dev env Gary M: choosenim is easy bedwardly-down: Yeah, it's pretty easy. And adding it to my fish path is much easier than with Bash bedwardly-down: Linux is definitely a better environment if you're willing to learn it as such. Right off the bat, it's not going to make a lick of sense to many people bedwardly-down: But, also, the whole argument is fully subjective and a matter of opinion. I will never go out and tell people to ditch Windows or Mac for a Linux system but will help some if they want to get into it Gary M: I will tell people to not get mac tho 😄 bedwardly-down: Hey, I loved the Mac I had years back. They have their benefits Gary M: I don't see any benefits in 2020 Gary M: especially for game dev which is usually where my discussions are lol bedwardly-down: Why I have an Iphone and Android phone at same time Prestige: Idk how anyone uses macs nowadays Gary M: mac isn't ios though bedwardly-down: That and tax write off for work bedwardly-down: It's not, but Macs are still decent for Unix users especially Gary M: then get a Unix compatible system for MUCH less $$$ bedwardly-down: That's pretty much all systems Gary M: exactly bedwardly-down: FreeBSD should run on most hardware Gary M: so why is mac decent when it costs more bedwardly-down: And Linux will run on most hardware Rika: #offtopic (#nim-offtopic for irc) Gary M: 👀 Gary M: cast[on-topic](off-topic) bedwardly-down: I was starting with nim and they dragged me into the badlands. I'm a good boy, I swear Prestige: Nice Rika: :Doubt: Rika: TIL nimble used to be called babel? bedwardly-down: If that's the case, I can see that being an issue. There are multiple projects / libraries that have gone by that bedwardly-down: Choosenim, really? `Choose a job. Choose a mortgage. Choose life. Choose Nim.` Rika: pff bedwardly-down: @Elegant Beef, are you working on devel or stable? Elegant Beef: #head bedwardly-down: Nim's actual download TUI stuff is really poor... bedwardly-down: You know what, I'm getting grumpy Prestige: Beef if you happen to look into dmenu launch in your wm, lmk if u find anything? I'll do the same Prestige: just have a few things to finish up before I get there bedwardly-down: Dmenu isn't too bad. It does require a bit of configuration work, especially if you're not using bash or a bash compatible shell Prestige: I use it a lot, but for some reason in the wm I'm making, I get an error when trying to open it bedwardly-down: I've got it on on my system and it does the job Prestige: Haven't look into fixing it at all, yet Elegant Beef: I use rofi Elegant Beef: So i have rofi support bedwardly-down: Prestige, what shell are you using and anything funky on the backend like XWayland or anything Prestige: zsh, and nah Prestige: rofi felt a bit slow to me, so I switched back to dmenu bedwardly-down: I tried zsh the other day and spent two hours noping back into fish, so I don't know Prestige: I had to add a few extensions to make zsh usable Yardanico: @Rika because Nim was called Nimrod Prestige: havent tried fish in ~10 yrs Yardanico: "Nimrod (/ˈnɪmrɒd/;[1] Hebrew: נִמְרוֹדֿ, Modern: Nimrôd, Tiberian: Nimrôḏ; Aramaic: ܢܡܪܘܕ‎; Arabic: اَلنّمْرُود‎, romanized: an-Namrūd; Persian: نمرود‎, romanized: Namrud; Turkish: Nemrud), a biblical figure described as a king in the land of Shinar (Mesopotamia), was, according to the Book of Genesis and Books of Chronicles, the son of Cush, the grandson of Ham and g bedwardly-down: Rofi felt the same for me and I didn't like the default configuration when dmenu was already working how I needed Yardanico: Tower of Babel Yardanico: It's references all the way down Rika: hey i didnt question why it was called babel bedwardly-down: Also, before anyone says anything, this discussion is about a nim based wm. 😄 Yardanico: I use Sway with Wofi and Waybar Elegant Beef: Im currently using awesomewm but was using i3wm before Prestige: I'm planning on making the wm minimal, no bar or deps for a menu Elegant Beef: I really just want alternating split bedwardly-down: You using Wayland then? How's it working with your system? My drivers are whack with it Prestige: I keep hearing about issues with Wayland so I haven't even tried it :/ Yardanico: I have full AMD system Prestige: but if it becomes standard I'll port my wm to it Yardanico: So of course Wayland works just fine Yardanico: RX 570 + 3700X, I don't game much bedwardly-down: Prestige, it won't be the full standard for a good while still due to driver complications and massive amounts of code work needed to get everything to move from X to Wayland Prestige: im honestly expecting 15 yrs (if it becomes standard) Yardanico: Well it already works quite well for a lot of stuff Yardanico: For most applications it's a matter of updating the framework version they're using Yardanico: Almost no applications use X directly nowadays Yardanico: They use GTK, Qt, etc bedwardly-down: True that. Prestige: True Prestige: Okay maybe sooner then Yardanico: Also there's offtopic channel :) Prestige: We were indirectly talking about nim, I'm making a WM with x11 bedwardly-down: @Elegant Beef how do I install head with choosenim? I'm usually decent with this stuff but I'm missing something Elegant Beef: `choosenim '#head'` bedwardly-down: Not putting in single quotes is why I couldn't get it to work? O.o Elegant Beef: yes Elegant Beef: Idk it's what i have to do with my terminal Elegant Beef: So could just be bash i guess 😄 bedwardly-down: Makes sense. I'm on fish, and # isn't usually a thing for terminal commands Yardanico: @Elegant Beef no? Yardanico: That's not how you do it Yardanico: choosenim devel Yardanico: Ah I see Elegant Beef: I dont recall where i seen to do this but i know someone told me Yardanico: Both will work bedwardly-down: Naw. Choosenim devel got nightly but not master at head bedwardly-down: At least that's what it showed on my end Elegant Beef: Yea idk im a numpty Elegant Beef: So no one should ever listen to me Yardanico: Well Beef you're right Never Listen To Beef: There a name to match my actual position here Yardanico: I'm just a bit old styled so I have nim repo cloned Yardanico: And do "sh build_all.sh" every so often Yardanico: After git pull Never Listen To Beef: ah Yardanico: I remember the times when we didn't have build_all.sh :P bedwardly-down: I usually would but I'm lazy and tired right now. Also, you could put it on a daily cron job if you wanna get fancy Yardanico: I don't really run cron :P bedwardly-down: I run it on my server but not on my laptop right now. No need for it 😛 Zed: why does `for i in tape` not work but `for i in 0..tape.len` work, tape is a string Zed: doesnt the first option do the same thing? Never Listen To Beef: is tape a sequence? Never Listen To Beef: the latter works cause it creates a range from 0 to tape.len Never Listen To Beef: then it iterates over them Zed: tape is a string Rika: Are you sure the latter doesn't work Zed: aren't strings natievly arrays? Zed: yeah i was getting errors Never Listen To Beef: you mean former rika Never Listen To Beef: It works Never Listen To Beef: https://play.nim-lang.org/#ix=2kgs Rika: I've been awake for so long Rika: You think I can think?? Rika: !eval for i in "test": echo i NimBot: t↵e↵s↵t Rika: Works here too Zed: https://play.nim-lang.org/#ix=2kgs Zed: this is not working on the playground Rika: What error are you exactly getting Zed: type mismatch Rika: It just did for me Zed: proc `[]`(s: string; i: BackwardsIndex): char Zed: first type mismatch at position: 0 Zed: proc `[]`[I: Ordinal; T](a: T; i: I): T Zed: first type mismatch at position: 0 Zed: proc `[]`[Idx, T, U, V](a: array[Idx, T]; x: HSlice[U, V]): seq[T] Zed: first type mismatch at position: 0 Zed: proc `[]`[Idx, T](a: array[Idx, T]; i: BackwardsIndex): T Zed: first type mismatch at position: 0 Zed: proc `[]`[Idx, T](a: var array[Idx, T]; i: BackwardsIndex): var T Zed: first type mismatch at position: 0 Zed: proc `[]`[T, U, V](s: openArray[T]; x: HSlice[U, V]): seq[T] Zed: first type mismatch at position: 0 Zed: proc `[]`[T, U](s: string; x: HSlice[T, U]): string Zed: first type mismatch at position: 0 Zed: proc `[]`[T](s: openArray[T]; i: BackwardsIndex): T Zed: first type mismatch at position: 0 narimiran: yaaay, multiline paste Zed: proc `[]`[T](s: var openArray[T]; i: BackwardsIndex): var T Zed: first type mismatch at position: 0 Zed: template `[]`(s: string; i: int): char Zed: first type mismatch at position: 0 Zed: Zed: expression: [](tape, i) Zed: that is in the playground Rika: Rika: https://cdn.discordapp.com/attachments/371759389889003532/705668559388540988/Screenshot_20200501-153445.jpg Zed: is it all messed up? Zed: im an idiot Zed: i was trying to use i as an index Zed: god im a dumbasss Never Listen To Beef: I had seen that as an issue with that acessor Rika: Name your variables more explicitly Never Listen To Beef: Rather operator error Rika: Literally make single letter variables an error for you Yardanico: Also by the way guys Yardanico: Did you know that Nim discord server actually has an audio channel which has never been used (afaik) Zed: lol i just noticed that now you've pointed it out bung87: do I need packaging portable application as installer so application can have app icon? on Linux Yardanico: On Linux your app doesn't really ship an icon in the binary Yardanico: On Linux it needs to be in a separate file which will be referenced in the .desktop file (which is a file format for application shortcuts on Linux) bung87: yeah , it has entry file bung87: without install step that .desktop cant specify the application path. skrylar[m]: fish certainly does not run other shell scripts. they are entirely their own. although fish is *usually* nicer. simple "rename stuff while replacing extension" is verbose tho :| bung87: @skrylar another topic? skrylar[m]: i saw fish mentioned in the backlog bung87: OK bung87: maybe I'll try `snapcraft ` for packaging skrylar[m]: appimages are pretty nice skrylar[m]: i always wished appimage took off more than it did; they're simple and they mirror the old macos "just download this app, plop it in Apps and run it" user story. snap/flat ... well, they don't. Never Listen To Beef: I'd be happy with appimages if there was a repo like system for them and they linked into `bin` bung87: ok , I will consider it, I only left the linux app build step now, for mac ,win I already wrote scripts. skrylar[m]: nothing stops you from putting the appimage in bin. they are just elf stubs with a squashfs image taped on bung87: mac is .app dir + plist, win just embed ico to exe, that's easier than linux Zed: how could i read in output as input from a shell executed command? Zed: if that mkes sense Never Listen To Beef: Nothing stops it but i use a package manager so i dont have to do manual work 😄 skrylar[m]: foo | bar? bung87: @zed it make sense, it's about stdio pipline skrylar[m]: or do you mean capturing stdout when running another process Zed: the latter i think Zed: i want to execute an executable from nim and read what it outputs to the console bung87: you can easy found article about this in python ,nodejs Araq: Zed: look into osproc.nim Araq: federico3, https://forum.nim-lang.org/t/6277 please have a look Araq: it's & inside a title when it should be & Araq: insert rant about "everything should be text (so that we end up with crazing quoting and escaping rules everywhere)" here Araq: *crazy Yardanico: @Araq also by the way, is there a way to make arc work with os:standalone, for example for nimkernel? Yardanico: Last time I tried I got an error "system module needs: nimErrorFlag" because if os:standalone, system module includes system/embedded which doesn't contain that pigmej: Heya pigmej: Anyone have idea how to fix `CANNOT LINK EXECUTABLE "./hello": library "libc++_shared.so" not found` on Android? That's how it was compilled: https://gist.github.com/pigmej/4d52250b65c9d4c4d5cee3dcefb80b74 + dockcross with android-arm64 Araq: yardanico: use --os:any --gc:arc for kernel development pigmej: ok the solution is to add `-static-libstdc++` to the scripts pigmej: now `could not load: libpcre.so(.3|.1|)` hmm Yardanico: you need pcre for nim's "re" and "nre" modules to work pigmej: yeah the question how to ship it to ndk... dom96: this is why I avoid dependencies at all costs Yardanico: try https://github.com/genotrance/nimpcre dom96: you may have better luck using nim-regex dom96: (regex implemented in Nim) dom96: or just not use regex at all :) pigmej: sadly I have to for that binary ;) pigmej: @Yardanico will check maybe that will help Bennyelg: I want to return a list of students data ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Since I have seq of JsonNode Im getting the @ thing [https://gitter.im/nim-lang/Nim?at=5eabf97b22f9c45c2a624eae] Bennyelg: how do I get rid of it Yardanico: wdym "get rid of it"? where is that string from? Bennyelg: its list of strings Bennyelg: as you can see or JsonNode Bennyelg: for that matter Bennyelg: Managed doing this: $(%*{"Students": studentsJsons}) pigmej: crap pigmej: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eabfb0f7975db7ebfd9c040] pigmej: will have to dig deeper ;/ Yardanico: are you sure you read the readme correctly? Yardanico: I think I'm close to compiling JackOS (seems to be a fork of nimkernel with some code updated) with arc and --os:any Yardanico: had to do a few quick one or two-line changes in some files like excpt.nim or mmdisp.nim, also had to discover flags like nimNoLibc, StandaloneHeapSize, noSignalHandler Yardanico: now it fails on the linking step because for some reason it can't find nim procs defined (and declared) in one c file and used in another c file pigmej: @Yardanico yeah I have set `-d:usePcreHeader` Yardanico: huh seems like all symbols are defined with ".hidden" because of PRs which made all symbols private :P pigmej: ;D Yardanico: pigmej I honestly don't know much about pcre, you can try https://github.com/nitely/nim-regex Yardanico: it's a pure-nim regex lib, mostly compatible with pcre with a few exceptions Yardanico: https://nitely.github.io/nim-regex/regex.html for docs Yardanico: well at last I managed to do it Yardanico: although seems like not really, it seems to crash when trying to do stuff with strings, maybe I didn't fix undefined references properly federico3: Araq: thanks. Unfortunately we don't seem to have html escaping in stdlib or jester... Yardanico: seems like it crashes on var c = @[1, 2, 3], hmmm Yardanico: now how do I debug a kernel :DD Yardanico: at least I god COM1 hooked up so I can use good ol' echo debugging, although the kernel is a bit more unforgiving bedwardly-down: What’s this about the kernel? I’d be intrigued on what you figure out with it Yardanico: https://github.com/watzon/JackOS is a fork of https://github.com/dom96/nimkernel and I'm trying to make it work with --os:any and --gc:arc Yardanico: so you could have strings and sequences and ref types in the kernel :DDDD bedwardly-down: 👀 Yardanico: managed by a not-so-much-a-GC Recruit_main707: if its a kernel, why os:any? Yardanico: because os:any is better to use than os:standalone for most cases Yardanico: including kernel Yardanico: wow so I actually can catch exceptions in kernel code Yardanico: that works Yardanico: albeit that worked without gc:arc with nimkerne ltoo Recruit_main707: and they say rust is the best for embeded devices Yardanico: good luck porting LLVM to your obscure microcontroller which only has some GCC cross-compile toolchain from 2015 ;) bedwardly-down: Would test building it with clang have value to your endeavors? Yardanico: honestly I'm not experienced in osdev at all, I'm just tinkering around trying to glue things together :D Yardanico: there's https://wiki.osdev.org/LLVM_Cross-Compiler Yardanico: and maybe I should try clang bedwardly-down: Oh, definitely. There's also this if you wanna try to cross compile for Windows: https://github.com/mstorsjo/llvm-mingw bedwardly-down: Despite it not being useful in kernel development, who knows bedwardly-down: Also, is this only specific to 32 bit or has anyone tried to compile for a 64 bit arch? Yardanico: nimkernel is 32-bit only Yardanico: 64-bit is a bit more complicated Yardanico: https://wiki.osdev.org/Creating_a_64-bit_kernel bedwardly-down: Thanks. reading the config file Yardanico: well not that much really bedwardly-down: I'm assuming that nimkernel's main focus was embedded systems and whatnot? Yardanico: it was to show that nim can be used to create a kernel :) bedwardly-down: Nice. Let me drag another person in here because I think he would get a kick out of this. Brb bedwardly-down: Time to RTFM. I'm getting make errors right of the bat about non existent thing a ma bobs Yardanico: well I don't think you'll be able to build JackOS as-is Yardanico: it for some reason has --gc:arc in nim.cfg but it doesn't really work with that bedwardly-down: Sweet. The original dev was on Arch Linux, so we know it at lwast was tested on something sane. /s 😛 bedwardly-down: Is #offtopic not tied to the gitter also? Yardanico: it is tied bedwardly-down: Gotya bedwardly-down: What version of nim are you running? I'm about to hop on stable. The compiler is telling me that nimerrormodule is missing Yardanico: yeah as I said JackOS doesn't really compile with --gc:arc Yardanico: you need --os:any to compile with --gc:arc Yardanico: (at least) Yardanico: and in JackOS you need to change more things Yardanico: I kinda fixed it but the kernel simply crashes when I try to create a seq, I already created a fork though bedwardly-down: Gotya. Your username the same? Yardanico: yes Yardanico: but you also need to patch some stuff in nim system module files :P bedwardly-down: Fuuuuuu... I mean, I need coffee. Bring it on!!!! bedwardly-down: And easy enough, you are the only fork of it period bedwardly-down: So, now I fork thee. 😛 bedwardly-down: Why is i686-elf-gcc being used? Yardanico: because it's a cross-compiler for 32-bit freestanding Yardanico: hence no "gnu" in name bedwardly-down: Ah. I thought Santa was in the house, yo bedwardly-down: I always thought elf was primarily for embedded systems. Interesting bedwardly-down: That's also the bare amount I've done cross-compiling for and that was way too long ago bedwardly-down: I'm about to start seeing about setting up an i686-elf-clang compiler to see what that says. Clang usually has better error messages for these kinds of things Yardanico: well I don't really know now :) Yardanico: but I pushed a new commit with some notes bedwardly-down: Checking into that bedwardly-down: *honestly doesn't want to use aur for getting the cross-compiler setup if he can avoid it* AUR isn't the worst thing but I don't like it when it breaks my system. Ha bedwardly-down: Think Arch version of Ubuntu Yardanico: you don't need aur Yardanico: ah right you do bedwardly-down: You build from source? Yardanico: actually nvm Yardanico: if you don't want to build from source, you can add chaotic-aur unofficial arch repo Yardanico: i686-elf-gcc is there bedwardly-down: I'll build from source. 😛 bedwardly-down: Building isn't hard. It's just usually a bit more time consuming. 😄 bedwardly-down: So, is gcc hardcoded into JackOS or would I be able to just change that? bedwardly-down: Also, those notes are good. bedwardly-down: Actually, really good. 😄 Yardanico: well they all can be fixed with PRs to Nim itself, although they need to be done more properly bedwardly-down: But there's no real point in them right now until you can actually justify them with building this. That sound about right? Yardanico: yeah Yardanico: kinda :P bung87: is there alternative `windres` on macos? Yardanico: you want to have a macos app with icon? Yardanico: then you'll have to create a proper macos app :P Yardanico: see https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1 Yardanico: oh sorry that's for ios bung87: no , on macos for win Yardanico: hm bedwardly-down: You're wanting to cross-compile from mac to win, bung? bung87: i searched using bing and github Yardanico: it might be available with mingw bedwardly-down: Bung, did you see the link I posted earlier about clang-mingw? bung87: I saw the mingw offical site, macos doesnot contains windres, federico3: now that type hinting is becoming more common in Python, a good py2nim translator could be doable bung87: I have not seen bedwardly-down: https://github.com/mstorsjo/llvm-mingw bedwardly-down: I don't know if that'd be useful to you, but it does build and at least works on Linux bung87: wow , it has a llvm-windres could be used bung87: https://github.com/mstorsjo/llvm-mingw/blob/master/wrappers/windres-wrapper.c#L79 Yardanico: ok bedwardly-down: 😄 Yardanico: apparently I'm getting a triple fault Yardanico: "On the x86 computer architecture, a triple fault is a special kind of exception generated by the CPU when an exception occurs while the CPU is trying to invoke the double fault exception handler, which itself handles exceptions occurring while trying to invoke a regular exception handler." Yardanico: wtf bedwardly-down: Damn. Even though I changed the compiler settings to clang in the config, it's begging for i686-elf-gcc Yardanico: it's not that simple bedwardly-down: Did you change it elsewhere that I missed? Yardanico: and you need to change it in Makefile bedwardly-down: Gotya alehander92: Yardanico awesome alehander92: i just wanted to study / work on my toy kernel alehander92: oh yeah this happens often! alehander92: the triple fault thing Yardanico: well how do I debug it? :D alehander92: basically there is alehander92: one other nim kernel which does the interrupt things ok and it worked alehander92: but it uses the GPL3 License Yardanico: https://github.com/samanthadoran/Mero ? alehander92: https://github.com/samanthadoran/Mero Yardanico: hah alehander92: yeaa, i actually mailed the woman who wrote it alehander92: because it didnt have a license file before iirc alehander92: she seemed pretty welcoming alehander92: so afaik she studied from osdev etc and based it on it alehander92: and i managed to integrate it in my one alehander92: but now i decided to do it myself alehander92: and dont use so much of others code bedwardly-down: bung87, got any tips on how to get this to compile with Clang? My version installed should cross compile with no issues, just changing compiler in both the config and Makefile here isn't allowing me to use Clang still. alehander92: but if you're mostly interested in the language in the toy alehander92: kernel alehander92: you can run it without all that stuff? Yardanico: ? alehander92: you can just start it similarly to dom96's one Yardanico: well the point is that I want to make it work with --os:any --gc:arc alehander92: okkk alehander92: yes i think i did alehander92: you know what Yardanico: and it actually compiles after commenting some stuff Yardanico: but does a triple fault when I try to create a seq alehander92: i planned on streaming a bit of my playing/studying with it Yardanico: at runtime alehander92: i can try to see if it really works on my setup bedwardly-down: Outside of building custom linux kernels, this is brand new to me bung87: @bedwardly-down yeah , please I have not install it for now, any thing I should noticed? Yardanico: also exception handling with arc works (I mean it worked with old nimkernel too) Yardanico: although getStackTrace() causes the kernel to crash too (getCurrentExceptionMsg works) bedwardly-down: I'm new to nim and, so far, @bung87, it's wanting the gcc cross-compiler that Yar here is using Yardanico: as I said you can use chaotic-aur unofficial arch repo so you don't have to compile yourself Yardanico: or install from AUR with compilation from source :P alehander92: Yardanico i manged alehander92: to build gcc binutils alehander92: i think Yardanico: well it's not an issue for me really alehander92: and i planned to use their cross compiler Yardanico: oh wait there's also https://github.com/pascalmouret/assyria Yardanico: MIT alehander92: yeah but "current goals" alehander92: are similar to ours now :P Yardanico: uh Yardanico: https://github.com/mikra01/nimkernel_ext Yardanico: MIT Yardanico: "basic gdt/idt/pic init" alehander92: ok alehander92: Yardanico i planned alehander92: to alehander92: refactor those to simple package alehander92: so one can add `x86` or `gdt_etc` or something like that bung87: @bedwardly-down that's fine, I will spawn process wait and pass to nim c alehander92: in his package alehander92: and directly start working on top of that alehander92: because i saw that people did something like that in rust alehander92: something like https://docs.rs/x86_64/0.10.1/x86_64/ Yardanico: huh bedwardly-down: I'm getting somewhere here alehander92: but maybe just for x86 bung87: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eac1d960b23797ec056b31a] alehander92: Yardanico but again, this shouldn't be needed to just see if sequences work bedwardly-down: Comments require space or they are ignored? alehander92: they *should* work Yardanico: yeah right bung87: I was trying to do this, then I realise mingw-64 does not contain windres alehander92: i managed to run with `--gc:newruntime` or something like that before alehander92: iirc alehander92: but it was harder Yardanico: well they seem to work with --gc:none --exceptions:goto :P Yardanico: but it crashes later anyway alehander92: but how does it crash Yardanico: on trying to convert an int to a string and concat with another strng Yardanico: well kinda like a reboot alehander92: oooh alehander92: yeah those invoke some internal stuff alehander92: so IIRC alehander92: i needed to also provide a libc.c file alehander92: and link it with my nim produced c files Yardanico: well I did --define:nimNoLibc Yardanico: and yes that works alehander92: hm, but what does it invoke then Yardanico: for wat? alehander92: for allocation etc alehander92: it has to somehow get memory Yardanico: functions implemented in nim itself :P alehander92: but they have to call something Yardanico: yes Yardanico: they are implemented in nim itself Yardanico: if useLibC is false alehander92: but what do they do Yardanico: https://github.com/nim-lang/nim/blob/devel/lib/system/memory.nim alehander92: they dont just go "lets return a random pointer" alehander92: hm yeah, but i wonder alehander92: about alloc Yardanico: ah about alloc Yardanico: it's in osalloc.nim alehander92: huh but that is good yeah Yardanico: https://github.com/nim-lang/nim/blob/devel/lib/system/osalloc.nim#L277 Amun_Ra: are items in seq contiguous? Yardanico: if you pass -d:StandaloneHeapSize:1234 it'll compile this block Yardanico: maybe that's why it's failing for me though Yardanico: maybe I've passed an invalid size or something Amun_Ra: hmm, it seems not alehander92: ohhh alehander92: yeah i think i changed that in my nim! Yardanico: really? alehander92: to 1 ? or something alehander92: yeah i just patched it Yardanico: changed what exactly? :P alehander92: wow alehander92: i think i made my own global pointer alehander92: ok alehander92: good stuff alehander92: so then i am not sure what happens alehander92: how much is PageSize ? Yardanico: seems to be 4096 actually Yardanico: PageShift = when defined(cpu16): 8 else: 12 and PageSize = 1 shl PageShift Yardanico: !eval echo 1 shl 12 NimBot: 4096 alehander92: that is not much at all Yardanico: so it's 4mb alehander92: no i mean it is Yardanico: well I passed 16384 :P bedwardly-down: I'm building the your gcc compiler from source. I will stand firm and not touch that aur with a 10 foot pole. 😛 alehander92: ok so you can alehander92: gdb it i alehander92: awesome Yardanico: also I have serial hooked up and I made a simple debug template to understand where the code stops working :P alehander92: https://wiki.osdev.org/Kernel_Debugging alehander92: look at gdb alehander92: ah ok alehander92: are you running it on hardware Amun_Ra: hmm, it seems seqs are contiguous after all, it's just addr s works when s in an array, it should be addr s[0] for seqs Yardanico: qemu alehander92: is there a way Yardanico: well seems like it can actually allocate ref objects at runtime alehander92: to somehow log something Yardanico: I just tried creating a ref object alehander92: yeah it should alehander92: coming it 5 min Araq: Amun_Ra, they are continguous bedwardly-down: Chaotic-AUR was super easy to setup. Thanks... bedwardly-down: Let's see if I can help figure this out Yardanico: Araq: so about --os:any --gc:arc - there are two places in mmdisp and one in excpt.nim which require IO Yardanico: mmdisp.nim 65 and 66 (quit isn't there on --os:any either I guess) and excpt.nim 45 Yardanico: "Your platform should support only some basic ANSI C library stdlib and stdio functions which should be available on almost any platform." ah right bedwardly-down: I'm getting a stdio.h header missing error Yardanico: check my notes Yardanico: you should do all 4 patches :P Yardanico: so I guess with --os:any I'll either have to patch these places or then properly provide an alternative for stdlib.h and stdio.h (even if just stubs) bedwardly-down: I didn't pull them in Yardanico: i mean in the notes bedwardly-down: In the notes in the repo, right? Yardanico: yes Yardanico: at the bottom of readme bedwardly-down: I'm guessing these changes are for the actual language and not the kernel? Yardanico: yep Yardanico: nimfolder is where your nim source folder is located bedwardly-down: Ok, so I need to download the repo itself bedwardly-down: I don't have the source, just the binaries Yardanico: well you have the "source" Yardanico: you always have it Yardanico: since stdlib modules are just .nim files Yardanico: same for system bedwardly-down: I don't know what that means Yardanico: well how did you install nim? bedwardly-down: Gotya. Misread part of that bedwardly-down: Choosenim Yardanico: then these files will be somewhere in ~/.choosenim/toolchains/nim-ver/ Yardanico: ver is the version you've installed bedwardly-down: Gotya. I was looking in the wrong folder bedwardly-down: Are you on head or devel, yarn? I have stable and both of those and want to test on same branch bedwardly-down: or version, I mean Yardanico: well I'm on devel Yardanico: but there isn't really much to test bedwardly-down: So, nim isn't a bleeding edge breaks everything kind of language? zacharycarter: why does choosenim have so many tendrils into my machine and why is not removing ~/.choosenim from my system enough zacharycarter: now any time I try to install a nimble package I get an error about choosenim Yardanico: !bedwardly-down nim is over 1.x already Yardanico: 1.0 i mean bedwardly-down: I'm used to different languages having the master branch be incompatible with stable, so 😛 dom96: zacharycarter, what errors are you getting? dom96: there are only two places that choosenim touches: ~/.choosenim and ~/.nimble/bin zacharycarter: yeah I've removed both of those zacharycarter: but - Error: getAppFilename failed. (Error was: Unable to read /Users/zacharycarter/.choosenim/current. (Error was: No installation has been chosen. (File missing: /Users/zacharycarter/.choosenim/current))) dom96: running what? `nimble` or `nim`? zacharycarter: nimble install nimterop dom96: which nimble zacharycarter: maybe it's the nimble that was installed with choosenim? zacharycarter: I can't even run nimble -v now dom96: did you copy it? zacharycarter: no - let me just try removing nimble and installing it with ./koch tools dom96: well, where is it then? zacharycarter: oh okay - if I remove ~/.nimble I stop getting that error message dom96: you say you've removed ~/.nimble/bin dom96: but yeah, you haven't :) zacharycarter: no I just removed choosenim from there zacharycarter: not nimble itself zacharycarter: but now I have :) dom96: yes, choosenim puts binaries there zacharycarter: ah okay - thanks for the help and explanation :) kaushalmodi: At work, I deploy nim by simply untarring the nim release tarball: http://ix.io/2kiD/sh zacharycarter: well I liked choosenim but I wanted to install a specific branch of the Nim repo and I couldn't figure out how Zed: has anybody done intense numerical computing with nim? zacharycarter: yes zacharycarter: but I don't know what you consider intense numerical computing? dom96: zacharycarter, choosenim #branch_name zacharycarter: hmm I tried that but couldn't get it working zacharycarter: I tried wrapping #branch_name in double quotes as well dom96: it should work, bug report? :) zacharycarter: sure - I will try to reproduce Zed: large machine learning datasets zacharycarter: Zed: maybe check out arraymancer and nimdata and numforge/laser bedwardly-down: Yar, I think there's a slight typo in your notes. Line 45 of excpt.nim is not the same zacharycarter: there are several folks in the data-science / ML space using Nim mratsim would be a great resource to ask questions like this to Yardanico: system/excpt.nim:45 ? bedwardly-down: I did find multiple showErrorMessages, though bedwardly-down: Yup Yardanico: I just checked and it is Yardanico: you just need to replace the one on line 45 Zed: thanks zac!! Yardanico: with "discard" zacharycarter: Zed: np Yardanico: no need to touch others bedwardly-down: Let me look at it again because I found a different line altogether bedwardly-down: `writeToStdErr(data)` Yardanico: ah right bedwardly-down: That's what's showing on line 45 Yardanico: replace that bedwardly-down: Gotya. You put the wrong info in notes. Yardanico: as I said thought it doesn't really work now Yardanico: you'll simply get a kernel which reboots after writing some stuff to the serial zacharycarter: dom96: it worked :) I think last night I was trying choosenim install but `choosenim "#branch_name"` works zacharycarter: user error bedwardly-down: Not quite. I gotta add some extra software to finish building dom96: zacharycarter, feel free to make an issue to improve the error message when trying `install` zacharycarter: will do bedwardly-down: So running jackos.bin is giving a SIGSERVER Address Boundary Error, right? bedwardly-down: And that's also the tiniest kernel I've seen. 112kb? O.o zacharycarter: oooo people are writing kernels in Nim atm? bedwardly-down: Wanna join the fun? bedwardly-down: https://github.com/Yardanico/JackOS Yardanico: there's no fun until it works with --gc:arc properly :P Yardanico: @bedwardly-dow umm no? Yardanico: you're supposed to do "make build" and then "make run" Yardanico: and it'll run with eqmu dawkot: Would appreciate if someone who knows how VSCode extensions work would take a look at this: https://github.com/pragmagic/vscode-nim/pull/159 Yardanico: "make build" is supposed to make an .iso alehander92: :) alehander92: Yardanico bedwardly-down: I forgot to do make run. 😛 Yardanico: @alehander92 ? alehander92: i'll try to run now mine bedwardly-down: I'm getting coffee alehander92: did you guys make it work Yardanico: well no :D alehander92: oh praise God what a day is today alehander92: we got an earthquake alehander92: and then an amazing afternoon zacharycarter: so can all these updates just go back into nimkernel? alehander92: i really felt this 5.0 Yardanico: zacharycarter: if they're stable enough, maybe I'll try alehander92: Yardanico my goal was Yardanico: but https://github.com/watzon/JackOS itself is a fork of nimkernel zacharycarter: lol yeah - but I wonder why alehander92: to eventually add `async` / `await` Yardanico: wow alehander92: to the toy kernel Yardanico: lool zacharycarter: if all he did was bring it up to date with the current Nim and add a makefile Yardanico: imagine a kernel with async alehander92: like a form of cooperative multitasking alehander92: yeah thats my idea alehander92: it seems not hard alehander92: basically the idea is to get the interrupts / setup to the point where one can alehander92: when i think about it you dont even really need this actually dom96: You guys are making me tempted to live stream updating nimkernel alehander92: i am going to live stream working on my kernel zacharycarter: you should Yardanico: dom96: well it's not that hard :P but I hope we can make it work with --gc:arc --os:any Yardanico: that'll be amazing Yardanico: strings/seqs/etc alehander92: but we can just all fix the same kernel :D alehander92: dom96 go go Araq: Yardanico, well you need the heap emulation but then it shouldn't be a problem Yardanico: i mean it already boots with --os:any --gc:arc but seqs don't work, or stack traces alehander92: hmm Yardanico: Araq: is it correct that I should be setting StandaloneHeapSize for --os:any ? Araq: yeah but maybe more is required dom96: Yardanico, yes, well, in that case I might add some more features :P Yardanico: dom96: well I already added serial writing, it's really easy Araq: it's only viable for a toy OS, in a real OS you should have kalloc/malloc offered by your kernel bedwardly-down: We have something bedwardly-down: https://cdn.discordapp.com/attachments/371759389889003532/705778580365246544/20200501_08h52m07s_grim.png Yardanico: yeah check serial.log alehander92: @dom96 do it! Yardanico: or you can just remove all lines in main which start/or are in the "debug" block alehander92: my plan was to basically simulate a process system Yardanico: so it's let attr = stuff, and then writeString ... alehander92: using nim functions as processes ⏎ ⏎ ``` async/await + cancellation for multitasking``` [https://gitter.im/nim-lang/Nim?at=5eac29d79ac8ce14a5944013] alehander92: and their types for protecting access to data structures/filesystem disruptek: balls. bedwardly-down: I have a blank serial.log. O.o alehander92: so e.g. you do stuff like let res = await fs.write(myPath, structuredObject) alehander92: and e.g. all stuff in the filesystem is just structured values (and maybe strings/binary as a subcase) bedwardly-down: Toy kernels a common thing for you guys? I didn't even know those were a thing Yardanico: not really :D alehander92: no, it's all talk for me dom96: what I would love is write an OS for the RPI dom96: perfect way to run your toy kernel on real hardware Yardanico: blob:https://imgur.com/e8f6c72d-6af9-414c-8b04-3be994ced124 Yardanico: dom96: https://github.com/andrewrk/clashos :D although it only shows hello world alehander92: @dom96 the cool thing is you can write a custom macro async which generates alehander92: cooperative switching between the os tasks Yardanico: but zig's author made a cool post about adding stack trace support for barebones target alehander92: i saw it in rust alehander92: and i wanted to play with that since that alehander92: https://os.phil-opp.com/async-await/#cooperative-multitasking-1 bedwardly-down: Honestly, I think this is cool as hell Yardanico: https://i.imgur.com/ObUQPNV.png i meant bedwardly-down: I'm learning a game framework that is built around the structure of a kernel Yardanico: the era has ended... https://github.com/nim-lang/Nim/commit/9c33bcac5c73f8188e1c017ba8b2a14db5d5a4fe Araq: if you want to write kernels, figure out how to steal drivers from Linux's codebase. or maybe from BSD to avoid Linux's viral license Yardanico: well I don't really want to since I have far less experience than required for proper kernels and OSes :D Araq: the drivers are everything, everybody can code an O(1) scheduler based on linked lists, it's not hard, you don't write it in C and then it's easy enough :P dom96: if you want to be practical then your best bet is to write on top of Linux or BSD Yardanico: yeah i guess so Yardanico: FreeBSD steals drivers from Linux though :D bedwardly-down: I wonder if using Callistios would be a good place to learn too. You know that project? Araq: or steal code from the unikernel projects dom96: The evidence that it works is out there, AFAIK PS4 OS is based on BSD Yardanico: yeah Araq: yup, it is Yardanico: "The native operating system of the PlayStation 4 is Orbis OS, which is a fork of FreeBSD version 9.0 which was released on 12 January 2012." bedwardly-down: KallistiOS is a Dreamcast OS bedwardly-down: Wait, what? PS4 uses that? Araq: PS4 is based on BSD, yeah alehander92: Araq the funny thing is to write some very custom alehander92: stuff Yardanico: btw echo "hello world" with -d:danger --gc:arc --os:any -d:StandaloneHeapSize:4096 --opt:size and static linking with musl (and stripping) produces a 20kb binary Yardanico: while it's not that low, it still allows for all your usual seqs and stuff unlike gc:none Yardanico: ah also --panics:on Araq: Yardanico, also use -d:noSignalHandler --panics:on Yardanico: with no signal handlers it's 17.7kb :P Yardanico: fully static Yardanico: and yes I'm using zig to cross-compile for x86_64-linux-musl bedwardly-down: I haven't tried musl for anything. How is it? disruptek: like compromising with wayland... but on steroids. Yardanico: yeah musl is usually used when you want static binaries :P bedwardly-down: I just set up Wayland out of fear and anxiety this morning. Haha Yardanico: or when you have limited memory I guess disruptek: that's why i used it as an example. alehander92: Yardanico wow you do use zig Yardanico: yes it actually works for cross compiling stuff Araq: I'd write my own libc in Nim but I can't be bothered bedwardly-down: I use ED to write code in, so that's just as nuts I would think Yardanico: it's just clang with headers for different libcs and with musl sources :P alehander92: btw guys alehander92: how do you pass a custom c compiler alehander92: to nim Araq: in fact, Nim doesn't use much out of libc anyway Yardanico: @alehander92 if it's compatible with gcc/clang, then you just do stuff like gcc.exe.path Araq: alehander92: --gcc.exe=blah alehander92: writing a minimal libc is not too hard i think Yardanico: or clang.exe.path alehander92: ahh thanks! Yardanico: or just port musl to Nim :P Yardanico: it's MIT bedwardly-down: Thanks, Yar Araq: yeah but musl probably uses 1000 lines of code to figure out which integer type to typedef dom96: Araq, sounds fun. You should post a call for action. I've seen lots of people writing libc implementations for fun Yardanico: im actually curious how big musl is hmm disruptek: i wrote a package manager for fun. disruptek: oh wait, no. alehander92: musl was a *lot* of work alehander92: afaik Yardanico: cloc says it's 50k of C and 30k of C headers (with 6k assembly), and that's ofc excluding comments/blank lines bedwardly-down: I wonder how musl compares to eglibc and dietc? alehander92: for a custom kernel i'd love to just see random designs alehander92: different syscall schemes and all of that sealmove: guys, what's the best way to debug right now? alehander92: no hw memory protection sealmove: i remember krux have done some work on debugging cli interface? bedwardly-down: Got a good place to start on learning how to do kernel stuff like this more often? I didn't do anything but go through the build steps, but this is definitely my jam Araq: when you write a kernel, you get to decide the syscall scheme... Yardanico: https://wiki.osdev.org alehander92: Araq yeah exactly alehander92: what i mean is alehander92: that people love to do linux again Araq: look, libc works on top of an OS, but you're writing an OS... alehander92: whic is great alehander92: yeah, thats my point bedwardly-down: And much of the os is dependent on libc, right? Yardanico: well indirectly Araq: good, so write some assembler already. seriously alehander92: i am trying to get my nim to compile :D Araq: you don't need muslimC's Linux specific syscall code Yardanico: XDD Yardanico: just need to write a macro so we can write safe assembly bedwardly-down: Bwahahaha alehander92: good idea! alehander92: yardanico my plan was to alehander92: not turn on memory protection and to somehow detect all that stuff on compile time :D bedwardly-down: And I need to actually learn how to use nim alehander92: when i think about it bedwardly-down: I just joined here half asleep last night after work alehander92: i can use z3 Araq: in fact, also don't use the freaking "GNU assembler", get a real one alehander92: to detect that ranges are not entered into bedwardly-down: What is a real assembler, then? alehander92: but this doesnt seem to make sense now in my head bedwardly-down: I don't know much about assemblers and have only used the clang and gnu ones Yardanico: when people have too much time they write forums in assembly alehander92: hm, i dont have stdint.h Yardanico: (https://asm32.info/fossil/repo/asmbb/index and https://board.asm32.info/ for live instance) bedwardly-down: Also, +1 for fossil link. 😄 Yardanico: but wait isn't it better than nimforum /s Yardanico: it has TAGS bedwardly-down: Ummmm.... What? Yardanico: although nimforum had merged categories already, just didn't update the live instance bedwardly-down: Why do that? bedwardly-down: Why make a forum in assembly language? alehander92: dude Yardanico: why not? :D that's how these questions are answerred alehander92: my stdint.h alehander92: includes with include_next stdint.h Yardanico: lol alehander92: what does this mean Yardanico: and this forum is actually pretty small and light Yardanico: although I wouldn't write in assembly :P bedwardly-down: Would you do it in Nim? Yardanico: of course, if i had do :P Yardanico: to* alehander92: oh i forgot to pass -ffreestanding alehander92: Yardanico alehander92: nostdlib Yardanico: yes? alehander92: how to nim alehander92: no stdlib alehander92: :D :D D: alehander92: i cant seem to pass it Yardanico: uhh alehander92: either with `-d` or the other Yardanico: --passC Yardanico: or/and --passL alehander92: but it generates alehander92: include in the nim source alehander92: i thought nim itself should not generate it Yardanico: ah right Yardanico: I just have an empty stdlib.h :DDDDDD Yardanico: https://github.com/Yardanico/JackOS/blob/master/kernel/stdlib.h Yardanico: just add an empty stdlib.h in your include path alehander92: smart! Yardanico: don't forget -d:nimNoLIbc and -d:noSignalHandler bedwardly-down: Holy hell!!! The first tutorial compiling and running is kind of satisfying alehander92: oh man i had this bedwardly-down: The output here is nice alehander92: even with some files! alehander92: some files alehander92: i forgot alehander92: Araq can i pas ld.exe bedwardly-down: Hello bedwardly-down: With my current setup, this is much easier than using Discord for chat here sealmove: Is there a way to simulate "any" type for an object's field? sealmove: I mean for runtime alehander92: variants or generics or ptr/RootObject ref if its ref alehander92: ? sealmove: generics don't work in this context sealmove: I want something similar to Java's `Object` type alehander92: but can you have stuff like alehander92: ints and other basic values alehander92: inside? alehander92: brandon hello! bedwardly-down: :hello: sealmove: @alehander92 not sure, probably only need objects. sealmove: yes, only need objects sealmove: actually the correct implementation is object variants... bedwardly-down: Think figuring out how to port a common library I use to Nim would be a good way to figure out its workings? alehander92: Yardanico hm, sorry, i'll look into your impl :D alehander92: i cant find out why alehander92: nim generates free/calloc/signal kaushalmodi: @bedwardly-down When I started with nim, I started using it a bash script replacement, then a Makefile replacement, then perl/python replacement, and now it's doing things for me that none of those can bedwardly-down: So, you used it as a scripting language more than anything else, right? alehander92: oh i didnt need! alehander92: i defined them . alehander92: but now my qemu just fails zacharycarter: I was going to stream some game dev stuff - but I can't get OBS to display my full terminal window alehander92: ah, ran with wrong arch and without -kernel invalid kernel header zacharycarter: so I gave up :/ alehander92: oh no zachary alehander92: cant you somehow resize it zacharycarter: I have a meeting in 11 minutes - I'll try again after that alehander92: or reset settings alehander92: ok zacharycarter: I tried! I set it to 2880 x 1800 and downsampled to like 1280x720 but some was still cut off alehander92: hmm alehander92: no idea alehander92: it just works iirc with mine bedwardly-down: How does nim handle package and file structures? zacharycarter: what do you mean bedwardly-down: Example: `import hxmath.math.Vec2` is a lib file from the hxmath package in Haxe Yardanico: https://nim-lang.org/docs/manual.html#modules-import-statement and down Yardanico: (and below) bedwardly-down: That reads file structure wise as `hxmath/math/Vec2.hx` Yardanico: in nim you do import a/b/c zacharycarter: yeah nim doesn't have packages zacharycarter: it's not Java / C# / Haxe codic: now I can re-ask my question! codic: For the nimcache directory for my project I have these files: codic: `hw.json '@mhw.nim.c' '@mhw.nim.c.o' stdlib_io.nim.c stdlib_io.nim.c.o stdlib_system.nim.c stdlib_system.nim.c.o` codic: but can't file the main flie I should be looking at bedwardly-down: Codic, my fellow Fishy user!!! :D zacharycarter: you put things in modules and then import the modules and Nim handles only importing what is necessary when it compiels to C Yardanico: @codic what's your main nim file called? bedwardly-down: Thanks @zacharycarter zacharycarter: it's '@mhw.nim.c zacharycarter: np Yardanico: if it's hw.nim, then you should look into @mhw.nim.c Yardanico: @m is just a prefix codic: ah ok. codic: Thanks zacharycarter: the .o files are object files zacharycarter: from the C/C++ compiler zacharycarter: or Obj-C I guess bedwardly-down: I'm not a C/C++ dev, so that's pretty new to me codic: Aw, I can't use `Ctrl R` to search history bedwardly-down: I kind of skipped them zacharycarter: getting comfortable with C/C++ will certainly help you with Nim development zacharycarter: but of course it's not a requirement codic: Damn, this C seems to require the nimbase header zacharycarter: actually Nim helped me become much more comfortable with reading C/C++ - I'm still not practiced enough at writing either zacharycarter: and things like move semantics still elude me codic: > `#include "nimbase.h"` codic: Yeha, nim is pretty similar to c and all conceptually bedwardly-down: I'm reading a library that I want to use the source for and include uses Linux FS structure for module imports. Nice Yardanico: Don't use include generally though Yardanico: Most of the time you want import bedwardly-down: I see that nim has pointers too bedwardly-down: And Inline? That might make this port easier alehander92: Yardanico i managed to start zacharycarter: Nim has managed and unmanaged pointers zacharycarter: and yes it can inline procedures via the `{.inline.}` pragma alehander92: but the console output is just not there alehander92: how do you setup the serial Yardanico: com.nim Yardanico: It uses two procs from io.nim Yardanico: Which are inline assembly codic: Where can i find the file nimbase.h? Yardanico: nimdir/lib/nimbase.h Yardanico: Also if you want to read the C file made from you nim file, compile with -d:danger so there's much less debug code around codic: alright, why is it called danger? codic: And where's nimdir? Yardanico: because -d:danger disables a lot of checks kaushalmodi: codic: Protip, navigate to https://github.com/nim-lang/Nim, hit the `t` key and type the file name alehander92: Yardanico ! Yardanico: nimdir is the directory where your nim resides alehander92: good advice kaushalmodi: On Emacs, I use the projectile package to quickly find any file in a repo alehander92: so hmmm alehander92: i have to see why my screen codic: ah codic: Wait, but I installed it with `sudo pacman -S nim` codic: probs /usr/share/nim or somethin codic: nope that only has `doc` Yardanico: Well search for it codic: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/nim codic: there codic: Got it zacharycarter: is it possible to nest tasks in a nimscript file? zacharycarter: or should I just turn one into a procedure? zacharycarter: I just turned it into a proc shashlick: You can kaushalmodi: > is it possible to nest tasks in a nimscript file? ⏎ ⏎ Yes shashlick: task abc => abcTask() zacharycarter: ah thanks kaushalmodi: If I have a task `foo` and I want to call in task `bar`, I called it using `selfExec("foo")` kaushalmodi: shashlick: ⏎ ⏎ > task abc => abcTask ⏎ ⏎ Oh, really? TIL :D [https://gitter.im/nim-lang/Nim?at=5eac3ddea9de3d01b1e0b73e] zacharycarter: works perfectly! thanks guys :D kaushalmodi: heh, so we have at least 2 ways of doing that kaushalmodi: shashlick: Where is that *abcTask* thing documented? shashlick: No idea, I saw that in the code kaushalmodi: yep, I just grepped for it ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5eac3ef797338850a2df67df] clyybber: uh, github is buggy again kaushalmodi: *oops copied code using the wrong binding* shashlick: @pigmej - re nimpcre shashlick: can you share the code you are using? disruptek: shashlick: do you have a 1.2 branch in your travis wrapper? does choosenim? disruptek: Araq: you knew this was coming... can we backport .nosinks. to 1.0 as a noop? shashlick: i cannot pick the branches, that has to be done in the yml file shashlick: choosenim's yml doesn't have 1.2 since it only builds with 1.0 right now shashlick: are you running into issues building choosenim on 1.2? disruptek: github requires arc, thus nimph requires arc. clyybber: disruptek: Yeah, we probably should Araq: disruptek, no but you can use Araq: when not defined(nimHasSinkInference): {.pragma nosinks.} alehander92: dom96 what would you want to add to nimkernel? alehander92: if I manage to port from tutorials all that gdt/idt stuff to a library, would you want to reuse it there? alehander92: i dont want to add stuff directly to nimkernel as i want different toy ones showcasing different stuff zacharycarter: https://www.twitch.tv/zachary_carter zacharycarter: stream is up zacharycarter: nevermind need to fix encoder settings disruptek: doh zacharycarter: obs was eating like 200% cpu zacharycarter: can you hear anything disruptek? disruptek: yeah, i'm just too lazy to type. 😁 Rika: Whatcha streamin zacharycarter: game development alehander92: okk Prestige: Nice, watching alehander92: i am going to stream after eating alehander92: is this vscode or vim Prestige: looks like kak leorize[m]: it's kakoune alehander92: oh nice alehander92: hm, tasks do look useful alehander92: i am a bit lazy alehander92: for them Prestige: havent tried kakoune, anyone have experience vs. vim? Prestige: zacharycarter: your mic is a tad quiet clyybber: I'm using kakoune alehander92: wow a dog alehander92: wooof woof , well not sure if i agree alehander92: a nice scene :D alehander92: https://www.twitch.tv/alehander42/ alehander92: ok i am going to stream a bit about learning osdev disruptek: sweet. Araq: alehander92: read your chat dom96: alehander42: dunno, maybe play around with implementing more things shashlick: Araq: is it fair to say that C identifiers with leading underscores should not be wrapped? shashlick: at least types Araq: why not? C is full of underscores shashlick: so its not C's hack for private names Araq: no, it's just usual C code shashlick: okay cool alehander92: what does cadey's vm do alehander92: disruptek Cadey: what did i do now alehander92: well alehander92: somebody told me something about a cadey vm Cadey: who is that someone lol disruptek: me alehander92: of course alehander92: basically alehander92: we were talking about something like interpreting nim Cadey: i made a VM? Cadey: did i get out of sync with time again Recruit_main707: `result[0..^2]` this gives me all the string except the last character right? narimiran: there's an easy way to find out ;) Recruit_main707: !eval echo("abcde"[0..^2]) NimBot: abcd jds_dizzy_: Anyone know how to add path options to vscode linter alehander92: awesome alehander92: string and seq-s work for me alehander92: Yardanico alehander92: in qemu with gc:arc bedwardly-down: Afternoon, all. You guys still trying to get the toy kernel to build properly? Recruit_main707: with arc and os:any iirc alehander92: it does for me alehander92: i streamed about it :D https://www.twitch.tv/videos/608175538 but its very chaotic brandon PMunch: Phew, spent almost all day setting up my new monitors :S Prestige: PMunch: What did you get? alehander92: i love light themes :D Recruit_main707: being Bytes of type []bytes in go: Recruit_main707: b.Bytes != nil Recruit_main707: how would this be done in nim?? PMunch: Prestige, nothing fancy, just some old monitors I had lying around. But they are a significant upgrade from my 1680x1050 monitors PMunch: These are 1920x1200 PMunch: But mostly it was because I just got a new graphics card, and it didn't have more than one DVI port, and my old screens only had DVI input PMunch: So I needed to switch in order to be able to connect all three monitors Prestige: Nice upgrade. I have another one coming in next week Prestige: PMunch: about nimlsp, would you have time to voice chat about it? Recruit_main707: (just in case someone was gonna answer me, it doesnt matter anymore) alehander92: Recruit Recruit_main707: ye? alehander92: is bytes a sequence Recruit_main707: in nim, yes alehander92: zacharycarter sorry for not watching/interrupting :( whats the basic plan for frag in the future Recruit_main707: but its really not necesary, dont worry :) alehander92: Recruit well whats the logical alehander92: yeah usually there is some sense to check eg empty PMunch: Prestige, sure russmack: Anyone had luck getting vim tagbar to work with nim? Prestige: PMunch: pm me whenever, I'm free through till Monday PMunch: We can do it right now Recruit_main707: i wonder... can you pm the gitterirc bot??? PMunch: Just give me a sec to make sure my mic is working properly Prestige: ah in a work call for about 50 more mins then I'm free, sorry alehander92: so alehander92: i want to generate asm alehander92: with a macro alehander92: and output a file as part of my build alehander92: do people do this alehander92: maybe i need to just write a normal program to do it alehander92: both seem good Recruit_main707: > do people do this Recruit_main707: only suicidal people probably alehander92: come on man its just a loop with some text :D alehander92: to generate stuff like https://github.com/cfenollosa/os-tutorial/blob/master/18-interrupts/cpu/interrupt.asm#L71 Recruit_main707: its just... what a dangerous sentence when programming :p Recruit_main707: you should try nevertheless PMunch: Prestige, no problem, my mic seems to be totally messed up ATM.. Prestige: Kk bedwardly-down: I saw there's a Twitch room for this gitter. Does that mean the language gets streamed on a regular basis? Recruit_main707: its starting to become a trend Recruit_main707: disruptek for instance usually streams while he codes disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek bedwardly-down: I haven't see mumble in forever. :O PMunch: Yeah there are a couple of people who stream from time to time bedwardly-down: I haven't streamed in forever but am looking to get back into that myself. Thanks. :D alehander92: wow i found a greatly expressed question about os multitasking on stack overflow alehander92: and who is the author? andrea ferretti alehander92: this man can right alehander92: write* alehander92: obviously i barely write write bedwardly-down: I joined disruptek's stream but can't do anything even after following him? O.o alehander92: you can watch! alehander92: do you want to talk on the strem? alehander92: you need to join mumble too Recruit_main707: nested is a keyword in nim?? Recruit_main707: `undeclared field: 'nested' for type system.int [declared in C:\Program Files\nim-1.2.0\lib\system\basic_types.nim(2, 3)]` Recruit_main707: nvm Recruit_main707: i didnt know you had to separate `using` args of normal ones with ; alehander92: oooh yeah alehander92: sorry alehander92: you know you can write alehander92: a, b: int alehander92: even if you dont use using? shashlick: wth is the intention of this code - https://github.com/lattera/glibc/blob/master/bits/confname.h#L24 shashlick: why an enum val - `_PC_LINK_MAX` and then a #define of the same PMunch: Prestige, here's what my new setup looks like: https://uploads.peterme.net/lowered.jpg https://uploads.peterme.net/raised.jpg Prestige: Nice! I could really use a third monitor at timeslol leorize: shashlick: welcome to the amazing world of glibc :P leorize: also that's not the up-to-date source PMunch: Prestige, I've got two spares now :P shashlick: yep, but at least i found a bug in nimterop Never Listen To Beef: Pmunch living life dangerously with that 3d printer at his feet PMunch: Haha, I don't run it under there PMunch: I pull it out when it's in use Never Listen To Beef: I can tell it's a shelf Never Listen To Beef: Never seen a floor shelf before though PMunch: A shelf? Recruit_main707: have i got it right? Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/705870765244809336/unknown.png Never Listen To Beef: You have stuff put on the build plate PMunch: Oh, that's just the cables and filament roller for the printer Never Listen To Beef: ah PMunch: I actually use it fairly often PMunch: The brown thing to the left of my computer is my shelf Never Listen To Beef: yea i was going to say i Never Listen To Beef: i'd bolt it to said brown thing Rika: @Recruit_main707 p.much yeah PMunch: The glory that is the shelf: https://uploads.peterme.net/openshelf.jpg PMunch: How would I bolt it to that? PMunch: And why? The whole point is for it to stay hidden while I'm not using it.. PMunch: Recruit_main707, you're kinda right, but it's a bit oddly worded Never Listen To Beef: idk im a clutz and would end up kicking that printer PMunch: Haha, I don't kick it that often Never Listen To Beef: But bolting wouldnt be hard roll that out drill a few holes then pass some bolts through PMunch: But where? On the top? Never Listen To Beef: yea Never Listen To Beef: Clearly not on the top of the roll out organizer since it doesnt have one 😛 PMunch: It's waaay to tall for that PMunch: And it wouldn't hide it at all :P Never Listen To Beef: Hiding stuff is for nerds, and we're waaay off nim 😄 PMunch: Being off-topic here is fine as long as no one wants to talk Nim :) Rika: f Rika: "who likes nim anyway smh smh" PMunch: Rika, huh? Rika: "no one wants to talk Nim" can be interpreted as "no one likes Nim" in a way PMunch: Oh, haha :P PMunch: brb PMunch: Damn it.. PMunch: After my jigging around with the computer I have this horrible base hum in my front mic.. PMunch: And I don't really know why.. Prestige: Hmm :/ Prestige: That's annoying PMunch: Sound card didn't fix it :P PMunch: Although I didn't do a lot of debugging with it PMunch: I discovered that I can connect the front microphone to it PMunch: But it didn't seem to have drivers.. bedwardly-down: Rika, that makes sense Rika: bedwardly-down what stefantalpalaru: Have you ever seen this statx.h CPP error when building Nim on Ubuntu 19.10? https://discordapp.com/channels/613988663034118151/616299964242460682/705880182124445697 bedwardly-down: `**** "no one wants to talk Nim" can be interpreted as "no one likes Nim" in a way` Rika Bennyelg: How can I do something like this: ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5eac8be57975db7ebfdb7f15] Bennyelg: type ⏎ ⏎ ```Result* = ref object ⏎ data*: any ⏎ message*: Option[string]``` [https://gitter.im/nim-lang/Nim?at=5eac8be59f0c955d7d9b8e71] Recruit_main707: any python users that can confirm me that ~ is just bitwise not and therefore == nim's not? Yardanico: in nim "not", "and" can be used for both booleans and bitwise operations Yardanico: also << and >> are shl and shr respectively Recruit_main707: so, yes? enthus1ast: @Bennyelg afaik this is not directly possible; you could consider Object variants or serialize the data zacharycarter: stream is back online: https://www.twitch.tv/zachary_carter enthus1ast: what are you building zacharycarter? zacharycarter: I'm working on a game engine zacharycarter: specically right now, hot reloading and plugins treeform: is the game engine in nim? zacharycarter: yes enthus1ast: considered entity component system? Recruit_main707: Pog zacharycarter: yeah I'll be doing one treeform: your microphone has static, like you are driving down the road. enthus1ast: i've build one 2 days ago :) disruptek: he's on mumble if you wanna chat. i'm watching his stream. treeform: mumble link? Yardanico: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) Yardanico: same as always treeform: I have connected I don't hear anything Yardanico: you sure? Yardanico: maybe you're deafened (I mean in mumble) Recruit_main707: `alignsize and size - 1` how does the compiler interpret this: Recruit_main707: `(alignsize and size) - 1` or `alignsize and (size - 1)` Recruit_main707: ? Yardanico: what are the types of alignsize, size? Recruit_main707: integrers Recruit_main707: integers* alehander92: yardanico Yardanico: ? alehander92: btw i think you dont need those changes Yardanico: why? alehander92: to sources in your kernel Yardanico: which ones? alehander92: because i managed to build mine without those Yardanico: ??? alehander92: the manual changes to nim sources alehander92: in the readme Yardanico: that doesn't work for me with --os:any --gc:arc Yardanico: without these changes alehander92: https://github.com/Yardanico/JackOS/#notes Yardanico: yes I understand Yardanico: it doesn't work for me without them on linux alehander92: do you pass all needed options alehander92: but it works for me hm Yardanico: see https://github.com/Yardanico/JackOS/blob/master/nim.cfg alehander92: wow so many alehander92: my approach is different Yardanico: well do you have source? :P alehander92: i do `nim c --os:any --gc:arc -d:danger --compileOnly:on -d:StandaloneHeapSize:4096 --exceptions:goto -d:nimNoLibc -d:nimNoSignalHandler --noMain --nimcache:build start.nim` Yardanico: --exceptions:goto is not needed here btw alehander92: and then just link separately Yardanico: --gc:arc defaults to goto anyway alehander92: and it works Yardanico: well I'm really not sure, maybe because jackos fork uses some strings and stuff alehander92: hm i dont use stackTrace and boundChecks alehander92: but i also usd strings and seq Yardanico: what about $ for ints? Yardanico: for me seqs don't work even without these stackTrace and boundChecks Yardanico: so I request your source :P Yardanico: maybe jackos doesn't initialize something correctly alehander92: okk alehander92: https://github.com/alehander92/lodka Yardanico: also btw panicoverride seems to be not included with --os:any Yardanico: can you try creating a seq and appending to it at runtime? alehander92: appending alehander92: ok Yardanico: like Yardanico: var a = @[1, 2, 3]; a.add 3; consoleWriteNl($a[3]) Yardanico: and btw you didn't have to patch nim because you added your custom headers :P Yardanico: with stdio and etcv Yardanico: etc* Yardanico: ./c/nimbase.h:261:10: fatal error: limits.h: No such file or directory hm alehander92: hmm appending works alehander92: but $integer alehander92: depends on __divdi3 Yardanico: ah yes alehander92: which i implement now but wrongly Yardanico: you need to link with libgcc Yardanico: it's okay to do that for kernels btw Yardanico: https://wiki.osdev.org/Libgcc#How_to_link_with_libgcc alehander92: i think its easier to add it in your own libc Yardanico: well it's not really a part of libc Yardanico: it's gcc's own builtins Yardanico: division of 64-bit integers on 32-bit CPUs uses __divdi3 afaik alehander92: hmm alehander92: but i *can* define it myself alehander92: i wonder if i can define it correctly alehander92: or this doesnt begin to make sense Yardanico: also did you get an error with limits.h? Yardanico: for some reason I get an error that nim can't find this header Yardanico: I'm using build_nim.sh Yardanico: ah I see the problem Yardanico: you have hardcoded paths :P alehander92: oh yes sorry Yardanico: or not hm Yardanico: it fails at nim step alehander92: i have for the ~/opt/cross/.. alehander92: stuff Yardanico: ah wait no alehander92: i should provide a setting for that alehander92: but i dont have the limits.h problem i think Yardanico: ah -nostdinc Yardanico: it works if I don't pass that Yardanico: and I don't think you need to pass that Yardanico: hmm maybe I should try booting raw kernel without grub too Yardanico: in jackos fork alehander92: no idea if this changes anything alehander92: but i plan to port the interrupt / idt stuff from https://github.com/cfenollosa/os-tutorial/tree/master/20-interrupts-timer/cpu codic: Can nimpy use httpclient (https://nim-lang.org/docs/httpclient.html) ? codic: Also what about one of the websocket libraries (treeform's ws https://github.com/treeform/ws and niv's websocket.nim https://github.com/niv/websocket.nim) Yardanico: @codic why wouldn't it? Yardanico: I mean httpclient with nimpy codic: just wanted to make sure, I was gonna write a `requests` alternative with nimpu codic: nimpy* disruptek: that's been done. codic: i know zacharycarter: stream's back up codic: just for fun haha codic: also a websockets thing is something i wanted codic: so would one of those work? Yardanico: nimpy is not specific to some subset of nim codic: yeah but i thought some libraries might not work Yardanico: why? codic: same reason why {.exportc.} doesn't translate tables to ruby hashes Yardanico: that doesn't mean it "wouldn't" work Yardanico: you'll just have to interface between nim and python types Yardanico: yourself codic: oh? codic: faster-than-requests doesn't eem to interface KingDarBoja: Hi Yard Recruit_main707: when does this error appear?template/generic instantiation of from here Yardanico: that's not the fulle rror Yardanico: show us the full error first :) Recruit_main707: template/generic instantiation of `WriteVal` from here Yardanico: full Yardanico: that's not "full" :P Recruit_main707: then what Yardanico: full stack trace Recruit_main707: Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/705907783106822174/unknown.png Yardanico: uhh that's not the one Yardanico: I meant from the compiler itself Yardanico: in terminal Recruit_main707: https://play.nim-lang.org/#ix=2ko9 Recruit_main707: full error of running check? Yardanico: "Error: expression 'littleEndian64' cannot be called" is the error itself Yardanico: and instantiations just show how the code path ended here Yardanico: also 'Error: undeclared identifier: 'littleEndian64'" Yardanico: did you forget to import endians? Recruit_main707: but littleEndian is part of the stdlib isnt it? Yardanico: no? Yardanico: it's in "endians" module Yardanico: it's not in system Yardanico: also if you use littleEndian64 in your templates in builder.nim and then call these templates in good_table.nim you might need to bind littleEndian64 in these templates Yardanico: or "export endians" Recruit_main707: this thing always confuses me Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/705908737650589816/unknown.png Yardanico: why? Recruit_main707: why would standar library appear there Yardanico: ?????????????? Yardanico: it's a link to https://nim-lang.org/docs/lib.html Recruit_main707: i know, when i see it i just thing that module is part of it Yardanico: endians is a part of stdlib but stdlib modules are not magically imported Yardanico: except system Yardanico: and threads zacharycarter: back again Recruit_main707: ok, thanks and sorry for the dumb questions :) KingDarBoja: RIP IRC Yardanico: ? Recruit_main707: bruh moment Yardanico: @alehander92 seems like I managed to make JackOS work with seqs too :D Yardanico: basically I used your build_nim.sh instead of a make file lmao alehander92: love it! alehander92: i am trying to make jack os alehander92: run with the makefile! Yardanico: although cpuinfo from jackos still does't work, maybe there's some error with inline assembly there alehander92: ok alehander92: it builds with makefile now alehander92: but it just shows me blue screen Yardanico: ye that's expected with current commits Yardanico: now with some config changes i can do seqs stuff somehow Rika: how much of a performance hit is accessing heap instead of stack? (ref object vs object)? alehander92: Yardanico ok alehander92: so basically fix alehander92: OBJECT_FILES alehander92: because they are hardcoded currently Yardanico: yeah I know alehander92: i think one can automatically get them from the *.o names Yardanico: I'll probably try to use nimscript though :P alehander92: but i am not so good at makefiles alehander92: but makefiles do seem useful i admit alehander92: but otherwise thanks !!! alehander92: i now know of more options alehander92: and linkerexe alehander92: and can adapt this for my kernel alehander92: we can like join forces or something Yardanico: I don't know osdev :P alehander92: but you can also do your own thing my ideas are very unreliable alehander92: yeah i plan on basically following some tutorials and doing unexpected stuff Yardanico: also btw for stacktraces in your kernel there is some issue (maybe because of some problem with malloc and friends) Yardanico: they produce some garbled output instead of proper ones Rika: T_T alehander92: oh yeah i dont care for those yet alehander92: my c stubs are very very basic alehander92: many of them just to make it build alehander92: basically you're right: i probably need to decide if i want to write my own mini libc or build with stuff alehander92: but i want to depend on a minimal amount of stuff Yardanico: write it in nim :P bedwardly-down: Streaming with Wayland took forever to get working but i did my first nim test stream a little while ago. ☺️ Yardanico: well with sway you just install wlrobs Yardanico: add it to your obs plugins and then use scpy bedwardly-down: Direktik helped me out with that, although, I didn’t realize that i was using the wrong stuff the entire time. 🤪 bedwardly-down: The main tutorial doc for it misdirected so much Yardanico: why? Yardanico: I followed it too Yardanico: in the readme it literally tells how to install it https://hg.sr.ht/~scoopta/wlrobs Yardanico: "Building" and "Installing" bedwardly-down: I was using the wrong plug-in. When i searched for Wayland obs, it pulled up a Wayland build of obs studio and a separate plugin from a George something bedwardly-down: And that was the setup linked from Obs’s help docs bedwardly-down: https://feaneron.com/2019/11/21/screencasting-with-obs-studio-on-wayland/ Yardanico: well i didn't use that bedwardly-down: I should have asked for more help with it. I may have to do the same for nim at this rate. 😛 dom96: le sigh #11912 disbot: https://github.com/nim-lang/Nim/issues/11912 -- 3Add undiscardable pragma and forbid Futures from being discarded shashlick: any ideas - https://github.com/genotrance/nimpcre/issues/3 disbot: ➥ error: no matching function for call to 'pcre_free_study' ; snippet at 12https://play.nim-lang.org/#ix=2kox bedwardly-down: dom96, :/ exelotl: @Rika about your performance question, the cost of indirection depends on whether the object is in the CPU caches (i.e. it has been accessed recently or is near some data that has been accessed recently) bedwardly-down: Does nim have anything like Promises in Javascript that guarantee that at some point an async call will happen during the lifecycle of an app? dom96: async await and futures? I guess exelotl: @Rika this chapter is a good read if you wanna learn more about that http://gameprogrammingpatterns.com/data-locality.html - apologies if I'm telling you stuff you already know xD codic: nim rules. codic: It's actually a very pleasant experience to refactor *small parts* of python code to nim and use nimpy. it gives you small performance boosts. eventually you get to the point where most of your heavy computing is nim codic: and then you be like 'why was my code slow before nim' bedwardly-down: I'm reading that bug and the ones linked, dom. I noticed that one of the merges for the docs suggested only discarding when it's safe. How does someone brand new (like me) know what is and isn't safe in that context? codic: waaaaaaaait https://nim-lang.org/ says string interpolation is evaluated at compile time codic: But what if you have string interpoltion having a value from input? codic: *polation codic: *interpolation codic: how can that be at compile time? Yardanico: strformat Rika: @exelotl you arent xd thanks Yardanico: @codic well basically your format string is transformed into .add calls Rika: though i think i'm prematurely optmizing at this point Yardanico: at compile-time Yardanico: and stuff like that Yardanico: so I guess 64kb for the kernel with --gc:arc --os:any is ok :P (after stripping) Yardanico: https://i.imgur.com/GVi1nYI.png a REAL sequence Rika: what is that 👀 codic: > @codic well basically your format string is transformed into .add calls codic: Ohh that makes much more sense Yardanico: JackOS (fork of nimkernel) codic: I thought {variable} was replaced by the content of the variable hahaha Yardanico: and I kinda made it work with --os:any --gc:arc Yardanico: https://i.imgur.com/olB6Vpa.png Yardanico: wait let me try something really crazy KingDarBoja: I have a question, it is possible to get the list of properties of one type? Yardanico: lmao Yardanico: tables in kernel codic: Does nim run on nim raspberry pi? codic: Does nim run on raspberry pi? Yardanico: yes of course codic: oh, great codic: what about the arduino bedwardly-down: Yar, is that a boot screen? bedwardly-down: Nice codic: And how do I install nim on the pi? codic: (And one last question 😢😢😢 does nim have bindings for the pi camera or would I have to write my own) codic: or as a third option for the last question osproc.execProcess and raspistill/raspivid would work for *basic* operations Recruit_main707: > what about the arduino Recruit_main707: Yep Recruit_main707: Yardanico: so they work?? Yardanico: who? KingDarBoja: Can I request a suggestion from you, Yardanicco? Yardanico: tables? ofc Recruit_main707: lmao, can you just do echo() ? Yardanico: well if you declare it in your file - ofc Yardanico: it'll shadow the system's own echo Yardanico: maybe codic: oh nice codic: i'll just use osproc for the picamera. tryna get choosenim on the pi rn codic: since the nim downloads page only shows x86/x86_64bit downloads KingDarBoja: I am checking a source code function (which is in JS) and they use a keymap (a dictionary pretty much) to store the key of the AST kind and the value as the list of properties of that kind Recruit_main707: Isn’t raspberry 64 bit? codic: yeah but arm64 KingDarBoja: I checked the same implementation on Go (KeyMap) and Python (Dictionary), so I guess I should use Tables module to do the same but here comes the question Yardanico: @codic well you can compile from source Yardanico: or use binary releases Yardanico: https://github.com/nim-lang/nightlies/releases/tag/2020-04-28-version-1-2-dc3919b Recruit_main707: > yeah but arm64 Recruit_main707: So is my pc Yardanico: linux_arm64 Yardanico: @Recruit arm64 != amd64 Yardanico: well you might be running an arm64 pc, sure, but that's kinda uncommon Recruit_main707: Probably amd now that you say it codic: choosenim won't work? Yardanico: it would Yardanico: but it'll compile from source codic: fine with me KingDarBoja: Is there a way to get each ast kind and create a key-value pair like I described? KingDarBoja: I mean, set the type as the key and the properties as the value (a sequence I think) Yardanico: it might work with typedesc , not sure :P KingDarBoja: I only see name on typedesc KingDarBoja: Ah well, I will go the easy way and make them manually on a table lol alehander92: Yardanico niccce! alehander92: dom96 disruptek i agree about the asyncCheck vs discard thing alehander92: that whole "you should read the docs" if the compiler can detect something doesnt make sense, it should just do it alehander92: too much overthinking imho alehander92: i agree with dom96 & alehander92: * alehander92: sorry, wanted to append to the first message cgarciae: hey, I've been trying to finds the docs for concept types but had no luck. Can someone point me to them? Rika: manual_experimental Rika: https://nim-lang.org/docs/manual_experimental.html Elegant Beef: https://nim-lang.org/docs/manual_experimental.html#concepts Elegant Beef: 1 upd! cgarciae: Thanks! Are they experimental? Rika: kinda yes Rika: my experience with them makes me think theyre still p. experimental cgarciae: I've found posts from 2015-16 talking about them Rika: age does not mean maturity Elegant Beef: *Ha dick joke here* cgarciae: I see. Thanks! Rika: maybe someone more advanced than me can pitch in regards this though Rika: one sample point is not much to base on cgarciae: By the way, types automatically "implement" a concept if they have the correct signature? No need to explicitly declare them? Rika: signature? Rika: also note concepts are compile time constructs Elegant Beef: Im looking at these now and i dont understand a thing leorize: concepts are additional constraints that a type must conform Elegant Beef: It's like an interface in C# no? leorize: a more detailed version of generics leorize: no Rika: how do you check if a type conforms to a concept Rika: interfaces are runtime leorize: how do you check if something matches your generic type? cgarciae: I am basing on this: https://gist.github.com/PhilipWitte/33819b40112a18c30b43 Rika: leorize: i do not know either Rika: is? Rika: Type is Concept? cgarciae: For me they are similar to Swift protocols Prestige: Does sort of remind me of an interface Elegant Beef: I'd say they're very similar to a C# interface in this example leorize: yea, but most interface implementations are runtime Rika: @Elegant Beef https://stackoverflow.com/questions/6948166/javas-interface-and-haskells-type-class-differences-and-similarities leorize: this is a compile time thing Rika: nims concepts are closer to haskells type class than interfaces Prestige: even better! leorize: there's a reason they're in experimental Rika: when i saw "concepts" i immediately thought haskell Elegant Beef: I mean a majority of my coding experience is inside Unity so.... everything is runtime! Rika: sounds like absolute pain, beef leorize: the syntax of concepts are weird leorize: and that if you aren't careful those things explodes your compile time Prestige: js/java mostly, here. Love having compile-time code in nim cgarciae: Concept contraints seem very powerful Elegant Beef: lol, good think im more of a technical artist now, than a proper gamedev Rika: which is why theyre experimental Elegant Beef: thing* leorize: we also had a proposal for vtref, which is the kind of interface you know Rika: vtref? leorize: basically the runtime version of concepts Elegant Beef: I sorta liked interfaced Elegant Beef: Although it's unlicensed so not technically legally allowed to copy it Elegant Beef: Although it's unlicensed so not technically legally allowed to copy/distribute it leorize: don't worry, it's originated from the nimforum leorize: all code there are mit licensed unless stated otherwise Elegant Beef: Ah cgarciae: In this example: cgarciae: cgarciae: Comparable = concept x, y cgarciae: (x < y) is bool cgarciae: cgarciae: How do you use Comparable? leorize: or you can ask krux :P Elegant Beef: Nah Elegant Beef: It's slangmgh's version Elegant Beef: So it's on github without a license leorize: cgarciae: use it as a type for parameters Rika: OH Rika: i see cgarciae: proc f(x: Comparable) ?? Rika: yeah i assume cgarciae: Hmmm cgarciae: So `concept x, y` do implies x and y are of the same type? Knaque: How might I go about adding new environment variables on Windows? As in, how can I add them through code? Elegant Beef: putEnv Elegant Beef: https://nim-lang.org/docs/os.html#putEnv%2Cstring%2Cstring Rika: @cgarciae `The identifiers following the concept keyword represent instances of the currently matched type` Rika: from the manual leorize: Knaque: depends on what you're trying to do Elegant Beef: So seems you need to have an implementation where x echoSlice a, n, m # no allocation` PMunch: Hmm, I need to find something to talk about for NimConf.. alehander92: or `split(a: string, c: char)[i: index] -> a[a.findNth(i - 1, c) .. ^1]` alehander92: (pseudo) narimiran: PMunch: reddit post turned into an article turned into a conference talk :D narimiran: PMunch: and a second one is: HN comment turned ..... :D alehander92: PMunch yeah, but i am not sure one can do that with just slices/iterators alehander92: as you would still generate the 0, 1, 2 string in split PMunch: Haha narimiran then I can post the talk to HN/Reddit narimiran: and then you put a link to a video of a talk of a thread turned into an article to your blog PMunch: And next year have the cycle one step longer PMunch: alehander92, it would require split to be lazy alehander92: so basically this way you can "teach" your rewriting pass how to optimize random code alehander92: that people would write alehander92: PMunch but this is not enough i think alehander92: because i want not only split to be lazy, but for it to detect it shouldn't split the first 3 tokens at all PMunch: So split wouldn't return a seq[] but an object with the arguments and access to that object would trigger it to forward the iterator and cache things alehander92: but even if its an iterator PMunch: It could do that alehander92: it should somehow accept that `4` alehander92: which requires knowledfge outside of the callsite alehander92: direct callsite* PMunch: Basically you would get back an object SplitResult[T][originalSeq: seq[T], splitChar: char] and then on access to [4] it would see that it didn't have anything in the cache and could skip straight to the fourth element PMunch: And then a converter that made it collapse down to a seq if needed alehander92: ah, interesting alehander92: doable, but the rewriting thing seems simpler to me :D PMunch: Well that requires teaching the compiler when it can rewrite stuff alehander92: because you dont change anything, but just add a simple rule PMunch: I've used my approach in libraries before alehander92: but you dont need to teach the compiler, if there is a general rewriting pass alehander92: like, you do, but its a general language system, like type annotations Araq: alehander92: Nim's TR macros were designed for this but we don't use them Araq: the current implementation is too slow and they have a design flaw I'd like to fix Araq: but yeah, other compilers also do this for stdlib routines Araq: GCC does it since forever for loops that use 'strlen' Araq: (O(n²) turned into O(n)) Araq: JavaScript engines are also known to do these things Araq: it's pretty standard these days and it's also a lesson for why compilers become complex. the compiler is written by few and used by many people. users benefit from what's done inside the compiler. Hammer2900: hey, help me please, how can i get last index in seq or array , i have this error (Error: unhandled exception: index -1 not in 0 .. 4 [IndexError]) narimiran: ^1 Hammer2900: thank you !!!!! alehander92: Araq yeah i thought its not very useful, but i now realized it seems good for this kind of stuff alehander92: it makes sense for compilers to be complex overally alehander92: but maybe this can be done easily: like overally loadDataStructure(..)[index] in general makes sense to optimize out unneeded elements of the call so one can just call a loadWithIndex overload for that alehander92: but thats just an edge case Araq: lol, how is that easy to do inside a compiler? you need to understand 'loadDataStructure' completely and then rewrite its inner workings Araq: das ist so wie wenn man durch die Wüste läuft und auf einmal sagt, "so, ich springe jetzt in diesen Teich und erfrische mich" Araq: sorry, too lazy to translate it into English Recruit_main707: being seen and inp a seq, could i extract the index in which inp[i] is in seem? Recruit_main707: ```if inp[i] in seen: Recruit_main707: twice.add i Recruit_main707: twice.add seen_index``` narimiran: i'm not sure i understand the question, but if you need both a position in a seq and the element there, use: `for i, x in mySeq` narimiran: or maybe you're looking for `find` proc? https://nim-lang.github.io/Nim/system.html#find%2CT%2CS alehander92: Araq this was a bit over my deutsch-learning head alehander92: but i google translated it alehander92: but no i didnt want that alehander92: my idea was that when the compiler sees `call()[]` it can look for `callIndex(args, index)` and replace it if it exists alehander92: which is very simple alehander92: but its not good language design, so nevermind alehander92: a general mechanism like rewriting seems better indeed Recruit_main707: for i, x in inp: this is index and value in that order? alehander92: yes clyybber: Araq: Are there now other reasons why a parameter can't be turned into sink? https://github.com/nim-lang/Nim/pull/14163/files#diff-061ade0026ed465dedf6806687820f3aL51-R51 disbot: ➥ fixes #14079 [backport:1.2] PMunch: Hmm, anyone know what might cause this? http://ix.io/2k9h PMunch: Brb, rebooting bung87: does `laser` has api like this ? `tf.reverse(img, axis=[-1])` bung87: found `arraymancer ` more close to this Vindaar: @bung87 I assume you mean `arraymancer`? At the moment there's no `reverse`. I was thinking about adding it earlier today, since I just added `sort`. Vindaar: ah bung87: yeah, that's easy understood proc and less code, I'd like to use it mratsim: `laser` is more of a research repo mratsim: I didn't put it on nimble personally mratsim: not sure how people are even using it bung87: just found it like numpy in python PMunch: Sweet, got my new graphics card up and running :) Araq: clyybber: probably but this was simple Araq: oh Araq: if you use .nosinks explicitly, the error message was off clyybber: Ah clyybber: I see Recruit_main707: has someone made a rust like impl macro? Recruit_main707: its pretty much the class macro, but out of curiosity Araq: yeah but it's old stuff Araq: so it probably doesn't compile anymore krux02: what is an impl macro? Recruit_main707: i mean, the rust impl thing, implemented in nim as a macro Rika: rust implements trait? Rika: that thing? krux02: I remember the impl thing. As far as I can tell it is not needed in Nim. Recruit_main707: well, sure, but this are all hypothetical things i think of alehander92: but isnt it an annotation? alehander92: like alehander92: it just says you implement this trait with this code krux02: In Nim you just have generic functions, no need to tag anyithng with impl. alehander92: what does it give you Recruit_main707: Araq: id like to see it anyway, do you know where can i find it? krux02: the impl thing in rust is a restriction Rika: so basically Concepts krux02: no it is not concepts Rika: ? how so? alehander92: sorry no idea of rust alehander92: i'd like to hear also Recruit_main707: https://github.com/ViliamVadocz/Autoplay/blob/master/struggle/src/bot.rs Recruit_main707: looking at this, impl looks more of a class like thing krux02: it is generic function, but with the restriction that the generic function can only be called, if it is explicitly whitelisted in the `impl` section of the type krux02: Nim does not have such a restriction. krux02: you can but a restriction on types in the generic function, but you can.t put the restriction on the type. A generic will always work, if it compiles. alehander92: <3 alehander92: makes sense krux02: s/can but/can put/ krux02: these restrictions are also part of the rust security/safety functionality. Araq: Recruit_main707: I don't have the code Recruit_main707: i think i found it alehander92: please link it Recruit_main707: https://gist.github.com/PhilipWitte/2cba4544530f23631ad1#file-gistfile1-nim-L149 krux02: oh yea krux02: first line I see already three things that are deprecated/removed or at least discouraged to do alehander92: this is some old code probably krux02: node kind based overload resolution. krux02: still works, but really don't do it. krux02: expr/stmt doesn't exist anymore. alehander92: but you can kinda do it with `using` Recruit_main krux02: today it is `typed` and `untyped` alehander92: if your goal is just to not write self: Type everywehre krux02: immediate macros don't make sense Recruit_main707: i was just wondering, although it sounds interesting, any examples using `using`? alehander92: i use it sometimes clyybber: Same here alehander92: but Recruit i'd say its more general alehander92: as you can apply it for different names and many arguments alehander92: e.g. ⏎ `using .. .. a: MyObjenv: Env etc` alehander92: `func onA(a, env): Node = .. func onB(a, env): Node = .. ` Recruit_main707: i see, that seems very useful for someone as lazy as me :p alehander92: i think its useful when you have a module with many procedures with the same signature alehander92: e.g. implementing visitor pattern or something like handlers alehander92: ok, visitor pattern might not be the correct name, sorry Araq: visitor pattern is close enough mratsim: For my ML compiler I use generated enums instead of visitors Recruit_main707: hold up, ML compiler= Recruit_main707: ? Recruit_main707: @mratsim bung87: maybe https://github.com/numforge/laser/tree/master/laser/lux_compiler disruptek: !last zevv disbot: Zevv spoke in 12#nim 32 hours ago Recruit_main707: does that ping him? disruptek: hearts and minds, people; HEARTS AND MINDS! disruptek: i know he hates to miss my morning mantra. sealmove: I have a general (possibly very ambigious) question. How easy or common is it to implement typical design patterns (say factory) in Nim, since it doesn't have standard object-oriented programming facilities? disruptek: every newObjectType() proc you see is such an animal. sealmove: Ok, for factory you make newObjectType() methods I guess. But in general, I'd like to see common design patterns implementations in Nim. Maybe we could make a doc page about it. disruptek: why? disruptek: why not use the idiomatic patterns everyone writes in nim, which work so well with the rest of the language? sealmove: But that was exactly my question. For example what you would use instead of X design pattern. disruptek: i think you're going to have to put value to your X variable. sealmove: Design patterns are like common language, many people know them and can understand code that uses it fast. If in Nim you do it in an other way, knowing how a pattern maps to Nim could be useful. disruptek: help me help you. tell me what the fuck you're talking about. Araq: disruptek, please be more friendly disruptek: this language is not common enough, i guess. Recruit_main707: disruptek, u good? disruptek: of course. disruptek: not all of us have the benefit of a secondary education. Recruit_main707: lmao Araq: yet everybody can show good manners, independently of education Recruit_main707: sealmove: i also feel like that sometimes disruptek: i didn't mean to be rude. just wanted to add some emphasis. disruptek: i'm sorry, sealmove. i'm really trying to help. sealmove: disruptek: I can take it, I am not offended. But still other people see the chat and might not like the tone. disruptek: well, araq knows a lot of buzzwords. sealmove: 🤔 Araq: a factory is a proc newFoo(): Foo, yes Araq: you're free to return a subtype from inside 'newFoo' Araq: the "factory pattern" is a workaround for overly specialized syntax like 'new T' Araq: the "visitor pattern" is a workaround for a case/pattern matching construct with exhaustiveness checks Araq: *for a missing construct Zevv: disruptek: zup? Araq: a "facade" is a wrapper proc Araq: a "singleton" is a global/thread local variable Zevv: aw don't spoil it now araq Zevv: you're taking out all the fun bung87: https://github.com/nim-lang/RFCs/issues/27 what's current progress? about endians disbot: ➥ [RFC] Option for endianness in streams Zevv: please rationalize SFINAE for me, while you're at it araq sealmove: Araq thanks for the info alehander92: disruptek btw what did annoy you about the await template Trem.: 4yhuiq2w Araq: bung87: use the external Nimble package for it Araq: Zevv, SFINAE can be used to pattern match against types in C++ but it was introduced for other reasons that I can't recall disruptek: alehander92: only that UFCS broke. disruptek: it's fine, imo. alehander92: oh sorry alehander92: can you give an example alehander92: did it work before ? e.g. `a.await` disruptek: no, i think the change is a good one. disruptek: await foo "bar" alehander92: ahh bung87: @Araq ok , found struct.nim throught irc logs alehander92: but now `a.await` might work alehander92: not sure, havent tried alehander92: which i am not sure is a good thing alehander92: but rust fans might like it disruptek: then we had better find a way to break it. Rika: lmao mratsim: @Recruit_main707 it pings me but I was busy mratsim: https://github.com/numforge/laser/tree/master/laser/lux_compiler mratsim: and https://github.com/numforge/laser/tree/master/laser/lux_compiler/core mratsim: look for the markdown files Recruit_main707: no hurry, thanks kaushalmodi: is the compiler name stored in some internal var in nim? disruptek: the what? kaushalmodi: instead of doing `when defined(tcc)`, `when defined(gcc)` disruptek: oh, i dunno. kaushalmodi: I am looking for a way to encode the compiler into the built binary for my debug purpose kaushalmodi: *encode the compiler name kaushalmodi: so that when I do `mybin --version`, it also prints the compiler used to build that disruptek: maybe you can use shashli so how to reproduce the paramStr madness ⏎ ⏎ Simply use paramStr in config.nims without importing `os` [https://gitter.im/nim-lang/Nim?at=5eab15cfb6dd23069799a9d4] krux02: I think Nim could provide a compiler callback to query completions for macro contexts. kaushalmodi: Earlier that worked because `paramStr` and `paramCount` existed in system krux02: but that is at the current state just an idea, nothing developed. kaushalmodi: Araq: This is how I fixed that breakage: https://github.com/kaushalmodi/hello_musl/commit/42e96a8eaae1307335af05583647f71212b4a973#diff-1e9f4e932d6743264195a0cbb63b83d9R12 Araq: ok, fixed disruptek: nice, thanks. leorize: I like Windows CreateProcess() and I hate it a lot at the same time :P leorize: question: why do people tend to use execCmd more than execProcess? disruptek: that's how i feel about having to use constants when creating objects from case kind: leorize: is it because the array syntax is annoying? leorize: though personally I like having the array syntax kaushalmodi: > question: why do people tend to use execCmd more than execProcess? ⏎ ⏎ That almost feels directed towards me :P kaushalmodi: Does execProcess do shell quoting too? leorize: execProcess use array-style parameter passing leorize: so yes, it's a part of the package leorize: safer, even disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek leorize: I noticed the use of execCmd being popular everywhere leorize: so I think it's something I can try to tackle kaushalmodi: answering myself.. yep it eventually shell quotes! https://github.com/nim-lang/Nim/blob/devel/lib/pure/osproc.nim#L478 kaushalmodi: leorize: Thanks, I will slowly start incorporating `execProcess` in my code leorize: I'm aiming to build an osproc alternative that's easy to use and can be extremely powerful if the situation calls for it kaushalmodi: nooo! you will be forking off osproc? leorize: it's a new implementation leorize: different syntax, etc leorize: osproc is nice but not powerful enough for me kaushalmodi: hmm leorize[m]: for example, the "simple" task of redirecting something to file is impossible kaushalmodi: or creating symlinks kaushalmodi: I call `ln` via `exec` in nimscripts leorize[m]: the only way you can do this is to spawn a shell to do it for you leorize[m]: creating symlink is not something osproc need to care about though :P kaushalmodi: oh well, hehe Araq: symlinks are like regexes kaushalmodi: so.. they are awesome! disruptek: wut Araq: leorize[m], add it to 'fusion' please Araq: bbl leorize: sure, once I got it working well :P kaushalmodi: what's fusion? leorize: !repo nim-fusion disbot: https://github.com/nim-lang/fusion -- 9fusion: 11Fusion is for now an idea about how to grow Nim's ecosystem without the pain points of more traditional approaches. Time will tell if the idea is a good one. 15 31⭐ 0🍴 kaushalmodi: cool.. that repo is just 9 days old KrispPurg: Hey guys, so every time when I set my shards in my library (https://github.com/krisppurg/dimscord) higher than 2 I keep having this issue of sending identifies per 5 seconds. The issue is that if it reaches the limit the both shards will wait and then when done it will be called multiple times exceeding the limit. (Ratelimit checker: https://github.com/krisppurg/dimscord/blob/devel/dimscord/gateway.nim#L259, Identify sending: https://gith Yardanico: your message got stripped in irc xd KrispPurg: wut KrispPurg: rip then leorize: Yardanico: maybe you should update the mattermost bridge you're using here? leorize: maybe it got some new features now? :P Yardanico: leorize: well I can, it's easy, but I'm scared something will break :P Yardanico: worth a try I guess Yardanico: I know that matterbridge now supports discord webhooks too leorize: maybe read the changelog before attempting :P dom96: Your bot not ready? KrispPurg: Anyways here was the message https://play.nim-lang.org/#ix=2kcW Yardanico: leorize: for two years? :D leorize: why not :p Yardanico: but I really looked at discord config for latest version, there's not that much new stuff leorize: maybe they support pinging now? Yardanico: @dom96 well it works quite ok in #nim-offtopic, there are some crashes because of some websocket errors (maybe that's due to the bot running on my PC), but generally with a script to auto-restart it it works just fine leorize: dom96: if possible you should allow it to hook into nimbot's logging system Yardanico: but I still need to fix edit diffing (and limit it to only 3 most recent discord messages), and add ability to ping people from discord in irc Yardanico: leorize: wdym? leorize: that will let us host long messages on discord directly on our servers :P leorize: that means you log directly into irclogs without all the jazz leorize: also give you a nice way to support long messages leorize: just log them there and generate a link to the entry Yardanico: well there are some paste services which support storing contents "forever" Yardanico: like paste.debian.net (it has a XML-RPC (jesus) API too) dom96: that sounds like it would be quite a complex system Yardanico: yeah I think so too dom96: what might work is if the bot generates its own IRC logs and then NimBot can merge them or link to them leorize[m]: it's better to host the logs on our infrastructure Yardanico: leorize: well matterbridge already runs on the same VPS as the nimbot Yardanico: and logs are there too Yardanico: tbh the log thing would've been easier if nimbot used a DB (even sqlite), so it could just ignore messages from FromDiscord and ircord will write them in the same DB, but that requires changing nimbot quite a bit too Yardanico: and irclogs website will need to be adapted too, and it'll be slower since it'll require reading DB every time someone opens a page (although I guess we could just generate an .html at the end of each day) KrispPurg: uhh, hello? Yardanico: hi? KrispPurg: Are you gonna help me with the ratelimit issue or uh? Yardanico: I didn't understand the issue at all, sorry KrispPurg: oh. KrispPurg: I'm going to show an understandable minimal example that reproduces this issue. KrispPurg: Only at tomorrow, because I gotta watch this quiz show that I like. martinium: what module or libray was the Nim website built with? Yardanico: martinium: old website was built statically using a nim tool, new one is jekyll Yardanico: https://github.com/nim-lang/website martinium: jekyll aka Ruby? Yardanico: jekyll aka static website :P Yardanico: but yeah, jekyll itself is in ruby martinium: any static website builders for Nim? Yardanico: github search may help you :P martinium: darn, wanted to be lazy martinium: hehe martinium: what ever happened to jester framework Yardanico: martinium: it's still around, wdym martinium: I thought Nim site was built using Jester Yardanico: martinium: there's no point in using jester Yardanico: since the website is static anyway martinium: static is fast martinium: love it Yardanico: for static page hosting nothing beats nginx :P martinium: going to search for a nim static site generator martinium: if none exists maybe I'll take that on as a project shashlick: disruptek: is nimph now working with latest devel? 4raq fixed the paramCount issue Yardanico: martinium: there are some disruptek: i can't get over how slow nimph is now. zacharycarter: why is it so much slower now? disruptek: i dunno. zacharycarter: oh shashlick: what's a benchmark we can use to test it? disruptek: you should install it and try operating it. disruptek: if that's too much, then don't worry about it. disruptek: i guess it's `nim dump`. disruptek: it's not /only/ that, though. shashlick: i just ran nimph on the nimph folder itself shashlick: but guess i have nothing to compare it with disruptek: how long did it take? shashlick: 10 seconds shashlick: good chunk was downloading the package list perhaps Yardanico: ah right, is --gc:orc supposed to work with async now? disruptek: yes. Yardanico: disruptek: what if it doesn't? :D Yardanico: both arc/orc fail to work with irc module in async mode for example Yardanico: they fail with "Exception message: File descriptor not registered." disruptek: that explains one problem i have with my bot. disruptek: shashlick: just run it a few times and take the best number. Yardanico: well I can submit an issue but irc module is quite big (~600 lines) disruptek: go for it. disruptek: i will fix it. disruptek: i mean, irc. shashlick: disruptek: http://ix.io/2kdv Yardanico: disruptek: aren't you supposed to fix arc/orc instead? :P disruptek: i think newer nim broke openapi which broke github. Willyboar: Nice things happen last 3 months :) disruptek: shashlick: but, how long did it take? shashlick: disruptek: 10 seconds every time disruptek: a good test is `nimph path nimterop` or w/e. shashlick: most of it was these two steps - the nimble package list is 2 days old, loaded 2612 packages from nimble disruptek: weird; that happens almost instantly for me. shashlick: almost 5 seconds shashlick: 4.3s disruptek: you have a thing that times line output? disruptek: that's sorta neat as an idea. shashlick: nimble path nimterop returns instantaneously shashlick: what is nimph doing for nimph path? disruptek: only computing the entire environment. shashlick: so you have to run nim dump multiple times? disruptek: no, i (should) only run it once. shashlick: let me build with profiling disruptek: it's some problem that arrived when the config changes came in. disruptek: i can look at it when i fix the damned hints. shashlick: disruptek: okay wasn't compiled with danger, with it, nimph runs path nimterop in 0.88s disruptek: that seems fast enough. Yardanico: netsplit, rip skrylar[m]: well this is a dumb request, but does anyone have a favorite system for splitting or visualizing trace logs on prefixes skrylar[m]: (i mean yeah, grep ^foo, but.. :|) dadada: is nim using ldpreload internally somewhere? dadada: moe from nimble is broken on my Linux, so I tried to fix it with my own ldpreload tool I created, but that didn't help cause apparently according to strace moe also is setting its own ldpreload settings, possibly overriding anything my tool is doing... I think ldpreload should be left to external tools (like mine), or is there a reason why an application should dynamically change ldpreload environment dadada: variables and the like? dadada: probably this isn't caused by moe code, but rather some ncurses binding related stuff dadada: hmm, wait, pardon, I think I saw something that wasn't there, or assumed something wrongly ... ignore my last few messages dadada: like you usually do! :-) Rika: less ignore more "busy with other stuff: Rika: 5 minutes aint a lot of time to let people read when the day's busy dadada: Rika: uhm, take it with a grain of salt, I did imply that ignoring me would make sense (joke about myself), because at least in this case, the thing I wrote was for naught Rika: thought you were mad dawkot: What should I expect Haxe to be worse at than Nim? Rika: habitual assumption due to repeat offenses (badly worded, i know) dawkot: Seems similiar, but I never used it Rika: never used haxe either Rika: let me take a look liblq-dev: do ranges automatically use the smallest type that can fit them? eg. does a range[0..4] consume as much as an int, or uint8? cgarciae: Newbie question: Why does Nim allow one to do this? cgarciae: cgarciae: ```nim cgarciae: type A = object cgarciae: field: int cgarciae: cgarciae: let a = A() # no error cgarciae: cgarciae: echo a.field # 0 cgarciae: ``` cgarciae: cgarciae: I'd prefer if it told me I forgot an argument. Also, just notice one cannot set default values in the definition of the type. Is there a convention for defining constructors? Yardanico: because that means that all fields in A will be set to "default" values for their types Recruit_main707: thats because A() is not a constructor liblq-dev: @cgarciae all arguments are initialized to default(T) Yardanico: for value types that's zero usually, for ref types that's nil Recruit_main707: you come from python probably? Yardanico: convention is to create procs like initType(args): Type for value types and newType(args): Type for ref types Rika: convention is `proc initXXX`... im late Rika: damn you yardanico and your speedy typing Recruit_main707: have a look at this: Recruit_main707: https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#self__init__ liblq-dev: !eval echo sizeof(range[1..8]) NimBot: 8 Rika: i blame my fingernails! cgarciae: I see, camel cased? liblq-dev: oh noes! it's u n o p t i m i z e d Rika: camelcase is the convention here Rika: "convention" Recruit_main707: not neccesary though Rika: but since nim is case insensitive but for the first letter Yardanico: @cgarciae well nim is partially case-insensitive, so not necessarily liblq-dev: you can still use snake case, because nim is style insensitive Rika: it doesnt really matter Recruit_main707: we are 4 people spamming the same answers xD Rika: wow, 4 people responding to the same person always looks funny Recruit_main707: lmao Rika: DAMN IT Rika: NOT AGAIN Rika: beat by recruit this time liblq-dev: @Rika type faster!! Rika: so does anyone here know haxe? dawkot was asking what it doesnt have that nim does Rika: lq: no u Recruit_main707: she has been typing since his last comment xD Recruit_main707: her* cgarciae: Ah right, but the community uses camel-cased them? Thanks! Rika: yeah but as we've said it really doesnt matter Recruit_main707: each one uses what he wants Rika: unless you wanna contribute code to std lib Rika: or compiler code liblq-dev: @Rika, well, first of all, haxe doesn't have such a nice syntax ;) liblq-dev: it also doesn't seem to have `range` types Rika: other than that, of course Yardanico: @cgarciae camelCase is preferred, yes liblq-dev: but I'm not experienced enough to know Rika: range types dont exactly work too well from my experience cgarciae: I think for reading others code it matters Yardanico: for types it's PascalCase, for constants either camelCase or PascalCase liblq-dev: and for procs it's camelCase only Rika: we mean that it doesnt matter if you use snake case uniformly on all your projects Rika: not that "it doesnt matter if you mix them in the same project" Rika: though thats ok too but no one would want to read your code at that point Yardanico: @cgarciae partial insensitivity means that if you write a proc like proc new_type(): Type someone will be able to use it as newType liblq-dev: but not NewType Yardanico: partial because the first letter is case-sensitive, because of types Yardanico: so type and Type are not the same Yardanico: and let type = Type() works liblq-dev: ^ old Nim did not support that, so sometimes you may see types prefixed with P or T cgarciae: yeah but try searching for it `new_type` vs `newType` on vscode Yardanico: well nim has it's own nimgrep, also nim plugin in vscode uses nimsuggest liblq-dev: ask the extension's authors to add a setting for style preference ;) Rika: do you use vscode lq? Rika: heard `@Gary M#6455`'s revamping it (kinda, he only wanted to fix syntax highlighting) Rika: hmm, haxe has pattern matching, interesting dom96: bah, we've got all these darn {.since annotations and the docgen doesn't show them? Yardanico: it does though? dom96: where? Yardanico: oh I thought it does dadada: Rika: not mad :-( dadada: sad!!! Rika: yeah Rika: understandable cgarciae: Weird that Haxe compiles to pure Python, it would be more useful to do something like what `nimporter` is doing: cgarciae: cgarciae: https://github.com/Pebaz/nimporter Rika: it *can* compile to pure python, just like how nim *can* compile to objective c Rika: i dont see how it is weird Yardanico: also see https://forum.nim-lang.org/t/1880 sealmove: I have a seq[char] (not null terminated) and I want to convert it to nim string. cgarciae: Because pure Python is slow, if you create a shared object that can be imported from Python its faster. Unless you really want the Python code for some reason. Yardanico: also imo haxe's stdlib is much smaller since it's harder to port things between backends Rika: Yarnanico: damn, adrianv's reply looks juicy Rika: as in content-size wise not controversialness wise Rika: @cgarciae *cpython* is slow, implementations are slow not languages, even if its the base implementation Rika: also, maybe someone does want pure python Rika: maybe its a project requirement Yardanico: I mean you can write a python backend for nim if you want, just base it on the JS backend, I doubt it'll be THAT much work to make most of nim work for it Rika: sealmove: i heard you can safely just cast between them but wait for someone to back my answer Araq: Rika implementations can have a hard time though mapping the language to the hardware Yardanico: Araq: so about orc - is it supposed to work with async now? Because I tried the "irc" module in async mode and it fails with both arc/orc with "File descriptor not registered", although simple async httpclient code works Araq: but indeed, give me Python that is as fast as Nim and I still wouldn't want to use it. :-) Araq: Yardanico, the tests I did worked Rika: Araq: that is true, hmm, i'd revise my answer to implementations are slow and language design can inhibit speed but that still does not make a language slow Rika: or so, i'd need to put more thought into it if needed but lol Yardanico: Araq: ah ok, I'll try to find a smaller example to reproduce this issue Yardanico: well irc module itself is ~700 lines Araq: Yardanico, thanks, much appreciated, I'm working on #14159 which might be related Yardanico: oh, nice :) Araq: Yardanico, also if you report the but, always also try --sinkInference:off my new enemy Araq: *bug skrylar[m]: my god. this entire error was just from forgetting a subscript Rika: subscript? Yardanico: Araq: seems like irc works in async mode with --sinkInference:off :D Rika: what does sink inference do exactly? and how would orc work without it? 2nd question is what's baffling me Yardanico: well it adds sink annotations or hooks automatically afaik Yardanico: basically an optimization thing but i'm not sure :D Rika: its just for optimization and not for orc or arc to actually work? Yardanico: yeah, they both will work without it Yardanico: orc is arc with a cycle collector zacharycarter: https://nim-lang.org/docs/destructors.html#sink-parameters - Rika zacharycarter: oh you probably already saw that Yardanico: ah wait the 14159 works without sink inference too Rika: i have but im unsure of how it works w/o it Yardanico: it does copies Rika: oh ok Yardanico: nimes seems to work with arc (or orc) without sink inference, but it's much slower Yardanico: and "perf" says that 70% of time is spent in __strstr_sse2 from libc zacharycarter: hmm interesting - so I'm loading a shared lib, loading a symbol and casting it to a callback, calling that callback and passing in a var object, assigning a value to a string member of that object and then unloading the library zacharycarter: with both the shared lib and the host program compild with `--gc:arc` the program never terminates zacharycarter: with default gc the program terminates shashlick: @zacharycarter so not https://github.com/nim-lang/Nim/issues/14074 zacharycarter: shashlick: going to add asan to the picture and I'll check out generated c and stacktrace zacharycarter: it looks different shashlick zacharycarter: it's happening in `N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(NimStringV2* dest)` zacharycarter: in - `if ((*dest).p && !((*dest).p->cap & NIM_STRLIT_FLAG)` zacharycarter: looks like (*dest).p->cap is causing an EXC_BAD_ACCESS zacharycarter: I think it's because the string is being created by the code executing in the shared library zacharycarter: and then I'm unloading the shared library zacharycarter: and Nim is trying to free the memory allocated by the string after the library has been unloaded Araq: zacharycarter, argh, that bug Araq: I'm sorry I forgot about that one... Araq: so simple to fix :-/ zacharycarter: I wasn't even sure if it was a bug zacharycarter: or if I was just doing something incorrectly Araq: you're buliding a library, right? zacharycarter: so I have a host program that loads a symbol from a shared library and passes a var object to the loaded proc zacharycarter: the code in the library assigns a string to a member in that var object zacharycarter: then in the host program I echo the member of the object zacharycarter: but Nim calls the destructor on the string after I unload the library Araq: PR coming... Yardanico: https://github.com/nim-lang/Nim/issues/14179 lol zacharycarter: \o/ dumjyl: do ref types work within unions (assuming I discriminate properly) for arc or must I implement my own RCed ptr type? Yardanico: i don't think there's any reason they wouldn't work Araq: https://github.com/nim-lang/Nim/pull/14180 Araq: dumjyl: we have extensive tests for them fwiw gogolxdong: cmp doesn't compile with orc `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` Yardanico: cmp? dumjyl: Maybe unclear, I'm talking about the `{.union.}` pragma. gogolxdong: Our CMP project, not the cmp proc of algorithm gogolxdong: Cross-Cloud Management Platform Yardanico: you mean the compiler segfaults? Yardanico: or sigsegv at runtime? Yardanico: try to compile with --sinkInference:off if it crashes on runtime gogolxdong: compile segfaults Yardanico: oh Yardanico: then you can get full traceback with ./koch temp c --gc:orc yourmainnimfile.nim Yardanico: or try to make a small reproducible example :P gogolxdong: https://play.nim-lang.org/#ix=2ked zacharycarter: Araq: can confirm that PR fixes my issue - thanks! zacharycarter: actually nevermind it doesn't, but I don't think my issue is fixable I think it just is improper use of nim strings zacharycarter: the host program can't know that the memory assigned to the member property was allocated by the shared library shashlick: I think Araq fixed my issue there, need to check if nimterop benefits zacharycarter: probably zacharycarter: using a shared pointer and calling destroy on it fixed my issue zacharycarter: probably the right way to do it skrylar[m]: what is this orc business Yardanico: skrylar[m]: arc with a cycle collector Yardanico: see https://forum.nim-lang.org/t/5734#38665 bung87: is there problem when writing string to image format? bung87: or seq[char], using `stream.write` bung87: https://github.com/bung87/icon/blob/master/src/iconpkg/ico.nim KingDarBoja: Everytime I run a test (using unittest module), any proc on setup section will display a hint on the terminal about it not being used KingDarBoja: Although I do use them on tests skrylar[m]: Yardanico: neat, i guess. skrylar[m]: got the pretty linebreaking to work on paragraphs today. still need to get the adobe optimization in tho :\ skrylar[m]: they put a depth limit in K-P which guards against psychotically long paragraphs bung87: cant easy provider example , I modfied the std libs... leorize[m]: shashlick: yes you can leorize[m]: --benchmarkVM or something like that will enable time functions zacharyc1rter: sweet - I think my fiber based job system is working now leorize[m]: check out --fullhelp zacharyc1rter: at least context switching inside of a thread is zacharyc1rter: at least context switching inside of a thread is zacharyc1rter: oops sorry Elegant Beef: You committed the cardinal sin, good bye zacharyc1rter: :D codic: sad zacharyc1rter: what's sad? codic: That you commited the cardinal sin zacharyc1rter: ah - I do it all the time codic: lol Elegant Beef: How do you even accidently resend a message on irc? zacharyc1rter: press the up arrow and then enter in irssi codic: Alright, how do I add a button with nim's `ui`? Yardanico: same for quassel Yardanico: same for quassel codic: That executes a proc when done Elegant Beef: Ah so same way as discord but not editing 😄 zacharyc1rter: Nim doesn't have a UI? codic: Uh Elegant Beef: Yea i was super confused Yardanico: he's referring to nim-lang/ui lib Elegant Beef: Nigui? codic: https://github.com/nim-lang/ui Yardanico: don't use that :P codic: The libui wrapper codic: Why? zacharyc1rter: dafuq is this? Yardanico: zacharyc1rter: libui wrapper Yardanico: use NiGui codic: why shouldn't I use it? codic: Oh Yardanico: or gintro if you want full-fledged GTK gui Yardanico: gintro bindings to GTK are superb codic: yeah, I just need a dialog box with two buttons Elegant Beef: *or if you're daft like me use imgui* 😄 Yardanico: well NiGui will work for you then codic: looking at examples codic: UCI is pretty cool btw Elegant Beef: Xlib atoms are the most "how the hell do these work" i've ever seen codic: Wow nigui is actually great Elegant Beef: It is codic: Anyone see a glaring problem with this? https://hatebin.com/ydlhahwmmw Yardanico: yes Yardanico: you define "status" inside of if/else scopes so it's not accessible at global level codic: oh, would I use let instead? Elegant Beef: no Yardanico: lemme show you codic: just have the textbox in if? Elegant Beef: those are both declarations which depend on variable scope Elegant Beef: variables are only accessible in their indent and below Elegant Beef: *Unless globally declared* codic: how do i declare em glbally? codic: hm wait Elegant Beef: before any logic just do `var status = status` Elegant Beef: second status is a string Elegant Beef: Im just dumb Elegant Beef: I'd also say use enums over strings for things like this codic: Ok codic: Why enums? Elegant Beef: Cause they're nicely named integers, and cannot be mispelled Elegant Beef: strings can easily be mispelled and i'd say should only ever be used in UI, and rarely used in logic Yardanico: https://play.nim-lang.org/#ix=2jYg codic: yeah but then Yardanico: at least it compiles now codic: I have to rewrap my whole textbox in an if else codic: which adds complexity Yardanico: ? codic: Oh thanks yardanico codic: What do you mean? Yardanico: check the code I linked codic: I did codic: I was talking about using enums Yardanico: oh codic: instead of strings Yardanico: well you don't really need to Yardanico: enums can have strings as values codic: oh Elegant Beef: Enums are superior to string based logic, even without the abillity to store a ordinal + string value zacharyc1rter: still seems there's an issue with threads and `--gc:arc` zacharyc1rter: program randomly crashes and if I run with asan it crashes every time zacharyc1rter: when I run with `--exceptions:setjmp and --tlsEmulation:off` disruptek: bugs are expected. zacharyc1rter: yeah I know, I just have no idea what is causing them nor how to fix disruptek: what happens with setjmp and tlsEm:off? disruptek: you don't have any smaller repro, right? zacharyc1rter: I'm trying to come up with one zacharyc1rter: https://gist.github.com/zacharycarter/06d5a3effa0a23b12e9318eff9d5dc1f - is the backtrace zacharyc1rter: it's definitely a `--gc:arc` issue though because it runs fine with the default gc bung87: found when the compress data string convert to cstring , it is truncated. Yardanico: how are you "converting" it? bung87: just string.cstring disruptek: we saw something like this before. i wonder if it's finding a null and assuming the string is finished. bung87: hmm not like python theres read binary mode bung87: I need read using `staticRead` which is string, then `.cstring`, the problem occurs... disruptek: you need to create a cstring with a certain length. then it should copy. i assume... Yardanico: oh staticRead disruptek: actually, i can't think why you'd need to specify the length. Yardanico: there might be an issue with staticRead krux02: I just figured out, that I am not a member of nim-lang anymore. leorize[m]: how so? krux02: don't know krux02: I wanted to tag an issue, can't do it anymore. Yardanico: might be https://github.com/nim-lang/Nim/issues/13786 Yardanico: for staticRead disbot: ➥ staticExec removes trailing LF which interferes with binary output that happens to end with 0xA ; snippet at 12https://play.nim-lang.org/#ix=2jYr Yardanico: @bung87 try reading at runtime Yardanico: with readFile Yardanico: and see if it works or not leorize[m]: Araq might still be awake and can give it back disruptek: yeah, that's the bug i was thinking of. disruptek: it's like 2a his time. bung87: I 'm search my prevous code about string ,cstring things disruptek: just work the problem. disruptek: it's just bytes. bung87: `readFile ` not work leorize: can I see the code? zetashift: Did something change with NimScript? https://play.nim-lang.org/#ix=2jYs krux02: leorize, I don't think he is still awake, it is pretty late bung87: https://github.com/bung87/finder/blob/master/src/finder.nim leorize: use `let`, not `const` :P zacharyc1rter: well - all the threading issues seem to stem from the new exceptions zacharyc1rter: and just using setjmp doesn't help - if I use the commit hash before the new exceptions got introduced things work flywind: https://github.com/nim-lang/Nim/pull/12860 disbot: ➥ Undefine `paramCount` & `paramStr` in nimscript.nim for *.nims Yardanico: ok now I feel like my mathexpr lib is useless after https://github.com/zevv/npeg/blob/master/tests/precedence.nim :D Yardanico: it's a simple math evaluator in ~30 loc lol wtf zetashift: oof thanks flywind I didn't see those in changelog for 1.2 bung87: I confirmed, Yardanico: works at runtime? bung87: len not equals... leorize: Yardanico: now if that thing is faster than your mathexpr lib it will be even funnier :P leorize: what len not equal? bung87: string len 657,cstring len 19 Yardanico: it probably is but lemme check with simple 2+2*2 leorize: bung87: use the string len leorize: don't use cstring len Yardanico: although mathexpr does more stuff like checking for functions and stuff zacharyc1rter: actually, nevermind, even with the version of Nim before the exceptions change, if I run things through lldb I get a null pointer use exception bung87: ok , let me add a len param leorize: bung87: you can just take a string then go from there disruptek: it's just bytes. leorize: use Nim types whenever you can Yardanico: ah wait actually wtf Yardanico: why my mathexpr is sooo much faster than this peg zetashift: So next version where nimscript `paramCount` was used you need to import OS if I understand this correctly? zetashift: import * leorize: yea, some stuff are unexported zetashift: os* jeez it's so late zetashift: @leorize was that towards me, just to be sure he? :p leorize: yep Yardanico: I get 500k iters/s for npeg one and 10mil for mathexpr Yardanico: for 2+2*2 zetashift: okay thanks! Could be worse change leorize: Yardanico: maybe it's due to the differences in algorithm leorize: also make sure to put the whole thing in a proc Yardanico: I use nimbench (yes its very old but I still haven't found a good simple alternative) disruptek: hyperfine or golden bung87: ok pass string directly works ,no error now disruptek: or criterion disruptek: !repo criterion disbot: https://github.com/LemonBoy/criterion.nim -- 9criterion.nim: 11Statistic-driven micro-benchmark framework 15 38⭐ 4🍴 Yardanico: it's archived disruptek: use my branch Yardanico: it has no new commits? disruptek: no, but we're collecting any issues. disruptek: iirc, it works but exposes a pragma bug. disruptek: but nothing too serious. disruptek: !repo golden disbot: https://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim 🏆 15 17⭐ 0🍴 Yardanico: and so how would I benchmark some operation repeated a lot of times for two libs? Yardanico: doesn't golden call the binary each time? disruptek: sure. disruptek: write two tests or use criterion. Yardanico: also it failed to install on devel :D disruptek: criterion? Yardanico: golden disruptek: ah, i rarely test it because i think it's broken on arc. Yardanico: Error: undeclared identifier: 'paramCount' Yardanico: in https://github.com/xmonader/nim-terminaltables/blob/master/terminaltables.nimble disruptek: omg disruptek: that guy uses crystal now, anyway. Yardanico: https://github.com/nim-lang/Nim/pull/12860 ? disruptek: i saw him in there when i was trolling. disbot: ➥ Undefine `paramCount` & `paramStr` in nimscript.nim for *.nims Yardanico: but where's backwards compat Yardanico: aren't we 1.0 release and stuff Yardanico: so no breaking changes like that are allowed zetashift: it's in devel not stable zetashift: only change needed is import os Yardanico: well but it'll be eventually in a new release Yardanico: and new releases still need to keep compat with 1.0 code zetashift: true, I dunno how they're gonna deal with it zetashift: usually there was a deprecation path zetashift: I also just ran into that error Yardanico: oh nvm Yardanico: https://github.com/nim-lang/nimble/pull/797 disbot: ➥ Fix nimble because `paramCount` & `paramStr` for nimscript are now defined in os.nim zetashift: it's a nimble problem yea zetashift: cause godot-nim imports os everywhere disruptek: it'll be a problem everywhere. zetashift: also for anyone who has 3 minutes to spare and hasn't installed godot-nim yet can one try to install it and set the GODOT_BIN environment and see if Nim picks it up? https://github.com/pragmagic/godot-nim/issues/58 disbot: ➥ Can't build sample app on Mac, environment variable not working ; snippet at 12https://play.nim-lang.org/#ix=2jYt zetashift: I ran into it, restarted it and it works now but can't reproduce codic: My gui so far. functionally it works. but what i'd like: codic: - put close and enable next to each other codic: - Make the "Tor is currently not running" non-editable. codic: codic: i'm using nigui https://play.nim-lang.org/#ix=2jYg bung87: @ disruptek @ leorize @ Yardanico thank you,finally it works out. zacharyc1rter: are sequences nil by default with `--gc:arc`? Yardanico: no? Yardanico: they're still just empty zacharyc1rter: interesting... zacharyc1rter: let me see if I can reproduce this then codic: Figured out how to use a label codic: just need to align the buttons codic: (And how do I make nigui use the system font?) codic: the font is a bit to small for my taste codic: and not the font family my system uses zacharyc1rter: https://play.nim-lang.org/#ix=2jYz zacharyc1rter: I don't know if this is worth filing an issue for or not - but I thought with `-d:useMalloc` asan would work codic: Nooo I'm doomed codic: No nigui docs Yardanico: check out examples disruptek: nim doc Yardanico: there's 17 of them Yardanico: https://github.com/trustable-code/NiGui/tree/master/examples Yardanico: and simple search already gives stuff like https://github.com/trustable-code/NiGui/blob/84a2b5c326658460d213b540e4f122b422deb5d6/examples/example_10_drawing.nim#L54 Yardanico: to change font family and stuff codic: oh, great codic: Can't I get it to use the *system*'s tho codic: or specify a ttf file zacharyc1rter: https://github.com/nim-lang/Nim/issues/14156 disbot: ➥ Sequences not initialized correctly with `--gc:arc` according to as an ; snippet at 12https://play.nim-lang.org/#ix=2jYK KingDarBoja: 🙂 Hi guys zacharyc1rter: hi KingDarBoja: What's up? :D Yardanico: hi, good night Yardanico: 5:23 AM 🤔 KingDarBoja: 9:23 PM disruptek: lua is fast. Yardanico: luajit is lightning fast KingDarBoja: Okay, Lua time it seems disruptek: well, i figured out my bug. Yardanico: what was it? disruptek: relative stack index became invalid due to mutation needed in order to query that same index. disruptek: kinda fucked up. zacharyc1rter: luajit is also unmaintained Yardanico: there's a maintained fork disruptek: the binding i'm using only supports 5.1. it's fine. Yardanico: moonjit zacharyc1rter: yeah but without the original author zacharyc1rter: whatever his name is - mike something zacharyc1rter: that dude was a genius zacharyc1rter: or is a genius zacharyc1rter: no idea what he's up to now zacharyc1rter: Mike Pall Yardanico: yeah that's true disruptek: i thought i was only gonna use this for data, but... Yardanico: https://repo.or.cz/w/luajit-2.0.git Yardanico: seems to be not dead Yardanico: He actually makes commits Yardanico: https://repo.or.cz/luajit-2.0.git/commit/179cf2eb84fef2b9a524469c3c8cc49363b8fb10 10 hours ago zacharyc1rter: that's good disruptek: iirc there's a 5.2 branch. leorize: I'd expect luajit to still be alive leorize: neovim is using it as it's internal scripting engine zacharyc1rter: if I didn't have hot reloading working with my plugin system, I'd use luajit disruptek: it hits a real sweet spot. zacharyc1rter: yeah it's nice for sure Yardanico: i think luajit is one of the fastest if not the fastest JIT implementation for an interpreted language zacharyc1rter: I think it is the fastest KingDarBoja: What you guys doing? disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: ~notes disbot: notes: 11https://gist.github.com/disruptek/41100bf20978de9a3cff55b23fcfe44e -- disruptek Yardanico: your'e still streaming?! Yardanico: wtf Yardanico: ah nvm disruptek: nah. disruptek: by way of explanation... leorize: disruptek: can you make your github module not trying to add an Authorized header when I don't have GITHUB_TOKEN set? disruptek: is that a good idea? leorize: yea, parts of the API don't need that disruptek: hmm, maybe the swagger is wrong. disruptek: you can pass "Authorization" with whatever you want in it. leorize: I don't need it :P leorize: I'm just fetching the latest releases disruptek: oh, do they puke on bad values? leorize: yea codic: how do I require a file in a subfolder from another file not in the subfolder? Yardanico: you mean import? codic: yeah zacharyc1rter: so I think the entire `--gc:arc` thread issue is related to the issue I Just found with seqs and asan Yardanico: import folder/file codic: o codic: and `import file` to import the file in the current dir? Yardanico: yes leorize: codic: import "../another folder" / file codic: but what if there is a module installed with nimble with the same name codic: as the file zacharyc1rter: nevermind it's not codic: which takes precedence, and how do I choose? leorize: your file take precedence Yardanico: import ./folder/file leorize: you can choose the package via `import pkg / module_here` leorize: `pkg` is a special prefix for packages codic: o codic: great KingDarBoja: That's a lot of stuff KingDarBoja: But awesome KingDarBoja: You gained a new follower ❤️ Yardanico: to see nim repos updated in last few days Yardanico: https://github.com/search?o=desc&q=language%3Anim+pushed%3A%3E2020-04-27&s=updated&type=Repositories Yardanico: sorted by last commit KingDarBoja: Holy cr*p, look at arraymancer D: Yardanico: yes Yardanico: also weave leorize: mratsim's projects are always cool Yardanico: zacharyc1rter: what happened with https://github.com/nim-lang/Nim/issues/14156 ? disbot: ➥ Disregard - not an issue Yardanico: also btw I tried https://github.com/def-/nimes with --gc:arc and it segfaults at some array access? Yardanico: works with default gc just fine even though no commits in 1.5 years :P disruptek: leorize: github 1.0.4 shashlick: @gogolxdong in case you see this - https://github.com/Microsoft/msquic disruptek: seems like nimph is broken in devel. disruptek: what's weird is, it crashes deep in config parsing code from the compiler. Zed: is it better to use when isMainModule or create a main proc and then call that? Zed: im used to coding in c and having to use a main function disruptek: it's better to use a main proc for very subtle are generally irrelevant reasons. disruptek: s/are/and/ Zed: so mainly so you can import it from another file? disruptek: shashlick: weirdly, it looks like gittyup was broken by devel this week. so everything is dead. disruptek: no, other more subtle reasons. disruptek: like iterator vars not getting reset at toplevel scope. Zed: ah ok disruptek: and soon, increment compilation caching. 😁 disruptek: incremental, too. zacharyc1rter: is there a way to manually increment a reference with `--gc:arc`? zacharyc1rter: like an equivalent of `gcRef`? Or should I just create a pointer to the object? leorize: I thought there's still GC_ref for arc? leorize: yea that's still there zacharyc1rter: hmm voltist: shashlick: You are genotrance right? shashlick: Yep leorize: Zed: also an undocumented fact: your code runs faster in a main() proc voltist: Cool. I'm just updating a spare Manjaro machine I have so I can test to see if the choosenim issue is present. Manjaro is very much Arch based, so if it works there then the issue must arise from one of the few differences Zed: ok dumb question, Zed: i have 2 functions `proc initSomething*()` and `proc initOtherThing()` Zed: I'm getting an error when trying to use the initOtherThing function inside of initSomething, do i have to import the function or something? shashlick: Ya I tested a docker image of Arch and couldn't reproduce the issue voltist: And that difference should also be present in the Arch linux Docker image that you tested, so that might narrow things down a bit voltist: Yeah Zed: leorize: why would that be, probably something interesting to look into leorize: top-level stuff are considered to be "global" leorize: so certain optimizations couldn't work there shashlick: Ya if you can get it to fail in a docker image, will be easy to root cause Zed: ah yeah that makes sense shashlick: Windows CI on Travis is so slow compared to Linux shashlick: @leorize how's the performance on azure pipelines voltist: shashlick: I tried the docker image as well (essentially recreated my new-ish install that it failed on) and couldn't reproduce the issue either leorize: shashlick: faster than travis could ever be leorize: github actions also works if you don't want to sign up for a microsoft account shashlick: Azure yml files seem a lot more complicated shashlick: Don't feel motivated to sit and learn that leorize: it just separate things into steps shashlick: Could you create something like https://gist.github.com/genotrance/fb53504a4fba88bc5201d3783df5c522 for azure leorize: azure model is pretty cool, you can create a template and everyone can reference it leorize: yes, and I can even put it on a public repo and everyone can reference it from their azure yml :) leorize: I'll give it a go later voltist: shashlick: Here is one possible lead. The arch install it failed on was the using the image provided by Linode; perhaps the docker image is the 'true' version and the Linode one is broken. shashlick: That will be great - one stop shop to get azure working for Nim shashlick: Thanks in advance shashlick: @voltist could be but it's weird nonetheless voltist: Indeed voltist: shashlick: What we really need is for more people who actually run Arch Linux to contribute to the troubleshooting voltist: I've tried installing it in the past, and I do not want to go through that again :) leorize: never thought that people running Arch would be a rare sight :P voltist: Yeah voltist: Maybe it's those three who just left IRC. They were the Arch users among us... voltist: 4 in fact KingDarBoja: Guys, how can I use external std modules on nim playground? KingDarBoja: Like unicodeplus Yardanico: Wdym "external std" Yardanico: And you can only use some packages which are available on playground leorize: !repo nim-playground disbot: https://github.com/inim-repl/INim -- 9INim: 11Interactive Nim Shell / REPL / Playground 15 247⭐ 19🍴 7& 18 more... leorize: !repo PMunch/nim-playground disbot: https://github.com/PMunch/nim-playground-frontend -- 9nim-playground-frontend: 11The front-end for https://play.nim-lang.org 15 11⭐ 4🍴 leorize: !repo PMunch/playground disbot: https://github.com/PMunch/nim-playground-frontend -- 9nim-playground-frontend: 11The front-end for https://play.nim-lang.org 15 11⭐ 4🍴 leorize: https://github.com/PMunch/nim-playground leorize: ^ PR welcome leorize: also disruptek, you should look into why disbot couldn't show me this one repo :P Yardanico: https://github.com/PMunch/nim-playground/blob/master/docker/packages.nimble KingDarBoja: I see Yard Yardanico: And it actually has unicodeolus Yardanico: *plus leorize: ping PMunch to check for the packages when he come online then KingDarBoja: Okay KingDarBoja: I just checked source code of unicodeplus proc isAlpha KingDarBoja: https://nitely.github.io/nim-unicodeplus/#isAlpha%2Cstring KingDarBoja: Seems like if I provide a printable rune which is not an ascii letter, it will be true anyway KingDarBoja: As it has an else branch to check by category 🤔 leorize: try unicode.isAlpha i guess KingDarBoja: Seems I better do the check with the int range KingDarBoja: Yields true KingDarBoja: Should better use rune.int is in range 65 - 90 or 97 - 122 KingDarBoja: It does -> (c.unicodeCategory() in ctgL or utmDigit+utmDecimal+utmNumeric in c.unicodeTypes()) KingDarBoja: Solved it 😄 Zevv: Yardanico: yeah, don't use npeg for these kind of things if you're concerned about performance. gogolxdong: @shashlick, thanks for remembering that. It will be helpful. shashlick: 👍:skin-tone-3: KingDarBoja: How I can check installed package version, i.e. unicodeplus version KingDarBoja: Using nimble Zed: nimble list -i Zed: lists all installed packages and their version shashlick: `nimble list -i --ver` shashlick: heh you don't need the --ver Zed: How do you declare a function inforward declaration? Zed: just the function header and then i fill it in later KingDarBoja: I just noticed I can't declare `requires unicodeplus == 0.6.0` on mypackage.nimble file KingDarBoja: Instead, I must use `>=` lqdev[m]: you can use `requires "unicodeplus 0.6.0"` leorize[m]: Zed: to forward declare, just write the function without the `=` at the end Zed: yeah i realised that not long after sending it bung87: https://github.com/nim-lang/zip/pull/52 can this get merged? disbot: ➥ add zip_source_buffer_create,zip_open_from_source to libzip,fromBuffe… PMunch: Speaking of things that can be merged: https://github.com/nim-lang/packages/pull/1444 disbot: ➥ Add ansiparse and ansitohtml packages bung87: after nimble reinstall dep lib need more step? it still use old version bung87: ignore this. Bennyelg: hey how can I remove nimcache from my project ? where does it placed ? Bennyelg: I suspect that there is a bug when running several delete statements on nim simple loop Vindaar: @Bennyelg the cache is in `~/.cache/nim/` Vindaar: but if unsure you can also just hand `-f` to your nim call to force a full rebuild Bennyelg: /Users/benny/.choosenim/toolchains/nim-1.2.0/lib/system/fatal.nim(49) sysFatal ⏎ Error: unhandled exception: index 1 not in 0 .. 0 [IndexError] Bennyelg: so wierd Bennyelg: @Vindaar Well so its not that Bennyelg: I run it ⏎ nim c -r "/Users/benny/DLM/backend/src/database/database.nim" Bennyelg: ```code paste, see link``` ⏎ ⏎ What Im doing wrong - looks like everything is deleted but fatal is raised [https://gitter.im/nim-lang/Nim?at=5ea9371b5cd4fe50a3da34a8] Vindaar: Since you're getting an index error, I assume the problem is in line `let tableName ...` ? Vindaar: Maybe one of those split calls doesn't do what you think it does Bennyelg: Output: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea93754a9de3d01b1d8001a] Vindaar: see, it's complaining about line 22 :) Bennyelg: thanks I'll check flywind: I want to import one module in nimble which has the same name in `stdlib`, when I use `import module` which one will be searched first? dom96: stdlib flywind: thanks, I will rename it. liblq-dev: I just tried to do something with soundio again, so I updated my wrapper to support latest nimterop but now for some reason I get a segv liblq-dev: (that reason is that the write callback seems to be null, which is really weird) Araq: liblq-dev, compile with --gc:arc and run valgrind liblq-dev: Araq: my code is incompatible with ARC, it has a bunch of pointer casting with refs which prevents destructors from being generated properly liblq-dev: should I just create my own `destroy=` procs? liblq-dev: how would I go about doing that? Araq: what does that mean "prevent destructors from being generated properly"? Araq: sounds like a bug you should have reported Araq: in fact, it sounds like the bug I fixed yesterday... liblq-dev: Araq: Error: cannot bind another '=destroy' to: RAudioDeviceObj; previous declaration was constructed here implicitly: /home/daknus/Coding/Nim/rapid/src/rapid/audio/device.nim(41, 14) Araq: oh that one, reorder your procs liblq-dev: how should I reorder them? liblq-dev: like, what order Araq: it tells you, "was constructed here" Araq: so that must move below your =destroy / finalizer liblq-dev: oh right liblq-dev: ok, seems to compile now liblq-dev: wow, that valgrind output's really clean liblq-dev: I should use ARC a lot more liblq-dev: so it seems like there's an invalid write at https://github.com/nim-lang/Nim/blob/version-1-2/lib/system/threads.nim#L307 but I don't see anything else liblq-dev: how can I disable segv checks? liblq-dev: so that valgrind can detect them Araq: liblq-dev, compile with -d:noSignalHandler liblq-dev: well, problem is that the backtrace points to createThread in the main thread, but the error actually occurs in another thread liblq-dev: the backtrace that valgrind gives me, that is Araq: there are other sanitizers beyond valgrind Araq: I don't have much experience with valgrind plus multi threading, sorry Araq: oh and also use -d:useMalloc Araq: otherwise valgrind is kinda blind liblq-dev: can you recommend a different memory sanitizer? PMunch: What does Nim do when you don't have -d:useMalloc? hax-scramper: I'm trying to concatenate `static` parameters in generic (proc takes two types with `array[N1, string]` and `array[N2, string]` as generic parameters and type of return is `array[N1 + N2, string]`). I'm getting compilation error `cannot instantiate U. got: , string]]]([type node])> hax-scramper: but expected: `. The code is here: https://play.nim-lang.org/#ix=2k0w Araq: PMunch, it uses our own O(1) allocator Araq: (which is usually faster, but not always) clyybber: Araq: Were you talking about bugs with gc:orc? Does it work with async? Araq: https://github.com/nim-lang/Nim/issues/14079 this one for example disbot: ➥ algorithm.sortedByIt template corrupts tuple input under --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2k0A Araq: or what about the bug that keeps 'koch boot --gc:arc' from working? clyybber: Ok, I will investigate Araq: well I'm on #14079 already disbot: https://github.com/nim-lang/Nim/issues/14079 -- 3algorithm.sortedByIt template corrupts tuple input under --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2k0A clyybber: Ah ok Araq: but it would be nice if 'koch boot' worked clyybber: The koch boot --gc:arc bug is because we have too much temporaries Araq: well fix it please clyybber: Araq: Is there a proc in the compiler to tell wether a conversion returns an lvalue or rvalue? liblq-dev: Araq: well anyways, valgrind doesn't help much, but GDB gave me a useful stack trace and from what I can tell what happens is a null pointer function call liblq-dev: I'm just unable to track down why it happens Araq: clyybber, no, I usually assume that conversions are lvalues fwiw clyybber: Ok Araq: and once --gc:arc works for bootstrapping, we should test --gc:orc Araq: but I have a novel optimization for --gc:orc in the pipeline PMunch: Hmm, I have more questions, but it hits me that it's probably just because I don't really know how memory allocation actually works low-level liblq-dev: so, for some reason it crashes on createThread on ARC PMunch: I thought malloc was basically a kernel call Araq: PMunch, no the kernel call is usually 'mmap'. malloc is not in the kernel because it would be too slow Araq: liblq-dev, also try --tlsEmulation:off please liblq-dev: nope, didn't do anything Araq: and also --exceptions:setjmp liblq-dev: nothing Araq: which OS are you on? liblq-dev: linux liblq-dev: the crash happens right here https://github.com/nim-lang/Nim/blob/15ba765ebd83e44d18a0a2c23016bdf3b4bbecca/lib/system/threads.nim#L307 liblq-dev: which seems weird as it's just a memory allocation clyybber: dom96: Is there a way to grep the irc logs? clyybber: I wrote down some stuff on the bug I want to fix but forgot what it was dom96: the only way is to look at each day and search it dom96: manually :) clyybber: damn PMunch: Yeah.. I've been thinking about writing an indexing bot for exactly this usecase.. PMunch: And to create graphs and such dom96: I need to modify NimBot to expose these as pure json dom96: should make it easier clyybber: Oh, I wrote it down on github too it seems flywind: Today it seems travis had some problems with downloading Nim using choosenim. flywind: https://travis-ci.org/github/iocrate/netkit/jobs/680904654 flywind: https://travis-ci.org/github/planety/prologue/jobs/680939844 dom96: looks like whoever is hosting the binaries is not liking the number of requests we are sending alehander92: PMunch yeah i wanted to see alehander92: how much i spam here alehander92: :D alehander92: show me a graph PMunch: Haha, yeah things like that PMunch: Who are the biggest posters PMunch: How long do new users stay in the channel PMunch: etc. alehander92: yea Recruit_main707: Zevv, can you use nim on an arduino emulator?? PMunch: Recruit_main707, I did manage to run it on the Arduboy emulator PMunch: So I'd say an arduino emulator shouldn't be a problem Recruit_main707: how hard was it? Araq: clyybber, or work on some other "showstopper" bug please clyybber: Araq: This is a showstopper IMO. The actual bug is not exclusive to gc:arc either Araq: clyybber, which one? clyybber: This one: clyybber: type clyybber: TPassContext = object of RootObj clyybber: PPassContext = ref TPassContext clyybber: PCtx = ref object of TPassContext clyybber: a: int clyybber: ModuleGraph = object clyybber: vm: RootRef clyybber: proc main() = clyybber: var g = ModuleGraph(vm: new(Pctx)) clyybber: PPassContext(PCtx(g.vm)) = nil #This compiles, but crashes at runtime with gc:arc clyybber: #PCtx(g.vm) = nil #This generates invalid C code clyybber: main() clyybber: clyybber: Oh sorry, this is the case which only crashes with gc:arc clyybber: This is the one: http://ix.io/2k1p clyybber: This generates invalid C code regardless of which gc we choose Araq: well now you know what to work on. ;-) clyybber: Thats what I'm doing :) shashlick: @liblq-dev: not sure if your crash is nimterop related but try `flags = "-H"` for your cImport call krux02: Araq, It would have been nice if you told me that you are going to remove me from the Nim organization liblq-dev: what does that do? shashlick: If you are trying #head shashlick: https://github.com/nimterop/nimterop/issues/169 disbot: ➥ Skip `{.header.}` generation shashlick: Basically -H adds the {.header.} pragma Araq: krux02, when I did that I had no idea I could still talk with you reasonably about anything shashlick: It was the default in 0.4.4 but is now opt in shashlick: If it fixes your issue then I'll have to reconsider since it will be the second crash shashlick: However it could also be a wrapper gen bug but need more info to debug shashlick: @Clyybber - your challenges with nimterop are hopefully fixed in master - it can now detect the config instead of depending on nimble shashlick: Appreciate some testing when you get a chance liblq-dev: shashlick: but how would {.header.} affect runtime though? shashlick: Haven't dug into it but it's worth checking shashlick: https://nim-lang.github.io/Nim/manual.html#implementation-specific-pragmas-header-pragma shashlick: Basically you are using the C type directly in the code so the size, etc will be exactly how it's defined clyybber: shashlick: Nice, I'll test it later! shashlick: @leorize suggested there are cases where headers hide details but I'm not sure how that works shashlick: My contention is that there could be a bug shashlick: But are you also testing when the new ast2 backend? shashlick: `flags = "-f:ast2"` shashlick: With Zevv: Recruit_main707: I don't see why not disruptek: shashlick: you're doing it again. bump more versions, please. clyybber: Hmm, this bug stems from the fact that lvalue casts are not a thing in C. Solution is to cast the address I guess. clyybber: Zevv: Would that violate strict aliasing rules? disruptek: shashlick: something wacky this way comes: https://api.travis-ci.org/v3/job/680316448/log.txt Araq: clyybber, it wouldn't Araq: strict aliasing is very subtle but don't worry about it, I'm gonna review your PR :P Araq: speaking of which... we compile without strict aliasing with --gc:arc we don't have to do that shashlick: disruptek: it's a big release with breaking changes so i'm taking my time to tag shashlick: want to transition to ast2 carefully PMunch: https://www.techspot.com/news/85020-lenovo-start-offering-thinkpads-linux-pre-installed.html PMunch: Nice! shashlick: disruptek: looks like i'll have to tag now thanks to that paramCount change shashlick: that's caused a lot of heartburn, what's the value in such a change PMunch: paramCount change? shashlick: https://github.com/nim-lang/Nim/pull/12860 disbot: ➥ Undefine `paramCount` & `paramStr` in nimscript.nim for *.nims Araq: shashlick, I think we need to revert this change Araq: breaks too much code PMunch: Wait, so they just moved into the os module? PMunch: Why not have nimscript just automatically import them from there. Possibly with a deprecation warning? kaushalmodi: The main issue was that if someone did `import os`, nim complained of ambiguous imports. kaushalmodi: The upcoming PR proposed by @timotheecour should fix that issue. Araq: from os import paramStr, paramCount Araq: export paramStr, paramCount kaushalmodi: Araq: Then the user has to keep a manual check on what `os` procs are defined in system + nimscript Araq: should do it, the compiler understands 'export' well and doesn't complain about ambiguous symbols kaushalmodi: After this is reverted, my `config.nims` will have `import os except existsDir, dirExists, existsFile, fileExists, findExe, paramCount, paramStr` kaushalmodi: the user should not need to manually track the ambiguous procs between os and system Araq: exactly my point... shashlick: Araq: if it genuinely cleans the code, i think we can deal with it but i haven't looked at this with sufficient detail Araq: well I'm not really into this problem but I don't see why we cannot simply use import+export Araq: so that code continues to work disruptek: CORRECT BY CONSTRUCTION Rika: caps disruptek: hell yeah caps Araq: disruptek, remember I said Nimscript causes ongoing costs? Araq: and here we are. ;-) shashlick: what's the problem with nimscript.nim today? shashlick: why do you want to get rid of it? disruptek: sometimes i wish this community had more focus. clyybber: community .. focus clyybber: its antithetic disruptek: doesn't have to be. clyybber: has to be antithetic in a "free" community clyybber: what should we focus on IYO? disruptek: rowing in the same direction. clyybber: in which direction? kaushalmodi: in the direction of config.nims shashlick: what disruptek is saying is that we pick a feature of the week or month and get it in shape as a team disruptek: i think the pipeline of features/fixes needs to be curated. disruptek: focussed. Araq: well it's my fault shashlick: i agree with that disruptek: yeah, let's pile on araq. Araq: I did the PR week, trying to get as many PRs merged/rejected as I could shashlick: but it's not like we all know all parts of the ecosystem zacharycarter: If I'm using `--gc:arc` and I pass a ref object to another thread, I need to call `GC_ref` corect? When do I then call `GC_unref`? disruptek: that's why we need to work together. shashlick: like if Araq said it's --gc:arc week, i can only do some testing at best zacharycarter: at the end of the threads execution or back in the main thread? disruptek: it's not just about cohesive work, it's about /not/ working on things out of scope. disruptek: so they stay in a control group. disruptek: i can't even CI most of my stuff most of the time because it's failing for one reason or another. Araq: zacharycarter, you don't need the GC_ref/unref dance anymore but you need to ensure you *move* the refs bung87: does nimble run pass compile flags? shashlick: so a proclamation that only PRs for features X, Y and Z will be accepted? zacharycarter: Araq: but what if I want to keep a copy of the object on the main thread as well? then I can't move right? Not until deepCopy works at least? Araq: why would you do that though, it's a recipe for race conditions shashlick: bung87 - yes per the help Araq: if you want to do that, write a SharedRef[T] bung87: `nimble run -d:bundle='/var/folders/j_/rjvv27dx4z594dfdfl7q9_kh0000gn/T/zipBundle.zip' --threads:on ` `defined(bundle)` not true zacharycarter: well I was going to use sync primitives to try to prevent races but it is messy... I guess I need to look at my code and figure out a way to eliminate shared state if possible zacharycarter: but I also see what you mean that `deepCopy` and then `moving` makes no sense either bung87: o, I should look carefully clyybber: disruptek: What is out of scope for example? Araq: clyybber, stuff that breaks somebody's code, I think. Araq: unfortunately, our "important package" testing is still insufficient leorize: how do other projects handle this? clyybber: By not testing with the devel compiler I guess clyybber: Similarily to the csize_t thing I think reverting it now would cause even more hassle/work. leorize: we probably should see how other projects do their management leorize: maybe they have some tricks that we don't know of leorize: I don't think "man power" is an issue anymore for Nim Araq: leorize, I think it is in the sense that we don't make good use of our man power disruptek: i really want to write a ci that doesn't suck. Araq: I thought about writing RFCs about what should be developed and spend roughly 100% of my time on code reviews disruptek: roughly. disruptek: the thing is, i like the lesson of "it's not rocket science" but i just don't think it really captures the whole space. disruptek: the rust ci, i mean. leorize: too much of nim is dependent on Araq :/ leorize: what happened to the entire code owners proposal btw? Araq: the other code owners don't get to work 10 hours every day on Nim, it's still a thing though leorize: also I think we should spend a lot more time fixing bugs leorize: the compiler just have too many of them leorize: new features are nice and all, but bugs when using Nim-specific features drive people away Araq: it depends on the bug, most remaining bugs will cause regressions when fixed Recruit_main707: is this doable? `proc check_packet_type(packet: JsonNode): GameState or Error =` disruptek: fewer PRs, higher quality. leorize: we have 6 yrs old crashes leorize: I think regressions are fine if they can be justified leorize: ie. tightening up some unspecified parts of the spec leorize: currently the situation with macros/generics is: if it doesn't work, report a bug, then hunt for ways to make it work while you wait for the bug to be fixed disruptek: nimph is only crash-free when built on 1.0 and it cannot determine prefixDir on 1.0, so it cannot function. disruptek: so you build it with 1.0 but you run it against later compilers... that cannot build it. Araq: disruptek, we can fix the later compilers though clyybber: Why do you get crashes on 1.2? disruptek: some kinda openssl alloc bullshit, who cares. clyybber: well, you should? Araq: Recruit_main707: use an Either[T, S] type Rika: @Recruit_main707 no Rika: what araq said yes disruptek: gittyup failed its cron-job CI after less than a week because of some choosenim/nimterop bug. Rika: you can also just make a Result[T, E], which is basically an Either Rika: maybe add some helper procs for Result too like isError or something Rika: you can also do what golang does, use a tuple Rika: but i dont recommend that lol Recruit_main707: how does this Either/Result work? Araq: leorize, well ok, crashes are easier as the chance of regressions is lower Rika: its an object variant im guessing Araq: and I can give you the missing pieces of the spec too, I wrote them down somewhere leorize: I'm also seeing a huge amount of bugs assigned to zah leorize: but he is not active nowadays Araq: but that's again "omg, let's fix everything at the same time and also: the Nimble package ecosystem must grow and continue to work" Rika: https://play.nim-lang.org/#ix=2k2D something like this i assume @Recruit_main707 leorize: it's a bridge that we have to cross leorize: gaining "maintained" packages are better than just packages Recruit_main707: i think make both inherit from a Message packet is probably the best way Recruit_main707: Message type* zacharycarter: does this make sense? - https://play.nim-lang.org/#ix=2gcc leorize: and nothing drives people away more than "I try to do this thing with macros but it crashes on me instead" leorize: I think it's ok to spend a month just hunting down as many issues as possible leorize: iirc we did this for 1.0 Araq: we need tick-tock releases Araq: like Intel did disruptek: yes. disruptek: i always do it and it's never a problem. leorize: our packages ecosystem is in a much better shape right now disruptek: we don't have to come up with the perfect improvement to the project, just some things to experiment with. Araq: but I do what I do because IMO a "fixed Nim v1" with all the bad parts regarding its threading story for me is an uncompetitive Nim. disruptek: shashlick: would you write a spec for how pm should work in nim? then we can version it and make the compiler and pm work together always. Araq: and if that means I spend less time on compiler crashes, so be it Araq: nice side effect: I also don't get regressions due to compiler "fixes" clyybber: disruptek: Isn't nimph exactly that? disruptek: not as long as the compiler changes. leorize: the threading story is not gonna be perfect anytime soon leorize: what happen to bugs while you're at it? companion_cube: since nim has such a pascal influence, what do you make of Ada tasks? Araq: leorize, they become your job ;-) disruptek: new features really have to justify their existence. companion_cube: (as a main model of threading I mean) leorize: can't you ask status to dedicate a personnel for fixing bugs? :P disruptek: they are increasingly expensive. so much so that some features that were cheap are now both unused and expensive to carry. clyybber: disruptek: Can you specify which compiler changes? Maybe its an easy fix leorize: I work on my own projects and what annoys me more than ever is the need to hunt compiler bugs disruptek: well, as an example, choosenim raised a bug in nimph, the "correct" solution of which was to change the compiler. so devel has this fix but 1.0 does not. companion_cube: I think kruxø2 has ideas about what features to remove :p zacharycarter: I guess my `SharedRef[T]` works because I'm not leaking anything and I'm not encountering any NPE's. ASAN is also happy zacharycarter: Oh yeah - krux02 was saying last night that he's no longer a member of the Nim org on Github zacharycarter: Not sure if that was a mistake or what clyybber: disruptek: So say you only support 1.2 and above? That doesn't work because you get crashes. So these must be fixed? companion_cube: oh so did he quit? disruptek: this isn't about my projects; i can handle them. zacharycarter: companion_cube: no... I dont think he removed himself Araq: he didn't quit, I removed him. zacharycarter: okay then - not trying to stir anything up just wanted to mention that he had noticed and was trying to tag an issue or something Araq: companion_cube, Ada tasks are most often mapped to threads narimiran: " the other code owners don't get to work 10 hours every day on Nim" -> but there is a certain someone who opens 3 PRs/day, opens 5 issues/day, writes 50 comments/day, etc. maybe we could focus him on more important stuff? ;) narimiran: (to my untrained eye, it looks like he spends 15+ hours/day on Nim :)) clyybber: The threading story is a library only issue IMO. leorize: the entire compiler is owned by Araq :P Rika: let's clone ar4a Rika: q clyybber: (discarding the fact that spawn is in the compiler :p) Rika: damn fingers aint hitting well because my nails are long clyybber: lol Araq: clyybber, it's beginning to be a library issue because of arc/orc clyybber: Yeah Recruit_main707: Rika: how did you miss the q for 4 though Araq: zacharycarter, it wasn't a mistake, you cannot shit on me all day long and expect no reaction Rika: @Recruit_main707 4 is intentional, i hit a instead of q Bennyelg: whats is wrong on with this pattern when I use os.walkfiles *_(\\d){8}_(\\d){4}.sql inside specific dir with 1 file (add_column_to_students_20200101_1000) Bennyelg: (add_column_to_students_20200101_1000.sql) Araq: leorize, fix bugs, get bounties Araq: disruptek, I think the problem for you was mostly our lovely "we must check certificates for SSL" change Yardanico: so about arc - how do I debug its issues? :P for example nimes (nes emulator in nim) runs fine with default GC on devel but not with arc leorize: well where are the bounties? :P leorize: we stopped assigning them 2-3 years ago :P leorize: -d:useMalloc and valgrind :p Yardanico: leorize: well it doesn't leak memory Yardanico: it segfaults at some array access Yardanico: as far as I can see Yardanico: but yeah I'll try clyybber: Hmm. Does valgrind not tell anything? leorize: valgrind is more than just a "memory leak checker" :p Yardanico: well the last valgrind message before the segfault (segfault has a full nim traceback btw) "Invalid read of size 8" ..call stack.. "Address 0x0 is not stack'd, malloc'd or (recently) free'd" clyybber: Ah, nice so its a use after destroy clyybber: Probably Yardanico: nimes is ~2k loc but I'll try to minimize it clyybber: Thanks <3 zacharycarter: Araq: is this similar to what you meant by a `SharedRef[T]`? zacharycarter: https://play.nim-lang.org/#ix=2gcc Araq: that link doesn't work for me zacharycarter: let me try again zacharycarter: https://play.nim-lang.org/#ix=2k2M Yardanico: also nimes uses nim sdl2 wrapper so maybe that's an issue too clyybber: Shouldn't be Yardanico: ok, now it's 1.7k loc zacharycarter: does that link work? Yardanico: zacharycarter: the last one you sent? yes Yardanico: I mean webpage opens :P zacharycarter: cool thanks :) Araq: zacharycarter, hmm looks dangerous clyybber: Araq: Do you think its better to always cast so as to preserve the lvalueness or should I only do it when theres a lfPrepareForMutation ? Araq: I don't know clyybber: Hmm, its a bit of a tricky issue. Basically we have to know when generating the conversion wether we want an lvalue or not. clyybber: So I generate the casts so as to preserve lvalueness when possible. Araq: pass it down via another flag in the TLoc, as you outlined clyybber: Ok Araq: (if only the codegen was an AST to AST transformation...) clyybber: Is there a helper proc to check wether a node is an lvalue or rvalue? Araq: plenty Araq: parampatterns.isLValue clyybber: Is that ok to use in cgen? Araq: yeah clyybber: Btw, asking everyone here, whats your opinion on those CI badges? Yardanico: I personally don't think they're so useful narimiran: clyybber: probably the same as yours ;) Yardanico: it's just to boast "look my tests are passing" clyybber: IMO they don't really have a purpose other than detracting potential users because of red CI and being advertisement for the CI s Yardanico: ok it seems to fail on this line "let n = mem.nes" Yardanico: where mem is a ref object, and nes is its only field Yardanico: oh maybe cyclic references Araq: I like them fwiw Yardanico: can arc segfault because of cyclic references or not? Araq: Yardanico, they don't have any influence Yardanico: ah ok Araq: it cannot clyybber: The way the readme currently looks is a bit ugly Rika: failing ci tests can be some sort of red flag or so clyybber: Rika: Exactly, and the CI's often fail due to unrelated (non nim) issues narimiran: Araq: are you aware that we now have 7 of those badges? clyybber: This "devel: BIGBADGE 1.0: BIGBADGE" formatting doesn't look too good IMO zacharycarter: Araq: what should I do then? Use `allocShared` and a counter or something? Yardanico: clyybber: so I have to look for some eqdestroy calls for the mem.nes field which is apparently 0 ? Yardanico: i mean it's zeroed somewhere clyybber: Yardanico: Yeah, its probably a double free/destroy clyybber: You don't have to look for them though, only minimize and report it :D leorize: narimiran: we can probably put all of those badges in a table :P leorize: or just get rid of them leorize: I never understand the appeal narimiran: i like the latter solution ;) clyybber: Same Yardanico: well there are 5 places where eqdestroy___hNmUe038zNCVJTLCEwmijA(&nes); is called Yardanico: in the C code Yardanico: ah maybe that's on error clyybber: Yardanico: Yeah, thats the bug in the compiler Yardanico: so I set =destroy hook for the CPU object in nimes and it was called twice, although there still was a segfault so it isn't the only place with double free or something Araq: zacharycarter, https://github.com/nim-lang/Nim/pull/10485/files study this disbot: ➥ Draft of smart pointers library for Nim Yardanico: because if I replace =destroy with my own hook which doesn't actually destroy the object it should've worked, so I'll try to add more =destroy hooks zacharycarter: thanks Araq clyybber: Yardanico: Does nimes use custom =destroys ? Yardanico: no Yardanico: last commit was 1.5 years ago ;) Yardanico: but it still works just fine with default gc on latest devel, only a few deprecation warnings leorize: does it use finalizers? Yardanico: I don't think so Yardanico: also I'm down to 1.5k loc :D removing stuff not related to the bug Yardanico: and yes I still test with default gc to make sure it doesn't segfault Yardanico: ok lemme try to manually remove all these 5 destroy calls from the C code and see if it works :P Yardanico: down to 700 loc :D Yardanico: ok I'm getting there, 300 loc clyybber: \o/ Yardanico: clyybber: will it be better for you if I put everything in 1 file or not? clyybber: Would be better probably liblq-dev: does echo still flush stdout? clyybber: Yeah liblq-dev: hm clyybber: Araq: If this is true https://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L2470 it will probably be tyRef right? Yardanico: ok I think I can't minimize anymore, it's 178 lines of code (134 cloc) Yardanico: also it requires a .nes file (although I'm using one of the emulator test ROMs available for download freely) Recruit_main707: i see nes emulators are a popular project Yardanico: well kinda Yardanico: because it's all documented and stuff Yardanico: nimes is ~2k cloc Yardanico: full NES emulator Recruit_main707: what are those test ROMs? Yardanico: https://wiki.nesdev.com/w/index.php/Emulator_tests Yardanico: I'm using the first one from branch_timing_tests here Recruit_main707: because i _might_ have just grabbed the first ones i found Yardanico: nimes will work for ~85% of all nes roms out there Yardanico: it won't work for roms which use some less known mappers Recruit_main707: https://tenor.com/view/pewdiepie-9year-old-army-tgay-congratulations-for-legal-reasons-thats-ajoke-gif-13924557 Generic: I'm writing a 3ds emulator in Nim Generic: though if it will ever start game (or even homebrew) is still unknown Yardanico: clyybber: https://file.io/itlqvV7k it's one self-contained file and a NES rom (taken from https://wiki.nesdev.com/w/index.php/Emulator_tests) Yardanico: i removed all sdl2 dependencies, it only depends on stdlib Yardanico: the "correct behaviour" for it is to do an endless loop and print "false", but with --gc:arc it segfaults Yardanico: ah right Yardanico: it works if I remove " result.apu = initAPU(result)" line Yardanico: (it enters an endless loop with --gc:arc just like with default gc which is "correct") Yardanico: oh wait, I don't think it needs a rom at all Yardanico: should I make an issue? it's 69 loc now https://gist.github.com/Yardanico/4f2d95d1e7df51cfb7a1d91ae65326ea leorize[m]: yep, that looks clean Yardanico: poor nimes, i stripped everything I could :D Yardanico: https://github.com/nim-lang/Nim/issues/14159 done disbot: ➥ [ARC] Segfault with cyclic references (?) ; snippet at 12https://play.nim-lang.org/#ix=2k3K dgb: Making a NES emulator in Nim? Nice. Yardanico: dgb: no, it existed for a long time now Yardanico: https://github.com/def-/nimes I was just trying to run it with --gc:arc dgb: Ahh, I see clyybber: Yardanico: Good job on that minification! Yardanico: well I hope I didn't mess something up while reducing it :P Yardanico: the error still seems to be the same as in the start though Recruit_main707: is it finished yet? Yardanico: what? Recruit_main707: nimes Yardanico: nimes? it's finished for years Recruit_main707: ah xD Recruit_main707: so you are testing arc with it then? Yardanico: read readme in https://github.com/def-/nimes and https://hookrace.net/nimes/ Yardanico: yes Yardanico: actually read https://hookrace.net/blog/porting-nes-go-nim/ leorize[m]: https://doc.rust-lang.org/error-index.html <- this is pretty useful leorize[m]: maybe we can do something similar Yardanico: I think someone talked about a bit similar idea Yardanico: create a tool which will parse nim compiler error messages and give useful output baed on them Yardanico: based* my s key seems to be working badly clyybber: Araq: https://github.com/nim-lang/Nim/pull/14161 disbot: ➥ Fix #14160 Bennyelg: what is wrong ? ⏎ let dt = "202001011000" ⏎ parse(dt, "yyyyMMddhhmmss") Yardanico: you don't have seconds in this string Yardanico: yyyyMMddhhmm works fine Bennyelg: oh bah yea thanks didnt notice :| Araq: clyybber, nice and I have a fix for #14079 disbot: https://github.com/nim-lang/Nim/issues/14079 -- 3algorithm.sortedByIt template corrupts tuple input under --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2k0A shashlick: so i ran an execCmd() call that returned a value of ret = 256, when I use quit(ret), i get a value of 0 - what's going on? shashlick: this is only on osx leorize: overflow :P leorize: execCmd() does some magic to mask the return code so that it's similar to what a shell would return shashlick: but return value of execCmd() is defined as int, and for quit(), the param is int again leorize: the overflow is not in nim leorize: it's how macos works shashlick: okay so what's my recourse shashlick: if osx and val > 255, mod Araq: only use 0 and 1 as exit codes leorize: shashlick: looks like this is posix fault shashlick: i'm calling nim which errors out with AssertionError and sets errorlevel = 256 leorize: > The value of status may be 0, EXIT_SUCCESS, EXIT_FAILURE, or any other value, though only the least significant 8 bits shall be available to a waiting parent process. shashlick: okay `quit(ret mod 255)` zacharycarter: mratsim: would you be opposed to me working on - https://github.com/mratsim/weave/issues/88 disbot: ➥ Latency-optimized / job priorities / soft real-time parallel scheduling zacharycarter: and also updating the benchmarks to follow pointers for copyMem calls to get things working with `--gc:arc`? zacharycarter: actually - I could use an example for the last thing I mentioned as to where this is an issue and what needs to change Recruit_main707: once a thread ends the rest of them seem to die, why? zacharycarter: do you have an example? Recruit_main707: https://play.nim-lang.org/#ix=2k4x Recruit_main707: i didnt include the actual url Recruit_main707: at line 97 the client thread should end, and the bot thread should start working (but it was already active) mratsim: @zacharycarter, no problem mratsim: Hint: instead of popFirst, do a popLast here: https://github.com/mratsim/weave/search?q=popFirst&unscoped_q=popFirst zacharycarter: ah yeah - I think the popFirst and thread local priority queue stuff is pretty straightforward mratsim: and you probably need each worker to have a local priority queue as well: https://github.com/mratsim/weave/blob/master/weave/datatypes/context_thread_local.nim#L47 zacharycarter: I was a bit confused about the memcopy stuff and following pointers - is that an issue with Weave itself or just the bnechmarks? mratsim: what's that memcopy stuff? zacharycarter: related to gc:arc zacharycarter: you mentioned in IRC the other day:`Weave used to work with arc for all the benchmarks/test suite, the main unknown is Nim seq/strings` zacharycarter: `well I'm pretty sure they don't work know because I use copyMem without following pointers but, would support be easy enough to add` mratsim: arguments are memcpy naively not deep copied mratsim: that means that for seq/strings without destructors I would have GC issue mratsim: and with destructors I would need to make sure that the argument are "sink" mratsim: so that we don't have 2 seq/strings actually "owning" the same memory mratsim: https://github.com/nim-lang/Nim/blob/devel/lib/system/channels.nim#L334-L341 mratsim: but from the code there ^, with destructors copyMem shoud be good zacharycarter: gotcha zacharycarter: thanks for the explanation Araq: the new string impl is still "pointer free" in the sense no additional indirection was introduced mratsim: isn't it still ptr + len + reserved? Araq: it's a (len, ptr) pair and the ptr pointing to cap + data mratsim: I see Knaque: I'm writing yet another Git-related tool, and this time around, it needs to work with Github. What's the "best" solution/workaround to the username and password prompts, in the case of using `osproc.execProcess()` to run the commands? leorize: you can write an interface to that iirc leorize: Knaque: https://git-scm.com/docs/gitcredentials.html Knaque: That essentially saves the username and password to disk, if I understand correctly? leorize: you can provide a GIT_ASKPASS helper leorize: which might be something that can notify your program to prompt for that disruptek: !repo github disbot: https://github.com/disruptek/github -- 9github: 11github api v3 for nim 15 7⭐ 0🍴 7& 29 more... Knaque: @disruptek that is a *lot* of `call` procs leorize: for quick and dirty access to the api, it's the easiest way :P Knaque: Access to the API isn't really what I'm looking for, I don't think. I'm taking a look at the `GIT_ASKPASS` thing, but I'm not sure if that's quite right. I should've mentioned this initially, but this is using a GUI instead of a terminal, so that makes things a bit trickier. disruptek: await is a template now? disruptek: that shit merged? alehander92: yea? alehander92: is it breaking something? leorize: Knaque: on *nix, create an unix socket, then generate something that will communicate to that socket which will be run by git as GIT_ASKPASS leorize: actually you don't even need a socket, a simple FIFO should work, but if you work with many clients then a socket is recommended Knaque: Okay, to be entirely honest, I don't really know what most of those things are. I'm sure I have orders of magnitude less experience than you. Knaque: Right now, I'm at a position where all I'm currently being prompted for is a password, so what I *think* would work is writing the password to stdin, or something like that... If only I had a clue on how I would do so. Rika: sounds insecure Knaque: Of course, that's just a guess based on my loose understanding of how this stuff works. Knaque: And yeah, it's definitely going to be insecure. leorize: yes, you can just write it to stdin leorize: process.inputStream will get you the stdin stream leorize: then just write to it leorize: it's not that insecure tbh Knaque: I'm making this project for 2-3 people who don't really feel like learning proper Git, so security isn't really a priority. I just want something that works. leorize: what os are you targeting? Knaque: They should be using Windows, but it'd be a nice touch if it worked on *nix as well. leorize[m]: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Askpass.md leorize[m]: don't handle the passwords then, let windows do it for you leorize[m]: that thing even supports github 2FA :) Knaque: I *think* I get how GIT_ASKPASS is supposed to work? Correct me if I'm wrong, but it looks like all I really need to do is have a program just write the username and password to stdout, and askpass should just kind of... take care of it. Knaque: To reiterate, I really don't understand most of this stuff, so I'm essentially just guessing here. leorize: yep leorize: git call `$GIT_ASKPASS "Username: "` leorize: then it will take whatever echo-ed out as the input Knaque: Is there a specific format I need to follow? leorize: as written in the manpage, no leorize: > A suitable prompt is provided to the program on the command line, and the user’s input is read from its standard output. Knaque: Well, it looks like it's half working. "Invalid username or password." Knaque: So, I must've written it wrong. Knaque: `stdout.write("coolusername\nsupersecretpassword")` Knaque: Does it need prefixes? i.e. `username: coolusername` Knaque: Sorry for all the questions, by the way. I'm just genuinely clueless. leorize: you gotta experiment :) leorize: I'm as clueless as you are Knaque: ah, that's always fun (: Knaque: Wish me luck. Knaque: Ah, got it! So, evidently, the format is `password\nusername` Araq: bisecting for https://github.com/nim-lang/Nim/issues/14136 would be appreciated disbot: ➥ Semcheck regression when accessing a static parameter in proc ; snippet at 12https://play.nim-lang.org/#ix=2k5M Yardanico: I'll try :P Yardanico: Araq: I don't know if that's correct, but git bisect says that it's https://github.com/nim-lang/Nim/commit/10eabec6d442cb32c2c74f7c56cc9fff3be40104 Yardanico: Bisecting: 0 revisions left to test after this (roughly 0 steps) [10eabec6d442cb32c2c74f7c56cc9fff3be40104] fix #12864 static params were mutating arg types during sigmatch; fix #12713 ; refs #13529 (#13976) disbot: https://github.com/nim-lang/Nim/pull/13976 -- 6fix #12864 static params were mutating arg types during sigmatch; fix #12713 ; refs #13529 leorize[m]: same result here leorize[m]: koch temp is awesome :P Yardanico: yep :D leorize[m]: you can just plug that into `git bisect run` then you can just chill out Yardanico: wait wat?! Yardanico: I did it manually lol Yardanico: oh I see Yardanico: very nice leorize[m]: your computer is too fast compared to mine :P Bennyelg: from dateTime to only date ? Bennyelg: how I truncate the hh:mm:ss Yardanico: https://nim-lang.org/docs/times.html#toTime%2CDateTime Yardanico: but it won't "truncate" them shashlick: poor man's cross-platform timeit to measure time taken for a command to run - https://github.com/nimterop/nimterop/blob/master/tests/timeit.nim Yardanico: lol shashlick: here's a timing summary of nimterop tests - https://travis-ci.org/github/nimterop/nimterop/jobs/681167509#L10109 Samrose-Ahmed: Hi, anyone encounter `undefined reference to `__builtin_ssubll_overflow` error when building nim from source? Yardanico: that happens if your C compiler is too old Yardanico: what's it's version (I assume GCC)? Samrose-Ahmed: gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) Yardanico: yeah that's a bit too old I think Samrose-Ahmed: Hm Yea makes sense I'll have to upgrade it. thx Recruit_main707: the godot nim example is broken by default :) zetashift: @Recruit_main707 you mean the stub? I tried it yesterday on 1.2 and it worked for me Recruit_main707: the dodgethenims Recruit_main707: like the game example i mean Yardanico: well what's the error? Recruit_main707: E 0:00:31.582 Unhandled Nim exception (NilAccessError): Could not access value because it is nil. Recruit_main707: proc onMobTimerTimeout*() {.gdExport.} = self.mobSpawnLocation.offset = rand(high(int32)).float64 Recruit_main707: thats the function that causes the error Yardanico: well maybe godot api changed or something zetashift: huh zetashift: that's my code but indeed I never updated that code zetashift: I think I even mentioned that in the readme haha zetashift: wait no dodgethenims was updated Recruit_main707: the api has not changed in that at least (PathFollow2D still has `offset=` zetashift: it might be because a packedscene isn't set in the editor correctly zetashift: I know that Godot sometimes "forgets" it zetashift: I'll check for you Recruit_main707: thx Recruit_main707: ill stay in discord, but i have to go to bed now zetashift: alright I'll ping or just PM you iffy: Is there a good non-deprecated replacement for `{.define: mything.}`? When running `nimble test` I want some tests compiled with one flag and other tests compiled with another flag Yardanico: nimbot alive Bennyelg: how can I do someething like ⏎ ⏎ ```type ⏎ StudentModule = object ⏎ Students: proc ()``` ⏎ ⏎ and pass the function with some of the parameters and not all [https://gitter.im/nim-lang/Nim?at=5ea9ff549f0c955d7d9498f6] Recruit_main707: I’m not sure what do you mean, you want to pass your prof certain args, but not all of them? zetashift: @Recruit_main707 `If you get a NilAccessError on the method onMobTimerTimeout please load the Mob scene in the editor on the Main Node. So select the Main node and in your Inspector you should see 'mob' as one of the script variables, load the Mob scene located in the scenes folder. You might have to restart your editor to see this after compiling the Nim source. And it might be gone after another restart. ` zetashift: also added this to the README Bennyelg: yes Bennyelg: module which will act as a functions container Yardanico: well default values for arguments exisrt Recruit_main707: zetashift: thank you very much Recruit_main707: What Yaradinco said, you would need to give them default values probably Rika: `Yaradinco` is a new one Yardanico: xdd Recruit_main707: I’ve been reading it like that for so long 😂 Recruit_main707: We will say that it’s because it’s late :p Bennyelg: we have a fast way to cast object to son ? Bennyelg: json* Yardanico: if you mean entire objects, no, use %* macro Bennyelg: %* on the object or on each variable inside the object Yardanico: check docs ;) Yardanico: https://nim-lang.org/docs/json.html#creating-json Bennyelg: Tried that Bennyelg: not working Yardanico: wdy, Yardanico: wdym* Yardanico: you need to specify fields manually Yardanico: not just the object itself Gary M: ok so I'm trying to translate some C code to nim where it's reading a file into a `void *code = NULL` Yardanico: well do you really want to translate 1:1? Yardanico: why not use normal nim IO functionality Gary M: not really because I don't want to deal with malloc stuff Gary M: but the way I'm doing it isn't working with the library I'm interfacing with Yardanico: that line sets code pointer to NULL afaik Gary M: yes Yardanico: you need "pointer" it's basically void * Gary M: well hold on a sec Gary M: I'm passing in a struct with the code size and a pointer to the code itself Gary M: so I'm trying to read the code with readFile() Gary M: but then for some reason it only wants a pointer of uint32 Gary M: ``` Gary M: VkShaderModuleCreateInfo* {.bycopy.} = object Gary M: sType*: VkStructureType Gary M: pNext*: pointer Gary M: flags*: VkShaderModuleCreateFlags Gary M: codeSize*: csize_t Gary M: pCode*: ptr uint32 Gary M: ``` Gary M: so from the documentation, it says > Gary M: Gary M: codeSize is the size, in bytes, of the code pointed to by pCode. Gary M: Gary M: pCode is a pointer to code that is used to create the shader module. The type and format of the code is determined from the content of the memory addressed by pCode. Prestige: hm is there no way to get an entry of an OrderedTable by index? Or at least just the first element, without iterating then breaking? leorize: yea, that's not a thing the api supports Prestige: Okay, thanks for the info Prestige: Hm I'm not quite sure what this error is about https://0x0.st/ieu4.png Says it's expecting an OrderedTableRef instead of an OrderedTable? Just trying to use `[]=` to add an entry nid: you should use `var tabTable = OrderTable[Tag, ]`. Prestige: Seems to have gotten rid of that error but now nimsuggest is complaining about.. something? On the same line: https://0x0.st/ieuU.png danielecook: Does anyone have trouble getting `terminal.isatty(stdin)` to work on macos? danielecook: specifically, I'm trying to test whether there is input from stdin danielecook: To be more specific, `isatty` works fine when I'm working interactively locally, but it fails when I run it within a continuous integration system danielecook: so My guess is there is something about it being non-interactive Prestige: ah when trying to compile from the cli I'm seeing more of the error. Hashing issue nid: User-defined object should define `hash` proc. nid: https://nim-lang.org/docs/hashes.html nid: https://nim-lang.org/docs/tables.html#basic-usage-hashing Prestige: Thanks, was just reading that :) Prestige: Is there a way to define an object as, Foo or any object that extends Foo? I might need to just show all the code to explain my situation Prestige: If anyone is willing to take a look (oop issue), https://github.com/avahe-kellenberger/nimdow/blob/masterstack/src/nimdowpkg/windowmanager.nim#L75 Prestige: I'm getting an error on that line: https://0x0.st/ieSq.png Prestige: If you look at tag.nim, it has a layout: Layout property. I'm attempting to have "Layout" be somewhat of an interface or base class nid: I could be wrong but i think in nim it makes more sense to have a proc in the base class that you assign on instantiation to the proc you want Prestige: Hm maybe I'll try that, I was attempting to follow this example of oop: https://nim-by-example.github.io/oop/ disruptek: please no. nid: ah that indicates im wrong nid: Please no who? disruptek: please no oop. nid: Dont worry disrupt my objects are all data holders more or less nid: 😛 nid: Why no oop? nid: inb4 "OOP was a mistake" Prestige: I am not sure another way to implement this than oop, although I pretty much have only done oop in the past nid: not making your layouts objects would me a way of not using OOP nid: Considering the layouts just a proc really Prestige: I was making them objects so I could also track the other properties of the layout nid: Properties of the layout like what? nid: I wonder if someone will implement a more Python-like class system 🤔 Prestige: borderWidth, gaps, number of windows in master, etc nid: Well those can all be declared inside the body of the nim fille and set by your config nid: Idk i generally think globally configured settings make more sense nid: I dont see why a layout needs to have gaps and border widths dependant on the object to implement them nid: Seems like it's a global state Prestige: some are layout dependent and at runtime, like the number of allowed master windows in a master/stack layout nid: Yea idk that doesnt seem like a per layout thing to me but im crazy so Prestige: but yeah gaps and borders may be configured globally Prestige: eh well actually it all should be per layout Prestige: or per tag rather nid: Eh, that's weird imo, but im also weird 😛 Prestige: Anyway I thought there'd be a way to do this with oop, but am not sure what the error is about nid: Seems it could be attempting to call the method for the intended type without casting it Prestige: yeah it doesn't infer the type of this.selectedTag.layout Prestige: but I didn't think it would have to Prestige: disruptek: Is there a way I could track the properties and the doLayout function without using objects? disruptek: just use a type for the layout and then run some code on it. Prestige: How would I have mutliple layouts conforming to the same function signature? Each Tag has to have a layout with some properties disruptek: use variant objects. nid: That's Nim strength nid: OOP is a headache on Nim 😄 You can make it work but need to be careful disruptek: it's never worthwhile. Prestige: Oh that's very interesting, thanks disruptek: i'd say the strengths in data structures are case objs, enums, and sets. disruptek: they all compose together nicely. bung87: ``` echo s.readAll ⏎ echo s.data``` ⏎ ⏎ the StringStream readAll return empty? [https://gitter.im/nim-lang/Nim?at=5ea7ac5d40f3430813c6673f] nid: How do I cross compile Nim? awr1: elaborate awr1: cross compile the Nim compiler? awr1: or some nim code? awr1: https://nim-lang.org/docs/nimc.html#cross-compilation awr1: alternatively if you want the simple way of doing things, consider installing zig and using nim's new `zig cc` backend awr1: https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html awr1: https://github.com/nim-lang/Nim/pull/13757 awr1: @danielecook try `isatty` from the posix module instead of the terminal one and see if any diff awr1: if there is no diff your assumption is probably correct awr1: nim OOP philosophy is to not design your programs around OOP in general but rather to use OOP as a tool only where most appropriate nid: Thanks nid: Hey, I am new to nim coming from Python! nid: Try to do some basic integration using nimpy but I get this error afters `i|port nimpy` saying that the `pyInitLibPath` when I do nid: nid: ``` nid: import nimpy nid: pyInitLibPath("some/path") nid: ``` nid: nid: but its clearly in the repo: https://github.com/yglukhov/nimpy/blob/90ae3899c269643f0cb5ca968869500afe617b7e/nimpy/py_lib.nim#L459 nid: nid: nid: I added nimpy to the .nimble file like this: nid: nid: ``` nid: requires "https://github.com/yglukhov/nimpy" nid: ``` nid: nid: Is it possible its using and older version of nimpy? nid: Hey, I am new to nim coming from Python! nid: Try to do some basic integration using nimpy but I get this error afters `import nimpy` saying that the `pyInitLibPath` when I do nid: nid: ``` nid: import nimpy nid: pyInitLibPath("some/path") nid: ``` nid: nid: but its clearly in the repo: https://github.com/yglukhov/nimpy/ version of nimpy? nid: Hey, I am new to nim coming from Python! nid: Try to do some basic integration using nimpy but I get this error afters `import nimpy` saying that the `pyInitLibPath` when I do nid: nid: ``` nid: import nimpy nid: pyInitLibPath("some/path") nid: ``` nid: nid: but its clearly in the repo: https://github.com/yglukhov/nimpy/ nid: nid: Is it possible its using an older version of nimpy? Does nimble use a cache? nid: Hey, I am new to nim coming from Python! nid: I'm trying to do some basic integration using nimpy but I get this error afters `import nimpy` saying that the `pyInitLibPath` doesn't exists. When I do nid: nid: ``` nid: import nimpy nid: pyInitLibPath("some/path") nid: ``` nid: nid: ts clearly in the repo: https://github.com/yglukhov/nimpy/ nid: nid: Is it possible its using an older version of nimpy? Does nimble use a cache? solitudesf: please, dont edit long messages on discord, this is how it looks for people in irc http://ix.io/2jRZ nid: Oof awr1: doesn't look like `pyInitLibPath` is exposed in the main nimpy module awr1: try `import nimpy / py_lib` awr1: @cgarciae nid: ^^ @cgarciae ^^ Vindaar: @pigmej Sorry, wasn't around anymore yesterday. Not sure how much of that is due to how its set up, but you may be right PMunch: Wait, is nid the new Discord bot? PMunch: Hmm, feature request: copy the bold username feature of the Gitter bot. Makes it easier to distinguish what the message is PMunch: Doesn't have to be bold, but just something else than normal text Araq: https://forum.nim-lang.org/t/5734#38665 leorize[m]: PMunch: it's not new, Yardanico just renamed it PMunch: Oh, so it's still the old FromDiscord? PMunch: And not the new one he'se been working on? leorize: that one is nl, and it's running offtopic PMunch: Right PMunch: Araq, "shipping in 1.2" isn't that the current release? leorize: I don't know why we switched to short names like this :P leorize: PMunch: yea, arc and sink inference is in 1.2 PMunch: leorize, someone mentioned the names got a bit long on mobile leorize: the new orc that actually works is not in 1.2 though PMunch: I guess I was just confused by the -ing leorize[m]: now we just need some numbers from orc vs arc vs refc :) leorize[m]: if orc is working well then maybe it's the ultimate solution to nimsuggest leaking problems Araq: leorize[m], I doubt it, nimsuggest has logical leaks that no GC can help you with Araq: I could be wrong though, we should try --gc:boehm for nimsuggest PMunch: Ugh, I'm so annoyed about all these Corona tracking apps. Like FFS, it wouldn't be that hard to create an app that just records the data and keeps it locally on the phone. Araq: I can give you my 'havlak' benchmark numbers, it's 0.7s for --gc:arc vs 1.0s for --gc:orc Araq: all the other GCs are slower Araq: (all about 1.4s) PMunch: Slower? Neat! Araq: but --gc:arc never frees the cycles and the other GCs are forced via GC_fullCollect Araq: so --gc:arc is cheating leorize[m]: what happens if you use thinout w arc? PMunch: Wait, you run --gc:arc and then manually start another GC at the same time? leorize[m]: if that's slower than orc then orc is the next default? Araq: leorize[m], didn't try but it should be about 0.75s - 0.8s with thinout leorize[m]: what will {.acyclic.} do with orc? is it gonna turn off cycle collecting for that type? Araq: yes Araq: (already implemented) leorize[m]: can it be inferred for simple objects? I wouldn't want to add acyclic to 90% of my ref objects? :p Araq: it is inferred too but 'ref's design throws in a spanner Araq: type Node = ref object le, ri: Node # cyclic in principle leorize[m]: sounds like orc can be the reasonable default Araq: I still think that --gc:arc is what the library ecosystem should focus on and --gc:orc is for applications leorize[m]: so are we ever gonna see thinout() hints? :p Araq: thinout doesn't work with async and requires the same =trace proc generation mechanism Araq: so far it's not a winning design Araq: anyhow to improve the performance in the realworld further we need "scope based destruction" Araq: it's the biggest Todo on my list Zevv: yeah, that one was also trivial I heard Araq: it isn't :P Araq: but maybe if I implement it via another separate optimization pass Araq: narimiran, do not backport https://github.com/nim-lang/Nim/pull/14147 I made a mistake narimiran: ok PMunch: Hmm, is there any reason why "choosenim devel" doesn't have this PR in it? https://github.com/nim-lang/Nim/pull/14137 Vindaar: @PMunch: for some reason choosenim doesn't always give you the most recent devel. I noticed that the other day on travis PMunch: Hmm, well that's annoying.. PMunch: Oh right: "Updates to the most recent nightly build of Nim." PMunch: And: The '--latest' flag updates and builds the latest commit in the devel branch narimiran: PMunch: i think it gives you the latest nightly release narimiran: oh, you already answered it yourself :) PMunch: Okay, so I'm doing a docker container, and currently I need that PR so I do `RUN CHOOSENIM_CHOOSE_VERSION="devel --latest" ./choosenim-init.sh` is there a better way to easily install a specific version of Nim? PMunch: Without pulling in too much stuff that must be cleaned out afterwards? narimiran: btw, PMunch, if you want to add more packages to the playground: https://github.com/nim-lang/Nim/commit/e1dab59d469bc74b719cdaf90f89c08268e3d979 PMunch: narimiran, care to make a PR? nid: @Araq - https://github.com/nim-lang/Nim/pull/13908 ? Araq: I hoped to see more up-/downvotes, I'm fine with doing what the majority says in this case nid: Araq: I'll comment later today. PMunch: With what timotheecour suggests, what would happen if I use a library that depends on an error being catchable, but I define it as a panic? PMunch: Is that a compile-time error, or will it just never throw and crash instead? dom96: PMunch, does choosenim not make that clear in the messages? that it's installing latest nightly? PMunch: Haha, it does, as soon as I read the --help :P PMunch: Has it always been that way though? I seem to remember it always pulling the latest commit before dom96: no, it should say when using `update devel` dom96: something like "Warning: latest commit hasn't been built yet, if you want to compile it yourself us --latest" dom96: no, it hasn't. This is new behaviour since choosenim started using nightly builds PMunch: Ah right, so this will only affect people who are used to old versions, not a big issue. And it probably did say that, but it got lost in the long log from Docker PMunch: Again, just an issue with me assuming that I knew how choosenim worked, not something that needs to be fixed really :) Araq: PMunch: it's neither but it should 'crash' instead PMunch: Well yeah, but if that is some odd seldom event that the library "guarantee" will never crash your program livcd: Are there any serious streamers on Twitch? Besides disruptek that is PMunch: livcd, define serious streamer? livcd: PMunch: like a less evil version of disruptek dom96: PMunch, well if you get confused, it's likely others will too. This is on me though, shashlick wanted a different command for installing the nightlies. I didn't consider the Travis use case (from a user perspective a slightly old nightly shouldn't make much of a difference) dom96: livcd, hahha, you can follow me d0m96. Although I haven't streamed in a long time livcd: dom96: were not you the one encouraging him? :P https://www.twitch.tv/videos/599327882 dom96: hrm? livcd: to visit other channels and ask about building adobe premiere :D dom96: what? I don't recall doing that PMunch: dom96, I mean it's a super edge-case where running a nightly vs. the latest commit would make much of a difference PMunch: And the only people affected are those who have used choosenim in the past and is not aware of the change (otherwise they would read the --help message to make sure they did it right). PMunch: livcd, I've also streamed a bit. But I haven't done any either lately PMunch: Might stream some WM development soon though nid: @Araq I see 6 upvotes but no downvotes - just don't want to go on a refactoring bout if it's not going to get merged nid: well, you didn't vote so 😉 nid: and naming them is the least bad solution I can think of dom96: oh, is nid the new bridge dom96: Why such an obscure name? Yardanico? nid: on a different note, we'll be doing a security audit of nimbus at some point in the not too distant future - got an eta for 1.2.2 ? livcd: dom96: because it read better on mobile with a short nickname Yardanico: @dom96 it's not the new bridge yet :P livcd: it reads( dom96: IRC on mobile is poor anyway dom96: I'd rather know where the messages are coming from :) nid: Note that for 1.2.2 we should make sure that this devel regression doesn't happen https://github.com/nim-lang/Nim/issues/14136 nid: Though I don't see any 1.2.x backport branch? Yardanico: it's https://github.com/nim-lang/Nim/tree/version-1-2 ? nid: Ah, I didn't see backport on the commits narimiran: leorize, leorize[m] ping l1x: hi folks, how do I read into a buffer in nim using asyncnet? PMunch: https://nim-lang.org/docs/asyncnet.html#recvInto%2CAsyncSocket%2Cpointer%2Cint PMunch: l1x ^ l1x: PMunch: thanks l1x: i guess i am not sure about the syntax l1x: if you have server = newSocket(..) and i want to server.sendTo(...) i get Error: expression 'sendTo(server, address, Port(port), "A")' has no type (or is ambiguous) l1x: if I type hint all the parameters than i get type mismatch: got l1x: but expected one of: proc sendTo(socket: Socket; address: string; port: Port; data: string) l1x: proc sendTo.... Yardanico: are you calling sendTo in some other proc? Yardanico: and if no, do you use "discard" for it? l1x: https://gist.github.com/l1x/d5114a14a4d256d939c6f1ab61270a62 Yardanico: no "discard" for sendTo Yardanico: also that's now how you specify arguments PMunch: The problem is that sendTo doesn't return anything Yardanico: l1x: https://play.nim-lang.org/#ix=2jTg PMunch: So you try to discard nothing, which doesn't work l1x: ahh, makes sense l1x: Yardanico: thanks! Yardanico: l1x: also in your program you're using the synchronous version of net, not the async one l1x: Yardanico: one step at a time, i am just learning the syntax for now :) Yardanico: ah ok, there's a simple example here https://nim-lang.org/docs/asyncnet.html#examples-chat-server dom96: PMunch> https://nim-lang.org/docs/asyncnet.html#recvInto%2CAsyncSocket%2Cpointer%2Cint dom96: please don't recommend these APIs dom96: they're dangerous dom96: avoid `pointer` as much as you can dom96: I'm fighting to deprecate these PMunch: Well, he asked how to read into a buffer PMunch: But yeah, l1x please don't do that if you can avoid it l1x: ok l1x: what should you read into then? dom96: what's the protocol? l1x: lets say you want to implement a DNS server, the requests are 512b data, what is the type you would ideally use for that dom96: you can put binary data into `string` dom96: just use https://nim-lang.org/docs/asyncnet.html#recv%2CAsyncSocket%2Cint PMunch: Hmm, is there a way to read a maximum? PMunch: Ah.. l1x: i bet i can, but that is the proper way of doing that? dom96: yes l1x: in erlang i would describe the dns protocol with binary matching PMunch: You can do that afterwards PMunch: I mean you could cast it to an object of the right size PMunch: But you probably shouldn't do that either :P l1x: #dns_rec{header=#dns_header{},qdlist=[#dns_query{domain=Domain,type=ptr,class=in}]} l1x: something like that l1x: or even call our the raw binary version PMunch: Ah, maybe binaryparse could help you? dom96: maybe you could write a nice library that emulates the erlang behaviour? :D alehander92: binary matching is very cool alehander92: but i think one can indeed write a macro library alehander92: or extend a pattern matching library to do it alehander92: or yeah `binaryparse` does look like a different version of that concept l1x: dom96: alright, i thought you have something like that in Nim already alehander92: https://github.com/PMunch/binaryparse or also https://github.com/OpenSystemsLab/struct.nim (if its something like python's struct) dom96: there are likely packages for this kind of thing PMunch: Pretty much the exact thing I wrote binaryparse for: https://github.com/PMunch/binaryparse/blob/master/binaryparse.nim#L687 alehander92: PMunch you really need to put some short examples in the readme PMunch: Yeah I know.. Yardanico: also there's nesm alehander92: api + docs is very useful, but its much much slower to understand Yardanico: weird now bold messages suddenly work :D Yardanico: (I'm testing in #nim-test) l1x: alexander92: thanks! l1x: PMunch: thanks too! alehander92: https://news.ycombinator.com/item?id=22995466 disruptek Araq alehander92: it might be interesting to compare alehander92: rust-analyzer's approaches for IC to the nim ones (it seems they also tried different stuff starting from RLS until getting to here) zacharycarter: I'm still trying to figure out why my program is getting hung up at `popSafePoint()` at the end of my thread's execution iffy: Does the `times` module include a way to get the hour value of a DateTime as an int/natural number? or am I stuck with `x.format("h").parseInt()` narimiran: https://nim-lang.github.io/Nim/times.html#DateTime narimiran: `myDateTime.hour` doesn't work? nid: how can i make an string readonly but public in an object? nid: make the object a "let" nid: but the other fields should not be readonly dom96: leave the field private and create an accessor proc nid: ok zacharycarter: so I've isolated the issue in my program to context switching on a non-main thread zacharycarter: seems to work fine on the main thread though zacharycarter: I guess I can try just using pthread functions and not use Nim's threads zacharycarter: and see if that fixes the issue zacharycarter: I wonder though if Araq might have any idea why this is the case though Yardanico: is there a way to make a template accept optiona openArray[tuple[k, v: string]] ? Yardanico: optional* disruptek: two templates? Yardanico: I guess so disruptek: i'm trying to get my nvidia card to do the stream encoding but i guess it's just too ambitious. Yardanico: it's actually pretty easy Yardanico: if you mean nvenc disruptek: i'm trying to record from a radeon and encode on an nvidia. Yardanico: oh Yardanico: good luck iffy: narimiran: thank you! I forgot to look at the type def (I was scrolling through the procs only) narimiran: np :) nid: should this code work? also with arc i get a c compile error and without it i get it at nim compile error: nid: https://play.nim-lang.org/#ix=2jUk shashlick: fixed the nimterop bug that was bothering non-nimble users shashlick: any takes for testing? nid: oh nice disruptek: i will mess with it today; nim.cfg branch still? shashlick: yes shashlick: fixed it for wrappers and toast standalone disruptek: awesome. disruptek: good job, dude. shashlick: it will detect the cfg and works for v1.2.0+ disruptek: not 1.0? shashlick: since before that, there's no `std/compilesettings` nor sufficient info in `nim dump` disruptek: that pr needs backporting. kaushalmodi: shashlick: Does it require creating a `nim.cfg`? What should that file contain? shashlick: for 1.0, nimcache works, and any explicit `--parth` kaushalmodi: Where should that file be placed? shashlick: kaushalmodi - just per usual how your project needs, if at all kaushalmodi: I don't use any nim.cfg shashlick: then if you are using cli flags, those will get picked up by the wrapper and forwarded shashlick: only nimcache, nimblePath and --path are covered kaushalmodi: I do `nim --clearNimblePath --NimblePath:/custom/nimble/dir/ some_wrapper_doing_nimterop_cimport.nim` shashlick: will work kaushalmodi: So that case should Just Work? kaushalmodi: awesome shashlick: please try though kaushalmodi: will do nid: @Recruit_main707 "type ClientThreadArgs = tuple[packet: var string, response: var string]" I don't know if this is supposed to be valid shashlick: also while you are here @kaushalmodi, please test your wrappers with -f:ast2 - new backend nid: @Yardanico it seems like its not, im trying with pointers Yardanico: yeah you need pointers for threads Yardanico: and on 1.2.0 arc doesn't have some thread fixes it does on devel Yardanico: I'll try to adapt it for arc kaushalmodi: shashlick: I git pulled, switched branch, `nimble install` and got: ⏎ ⏎ > /home/kmodi/sandbox/nim/nimterop/nimterop/getters.nim(5, 16) Error: cannot open file: compiler/ast shashlick: what version of nim kaushalmodi: Should I revisit the nimterop README on how to build from git? shashlick: OS kaushalmodi: nim 1.3.1 kaushalmodi: RHEL 6.8 shashlick: that should work kaushalmodi: hmm .. shashlick: does the config.nims have --path:"$nim" kaushalmodi: full trace: http://ix.io/2jUn/text shashlick: do you have a `compiler` directory in your Nim folder kaushalmodi: duh :facepalm: of course not kaushalmodi: ```./ ⏎ ├── bin/ ⏎ ├── config/ ⏎ ├── doc/ ⏎ └── lib/``` [https://gitter.im/nim-lang/Nim?at=5ea85061d898fe7a3751fc7f] kaushalmodi: so far, my locally deployment of nim had just these and it worked fine kaushalmodi: .. will deploy compiler too shashlick: ya don't deny us of the compiler code 😄 kaushalmodi: +1 ⏎ ⏎ > Success: nimterop installed successfully. shashlick: peace, step 2 disruptek: shashlick: i cannot `nimble build` or `nimble test` in ~nimterop. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek shashlick: what's the error shashlick: not able to join now 😞 disruptek: oserr.nim(94) raiseOSError disruptek: Error: unhandled exception: Permission denied disruptek: Additional info: "/home/adavidoff/.nimble/pkgs" [OSError] disruptek: today only: lua embedding fails. shashlick: uhh, not enough info there disruptek: it wants to do something to pkgs. disruptek: not enough permissions to do so. shashlick: how about just `nim c nimterop/toast` shashlick: that's cause of nimble wanting to setup deps probably shashlick: you need to put deps somewhere and then `nim c --nimblePath:deps nimterop/toast` shashlick: or `mkdir deps` then `nimble install -d --nimblePath:deps` disruptek: i'm in a deps folder, so that should be fine. kaushalmodi: shashlick: I will continue with step 2 later today because to reproduce the issue I posted earlier, I need to locally undo the hacks in Makefile I deploy at work shashlick: okay no problem, thanks narimiran: shashlick: regarding https://github.com/nim-lang/Nim/pull/12860 - yeah, i already fixed one package, and i think it might affect nimterop too disbot: ➥ Undefine `paramCount` & `paramStr` in nimscript.nim for *.nims narimiran: (or some other package of yours, i don't remember exactly) disruptek: shashlick: http://ix.io/2jRr shashlick: narimiran: yes i made a fix to docs.nim - https://github.com/nimterop/nimterop/blob/nimcfg/nimterop/docs.nim#L5 disruptek: http://ix.io/2jUv/nim shashlick: same as before - somehow the plugin isn't getting compiled but execAction doesn't fail shashlick: can you find the plugin error you found earlier shashlick: could try a manual compile and see what the output is disruptek: that /is/ a manual compile. disruptek: not sure what you mean, i guess. shashlick: last time you had sent another paste with the plugin script filename shashlick: and the cfg file that was generated disruptek: the second link i sent is the plugin script. disruptek: where do i find the nim.cfg that was generated? shashlick: same temp plugin filename + ".cfg" disruptek: http://ix.io/2jRu/cfg shashlick: can you try compiling - nim c --app:lib /path/to/plugin.nim shashlick: before that shashlick: can you check if libplugfilename.so exists shashlick: at the same location disruptek: nope. disruptek: that built. shashlick: hmm shashlick: can you edit nimterop/getters.nim shashlick: https://github.com/nimterop/nimterop/blob/nimcfg/nimterop/getters.nim#L735 shashlick: just echo the output of execAction shashlick: wondering what's going on shashlick: and delete the cache or run with -f disruptek: nimble cannot parse your .nimble shashlick: you on devel? shashlick: if you are seeing a paramStr/Count error and are on devel, need to recompile koch and then koch tools shashlick: same link narimiran just sent above shashlick: issue is fixed in this branch but need nimble fix as well narimiran: shashlick, disruptek: i think i've hit that issue when trying to test `nimph` narimiran: i don't know exactly anymore cause in last 2 days i've tested lots of packages, and it all got mixed up disruptek: i'm not on /that/ recent of a devel. kaushalmodi: shashlick: ⏎ ⏎ In `nimterop.nimble`: ⏎ ⏎ > requires "nim >= 0.20.2", "regex#v0.13.1", "cligen >= 0.9.43" [https://gitter.im/nim-lang/Nim?at=5ea85d28b6dd230697919a6b] nid: shashlick btw - you did some callback handling updates based on ast2 - is that gonna make it into a release? kaushalmodi: can you change the regex dependency to `regex >= 0.13.1` kaushalmodi: I was curious why that one package installed in a dir with `#` in its name shashlick: @kaushalmodi - had a bug in regex, got fixed, i should update the dep shashlick: @arnetheduck: what do you mean by callback handling? kaushalmodi: shashlick: I was just commenting on the fact that if you have `regex >= 0.13.1` instead of `regex#v0.13.1`, I won't get a dir name with `#` char in it nid: shasklick, the `proc`-as-parameter fix (for sqlite for example) nid: Araq - https://github.com/nim-lang/Nim/pull/13908 looks ready to me except for some weird macos ssl build thing disbot: ➥ Error -> Defect for defects pippo: !list shashlick: @arnetheduck - oh the one marked as fixed - https://github.com/nimterop/nimterop/issues/156 disbot: ➥ Pointer to function pointer is not handled correctly shashlick: yes it is fixed in ast2 nid: yeah, but 0.4.4 doesn't include that fix (I'm using a locked release version in an attempt to get at least some of the code at a fixed version, even if nimble screws that up) shashlick: yes I haven't tagged a release yet since i'm still fixing various issues shashlick: its in #head for now but i hope to get a release out in a next few days, if not weeks keslerm: could anyone point me in how to read lines from a constant pipe? it's multiple lines and for each line i need to do some work on it keslerm: i've tried a couple things but can't get it to do more than 1 line and then stop Yardanico: wdym by "constant pipe? keslerm: sorry, i'm piping from a program that outputs a line every 10 seconds or so keslerm: but it doesnt terminate, just keeps outputting data keslerm: so it needs to read the line, process then wait for the next one keslerm: you know what, my code was fine - it looks like httpclient is blocking when posting to influxdb Yardanico: well unless you use async version of httpclient, it will block of course Yardanico: until the request is finished keslerm: it should complete, wireshark shows a 204 response from influx Yardanico: can you share code? maybe you're blocking somewhere else keslerm: https://gist.github.com/keslerm/078b0e02bc8ade1166df50362a4a9e90 Yardanico: so it blocks on client.request or what? Yardanico: can you add some "echo" statements before and after client.request keslerm: it blocks on client.request keslerm: i updated the gist with the stacktrace nim outputs when i hit ctrl+c keslerm: which is it sitting around readIntoBuf/uniRecv leorize[m]: httpclient is blocking leorize[m]: you need to use asynchttpclient Yardanico: leorize[m]: well in kase of @keslerm for him it hangs leorize[m]: (it's in the same module) Yardanico: in wireshark the server returns a 204 response but client.request is still active keslerm: it should block in this case, but it should also be complete, influx is returning a 204 Yardanico: does httpclient handle 204 correctly btw? hm keslerm: when i route the httpclient through charles http proxy it seems to complete the request fine keslerm: i added the raw header i see in charles to the gist leorize: do we have a thread safe ring buffer in nim? Yardanico: cool, https://github.com/nim-lang/Nim/pull/13908 got merged disbot: ➥ Error -> Defect for defects nid: so is that gonna be slated for nim 2? nid: it looks like a big breaking change Yardanico: no? Yardanico: it's not a breaking change at all Yardanico: you can still use the deprecated error names Yardanico: Defects were around for much longer nid: ah, okay nid: i thought the older names were totally removed Yardanico: nah Yardanico: even before 1.0 it was really really rare for something to get straight up "removed" Yardanico: there always was some deprecation Yardanico: you can still find some deprecated stuff from years ago nid: so 1.4? Yardanico: 1.2.2 maybe Yardanico: but probably 1.4 nid: and about uncommon modules - @Rika did you know https://nim-lang.org/docs/strmisc.html exists? 😄 nid: or https://nim-lang.org/docs/smtp.html (although I wonder why this is in stdlib, I agree with dom that modules like this and the FTP module shouldn't be in stdlib) nid: yes about strmisc nid: no about smtp nid: asyncftpclient nid: https://nim-lang.org/docs/colors.html nid: why'd you ping me over this, but i appreciate it, i like learning about std modules i dont know of nid: i know that too nid: colors i know but havent learned keslerm: looks like influx is not returning Connection: keep-alive, i think maybe it has something to do with casing since going through charles sets it to `keep-alive` but nim uses `Keep-Alive` keslerm: setting `Connection: close` seems to resolve it anyway Yardanico: hmm maybe a regression of https://github.com/nim-lang/Nim/pull/13968 ? disbot: ➥ Add the ability to pass title case headers to an HTTP server Yardanico: ah wait you're on 1.2 so no keslerm: yeah actually it doesnt look like influx returns connection at all, i think charles was putting it in (and not the first time charles has "fixed" the issue transparently with something) nid: Hey, I am new to nim. I am amazed by the parallel and spawn primitives, so simple compared to Python! nid: I've noticed there is the threadpool and weave modules, which one is the most recommended right now? zacharycarter: I don't think threadpool has any load balancing zacharycarter: weave is an entire runtime and isn't just a threadpool zacharycarter: also weave doesn't yet work with `--gc:arc` Araq: what's required to make it work with --gc:arc? nid: Seems weave is new and has more features but sounded as if it was still experimental. nid: So I wanted to know what the community is using. zacharycarter: Araq: 1) the bugs reported related to exceptions, threads and `--gc:arc` leorize[m]: cgarciae: weave is better than threadpool in every aspect Araq: zacharycarter, issue number? zacharycarter: 2) something about pointers and I don't remember what - mratsim: can you fill us in here? leorize[m]: Araq: mratsim tagged them all leorize[m]: just search by label zacharycarter: https://github.com/nim-lang/Nim/issues/13936 disbot: ➥ Simple channels with --gc:arc nid: Thanks! nid: Side note: weave reminds me of erlang /elixir, any benchmarks? nid: Side note 2: just saw in 0.13 there was an actors module, is this still a thing? Yardanico: see https://github.com/mratsim/weave/tree/master/benchmarks for benchmarks maybe? leorize: cgarciae: we phased actors out nid: Wonder if it's possible to represent this monstrosity in nim https://github.com/torvalds/linux/blob/481ed297d900af0ce395f6ca8975903b76a5a59e/include/uapi/linux/io_uring.h#L17-L61 leorize: yes nid: How do you deal with the anonymous unions? leorize: create non anonymous versions of them leorize: then refer to them in the main object Yardanico: yeah, c2nim usually generated INNER_UNION_XXX objects for anonymous unions like that nid: I've tried that and, predictably `attempting to call undeclared routine: 'off=` shashlick: yay nested structs leorize: now with type section macros we can make it look kinda nice too leorize: Chiqqum_Ngbata: yea you'll have to define some templates leorize: Araq: do you have any tips for implementing a thread-safe buffer for files/pipes? nid: params.response[][0] != "!" nid: how can i convert that len 1 string into a char? Yardanico: '!' leorize: well compare it with a char :P Yardanico: in most compiled languages chars are single quotes, strings are double-quotes AFAIK Yardanico: actually not just compiled, most languages which have a distinction between an ascii character and a string nid: right, a bit tricky imo, i guess thats what happens when you come from python leorize: not that tricky, though I can understand leorize: in the strongly typed land pascal is an example of not having this distinction Yardanico: I wonder if there's an easy way to compare two types for equality? Yardanico: like "typeof(multiply(u1, u2)) == U[3]" leorize: `is` Yardanico: ah, is Yardanico: right shashlick: Yardanico: any plans of consolidating the two discord bots? shashlick: don't want to add two rules for nick renaming Yardanico: shashlick: wdym? there are plans to make ircord the default of course Yardanico: the one in #nim-offtopic is the new one, when it's completed it'll either use "nid" or "nl", not sure which one to choose though shashlick: right now there's nl and nid and i only have a rule for nl right now shashlick: so nid shows up here Yardanico: well nl is #nim-offtopic, nid is here supakeen: I vote for 'bottymcbotface' shashlick: okay which one is going away Yardanico: I honestly don't know, need opinion from other people :D supakeen: I like nid more. Yardanico: yeah I think I will keep that one supakeen: nl seems like it's the country code for the netherlands Yardanico: ok nid it is :P supakeen: Also easier to pronounce :) nid: disrod Yardanico: lol Yardanico: we have disbot already Yardanico: a bit confusing :P nid: leorize: Do you mean I'll have to emit C to interact with it or dom96: Why not FromDiscord again? leorize: Chiqqum_Ngbata: no, use a template to access the internal objects Yardanico: @dom96 well some people said that it's a bit too long Yardanico: FromDisc? :P dom96: who? leorize: Chiqqum_Ngbata: ie `off(t: IoUring): int` dom96: We've had it for months if not years and nobody complained Yardanico: so should I return the FromDiscord one? dom96: I would prefer it, it's clear where it's coming from that way Yardanico: ok, i'll restart the bridge now, expect some seconds of downtime :P Yardanico: uh apparently FromDiscord wasn't even registered on freenode before Yardanico: now it is dom96: it might have been, they cleared old unused nickname registrations Yardanico: well but FromDiscord is active every day disruptek: !last axiom disbot: axiom never seen. disruptek: !last axion disbot: axion quit 79 days ago and last spoke 4 weeks ago Yardanico: also @dom96 I think we might want to apply for discord verification so we could have a nice discord server url like discord.gg/nim-lang (e.g. discord.gg/rust-lang or discord.gg/vlang), although from what I've read the server owner should be also an official representative of the project. Right now their verification queue is closed, but when it opens maybe we'll need to find a way so I can transfer server ownerhip to you so you Yardanico: would do that :P Yardanico: well I'm not entirely sure now, I'll email them again when they have that queue open dom96: sure, gimme a ping when that's available Yardanico: we'll also get a "verified" checkmark on the server :P leorize: also verify our github org too :) leorize: or at least verify the link :P Yardanico: Ah yeah this would be cool too Yardanico: https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/verifying-your-organizations-domain Yardanico: it's really simple, but need to have access to nim-lang.org's DNS records :P supakeen: And Twitter! (does nim have a twitter?) Yardanico: yes Yardanico: https://twitter.com/nim_lang supakeen: But we haven't stolen nimlang even if it belongs to an 84-year old who likes chicken? Yardanico: why not steal twitter.com/nim then supakeen: Oh right. Araq: leorize, give it a lock? Rika: disruptek: axion gave up on nim quite a while back, why the !last? leorize: wait he did? Rika: he messaged me about it yes Rika: he didnt like how basically every new feature was left experimental; i dont know if it's insensitive to talk about it more leorize: Araq: yea, that's a way, though I don't know if lock contention should be something I need to be worried about leorize: Rika: well maybe he will return after looking at all the other languages :P leorize: or maybe he'd just get back to lis leorize: lisp* Rika: he went back to lisp Broadwell: https://play.nim-lang.org/#ix=2jWP leorize: Broadwell: typedesc is not a valid runtime value Broadwell: Oops Joshua S. Grant: @Rika He (if I'm remembering right and axion is mfiano), left the Lisp-Discord a lil bit ago as-well; Not sure where he really stands -- but is still doing semi-regular commits to his game-engine and related depends zacharycarter: yeah he is - I talk to him on a semi-frequent basis in another IRC chat zacharycarter: related to roguelike development Bennyelg: Happy independence day Israel even dow in zacharycarter: I don't think he was a big fan of Nim - but he also doesn't love CL anymore so maybe he'll go to Rust or Zig or something Bennyelg: quarantine Rika: he liked cl for its macros so i doubt rust zacharycarter: true Rika: zig, im not familiar with Rika: if it has good macros then maybe leorize: zig don't have that zacharycarter: it does not Rika: he legitimately liked lisps macros a lot leorize: like not having syntax sugar is the point of zig leorize: no "surprises" Rika: so zig is almost the anti-nim no? leorize: yes :p Rika: nim is literally built on sugar haha Rika: you get expression but also surprises -- if you dont read code Joshua S. Grant: Well, he's a very taleneted guy and hope he falls into another fever-pitch even if it doesn't happen to be Nim, ultimately Rika: though i do understand, reading code takes a lot of time Rika: yeah, i dont mean him any harm, its just sad he didnt like nim that much Rika: if i were skilled enough i'd strive to improve it enough for him to reconsider 😛 leorize: he will like nim once nim v2 is out :p leorize: just try :p leorize: you can't be skilled if you don't do it Rika: you can though? Rika: education exists Rika: i dont have a college education yet Rika: ill try out once i do leorize: college is overrated leorize: experience trumps all Joshua S. Grant: I selfishly want him here, because now that I've started to make a commitment to the ecosystem -- I want to see more game-engineers about. :^) Though we seemed to of bagged oakes for the time being ... so hey! Rika: are you a close friend of his? Joshua S. Grant: Assuming you're talking about mfiano; Nah, we've talked a few times -- and I've actively bugged him with reorganizing my Github enough that he's took notice and dm'd me to basically 'chill' lol -- But really appreciate his body of work, and how readable / clear his CL is Elegant Beef: *wait people have college education* 😄 Elegant Beef: I prefer collage education myself it's more hands on leorize: can't really relate on that :P leorize[m]: > `lpCommandLine`: The maximum length of this string is 32,768 characters, including the Unicode terminating null character. leorize[m]: so they built windows on top of uint16 or something KingDarBoja: Who is axi0n? leorize: axion was our fellow lisper KingDarBoja: By Lisper you mean Lisp Advocate? leorize: he is a common lisp user looking to switch KingDarBoja: I have never met a Lisp developer KingDarBoja: Only heard of the parenthesis meme leorize: he said if you actually write lisp you won't see them leorize: the editor abstracts them out of you KingDarBoja: Loool KingDarBoja: I was able to overcome my unicode issues on the graphql lexer module, just making the last fixes, hooray leorize: \o/ KingDarBoja: That's what happen when u come from Python KingDarBoja: Unicodeplus was helpful indeed KingDarBoja: And I find comfortable comparing runes with runes instead of Char with char krux02: as far as I know we lost axion back to lisp. krux02: The language just had too many bugs. krux02: with the language I mean Nim. krux02: leorize, regarding the parenthesis, they are after all just syntax. you get used to them as you get used to other syntaxes. Rika: i said that above leorize: I don't doubt that, touch macros a bit and you might make the compiler implodes krux02: yea I didn't read everything Prestige: Is there any way to get an i'th item from an OrderedSet without using an iterator? krux02: Prestige, maybe you can get declare your own [] operator to do that. krux02: But as far as I know ordered sets are internally linked data structures that require O(n) access time krux02: if you go by index Prestige: looks like it's a sequence underneath Prestige: Only really had one place where I wanted to grab the first element so it's nbd, was just curious disruptek: i can't build disbot under orc, but it builds under arc. leorize: ping Zevv shashlick: what's the best package to measure how long my nimterop tests are taking individually disruptek: !last zevv disruptek: !last zevv disbot: Zevv spoke in 12#nim 33 hours ago disruptek: the bot binary is also much larger under arc. disruptek: >+50% federico3: urgh codic: How od I run a ssytem command in nim? codic: *do leorize: os.execShellCmd leorize: though I'm not sure what you mean codic: have a string (eg `"ls"`), run it through a system call, and return the output codic: I want a function that does that, does it exist? Yardanico: disruptek: maybe due to a lot of destroy/etc calls? Yardanico: @codic https://nim-lang.org/docs/osproc.html#execProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D Yardanico: import osproc; echo execProcess("ls") codic: So if I had `import osproc; echo execProcess("ls -al")` it would output the output? codic: ya beat me to it, great ;p Yardanico: yes Yardanico: lol Yardanico: leorize: so I tested this simple example with and without -d:useMalloc with both --gc:arc and default gc codic: I've also noticed that some examples in the docs use `$variable` instead of `variable` as an aside. for example `var t="o"; echo $t`. Why is this? Yardanico: ah wait wrong chat leorize: I'm in both :P leorize: stop chatting on topic on off topic :P codic: haha Yardanico: @codic maybe a remnant of the past or just to be explicit Yardanico: echo converts all arguments to string with $ implicitly, yeah Yardanico: although $ is no-op for strings so it won't cost performance or memory to do "echo $stuff" codic: But `$` is useless to put in front of a variable? codic: in modern nim codic: also, another quick question. assuming I had a library thing, `import thing` would pollute everything in thing to the global namespace. How could I put it all in a namespace like python, so that I do thing.whatever() instead of whatever() (assuming the library thing has a function whatever)? Rika: from module import nil codic: then i can do module.thing()? Rika: Yes codic: yay leorize: please don't do that unless you have a good reason to Rika: Nims "global namespace pollution" is just like lisps parenthesis hell I think Rika: Editors make it much more bearable to use Rika: E.g. You can hover over the proc in vs code and it will show what module it's from Rika: So yeah, there's a reason we don't have it on by default, also because UFCS fails to work with it leorize: that's not the reason Rika: Never said it was Rika: But I guess it's implied Rika: Well, I didn't mean to imply that leorize: it's not like you can easily see where something came from in python anyway :P leorize: put on some classes and you will need ides codic: Does nim even have a dedicated ide? codic: vscode works great for me leorize: no we don't codic: i remember there was one written in nim but it's dead leorize: yea, the alternatives just worked better dom96: no, the alternatives had the support of big companies leorize: not much big companies but users federico3: namespace pollution is a bit annoying tho Prestige: I'm using neovim w/nimlsp and alaviss/nim.nvim, it works pretty decently codic federico3: especially when librarie export meaningless proc names federico3: Prestige: nimisp? Prestige: LSP Prestige: https://github.com/PMunch/nimlsp federico3: what is it doing? Prestige: sometimes if I'm refactoring something and the syntax is very messed up, alaviss/nim.nvim crashes tho Yardanico: federico3: language server in Nim Yardanico: for Nim leorize: not a setup I'd recommend, but feel free to use it, it works federico3: Yardanico: yep, but what is it for? Yardanico: any editor which supports LSP could be configured to use nimlsp Yardanico: and nimlsp provides access to nimsuggest and stuff Yardanico: so you can get suggestions and go to definition and stuff in any editor with LSP support :P federico3: nim.nvim uses nimsuggest already federico3: (hence my question) Yardanico: well there are more editors than just nvim :D leorize: Prestige would like to use the LSP ecosystem Prestige: Yeah, I use lsp for all languages I work with federico3: Prestige: sounds like you are using them together Prestige: mostly for the syntax highlighting Prestige: nim.nvim I mean leorize: once PMunch got that working in nimlsp I'll toss in a switch to let you turn nimsuggest integration off bung87: ```code paste, see link``` ⏎ ⏎ anyone can help me with this? [https://gitter.im/nim-lang/Nim?at=5ea8bbcc347bd616304217ba] Prestige: I'll probably be contributing to nimlsp once I've gotten my current project to a decent state bung87: I'm tring to create zip archive from cstring it gives error code 19 Yardanico: why are you using unSafeAddr? Yardanico: and did you look into nimarchive? bung87: `data: cstring` Yardanico: yes, you can just use ".addr" if it's a "var", you shouldn't get address of "let" variable (hence it's unsafeAddr) bung87: I have not try nimarchive, I modify the std libzip add new func import from c bung87: `var cstring` still same problem. shashlick: back to FromDiscord? Yardanico: shashlick: well yeah sorry leorize[m]: bung87: remove the addr and the cast Yardanico: leorize: would it work without that? Yardanico: he's calling into raw C functions leorize[m]: his data is a cstring bung87: ok , just cstring Bennyelg: sporadic error when trying to execute multiple deletes on over sqlite connection ⏎ Error: unhandled exception: index 1 not in 0 .. 0 [IndexError] bung87: am I main logic wrong? shashlick: leorize[m]: was https://github.com/nimterop/nimterop/issues/151 your concern as well with nimterop? bung87: ```code paste, see link``` ⏎ ⏎ I'm try porting these cpp code [https://gitter.im/nim-lang/Nim?at=5ea8bd7ab6dd230697929adc] leorize[m]: shashlick: yea leorize[m]: bung87: remove cast and addr and it should just work shashlick: okay it should be fixed in #head now bung87: I removed still `19 ZIP_ER_NOZIP` bung87: `zip_source_buffer_create(const void *data, zip_uint64_t len, int freep, zip_error_t *error);` bung87: am I doing right? codic: is nim's `ui` good for small dialogs? is there an example just showing text and two buttons under it? codic: that's all i need codic: (one closes the app, the other spawns a system process) leorize[m]: codic: yea it's pretty decent for that codic: oo matrix leorize[m]: bung87: that code should be the same as the c++ code. I can't be 100% certain with a runnable example though codic: is there an example for that then? codic: now I must use matrix codic: :) shashlick: meh, cannot benchmark in nimscript, no time functions available codic: or is there any other library with a similar example? Skaruts: gonna give it a try Joshua S. Grant: Ah, the old 'public static void' (re: beef); I really can't believe the verbosity of Java / C# is tolerated to the extent it is -- guess mostly just due to legacy reasons, but still ... like no real reason beef had to adopt similar idioms Rika: its directly competing with C# Varriount: I prefer specifying "void" by omitting a return type, and having either private or public be default (preferably private). Joshua S. Grant: @Rika I mean, I get that; But still -- I don't know, simplify the semantics when / where you can. You don't have to be 100% mappable and this is the time to reduce kludge :^P Varriount: for static... in most cases, static functions could just be regular functions. The reason Java uses them to the extent it does is because you can't have plain "functions", everything is a class/object Rika: @Joshua S. Grant better adoption for people using C# with a syntax similar to it Rika: can anyone explain to me what `ashr` is useful for Rika: i fail to understand Joshua S. Grant: @Rika it would still be similar though; Even if it was as Kotlin is to Java most of the semantics are the same, even if there is tweaking to the grammar -- but Idk, ultimately I guess it's preference Rika: kotlin to java is a pretty massive difference imo Elegant Beef: Well the verbosity of C# is because it's required to have classes obey protection levels whilst being able to control what's instanced and what's not Elegant Beef: `public static void` for instance are all useful keywords in describing the function state Rika: then how does nim do away with most of them? Elegant Beef: Nim doesnt have objects in the same way C# does Rika: even if it did, i bet it would still do away with most of them Elegant Beef: Nim also handles imports differently to C# Rika: i dont think that is relevant to its syntax Elegant Beef: Well in nim you can only expose things upwards in C# you can expose them any direction Elegant Beef: So public atleast becomes more useful Joshua S. Grant: I mena, is the object model of C# similar to Java (I don't know, but would assume based on the use of syntax there ...)? I mean, Kotlin is able to get away without it Joshua S. Grant: I mean, is the object model of C# similar to Java (I don't know, but would assume based on the use of syntax there ...)? I mean, Kotlin is able to get away without it Elegant Beef: I imagine it's similar Joshua S. Grant: Is the object model of C# similar to Java (I don't know, but would assume based on the use of syntax there ...)? I mean, Kotlin is able to get away without it Elegant Beef: What does kotlin do for `public static void` and `private static void` or `protected static void` Elegant Beef: *The last of those i actually dont know if it's possbile to do in C#* Rika: i assume its `protected fun name(): Unit` or so Rika: im not well versed in kotlin Elegant Beef: I've never looked at kotlin, i'm relatively well versed in C# though Rika: public is default Elegant Beef: private is default in C# Elegant Beef: Which considering it's an OOP language is sensible Joshua S. Grant: Yeah, public is default; But I'm pretty sure you can use all the same visibility-monitors similar to Java? could be wrong Elegant Beef: The big thing is i dont get what the issue is with `public static` Elegant Beef: That's literally what an exposed proc is in nim as i understand it Elegant Beef: methods would be just public Rika: man i really do need to look through whole stdlib, TIL rationals module Elegant Beef: **Read it all** https://nim-lang.org/docs/theindex.html Elegant Beef: 😄 Joshua S. Grant: @Elegant Beef I mean, I guess my 'issue' but more-so a syntatical prefence, that makes Java & C# feel a lot more kludgy than it should for me -- I'll fully admit it's probably a personal-fault lo ... but tbh would rather it be hidden away... heck I'm even talking going as-far as a \@main annotation or something lol Joshua S. Grant: @Elegant Beef I mean, I guess my 'issue' but more-so a syntatical prefence, that makes Java & C# feel a lot more kludgy than it should for me -- I'll fully admit it's probably a personal-fault lol ... but tbh would rather it be hidden away... heck I'm even talking going as-far as a \@main annotation or something lol Joshua S. Grant: @Elegant Beef I mean, I guess my 'issue' is more-so a syntatical prefence, that makes Java & C# feel a lot more kludgy than it should for me -- I'll fully admit it's probably a personal-fault lol ... but tbh would rather it be hidden away... heck I'm even talking going as-far as a \@main annotation or something lol Elegant Beef: Yea idk that feels like the same thing Joshua S. Grant: I mean, it is; Ultimately 'what does it matter' ... like it shouldn't, but for whatever reason I can't shake that feeling. :^P Elegant Beef: Static functions sometime reside in instancable classes so having it is a requirement that the language supports 😄 leorize: @Joshua please don't edit on discord Elegant Beef: This is where the meme *OOP was wrong and needs to die* fits in nicely leorize: it spams irc Joshua S. Grant: Oh, sorry; Didn't even think about that. Elegant Beef: More accurately dont edit, it causes irc users to spam discord 😛 Joshua S. Grant: I mean, I'm sure the default decleration syntax with the visiblity levels and the like is probably the most efficent / powerful way to express that ; But again, sure it just comes down to personal preference and I think there has to be similar ways to express such things to that level over the course of a few lines. Joshua S. Grant: But like, Idk, one of my favorite languages is Scala; And they don't have that problem but certainly have issues with being short and/or too the point -- so maybe I shouldn't judge too harshly. lol JorySchossau: Does anyone remember what the tool is that generates the complete set of cross compiled c sources and the build script to choose among them? For example, this was used to create the csources repo contents. I've used it before but I can't remember what/where it is. Elegant Beef: I tend to prefer explcitity over implicity Joshua S. Grant: @Elegant Beef Also, yeah, think that's fair; As-said it comes down to preference -- probably almost entirely; I can see a lot of value with being more than-less explicit; tbh but 'language feel' matters to be a lot. Maybe too much. Actually almost certainly too much. Rika: either way it is eternalized in the form of nim irc logs Prestige: We should give this irc bot some color for names JorySchossau: Another way to ask it: What is the nim tool that reads `project.ini` that can automatically build c sources for all architectures listed in the file? JorySchossau: Ahhh! It was in the git commit logs of an old repo of mine: `niminst` is the tool I was looking for. Rika: what's the best library i can use for a uint128? stint? zetashift: Yes I'd use stint zacharycarter: I'm looking at http://man7.org/linux/man-pages/man2/mmap.2.html and https://github.com/nim-lang/Nim/blob/1bdc30bdb13422bd5eff830327582a938e7b76ac/lib/posix/posix.nim#L628 - shouldn't the second parameter be a `uint` and not an `int`? leorize: should be a csize_t zacharycarter: which the manual says = uint leorize: don't trust the manual, trust the generated c leorize: csize_t will generates size_t zacharycarter: gotcha - thanks leorize: i doubt it would make a difference though leorize: the posix module imports the procs directly from the headers zacharycarter: yeah Cerberus|The Enby: Can nim build something like cheat engine but for linux >. 1, then turn it into that form KingDarBoja: 👍 KingDarBoja: Just found the isPrintable proc KingDarBoja: Pretty nice leorize: https://play.nim-lang.org/#ix=2jK0 leorize: so I wrote a "fast" version leorize: it will be fast as long as you don't encounter any of the utf chars :P leorize: multibyte* Prestige: How can I manually init a table with empty sequences at the values? I tried { 1: @[] }.toTable and { 1: seq[int] }.toTable, for instance leorize[m]: why do you need that? leorize[m]: but well you can use `newSeq[int]()` Prestige: I'm wanting to populate a table with a set number of keys Prestige: ag thanks KingDarBoja: 😋 👍 skrylar[m]: all i did was read a pile of text layout articles/books and then kind of got fancy paragraphs :x skrylar[m]: probably not as impressive as new memory models lol Prestige: Hm so I have a table with Hashsets as values, I'm wanting to iterate over the hashsets and add an element to each, e.g. https://play.nim-lang.org/#ix=2jK8 Prestige: How should I actually do this? ^ Prestige: Seems like it's just immutiable if I iterate over the values, so I'm having to iterate over the keys and then access the set from within the for body Yardanico: There's .mitems Prestige: ah thanks Yardanico: And .mpairs Yardanico: It's a convention to name iterators like this if you can mutate the values they return Prestige: Thanks! Yardanico: And .mvalues too voltist: Does Nim have a way to pass a seq as varargs? Like how in Python `zip(*[a,b])` is equivalent to `zip(a, b)` Varriount: Hm, you might just be able to pass the sequence as normal voltist: @Varriount Oh, it seems you can. Thanks! voltist: Whats the Nim equivalent to Python's `pass`? bung87: discard voltist: Yeah that works, thanks! bung87: ```spawn server() ⏎ sleep(900) ⏎ app()``` ⏎ ⏎ is there another solution instead of waiting 900ms? [https://gitter.im/nim-lang/Nim?at=5ea688a694ac2758e30e6c63] flywind: How can I do code coverage? It seems that code coverage result is not accurate enough using `gcov`? flywind: flywind: https://cdn.discordapp.com/attachments/371759389889003532/704238447778463764/unknown.png Araq: there are also nimble packages that use Nim's macro sytem for code coverage Araq: haven't used them though, I don't do code coverage, instead I only write the necessary code Araq: https://github.com/nim-lang/opengl/pull/76 narimiran, same, no CI integration disbot: ➥ Removed unused imports, fixed #65 Araq: --> move to 'fusion'? narimiran: ok Araq: well not yet Araq: but we should keep it in mind bung87: `socket.connect( "localhost", Port(80))` raise `(parent: nil, name: "OSError", msg: "Invalid argument"` ? Araq: bung87: you used a question mark but it wasn't a question bung87: hmm , it's in loop , when move out and top of the loop, it raise connection error bung87: Error: unhandled exception: Connection refused [OSError] bung87: my bad ,sleep after connect Recruit_main707: is arduino nim usable? Recruit_main707: zevv? Araq: it should be Recruit_main707: i hope my teacher lets me use it narimiran: PMunch: are you around? PMunch: Always narimiran: IIRC, the playground has its own list of "important packages" that are installed? how big is that list and how did you pick the packages? PMunch: That's right PMunch: https://github.com/PMunch/nim-playground/blob/master/docker/packages.nimble PMunch: The list was seeded with the official "important packages" list, then I removed some that obviously wouldn't work (like Windows specific packages, JS specific packages, GUI packages, networking packages, etc.) and I accept pretty much all PRs for new packages PMunch: There are some more ones that can be removed as well PMunch: Like c2nim and cligen probably aren't very useful in there PMunch: Or inim Araq: excellent work, PMunch :-) PMunch: Huh? PMunch: What did I do now? :P narimiran: PMunch: great, thanks! i'll see what of that list i can include in the official "important packages" Araq: you took "important packages" and cleaned it up for nim-playground, I wasn't aware PMunch: I think there are only like 5 packages that have been added to that PMunch: Oh right, yeah I did that quite a while ago :P PMunch: TBH it's not very cleaned up. Some packages might have 3rd party dependencies that aren't installed as well.. voltist: Oh gee `Error: cannot open file: strutils`. What *have* I done... PMunch: Although I try to add them here: https://github.com/PMunch/nim-playground/blob/master/docker/Dockerfile#L61 PMunch: Recruit_main707, Nim runs fine on Arduino PMunch: I used it to program the Arduboy PMunch: But I'm not sure how well nim-arduino works, I was just wrapping things by hand alehander92: that's cool Recruit_main707: but the arduino ide wont look good with nim right? PMunch: But Zevv showed me that it worked during FOSDEM PMunch: Hehe, Zevv actually integrated it into the IDE, so apart from a bit wonky syntax highlighting it works fine Recruit_main707: nice PMunch: I just made a makefile that built and uploaded the Nim code directly PMunch: This is what I'm using: http://ix.io/2jKO PMunch: With this nim.cfg file: http://ix.io/2jKP Recruit_main707: ok, so that first file is a .make? PMunch: It's a "Makefile" PMunch: What's a .make? Recruit_main707: idk, how should i use the makefile :p PMunch: Put it in a file called "Makefile" and then you can run "make upload", "make size", "make run" (this is for running in the Arduboy emulator), or simply "make" which runs the first rule Zevv: Recruit_main707: it works and all, but I never properly finished it. Story of my life, basically. PMunch: Makefiles are basically just rules for creating files. So the format is `file>: PMunch: Oops Zevv: https://github.com/zevv/nim-arduino Zevv: I reached out to the arduino developers but they only started nagging me and being blunt about the language, so screw that PMunch: `: ` and then an indented list of commands to run to create the file. If a `dependency` is missing, it will run the rule to create that file. As you can see `upload`, `run` and `size` doesn't actually create any files, so they will always run. voltist: Ok seriously, anybody got any idea why I'm getting ` Error: cannot open file: strutils`? PMunch: Zevv, the Arduino developers didn't want more languages? :( PMunch: voltist, because it's missing? PMunch: How did you install Nim? voltist: PMunch: With choosenim PMunch: Can we see the full compilation output? There are some hints there to which cfg file it uses and such voltist: PMunch: Yeah sure, https://pastebin.com/Jk1qdwT8 PMunch: And what is the contents of /home/liam/.choosenim/toolchains/nim-1.2.0/config/nim.cfg PMunch: And do you just have "import strutils" or something else in your file? voltist: The config file is empty voltist: And yeah `import strutils' is in there PMunch: And that's probably your issue :P PMunch: My config file is 319 lines long, and that's the default one voltist: Oh weird voltist: I'll try getting rid of everything and reinstalling PMunch: Just delete the entire /home/liam/.choosenim/toolchains/nim-1.2.0 directory and run choosenim stable again PMunch: Ugh, I think it's about time to get a new graphics card.. voltist: Nah that didn't help unfortunately PMunch: Still an empty file? voltist: Yep. Choosenim says when I install that the compiler and tools have already been installed. Perhaps a broken config is being copied in from the cache? voltist: Already built* PMunch: Try choosenim update stable voltist: Same issue. It doesn't appear to actually be downloading anything except the compiler PMunch: What does your `choosenim --version` say? voltist: choosenim v0.6.0 (2020-03-06 18:24:57) [linux/amd64] PMunch: Hmm, weird narimiran: PMunch: ah, at first i thought your list would be more different than ours. now i see they're basically the same: your has 4-5 packages that we don't (yet) PMunch: Yeah, as I said it's a copy of the "important packages" list, but I add things people want to have an the playground voltist: PMunch Yeah, do you know what I need to delete in order to cleanse everything? PMunch: But it's not very well known that there even are packages on the playground :P narimiran: people should want more :D PMunch: voltist, I mean if you delete the .choosenim folder.. narimiran: (i'm looking for more packages we should test) PMunch: You can test all of mine :P PMunch: I try to make sure they always work on the latest Nim version narimiran: PMunch: three of yours are getting introduced this time :) PMunch: Oh nice, which ones? narimiran: termstyle, optionsutils, macroutils Zevv: PMunch: apparently not. And ther was this dude going on how "unsafe" this all must be, just as "unsafe" as using C++ strings - he clearly does have no clue, but it's a bad start to get your thread hijacked by someone like that. voltist: PMunch: It must be caching somewhere else because even when .choosenim and .nimble are removed, it still doesn't build anything PMunch: narimiran, haha good luck breaking termstyle :P It's basically just some string concatenation PMunch: Zevv, wait, how unsafe it would be to use Nim, or how unsafe it would be to integrate new languages in the IDE? PMunch: voltist, that is very strange PMunch: I assume your username is liam? Zevv: to use nim. He wanted my to Nimify some serial mundane rx/tx example, and it was clearly no better then the C++ version and very unsafe voltist: PMunch: Yep Zevv: oh right, that wasn't an actual arduino developer, it wast just Some Guy PMunch: Zevv, that's just dumb.. PMunch: Like why would that even matter for integrating it into the IDE.. Zevv: right https://forum.arduino.cc/index.php?topic=661603.0 PMunch: voltist, I don't know what to tell you. Unless you have `choosenim` aliased to something that sets --choosenimDir and --nimbleDir I don't really know what's going on.. voltist: PMunch: All good. I'll work on it some more and see if I can find out whats going on Araq: Zevv, lol Araq: that thread is funny PMunch: If he could see some of the Arduboy stuff I've been working on I think he would be a bit more impressed :P PMunch: But just a serial read/write example, as you say, how much more/less complexity were you expecting? alehander92: Praise God alehander92: what a good day alehander92: disruptek interesting work alehander92: on IC alehander92: when would it be usable for alpha testing :) alehander92: (even for toy examples) PMunch: Good day? KrispPurg: Hey guys, uh when I send a multipart data to a http request that is a file in a directory it throws this error "The filename, directory name, or volume label syntax is incorrect." when I use Nim v1.0.4 it works fine, but on Nim v1.2.0, it doesn't any solutions to this? PMunch: KrispPurg, how have you set up your server? PMunch: Hmm, I can get an RTX 2060 6Gb for €365 or a GTX 1660 6Gb for €261.. KrispPurg: you mean how I handle the request? PMunch: Yeah KrispPurg: Hold on KrispPurg: https://play.nim-lang.org/#ix=2jLa PMunch: Uhm, where do you do any file handling there? KrispPurg: oh wait KrispPurg: https://play.nim-lang.org/#ix=2jLc Chiqqum_Ngbata: Any idea why querySetting(ccompilerPath) is returning empty Chiqqum_Ngbata: If no good solution to that one, how else could I find the current compiler KrispPurg: the first statement is where if the file body isn't provided and the file object is just a file with a name only. PMunch: KrispPurg, TBH I have no idea what's going on. Try to create a minimal example that reproduces the error PMunch: Hmm, a used 1060 for €78 Zevv: it's funny but it's also sad dom96: By god, arguing with open source developers should be a full-time job :P InventorMatt: I think nim has a lot of potential for robotics so it kind of sucks that the arduino community wasn't receptive to it InventorMatt: if we could integrate it with ROS that could help gain exposure livcd: will orc replace arc? :D Araq: https://github.com/nim-lang/Nim/pull/14121 it's done disbot: ➥ new implementations for --gc:orc Araq: livcd, maybe, I'm seeing more and more things the researchers overlooked KrispPurg: PMunch: https://play.nim-lang.org/#ix=2jLh livcd: Araq you are the Omnissiah Araq: livcd, I'm not that familiar with Warhammer Araq: so yeah, 1.4 is ready, featuring --gc:orc for the people who cannot rewrite software Araq: (kidding) Recruit_main707: Araq, despite having orc, arc will eventually fix its memory leaks right? Araq: there are no leaks, there are bugs we're fixing but the fact that it doesn't collect cycles is by design livcd: Araq: "Hail the Omnissiah! He is the God in the Machine, the Source of All Knowledge." Recruit_main707: Araq: isnt the problem with async a leak? Araq: yeah, so today's async requires --gc:orc Araq: all the other std libraries are known not to create cycles Recruit_main707: thats what i mean, arc will eventually fix that (or async will be re designed) Araq: no, arc can't fix that by design Araq: only a different async can do that Araq: but for now --gc:orc is becoming the solution Recruit_main707: there are plans on that new async model in he mid future? mratsim: I thought you had this colofing based cycle collector from Bacon and Dingle paper? Chiqqum_Ngbata: "Bacon" occurs in the diff, I know that much alehander92: PMunch good day ! alehander92: hm, loading assembly today! alehander92: do you guys alehander92: prefer the at&t or the intel syntax Chiqqum_Ngbata: Hrm, is there no way to get current C compiler? mratsim: I prefer intel syntax mratsim: but for inline assembly I have to use ATT :/ KrispPurg: Hello..? Is anyone gonna help me? I have this error "The filename, directory name, or volume label syntax is incorrect." when I use Nim v1.0.4 it works fine, but on Nim v1.2.0, it doesn't. Any ideas or solutions to this error? Recruit_main707: that last url is the source? KrispPurg: yes KrispPurg: https://play.nim-lang.org/#ix=2jLh Araq: mratsim: yeah, why? Araq: once again, --gc:orc is --gc:arc + Bacon/Lins's cycle collector Araq: the 'o' is a cycle Araq: hence the name Zed: how does nim handle class methods? Zed: like with java, you have a class and then a bunch of methods for that class to access data etc Zed: how does nim do this? Araq: Nim doesn't have 'class' PMunch: KrispPurg, I don't get that error on 1.2.0 with your code.. Zed: can you turn an object into a class? Yardanico: @Zed https://nim-lang.org/docs/tut2.html#object-oriented-programming exelotl: ^ KrispPurg: huh Recruit_main707: i dont know how to help you bro exelotl: is it still using dispatch trees as the mechanism? exelotl: or did we switch to vtables yet? Araq: still uses the dispatch trees mratsim: @Araq maybe interesting for DrNim on what people may want to use it for, and you can just reuse their example for documentation as well: https://allan-blanchard.fr/publis/frama-c-wp-tutorial-en.pdf mratsim: gc:orc --> owned ref counting 😉 Araq: mratsim: thanks but I'm already stealing everything from Frama-C Araq: :D mratsim: well steal their documentation then Araq: it's very good stuff, they even have my write tracking ideas Araq: mratsim: the first milestone for Drnim is "integrate into nim's development" mratsim: btw I've found out the source of the C++ atomics codegen issue, I've workaround my initial bug but I have another one where inexplicably, Nim compiler doesn't respect {.noInit.} if the variable is declared in a for loop Araq: yeah I've seen it, can't be hard to fix mratsim: type-level {.noInit.} might be helpful for atomics, or atleast prevent assignment and sink with the C++ backend as well livcd: windows\registry.nim(58, 54) Error: expression cannot be cast to pointer -> this is what I get with gc:arc. Is this a bug? Araq: livcd, yeah, registry.nim needs to be patched KrispPurg: Well, have they changed the way how you read files in nim? KrispPurg: (nim v1.2.0) PMunch: Since 1.0.4, doubt it KrispPurg: PMunch, have you tested the code with sending your local file. PMunch: I just get the normal "No such file or directory" error KrispPurg: huh PMunch: Which is a bit weird since the file exists.. KrispPurg: yeah alehander92: mratsim hm, att seems less verbose to me because of the DWORD stuff alehander92: but i totally look rarely at asm alehander92: so no idea if i am right. PMunch: Huh, it seems like multipart.add tries to read the file PMunch: Well, not the add function. But when you go to send it PMunch: This seems to cause the issue that I'm having: https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/httpclient.nim#L913 PMunch: This commit basically changes how the httpclient handles files: https://github.com/nim-lang/Nim/commit/e056298ceb0fbddf6190f1b97f415b61323d446c PMunch: And it seems to do something wrong KrispPurg: a ha PMunch: Try to set isStream = false PMunch: Err, useStream KrispPurg: I'll do it later, because I'm fixing a a different bug. PMunch: I get the same error on 1.0.4 though.. Zed: has anybody tried any sort of machine learning with nim? PMunch: Yes Zed: how did it go? Recruit_main707: we actually have torch wrapped Zed: did you use that python binding library or direct c bindings? PMunch: I dunno, ask them PMunch: But I think it went pretty well :P Recruit_main707: i didnt manage to install it though PMunch: I didn't do it, but I know somebody did Zed: ah ok Recruit_main707: also there is arraymancer Recruit_main707: which is a tensor library Zed: yeah im looking at that now Yardanico: See https://github.com/sinkingsugar/nimtorch Zed: thanks @Yardanico PMunch: Are there any tests for document generation? KrispPurg: PMunch, it works fine now thanks :) PMunch: No problem :) shashlick: @voltist that's a choosenim bug you saw - https://github.com/dom96/choosenim/issues/194 disbot: ➥ Choosenim v0.6.0: Toolchain extraction results in corruption of vital `Nim v1.2.0` files after `choosenim update stable` ; snippet at 12https://play.nim-lang.org/#ix=2iDk shashlick: I don't have a repro though - are you on arch Linux KrispPurg: Someone should make a pr to this change though shashlick: Also, does the failure happen if you install 1.0.6? KrispPurg: (not to be confused with the choosenim issue) mratsim: @alehander42 it's not the verbosity but the argument order that mostly are annoying mratsim: ATT is input -> result while intel is result <- input Chiqqum_Ngbata: Does nimscript not support one of the child process exec procs that return exit code Chiqqum_Ngbata: The only thing I can get to work is exec() PMunch: KrispPurg, yeah I'm not entirely sure what happened there PMunch: Is it a bug, is it a (documented) API change? KrispPurg: I believe it was just some bug or just some mistake, I guess? PMunch: It looks a bit like they just swapped two fields by accident bung87: how to get next free port? livcd: bind to 0 i believe livcd: i believe on linux it gives you the free port Yardanico: Wow, TIL bung87: it's system behavior? bung87: what about windows Yardanico: Yes, it works on Windows too livcd: Did you just try? :P bung87: ok thanks Yardanico: Seems like it's a part of BSD4.2 standard or something https://docs.microsoft.com/en-gb/windows/win32/api/winsock/nf-winsock-bind?redirectedfrom=MSDN Yardanico: "For TCP/IP, if the port is specified as zero, the service provider assigns a unique port to the application from the dynamic client port range" Yardanico: 4.2BSD * bung87: thank you ! livcd: so bung87 it's a spec you should not rely on :P bung87: I'll test the program on windows when it's ready livcd: bung87 are you chinese? livcd: Anyone knows if there are some alipay/wechat libs for Nim? bung87: yeah old chinese livcd: old chinese means taiwanese? bung87: 30+ years old livcd: age lol livcd: ok bung87: I dont think there are alipay/wechat libs in Nim bung87: the nim std libs well enough? I dont think so Chiqqum_Ngbata: I've used port 0 bind extensively in automated tests, e.g. PMunch: shashlick, what's the status on nimssl? federico3: nimssl? PMunch: nimssl: https://github.com/genotrance/nimssl federico3: there's already a wrapper in stdlib nc-x: Araq, dom96 https://github.com/nim-lang/nimble/pull/797 disbot: ➥ Fix nimble because `paramCount` & `paramStr` for nimscript are now defined in os.nim PMunch: federico3, not a complete one PMunch: I specifically need RSA_private_encrypt federico3: yep, and we should try to improve that one instead PMunch: And decrypt livcd: hmm how do you actually get back the port the OS gives you? livcd: in jester mratsim: @Pmunch, for RSA we use bearssl PMunch: Hmm, that might work PMunch: Have you cross compiled for Windows with that? dom96: PMunch, wrap RSA_private_encrypt? PMunch: That's what I have done so far PMunch: Manually, for my own library PMunch: I guess I could create a PR to add them to the official module martinium: what is the equivalent of Python's pass in Nim? Recruit_main707: discard martinium: I specifically want to ignore an error so my program doesn't segfault PMunch: martinium, define "ignore an error" Rika: Just as recruit said martinium: to I need to use it within a try: except: block within the except block? martinium: dpo* martinium: do** Zevv: martinium: a segfault is not an exception Recruit_main707: discard will do Recruit_main707: about the error no idea Rika: Zevv, I think you misunderstood Zevv: a segfault is a bullet through the head because your program was behaving very bad martinium: well not really segfault but just so my program doesn't quit on an error that can be handled and not stop the running of the program Rika: Not all thrown errors are handlable are they? martinium: segfaults are a very bad error that should and will kill program Zevv: unless you catch SIGSEGV :) Araq: don't... martinium: in my case am getting OSError invalid argument martinium: so want to ignore that one case and continue processing the other 40k cases in the loop Zevv: indeed; catch the exception and do nothing in the except: block martinium: so just the discard keywork in the except block martinium: keyword* Zevv: sure. martinium: ok will try that PMunch: Zevv, don't give him any ideas! PMunch: Uhm, is choosenim broken? Rika: kinda apparently, what happened now? PMunch: I compiled Nim locally, and ran "choosenim ." PMunch: But nim --version shows the stable version being chosen.. PMunch: http://ix.io/2jMr PMunch: Uhm: http://ix.io/2jMs PMunch: Oh wait.. PMunch: Somehow Nim has gotten installed through my package manager.. PMunch: Huh, wonder how long it's been like that.. livcd: package managers are bad for your blood pressure martinium: Zevv, no dice still stops program from running ugh so I either have a more serious logic error or I dunno lol livcd: martinium: post your code martinium: in a bit have to change gears for work unfortunately disruptek: buy a radeon, they said. martinium: can readFile read an entire directory's contents? disruptek: open drivers that work in linux, they said. mratsim: use walkDir / walkDirRec PMunch: livcd, better than scourging SourceForge for installers.. livcd: PMunch: sourceforge livcd: 2020 PMunch: That was all the rage last time I used Windows :P PMunch: installersR'us then shashlick: PMunch - I've not updated nimssl since it's not clear which headers should be wrapped by default Araq: dom96: which Nimble commit should the upcoming Nim ship? shashlick: There's so many and wrapping all will take a long time to render dom96: when is the upcoming Nim shipping? dom96: and what version is it? shashlick: But using rsa.nim, you can edit and wrap those headers of interest PMunch: Just added them here instead, hopefully it will be merged :) https://github.com/nim-lang/Nim/pull/14137 disbot: ➥ Add RSA key reading and encrypt/decrypt to openssl PMunch: I think I've asked this before, but I don't think I got an answer. Is there a way to run the test-suite locally so that I don't have to create a PR and wait to see if it fails? Yardanico: yes of course Yardanico: testament can be run locally :P PMunch: And how do I do that? Yardanico: ./koch tests ? Yardanico: you also might want to select a category of tests PMunch: Oh boy, my computer sounds like it's about to fly away :P martinium: what is standard way to read/list a directory's contents? narimiran: PMunch: i compile `testament/testament.nim` and then run the category i'm interested in with `./testament/testament cat ` PMunch: That seems to work well nc-x: Araq: https://github.com/Araq/ormin/pull/49 disbot: ➥ import paramCount, paramStr from os.nim PMunch: What was the koch command to quickly build again? PMunch: It's not in --help.. narimiran: PMunch: koch temp? PMunch: That's the one disruptek: we should have a deprecation tag that works opposite of since. PMunch: Deprecated until? mratsim: from PMunch: Wait, koch temp puts the compiler in a different directory? disruptek: github 2fa broken. PMunch: Well that's half an our of good confusion I'm not getting back.. disruptek: koch temp makes bin/nim_temp. disruptek: it knows how to call testament, but you can run testament yourself, too. Araq: disruptek: 'validUntil: (2, 0)' Araq: intriguing disruptek: it's a thing? Araq: no, you invented it, I gave it a name disruptek: oh disruptek: it solves the problem. disruptek: endoflife disruptek: removedIn Araq: fun fact: every single proc in 1.0 has "Potential end of life in 2.0" because that's how semver works alehander92: hmm disruptek: i guess `until` is the closest antonym, maybe. alehander92: just finding out about `__attribute__((visibility("hidden")))` disruptek: things i wish i never knew. disruptek: today i try to build an obs for native wayland because qtgui/wayland seems to be br0xred on radeon. alehander92: is this the way alehander92: to define a function with the same name in 2 .c files Araq: well there is also 'static' alehander92: hm yeah i am trying it disruptek: stuff in important packages that doesn't run on windows has to produce a noop for windows tests, yes? Araq: disruptek: or we put the test inside a 'when not defined(windows)' Araq: the power of having the data as code *cough* disruptek: this might be one of those days where i find something, anything, else to do. mratsim: @disruptek, you're the first person I met that uses wayland? disruptek: today i read that it's the default on gnome. mratsim: OpenCL 3.0 specs are in RFC since today btw, with finalization next months AFAIK alehander92: okk alehander92: `static` it is thanks Araq mratsim: can't use Wayland with Nvidia drivers I think (or maybe they solved that) disruptek: i've been using nouveau. Araq: oh la la, niveau avec nouveau Yardanico: @mratsim I use wayland too Yardanico: although I have an amd gpu Yardanico: and yeah, you can't really use wayland on nvidia because every open source driver implemented GBM for it, and nvidia decided that EGLStreams will be "a better fit" for their driver, and it's only supported in GNOME and Plasma (and it doesn't work that good) disruptek: you say that like it's a bad thing. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: does it work? PMunch: I can see the stream Joshua S. Grant: @mratsim https://wiki.gnome.org/Initiatives/Wayland/NVIDIA martinium: is there an equivalent for python's os.listdir()? livcd: walkdir? mratsim: > @mratsim https://wiki.gnome.org/Initiatives/Wayland/NVIDIA mratsim: @Joshua S. Grant I'm using KDE but it seems like for Gnome it should work then Joshua S. Grant: Don't want to get too offtopic; But yeah, think that Nvidia is starting to relax a tiny-tiny bit and there's general advancements coming from the other-end anyways ... so, matter of time? lol I have a Nvidia Card, use GNOME, but I don't ever really use it because some things like streaming is not where I need it to be on Wayland Joshua S. Grant: I'm thinking a realistic timeline is 5 or-so years for now for it to be a "drop-in replacement"; On at least GNOME martinium: livcd, walkDir for some reason wasn't working for me I must be using it wrong. Does it need to be used in a loop or a function? narimiran: martinium: it is an iterator narimiran: here's a small example how to use it: https://nim-lang.github.io/Nim/os.html#walkDir.i%2Cstring martinium: thanks, I just realized something good narimiran: martinium: here's how you could convert it to seq if you want: https://play.nim-lang.org/#ix=2jNn bung87: walkdirrec is for you bung87: if you using pythons ,similar behavior martinium: excellent Yardanico: @Joshua S. Grant I use OBS with Wayland (on Sway) just fine, there's a plugin for that 🙂 inv2004: Hello, Question: I have nimble lib with k.h header and c.o in the root of the project. binary works ok, but the question about tests folder: config.nims with switch("path", "$projectDir/../src") does not help to find k.h header file for tests, does it mean than I have to add -Isrc to test1.nim ? inv2004: or probably there is a better way to do it for tests PMunch: Anyone have any input on whether this is my fault or not? https://github.com/nim-lang/Nim/pull/14137 disbot: ➥ Add RSA key reading and encrypt/decrypt to openssl PMunch: The CI fail that is leorize[m]: it's not your fault PMunch: Sweet CoolMan: Is there any reason ```net``` should be so slow CoolMan: I'm getting 42 ping on my own computer CoolMan: with -d:release Yardanico: notice to people here: the discord bot is gonna be down for ~1 min, I'll change its nickname from FromDiscord to "nid" Yardanico: which is shorter and much better to read livcd: \0/ leorize: CoolMan: depends on how you use it Yardanico: ok let's hope it works first try Yardanico: yay nid: 123 Yardanico: I hope that'll make it easier to read stuff xd livcd: you broke it Yardanico: livcd: ? livcd: check offtopic Yardanico: ok leorize: you could just use a proper irc client and you won't need that name to be short Yardanico: idk why it does that wtf Yardanico: ah I know why livcd: leorize: it is bad on mobile with whatever client leorize: go matrix on mobile :P livcd: irssi :p Yardanico: fixed nid: https://github.com/CoolMineman/stunning-octo-train/ is my code bad or is net just slow? nid: 0x01 is the ping packet Yardanico: btw I see you use some NBT stuff Yardanico: see https://github.com/Yardanico/nimnbt/blob/master/src/nimnbt.nim how to parse endianness and stuff Yardanico: I mean endianness only though, sorry :P Yardanico: I think I should have code for varint too nid: varint is a protocal thing nid: and it is little endian nid: will probably need the endian stuff in the future tho shashlick: what's this bridge now nid: discord Yardanico: shashlick: people asked to make the nick shorter :P nid: maybe make it more explicit Yardanico: @CoolMan I think I had varint decoding somewhere nid: It's in python? Yardanico: who? nid: your varint Yardanico: maybe i deleted it, but I surely had it in nim alehander92: wow man alehander92: that offtopic thing was a wild ride alehander92: but nid sounds like a real nick of a real person shashlick: FromDiscord => nid? Yardanico: yes :D shashlick: okay need to fix my matterbridge config shashlick: i'm not used to seeing for a long time now livcd: i asked to make the nick really short so it is readable on mobile voltist: shashlick: Thanks for pointing out that it's a known issue. I'll test to see if the problem also occurs when installing 0.16.0 and reply to the issue with my results. Yardanico: i hope not nim 0.16.0 :P Yardanico: ah right you're about corruption pigmej: Heya, ⏎ If I run `nimble build --cpu:arm64 --os:android` then the binary *should* be for arm64 right? Then why I still can run it on amd64 (?) shashlick: @voltist are you also on arch Linux pigmej: nim `devel` branch and nimble more or less recent voltist: shashlick: Yep dom96: pigmej: might need to use --passNim:--cpu:arm64 shashlick: Is it musl based pigmej: yeah that would explain as I had feeling that it's ignoring my settings pigmej: @dom96 but it says then `Error: invalid command line option: '--passNim'` voltist: shashlick: Arch is not musl based. BTW, the specifics you asked for are now on the issue thread. dom96: maybe your nimble version doesn't support that, `nimble c --cpu...` will definitely work pigmej: @dom96 I do have most recent "stable" nim pigmej: nimble I mean shashlick: @voltist thanks - at least it can be debugged now voltist: shashlick: Yeah. Do you have any guesses as to which recent version might work fine? shashlick: Newer Linux builds now come with precompiled binaries shashlick: But why stuff isn't extracted correctly makes no sense pigmej: unless there is some super duper trickery going I'm always able to run --cpu:arm64 on amd64... leorize: it's nothing special, really leorize: you probably didn't configure your nim to use a cross compiler leorize: so it complied the generated C code with the native compiler leorize: thus enable you to run the executable shashlick: Or you gave qemu pigmej: ok, so then how to enable cross compilation? I thought that it's by passing the --cpu pigmej: https://nim-lang.org/docs/nimc.html#cross-compilation leorize: do you have a cross compiler for android installed? pigmej: I want native arm64 so I don't need all the "android" stuff Yardanico: ah then you need an arm64 cross-compiler Yardanico: for example zig ;) Yardanico: ah right it's not in 1.2.0 pigmej: I do have 1.3.1 Yardanico: ah then you might want to try with zig leorize: the manual also states that you need to configure your nim :P Yardanico: download master for your OS from here https://ziglang.org/download/ , add "zig" to your path pigmej: arch so done :) Yardanico: what version? pigmej: zig or nim? Yardanico: zig >= 0.6 is needed pigmej: 1) 6.0-1 Yardanico: then do nim c --cc:zig --cpu:arm64 --passC:"-target aarch64-linux-musleabi" --passL:"-target aarch64-linux-musleabi" yourfile.nim Yardanico: and it'll make a statically linked binary with musl pigmej: k pigmej: I need cpp though pigmej: but that's easy change Yardanico: well then try "cpp" but I'm not sure if zig will work with that Yardanico: ah it won Yardanico: t pigmej: crap Yardanico: zig only can act as a C compiler rn Yardanico: you'll have to find (or cross-compile yourself) a cross-toolchain for aarch64 (arm64, armv8, same meaning) pigmej: what about arm-linux-gcc? Yardanico: that's armv7 I guess Yardanico: not 64-bit pigmej: oh yeah plausible Yardanico: ah there's https://www.archlinux.org/packages/community/x86_64/aarch64-linux-gnu-gcc/ Yardanico: although it will link dynamically with glibc, so your target arm64 device should have glibc with same version or newer too pigmej: crap pigmej: so I can go --compileOnly then and just compile on android... pigmej: will be probably less painfull Yardanico: see https://musl.cc/ pigmej: yeah libmusl would be an option for static link too pigmej: ok I thought it's somehow more integrated and having a wish to have it "easy peasy" done. Seems that it will need to wait day or two more :D Yardanico: well with zig that's possible for C backend pigmej: https://github.com/genotrance/nimfuzzy needs cpp sadly Yardanico: does it? Yardanico: it's really small https://github.com/forrestthewoods/lib_fts/blob/master/code/fts_fuzzy_match.h Yardanico: I guess you can rewrite it in Nim easily :P pigmej: https://github.com/forrestthewoods/lib_fts#why-c-and-not-c pigmej: obviously it's not rocket science, pigmej: but.... again matter of time :) shashlick: just use a docker image shashlick: dockcross, like nightlies use Vindaar: maybe just: https://github.com/nim-lang/Nim/blob/devel/tools/dochack/fuzzysearch.nim ? pigmej: dockcross would be an option too as that would make ndk possible "easy" pigmej: thx will check pigmej: @Vindaar that's also nice, maybe would work for me that would mean that I can drop cpp :) nid: @Yardanico regarding, obs screencapture on Wayland -- haven't tried it some months, but at the time there was a notable delay to the cursor and some fullscreen apps wouldn't render. It's possible this is an issue more-so with GNOME and they way it's compositor is implemented. Idk lol Yardanico: I'm using an obs plugin https://hg.sr.ht/~scoopta/wlrobs Yardanico: it works fine with Sway, no lags really and all apps render Yardanico: (I use the screencopy backend) pigmej: hmm.... how can I "import" that file without copy&paste? nid: Ah, maybe I'll true that. I was using the flathub's version that was shipping 'GNOME Screencast' or similar nid: Anyone familiar with circle ci? leorize: I have a bit of experience pigmej: ok sadly @Vindaar that search is more optimized for short single symbols from what I see than bigger texts pigmej: anyway enough input ;-) nid: 'true that' ahahaha didn't even notice at the time; one of the funnier autocorrects I've got tbh Prestige: Is there a way to do math operations on a float and int and expect a float result (that's built in)? I've just been converting the int to a float Prestige: like x = float(someInt) * 2.5 shashlick: lenientops Prestige: Thanks shashlick nid: I wonder if i could use Kivy with Nim... FromDiscord_: Is there any 'documentation tool' for Nim like Mdbook for Rust or Dottydoc for Scala3; Or is it recommended to just use mkdocs or similar? leorize: nim doc FromDiscord_: OH WOW; Major oversite by me then, lol, sorry and thanks skrylar[m]: thats a big jumble. nim doc is more like doxygen. mdbook is more like mkdocs or hugo skrylar[m]: but there is an rst2html thing built in to the nim compiler too, if you don't feel like hugo/nikola/mkdocs for some reason FromDiscord_: The relative promise of what HCR is to deliver -- has made Nim like 10x more intersting to me as someone who has barely ever touched Python; Like between that and the Lispy macro-system, it's looking so dang attractive for gamedev / live-coding FromDiscord_: Yeah, looking more for mdbook-styled than some aproximation of api docs / annotated comments. skrylar[m]: i need to finally sit down with nims hcr and test it skrylar[m]: hugo has themes like Learn which i suppose are close to mdbook skrylar[m]: wasn't mdbook just a markdown processor written in rust skrylar[m]: nims hcr also seems to only trigger when you trigger it, which i suppose avoids a lot of issues skrylar[m]: not sure if anything stupid happens if you use hcr and threads FromDiscord_: @Joshua S. Grant Keep in mind that HCR is still quite a bit finicky - it usually is in any lowish-level language that's directly compiled to machine code . skrylar[m]: yea but being able to swap a couple of functions can be enough skrylar[m]: i remember years ago trying to use embeddable common lisp, tiptoeing around some things like segfaults on the c side killing the whole thing timotheecour: is there a search functionality for IRC chat logs https://irclogs.nim-lang.org/ ? the gitter search is broken beyond repair timotheecour: (or get access to the db locally) FromDiscord_: Well one way is to use Google, it indexed quite a lot of pages in there timotheecour: ya i guess `site:https://irclogs.nim-lang.org/ “literal”` is the best bet; would still be nice to at least allow users to access db (no idea where it’s hosted, i haven’t looked into irc repo) FromDiscord_: It's hosted on the same VPS where Nimbot itself runs timotheecour: hmm https://github.com/nim-lang/nimbot readme is rather… limited FromDiscord_: Well I just have access to that VPS (because it runs FromDiscord as well) and so I know :P FromDiscord_: I guess you can ask Dom so he could give you access timotheecour: ok thanks for the info; well ideall it’d be for all, not just for me; i feel it wouldn’t be hard to at least write some good local-client based search tool around gitter FromDiscord_: Well yeah that's true the IRC logs contain tons of useful info timotheecour: likewise with forum search; searching raw data via raw db access would overcome the known limitations of forum online search timotheecour: > tons of useful info ⏎ ⏎ can’t agree more FromDiscord_: You can also use Discord search but it's also limited, and it was bridged to IRC only around 1.5-2 years ago FromDiscord_: But I think that sharing IRC logs should be harmless since they don't contain any private data FromDiscord_: I can do it myself with the permission from dom (I mean make a backup of IRC logs and publish it somewhere) timotheecour: oh cool, definitely ask his permission (but he should have a strong rationale if he doesn’t agree) and provide some instructions somewhere! timotheecour: Size wise, should be small = < 1GB i assume timotheecour: (i mean probably much less) FromDiscord_: Well actually I just checked and in total it's 2gb FromDiscord_: They go all way back to the middle of 2012 FromDiscord_: also some of them are stored as .html and others as .logs (seems like marshal'd into json nim objects) timotheecour: perfect; (maybe answer here https://github.com/timotheecour/Nim/issues/126 or create a new issue) FromDiscord_: yeah I commented https://github.com/timotheecour/Nim/issues/126#issuecomment-619466472 FromDiscord_: The first day of logging seems to be https://irclogs.nim-lang.org/30-05-2012.html btw FromDiscord_: if you use a C++ library in nim code is the GC able to clean whatever memory the library allocates or do you need to do it manually leorize: you still have to do it manually leorize: the gc can only collect memory that belongs to it leorize: disruptek: can you make your `github` module only add an Authorization when GITHUB_TOKEN exists in the environment? leorize: not all github APIs require a token FromDiscord_: do you have a mildly long example of C++ integration code leorize: !repo wxnim leorize: disbot? leorize: https://github.com/PMunch/wxnim/blob/master/examples/purewx/example1.nim leorize: here's an example of wxwidgets FromDiscord_: I see cnew, assume you’d have cdelete or similar, makes sense, thanks! leorize: that one in particular don't have it leorize: because you're supposed to destroy them via their .destroy() method leorize: but then it's wxwidgets specific :P FromDiscord_: yeah, it’s certainly a cool feature FromDiscord_: don’t think I know any other language with C++ integration FromDiscord_: Anyone here familiar with UDP? FromDiscord_: vaguely FromDiscord_: I'm looking for someone with more experience than I do to look at this PR: https://github.com/nim-lang/Nim/pull/14109 FromDiscord_: don’t know about that, hope someone can help you Prestige: Elegant Beef: are you around? FromDiscord_: Yes FromDiscord_: Man this bot really needs mentioning discord users FromDiscord_: *No i will not use irc* FromDiscord_: Haha Prestige: Sending u a request on Discord Elegant Beef bung87: how to pass compile flag when using nimble build? shashlick: Use a cfg file bung87: I'm writing a tool so , awr1: @bung87 use a nimble task or add a cfg file bung87: `build [opts, ...] [bin] ` what's the opts here bung87: when I run nimble build --help awr1: i think that is just flags for compiler FromDiscord_: Nim is OP bung87: hmm I may need read more nimble source code.. awr1: ya im looking at it rn awr1: it looks like it just passes cmd line args to compiler shashlick: It does yes awr1: i just tested it too shashlick: @awr1 since you are here, wanted to let you know that ast2 isn't in nimterop 0.4.4 awr1: oh really shashlick: It's in master and I'm yet to tag it officially in 0.5.0 shashlick: Working on various fixes and improvements shashlick: Change log, etc awr1: LMK when you tag it so i can change cpuwhat shashlick: Will do shashlick: Slowed down due to thumb pain bung87: `nimble build -d:release` will work? shashlick: Yes should awr1: i will probably remove the hard nimterop dependency but keep it under a when branch awr1: *the old code FromDiscord_: Is it possible for me to be able to 'import' .so files? awr1: i've been pining to possibly add ISPC support for it future, i don't quite have a plan yet for how to go about though awr1: https://ispc.github.io/ shashlick: Yes look at dynlib and importc bung87: ah yes it works, I mis read the stdout, `Debug build;` info belongs the tool FromDiscord_: Thanks awr1: using intrinsics in GCC/Clang are annoying if you want to make portable software shashlick: What do you want to import TC shashlick: You usually need to make a wrapper, as we call it, of the C functions you want to import RocksteadyTC: is there something like NVM for nim? awr1: choosenim awr1: https://github.com/dom96/choosenim RocksteadyTC: I'm trying to get an older app to run, and the error message is quite cryptic, but a friend gets it to run no problem in 0.17.2 RocksteadyTC: thanks @awr1 shashlick: What's the error bung87: https://github.com/nim-lang/niminst I'm wondering this lib really in used? bung87: I can't get useful info from readme.txt awr1: https://github.com/nim-lang/niminst/blob/master/niminst.txt awr1: looks like you were looking at the wrong txt bung87: oh, it should combine the link you provider and https://github.com/nim-lang/niminst/blob/master/niminst.nim `const Usage ` to readme shashlick: It's used to create the zip file shashlick: See koch bung87: so , for macos it use zip packaging files right? shashlick: Posix is the xz file shashlick: But all three can be recompiled from scratch on any other bung87: ok thank you , then I 'm not reinventing the tool. shashlick: What do you need bung87: (https://files.gitter.im/nim-lang/Nim/GDba/Screenshot-2020-04-26-at-12.23.53-PM.png) bung87: I wrote this, could be part of webgui lib FromDiscord_: Can someone tell how easy my Python script (https://paste.pythondiscord.com/fitusadogi.py) would be to port to Nim? bung87: https://github.com/bung87/nim-pymod bung87: oh wrong repo , it's nim to py shashlick: You can convert line by line in 10 minutes shashlick: It's short and doesn't import any 3rd party stuff bung87: https://github.com/oumugai/py2nim/blob/master/py2nim.py bung87: then using regex replace , think this would be the short way bung87: also could build the py code to .so and import it in nim? FromDiscord_: Thanks :p FromDiscord_: im new to nim, i cant figure out what to do: int var (that takes command line argument) cant evaluate at runtime (due to?) custom type that uses it. if types are at compile time and wont accept it, how else should i do it? https://play.nim-lang.org/#ix=2jBU Prestige: maxOps is a variable but arrays are evaluated at compile time Prestige: So I think you can't do array[maxOps, array[2, int]] narimiran: use `seq` Prestige: ^ FromDiscord_: alrighty, thanks for the info awr1: has anyone ever tried to generate C code (or more specifically C-like code) using the macro system directly? either through the compiler libs (though I don't know of any interface in the compiler libs that allows NimNode *directly* to be reformed into PNodes) or some other means? FromDiscord_: I don't know what you mean 😅 FromDiscord_: Anyone know if a class system like `class name(classToInherit)` will be a thing? awr1: come to think of it i suppose the shader generation libs i've seen kinda count FromDiscord_: Well technicae with the macro system that is possible but nim has inheritance so depending on what you need that's in already awr1: i'm considering approaches to an ISPC library for nim FromDiscord_: I want to be able to have a class that can accept arguments FromDiscord_: What do you mean? awr1: where individual functions based on a nim subset could be compiled to the ISPC language FromDiscord_: class that can accept arguements? FromDiscord_: Like a python class FromDiscord_: With an init function awr1: what is missing from `type Foo = object of Bar` for you awr1: oh init functions FromDiscord_: Yeah :p FromDiscord_: you mean a constructor? FromDiscord_: Yeah awr1: nim probably will not get user definable implicit ctors FromDiscord_: Damn FromDiscord_: I tried making my own hacky version FromDiscord_: But I can't really do it well FromDiscord_: i mean that's what people normally do `newObject` FromDiscord_: I can probably do it with more effort FromDiscord_: How would newObject work? awr1: https://forum.nim-lang.org/t/1190 FromDiscord_: https://nim-by-example.github.io/macros/ FromDiscord_: Also, the reason i wanna do it like this is because i am making a Python module in Nim FromDiscord_: there is an example there that looks close to what you want awr1: standard nim way is you make a explicit proc that constructs things awr1: pretty straightforward imo FromDiscord_: Okay then, thanks awr1: if the issue for you is less that "you have to call ctors" awr1: and more that you want a ctor-ish definition in line with the object def awr1: you can do that with macros FromDiscord_: Okay, thanks FromDiscord_: I might just use tables with procs FromDiscord_: Can I define a proc inside of a proc? awr1: yes awr1: it will have closure capabilities unless you specify `{.nimcall.}` FromDiscord_: Thanks Prestige: Is there a way to run a command in nimscript in the background? I was trying exec "my command &" but that doesn't work FromDiscord_: Prestige: Why do you need to run a command in the background? Prestige: I'm trying to set up a nimble task to run my setup to manually test my WM, which launches Xephyr in the background then runs my WM on the new display Prestige: currently I'm using a bash script, was hoping to get it running via nimble or a nim script FromDiscord_: Prestige: Have nimble run the bash script? FromDiscord_: Sorry, nimscript FromDiscord_: Have nimscript execute the bash script Prestige: I mean atm I'm just doing ./run.sh, would be nice to just be able to add it to my nimdow.nimble and not have an external script at all Prestige: Is there no way to run a command in the background and continue execution? FromDiscord_: With Nim, yes. With nimscript, I don't know Prestige: Ah okay, thanks FromDiscord_: Man varriount you need an avatar that fucked with me for a good 10 seconds FromDiscord_: Prestige you can use nimble build tasks if you want FromDiscord_: but yea no clue about the non blocking Prestige: Yeah I was using it to build but got hard stopped when I couldn't fork a process to the bg Prestige: Looked through the docs a couple times but haven't found anything yet Prestige: I would assume there's a way but 🤷 FromDiscord_: Anyone know how I'd make an asynchronous function for use in python using Nimpy. FromDiscord_: ?* FromDiscord_: @Elegant Beef There. FromDiscord_: thanks 😄 FromDiscord_: @Technicae Circuit How are you interfacing with Bumpy? FromDiscord_: *Numpy FromDiscord_: What? FromDiscord_: Nimpy FromDiscord_: https://github.com/yglukhov/nimpy FromDiscord_: I can make Python functions in Nik or import Python modules FromDiscord_: See this is why we need explicit names like `NimPythonBridge` FromDiscord_: 😄 FromDiscord_: Haha FromDiscord_: @Technicae Circuit What do you mean by async? Python async or Nim async FromDiscord_: Python async FromDiscord_: I need to make an asynchronous Python function in Nim FromDiscord_: I'm basically wrapping httpclient for Python because it's faster then any Python alternative as of now FromDiscord_: And i need it to be asyncronous FromDiscord_: Hm. FromDiscord_: What I would do, is create a regular Nim function and wrap that in an iterator which handles the state management. FromDiscord_: That being said FromDiscord_: You may just need to run it in another thread. FromDiscord_: Threading doesn't like async FromDiscord_: Okay then, thanks FromDiscord_: Also, if you know Python, how do i use an executor? :P FromDiscord_: Why are you using nimpy if i may ask? FromDiscord_: Because it's easy to make Python extensions with Nimpy FromDiscord_: And i am still a python programmer at heart FromDiscord_: I am too attached to python but i also love Nim FromDiscord_: So FromDiscord_: ~~But python is so icky~~ Ah, ok FromDiscord_: Haha FromDiscord_: ... I like Python FromDiscord_: It's ok to be objectively wrong, it happens to some people sometimes 😛 FromDiscord_: @Technicae Circuit Personally, I would attempt to write a Nim dll, and interface with it via CFFI FromDiscord_: I use windows :p FromDiscord_: And using cffi isn't allowed on PyPi i think FromDiscord_: You mean Pypy? FromDiscord_: Nope FromDiscord_: PyPi FromDiscord_: PyPI is the package index FromDiscord_: Yeah FromDiscord_: Where you upload packages FromDiscord_: You can't use cffi packages i think on PyPi FromDiscord_: Uh... I don't see why using a particular dependency would bar you from uploading or using the package index. FromDiscord_: They don't allow you to upload other languages that need an additional compiler i think FromDiscord_: I can't remember exactly tho FromDiscord_: I know that Numpy and some other scientific libraries use it. FromDiscord_: They use Cython FromDiscord_: Upload the generated Nim C code FromDiscord_: Since setuptools and distutils can compile the C by default FromDiscord_: That's distro and arch specifc FromDiscord_: Specific* FromDiscord_: Who is the "they" here? FromDiscord_: They as in the people who run PyPi FromDiscord_: PyPI is just a package index. The maintainers don't particularly care what dependencies or tools your package requires to run. FromDiscord_: (maintainers, as in the ones who maintain the index) FromDiscord_: Hm FromDiscord_: Well, I don't think people will want another compiler on their system FromDiscord_: Use the C files generated by Nim, and have setuptools/distutils/pip build it. FromDiscord_: Or better yet, supply a wheel with pre-built binaries FromDiscord_: But the C files are platform specific FromDiscord_: A wheel is good FromDiscord_: But idk how to make them 😅 FromDiscord_: In Nim? They are OS and architecture specific, but they're aren't that many combinations of those, and the Nim compiler can generate code for all of them from one system. FromDiscord_: 64/32 bit x Windows/Linux/OSX/BSD FromDiscord_: Yeah FromDiscord_: Do you know how to make wheels btw? FromDiscord_: Oh yeah, Nimporter can make wheels iirc FromDiscord_: Unfortunately I do not. I have not written C extensions before. FromDiscord_: That being said, there's probably a dearth of information available on the interwebz FromDiscord_: Damn FromDiscord_: Thanks FromDiscord_: @Technicae Circuit Here's a project that uses CFFI - https://github.com/pyca/cryptography/blob/d75335a7de77d4294bea29d03928229a83a77493/setup.py FromDiscord_: As you can see, it's completely simple and straightforward, just like all Python packaging processes. FromDiscord_: \sarcasm\ FromDiscord_: Oh cool FromDiscord_: The main things I see are adding cffi to setup_requires and a bunch of the side effect stuff FromDiscord_: https://cffi.readthedocs.io/en/latest/cdef.html#preparing-and-distributing-modules FromDiscord_: That should also help FromDiscord_: Thanks livcd: There's a lot of people here from discord recently wow FromDiscord_: Haha FromDiscord_: There's 800 people in the discord livcd: Amazing. Nim is really taking off. FromDiscord_: Mhm bung87: can I static read binary data? livcd: bung87: yes bung87: really? how to do that livcd: Sorry I am a bit tipsy. But I staticRead an exe (a driver) and I install it before I execute my business logic in a Nim program livcd: Is that what you were asking? bung87: not really understood your logic , I mean eg static read a zip file livcd: Yes you can livcd: You decompress at runtime the zip file bung87: before that I need convert it to cstring? FromDiscord_: *Someone want to explain what "Static reading" is?* livcd: i dont think you have to. You can just dump the zip file and decompress. FromDiscord_: Ah it's an actual function FromDiscord_: nvm bung87: ok,thank you, I'll try livcd: Elegant Beef: for resource embedding in the binary FromDiscord_: Yea i looked it up when i noticed you wrote it camel cased livcd: Elegant Beef: where are you from? FromDiscord_: Canada, why? livcd: Ah just thinking about when the people are most active on this channel livcd: I would say it's still very EU centric FromDiscord_: Ah yea FromDiscord_: :p Prestige: Some of us in the US just don't sleep Prestige: er, western hemisphere FromDiscord_: Man this dude just said Canada is in the US Prestige: Canada is just the USA's favorite hat, Beef FromDiscord_: Im thinking with your president tweeing "liberate X state" we might come down there and do it FromDiscord_: tweeting* Prestige: I try to not read or hear anything he says livcd: I dont see any difference between the US and Canda :P livcd: sorry guys FromDiscord_: Damn livcd: But seriously :P FromDiscord_: We have a parlimentary system, and most importantly garuentee healthcare as a human right livcd: That's just nuances. You coul do the same as US state FromDiscord_: Lol im certain the federal US government would like it if you made a new federal government in your state, and disregarded them 😄 livcd: Politics aside I really see you like Germany and Austria FromDiscord_: @Elegant Beef If it weren't for family, I would seriously consider trying to immigrate to Canada livcd: Me too. Prestige: Where are you all? livcd: I am in Austria FromDiscord_: East coast of the US Prestige: Same Varriount livcd: I would immigrate to Canada just because it's easier in Canada than in the US. I would very much prefer the US though. FromDiscord_: Family schmamily, not like US/Canada has the worlds strictist border 😄 livcd: Elegant Beef: Costs. FromDiscord_: I like being within driving distance of my family FromDiscord_: (so you can guess that I'm not in Vermont) FromDiscord_: Well the trick is you get so good at your job you own the company and get a private jet, this way you're preparing for failure 😛 Prestige: two guesses.. Georgia or Marland? Prestige: Maryland* livcd: Elegant Beef: Where are you in Canada? FromDiscord_: Also bold of you to know i know the placement of any states that arent major states ie NY,Cali,Washington,Florida,Texas,Louisana,Alabama,DC/Maryland FromDiscord_: That's all my US geography 😄 livcd: It does not matter livcd: It's not like I can pin point any not so known german cities in Germany :P FromDiscord_: I mean it's a very american thing to expect people to know where states are livcd: It's a european thing to know where at least the capital cities are FromDiscord_: They got 50 states and have states with like 800k people in them, why are you dividing up land so agressively! FromDiscord_: To be fair, although I can list all the states, I would have a hard time placing them all on a map livcd: Ahh I would not livcd: I mean i learned that at high school Prestige: Same FromDiscord_: livcd: There is a joke about a European friend/relative coming to visit someone on a state on the East coast (say, New York) and suggesting a "short" trip to visit Texas (Midwest) or California (West) livcd: short trip aye FromDiscord_: There is another joke about a European suggesting using public transit in NA FromDiscord_: Get it cause most of it's garbage FromDiscord_: 😛 livcd: Idk I always felt the US to be so surreal livcd: I have to visit to really understand if it's real or not :P FromDiscord_: @Elegant Beef That's highly dependant on the state livcd: I never had such feeling about Asia FromDiscord_: >public transit in NA livcd: public transit is overrated livcd: idc tbh livcd: It's not a religion to me. It's nice if you have an access to an efficient public transit. But if you commute by car it's also nice. Prestige: It's nice to have esp in big cities FromDiscord_: Well i dont drive and have no interest in getting a license livcd: I used to drive in Seoul livcd: I ver much preffered driving in Seoul than using a public transit in Seoul FromDiscord_: I love public transit FromDiscord_: I dont need a car, especially in this small town im in livcd: And Seoul has one of the best public transit systems livcd: express subway lines aaaaahhhh livcd: I like Singapore the most though livcd: Elegant Beef: do you live in any of the big cities in Canada? FromDiscord_: Nope FromDiscord_: Bumfuck nowhere Prestige: Are there plans to remove the necessity of forward declaring procs when they aren't listed in order? livcd: wait is not that a feature? :P FromDiscord_: Isnt that in C/C++? FromDiscord_: Ah i totally know words and what they mean Prestige: Currently you have to forward declare procs unless they are declared before they are called Prestige: i.e. you can't call a proc before it's declared FromDiscord_: isnt it like that with C and C++ Prestige: Yeah, afaik FromDiscord_: I feel like as annoying as it is it's fine FromDiscord_: It does suck if you want to call a function from inside another function but the function is above it for good reason Prestige: I prefer listing my functions in essentially the reverse order that is required to not have them forward declared, for readability. So I'm forward declaring all my procs, usually FromDiscord_: Eh, i just declare when/where i need without thinking and let the red squiggle tell me if i do good Prestige: I think it's something that could be done, would be nice. Just don't know if it's even a considered proposal atm jorjun_twitter: Is there a nice idiomatic way of attaching a few constant static properties to an object? FromDiscord_: is wxnim pretty much dead by now or are there plans to begin updating it again in the future? livcd: Why would it be dead? FromDiscord_: There just hasn't been any updates in over a year livcd: That's not what dead means :P livcd: You need to deal with the fact that Nim's community is very small and a lot of libs will be maintained by solo developers. FromDiscord_: I know and I understand that. I just really enjoy the language and want to be able to get more out of it. livcd: Right now you are talking about PMunch's fork right? dom96: There are thousands of possible libraries that could be created and much less Nim developers that have time to maintain them. If there is a library that you care about, help us maintain it :) FromDiscord_: Yeah, that's the one. livcd: one could say jester is also abandoned livcd: :P dom96: indeed dom96: others would say it's complete :P narimiran_: ahem... https://github.com/dom96/jester/pull/243 FromDiscord_: I've tried helping with some of the libraries but the low level stuff is hard for me to follow coming from a python background. livcd: httpbeast windows support when! livcd: btw dom96 livcd: what's your bread and butter @ FB? dom96: narimiran, yeah, that needs me to fix the CI, which I don't have the will for right now dom96: livcd, httpbeast support for Windows never narimiran: so, you can merge it now without CI? narimiran: CI is already failing even without that PR livcd: dom96: sadpandaface dom96: narimiran, did you try the alltest manually? narimiran: this just unblocks me from sending a cleanup PR to nim repo dom96: or can you? if it compiles and runs I'll merge narimiran: let me try dom96: livcd, what do you mean by "bread and butter"? lol livcd: dom96: tech stack livcd: basically what do you do dom96: A lot of Hack currently. But also some C++ and Python. FromDiscord_: Hello Prestige: o/ FromDiscord_: Back to whittling on the model of tachiyomi in nim narimiran: dom96: how long should that test take? it seems like it just hangs :/ dom96: narimiran, it's a server, send some requests to it dom96: see the file for the routes dom96: test a few livcd: how's hack? dom96: Fairly good for a PHP fork livcd: Did you sneak in any Nim? dom96: Nope, but I have been trying :) jorjun_twitter: now thinking python damages the brain the way that basic was said to do :( narimiran: dom96: tested and it works. (i've just found another deprecated `random` in `alltest.nim`, so i force-pushed that one too) jorjun_twitter: declare a tuple of points, then wrestle with trying to iterate over it dom96: narimiran, cool, thanks! FromDiscord_: <0ffh> Q: In a library I am writing I have a few one-line convenience/readability procs that really should not result in a call/ret. Should I rather defined them as {.inline.} or as a template? PMunch: Depends on what they do PMunch: I tend to use templates FromDiscord_: dom96 when you talk about hacks, what type of hacks? dom96: I'm talking about the Hack programming language FromDiscord_: Lol FromDiscord_: Nim is kinda hard to pun with isn't it FromDiscord_: not many words end or start with nim FromDiscord_: <0ffh> @PMunch Yes, I think I probably should, too. Also templates are guaranteed to inline, which {.inline.} isn't, iirc. Thanks PMunch: Yeah, templates are inlined by the Nim compiler the {.inline.} pragma is just a hint to the C compiler PMunch: That being said if it isn't inlined it's because the C compiler deems it a performance loss to do so FromDiscord_: I thought the inline pragma was performed by the nim compiler, to allow for cross module inlining outside of lto FromDiscord_: I see, the inline function is copied into each generated C file as a separate function annotated as inline FromDiscord_: Yep, I guess that leaves the c/c++ compiler to choose wether it’s better or not jorjun_twitter: Trying the exercism mentor assist function so don’t answer me on here. jorjun_twitter: for the next challenge I am going to prototype in Python then encode it in nim afterwards, see if that makes it less sweat jorjun_twitter: From a philosophical perspective the idea that unit testing is the One Way to develop seems come from an established ethos that coding is difficult. And it is mostly (before the rise of scripting showed us differently). But self-testing is also a form of onanistic conceit. Better to get your conciseness, model and algorithm right, and place any spare chips on that aspect of the craft. Because coding isn’t an ... endless succession of input =: correct_output jorjun_twitter: Or if it was I would immediately change careers. jorjun_twitter: http://claysnow.co.uk/recycling-tests-in-tdd/ jorjun_twitter: Perhaps I am still traumatised by sharing an office with kids far younger than me back in 2010, who placed a Darth Vader meme passively aggressively over my desks: “I find your lack of tests disturbing”. I thought, “who the fuck are you to advise me, when I have more years experience in code than you have had on earth. They got me fired a few months later.” On the plus side, I learned heaps of linux lore FromGitter: ... from those twats which I now realise is the only way to get it, i.e. from working with other geeks. FromDiscord_: jorjun_twitter: prototyping in python is not worth it imo, nim is already very clean jorjun_twitter: @Recruit_main707 yes, I find it clean. It is me that is at fault for being oblivious about types and focussing only on rapid evolution of an algorithm. Being forced to think about architecture is a good discipline. I am at that steep part of the learning curve. But going on the faith that I will be able to craft in nim without feeling as if I am also trying to construct a c-program underneath it all.. livcd: I think prototyping is worth it if you rely on certain set of libraries that are not there yet for Nim dom96: https://i.imgur.com/y6vrNeE.png dom96: Close enough :) dom96: (gamelight font rendering JS vs. SDL for the same code) PMunch: That's pretty good PMunch: Not perfect of course FromDiscord_: Can someone give me an example on how i would use a C++ lib in Nim? Araq: ok, I did it, got --gc:orc to win the havlak benchmark Araq: 1.0s for --gc:orc, 1.4s for boehm/refc/markAndSweep Araq: 0.7s for --gc:arc dom96: what is orc? FromDiscord_: :p Araq: dom96: arc + a cycle collector Araq: (so that nobody has to patch async, yay...) inv2004: Hello, everything is perfect with nim, except my small question :) Q: t.addColumn[int]("aaa") does not work - it says error in 2nd param, but addColumn[int](t, "aaa") work perfect. Are where any workaround I can apply? dom96: Araq, awesome. Does it work with async already? FromDiscord_: yes, you should write [:int] FromDiscord_: ive been beat Araq: dom96: haven't tried but lots of GC tests are still red too FromDiscord_: learned from the best one Araq: dom96: I wanted to ensure I can meet my arbitrary performance requirements before continuing and the performance it ok FromDiscord_: small thought i just had, why is it "case of" rather than the more "conventional" "switch case" FromDiscord_: in nim inv2004: ^^^ sorry, looks like my fault with string/cstring conversion FromDiscord_: inv2004: what do you mean your fauly? Zevv: wow orc wins, that's pretty sweet! Araq: Rika: because it's less to type and felt cleaner to a non-native English speaker FromDiscord_: pascal uses case of too FromDiscord_: hmm, i see, was just wondering FromDiscord_: ah so we arent the only ones Araq: yeah the Pascal family uses 'case' indeed FromDiscord_: I quite like their syntax https://castle-engine.io/modern_pascal_introduction.html#_testing_single_expression_for_multiple_values_case skrylar[m]: hoi FromDiscord_: hoi! skrylar[m]: i see dom is also doing type related things skrylar[m]: hoping to get the non-richtext renderer done today x.x inv2004: no, cstring does not matter :( t.addColumn[int]("aaa") proc addColumn[T](t: var K; name: string) \n first type mismatch at position: 2\n missing parameter: name FromDiscord_: we told you what to do already] FromDiscord_: `t.addColumn[:int]("aaa")` add the colon here skrylar[m]: is --gendeps intended to take the full time to compile a module but not actually write the result to output :eyes: skrylar[m]: i get the depfile but it doesn't also spit out the executable inv2004: [:T] from telegram - solved :) Zevv: So next thing we know Nim itself will run on orc as well FromDiscord_: dom96, can I get your font with "!!" missing? I did fix an issue for things missing. But it looks like it made !! in your font vanish. Fonts are really complex some times. dom96: hey treeform, sure dom96: let me open discord and send it to you dom96: sent FromDiscord_: thanks disruptek: i think it was leorize. disruptek: the doofus who told me i shouldn't use radeonsi. FromDiscord_: i wnated to try that tabnine, do i have to enable nim default plugin too or what disruptek: i thought it was pay-to-play. zacharycarter: it was zacharycarter: I'm still having trouble getting nim-lsp to play nice with kakoune PMunch: What's the issue zacharycarter: I probably have something configured incorrectly because I know Solitude uses kak with lsp zacharycarter: but jump to definition isn't working for me or references etc solitudesf: do they never work? zacharycarter: nope never even in the same local file zacharycarter: I saw your dotfiles on github Solitude so I probably need to take a closer look at them and see what the difference is between my kakrc and yours FromDiscord_: What would happen if I tried to create more threads than maxthreadpoolsize? disruptek: let's just say i wouldn't want to be in the same room. FromDiscord_: Would anything bad happen if I just set MaxThreadPoolSize to something very high disruptek: you know what's really high right now? disruptek: 👍this guy👍 zacharycarter: :D solitudesf: stop abusing substances and turn on the stream zacharycarter: or turn on the stream while you abuse substances zacharycarter: I'm not picky disruptek: i'm not sure obs can actually capture video yet. disruptek: also i don't have a web browser. zacharycarter: what happened to it? disruptek: it just fucked right off. zacharycarter: hate it when they do that disruptek: i think maybe it's on my old video card. zacharycarter: sneaky web browser disruptek: $ chromium --new-window 4760ms  11:34 disruptek: Opening in existing browser session. disruptek: is it me? zacharycarter: yes zacharycarter: no zacharycarter: possibly inv2004: C: header.h inv2004: typedef struct{unsigned char g[16];}U; inv2004: function: K ku(U); inv2004: Nim: inv2004: GUID* = array[16, byte] inv2004: proc ku*(x: GUID): K0 {. importc: "ku", header: "header.h".} inv2004: trying to call ku(GUID), but compilation fails during compilation into C: inv2004: incompatible type for argument 1 of ‘ku’ inv2004: expected ‘U {aka struct }’ but argument is of type ‘NU8 * {aka unsigned char *}’ inv2004: ogm sorry, did not expect it from copy-paste FromDiscord_: @kodkuce I use it with the Nim plugin together and it actually works pretty good. TabNine sometimes really helps when you need you type quite a lot of similar code, or it can predict what you want to write by the previous lines and stuff. I've been using the free version inv2004: Telegram pointed that nim force for pass the array by pointer, but are there any way to pass it like value? FromDiscord_: inv2004 try `cuchar` instead of `byte` i think FromDiscord_: i have no clue tbh inv2004: Rika, it did not help FromDiscord_: > i have no clue tbh skrylar[m]: https://media.discordapp.net/attachments/239881657908330499/704004089372999680/unknown.png woo. now to add the prettier linebreaker FromDiscord_: Working on a new leaderboard FromDiscord_: https://cdn.discordapp.com/attachments/371759389889003532/704006282369040471/unknown.png FromDiscord_: io game :ThonkDumb: FromDiscord_: io games are the best 😄 Prestige: dom96: written in nim? dom96: of course iws: memory access question: I am trying to use SDL2/Audio and in the example the outputbuffer is set up with `var outputBuffer = allocShred(nBytesPerSample)` iws: I have a sequence I want to write inot that shared buffer before handing to the queueAudio() call iws: How could that be done? zacharycarter: `addr seq[0]`? iws: That would give me the pointer to the value at seq[0] right? But in this case I want to write to some byte x inside the outputBuffer (which is a poitner to something?) iws: https://github.com/nim-lang/sdl2/blob/master/examples/sdl_audiostream.nim Line 111->116 is what I was trying to replicate iws: but with my data coming from a seq[int] instead of a stream zacharycarter: just try what I suggested iws: I did, but I have syntax errors abound zacharycarter: `queueAudio(addr seq[0], len(seq) * sizeof(seq_datatype)) FromDiscord_: can you edit an openarray? iws: Oh I see! Yardanico: @Recruit yes Yardanico: if you pass it as "var openArray[...]" FromDiscord_: ok, forgot about var iws: zacharycarter: That works great! Thanks a ton iws: I understand what's going on now, that's much clearer zacharycarter: np iws: the only couple differeces were type issues iws: `device.queueAudio(unsafeAddr wave[0], uint32(len(wave) * sizeof(int)))` wound up with that zacharycarter: looks good zacharycarter: I'm running into a EXC_BAD_ACCESS signal here - https://github.com/nim-lang/Nim/blob/devel/lib/system/excpt.nim#L114 - at the end of my thread func's execution zacharycarter: can't figure out why :/ FromDiscord_: zacharycarter: Are you using arc? zacharycarter: yeah with `--exceptions:setjmp` FromDiscord_: Are you getting a stack trace? zacharycarter: yeah but it's not very helpful Yardanico: uh guys I'll restart the FromDiscord bot now coz I accidentally made a public paste with the token (so I'll recreate it), expect a few mins of downtime for the FromDiscord here, sorry for the inconvenience Varriount: Yardanico: You've doomed us all Yardanico: done Varriount: zacharycarter: What's the trace? zacharyc1rter: whoops killed my tmux session I think zacharyc1rter: Varriount: https://play.nim-lang.org/#ix=2jGU - are the top three frames of the stack trace zacharyc1rter: the middle frame is the last line of my thread func zacharyc1rter: where I make a call to another proc that calls `mnunmap` and that call returns with a zero exit code zacharyc1rter: if I remove that call, the program exits after I call joinThreads. If I keep that call present it hangs and this EXC_BAD_ACCESS signal occurs leorize: did you unmap some of Nim's memory? zacharyc1rter: no I unmapped some memory I previous mapped with `mmap` / `mprotect` Recruit_main707: can you use "in" with a seq? Varriount: Yes Recruit_main707: with sequtils right? Recruit_main707: oh, it now works Recruit_main707: i swear it said it didnt work before :p Varriount: zacharycarter: I'd modify the pop safepoint code to print out the value of excHandler.prev Varriount: *excHandler Rika: @Recruit_main707 no need even, its from `system` zacharyc1rter: hmm this one is pretty easy to reproduce - https://play.nim-lang.org/#ix=2jHa zacharyc1rter: asan is not happy Yardanico: @Recruit_main707 it's easy to check if you can use "in" for some type - search for "contains" for that type Yardanico: if a type has proc contains*(a: MyType): bool defined it'll be used by "in" and "notin" Recruit_main707: hmm arc being slower than the default gc.... Yardanico: code? Recruit_main707: https://play.nim-lang.org/#ix=2jHh Yardanico: and it's not always supposed to be faster (at least yet), it's much newer than default GC which has been around for years :P Yardanico: @Recruit it's actually faster for me with --gc:arc lol Yardanico: on the last cpuTime it's 4s for --gc:arc vs 5s for default gc Recruit_main707: which leads to the second question, how the hell is python doing that in under 1 second (the biggest array/seq Yardanico: (I'm on latest devel and compiled with -d:danger) Yardanico: can you show python code? Recruit_main707: https://play.nim-lang.org/#ix=2jHj <- python code Recruit_main707: also, on my machine last cpuTime takes 20 seconds lol Recruit_main707: (with arc -d:danger) Yardanico: https://play.nim-lang.org/#ix=2jHk that's faster for me Yardanico: around 25% Yardanico: also cpuTime isn't always what you want leorize[m]: use std/monotimes for benchmark Recruit_main707: but still, nim being that slow compared to python... leorize[m]: give me the benchmark in python and the same in nim :P leorize[m]: and I'll see if I can beat python :P Recruit_main707: on the last aray: `hyfix 0.16587833000000005` Recruit_main707: i linked hyfix above Recruit_main707: array* Yardanico: what about the full code? Yardanico: full python script Yardanico: with actual benchmarking Technicae Circuit: What is the fastest C compiler that i should use with Nim? disruptek: gcc leorize: clang is also decent nowadays disruptek: more codegen bugs, though. Yardanico: disruptek: clang is sometimes faster Recruit_main707: gcc tends to be faster though iirc Yardanico: clang and gcc are the same for perf most of the time nowadays Technicae Circuit: Okay then Yardanico: https://www.phoronix.com/scan.php?page=article&item=gcc-clang-3960x&num=1 Technicae Circuit: Thanks Recruit_main707: _maybe_ its just my machine being slow Recruit_main707: wait a sec Yardanico: well if you share full python script we might help Recruit_main707: leorize: what do you use for benchmarks? leorize: std/monotimes, that's one of the most accurate and low overhead timers in the stdlib Recruit_main707: how would i use it? Yardanico: there are docs though? Yardanico: https://nim-lang.org/docs/monotimes.html Yardanico: just subtract one getMonoTime() from another Recruit_main707: thx zacharyc1rter: hmm zacharyc1rter: apparently here - https://github.com/nim-lang/Nim/blob/devel/lib/system/excpt.nim#L113-L114 zacharyc1rter: `excHandler` is undefined Yardanico: https://github.com/nim-lang/Nim/blob/devel/lib/system/excpt.nim#L62 zacharyc1rter: I put a breakpoint in lldb and turned off line mappings and when I try to print `p excHandler__rqLlY5bs9atDw2OXYqJEn` I get - `(lldb) p excHandler__rqLlY5bs9atDw2OXYqJEn5 zacharyc1rter: error: use of undeclared identifier 'excHandler__rqLlY5bs9atDw2OXYqJEn5'` zacharyc1rter: sorry zacharyc1rter: I'll check out the generated C code to see what's wrong zacharyc1rter: yeah, it's not generated hmm Yardanico: but how did the code compile if it's not there zacharyc1rter: hmm good question zacharyc1rter: maybe it's defined in another source file let me look zacharyc1rter: okay yeah my mistake I think I was just messing up the search string zacharyc1rter: when I dereference it, I get - zacharyc1rter: error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory zacharyc1rter: and if I dereference it and print it's `prev` member property - error: supposed to interpret, but failed: Interpreter couldn't read from memory zacharyc1rter: I think those are lldb errors Yardanico: but is that variable even supposed to contain something meaningful if there's no exception in nim code happening currently? zacharyc1rter: well I'm getting an EXC_BAD_ACCESS error in lldb and my program just hangs when I run it CoolMan: How do I convert a char to byte or uint8? Yardanico: uint8(myvar) Yardanico: https://play.nim-lang.org/#ix=2jHW Yardanico: there's also "ord" to get an int value of a character Yardanico: (or an enum value) CoolMan: ty disruptek: i'm watching my stream from a couple days ago. disruptek: pretty damned boring. Bennyelg: Dummie Question Bennyelg: I wrote nim backend but I dont want to use static pages but React Bennyelg: How should I do it 👀😅 Yardanico: do an api in nim and make your frontend call that api? Yardanico: I mean rest api or whatever Bennyelg: Well so I need to understand when I should use the static pages and when is not enough since that what I thought Bennyelg: But I still wany my logic will remain on Nim Yardanico: yes it'll still be in nim Yardanico: if you want to use react you will implement backend api in nim Bennyelg: Which just return Jsons, but when called Ill cast to the relevant types, do the logic and put it via the dal Yardanico: well that's how it works, and it doesn't really have to be JSON, it can be anything you can decode on the frontend Yardanico: https://medium.com/free-code-camp/create-a-react-frontend-a-node-express-backend-and-connect-them-together-c5798926047c for example, but replace backend with nim Bennyelg: Thanks 😊 Vindaar: @narimiran why are you forking all those repos? :D Yardanico: for fusion maybe? Yardanico: idk Vindaar: hmm, maybe Vindaar: ahh, he's fixing some deprecated things Technicae Circuit: How do i make a webserver in Nim? Technicae Circuit: Using the C side skrylar[m]: hmm looks like this [expired] adobe patent for line breaking is a lot like the one optimized knuth plass one but with a depth limit stuck to it :curiou skrylar[m]: * :curious: Yardanico: @Technicae you mean the C (default) backend? Yardanico: the easiest choice would be to use jester or asynchttpserver (but it's a bit broken in 1.2.0 but it was fixed and will be in next 1.2 patch) Technicae Circuit: You and thanks Technicae Circuit: Can Nim be used to make mobile apps? Recruit_main707: it can Technicae Circuit: If so, is it ideal? Recruit_main707: i heard android is a bit painful Technicae Circuit: Is it not recommended or something dom96: ideal for what? Technicae Circuit: Ideal for making android apps dom96: obviously Swift is ideal for iOS and Java/Kotlin is ideal for Android Technicae Circuit: ~~I totally am not thinking about making a custom mobile discord client~~ Recruit_main707: oof Technicae Circuit: I sadly can't figure out Kotlin or Java Recruit_main707: you seem to just want to die based on your projects xD Technicae Circuit: Hahaha Technicae Circuit: https://stallman.org/discord.html dom96: There are hundreds of resources for how to make Android apps in Java dom96: *hundreds of thousands probably companion_cube: what's so bad about kotlin? dom96: For Nim there are like a dozen at most Technicae Circuit: I don't want to learn Java, and i like Kotlin as a lang Technicae Circuit: But can't figure out the deps system Technicae Circuit: I can't figure out maven or gradle with it dom96: If you can't figure out Java or Kotlin then you will have a very hard time using Nim. Generic: I have to correct you obvously Nim is idea for iOS and Nim is idea for Android Generic: *ideal Technicae Circuit: I am a Python programmer mainly Technicae Circuit: Cool Technicae Circuit: And Nim seems okay to me so far dom96: I'm writing a game in Nim targeting mobile and web browsers, and it hasn't been easy :) Technicae Circuit: Oof Technicae Circuit: Goodluck though! dom96: If you're writing something that needs to target so many platforms then Nim may make sense, otherwise you're far better off sticking with what most use. dom96: Unless your goal is to learn Nim or just have fun with it Technicae Circuit: I want to learn Nim and have fun with it so i guess my use case works exelotl: exelotl: https://cdn.discordapp.com/attachments/371759389889003532/704087763279937657/unknown.png exelotl: why am i not surprised that this is the first point lmao dom96: Then I would suggest something more fun than fighting with Android :P __ابــــراهــــيــــم__: hello, is there a nice functional programming library i can use with nim? Technicae Circuit: Haha exelotl: @__ابــــراهــــيــــم__ I'm reminded of the itertools port, though I guess it's not exactly functional programming https://github.com/narimiran/itertools Varriount: rayman22201: So I looked at Rust's executor's and async, and I think they would work very well for Nim. I'm a bit puzzled by how the passed-in "wait" function works, since it would need some sort of reference to the task or top-level callback, which would create a circular reference ( wait -> task -> async future chain -> ... ) __ابــــراهــــيــــم__: @exelotl nice! ill have a look. do you think i can bind this library to nim? https://github.com/Dobiasd/FunctionalPlus/ Recruit_main707: why do you want clear c++ code in nim though :P __ابــــراهــــيــــم__: sorry, my idea may be weird, i want to learn functional programming and i want to use nim. please no haskel :P Elegant Beef: doesnt nim work as a functional language without much fuss? __ابــــراهــــيــــم__: i guess it does. i found an example in the nim in action book but there is only one __ابــــراهــــيــــم__: list.map() Recruit_main707: whats functional programming? __ابــــراهــــيــــم__: something about pure functions __ابــــراهــــيــــم__: i trying to learn about it companion_cube: what an annoying nickname Recruit_main707: lol exelotl: @__ابــــراهــــيــــم__ there are more functional helpers in the sequtils module in the standard library: https://nim-lang.org/docs/sequtils.html __ابــــراهــــيــــم__: me? :D companion_cube: yeah :p __ابــــراهــــيــــم__: lol Elegant Beef: no latin characters are horrid companion_cube: can't even write it __ابــــراهــــيــــم__: it's arabic Recruit_main707: its probably suuuuper long in irc __ابــــراهــــيــــم__: omg really Elegant Beef: *It's arabic*, yes that's why i said non lating 😄 Recruit_main707: `__ابــــراهــــيــــم__`something like this probably Elegant Beef: latin* irc-friendly-name: this better? Elegant Beef: yes Recruit_main707: xD irc-friendly-name: xD irc-friendly-name: @exelotl that's it !!! thank you so much exelotl: np :) companion_cube: irc-friendly-name: heh :D companion_cube: I didn't see it as arabic, or rather, there's a ton of `_` in the middle exelotl: lol it was pretty epic in my irc client exelotl: https://cdn.discordapp.com/attachments/371759389889003532/704091691400822784/unknown.png companion_cube: ahahah irc-friendly-name: that's a crime in itself xD Araq: hmm I invented a new GC algorithm, now what? who wants my paper? irc-friendly-name: is it similar to ARC? companion_cube: Araq: there are conferences about that Araq: irc-friendly-name: it's orthogonal to arc irc-friendly-name: i dont understand GCs that deeply but it sounds amazing xD dom96: Araq, actually, maybe you should do it :) companion_cube: ugh, can't find anything Araq: dom96: do what? dom96: Araq, write a paper Araq: maybe later, better finish the GC I'm currently writing dom96: also, your paper would be one of very few that actually have an implementation used in production dom96: seems like many papers out there propose something and their implementation has bugs Araq: well the algorithm that I found isn't implemented anywhere yet, let alone "used in production" disruptek: sounds fast. companion_cube: a lot of papers have implementations I think dom96: it will be, I trust in your algorithmic skills companion_cube: e.g. if you look at the java GCs skrylar[m]: https://www.beeflang.org/ wot skrylar[m]: well the append allocators are neat. for bolting on variadic bytes in the same alloc as the object skrylar[m]: seems a lot of people are interested in hcr these days Araq: skrylar[m]: yeah it's nicely done Elegant Beef: My favourite thing about the beef lang is someone complaining about how the name is unethical Elegant Beef: *side note, sorta wish i made it* 😄 Elegant Beef: Complaint in question https://github.com/beefytech/Beef/issues/14 krux02: Interesting, I also just read about the beef language. skrylar[m]: inb4 savage retort that they can just use v if they are vegetarians krux02: If beef gets a compile time code execution path, they can call the subset of the language that works at compiletime tofu. skrylar[m]: the hcr looks fancy but seems to be only if you use their ide. and append allocators are very yes. otherwise eh.. no macros, otherwise haxe syntax, meh. krux02: It is nice that beef comes with its own editor. krux02: but also meh, I am so used to emacs now. krux02: Mixed builds are cool though. Araq: skrylar[m]: you can use an 'UncheckedArray' as the last field in an object to get a bit of the same as "append allocators" skrylar[m]: yea you can also do similar things in C++; the allure is that it otherwise works with a normal constructor syntax Araq: tried to make the compiler's ropes faster with this idea, no performance difference skrylar[m]: eh. ropes aren't worth it. piece tables or death Varriount: Araq: Is there any way to allocate an iterator closure's environment on the stack? Varriount: Or within another iterator closure? Araq: ergo based on this experiment with a sample size of one it's not important and doesn't need sugar :P Araq: varriount: no Araq: good night Araq: dom96: --gc:orc works with async Araq: and frees memory too, pretty good for a weekend of work Skaruts: is there some way to allow optional parameters in a template that takes a block of code, without having to create a bunch of overloads? Skaruts: for example, `template(x, y, z:int, a:A, b:B, c:C, code:untyped):untyped` Skaruts: I want a, b and c to have default values Varriount: Can you have variadic parameters? Skaruts: hmm, can you remind me what variadic is? Araq: Skaruts: no but we should have allowed default parameters for templates taking a single last 'untyped' block a long time ago... Araq: please write an RFC Varriount: A variable number of arguments. `proc output(x: varargs[string])` Skaruts: ah, no, they have different types Skaruts: @Araq will do thanks Skaruts: @Araq, well, I never done an RFC before though, and I have no knowledge of how to implement such a thing, can I leave blank sections in the RFC? Skaruts: I also don't have much to say about it, though I have one real use case Varriount: Skaruts: Just explain the problem, the proposed solution, pros, cons, alternatives, etc jason_koch_twitter: nim-fswatch jason_koch_twitter: lol oops FromDiscord_: rayman22201: So I was looking over the Rust article on async procedures FromDiscord_: They actually do something quite similar to Nim, just with more optimizations. rayman22201: no. It's fairly different. rayman22201: yes, they do more optimizations rayman22201: but the fundamental idea is different. zacharycarter: I'm using kakoune + nimlsp but jump to definition doesn't seem to be working at all FromDiscord_: rayman22201: The whole state machine thing is just another optimization. The Nim compiler could do it with closure procedures and iterators. rayman22201: Yes, the nim compiler can do it. No it's not just another optimization. rayman22201: It's run-time dispatch vs. compile time dispatch rayman22201: like comparing templates to interfaces rayman22201: in C++ FromDiscord_: I don't follow. Which one is doing the compile time dispatch? rayman22201: the state machine rayman22201: the rust thing rayman22201: I'm going to try and draw a crappy picture lol. FromDiscord_: From what I can tell, the current async machinery uses static dispatch. Yes, it makes liberal use of procedure pointers, however it still creates a future via static dispatch. FromDiscord_: The biggest difference I can see is one of organization. Nim's async system seems to involve passing closures down the stack into the event loop. From what I can tell, Rust doesn't do that, it just calls the "root" closure, which calls the next, and the next, etc. rayman22201: Nim allocates a new Future every time await is called. rayman22201: at run time rayman22201: and a new future callback FromDiscord_: Yes. That's not compile time or static dispatch. That's heap vs stack allocation. rayman22201: Yes. I applogize. It was meant as an analogy. Not a direct comparison rayman22201: heap vs. stack is the correct distinction. You are correct. FromDiscord_: Unfortunately, I can't think of an easy way to do that in Nim, as there's not a good way at getting the type of a closure environment. rayman22201: Araq and I have a way. I can do it. I just don't have time FromDiscord_: You could probably use cast and a bunch of other hacks though. FromDiscord_: I apologize if I'm coming off as a bit abrupt. It's been a long week. rayman22201: The heap vs. stack is a huge optimization though. It's worth doing. It has fundamentally different (better) characteristics, in terms of memory, runtime, and lifetime managment. rayman22201: no worries :-) rayman22201: hard to explain this stuff over text also FromDiscord_: I agree. FromDiscord_: I'm on Mumble, though disruptek seems to be silent. rayman22201: lol. I can get on, but only for a bit :-) zacharycarter: if I'm using `--gc:arc` with `--threads:on` and I create a ref object, is it allocated on a thread-local help or a shared heap by default? disruptek: shared. zacharycarter: thanks disruptek: basically, it's happy with a thread accessing it if the whole subgraph can move. zacharycarter: gotcha FromDiscord_: So why in some cases does generating procs inside a for loop make it so only the last iterated value get's passed to the procs? disruptek: what value do you think they should have? FromDiscord_: ` var keyConf = newKeyConfig(keycode.cuint, Mod4Mask,proc() = goToWorkspace(actualNum))` FromDiscord_: This line for instance FromDiscord_: it only calls the last iterated value IE 8 in this case FromDiscord_: actual num is an immutable value declared at the for loop level FromDiscord_: for loop child level* FromDiscord_: Full loop here FromDiscord_: https://hatebin.com/eawrmrsdpc FromDiscord_: Nim in action is an amazing book! FromDiscord_: Props to whoever made it FromDiscord_: Props to whoever wrote it FromDiscord_: A very good beginner resource leorize[m]: @Elegant Beef use sugar.capture FromDiscord_: So is https://narimiran.github.io/nim-basics/, and of course the original nim docs dchem: hi does anyone know whether nim-chronos has something similar to addQuitProc (like in asyncdispatch)? Or does one use addSignal proc for SIGTERM handler? rayman22201: @Varriount: one last thing. The chronos impl: https://github.com/status-im/nim-chronos/pull/45 disbot: ➥ [WIP]: AsyncChannels[T]. rayman22201: ok. dinner. bye :-) voltist: Any ideas as to why the jsffi example (https://nim-lang.org/docs/jsffi.html) is throwing the error `Error: invalid extern name: '$(#)'.`? codic: Hey, example on https://nimyaml.org/ ues an object, would using a table also work for this purpose? codic: * Hey, example on https://nimyaml.org/ uses an object, would using a table also work for this purpose? codic: (double message because matrix edits transfer to irc reposts beginning with a star) dchem: voltist, try this: {.importcpp: "$$(#)".} dchem: Here's more doc for escape characters for js interop: https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers#javascript-interoperability voltist: dchem: That works, thanks. Do you also happen to know why my compiled JS doesn't contain any of the procs I defined? dchem: voltist, not sure voltist: Ok. It's a weird issue... dchem: voltist, I mean the example says jQuery, but I'm not seeing where they're importing the jquery stuff voltist: It's the `proc jq(selector: JsObject): JsObject {.importcpp: "$(#)".}` dchem: no I mean I get that, but how is jquery source being pulled in? dchem: or is it just making a delegate call voltist: I have no idea dchem: I guess it's assuming jquery is loaded already? voltist: My problem now is that despite defining a proc in my nim, the output JS is just a few lines of header code without any functions dchem: h dchem: ah dchem: well dchem: voltist, the js ffi is to use js library from within nim executible, isn't it? dchem: voltist, what are you trying to do? compile the nim code into js or use js library in nim? voltist: This isn't a problem with jsffi, it's just that the Nim compiler (with the JS target) isn't generating the needed code voltist: Ah I've solved it voltist: Forgot to include {.exportc.} :/ dchem: Ah, ok, that will do it :D shashlick: @voltist hey buddy, finally figured out a reliable way to wrap openssl voltist: shashlick: Neat! voltist: Something quicker and easier than the rig we had going? shashlick: https://github.com/nimterop/nimterop/blob/master/tests/rsa.nim shashlick: I've not yet figured out a way to update nimssl since there's no sensible way to import all headers, takes a while to wrap it shashlick: Rendered output is several tens of thousands of lines voltist: Have you implemented that recursive header import thing in nimterop, or just figured out how to do without it? shashlick: Nope not doing that shashlick: But this way, if you specify five headers that should be imported, they get processed and duplicates get eliminated shashlick: Including with recursion shashlick: Unlike multiple cimport calls voltist: Ah cool shashlick: No need to include in any particular order voltist: I see voltist: Sounds good FromDiscord_: Also sorry leorize didnt say thanks 😄 shashlick: on the flip side though, cannot create an rsa.nim, pem.nim, abc.nim and what not and import them separately since we end up with duplicates again shashlick: so unclear what to do with nimssl FromDiscord_: What cool things have you guys made with nim? dchem: voltist, for what it's worth: https://github.com/nim-lang/Nim/pull/14111 disbot: ➥ Fixes #14110 voltist: Nice one FromDiscord_: Zed, im currently working on a tiling window manager using nim voltist: Elegant Beef, woah! dchem: Zed, I'm using nim for cryptoassets exchange - orderbook management and matching engine FromDiscord_: What voltist? FromDiscord_: It's using xlib so not amazing but nearly "done" FromDiscord_: Those both sound insanely cool voltist: Well I love Nim and I love tiling window managers, so it's right up my alley FromDiscord_: Nice, the code is currently astray, but here FromDiscord_: It uses imgui for the status bar, so it's silly as hell Prestige: Are there any details about how nim handles moving elements in a sequence? I'm curious about efficiency disruptek: seqs involves a lot of movement and efficiency has never been a goal. disruptek: details are probably inappropriate for this channel. Prestige: Maybe I should just dig through the source to find out how it's handled disruptek: if you can keep your seq to a fixed size, you don't have to worry about performance. Prestige: hm okay, it will be fixed at least when I'm wanting to reorder elements disruptek: sorting is fast. zacharycarter: so if I'm using `--gc:arc` with `--threads:on` since ref objects are allocated on the shared heap - shouldn't I be able to pass them between threads? zacharycarter: ah okay - I can, but I think as you said disruptek, the subgraph needs to be able to be moved as well zacharycarter: and if the ref object as a member property that is a sequence this doesn't work disruptek: my understanding is that as long as the graph is distinct, you can move the whole thing. zacharycarter: hmm zacharycarter: https://play.nim-lang.org/#ix=2jrv - works but https://play.nim-lang.org/#ix=2jru does not disruptek: yeah; you cannot share the graph between threads. skrylar[m]: https://ourmachinery.com/post/dll-hot-reloading-in-theory-and-practice/ cute zacharycarter: ah okay I need to move it gotcha disruptek: there are tricks and stuff, but yeah. bung87: @Araq I added ci https://travis-ci.org/github/bung87/htmlparser , I can sleep now Prestige: Elegant Beef: did you have any issues with input events not working on window? Seems like I'm not getting key events Prestige: Looks like you call XSetInputFocus on any window that gets input events, didn't know that was necessary FromDiscord_: Araq: Does Nim do any sort of escape analysis on closures and closure iterators? FromDiscord_: So that it can allocate their environments on the stack, rather than on the heap? FromDiscord_: Yea my selection right now is iffy, my XWarpPointer borked and some other things FromDiscord_: but generally i just use OnEnterEvents to figure out what to focus Prestige: I think I just need XGrabKey explicitly instead of adding an eventMask for KeyPress events on the parent window Prestige: Going to give that a shot tomorrow FromDiscord_: Yea XGrabKey will grab any key aslong as you also look for the event FromDiscord_: well anykey you specify Prestige: For some reason I thought just adding the KeyPress mask to the window's parent frame would work, but it doesn't :P so I'll get that fixed up tomorrow FromDiscord_: From my understanding XGrabKey intercepts key strokes before they go out to applications Prestige: Is goodwm going to be workspace-based or tag-based? FromDiscord_: Huh? Prestige: a lot of WMs use workspaces but some use tags (I'll be using tags, gives the user a little more power) FromDiscord_: I plan on having support for classes/names to move them automaticaly to specific work spaces, if that's what you mean Prestige: ah okay FromDiscord_: The workplaces can have any name, just each monitor has 9 FromDiscord_: which can change if i refine the workspaces FromDiscord_: I do like the idea of using Mod4+number to iterate over that monitors workspaces Prestige: Tags are interesting, windows can have multiple tags assigned to them (sort of like displaying a window on multiple workspaces) Prestige: then you can decide to display 1 or more tags at a time FromDiscord_: Ah so like awesomewm has? FromDiscord_: I dont really like that Prestige: Yeah, and dwm FromDiscord_: The one thing i really liked about awesomewm is the predefined layouts which i've implemented FromDiscord_: Do need to make a main/stacked, but i got the one i really like which is alternating splits Prestige: I only ever use one layout and fullscreen, but I'm planning on creating a way for users to define their own layouts in a config file that the WM can handle FromDiscord_: One think that really annoys me with awesomewm is that in the spiral config, the new window goes at the bottom of the stack instead of top FromDiscord_: thong* FromDiscord_: thing** Prestige: hehe FromDiscord_: God damn i cant spell Prestige: finger betrayal Prestige: I'm going to have a dir for layouts, and a file for each layout. Let the user decide if windows are spawned at the top or bottom of the stack, etc FromDiscord_: Im very much a person that likes the strict mathematical layouts FromDiscord_: I dislike spiral, but am using it in awesomewm at the moment Prestige: oh I noticed something in your wm, I think this XMapWindow call isn't needed: https://github.com/beef331/goodwm/blob/master/goodwm.nim#L554 Prestige: The docs say XReparentWindow will call XMapWindow on the child Prestige: iirc FromDiscord_: Well it seems like it is FromDiscord_: Do you have any clue why my XWarpPointer isnt moving the mouse anymore? Prestige: Hm are you sure it's being invoked still? FromDiscord_: Yea FromDiscord_: Certainly is just doesnt want to move Prestige: Lol, not sure I'd have to check it out. So long as it's being called and avtiveWindow().rawWindow is valid (and the expected window), I'm not sure Prestige: activeWindow().rawWindow* I also can't type FromDiscord_: Yea, it wildly just stopped moving my cursor today FromDiscord_: Yea i knew what you meant Prestige: probably requires some actual debugging FromDiscord_: *Actual debuggin* Heh FromDiscord_: Is there a way to make a custom constructor for a new type I've defined? AKA I'd like doing `var shrtStr:ShortString = "some string here"` to check if the incoming string is 255 characters or less FromDiscord_: I know the 'standard' is `newShortString` but I'm very meh about that, and a custom constructor would be cleaner FromDiscord_: there is no constructor FromDiscord_: could write a converter FromDiscord_: I don't remember the rationale but it had some composability issue FromDiscord_: 🤔 Wait I could write a custom assignment operator for that type FromDiscord_: I just wasn't thinking creatively enough FromDiscord_: Also prestiege have you figured out how to check if a window wants to go fullscreen? Prestige: nah not there yet, sorry FromDiscord_: Also hopefully my wm actually helps and isnt just a poorly coded mess Prestige: It helps to see how xlib is supposed to be interacted with, thanks :) FromDiscord_: You say supposed to, but i dont know if that's true FromDiscord_: Im doing the exact same thing i do anything, attempt what makes sense and see what happens, then go from there Prestige: You're further along than my WM but you I'm tracking my progress on github via issues if you wanted to see Prestige: issues/milestones FromDiscord_: Yea this is a pain FromDiscord_: I makes 0 sense, no errors and it just doesnt work 😄 FromDiscord_: I really prefer hard crashes over non-compliant code FromDiscord_: So i feel dumb, apparently inside xephyr mouse movement doesnt work FromDiscord_: So that was an hour of my time wasted Prestige: Really? That's weird FromDiscord_: Yep awr1: @Benumed you probably want a generalized raw str literal awr1: https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals awr1: @Benumbed awr1: custom assignment operator is kinda....idk awr1: i wouldn't do it awr1: in any case i've grown accustomed to nim's generalized philosophy of "all ctors are explicit" FromDiscord_: @Benumbed you can just change the name and do `var shrtStr = ss"some string here"` given the name of the proc was `ss` skrylar[m]: so i found out the convoluted nightmare that powers armorpaints hot reloading FromDiscord_: ? skrylar[m]: they have some runtime written in haxe-ish that in turn loads a javascript vm and then the application code is haxe compiled to javascript which they then swap the javascript :headbandage: FromDiscord_: what FromDiscord_: thats nightmarish skrylar[m]: i still haven't tested nim hcr on windoze FromDiscord_: windoze zzzzzz Prestige: Beef: are you trying fullscreen outside of xephyr btw? skrylar[m]: v hcr doesnot work Prestige: When I start up my hotkey daemon inside of xephyr I get an error: Could not resolve keysym XF86FullScreen skrylar[m]: write your compiler in ocaml to compile to javascript to run on a jit vm :dies: Bennyelg: Hi, I created a tiny API using Jester, and I want to add swagger to it, do we have anything ? FromDiscord_: No. Maybe just write docs in the json form and render it using swagger or redocs. Bennyelg: Thanks Bennyelg: Another question: ⏎ What is the best practice of validating apiKey ? ⏎ for every endpoint I should check again ? something like: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea4222bf6a6e539797698a8] skrylar[m]: i would imagine so, unless you have a proxy which does it for you Bennyelg: ok, if proxy is best practice, I'll try to implement it skrylar[m]: some of the newer "service mesh" stuff does have micro proxies that checks keys/cookies and then hands vlaid reuests downstream to microservices Bennyelg: any example somewhere? skrylar[m]: i dont know of a perfect one off the top of my head. might look in to lemonldap or authy or lasso since they are based on getting nginx or apache to route stuff to the authenticator before letting the calls through Bennyelg: thanks FromDiscord_: use hooks maybe, https://github.com/dom96/jester/blob/d8a03aa4c681bc8514bb7bbf4953d380d86f5bd6/tests/alltest.nim#L172 madpata: I can't compile programs using the ncurses module (info: https://pastebin.com/vck4v977). Anyone else have that problem and maybe a solution? dom96: looks like the package is broken, maybe trying to type cast a large int to an int that cannot fit it? madpata: yeah, that seems to be the problem. Sadly not the only problem with the package as its .nimble file is malformed, too. madpata: Any suggestions for creating text mode applications in nim? (keeping in mind that the standard ncurses doesn't work) solitudesf: !repo illwill disbot: https://github.com/johnnovak/illwill -- 9illwill: 11 15 99⭐ 9🍴 & 1 more... dom96: madpata, I created this a while back, it uses nimbox, maybe you can use it too: https://github.com/dom96/deauther FromDiscord_: generics cant know their type based on the expected one in their implementation? Bennyelg: > ** use hooks maybe, https://github.com/dom96/jester/blob/d8a03aa4c681bc8514bb7bbf4953d380d86f5bd6/tests/alltest.nim#L172 ⏎ ⏎ This is wonderful, thanks FromDiscord_: no problem. FromDiscord_: https://dev.to/juancarlospaco/ode-to-nimpy-4753 FromDiscord_: Proves that Nim is best lang sheerluck: +1 FromDiscord_: specifying a generic parameter makes this code dont work: `t.Get[uoffset](t.Pos)` FromDiscord_: is this a bug? FromDiscord_: how would we know w/o the rest of the code tho FromDiscord_: the error message is about type mismatch FromDiscord_: this is the error message: https://play.nim-lang.org/#ix=2juj FromDiscord_: its right there FromDiscord_: the error is right there FromDiscord_: youre either missing the Vtable or the Offsets FromDiscord_: but they are both there FromDiscord_: no they are not FromDiscord_: you only have one parameter FromDiscord_: t.Get[uoffset](t.Pos) FromDiscord_: ^ ^ FromDiscord_: ah, misread FromDiscord_: ah FromDiscord_: i know now FromDiscord_: `t.Get[:uoffset](t.Pos)` FromDiscord_: do that FromDiscord_: how it's resolved: FromDiscord_: ``` FromDiscord_: t.Get[uoffset](t.Pos) FromDiscord_: { } is the proc FromDiscord_: { } is the proc `[]` w/ argument uoffset FromDiscord_: { } runs whatever is given "as a proc if it could" with t.Pos as argument FromDiscord_: ``` FromDiscord_: @Recruit_main707 ^ FromDiscord_: i see, thanks FromDiscord_: https://dev.to/xflywind/write-a-simple-web-framework-in-nim-language-from-scratch-ma0 PMunch: Cool article flywind :) FromDiscord_: thanks. FromDiscord_: i will have a look at it, it looks promising FromDiscord_: leorize: yesterday you said `cast[T](b)` was wrong, but what about `cast[ptr T](b)[]`? FromDiscord_: i am having a look at this thread btw https://forum.nim-lang.org/t/2626 FromDiscord_: which also shows bit shifting is the slowest also FromDiscord_: Hey, I was thinking of using nimpy to write a module, It's gonna be using https://nimyaml.org/ and nim's json library. Here's the problem: Nim types (like tables) are NOT python types (like dicts). Will the types auto transfer? FromDiscord_: nim types are converted to python dictionaries iirc FromDiscord_: @codic nimpy auto converts between types iirc FromDiscord_: That's what it does with strings and ints at least FromDiscord_: And arrays PMunch: @codic, according to the tests it seems to convert them: https://github.com/yglukhov/nimpy/blob/master/tests/nimfrompy.nim#L51 and calling that from Python https://github.com/yglukhov/nimpy/blob/master/tests/tnimfrompy.py#L64 FromDiscord_: i maintain my point, nim types will work as dictionaries in python, which works well if you are not planning on using them as classes in python, and more like data structures. FromDiscord_: Oh, great that's amazing! FromDiscord_: Also, assuming I have this function, why does discord highlight it wrong? FromDiscord_: ```nim FromDiscord_: proc thing(a: int): string {.cdecl, exportc} = FromDiscord_: if a == 1: FromDiscord_: return "NO U" FromDiscord_: else: FromDiscord_: return "NO ME" FromDiscord_: ``` FromDiscord_: But if I use a period after exportc, it highlights right PMunch: Please don't paste code into discord FromDiscord_: i'm using a modified version of the example on http://bootstrap.me.uk/programming-languages/2017/07/09/nim-for-the-discerning-rubyist.html FromDiscord_: Alright ,sorry FromDiscord_: try not to paste code in here, its a pain for irc users, use https://play.nim-lang.org/ FromDiscord_: Huh, play.nim-lang.org highlights it right FromDiscord_: That's... strange FromDiscord_: @codic likely the syntax highlighter doesnt know that both syntaxes are valid FromDiscord_: you are missing a dot FromDiscord_: its not required to have the last dot] FromDiscord_: The example at http://bootstrap.me.uk/programming-languages/2017/07/09/nim-for-the-discerning-rubyist.html doesn't show it FromDiscord_: ah PMunch: It isn't? FromDiscord_: Ah, so it's not an issue with my ode? FromDiscord_: Ah, so it's not an issue with my code? FromDiscord_: no its not FromDiscord_: ah FromDiscord_: okay, thanks PMunch: Oh, and try not to edit your messages either FromDiscord_: try running it, it'll work both ways PMunch: It sends a duplicate (yes the Discord bridge is stupid, yes we're planning on fixing that) FromDiscord_: Alright, I won't FromDiscord_: I think that's because Irc doesn't have edits PMunch: Correct FromDiscord_: If you join an irc channel from matrix and edit something, matrix duplicates the message PMunch: But it could detect single character edits and just not send them or something FromDiscord_: True FromDiscord_: you think it'll be easier to port RxPY than RxCpp? or RxJs PMunch: Or try to be smart and convert that message to just "code*" which is what most people on IRC would end up doing PMunch: Rika, RxCpp would probably be the easiest FromDiscord_: im not wrapping FromDiscord_: im full porting PMunch: Oh porting FromDiscord_: wrapping sounds like it wouldnt work with asyncdispatch PMunch: Well the Python or JS interface is likely to be closer to a pragmatic Nim approach FromDiscord_: I love Nim FromDiscord_: Also, since I was reading http://bootstrap.me.uk/programming-languages/2017/07/09/nim-for-the-discerning-rubyist.html this brought up a question. Do you think that NimYAML/json for nim will auto convert to ruby types as well? FromDiscord_: this is gonna be an intense and large project i guess FromDiscord_: Nim can write not only Python extensions, but Ruby aswell FromDiscord_: (I do know that ints and strings convert proper) FromDiscord_: on the other hand, figuring types is gonna be painful FromDiscord_: rxcpp prolly is more tuned for optimized performance than readability so thats prolly an issue FromDiscord_: there's also rxjava FromDiscord_: for flatbuffers, i am basing on python, but have constant looks at the go implementation to check types FromDiscord_: http://reactivex.io/languages.html hmmmmmmm FromDiscord_: So basically I'm asking if ruby hashes are converted to nim tables FromDiscord_: Since ints and strings are FromDiscord_: (Oh, also, discord.nim is broken) FromDiscord_: we know FromDiscord_: @codic they should, but test it FromDiscord_: (Oh, also, discord.nim is broken, zlib error) FromDiscord_: Everyone already knows FromDiscord_: Oh FromDiscord_: eh FromDiscord_: It's common knowledge :p PMunch: Well, since yesterday :P FromDiscord_: Seems to be an upstream issue FromDiscord_: https://github.com/nim-lang/zip/issues/39 disbot: ➥ ZlibStreamError due to size mismatch of data types (Linux) ; snippet at 12https://play.nim-lang.org/#ix=2iJQ FromDiscord_: That's pretty cool FromDiscord_: (The bot) PMunch: Not quite sure if hashes would convert to tables, but I doubt it FromDiscord_: what is nim's situation regarding IDE support and debugging FromDiscord_: Why do you think that? PMunch: Oh disbot, yeah he has some neat tricks FromDiscord_: Yeah FromDiscord_: @Sophie we have quite a few FromDiscord_: also ***dis***bot, ***dis***cord FromDiscord_: lol PMunch: codic, because it isn't built for it FromDiscord_: ah FromDiscord_: its prolly disbot because ***dis*** ruptek FromDiscord_: the maker? i think FromDiscord_: so i'd have to somehow do it manually? FromDiscord_: hah FromDiscord_: haha PMunch: The Nim <-> Ruby code in that article is actually more like Nim <-> Dll <-> Ruby FromDiscord_: ~~Eh, nah, more like Nim <-> .so <-> ruby since unix rules~~ PMunch: So Ruby just thinks its playing around with a regular dynamic library FromDiscord_: yeah, that's true.. FromDiscord_: vscode, sublime text, vim, neovim... (something with jetbrains iiirc?) PMunch: Yeah :P so just sounds so weird :P FromDiscord_: What does? FromDiscord_: and a bunch of outdated ones :p PMunch: I'm on Linux and I keep calling them dlls simply because it easier to understand what it is FromDiscord_: and atom FromDiscord_: ah haha FromDiscord_: Is there something like Nimpy but for Ruby? (Basically Nimrb) FromDiscord_: for jetbrains I could only find one that doesn't seem has been updated in a few years PMunch: Sophie, we also have nimlsp so any editor with LSP can get Nim stuff in it FromDiscord_: That wouldn't be that hard to code FromDiscord_: The hardest challenge, to be honest, would be auto generating the attach_function calls PMunch: (But no syntax highlighting since LSP doesn't really support that, working on implementing the unofficial highlight extension though) FromDiscord_: i use vscode, it works pretty well, also, Gary M is working on fixing some issues of the current main plug in FromDiscord_: :p FromDiscord_: great, that works FromDiscord_: They use the format `attach_function(:functionName, [:an, :array, :of, :argument, :TYPES], :returnValueType)` FromDiscord_: Hmmmm FromDiscord_: Welp FromDiscord_: Doesn't matter honestly, just one extra line per function FromDiscord_: You could just check how Nimpy does it :p FromDiscord_: Python ffi is different FromDiscord_: But I'll check it out FromDiscord_: Yeah but porting things like https://github.com/juancarlospaco/faster-than-requests would be a pain FromDiscord_: Not raeally FromDiscord_: Not really FromDiscord_: Let's see FromDiscord_: Stop editing :p FromDiscord_: https://github.com/juancarlospaco/faster-than-requests/blob/master/src/faster_than_requests.nim is 345 lines FromDiscord_: Oh yeah FromDiscord_: So I should average about like 20 lines of attach_function, which isn't a lot FromDiscord_: or more FromDiscord_: like 50 FromDiscord_: or 60 FromDiscord_: Eh FromDiscord_: So FromDiscord_: Basically FromDiscord_: Yeah I'll look at nimpy FromDiscord_: Nim is now my go-to language FromDiscord_: Nope, I can't port this FromDiscord_: It uses python apis FromDiscord_: @codic remember that Python can import c modules FromDiscord_: Yeah :p FromDiscord_: Yeah, like any language can FromDiscord_: via ffi FromDiscord_: But Python has an api so FromDiscord_: So does ruby FromDiscord_: and most other languages FromDiscord_: Unless Ruby has an API like Python FromDiscord_: and most other interpreted languages FromDiscord_: It does FromDiscord_: Why don't you write a custom Nimrb module FromDiscord_: https://docs.ruby-lang.org/en/2.7.0/extension_rdoc.html FromDiscord_: That is similar to Python's FromDiscord_: I just don't want to learn the whole api FromDiscord_: :| FromDiscord_: :p FromDiscord_: I wish I could use some hacky regexp to get something like this FromDiscord_: ``` FromDiscord_: :functionName ( :argtype1, :argtype2 ) :returnType``` FromDiscord_: If I could that to ruby is easy FromDiscord_: You probably could PMunch: Technicae Circuit, welcome to the club :) FromDiscord_: does someone know whats leorize's timezome aprox? FromDiscord_: :p FromDiscord_: I mean, Nim is just so simple to make libs for any lang FromDiscord_: Yeah FromDiscord_: And with a much nicer syntax than languages like C, or C++ FromDiscord_: Mhm codenoid: how things going folks PMunch: Going good PMunch: Did a miss a big article or something? All of a sudden so many new people around here :) FromDiscord_: struggling with code, FromDiscord_: for a change :p FromDiscord_: Very nice FromDiscord_: Oof FromDiscord_: https://dev.to/xflywind/write-a-simple-web-framework-in-nim-language-from-scratch-ma0 this is the only new thing i know of FromDiscord_: haha PMunch: I meant more like the past week(s) FromDiscord_: play.nim-lang.org is soo useful FromDiscord_: idk then ¯\_(ツ)_/¯ PMunch: I guess maybe it's just the pandemic :P PMunch: codic, yeah it's a nice tool :) FromDiscord_: Oh. Um, I had a string with `&"string{thing}" FromDiscord_: btw, do you see this: ¯\_(ツ)_/¯ in irc, or just `/shrug`? PMunch: I see the expanded form PMunch: ¯\_(ツ)_/¯ FromDiscord_: They should see the actual shruggie FromDiscord_: I got this error: https://hastebin.com/gamufamigo.pl FromDiscord_: (no, it's not perl) FromDiscord_: PMunch: thats the same one in discord :p FromDiscord_: Since discord sends the message content as the shruggie disruptek: i see dead people. FromDiscord_: as soon as you press enter, on the client side, /shrug is converted to the shrug before it is sent to the server FromDiscord_: Oof PMunch: Where?! FromDiscord_: ~~Me-~~ FromDiscord_: lmao PMunch: Are you dead? FromDiscord_: Inside yes FromDiscord_: thats because you are not coding in nim probably FromDiscord_: Probably FromDiscord_: sad story FromDiscord_: xD FromDiscord_: Ahhh FromDiscord_: When I replace & with fmt I get undeclared identifier FromDiscord_: Is it because my compilation target is cpp FromDiscord_: Oof FromDiscord_: Nope, same with c FromDiscord_: /usercode/in.nim(2, 53) Error: undeclared identifier: 'fmt' FromDiscord_: Did you impoet strutils narimiran: *strformat FromDiscord_: Import* FromDiscord_: O FromDiscord_: Oh FromDiscord_: import strformat FromDiscord_: me stupid FromDiscord_: :P FromDiscord_: :p FromDiscord_: there, all is nice and happy, until... FromDiscord_: /usercode/in.nim(4, 19) Error: undeclared identifier: 'table' FromDiscord_: :gasp: FromDiscord_: What is the table type called? narimiran: import tables FromDiscord_: o narimiran: c'mon man, do some imports :D FromDiscord_: changed my import to `import strformat, tables` FromDiscord_: Still get undeclared identifier: table FromDiscord_: (I'm using table as a type) narimiran: Table narimiran: capital T FromDiscord_: Oh, why was that chosen? narimiran: because sanity FromDiscord_: COMPILATION SUCCESS. 🚀 FromDiscord_: types w/ capital obv FromDiscord_: then why not `Int` and `String`?/ FromDiscord_: ~~Because sanity~~ narimiran: finally, a non-trivial question :) FromDiscord_: 😠 FromDiscord_: :P FromDiscord_: that would be ugly imo PMunch: All the basic built in types are lower-case PMunch: Anything more complicated have uppercase FromDiscord_: Coolio FromDiscord_: so i change my statement to, complex types w/ capital PMunch: (by convention) FromDiscord_: ie: primitives, no, the rest, yes :p PMunch: Yeah, pretty much PMunch: If they live in a module, uppercase FromDiscord_: why are the first ones right, but the second ones ambiguous? https://play.nim-lang.org/#ix=2juJ narimiran: @codic look at the paste above, and uppercase function names. that's not sanity. FromDiscord_: I'm a bit confused. I have this in helloWorld.nim: https://play.nim-lang.org/#ix=2juL FromDiscord_: I compiled it to libhelloWorld.so and used this ruby code: https://hastebin.com/idicetewuw.rb FromDiscord_: Now, ruby complains: function 'testInts' not found in [./libhelloWorld.so] (FFI::NotFoundError) FromDiscord_: it actually makes sense to me, coming from Golang, since exported methods are capitalized PMunch: {.exportc.} FromDiscord_: ^ FromDiscord_: if not, nim compiler will use an "optimized" name narimiran: exported procs in nim have `*` at the end (in the case you didn't stumble on that one yet) FromDiscord_: End of the name specifically FromDiscord_: at the end... of the name narimiran: yep PMunch: Not really optimised, just done for technical reasons PMunch: Nim can overload procedures for example PMunch: While C can't FromDiscord_: oh, i forgot about the cdecl lol FromDiscord_: and ah, I see PMunch: So it would be impossible to always use the same C name as the Nim name FromDiscord_: makes sense now PMunch: Oh yeah, and cdecl to ensure that it uses the C calling convention FromDiscord_: and dynlib since its gonna be inside a dll? PMunch: nimcall default to fastcall when available IIRC PMunch: Shouldn't need dynlib for exporting I think FromDiscord_: but that was not intended, that was a bug iirc FromDiscord_: and it was fixed PMunch: Huh, apparently it should be used, not sure what it does though: https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export FromDiscord_: Exact same error, I added this pragma: `{.cdecl, exportc.}` FromDiscord_: then removed my .so and recompiled FromDiscord_: add dynlib PMunch: Check with `nm -a` to see if the procedure exists with the name you expect FromDiscord_: On the .so file? FromDiscord_: That gives me https://hatebin.com/edlpobihkp FromDiscord_: junk PMunch: Not junk PMunch: Those are all the symbols defined in your so FromDiscord_: How do I find if testInts exists? PMunch: You can see it on line249 FromDiscord_: wait, do I add `*` after the proc definition FromDiscord_: to export it PMunch: So it is there FromDiscord_: like `testInts*(signature)` FromDiscord_: Ah FromDiscord_: ctrl + f testInts FromDiscord_: > 0000000000012d70 t testInts FromDiscord_: yeah FromDiscord_: So what could be the issue? PMunch: Ah, but it is lowercase FromDiscord_: Indeed PMunch: The `t` is lowercase, meaning it's local to that library PMunch: Did you add the * before compiling the .so? FromDiscord_: `testInts*` <- this way FromDiscord_: Nope I didn't that's what I was asking FromDiscord_: Haha FromDiscord_: Like `proc func*(stuff):type =` FromDiscord_: trying now FromDiscord_: Yeah, I already said tht FromDiscord_: We said that before :p FromDiscord_: *that FromDiscord_: I said that before FromDiscord_: https://discordapp.com/channels/371759389889003530/371759389889003532/703623364039802910 FromDiscord_: :p FromDiscord_: Welp, no success still FromDiscord_: Oof PMunch: Works fine here.. FromDiscord_: @codic PMunch: http://ix.io/2juR PMunch: @codic ^ FromDiscord_: Hmmm FromDiscord_: Ohhh FromDiscord_: I didn't add dynlib FromDiscord_: haha FromDiscord_: *overdramatically facepalms* FromDiscord_: Hahaha FromDiscord_: ¯\_(ツ)_/¯ FromDiscord_: Finally! FromDiscord_: happens to the best of us PMunch: Ah yeah, without `dynlib` it seems to be local to the library (lowercase t in nm -a output) FromDiscord_: I have been waiting for glorious 2 for years FromDiscord_: Ah okay FromDiscord_: Thanks! PMunch: By the way, I can almost guarantee you that strings and tables won't work that way :P FromDiscord_: Let's try FromDiscord_: and.... FromDiscord_: It doesn't even recognize the method! FromDiscord_: oh FromDiscord_: strings maybe, Tables (ie: complex types) i bet not FromDiscord_: Nvm, I didn't attach_function PMunch: Strings are basically struct {int64_t len; int64_t cap; char *data}; PMunch: And tables are a complex object PMunch: Both of course under the control of the Nim GC FromDiscord_: Boom! I got the most readable output ever! FromDiscord_: `�` PMunch: Haha FromDiscord_: from `puts(Nim::testStrings("a", "b"))` where testStrings was `proc testStrings*(a:string,b:string):string {.cdecl, dynlib, exportc.} = return &"concentated string: {a}{b}"` FromDiscord_: So sad FromDiscord_: i ? unicode PMunch: You're not passing it strings though.. PMunch: At best those would be cstring FromDiscord_: I am FromDiscord_: but they're ruby strings FromDiscord_: Not Nim strings PMunch: Yeah :P FromDiscord_: then thats the issue PMunch: So not the "string" type in Nim FromDiscord_: But how do I construct a Nim string? can I make a proc to do that? FromDiscord_: use cstring FromDiscord_: Ruby's cstring? FromDiscord_: also return cstring, i assume FromDiscord_: no FromDiscord_: nim cstring FromDiscord_: Oh, in the method FromDiscord_: procedure FromDiscord_: wherever you used string in nim, use cstring FromDiscord_: How do I convert my return value to a cstring? FromDiscord_: it should automatically work iirc PMunch: That actually worked FromDiscord_: Oh, let's see FromDiscord_: Worked!!! FromDiscord_: Yesssssssss, now to try glorious tables FromDiscord_: G L H F with that FromDiscord_: let him realise PMunch: http://ix.io/2juU PMunch: Haha FromDiscord_: NOOOOOOOOOOOOOo FromDiscord_: /home/codic/.gem/ruby/2.7.0/gems/ffi-1.12.2/lib/ffi/types.rb:69:in `find_type': unable to resolve type 'Table' (TypeError) PMunch: Here's the type definition if you want to try and wrap it codic: https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/collections/tables.nim#L224 FromDiscord_: should i go with TDD for porting RxPY? FromDiscord_: oh, thanks PMunch: A tuple is essentially a C struct FromDiscord_: but I have no idea how FromDiscord_: i think... you should vreate that type in ruby FromDiscord_: Wait, I can use C libraries in Nim and compile to C? FromDiscord_: If so, I can use Ruby's C api in nim FromDiscord_: Yeah but Idk how FromDiscord_: or make a helper that creates it in nim and passes it to ruby FromDiscord_: a type definition in ruby is just PMunch: Yup FromDiscord_: class whatever; end FromDiscord_: ye, you can use Ruby's c api FromDiscord_: Nim is compiled to C after all FromDiscord_: oh, great! FromDiscord_: I think a helper would be easier first though FromDiscord_: well, by default its to C FromDiscord_: Is there a `del` function in Nim FromDiscord_: To delete a variable? FromDiscord_: How'd I make a nim helper that returns a tableref? FromDiscord_: Doubt it FromDiscord_: But eh FromDiscord_: I don't think so FromDiscord_: nope FromDiscord_: If Nim has a free function to free mem, tho, you can use that FromDiscord_: just dont use the variable FromDiscord_: not a good idea FromDiscord_: i didnt Desire to die enough to try to create python libraries yet with nim, having in mind we dont actually have classes FromDiscord_: you might bamboozle the GC PMunch: Technicae, what do you mean "delete a variable"? FromDiscord_: Free up the memory that the variable or function is using PMunch: Just out of curiosity, why are you trying to use Nim in Ruby? PMunch: Technicae, that's the GC's job FromDiscord_: @Technicae Circuit put it in a block then make that block go out of scope FromDiscord_: Just for fun, so I can write one library that works in python, ruby, and nim FromDiscord_: https://tenor.com/view/press-f-pay-respect-coffin-burial-gif-12855021 FromDiscord_: in advance PMunch: Haha, good enough reason that :P PMunch: But I've gotta run now PMunch: TTYL FromDiscord_: i procced to re-ask my question: FromDiscord_: why are the first ones right, but the second ones ambiguous? https://play.nim-lang.org/#ix=2juJ FromDiscord_: proceed* :p FromDiscord_: Why the coffin? FromDiscord_: 😢 😢 😢 😢 FromDiscord_: first ones? FromDiscord_: which are the first ones FromDiscord_: my favourite part is that innocent "for fun" xD FromDiscord_: and which are the second ones FromDiscord_: WriteVal FromDiscord_: and GetVal FromDiscord_: because procs must not be ambiguous when no generic params are filled FromDiscord_: a generic param is not required FromDiscord_: Argh. I'm stuck on what to port to nim FromDiscord_: > a generic param is not required FromDiscord_: wdym? solitudesf: @Recruit_main707, because it is ambiguous, generic parameter cant be inferred from arugments and you dont provide it explicitly solitudesf: in WriteVal its is inferred from `n` solitudesf: and you cant overload like this FromDiscord_: :p FromDiscord_: because generic params are usually inferred no? solitudesf: they are inferred is there is something to infer from, but in this case there isn't FromDiscord_: `generic parameter cant be inferred from arugments` but the first to functions are the ones that do that and they work fine FromDiscord_: i think he wants to force using it explicitly FromDiscord_: > `generic parameter cant be inferred from arugments` but the first to functions are the ones that do that and they work fine FromDiscord_: @Recruit_main707 because there it can FromDiscord_: 2nd cannot FromDiscord_: 1st can (because the generic is used in the arguments) but 2nd it cannot (since generic isnt used in the arguments) FromDiscord_: > i think he wants to force using it explicitly FromDiscord_: id rather not actually FromDiscord_: how would you decide what return type to use then?? FromDiscord_: So, how do I make a class in Nim? FromDiscord_: well, since i cant it doesnt matter :p, but the one the code that calls it expects FromDiscord_: @Technicae Circuit my python boy, "classes" in nim dont exist as such FromDiscord_: So what should i do? :P FromDiscord_: Can i define a function inside a function? FromDiscord_: wait a sec FromDiscord_: https://nim-by-example.github.io/oop/ FromDiscord_: Uh FromDiscord_: that example always uses `ref object of ...` not that ref is optional FromDiscord_: note* FromDiscord_: So how would `class Test: def hi(): print("Hi")` look like in Nim? FromDiscord_: Assuming it was valid FromDiscord_: I don't wanna add newlines cuz of the irc users FromDiscord_: https://play.nim-lang.org/#ix=2jv4 FromDiscord_: Thanks FromDiscord_: essentially its the same but without a class body FromDiscord_: So would self have to be passed? narimiran: you can do `self.hi` in nim narimiran: if you're after that kind of syntax FromDiscord_: I want the the user to be able to do `x = class_name("bot token")` (yes I'm working on nimcord) FromDiscord_: not possible FromDiscord_: Damn FromDiscord_: you'll have to do with initClassName("token") FromDiscord_: That could still work FromDiscord_: he can do it like: `class_name(field_name: "bot token")` dom96: convention is to use initTypeName or newTypeName, please do follow the conventions :) FromDiscord_: that doesnt guarantee that the other fields are initialized as wanted FromDiscord_: for example, there might be custom code that sets some field differently to it's `default(type)` value FromDiscord_: Hm FromDiscord_: dom96: but the function will do that wont it FromDiscord_: see my messages FromDiscord_: not necessarily FromDiscord_: Damn FromDiscord_: then how? FromDiscord_: how what? dom96: what function? FromDiscord_: about how to call hi: FromDiscord_: `var atest: Test` FromDiscord_: `atest.hi()` (if it doesnt need to be initialised) FromDiscord_: the initTypeName() function FromDiscord_: dom96 ^ FromDiscord_: I need to be able to pass variables to the 'class' FromDiscord_: thats fine, procs can be passed varialbes of course FromDiscord_: But then how would i define functions for the 'class' and pass those variables to the functions FromDiscord_: Like python's self FromDiscord_: for instance: https://play.nim-lang.org/#ix=2jv7 narimiran: youself.funcName(par1, par2, par3) FromDiscord_: just make procs with the type as first parameter narimiran: you'd call it as: self.funcName(par1, par2, par3) narimiran: and define it as `proc funcName(self, par1, par2, par3)` (with types, of course) FromDiscord_: I don't understand ;-; narimiran: IMO, take a break of what you're trying to do and read some nim tutorial. you'll be faster in the end FromDiscord_: You're trying to figure out how to get classes in nim? FromDiscord_: stop thinking in terms of classes, start thinking in terms of structs, i guess? FromDiscord_: This is what I understand so far: FromDiscord_: Basically FromDiscord_: Hmm FromDiscord_: Quick question FromDiscord_: Reading https://matthiashager.com/nim-object-oriented-programming, why is it `node: var Node`, not `node: Node`? narimiran: mutable vs imutable FromDiscord_: yeah FromDiscord_: var Node means its initialised iirc FromDiscord_: but does it matter if ya leave out var? FromDiscord_: no its not recruit FromDiscord_: ? FromDiscord_: @codic yes, you cannot change fields in node narimiran: it does if you plan to modify `node` inside of a proc FromDiscord_: w/o var FromDiscord_: Ah ok narimiran: https://narimiran.github.io/nim-basics/#_declaring_a_procedure narimiran: see the fourth (or so) example FromDiscord_: @Technicae Circuit have a look at this, take it as a way (probably not the most nim-ish one) of using "classes" or OOP rather: https://play.nim-lang.org/#ix=2jvd FromDiscord_: Is there such that as global vars? FromDiscord_: Can you export a type with the exportpy pragma? FromDiscord_: (To python) narimiran: "Is there such that as global vars?" RTFM, please FromDiscord_: Thanks FromDiscord_: nimpy still doesnt support exporting types yet narimiran: (and yes, there are global variables) FromDiscord_: aw, so making a nim "class" and exporting it to python is impossible FromDiscord_: :p FromDiscord_: Damn it FromDiscord_: But can you just use a table to store your information? FromDiscord_: We can FromDiscord_: Have a function that returns a table FromDiscord_: Then have other functions calling that FromDiscord_: yes FromDiscord_: Then we can use AttrDict on that table FromDiscord_: ... FromDiscord_: In Python FromDiscord_: Nim does not have attrdict FromDiscord_: Oh FromDiscord_: Basically we are using a stupid workaround to classes narimiran: "we" FromDiscord_: xD FromDiscord_: you FromDiscord_: Me and Codic FromDiscord_: We are working on a project :p FromDiscord_: are you two friends FromDiscord_: 👀 FromDiscord_: Yup narimiran: you two should work on reading tutorials, and then your workarounds won't be stupid anymore ;) FromDiscord_: recruit lets work on a project too even if i barely know you FromDiscord_: (jk) FromDiscord_: lmao FromDiscord_: :p FromDiscord_: well, im up for it :P FromDiscord_: nah im jokin, ill spare you headaches FromDiscord_: still trying to port Rx FromDiscord_: im w/ flatbuffers rn FromDiscord_: > nah im jokin, ill spare you headaches FromDiscord_: lame excuse ngl ;) FromDiscord_: eeeeeh FromDiscord_: ree FromDiscord_: what a polite ree xd FromDiscord_: what, you want a WRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY FromDiscord_: ? FromDiscord_: idk 😭 FromDiscord_: how do i create an string out of a byte sequence? FromDiscord_: cast lul FromDiscord_: If i define a table outside of a function, how would i access it inside the function FromDiscord_: wdym? can you playground it FromDiscord_: Okay FromDiscord_: https://play.nim-lang.org/#ix=2jvk FromDiscord_: I want to access the table `a` inside of my function FromDiscord_: So i can modify it FromDiscord_: put the proc below var a FromDiscord_: ah FromDiscord_: But then a can't access the function FromDiscord_: wait FromDiscord_: thats weird, dont do that FromDiscord_: why do you want test to be inside the table though FromDiscord_: It's the only way i can pass a 'class' to Python FromDiscord_: tables cant hold different types in its value FromDiscord_: Oh FromDiscord_: so b has to be a proc(int):void too FromDiscord_: That's fine FromDiscord_: Damn it FromDiscord_: This is complicated FromDiscord_: christ, dont emulate python in nim please FromDiscord_: at least dont do it when you have no idea what you're doing FromDiscord_: if you want to interop with python FromDiscord_: Use the C API i assume FromDiscord_: :p FromDiscord_: using the C api and a bit of c code FromDiscord_: that way you have actual classes and actual python classes FromDiscord_: Hm FromDiscord_: i thought of writing a macro for converting nim types into python classes, but i have abandoned that project for now FromDiscord_: Oof FromDiscord_: i thought of a way to emulate python classes but it has heavy use of `pointer` FromDiscord_: into python classes using the c api FromDiscord_: then also i cant think of solutions to certain problems youll hit with my idea FromDiscord_: there is also the solution to create the class in python and making its functions call nim functions FromDiscord_: but that will only work with primitives basically FromDiscord_: :p FromDiscord_: someone also wrapped the c api for nim, although i didnt manage to make it work as intended, but its worth having a look at it FromDiscord_: https://github.com/matkuki/python3 FromDiscord_: Cool FromDiscord_: Is there a pragma for no closure? FromDiscord_: not adding the closure pragma is how to get non-closure procs FromDiscord_: Oh FromDiscord_: lambda/anonymous procs or procs as types must be closures though afaik FromDiscord_: For some reason I can't return a table if the proc that is returning it is available to python leorize: specify a calling convention that's not closure and it won't be closure FromDiscord_: Or use CFFI from Python FromDiscord_: Does the name of a proc affect it at all? FromDiscord_: I doubt it FromDiscord_: no liblq-dev: @Technicae Circuit if you want to enforce a proc to not be a closure use {.nimcall.}. use {.cdecl.} if you need to pass the proc to C code liblq-dev: @Rika Nim will automatically create a closure if you capture and variables enthus1ast: hi all liblq-dev: hello enthus1ast: when i create a type with a macro (which depends on other types) can i somehow call the macro in a type block? enthus1ast: the workaround is to also create the other type disruptek: pragma macro FromDiscord_: liblq-dev "and"? enthus1ast: what exactly do you mean disruptek? liblq-dev: @Rika you said you needed to add the {.closure.} pragma explicitly. FromDiscord_: im pretty sure i think i know what you mean FromDiscord_: no i did not liblq-dev: > not adding the closure pragma is how to get non-closure procs liblq-dev: I understood this statement like that. if that's not what you meant, then sorry. FromDiscord_: no FromDiscord_: its not FromDiscord_: the person i was talking to may not be aware about closures FromDiscord_: though i guess it would have been better to mention that zacharycarter: I have a question regarding move semantics and reference counting. I understand that if I move a ref var that the ref var will no longer point to the original allocated memory, and will be a nil ref. What if I want to however move a value to another ref var and still retain a copy. leorize: enthus1ast: Nim recently added type section macro leorize: in 1.2 you can annotate a type with `{.yourMacro.}` and it will call `yourMacro()` with the type definition zacharycarter: Like if I want to pass a value to another thread and still have a copy of the value on the main thread. I realize move is probably the wrong assignment to use here, but what do I use instead? FromDiscord_: copy it? leorize: deepcopy, if it's still a thing zacharycarter: Just deep copy? zacharycarter: Hmm okay I'll try that thanks leorize: !issues deepCopy disbot: https://github.com/nim-lang/Nim/issues/13997 -- 3ARC: deepCopy in new runtime feature missing, do we have alternatives? disbot: https://github.com/nim-lang/Nim/issues/7108 -- 3deepCopy bug disbot: https://github.com/nim-lang/Nim/issues/8525 -- 3Global variable breaks spawn with overloaded deepCopy 7& 26 more... enthus1ast: sounds interesting leorize any idea where this is documented? zacharycarter: Ah okay so basically I can't do this yet zacharycarter: I still need pointers and sync primitives leorize: enthus1ast: ask Araq I guess :P enthus1ast: or where do you have seen this? :) leorize: you can probably make do by using `{.dumpTree.}` on the type definition to know what you're going to deal with leorize[m]: it's in the change log leorize[m]: one really helpful line: `macro pragma` is now supported for type sections :) enthus1ast: thank you leorize[m] i will try to find something enthus1ast: ( i also created a forum post: https://forum.nim-lang.org/t/6254 ) Bennyelg: (https://files.gitter.im/nim-lang/Nim/sLm6/image.png) Bennyelg: Anyone can assist why I can create some "global" envs without getting a GC warning ? leorize: wdym? leorize: also the gc warning doesn't appear if the proc don't have {.gcsafe.} Bennyelg: (https://files.gitter.im/nim-lang/Nim/pYxY/image.png) leorize: I'm still unsure what's your question FromDiscord_: leorize now that you are online, ive been investigating, and using this: `cast[ptr T](unsafeAddr b[0])[]` works leorize: yes it does, but you're going to interpret the bytes as the native endian FromDiscord_: i can live w/ that :P FromDiscord_: for now Bennyelg: My Question is I see warning or kind of error on the route and this is what it wrote (in the image) this is because I initialize something above the routes which is not. a gc safe leorize: compile the file leorize: that error snippet is totally meaningless leorize: probably someone didn't add all the error messages in... leorize: well the vscode extension is not actively maintained, so I'm not too surprised FromDiscord_: Gary M is working on fixing the errors of the current one FromDiscord_: his can already be used FromDiscord_: Anyone know a way to get the "type" of a closure iterator's environment at compile time? leorize: I don't think you can leorize: wdym by the "type" of the environment? FromDiscord_: Currently a closure iterator's environment is always allocated on the heap, as a separate allocation. I would like to embed the data in the environment of another closure iterator, rather than suffer another pointer indirection. leorize[m]: I take it that you are going to exploit the "having to pass param everytime you call the iter"? FromDiscord_: Will proper classes be implemented in Nim anytime soon? Yardanico: wdym "proper classes"? Yardanico: they are there disruptek: i guess we need more classes. Yardanico: we have inheritance with runtime dispatch and also multimethods (with --multimethods:on) zacharycarter: can anyone help me understand why I'm encountering this error from asan sporadically? disruptek: on why oop is dead. zacharycarter: https://play.nim-lang.org/#ix=2jwL zacharycarter: I'm not sure why reallocation is going on either zacharycarter: or a copy Yardanico: https://github.com/nim-lang/Nim/pull/12085 just got merged yay FromDiscord_: Hm disbot: ➥ Make await a template zacharycarter: I'm compiling with `--gc:arc` in my example Yardanico: -d:useMalloc ? dom96: yay FromDiscord_: Why do tables only accept one type pair? Yardanico: because nim is statically typed ? zacharycarter: ooo I didn't realize I needed to use `-d:useMalloc` to use the shared heap Yardanico: no, it's not for that Yardanico: it's to make tools like valgrind happier Yardanico: so that nim will use OS's own allocation functions zacharycarter: oh Yardanico: "Works with valgrind and clang's address sanitizers, compile with --gc:arc -d:useMalloc (and maybe with --debuginfo) for enabling this feature." Yardanico: https://forum.nim-lang.org/t/5734 zacharycarter: the docs say - ```use an alternative runtime that uses destructors and that uses a shared heap via -d:useMalloc zacharycarter: interestingly with useMalloc the error seems to not reoccur Yardanico: well that means that everything's fine :P zacharycarter: lol zacharycarter: https://cdn.vox-cdn.com/thumbor/y_Zt9t_J2sS3RKS-h6SYp3Wzi14=/0x0:900x500/1820x1213/filters:focal(378x178:522x322)/cdn.vox-cdn.com/uploads/chorus_image/image/49493993/this-is-fine.0.jpg Yardanico: xd FromDiscord_: > because nim is statically typed ? FromDiscord_: @gitterirc golang is statically typed and it accepts multiple types in arrays and maps (tables basically) Yardanico: can you show an example? via a paste service please zacharycarter: does it? FromDiscord_: Mhm zacharycarter: pretty sure hashmaps in go are heterogenous FromDiscord_: Sure FromDiscord_: Let me get the code zacharycarter: err not heterogeneous dom96: Go allows interface {} probably dom96: and you can do the same in Nim dom96: Just use RootObject dom96: I think I said this to someone already FromDiscord_: How does RootObject work? leorize: don't use RootObj for a hash map leorize: that's like, requiring your objects to be as big as RootObj (which is empty itself)? Yardanico: lol PMunch: RootObject basically adds some hidden runtime type information to the object Yardanico: do tables understand it? skrylar[m]: yup `interface {}` is basically a void pointer leorize: Yardanico: if you use `ref`, then yes dom96: while RootObject is likely to work, I wouldn't recommend it FromDiscord_: How would the recommended way to be able to use all types be then? leorize: don't dom96: You don't ever need all types rayman22201: Varriount I think you can do closure.rawEnv to get the environment ptr dom96: Explain your use case and we can suggest something concrete FromDiscord_: I need to be able to use multiple types for discord's API Yardanico: object variants :P FromDiscord_: So i can send an integer with a steing in the same map leorize: certainly leorize: yea object variants FromDiscord_: How does that work? :P leorize: look it up :P leorize: it's in the manual dom96: You can likely get away with just using JsonNode FromDiscord_: Oki dom96: maybe Discord's API even uses JSON leorize: !repo discord disbot: https://github.com/Krognol/discordnim -- 9discordnim: 11Discord library for nim 15 52⭐ 10🍴 7& 6 more... leorize: ^ you can consult that too Yardanico: it does Yardanico: over websockets dom96: of course it does, so there is no excuse not to use JsonNode anyway Yardanico: and it works without any object variants/inheritance (I mean the API objects themselves) Bennyelg: ```CC: stdlib_json.nim ⏎ CC: dal.nim`````` [https://gitter.im/nim-lang/Nim?at=5ea486bee5ed621d4dde24ee] Yardanico: you don't need to care about these warnings unless you use threads FromDiscord_: yeah but that doesn't export to python lol Yardanico: ? Bennyelg: Buf if i'll want my server to run threads probably I need to apply something ? zacharycarter: so if I don't want to use the implicit result var I just use {.noinit.} ? Bennyelg: single threaded server is poor i guess Yardanico: if it's async - not really Yardanico: also if you use jester you won't need to worry since it uses httpbeast on supported OSes which is multithreade Yardanico: d Bennyelg: Yea well, dbs are sync :| dom96: benchmark your code before enabling threads Bennyelg: I must learn more on this area Bennyelg: how to @dom96 Yardanico: wrk2 leorize: zacharycarter: you will always use the implicit result var :) Yardanico: zacharycarter: if you pass noinit that implicit "result" var just won't be initialized at all zacharycarter: so how I can I create and return a threadvar in a proc? leorize: what's your use case? enthus1ast: leorize i got it working https://forum.nim-lang.org/t/6254 enthus1ast: thank you for hinting me zacharycarter: I guess this works? https://play.nim-lang.org/#ix=2jwZ leorize: np :) leorize: zacharycarter: lol no leorize: though I'm not sure what you mean by "creating a thread var" leorize: threadvar in procs are {.global.} zacharycarter: I want to create something on the thread local heap zacharycarter: like in thread local storage leorize: I'm still not sure what you're trying to do zacharycarter: normally I'd use `pthread_setspecific` zacharycarter: in C leorize: well make a template for this one :P leorize: native threadvars are declared leorize: not a thread-specific hash map zacharycarter: okay skrylar[m]: isn't a thread specific hash map exactly how pthreads does it zacharycarter: so I could just use a global table threadvar then I guess? zacharycarter: oh nevermind I think I get how threadvar works now FromDiscord_: Is there a way to make a function with arguments if you don't know the type? FromDiscord_: Doubt it but it'd be nice Yardanico: well there's "auto" or you can just use generics but pls don't Yardanico: I mean I don't think "make a function with arguments if you don't know the type" is a good thing FromDiscord_: How do I use auto? FromDiscord_: And i kinda have to for a python module that I'm testing in Nim Yardanico: you don't have to Yardanico: "proc a(myarg: auto)" FromDiscord_: Thanks :p FromDiscord_: Apparently auto is invalid Yardanico: well what are you trying to do? Yardanico: we can't help without code FromDiscord_: Let me paste it in playground FromDiscord_: auto only works when the type is inferrable in compile time no? Yardanico: yes of course FromDiscord_: same thing with generics FromDiscord_: thats what i thought Yardanico: yep FromDiscord_: so that might be techni's issue FromDiscord_: im gonna need help with this generics, my head hurts already and i dont know what i am doing wrong, pls help FromDiscord_: https://play.nim-lang.org/#ix=2jxg FromDiscord_: youd rather get this into an actual editor to see the errors without compiling/checking Yardanico: well the error exactly tells you what's wrong Yardanico: you have two func GetVal*[T] with same definition FromDiscord_: there are 35 errors though :P Yardanico: well the errors related to "Get" are very clear too Yardanico: compiler doesn't know which T you're talking about because you're only using it as return type Yardanico: you'll need to explicitly specify it like [:type] too Yardanico: for each .get call FromDiscord_: when i do i get other error FromDiscord_: which is FromDiscord_: cannot instantiate: 'Get[voffset]'; got 1 type(s) but expected 2 FromDiscord_: in expression 'Get[voffset][voffset](t, t.Pos)': identifier expected, but found 'Get[voffset]' FromDiscord_: (for this code: `t.Get[:voffset](t.Pos)`) Yardanico: ah well Yardanico: you can fix Get definition pretty easily Yardanico: you used generics wrong Yardanico: "func Get*[T: Offsets](t: Vtable, off: T): T =" FromDiscord_: that would work for that example, but Get should also work with ints and etc Yardanico: well I really don't understand what are you trying to do with all this code FromDiscord_: ill get you the original code Yardanico: also you have to remember Yardanico: you can't do overloading on return type in Nim skrylar[m]: this is probably grossly wasteful but my current draft of this [nim] text layout does basically what tex does; makes a box of ex. all the text on one line. although interestingly it does let you get the size of a string as well as lay out the string without processing the string twice as most apis do :think: FromDiscord_: Yardanico: i already have only one GetVal function, thats fixed :) Yardanico: well show the code Yardanico: but did you really look into skflatbuffers? FromDiscord_: skflatbuffer uses Streams Yardanico: so? FromDiscord_: dont really want to use them skrylar[m]: i think the suggestion is you yoink the rest of the code that already does what you're doing :b Yardanico: yes FromDiscord_: https://github.com/google/flatbuffers/blob/master/go/encode.go all this gets and writes, but as generics Yardanico: you can easily remove streams from skflatbuffers FromDiscord_: streams are useful as hell though FromDiscord_: and you can make a string stream easily anyway so i dont see the issue with having them Yardanico: @Recruit as I said there's no return type overloading in Nim leorize: streams are super useful skrylar[m]: skcbor actually doesn't use streams and instead uses an "actuator" which is a closure that gets fed a control code and bytes Yardanico: so if you have func Get[T](data: seq[byte]): T = you'll always have to specify what T you're referring to FromDiscord_: ye, i know FromDiscord_: but the places i do it it errors with that other thing leorize: the way I prefer is Get(data: seq[byte], T: typedesc): T Yardanico: oh yeah FromDiscord_: Get(data: seq[byte], off: offsets, T: typedesc): T rather? Yardanico: Get(T: typedesc, data: seq[byte], off: offsets): T Yardanico: so you'll have the type as first argument, just for easier reading :P leorize: data should be the first argument imo FromDiscord_: ok, i thought of this, but it didnt seem very nim-ish Yardanico: why? FromDiscord_: having generics FromDiscord_: generics wont work with what you want Yardanico: "streams" stdlib module has procs like readInt, readUint, etc Yardanico: it uses generics only with arguments with that generic type FromDiscord_: Yardanico, do you think readXXX() is better over read(typ: typedesc) ? Yardanico: I would actually prefer readXXX() ngl FromDiscord_: skflatbuffers are not wrong, im just trying to get flatbuffers that are more similar to the "official" ones FromDiscord_: so that hopefully i can adapt flatc to support nim Yardanico: you can always create read(typ: typedesc) and then create procs like readUint which just call the original one FromDiscord_: why? FromDiscord_: which is something essential imo FromDiscord_: Well prestige if you figure out how to use XGetWindowProperty, let me know, i am currently doing this and it hates me for it https://hatebin.com/reqfgqqdvt FromDiscord_: Complains about a nil skrylar[m]: read(x: var T) :) Yardanico: @Elegant Beef what is PPcuchar ? Yardanico: and how does it complain skrylar[m]: pointer to a pointer to c characters Yardanico: you can just not have it as "nil" and it'll be initialized to zeroes which would mean the same in this case skrylar[m]: wondering how derpy literate nim would be Yardanico: wdym FromDiscord_: why *is* there no generic hash proc for objects? skrylar[m]: eh was thinking of having a script that eats comment lines and turns them in to adoc instead, and then the non-comments become code sections skrylar[m]: theres slightly more to literate tools than that, but not much FromDiscord_: I mean all the values from my understanding will be intialized by XGetWindowProperty Yardanico: well but what's the error FromDiscord_: Attempt to read from nil Yardanico: can you post *full* error? with code too :P FromDiscord_: https://hatebin.com/lzsoisjsum FromDiscord_: That is the full error FromDiscord_: That line causes a attempt to read from nil error Yardanico: what's on line 694 Yardanico: and is the source itself open? FromDiscord_: XGetWindowProperty FromDiscord_: I posted the full code of that function Yardanico: but I mean the full code of your project so I can test :P FromDiscord_: I ensure that activeTWindow cannot be niil FromDiscord_: I mean i dont have the nimble setup yet FromDiscord_: but FromDiscord_: https://github.com/beef331/goodwm FromDiscord_: I'm back FromDiscord_: https://play.nim-lang.org/#ix=2jxf FromDiscord_: Need imgui and xlib iirc FromDiscord_: That's the code I'm struggling with FromDiscord_: @Technicae Circuit client's type cant be inferred with the known data Yardanico: did you check https://github.com/yglukhov/nimpy/blob/master/tests/tpyfromnim.nim#L184? Yardanico: https://github.com/yglukhov/nimpy/blob/master/tests/tpyfromnim.nim#L184 FromDiscord_: Okay, but if i do `ref PyObject` i get the the following error FromDiscord_: Lemme see FromDiscord_: Nothing there that helps me Yardanico: and what is "coroutine"? FromDiscord_: A coroutine is an asyncronous function Yardanico: i mean in python Yardanico: how is it defined FromDiscord_: In older Python functions async def doesn't exist Yardanico: I know FromDiscord_: So the alternative is `func_name = types.coroutine(func_name)` FromDiscord_: O FromDiscord_: It's defined like `let coroutine = pyImport("types").coroutine` FromDiscord_: ~/data/data/com.termux/files/home/hata.nim(14, 33) Error: type mismatch: got .}> but expected 'PyObject = ref PyObject:ObjectType'` i have gotten this error using ref PyObject disbot: no footnotes for `/data/data/com.termux/files/home/hata.nim(14,`. 🙁 FromDiscord_: What? FromDiscord_: Disbot shouldn't respond to that :p Yardanico: it should leorize: well disbot don't care :P disruptek: disbot: don't gaf. disbot: on it. 👍 Yardanico: try https://play.nim-lang.org/#ix=2ija @Technicae Yardanico: but really use nim discord libs instead skrylar[m]: huh. doesn't work too bad actually skrylar[m]: python script that just looks for comment lines that start with `#- ` and then a little bit of switching to put in the `[source,nim]` fences FromDiscord_: O FromDiscord_: Oki FromDiscord_: > try https://play.nim-lang.org/#ix=2ija @Technicae FromDiscord_: Uh FromDiscord_: Wrong link? Yardanico: no, seems like playground lagged or something like that Yardanico: https://play.nim-lang.org/#ix=2jxI FromDiscord_: how do i have a generic type X[T, U] also accept one generic? like saying `type X[T] = X[T, T]` or something like that FromDiscord_: Oki Yardanico: also I wouldn't really be so sure that async from Python side will work properly with nimpy FromDiscord_: I've gotten `Traceback (most recent call last) FromDiscord_: /data/data/com.termux/files/home/hata.nim(9) hata FromDiscord_: /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1198) callMethodAux FromDiscord_: SIGSEGV: Illegal storage access. (Attempt to read from nil?)` FromDiscord_: Yeah i know :p Yardanico: well then I don't know, I don't really use nimpy or python FromDiscord_: Damn FromDiscord_: Okay, thanks anyway Yardanico: i mean idk how to solve that error, maybe try opening an issue in nimpy repo to ask yglukhov how to deal with async and stuff like that Yardanico: but I really recommend you to just use a pure-nim discord lib FromDiscord_: but none exist that work, lol Yardanico: wdym FromDiscord_: Discord.nim doesn't work FromDiscord_: I think it's the library side Yardanico: and the other one? FromDiscord_: Which other one? Yardanico: https://github.com/krisppurg/dimscord FromDiscord_: i didn't even know that exists, lol FromDiscord_: Oh that's maintained, great! FromDiscord_: It's quite complicated :p FromDiscord_: Seems pretty simple FromDiscord_: Not to me ;-; FromDiscord_: What seems complicated about it? Yardanico: it's much less complicated than using nimpy to call into python FromDiscord_: True FromDiscord_: But I'll probably write my own kib FromDiscord_: Lib* FromDiscord_: It seems very simple to me FromDiscord_: Simpler than every async based library I've seen so far FromDiscord_: (not in nim, just in general) FromDiscord_: most async libraries in nim have looked simpler than any non-nim async library ive seen madpata: checkout lface.gif in dimscord's example folder. Not very professional FromDiscord_: lolwat FromDiscord_: https://github.com/krisppurg/dimscord/blob/master/examples/lface.gif FromDiscord_: hm? FromDiscord_: Yeah... sadly, that doesn't help me :P FromDiscord_: I wish it had much better designed examples than what it currently has FromDiscord_: > The docs will be out soon or later. FromDiscord_: Welp, no docs Yardanico: it's not so hard to check source code FromDiscord_: true FromDiscord_: I wonder when voice support will come FromDiscord_: > will be added on later FromDiscord_: ugh, im still heavily irked by the lack of a generic `hash(object): Hash` proc in `hashes` FromDiscord_: is there a reason this doesnt exist? FromDiscord_: you mean a hash function that could hash anything you give it? FromDiscord_: how can i have a `varargs` supporting all types? `varargs[`$`]`? FromDiscord_: yes patasuss leorize: Rika: because no one really need one FromDiscord_: it wouldnt hurt to have one would it? leorize: yes it would :) leorize: to this day the generic `$` for objects is still considered one of the harmful inventions FromDiscord_: but is that right? FromDiscord_: hashing is something that should be well thought about. Not just sth to be generated willy nilly FromDiscord_: WAIT, so could I even just use ````thing: `$` ``` for any sort of type? Or would i do `[T](thing:T)` (generics)? FromDiscord_: we're not talking to you codic FromDiscord_: I know, just thought of it because leorize said FromDiscord_: > to this day the generic $ for objects is still considered one of the harmful inventions FromDiscord_: you misunderstood leorize then Yardanico: well with [T](thing: T) you will be able to accept any type, yes FromDiscord_: leorize, why is it harmful? i fail to see Yardanico: but you'll need to check inside the proc for different types with "when" statements Yardanico: which is the same to just writing the overloaded procs for different types FromDiscord_: So generics, gotcha. So can I do `[T](thing: varargs[T])`? Yardanico: not sure FromDiscord_: Yup I know I'd have to check inside proc FromDiscord_: you can, but you can only still accept one type then FromDiscord_: Alright, I'd try myself FromDiscord_: Oh FromDiscord_: So using a $ is the only way for varargs? FromDiscord_: using a $ will convert them all into strings FromDiscord_: $ has nothing to do with generics or varargs Yardanico: yes, so in the end you'll only deal with one type FromDiscord_: if you think that's useful, then sure Yardanico: coz $ returns a string FromDiscord_: o FromDiscord_: welp FromDiscord_: about generics dont gtting value assigned by return type, will that be a thing? Yardanico: not really FromDiscord_: it would be so cool FromDiscord_: i dont understand your question Yardanico: see https://forum.nim-lang.org/t/3025 leorize: return type overloading is evil leorize: and no sane prog land has never done it Yardanico: @Rika basically you'll have proc myproc[T](data: int): T and if you call it like "let myint: string = myproc(5)" myrpoc will get "string" for T leorize: lang* leorize: Rika: it causes trouble with generic binding, and even more trouble to people who like to import modules partially FromDiscord_: no sane lang has this metaprogramming either Yardanico: depends on what you mean by "metaprogramming" leorize: well lisp have it, even more than us Yardanico: and yeah, I don't think we need return type overloading, you already have "var" types FromDiscord_: lisp is super insane tho 😛 leorize: it's not about var type tbh FromDiscord_: Yardanico: damn, i see, that looks evil madpata: will things like this ever be possible? https://play.nim-lang.org/#ix=2jxQ Yardanico: @Rika not really leorize: it's about how `foo()` means different thing in different context with no visible way to distinguish them madpata: oh wait, didn't read the forum post FromDiscord_: madpata, you can just discard since none() is default 😛 madpata: damn, never thought about it madpata: but thanks leorize: if you wanna use none, it's none(T) FromDiscord_: madpata, https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/options.nim#L124 LOL FromDiscord_: none() is literally a discard LOL Yardanico: that is an implementation detail PMunch: You can also just call "return" or even "return result". The default value for Option[T] is none(T) madpata: yeah, never looked into it. was just a bad habit of mine I guess FromDiscord_: i said that PMunch FromDiscord_: smhhhh T_T PMunch: You said you could "discard" which is also true PMunch: I was just offering up some more ways of doing it :) FromDiscord_: i seem to have recalled sending a message i never actually sent madpata: but maybe I'll stick to "return none[T]()" because it's a bit more explicit about that something gets returned FromDiscord_: my memory is as reliable as discord... PMunch: madpata, to anyone familiar with Nim you know that it has default return values PMunch: So it shouldn't be an issue PMunch: But yeah, you can also do none(T) instead of none[T]() which is a lot easier to type (at least on this layout) madpata: I'm not always a fan on default returns values (or result being returned implicitly). My C/C++/Java experience might have ruined me in that aspect, but I like being explicit there. leorize: instead of typing `return smt`, you can do: `proc foo(): Option[int] = none int` FromDiscord_: im new to nim. trying to get a proc to accept a type i defined, it doesnt wanna (maybe theres some syntax i dont understand to do that). for those curious, writing a genetic algorithm. https://play.nim-lang.org/#ix=2jxT Yardanico: "creature = array2d" should be "creature: array2d" FromDiscord_: thank you PMunch: madpata, you get used to it, and it's actually quite a nice feature once you know how to wield it Yardanico: ah I see what you're trying to do PMunch: And `result` is great, it means one less thing to name, and you can easily follow what you're returning through the entire procedure. Not to mention the performance benefit madpata: PMunch I'll try my best to change my habit Yardanico: do you really need to return something from "runCode"? PMunch: I mean there's nothing wrong with being explicit about returns in Nim madpata: yeah result is great, already been using that. just have been returning them explicitly :p FromDiscord_: yes, to return the altered array (err... nothing is altered yet, havent wrote it yet) FromDiscord_: how do i check if a type complies with a concept on compile time? Yardanico: then something like https://play.nim-lang.org/#ix=2jy0 @Ahri PMunch: madpata aah, that would indeed look a bit strange :P Here's an article on using the implicit return thing in some neat ways by the way: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html FromDiscord_: thank you Yardanico: also you can always do randomize() to randomize by a different value each time Yardanico: without arguments I mean, to have a different seed each time FromDiscord_: thanks for the tip. for now i want it deterministic though, but when the code is completed then i'll switch it to that Yardanico: ah ok PMunch: Rika, you could to a when compiles statement.. PMunch: Bit of a hack though.. FromDiscord_: eeh... madpata: PMunch, nice article. Have been using inline if and stuff. Very nice. Yardanico: madpata: also don't forget you can have case expressions too :) Yardanico: if you cover all cases of course PMunch: Thanks, yeah I was surprised myself when I started researching that article about how deep it goes PMunch: It was prompted by someone asking for a default value for things that could throw PMunch: So I tried `var x = try: parseFloat("hello") except: 0.0` and it worked :) madpata: Another question: Would there be any reason to not allow thngs like this? https://play.nim-lang.org/#ix=2jy2 Yardanico: I guess "let a = try: parseFloat("100.0") except ValueError: 0.0" works because otherwise the code will throw so "a" won't really get used later anyway? PMunch: Yardanico, that's also mentioned in the article :) madpata: PMunch I love nim for those small productivity things Yardanico: madpata: Foo[int](val: 1) Yardanico: also "return" is not needed here :) PMunch: Yardanico, what do you mean? That statement will never throw, it will be the result of the parse if it succeeds, otherwise 0.0 madpata: Yardanico I know what the fix would be. I just wondered why the [int9 is needed madpata: just seems like sth the compiler could infer/assume PMunch: You could also do it like this: https://play.nim-lang.org/#ix=2jy4 madpata: oh damn, nice. PMunch: Well "1" can be int, uint, int64, uint8, etc madpata: just make number suffixes required /s FromDiscord_: lol FromDiscord_: No PMunch: Hmm, seems like Nim is just picky in this case: https://play.nim-lang.org/#ix=2jy5 FromDiscord_: That seems like it should work madpata: but sadly doesn't FromDiscord_: What happens if you don’t fill the generic? FromDiscord_: (Don’t specify [int]) madpata: throws an error. Missing generic argument FromDiscord_: And Foo[int](val:... ? FromDiscord_: How would i not include the stdlib in Nim? FromDiscord_: You guys are trying hard, respect, but I don’t think that’s possible madpata: Technicae Circuit --os:standalone maybe? FromDiscord_: Thanks FromDiscord_: Maybe it is :P Yardanico: there's also --os:any Yardanico: and what do you mean by "not include the stdlib"? Yardanico: you mean C stdlib or wat? madpata: probably means the system module Yardanico: nim "system" module is ALWAYS included in your files Yardanico: imported* :) Yardanico: but of course it has a lot of "when" stuff to differentiate between different OSes and stuff FromDiscord_: I don't want to include anything at all that I don't use :p leorize: dead code elimination is on by default leorize: if you don't use something, it won't get in enthus1ast: does one know how to use the macros.quote do with other quoting chars than ``? No char i use seem to work. enthus1ast: i want do do []=(`entity`.world.`storeName`, `entity.id`, `componentObj`) enthus1ast: to do FromDiscord_: Can someone explain what ```Traceback (most recent call last) FromDiscord_: /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1026) testPy_wrapper FromDiscord_: /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1015) noinline FromDiscord_: /data/data/com.termux/files/home/hata_cmds.nim(7) test FromDiscord_: /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1223) getAttr FromDiscord_: SIGSEGV: Illegal storage access. (Attempt to read from nil?)``` means? FromDiscord_: Oop- FromDiscord_: I forgot to use playground 😅 liblq-dev: it means that you tried to read/write to a nil value. liblq-dev: eg. a null pointer, or an uninitialized ref object Yardanico: so is it a bug or not if json.to macro doesn't work if the type to deserialize has a field like "myfield: Option[MyOtherTyp]" where MyOtherTyp is "ref object" ? Yardanico: it works if it's "object" but not when it's "ref object" FromDiscord_: How would i fix that then? FromDiscord_: Hm enthus1ast: Yardanico nope ref will not work Yardanico: enthus1ast: strange, I thought it would work, isn't it easy to initialize a "ref object" in json.to macro? Yardanico: just add a "new" call before assigning stuff enthus1ast: i tried to patch json for one of my game projects but the macro stuff there blew my mind enthus1ast: also the serializer and deserializer is limited Yardanico: I know, it's for discord api lib Yardanico: there's A LOT of optional fields dom96: You don't need to define them all up front dom96: also, they more than likely shouldn't be refs Yardanico: @dom96 well I know, it's just that this lib used them as "ref object" :) dom96: yes, and that's a bug dom96: should get a better error message at least Yardanico: yeah it crashed at runtime because of assertion in options.nim so I was a bit confused for a few mins :P enthus1ast: dom96 do you maybe know how i could use `[]=` in macro.quote ? dom96: nope enthus1ast: mh ok; there is a parameter to change the quoting chars, but nothing i type in there seems to be allowed? dont kno enthus1ast: w dumjyl: The custom quote op acts like a prefix operator, not something that surrounds like backticks. PMunch: enthus1ast, yeah I've asked about that before FromDiscord_: Yardanico, its fixed on the devel branch Yardanico: not for Embed though PMunch: Seems like no one knows how to pass that parameter.. Yardanico: all "EmbedThumbnail" etc should be just "object" to Yardanico: o enthus1ast: maybe Yardanico: also I've found a few other bugs enthus1ast: there should be an equivalent for every []= and friends in the stdlib FromDiscord_: For embed, all fields are options as the discord dics say FromDiscord_: no, you didn't understand me FromDiscord_: the types should be "EmbedThumbnail = object" and so on for all types which are used in other fields as Option[Type] FromDiscord_: you did this to types like User but not for Embed subfields FromDiscord_: @sealegs line 613 in object.nim -> should be "get(result.party).size = $data["party"]["size"][0].getInt()" if you want to get CurrentSize or you might want to parse them both PMunch: enthus1ast, you an do this: https://play.nim-lang.org/#ix=2jyd PMunch: can* FromDiscord_: PRESENCE_UPDATE line 385 - you should have checks for "cl.cache.guilds[presence.guild_id]" and "guild.members[presence.user.id]" because for me they crashed because they key wasn't there FromDiscord_: so I had to add two checks for the existence of these keys FromDiscord_: huh for some reason its workinf for me enthus1ast: ah i see PMunch nice workaround enthus1ast: thank you FromDiscord_: sorry for the typos btw FromDiscord_: I ran it in this Nim server so there's quite a lot of people with different presence updates and stuff FromDiscord_: I was porting https://github.com/Yardanico/ircord to your lib FromDiscord_: Ohhhh wait, I know why FromDiscord_: also all handlers should have {.async.} and you should "await" them in your event handling instead of just calling, because making them synchronous doesn't make sense PMunch: enthus1ast, I could've sworn that I found another workaround when I was creating macroutils PMunch: But I can't figure out what that was FromDiscord_: it's easy to change, I did that for message_create and message_update and it just worked FromDiscord_: I see. FromDiscord_: If a guild reaches a lot of members the library doesn't handle uncached members. FromDiscord_: Also for some reason message_update events weren't handled because of this return here https://github.com/krisppurg/dimscord/blob/devel/dimscord/gateway.nim#L598 FromDiscord_: after removing it I could handle message_update events FromDiscord_: well actually I didn't just remove it, I moved it to "if cl.cache.preferences.cache_dm_channels and cl.cache.dmChannels.hasKey(msg.channel_id)" on line 609 FromDiscord_: but I removed the return FromDiscord_: Okay Yardanico: I'll try making a PR with some of these changes so you can easier understand what I meant Yardanico: to "devel" branch FromDiscord_: Thanks, really appeciate it. FromDiscord_: beginner ahri again, sorry for intruding. i got a cannot evaluate at compile time for n in a for loop , i imagine its due to me messing up something with creatureArray, somehow https://play.nim-lang.org/#ix=2jyf PMunch: Ahri Fox: https://play.nim-lang.org/#ix=2jyj PMunch: Your array3d type is an array of your creatureArray tuple PMunch: Tuples can be accessed by [], but only when the value is known at compile-time PMunch: So that .code could be replaced by [1] PMunch: That's why the error might be a bit confusing PMunch: @Ahri Fox ^ FromDiscord_: oh alright, thanks! PMunch: Oh well, I'm off PMunch: Have fun FromDiscord_: on request of @Recruit_main707: https://cdn.discordapp.com/attachments/371759607934353448/703729945586696212/unknown.png FromDiscord_: :O dom96: Generic: love it. FromDiscord_: go out there and hit your work partners and bosses with the nim or nothin' FromDiscord_: Nice image FromDiscord_: why cant creature.vars[whatever] by assigned to? tuples are mutable right https://play.nim-lang.org/#ix=2jyW Yardanico: because you need to pass it as "var T" if you want it to be mutable in the procedure Yardanico: https://play.nim-lang.org/#ix=2jzo FromDiscord_: oh adding a var, i guess that makes sense FromDiscord_: sorry for asking so much Yardanico: it's okay Yardanico: But I'd suggest you to read https://narimiran.github.io/nim-basics/ FromDiscord_: TUPLES ARE MUTABLE?! Yardanico: ehm of course lol? Yardanico: if you declare them as "var" Yardanico: and pass them as "var" FromDiscord_: . -. FromDiscord_: my disappointment is immeasurable and my day is ruined Yardanico: well I got that reference FromDiscord_: lol Rika FromDiscord_: Man and here i was, thinking "no way tuples can be mutable" then Mr "var" comes along and says "lol no" skrylar[m]: welp. greedy wrap done. now for the uh, less fun ones. FromDiscord_: That’s why we have a let skrylar[m]: let annoys me because i want to replace a previous let binding with a new one line any sane language with let bindings skrylar[m]: but it says ARRR U NO DO skrylar[m]: oh well it beats an army of match statements in v/rust to deal with errors from every function call FromDiscord_: What FromDiscord_: I don't understand your issue skrylar[m]: was trying to shadow a `let` with another `let` in the same block and it wouldn't let me do it skrylar[m]: elixir lets you do it FromDiscord_: That just violates the point of a let tho no? skrylar[m]: noh. it doesn't change the original value, it changes the binding skrylar[m]: let a = 5 #a1 is now 5 skrylar[m]: let a = a + 5 #a1 is still 5 but any code from this line down gets a2 FromDiscord_: I'm getting this warning: game_types.nim(13, 8) Warning: method has lock level , but another method has 0 [LockLevel] FromDiscord_: is there any info about this lock level stuff? I was only able to find one github issue when searching FromDiscord_: Yeah I think that defeats the purpose of a let skrylar[m]: https://gist.github.com/Skrylar/179648d5856ae49087ad34a87d0740f9 will probably regret using TeX as the basis for this layout system, but we'll see FromDiscord_: ~~Imagine if Nim could make haxe code~~ zacharycarter: Why not just use Haxe? FromDiscord_: ~~Because Nim is superior!~~ FromDiscord_: And i wasn't saying it should FromDiscord_: I'm just saying imagine FromDiscord_: If Nim could though that could be OP FromDiscord_: Not only would it be able to make C, C++, ObjC and JS FromDiscord_: But it would have access to anything Haxe could FromDiscord_: But i prefer Nim how it is now zacharycarter: I don't really get the appeal FromDiscord_: Wdym? FromDiscord_: Appeal of Haxe? zacharycarter: I don't understand why you'd want to generate Haxe from Nim zedeus: well, you can do the opposite https://github.com/RapidFingers/Craxe FromDiscord_: I don't either zacharycarter: if it can already compile to C/C++ FromDiscord_: Oo cool zacharycarter: seems kind of pointless - why not just compile Haxe straight to C/C++? zacharycarter: none of this makes much sense to me FromDiscord_: Yeah FromDiscord_: Neither to me :p skrylar[m]: you have to remember haxe was made by `ambitious frenchmen` who had to deal with shitty software stacks on hand and made haxe to medicate their suffering zacharycarter: I think if you like Java and you don't want to deal with C/C++ then Haxe might be useful skrylar[m]: well haxe also was to replace actionscript zacharycarter: yeah well Haxe's syntax and OO rigidness induces suffering IMO skrylar[m]: so your flash games and the server shared the same code skrylar[m]: i don't know that it makes much sense to use the java/c#/php backends anymore skrylar[m]: haxecpp does produce pure c++ (and its builds are slooooow) and hashlink can either run in jit mode or transpile to c zacharycarter: I remember when people said that everyone would be reusing JS with NodeJS FromDiscord_: Wdym? zacharycarter: That client and server JS apps would be sharing code FromDiscord_: They do if you use NodeJS for the server :p skrylar[m]: dont some of them FromDiscord_: I use Python for both most of the time FromDiscord_: But I'm switching to Nim slowly zacharycarter: Sharing code != using the same language zacharycarter: it means actually reusing code FromDiscord_: Ik zacharycarter: you might reuse some small portions of your code but for the most part the problem domains are so different you're not resuing much FromDiscord_: True skrylar[m]: i kind of liked haxe.. also they have stuff like flixel zacharycarter: it's too much like Java for me skrylar[m]: hmm i didn't mind its c#-ness skrylar[m]: v is interesting a little FromDiscord_: :p zacharycarter: V is interesting in that it's making money and is essentially vaporware skrylar[m]: i mean. you can use it to make stuff. and its tiny skrylar[m]: Red is more vaporish than V skrylar[m]: hcr doesnt work on windoze gogolxdong: @timotheecour glad to hear you like karax, me too, I built an application based on pure karax https://www.cloudfastnet.com/ Yardanico: wow I only now found out that nim irc logs go all way back to 30.05.2012 https://irclogs.nim-lang.org/30-05-2012.html skrylar[m]: does nims hcr work on windows these days shashlick: !repo plugins disbot: https://github.com/genotrance/plugins -- 9plugins: 11Plugin system for Nim 15 21⭐ 1🍴 7& 29 more... Yardanico: is it possible to make --gc:arc work for --os:standalone? because https://github.com/watzon/JackOS seems to have it but I couldn't compile because "Error: system module needs: nimErrorFlag" which happens because with os:standalone "system" includes system/embedded which doesn't have arc-specific stuff disruptek: i can't think of a reason it couldn't. skrylar[m]: suppose nobody knows then. ah well FromDiscord_: Hi guys skrylar[m]: hiyo FromDiscord_: \o/ FromDiscord_: What's up bro? skrylar[m]: nothing much yet. writing my test notes on v, still have to test code reloading in nim. and at some point sit down and get the fancy text module built disruptek: seems like the glfw bindings i need have vanished from github. skrylar[m]: how lucky that sdl2 does all you need to get the gl context then :^) disruptek: it's a req for some code i want to run. FromDiscord_: on V? FromDiscord_: V lang? FromDiscord_: https://www.youtube.com/watch?v=sgHbC6udIqc I am watching this skrylar[m]: yes. v is very nearly "acceptable," but i hate the reasoning for operator overloads skrylar[m]: its "you might do a bad with them, so no soup for you." which means i couldn't ex. port and use skmap, it would get some third world keyword notation instead of just override [], and since their maps don't even hash non-string keys and mine do, its just. eurgh. skrylar[m]: nim doesn't hide things from me because someone else might do it wrong, which is nice skrylar[m]: (those 0.7sec full compiles though.. cripes.) FromDiscord_: Good FromDiscord_: I still struggling to not fall into learning too many stuff FromDiscord_: I don't want to be a jack of all trades lol skrylar[m]: generalists have their place FromDiscord_: Yup skrylar[m]: oh unicode. nopes out at full speed skrylar[m]: been there, did that FromDiscord_: Too bad I didn't pick CS as my bachelor career skrylar[m]: schools are dumb. read knuth books instead FromDiscord_: 😢 That's why I tend to struggle, I lack the base knowledge but start digging harder on a single cave FromDiscord_: By single cave I mean single tech skrylar[m]: knuth was kind of funny in that he's been quoted as saying he couldn't be bothered to keep up with languages so he just writes the algorithms in pseudocode FromDiscord_: That's better IMO FromDiscord_: Pseudocode as this is "language agnostic" skrylar[m]: i will say there is something to be said for how they are self hosting in megabytes. Red pulled that off too, kinda skrylar[m]: i think we can make go interfaces with macros in nim but it might be a little weird skrylar[m]: those end up being structs with function pointers and go stuffs the pointers when you cast it skrylar[m]: V precomputes a vtable for all the interfaces and the c code just indexes that skrylar[m]: for cbor i just have a closure with an action enum and it calls that with the different operators it wants you to do, which absolutely does work but you have to write all the behavior in a big switch which is kinda dumbo skrylar[m]: i suppose the answer is again, use a macro so it reads correct but just emits a swithc with a bunch of "iparam_2" glue shashlick: Every new thing works fast and is small disruptek: Hint: 542648 LOC; 39.196 sec; 845.305MiB peakmem; shashlick: But as you add capabilities and satisfy more use cases, it will become real shashlick: Standard illusion of youth vs middle age skrylar[m]: i don't entirely believe that. a lot of the speed penalties are because of design choices :\ shashlick: You can judge wrinkles all you want skrylar[m]: ¯\_(ツ)_/¯ CL certainly doesn't reach apocalyptic build times to update one function because they don't have a design based on compiling the entire image to update one function shashlick: Everything new stands on the lessons of the old skrylar[m]: you can put the book of aphorisms down, i'll stop talking shashlick: That's not my intention, sorry disruptek: too bad so few learned from cl. disruptek: not like it ain't old enough. skrylar[m]: they took studying the classics out of the cirriculum to graduate several classes of java hacks disruptek: pretty accurate, ime. skrylar[m]: even MIT has clunked a lot of scheme to appeal to simpletons skrylar[m]: as stepping stones sure thats fine but.. skrylar[m]: its just gone entirely FromDiscord_: I got lost while watching the video shashlick: Knowledge is available like the sand, doesn't mean it is accessible to the everyone skrylar[m]: are you trying to write your own unicode base code shashlick: I can barely get thru a cs paper skrylar[m]: i'll try not to go too far off the rails but basically there's been a systemic departure from the classical trivium/quadrivium and in to a lot of focus on wasting time or babblespeak. if you read ex. an aristotle book it's a very simple "here i will define my words, here is how they relate, now i'm going to take a nap." some of those cs papers seem to be rewarded on how indecipherable of language they use, because they can skrylar[m]: almost always be rewritten with a lot less obfuscation disruptek: i can barely get through a doorway. disruptek: need to get some exercise. shashlick: Fact is that every industry has its masters and paper pushers skrylar[m]: well when trying to figure out how cassowary did its thing, there were a lot of references to other hard to decipher papers, and then on youtube someone just points out how simplex optimization works in five minutes skrylar[m]: and then cassowary is just 'that' with a couple steps added skrylar[m]: so.. things do get more toothy as they get complicated, but sometimes they didn't need to be complicated shashlick: Sounds Feynman'ish skrylar[m]: well the last i should say is when you hide a lot of your class members in c++ via either a dptr, or a fixed-size block of bytes you typecast internally, a nontrivial amount of compile time bloat dies skrylar[m]: lot of time wasted collecting data that was not needed skrylar[m]: wonder if making a custom rect for text layout is wise or premature. there are a lot of boxes needed to lay out a paragraph and single glyphs are rarely >250px FromDiscord_: You guys got me wrong, I mean about the topic being discussed while I was watching the video, seems like disruptek was talking too FromDiscord_: But got the idea from Pro Tip #1 FromDiscord_: Unicode on the inside (decode), bytes on the outside (encode) skrylar[m]: unicode is all pretty well documented, its just tedious FromDiscord_: So I should pick any nim string (doesn't matter if it is raw aka triple quoted strings ?) and convert into unicode FromDiscord_: Use unicode module for that FromDiscord_: Deal any character (in this case, Rune) to check and return the decoded unicode skrylar[m]: nim strings are already utf-8 aren't they FromDiscord_: In that case, I just missing the unicode module FromDiscord_: To properly get the character at the desired position FromDiscord_: skylar[m]: Yeah, they are FromDiscord_: https://gist.github.com/Varriount/c3ba438533497bc636da rockcavera: is not safe "var string" in procedure async? Prestige: Is there a table proc to check if a value exists? Or should I just loop over everything? Prestige: Hm maybe a bidirectional map would be a better use for this leorize: Prestige: yes, hasKey leorize: oh wait a value? leorize: yea then loop Prestige: Hm ok Prestige: oh there's withValue, that looks good FromDiscord_: Does Nim has a pet? rockcavera: Improving the question: isn't "var T" safe in procedure async parameters? Prestige: A bidirectional map would be cool FromDiscord_: Heya, how would i declare a variable in Nim? FromDiscord_: var x = sometype FromDiscord_: Thanks silvernode: arrays are immutable right? FromDiscord_: The length is FromDiscord_: Atleast to my knowledge arrays need to be a compiletime constant FromDiscord_: array lengths* FromDiscord_: I'm probably certainly wrong FromDiscord_: since i tend to be that a lot FromDiscord_: Is there python-like lists in Nim? FromDiscord_: So i can add and remove values FromDiscord_: sequences FromDiscord_: How do i use them? FromDiscord_: `var s : seq[int] = @[1,2,3,4,5}` FromDiscord_: clearly supposed to be `]` at the end FromDiscord_: Oh okay FromDiscord_: Does that only accept one type? FromDiscord_: yes FromDiscord_: Damn FromDiscord_: Strictly typed languages be like that 😄 FromDiscord_: So i should use a 2d sequence for multiple types in an array FromDiscord_: :p FromDiscord_: What are doing that you need multiple types? FromDiscord_: Just curious right now FromDiscord_: Nim is surprisingly nice for a compiled language FromDiscord_: I agree FromDiscord_: Probably because i am used to the Pythonish syntax FromDiscord_: And it doesn't use a main function for code FromDiscord_: I like some of the syntaxial sugar FromDiscord_: Mhmm FromDiscord_: Main function doesnt matter really FromDiscord_: Since you can think of your main file as a named function FromDiscord_: True, but i just prefer anything without the main function FromDiscord_: Yeah FromDiscord_: i mean mained* FromDiscord_: Oh okay FromDiscord_: I still use a main function and just call it at the end cause i prefer containerizing the code for reusabillity FromDiscord_: Oh okay FromDiscord_: How do i define a function again? :P FromDiscord_: Is "oh okay" equivlent to "I didnt ask" FromDiscord_: not like that FromDiscord_: `proc name(args:type):returnType = body` FromDiscord_: I'm interested skrylar[m]: arrays elements are mutable the length is constant. sequences are mutable and te length is mutable. FromDiscord_: Thanks FromDiscord_: :p skrylar[m]: also nim correctly exposes length and capacity separately which you would be surprised how many languages botch FromDiscord_: In what way to they bodge them? FromDiscord_: Make them the same thing? skrylar[m]: many of them don't let you pre-allocate for capacity skrylar[m]: iirc nim you can ask for a length of zero but a capacity of whatever upper bound you expect skrylar[m]: so when you go append stuff one at a time it doesn't trigger reallocs FromDiscord_: Ah FromDiscord_: I know C# has those features too, and it's the only other language i've really used FromDiscord_: If you want different types, use tables FromDiscord_: Which are the equivalent to dictionaries FromDiscord_: That doesnt give you different types FromDiscord_: It's still typeA,typeB FromDiscord_: And afaik it only works on ints/strings as keys unless it has a hash method FromDiscord_: https://nim-lang.org/docs/tables.html#basic-usage-hashing FromDiscord_: Hey im right, write it down! FromDiscord_: Why is Nim such a good language? FromDiscord_: Well designed, nice sugar, it's not python 😄 FromDiscord_: :p FromDiscord_: I got the error `Error: expression 'main()' is of type 'int' and has to be discarded` FromDiscord_: yep FromDiscord_: You have a return type you dont handle FromDiscord_: Oh okay FromDiscord_: `discard main()` will solve it FromDiscord_: Cool FromDiscord_: I just did ```nim FromDiscord_: proc main():int = FromDiscord_: return 0 FromDiscord_: FromDiscord_: main()``` FromDiscord_: :p FromDiscord_: Yea FromDiscord_: It worked FromDiscord_: Coolio FromDiscord_: In most languages you can put a value on any line, and the language doesnt complain, nim doesnt like values that dont get handled FromDiscord_: so in python you can put `"This is totally useless"` anywhere and it still runs FromDiscord_: Oh okay FromDiscord_: Yeah FromDiscord_: That's actually good to know FromDiscord_: in nim you need to `discard "This is totally useless"`, so it's less funny FromDiscord_: Arrr got it wrong, sorry FromDiscord_: So how would multiline comments work? In python you just use a multline strings FromDiscord_: So how would multiline comments work? In python you just use a multline string FromDiscord_: Multiline comments? Or multiline strings FromDiscord_: `#[Multiline inbetweenhere]#` FromDiscord_: Use `##[]##` if you wish it to be docstring-like FromDiscord_: Thanks! FromDiscord_: Python doesnt have multiline comments so people tend to just drop strings for comments and let the language figure it out 😄 FromDiscord_: Yeah FromDiscord_: 😄 FromDiscord_: I like Nim alot FromDiscord_: I have a feeling that's a shared feeling in these parts FromDiscord_: I need to get Syntax highlighting for Nim with nano FromDiscord_: Eheheheh FromDiscord_: I use VSCode so... FromDiscord_: Use vscode with nim alt FromDiscord_: Gary's done some good work on that FromDiscord_: nvm FromDiscord_: I mainly use vsc, but I'm on mobile using Termux FromDiscord_: So i prefer nano FromDiscord_: Gonna play a bit skrylar[m]: kakoune here.. though i used to have a highly customized emacs+mode, though i dunno where my mode is buried atm FromDiscord_: What's kakoune? skrylar[m]: https://github.com/mawww/kakoune skrylar[m]: reimagined vim; based around multiple selections and composed keystrokes FromDiscord_: Oo FromDiscord_: Cool FromDiscord_: Why was Nim made? FromDiscord_: Araq, probably knows FromDiscord_: And who were the people who developed ir FromDiscord_: It* FromDiscord_: Oh okay FromDiscord_: He's the language founder and is around here quite a bit FromDiscord_: You can always look at the nim github to see the contributors FromDiscord_: O FromDiscord_: Cool FromDiscord_: Nim has a small community right now, doesn't it? FromDiscord_: It was only officially released last october, so it's super new FromDiscord_: O FromDiscord_: It was released before October then? FromDiscord_: Well FromDiscord_: Was it available to the public before October is what i mean FromDiscord_: It's been around since 2008, just first full release was october FromDiscord_: Oh okay FromDiscord_: Cool FromDiscord_: All your other questions can be answered here FromDiscord_: https://en.wikipedia.org/wiki/Nim_(programming_language) FromDiscord_: Thanks! skrylar[m]: probably because araq was a delphi head and delphi is kill skrylar[m]: i should say delphi enthusiast i dont think he worked at borland FromDiscord_: O skrylar[m]: old versions of nim were very much pythonized pascal FromDiscord_: Woah FromDiscord_: I mean im sorta disppointed it's not called nimrod anymore FromDiscord_: 2008-2020 FromDiscord_: Why are you disappointed for? FromDiscord_: That's like... 12 years under development, but glad it got it's first release skrylar[m]: it was a capitulation to make derps happy FromDiscord_: Cause nimrod is a peak language name FromDiscord_: :p FromDiscord_: Well it started development in 2005 wikipedia says FromDiscord_: so 15 years skrylar[m]: then you have mozilla name a language after a literally undesirable situation that makes your metal unusable skrylar[m]: ... which is appropriate, nevermind. :ducks: FromDiscord_: Is it older then Python? FromDiscord_: I admire him for not giving up on those years FromDiscord_: Mhm FromDiscord_: Lol skrylar dont say that too loud the crabs will attack skrylar[m]: some of these altlangs are pretty old actually skrylar[m]: haxe is quite aged too, as was D1 FromDiscord_: That's very nice FromDiscord_: All im going to say is what does a king crab wear on his head? FromDiscord_: Idk FromDiscord_: *the answer is a crown* FromDiscord_: The icon of nim 😄 skrylar[m]: well "nimrod" was also a positive bible reference iirc, which a lot of tech places hate FromDiscord_: O FromDiscord_: > well "nimrod" was also a positive bible reference iirc, which a lot of tech places hate FromDiscord_: Oof FromDiscord_: https://www.youtube.com/watch?v=LDU_Txk06tM skrylar[m]: (i somehow doubt if it was called "hailsatan" google would have been nearly as offended, but i won't go in to that further) FromDiscord_: Haha FromDiscord_: I've now lost interest in the nimrod language, i thought it was based off the insult FromDiscord_: O skrylar[m]: the insult was itself based on the same reference FromDiscord_: ~~Don't lose interest for this amazing language~~ FromDiscord_: *obviously* FromDiscord_: I've already made a window manager for it, im already too deep FromDiscord_: with it* skrylar[m]: the interesting times when childrens cartoons contained heavy doses of irony and reference to classical texts :thonk: FromDiscord_: Oo FromDiscord_: So after reading that hash stuff i thought, why isnt there macro that makes hash functions for objects if declared FromDiscord_: Seems like hashing all the hashable members of a type is a logical thing for a proc to do FromDiscord_: macro* skrylar[m]: and now you know why skmap has a user supplied hash function :3 FromDiscord_: Huh? FromDiscord_: Is there something like `import github/username/repo` FromDiscord_: `nimble install repo` skrylar[m]: no we aren't Go FromDiscord_: Works if it's a nimble package FromDiscord_: Which would just be the approximate path to to the GitHub folder FromDiscord_: O FromDiscord_: If it's not a nimble package you cant, cause that's silly skrylar[m]: fwiw even the go folk have started t orealize why importing github directly was bad and have been walking it back with dep and vendoring tools skrylar[m]: @Elegant Beef i made my hash tables accept a closure when you initialize it which hashes the key, so the hash functions are replacable. for things like custom key hashing FromDiscord_: Ah, i was thinking to just have the macro automate the hashing of objects, but couldnt be arsed to write it so thought i'd see if there was anything like that FromDiscord_: Feel like something like that should be included in the tables module skrylar[m]: but otherwise, i don't think anything stops you from writing a macro that walks over the fields of a struct and feeds them to another hash function underneath FromDiscord_: Well yea nothing stops me but my laziness skrylar[m]: laziness bad. git gud :E FromDiscord_: Eh, i gotta still implement fullscreen windows into my window manager FromDiscord_: *Note to self never use xlib ever agaiN* FromDiscord_: *Note to self never use xlib ever again* skrylar[m]: oof skrylar[m]: still have to finish an xxhash port FromDiscord_: lol FromDiscord_: I do think ill try writting that function cause it seems rather useful to speed up using tables FromDiscord_: but after i get fullscreen support 😄 skrylar[m]: https://github.com/Skrylar/skflatbuffers/blob/master/skflatbuffer.nim#L76 not sure if this macro still works skrylar[m]: i already wrote some that iterate fields and try to emit code for it FromDiscord_: ah yea skrylar[m]: which is 90% of the job you're trying to do lol FromDiscord_: I know i previously tried to automate making constructors FromDiscord_: so you could do something like FromDiscord_: `construct(type,"memberA","memberB")` FromDiscord_: and it'd handle everything FromDiscord_: How do Nim tables work? FromDiscord_: They're hashmaps but the key needs to be a int/string/type with two procs implemented skrylar[m]: never used them. but they're supposed to be your standard key/value store FromDiscord_: scroll up there is a explanation on there FromDiscord_: Okay FromDiscord_: til skrylar was already working on xxhash, damn, thought that could be my next project skrylar[m]: it still could. i haven't worked on it in a few days skrylar[m]: i have spookyhash too but theres a bug in it FromDiscord_: that's just a waste of effort aint it? FromDiscord_: unless i fork your repo skrylar[m]: blake however is tested against the official versions test vectors and works FromDiscord_: Table are basically made like `{"key":"value"}` FromDiscord_: Table are basically made like `{"key":"value"}.toTabls` FromDiscord_: `{"key":"value"}.toTable`* FromDiscord_: I forgot about editing ;-; FromDiscord_: yes FromDiscord_: You can also use the initTable proc, to initalize an empty table FromDiscord_: Oh okay, cool FromDiscord_: `{"key": "value"}` is essentially `((key: "key", val: "value"))` (two tuples) FromDiscord_: Oh? Why is it like that? FromDiscord_: tables arent imported by default FromDiscord_: So i know how to use input and output, i know about let, const and var, i know about sequences, arrays and tables, so do i need to know anything else? FromDiscord_: True FromDiscord_: Flow control FromDiscord_: do you know tuples? FromDiscord_: What's that? :P FromDiscord_: if else elif when FromDiscord_: thats flow control i assume FromDiscord_: if,case,else,elif,while,for i'd consider flow control FromDiscord_: Not yet, unless tuples in nim are similar to Python's tuples FromDiscord_: Oh okay FromDiscord_: they pretty much are FromDiscord_: except nim tuples can have names assigned to their fields FromDiscord_: Oh okay, nice FromDiscord_: ```/data/data/com.termux/files/home/nim_stuff/main.nim(3, 14) Error: undeclared field: 'toLower' for type system.string [declared in /data/data/com.termux/files/usr/lib/nim/lib/system.nim(34, 3)] FromDiscord_: [email protected] ~/nim_stuff [1]> cat main.nim FromDiscord_: proc main():int = FromDiscord_: let userinput:string = string(readLine(stdin)) FromDiscord_: if userinput.toLower == "hi": FromDiscord_: echo userinput FromDiscord_: elif userinput.toLower == "hello": FromDiscord_: echo userinput FromDiscord_: else: FromDiscord_: echo "Heya" FromDiscord_: return 0 FromDiscord_: FromDiscord_: discard main()``` FromDiscord_: Any idea what thw issue is? FromDiscord_: Any idea what the issue is? FromDiscord_: Wait FromDiscord_: Lemme use a paste service FromDiscord_: https://hastebin.com/jolefumovo.bash FromDiscord_: That's my code and I'm getting an undeclared field error FromDiscord_: tolower is in unicode/strutils FromDiscord_: Unless toLower is wrong FromDiscord_: Oh okay FromDiscord_: You need to import strutils FromDiscord_: Oki FromDiscord_: also be nice to thes irc nerds dont paste too many lines FromDiscord_: a few is fine more than that is bad FromDiscord_: Yeah, i just realised :p FromDiscord_: Nim might be my favourite language soon FromDiscord_: My current favourite lang is Python FromDiscord_: Well that's weird, liking python FromDiscord_: Say that to the Python discord server :p FromDiscord_: Python has alot of stuff that can be used FromDiscord_: But not a sensible typing FromDiscord_: Wdym? FromDiscord_: I hate dynamically typed languages FromDiscord_: Oh okay FromDiscord_: I prefer them but i know that that can reduce speed FromDiscord_: There is also Cython FromDiscord_: Which compiles Python to C or C++ FromDiscord_: And it allows you to do `cpdef type var_name = value` FromDiscord_: Yea that's not hideous FromDiscord_: For booleans you just use an integer since bools are just ints in Python FromDiscord_: Which i personally don't like FromDiscord_: Because `False + 1 == True` basically FromDiscord_: bools in python inherit from int? FromDiscord_: Bools are enums in nim, so it's not too crazy 😄 FromDiscord_: Although they're magic here FromDiscord_: FromDiscord_: https://cdn.discordapp.com/attachments/371759389889003532/703126538580918332/Screenshot_20200424_071342_com.termux.jpg FromDiscord_: > bools in python inherit from int? FromDiscord_: Yup skrylar[m]: i like janet, but i use python :b FromDiscord_: `echo bool(int(false) + 1)` FromDiscord_: There you go that's how you do it in nim FromDiscord_: `>>> dir(int) FromDiscord_: ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos FromDiscord_: Specifically __bool__ FromDiscord_: 👀 FromDiscord_: `__bool__` just means you can convert it to a bool aint it FromDiscord_: "Yea i noticed the paste, i'll host it" procedes to attack our irc brethern FromDiscord_: Yeah FromDiscord_: Wut FromDiscord_: > "Yea i noticed the paste, i'll host it" procedes to attack our irc brethern FromDiscord_: @Elegant Beef its a single line FromDiscord_: Ah FromDiscord_: 2 lines FromDiscord_: :p FromDiscord_: yeah, that FromDiscord_: Got discord on my portrait monitor FromDiscord_: That's a big ol' block fo text FromDiscord_: of* FromDiscord_: lucky you, with two monitors FromDiscord_: Haha skrylar[m]: matrix here o/ FromDiscord_: fuck matrix FromDiscord_: (im joking) FromDiscord_: There's a matrix channel for Nim? FromDiscord_: You're in it right now FromDiscord_: Through discord FromDiscord_: no theres a matrix bridge skrylar[m]: as a protocol matrix isn't exactly bad. FromDiscord_: Oh okay FromDiscord_: hey i said i was joking FromDiscord_: From my understanding video/audio is garbo FromDiscord_: I havent actually ever used matrix FromDiscord_: I wanted to use it over discord cause the discord linux client is spotty to me skrylar[m]: technically yall are all bridged to said irc :p FromDiscord_: And is no one going to comment that they're using comic sans as their keyboard font? FromDiscord_: Never tried video or audio do i never needed to FromDiscord_: I am FromDiscord_: So FromDiscord_: oh what the fuck FromDiscord_: :p skrylar[m]: oh never used voice/audio in matrix. just read over the text stuff a few times. and frowned that the primary server was some python heavyweight. but there's a c one that is getting more mature so its pretty efficient now FromDiscord_: O FromDiscord_: Riot? FromDiscord_: rest in peace nim chat FromDiscord_: nothing nim related skrylar[m]: if they added a topic field it would be a lot like zulip which is pretty nice FromDiscord_: Oof FromDiscord_: Nah we're planning a new nim based chat client that's not garbage and intercepts the discord rich presence shit FromDiscord_: 😄 FromDiscord_: Cool skrylar[m]: zulip is the only one where you can actually have multiple topics in a chat and it not all go to crap because you can have them all filed with their own topic tags ._. timotheecour: can someone please review and merge https://github.com/nim-lang/Nim/pull/14102 to un-break nim CI? disbot: ➥ fix nim CI; fix local testament ; snippet at 12https://play.nim-lang.org/#ix=2jiK FromDiscord_: @gitterirc should do `.strip("")`- narimiran: @timotheecour can we fix that SSL cert? FromDiscord_: not possible, we dont own the bot afaik? FromDiscord_: O narimiran: also, your un-breaking breaks SSL CI tests timotheecour: how so? timotheecour: these test failures seem unrelated as i noted PR FromDiscord_: Nim should add a gitlab and Codeberg repo mirror FromDiscord_: why? narimiran: btw, i've seen that you reported to `inim`, so i'd rather wait a bit to see if they can fix it on their side. because these "temporary fixes" usually last much longer than they should.... timotheecour: > can we fix that SSL cert? ⏎ ⏎ @narimiran the test https://github.com/timotheecour/Nim/blob/pr_fix_ci_ssl/tests/stdlib/thttpclient_ssl.nim (as written) is expected to fail, and `alert number 48` should mean the same as `certificate verify failed` according to https://mta.openssl.org/pipermail/openssl-users/2017-December/007046.html narimiran: i'm waiting for federico3's input on that problem FromDiscord_: > why? FromDiscord_: So more people can see nim FromDiscord_: but it's already found on github so...? i'd understand if it was from gitlab to github mirror but timotheecour: we should keep nim CI green, at all times, having it broken affects every single PR that rebases against devel; there’s already an open ticket for inim and important_packages should not break because of bugs unrelated to nim compiler; @0atman has been prompt to fix inim issues in the past anyways. I don’t see a reason to wait for inim. FromDiscord_: also i just learned that on/off are aliased to true/false FromDiscord_: That's comically fantastic FromDiscord_: haha, thats for switches in nimscript i think FromDiscord_: ah narimiran: you didn't understand my point.... FromDiscord_: Nim is OP FromDiscord_: I just made a python module in Nim so simply FromDiscord_: it gets harder the more complex the module FromDiscord_: True FromDiscord_: But eh PMunch: Rika, harder to integrate with Python, or harder to use Nims more powerful features? FromDiscord_: What's the best way to make a discord bot in Nim? FromDiscord_: > Rika, harder to integrate with Python, or harder to use Nims more powerful features? FromDiscord_: