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_: Probably both imo PMunch: I mean sure, Nims macros can be a bit daunting at first. But once you get into it it's not that hard PMunch: Haven't tried integrating it with Python though PMunch: Technicae Circuit, I'd say this would be a good starting point: https://github.com/Krognol/discordnim FromDiscord_: Okay then, thanks! PMunch: How did PR thursday go Araq? Last I checked it was 114 PRs, now it's up to 123.. PMunch: By the way, if you're looking for a package: https://nimble.directory/search?query=discord nhanb: Guys, how do I send a streaming response using asynchttpserver? I'm basically writing an http proxy that streams from google drive to the end-user's browser. The "downloading from google drive" part I could do by reading chunks from httpclient's AsyncResponse.bodyStream, but I could not find anything from asynchttpserver that would let me write chunks to the requesting client? FromDiscord_: I got this error https://hastebin.com/gododekiba.coffeescript FromDiscord_: While using discordnim PMunch: Aha, you have a bad version of zlib PMunch: Or rather a different one than expected FromDiscord_: Which version do i need? FromDiscord_: what do you need? streaming response or chunk [email protected] FromDiscord_: stream response https://github.com/dom96/jester/blob/d8a03aa4c681bc8514bb7bbf4953d380d86f5bd6/jester.nim#L200 FromDiscord_: chuncks response https://github.com/iocrate/netkit/blob/master/netkit/http/chunk.nim FromDiscord_: chunks response https://github.com/iocrate/netkit/blob/master/netkit/http/chunk.nim PMunch: Technicae Circuit, TBH I'm not sure.. PMunch: It might be this thing that you've run into: 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_: Thanks nhanb: Thanks flywin, streaming response is what I need. I'll check out how jester does it via the stdlib then FromDiscord_: no problem. FromDiscord_: I don't know what I can do because Zlib is broken PMunch: Hmm, well you can go into .nimble/pkgs/zip-0.2.1/zip/zlib.nim and change Ulong on line 14 to be uint instead of uint32 PMunch: That seems to be what I've done FromDiscord_: Okay then FromDiscord_: https://hastebin.com/ekoresojew.coffeescript FromDiscord_: I'm now getting this error PMunch: "Exception message: key not found: .user.username" PMunch: Well, do you have that key? FromDiscord_: What do you mean FromDiscord_: I don't even understand the error FromDiscord_: I'm just using the example PMunch: It tries to access the field .user.username in a JSON object, but it isn't there, so it fails FromDiscord_: Hm FromDiscord_: I have no idea ;-; PMunch: Wild guess, you haven't set the "token" environment variable it tries to use to connect to Discord PMunch: So instead of valid messages you get an authentication error JSON response instead FromDiscord_: I thought that i just put my token in the code PMunch: Oh, you could do that as well FromDiscord_: I've messed with the api myself so this should be right FromDiscord_: ```nim FromDiscord_: import asyncdispatch, discordnim FromDiscord_: FromDiscord_: proc messageCreate(s: Shard, m: MessageCreate) = FromDiscord_: if s.cache.me.id == m.author.id: return FromDiscord_: if m.content == "ping": FromDiscord_: asyncCheck s.channelMessageSend(m.channel_id, "pong") FromDiscord_: FromDiscord_: let d = newShard("Bot My token") PMunch: Ugh.. FromDiscord_: FromDiscord_: proc endSession() {.noconv.} = FromDiscord_: waitFor d.disconnect() FromDiscord_: FromDiscord_: setControlCHook(endSession) FromDiscord_: d.compress = true FromDiscord_: FromDiscord_: let removeProc = d.addHandler(EventType.message_create, messageCreate) PMunch: Please don't paste code into Discord.. FromDiscord_: waitFor d.startSession() FromDiscord_: FromDiscord_: removeProc()``` PMunch: It comes through on IRC and looks horrible.. FromDiscord_: *quick silent stab at irc* PMunch: https://irclogs.nim-lang.org/24-04-2020.html#07:28:38 FromDiscord_: Oh sorry FromDiscord_: I completely forgot FromDiscord_: https://hastebin.com/mudawitezu.cs FromDiscord_: There PMunch: Nothing wrong with IRC, the Discord bot is the issue.. PMunch: Yeah, so it's the basic_bot example FromDiscord_: Mhm PMunch: This seems to be where the issue comes from: https://github.com/Krognol/discordnim/blob/master/src/ctors.nim#L139 PMunch: Called from here: https://github.com/Krognol/discordnim/blob/master/src/discord.nim#L252 FromDiscord_: Damn PMunch: I'm guessing that maybe the Discord API changed.. FromDiscord_: Probably FromDiscord_: Because intents FromDiscord_: And https://blog.discordapp.com/the-future-of-bots-on-discord-4e6e050ab52e FromDiscord_: I think I might have to write my own library PMunch: https://github.com/Krognol/discordnim/issues/27 disbot: ➥ Exception: key not found: username ; snippet at 12https://play.nim-lang.org/#ix=2jj0 FromDiscord_: Hm PMunch: So maybe check out the develop branch FromDiscord_: Okay then FromDiscord_: That's 16 months old PMunch: (With nimble you can do that with #develop) FromDiscord_: I might try a c++ library in Nimble if possible FromDiscord_: I might try https://github.com/nim-lang/c2nim but i know little to none nim FromDiscord_: Would https://github.com/yourWaifu/sleepy-discord be a good library to try c2nim on? Araq: when you try c2nim PLEASE understand its workflow PMunch: Dunno Araq: yes, c2nim cannot parse Y. Araq: no, you don't have to abandon it because of that, you're suppose to tweak the header file(s) Araq: you tweak the header files and use enough options of c2nim so that you don't have to edit the produced Nim code PMunch: Does nimterop work on C++? Araq: and then you keep C header diff and reapply the patch for newer versions of the header file Araq: PMunch, afaik no, it doesn't PMunch: Ugh, why are some things that feel so natural to us so hard to formally describe.. Araq: what do you mean? PMunch: I'm back to fiddling with my no-overlap window manager Araq: ah, these things are nice. a Window manager that actually manages your windows PMunch: Yes PMunch: So it essentially tries to ensure that your windows don't overlap by repositioning them, or if need be scale them as little as possible FromDiscord_: > yes, c2nim cannot parse Y. FromDiscord_: Okay FromDiscord_: I can't figure out c2nim Araq: argh... PMunch: Haha, you tried Araq FromDiscord_: Haha FromDiscord_: Sorry 😅 FromDiscord_: I don't know whether i should attempt to make my own discord lib in Nim or whether i should keep trying c2nim on sleepy_discord PMunch: I mean, getting the parts you need should be easy FromDiscord_: Welp, looks like I have to directly interact with the discord API FromDiscord_: And now I'ma also bombard everyone here with a bunch of questions FromDiscord_: So, what's a good library i should use for making post, get, pull and delete requests? PMunch: httpclient in the stdlib should serve you well PMunch: https://nim-lang.org/docs/httpclient.html FromDiscord_: Thanks FromDiscord_: So, how do i use an async proc? PMunch: asyncdispatch FromDiscord_: Thanks FromDiscord_: I think i might just use a python lib with nimpy PMunch: Well that's no fun! FromDiscord_: I don't know nearly enough Nim to do this ;-; FromDiscord_: I might try anyway PMunch: That's just an opportunity to learn :) FromDiscord_: I'm going to try it anyway FromDiscord_: :p FromDiscord_: So, how do i make a package? PMunch: nimble init FromDiscord_: Oki FromDiscord_: I'ma call it `nimcord` FromDiscord_: Should i use `C`, `C++`, or `ObjC`? liblq-dev: C FromDiscord_: Thanks, can i ask for the reason why? FromDiscord_: cuz *speed* FromDiscord_: Haha okay PMunch: It's the default FromDiscord_: What's the most standard Nim version? PMunch: Basically don't use the others unless you have a particular reason PMunch: The most standard? FromDiscord_: Mhm FromDiscord_: As in the most common PMunch: Latest stable 1.2.0 should be good FromDiscord_: Oki PMunch: I'm not sure if choosenim does statistics FromDiscord_: :p dom96: it does actually PMunch: Are they published anywhere? dom96: nope dom96: and they're probably not 100% accurate anyway PMunch: Of course not PMunch: But it would be interesting to see PMunch: E.g. how fast people move onto a new version FromDiscord_: How do i make it so I can do `nimble build` to install my lib? FromDiscord_: with a .nimble file iirc FromDiscord_: I have the nimble file but it'd saying nothing to build FromDiscord_: It's* PMunch: `nimble build` is to build packages that provides tools PMunch: So they make a binary PMunch: What you want is `nimble install` PMunch: @Technicae Circuit ^ FromDiscord_: @Technicae Circuit ^ FromDiscord_: @Technicae Circuit Is this your library? https://github.com/krisppurg/dimscord/blob/master/README.md PMunch: clyybber, I highly doubt it, he literally just started :P FromDiscord_: Oh, well. This just got submitted to the pkglist FromDiscord_: Might wonna use that instead of making another one yourself PMunch: Yeah I was about to say FromDiscord_: @Yardanico FromDiscord_: Maybe this could be used for the bridge FromDiscord_: > What you want is `nimble install` FromDiscord_: Oh okay, thanks PMunch: No problem :) FromDiscord_: > Oh, well. This just got submitted to the pkglist FromDiscord_: Oh cool, thanks, I'll probably make my own lib once i get more experience PMunch: If you want a project we sorely need a better Discord bot for this channel PMunch: One that create paste links instead of directly forwarding code.. FromDiscord_: That would be kinda hard 😅, I'd need to find an API similar to hastebin (hastebin doesn't have an API afaik), and i barely know Nim ;-; PMunch: ix.io is your friend :) PMunch: You can have a look at how the Nim playground does it, super simple PMunch: https://github.com/PMunch/nim-playground/blob/master/src/nim_playground.nim#L111-L115 PMunch: And the point was to have a project to do in Nim to learn the language :) FromDiscord_: Oo cool FromDiscord_: Now i need to figure out a command handler ;-; PMunch: Command handler? FromDiscord_: Does Nim allow you to import local files FromDiscord_: Yeah for the discord lib PMunch: The question to "Does Nim allow you to" is pretty much always "yes" :P FromDiscord_: Haha FromDiscord_: How do i do it? `import ./file/path`? PMunch: Just "import file/path" works fine FromDiscord_: Thanks! FromDiscord_: https://github.com/Oples/nanorc-nim/blob/master/nim.nanorc FromDiscord_: I am saved! FromDiscord_: Does importing a module make the variables declared available aswell? FromDiscord_: I am planning on writing a command handler like thr discord.js command handler in the docs skrylar[m]: they would have to be exported with * FromDiscord_: So like `const *name ...`? FromDiscord_: after the name FromDiscord_: Oki FromDiscord_: Also, how do i make arrays? FromDiscord_: var array = [1, 2, 3, 4] FromDiscord_: Thanks FromDiscord_: or var array: array[4, int] = [1, 2, 3, 4] FromDiscord_: So the structure would be like ```nim FromDiscord_: const FromDiscord_: name*:string = "Name" FromDiscord_: aliases*:array[amount_of_aliases] = [aliases] FromDiscord_: FromDiscord_: proc code(msg:idk_about_this_yet, args:array) = FromDiscord_: # Stuff``` FromDiscord_: Would that work? FromDiscord_: So the structure would be like ```nim FromDiscord_: const FromDiscord_: name*:string = "Name" FromDiscord_: aliases*:array[amount_of_aliases] = [aliases] FromDiscord_: FromDiscord_: proc code(msg:idk_about_this_yet, args:array)* = FromDiscord_: # Stuff``` FromDiscord_: Annd i forgot about editing... FromDiscord_: And i forgot about irc FromDiscord_: 😅 FromDiscord_: nope, there are a few things wrong FromDiscord_: https://paste.pythondiscord.com/veroziwelu.py FromDiscord_: Does the `*` need to be after the type aswell? FromDiscord_: https://play.nim-lang.org/#ix=2jjU FromDiscord_: thats how it should be done FromDiscord_: `["alias1", "alias2"] # etc` this would need to reach the size of your array FromDiscord_: also, `const` means those variables are only available at compile time, have it in mind FromDiscord_: Oh okay FromDiscord_: Thanks solitudesf: no, const means that value is known at compile time FromDiscord_: Thanks FromDiscord_: I want to make sure `args` is an array but i don't know how long it'll be FromDiscord_: then use seq[string] FromDiscord_: they are basically python lists (if you come from python) FromDiscord_: Cool FromDiscord_: I do come from Python :p FromDiscord_: ```let FromDiscord_: number_of_aliases = 3 FromDiscord_: name*:string = "Name" FromDiscord_: aliases*:array[number_of_aliases, string] = ["alias1", "alias2"] # etc FromDiscord_: #[This part is optional ]# FromDiscord_: FromDiscord_: proc code*(msg:idk_about_this_yet, args:seq[string]) = FromDiscord_: #code``` FromDiscord_: ```nim FromDiscord_: let FromDiscord_: number_of_aliases = 3 FromDiscord_: name*:string = "Name" FromDiscord_: aliases*:array[number_of_aliases, string] = ["alias1", "alias2"] # etc FromDiscord_: #[This part is optional ]# FromDiscord_: FromDiscord_: proc code*(msg:idk_about_this_yet, args:seq[string]) = FromDiscord_: #code``` FromDiscord_: Should be alright now FromDiscord_: use this web for pasting code: https://play.nim-lang.org/ PMunch: Pleeease stop pasting.. FromDiscord_: Oh sorry sheerluck: Technicae Circuit god damn FromDiscord_: I keep forgetting ;-; FromDiscord_: and when you edit messages they are sent again iirc, so try not to either PMunch: And hurry up with creating the new Discord bot! :P PMunch: s/bot/bridge FromDiscord_: :p FromDiscord_: I don't even know how to use irc FromDiscord_: https://play.nim-lang.org/#ix=2jk1 FromDiscord_: There FromDiscord_: Would that code be valid? FromDiscord_: (also does irc have a feature for editing messages?) PMunch: Nope PMunch: It's very basic text chat FromDiscord_: Damn FromDiscord_: PlaygroundCode on GitHub FromDiscord_: Font size: FromDiscord_: 13 FromDiscord_: Compilation target: Nim version: FromDiscord_: 1 FromDiscord_: let FromDiscord_: 2 FromDiscord_: number_of_aliases = 2 # You dont need this FromDiscord_: 3 FromDiscord_: name*:string = "Name" FromDiscord_: 4 FromDiscord_: aliases*:seq[string] = @["alias1", "alias2"] # @ means its a seq instead of an array FromDiscord_: 5 PMunch: Recruit_main707... FromDiscord_: FromDiscord_: 6 FromDiscord_: proc code*(msg, args:seq[string]) = FromDiscord_: 7 FromDiscord_: #code FromDiscord_: 8 FromDiscord_: ​ FromDiscord_: Share to ixShowing: outputRun!(ctrl-enter) FromDiscord_: https://play.nim-lang.org/#ix=2jk3 FromDiscord_: oh shit FromDiscord_: hahaha FromDiscord_: Also, why not use webhooks on discord, so the user name would be the irc username PMunch: Did you just dit Ctrl+A Ctrl+C? :P PMunch: Got line numbers and everything :P FromDiscord_: And if irc has webhooks do the same for irc :p skrylar[m]: someone did a bad job PMunch: Most people just use the old skool star fix PMunch: school* FromDiscord_: i selected with mouse, and it went a bit too high :p im so sorry PMunch: Like that ^ PMunch: Or like I do with substitution syntax PMunch: Like I did earlier with s/bot/bridge FromDiscord_: What language is the bot written in right now? PMunch: @FromDiscord_, help PMunch: @FromDiscord_, version PMunch: Hmm PMunch: No idea FromDiscord_: Wut PMunch: Think it's an off the shelf one FromDiscord_: @gitterirc FromDiscord_: @gitterirc help PMunch: I know disbot has some commands like that PMunch: !help PMunch: Hmm PMunch: !eval echo 3+4 FromDiscord_: Would you mind if i first rewrite the bot in Python, then rewrite it in Nim later? NimBot: 7 FromDiscord_: !eval echo "Test" NimBot: Test FromDiscord_: Oof FromDiscord_: Oh cool PMunch: As long as we don't get code pastes on IRC you can rewrite it in assembler for all I care.. FromDiscord_: Haha FromDiscord_: Does irc not support newlines either? PMunch: Huh, disbot PMs you the reply PMunch: Don't think so PMunch: We do have colours and italics/bold etc. FromDiscord_: Damn PMunch: You can try IRC here if you like: https://webchat.freenode.net/ FromDiscord_: I've tried it before but I can't login again 😅 PMunch_web: You don't need a password FromDiscord_: Don't most channels need a password? PMunch_web: Just choose a nick no one else uses and goahead PMunch_web: Some do, but not all PMunch_web: This one for example doesn't PMunch: Hi Technicae_Circui Technicae_Circui: And my nim was cut off- Technicae_Circui: Heya Technicae_Circui: Sup? PMunch: Haha PMunch: So as I said it's only text Technicae_Circui: What do you mean? PMunch: And italics bold and underline Technicae_Circui: Oh okay PMunch: A12lo02ng04 w06it08h 10co12lo02ur04s! Technicae_Circui: Test\ncool Technicae_Circui: Oof Technicae_Circui: Oo colours PMunch: Haha Technicae_Circui: Very nice PMunch: Mostly used for bots to highlight messages and such PMunch: !issue 42 disbot: https://github.com/nim-lang/Nim/issues/42 -- 5illegal recursion in type 'TThread' 7& 29 more... PMunch: Like that Technicae_Circui: Oh cool Technicae_Circui: Apparently new lines can be simulated by just splitting the message and sending those parts in quick succession PMunch: Yes, that's what happens when you paste code in here Technicae_Circui: Oh okay, is it that bad? PMunch: You tell me: https://irclogs.nim-lang.org/24-04-2020.html#10:38:08 Technicae_Circui: Someone from discord please send a multline message Technicae_Circui: O Technicae_Circui: I can't see it ;-; PMunch: What do you mean you can't see it? FromDiscord_: should i? PMunch: Not now.. He quit the online IRC chat.. FromDiscord_: And my IRC session just got screwed while opening the link FromDiscord_: :p PMunch: Haha FromDiscord_: Oh damn FromDiscord_: That is bad FromDiscord_: I feel sorry for people who use irc FromDiscord_: I could just use a paste api that just puts all multiline messages into a text file FromDiscord_: But does anyone else here know irc? FromDiscord_: I mean FromDiscord_: Does anyone know how to make an irc bot in Python here? FromDiscord_: I'm going to use Python until i learn more Nim sheerluck: I'm going to use Python too until i learn more Nim FromDiscord_: Coolio FromDiscord_: learn-by-doing FromDiscord_: Nim doesn't have a good discord lib yet FromDiscord_: Discordnim? FromDiscord_: Plus I don't even know irc FromDiscord_: That's broken af FromDiscord_: it now has FromDiscord_: dimscord FromDiscord_: Discordsrm or something FromDiscord_: Yeah FromDiscord_: I don't know about irc though FromDiscord_: well, in a few minutes, ones the CI passes 😄 FromDiscord_: Who made it FromDiscord_: I'm not sure FromDiscord_: https://github.com/krisppurg/dimscord FromDiscord_: Ya sure this one works better? FromDiscord_: didn't try it FromDiscord_: It works atleast FromDiscord_: I think FromDiscord_: its also maintained FromDiscord_: @Technicae Circuit Yardanico is already working on a new bridge FromDiscord_: and theres plan for voice support PMunch: Voice support? FromDiscord_: hold up, voice support? FromDiscord_: for a discord bot? FromDiscord_: yeag FromDiscord_: Many libraries have voice support FromDiscord_: *h FromDiscord_: how is that though? FromDiscord_: Hm I'll switch my bot to this I guess FromDiscord_: Never mind, I'm skeptical FromDiscord_: lol FromDiscord_: can't hurt trying FromDiscord_: ??? Everything is a ref object FromDiscord_: Why? FromDiscord_: It's not working FromDiscord_: > @Technicae Circuit Yardanico is already working on a new bridge FromDiscord_: Oh okay rhen FromDiscord_: What the heck FromDiscord_: /data/data/com.termux/files/home/.nimble/pkgs/dimscord-0.0.9/dimscord.nim(1, 11) Error: cannot open file: lib/gateway FromDiscord_: I'm really tempted to write my own library dom96: voice support would be cool FromDiscord_: Good luck with that FromDiscord_: :p dom96: @Technicae Circuit: do it, sounds like a good learning experience :) FromDiscord_: I've already messed with the discord API a bit ages ago FromDiscord_: So it shouldn't be too hard, right? 😅 FromDiscord_: Not sure where that error comes from. Clearly there *is* a lib/gateway FromDiscord_: It's a lot of objects to encode FromDiscord_: Welp FromDiscord_: There's a lib gateway nim not a lib gateway FromDiscord_: I'm going to try and use https://nim-lang.org/docs/httpclient.html to send a message with Nim FromDiscord_: ~~Why not make a channel where discord bots can be invited for testing purposes~~ FromDiscord_: ~~And only give bots access to that channel~~ FromDiscord_: Perms aren't that granular in discord FromDiscord_: Bad idea FromDiscord_: Wdym? FromDiscord_: @Rika > There's a lib gateway nim not a lib gateway FromDiscord_: WDYM? FromDiscord_: @Clyybber error didn't state an extension FromDiscord_: @Technicae Circuit misunderstood FromDiscord_: @Rika Thats normal FromDiscord_: Oh FromDiscord_: When the file doesn't exist FromDiscord_: My guess is that the lib didn't get cloned/downloaded FromDiscord_: FromDiscord_: https://cdn.discordapp.com/attachments/371759389889003532/703201119169413120/Screenshot_20200424_121005_com.termux.jpg FromDiscord_: yeah FromDiscord_: I cloned it and used the devel branch FromDiscord_: Then used nimble install FromDiscord_: nimble doesn't copy it because its not specified in the .nimble file I think FromDiscord_: Should i manually move the folder then? FromDiscord_: Or would that break nimble? FromDiscord_: yeah, for now FromDiscord_: nope FromDiscord_: Oki FromDiscord_: it wouldn't FromDiscord_: Invalid indentation now apparently FromDiscord_: In their example FromDiscord_: Holy shit I really don't like the look of this library FromDiscord_: I'll stick to fixing discord nim I guess? FromDiscord_: what "look"??? dom96: make sure to post issues on that libraries github FromDiscord_: dom96: Is the solution to add lib to the srcdirs? FromDiscord_: @Clyybber the code FromDiscord_: Maybe I'll check what it does differently FromDiscord_: I dunno, looks ok to me FromDiscord_: And the ref objects seem to be ref on purpose FromDiscord_: since some are not FromDiscord_: Seem FromDiscord_: https://play.nim-lang.org/#ix=2jki dom96: clyybber: doesn't sound right, but I'd have to look at the file structure FromDiscord_: Doesn't work because of indentation apparently FromDiscord_: Pass should be discard FromDiscord_: Oh okay FromDiscord_: Still invalid indentation PMunch: Because it's indented with 4 spaces.. FromDiscord_: That's the example :p FromDiscord_: Does Nim only accept an indentation width of 2? PMunch: Try this: https://play.nim-lang.org/#ix=2jkl PMunch: Well 4 can work, but that's mostly by chance :P FromDiscord_: Oh okay FromDiscord_: huh? FromDiscord_: nim doesn't care about how many spaces you indent with FromDiscord_: as long as its correct FromDiscord_: Still invalid PMunch: "As long as it's correct", which is 2 spaces :P PMunch: What line? FromDiscord_: eh, 4 is correct too FromDiscord_: X is correct FromDiscord_: the lexer doesn't care about how many spaces you indent with FromDiscord_: he only cares about: as many as in the line before, more, less FromDiscord_: ` What line?` line 19 FromDiscord_: I wish Nim had braces FromDiscord_: Even though I come from Python, i prefer braces Faulander: thank god it doesn't. FromDiscord_: braces 🤢 FromDiscord_: braces are a longer curse FromDiscord_: Haha FromDiscord_: I like braces, idk why tho ¯\\_(ツ)\_/¯ Faulander: then use rust, go, c, c++, java, js :) FromDiscord_: literally the first requierment for a new language for me was that it didnt use them :P 2 spaced tabs are so much more fitting for nim FromDiscord_: (i call them tabs, i know they are spaces) FromDiscord_: O Faulander: same for me. it's one of the first selling points to me, if it has them or not. it's like a religious discussion. i kinda lika adas style though :) FromDiscord_: Haha FromDiscord_: I just think braces are nice FromDiscord_: You can use braces in nim too btw FromDiscord_: just put everything in `(` `)` Faulander: code without is so much more readable. FromDiscord_: Wait FromDiscord_: So `(` and `)` basically removes the need for indents? FromDiscord_: Or do indents still need to be added? Faulander: wait ... you want to write code without indentation BUT with braces? Jesus, i hope the only person looking at that code is you ;) FromDiscord_: I include indents even with braces FromDiscord_: I just don't want the indents to matter FromDiscord_: @Technicae Circuit No, you still cant write: FromDiscord_: ``` FromDiscord_: ( FromDiscord_: this FromDiscord_: is FromDiscord_: stipud FromDiscord_: )``` FromDiscord_: Yeah FromDiscord_: It's a shame ;-; FromDiscord_: think of it as a style check included with the compiler for your pleasure 😄 FromDiscord_: @Technicae Circuit why do you want to write such code.... FromDiscord_: Because indents can get annoying, and i blame one language ***cough cough*** ~~Python~~ ***cough cough*** FromDiscord_: you know whats more annoying FromDiscord_: noone undestanding your code FromDiscord_: and it looking like poop :p FromDiscord_: True but I still include indents FromDiscord_: then you shouldn't care ? FromDiscord_: indentation based syntax makes it more convinient to code well styled code. And it also enforces you to code well styled code FromDiscord_: Both are a plus in my book FromDiscord_: I have issues with the fact that tabs and spaces can't be used at the same time, because i use spaces and all of my friends use tabs FromDiscord_: And using tabs are bad practice FromDiscord_: Its just an editor problem FromDiscord_: Configure your editor to insert spaces instead of tabs. FromDiscord_: Or make a git hook FromDiscord_: ^ FromDiscord_: What's a git hook? FromDiscord_: Something that runs when git does something FromDiscord_: O FromDiscord_: like pre-commit, post-commit FromDiscord_: So i can just turn all tabs to spaces FromDiscord_: yeah FromDiscord_: yep FromDiscord_: Coolio FromDiscord_: ~~I still want braces~~ FromDiscord_: coders paradise FromDiscord_: :p FromDiscord_: if I want to write shitty code, I write perl : ) FromDiscord_: @Technicae Circuit install dimscord via git FromDiscord_: I am currently aware of this issue and I'm trying my best to fix it FromDiscord_: Haha FromDiscord_: I did FromDiscord_: @Technicae Circuit maybe this will cure you: https://github.com/belamenso/v FromDiscord_: I did `git clone library_url` then nimble install FromDiscord_: What's that FromDiscord_: @Technicae Circuit Oh btw when you clone via git, you don't have to nimble install. You can nimble develop too FromDiscord_: @Technicae Circuit It is cursed. FromDiscord_: Omfg FromDiscord_: ***This is amazing*** FromDiscord_: @Yardanico <- this fella here created an unholy abonimation fork of the above: https://github.com/Yardanico/nim-emojify/commit/dae1893a3e25d97f9c9078491b399c29f27e7184 FromDiscord_: Hahahaha FromDiscord_: tech, I think what you need to do is first clone it, then once you got the dimscord folder make ur own folder then make a file in nim and import the library FromDiscord_: I might actually troll my friends with this FromDiscord_: Oh okay FromDiscord_: @sealegs Might wonna ask dom96 about how to fix that issue FromDiscord_: with lib not being copied/installed by nimble FromDiscord_: okay FromDiscord_: Can we make a discord bot for this server? FromDiscord_: In Nim FromDiscord_: And then make it so commands are generated from files :p FromDiscord_: Just like @gitterirc? FromDiscord_: Mhm FromDiscord_: But actually make the bot cool and useful FromDiscord_: I was thinking of that before when I was working on the lib FromDiscord_: Oh? FromDiscord_: It actually took me 4 or 5 months FromDiscord_: I think it'd be cool FromDiscord_: Oo FromDiscord_: I'd like the commands would be generated from files FromDiscord_: Let me write an example FromDiscord_: hmm ok FromDiscord_: Generating the commands from files can clean everything up alot FromDiscord_: ? FromDiscord_: oh, you mean discord commands FromDiscord_: Because having one massive file is hideous FromDiscord_: Yeah FromDiscord_: thats out of dimsord's scope I suppose FromDiscord_: or are you talking about the bot? FromDiscord_: The bot FromDiscord_: It could be made easily PMunch: Sorry, I had to go there for a sec PMunch: Technicae Circuit, did you find your issue? FromDiscord_: I had to go too :p FromDiscord_: But https://play.nim-lang.org/#ix=2jkN is how i think the structure should be like FromDiscord_: @KrispPurg FromDiscord_: Per file sounds insane imo FromDiscord_: Maybe commands can be split into modules FromDiscord_: I mean, not nim modules just something called "modules" FromDiscord_: Haha FromDiscord_: Sure FromDiscord_: Or a class based command system rockcavera: This pull (https://github.com/nim-lang/Nim/pull/14004) broke old code. Example: https://play.nim-lang.org/#ix=2jkQ disbot: ➥ fixes #14001 FromDiscord_: Well, I mean having a split file is cool through, but I'm sure you can just modify the example code and make it use split file command rockcavera: Now it remains to be seen whether it was deliberate, since previous behavior was inappropriate. FromDiscord_: then you can also just `include` files solitudesf: pretty sure it was delibarete solitudesf: 4raq is aware of that breakage, at least Bennyelg: What is the best practice to open connections on an API ? ⏎ on every route open or at the top like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea2e0a6568e5258e47fd37a] FromDiscord_: Are giu able to Include C files? FromDiscord_: Are you able to include header files? PMunch: Yes rockcavera: solitudesf, thanks. I believe too. rockcavera: I am in need of help. I have an asynchronous procedure that returns a Future [int], but I pass a 'var string' as a parameter, but I receive that it is not safe and does not compile. dom96: You can use FutureVar Araq: rockcavera: it wasn't the PR, it was a different PR Araq: and the code isn't supported dom96: (if you're adventurous you can modify the async macro to transform `var string` into `FutureVar[string]` and make a PR :)) rockcavera: thanks Araq: nah, people should use FutureVar[string] explicitly and learn about the stack vs heap rockcavera: :) dom96: Araq, why? :) PMunch: Is there a way to wrap a field like `char title[50]` in a structure to something that would be treated as as string? dom96: ideally {.async.} should support the language's features transparently PMunch: Or would I need to do array[50, char]? Araq: PMunch: use array[50, char] PMunch: But then it's a pain to assign string data or echo the contents.. dom96: write procs that make those operations easier then PMunch: Oh, I'm not needing this for anything in particular PMunch: I'm just writing up an article on Nim/C interop PMunch: And wondered if there was a better way of doing it Araq: in your tutorial also show template toCstring(x): cstring = unsafeAddr(x[0]) PMunch: Is that template defined anywhere? Or just show off that it's possible to do it? FromDiscord_: So how would i use a C++ library in Nim? PMunch: Like this: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma Araq: dom96: "less magic" is en vogue FromDiscord_: Thanks! Araq: PMunch: that template doesn't exist PMunch: (except for the fact that the code example literally says "Horrible example of how to interface with a C++ engine" :P) PMunch: Araq, okay thanks Araq: anybody around with experience on this algorithm https://en.wikipedia.org/wiki/Path-based_strong_component_algorithm ? Araq: clyybber? PMunch: Is there a way to limit a template to only string literals? dom96: Araq, okay, at the very least, someone should suggest FutureVar when `var` is attempted in an async macro :) dom96: alehander42: maybe you'd be interested in this improvement also? PMunch: Ah, can be done with {lit} like in term rewriting macros shashlick: Do templates work for simple substitutions - #define MyCoolUint32 uint32 disruptek: sure. alehander92: dom96 i agree this should be at least hinted alehander92: i think i didnt know i can use FutureVar as well ... PMunch: So something like this helps deal with the situation: https://play.nim-lang.org/#ix=2jlg PMunch: To bad I can't create an = operator dom96: btw yesterday I created a quick hacky implementation of intsets for the JS backend which uses JS' native `Set` and got some nice perf improvements. I wonder how many others things like this there are in the stdlib. dom96: Araq, would you accept patches to implement them using JS-native APIs dom96: ? Araq: if the patch is clear enough Araq: for example, one solution is to make intsets.nim contain Araq: when defined(js): include intsets_js dom96: yep Araq: else: include insets_native FromDiscord_: wait would that mean that ES3 compatibility is no longer guaranteed? FromDiscord_: wait, was nim the one that guaranteed ES3 compatibility? i forgot dom96: Set has pretty good browser support from what I checked Araq: Rika: in the worst case it means 'when defined(js) and not defined(nimArchaneJs): ...' dom96: https://gist.github.com/dom96/d5cdd3c2406992aae4173b9e47ae5249 dom96: my hack from last night dom96: awesome that I can code something like that up in like 10 mins btw disruptek: right? disruptek: Araq: i'm blocked by stupid shit. Araq: shoot disruptek: see stream late yesterday or i will demo in a few; lemme get some coffee. disruptek: Rope != ref object Rope disruptek: dafuq FromDiscord_: Is therr a way to get the C++ code and not just the compiled binary? alehander92: hm, i should start using sets dom96: Araq, I wonder how much effort it'd be to reimplement the nim stdlib to use native JS strings alehander92: i constantly use JsAssoc[stuff, bool] alehander92: to immitate that alehander92: oh we wanted that with @zah alehander92: but the problem is the mutability thing Araq: disruptek: simple, there are two different ropes modules dom96: hm. I see. dom96: tbh I'm not sure strings are the bottleneck for my game Araq: the compiler doesn't use the stdlib's ropes module, watch out Araq: dom96: IME karax with its 'kstring' does it best alehander92: we can have something like kstring Araq: sometimes a library solutions patching over language problems work best dom96: spent a while optimising things last night and while I improved certain timings, Edge was still stuck at 9fps :( dom96: might need to rethink how I move particles or be less ambitious (this was 2500 particles moving at once) Araq: holy shit... my cycle collector works for 'hamming.nim' FromDiscord_: thats probably really good! congrats! :p Araq: it's suprising as the collector is incomplete :-) FromDiscord_: Araq: Regarding the algorithm, nope. FromDiscord_: Araq: Also \o/ FromDiscord_: 😄 Araq: well now I have the proof that my architecture is correct Araq: and the other algorithm is broken Araq: because my new one works Araq: no errors according to valgrind disruptek: Araq: you're blowing my mind right now. also, thanks. FromDiscord_: > Is therr a way to get the C++ code and not just the compiled binary? FromDiscord_: :p disruptek: look in your nimcache. disruptek: ~nimcache disbot: nimcache: 11the best way to figure out where it is located is to specify that location with --nimcache -- disruptek FromDiscord_: Thanks FromDiscord_: you can do `--nimcache:./cache` or something like that FromDiscord_: So just specify a path for the cache to go? FromDiscord_: yep FromDiscord_: there is a default one somewhere FromDiscord_: Oki alehander92: it should be in `~/.cache/nim/` alehander92: by default IIRC alehander92: you can also `--nimcache: ` to `/dev/shm/` or `/tmp/` location PMunch: _d for debug and _r for release FromDiscord_: Thanks, but when i do `nim --nimcache:path` it says i need a command zetashift: still need to add c/cpp and a nim file probably zetashift: like `nim c --nimcache:path main.nim` FromDiscord_: Oh okay, thanks alehander92: of course this is for linux, i am not so experienced in nim with other platforms PMunch: Should wrapped types have importc on them? Why/why not? FromDiscord_: I am a linux user too :) alehander92: ok FromDiscord_: Is there an option in my nim.cfg to set a default path for cache,m FromDiscord_: Is there an option in my nim.cfg to set a default path for cache? disruptek: hold it closer to the screen. disruptek: can't quite read it from here. zacharycarter: Hackathon went well btw - I have no idea if we won, but our project elicited the most ooos and ahhhs FromDiscord_: Cool PMunch: Oh nice zacharycarter! disruptek: which hackathon? zacharycarter: and I wrote the AWS lambda in Nim PMunch: What did you make? alehander92: Technicae yeah you can just write your flags there alehander92: e.g. `--nimcache:..` zacharycarter: we made a chat bot / did NLP stuff alehander92: https://github.com/nim-lang/Nim/issues/7402#issuecomment-376153970 FromDiscord_: Thanks disbot: ➥ [TODO] could nimcache be generated out-of-source (in /tmp) like rdmd does in D? zacharycarter: so you'd say you want to see what shipments are getting picked up or dropped of on a particular day and our bot would retrieve that information FromDiscord_: There should also be a `transpile` option alehander92: ? why FromDiscord_: So it outputs the converted code alehander92: but it does output it zacharycarter: Nim doesn't do transpilation though alehander92: and outputting it on the screen would be confusing as you generate a lot of boilerplate FromDiscord_: Does it not? How else does it generate C, C++ and JS? zacharycarter: compilation alehander92: and different files FromDiscord_: Welp disruptek: syntax. alehander92: Technicae this is like a flamewar topic "is transpilation useful term or not" FromDiscord_: Oh okay :p disruptek: transpilation usually suggests no change to semantics. alehander92: you can use the `debug` options to get line directives inside your c/javascript files alehander92: or `--lineDir:on` FromDiscord_: Hm alehander92: we also have `--sourcemap:on` now for javascript, but its a bit experimental (all those if you want to map the outputted code to nim cod) FromDiscord_: Are files compiled by Nim decompilable? zacharycarter: Can you do that in any other language? disruptek: no less so than any other c file. Zevv: up to a certain level, sure zacharycarter: I mean c2nim can generate nim code from parsing C zacharycarter: and C++ Araq: it's all decompilable unless you convert it to 'move'-only code Zevv: even then. just given enough time and patience FromDiscord_: Hm Araq: https://github.com/xoreaxeaxeax/movfuscator use this on your code FromDiscord_: That's a plus fot me then FromDiscord_: That's a plus for me then Araq: Zevv: nobody has enough time to deal with mov-only code ;-) alehander92: Technicae code is always reverse engineerable FromDiscord_: I want to just get a C or C++ file that can be compiled for use in Python scripts, so i want to be able to decompile the code :p alehander92: what do you call decompile FromDiscord_: Just get all the code in it's C form, no matter how messy it is, if it works, then it works FromDiscord_: Messy or unreadable* PMunch: So you just want the C code from Nim code? PMunch: That's compiling, not decompiling.. FromDiscord_: If I'm using the binary to get the C code? PMunch: Decompiling would be to go the other way, from binary to C/Nim or from C to Nim. PMunch: But why would you want to do that when you can just get the Nim compiler to output the C code in the first place? alehander92: yeah :P FromDiscord_: But doesn't the cache generate a bunch of files? FromDiscord_: I only want to get one file alehander92: but still it's much much much easier to just postprocess them somehow alehander92: than to decompile a binary alehander92: and why do you need just a single file? PMunch: find ./nimcache -name *.nim.c -exec cat {}; alehander92: this shouldn't matter in general FromDiscord_: I want a single file so i can just give the setup.py one file to compile in C PMunch: I guess just `cat nimcache/*.nim.c` would work as well alehander92: but why would you give that to setup.py at all alehander92: if nim can already compile the c files PMunch: You have the --genscript switch which creates a script to compile your C sources PMunch: Provided that it still works alehander92: can you explain a bit more what exactly does your python program do alehander92: (and yeah, you can still compile the whole directory, it is basically a set of `gcc` invocations => `.o` files and final => binary) alehander92: IIRC FromDiscord_: I'm planning on starting to write all of my Python extensions in Nim, but having massive amounts of files doesn't seem that nice, since that would clog the directory with masses of .c files bung87: `+ (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask ⏎ ⏎ ``` handler:(NSEvent * _Nullable (^)(NSEvent *))block;```` [https://gitter.im/nim-lang/Nim?at=5ea2f88b2bf9ef12699fdcc8] alehander92: well you can just have subdirectories bung87: how to write this in c using objc runtime? bung87: `objc_msgSend(objc_getClass('NSEvent'), sel_registerName('addLocalMonitorForEventsMatchingMask:handler:'),1 << 14,(IMP)KeyboardEventHandler,"[email protected]:@");` bung87: this not work alehander92: Technicae but for sure there are ways to generate single c/h files from groups of c/h , do that, dont decompile :) FromDiscord_: How would i do that then? :P alehander92: well, does a subdirectory not work? alehander92: if not, https://github.com/cil-project/cil is one option alehander92: http://cil-project.github.io/cil/doc/html/cil/ alehander92: => Using the merger FromDiscord_: Okay, I'm using Nimpy right now but i need to figure out how would iterate through a list of functions, the functions are passed to Nim from Python FromDiscord_: > well, does a subdirectory not work? FromDiscord_: Yeah it does, so i guess a subdir should be fine :p alehander92: good! disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: gamer tool today. alehander92: technicae the iteration should work if not ask alehander92: disruptek oo FromDiscord_: I can only iterate through one type which is sad FromDiscord_: But i need to iterate through a list with multiple data types FromDiscord_: ~help FromDiscord_: !help FromDiscord_: Oof alehander92: :) alehander92: can't you collect them FromDiscord_: What do you mean? FromDiscord_: How would i iterate through a list that i passed from Python to Nim if it has multiple data types (like and int and a string) alehander92: ahhh ! alehander92: sorry, i didnt realize what you need alehander92: can't you pass it as a tuple somehow alehander92: or can't you work with them as some kind of general objects, not too familiar with nimpy tho FromDiscord_: It's basically using Nim alehander92: but can you directly introspect PyObjects FromDiscord_: And the limitation is that sequences (Python lists get turned into sequences) can only have one type FromDiscord_: Oh? FromDiscord_: How? alehander92: sorry its a ? :D companion_cube: what's the tech behind FromGitter/FromDiscord? is it free? dom96: FromGitter is written in Crystal by oprypin dom96: FromDiscord is whatever the most popular relay written in Go is, can't remember the name companion_cube: oh really? :o FromDiscord_: @Technicae Circuit, I have updated the library dimscord with the fix of the example and the nimble issue. FromDiscord_: Oh, nice! FromDiscord_: I recommend making the library simpler though since the current version isn't the best FromDiscord_: ? FromDiscord_: @sealegs hello, I'm interested in your dimscord library, can it run for long periods of time without any crashes and stuff (like days and weeks)? I'm asking because https://github.com/Yardanico/ircord currently uses discordnim and it's not that reliable Yardanico: FromDiscord in this channel is matterbridge dom96: Yardanico, how often do crashes happen dom96: ? companion_cube: ahhh cool, thanks Yardanico dom96: if they're not too frequent it shouldn't be a problem, just restart the program Yardanico: @dom96 well the worst thing is that there's no such reliable way to detect that Yardanico: it just stops handling discord events Yardanico: without any exceptions dom96: ahh, that's really bad dom96: does the library do something silly like catch exceptions and then ignore them or something? dom96: My guess is that discord is timing out the connection and it cannot reconnect Yardanico: well discord has that well documented Yardanico: and there are "try" statements but they echo stuff if they catch an exceptions dom96: might be worth just getting rid of those FromDiscord_: Does Nim have anything like a Python list? FromDiscord_: Dynamic, can hold elements of any type dom96: it's always better to crash early FromDiscord_: Does Nim have anything like a Python list? FromDiscord_: Dynamically sized, can hold elements of any type dom96: if the crash happens to often then fix the crash dom96: if it's rare you can always restart Yardanico: @codic no, you'll have to use stuff like variant objects Yardanico: @dom96 usually it happens in less than a day Yardanico: I'll try using dimscord :P dom96: sometimes you gotta get your hands dirty dom96: libraries won't be fixed unless you help the process along Yardanico: i know, I tried looking why discordnim crashes, but didn't get any meaningful info FromDiscord_: ah, how do variant objects work? I can't find anything about variant objects, just ***object variants*** :P https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants Yardanico: yeah, object variants FromDiscord_: haha Yardanico: since discordnim is pretty much unmaintained it's bundled in ircord FromDiscord_: is it? FromDiscord_: FromDiscord_: https://cdn.discordapp.com/attachments/371759389889003532/703268456845410434/unknown.png FromDiscord_: last commit on jan 16 FromDiscord_: ;P Yardanico: well if you look at it it doesn't really do any meaningful changes Yardanico: just some styling FromDiscord_: oh FromDiscord_: Let's see FromDiscord_: Commit a day before it FromDiscord_: https://github.com/Krognol/discordnim/commit/e3b7223ff726d12295dfdacdf78f2ab6abae8774 FromDiscord_: although that seems to be mainly removing whitespace? FromDiscord_: Why was that whitespace there in the first place? FromDiscord_: also, I wonder how nim hasn't exploded into popularity yet, seeing that it's 15 years old and provides great speed with simplicity Yardanico: well whitespace can be there if you do Yardanico: in my projects I sometimes have a space after "=" in proc definition or after ":" (in if/when/etc) FromDiscord_: true, but why would that affect the compiler? Yardanico: it won't? dom96: codic: I wouldn't call it 15 years old, 12 at most Yardanico: well, except the whitespace before the code FromDiscord_: Then there's no need to remove it, that whole commit is about that except for an import change Yardanico: because nim is whitespace significant :) FromDiscord_: wasn't nim created in 2005? Yardanico: @codic that comment also replaces some procs with templates, although I'm not really sure that it's neccessary either Yardanico: @codic first public release in 2008 FromDiscord_: Yeah, but I think that's for whitespace at the end, not at the beginning FromDiscord_: Ahh, okay FromDiscord_: Still FromDiscord_: A 12 year old language is pretty old Yardanico: no big corporate backing FromDiscord_: True I guess FromDiscord_: then also many people dont seem to like some of the features FromDiscord_: like which ones? FromDiscord_: whitespace instead of braces, semi case-insensitivity Yardanico: well you can write pRoC a = echo "hi" but no one does that :P FromDiscord_: That's cool FromDiscord_: I should now write Yardanico: mostly case insensitivity is used for snake_case vs camelCase Yardanico: so if someone has a lib in snake_case you can use it as camelCase FromDiscord_: ```nim FromDiscord_: pROc a(b: INT, c: INT) = FromDiscord_: return b + c FromDiscord_: ECHO "TEST" FromDiscord_: ``` Yardanico: pls don't paste stuff in discord dom96: two main criticisms are always: style insensitivity and how module imports work by default Yardanico: currently in IRC it looks bad :( FromDiscord_: Am I allowed to go that far? FromDiscord_: I didn't paste anything Yardanico: @dom96 the latter is probably because these people are coming from python dom96: three lines is fine, just don't paste 50 FromDiscord_: Erm.... FromDiscord_: Okay FromDiscord_: Ohhh I see what you mean hahha FromDiscord_: Ohhh I see what you mean haha Yardanico: don't edit either :P really need to get that ircord done FromDiscord_: tfw discord too modern for irc FromDiscord_: smh smh dom96: IRC is too cool for Discord :P Faulander: hey guys, has someone created a epub out of the official manual by any chance? I need it with me on my ebook reader :) Yardanico: yeah, discord doesn't even support colored messages smh FromDiscord_: does it have to be epub? does your e-reader not work with pdf? FromDiscord_: @Yardanico I'll answer your question later because im gonna have a shower FromDiscord_: it'd be a pretty shitty e-reader to not work with pdf Faulander: it works with pdf, but epubs are WAY better. i won't go into details here, but pdf doesn't scale well. Yardanico: find some html -> epub tool I guess? Faulander: haha, i can do it no problem. i just wanted to know if someone already did :) Faulander: (and maybe make a lib out of it, practising my nim knowledge) dom96: search around, this was done before IIRC Faulander: kk Faulander: bzw. just wrote my 1000 line of nim code (yay!) and only one program left to convert from python to nim. Faulander: and i bought your book dom, its pretty good. dom96: yay, thanks for getting a copy :) FromDiscord_: > IRC is too cool for Discord :P FromDiscord_: nope, matrix best Yardanico: too much centralization, people talked about this in nim-offtopic I think Yardanico: the most popular matrix server is matrix.org and it's really overloaded Yardanico: so it's not that fast dom96: lol Matrix sucks FromDiscord_: matrix.org sucks FromDiscord_: but there are other nice servers dom96: All I see is netsplits from it FromDiscord_: like privacytools.io Yardanico: @dom96 that's thanks for the JS-powered matrix bridge bot dom96: Although to be fair, I never actually used it FromDiscord_: Does nim have a type like Go's `interface{}`, basically satisfying every type? That way, assuming it was called `any`, I could make a `seq[any]` FromDiscord_: ll FromDiscord_: Lol Yardanico: @codic that's not really possible FromDiscord_: Aww dom96: codic: seq[RootObject] but then you need to use inheritance which sucks FromDiscord_: What do you mean, I have to use inheritance? dom96: what are you trying to do? dom96: FooBar = object of RootObject FromDiscord_: create a dynamic array which can hold any sort of type (ik, I'm stupid) dom96: and then you can store FooBar in that seq or any other type that inherits from RootObject FromDiscord_: in this case, i'm trying to use a sequence alehander92: codic i dont really think you can do that FromDiscord_: ah dom96: right, but why do you need this? alehander92: because e.g. ints are not boxed FromDiscord_: for being stupid dom96: what is your concrete use case? FromDiscord_: Let's assume that I have an array of user input from a website or something alehander92: is it like json FromDiscord_: Some of the input may be ints, others may be strings, so on Yardanico: it's just that different languages have different ways of dealing with problems Yardanico: @codic use object variants alehander92: you can use case objects `codic` alehander92: yeah , the same FromDiscord_: true, i agree Yardanico: or json module (it can be used for boxing different kinds of variables) FromDiscord_: I have no idea how to use object variants, the docs don't explain much alehander92: which languages have you used before FromDiscord_: oh, json does seem like a good idea Yardanico: and unless you convert it to string the inner representation won't be json at all FromDiscord_: python, ruby, go, and kotlin Yardanico: json in nim is implemented using object variants too Yardanico: https://nim-lang.org/docs/json.html#JsonNodeObj FromDiscord_: that's actually a good idea alehander92: ok they are something like sealed classes in kotlin from what i read dom96: yeah, json is a good example dom96: you can copy the object variant used there as an example dom96: or just use JsonNode directly alehander92: i really want to add something like patty's variant constructor alehander92: to stdlib or fusion alehander92: now with type pragmas alehander92: this should be easier : just writing `A {.sum.} = object .. Int(a: int) String(text: string) Other(b: seq[A])` etc Faulander: codic is missing pythons list i think. i used that extensively aswell, slow but comfortable. alehander92: yeah, but no alehander92: `seq` is list, he is missing isinstance and duck typing imho alehander92: but one usually doesnt really need that Faulander: seq is one type only, lists are not alehander92: but this isnt about seq ;) alehander92: its about all nim collections Yardanico: Faulander: seq *is* a list alehander92: they all are typed alehander92: but you usually use just several kinds of values, so you can just wrap them in case objects alehander92: its about `any` vs sum type/case objects vs traditional typed value alehander92: not about seq vs list alehander92: you can also use two types only in Table and many in dict, one in set and many in python set Faulander: i am way too pragmatic, i just converted everything to json if i needed it :) Yardanico: it's fine alehander92: that works sometimes too :P Yardanico: unless you convert a JsonNode to string it won't be stored as JSON inside of memory Yardanico: it'll be just stored as object variants FromDiscord_: So uh, anyone figured out how to have any type in a sequence? :P Yardanico: as we said, use object variants instead Yardanico: or inheritance FromDiscord_: Which way would be better suited for being passed a Python list? alehander92: probably variants imho alehander92: but you really have to look inside nimpy a bit alehander92: i am sure internally it should be able to work with a more general type somehow FromDiscord_: Okay then FromDiscord_: Thanks madpata: Good evening, why doesn't this (https://play.nim-lang.org/#ix=2jmI) throw an "ambiguous call" error? Both the member callback and the proc could be called. Will it always be like this or is there somewhere I can read up on nim's ufcs? alehander92: ok man i looked alehander92: `toJson` can help you maybe Technicae alehander92: https://github.com/yglukhov/nimpy/blob/master/nimpy.nim#L1176 solitudesf: object fields have priority, but idk if its specified in manual alehander92: it does https://github.com/yglukhov/nimpy/blob/master/nimpy.nim#L725 madpata: It makes sense that object fields have priority. Do you know if there's a compiler flag to emit a warning? Just curious because this behaviour could lead to subtle bugs. FromDiscord_: yup I'm missing python's list FromDiscord_: i found a solution: to not be stupid FromDiscord_: (aka convert everything to a string before making a seq) shashlick: use json Faulander: i knew it, i came over from python also a week ago, been there, done that ;) Faulander: covert to str and use seq if type doesn't matter, or use json (as i did) codic: Lol codic: Yeah, I can always convert the types back, that seems like the easiest solution shashlick: won't last for long codic: why? shashlick: better to be disciplined about types, I transitioned and code is a lot cleaner FromDiscord_: small brain: use object variants FromDiscord_: big brain: serialize to string, deserialize when needed codic: 🤔 shashlick: i don't miss random failures due to python types FromDiscord_: (i am joking) codic: oh FromDiscord_: please do not do what i jsut said codic: Yeah, but I don't get how I would use object variants codic: lol codic: ~~i'm doing it~~ FromDiscord_: its just "if field has this value, the other fields are these and have these types, else this is that etc etc" Faulander: yeah, answers here are sometimes too, well perfect. takes some time to recognize the beauty in most of them (if you even understand the words) codic: No, I literally don't understand how to use em haha Faulander: yeah, i still have the problem all the time: i do understand it conceptually, but cannot implement it :) Faulander: nim-playground helps alot ... try it out and post the link here if you're stuck. then you probably get the help you need. Yardanico: codic: you store an object variant in a sequence, and then where you need to process it you do different stuff based on the kind of that object variant Yardanico: with case statements usually (if also works but case statements are better since they check for exhaustion) madpata: @codic @Faulander The Nim manual has a section on object variants (https://nim-lang.org/docs/manual.html) Yardanico: https://nim-lang.org/docs/manual.html#types-object-variants FromDiscord_: @Yardanico, I haven't tested a bot running for days or weeks, but if you put your computer to sleep for long periods of time the library will manually throw an error, I'm planning on maybe just do a hard reset. Yardanico: well I'm asking for ircord Yardanico: which is an IRC<->Discord bridge codic: i saw the manual, it doesn't explain it codic: Could anyone show an example? codic: (yes, i'm on matrix now because it beats both discord and irc) Yardanico: codic: example of what? Faulander: ok, i came so far as to create this: https://play.nim-lang.org/#ix=2jmX Yardanico: JSON itself uses object variants for example codic: Of object variants codic: Ah, thanks Faulander! Faulander: how do i group different nodes together? Yardanico: Faulander: just create a normal seq Yardanico: seq[Node] Yardanico: nim compiler itself uses object variants for AST Yardanico: https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim#L723 codic: alright. so from what I can tell, an object variant is a type of key val pair? Yardanico: codic: not really Yardanico: it's an object with a special field for determining the object kind Yardanico: and depending on that kind the object might have different fields "activated" Yardanico: you can google "tagged union" Yardanico: https://en.wikipedia.org/wiki/Tagged_union there's a nim example here too codic: ah. could it not also be used for key val? Yardanico: codic: not for arbitrary key/val Yardanico: it's declared in your source code Yardanico: for arbitrary key/val just use "json" module or something like that I guess codic: that's true codic: Why not tables? Yardanico: or just do TableRef[string, MyObj] where string is the key and MyObj is your object variant codic: Why not a regular table, without any object variants? codic: 😛 Yardanico: if you need string->string mapping, ok Yardanico: if you need actual types - object variants codic: ah k, thanks Yardanico: there's also "strtabs" module for string tables specifically codic: I really think that I should understand other concepts of Nim before going into object variants... 😅 codic: ah Faulander: codic: this should get you going: https://play.nim-lang.org/#ix=2jmX codic: Yeah, I saw that Yardanico: https://github.com/nim-lang/irc/blob/master/src/irc.nim#L85 for another example Faulander: oops, my code vanished Faulander: i wrote a complete example :) codic: oh haha codic: Oof, "long message" Yardanico: it's fine codic: But why double ticks? Yardanico: for documentation codic: For comments Faulander: now: https://play.nim-lang.org/#ix=2jmZ Yardanico: nim has automatic documentation generator Yardanico: and it's RST codic: For example: "the ``kind`` field is the discriminator" FromDiscord_: 👍 that's great Yardanico: see https://nim-lang.org/docs/tables.html#%5B%5D%2CTable%5BA%2CB%5D%2CA_2 Yardanico: t[key] here is in a different font Yardanico: and if you go to https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/collections/tables.nim#L364 it uses double ticks for that codic: Ohhhhh codic: Why not follow single backticks, like the markdown convention? Yardanico: RST is not markdown codic: oh rst codic: Ignore me codic: i'm stupid, sorry 😅 Yardanico: also see https://forum.nim-lang.org/t/4280 Yardanico: the main problem is that literally all nim documentation already uses RST Faulander: its so funny, you are where i was a week ago. Faulander: i asked almost the same questions companion_cube: I think pandoc can convert from rst to markdown companion_cube: but it might be lossy :( Faulander: i use mddoc Faulander: https://github.com/faulander/nimQBittorrent (this is done with mddoc) Yardanico: "METHODS" ? Yardanico: they're procs :P Faulander: remember: one week! ;) Faulander: and methods is understood no matter what language you're used to! :) codic: but functions codic: func = proc codic: lol Yardanico: codic: Yardanico: no Yardanico: func in nim is different from proc codic: Oh? Yardanico: and it's actually the better meaning than in most other languages codic: Someone said it was an alias for proc Yardanico: it's not Yardanico: https://nim-lang.org/docs/manual.html#procedures-func Yardanico: it's an alias for proc with {.noSideEffects.} pragma Yardanico: *noSideEffect Yardanico: and about this pragma - https://nim-lang.org/docs/manual.html#pragmas-nosideeffect-pragma codic: ah, what does that pragma do? Faulander: thats all not needed, i wrote a library, even used macros and templates and don't know nothing about all that ;) It will all come with time, just start coding. FromDiscord_: Is proc better then func? Yardanico: it's not "better" Yardanico: they're just different Yardanico: "func" is just an alias for proc with noSideEffect pragma so you can have less verbosity in your code :P codic: so if you had `func a() = echo 'test'` codic: That'd be the same as Yardanico: that won't work Yardanico: echo has side effects FromDiscord_: Oh? Yardanico: read https://nim-lang.org/docs/manual.html#pragmas-nosideeffect-pragma again :P Yardanico: "echo" has an IO side effect Yardanico: debugEcho is the one which can be used in "func" routines, but only for debugging really codic: `proc a(): {.noSideEffects.} = echo 'test'` FromDiscord_: So proc would be a bit better for general use cases? Yardanico: codic: yeah that would be around the same codic: Ah, so func isn't really needed? Yardanico: codic: it's just sugar Yardanico: @Technicae Circuit if you don't modify global variables or stuff you can use func to explicitly state so nisstyre: it adds some optimization opportunities right? Yardanico: nim also has stuff like effects/tags tracking nisstyre: like you can safely assume that f(1) == f(1) always solitudesf: no, its just more static checks codic: So there wouldn't be a need for it for an average usecase Yardanico: https://nim-lang.org/docs/manual.html#effect-system codic: ah solitudesf: you cant really assume that, since you can override sideeffect tracking nisstyre: then what's the point of having pure functions? codic: well, for most use cases Yardanico: nisstyre: if you want to :P nisstyre: Yardanico: I know but what's the point of indicating to the compiler that they're pure? Yardanico: I personally almost never use func (and noSideEffect pragma itself), because it's not that useful for me solitudesf: to ensure thay your code is side effect free Yardanico: nisstyre: they're not "pure" in the mathematical sense either nisstyre: ok, side effect free solitudesf: to accidentally not introduce side effect? Yardanico: yeah that nisstyre: I guess that's fair codic: import sugar, sequtils codic: echo @[1,2,3].map((t)=>t*2) # ==> [2,4,6]?? Yardanico: ? alehander92: it can still help you check you havent used globals or IO or stuff like that codic: lol FromDiscord_: Would that work? alehander92: basically if you can use func, use func, if not proc Yardanico: !eval import sugar, sequtils; echo @[1,2,3].map((t)=>t*2) alehander92: similar with let and var alehander92: i think NimBot: @[2, 4, 6] Yardanico: there's also mapIt though alehander92: not that i do it .. but it seems as a good practice FromDiscord_: yeah, yay Yardanico: !eval import sequtils; echo @[1, 2, 3].mapIt(it * 2) NimBot: @[2, 4, 6] codic: !eval echo "TEST HELLO WORLD" NimBot: TEST HELLO WORLD Yardanico: !lag NimBot: 16ms between me and the server. FromDiscord_: Pretty cool FromDiscord_: Let's see if it works from discord FromDiscord_: !eval echo "TEST" Yardanico: it does NimBot: TEST FromDiscord_: oh, nice Yardanico: it just uses play.nim-lang.org for code compilation btw FromDiscord_: but less latency with matrix FromDiscord_: ah, good way to sandbox Yardanico: well nim doesn't have a real "eval" anyway Yardanico: at runtime I mean FromDiscord_: yeah, it's a compiled language, makes sense Yardanico: although you can use compiler as a library xd alehander92: it kinda can have it if you import the nimscript alehander92: yeah alehander92: but its limited FromDiscord_: !eval write(stdout, "Does this support input? "); echo(readLine(stdin)) NimBot: /usercode/in.nim(1) in↵/playground/nim/lib/system/io.nim(365) readLine↵/playground/nim/lib/system/io.nim(141) raiseEOF↵Error: unhandled exception: EOF reached [EOFError]↵Does this support input? FromDiscord_: Welp FromDiscord_: ") FromDiscord_: :( Yardanico: how would it though? Yardanico: there's also nim on https://godbolt.org/ Yardanico: and on a few other "online repl" websites FromDiscord_: yeah, like repl.it FromDiscord_: I dont know Yardanico: on other note, nim really has A LOT of different features and modules in stdlib, and some of them are underused but cool Yardanico: like https://github.com/Yardanico/nim-strenc uses term-rewriting macros Yardanico: https://github.com/Yardanico/nim-strenc/blob/master/src/strenc.nim FromDiscord_: I hqve never understood why macros qre needed, tbh Yardanico: macros are needed to create DSLs and stuff Yardanico: nim async itself is done via macros Yardanico: async in nim* FromDiscord_: Ah,ok Yardanico: you can really do a lot of stuff with macros, A LOT :P Yardanico: as long as some code is valid nim syntax you can use handle it in macros FromDiscord_: Great! alehander92: if you want to make random syntax does stuff alehander92: you can use macros alehander92: makes syntax go brrr alehander92: probably not a good meme.. FromDiscord_: its a good meme FromDiscord_: i rate it an 8/10 FromDiscord_: "NOO YOU CANT JUST CHANGE SYNTAX ALL WILLY NILLY LIKE THAT" FromDiscord_: "haha macro system go brrr" FromDiscord_: how do I represent a C void* in Nim? Yardanico: "pointer" Yardanico: @Rika well you can't really change "syntax" Yardanico: "While macros enable advanced compile-time code transformations, they cannot change Nim's syntax. However, this is no real restriction because Nim's syntax is flexible enough anyway." Yardanico: because if some code isn't valid nim syntax you wouldn't be able to make AST for it Yardanico: but for example it just happens that almost all of Python syntax is also valid nim syntax :P disruptek: should default() behave static? FromDiscord_: Yardanico: its just a meme, and in other languages, macros can change syntax Yardanico: what languages? Yardanico: lisp family languages don't really have syntax FromDiscord_: i dont know, i heard lisp can Yardanico: and in other languages you can't really change syntax FromDiscord_: i mean FromDiscord_: thats a technicality Faulander: i tried to wrap my head around lisp in school, 30 years ago, my professor was a hardcore lisp fan. this is too abstract for me to understand. Yardanico: Faulander: well I tried scheme a bit and it's not that complicated FromDiscord_: Faulander: Play around with Emacs; I'm not kidding. Elisp is not the best implementation of a Maclisp-like out there but certainly had a TON of fun messingabout with it in my mid-to-late teens. Emacs, more than anything else, pushed my interest into STEM -- in my 'formative years'. lol Faulander: it was more than 30 years ago, back then i was more interested in assembler than anything else. FromDiscord_: I mean, fair-enough; I just don't vibe with the notion of it 'being too abstract' -- I find it more likely there just wasn't a killer-app / driven purpose to learn it. :^P Faulander: assembler isn't abstract, this i can understand. the "higher" languages never appealed as much to me as assembler. Faulander: at least back then, assembler was put to good use in my *cough* not so legal activities *cough* Yardanico: hacks? bung87: I thought higher language is more easier to understand ,right? Faulander: replace the h with a cr ;) Yardanico: well the same mostly :P Yardanico: @bung87 well it depends really FromDiscord_: @bung87 I think the argument is that literally "it's straight-foward" to what the machine's actual instructions are and not hidden between semantics / keywords? bung87: I starting programming from js Faulander: it depends on the wiring of your mind ... for me assembler - at least the old 8bit ones - is much, much easier to understand. Yardanico: well yeah Yardanico: but x86 and x86_64 literally have hundreds of instructions FromDiscord_: oh man i used to hack mobile games so i had to understand arm assembly Faulander: thats why i clearly said "8bit" :D bung87: hmm I got your point. FromDiscord_: Oh, actual Nim question! Godot-nim seems to be relatively complete -- but I can't find any demos / examples anywhere; Am I missing something or has this just not been a focus? FromDiscord_: its not really a focus i dont think, i rarely see questions about it here Yardanico: well the company which created godot-nim use it for their in-house game Yardanico: they've made UE4 bindings before but then decided that Godot was a better fit for their 2D game Yardanico: there's a simple example here https://github.com/pragmagic/godot-nim-stub FromDiscord_: Ah, so there's no real incentive to provide 3rd-party examples when they're dogfooding a game themselves? That's fair-enough I guess FromDiscord_: Also, cool will check that out FromDiscord_: Nim seems like such an obvious choice for a gamedev language; that it's crazy I don't see more hype behind it here -- I remember there being frag a few years ago, when I first checked the ecosystem; but seems to have died since FromDiscord_: to my knowledge, godot-nim is still not working, ue4 nim is outdated and we only have bare opengl vulkan and sdl2 Yardanico: wdym "godot-nim is still not working"? FromDiscord_: last time i tried using it it didnt work Yardanico: well maybe you did something wrong :P Yardanico: and we have SFML bindings too Araq: fork it, make it work, create a PR so that it's an "important package" awr1: hello FromDiscord_: There seems to of been 58 'releases' on their github; But hasn't really been touched in 3 months -- I would assume it was relatively mature at this point (that they don't need constant pushes to it)? Yardanico: https://github.com/search?o=desc&q=language%3Anim+game&s=stars&type=Repositories awr1: RE first languages: TI-BASIC was my first Yardanico: also see https://github.com/Vladar4/nimgame2 FromDiscord_: Araq, its easy to say, but i am more or less newbie to nim yet FromDiscord_: The name, it pains me lol FromDiscord_: 'nimgame2' Yardanico: seems okay for me FromDiscord_: about SFML, cant we make nim appear in here? https://www.sfml-dev.org/download/bindings.php Yardanico: not really Yardanico: ah wait martinium: Hello everyone Yardanico: it's already there martinium: Happy Friday FromDiscord_: Yardanico: good call, im so blind kungtotte: My first language was the homegrown scripting language for the game Operation Flashpoint. It had a ternary operator and goto as its only control flow mechanisms FromDiscord_: martinium hi Yardanico: it wasn't updated in 17 months but it shouldn't be hard to update it to whatever the last SFML release is https://github.com/oprypin/nim-csfml FromDiscord_: kungtotte, ouch Araq: hmm I'm a compiler dev and found a recursion algorithm where I'm unable to eliminate the recursion Araq: *recursive algorithm Araq: I think I'm a bad compiler writer. FromDiscord_: facts say you are not though martinium: great compiler devs always think they are terrible compiler devs Yardanico: i always think that all compiler devs are great :P FromDiscord_: great (insert skill 1) people think they are terrible (insert skill 1) people martinium: Araq, where you get started with compiler dev stuff? College? Yardanico: university maybe? kungtotte: Rika, yeah it was Good Times(tm). You wrote code like ? (somecondition) : goto "true_label" bung87: guess TI-BASIC and flash guys are not young Yardanico: kungtotte: that's still not the worst I guess kungtotte: Oh it's not the worst, but it was pretty terrible kungtotte: You made "blocks" by beginning with a label, then write your code, and end with a goto "continue" Araq: university but I wrote interpreters with 18 fwiw kungtotte: If you missed that last goto it would just keep going kungtotte: Also no looping constructs kungtotte: So loops were written like #loop; code here; sleep 0.1; goto "loop" companion_cube: Araq: derecursification is a thing, but ugly af FromDiscord_: isnt "goto firstlabel" essentially a looping construct companion_cube: (sorry, I imagineyou know it better than me) kungtotte: The sleep was necessary because it had no concept onf scheduling or threads, so without the sleep it would just pin the CPU and bog the game down kungtotte: Rika, right, I meant it had no for/while or anything like that. You rolled your own loops Araq: well I can translate it into push/pop opcodes and a virtual machine, companion_cube ;-) FromDiscord_: man that legit sounds awful awr1: way back in my high school math classes, i understood the math but was always messy with my arithmetic (forgetting to do a certain operation, etc.) so I made programs on my TI-84 and learned how to use the internal BASIC interpreter to automate a lot of the more annoying stuff in trigonometry, etc. TI-BASIC was crappy but it was insanely useful kungtotte: People wrote really complicated stuff in that language. They eventually replaced it with a better version that had things like functions, if/then/else, and for/while awr1: and now i (well, almost, i'm just waiting for it in the mail at this point) have a diploma for a bachelors in CS, so thank you TI-BASIC Araq: kungtotte: if/then/else and for/while? you mean they added language features and the language became easier to use? but what about that "perfection is when you cannot remove features" and "less is more"? heresy, we should all use languages without features ;-) kungtotte: Araq: it was more about removing footguns :P I don't mind goto, except when it's the -only- control flow option :P Araq: after all, what if somebody smarter than you comes along and uses these features to their full capacity... the horror. FromDiscord_: Yaradinco: `Invalid GODOT_BIN path: C:\Users\porra\OneDrive\Escritorio\Godot_v3.1.2-stable_win64.exe` Yardanico: try not to use OneDrive I guess Yardanico: and try to remove _ :P FromDiscord_: that came by default Araq: fix the damn build so that it doesn't use environment variables, so annoying disruptek: is enum position variant for enums with holes? disruptek: enum.sym.position ... Yardanico: Araq: well it uses that to generate API Yardanico: https://github.com/pragmagic/godot-nim/blob/master/godot/godotapigen.nim Araq: disruptek: e.position it its ordinal value Yardanico: it gets JSON api description from that godot binary and uses it Araq: oh not that again Araq: don't generate Nim code on the user's machine, it makes QA impossible... Araq: generate it on your machine and push the Nim code to github. ffs... disruptek: thanks. FromDiscord_: https://play.nim-lang.org/#ix=2jon how is this looking? FromDiscord_: im not sure if i got generics & shit correctly FromDiscord_: hol up FromDiscord_: nvm FromDiscord_: (the question is still up) :P leorize: I'm seeing capitalized proc names leorize: and non type-safe conversions? leorize: casting* FromDiscord_: about capitalized, im just transpiling as 1:1 as i can :p FromDiscord_: about casting, how would you? narimiran: don't. Yardanico: it depends on what you want to do FromDiscord_: this are flatbuffers leorize: without seeing the original code, I can't comment on this leorize: but I'm pretty sure that some casts here are just plain wrong leorize: at least with the unconstrained generics FromDiscord_: https://github.com/google/flatbuffers/blob/master/go/encode.go from line 135 to the end, the point is to make them generics FromDiscord_: also, i was told byte operations are not efficient. leorize: yea this is completely wrong, sorry leorize: wdym by bytes operations not efficient? FromDiscord_: shl and shr FromDiscord_: whats wrong though? leorize: they are efficient? leorize: but shl works on bits, not bytes FromDiscord_: bits sorry :P leorize: what do you expect WriteVal to do? Yardanico: operations on bits are as efficient as they can be Yardanico: also see https://github.com/Skrylar/skflatbuffers Yardanico: https://github.com/Skrylar/skflatbuffers/blob/master/skflatbuffer.nim leorize: skrylar[m] cracked this long ago? damn :P FromDiscord_: this is what the flatbuffers for c creator told me: FromDiscord_: > If you don't care about performance, you can easily use byte shift operations to have endian neutral behaviour, but you likely don't want that. narimiran: leorize: while you're here, maybe you know: how do i escape `'` in init.vim? leorize: byte shift is definitely not the same as bit shifts leorize: narimiran: wdym by escape? leorize: in a string? leorize: then you don't have to? FromDiscord_: i know very little about them, forgive my ignorance narimiran: leorize: i have something like `'foo': 'bar'`, and i want to have `'foo': '\'bar'` leorize: I don't know much either leorize: Recruit_main707: though I think he was talking about bit shifts leorize: gotta look up real quick leorize: narimiran: "'bar"? leorize: or if you like it the pascal way: '''bar' narimiran: wait, are you telling me that double quotes just work?? why didn't i try that?? FromDiscord_: '\'bar' shouldnt this also work though? narimiran: (is that a 3x single quote in the second example?) FromDiscord_: damm it discord leorize: narimiran: yes narimiran: `'\'bar'` doesn't work narimiran: thanks, let me try if i can make it work.... liblq-dev: leorize: nim.nvim is highlighting NPeg's fail() both as an error and as a template… lol leorize: Recruit_main707: idk, bitshifting is as efficent as it can be leorize: liblq-dev: don't blame me :P blame the compiler liblq-dev: not blaming you ofc, it's nimsuggest FromDiscord_: leorize: its not a viable solution for generics though :P leorize: wdym? :P FromDiscord_: if you want the lame question: FromDiscord_: how can i make all of those Write... functions in Nim (with generics) leorize: ah, I get what that guy mean now narimiran: leorize: yep, that will work! thanks!! FromDiscord_: Is there a way to get the compiler to print warnings for exceptions that aren't handled? Yardanico: yes Yardanico: but it will error instead though :P Yardanico: add {.raises: [].} to a proc definition or something else dom96: how's everybody doing? Yardanico: and compiler will error if some exception can be raised dom96: After doing some research I think I'm going to try and implement spatial hashing for my game FromDiscord_: leorize: u there? leorize: yea I figured out an efficient way but it's not pretty, mind you Yardanico: you can use Yardanico: !seen leorize disbot: leorize spoke in 12#nim 2 seconds ago Yardanico: hm Yardanico: !help FromDiscord_: id rather have a fast and ugly solution than an slow one leorize: to be fair, "slow" is an overstatement leorize: in typical usage, you'd not even notice leorize: you gotta do actual benchmarks to see how "slow" or "fast" this is FromDiscord_: Raises works well, but what about standard library functions? Ie writing to a file FromDiscord_: Ah yes, premature optimization FromDiscord_: https://tenor.com/view/iwanna-see-it-show-me-let-me-see-iwant-to-see-big-boi-gif-13800468 leorize: Recruit_main707: here's the "optimized" one. tbf you should compare it with a normal one to see if this is even an optimization: https://play.nim-lang.org/#ix=2jox leorize: without comparision this might just be an overcomplicated way to implement this FromDiscord_: it does look ugly, but seems pretty good if we ignore that leorize: this is as efficient as I can think of in theory FromDiscord_: Might not be worth the maintenance cost for the performance if gains FromDiscord_: It* leorize: if you want "super micro optimization", you gotta pull out the profiler and instrument the individual instructions themselves FromDiscord_: Rika: this wont be changed in a long time leorize: that's just writeval leorize: you gotta implement getval yourself FromDiscord_: get val wont work already?? leorize: nope leorize: you implemented it wrong :P FromDiscord_: gimme a little clue pls leorize: you don't `cast` a `seq` leorize: it's not a byte buffer FromDiscord_: and an openArray? leorize: the seq contains more than just the byte buffer I mean leorize: same thing applies here leorize: just see how I implemented WriteVal FromDiscord_: hmmm, so its not gonna be that easy :P FromDiscord_: yeah, its basically applying the same but as getter FromDiscord_: thank you leorize[m]: https://godbolt.org/z/zedYJO leorize[m]: yep, this really is as efficient as it gets, on an x86 FromDiscord_: nice Yardanico: leorize[m]: seems like it got inlined? Yardanico: nice Yardanico: ah Yardanico: {.inline.} leorize: took literally 0 instructions :) Yardanico: no code - most performant code dom96: Researching this more I appear to already be using a spatial hash. lol. FromDiscord_: leorize: Something I found out about Godbolt - it doesn't do linking, so any external functions get the odd "lea eax [rip+0x0]" and similar. leorize: in the "options" menu it has the button to make it generate executable FromDiscord_: leorize: I think that just runs the binary, it doesn't affect the assembly output. I still find `lea rdi,[rip+0x0] ` littered throughout the code, which doesn't match up with what I see from objdump locally leorize: well I activated "compile to binary" and I see `call` all over the place :P FromDiscord_: Yeah, but do you see any calls to things like `echo`? leorize: I do see calls, but it calls some arbritary address instead leorize: also we don't have line correspondance with the asm here FromDiscord_: If you use --linedir:on --debugger:native you get a (fairly inaccurate) asseembly map FromDiscord_: You can make it slightly more accurate by puttin 2-3 blank lines between all lines containing actual code. FromDiscord_: Anyone know what needs to be passed to the compiler to dump the generated code of async procedures? disruptek: expandMacros shashlick: disruptek: wanted to discuss the plugins issue with nimterop disruptek: what? disruptek: plugins? shashlick: the nimph issue where nimcache / nimblePath / path don't get passed to the plugin compile step disruptek: what do you propose? shashlick: so i was thinking about the design shashlick: we have std/compilesettings from which I can get nimcache, nimblePaths and lazyPaths shashlick: but i have no way to know if this is default values or if they are custom for that call disruptek: what does that mean? disruptek: what's the difference? disruptek: these are values set by the configuration, wherever it may occur, right? shashlick: it means either I always propagate what i got even if nothing was changed from defaults or i run a nim dump and diff the changes disruptek: i guess maybe you load the nim.cfg from the compiler to determine the "defaults", but it's hacky. shashlick: i can run nim dump in json and get all the info i need but will have to do that diff disruptek: i dunno what you mean by "propogate what i got" shashlick: another thing is that if you use the cImport() method, I know the nim flags received and can forward it to toast disruptek: you are trying to reuse the cache if no settings changed? shashlick: so when you call nim c wrapper.nim, it picks up the flags shashlick: then the wrapper calls toast behind the scenes with CLI arguments shashlick: toast now might need to compile a plugin behind the scens shashlick: https://github.com/nimterop/nimterop/blob/master/nimterop/getters.nim#L720 shashlick: that's the step that breaks since toast just runs nim as if no local deps were detected shashlick: and since it is in nimcache, there's no nim.cfg in effect shashlick: so I need to detect the correct flags in wrapper.nim, forward to toast who will forward it back to nim shashlick: but this design does not solve the issue when you just run toast directly shashlick: that will still fail unless toast is made smart enough to figure this out shashlick: considering you have nim.cfg functionality within nimph, was wondering what your thoughts were around this disruptek: toast could learn how to parse the config too, i guess. disruptek: i mean, this is what tools do. shashlick: note also that wrapper.nim (in $projectDir) then imports cimport.nim which is in the deps directory which calls toast which calls nim on some file in nimcache shashlick: so we have to pass projectDir context all the way even in that case disruptek: i understand your wrapper.nim solution. that sounds workable to me, but still pretty brittle compared to including the code post-generation. disruptek: the projectDir context gets picked up fine toast is local to it -- inside it. shashlick: and nim doesn't make currentDir reliable to know projectDir settings i should be referring to shashlick: in localdeps mode yes, but the same design has to work in ~/.nimble/pkgs mode as well FromDiscord_: rayman22201: Are you around? disruptek: it already works in pkgs mode, right? shashlick: ya but how does toast know it isn't in localdeps mode disruptek: pkgs mode is that same mode. what matters is where you are located; nim picks up env settings from the env. shashlick: or in some $NIMBLE_DIR or other nim.cfg mode disruptek: localdeps mode /is/ nimble mode as far as the compiler is concerned. disruptek: they are all the same. disruptek: to pretend otherwise is to make life hard. shashlick: how about this - when toast runs, it checks where it is - if it is in ~/.nimble/pkgs then it runs per usual disruptek: i'm trying to tell you that your model doesn't match reality. disruptek: you're asking me to choose how to cover my eyes. shashlick: what do you propose shashlick: i'm telling you the challenges disruptek: can you think of a good reason not to do it the way i do it? disruptek: because i chose my design for a reason. shashlick: i don't know your design which is why i'm asking you disruptek: my design is to emulate the compiler in all evaluations of the env. disruptek: thus, whatever works in the compiler, works in nimph. shashlick: a) I need to know what $projectdir is and b) evaluate it disruptek: nim dump disruptek: to find the project dir itself, i search cwd and up. disruptek: i try to find one and only one .nimble file. disruptek: first one found, bam, that's my project dir. shashlick: if a user runs toast in or within project dir, i can figure that out, sure but i do not know which file is the main.nim cause that's not what you pass to toast shashlick: do you need main.nim? disruptek: nah. disruptek: do you need main.nim? shashlick: cause i noticed `nim dump .` does something different from `nim dump main.nim` shashlick: i don't for toast, it is operating on C headers disruptek: nim dump some.nim will also eval some.nim.cfg disruptek: it may set other paths. shashlick: you run just `nim dump .`? disruptek: see `findPrefixDir` in src/nimph/config.nim disruptek: i dump it in json with a dummy target file. shashlick: okay so then i can build that into toast - it can do the same and get the env info and propagate it to the plugin compilation rayman22201: Varriount what's up? disruptek: it's annoying, right? shashlick: on the command line, user would typically run it in the project dir - if not, toast can grumble that it's not in a project directory shashlick: when run through cImport, i can pass the project directory to toast as a CLI param so it knows the context shashlick: do you have code detecting .nimble as well? disruptek: yeah; from bump. disruptek: nimph is a little smarter because it knows how to follow link files. shashlick: i'd rather have just depended on nimph for this but considering nimph is depending on nimterop, not possible disruptek: maybe we make a pmtools lib. shashlick: that'll be awesome shashlick: get nimble to use it as well eventually FromDiscord_: dom96: In code generated from async procedures, what is the purpose of the AsynCcontinue closure? disruptek: probably nimterop /could/ depend on nimph. shashlick: anyway, 2 things i need - figure out where .nimble is for project dir and the nim dump parsing which you pointed to already dom96: Varriount: to continue the async iterator AFAIK dom96: *IIRC disruptek: the .nimble finder is bump.findTarget("some directory", target = "optional package name") disruptek: returns tuple[message: string; found: Option[Target]] dom96: shashlick, disruptek: pretty sure Nimble has functionality, why aren't you depending on it? disruptek: Target is a repo, package, ext: string tuple. disruptek: because i'm a comedian and not a clown. shashlick: dom96: nimble doesn't parse nim.cfg to figure out if user overrides nimcache, paths, nimbleDir and other stuff shashlick: now i'm wondering why i added compilesettings if nim dump is the solution anyway dom96: sure, but it can find the .nimble file for you disruptek: i doubt it works from any subdirectory. dom96: *shrug* dom96: The point is: use what's there and improve it instead of making a pmtools package and then getting Nimble to depend on it disruptek: you're right; they both sound like silly ideas. shashlick: what does nimph use from bump? disruptek: the target stuff, the version stuff. shashlick: so you created linkedFindTarget in nimph that uses findTarget from bump? disruptek: yeah, probably. shashlick: would you consider moving it to bump? disruptek: bump doesn't need to know about it, but, i dunno, maybe. disruptek: can it be moved? shashlick: on the flip side, does even nimterop? shashlick: what's the case for searching through link files? disruptek: nimterop can just import from nimph. disruptek: because it helps me find the actual repo for a package. disruptek: this is something that the compiler does, so i do it too. disruptek: i think i was gonna use the compiler code for it by my stuff was simpler. shashlick: i import compiler into toast anyway, where is this in compiler? it doesn't look for nimble files does it disruptek: it has to follow link files. shashlick: ah FromDiscord_: whats the process behind cast? disruptek: treat memory like the dirty memory it is. disruptek: load the bullets into your foot-shooter and go to town. FromDiscord_: its because leorize told me i couldnt just cast a deq[byte] into a type, but i dont know how would you do that FromDiscord_: seq* FromDiscord_: ive been thinking how for almost an hour now 😅 but i dont know shashlick: what do you want to cast to what martinium: is there a Nim equivalent to python's selenium? FromDiscord_: shshlick, ive already been told this is wrong, but it explains the problem: https://play.nim-lang.org/#ix=2jpu shashlick: disruptek: did you consider just using loadConfig() from compiler instead of nim dump? disruptek: i cannot find the compiler without running it because choosenim. disruptek: shims. disruptek: this is the problem. disruptek: stupid designs. shashlick: how does that affect you when nimconf.nim is compiled into nimph? leorize: Recruit_main707: cast basically tell the compiler how to interpret a glob of data as disruptek: i need to know how to set the prefixdir. disruptek: it's not available in nim-1.0, fwiw. shashlick: wish i had a better memory leorize: disruptek: set the prefixdir? leorize: ah I see :P didn't pay enough attention to the conversation FromDiscord_: What module is `getTime()` defined in? disruptek: https://github.com/disruptek/nimph/issues/127 disbot: ➥ Path error when using choosenim ; snippet at 12https://play.nim-lang.org/#ix=2gK1 leorize: @Technicae Circuit: times FromDiscord_: Thanks shashlick: thanks, that rang the bell disruptek: but eventually, we could maybe determine prefixDir this way. FromDiscord_: leorize, i surrender for today, will try tomorrow :p FromDiscord_: So, what's the built-in http client Nim has? FromDiscord_: I'm going to make my own simple library now leorize: HTTP/1.1 support, inefficient download/upload disruptek: it's the built-in http client. shashlick: i think this isn't related - what i'm saying is that instead of relying on `nim dump` to figure out what the nim.cfg evaluates to for a particular directory (for which you don't need prefix dir since you just run "nim") FromDiscord_: What's it called? And is there a better alternative? shashlick: what i'm asking is - why not use loadConfig() from nimconf.nim, compile that into nimph since you pull in the compiler anyway and detect it directly within nimph leorize: it's called httpclient. You should take a look at https://nim-lang.org/docs/lib.html disruptek: shashlick: i do. you cannot make sense of loadConfig() without a valid prefixDir. FromDiscord_: Oh okay, thanks! disruptek: i use `nim dump` so you can build nimph with 1.0 and use it to configure nim 1.3. disruptek: when we can rely upon prefixDir in the config, then we can deprecate some of this. shashlick: Ok disruptek: it would be good to know how to do that. i haven't even looked. disruptek: i'm waiting for it to be backported and a new 1.0 patch. then i will bump reqs, etc. shashlick: You mean the nimExe addition? FromDiscord_: Is the name `nimcord` taken in the package list? FromDiscord_: Is the name `Nimcord` taken in the package list? FromDiscord_: What's up boys FromDiscord_: The thing I don't get though FromDiscord_: a friend added my library as a submodule and it apparently Just Worked https://github.com/IamRifki/CattoCookie gogolxdong: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea0dd2d2bf9ef12699a0fc2] gogolxdong: does this mean leak memory? gogolxdong: Regarding https://github.com/nim-lang/Nim/issues/12952 , is it possible that all c interface leaks memory ? I tried a minimal test with mysql , above is the result, source code as follows: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea0e2181e3d5e20633a2110] disbot: ➥ Possible memory leak using re ; snippet at 12https://play.nim-lang.org/#ix=2j8A leorize: @gogolxdong: possibly lost are potentially leaked memory leorize: but if you're testing this with the default gc, you'll need Nim's suppression file to verify leorize: but not all C interface leak memory leorize: iirc re has to leak memory due to how poorly the pcre interface was designed bung87: what should I noticed when compare string from `TaintedString ` to string ? bung87: len(cleanHtml) was 6569 ⏎ len(cleanExpected) was 6583 leorize: taintedstring is just a concept signifying that the string come from outside bung87: I use text diff that they are same.I confirmed times. leorize: did you compare the newlines? leorize: CRLF might have turned into LF for example leorize: whatever tool that processed the file might have done that bung87: oh yeah, that may cause problem, thanks leorize: you're missing 14 chars, so 14 lines? :p gogolxdong: @leorize I'm using --gc:arc , and what's Nim's suppression file? bung87: I use stripLineEnd ,still same, I 'll look carefully the source invisible chars leorize: gogolxdong: you're using --gc:arc? are you combining with -d:useMalloc? leorize: you need -d:useMalloc to work with valgrind leorize: https://github.com/nim-lang/Nim/blob/devel/tools/nimgrind.supp leorize: ^ also that's the suppression file for Nim default allocator and gc gogolxdong: yes, the same result. gogolxdong: How to use it besides arc and useMalloc? leorize: figured out your problem leorize: it's just valgrind unable to scan libmysqlclient memory so it assume that part is lost :P leorize: we init() mysql but we never deinit() it leorize: not really a problem gogolxdong: How to confirm re issue is an issue rather than we init but never deinit so valgrind unable to scan the memory? leorize: the re issue isn't an issue leorize: "still reachable" memory meaning that the pointer still exist on the stack leorize: so can still be reached by the program in question leorize: practically it just mean that we alloc-ed then never dealloc at program end, the pointer is still there if manual deallocation is desired, but typically it doesn't make sense since the OS can clean up after us leorize: usually to confirm these issue, just look at the source of those module shashlick: leorize: what was the -d to check that the wrapped structs match the size of C structs? leorize: -d:checkAbi iirc shashlick: there's nothing in the nim code like that leorize[m]: https://github.com/nim-lang/Nim/blob/269a458d74e9abbc126d96c506b730c37af0932a/compiler/ccgtypes.nim#L249-L251 shashlick: neat thanks FromDiscord_: So what's the chances someone here knows the dance and chant to add atoms to the root window with xlib? gogolxdong: Not everyone knows what you know, it requires some experience and even, more evidences and documents. And for my own further concern, what's the functionality of useMalloc with arc, what if without it ? disruptek: useMalloc uses malloc instead of nim's allocator. Yardanico: with -d:useMalloc nim will use C stdlib's memory allocation functions like malloc() Yardanico: and without it, as disruptek said, it'll use nim's own allocator Yardanico: with -d:useMalloc when nim frees an object its memory is given away to the OS instantly gogolxdong: both shouldn't leak memory right? Does this imply better useMalloc ? disruptek: nah. Yardanico: no, better use nim's allocator, it knows how to deal with memory in nim programs better than your OS does :) leorize: valgrind is not compatible with nim's allocator :P leorize: Yardanico: to be fair, they are equally good leorize: but nim's allocator is constant time :) shashlick: compileOption() doesn't work for --noNimblePath or --clearNimblePath gogolxdong: I suspect my server is leaking memory , do you suggest try useMalloc or how to investigate? leorize: does it use async? gogolxdong: yes, it does. Yardanico: @gogolxdong gc:arc doesn't work with async yet (it leaks memory) gogolxdong: By async , do you mean async macro literally or whole async solution like waitFor, etc. Yardanico: the whole asyncdispatch gogolxdong: Won't useMalloc make a difference? Yardanico: it won't really Yardanico: gc:arc can't deal with cycles martinium: are there any major performance differences between the different Nim compiler backends Yardanico: martinium: as in time to run or time to compile? Yardanico: if time to run (the resulting binaries/code), then it's mostly the same for C/C++/Objective C I would say (although there are some backend specific options like use C++ exceptions for C++ backend) Yardanico: JS backend will of course be slower since JS isn't a compiled language :P martinium: pretty wild it can compile to so many languages Yardanico: well C/C++/ObjC are "mostly" the same :P martinium: so the JS transpiling is basically mature now? martinium: it was still WIP last time I had checked on this language leorize: yea been mature for awhile Yardanico: well I mean nim forum runs on it, karax runs on it martinium: nice martinium: I need to check out karax martinium: The script I was working on crashed yesterday due to too many open files martinium: I read in the docs that the http client opens a new connection and keeps it open for each request Yardanico: maybe you forgot to do "client.close()" ? martinium: so I have to manually close after each request? Yardanico: or you can just reuse the same http client Yardanico: no need to create it for every request martinium: that's what I was doing and it errored out martinium: with the too many open files error martinium: python took 7 hours but it didn't segfault martinium: so def have to adapt the code to be more Nim martinium: I also need to convert it to async martinium: but I have no experience coding async or threads martinium: love the syntax in this lang makes things a lot smoother martinium: currently reading Dom's book to get an idea of how to do it FromDiscord_: I just discovered that calling discard on some proc that raises an error will give you all the proc stacks on terminal leorize: uhmmm what? FromDiscord_: https://imgur.com/0SBSPmB leorize: it's not discard-specific :P leorize: everything do that when they raise and no one catch FromDiscord_: OHHHHHHH FromDiscord_: Didn't know Yardanico: lol Yardanico: that's how exceptions work you know Yardanico: "discard" basically has 2 uses: 1) you have to explicitly discard the value of the procedure when you call it but don't need the result 2) when you want to "do nothing" in some block (if statement, case statement, etc) Yardanico: the 2) is the same as "pass" in python FromDiscord_: Yeet FromDiscord_: Not sure why I said that lol, maybe I lost sight while listening to music, who knows FromDiscord_: 🙈 bung87: can push gc flag in tests with different value? disruptek: in a nim.cfg, sure. bung87: but should use different test file right? Yardanico: you can use a .nims file just for one specific test file shashlick: disruptek: what did you think of static linking libgit2 shashlick: and a distribution model similar to choosenim - built on CI and just downloaded to users systems prebuilt bung87: thank you , I was thinking just one file, each test case leorize: or you can use testament :P bung87: the nims is configuring for dir? FromDiscord_: So, I've been following Nim for about a year now, and I've messed with it a little but nothing big, and I quite like the language. Especially since I like to do web stuff too. But what I really like to focus on is game development, but I don't really like engines too much. So I was wondering if 1: You guys think Nim would be good for game development, and 2: What you would recommend for libs if so leorize: summoning lqdev[m] disruptek: shashlick: sounds great; when can it work? disruptek: or zacharycarter. shashlick: i'm looking into getting nimblePath and paths forwarded to child nim processes, should fix the build issue shashlick: but i cannot detect clearNimblePath or noNimblePath shashlick: compileOption() doesn't work for those disruptek: shouldn't it yield an empty array in that event? FromDiscord_: Welcome to Discord Nim, SolarOmni 😄 FromDiscord_: Take a seat while our community members answer your question. disruptek: think about how you'd solve this if we impl your pm->builder->compiler workflow. disruptek: nim is good for game dev. skrylar[m]: and now i have ported my handletree (well, based on a design stolen from stack overflow) to nim disruptek: there are many libs to choose from. disruptek: !repo nimgl disbot: https://github.com/nimgl/nimgl -- 9nimgl: 11NimGL is a Nim library that offers bindings for popular libraries used in computer graphics 15 133⭐ 12🍴 7& 6 more... disruptek: !repo sdl2 disbot: https://github.com/nim-lang/sdl2 -- 9sdl2: 11Nim wrapper for SDL 2.x 15 108⭐ 53🍴 7& 29 more... shashlick: it complains it isn't a supported flag zacharycarter: C question - what does this macro evaluate to logic wise? skrylar[m]: i guess i should look at this v lang since people here keep mentioning it shashlick: need to add it to the compiler in http://commands.ni:neutral_face: zacharycarter: ```#define foo(p) (cond ? a : 0, b)``` zacharycarter: ternary followed by some expression zacharycarter: with the comma operator FromDiscord_: I am familiar with SDL2, that would be nice. FromDiscord_: @KingDarBoja Thanks 😄 Yardanico: I'd prefer to recommend you a different sdl2 wrapper though Yardanico: https://github.com/Vladar4/sdl2_nim disruptek: they are talking to me in ##rust but i have no idea wtf they are talkin' about. FromDiscord_: Haha, Rust is black magic skrylar[m]: "Unlike most languages, variable shadowing is not allowed. Declaring a variable with a name that is already used in a parent scope will result in a compilation error." dumb Yardanico: skrylar[m]: don't Yardanico: you'll only laugh :D skrylar[m]: the official sdl wrapper works fine enough to start up an opengl context, which is what you use sdl for anyway skrylar[m]: also once you do that, https://git.sr.ht/~skrylar/skgl you're welcome disruptek: "< rtyler> disruptek: is that on report or record?" -- is this some rust-specific lingo? zacharycarter: don't use SDL - use sokol FromDiscord_: NimGL looked interesting, but, that's way beyond my level disruptek: !repo rapid disbot: https://github.com/liquid600pgm/rapid -- 9rapid: 11A game engine written in Nim, optimized for rapid game development and prototyping. 15 68⭐ 2🍴 7& 1 more... zacharycarter: but no one has any idea what that macro I posted evaluates to? Yardanico: zacharycarter: (if cond: a else: 0; b) Yardanico: i think skrylar[m]: why is an ORM even mentioned in the compiler docs disruptek: it's (something, something-else) disruptek: ie. the b is a second clause. FromDiscord_: zacharycarter: What is Sokol? I googled it but I can't find anything FromDiscord_: V stands for Vaporwaveeee(?) zacharycarter: ok thanks Yardanico: ware* zacharycarter: SolarOmni:https://github.com/floooh/sokol Yardanico: skrylar[m]: my favourite is https://github.com/vlang/v/blob/master/doc/docs.md#memory-management Yardanico: "(Work in progress) There's no garbage collection or reference counting. V cleans everything up during compilation. If your V program compiles, it's guaranteed that it's going to be leak free." good luck implementing that without something like Rust's borrow checker FromDiscord_: Welcome solar, im primarly a game dev too, and sadly the current gamdev front is semi bleak for nim, since there isnt a fantastic easy to use framework or engine zacharycarter: You don't need an engine for gamedev really zacharycarter: and if you want one - use the Godot stuff or the UE4 stuff skrylar[m]: finished scrolling through it. i don't.. *hate* V. it looks like someone left Go out in the rain a little too long until it got rusty, and i guess type reflection is bearable in that you could do the old two step "build an app that reflects on itself and outputs a module you can include to get your static serialization stuff", but uhm.. eeh FromDiscord_: Well yea i dont disagree with the not needing an engine, a framework would be fine, but most nim game stuff is 2D, which is unexceptable! 😛 FromDiscord_: unacceptable even skrylar[m]: if it were not for nim i would be using haxe ^^;; although v's build chain is less french^W convoluted disruptek: lol FromDiscord_: I'm just dabbling in a few different discords getting peoples opinions and see if I can't find some libs I can't find myself. Right now I'm mostly interestedin Rust, Go, Nim, Haxe, and Crystal (though Crystal still can't compile for windows, which is a no go) skrylar[m]: (they make jokes about how many frenchmen are involved in their own compilers, thus the joke) Yardanico: ahem Yardanico: im getting some déjà vu here zacharycarter: Elegant Beef: so use C/C++ libraries to fill the gap Yardanico: disruptek will understand zacharycarter: if you want Unity or UE4 written in Nim then just forget it it because it aint happening zacharycarter: those engines have hundreds of developers working on them full time skrylar[m]: is that because you keep starting your engine over zacharycarter: maybe skrylar[m]: i'm up to my eyeballs in index buffers and old gles2 crap zacharycarter: actually - this iteration of it is looking promising FromDiscord_: Well the thing is there isnt a plug and play solution imo, which i dont like and i dont know enough about C/C++ to actually go around making bindings/usable stuff disruptek: shashlick: what's the deal with choosenim on osx? zacharycarter: I have hot reloading working Yardanico: @beef godot? Yardanico: there are nim bindings zacharycarter: and a fiber based job system Yardanico: for GDNative disruptek: it's failing my ci. zacharycarter: Then why not just use Unity & C#? disruptek: you made your own fibers? skrylar[m]: Yardanico: eh the borrow checker is actually good Yardanico: skrylar[m]: you didn't understand what I meant zacharycarter: disruptek: deboostified fibers disruptek: wtf is that zacharycarter: so no boost ocntext zacharycarter: context* Yardanico: "good luck implementing that without something like Rust's borrow checker" means that it's really hard to do something like Rust's borrow checker with V's syntax really disruptek: just stack? zacharycarter: https://www.boost.org/doc/libs/1_68_0/libs/fiber/doc/html/fiber/overview.html zacharycarter: yes disruptek: hmm. skrylar[m]: if i were a stupid person i would just bind Urho3D's scripting interface to hashlink :p disruptek: seems fine to me. skrylar[m]: thats basically budget unity FromDiscord_: Zach im saying i'd like to use nim in a game environment and your solution is "use unity"? Yardanico: skrylar[m]: 4raq himself has made Urho3D bindings in the past :P Yardanico: https://github.com/3dicc/Urhonimo skrylar[m]: urho is okay. i used it a wee bit zacharycarter: No my solution was Godot haha zacharycarter: but if you don't understand C/C++ you might be better off with C# skrylar[m]: hmm a saner person would use godot yeah zacharycarter: and Unity FromDiscord_: I mean it's not like i cant learn it, i just have no interest in them, im already we aclimated with unity and godot zacharycarter: You're not going to get very far in game dev with Nim if you don't understand C/C++ skrylar[m]: "i just want to use janet to do my dialogue scripts" -> welcome to gdnative is almost entirely nudocumented ha ha ha ha zacharycarter: I mean - if you want to do simple 2d stuff - fine you don't need to know C/C++ you can just use SDL2 / GLFW zacharycarter: but if you want to do 3d stuff - well chances are you're going to be relying on some C library down the road skrylar[m]: i guess there is also the inkjs option of just emitting json bytecode and then having a very hastily clad interpreter in gdscript skrylar[m]: those are all saner than "i will just do it myself .. fek now i have to spend weeks on basic 2d parts" FromDiscord_: Yea i dont do 2D games stuff often, if ever zacharycarter: I mean it sounds to me like you want things to be easy and for things to be easy you should use a game engine that is well documented and widely adopted zacharycarter: Nim doesn't fit into that picture at the moment FromDiscord_: Which is what i said zacharycarter: no you implied that game dev in Nim was bleak, it's not zacharycarter: it's just not easy FromDiscord_: > Welcome solar, im primarly a game dev too, and sadly the current gamdev front is semi bleak for nim, since there isnt a fantastic easy to use framework or engine zacharycarter: is game dev in C bleak? FromDiscord_: I literally gave reason why it's not bleak FromDiscord_: it's bleak* FromDiscord_: If I wanted an engine, I'd use Defold or Godot FromDiscord_: But I just prefer code zacharycarter: it's not bleak it's just not easy button FromDiscord_: I actually am moderately versed in C++ myself skrylar[m]: defold? FromDiscord_: It's a low level lua engine FromDiscord_: I've modified barony's source code to load characters through json, so im totally versed in C++ leorize: we have a decent sdl2 wrapper :P Demos[m]: c++ is cursed FromDiscord_: 😄 Demos[m]: it's a great leanguage Demos[m]: but cursed skrylar[m]: its not a great language zacharycarter: yeah it's def not FromDiscord_: I like C++, just, too much work xD I already tried writing an engine in it with SDL2, I got a ways, then burned out, cuz too much damn work skrylar[m]: common lisp is a great language. c++ is an incurable illness zacharycarter: nothing cursed about it - just bad design by committee Demos[m]: there's some good design by committee too FromDiscord_: I also realized it was basicaly black magic to anyone but me FromDiscord_: So I'd have to then plugin a scripting language Demos[m]: (I actually think for gamdev being well versed in something like Fortran 2008 is better than being well versed in c++) shashlick: disruptek: nimph? disruptek: cutelog is failing, of all things. disruptek: cannot fetch choosenim nightly on osx. disruptek: 403 skrylar[m]: well i just have no faith in c++ stuff. i mean can you defend templates with a straight face shashlick: it runs into the api limit on github to pull nightlies shashlick: you could set a github token to make it work Demos[m]: skrylar: you do know nim's generics are straight up a copy of C++ templates right? skrylar[m]: when bjarne said "nobody will ever fully understand [all the template mechanics]" c++ should have been shot in the head skrylar[m]: journe disruptek: "nobody" sounds pretty damning, coming from him. FromDiscord_: Lol skrylar[m]: yeah the guy who made the language basically confesses his language is crap skrylar[m]: macros are simpler than the horror that is the entire template spec shashlick: disruptek: oh you are still using the old travis.sh disruptek: oh Demos[m]: skrylar: nim macros or c++ ones disruptek: thanks; that's an easy fix. skrylar[m]: Demos: common lisp Demos[m]: ah Demos[m]: templates (and nim's generics) make writing certain kinds of code much easier than macros Demos[m]: (clisp macros) shashlick: change to **`curl https://gist.github.com/genotrance/fb53504a4fba88bc5201d3783df5c522/raw/travis.sh -LsSf -o travis.sh`** Demos[m]: (not c macros, those are bad) shashlick: might need to clear cache disruptek: already pushed. Demos[m]: anyway Bjarne would probably say "yeah it's complicated, but evidently it's useful" Demos[m]: also TONS of other languages copied c++'s template semantics (almost nobody copide the syntax, cuz it is truely insane, or should I say typename insane) skrylar[m]: CL macros are basically "so we look at the head of a list, and if its a macro then we run some code in an interpreter and whatever you return is what we try to compile as though you typed it in." and thenpretty much every language ever says macros bad, while people praise c++ templates, even though things like boost are extreme voodoo and they're just patting themselves on the back for making a convoluted hedge maze that they skrylar[m]: then managed to waste years walking through and then say "THERES NO PROBLEM, WE MADE IT THROUGH THE HEDGE EVENTUALLY!!" thats basically the c++ deep coping. skrylar[m]: meanwhile they keep deferring pascal units from the standard ... disruptek: voodoo really has no place. Demos[m]: I don't really know any c++ people who think cl style macros are bad skrylar[m]: guess compiling hundreds of megabytes of bad syntax every file isn't a problem we compiled it eventualy too leorize: I'm pretty sure Nim's generics are simpler than C++ templates :P Demos[m]: I do know many implementers who don't want to standardize their AST skrylar[m]: anyway that's enough of that rant, have modules instead. https://git.sr.ht/~skrylar/skhandletree Demos[m]: c++20 has pascal units Demos[m]: although tbh they work more like ada modules/units leorize: has != people will use it Demos[m]: I'll point out that c++ also did a very fine job with concepts (requires requires aside.... ) leorize: I do know people who dread that addition Demos[m]: I know people who dread it too Demos[m]: and it's really because the current place where the build system is seperated from the compiler doesn't make sense any more leorize: nim have concepts before it's cool :P leorize: we never got to make it properly work though Demos[m]: nim is copying c++'s concepts to make them work :D leorize: mainly because of the lack of interest Demos[m]: I actually still annoyed that in c++ I have to write like void foo(someconcept auto arg) {} instead of in nim where I can say Demos[m]: proc foo(arg: someconcept) Demos[m]: just like any other type leorize: proc foo(a, b: int) Demos[m]: but at least we got the abbreviated syntax! leorize: ^ the ultimate form Demos[m]: I hear that was an extremely spicy wg21 meeting martinium: I am about to embark on converting a synchronous function to async. Right now it works by making requests for paginated http json responses. Would I need to make each request await? Yardanico: martinium: to truly make use of async you'll have to do like 10-50 calls in batch and wait for all of them Yardanico: or if your logic allows that have async procs which call other async procs with (await) Demos[m]: martinium: that's probably the easiest Yardanico: so you can start like 10 async procs which then will call 500 async procs Yardanico: and it all will be async and stuff Demos[m]: Yardanico: it's all on a stackless event loop right? they don't get deligated to the thread pool Yardanico: ? leorize: yea Yardanico: yes it's single-threaded martinium: would I need to create a separate http client for each or can they all use one client? Yardanico: but for IO stuff like http requests it's very good leorize: martinium: concurrency Yardanico: martinium: you'll need a separate one for each async proc Demos[m]: cuz I know in cpprestsdk (which uses taks based async) we have a problem where people do like "a.get() + b.get()" and don't understand the issue with it leorize: a client can only do one request at a time Demos[m]: they also deadlock sometimes because the threadpool runs out of threads leorize: a limitation of the HTTP/1.1 spec Demos[m]: clients can have more than one connection open at once Demos[m]: also didn't 1.1 add pipelineing? leorize: you still can't request concurrently leorize: also pipelining is so broken no browser even enable it Demos[m]: why the hell not? leorize: ah wait I was wrong leorize: you can :P leorize: but pipelining is still broken Demos[m]: you probs need ratelimiting martinium: if I await one of the clients the other clients will be able to start their requests concurrently without waiting correct? Demos[m]: but you need that anyway Demos[m]: are you awaiting within an async proc? Yardanico: martinium: yes martinium: should I even await at all Yardanico: yes Yardanico: but you need to use it carefully martinium: I was thinking of doing await for each http request Yardanico: well that's ofc Yardanico: https://gist.github.com/martinium/c93119a6e4fb0bb4914fc5dfbc7c91af you have 3 for's here Yardanico: so you can call an async proc for each asset_id which then will call async procs for all pages which then will return stuff Yardanico: or you can just write to a global variable xd martinium: this is going to be a bitch lol martinium: hate not knowing stuff haha martinium: so you recommend breaking down the loops into their own procs? Yardanico: otherwise you won't really be able to take advantage of async martinium: yeah that was what I was thinking but was being lazy Yardanico: also does this API have rate limiting? Yardanico: in seconds martinium: yes it does 1 sec Yardanico: because that's quite an issue :P martinium: think its 1 request per second martinium: may be much higher martinium: looking at docs Yardanico: 1req/second is really low Yardanico: how much requests do you need to make in total? martinium: think I had read either 10 or 500 per second martinium: it'll be more than 10000 requests total Yardanico: uh-oh Yardanico: rate limiting will be quite difficult in a nim async app because I don't have experience with that :P Yardanico: and yes you need to care because the way I was meaning to do it is by spamming as much requests as possible at the same time martinium: I'll try and get it as far as I can and deal with that as it becomes an issue I guess martinium: I actually don't see any rate-limiting info in their docs martinium: so it may not be rate limited martinium: which would make sense considering the amount of data that needs to get requests and grabbed martinium: they limit to max 500 items per page per request Yardanico: well I can you implement this stuff if I know which APIs to call :P Yardanico: and what's get_asset_IDs() martinium: another function that gets all asset IDs from another endpoint martinium: I save those IDs into a seq martinium: that I plan to reuse for other procs Yardanico: well can you send the nim version you currently have? in private maybe skrylar[m]: for rate limits wouldn't you just make an async actor that waits on a timer before it pitches a new job to the scheduler martinium: seq saves "id": "ip" Yardanico: skrylar[m]: how to do that with asyncdispatch? :P skrylar[m]: i haven't used async because i'm constantly told its broken, so. skrylar[m]: but with a rate limit of one second i don't think you gain anything with async martinium: I can share the code as it is nothing proprietary in the code 1 sec skrylar[m]: ok. slapped a readme on handletrees martinium: yeah the rate-limit was in my brain it is nowhere in their docs skrylar[m]: https://git.sr.ht/~skrylar/skhandletree i hope thats readable enough (last time i'm going to plug it tonight lol) FromDiscord_: Arrrhg Yardanico: oh so you're using insightvm api martinium: yeah martinium: rapid7 martinium: https://gist.github.com/martinium/6530d5d335e29feda0ce3b885376a5ed FromDiscord_: That moment when you dealing again with unicodes lol martinium: lot of commented code that I am in process of converting Yardanico: martinium: well I already wrote a "template" Yardanico: I mean some stuff without saving the results and these tables with asset/site maps martinium: with proper examples to learn from I can build upon it martinium: I want a taste of the proper speed boost this lang can bring FromDiscord_: "Check failed: value.value == "Has a ਊ multi-byte character." FromDiscord_: "value.value was Has a 0000000000000A0A multi-byte character." FromDiscord_: Sooo close Yardanico: well as I said before you can speed it up a lot with async even in python martinium: yeah martinium: I'll prob an async python version when I complete the nim version Yardanico: also one thing - "count" won't really be possible with an async version martinium: the other good thing with nim is I can just give someone an executable martinium: count is not really needed martinium: just hadn't deleted Yardanico: you'll need to also not forget to include openssl libs if you're compiling for windows :P skrylar[m]: why would counts not be possible Yardanico: skrylar[m]: well I mean they will be possible Yardanico: but they won't be in sequential order like before martinium: since the threads will prob right at different times martinium: yeah skrylar[m]: true Yardanico: martinium: there's only 1 thread in async ;) martinium: write not right* Yardanico: concurrency vs parallelism Yardanico: although you can use both at the same time martinium: I was about to ask that martinium: how is parallelism in nim? martinium: is it stable? skrylar[m]: hot potatos does v compile fast though Yardanico: well it is stable, but with the default GC you won't be able to use global GC'd memory Yardanico: that's to be solved with --gc:arc but it's still in development martinium: a parallel async app would be amazing martinium: proper advantage of all modern cpu cores zedeus: about openssl and windows, I saw a bunch of forum threads about static linking but they were mostly old and nobody seemed to figure it out zedeus: I really wanted to avoid shipping dlls though so I managed to do it on my own, maybe worth a forum post or something? i don't know if this is still something people haven't figured out zedeus: https://github.com/zedeus/kinoplex/commit/935138b2b7cac847a9093c8cdeb9b811531b360a Yardanico: well it's mostly the same for linux Yardanico: coz you're compiling with mingw :P Yardanico: kaushalmodi made some static linking stuff for linux with libressl and pcre zedeus: right but on linux people usually have openssl installed anyway so it's not an issue Yardanico: https://github.com/kaushalmodi/hello_musl Yardanico: zedeus: depends on what linux you're targeting though :P zedeus: the ones I care about targeting all have it :) martinium: windows 10 comes with openssl nowadays martinium: openssh nevermind martinium: openssl is diff zedeus: anyway, resources for static linking linux binaries with nim are aplenty, but there are basically none for mingw zedeus: besides dead ends on the forum leorize: you get to be the first then :) FromDiscord_: https://github.com/nim-lang/Nim/issues/400 disbot: ➥ Unicode-aware string handling ; snippet at 12https://play.nim-lang.org/#ix=2j9q FromDiscord_: @Varriount I see what you did there skrylar[m]: depending on what you're doing you could also jank it with an ecs or something Yardanico: @KingDarBoja there's https://github.com/nitely/nim-unicodeplus skrylar[m]: store the task info in boxes and then have workers ask for the job across threads like you would be doing with beanstalk anyway Yardanico: also https://github.com/nitely/nim-unicodedb Yardanico: well basically https://github.com/nitely/nim-unicodeplus combines 3 other unicode libs nitely wrote for Nim FromDiscord_: I will check the unicodeplus FromDiscord_: I love you Yardanico-sensei Yardanico: also https://github.com/nitely/nim-strunicode FromDiscord_: Ok, unicodeplus doesn't seem what I am looking for, looking at strunicode Yardanico: what do you want to do FromDiscord_: Handle unicodes on strings FromDiscord_: As different GraphQL APIs could return those skrylar[m]: um skrylar[m]: that doesn't mean very much skrylar[m]: you can just do literally nothing and you 'handled' a unicode string skrylar[m]: if you mean things like comparing two strings, then you start getting in to unicode normalization forms shashlick: zedeus: see nimarchive and nimgit2 for static linking on windows with mingw skrylar[m]: humm. should see how well this hot code reloading works in nim skrylar[m]: the sheer compile speed and hcr are the spiciest meatballs in V. shashlick: Of course that's cause the libs can be built on windows with their build tools shashlick: Openssl requires a laundry list of stuff to build FromDiscord_: I need unicode cuz my current lexer isn't able to catch properly unicode strings :/ FromDiscord_: or maybe I am not correctly parsing them, lol FromDiscord_: Anyway, going to sleep, bye guys 😄 Yardanico: oh Yardanico: you just need to use nim's unicode stdlib then Yardanico: and iterate over utf-8 runes instead of ascii characters Yardanico: although not neccessarily Yardanico: nim itself supports utf-8 identifiers without actually using runes in the compiler AFAIK FromDiscord_: I had something like this -> elif character == 'u' and pos + 4 <= bodyLen FromDiscord_: And it is entering the condition but looks like I got the unicode wrong FromDiscord_: Because I am converting that string lice using fromHex FromDiscord_: Which I have no idea why I used it lol FromDiscord_: is there a simple way to convert a string of an expression into a proc? like turning "x**2 + 3*x" into the appropriate proc Yardanico: @KingDarBoja that's unicode escape character Yardanico: where are you getting the values from? json? FromDiscord_: No, a string Yardanico: @InventorMatt on compile-time? sure Yardanico: there's https://nim-lang.org/docs/macros.html#parseExpr%2Cstring FromDiscord_: But I think Variount mentioned something about perfomance with unicode module, not sure atm Yardanico: just create something like macro(a: static[string]): untyped = parseExpr(a) Yardanico: don't forget to import macros FromDiscord_: https://github.com/nitely/nim-strunicode looking at this one right now Yardanico: are you sure the string actually has \u1234 verbatim? Yardanico: that's usually a unicode escape FromDiscord_: The input string is "{ field(arg: "Has a \u0A0A multi-byte character.") }" FromDiscord_: Doing repr(s) yields "0000000000996058" # This comment has a \\u0A0A multi-byte character.\10" Yardanico: what if you do echo arg[8] Yardanico: what does it print FromDiscord_: Char at Pos 8 ->{ Yardanico: uh Yardanico: I mean Yardanico: what if you do for x in str: echo x Yardanico: does it actually print \ u 0 A 0 A each on their own line FromDiscord_: I just remember the thing with triple quote strings FromDiscord_: They do not escape sequences 🤔 FromDiscord_: Yeah, it does Yardanico: lol Yardanico: are you sure the graphql will actually return the answer like that? Yardanico: and not as utf-8 encoded strng FromDiscord_: I am looking at the source implementation (Javascript), the same test that I am trying to achieve FromDiscord_: Hold on FromDiscord_: https://github.com/graphql/graphql-js/blob/master/src/language/__tests__/parser-test.js#L137 this one mate Yardanico: well JS has unicode escapes FromDiscord_: The parser relies on the Lexer Yardanico: so you shouldn't test if there's an "u" character FromDiscord_: Which is hitting this proc FromDiscord_: https://github.com/graphql/graphql-js/blob/master/src/language/lexer.js#L445 FromDiscord_: This function* lol Yardanico: yeah it iterates on unicode points as JS itself does Yardanico: although JS uses UTF-16 internally, I don't think it'll make a difference there though Yardanico: so you'll need to use "unicode" module or this strunicode FromDiscord_: Should I worry about perfomance ? Just curious Yardanico: not really I think Yardanico: also I really think a lot of code in your port can be avoided, why not just write a simple iterative tokenizer lol Yardanico: is your work open source? FromDiscord_: In the case of strunicode -> _Be aware, storing a sequence of grapheme clusters may take 10 times as much space as a utf-8 string. _ Yardanico: well and JS does it like that by default FromDiscord_: By open source you mean on a repo without any stuff regarding companies? Yes FromDiscord_: xD Yardanico: yes I mean repo FromDiscord_: Yup Yardanico: well of course JS has logic for detecting if string contains unicode or not Yardanico: for optimization FromDiscord_: https://github.com/KingDarBoja/Phosphate FromDiscord_: I have few changes on local, need to push to the repo but lazy right now lol FromDiscord_: @Yardanico I need something that can do it at run time not during compile time. Yardanico: @InventorMatt then you need to look into embedding nimscript FromDiscord_: if it helps to give context I am creating a wrapper for the sympy library and I want to be able to convert the symbolic equations into a proc that I can use within the code form there Yardanico: Nim compiles to native code Yardanico: you'll either have to use a nim vm (which nimscript is) or think of some other way of doing that :P FromDiscord_: okay, thanks. FromDiscord_: Yard, just updated the repo 😄 FromDiscord_: `dev->command_pools = malloc(queue_info_count * sizeof *dev->command_pools);` from C, what is the nim way of doing this? Yardanico: if it's a dynamically allocated "array" in c - use seq FromDiscord_: If you can take a look and help me with that unicode thing, thank you FromDiscord_: Now going to sleep FromDiscord_: 😄 Bye bye FromDiscord_: Hm, someone here was talking about implementation async functions using state machines, but I can't recall who... leorize: it's rayman22201 leorize: but he is busy with his day job rn, sadly leorize: though Araq did voice interest in working on a newer async implementation Araq: that doesn't mean much, Araq is always too busy Araq: but I'll write my 20 line arc async proof of concept FromDiscord_: Araq: I was idly "sketching" an idea out today. It mostly hinges on async iterators and the fact that you can call an iterator instance with different parameters. FromDiscord_: Rather than the nested closure concept currently used. silvernode: Good morning silvernode: so I am trying to create a type and make one of the fields a bool but it won't let me. FromDiscord_: can i see code FromDiscord_: also good morning silvernode: https://play.nim-lang.org/#ix=2j9P FromDiscord_: equals sign FromDiscord_: use colon silvernode: oh duh silvernode: thanks silvernode: I knew better than that, what's wrong with me! FromDiscord_: you just woke up silvernode: Indeed I did, and in 30 minutes, I have to clock into work silvernode: We deided to start over with Space Nim now that we have mostly figured out what we want to do FromDiscord_: we? silvernode: A childhood friend is helping me work on it silvernode: Also, techinically disruptekis a project member but has not had a good reason to jump in yet. The project is still materializing. silvernode: That's what happens when you don't know what direction to go in and how to code well silvernode: still flushing out the details but we know a lot more about Nim, and where we want to go with the game silvernode: We decided that exploration will be something you cannot do without turns, and the player gets turns as a reward FromDiscord_: thats odd FromDiscord_: so its a turn based now instead of a real time silvernode: yeah silvernode: turn based should be easier on the brain for a new programmer silvernode: I have trouble breaking down problems and using logic even if I know all the language syntax silvernode: side note, as a young boy, it look me longer than most children to learn how to read. My brain tends to learn in a technical lway so explainations usually need to be disected more so than needed for most people. silvernode: Like: Roads are smooth so motor vehicles can travel easier. I would ask: but how is the road made smooth? silvernode: To which a teacher would reply: They just are. silvernode: I seem to be rambling a bit lol. oops FromDiscord_: that is fine FromDiscord_: no one is here silvernode: I guess I just want people to know me here because I like the crowd in this IRC. silvernode: It's the first community that I feel like I can be myself. silvernode: disruptek: says I should start streaming when I start coding, just like he does. FromDiscord_: why not? martinium_laptop: anyone ever encounter this error? martinium_laptop: ```Exception message: Too many open filesAdditional info: "nodename nor servname provided, or not known"Exception type: [OSError]``` martinium_laptop: Yardanico failed with that same error again FromDiscord_: you probably opened too many files? martinium_laptop: wondering if it is a macOS limitation FromDiscord_: macOS has a pretty low file handle limit from what i recall martinium_laptop: I am making a bunch of async web requests and processing some data FromDiscord_: are you closing your files martinium_laptop: the only thing I have to close is the connections martinium_laptop: and they are being closed after each request completes FromDiscord_: do you open any files martinium_laptop: only file I create is a CSV that is written to in a loop FromDiscord_: huh FromDiscord_: hm martinium_laptop: I assume by open files it is referring the http get requests potentially FromDiscord_: but you said you were closing them so martinium_laptop: yeah martinium_laptop: client.close is called after each requests martinium_laptop: so this error has me confused martinium_laptop: error type says OSError martinium_laptop: solved the issue codenoid: hi folks PMunch: Hi codeneid FromDiscord_: anyone here knowledgeable on reactive programming? or got any guides for implementing it in a language? trying to do so for nim but i got nowhere to start Araq: Rika check out my experiments inside karax's repo Araq: summary: it sucks... Araq: ;-) jorjun_twitter: There’s a plethora of code-challenge type websites now. Who wants a code-wrestling place to go? The winning solution wins human votes for aesthetic, and the machine can assess each solution for memory, and performance. FromDiscord_: Araq: why does it suck? also, a guide for moving away from reactive would also help me jorjun_twitter: Difficult allowing different language entries..but something to think about . If there is any interest. A marketer guy told me: see if there is interest before you build speculatively. FromDiscord_: im just trying to port something to nim and it uses reactive, really jorjun_twitter: Trick is to devise challenges where there is a mix of IO bound and CPU bound. Would have to get categories together. jorjun_twitter: Ideally would tune it so that script guys can sometimes win. There’s not enough objective evidence of benefits of compiling in context of IO-heavy tasks. jorjun_twitter: And now I will get my coat. :D FromDiscord_: thats a large gap in time Araq: jorjun_twitter: Nim is not just about "make scripting faster", it's also "let's fix scripting and give a type system" Araq: Rika: it's much more complex than DOM diffing and DOM diffing is already too complex PMunch: Is there a better way to do this without "toStr"? https://play.nim-lang.org/#ix=2jan jorjun_twitter: @Araq Yes, I see that. Didn’t come on here to critique, but thinking about teaching some new coders best practice. FromDiscord_: Everyone knows the best coding practice is to stop before you start 😄 FromDiscord_: Cant write bad code if you dont write code supakeen: There isn't really a best practic when it comes to CPU vs I/O bound, it heavily depends on the workload even within those domains :) jorjun_twitter: When you solve these online code challenges, the only feedback you get right now, is votes from others and unit test passing. Vindaar: @PMunch: `astToStr(name)`? jorjun_twitter: Would be good to get across a range of considerations... PMunch: Vindaar, ah perfect. I knew there was a way! FromDiscord_: Without multiple languages you could have a few solutions of good,great, and fantstic, which both use line count, memory usage, and time as indications of the solution method FromDiscord_: With multiple languages you have basically 0 benchmark, and users arent going to be that into reading over 9 million duplications of the same thing timotheecour: @araq is there anything else needed for https://github.com/nim-lang/Nim/pull/13926 beside the comment here https://github.com/nim-lang/Nim/pull/13926#discussion_r406714163 ? dchem: Hello! when a compiler gives an error like "Got but got Future[type]" what does angled brackets "<" mean? jorjun_twitter: @Elegant Beef The "new thing" to bring to the table is objective assessment of the solution with benchmarking & instrumentation. PMunch: Rika, what kind of reactive programming do you need? It should be entirely possible to do it in Nim dchem: "but expected Future[type]" sorry Araq: timotheecour: I don't understand it, what I'm saying is this: PMunch: dchem, nothing. There is something else wrong FromDiscord_: Yea the benchmarking is interesting, and you could do use stdin/stdout for managing most languages, but bench marks would require a rosetta code like database Araq: .importc'ed types have sizeof, but that sizeof must be mapped to C's sizeof mechanism FromDiscord_: I suppose you could possibly use rosetta code for challenges alehander92: hmm reactive programming FromDiscord_: Also would require having support for many languages as far as i can see jorjun_twitter: @Elegant Beef oo great idea to grab bootstrap with existing solutions. Then I wonder how hard it is to add "fair instrumentation" all the different runtimes. Araq: timotheecour: and then we have .incompleteStruct for when sizeof is not available timotheecour: right but I’m enabling CT sizeof for types that are explicitly whitelisted as being complete; and for these, a static_assert will check for that timotheecour: `incompleteStruct` doesn’t work at all, because it’s the wrong default (as i showed) Araq: sure but it isn't the default, so there is no design flaw here dchem: PMunch, thank you. That's weird FromDiscord_: Yea, i actually think any CS projects in schools should be done with the stdin/stdout methods, since forcing the usage of a single language when you might know many/dont like the language they use is weird timotheecour: the default should mean incompleteStruct, and incompleteStruct is or should be in fact a noop; the non-default is explicit `completeStruct` FromDiscord_: Slr, PMunch, the one like in RxJava, and I figured it would be possible in Nim, I just don't know where to start coding one Araq: timotheecour: so what's the original problem again? Araq: you want to check if we got an .importc'ed definition right? timotheecour: enabling CT sizeof, and checking for it jorjun_twitter: @EB My older bro’ trying to sell me Elixir to me, and I take a look at it and feel complete disgust at the syntax. I really think that people will go for the language they can tolerate the look of, and that’s fine. alehander92: @jorjun_twitter i liked elixir before, it's elegantly simple with its macro system timotheecour: and fixing the pre-existing bugs that we’ve silently had in the past where we claim a type has sizeof x but in fact has sizeof != x Araq: but CT sizeof for .importc is very dangerous alehander92: the syntax was very ruby-like + `|>` jorjun_twitter: But there has to be some engineering in there, too. And schools have to try not to oppress budding talent making it crawl around on the floor jorjun_twitter: Yes, he is a ruby geek. I just can BEGIN and END with that s** dchem: PMunch, is there a flag to get more detailed compiler error? I'm really lost here. Thank you. PMunch: Rika, well I guess you would need some data structure to drop data into. And some wrapper that makes asynchronous methods able to put things into this data structure. PMunch: And a way to save callbacks for things to be inserted into the structure FromDiscord_: Yea jorjun it's a silly thing to me to have any requirement on language, like who the fuck cares what int/int equals in language x FromDiscord_: I do wish the .size pragma would work for importc'd objects, rather than just enums. There are cases where I know exactly how big a type is (due to hardware / library / toolchain guarantees), but still can't do sizeof at compile time PMunch: dchem, not really. If you post the full error message and a code snippet there probably is enough information to figure out what has gone wrong FromDiscord_: Wait, so something similar to streams? FromDiscord_: Man reactive is hard to understand FromDiscord_: Anyway, yea rosetta code could be a good base, assuming it's not locked down due to licensing, since it's got a ton of challenge solutions, the big thing would be getting many language compilation support FromDiscord_: compilation/runtime* FromDiscord_: Anyway i sleep now, buh bye PMunch: Rika, kinda, but not really. And it's not that difficult. It's basically setting up callback for things that can update, and propagating the updates in a reasonable manner jorjun_twitter: @EB yep, I find it fascinating that there are so many distinct temperaments. Worth finding out which language appeals. I might make a facility. Last opus was a photographer competition site. But itching to make another community for coders. jorjun_twitter: Some people just need introducing to good taste of course... Araq: timotheecour: I'm merging it but the cost is you get to update the documentation and write some very precise docs timotheecour: @araq the danger is much mitigated by fact that C compiler checks for it at C compile time via static_assert , with this this PR. And it’s opt-in anyways. And we’re already relying on this feature with types that have `{.importc, size:8.}` (for eg ) or `type Foo {importc} = cint`; and I’ve shown that thanks to this PR, we can identify existing violations. timotheecour: sure, i can do that FromDiscord_: PMunch: reasonable? What is an unreasonable manner PMunch: I dunno :P skrylar[m]: well'p. gave v a short spin on windows. windows kept complaining about "security scans", had one instance of its cache files corrupt and need manual deleting, and hot code reloading didn't work. cest la vis. PMunch: Setting up a socket for everything and sending all your data through the Tor network? PMunch: That would be pretty unreasonable timotheecour: @araq thanks dchem: PMunch, https://paste.debian.net/1142393/ Araq: so ... it's PR week, not sure if #nim noticed Araq: the plan is to get below 100 open PRs PMunch: Oh neat FromDiscord_: There are articles everywhere on how to use reactive programming but none that I know of about how to implement them Araq: Rika: ask skrylar[m], he did it well iirc PMunch: I feel like that's often the case Rika skrylar[m]: cobweb never actually got finished because i was fighting the type system at the time, buuuut skrylar[m]: ¯\_(ツ)_/¯ basically you just need toposort FromDiscord_: ???? skrylar[m]: well reactive programming is literally just reacting to events, and works kinda the same as how spreadsheets work FromDiscord_: Good analogy skrylar[m]: you have a value node and add edges for things the value depends on to be updated Araq: karax has ReactiveSeq and stuff Araq: and I wrote "todo" with Karax Reactive FromDiscord_: Oh no, graphs, I'm no good at that Araq: I think the code is somewhere under /experiments skrylar[m]: they're not complicated really skrylar[m]: values have <-> relations with other values, and when you update one you iteratively trigger the other values watching that skrylar[m]: and maybe throw in a little topological sorting to check for abberant geometry in the graph skrylar[m]: if you promise not to make infinite loops you can do it with simple seqs and barely any code Araq: you need to watch out for infinite update events, A updates B which causes A to update which ... Araq: in my experience with vue.js that problem quickly became intractable dchem: PMunch, sorry, I should have included that I'm using nim 1.2.0 skrylar[m]: yea i dunno how spreadsheets deal with cycles like that. i think most of them just go "NO." and refuse to propagate FromDiscord_: google sheets limits propagations afaik? Araq: but I was also forced to write the code in the most convoluted way possible, so my experience is very biased Araq: skrylar[m]: in most programming systems there is a 'onNextTick' thing for it skrylar[m]: recursive data exists sometimes like meeks algorithm where you have to sit there and iteratively crunch the same things until they settle down but skrylar[m]: delaying propagation by one yeah. vcv rack does this timotheecour: meh, i actually like karax, there are bugs that should be fixed but it’s useful and I don’t know of a better existing alternative skrylar[m]: all values go in to "cables" so each conncetion creates a one frame propagation lag Araq: I recently fixed the most pressing Karax bugs Araq: but Karax is DOM diffing, not reactive FromDiscord_: @[email protected] FromDiscord_: am overwhelmed now skrylar[m]: what i did was have a single cobweb object and the expectation is you use that to connect value objects, which are just generic boxes, because then the cobweb object is able to watch out for stupidity. but also, double effort you can use something like skyblue https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.8935 Araq: I'm a huge fan of immediate mode UIs, DOM Diffing emulates to a good extend PMunch: dchem, probably need to mark that procedure as {.async.} skrylar[m]: skyblue is capable of being told several possible dependencies of a constraint, and it will work out which ones need to be re-routed and which ones have to be disabled, so you can get a little further with the dataflow that way Araq: and for me reactive tries to do the same as immediate mode and fails skrylar[m]: its beautiful when it works Araq: immediate mode is more beautiful and works more often ;-) skrylar[m]: bacon.js is also one to look at; its kinda basic but it gets the point across dchem: PMunch, using {.async.} and then doing result = await newWeb3(uri) returns type mismatch: got but expected 'Web3 = ref Web3:ObjectType' PMunch: Hmm dchem: PMunch, sorry the output was type mismatch: got but expected 'FutureBase = ref FutureBase:ObjectType' dchem: It's possible that it's web3 project issue, I'm not too familiar with future and asyncdispatch yet, so I dn dchem: I don't know what is the prefered way to write {.async.} compatible functions - putting together toy examples without web3 works just fine, and using the await newWeb3(uri) in another context works just OK dchem: but not if I'm trying to make a separate proc that just returns future FromDiscord_: skrylar so what made you archive cobweb dchem: I mean nesting an async function that returns future within a async function that returns future should just be returning either the yield val or doing it as await dchem: PMunch, thank you in any regard. Araq: Clyybber: found the cycle collector problem skrylar[m]: @Rika i went to rust for a while, but also dealing with variant objects was getting to be a pain. might be able to unarchive it and fiddle with it at some point Araq: it's the old "freelist" problem, the paper uses a freelist and we don't. a freelist turns "accesses freed memory" into a valid operation skrylar[m]: i also didn't really understand how stuff like skyblue worked and had no help at the time, so i had to grind through things like the cassowary paper for a month Araq: fun fact: Facebook's Reactive framework isn't "reactive programming" skrylar[m]: its funny that im the one who nudged the Red guys in to adding frp stuff and now they list it as a front page feature skrylar[m]: i seem to remember having issues storing types in value objects FromDiscord_: well types aren't concrete ... FromDiscord_: but isn't "PhantomData" used for that? alehander92: hmm skrylar[m]: i dunno but cobweb was like, nim 0.17 too inv2004: Hello, How to get second int byte from structure? inv2004: cast[UncheckedArray[cint]](x.k)[1] does not compile inv2004: I use kind variant, but I do not want to do big case just to extract the same number from different kinds PMunch: Second int byte? PMunch: What's an "int byte"? inv2004: ah, sorry inv2004: second int position FromDiscord_: what structure inv2004: a: char, b: char, kind: char, c: char, iNeedThisInt: int inv2004: ptr object ... FromDiscord_: does openArray change anything? FromDiscord_: im still heavily confused dchem: ok, so it's status-im people with their own "chronos" library that is causing the problem I mentioned earlier FromDiscord_: @Recruit_main707 wdym? dchem: can't use asyncdispatch with nim-web3 library FromDiscord_: instead of uncheckedArray OpenArray alehander92: dchem they are relatively similar FromDiscord_: openarray isnt a real type isnt it? alehander92: chronos and asyncdispatch dchem: Yes, but it's causing issues with compilation on 1.2.0 alehander92: hm, chronos should work on 1.2.0 iirc alehander92: i think status upgraded their code to 1.2.0 FromDiscord_: Rika: oh right, he should use toOpenArray() dchem: I mean you can use either chronos or asyncdispatch, but not both PMunch: Something like this? https://play.nim-lang.org/#ix=2jbt PMunch: inv2004_ ^ alehander92: dchem oh, i guess it would be hard to use both PMunch: Note that I wouldn't recommend that.. FromDiscord_: inv2004: can you show us the code? FromDiscord_: Araq: Oh, nice. I was just about to start looking at it. Araq: however, nothing I do works inv2004: PMunch, looks like (array[2, x])[1] works, Thank you PMunch: Yes, that would work to get the second int field PMunch: Still, wouldn't recommend it though.. inv2004: why UncheckedArray does not work ? FromDiscord_: you need to use ptr UncheckedArray FromDiscord_: ^ PMunch: Hmm https://play.nim-lang.org/#ix=2jby PMunch: What is up with the data in there.. PMunch: The 0th field should be the kind no? PMunch: Ah, nvm.. PMunch: The TestKind enum is sizeof 1 and the rest is just alignment PMunch: So uninitialised data PMunch: Makes sense inv2004: mratsim, it works, thanks, I forgot that my struct is a pointer FromDiscord_: i think that has nothing to to, its just that uncheckedArray should be used with ptr iirc inv2004: Another question: I reading this page: https://nim-lang.org/docs/destructors.html inv2004: But do I need any hook to inc_refs during contructor of the object ? inv2004: or `[]` works for constructor also? (Easy to check I suppose) inv2004: Misprint I mean `=` inv2004: Looks like it does not run for constructor Araq: there is no constructor you can hook into inv2004: ok, not a big deal I think inv2004: Another question why =destroy is not called for the line?: https://github.com/inv2004/k_nim/blob/38c559d1640b7ed2260d0d535f94aa65dc2b5215/src/k_nim.nim#L31 inv2004: a bit confused: it worked before :) inv2004: =sink prevent destroy. hm Araq: your =sink needs to destroy inv2004: why? I thought it is move inv2004: it is really necessary to define =sink? Or I can make first implementation without it and it will work with =destroy only? Araq: iirc =sink is inferred these days inv2004: but cannot understand why should I copy destroy into sink, or maybe I misunderstood something Araq: read our documentation please Araq: in imperative programming languages the assignment is destructive, it destroys the old value, both = and =sink need to clean up what was previously in the memory cell Araq: it's fundamental. FromDiscord_: Is there a tutorial for this stuff that explains the basics? I feel like I've only seen plans/proposals but they assume familiarity with the subject and I'm not sure how it compares to what actually got implemented FromDiscord_: Looking at that destructors doc it seems clearer than last time, but still not sure about the lent or owned stuff. Is that still relevant? Araq: 'owned' is currently not a thing, 'lent' is under-used Araq: you can ignore both Araq: exelotl: we don't have a tutorial yet but the summary would be "use --gc:arc, everything else is details you can ignore" Faulander: huch, ist github down? FromDiscord_: not for me FromDiscord_: oh, doch.. PMunch: Yup, it's down: https://www.isitdownrightnow.com/github.com.html Faulander: ok, good to know. Araq: clyybber: I am beginning to think the algorithm cannot be saved Araq: even if correct, it suffers from lots of other problems FromDiscord_: what problems? Araq: heavily shared nodes are 'yellow' all the time and incur the trial deletion overhead Araq: (which is enormous for 'havlak') PMunch: Faulander, sees to be back up now Araq: both 'incRef' and 'decRef' have even more instruction inside, so inlining them cause more code bloat Araq: *instructions PMunch: Eh, maybe not.. Araq: PMunch: it's down for me too FromDiscord_: Araq: Maybe we will get some optimization ideas after getting it to work Araq: but we have these optimization ideas Araq: they amount to "copy Python's algorithm, it's better" Araq: for Nim's case this means we introduce (un)registerPotentialCycle() operations and let the user-land deal with the problem Araq: want a cycle collector? import std / cyclecollector FromDiscord_: Araq: We could also make it opt in, via marking the objects as {.cyclic.} Araq: we can't really. the hard cycles are introduced by closures FromDiscord_: Or we try to prove as "hard" as possible that its {.acyclic.}, possibly via drnim? FromDiscord_: Araq: Hmm. Do you know how rust solves the closure problem? Araq: I know how Swift does it but I don't think it's applicable for Nim companion_cube: clyyber: rust creates a new (anonymous) type for each closure companion_cube: that's why you can write `fn mapB>(v: Vec, f: F) -> Vec {…}` companion_cube: oops, should be `B>` FromDiscord_: companion_cube: Oh yeah, I mean how it handles capturing/cycles introduced by closures companion_cube: because the type of `f` is itself a type variable companion_cube: cycles are impossible companion_cube: capturing is done either by reference, in which case the borrow checker must agree companion_cube: or by move (a move closure), in which case it moves inside the closure whatever's captured companion_cube: typically needed for spawning a thread companion_cube: `thread::spawn(move || { … })` as you can't borrow from another thread's stack alehander92: `move ||` is a syntax sugar, but is there a way to do it more granulary alehander92: e.g. `|a is moved, b is borrowed|` Araq: well we had pretty much the same solution with 'owned ref', 'owned proc' Araq: problem is that our legacy code doesn't work with it FromDiscord_: Can someone point me to any documentation about how C types map on to Nim types? Seems like an import subject which is only touched on in the manual and backends document, unless I've missed it. companion_cube: alehander92: really? :o companion_cube: what's the syntax for that? I didn't know companion_cube: do you just annotate the types? PMunch: Venator, what do you mean? PMunch: Like what is a C int in Nim? Or more like "what is this struct" in Nim? PMunch: Or the other way around? FromDiscord_: What is a C int and a C struct in Nim FromDiscord_: when calling out via FFI for example PMunch: Well most C types simply have c placed in front of them in Nim PMunch: So an int is a cint, an unsigned int is a cuint, etc. PMunch: Objects in Nim are pretty analogous to a structure in C. They don't contain anything extra so they map one to one for the simple case. PMunch: With variant objects and generics it gets a tad more complicated PMunch: Variant objects can be thought of as a structure with a union in them. And generics just create a copy of the struct for each distinct type. PMunch: char * can be expressed as cstring as well, not just ptr char. With cstring Nim will treat it as a zero-terminated string, with ptr char it will treat it as a single character. PMunch: If you need void * you can use `pointer` in Nim FromDiscord_: That may be enough for me then, the API I want to use is fairly straightforward and uses ints, floats, strings (const char*) and simple structs PMunch: Yeah, then these should be pretty much what you need: https://nim-lang.org/docs/system.html#clong PMunch: I guess this should be summed up in an article FromDiscord_: Yeah, the manual mentions cstring and cint but never defines them really, a more comprehensive C mapping doc would be nice I think companion_cube: or rather, you can make an explicit reference, and capture *that* by move if needed, I imagine companion_cube: but if you use a move closure it's probably because it's going to live longer than your stack frame alehander92: but doesn't that happen very often alehander92: probably most of the time with callbacks/etc except for functional code like map/filter chains companion_cube: depends what you use the closure for, I guess companion_cube: ah well, callbacks suck, I guess alehander92: that would be a good thing to coverage companion_cube: but then you allocate some place to put your closure, a Box or something like that alehander92: lifetime of closures in a run companion_cube: and use a move closure inv2004: ah, just understood that is was about destroy destination of = and =sink alehander92: companion_cube interesting Araq: inv2004: please write a short article about your findings, we need an arc tutorial inv2004: :))) companion_cube: alehander92: it's also interesting that the "default" is by borrow, which is enough for most iter/map/filter things disruptek: #13926 disruptek: nice! disbot: https://github.com/nim-lang/Nim/pull/13926 -- 6CT sizeof(+friends) for {.importc, completeStruct.} types, enable ABI static checks ; snippet at 12https://play.nim-lang.org/#ix=2jcQ Araq: companion_cube: if only this were true... the default is by "I take ownership" when you use the plain 'T' as a parameter. you have to use pointers everywhere else. ok, they are borrowed and safe but it's cumbersome shashlick: heh dev is blocked with github down inv2004: I started first part of the manual "how to set random ref_inc() and ref_dec() and run it until your program works" Araq: er... ok. FromDiscord_: GitHub seems to be working for me companion_cube: Araq: not in closures, afaik disruptek: pro streamer tip no. 43: always lick your earbuds before insertion; makes for a solid 8hr seal. companion_cube: sexy tip inv2004: seconds part of my GC interop manual: "when you debug rc in =destroy - it works perfect, if you remove it - it starts to leak" disruptek: lick first for a tighter seal. disruptek: it's like i'm talking to a wall in here. shashlick: the seal's too tight so you cannot hear the ack inv2004: but you can see it companion_cube: he also licked his eyelids FromDiscord_: the seal was so pleasurable their eyes rolled back shashlick: unlike ears, you gotta look disruptek: earballs be rollin' win i git on the mic disruptek: shashlick: is there a 1.2 branch in choosenim? shashlick: branch? disruptek: for the purposes of ci shashlick: probably ot disruptek: doesn't matter. disruptek: today we're gonna try something new. disruptek: compiler code with minimal surface. disruptek: a whole new world of challenge. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek lmariscal: https://reg.nim.moe/packages.json is a packages.json for nimble that acts as a mirror for all of nim packages lmariscal: it is running on a low budget vps so it's mostly an idea that I have (would like to expand it in the future) lmariscal: it also converts mercurial repos to git repos like linagl https://cgit.nim.moe/linagl lmariscal: it updates the packages every 30 mins and the packages.json every 10 mins lmariscal: you can find the cron jobs in https://github.com/nim-moe/cron if you want to create your own dom96: lmariscal, awesome! disruptek: or, just run nimph. martinium_laptop: boom martinium_laptop: Morning everyone FromDiscord_: gm o you FromDiscord_: to* martinium_laptop: Good afternoon for those across the pond martinium_laptop: :D FromDiscord_: no good evening for us? FromDiscord_: (tbf, its night here) martinium_laptop: Good evening Rika martinium_laptop: :) Prestige: good morning/evening :P FromDiscord_: Could just employ the generic "good day" FromDiscord_: what if i lived in a planet with no concept of days, hm? Araq: disruptek: nimph doesn't mirror packages, does it? disruptek: mirror? Araq: it's the proper term, I don't understand the question, I'm sure you know it disruptek: nimph doesn't have a package file, though it knows to grok nimble's. FromDiscord_: > what if i lived in a planet with no concept of days, hm? FromDiscord_: @Rika Error: OutOfBounds zetashift: But https://reg.nim.moe/packages.json also has a 'copy'/mirror of the nimble packages, I didn't read that nimph does that too? Demos[m]: someone needs to clone raku (perl6's) MAIN sub FromDiscord_: MAIN sub? zetashift: you mean this: https://docs.raku.org/routine/MAIN ? isn't this just a fancy isMainModule with docopt or something?? leorize: !repo cligen disbot: https://github.com/c-blake/cligen -- 9cligen: 11Nim library to infer/generate command-line-interfaces 15 171⭐ 12🍴 7& 1 more... leorize: it's literally this but look nicer by default FromDiscord_: what does the method {.base.} pragma do? - apart from stop the compiler complaining that baseless methods are deprecated? The manual uses it but does not explain from what I can see bung87: @Araq I'v done the work , yesterday we disscussed. leorize: Venator: telling the compiler what to dispatch to dynamically when the type it's not overridden for the current type afaict disruptek: Araq: nimph just searches github for packages. disruptek: i will use this other one if people like it. Araq: bung87: link to your PR? Araq: disruptek: there is an inherent danger of people deleting their repos from github bung87: https://github.com/bung87/htmlparser I upload it here. disruptek: that's a risk i'm willing to take. kaushalmodi: @bung87 I cannot see the exact commit fixing that issue Araq: bung87: thanks but that's what 'fusion' is about to fix Araq: your package lacks CI and didn't get a review process bung87: so leave it just there is fine ? bung87: also need fix the `runnableExamples` Araq: no... I mean, it's nice that you did it but it's not what I had in mind Araq: ping me about in the next two days please, I'm busy with something else Araq: for now it's good bung87: create pr that I'll rename the xmltree lib name as it specific to html now bung87: ok , just leave it for now utill you be free bung87: @kaushalmodi It'll fix all the opened issues that contains `htmlparser` Araq: narimiran: close https://github.com/nim-lang/Nim/issues/14026 please disbot: ➥ CI broken for release branches (version-1-0, version-1-2) narimiran: yep martinium_laptop: does the order functions are declared in a nim program matter? FromDiscord_: yes FromDiscord_: you need to forward declare martinium_laptop: meaning to declare above before calling? bung87: unless you using reorder pragma bung87: https://nim-lang.org/docs/manual.html#scope-rules-code-reordering leorize: it's beter to forward declare leorize: it works better for macros atm planetis[m]: guys what do you think: https://gist.github.com/b3liever/d1571d25917e670e9882e48618d6a834 planetis[m]: its a template that unwraps an (bool, T) tuple zacharycarter: using Nim in our hackathon project at work today for an AWS lambda function leorize: planetis[m]: you can use `bind` to bind `isNil` so you don't have to do the system.`!=` dance leorize: zacharycarter: are you winning? planetis[m]: though I read here that isNil is going to be booted leorize: you can also bind `==` and `!=` if that's more of your thing :P planetis[m]: no idea what bind does, will read about it alehander92: huh crafty Prestige: zacharycarter: Nice! I should do that at our next hackathon alehander92: still i'd prefer to use a single Result/Option type if i can alehander92: and let it be represented by the value itself for pointers alehander92: and for range ints (where one can use start - 1 or end + 1 for invalid) alehander92: we almost never need the full int range anyway leorize: yea that's how Option[T] is declared alehander92: but i doubt it works for int alehander92: ranges like that planetis[m]: btw i got the ?= operator idea from a test in Nim alehander92: / uint etc leorize: it works for Natural and Positive :P alehander92: hmm and Option still is a struct with val alehander92: even for pointers Prestige: LOL Prestige: Wrong chat alehander92: what i thought people want is Option*[T: SomePointer] = T alehander92: distinct T * maybe leorize: alexander92: https://github.com/nim-lang/Nim/blob/devel/lib/pure/options.nim#L71 alehander92: no no no leorize: a struct with only a val have zero overhead leorize: compared to the val alone alehander92: forgive me alehander92: yeah i understand you now! alehander92: thanks alehander92: but still i wonder about the `some` case alehander92: because it is `create a separate struct and copy the val there` vs `just use the val` dumjyl: it throws or something if given nil alehander92: that's fine leorize: create a struct and copy the val there have zero overhead compared to just use the val for pointers :P leorize: a struct with one element is the element itself, literally leorize: sizeof() both of them and you'll find that they are equal alehander92: i know leorize: inspect machine code and yea, same story :p alehander92: i mean i realized it after your previous messages sorry :P alehander92: but i wonder if alehander92: it somehow introduces +1 copy alehander92: but probably not because its a return value alehander92: in both `some` and `get` leorize: with sink inference it will captures the input completely if allowed alehander92: and `if b1 ?= b`actually seems like something i'd use alehander92: thanks! leorize: now I finally understand while libc have a buffer inside FILE* leorize: they have to implement getline() :P zacharycarter: leorize: don't know yet zacharycarter: Prestige: yeah the nim lambda github projects make it super easy to use serverless framework and get something up quick Prestige: It would be awesome if my company would up and switch from C to nim, lol Prestige: We mostly use JS for lambdas, and I just went through a whole ordeal convincing the CTO to let us use typescript, so nim is probably not going to happen soon :/ thegod: inim is breaking CI for PRs FromDiscord_: leorize: Disruptek mentioned that you might be using IO completion ports? thegod: inim seems to have a new dependency "ansiparse" which nim CI doesnt have installed PMunch: Added four hours ago leorize[m]: @Varriount: yes? narimiran: i'll fix it, thanks for the report PMunch: Oh, and I haven't added ansiparse to nimble.. narimiran: hmmm, nothing to fix there :/ narimiran: inim already had some dependencies, and any new one should be automatically picked up narimiran: thegod: which PRs are broken? zacharycarter: Prestige: I wouldn't mind coding in C zacharycarter: for a job thegod: seems to be just #14084 disbot: https://github.com/nim-lang/Nim/pull/14084 -- 3changed type() to typeof() in docs and error messages PMunch: Added the ansiparse and ansitohtml packages to nimble (or rather created a PR for it) https://github.com/nim-lang/packages/pull/1444 disbot: ➥ Add ansiparse and ansitohtml packages narimiran: thegod: i'll restart tests for that one Prestige: zacharycarter: our code base is huge messy and old Prestige: the people who wrote it are mostly gone, too PMunch: Prestige, that reminds me of a time at my first workplace. Went up to a guy and asked him about some code. He said he'd never seen it before. I told him that according to the git history and the author section in the files it was he who had written the whole thing. He took another look and went, oooh yeaah, now I remember this. Been a while since I've seen this old thing, no idea how it works FromDiscord_: @alehander42 fwiw, we just added `Opt[T] = Result[T, void]` which works out nicely - https://github.com/status-im/nim-stew/blob/master/stew/results.nim - in fact , using `Result` in Nim is pretty nice overall, the code is clean and readable, yet stresses the right things on the calling side - ie which expressions fail etc FromDiscord_: with `Opt[T]` being the same as `Option[T]` but with a slightly richer API Prestige: PMunch: Lol yeah, pretty much how it goes Prestige: even better when variable names are 1 to 3 letters long PMunch: Of course, can't wear out that keyboard! PMunch: Especially the vowels, those are extra precious PMunch: But TBH I prefer that to the C# way of doing things Prestige: What's the C# way, super long names? PMunch: Yes, basically typing the procedure out in the name PMunch: String StringReturnedFromCallingProcedureThatReturnsStringBasedOnWhatEnvironmentVariableHelloIs = ProcedureThatReturnsStringBasedOnWhatEnvironmentVariableHelloIs(); alehander92: arnetheduck alehander92: thanks! i had some ideas how would i like to use ` result`-like dsl in nim PMunch: Instead of just `var hello = getEnv("HELLO")` PMunch: And of course brackets need their own line.. alehander92: arnetheduck a thing i liked looking at zig is some kind of enum-ability / automatically making sets of call errors when you propagate them Prestige: Yeah, the C code I work with does that too PMunch Prestige: the brackets, I mean alehander92: i tried to think of a good syntax for that with `Result[]` and i think its doable Prestige: btw thanks for that link about window managers, been really helpful alehander92: but it might be not such a big deal for most codebases where one mostly follows a strict set of errors anyway narimiran: offtopic question: how do i escape `'` in vim config? narimiran: (and no, `\'` doesn't do the trick) FromDiscord_: alehander42 - well, I don't know really if that's a feature or not - ie enum-as-error is moderately great - you only need it if you're going to differentiate errors in the callee, otherwise a `cstring` is fine (which you _never_ compare with, just print as a debug statement basically) FromDiscord_: I feel that it repeats some of the issues with exceptions, namely that it creates a leaky abstraction where errors from lower levels propagate up the call hierarchy instead of being deliberatly considered at each layer FromDiscord_: if abstraction is the goal, leaking errors from the depths of your application makes for a proper spaghetti sauce FromDiscord_: but I don't have experience really with zig - maybe it's fine FromDiscord_: what does happen with enum however is that you end up making "catch-all" or coarse enums that are difficult to debug: because there are multiple places in your code that return the same enum (because it's such a pita to make a new one, or keep the enum list "clean" and free from cruft), it's harder to find where the error originated from.. with `cstring`, programmers tend to type out a unique string for every error so you can grep for disruptek: strings are useless for typechecking. Araq: I'm a fan of a single error enum that is used for everything fwiw disruptek: enums are create for cases. disruptek: great, too. Araq: it works for Posix disruptek: copying bad design... companion_cube: zig does that too, but it generates the whole enum automatically companion_cube: you don't have to declare all variants in one place Yardanico: about zig " However, each error name across the entire compilation gets assigned an unsigned integer greater than 0. You are allowed to declare the same error name more than once, and if you do, it gets assigned the same integer value." Yardanico: https://ziglang.org/documentation/master/#toc-Errors FromDiscord_: I'm merely relaying experience from working with Result - tendentially, the code gets organized into units which logically either fail or work - there's rarely any middle ground that calls for an enum that you later need to case over companion_cube: OCaml has "polymorphic variants" which are structural sum types and have similar properties bung87: Can declare multiple const with `when`? Yardanico: @bung87 well yes, depends on what you actually mean by that disruptek: arnetheduck: see gittyup disruptek: !repo gittyup disbot: https://github.com/disruptek/gittyup -- 9gittyup: 11higher-level git bindings that build upon nimgit2 15 1⭐ 0🍴 disruptek: plenty of effective use of Result there. disruptek: and casing. disruptek: as enums. bung87: how to do that, I using when two times now FromDiscord_: so programatically, enum's only make sense if later you have `case result.error of A, B, C` disruptek: i cannot help it if you are too lazy to write explicit code. Yardanico: @bung87 show the code please bung87: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea1e7d43ea9b172a4866ed7] bung87: here is what I intend to do, all case are same, so I wonder if I can assign just onece FromDiscord_: disruptek - it's not so much laziness as the general strucuture of code that simply doesn't end up needing to deal with multiple failure cases in different ways - instead that function might be split up into two functions that each fail separately, and then you don't need the enum FromDiscord_: the operations become more "atomic" and binary zetashift: can't you just do `const entryType = url` then? disruptek: then don't use Results? FromDiscord_: well, it's not always like this - just tendentially 🙂 FromDiscord_: 50% maybe FromDiscord_: and then it's nice to have a descriptive string around which tells you what went wrong disruptek: exceptions. Araq: the enum exists to make it future proof, currently it can fail with A, B, then you call baz() which can fail with C and the clients already had to swallow all possible failures :P FromDiscord_: then there's maybe 20% that benefit from an enum bung87: entryType is enum type disruptek: enums in case statements test for exhaustion. this is the point. disruptek: someone tell me what i'm doing wrong with import foo / [bar, bif] syntax. FromDiscord_: and 20% that benefit from a complex type and finally 10% that benefit from exceptions (ie the truly exceptional cases) bung87: ok , I got it, assign entryType first then assign url Yardanico: @bung87 when blocks don't open a new scope Yardanico: so you can declare consts inside of "when" statements FromDiscord_: well, what if you don't have any cases to test for? I mean - an RSA key negotiation might be composed of 5 steps, but at the end of the day, if you don't get a secret key, you don't really care if it was the a or b key that didn't match expectations so there are really no cases to check for disruptek: sounds like nice code. bung87: @Yardanico thank you ! so I can write `const url =` in each case Yardanico: yes FromDiscord_: https://github.com/status-im/nim-eth/blob/master/eth/p2p/ecies.nim#L185 - lol this was ported from an enum status code, so it happens to use an enum return - but _nothing_ would change if it switched to cstring because there is no case where the underlying result error is checked specifically - so you can see that `mapErrTo` simply puts a single enum value in place for any error that might have happened when parsing the public key FromDiscord_: basically, enum or some more involved type is good if you need to transport more data to the caller than "it worked" or "it didn't work" - a typical example is `send` from sockets which returns `eagain` if the write buffer is exhausted and you should call again - literally all other error codes from `send` mean "it didn't work, and won't work, stop trying" and you don't differentiate between them other than to show an error to the user Araq: enums also have i18n benefits, it's rather easy to translate the frozen set of errors into different languages disruptek: i can't seem to squirrel away ic code in the compiler because i cannot figure out how imports work with relative paths. FromDiscord_: true - that is an advantage - though gettext works with strings and not enums - in part because the string might take parameters, and some languages need conjugations etc disruptek: 🤦 Araq: and I claim that if you enforce a single error enum throughout the programming language you get interop benefits FromDiscord_: well `import a/[b, c]` works but `./[b, c]` doesn't - perfectly logical 😉 Araq: `.` is not an identifier and the general expression parsing logic is used. logical indeed FromDiscord_: well `import a/[b, c]` works but `import ./[b, c]` doesn't - perfectly logical 😉 disruptek: idgaf, i want compiler/ic/spec to import compiler/ast Araq: it simply works more consistently than users might anticipate. *shrug* FromDiscord_: well I don't care about that distinction - I'm mostly upset that I can't group my imports consistent FromDiscord_: well I don't care about that distinction - I'm mostly upset that I can't group my imports consistently Araq: disruptek: need my help on mumble? disruptek: if it's not too annoying, please. Araq: ok, one sec FromDiscord_: but I'm more upset about not being able to return a proc from a proc easily - ie `proc x(): SomeCallback = proc () = echo hello` doesn't parse - you have to `proc x(): SomeCallback = (proc () = echo hello)` FromDiscord_: > single error enum throughout the programming language FromDiscord_: you also need a global assignment oracle and someone to tell you which enums are no longer in use disruptek: {.used.} {.deprecated.} shashlick: @PMunch - https://github.com/nimterop/nimterop/blob/master/tests/rsa.nim PMunch: Oooh, is the RSA wrapping done? shashlick: yep, in master, part of the official nimterop test on linux shashlick: you'd need to expand it to download headers on windows if you need that shashlick: i'm thinking of building and wrapping libressl shashlick: so you can statically link with nimble install nimressl shashlick: if there's interest FromDiscord_: @disruptek badresults is your way of doing versioning? 🙂 disruptek: it's my way of using your code the way i want to. FromDiscord_: what did you change? disruptek: i explained my issues in your repo's issues. disruptek: i don't want to fucking impl `func $` for every type i wrap in Result. shashlick: disruptek - by the way, i made a cmake package in nimble so you can requires "cmake" instead of telling people to use scoop disruptek: side-effects. they are a part of life. shashlick: works on windows disruptek: cool, thanks. disruptek: i'll update nimph readme. shashlick: but ya, we should move to binary releases shashlick: nimph isn't a library so we should make it easy to distribute FromDiscord_: @disruptek but.. I remember asking for a case where you actually had side-effects in `$` - ie you can call a proc from a `func` as long as it doesn't actually do side-effects disruptek: well, you know where to find my reply. FromDiscord_: and having side-effects in `$` - well, I was just struggling to come up with a case where that was a good idea FromDiscord_: well, I looked and posed a questoin in response - ie do you have a side effect in there or is it deduced wrong? FromDiscord_: then you closed the issue disruptek: i deduced the approach was wrong. FromDiscord_: arnetheduck: There's also the plain reeason that disruptek felt that implementing `$` for every type used was too tedious, and so forked it for his own use. disruptek: i'm a lazy anti-social prick. FromDiscord_: There's nothing inherently wrong with that. FromDiscord_: Varriount, you don't have to implement `$` for every type - only if you call `$` on Result disruptek: bzzzt. FromDiscord_: arnetheduck: Again, perhaps he felt it was too tedious. FromDiscord_: well, I'm trying to find out what was too tedious - then I could judge whether the change makes sense to upstream, or if there exists another solution that will please us both FromDiscord_: It's not an objective thing - what you might find acceptable in a set of requirements, someone else might find too much. disruptek: there's no interest in extra work that doesn't even establish that no effects exist. FromDiscord_: again: I'm not objecting - I'm curious disruptek: you are welcome to play with gittyup. FromDiscord_: I'm not _that_ curious 😉 if you find it less work to fork, that's totally fine - we each have our use-cases - I got curious also because we've made some significant updates to work around a bunch of compiler bugs that you might be interested in PMunch: Hmm, are float no longer always 64 bits? PMunch: It says "Default floating point type" in the manual, but doesn't specify what that actually means.. FromDiscord_: Whichever is native to the target you compile to I guess solitudesf: https://nim-lang.github.io/Nim/manual.html#types-preminusdefined-floating-point-types PMunch: According to the tutorial it's always 64 bit https://nim-lang.org/docs/tut1.html#basic-types-floats PMunch: "In the current implementation" FromDiscord_: or rather, I don't have bandwidth to be _that_ curious - we use Result as a tool to meet certain needs, so I'm curious as far as those needs go - your use case, I'm curious because maybe we'll come across it also, and then it's good to be prepared PMunch: Is there a particular reason why int is the same size as a pointer? For speed? For compatibility with something? For fun? FromDiscord_: we use `func` because it gives us guarantees about a whole class of bugs that we want to avoid in our codebase - so relaxing `Result` to not use `func` is a functionality loss from our point of view - hence we'd want something in return martinium: how can one debug a running nim program? martinium: one of my functions doesn't seem to execute and I have no idea why martinium: currently using vscode to write it FromDiscord_: oh and those of you that needs SSL: https://github.com/status-im/nim-bearssl - no pesky openssl license and no need to muck around with dll:s - it builds the C code automagically when you import it Prestige: martinium: you could start the program with gdb, or if it's already running you can attach the pid w/gdb PMunch: Why is cint defined like this? cint* {.importc: "int", nodecl.} = int32 PMunch: int in C can be anything from a int16 and bigger. PMunch: shashlick, that would be great! But what do you mean by "you'd need to expand it to download headers on windows"? disruptek: /home/adavidoff/nims/1.3/lib/pure/ropes.nim(59, 3) Error: 'N' should be: 'n' dom96: lol at that error shashlick: PMunch - point it to the headers since mingw doesn't have openssl installed by default PMunch: Oh right martinium: scoop install openssl helps on windows martinium: if you went the scoop route Bennyelg: (https://files.gitter.im/nim-lang/Nim/FE1v/image.png) Bennyelg: Is that a jester bug? Bennyelg: Im reading request.params Bennyelg: but after the 3rd element its start to mee up Bennyelg: mess up Bennyelg: (https://files.gitter.im/nim-lang/Nim/iVG4/image.png) dom96: what's your request path? Bennyelg: managed. I was missed the & :| thanks shashlick: arnetheduck: can you use bearssl as a replacement for openssl in an existing project? shashlick: looking for static link for choosenim dom96: shashlick, really, if the machine's curl is broken then I don't think there is much we can do dom96: we shouldn't add yet another dependency that's unproven just to fix this FromDiscord_: shashlick: well, they don't implement the same API so you need to adapt your code Yardanico: libressl OTOH is compatible with openssl afaik Yardanico: i tried using it to statically link linux apps Yardanico: there's also https://github.com/kaushalmodi/hello_musl FromDiscord_: what's nice about bearssl is how easy it is to build and embed - works on windows too dom96: bearssl isn't ready for production yet though, is it? dom96: last time I checked the author wasn't comfortable recommending it to be used in prod Yardanico: "There is no such thing as bug-free code, and I won’t claim that there is none in BearSSL; only that I looked real hard. Use in production applications is, in any case, at your own risk." dom96: "Current version is 0.6. It is now considered beta-quality software:" dom96: beta implies to me that it's not ready for real-world usage FromDiscord_: I think that's what he said too dom96: this is especially true when talking about crypto shashlick: dom96: my concern with choosenim is that we want an older OSX build but don't want to then force users to install some specific openssl version in order to use it shashlick: i'd rather pick the latest libressl and link it in so that end user doesn't care shashlick: likewise for windows where we need dlls today dom96: shashlick, like I replied in the issue, I'm confused why it worked fine for me with curl. shashlick: honestly no idea cause i'm not much of an osx user shashlick: but my PR's travis jobs show you the failures dom96: shashlick, can you add a check for `curl -v` on the travis job? dom96: Maybe homebrew ended up replacing my system curl :( shashlick: sure i can try shashlick: the thing that confuses me is brew installing stuff without adding to system path since it can conflict with OSX's version shashlick: so you can hack your build to pick it up but end user might not do that and you end up with runtime failures dom96: of course. I was under the impression that it was a system curl that I had in my PATH dom96: If it isn't then yes, we need a different solution shashlick: is curl == libcurl or are they different packages Yardanico: what about libressl dom96: no idea Yardanico: it's osed by OpenBSD Yardanico: used* shashlick: yep that's what i'm proposing - static link to libressl shashlick: similar to nimarchive dom96: if you want to implement libressl support for the stdlib then that would be really nice shashlick: dom96: i forget - why curl on osx? why not httpclient dom96: shashlick, because openssl failed on OSX for me dom96: with cert errors dom96: curl worked fine shashlick: so on osx, choosenim isn't linking to libcurl? it just calls the curl CLI? dom96: yeah dom96: or wait dom96: no, it's libcurl Yardanico: @dom96 libressl already works with stdlib Yardanico: it's compatible with openssl dom96: Yardanico, yeah yeah, I mean static linking support Yardanico: it works too :P Yardanico: https://github.com/kaushalmodi/hello_musl dom96: shashlick, guess we really should check libcurl version then shashlick: so sounds like if we brew install curl, it might just work then shashlick: even on the old version dom96: Yes... but you can do the same with openssl dom96: We need to establish if it works out of the box with curl dom96: I just checked `brew info curl` and I don't have it installed dom96: so either I somehow managed to get libcurl that is newer without homebrew or it should work dom96: shashlick, if you try `curl --version` on travis and maybe attempt to download a release from github as well we can gain some insights. FromDiscord_: @araq https://github.com/nim-lang/Nim/pull/13908 - y/n? would be nice because we're having some trouble with this - ie somewhat unusually, we're actually trying to catch exceptions and not let things crash but people get confused disbot: ➥ Error -> Defect for defects leorize: so a thing people usually do with pipes is to read lines from them leorize: now to implement this functionality, I'd need to be able to store an internal buffer leorize: question is: should this turn into it's own type (ie. BufferedPipe) or should this just be a property of the same pipe type? moerm: Hello everyone disruptek: leorize: its own type. moerm: Hmm ... bye companion_cube: disruptek: you said the wrong thing FromDiscord_: Disruptek never says anything wrong disruptek: wrong wrong wrong FromDiscord_: see never said "anything wrong" disruptek: i'm good but i'm not that good. disruptek: its times like these i wish i got into ice road truckin'. FromDiscord_: That's just driving around banff isnt it? disruptek: you could do worse. FromDiscord_: Yea like driving across the permafrost up north disruptek: not for me. disruptek: winter is a difficult time. disruptek: balls clinkin' together like cubes in a glass. disruptek: no thanks. FromDiscord_: Lol, i live in an area that the average temperature in january is like -30C disruptek: i wouldn't call that `living`. dom96: Wow, HashSet sure is slow in the JS target FromDiscord_: so I'm trying to do a cpFile call from a nimble task, but I'm getting Access is denied FromDiscord_: nvm looks like I just had bad syntax FromDiscord_: Hello Yardanico: hi FromDiscord_: Sup? FromDiscord_: Could i ask about Nim use cases? Yardanico: well you can, but what do you want to know exactly? FromDiscord_: What cases is it useful in? FromDiscord_: And is it meant as an alternative to something? Yardanico: well Nim is general-purpose and no, it doesn't position itself as a direct replacement for some other language Yardanico: you can literally do anything in Nim since it compiles to C (and C++/ObjC/JS) FromDiscord_: Okay, that's cool Yardanico: but how easy that would be depends on the task ;) FromDiscord_: I think i have a way to use Python if you use C or C++ btw Yardanico: ? FromDiscord_: I think i have a way to use Python modules in Nim if you use C or C++ btw FromDiscord_: You know the language Python? The interpreted lang? Yardanico: wdym? well there's a module to use python modules in nim and nim modules in python Yardanico: i know python FromDiscord_: Oh FromDiscord_: Well FromDiscord_: I have another theoretical way to use Python modules in Nim Yardanico: also don't edit your messages in discord, they'll just be sent as new ones in IRC instead you can corrent like *corretion) FromDiscord_: oh okay, nice FromDiscord_: oh okay Yardanico: *correction :P FromDiscord_: Oop- FromDiscord_: I just realized i edited my message 😅 FromDiscord_: Well since I'm a Python programmer, myself my mind immediately thinks "can i use Python in ...", And since there is a tool called Cython, i can make a C function in Python which allows me to use import statements in Nim Yardanico: yes but that's more effort than just using nimpy FromDiscord_: Cython can compile Python to C FromDiscord_: Eh Yardanico: https://github.com/yglukhov/nimpy FromDiscord_: Oo FromDiscord_: Doesn't that actually use Python Yardanico: it does Yardanico: but that's kinda the point FromDiscord_: I mean does it use it as a bridge FromDiscord_: Wait FromDiscord_: I can't English ;-; Yardanico: it uses CPython's dynamic library FromDiscord_: So it uses CPython itself, basically calling the Python function Yardanico: yes FromDiscord_: Because i think my method won't actually even need Python installed FromDiscord_: I'm not sure though FromDiscord_: It might FromDiscord_: I will try it as soon as i figure out how to use C or C++ functions in Nim Yardanico: Cython will use your local python installation as well Yardanico: it doesn't embed CPython in the binary FromDiscord_: When the code is compiled? FromDiscord_: There is an embed option Yardanico: you can do the same with nimpy then Yardanico: just link statically with libpython FromDiscord_: Okay then FromDiscord_: Is there a C to Nim converter somewhere? If so, can i have a link to it? FromDiscord_: Nvn FromDiscord_: Found it Yardanico: there Yardanico: there's c2nim but it doesn't work for all C code Yardanico: there's also nimterop but it's mainly for wrapping C libraries by wrapping headers FromDiscord_: yeah FromDiscord_: Oh okay Varriount: Yardanico: One median blur filter, and that looks like it would make a great desktop Yardanico: lol martinium: Hello, everyone I am glad to see all the progress Nim has made since I last used in version 0.13 Yardanico: martinium: wow that was quite a while ago :P martinium: Documentation is spectacular! So great job guys martinium: I am converting a python script I use at work into Nim martinium: I need the performance martinium: python script is still running for over 5 hours and I think Nim should be able to do it faster Yardanico: what does it do? martinium: we use a vuln management tool at my job so I am using API to get all site names within the tool and create a custom dict that stores its name then using the ID of the site I have to do another http request to another endpoint to get the list of assets and their IDs and paginate through however many pages Yardanico: that mostly sounds like an IO-bound task though martinium: then after than I am searching for each asset IDs vulns and iterating through them all and exporting to CSV with name of site etc that I put together from first call martinium: then filtering to just TLS/SSL vulns with an if conditional martinium: so far running time for python script is 6 hours martinium: still going martinium: we have a lot of assets martinium: anyways, my question is how do you do HTTP basic authentication with httpClient in Nim? martinium: I am spoiled by Python's Requests lib Yardanico: well basic auth is just an "Authorization" header with stuff Yardanico: https://stackoverflow.com/questions/47791826/how-do-i-authenticate-using-nims-httpclient-module-to-retrieve-html :P martinium: yeah you have to base64 encode it martinium: username and password and then base64 encode it martinium: "Authorization: Basic" is the header martinium: was just wondering if there was a time saving function in Nim to handle that martinium: seems newProxy seems to implement what I am looking for but I don't need a connection proxy Yardanico: well it uses a "Proxy-Authorization" header martinium: yeah martinium: need it to be only Authorization: Basic header instead martinium: guess I'll have to create a custom function to take care of that martinium: anyone know how to import variables from a separate source file martinium: I am doing from file import * and it isn't reading my variables Varriount: martinum: Are you exporting your variables, and isn't it just `import file`? leorize: I can see python habits peeking through :P martinium: how do I export the variables so they are visible in other source file? Yardanico: martinium: use asterisk * Yardanico: like "proc test*()..." Yardanico: or "type MyType* = myfield*: int" martinium: yep that solved it martinium: Thanks! skrylar[m]: i had some nim support code for flatbuffers somewhere Varriount: martinum: https://gist.github.com/Varriount/bacbcb5af7e75f686249eec3a94195f5 skrylar[m]: @Recruit_main707 https://github.com/Skrylar/skflatbuffers Varriount: What are flat buffers? Aren't buffers usually flat by default (being backed by arrays and all...)? Yardanico: xd skrylar[m]: nah its one of those serialization formats thats largely blitting structs skrylar[m]: there is an offset field that says each field is N bytes from the table and then you can do some machinery where you read those offsets and adjust some pointers, it was meant for some phone games to get out of having to do serialization code martinium: plan is to convert this: https://gist.github.com/martinium/c93119a6e4fb0bb4914fc5dfbc7c91af into Nim Yardanico: I still think that it's mostly IO-bound Yardanico: and even in python you can make it much faster with async skrylar[m]: @Varriount the weaker platform (the phone) can blit the structs and put in some offset blobs, the stronger one (server) can adjust some pointers so deserialization is mostly an extra pointer deref... capnproto has a similar idea but does it differently. they're both a little worse with bandwidth though since they don't compress as well skrylar[m]: (capnproto the fields always have the same order so theres no offset table, but the structs are packed in a deterministic way which is not the same as the C compiler) martinium: Yardanicowouldn't IO be much faster in a compiled language regardless? Yardanico: IO means that most of the time is spent waiting for IO Yardanico: for network requests or writing data martinium: it does the network request then processing the data then writes each row Yardanico: well I suppose nim version will be faster anyway but you can make python version much faster nonetheless martinium: seems to take a while and I have a super fast SSD martinium: running for 6.5 hours elapsed so far martinium: if my nim converted version ends up much faster I am going to jump martinium: then I'll make it async martinium: text data over internet is usually super fast skrylar[m]: i don't suppose you've put in profile tracing code yet :eyes: Yardanico: martinium: not when you do like millions of requests sequentially :P Prestige: not sure if this is a bug, but I'm getting an error with imports here: https://play.nim-lang.org/#ix=2j1r Yardanico: what error Prestige: Line 51 says windowmanager isn't defined, but works if i import nimdow/windowmanager as windowmanager Yardanico: oh lol wtf is / Yardanico: oh nvm Prestige: I also can't import windowmanager inside that import array (lines 3-7) Prestige: Does that seem off? Here's the file hierarchy: https://0x0.st/ijst.png Yardanico: i'm not sure but it probably happens because you have "a/b" inside of [] import Prestige: weird because that syntax is working on its own Yardanico: well idk if you really can use it like that in brackets :P Yardanico: i've never seen that martinium: success, authentication and API calls working good martinium: are the methods for the asyncHttpClient roughly the same as non async? Yardanico: yes, but you need to call them in an async context Yardanico: and to actually take advance of async you will need to do start all futures in a loop or something, and then wait for completion of them all martinium: to work with a received json response can I access the data directly using iterator["key"] syntax or do I first need to parse it into a jsonnode for nim? Prestige: Hm well Yardanico if I change it to this, I still have to use `as windowmanager` https://play.nim-lang.org/#ix=2j1u Yardanico: martinium: you get strings from httpclient mostly (if you do stuff like getContent), but if you use something like "get" then for async you'll also need to await the body of the response Yardanico: and then parseJson it Yardanico: Prestige: well maybe compiler is confused so it reports "not used" Yardanico: but does it work with the first way? martinium: I did this and printed to std out using req.body() in echo function to see if response was good martinium: var req = client.request(url, httpMethod=HttpGet, multipart=data) Prestige: with a/b inside the array? Yes that works Yardanico Elegant Beef: Prestige do you know how to get requests of full screen/floating? martinium: how can I deal with this error Error: unhandled exception: input(1, 5) Error: string literal as key expected [JsonParsingError] Prestige: Nah haven't looked into it yet Elegant Beef Prestige: about to finish up user config stuff Elegant Beef: Ah im just about to go to user config stuff 😄 disruptek: martinium: fix your js encoder to follow the standard. Elegant Beef: Current progresshttps://streamable.com/gzztzv disruptek: beef: is this wayland or...? Elegant Beef: xlib Prestige: Nice Elegant Beef disruptek: there's that troubled pupper. Prestige: I haven't actually started on anything with window management yet, just config for key bindings martinium: I have no clue how I would fix that martinium: lol Elegant Beef: I mean he knows i've talked to you, he's just worried about me martinium: :) disruptek: pipe it through jq i guess. martinium: doing this martinium: let jsonNode = parseJson("{req.body()}") Elegant Beef: Yea like i said i want to use nim script for configurating my wm so I think im going to give the window managing a break and implement the nimscript stuff i need disruptek: or use npeg. Yardanico: martinium: nim has string interpolation, but not in all literals :) Yardanico: let node = parseJson(req.body) Elegant Beef: Then after the config i get to figure out how to make nimscriptable imgui widgets 😄 martinium: I was just following example martinium: they had quotes around it etc Yardanico: martinium: where? Yardanico: if they had quotes, then they also had "&" or "fmt" before the string which comes from "strformat" module and it's really useless in this example martinium: from here https://nim-lang.org/docs/json.html martinium: I should have paid closer attention since it was literally literals in there martinium: haha martinium: so that fix worked but it ignored my multipart query martinium: it only iterated through 10 martinium: api response default is 10 max is 500 martinium: I added the filter for it to be 500 so weird that the loop only did 10 disruptek: maybe it got tired. disruptek: i usually need a sip of something between 6 and 8. martinium: probably martinium: wow my python processing finally finished martinium: took it 7 hours martinium: .... Prestige: Elegant Beef: I just finished user config, aside from dynamically loading the file's location martinium: Nim save meeeee Prestige: https://github.com/avahe-kellenberger/nimdow <- using toml martinium: anyone create a library like this for Nim yet? http://zetcode.com/python/prettytable/ martinium: if not I may take it upon myself when I come to grips with the language enough Yardanico: there's https://github.com/xmonader/nim-terminaltables martinium: ah perfect martinium: same thing martinium: does nim allow you to create empty hashmaps and empty lists? Yardanico: martinium: of course disruptek: since when? Yardanico: var myemptyseq = newSeq[string]() for an empty sequence of strings martinium: I am trying to declare an empty list as var id_lst = @[] Yardanico: you need a type Yardanico: nim can't infer type in that example Yardanico: so you either do var id_lst: seq[mytype] = @[] or var id_lst = newSeq[mytype]() martinium: ah I see martinium: same thing for a hashmap or slightly different? Yardanico: it's called "table" in nim, "tables" module Yardanico: if you need value semantics, var tabl = initTable[keytype, valtype]() Yardanico: if ref semantics - var tabl = newTable[keytype, valtype]() martinium: Thanks, this will save me some googling Yardanico: no need for googling Yardanico: https://nim-lang.org/docs/tables.html disruptek: WHEN DID WE GET DOCS? martinium: I will say the docs have improved substantially since I was here last martinium: 0.13 was a while back martinium: back then they were good also martinium: but now there are even more examples I think martinium: can a table have multiple value types if so how? Yardanico: no Yardanico: what's your use case? disruptek: use a variant object. martinium: only thinking of json since it has diff value types disruptek: that a negatory, ace. Elegant Beef: lol prestige, dynamic file location is silly, just for `~/.config/wmname/wmname.configextension` martinium: but nim has specific json types for jsonNode already Yardanico: martinium: you can use json module, yes disruptek: no, they are all type JsonNode. Yardanico: also, why do you really need that? Prestige: Atm I just load config.default.toml from the project Beef Elegant Beef: ah Elegant Beef: Im also going to use toml, since embedded nimscript seems very limited for what i wanted Elegant Beef: and i cant be arsed to expand it Elegant Beef: So widgets will end in a burning ring of fire Prestige: I'm going to have a global default config, and a user config that will be in ~/.config/nimdow/ Elegant Beef: or i just use a different bar Yardanico: it's much less limited than TOML though :P Elegant Beef: Yea but i wanted to pass types from nimscript to nim but it's currently not possible Yardanico: wdym "types"? Elegant Beef: Constructed objects Prestige: Reading PMunch's code that uses NimNodes is hurting my brain Yardanico: you mean macros disruptek: get him to read it for you; he has a voice like liquid sex and thighs that just won't quit. Prestige: Yeah, using NimNodes and quote do Prestige: lmao disruptek disruptek: what? Prestige: It was a very funny sentence Prestige: I think he and I are going to talk about the code this weekend but yeah disruptek: i never knew what they meant by "a dancer's hips" until i met pmunch. Yardanico: disruptek: your voice is very nice too :P disruptek: awww martinium: what is the proper way to add url query params? martinium: I mistakenly used Add() martinium: on a newMultiPartData() object Yardanico: concat Yardanico: string concatenation :P if you mean for get requests martinium: yeah martinium: so manually? disruptek: there's an encodeQuery iirc. martinium: let me look that up Yardanico: ah yes Yardanico: there is, in "uri" module martinium: https://nim-lang.org/docs/uri.html#encodeQuery%2CopenArray%5B%5D martinium: yep martinium: have to import uri module disruptek: FUCK disruptek: it's just one thing after another with this fucking language. Yardanico: disruptek: i see you're not in a good mood today xd disruptek: my balls are throbbin', that's for damn sure. disruptek: you know what i hate about uri? Yardanico: wat disruptek: it defines Url and doesn't use it for shit. disruptek: fucking useless. Yardanico: lol actually yes Yardanico: xdd Yardanico: it's there for at least 6 years disruptek: i need an ice pack; those brazilians did a number on the ol' plums. Yardanico: https://github.com/nim-lang/Nim/commit/cf87759e2911cb44aaf1e107f20417df74d2a606 Yardanico: it was actually used! Yardanico: in the past disruptek: great, that really helps. Elegant Beef: prestige are you using the toml nimble package? disruptek: i done tol' you not to use that shit. Elegant Beef: You didnt tell me Yardanico: disruptek: I think toml is fine :P Prestige: parsetoml Elegant Beef: Also you cant use said shit cause it doesnt install Yardanico: "parsetoml" Elegant Beef: No issues installing it? Prestige: nah, I just nimble install parsetoml Elegant Beef: Well it seems to not like me then disruptek: it cannot parse what it writes, and what it writes is not pretty. disruptek: so you may as well use json. Prestige: I couldn't build with nimble after adding parsetoml to my repo tho, idk why Yardanico: how did you add it Prestige: so I just used nim c Yardanico: and what's the error Prestige: let me check disruptek: nimble is for chumps. Elegant Beef: https://hatebin.com/srmuqruiib kaushalmodi: disruptek: ⏎ ⏎ > it cannot parse what it writes, and what it writes is not pretty. ⏎ ⏎ hmm? [https://gitter.im/nim-lang/Nim?at=5e9faafa312a2d132c27b720] Elegant Beef: My issue kaushalmodi: I have use parsetoml in lot of my projects.. reads/writes toml just fine Prestige: src/nimdowpkg/config/config.nim(3, 3) Error: cannot open file: parsetoml disruptek: i tried using toml for nimph's lockfiles. i dunno; maybe i'm an idiot. Prestige: seems like a nimble issue to me Yardanico: try to reinstall it I guess Yardanico: here it's proper "modern" nimble syntax https://github.com/NimParsers/parsetoml/blob/master/parsetoml.nimble Prestige: Yardanico: it works if I compile it manually with nim, just not if I try compiling with `nimble build` Prestige: https://github.com/avahe-kellenberger/nimdow if you wanted to see Yardanico: how is it specified in your .nimble file Yardanico: you should add requires "parsetoml" Prestige: exec "nim c src/nimdow.nim" Prestige: oh neat Prestige: thanks, I forgot about that martinium: this URI stuff is annoying martinium: ugh Yardanico: also why gplv2 ? :P just a friendly question Yardanico: ah there's no license at all so it's all rights reserved, sorry :P disruptek: kaushalmodi: got a sample project to share? Prestige: I should attach the license just haven't bothered Yardanico: well by default if some repo on github has code and no license it means that it's "all rights reserved" Elegant Beef: MIT or broke 😄 Yardanico: so you can look at the source but not use it Yardanico: without the permission of the owner Elegant Beef: Yea i fucking hate it Elegant Beef: Nim embedded is also like that Elegant Beef: nimscript* Prestige: I'll go add it then Yardanico: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository "However, without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work. " Prestige: Yeah, I just was lazy Prestige: I usually add the license leorize: I'm going for MPL nowadays leorize: MIT is too lax Yardanico: Yeah MPL is kinda nice too martinium: found what I needed martinium: https://nim-lang.org/docs/uri.html#%3F%2CUri%2CopenArray%5B%5D martinium: that's a useful proc Elegant Beef: Prestige what nim version are you running? Prestige: 1.2.0 Elegant Beef: Ok so then i have no clue why i cant install this Prestige: u can't nimble install parsetoml? Prestige: I did install nim with choosenim btw, if that makes a difference Elegant Beef: I did too Elegant Beef: so just for fun i did sudo and it installed Prestige: O.o Prestige: weird permissions maybe, did u get an error when installing normally? Elegant Beef: i got an error but nothing complaining about permissions disruptek: don't use sudo, chuckles. Elegant Beef: Oh i know disruptek Prestige: What error? Elegant Beef: It's more of a "does this change anything" and less of a solution Elegant Beef: I already posted it up ther Elegant Beef: there* Prestige: Yardanico: about gpl2, I just agree with the ideology Elegant Beef: Doesnt gpl2 remove a fair bit of freedom from the software? Elegant Beef: Requiring changes to be open sourced Prestige: as opposed to something like bsd, yeah Varriount: GPL for applications, bsd/mit for libraries Prestige: eh Prestige: matter of opinion Varriount: I have yet to see many (any?) companies do the things the GPL protects against with regards to libraries. Elegant Beef: Idk feels sorta silly imo to publish anything openly whilst preventing reuse of anything in it Prestige: wdym? Elegant Beef: I mean if you want to take code, use it and modify it and put it on proprietary software you arent allowed Elegant Beef: Atleast the way i understand it Prestige: well just the last part, yes leorize: well sometimes that's exactly what people want disruptek: hookers and blow? Elegant Beef: Liberty, and prosperity? kaushalmodi: disruptek: ⏎ ⏎ > got a sample project to share? ⏎ ⏎ No, all are company-internal [https://gitter.im/nim-lang/Nim?at=5e9fae9f35a35031bf79e5ac] Elegant Beef: That's a terrible quote system 😄 disruptek: you make me sad. Elegant Beef: Good disruptek: well, my toml effort is in nimph's git history. rockcavera: my devel version is not compiling. ;`( Varriount: When I've encountered a GPL that looked useful while working on an internal tool, I've nearly always had to walk away from it. Prestige: basically it boils down to me not support proprietary software rockcavera: https://pastebin.com/Wr1bQFD3 Prestige: supporting* leorize: Varriount: you are allowed to use gpl for things you don't release, like internal tools Varriount: Leorize: Yes, but the phrase there is "don't release" disruptek: rockcavera: is this new? rockcavera: yes rockcavera: now leorize: Varriount: it technically just mean that whoever got the tool can ask you for a copy of the source, but since it's internal you don't really have to care about it? disruptek: you usually use gcc on windows? kaushalmodi: disruptek: here's an old public project using parsetoml: https://github.com/kaushalmodi/nbuild/blob/master/src/nbuild.nim rockcavera: yes, gcc Varriount: leorize: And what do I do when my company wants to distribute said tool? Varriount: (to customers) leorize: tell them to release the source? :P bung87: why the htmlparser $html result a document element Varriount: leorize: Yes, I'm sure that would just make the manager's day. leorize: lol disruptek: rockcavera: reproduced on linux. rockcavera: disruptek, so less bad. disruptek: yeah. disruptek: this commit hash works: 1b6c4ed2ba29f855b47ff295515b54c9ae4edafa kaushalmodi: disrupek: for the issue you faced with parsetoml, can you open an issue on its repo? sealmove: federico3 you here? disruptek: someone can merge #14063 to fix devel. disbot: https://github.com/nim-lang/Nim/pull/14063 -- 3fix typo preventing build disruptek: uh, i can open an issue maybe, sure. disruptek: not a big deal because json works for me and as long as the output is sloppy, toml is useless -- it's supposed to make editing easier, not harder, after all. martinium: need help with this error martinium: type mismatch: got but expected one of:proc add[T](x: var seq[T]; y: T)first type mismatch at position: 2required type for y: Tbut expression 'item["id"]' is of type: JsonNodeproc add[T](x: var seq[T]; y: openArray[T])first type mismatch at position: 2required type for y: openArray[T]but expression 'item["id"]' is of type: martinium: JsonNode14 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see themexpression: add(asset_ids, item["id"])Peek Problem (⌥F8)No quick fixes available martinium: seems like it wants a generic type disruptek: item["id"].getInt most likely. martinium: I am trying to pass a value from one of the json keys in each iteration martinium: ok let me try that disruptek: confidence intensifies martinium: works martinium: so you have to be more explicit martinium: in this language disruptek: no; JsonNode is a type. getInt unpacks the int value from it. disruptek: getInt() i should say. disruptek: for one alternative, see disruptek: !repo jsonconvert disbot: https://github.com/disruptek/jsonconvert -- 9jsonconvert: 11lazy json node conversion 15 2⭐ 0🍴 disruptek: the language is typed, sure; this is a wonderful feature. martinium: yes, will help avoid a lot of errors rockcavera: disruptek, with your pull you compiled normally. disruptek: yes. martinium: does the $ stringify values martinium: ? disruptek: yes. martinium: beautiful martinium: so concise disruptek: when it is defined for the type, that is. disruptek: it is a proc such as any other. martinium: its the functions mannnnn disruptek: dude. disruptek: varriount: you up shashlick: disruptek did you think more about our conversation the other day disruptek: yeah. shashlick: And feedback? disruptek: i'm not interested in a 3-way at this time. disruptek: flattered that you asked, of course. Varriount: Disruptek: yeah disruptek: varriount: you get to be the hero that unbreaks the build. Varriount: ? disruptek: shashlick: we need to fix nimterop. shashlick: What's up shashlick: I'm neck deep in it so anything goes disruptek: also, i still like your idea. i just don't want to promote fracture of the pm behavior. let's make it work for everyone. disruptek: i could not make includes and private imports work, so yeah, there will need to be something there. shashlick: I don't know if that's what I'm proposing, just that the interfaces should be clean and in one direction disruptek: but it's madness to say "my tool can only be installed with pm X" disruptek: well, no argument here. disruptek: wrt nimterop, i'm convinced its untenable in its current run-toast-at-ct form. shashlick: Also, there's no compulsion to use a particular tool but if openssl can only be compiled reliably with autoconf, just invoke it and call it a day disruptek: all things considered, that's my considered opinion. shashlick: Toast is getting more and more capable by itself Varriount: How does this involve me? disruptek: you have merge rights. Varriount: I do... disruptek: "someone can merge #14063 to fix devel." disbot: https://github.com/nim-lang/Nim/pull/14063 -- 3fix typo preventing build Varriount: I'll merge it, but what led to the typo in the first place? disruptek: shashlick: if you wanna spend money, i hope you'll spend it in having ct code select from platform-specific wrappers generated aot. disruptek: varriount: sleepy araq disruptek: misbehavior ci, too, i guess. Elegant Beef: How do we parse enums from strings in nimland? leorize: strutils.parseEnum Elegant Beef: Ok thanks disruptek: strutils.parseEnum[SomeEnumType](somestr) is the syntax you'll need. skrylar[m]: eh, i use mpl-2 these days. i'm partial to [a]gpl in some ways but always tended to prefer the lgpl+link exception shashlick: Aot? disruptek: ahead-of-time shashlick: But it only generates once after which it is cached disruptek: that's cool, man, but not as cool as reliable builds. disruptek: we're stuck between a rock and a hard place. skrylar[m]: did you mean reliable or reproducible disruptek: reliable. shashlick: disruptek: have you read the latest nimterop readme? shashlick: i've tried to explain the compile time pov skrylar[m]: wasn't aware that installing packages was a hard problem these days disruptek: i will look, but i truly believe that i understand that pov. shashlick: there's 3 things - platform, compiler (version) and packages (nim and C libs) disruptek: i even shared that pov at a point. martinium: whats the error here: sites_map.add(item["id"].getInt().intToStr(): item["name"].getStr()) shashlick: every render depends on all those things so there's not really a single wrapper that can be cached shashlick: for simple libs, it is definitely possible shashlick: but without looking at the library headers in detail, there's no way to know disruptek: , not : martinium: got it martinium: actually just fixed before you commented woohoo martinium: thanks disruptek: not need for () on calls with at least one arg. shashlick: i was working on PMunch's wrapper request for openssl disruptek: rtfm re: UFCS disruptek: you'll love it. disruptek: shashlick: this is exactly my point. shashlick: wrapped 6 header files - results in 13k lines of wrapped headers disruptek: one person has the expertise to wrap the package and the mission to maintain it across multiple platforms. leorize: martinium: sites_map.[item["id"].getInt.intToStr] = item["name"].getStr shashlick: it'll work on my machine sure shashlick: but it won't on yours disruptek: well, it doesn't work for me right now. or solitude, as the case was today when he tried to build nimph. martinium: leorize fixed it the issue was the : shashlick: since you may not have some random package installed or your distro might exclude certain things from the conf shashlick: give me issues to work on disruptek: there's no point, because the design relies upon nimble and prohibits local deps. disruptek: when you run nimscript in ~/.cache/nim/nimterop you don't pick up any of my compiler env. shashlick: is it because toast isn't built? disruptek: or w/e the hell you're running in there... shashlick: okay, give me the commands i should run to reproduce it and i'll fix it disruptek: and my next step is to remove nimble from nimph. which breaks nimterop. disruptek: put --clearNimblePath in your nim.cfg and then have fun building nimph. shashlick: it is doable - i don't have anything in the nimble file to enable build or execution Varriount: Merged shashlick: step 1 - git clone nimph? shashlick: step 2 - bootstrap disruptek: it's 154... it needs to go into $NIMBLE_DIR/lib disruptek: not ~/.cache/ ... disruptek: chmod 0 ~/.nimble first. disruptek: if you aren't picking up my env when you build my software, you're doing it wrong. simple as that. and not specific to disruptek, of course. disruptek: but honestly, this goes deeper than nimph or nimble or even nimterop. disruptek: it doesn't make sense to have those least-qualified engineer the solution. shashlick: so again, what are the steps shashlick: i git clone nimph, bootstrap directly disruptek: did you chmod 0 ~/.nimble? shashlick: do i make a deps dir? KingDarBoja: Hi fellas disruptek: what's the deps dir? shashlick: where should nimterop get installed? disruptek: got me. disruptek: the bootstrap still works. 🎉 shashlick: 154 is on my backlog - i haven't figured out how to fix it though disruptek: here's a repro: shashlick: for nimbass, i'm now resorting to -l instead of dynlib - https://github.com/genotrance/nimbass/blob/nimterop/nimbass/bass.nim#L59 disruptek: 1) clone nimph as per usual. disruptek: 2) bootstrap nimph as per usual. shashlick: cause hard linking to ~/.cache isn't portable disruptek: 3) create a nim.cfg with these two lines: disruptek: 3a) --clearNimblePath disruptek: 3b) --nimblePath="$config/deps/pkgs/" disruptek: 4) rm -rf ~/.cache/nim/nimterop disruptek: 5) nim c src/nimph.nim disruptek: that's it. disruptek: /home/adavidoff/.cache/nim/nimterop/cPlugins/nimterop_418565994.nim(1, 24) Error: cannot open file: nimterop/plugin [AssertionError] [AssertionError] disruptek: home/adavidoff/nims/1.0/lib/system/fatal.nim(39, 5) Error: unhandled exception: /home/adavidoff/git/n/nimph/deps/pkgs/nimterop-0.4.4/nimterop/cimport.nim(166, 12) `ret == 0` Prestige: any good resources on macros? Aside from the docs disruptek: you can try macroutils. disruptek: !repo macroutils disbot: https://github.com/PMunch/macroutils -- 9macroutils: 11A package that makes creating macros easier 15 8⭐ 1🍴 disruptek: it's new. disruptek: !repo breeze disbot: https://github.com/alehander92/breeze -- 9breeze: 11a macro dsl for nim 15 37⭐ 2🍴 disruptek: some folks use breeze, also. Prestige: Cool, thanks. Trying to learm more about them skrylar[m]: neat skrylar[m]: was doing macros in janet and its kind of nice being able to just switch/case off list symbols so things that make nim macros easier are neat disruptek: shashlick: i forgot; chmod 0 ~/.nimble in there, too, of course. disruptek: for 154 we'd probably need to -rpath the $NIMBLE_DIR/lib because otherwise we cannot probably isolate the libs; hence $XDG stuff won't work, right? disruptek: s/probably/properly/ shashlick: what exactly is the goal? Prestige: this seems useful: https://www.youtube.com/watch?v=8SoJR3sCaR4 shashlick: i'll try out your steps disruptek: to not have nimph stop working because i broke gittyup while developing new features for golden. Elegant Beef: Well prestige i now have loading keybinds from a json 😄 Prestige: Nice Prestige: That was fast Elegant Beef: I mean i already had the base system in just needed to feed it data Varriount: Victor Kirilov... I wonder if he's on this channel leorize: onqtam? Elegant Beef: The old setup i did this manually `newKeyConfig(113,Mod4Mask or ShiftMask,nil)`, so it was quick to plug in a jsonnode in place of the data Prestige: This is actually a great video leorize[m]: Varriount: he does appear when someone mentions, but not a lurker afaict disruptek: so he's like batman? Elegant Beef: Well i mean batman has a symbol, so we need a viktor symbol disruptek: is there a symbol that denotes random code that no one uses strewn across the entire compiler? Elegant Beef: Also by the title i assume it's a video promoting the use of C++ transpiling? skrylar[m]: disruptek: gensym? disruptek: ☢ martinium: so for multiple web requests async should make it faster? leorize[m]: @kaushalmodi: you here? Prestige: martinium: making async requests is faster kaushalmodi: leorize: yes Prestige: They'll happen more or less at the same time, need to wait for one to return before you send another request martinium: jsut got a too many open files error doing it synchronously leorize[m]: kaushalmodi: try this `echo | ./script/that/nim/generates` martinium: `Error: unhandled exception: Too many open filesAdditional info: "nodename nor servname provided, or not known" [OSError]` leorize: kaushalmodi: if the same error surfaces, then it might just be that gcc can't deal with not having it's stdin being a tty for whatever reason kaushalmodi: leorize: nothing.. no output kaushalmodi: but the `stdinfile` got generated fine (with the `set -e` added to the script) leorize: at this point I guess it's up to gcc devs to point out the problem :P leorize: maybe you'll find a patch that you can just backport to your gcc 6.1 kaushalmodi: I wanted to show folks at work that they can quickly try out nim this way, but now I'll just wait for a fix leorize: does it apply to any nim file or just stdin? leorize: also you can just point to `inim` :P leorize: though I don't think that one is still being developed kaushalmodi: leorize: another observation .. kaushalmodi: `echo echo NimVersion | nim c - ` works fine kaushalmodi: but `echo echo NimVersion | nim c -r -` gives that collect2 err kaushalmodi: > does it apply to any nim file or just stdin? ⏎ ⏎ I mean `nim c -r foo.nim` works just fine kaushalmodi: It's just that I wanted this cool feature to Just Work leorize: I have no idea now, the `-r` literally change nothing but to tell nim to run the executable after it's generated (at least that's what I'm seeing in the compiler source) martinium: how do I make a proc async martinium: used to be adding {.async.} martinium: that still the way? leorize: import asyncdispatch leorize: yea leorize: just remember to import asyncdispatch first martinium: linter still giving me crap about {.async.} leorize: what's the function prototype? kaushalmodi: > I have no idea now, the -r literally change nothing ⏎ ⏎ I feel like crying.. you are correct.. I had set gcc back to 9.1.0 :facepalm: kaushalmodi: so `echo echo NimVersion | nim c -` still gives the same error leorize: try the `echo | script` thing again? martinium: looks like now since it's an async http client it returns a future kaushalmodi: nope, no error with that (rm'd the .cache and double checked the gcc version to be 6.1.0 this time) leorize: out of ideas then :P kaushalmodi: thanks though for sticking with me through this debug kaushalmodi: I really hope that the fix is awesome martinium: I haven't ever really done Async code martinium: guess I'll have to learn... :D pragma: anyone interested in writing emulator server in Nim is made in Java but I think it would be fun to pass it to Nim pragma: Emulator Server works with a 2D game under Flash player pragma: who are encouraged Prestige: Hm can someone explain this statement about parameters used in a template? Prestige: https://youtu.be/8SoJR3sCaR4?t=880 Prestige: since `filename` is a string, I didn't think it could get "evaluated" twice by referencing it twice leorize: template parameters are AST nodes leorize: for example templateCall(thisExpensiveOperation()) leorize: and it will paste "thisExpensiveOperation()" to all the place that the param was referenced Prestige: Very interesting, thanks for the explanation. I'm not familiar with AST yet Prestige: damn macros are cool Elegant Beef: The entire meta programming is fancy cool features 😄 Prestige: I'm just starting to learn about it, pretty sick. Prestige: going to take a bit to get used to Elegant Beef: Yea it basically means "Hey i want this", and the answer is almost certainly "Well go get it", atleast from my understanding Prestige: Been watching here about it https://youtu.be/8SoJR3sCaR4?t=1151 pretty informative Rika: where is nimsuggest documented? Rika: oh found it alehander92: PMunch is macroutils going to fusion PMunch: fusion? PMunch: Oh that's the Nim distribution thing? PMunch: Cool :) PMunch: Oh, you were asking if macroutils where going to fusion :P PMunch: I dunno alehander92: well it was Araq's idea alehander92: to make fusion alehander92: but no idea if its happening Amun_Ra: what's the most efficient way of (python code): buf = buf[pos:] (buf is a seq)? I went for C approach by now and I just copy data in for loop then set length at the end Faulander: good morning Araq: depends Faulander: if i run "nim jsondoc -o:doc.json filename.nim" i get: Error: unhandled exception: index out of bounds, the container is empty [IndexError] Araq: hmm cooldome already fixed what I was about to work on... Araq: Faulander, which Nim version? Araq: ah no, the bug still exists :-) Faulander: Andreas, 1.2.0 Araq: Faulander, tell PMunch Faulander: OT: Andreas, bist Du eigentlich Österreicher? In der Weststeiermark wo ich herkomme, gibt's viele Rumpfs :) PMunch: Amun_Ra, buf = buf[pos..^1] Araq: Nö, bin Deutscher PMunch: Maybe those Rumpfs are german? Amun_Ra: PMunch: argh, I completely forgot I can use it there, thank you alehander92: ich habe diese Worten versteen! PMunch: Amun_Ra, no problem :) Faulander: @PMunch: if i run "nim jsondoc -o:doc.json filename.nim" i get: Error: unhandled exception: index out of bounds, the container is empty [IndexError] PMunch: Hmm PMunch: On any file? Faulander: at least on the one i tried, let me try another one ... PMunch: Just tried it on a random file and it worked fine Faulander: on another i get: Error: new section expected Faulander: lineinfos.nim(249) raiseRecoverableError Faulander: Error: unhandled exception: new section expected [ERecoverableError] jorjun_twitter: Loving this language (experienced in python but not types & compilation), any recommended reading on how to work with 3rd party stuff, either c++ framework or javascript ..? Do I need to know more about chips and linking? My comp sci was many many moons ago.. ultimately I want to target raspberry pi jorjun_twitter: I’ve waited 30 years for a non-nerdy language like this that exposes the power of CPU Faulander: jorjun: do you know the nim for python developers series? this was great for me (same background as you) sheerluck: I love this language too jorjun_twitter: Yes @faulander , but I am getting the syntax pretty well from completing exercism challenges. I am curious to see if I can use nim to leverage libraries. Easily jorjun_twitter: Clueless about clang and linking and build stuffs. alehander92: guys alehander92: how can i change assembler alehander92: for gcc (like the binary path for as) Araq: do yourself a favor and remain as clueless as possible :-) this stuff is all awful Faulander: well, i am there too ... no clue about that either. but reading nim.cfg helps in understand which options the nim compiler has. jorjun_twitter: :D PMunch: @jorjun_twitter here's a little primer on types: https://peterme.net/nim-types-originally-a-reddit-reply.html PMunch: Like how Nim handles types on the stack/heap and such PMunch: Might be helpful to get into the more low-level stuff in C jorjun_twitter: Spent an hour last night trying to build nimgame2 lib and then run the demo’s. Then I tried “nimble develop” and it all worked jorjun_twitter: Last time I tried low level was 6502 in 1985. So I will dive in. 300 files to just 14 and one long JS for the actual plugin jorjun_twitter: @rika for sure. Have totally moved to typescript Gary M: my bet is on the minification though Gary M: it's pretty easy to migrate an extension to webpack if the code doesn't conflict with minifying livcd: I use Nim as a betterGo. I dont use Nim's full potential (because I am dumb) but it's surprisingly working really well for what you would use Go for. alehander92: yes @jorjun_twitter i'd say types should be often not about performance at all (lets say they happen to also help with that) Gary M: dynamic types are great if you love silent unintended behavior /s Araq: livcd, now that's what I consider a compliment :-) PMunch: Big benefit of types, all that "munging about" when changing your implementation actually means you look at your code and make sure it works with the new implementation. And the stricter you are with your types the more you can be certain that the compiler will catch bugs. PMunch: Faulander, built the compiler in debug mode (from the v1.2.0 tag) and ran the example you provided. Here is the stacktrace: http://ix.io/2j3c jorjun_twitter: @alehander92 Yes, protoyping is also very valuable. I might end up doing that in python and solidifying in nim. Unless I just get fluent, and my 1.int just comes naturally. But it feels like the compiler is underneath, in a way that I am not used to. I would say on exercism so far, 90% on wrestling with weird errors due to type mismatch. 10% on the algorithm. But I will persist. PMunch: If you want to have a look at it, I'm a bit busy right now alehander92: i think nim is very fast for prototyping alehander92: i'd even say writing down signatures is an ok form of prototyping as well livcd: Yeah much faster than Go alehander92: but i agree it probably takes time to get used to it alehander92: the bigger difference with python might be metaprogramming livcd: The only thing is when you get SIGSEGV: Illegal storage access. (Attempt to read from nil?). You run it through gdb and you still have no clue what's going on Gary M: Oh that's fun jorjun_twitter: @alehander92 do you use metaprogramming regularly to reduce the weight of code? Gotta say am intrigued by that as well. I didn’t use it much in python, but Django (popular web framework) folks benefitted hugely from declarative database model stuff implemented via metaprogramming. Huge lot of ugly wiring behind that productivity deliverable. Great for giving tools to others.. PMunch: I use it quite heavily PMunch: And not only for creating libraries, a small template or macro in a project can be a great way to cut down on code PMunch: https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html Gary M: I really want to learn how to do that kind of stuff, especially macros PMunch: Like I explain in this article livcd: Macros only for libs! PMunch: Macros for president! alehander92: @jorjun_twitter yes, i think many django/rails concepts alehander92: can be adapted to nim with macros alehander92: sometimes it might be a bit harder, but sometimes you can do stuff that's hard to do in python/ruby alehander92: because you have access to ast/types alehander92: e.g. you can typecheck that your ORM types match your db schema on compile time alehander92: just as an example, not saying its a good plan alehander92: overally you use different code patterns to achieve the same thing, but many things are possible jorjun_twitter: I started coded purely to write games. Got sidetracked by corporate s***. But am gradually rediscovering the enthusiasm side. I want nim for moving things about, especially in 3d I think. Would like to make an A/R something. Not sure what. Python is already pretty good with its openCV bindings. jorjun_twitter: Maybe valve will cough up their new source engine and we can all dive on that.. jorjun_twitter: Games have always stretched the bounds of computing, I’ve observed.. jorjun_twitter: @pmunch This meta programming article is fantastic. merci Gary M: I don't think source 2 is going to be open source 2'd PMunch: jorjun_twitter, de rien :) Gary M: Or really released for the public in the same way unity or unreal are jorjun_twitter: @FromIRC There’ll be something but, yes, they aren’t going to bust a gut documenting. Probably more like a partner thing. But having recently completed Alyx, gotta say I am quite impressed. There’s a dead rat in one of the bins at the start. Hideously real physics engine.. :D Rika: Macro only libraries in nim where PMunch: Rika, huh? Rika: Libraries that implement its api using only macros lol Gary M: Source 2 has been around for years, not just for Alyx. It's the engine running DotA 2 Gary M: Since 2015 PMunch: Rika, some of mine come real close :P Gary M: Macro only nim executable when PMunch: That'd be interesting, an application for Nim that counts cloc, but is able to determine compile-time lines vs. runtime lines PMunch: Or macro+template+static lines against everything ele Rika: Sounds hard to do Gary M: Nim executable with macros generating code entirely from config data when alehander92: hm, PMunch you want coverage alehander92: not cloc? alehander92: otherwise compile time lines generate runtime lines, so its a bit misleading :P PMunch: Yeah that's a good point PMunch: I guess both would be best alehander92: a debugger for compile time :P PMunch: Something like: source lines: 100, macro lines: 76, generated lines: 1242, output lines: 1266 PMunch: Or maybe compiled lines instead of output lines alehander92: it sounds not hard if you build it in the compiler :P PMunch: I mean it could be a tool that imported from the compiler PMunch: But yeah, it'd definitely need stuff from the compiler to calculate that Varriount: Does a line count mean anything for generated code though? It's all an AST at that point PMunch: Just for fun PMunch: I mean a line count doesn't really mean much to begin with alehander92: for generated C code it does alehander92: but this is very relative of course PMunch: What is opt[int]? Rika: ??? how do i use nimsuggest in stdin mode? Rika: im confused on what format the query location should be givent Gary M: just for fun vs Rika: ah it only works if the CWD is the project folder Gary M: also I noticed something weird that I can't explain with my fork of the extension which is that in the original extension nimsuggest runs and continues to run over multiple tabs in VS Code, however after minifying everything nimsuggest only runs when it needs to and closes right after... I don't know at all why that is Gary M: but it seems to work "better" Rika: why does nimsuggest require a project folder to work? Rika: i've always wondered this actually Gary M: I don't know enough about nimsuggest since I haven't implemented it myself. I can only observe what was already done Gary M: it's still properly executing a check on the project and not just a dirty file so that's good Gary M: with the original nim plugin, my processes look like this: https://i.imgur.com/nmXfI4K.png Gary M: and those nimsuggest processes aren't closing down at all Gary M: but with the modified plugin, it looks like this while idle: https://i.imgur.com/MFk2CXd.png Gary M: so I think it should in theory scale up way better with more open files in a project Araq: Rika: because nimsuggest cannot guess the project structure, it's true for every IDE I've ever used PMunch: Anyone able to help me with some C wrapping? crypt.nim (the library): http://ix.io/2j3B, test.nim (trying to use it, with C code I try to implement): http://ix.io/2j3D, the error: http://ix.io/2gc0 Rika: Araq: but arent imports either nimble imports, standard lib imports, or imports relative to the current file? Araq: Rika: ignoring the 'include' file issue, you would then create a project per module you open in your editor, not good enough Rika: what do you mean "create a project"? why must everything have a project Rika: i have single .nim files i use, small scripts that i compile and run once in a few months bung87: nimsuggest need a project entry file bung87: the vscode set the every nim file you open as a entry file bung87: so every entry file as a project. that's the logic Araq: that logic is broken and must be replaced bung87: in fact , the vscode extension that behavior can be change. Rika: what logic? the "every file is its entry file"? bung87: I'v tried modify the vscode extension ,but now I can't recall. bung87: yeah, so that you have multiple nimsuggest proccess at the background. Araq: Rika, yes, that logic Rika: araq: what logic would you recommend to replace this one? how do you determine what file is the entry file? bung87: `packaname` `src/packagename.nim` that's the default structure when using `nimble init` mratsim: if only we could fix nimble eating the "src" directory it's really annoyinh Araq: Rika: just use nimsuggest's directory feature Araq: and let it figure it out itself Rika: so i pass it a dir rather than a file? Araq: yeah, on *startup* Rika: the one on the command no? Rika: yeah okay hmm bung87: you can modify the vscode extension , that's not hard task Gary M: I'm currently working on that myself, I just don't know exactly how I should modify it. Gary M: I don't think it should depend on a nimble init scaffold narimiran: leorize: maybe you can help vscode guys above? Rika: Gary, i sent you some PMs Gary M: bung87: I forked the vscode extension and it's currently available as Nim Alt, if you want to take a look. bung87: I have a modified version https://github.com/bung87/vscode-nim-extension Rika: what did you modify bung87: and another extension that using nim lsp server , that just slow at first index period, anything else works fine. bung87: remain single nimsuggest per project, add a status bar can change nim version,when you have multiple nim version Gary M: nimsuggest works as intended with only a single per project? Gary M: in your fork bung87: now I cant confirm they both work, it's months ago bung87: yeah, someday I noticed my 8gb memory left less.I made this change Araq: damn, hunting a ghost... bung87: oh , it's https://github.com/bung87/vscode-nim not that url Araq: you write some assert, you debug the compiler Araq: only to find out the assert was wrong :-( bung87: https://github.com/bung87/vscode-nim/blob/master/src/nimSuggestExec.ts#L227 start here find the project root file Araq: you don't have to find the project root fine, Nimsuggest does that for you Araq: you pass a directory to nimsuggest, it figures it out Gary M: ```let desc = await getNimSuggestProcess(vscode.workspace.rootPath,filename);``` Gary M: Araq: so this is not how you would do it right? What directory should you pass to nimsuggest? Araq: the directory of the .nim file that is open Rika: Even if it's a few folders within the project root? Araq: yes Araq: nimsuggest auto-detects the main project file Araq: since every editor gets it wrong nimsuggest standardizes it bung87: ok , so that can be very easy now. InventorMatt: how do you do a for loop in the middle of a macro tree? Araq: ^ awesome question. there is no good way currently, you need to split up the tree construction to regain mutability Araq: but I'll keep it in mind for upcoing newTree/quoteAst/etc proposals InventorMatt: okay, thanks. I'll do a bit more research into macros and then probably come back for help on getting it right. PMunch: Okay, made an actually fully working C sample of what I need to be able to do shashlick: http://ix.io/2j4d alehander92: Araq alehander92: how important is it that the await error should be as clear as possible alehander92: i wonder if i should just leave the default type mismatch one alehander92: as this would be very natural alehander92: (tho if i dont leave a global overload fallback, people might overload it erroneously) Araq: global overload fallback sounds ok PMunch: Uhm... Error: unhandled exception: value out of range: 22 notin -2147483648 .. 2147483647 [RangeError] PMunch: I beg to differ.. PMunch: What on earth is going on here? https://play.nim-lang.org/#ix=2j4h liblq-dev: PMunch: well it works if you split it into a few different variables liblq-dev: https://play.nim-lang.org/#ix=2j4k liblq-dev: but it's obviously a bug that your example doesn't work PMunch: Yeah, just splitting the len and cint works: https://play.nim-lang.org/#ix=2j4m PMunch: But it's the strangest thing I've seen in a while. I mean even the error message is just plain wrong shashlick: @PMunch - I have the openssl wrapper ready, will send in 30 minutes shashlick: Will you still be on? PMunch: Oh.. yassen[m]: Hi there, trying to join the forum at https://forum.nim-lang.org/ since this morning, to no avail. Somehow missed the confirmation email -- when clicked couple hours later, it said it has expired, then attempts to get other links and click on them didn't work -- I got "Invalid ident hash". Also logging stopped working. Attempt to create another account with the same email address also failed. Can anyone help me? (My user name: yassen[m]: yassen, email address [email protected]) PMunch: Yeah shashlick: Ok will ping PMunch: Sweet :) narimiran: yassen[m]: ping dom96 yassen[m]: thanks, will do! InventorMatt: how does one create a wrapper for a python library. I was thinking of using nimpy and importing the library from there but it seems as though it'll treat it like a generic objects as generic python object and it won't bring in the dunder methods from the object. Rika: What clyybber: PMunch: Looks awfully similar to this: https://github.com/nim-lang/Nim/issues/13698 disbot: ➥ Exception when converting csize to clong ; snippet at 12https://play.nim-lang.org/#ix=2eKB clyybber: for which the fix looks suspicious PMunch: Hmm, compiling with 1.0.6 indeed fixes the issue clyybber: Araq: Whats the cause for this bug/bugs and why does the fix have to special case csize ? PMunch: Very likely the same PMunch: Yikes, that fix does indeed look sketchy mratsim: I think Araq tried to change csize to actually match csize_t and in the end it caused to much bug so csize_t was introduced mratsim: new code should use csize_t, and csize has been deprecated alehander92: so `dirty` is like alehander92: adding mixin to used idents? clyybber: @mratsim I tried to make csize a uint and it worked alehander92: my new approach for async templates defines await as an inline template mratsim: dirty uses idents instead of nnkSym I think clyybber: @mratsim But my PR was reverted and csize_t was introduced instead alehander92: but i didnt realize now this requires one to use `mixin await` or `{.dirty.}` for template using await clyybber: Because its a breaking change alehander92: this *can* be hinted in the error message .. Araq: hmm isn't ACM free for all articles nowadays? clyybber: I thought so as well mratsim: I think macro/proc/method overload resolution has an edge case when methods have the same name as a macro/proc: https://github.com/bluenote10/NimData/issues/56 disbot: ➥ Compile error with nim 1.2.0 shashlick: @PMunch - i'm back on PMunch: Oh you were gone :P I though you were working on something shashlick: so openssl does not have a clean import order of headers or a top level header that imports in the right order shashlick: so i had to maek some changes to toast to enable imports of multiple headers without duplication of symbols shashlick: i'm importing these five headers - **pem.h ssl.h rsa.h evp.h bio.h err.h** shashlick: based on this example - http://hayageek.com/rsa-encryption-decryption-openssl-c/ shashlick: make that 6 PMunch: I found out I could get away with rsa.h, pem.h, and err.h PMunch: http://ix.io/2j4H shashlick: cool PMunch: And usage: http://ix.io/2j4J PMunch: Ah, probably because I don't need to generate a key shashlick: just those 3 files results in a 10k wrapper PMunch: Bytes or lines? PMunch: Not that it really matter with deadCodeElim shashlick: lines shashlick: http://ix.io/2j4M/nim is what the wrapper looks like shashlick: the toast command line is at the top shashlick: i'm using a plugin which looks like this - http://ix.io/2j4O/nim PMunch: I'd need that wrapped up in Nimble if I were to use it.. shashlick: sure but want to make sure it works for you first shashlick: recommend generating the wrapper rather than using what i pasted tho shashlick: cause it is system specific PMunch: System specific? shashlick: so if you can pull the multifile branch of nimterop shashlick: see the why nimterop section of the readme, specifically the preprocessing portion brentp: with nim#head, I get further compiling with --cc:zig and it works for hello world, but I get SIGILL on other pure nim code, such as: https://github.com/brentp/nim-lapper (src/lapper). and it doesn't seem to know about -d:openmp. martinium: Good morning all martinium: Afternoon for you guys across the pond martinium: :D alehander92: hi, america ! Recruit_main707: how is something like this done? Recruit_main707: https://play.nim-lang.org/#ix=2j4W Araq: brentp: we really don't support zig. supporting all these different C compilers and OSes and CPU archs is already painful enough PMunch: Recruit_main707, like this? https://play.nim-lang.org/#ix=2j4X brentp: heh. ok @Araq . was just thinking it might be an easier way to get static binaries for my projects. Rika: https://play.nim-lang.org/#ix=2j4Y Rika: oops, late Recruit_main707: thanks both Rika: @Recruit_main707 look at mine too though 😛 PMunch: By the way, you only need to set the first one to 1 and the rest will increment automatically Recruit_main707: i have looked it obv Rika: oh ok Recruit_main707: PMunch, that would have been something valuable to know :P PMunch: And now you do :) Rika: also commas arent needed for newline'd enum entries filcuc: i'm trying to build/link SDL2 by directly bundling it by compiling its .c files. Is there a way to disable the automatic inclusion of the system module? filcuc: C:\Users\filcuc\nimcache\main_d\stdlib_system.nim.c.o:stdlib_system.nim.c:(.text+0x0): multiple definition of `NtCurrentTeb' C:\Users\filcuc\nimcache\main_d\SDL.c.o:SDL.c:(.text+0x0): first defined here filcuc: btw i'm not so sure in what i'm doing :D filcuc: the idea is to have a somewhat pure nimble package shashlick: PMunch: so if you can test if the wrapper meets your needs, i'll be enhancing cImport to allow multiple files like the command line does shashlick: and then we can update the official package PMunch: Okay, so how do I test this PMunch: Copy the wrapper and the plug-in? PMunch: Oh no wait, not the wrapper shashlick: install the multifile branch of nimterop shashlick: and then run the command line in the wrapper i sent shashlick: **`/home/nimterop/nimterop/toast -np --pluginSourcePath /home/wrappers/nimssl/nimssl/p.nim -f:ast2 -k -O OPENSSL_die -r -s pem.h rsa.h err.h`** shashlick: along with the plugin i sent shashlick: you can use -o or > to redirect to file PMunch: Hmm, I just get no such file or directory PMunch: But I'm not sure why.. PMunch: http://ix.io/2j52 shashlick: Araq: I import segfaults and I have --stackTrace:on and --lineTrace:on but I still get SIGSEGV: Illegal storage access crashes without any traceback Araq: don't import segfaults, ever shashlick: i added it to see if i get more, but it crashes even without it the same way shashlick: this is only on 1.2.0 and devel, same stuff works fine on 1.0.6 and 0.20.2 shashlick: was happening only on OSX but last CI it is failing on Linux shashlick: and i'm unable to reproduce locally shashlick: PMunch: please update to nimterop branch multifile PMunch: I have shashlick: cause toast is pointing to 0.4.4 shashlick: which is very old PMunch: Huh PMunch: I cloned the repo, checked out multifile, and ran nimble install shashlick: perhaps remove [email protected]#v0.4.4 shashlick: and link toast to the new binary or use full path shashlick: does /tmp/opensslwrap have the ssl header files? shashlick: i was running in /usr/include/openssl PMunch: The nimble file in that branch says 0.4.4.. PMunch: Same error when running from /usr/include/openssl shashlick: what's the output of toast -h PMunch: Huh, seems like there was something funky with that symlink PMunch: http://ix.io/2j56 PMunch: Different error now though shashlick: ya that's up to date now shashlick: what's cligen upto now PMunch: [email protected] shashlick: try `-np --pluginSourcePath=/tmp/plugin.nim -f:ast2 -k -O:OPENSSL_die -r -s pem.h rsa.h err.h` shashlick: not sure what to say PMunch: Same error Recruit_main707: how can i only import sqrt from `math` PMunch: `from math import sqrt` Recruit_main707: oh, thx shashlick: hmm shashlick: PMunch - seems like zsh itself is complaining PMunch: Same error with bash shashlick: seems to be treating the whole command line as the executable PMunch: Oh PMunch: That was a bad symlink PMunch: The new error is: Unknown short option: "Â" shashlick: oh right shashlick: can you add the flags incrementally and see which one is causing the problem? PMunch: Well, that fixed the issue.. shashlick: maybe cause of copy/paste? PMunch: Must've been some weird symbol hidden in there when I copied it PMunch: Yeah PMunch: Well it thinks that it takes a ptr File, which should just be a File in Nim. PMunch: And I get some conflicting type errors: http://ix.io/2j5c Recruit_main707: > ptr File, which should just be a File in Nim. Recruit_main707: i think not iirc its the same as in c/c++ PMunch: I just defined it as `pointer` and passed it the output of `open` which worked PMunch: According to the io module `File = ptr CFile` PMunch: So it should either be ptr CFile or File, but not ptr File Recruit_main707: but i think CFile is also a pointer to a file shashlick: okay we can fix that - FILE => CFile shashlick: rather FILE* => File bung87: https://play.nim-lang.org/#ix=2j5e why parse simple html fails? shashlick: PMunch: pushed a fix on that branch PMunch: That fixed the file issue, but I still get the conflicting types errors: http://ix.io/2j5i PMunch: Oh wait.. PMunch: Okay, that was caused by me leaving in my emit statement from earlier :P PMunch: Woo, it works :) PMunch: (with --passL:-lcrypto) shashlick: excellent shashlick: i tried copy pasting the command in a hex editor but don't see any 0xc2 which mapped to that unknown char PMunch: Weird.. PMunch: I might've hit some random keys :P shashlick: by the way, there's a lot of comments at the top of the wrapper which you can toss out for now shashlick: i am trying to figure out how to best report that kind of stuff PMunch: I didn't even look at the generated code :P inv2004: Hello inv2004: K* = ptr object {.packed.} # it works, but writes that it is depricated to write pragma here, ok, I changed it to K* {.packed.} = ptr object - and it does not work - alignment is broken shashlick: how do you pass a `static string` passed to a macro onto another macro as a `static string`? treeform: PMunch, I just read your Q&A it's really well written, good job. PMunch: Oh, thanks :) Yardanico: ah yeah, I read it in the morning today too, its very nice :) shashlick: link? treeform: https://peterme.net/nim-qa-originally-a-hn-reply.html PMunch: Credit to the guy on HackerNews for the good questions Yardanico: https://peterme.net/nim-qa-originally-a-hn-reply.html shashlick: any ideas on the static string question? narimiran: anybody here have some experience with ruby/gems/jekyll/bundler and that stuff? i'm trying to build nim's website and i'm failing left and right PMunch: I've gotta go walk the dog. Might be back later kaushalmodi: narimiran: Switch to Hugo shashlick: PMunch: `chop their arm ofF then` narimiran: @kaushalmodi heh, https://github.com/nim-lang/website/ uses jekyll kaushalmodi: narimiran: jekyll/octopress left me stumped for many years with all the ruby mess, until one day I discovered Hugo on HN kaushalmodi: narimiran: I know.. *switch* to Hugo Yardanico: @kaushalmodi make a PR :) Rika: LOL kaushalmodi: If the nim team is fine with the switch, I can spend time on that kaushalmodi: I am not joking Yardanico: well you need to ask dom and 4raq I guess, I don't do webdev stuff at all disruptek: go for it. Yardanico: and miran too shashlick: disruptek: continuing our conversation from last night shashlick: how come you aren't statically linking libgit2? disruptek: PRs accepted. shashlick: just need to set -d:git2Static in gittyup and you are done disruptek: does it work? shashlick: its tested on the CI disruptek: not afaik. narimiran: @kaushalmodi if hugo would make our life easier (and currently the bar for that is quite low :P), why not :) shashlick: https://github.com/genotrance/nimgit2/blob/master/nimgit2.nimble#L35 Araq: no. narimiran: i'm guessing i'm currently in some dependency hell, and i can't get out of it no matter what i try.... Araq: website rewrites are only acceptable if they use Nim Araq: the website used to use Nim and it worked fine disruptek: shashlick: it doesn't work because libssh needs static linking. disruptek: ssl, crypto, libz, ssh2, etc. Yardanico: libressl works for static linking too shashlick: works fine on travis and locally shashlick: https://github.com/genotrance/nimgit2/blob/master/nimgit2.nim#L51 Araq: btw Hugo has 64 dependencies and had a bug in 'ToLower', see https://github.com/gohugoio/hugo/commit/27af5a339a4d3c5712b5ed946a636a8c21916039 I'd rather use my own 300 line helper Nim program instead, thanks kaushalmodi: Araq: You can wget a hugo static binary Recruit_main707: oh gosh, out of all of the names for a go tool they had to choose mine Rika: ok hugo Araq: kaushalmodi: the art of programming lies in what *not* to do. kaushalmodi: Araq: just wget this tar, extract and binary and run it: https://github.com/gohugoio/hugo/releases/download/v0.69.1/hugo_0.69.1_Linux-ARM64.tar.gz kaushalmodi: s/and/the Araq: I'm not on Linux and I have a life kaushalmodi: they have windows binaries too Araq: dude, I don't want it kaushalmodi: https://github.com/gohugoio/hugo/releases/download/v0.69.1/hugo_0.69.1_Windows-64bit.zip kaushalmodi: ok, I am just saying that you don't have to worry about Hugo dependencies, no matter what platform you are on Araq: believe it or not, I'm capable of installing software on my machine Araq: I want the old Nim website builder back and you'll never convince me of anything else kaushalmodi: > btw Hugo has 64 dependencies ⏎ ⏎ I am just countering that.. if you don't want to use Hugo, I understand, but "hugo has dependencies" is the wrong reason disruptek: it would make a good demo of karax. Yardanico: disruptek: no Yardanico: no need for karax bung87: @Araq https://github.com/nim-lang/Nim/pull/14070 need feedback Yardanico: just a simple nim static website builder disbot: ➥ fix #14064 xmltree should allow create text node with raw text(non-es… Araq: "hugo has 64 deps" for a static website builder for me is an indicator of "software written by amateurs", I am well aware that you can bundle deps kaushalmodi: following the hugo development actively, I can understand the reason for those 64 deps disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: compiler hacking and ragging on karax. kaushalmodi: it's a static site builder with lot of features but I won't go into that over here Rika: can we drop this hugo thing narimiran: i finally, after half a day of trying (!), managed to somehow make jekyll to build the website Rika: im not sure of what you guys are arguing about anymore companion_cube: (funny, the one I use in rust, cobalt, also has a bunch of deps so it can provide a local dev server and stuff) narimiran: (and i'm not sure if this blessed state would last or if it is just temporary) Araq: Rika: we're already done Rika: okay Araq: but once again, I want my old website builder back that used 'nim rst2html' and Nim's source code filters because I like Nim. and guess what, I had any feature that I needed available in this setup. Yardanico: old nim website looked more "solid" or something like that :P Araq: Yardanico: you look at the CSS, it was bad, then it got better. nothing to do with the builder software Yardanico: ah right companion_cube: the current website looks good Yardanico: yeah we're not talking about changing the website look Prestige: I feel like some specific pages take a while to load Yardanico: Prestige: nim website is literally statically served :P companion_cube: disruptek: what other chan are you on? :p is there a offtopic to this? Prestige: but idk how the content is being served Prestige: hm Yardanico: and it's behing cloudflare as well disruptek: twitch chat. companion_cube: ahhhhhh ofc. Prestige: Woah that's weird, maybe firefox is just having issues with the searchable index page Yardanico Yardanico: Prestige: oh you're about that page Prestige: Takes like 4 seconds to load on ff but chromium took like .5 seconds Yardanico: https://nim-lang.org/docs/theindex.html ? Yardanico: well it's a very big page Prestige: Right, still seems odd that ff is taking much longer than the other kaushalmodi: I am using latest firefox on Windows, loads fine.. takes about a second kaushalmodi: *theindex.html loads fine companion_cube: disruptek: gRPC and the likes are RPC over http Araq: narimiran: so what's the changelog situation? Araq: where should people add their changelog entries? companion_cube: disruptek: http supports persistent connections, too Araq: cc bung87 companion_cube: :DD no offense companion_cube: yeah that was funny 😂 narimiran: Araq: i'm still not convinced that `changelog.md` should become just a "table of contents" for changelogs narimiran: if anybody else wants to give their opinion/view: https://github.com/nim-lang/Nim/pull/14025 disbot: ➥ avoid messing up changelog history on each subsequent release Araq: no, it should be changelog_$version.md companion_cube: monday night I think Araq: and there should be no changelog.md companion_cube: on discord? Prestige: Could just be a ff bug for this version I guess lol bung87: @Arag I added it to changelog_1_2_0.md companion_cube: why would you want to troll crystal, disruptek? Yardanico: companion_cube: why not Yardanico: it's for research narimiran: @bung87 that change of changelog_1_2_0.md is wrong!! narimiran: 1.2.0 is already released!! companion_cube: 😂 oh well companion_cube: please be nice, crystal is interesting (unlike V) Rika: OOF bung87: ah, that's a problem. companion_cube: and thus starts another copy-pasta narimiran: @bung87 put it in `changelog.md` bung87: I dont think I can change the nim version.. narimiran: this one: https://github.com/nim-lang/Nim/blob/devel/changelog.md bung87: ok narimiran: and it is `since:(1, 3)` narimiran: and in text, it is `**Since**: Version 1.4.` (not a typo, 1.4) companion_cube: they're doing good companion_cube: who knows, maybe we were trolled the same way bung87: ok, next time I can easyly handle this .. companion_cube: well rust might be a valid choice for that crazy project disbot companion_cube: disruptek zacharycarter: q zacharycarter: q! companion_cube: q? Yardanico: q! Recruit_main707: q Rika: :q! Prestige: Lol narimiran: brainfuq language when? Yardanico: Chef language is better Yardanico: write programs using recipies companion_cube: there's beef lang, too :p Recruit_main707: \:smart: narimiran: it was a (bad) joke about repetitive usage of Q :'( Yardanico: it was a good joke narimiran: q! clyybber: Araq: Does your recent PR mean that the cycle collector is now working? bung87: https://github.com/nim-lang/Nim/issues/14073 any idea to this ? disbot: ➥ htmlparser doest parse self close tag ; snippet at 12https://play.nim-lang.org/#ix=2j67 kdheepak: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea0758f35a35031bf7cd6cb] kdheepak: Why does something like this not work? kdheepak: > Error: cannot create a flowVar of type: Person ⏎ ⏎ I get the following error kdheepak: I've tried with Person = tuple as well. bung87: you evalute worker() bung87: that return a Person, so you wrote spawn Person shashlick: if porting to --gc:arc, can the code still compile with regular GC for older Nim versions? Yardanico: shashlick: most of the time you don't need to port anything Rika: so essentially, dont call worker Rika: ? kdheepak: I want to start a thread that returns a Person. shashlick: ya but my code doesn't work anymore since i'm loading a dll and there's some issue being introduced leorize: shashlick: --gc:arc is vastly simpler than the normal gc leorize: if it can run on arc it runs everywhere bung87: so you just pass `worker` kdheepak: ```test.nim(14, 19) Error: 'spawn' takes a call expression ⏎ ``` [https://gitter.im/nim-lang/Nim?at=5ea076b9727e88014a0d028f] shashlick: so in nimterop, i compile a plugin with --app:lib --gc:arc and run a proc from it on memory from main exe shashlick: that data isn't coming through so tests are failing shashlick: basically cPlugin() isn't working kdheepak: If I return `int` it works if I use `spawn worker()` bung87: hmm I checked my mistake leorize: shashlick: use -d:useMalloc for both of them bung87: document not explain what FlowVar is shashlick: leorize: how does that help? shashlick: same issue leorize: then it might be a bug leorize: do you have a small reproducible sample? shashlick: Trying to figure out what's going wrong Yardanico: @gaurav Yardanico: so what did you choose for your adobe premiere competitor in the end? zacharycarter: You picked vlang didn't you? gaurav: @Yardanico I am still researching. I have not been hired for the position yet. Researching before I join. Learning alot about cross platform desktop apps. I found the advices helpful though. May go with Qt and CPP gaurav: The only reason to think about other options was to get less size of binary and low mem footprint. VLang, Rust and Nim are options too. leorize: you can get small binary size with C++ if you know what you're doing gaurav: Performance matters and that could be the selling point over Premiere.. We hv few editors as mentors though and they complained abt transition in windows and flow of different softwares. UI should not be overwhelming. leorize: make sure you hire a proper designer and not a bunch of developers trying to draw out a clunky ui gaurav: I am not into programming and I can't impose what I like (I like web based programming languges and FP). I need to look with the point of view of architects and developers. gaurav: I understand that. UI is important. gaurav: I am looking at the option of going with KDenlive's code too.. saw some of its performance videos over other editors and it is good.. I liked the suggestion of one mate that day to use Kdenlite's code at the backend and make a new GUI companion_cube: kdenlive is GPL though, you can't just commercialize a fork of the code gaurav: I am planning to use Qt Design Studio for it for now. Licensed version. Hopefully, we will get up with something better.. gaurav: we will look into the code and tweak it and use it for our favour... I think we need few testing tools too.. with C++ I heard that few things are very slow to implement in that.. disruptek: don't talk to him about commercial forks; he isn't into programming. gaurav: yes.. I am not into programming.. gaurav: we will look into the code and tweak it and use it for our favour... I think we need few testing tools too.. with C++ I heard that few things after being made perform very slow to implement in that.. gaurav: Someone was sugggesting to use JS over Electron as it has lesser footprint.. gaurav: I need to look into that option too.. will try some alternatives of Electron if this option is better.. companion_cube: that was a joke companion_cube: electron s the heaviest thing in the galaxy leorize: this is way people need consultants and not just running head first into making some big projects shashlick: this entire conversation belongs in #nim-offtopic shashlick: nothing is nim specific kdheepak: I posted my question on the forum (https://forum.nim-lang.org/t/6245) because I'm pretty sure get lost in this thread. leorize: looks like you're moderated :P leorize: for your flowvar problem, I'd recommend using leorize: !repo yglukhov/threadpools disbot: https://github.com/yglukhov/threadpools -- 9threadpools: 11 15 15⭐ 7🍴 leorize: it's an improved version of threadpool and works better than the stdlib leorize: !repo weave disbot: https://github.com/mratsim/weave -- 9weave: 11A state-of-the-art multithreading runtime: message-passing based, fast, scalable, ultra-low overhead 15 141⭐ 8🍴 leorize: ^ this one is interesting too, but it's not compatible with GC-ed memory so not really that useful yet leorize: hopefully arc will change this narimiran: leorize: @kdheepak's post should be visible now gaurav: brb shashlick: can you set the gc on http://play.ni Yardanico: no shashlick: @leorize - i have a minimal example shashlick: Araq: have a --gc:arc test that doesn't work - appreciate some help Araq: well? shashlick: main.nim = http://ix.io/2j6u/nim and plugin.nim = http://ix.io/2j6v/nim leorize: shashlick: your plugin one need cdecl too... leorize: or use nimcall for the main one leorize: though it shouldn't matter on linux shashlick: well it doesn't even work with the regular GC, so hold on, let me check Araq: shashlick: does your malloc implementation work across .so boundaries? shashlick: let's just say i've been living on the edge and it's finally come to bite me leorize: Araq: I'd expect it to, since that's literally libc job shashlick: nimterop sporadically crashes with the regular GC so i'm testing with --gc:arc shashlick: but now hash is empty in the plugin Araq: shashlick: well ask valgrind clyybber: Araq: Does your recent PR mean that the cycle collector is now working? Araq: no. Araq: I suspect the paper's algorithm might have a bug since my 'thinout' uses the same technology and doesn't crash Araq: so I'm looking for a simpler cycle detector algorithm to try out leorize: shashlick: also can you add an echo to the plugin to verify that the initialization proc was run? shashlick: how do I do that leorize: just a simple `echo "hello"` at the top-level of plugin.nim shashlick: yep init runs with regular GC Araq: wouldn't be the first time I found a bug in a paper with a "correctness proof" shashlick: init runs with --gc:arc as well shashlick: so in theory, hash should be populated with a value Araq: shashlick: try also with --sinkInference:off mratsim: @leorize, is yglukhov threadpool compatible with sequences and strings? or I guess it works with Nim channels leorize: it is compatible leorize: it can do ref objects the last time I checked RaycatWhoDat: oh jeez RaycatWhoDat: IRC bridge throwbacks RaycatWhoDat: Also, hello. Trying to canvass the room for a few opinions. Does anyone here uses Nim to generate their C++ code but is proficient in C++ as well? Araq: define "proficient", I know a bit about C++ leorize[m]: I'm not that proficient in C++ but I do know a thing or two narimiran: i'm proficient, but i know nothing RaycatWhoDat: On the scale of 1 to Bjorne... like a 6. You know enough about it to put "C++ programmer" on your resume. Araq: leorize[m]: is https://github.com/nim-lang/Nim/pull/13934 still relevant? disbot: ➥ Set NONBLOCK flag atomically leorize: yea, it's still relevant Araq: RaycatWhoDat: please ask your question already Araq: leorize[m]: merge? leorize: sure RaycatWhoDat: Does Nim address most of the things you'd write C++ code for? awr1: anyone that claims to know C++ is lying awr1: /s shashlick: Araq: --sinkInference:off doesn't help leorize: you can see why none of us said we know c++ :p RaycatWhoDat: Right. leorize: I write C++ because I work on a project that is written in C++, and Nim certainly can't address that :) RaycatWhoDat: That makes sense. Would you pick Nim if it was a greenfield project? RaycatWhoDat: I'm guessing "yes". bung87: @gaurav electron is the easy way to go, qt also good as well. bung87: any other approach "cross platform" just wrote two words... leorize: ofc I'd pick nim :p Rika: Only issue with nim IMO is its small 3rd party library count, but that fixes over time Rika: Has anyone used nimlua? bung87: I'm planed write a new webview lib ,but I have no income now Recruit_main707: I was thinking, you know what would be nuts? Recruit_main707: Getting Computerphile to feature Araq to talk about nim. Recruit_main707: with the quarantine they probably dont have that much content leorize: you can ask them and maybe they'd reach out leorize: if they haven't already :P Araq: RaycatWhoDat: "greenfield project" is too broad, what project Recruit_main707: Araq: would you accept that? Araq: Recruit_main707: sure Recruit_main707: then gotta start spamming their social media ;P Rika: Not a good idea I don't think Rika: Just inquire once and wait Recruit_main707: they tend to read comments i know RaycatWhoDat: @Araq "Greenfield project" in my head means you started from zero, you're in the process of choosing a language. Rika: Never heard of that idiom RaycatWhoDat: I'd be interested to know when Nim isn't the best option. Araq: I know what a Greenfield project is, but you didn't say the topic Araq: is it a new web browser, a game engine, control software for your toaster? Rika: Right now nim ain't too good for mobile app development AFAIK leorize: spoiler: control software for toaster is actually where you shouldn't use nim, yet Rika: Why not? I though nim was embedded ready clyybber: @Rika Why wouldn't it be good for mobile app development? RaycatWhoDat: Araq: Sorry for the miscommunication. I was looking at it from an overall perspective, use case aside. "When isn't Nim the best option?" is the closest I can get in meaning. Rika: I don't know of any tutorials for mobile development in nim leorize: Rika: the ecosystem around embedded things in nim is still young, and almost no support for any of the popular embedded boards clyybber: Well, its as possible as it is to do with C++ or C leorize: also --os:standalone breaks every release :P Rika: But are there the docs for it clyybber: @Rika We can even compile to dalvik Rika: Is it well supported leorize: we now have --os:any but you don't seem to have control over everything like --os:standalone clyybber: @Rika No it was more of an experiment AFAICT. But there is https://github.com/yglukhov/jnim which the original author of the dalvik backend is now working on too Rika: Interesting, I've heard of any but not standalone Rika: I see. That looks useful Rika: For my project I mean clyybber: also dom96 is making a mobile app/game leorize: --os:standalone predates --os:any, but it's kinda funky and no one ever nailed the semantics down clyybber: using jnim afaik Araq: RaycatWhoDat: ok well, Nim definitely has all the downsides of a small ecosystem so if your project relies on libraries that are not available and not easy to wrap/redo than Nim isn't a good choice RaycatWhoDat: @Araq Okay, cool. I'm used to smaller ecosystems and I'm not afraid to put in some elbow grease to make things play nice. RaycatWhoDat: Thanks for the info! alehander92: hey guyss alehander92: i used ! alehander92: os:any yesterday alehander92: for study-kernel alehander92: and it seems to work! awesome work alehander92: disruptek or zevv or rainman or leorize not sure who did it alehander92: also i used `--gc:arc ` disruptek: zevv. alehander92: so my plan is to use `async` now and rewrite disruptek: congrats, dude. alehander92: it to very simple cooperative multithreading alehander92: well it's like absolutely toy stuff dont listen to my rambling :P alehander92: the problem is simple alehander92: `asyncdispatch` currently depends on `os` and a lot of stuff alehander92: so probably it would be better for me to just write a custom `async` macro leorize: use chronos and write your own backend for it :P alehander92: well, thats the good thing: i was like "how to write a custom executor like they do in rust" alehander92: and in nim you can just sidestep the whole thing leorize: true :P alehander92: and write your own third macro ignoring the whole stdlib/chronos thing leorize: I'm a bit wary about --os:any due to sysFatal not overridable alehander92: i need to think of preemption one day but for now not important leorize: meaning you can't have a nice panic for your kernel alehander92: but i wonder if i need to just generate `switchTasks(res: T)` calls instead of `yield` as syntax sugar alehander92: background (shell(1), shell(2)); => var input = await read(); var output = await process(input); await write(output); alehander92: hm, i really need to think about that first alehander92: anyway, my first battle was to just manage to build a cross compiler Zevv: zup Zevv: oh it was me, yes alehander92: Zevv is it a good idea to write a kernel which exposes everything in async style Zevv: ha how should I know :) alehander92: my plan is every "process" / "syscall" to be just a proc name(args): ret (optional {.kernel kind of async.}) and Zevv: If it was a good idea, wouldn't there be kernels around which expose everything in async style? :) alehander92: to just see where this goes alehander92: well, i think alehander92: it's probably a good idea but the problem is shashlick: markAndSweep fixed the crash for now alehander92: if almost everything is awaitable anyway alehander92: its better to use this as a default in the language of the kernel alehander92: so maybe people use different kinds of expressing it alehander92: but this is still doable in nim alehander92: you can write `write!(a)` instead of `await write(a)` i think alehander92: if you write such an api Zevv: I've been neglecting recent developments here, but I assume arc and async now play together well? disruptek: nah. alehander92: not sure, but i'd write my own custom async if i do that Zevv: nah?! Zevv: that was *the* single problem to be solved! alehander92: so you just write write!(a) or write~(a) for await/background alehander92: but maybe too much operator moerm: Hello everyone Zevv: what about just exposing write() only alehander92: zevv but then how would the scheduler know to run it non-blockingly alehander92: if the language generates a direct call Zevv: sure, but you make your own write(), I mean Zevv: that is implicitly async Zevv: not sure if that's the smart thing to do of course, but hey, what do I know Zevv: it makes sense to see where your scheduling points are. That's what "await" is helping with alehander92: yeah, i mean if you somehow automatically insert `await/yield` alehander92: before "futures" alehander92: this can work Zevv: sure. I did that in Lua ages ago with coroutines. alehander92: hm alehander92: but i want to sometimes Araq: Zevv: well it's hard and nobody screams "hey, I'm solving it" alehander92: run them in the background alehander92: i can always write explicitly that Araq: Zevv: work on --gc:orc is continuing and then you can run everything without the porting effort Zevv: Araq: I'm not complaining :) I know it's hard - I tried understanding any of that and just gave up after two days alehander92: Zevv yeah an example solution is safeasync from https://github.com/status-im/nim-chronos/issues/2#issue-327470294 disbot: ➥ [RFC] Async I/O with structural control flow (a.k.a. Enforced Awaits) ; snippet at 12https://play.nim-lang.org/#ix=2j7c Araq: yeah well, same here, I gave up and I'm adding a cycle collector bung87: recommand a good html parser? I know python's alehander92: but i probably just like explicitness here Zevv: Araq: fair enough alehander92: it can be simpler to just know "ah here in the code i await and here i dont" Zevv: right alehander92: so its technically possible, but i can't decide why would i do that as language point bung87: like ruby style bung87: so developer will not relys on their bad memory alehander92: also piping is interesting, if everything is awaitable `a().b()` should be something like async iterator in async iterator Zevv: lazy iterators Zevv: chainable lazy iterators, even Zevv: I'm all for it alehander92: for await e in a: for await c in b(e): alehander92: yeah alehander92: but for my shell to understand it alehander92: it should interpret this on nim runtime alehander92: which is not that hard moerm: Have a good time everyone (and especially Araq our beloved BDFL) alehander92: ok, so 1) cross compile 2) structure correctly repo 3) elementary custom async switchTasks alehander92: moerm hey hello leorize: shashlick: I've tried your test and the hash set is weirdly empty shashlick: i fixed my crash with markAndSweep for now but ya, eventually would like to use arc shashlick: but I don't understand how the regular GC also fails with that test leorize: it might be a bug in hashset itself? leorize: ping narimiran narimiran: pong leorize: shashlick: fun fact, if you use `hash.incl` inside `onTest`, it will work shashlick: actually it works on regular gc and with boehm shashlick: only not with arc shashlick: let me open a bug for tracking Araq: yes please Araq: shashlick: oh also try with --exceptions:setjmp leorize: newruntime repr() on ptr is kinda useless... leorize: it doesn't show me the address Araq: leorize: fix it please Araq: when I wrote the code I thought "yeah, nobody ever cared about these addresses..." shashlick: https://github.com/nim-lang/Nim/issues/14074 disbot: ➥ --gc:arc does not retain global HashSet in --app:lib ; snippet at 12https://play.nim-lang.org/#ix=2j7k leorize: shashlick: found the issue leorize: it's an old one and probably reported long ago Araq: what is it? leorize: but the global variable destructors assume that the program last for the duration of NimMain() leorize: which is not true for libraries leorize: so as you might expect, everything got wiped out after initialization finished :) leorize: shashlick: walkaround: move everything to an init proc clyybber: Araq: Are you referring to the proof in this paper https://sci-hub.tw/https://doi.org/10.1016/j.ipl.2008.09.009 ? clyybber: It looks correct to me shashlick: i'll stick to markAndSweep for now since I have to support older Nim shashlick: phew, seeing green after weeks! https://travis-ci.org/github/nimterop/nimterop/builds leorize: oh also disregard that advice about {.nimcall.}, it appears to me that {.exportc.} defaults to cdecl shashlick: cool shashlick: okay so question i asked again - how do you pass a static string param to a macro to another macro that expects a static string leorize: you don't :) leorize: Araq: does --gc:arc support sharing memory between shared objects without using nimrtl? mratsim: 1) use a compile-time proc @shashlick ⏎ 2) use getAST ⏎ 3) quote do call the macro and pass the string Araq: leorize: with -d:useMalloc, yes shashlick: @mratsim: i am using #3 in nimdeps, will try the same in this case shashlick: https://github.com/nim-lang/Nim/issues/7375 is still biting me disbot: ➥ Macro: bool is converted to int inside `quote do` ; snippet at 12https://play.nim-lang.org/#ix=2j7q mratsim: just call newLit(x) before doing quote do mratsim: or in the quote do block boo(`x`) mratsim: foo* mratsim: I'm more annoyed at the fact that you can't interpolate an expression, only variables in quote do shashlick: it works! shashlick: peace shashlick: so now you can cImport multiple files and toast will process them altogether and skip duplicates shashlick: duplicate symbols awr1: and made this public awr1: https://github.com/awr1/cpuwhat leorize: are we gonna see a runtime dispatcher library based on this? :) leorize: @mratsim might like this leorize: oh wait you depend on nimterop.. Recruit_main707: a nim library that doesnt have nim in the name :0 awr1: does mratsim not like nimterop leorize: I don't like nimterop dependency, not sure 'bout him leorize: though what you do look simple enough Recruit_main707: thats what i was gonna say awr1: i thought it would have been useful for all those new weird intrinsics awr1: that intel likes to keep adding Recruit_main707: he only imports a few types Recruit_main707: no arm support though :( awr1: if only optional dependencies were a thing in nimble leorize: I've got my fair share of nimterop erroring out on installation, so it's not my favourite awr1: i'll get an RPI when i move out and then i'll add proper ARM support leorize: you can use qemu arm emulation as a stop gap measure :P Recruit_main707: i havent been able to succesfully wrap a project, but its hell of a big one, and shashlick has dedicated me a lot of time trying to help. shashlick: I'd appreciate issue reports if you do encounter stuff Recruit_main707: dont worry, ive just parked it for a while shashlick: ya i mean in general to everyone shashlick: its getting old hearing about errors and bugs with no actual issues to tackle shashlick: @awr1 - if the wrappers aren't changing across platforms, you can cache the output in your repo leorize: I saw that issue with nimterop/plugin on nimph installation, has it been fixed? shashlick: no not yet - there's multiple issues with that leorize: until that's fixed I can't trust having nimterop as a dependency, sorry :/ awr1: what do you mean? shashlick: first need to get Nim flags with std/compilersettings shashlick: but i'm not sure if http://nim.cf also gets picked up by that leorize: I got hit once and the only way out was to keep trying until it starts to work shashlick: you don't use nimble either? awr1: what issue exists with niph and nimterop shashlick: or overriding nimble dir? awr1: *nimph leorize: shashlick: yea, was overriding nimble dir shashlick: on the nimterop tracker, 154 - though disruptek could use nimgit2 with static link instead, and 153 shashlick: issue is that nimterop builds a plugin by calling nim but doesn't yet know that nimcache, path or other nim compiler settings are tweaked shashlick: so if you change your nimble dir, the top level nim command will pick it up but not nimterop awr1: should the nim compiler expose a const or something for the nimble directory then shashlick: it is available now with std/compilesettings shashlick: but nimterop needs to use it leorize: shashlick: isn't having binaries in the project cache dir the right thing to do? leorize: I'd be worried if I have to clear my XDG_DATA_HOME/nimterop if something went wrong awr1: oh i see. i thought there was something like that already but it's `compileOption` - only getting a bool back, not querying a string shashlick: the thing breaking disruptek there is that if you have two projects using nimgit2 and one of them deleted the cache, the other one's binary stops working shashlick: i suggested static linking but that might not always be desirable shashlick: the way i made nimbass is to use standard linking instead of dynlib shashlick: https://github.com/genotrance/nimbass/blob/nimterop/nimbass/bass.nim#L59 leorize: static linking please, this install to $XDG_DATA_HOME is tacky as hell shashlick: so that the end user can move the binary and take the so/dll with it shashlick: and use standard lib loading shashlick: https://github.com/nim-lang/RFCs/issues/58 is similar in motivation disbot: ➥ RFC: change `dynlib` handling on linux to use standard dynamic linking instead of runtime loading via `dlopen` shashlick: i might have to change nimarchive and nimgit2 to do the same shashlick: by default, library will link with -l and then its up to the user to move the binary dlls to wherever and set LD_LIBRARY_PATH leorize: note that standard linking assumes that libraries are in standard locations shashlick: it's not pretty though - see the nimbass test file shashlick: https://github.com/genotrance/nimbass/blob/nimterop/nimbass.nimble#L16 shashlick: ya and if you did want to use std locations then why download and build to nimcache shashlick: you can just -d:git2Std and nimterop will find the standard stuff shashlick: so i don't yet know how to solve that one Araq: clyybber: I cannot open your link but my implementation is faithful to the algorithm in the paper modulo its very many typos leorize: shashlick: go all in on static linking leorize: it works, and you don't have to deal with the .so mess Araq: and feel free to debug it against hamming.nim to find the problem leorize: dynamic linking then hide the library is a recipe for disaster leorize: linux distributions has yet to solve this problem after who knows how long shashlick: Ya but for like nimbass which only have a dll leorize: if you want to support dynamic linking, force the user to specify where the resulting library will be shashlick: What do you think of the approach leorize: static vs shared is not a minor difference that you can just mask over leorize: if you produce only an exe, then the user will only copy the exe shashlick: Hmm leorize: you got to produce both the exe and the dll at the same place, then the user will copy both shashlick: See the nimbass readme, is that okay? leorize: I don't think so, this is unreliable clyybber: Araq: Ok, I will do so tomorrow. clyybber: Araq: scihub.tw is dns blocked on vodafone/kabeldeutschland and probably some others too. Had to change my dns to access it shashlick: So if shared lib, user has to specify where the lib should be copied? clyybber: awr1: What does it need nimterop for? leorize: IMO anything that rely on things outside of the scoped environment of your build is prone to breakage shashlick: That works on windows but for posix it won't run unless user uses ld library etc leorize: well it still wouldn't run even if you put it in ~/.nimble leorize: *nix have a trick for this, but it's not really welcomed shashlick: Does posix have no solution for this? shashlick: Rpath? leorize: if you link with `-rpath $ORIGIN` (note the `$`), then the binary will look for libraries in it's directory leorize: the `$` must not be escaped :) leorize: sorry, must be escaped leorize: it's a PITA with any shell-based build system leorize: I heard `-rpath $$ORIGIN` is a common walkaround leorize[m]: I think when you design a system like nimterop, you should strive for the most deterministic behavior leorize[m]: for dynamic libraries, you can follow the example of most C/C++ build systems, build them in the cache with the same flags as the project, then copy them to somewhere that's easy to be seen leorize[m]: you can default to `--passL:-Wl,-rpath,$$ORIGIN` to make the binary look for libraries next to it leorize[m]: and for bigger libraries, say LLVM, this would be needed to keep the collection of helper libraries in one place leorize[m]: `$$ORIGIN/lib` is also an usable pattern IMO awr1: i've used the rpath thing before, it works awr1: it makes the lib loader work more like windows zedeus: has anyone succeeded in statically linking openssl with mingw? i've gotten pretty close but `SslLibraryInit()` returns 0 bung87: I will create pr has bugfix cross maybe 3 libs, what's the correct steps? bung87: that might have breaking change bung87: @Araq still there? zedeus: nvm I forgot to do --dynlibOverride:ssl, got it working now Araq: bung87: what do you mean? leorize: Araq: how does `=destroy` binding work? do I have to export it or can I keep it private? disruptek: Araq: shouldn't the warshall's algo stuff use a distinct type so it doesn't overflow? bung87: may disscuss first? or just create the PR? Araq: discuss it first Araq: leorize: keep it private Araq: disruptek: what's warshall's algo again? leorize: does `=destroy` to finalizer transformation work for generic `=destroy`? bung87: (https://files.gitter.im/nim-lang/Nim/9y7t/Screenshot-2020-04-23-at-5.53.02-AM.png) bung87: I will commented these lines disruptek: Araq: dirty a graph's deps. bung87: (https://files.gitter.im/nim-lang/Nim/7xyn/Screenshot-2020-04-23-at-5.54.05-AM.png) disruptek: it's nothing to reall worry about. bung87: make it not self closing Araq: leorize: I hope so Araq: bung87: that's a breaking change bung87: I locally test the html file parse as well as expected. Araq: huh? you want to change how the html parser handles certain constructs Araq: so obviously it's a breaking change bung87: (https://files.gitter.im/nim-lang/Nim/MAIB/Screenshot-2020-04-23-at-6.01.39-AM.png) bung87: also these lines, semantic checks not readlly need, and wrongly reporting errors bung87: yeah , when do this it can correct parse html, but loss semantic checks feature Araq: move htmlparser to fusion please and give it a better test suite FromDiscord_: Github just push their notification changes to everyone :/ bung87: ok how to "move htmlparser to fusion" kdheepak: Is there a way to run a task on `nimble install` on the user's machine? kdheepak: I'm wrapping a C library and need to download the appropriate libraries that need to be present during dynamic linking at runtime. shashlick: The are before and after install hooks kdheepak: got it! I think the before hooks are what I want. bung87: I might move the modified libs to a new repo , then see where to put shashlick: Note that it's not without its issues shashlick: See the issue tracker if you run into issues leorize: Araq: so no, generic destructor -> finalizer doesn't work awr1: @leorize what were you going to say in regards to the nimterop caching earlier awr1: i'm sorry i meant @shashlick nerdrat[m]: Well 0.4.0 Also works as expected same machine. I'll keep testing. shashlick: Frankly this dll thing isn't really a nimterop issue cause it really is the library writers job to decide what to do with the dll they build shashlick: Reason I'm affected is cause I make wrappers too so they kind of need to set an example of best practices so getting it right is important shashlick: @awr1 sorry I missed the context shashlick: @nerdrat[m] same with your message, don't see the full context Bennyelg: Error: attempting to call undeclared routine: 'dup' Bennyelg: when using example of version 1.2 leorize: Araq: destroy is bound on the first object construction? I have a destroy at the end of the file and now I gotta bring it up leorize: Bennyelg: import sugar leorize: it's noted on the changelog :P Bennyelg: need to edit the docs Bennyelg: thanks awr1: you said something about caching the output of the headers - in regards to my intrinsics library - inside my repo nerdrat[m]: shashlick: About the choosenim "corrupted nim installation" issue. Araq: leorize: well you need to instantiate the generic shashlick: @awr1 ah okay leorize: Araq: it gives me an error about wrong definition shashlick: if the wrapper output won't change across distro or OS, you could use cDebug() to print it out and save it to a file which could be checked into source controlt leorize: Araq: the definition was: proc `=destroy`[T: AsyncPipeObj | PipeObj](p: var T) shashlick: that way you don't need to depend on nimterop as the end user or run it at compile time leorize: the compiler said it expects: proc `=destroy`[T: object](var T) :P shashlick: problem though is that these are compiler specific extensions and having a generic wrapper that works on multiple versions of compilers across OS is probably not realistic awr1: Hmm maybe. The intrinsics are weird though. The outward interface is supposed to work on multiple compilers (GCC and Clang and MSVC) shashlick: @nerdrat[m] so nimarchive was introduced in 0.5.0 so the fact that it works but 0.6.0 does not is weird awr1: even if their implementation internally depends on compiler specific internals shashlick: it could be a build issue but both versions of choosenim were built by the CI automatically shashlick: @awr1 - I've documented my opinion on the nimterop readme in the later sections on compile time shashlick: I don't think of it as different than cmake or some other tool that's required at build time shashlick: but if you don't need to depend on it, why not shashlick: it might be more work for you to ensure that the wrappers work predictably though shashlick: might have to add more code to check for conditions, etc. nerdrat[m]: Well I think may be something else not nimarchive if you say nothing related to extraction has been changed since 0.5.0. awr1: Maybe, I dunno. I always liked that nimterop 'just works' and has everything generated when you import it, that you don't need to have to toast things manually prior or add it as a build step shashlick: Can you try the debug version shashlick: It's posted on the release page shashlick: Or compile a build locally shashlick: @awr1 I agree and I have a good success rate of getting it to work cross os - with Travis and appveyor jobs, across Nim versions shashlick: But there are limitations shashlick: Time and info awr1: I'm reminded of a special loader library for Vulkan for C/C++ that autogens a header from the Vulkan spec XML, and it did so with a python script and it came with a pregenerated version of the header. But the Vulkan spec changes (due to added extensions) often, so I always figured this was a bit janky awr1: the Nimterop equivalent, if sources changed, would be to just force a rebuild shashlick: That's how it works shashlick: Stuff is cached inv2004: Good night, inv2004: I have one struct K = object k:ptr KP. And a lot of functions which use ptr KP. K is just wrapper for ref-counter. inv2004: Is it possible to make access to the K.k field easier? Becuase looks like I have to put it everywhere and it is a boilerplate inv2004: ... probably converter FromDiscord_: if I do "import foo" is there a proper way to have it find "foo.nim" in "$projectDir/foo/src" FromDiscord_: oh wait that path is incorrect anyways FromDiscord_: basically my project looks like this FromDiscord_: https://cdn.discordapp.com/attachments/371759389889003532/702661094262702121/unknown.png FromDiscord_: so like, I can solve it with --path:"foo/src" FromDiscord_: but then I need to do that for every new library that I add as a submodule FromDiscord_: curiously, `nim dump` doesn't seem to show any nimble paths? shashlick: That's why there's package managers FromDiscord_: to add foo to main i believe you'd need to do `../../foo/src/foo`, but yes package maangers save lives FromDiscord_: fair, was hoping to save my teammate some work so he doesn't have to remember to update all the dependencies whenever he pulls the project FromDiscord_: and also so that I can't forget to push a change in a dependency FromDiscord_: and also so that it's easy for him to change the code of a dependency that we wrote FromDiscord_: Nimble supports github hosted dependancies FromDiscord_: git* FromDiscord_: Truuue Elegant Beef: Lol Rika: i would say "and discord isnt battle tested?" but we all know that it fucking isnt Elegant Beef: Inb4 you take a 19th century naval ship into modern combat, "Hey it's lasted this long it can last longer!" Elegant Beef: I really want a good alternative to discord, but it requires everyone also moving over, so sadly im pretty much locked to discord, cause of their third party client limitations Rika: lol they actually dont give a shit Elegant Beef: I mean they dont actually, but it's in the TOS, im a good boy! Rika: sure Yardanico: But did you read Nim's copy of the MIT License?! Rika: but its the MIT licens Rika: e Yardanico: Yes, that's what I meant Elegant Beef: *What's his point?* Rika: yes Yardanico: Ok now I'm going to sleep for real Elegant Beef: ok buh bye Rika: its 8 am and i havent slept yet either Elegant Beef: Dont let the proprietary demons bite Rika: dont let the affero demons bite sealmove: Is there no documention for imGui? sealmove: Also it seems overly focused on game development Elegant Beef: It can be used anywhere Elegant Beef: There isnt much documentation for it Elegant Beef: The github issues are rather helpful Elegant Beef: also the imgui method names in imgui.nim are pretty good Elegant Beef: That console was my first usage of imgui, it's not too bad use imo sealmove: I see... It looks very powerful so it's sad there is no documentation. Elegant Beef: The imgui documentation and cimgui examples still apply Elegant Beef: https://github.com/ocornut/imgui#how-it-works Elegant Beef: Suppose this is better Elegant Beef: https://github.com/ocornut/imgui/wiki sealmove: This is probably the closest to a real documentation there is: https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#qa-usage skrylar[m]: @sealmove immediate mode guis are more or less the exclusive domain of games Elegant Beef: Shadered is one of the programs that isnt a game that bases it's entire UI in imgui, although it's a 3D shader sandbox so... skrylar[m]: when i did deep reads on them its mostly single developers that like immguis and usually for debug consoles, their popularity rolls off sharply when more than one person touches the code or if you have useless concerns like "usability" or "a UI designer" :wink: sealmove: hmm, so why did Yardanico recommend it? https://ide.kaitai.io/ weirdly falls into this category? skrylar[m]: kaitai structs are neat though sealmove: Yes it's really nice. skrylar[m]: i'm not sure what their ide has to do with immgui though? sealmove: Me neither, I know nothing about GUI devel and I am trying to make a clone of what you see but as desktop app so it can support editing (this one is just a viewer) skrylar[m]: well immediate mode guis in general have to do with forsaking retained mode (scene graphs, separation of model drawing and logic) so they do things like immediately check if the mouse is in a hot region and then issue drawcalls to react to that, rather than the old PAC/MVC thing of control code deals with reading inputs and then throwing them down event pipelines skrylar[m]: so the code reads things like `if (some condition) { draw this box }` instead of a spoderweb of "register this callback to this sensor, then this callback controls the alpha level of that box" sealmove: I see. Then it's not ideal for my use case. skrylar[m]: it is possible to do a lot of cache finagling to make this more efficient so you don't ex. knuth-plass an entire block of text every frame because the immgui doesn't have state skrylar[m]: over on the browser side with [p]react and vue or riotjs there's a bit more of hooking up dataflow triggers so you just change some relevant variables and a backend handles sending the updates to the retained mode graph (the DOM) sealmove: which one of: ⏎ https://github.com/yglukhov/nimx ⏎ https://github.com/StefanSalewski/gintro ⏎ https://github.com/nim-lang/ui [https://gitter.im/nim-lang/Nim?at=5e9e3f680480c128efd5b938] skrylar[m]: only one of those i have used is libui which does work, but is quite limited sealmove: this seems to hard :| maybe it's not work it sealmove: contributing to an existing hex editor and adding .ksy highlighting support might be a better solution skrylar[m]: maybe :headbandage: Rika: oof skrylar[m]: gtk3 is bearable if you aren't seeking windows support sealmove: desktop apps is a sad story... skrylar[m]: yea they haven't been replenishing the desktop talent, same for mainframes Chiqqum_Ngbata: I read the entire thread on serialization for kaitai structs recently Chiqqum_Ngbata: Skeptical that it will happen sealmove: What will happen? sealmove: ah sealmove: Yeah never thought about that till you mentioned it just now xD sealmove: Yeah would be awesome to parse files with Kaitai, edit them in native data structure level, and serialize them back, but we don't even have a good way to edit bytes in a hex editor xD sealmove: There is a lot of work to be done on this field Chiqqum_Ngbata: It took me a long time to figure out that you're supposed to drag-n-drop sample files into their IDE sealmove: There is a button to upload Chiqqum_Ngbata: Must have missed it, lol sealmove: It has an arrow that faces upwards :P Varriount: Kaitai? sealmove: <_< This project really hasn't get the attention it deserves. Maybe YAML is just that hated. Varriount: sealmove: What project sealmove: https://kaitai.io/ sealmove: Btw it has Nim support :P jds_dizzy_: How to turn ptr char into a string? leorize[m]: depends on this ptr char you have leorize[m]: is it a NUL terminated string? jds_dizzy_: Pretty sure leorize[m]: or does it have a length? leorize[m]: if you're sure that it's a nul terminated one leorize[m]: then `$cast[cstring](your ptr char here)` jds_dizzy_: And if it’s length based? Varriount: Ah, it's like https://construct.readthedocs.io/en/latest/intro.html Varriount: sealmove: Is there any reason one couldn't use something like NPEG for this? leorize[m]: jds_dizzy_: https://play.nim-lang.org/#ix=2iSW leorize[m]: there's also a pattern for having C proc put things inside Nim's string directly leorize[m]: (ie. using Nim's string as your buffer) jds_dizzy_: Thanks been scratching my head 2 long sealmove: Varriount yes I guess python's construct is quite similar, with the exception that construct is an internal DSL while Kaitai Struct is external. How is NPEG relevant though? disruptek: it's possible for bots to post messages on irc that only one person can read. disruptek: we could have the bot introduce itself to new users, for example. sealmove: nice disruptek: try !help sealmove: !help disruptek: well, you have to be on irc. Prestige: !help Prestige: nice. disruptek: it could work for the other networks if the bridges were hacked. disruptek: not my department, though. talk to Yardanico. Prestige: Hm looks like I'm having an issue with nimble building my project, how strange skrylar[m]: i tend to agree with some of the added things from matrix like local room history, and then reject that anything more than an extension was needed, but reinventing the world in json is just how we do things today :shrug: although some of the matrix apis are not bad Varriount: sealmove: Well, NPeg can parse textual patterns and data structure patterns, so there's no reason it can't parse data patterns too Prestige: I have a nimble task that is just 'exec "nim c src/nimdow.nim"' that fails, but if I run nim c src/nimdow.nim it succeeds lol skrylar[m]: though i fear the selection period is long over and even when the super efficient matrix servers are marked as mature, everyone will have already re-centralized under discord, and then will be too entrenched to switch, so. rip. skrylar[m]: also yea i dunno why pegs aren't usde for binary data more Varriount: Though, the fact that it requires a buffer to be passed to it might complicate things. disruptek: nah, that's fine. skrylar[m]: though i guess since more formats are becoming glorified key/value tags, the impetus for more parsing has gottne kinda less disruptek: Prestige: why do you use nimble to build? Varriount: I remember when Minecraft used null-terminated strings in it's protocol... and had a thread-per-client model that blocked the head on reading strings. skrylar[m]: ._. Varriount: https://github.com/MostAwesomeDude/website/blob/master/content/entries/take-a-bow.rst Prestige: disruptek: seemed convenient to have multiple build scripts so I can just do "nimble build" "nimble debug" "nimble release" etc skrylar[m]: am quite happy with cbor. single tag byte for type and byte length, doesn't do any weird zag encoding or test bit and read. EBML does unicode's weird read tag bits and then shuffle bytes, and even then you get no type data so you just have to know what data is meant to belong at "field 7" Prestige: I'm new though so 🤷 Varriount: I prefer Nimscript (when I can actually find the documentation on it) skrylar[m]: (still haven't read up how avros/blender sdna does it; i think they do blit structs to disk, but they also include a schema blob so they handle mutations by giving you an opportunity to check for them but otherwise there is no overhead for "i'm field 7" in every map) Prestige: Do people usuallly have a .nimble file for their packages? skrylar[m]: isn't it mandatory to be in nimble? Prestige: I would assume so Varriount: I think it's required for Nimble skrylar[m]: i quite like redo, but use pydoit lately :\ Prestige: Seems really odd to me that a simple build script would fail though disruptek: Prestige: when it comes to nimble, the sky is the limit. skrylar[m]: i guess rake can dump out raw makefiles now but haven't used that in a long time either disruptek: !repo nimph disbot: https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 59⭐ 4🍴 7& 1 more... Prestige: Nimble replacement? Rika: not yet idts disruptek: no, i aimed a little higher for your sake. disruptek: and mine. Prestige: Haha. Well I'm looking forward to it, seeing nimble fall apart disruptek: the future seems to be that package managers will setup packages however they see fit and supply input to a build tool (which is nim, in the case of nimph). then the build tool will configure the compiler if necessary and optionally run the compiler. disruptek: so you can plug code into any part of this process. skrylar[m]: seems normal enough. you dont run apt every time you run software disruptek: i mean, nimph works this way today. disruptek: it's more of a standard that nimble may support. leorize: Varriount: I found a small problem with the named pipe idea leorize: if someone could guess the seed I use for the random number generator, they can DDoS the program by predicting the next pipe name I'd try to use leorize: now I could bring in the system prng to solve this, but is it really a good way? leorize: it'd be really expensive to create an async pipe disruptek: just print a message recommending they switch to linux. skrylar[m]: i'm a bit dumb but isn't this a very remote problem with many apis skrylar[m]: even linux has some security bulletins about people 'guessing' the result of mktemp leorize: this is a windows thing, their anonymous pipes can't do async i/o leorize: so I gotta fake it with a named pipe skrylar[m]: you can use a crypto gen like blake2x if you really want to minimize guessing chance Rika: `if someone could guess the seed I use for the random number generator` now what are the odds of this disruptek: i dunno, i'm a pretty good guesser. skrylar[m]: https://blake2.net/blake2x.pdf i should check how much i would need to adjust to support this skrylar[m]: but basically blake has many fun uses, one of which is being abused to generate rolling hashes like this leorize: the seed will be the result of getMonoTime at the point where the first async pipe is created leorize: this can be trivially guesses leorize: guessed* skrylar[m]: ask the cpu for entropy or the os skrylar[m]: then extend it with x leorize: yea but wouldn't it ramp the cost up too hard? leorize: I got a way to do this by asking windows for 4 bytes of randomness then turn them into hex disruptek: no. disruptek: it's nothing compared to creating a named pipe. skrylar[m]: well you ask for entropy on init time and then run blake2x to get a new pipe name, so how often are you initializing the program or making pipes disruptek: if they can collide with your pipe, they can likely read your memory anyway. disruptek: if you collide, you get more random. disruptek: also, i know nothing about windows. fwiw. leorize: I do know one thing is that timing attacks are easy to do leorize: if say, someone got an open source nim app running on windows disruptek: easy solution: disruptek: prevent nim apps from running on windows. skrylar[m]: what does this have to do with timing attacks skrylar[m]: there are many intel cpus you can run something like rdrand and just get entropy from the silicon leorize: well I'm going with the system prng route to solve this skrylar[m]: 'kay. leorize[m]: fwiw many program out there implement async pipes on windows by using just a simple counter and loop until they get a free pipe leorize[m]: a possible topic to look for ddos attack :p leorize[m]: I'm not sure how practical one such attack would be, but it's there if anyone wants to do research :p gaurav: Hi All! gaurav: I need to make a desktop app similar to Adobe Premiere but with higher performance and low memory footprint with GUI as beautiful as Premiere. This would be the only selling point for us. This would be my first Cross Platform Desktop App development and I don't want to fail. Seeking help. Please guide me. leorize[m]: well what kind of help are you looking for? leorize[m]: I assume that you know what you need to do, right? KingDarBoja: Hiu guys KingDarBoja: 😄 gaurav: > I assume that you know what you need to do, right? gaurav: @gitterirc why would I need the help then Bot? disruptek: send me money; i'll help. gaurav: > send me money; i'll help. gaurav: @gitterirc 🍴 disruptek: will eat for food? leorize[m]: well you can't build an adobe premiere competitor without knowing what you need to implement :p gaurav: lol Elegant Beef: Clearly you just wrap kdenlive with a more attractive ui environment and ship it gaurav: kdenlive? Elegant Beef: FOSS video edditor disruptek: maybe start with competition research. disruptek: beef: you're hired. gaurav: why not openshot? Prestige: kdenlive is nice, I just need to take the time to set a theme.. the white blinds my eyes Elegant Beef: I mean i have qt set to dark theme Elegant Beef: lxappearance saves lives Prestige: That's what I've yet to do Elegant Beef: or is it qt5control Elegant Beef: whatever, im on ubuntu laugh at me 😄 gaurav: or the latest in the series.. something named with D* I think Elegant Beef: Also what do you mean why not openshot Elegant Beef: why not N video editor where n is a video editor that is FOSS Elegant Beef: I'd say it makes more sense to expand a video editor than start fresh Elegant Beef: I'd imagine it's a super large undertaking gaurav: I read about Qt, Glade, Xojo, Revery, VUi. leorize[m]: the ui is 1/4 of the battle leorize[m]: have you decided on which linear editing backend are you gonna use? gaurav: Openshot is also FOSS and was suggested by one developer. gaurav: but we need to do the editing on desktop and save it on cloud and then apply AI to it. gaurav: damn! I have started doubting myself.. gaurav: 😐 gaurav: This is what we are fighting up against.. https://www.youtube.com/watch?v=AtjgVHDvvVg Elegant Beef: I come from game dev discords, where people with very little experience say "I want to make an mmo" so i sorta have a full meter of "you probably shouldnt do that" saved up gaurav: I understand how massive it is and I am the one responsible for deciding the tech suite. Prestige: Is it possible to have a map where the values are procs? gaurav: We can't penetrate the Adobe market unless we are equally good at GUI (flow, gloss, UI and UX) and better in performance (windows switching in fraction of seconds using far less resources) skrylar[m]: why wouldn't it be? procs are pointers in the end skrylar[m]: Realistically, you aren't going to penetrate the Adobe market period. People who have already functional products on the market right now are having to give them away just to get people to look at them (cf. Da Vinci, Hitfilm.) Prestige: oh maybe I needed to have Table[Foo, proc()] skrylar[m]: Sarif is practically handing Affinity products away too gaurav: @Elegant Beef Any idea on that? Elegant Beef: Adobe has a monopoly and wont be competed with gaurav: Few of the developers have warned to use Qt as it has loads of features now and is confusing. Elegant Beef: It's the exact same as windows in that regard gaurav: Still Mac rules in performace Elegant Beef: And the userbase is where again? Varriount: Eh, any complete UI system will be confusing Varriount: Either that, or it will be high-level disruptek: confusing is what you make it. skrylar[m]: i tend to think everything at all with this thesis is wrong, for many reasons, but /shrug Varriount: disruptek: UI has to deal with things like accessibility, internationalization (not just translation, but RTL vs LTR), and varying display profiles and forms. Varriount: That's a lot to implement, cover, and learn. disruptek: to repeat, disruptek: confusing is what you make it. skrylar[m]: performance on macs "ruling" for one, is just hilarious. no, they are slower, they have avoided refreshing the pro workspace models quite often and the laptops dont even have cooling vents! they are UNDERCLOCKED disruptek: yes. skrylar[m]: all that performance is because stuff like final cut smartly hands some tasks off to the gpu, which is something adobe/avid still wont do Varriount: skrylar: Do you mean the Macbook Pro, or the desktop? Elegant Beef: The performance is bad in either skrylar[m]: @Varriount: the desktop workstation models have not gotten updates until fairly recently with that one model of iMac Pros, but people were screaming for a new mac pro for years Elegant Beef: Since performance relies on efficiency imo, and the price is inefficient skrylar[m]: the macbooks don't even have cooling systems, and the mac pros are soldered bricks. i dunno if they have fans skrylar[m]: *macbook pros disruptek: they have fans but fans don't make you fast. Varriount: @Elegant Beef Well yeah. I wouldn't use a MacBook personally, but if my job is paying for it... Elegant Beef: I still wouldnt use it Varriount: Then cost is mostly irrelevant. skrylar[m]: @disruptek no, but when your 4ghz processor is underclocked to 25% it doesn't do you any favors Varriount: I haven't had any performance issues... but then again, I'm not working on 3D games and the like. disruptek: pro tip: don't buy a laptop to win benchmarks. Elegant Beef: Dont buy macs to win benchmarks* skrylar[m]: back when i dealt with vcv rack, macs were also the #1 complainers of bad performance skrylar[m]: and that was just a glsl+nanovg interface Elegant Beef: Price to performance is an important metric 😄 skrylar[m]: *gles2 gaurav: @Elegant Beef What shall you use then? Elegant Beef: What do you mean disruptek: no argument here; i ran mac hardware for 15 years. gaurav: @Elegant Beef user base is worldwide, video editors, mostly the Production houses. disruptek: on the plus side, osx on hackintosh is incredible. disruptek: until you experience linux. Elegant Beef: I was going to say patheon OS exists 😄 Elegant Beef: i mean DE* disruptek: no one in video runs anything but mac. skrylar[m]: my kernel was busy panicking for me to hear you, disruptek gaurav: I mean, what shall you use, Windows? Linux? I installed Mx Linux, got crashed, got back to windows and not in mood to repair that. Prestige: I can't stand mac os Elegant Beef: I use linux as my main os Elegant Beef: But what i use doesnt change the facts Elegant Beef: It'd cost rather a lot for businesses to swap over to a new video editor, so it'd have to blow adobe out of the water with features and usabillity gaurav: don't worry.. the app I am planning for will be cross platform 😛 skrylar[m]: network effect is a lot of it Elegant Beef: Ok? disruptek: i have two brothers in industry. no one will consider anything outside of mac. skrylar[m]: there are some windows shops around disruptek: technically true but also irrelevant to the market. gaurav: I understand that, we are planning for that, but I am stuck with the tools and languages. disruptek: even disk arrays have to ship in silver boxes to be sold. skrylar[m]: but you still have to fight that a lot of people have a hard-on for "it must be in THIS specific project format" and that format seems never to be an interchange one (in my experience) Elegant Beef: Well i think a new tool standard could be made, but to compete with adobe you need as many programmers and probably as much money to market 😄 gaurav: Yes, I understand that too. skrylar[m]: anyway. i think there is a wx binding somewhere, i don't know if we have a qt one. those are the closest you get to cross platform and fully featured. gaurav: I am talking about a commercial grade software. disruptek: SOL disruptek: you'll be wrapping Qt or nothing. skrylar[m]: wx will also do most of what they want gaurav: My job is to choose the stack and get it implemented. I have picked few languages like Nim, V Lang and Reason (Revery). skrylar[m]: the beos stuff i was working on isn't shippable right now disruptek: i'm not familiar with wx but i'm familiar with qt. gaurav: @disruptek Tell me about qt. Elegant Beef: Disruptek i think they just called you a qt gaurav: lol disruptek: nothing more to say; you've shortlisted v and reason. disruptek: i don't think wx is in the same class as qt; not even close. gaurav: I am confused on how will it be proceeded. Regarding Languages, Using V Lang has an option of making the whole codebase to be compressed in far lesser MBs and making the use of C and C++ and there will be lesser mem footprint. It is static typed too. gaurav: About Nim, I donno much companion_cube: V is so not ready for anything gaurav: Except what it says on its website. Elegant Beef: Yea and on my website i say im a unity programmer Elegant Beef: So what's that mean! Elegant Beef: sorry unity developer companion_cube: https://christine.website/blog/v-vaporware-2019-06-23 🤷 companion_cube: (and all the other comments on various HN threads, too) gaurav: That is what I am saying, just because Nim has mentioned few things on its website.. does that mean anything? Elegant Beef: I mean it means it's a language gaurav: V has been implemented in few projects and they mentioned it on their website too. Elegant Beef: You can grab any screwdriver and get the job done aslong as the screwdriver exists disruptek: it was hard to take this project seriously before. now it's impossible. companion_cube: well, for nim, you can try for yourself gaurav: I donno buddy, its like sleeping over V and waking the other day with Rust in mind and then the other day with Revery and waking up with Nim then. companion_cube: I'm more curious about revery, Reason does exist and do what it promises, at least gaurav: V says it has UI, so does Nim. gaurav: how capable are they is what I don't know about and I never worked in this field and this would be my first project in Desktop app development. disruptek: respectfully, you're in over your head. find a mentor. gaurav: @disruptek find me a mentor companion_cube: gaurav: if you ask anyone who's been busy implementing a language these past few years (like nim or zig), they'll tell you that V overpromises by a long, long shot Elegant Beef: dis you wanna be my mentor, i need to learn how to be sillier more! gaurav: lol disruptek: for one thing, you may as well spell it correctly. disruptek: it's pscillyer. Elegant Beef: So that's a yes? Elegant Beef: And no i dont have that anymore my doctor treated it Elegant Beef: I thought i told you not to tell anyone disruptek: doctor-patient confidentiality was never very important to me. Elegant Beef: But you put your finger in my... Yea it's to me gaurav: @gitterirc With 300 kb of a Native desktop client for Slack, Skype, Matrix, Telegram, Twitch and many more services, I doubt that. Elegant Beef: I mean you're incapable of understanding how this irc bot works, so ... disruptek: the first step is admitting you have a problem. disruptek: the thing about ignorance is that it's treatable. disruptek: but you have to want to change. gaurav: @Elegant Beef What do you think will be useful in my case? Elegant Beef: Making an editor for yourself not others, unless you have super mega funding gaurav: for myself or by myself? Elegant Beef: for disruptek: c'mon, it's absurd. gaurav: Its a startup disruptek: you're talking about a $100MM piece of software. disruptek: and you're using V in the same breath. gaurav: I am going to be a part of it. disruptek: indeed. disruptek: every startup needs a scapegoat or ten. gaurav: And we shall be looking for funding too once the MVP is up. gaurav: lol @disruptek disruptek: you know what i ask every knucklehead who pitches me? disruptek: WHY YOU gaurav: @disruptek dont' worry, that won't be me. 😛 disruptek: what do you have that uniquely positions you to bring this product to market. disruptek: so far, i'm not being wow'd here. gaurav: no fear to lose, and knowledge to gain. disruptek: may it warm your cockles on those chilly skid row nights. companion_cube: gaurav: is there a downloadable binary of V's supposed chat client now? disruptek: nah. gaurav: yes there is companion_cube: cause, well, 300kb might be with a ton of dynamic libraries, assuming it even does exist gaurav: I think so.. KingDarBoja: _may it warm your cockles on those chilly skid row nights._ It's funnier on spanish lol gaurav: lol companion_cube: ah well, nothing for linu companion_cube: so much for the cross platform disruptek: i guess my spanish is better than i thought. KingDarBoja: You should listen to the advices KingDarBoja: Don't jump into something too big with so little knowledge on the field disruptek: shit, you're talking to people who do that for a living. gaurav: That is why I am looking for the knowledge, more knowledge regarding the field will be provided by other guys gaurav: And the mentors in that field.. disruptek: what's the largest tech team you've managed? gaurav: My job is to choose the tech-stack disruptek: WHY YOU gaurav: 32 Elegant Beef: no it's 42 Elegant Beef: Everyone knows this gaurav: ok KingDarBoja: _shit, you're talking to people who do that for a living._ I know people do that for living, but better go into small steps instead of a huge software stuff which promises to change the world lol disruptek: i'm saying, people who wield lightning without understanding it are afraid to shake your hand. gaurav: it would be small steps but I need to choose the tech stack. KingDarBoja: Now gonna take a quick shower gaurav: It would not be a wise dicision to change the technology later on gaurav: I mean midway disruptek: select something that 100 engineers can work with for at least 5 years before release. disruptek: ie. C++. gaurav: why not Nim? companion_cube: for redoing a photoshop? dman companion_cube: damn* Elegant Beef: not photoshop, preimire disruptek: it's premier. gaurav: premiere* Elegant Beef: Primer gaurav: and then the paint. gaurav: so, do you think Qt will be sufficient for GUI? disruptek: obviously. gaurav: in my case I meant. disruptek: obviously. gaurav: yes or no? Elegant Beef: You're sincerely continuing this, it makes more sense to use a terminal multiplixer that feeds data into your editor before you get ui up Elegant Beef: The UI is the least of concerns disruptek: you won't find 100 engineers that know wx or any other commercial x-platform toolkit. gaurav: Mine is an agile team. What shall the UI developers be doing by then? disruptek: just like you cannot find enough talent or tooling to build this project outside of java or C++. disruptek: and java is absurd for video. disruptek: ergo, C++/Qt Elegant Beef: Agile, so they're quick? Ah so it should be quicker companion_cube: I think I have to agree with disruptek … disruptek: if you rub it on the back of a duck, it goes faster. disruptek: but, hey. disruptek: go with V or reason if you must. disruptek: what the fuck do i know. companion_cube: if you have a team of engineers building a real thing, right now, better pick well tested technology gaurav: and I don't know about that. gaurav: That is the problem I am looking the solution for, for past few days. companion_cube: as disruptek said companion_cube: I mean, you can also pick free pascal, if you want something well tested, but it's a tad bit old Elegant Beef: I still think that considering what they're planning on making the language is less of a concern than time Elegant Beef: Or man power companion_cube: language is definitely important in this case Elegant Beef: Well you say that but if the project is unfinishable in a reasonable time it doesnt matter if you write it in python or asm companion_cube: (I mean, the jvm might also work *if* you get good GPU interop) gaurav: man power could be increased once we have funds, but by then, it would be us making it to take some shape. gaurav: And we no tech or GUI we won't be getting the investors. disruptek: another reason you need Qt. companion_cube: Elegant Beef: yeah well, you need both gaurav: And with no tech or GUI we won't be getting the investors. Elegant Beef: Im talking this in the same way first day game developers go and ask "How do i make a MMO" or "Anyone want to make a mmo with me" It's unreasonable to pursue this idea, unless you already have a team or funding gaurav: I want it to run on i5 8GB system. disruptek: why didn't you say so. companion_cube: https://en.wikipedia.org/wiki/Kdenlive <-- oh hello existing video editor in Qt Elegant Beef: What's this it's open source Elegant Beef: hmph gaurav: you don't get funding unless you show MVP Elegant Beef: Sure Elegant Beef: You also are a snake oil salesman at that point companion_cube: but getting to MVP is hard disruptek: i bet it's not written in C++. disruptek: oh look. companion_cube: :D Elegant Beef: But im an unemployed schmuck, so what do i know gaurav: With no tech in hand and no UI, yes it is hard disruptek: it's almost like someone who wanted to make a competitive product and knew how... picked the right tech stack with which to do so. and created a shipping product. Elegant Beef: Make the tech and add ui later disruptek: weird. Elegant Beef: The tech doesnt care how it gets inputs disruptek: bohemian! Elegant Beef: Rapsodian? KingDarBoja: Mama mia companion_cube: err, for an editing software, the UI is definitely part of the tech gaurav: but here it is about output also.. isn't it? disruptek: nah. KingDarBoja: I really hate all thatagile-related stuff KingDarBoja: But hey, that's what some industries like to implement disruptek: fr-agile gaurav: If system's processor will be heavily processing the UI, how will it work on the editing stuff? KingDarBoja: Better pick a well tested tech as other mentioned Elegant Beef: Companion, you say that but a bunch of hastily thrown together terminal multiplexed tuis could work too 😄 companion_cube: gaurav: so, if you don't know how to make a MVP or what tech to pick… why even start? KingDarBoja: Usually you have GPU and CPU companion_cube: for video? ugh :DDD companion_cube: good luck editing your video with libcaca disruptek: maybe you can use crystal; all you have to do is port it to windows. Elegant Beef: I mean the video would be rendered out properly KingDarBoja: The big question is... are you a developer or something else? Elegant Beef: Just everything else would be shoddily thrown together tuis companion_cube: Elegant beef: easier, use imgui Elegant Beef: Cant tell if you're sincere or mocking me companion_cube: a big video renderer and shittons of imgui on top of it companion_cube: easier than a TUI Elegant Beef: I guess companion_cube: (I'm serious) gaurav: I am a Manager, have been a BA, and developer earlier till 2004 Elegant Beef: You've only been a Bad Ass for 16 years? KingDarBoja: Calm down guys, no need to rely on jokes Elegant Beef: Hey you rely on what you are KingDarBoja: lol, agreed KingDarBoja: Back to the topic, okay mate, just think about what do you want, you want quality, faster development times, or just get that thing done no matter if doesn't work at all? gaurav: Yes, thanks for appreciation 🙂 disruptek: just make an offer to buy lightworks. it looks like it has the most potential. boom, you're a big shot. Elegant Beef: Yea you're attempting to compete with something that took 16 years to get here gaurav: quality + faster MVP KingDarBoja: Harder to do both companion_cube: disruptek: so do you want to hear about my idea of reimplementing mathematica in 6 months? :p disruptek: do i KingDarBoja: But best advice is research on current market platforms and check their stacks Elegant Beef: Well im remaking physics overhere, i think the flaw is that the speed of causality is too low, we need a higher speed limit gaurav: With no MVP in time, we are already dead. KingDarBoja: Probably (I have no idea to be honest) those apps use C++, Java, C# Elegant Beef: Well take something you can handle gaurav: Adobe uses, C, CPP, Java.. KingDarBoja: There u go gaurav: I donno what they use for GUI Elegant Beef: Make a new chat client to rival discord, they use electron, you can beat them companion_cube: yeah but then you'll get banned from their servers companion_cube: it's their turf Elegant Beef: Yea i gues the guys that get funding from the CPP's western arm tencent would be into dictatorships Elegant Beef: Yea i guess the guys that get funding from the CPP's western arm tencent would be into dictatorships gaurav: @Elegant Beef It is not always a choice. Elegant Beef: Well if anyone holds a gun upto my head and says "Compete with the biggest company in a rather complicated software field" i think ill tell them to shoot disruptek: let me just pick a competitor that owns 95% of the market and has an incredible moat and, even though i know nothing about the industry or the product, invent competition and gamble on success. gaurav: lol gaurav: I appreciate your honesty.. gaurav: But if your company picks that project and you are asked to lead a team what will you say? disruptek: pay me money. Elegant Beef: This is unreasonable and we need to find a better project, if you want the business to stay afloat and not be a sinkhole leorize: if they got money, let 'em disruptek: it's his livelihood, too. companion_cube: it's more, if you have barely any chance to make it work, it seems a bit wasteful companion_cube: (or bad for morale) Elegant Beef: If they trust you enough to make you a lead they should trust your opinion or shouldnt make you lead companion_cube: well I guess if I was told to use V I'd quit on the spot, so there's that gaurav: Premiere is in the market for 16 yrs, yet many tools are competing with Premiere..though its the marketleader. gaurav: With "No" in mind, we can never proceed. Elegant Beef: They're also all like 16 year old software Elegant Beef: vegas for instance is also >15 years old Elegant Beef: same with davinci resolve gaurav: and we shall be using their expertise too. Elegant Beef: Same with kdenlive disruptek: it doesn't matter. you have to not just produce a competitive product, but drink their milkshake while they watch. disruptek: good fucking luck with that. gaurav: 😛 disruptek: also, this isn't some rando brazilian gamehouse. companion_cube: disruptek: I mentionned mathematica as something basically impossible to compete with disruptek: this is a major valley player. gaurav: I understand that. companion_cube: but premiere is a pretty good example too gaurav: Thanks for understanding. disruptek: speaking of brazilians, i hear some porn calling my name. disruptek: ciao. KingDarBoja: WTF companion_cube: classy 😂 KingDarBoja: Good wank? gaurav: @KingDarBoja Are there real ppl through this bot or is it just an AI tool? Elegant Beef: It's been 30 seconds he's probably done by now Elegant Beef: It's a bot connecting to a irc server companion_cube: well if bots were that good, disruptek would be the rich one gaurav: hmm.. that is what I thought.. Elegant Beef: He's rich in spirit gaurav: again back to the topic, will my codebase be lower, with low memory footprint if I use Nim? Will Qt suffice my venture or I should go with Glade or something like that? KingDarBoja: The Beef Elegant explained the bot stuff Varriount: I know there's a QML library for Nim, but I don't believe we have an actual QT wrapper. companion_cube: just go for C++17 and Qt companion_cube: easier to hire for than nim anyway companion_cube: and Qt is designed around C++ Varriount: QT is quite hard to wrap, as it requires it's own compiler thing gaurav: Yes, heard of this QML too.. gaurav: You mean, considering my requirements I should zero in for QML with Qt for GUI gaurav: and for backend, I should be using C++.. gaurav: or C companion_cube: C++ with Qt gaurav: but C++ will make it use larger memory and Exe size will increase too companion_cube: larger memory than C? meh companion_cube: also, sounds like y'all need to be productive… 🤷 Varriount: Or you could go with JavaScript and Electron. For the ultimate memory efficiency. Elegant Beef: I sincerely doubt the executable memory size matters much within reason companion_cube: the existing programs are big, too Elegant Beef: want 8 gb of space Elegant Beef: I like blender vs maya, blender is <300MB maya wants 4+GB Varriount: Blender is nice. The UI in particular had improved immensely. Varriount: *has gaurav: Electron is no good, Thanks! Varriount: I used blender to process a 3d model from a Pokemon game, then print it out on a 3d printer gaurav: we can rather use web-pack gaurav: ? gaurav: Thanks for the help guys. I think I will look into the information provided by you all. gaurav: And will get back to you once I need to know something more. gaurav: Regards! skrylar[m]: suppose i could have been more gracious with our guest earlier. was just thinking i do have some small reading list when it comes to doing your own GUI stuff since i've been working on that skrylar[m]: recently read the TeXbook to brush up on text layouts skrylar[m]: tho it was a couple hundred pages that amounted to it basically makes a tree of boxes InventorMatt: from my experience with pyqt that does seem to be all it is for gui's in general skrylar[m]: that will get you far yea skrylar[m]: my frustration with many gui systems was that if you wanted a stock control you got them easy, but the second you want any custom thing you are now left out in syberia to figure it out yourself skrylar[m]: even gtk4 i think said they wrote a cassowary solver but its a hidden internal, you can't just reuse it for your own widget parts skrylar[m]: which is why for the thunderstrike stuff i've been reading the source materials and trying to make them in parts; because there is no good reason you can't just borrow the miglayout or css flexbox stuff for things you have to partly draw yourself skrylar[m]: trees of boxes gets you the really high level click zones; layout and text are their own diversions skrylar[m]: single typeface in english or normalized european is okay, rich text is a hot mess skrylar[m]: multiple typefaces it starts to get irritating cause now you have to have lists of boxes and calculate individual line heights and make sure when you place the lines its multiples of the baseline or else the text becomes unprofessional and bad and then if its doing it with opengl you have to add another step because changing typeface might mean changing textures so you have to work out multiple elements to batch render skrylar[m]: then there are deep secrets like people are used to clicking bold or italics, but in actuality that is a different typeface and there is no internal difference between bold<->not bold or times new roman<->comic sans because its just changing the entire characterset anyway Varriount: Skrylars: Don't forget RTL and LTR text input skrylar[m]: thats why i caveated things with english or normalized euro Elegant Beef: The trick is to only output a bit stream and make them learn how to read it skrylar[m]: although if you've gone "full knuth", it's not as bad skrylar[m]: cause i think the texbook even says it's just a matter of changing the justification of the hboxes Varriount: Elegant Beef: Or we all migrate to Wingdings as the one true textual language skrylar[m]: unfortunately todays yak shaving isn't finishing up multiline text, but faceplating gles2 :( Benumbed: Is there a Nim builtin that will tell me the index of a value in a set or seq? Benumbed: I can't find anything, but that doesn't mean it's not there Elegant Beef: for the set since it's stored as a bitmask i've been told, you should be able to do get log2 of the `yourSet and val` Elegant Beef: Although there is probably a smarter method for getting that returned value into the offset Benumbed: Hmm, I can give that a shot, thanks @Elegant Beef leorize: you can't find the index of a value in a set leorize: but you can do so for a seq[], there's a `find()` module defined for it Benumbed: See that's what I was looking for, but I couldn't find it in system Elegant Beef: Yea i was being dumb i would've just got the enum base 2 value 😄 Benumbed: but if there's a module Elegant Beef: It's in system Elegant Beef: But not under seq Elegant Beef: https://nim-lang.org/docs/system.html#find%2CT%2CS Benumbed: Searching for `find(` in system.nim nets me a goosegg for proc refs Benumbed: lol doh Elegant Beef: I do have to say annoyingly it's not listed under seqs Elegant Beef: https://cdn.discordapp.com/attachments/371759389889003532/702039420877930536/unknown.png leorize: well PR it in? :) Elegant Beef: I dont contribute, i misinform Benumbed: Noted :triggered: Benumbed: Thanks for the help BTW, both of you Elegant Beef: my log2 method is a valid method of getting the index of a bit with only the value of the bit 😄 leorize: it's still wrong btw :P Elegant Beef: huh? Elegant Beef: if you have any single bit value that will give you the index of said bit Elegant Beef: log2(2^y) = y leorize: except it doesn't work like that with Nim sets :) Elegant Beef: yea Elegant Beef: I got that, i dont know anything about nims sets, i just spew bullshit skrylar[m]: sets are technically bitfields that set 1< Taking the address of an object that resides on the stack is unsafe, as the pointer may live longer than the object on the stack and can thus reference a non-existing object. such father that father not: so is there a way to dynamically allocate stuff on the heap? Yardanico: of course such father that father not: how? such father that father not: sorry for the noobish questions 😅 Recruit_main707: ref i believe such father that father not: oh, really? Yardanico: like "alloc" such father that father not: so that's what ref is for 🤦🏻‍♂️ Yardanico: "allocShared" Yardanico: "alloc0" Yardanico: realloc, dealloc, etc Yardanico: search for "alloc" in system module docs such father that father not: yeah, so i'm seeing also something like this in the docs: such father that father not: such father that father not: https://cdn.discordapp.com/attachments/371759389889003532/702074157298614342/Zrzut_ekranu_2020-04-21_o_10.32.00.png Yardanico: yes, that's possible Yardanico: "ref" is GC'd pointer such father that father not: so that's a bit like `new int` in c++, right? Yardanico: https://nim-lang.org/docs/system.html#new%2Cref.T%2Cproc%28ref.T%29 such father that father not: i mean about `new(n)` Yardanico: well I'm not really experienced with C++ so I can't answer such father that father not: heh 😆 such father that father not: nim is such a huge language such father that father not: and i thought it was only a one-trick pony Yardanico: read https://nim-lang.org/docs/manual.html when you're bored Yardanico: you'll discover a lot of stuff such father that father not: lmao Yardanico: also https://nim-lang.org/docs/manual_experimental.html skrylar[m]: a lot of its sugar such father that father not: ooooh, experimental such father that father not: okay, so is there something akin to the rest operator in JS? such father that father not: cause say i have a seq to which i'm appending items such father that father not: and i have a proc that returns a seq such father that father not: and i want to add the things that proc returns to the seq to which i'm appending things such father that father not: it doesn't return an error, so i presume it's correct 🤔 Yardanico: "and i want to add the things that proc returns to the seq to which i'm appending things" you can have two approaches Yardanico: 1) make your seq argument in the proc as "var seq[yourtype]" and then you will declare your seq as "var data = ..." and do "myproc(data)" Yardanico: or argument as "seq[yourtype]", return type is the same and then "var data = ..." "data.add(myproc(...))" such father that father not: yeah, the second approach is what i'm doing right now and it seems to be working Yardanico: the first one might be more efficient though :P such father that father not: really? how so? Yardanico: well with current compiler optimizations it might be the same, not really sure Araq: what to use depends on the recursiveness of your proc, if it's recursive, use a 'accumulator: var seq[T]' parameter such father that father not: it actually is recursive, it's a parser Araq: I know. such father that father not: yeah, you're probably right now that i look at it alehander92: guys alehander92: mornnnning Yardanico: gmorning alehander92: after holidays :) such father that father not: hi! alehander92: hey, strange name maybe inspired by a tree algorithm such father that father not: mine? alehander92: yes, probably a pun such father that father not: not really, but makes sense 😅 alehander92: i'll take a loot at the async PR later skrylar[m]: @araq @ergonomic beef alright thats as much as i'm working on this tonight https://git.sr.ht/~skrylar/skgl Rika: ergonomic??? skrylar[m]: elegant beef but i'm tired jorjun_twitter: Targetting a well-formed and robust browser engine, like Chromum seems like a VGI. Can Nim help me out in any way? Do I just look for c++ bindings? I am bloody new to all this. As a python guy. skrylar[m]: usually the way people embed chrome is with libCEF Araq: it can help indeed. one unconvential way is to use 'nim cpp --gc:arc -d:useMalloc ' and add the produced C++ code to the codebase Araq: the tooling isn't there yet though, I think, as --gc:arc is too new Araq: can anybody help me with https://github.com/Araq/packedjson/issues/7 ? disbot: ➥ Cannot import packedjson Araq: I don't understand the problem Rika: will test solitudesf: yep, .nim file doesnt get installed for me too Faulander: easy question: how do i assign raw to a string from a variable? like r'this is a\raw string" but like rVariableName. Background, the VariableName is coming from an unescaped JSON Rika: me neither Rika: weird... solitudesf: but if i manually git clone -> nimble install - it works properly alehander92: Faulander you want a dynamic variable name? alehander92: variable names have to be generated on compile time alehander92: do you use json on compile time Faulander: no no, i want to convert a string saved in a variable to a raw string Yardanico: you don't need to alehander92: what do you call a raw string Yardanico: "raw string" is not a separate type solitudesf: 'raw' is a propery of string literal Faulander: ok, i get this string from json: 2020-04-21T11:39:34] - DEBUG - JSON:/downloads/ Faulander: all after JSON: Yardanico: pls no big pastes :P Rika: doesnt look like a big paste Faulander: this is a string: var body = "/downloads/" Faulander: and if i do parseJson(body) i get an error Yardanico: well that's not correct JSON Rika: where do you get that string anyway Rika: can you paste the whole json Rika: not here ofc as yardanico says Faulander: ok, the string is coming from a httprequest and is in the response.body - and i have a proc which converts all string delivered by that api to json Rika: it probably isnt json then Faulander: https://play.nim-lang.org/#ix=2iV8 Yardanico: "JSON:/downloads/" that aint json :P Yardanico: like really Faulander: i know Yardanico: it's not JSON at all Faulander: its a string Yardanico: so why are you trying to parse it as json? Faulander: omg ... i should sleep more Faulander: you must be so tired of my non nim related bug questions. sorry for that Rika: go sleep Yardanico: it's ok Faulander: i just called the wrong proc, i have another one which converts strings to json such father that father not: i'm sorry if i'm off-topic here, but what endianness are nim ints, if that makes any sense? Yardanico: the same as any other native numbers on your PC Yardanico: on your device* such father that father not: so little? Yardanico: if your device is big-endian, they're big endian Yardanico: otherwise little endian Yardanico: nim integers are native, there's no "containers" for them such father that father not: what i'm getting at is i want to convert a nim int into an array / seq of bytes skrylar[m]: there is also an endian module with a set of procs to do endian swapping such father that father not: and i don't know from which side to parse lol such father that father not: i'm sorry if what i'm saying makes completely no sesne such father that father not: sense* skrylar[m]: but they did answer; its the same as your local system skrylar[m]: and if you need it to be in a specific endian, import the endian module and use the `littleendian` or `bigendian` procs such father that father not: yeah yeah i know such father that father not: also big thanks if i haven't made that clear lol such father that father not: i just tend to ask questions and **require answers or else** Gary M: yikes PMunch: @genotrace, you around? Recruit_main707: he is shashlick in this server PMunch: Ah, they're the same person! PMunch: Hard to keep track of all the nicks.. PMunch: @shashlick, you around? Recruit_main707: xDD such father that father not: lol livcd: whoever created this abomination called Teams should be punished PMunch: livcd, like Microsoft Teams? livcd: yeah that one PMunch: Luckily never had to use it, haven't heard anything good about it :P livcd: what chat app do you use at work? Rika: i heard microsoft teams is really fucking horrible Recruit_main707: its true, discord is way better and im sure it can hold 20-30 ppl livcd: electron apps are horrible in general Araq: !rfcs distro disbot: https://github.com/nim-lang/RFCs/issues/173 -- 3Developing Nim's stdlib and a Nim distribution disbot: https://github.com/nim-lang/RFCs/issues/58 -- 3RFC: change `dynlib` handling on linux to use standard dynamic linking instead of runtime loading via `dlopen` PMunch: livcd, Slack PMunch: It doesn't work in FireFox, but apart from that it seems to work okay alehander92: livcd cant agree, vscode is ok PMunch: Anyone else who can get this to work? https://github.com/genotrance/nimssl/tree/linux Faulander: teams is not that bad. there are some quirks, but it can hold conferences (video and chat) with 250ppl out of the box and the quality is better than landline. Faulander: otherwise it's like slack, lacking the integrations ... but the integration with sharepoint (if you use it) is really great Faulander: we like it ALOT Recruit_main707: ive seen discord discos with about 500 ppl livcd: Faulander: it cant do one thing well...not lag like crazy because it's made of crap. Araq: ping disruptek Faulander: Discord would NEVER EVER be used in a company environment, at least not in companies with sensible data and sensible clients Faulander: and teams can do 100.000 ppl, i just said 250, because that is what you get with the normal license almost everybody has Recruit_main707: they've made a quick update to make it a bit more not-gamer friendly livcd: I use this for private communication https://www.kakaocorp.com/service/KakaoTalk livcd: It's a native app. Takes around 10MB here. Faulander: too late, there are only two options. slack and teams and in europe teams already has won, in us probably slack Faulander: we are a small company with alot of clients, we never have experienced lag, except in the beginning of the corona crisis livcd: I mean the UI "lags" if you have only a semi decent machine with a lot of other apps running Faulander: it doesn't for me, i always have a ton of programs running and only a descent laptop. i think its in the under 1000$ range, but not sure. livcd: Faulander: I am on Search Results livcd: Featured snippet from the web livcd: oops Recruit_main707: Faulander: ive been thinking, why would you even need 10.000 people capabilities livcd: Search Results livcd: Featured snippet from the web livcd: HP EliteBook 840 G5 - 14" - Core i5 8350U - 8 GB RAM - 256 GB SSD - US livcd: And it's not a pleasant experience Faulander: Lenovo 15" - Core i5, 16GB Ram Faulander: probably you're running low on RAM. livcd: which was my point the whole time :) Faulander: well, but that's not really the problem of the program itself :) federico3: all this stuff is off topic livcd: no nim discussion going on! federico3: it still takes people's time to go through the backlog Faulander: ok, back to nim. how do you guys create github markdown from the rst docs in nim? Araq: 'koch docs' Araq: and how can I change my color settings for VSCode on OSX? it says it cannot write some settings file Faulander: cmd + "," and change it directly in the settings Araq: never mind, finally figured it out Araq: took me a year... Araq: finally I understood what the program tried to tell me clyybber: can I safely cast an `array[N, float64]` to an `array[N div 2, array[2, float64]]` ? clyybber: I fear it might be unsafe because of alignment clyybber: But intuitively I would say it should be safe, right? liblq-dev: @clyybber: well uh, you can always check by casting both arrays to ptr UncheckedArray[uint8] and comparing the contents liblq-dev: I would say it should work liblq-dev: because arrays don't have any special headers shashlick: @PMunch sorry it's not functional yet, @voltist helped convert it to nimterop but it's broken since PMunch: That's what I feared.. shashlick: The new ast2 algo should go better but will need some effort to get it working shashlick: What specific portion do you need shashlick: I can get it back in shape PMunch: RSA encrypt/decrypt PMunch: I already have the keys shashlick: Will you be linking with the dll/so or want to compile it in shashlick: Also which os PMunch: Doesn't really matter PMunch: And Windows and Linux for the platform Araq: so. here is a new idea regarding https://github.com/nim-lang/RFCs/issues/173 disbot: ➥ Developing Nim's stdlib and a Nim distribution Araq: anybody interested? shashlick: PMunch: ok dll/so is easier shashlick: I can whip something out quickly for you to use for now PMunch: Neat! euantor: OpenBSD CI is finally passing and hopefully ready to go! Took me a while to get it all working, but looks like we're all green now: https://github.com/nim-lang/Nim/pull/12105 disbot: ➥ #12103 - CI for OpenBSD PMunch: Araq, is that text updated with the new idea? Araq: no shashlick: PMunch: do you have some sample C code?want to know what specific headers need wrapped PMunch: Well I need "RSA_private_encrypt" and "RSA_public_decrypt". Along with some way of creating the RSA struct from the keys I get from the C# code. And whatever helper functions to get errors and such. Araq: so here is a summary: we introduce a new github repo nim-lang/fusion where we add new modules. These modules should work with Nim 1.0 and 1.2, continue to be maintained, have had a review process and are part of 'theindex' and shipping with the official Nim installer Recruit_main707: and should work with arc? alehander92: what is theindex Araq: yes but only with devel's arc alehander92: hm, they need some kind of maintainer system clyybber: alehander92: The search page in the docs alehander92: e.g. what happens if module X's maintainer steps down Araq: the reason behind this is the following: whenever I say to person X "this should be a nimble package instead" we don't have a process for the resulting package even if the package gets done at all. Araq: the package needs to be setup, it needs CI integration, a Nimble entry etc and even then no QA happens Araq: alehander92: we maintain it like nim-lang, it becomes a community effort alehander92: so it's like an extended optional stdlib Araq: and we'll ensure it's not suddenly removed from github... Araq: alehander92: the overall quality and domain is not "stdlib" like Araq: for example, you can add a decent UI library or stuff like my 'dialogs.nim' which don't fit a stdlib alehander92: hm, ok alehander92: but how do you guys solve the alehander92: one adds a good ui library, year later most people start using lib Y because its so cool alehander92: thing Araq: and now let's see how this works out with basics math: we have 2 things, the Nim compiler (C) and Nim extensions (E). C adds E as an "important package" so we ensure it keeps working. E tests against 1.0 and 1.2. that's 3 combinations. Compared to N*M for when you have N packages and M compiler versions. Skaruts: if I do `import foo except a, b` and then `export foo`, does `a` and `b` get exported with the module? Skaruts: seems like it's what's happening in my code Araq: Skaruts: I think so, but a very good question Araq: export foo except a, b Araq: was added in version 1, iirc? Skaruts: oh let me give it a try Araq: alehander92: in this regard it is stdlib-like, stuff in there keeps working unless we move it to the graveyard Araq: and bigger packages like QT or wxWidgets continue to better be done as separate packages liblq-dev: Araq: hey, could you please create a new tag for https://github.com/nim-lang/cairo? the current newest one still uses the old API with pascal-style T/P prefixes Skaruts: worked, thanks Araq Araq: liblq-dev: ok, ping me again about it tomorrow if I forget liblq-dev: sure Araq: and thanks for making my point. semver is fundamentally broken because it's a constant development overhead and it predates git commit hashes, we should all simply use git commit hashes and abandon semver PMunch: Problem with that is that it's hard to know which is newer of 3bbc36e3074a0baf34ac20c9fe210bde2390ab2c and 8033061afa00f8bd206df5d08bba3e85cde1e38b Rika: why would you be able to export something you havent imported? PMunch: Plus kinda hard to reference.. Araq: PMunch: sure and I prefer ISO dates as the version but that doesn't work for reproducible builds Araq: we could combine them Araq: Rika: well the compiler doesn't remember what you imported when it processes the 'export' statement Araq: but IMO it's good enough Rika: okay EdgyNerd: can any of the 3 compilation targets (C++, C, ObjC) give any speed improvements, or are they all fairly similar? PMunch: Depends on the compiler/optimisations. But I've seen the C++ target be considerably faster sometimes PMunch: Other times they're the same PMunch: Or slightly slower Araq: EdgyNerd: C vs C++ is an interesting open question. In theory C++ has the faster exception handling impl Araq: but I also heard rumors of C++ being 2x slower on some code for unknown reasons Recruit_main707: i feel like "echo" in c++ was WAYYYYY slower Recruit_main707: i havent checked it in a while though Recruit_main707: but it was making my program go slow Araq: makes no sense though, we don't use 'cout' or anything Recruit_main707: i dont know why, and it only happened in the cpp backend, c was fine Araq: well, 'fusion' package? yay or nay? Rika: for what? Araq: for growing Nim in an easier way Recruit_main707: could be interesting alehander92: well, if the core team wants to maintain all this alehander92: (talking in the worst case where n packages get stale) Araq: alehander92: currently we have packages under nim-lang that lack CI Araq: and I accepted PRs and now for example 'zip' is broken on Windows Araq: maintaining *instead* 'fusion' would be easier than this mess of dozens of little packages alehander92: ok, for small packages it probably makes sense alehander92: does this mean eventually more of stdlib might move *to* fusion one day Araq: stale packages are a problem either way but this way at least they keep compiling Araq: yeah we can move more of the stdlib to extensions too Araq: and here is one more idea: we keep the versioning in the directory hierarchy. say we have fusion/htmlparser and at some point too much stuff in there is .deprecated. then we should introduce fusion/2/htmlparser and both can import fusion/private/htmlparser_impl.nim, no code duplication and code that imports fusion/htmlparser continues to compile Araq: as you can see, I'm trying to get into the lovely fairy world where code is immutable alehander92: hm companion_cube: Araq: have you read about the unison language? Araq: companion_cube: yes I do companion_cube: cool, there are some interesting ideas in there (about immutability indeed) mratsim: can we add monorepo support to nimble before "fusion"? Araq: nimble does support multiple nimble projects per repository already mratsim: oh? so the installation path would stay nimble install zip or nimble install sdl2? mratsim: assuming both are put in a fusion monorepo? narimiran: @mratsim see https://github.com/nim-lang/graveyard Disciple: New to Nim, does the compiler not warn against procedures that have a return type but don't return anything in the body? Rika: no Rika: because there is an implicit result variable Rika: (i assume) liblq-dev: yeah, not returning anything isn't harmful in most cases but it could warn you if you forget to assign to `result` Araq: there is a warning for it but only for types that lack default(T) clyybber: @mratsim Do you think https://github.com/nim-lang/Nim/issues/13193 should be high priority? disbot: ➥ Type tyAnything can't be matched to proc argument of typedesc type ; snippet at 12https://play.nim-lang.org/#ix=2iWM Araq: clyybber: iirc I tried to fix that one and it's hard mratsim: for me it's blocking but I don't know if supportsCopyMem in a type section is that popular a feature Araq: one idea that I had was to introduce tyTypedesc2 and get it right this time Araq: and then we can deprecate typedesc for typedesc2. Araq: currently whenever I try to fix too much wrt typedesc too much stuff breaks Araq: we could use a better name than typedesc2 for it though mratsim: the whole generics/static/typedesc is quite tricky Araq: one after the other, typedesc seems more important than "generic sandwiching" IME clyybber: @mratsim Does it work when you do CpuStorage[T: type] instead? mratsim: When I need to deal with them in macros, I'm like "Okay, do I really want to do this? Do I have a weekend to fight the inevitable bugs?" Araq: mratsim: do not conflate everything together, typedesc is tricky but "working with types inside macros" is a different topic Araq: but the same solution might be applicable, leave the old stuff alone, introduce new magics and identifiers and macro procs that do what we really want them to do clyybber: Ha clyybber: I think I know the source clyybber: of that bug clyybber: Its that in `Generic[T]` the T defaults to any clyybber: and not to type clyybber: as it should mratsim: mratsim: https://cdn.discordapp.com/attachments/371759389889003532/702169089078198363/unknown.png clyybber: So it makes sense that you can't call supportsCopyMem clyybber: Oh, I have to test your original snippet clyybber: Only tested cooldomes minified one mratsim: I'm not conflating, everything related to generic/static/typedesc types is tricky mratsim: both macros and semchecks clyybber: @mratsim Yeah, works for me clyybber: I'll comment on github mratsim: I can't assign the result Araq: mratsim: they are different features and implementations disruptek: the fusion idea doesn't compel me at all. clyybber: mratsim: Can you give me an example? mratsim: it may be different but it's about the same "layer"/"object"/"concept" Araq: disruptek: why not? disruptek: i dunno what to tell you. change that doesn't change anything changes nothing. Araq: what should we change instead? disruptek: i will wait for the RFC update; maybe i've missed something. disruptek: create a working pattern to solve the module imports issue. disruptek: i have a feeling it's already doable, but i haven't tested it yet. Araq: what is the "module imports issue"? disruptek: move forward on the pm->builder->compiler pattern. mratsim: @clyybber that's not even the error I have but here is one: https://play.nim-lang.org/#ix=2iWS disruptek: the issue with imports, exports, circular imports, w/e. disruptek: make nimsuggest support include so we can actually use it. Araq: it does support 'include' disruptek: not /enough/ mratsim: and this one is an ICE: https://play.nim-lang.org/#ix=2iWT disruptek: iirc it's broken by forward decls too. disruptek: leorize knows all. Araq: I'll wait for him then disruptek: i think i'm back to wasting time on generics. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: but streaming about something else. disruptek: anything else. clyybber: @mratsim Hmm, yeah the compiler trips over that explicit `: type` clyybber: @mratsim Your ICE is fixed when using `: not static` instead :p mratsim: ... mratsim: I've also used static to fix bug in the generic code disruptek: https://github.com/juancarlospaco/nim_packages_security_audit companion_cube: damn, how do you see anything with that contrast in your editor companion_cube: yep :p mratsim: This openarray semcheck bug is fixed by using a dummy static parameter: https://github.com/nim-lang/Nim/issues/6343 clyybber: Araq: FWIW pony also doesn't have scope based destruction yet (or may never have it) Araq: does Pony have destructors? clyybber: Yeah clyybber: But they are not overridable clyybber: More like, they have a GC and finalizers clyybber: And the GC only collects stuff from some "proc" after that proc has run Araq: I want scope based destruction, it would further improve the generated machine code companion_cube: you mean RAII? clyybber: Araq: Yeah clyybber: companion_cube: Similar concept yeah Araq: companion_cube: yeah (the term is terrible though) companion_cube: yeah but it's well known by now exelotl: Hey I published my GBA image conversion library :) exelotl: https://github.com/exelotl/trick clyybber: nice! just saw the PR for the pkglist clyybber: @exelotl If you want a challenge you could try doing all this at compile time clyybber: So that you can say loadImg("somePng.png") clyybber: Directly in your games code I mean mratsim: @Araq, did you read the scope-based mangement of the scopes programming language? Araq: yeah I think I did Faulander: does encodeQuery only accept one type? clyybber: lritter hops on this channels sometimes Faulander: https://play.nim-lang.org/#ix=2iX2 exelotl: @clyybber Hmmm I wonder how viable that would be. I do have something in my game where you add the image to a config file. So if you add dog.png with 4bpp, 32x32 pixels, then gfxDog becomes available in the game code and you don't have to remember the bit depth or size because they're known at compile time exelotl: You still have to remember to run the tool though, whenever you add or change an image clyybber: Hmm, that should be possible to automate clyybber: at least via staticExec exelotl: Yep, but I'm tending to stay clear of staticexec nowadays, cause it's a can of worms that doesn't play nice with nimsuggest exelotl: I think a simpler/more primitive solution isn't such a bad thing clyybber: sure dadada: hi dadada: can I use nim's parser at runtime? somehow? sealmove: dadada yes, you have to use the compiler API clyybber: via the compiler api maybe. sealmove: Is it possible to specify multiple executables in a nimble package> sealmove: dadada: https://github.com/nim-lang/Nim/blob/devel/tests/compilerapi/tcompilerapi.nim dadada: sealmove: great, thank you! dadada: another option occured to me just now, I could call nim as external program and let it dumpTree things for me sealmove: Why not dump Nim code? Then you have a proc ready for you for parsing back to AST mratsim: the compiler API is broken for me: https://github.com/nim-lang/Nim/issues/12293 disbot: ➥ compiler as a library: findNimStdLibCompileTime fails to find system.nim ; snippet at 12https://play.nim-lang.org/#ix=22qc brentp: is there something i need to do to get zig working as compiler? I installed zig 0.6.0 and then run `nim c --cc:zig x.nim` on a hello world example brentp: but I get a lot of errors, including `home/brentp/.cache/nim/x_d/stdlib_system.nim.c:428:50: error: expected ')' ⏎ static N_INLINE(NIM_BOOL, nimSubInt)(NI a, NI b, NI* res);` alehander92: please look for one issue where people found the flags to do it alehander92: hm ok http://webcache.googleusercontent.com/search?q=cache:https://github.com/ziglang/zig/issues/5055 seems alehander92: maybe as a different issue , sorry brentp: https://github.com/nim-lang/Nim/pull/13757 is what i find. disbot: ➥ Add support for `zig cc` as C compiler. brentp: and https://github.com/nim-lang/Nim/pull/13957 sealmove: Is there a macro for not repeating echo all the time? sealmove: e.g.: sealmove: ```nim sealmove: echoMacro: sealmove: thisString sealmove: theString sealmove: ``` Recruit_main707: echo can work that way Recruit_main707: its not recommended though Recruit_main707: but it will work Recruit_main707: or you mean multiline strings? sealmove: single line is ok. why it's not recommended? Recruit_main707: idk, its in the docs iirc yumaikas: sealmove: Why not just use a multiline string? sealmove: example? sealmove: My code is like "print 3 lines, then run some code, then print 2 lines, run some code, print 4 lines" alehander92: just alias it to something like `e` alehander92: or inject automatically echoes around statements mratsim: @sealmove it's easy to write a macro that does that sealmove: "inject automatically echoes around statements" this sounds interesting, how to do? mratsim: you can check the code of the `check` macro/template in unittest, it insert something at each statement mratsim: otherwise just macro echoAll(body: untyped): untyped = for s in body: newCall(bindSym"echo", s) mratsim: ah sorry forgot a result = newStmtList() and result.add newCall(bindSym"echo", s) sealmove: awesome 🙂 mratsim: https://play.nim-lang.org/ mratsim: https://play.nim-lang.org/#ix=2iXF Faulander: how do i create a linebreak in nims created documentation? sealmove: mratsim this is exactly what I was looking for :> mratsim: added to my cookbook: https://github.com/status-im/nim-cookbook/blob/master/multiline_echo.nim sealmove: Maybe I will make the macro take 2 strings per row and output them in a tabular format sealmove: would that be too hard to do? Rika: i dont think so yumaikas: sealmove: By the time you're going for tabular output, you're in territory of things that might not make sense in a macro. At least, if you want to align your text all nice and pretty mratsim: what you can do is have something that work on regular strings and then call it at compile-time, possibly via a macro that first call "repr" on statements on each lines sealmove: well I want to easily print something like this: sealmove: ```nim sealmove: &"""{"Relative path":<25} | {lnk.relPath.str}""" sealmove: &"""{"Absolute path":<25} | {absolute(lnk.workDir.str, lnk.relPath.str)}""" sealmove: ``` Recruit_main707: when you run nim with the --header, does it include the intermediate c file? Recruit_main707: ie: `nim c --header file.nim` Recruit_main707: will `file.h` contain #include `file.c`? sealmove: hmm, I think I know how to do it, need to first make a regular proc leorize: Recruit_main707: the --header switch is deprecated alehander92: hm, i will rename `lodka` to `study-kernel` and build it with :arc alehander92: but i plan to use the async/await macro there alehander92: wonder if it will work out Recruit_main707: leorize, why? Recruit_main707: it could be very useful for interoping with c/c++ Recruit_main707: nim -> c/c++ that is leorize: the exact lines from Araq: "Nim is not a header generator" leorize: btw Araq, this is the problematic bug in nimsuggest: http://ix.io/2iXP/nim Recruit_main707: is there onther, as easy way for interoping nim -> c/c++? Yardanico: what would be a good way to check if a float can be represented as int without any loss? Yardanico: like 5.0 can be "safely" represented as 5 but not 5.5 companion_cube: turn to int, then back to float, check for equality? Yardanico: yeah I also thought like that Yardanico: just feels like it might be not the best way :P Recruit_main707: + --header would help people to easily use nim in their work because in the end it would be as writing normal c, (unless there is anoteher way that i am not concern of) Yardanico: float(int(a)) == a I guess leorize: I think the problem with --header is that it depends heavily on Nim leorize: you need nimbase.h, I'm sure of that leorize: Yardanico: `==` never works well for float fwiw Recruit_main707: wasnt nimbase.h gonna be deprecated also? leorize: Yardanico: maybe `a - trunc(a) <= some small number` leorize: Recruit_main707: yea but it's not here anytime soon Recruit_main707: (if you ask me, just print it directly in each file :P ) Recruit_main707: or add it to the cache awr1: hello Recruit_main707: hi Recruit_main707: leorize: as a last question and then i let it be, what would be the next easiest way to interop nim -> c/c++? awr1: what do you mean, like getting C to call nim? leorize: make your own header generator :P Recruit_main707: that sounds unfun having one :( leorize: the bad thing about --header is that it also generates header for... everything Recruit_main707: does it? leorize: afaik, yea Recruit_main707: last time i used it, i think it didnt Recruit_main707: let me check leorize: well a header generator might just be a macro leorize: I thought of making one but currently I'm busy with other projects Recruit_main707: how did you avoid that nim optimized your functions by passing pointers? leorize: `{.bycopy.}` Recruit_main707: well, its not giving a fuck about it :P leorize: use bycopy on the type itself Recruit_main707: i am leorize: that's weird leorize: any examples? Recruit_main707: is it because its `var Type`? leorize: well obviously lol Recruit_main707: var is just a pointer to an initialised object? leorize: yea, it's implemented as a pointer to something leorize: I mean that's the only way Faulander: i just managed to write the 500th line of nim code in an program. congratulate me, way to go! ;) leorize: woooo \o/ Recruit_main707: nice Recruit_main707: i dont think i have even reached 500 lines in a single file xD Faulander: not too bad for only a few days of (mostly) struggling around, hahaha Faulander: i am still struggling with some basic concept and the tooling, i wish there would be documentation for ppl not coming from a C background. The "Nim for python programmers" was VERY helpful though. alehander92: nice Faulander: i think i will create a library out of it ... if i sometimes find out, how do :) Faulander: i have one last question today. i have installed nim with scoobe and araq threw into the room, that i should use koch doc if i want to create markdown documentation (my code is very well documented). but i don't have koch (a name i like as native german speaker) leorize: ah koch docs is for the compiler only leorize: for your project there's nim doc --project Faulander: and that creates markdown? leorize: oh wait you want to generate markdown? narimiran: Faulander: that creates .html Faulander: i thought thats only if you have more files ... i yet have to split up the source in different files alehander92: hm, cant nim doc create makrdown alehander92: i almost never try to run that Faulander: i just want to create github readme.md with it :) leorize: !repo mddoc disbot: https://github.com/treeform/mddoc -- 9mddoc: 11Generated Nim's API docs in markdown for github's README.md files. Great for small libraries with simple APIs. 15 5⭐ 1🍴 Faulander: thank you so much @leorize and good night! alehander92: huh it just doesnt work for me sealmove: Guys, for those interested, I changed the project to a framework (collection of simple executables): https://github.com/sealmove/kaitai_struct_forensics sealmove: Oops, forgot to change the description alehander92: oh sorry it works alehander92: i need to pass the flags that i pass to my build alehander92: i really want a white background! sealmove: I am hoping to replace the stupid endless jungle of fragmented/different platform forensic tools with a consistent framework which uses auto-generated parsers by Kaitai Struct. I think Nim can shine in this field! It's perfect because of the easy syntax + being low level which is important in forensics. alehander92: huh it is white federico3: sealmove: but we need better integration and tooling around kaitai alehander92: i maybe want more different code clocks color alehander92: just so hard to undestand for me alehander92: comparing it to rust/zig they just seem white-r alehander92: but it seems its an illusion livcd: I have heard of kaitai before oO sealmove: Will probably add IDE support soon mratsim: you need to expand the README @sealmove I have absolutely no idea how to use those sealmove: It's very early stage now, I've only started making the first executable (for Windows Link Files). I will also add help in the executables (`-h` option). If you want to try it for now, it's just `wlf `. sealmove: install with nimble or manually by compiling `tools/wlf.nim` inv2004: Is it possible to have recursive imports? google says better to not ask it here :) sealmove: you mean cyclic imports? sealmove: no, it's not implemented yet sealmove: Probably Nim 2.0 inv2004: trying to find include which could help inv2004: src/k_f.nim(3, 1) Error: redefinition of 'len'; previous declaration here: src/k_f.nim(3, 6) inv2004: ?!? It is the same file inv2004: and line Yardanico: can you show this line? inv2004: proc len(x: K): clonglong = inv2004: If I do :int - the same error solitudesf: thats because of includes inv2004: Ah! :)) I forgot about the include I did 2 mins ago, but you remember it bung87: is there a objc runtime binding ? bung87: I want fix old c version webview but the `objc_msgSend` looks ugly shashlick: @PMunch - still around? Varriount: inv2004: Technically you can have cyclic imports, but the behavior works in much the same way Python's recursive import behavior works. Varriount: If module `A` imports module `B`, and then module `B` imports module `A`, module `B` will only have access to types/procedures defined from module `A` up to its import of module `B`. leorize: that kind of import only works one way fwiw leorize: ie. if you make module `a` work like that, you can only compile module `a`, if you compile module `b` it won't work Prestige: Can someone explain something about tables? https://play.nim-lang.org/#ix=2iZq Prestige: I'm attempting to do that latter but get an error about type info, but the first example works. I'm a little confused Yardanico: Prestige: it works if you do initTable[string, proc()]() Prestige: Yeah just found that out, I thought it wouldn't because if I change the table `bar` to be declared with [string, proc()] I would get a type error lol Yardanico: also btw I just tested my recursive descent math evaluator (mathexpr) and it's ~35% faster (well I did some arc optimizations for that lib in the past but it wasn't that fast) Yardanico: also with --gc:arc the results are consistent :P Yardanico: 160k iterations/sec for evaluating "2+2*2-3*5125-12512+25125*44-33+2*2" Elegant Beef: So using imgui for a status bar is silly, no such thing as alignment as far as i see Elegant Beef: So im smart! companion_cube: you mean horizontal alignment? Elegant Beef: Yea Yardanico: by the way guys I'm using TabNine with nim extension in VSCode and so far it's pretty good Yardanico: sometimes it's so smart that I'm scared Yardanico: well, rather not smart but analyses the code very well Elegant Beef: You cant exactly go "i want x widgets left aligned these center aligned and these right aligned" Yardanico: so I have this case statement https://github.com/Yardanico/nim-lox/blob/master/src/debug.nim#L38 companion_cube: ah well, it's quite direct in terms of rendering companion_cube: isn't a status bar something thin, though? Yardanico: and when I needed to write a new one, I started doing "of OpLess: " and then TabNine autocompleted the WHOLE line companion_cube: (if it's like i3-status) Elegant Beef: I might make three groups though Yardanico: to " of OpLess: simpleInstruction("OP_LESS", offset" Yardanico: like literally Elegant Beef: Yea it's 30 pixels atm companion_cube: beef: have you looked at the demo window? there's some layout instructions it seems Elegant Beef: Elegant Beef: https://cdn.discordapp.com/attachments/371759389889003532/702262449449074776/unknown.png Elegant Beef: I havent actually Elegant Beef: That's currently what my status bar is companion_cube: ah, there's a ImGuiShowDemoWindow or something like that companion_cube: super useful to see what's available Elegant Beef: Yea i know, havent looked at it though Elegant Beef: Launcher is just so i can launch applications inside xephyr since my WM blocks all my inputs skrylar[m]: some days i lament we can't just ban people from having more products because stuff like teams is just going to ride off "it's microsoft, so we'll use it" and the actual merits of literally anything else will be ignored because just the name is enough, and nobody else can "be microsoft," so anything they decide to push doesn't even have to be that good. but we seemingly can't, so, bleh. Prestige: Hm I need to learn how nim reads modules. My current setup isn't allowing me to use windowmanager.nim https://0x0.st/i1FY.png skrylar[m]: @earlier Yardanico: Prestige: how do you import stuff? mratsim: I'm quite happy of the graph generator of Synthesis: https://github.com/mratsim/Synthesis/#sync-await-a-task-that-may-be-spawned-on-another-thread Yardanico: @mratsim yeah I saw that PR in weave it's very cool! Recruit_main707: leorize: since var is a pointer, will `ptr Type` be compatible with `var Type` also? leorize: no leorize: the fact it's a pointer is just an implementation detail leorize: technically speaking `var` will be compatible with `ptr`, but not the other way around Recruit_main707: ok leorize: `var` semantics let it assumes that there can't be any `nil` pointer passed leorize: `ptr` doesn't have that Recruit_main707: i see Prestige: Yardanico: from nimdow.nim, import nimdowpkg/windowmanager doesn't work Prestige: But the modules in nested directories work, like import nimdowpkg/config/config Yardanico: damn 4raq is merging so much PRs my notifications get blown up :P but it's all for the best leorize: dom96: when should I call `GC_unref()` on a `Custom` object? dom96: context? shashlick: does cligen have a way to do `-d -d -d` for increasing debug level leorize: dom96: I've just called an overlapped operation, and it finishes without having to go async leorize: do I unref my `Custom` there? dom96: honestly cannot remember, see what the stdlib code does leorize: asyncdispatch is known to leak on windows, I don't think seeing the stdlib code is a good bet leorize: but I'm seeing differing opinions here leorize: stdlib don't unref if an overlapped operation completes before having to go async leorize: but cheatfate's asynctools unref if that happens Recruit_main707: [about flatbuffers] Recruit_main707: > i am pretty happy with how the table transpilation has resulted, i think i got generics right, if you spot something tell me pls. Recruit_main707: Recruit_main707: How is it looking guys? Recruit_main707: (this is based on the python implementation: Recruit_main707: https://github.com/google/flatbuffers/tree/master/python/flatbuffers/table.py Recruit_main707: https://play.nim-lang.org/#ix=2j09 Recruit_main707: I should have left a bit of space between the URLs :P dom96: leorize: is asyncdispatch known to leak on windows? Do you have an issue? leorize: no, but from a lot of code snippets complaining about memory leaks with async, I noticed that none of the leaks happen on linux leorize: either it's a difference in how the gc release memory, or it's a difference between how asyncdispatch handle its memory leorize: I'm skeptical since I'm seeing GC_ref and GC_unref all over the place leorize: I'm looking for documentation regarding if IOCP still notify for operations completed on-the-spot dom96: async definitely leaked memory on linux leorize: if it doesn't then we're leaking a bunch, at least in asyncdispatch dom96: (I saw it with my own eyes :)) dom96: but yeah, that logic may be wrong. I vaguely recall getting crashes when doing gc_unref there and seeing some weird behaviour from IOCP disruptek: doesn't leak for me in the testament test. dom96: ^ That NimBot crash was likely due to a leak :) dom96: But I would guess it was fixed by now, I haven't recompiled it in too long leorize: at least one source said iocp would still notify for operations done immediately leorize: but the said source also say that it's configurable dom96: test it, write to a writeable socket or something Yardanico: lmaooo Yardanico: guess what error I got when I tried to run paramCount in js backend with -d:nodejs? Yardanico: "Error: Error: unhandled exception: paramCount is not implemented on Nintendo Switch [OSError]" Recruit_main707: Bruh Yardanico: well nim has a nintendo switch target, but it was unexpected seeing this error for JS backend Recruit_main707: They didn't even expect people trying so they didn't even make an error for that cases xD leorize: I made a PR error out at compile time leorize: to make it ^ timotheecour: > ** `var` semantics let it assumes that there can't be any `nil` pointer passed ⏎ ⏎ then why don’t we rename `not nil` to `var`? leorize: timotheecour: because it's not the same thing? leorize: you can do this `procThatTakeVar(nil[])` with var leorize: because by Nim logic it already errored out the moment you deref `nil` to pass into the var param leorize: so by definition, the `var` param will never take a `nil` pointer in Nim, which is why it can assume that shashlick: @Recruit_main707 - did the flatcc wrapper work out? Recruit_main707: Nope, I didn't try that much not gonna lie timotheecour: @leorize ya ok, that was a bad idea. shashlick: okay exelotl: mannn it's not possible to overload `with` from the standard library, is it... leorize: it should be possible? Recruit_main707: Also, I am giving another try to implementing flatbuffers in pure Nim, I have 3 possible solutions to my problem, wrapping those headers would be the easiest, but a bit ugly. exelotl: it takes untyped arguments, so if both `std/with` and my custom `with` are imported, I'll always get an error due to ambiguity leorize: make yours take typed :P Recruit_main707: shashlick: if I give up again and try to wrap the headers, I will let you know and we can give it a try if you have some time Yardanico: oh boy I managed to run my (early) Nim implementation of C implementation of Lox from craftinginterpreters Yardanico: with JS backend Yardanico: just needed to add around 40 JS-specific loc for stderr/stdout and reading input exelotl: leorize: oh, it does work if I avoid generics exelotl: Bad: template with*[T:SomeRegister](r: T, args: varargs[untyped]) exelotl: Good: template with*(r: SomeRegister, args: varargs[untyped]) exelotl: would there be a way to represent the concrete type of `r` in the body of the "Good" template? exelotl: since I can't use T Recruit_main707: Maybe something like: let T = r.typeof leorize: dom96: I'm not on windows atm leorize: I'm tempted to ask on stack overflow lol dom96: do it shashlick: @Recruit_main707: sounds good - it compiled for me on linux, i can try windows if that's what you are targeting leorize[m]: dom96: I think I solved it leorize[m]: > When a file handle is associated with a completion port, the status block passed in will not be updated until the packet is removed from the completion port. The only exception is if the original operation returns synchronously with an error. leorize[m]: from MS docs: https://docs.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports leorize[m]: it appear that it will notify again leorize[m]: unless an error occur, ofc leorize: just to be sure I'll have to test this again once I'm on windows leorize: implementing stuff on top of asyncdispatch is a PITA without any kind of docs whatsoever leorize: I'll see if I can document the low-level bits after I'm done with the project Yardanico: ngl this looks kinda cool :D https://i.imgur.com/uhsGYTB.png Yardanico: managed to use google closure compiler for Nim's JS output (for browser, GCC doesn't really support nodejs) Yardanico: GCC also said "0 error(s), 128 warning(s), 71.6% typed" leorize: not 100% typed? :P Yardanico: no :P Yardanico: I'm really suprised nim's js backend is that good dom96: I tried closure compiler on my game's JS once dom96: It broke the JS :P Yardanico: lol __ibrahim__: can nim be used as a purely functional language? leorize: @KingDarBoja: hmm, a question, do you ever throw the base error? leorize: __ibrahim__: no leorize: eventually you gotta do I/O and you can't do that "pure" KingDarBoja: Yes KingDarBoja: I will but haven't reached that module (execution) KingDarBoja: Still thinking about my approach, seems like shorter KingDarBoja: seems shorter* KingDarBoja: https://imgur.com/b8pXb5l the "messy" one but now I have changed my mind lol __ibrahim__: so can do everything pure func but I/O leorize: I'm not sure about that leorize: memory allocation is not really "pure" leorize: but most functional prog lang just assume that it is pure __ibrahim__: yes exelotl: @__ibrahim__ I guess you can use nim in a purely functional style if you really want to. See e.g. https://github.com/zevv/aoc2019/blob/master/08/main.nim __ibrahim__: thats very interesting thank you @exelotl exelotl: np :) it's not my cup of tea but it can be done haha __ibrahim__: not mine either, paradigms can-o-worms got me curious sealmove: disruptek: I worked on the official implementation (in Scala). So we don't have it in CT. You have to generate your parser using the official Kaitai Struct compiler with the argument `-t nim`. __ibrahim__: but i think as leorize said, it maybe not pure functional. __ibrahim__: https://min-lang.org Yardanico: yes Yardanico: there's also http://sprylang.se/ Yardanico: or https://github.com/liquid600pgm/rod but it's in relatively early state __ibrahim__: fascinating __ibrahim__: funny question: could you theortically make nim's keywords use another language? (russian, chinese, etc...) sealmove: theoretically? of course, why not? __ibrahim__: xD __ibrahim__: how bout in reality? sealmove: depends on what you are thinking sealmove: like a fork on the language? sealmove: or do it within it? __ibrahim__: like replace the keywords so that u can program it in a different language __ibrahim__: like translating nim from english to x __ibrahim__: same exact functionality, just different unicode characters __ibrahim__: إكو "hello world" __ibrahim__: xD sealmove: You would have to fork the language and change keywords. sealmove: They are no overridable __ibrahim__: that's coool __ibrahim__: thanks sealmove Skaruts: how to access the elements of a pointer array from C? (in my case a `ptr Color` retrieved by `GetImgeData()`, from Raylib) leorize[m]: cast it to ptr UncheckedArray[Color] Skaruts: seems to work Skaruts: but how do iterate it? KingDarBoja: leorize KingDarBoja: What is the reasoning behind exception not being `ref` but raise statement requires it lol leorize[m]: Skaruts: uhmm, you got the size, right? then iterate from 0 to size - 1 leorize[m]: @KingDarBoja: historical reason lol Skaruts: ah ok, I was thinking in terms of `for x in data` Skaruts: thanks Prestige: Elegant Beef: I was able to do this for masks: https://0x0.st/i1_p.txt Prestige: We convert TXEvent.xkey.state and the Mask with this function and compare them KingDarBoja: lol ok KingDarBoja: At the end, I stick to my first approach, easier IMO KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/error/syntax_error.nim and works 😄 KingDarBoja: I have to admit that not having a `super` call got me out of place disruptek: there's a super call. disruptek: https://nim-lang.github.io/Nim/system.html#procCall%2Cuntyped Elegant Beef: Yea i know Elegant Beef: I already use them prestige Prestige: I thought ealier you said you used a map for modifiers Elegant Beef Elegant Beef: For serializing/deserializing Elegant Beef: I have this function, albiet pretty silly Elegant Beef: https://hatebin.com/qfmoqheisd Elegant Beef: Which is getting key.keycode and key.state KingDarBoja: WHAT !?? KingDarBoja: Woah woah... I need some example with that procCall Elegant Beef: Has to be the worst url on a documentation site Elegant Beef: https://cdn.discordapp.com/attachments/371759389889003532/701603334511001671/unknown.png Prestige: ah I'm using a table instead of iterating over the bindings Elegant Beef Elegant Beef: I will probably do the same but i couldnt be arsed to find a nice hash and didnt want to use a string Elegant Beef: You also dont need to put my name at the end, im on discord that does fuck all 😛 KingDarBoja: https://nim-lang.org/docs/manual.html#multiminusmethods-inhibit-dynamic-method-resolution-via-proccall Prestige: Lol oh rip Elegant Beef: Sadly this bot doesnt even mention someone if you do @ followed by the persons name disruptek: huh? Mask: what is the best way to do this... for abstraction purposes? Mask: https://cdn.discordapp.com/attachments/371759389889003532/701604805705203862/unknown.png Mask: i tried `let sizeboard = 5` disruptek: const sizeboard Mask: ah Mask: thaks KingDarBoja: Mmmm no idea how to use it to be honest, the procCall disruptek: why do you think you want inheritance? disruptek: (usually, you don't) KingDarBoja: Well it is supposed to provide shared props between several inherited types from the base type KingDarBoja: And provide the same base logic for those KingDarBoja: That's why I needed the super call KingDarBoja: So my inherited type calls the newParentType proc and perform some setup, then use that for my inherited type setup disruptek: not a good reason, but if you want the complexity, it's there for you. KingDarBoja: Once again, making a 1:1 port probably is a complex approach but well, so far so good D: KingDarBoja: And tbf, I am used to OOP disruptek: sure, but you will have more success if you exploit nim's strengths rather than those of another language. KingDarBoja: What do you recommend when dealing with things like inheritance? Mask: how can i use operator overloading on `echo`? In python, `print` implicitly calls the parameter's `__str__` function. disruptek: in my experience, it adds needless complexity and subtle bugs. disruptek: echo implicitly applies $ to its arguments. KingDarBoja: declare some proc like -> proc `$` () Mask: awesome thanks again. Mask: very cool KingDarBoja: Oops, wait Mask: `$` Mask: i know Mask: ` KingDarBoja: Okay... darn formatting Mask: yeah lol disruptek: you can impl your own such feature with a varargs[someTypeDesired, someTransformingProc] disruptek: this is how echo is impl. Mask: hmmm Mask: okay i will look into that disruptek: you can also use converters, but they are a loaded gun to be wielded sparingly. Mask: gotcha lmariscal: @dom96 are you there? KingDarBoja: What are Nim's strengths (besides macros) ? KingDarBoja: Just to keep that in mind disruptek: king: basically, the advice is to try to use variant objects instead. with templates, macros, concepts... variant objects are likely the fastest and slickest solution. disruptek: a strength is that the language is large and powerful and fast. the stdlib doesn't always exploit this, but if the stdlib had what you wanted, you wouldn't be here. disruptek: so, you build a thing. it runs fast. when you are ready to optimize it, it will run like greased lightning. disruptek: make it work, make it correct, make it fast. KingDarBoja: That last stmt is true KingDarBoja: I am probably missing the make it correct and fast part disruptek: start with stdlib. make it work. everyone goes through a period of chafing against the language. it's normal. leorize: I'm hating windows so much now leorize: their piping system can only do synchronous i/o KingDarBoja: That's what I am doing... but not sure how large is the stdlib leorize: and it errors out if you close one end of the pipe :) Prestige: I'm surprised you use windows KingDarBoja: And don't get me wrong, I am taking notes of every advice KingDarBoja: Bro, I use Windows too 😛 leorize: not that I use windows, but my library has to support windows disruptek: leorize: i think you need ParentStreams. Prestige: ah leorize: nah, the well known "walkaround" is to create a randomly named named pipe leorize: and I hate that leorize: because it's named now I gotta worry about it's access control KingDarBoja: But disruptek advice to switch to object variant is giving me the energy to use it lol disruptek: i've been here a year. i'm not a good programmer, but you cannot help but to soak up a knowledge of the language's geography. traps and pitfalls as well as smooth routes. disruptek: leorize: did you try asynctools? disruptek: because it's probably what you want. leorize[m]: yes, but it doesn't have what I want disruptek: i don't believe it. leorize[m]: so I'm building one from scratch disruptek: bad news, good news, i guess. leorize[m]: well I need a piping system that can do both synchronous i/o and async i/o KingDarBoja: You speaking to me disrupt? leorize[m]: I'm making an alternative to osproc, it has to work properly and cover whatever osproc has leorize[m]: and I don't want to pull in deps because I don't trust nimble disruptek: king: not since i pinged leorize. KingDarBoja: lol ok 😄 disruptek: you will be fine; just stick to what works. KingDarBoja: Wise advice leorize[m]: also asyncpipes doesn't have the kind of api that I want :P KingDarBoja: I just tend to seek what's the best approach but you're right, better make it work first then optimize KingDarBoja: You can raise issues an all you want 😄 disruptek: it's good to know what's out there, but it's even better to know what works. leorize: Araq: how does `=destroy` attachment work? do I have to export my `=destroy`? KingDarBoja: Neither Python nor JS/TS deals with ptr or ref, that's a big game changer for me. disruptek: true. Mask: can i create a derivative type of int whose values must be within a certain range disruptek: range[4 .. 6] disruptek: eg. type Foo = range[4 .. 6] Elegant Beef: if that huh was to me a while ago disruptek, if an irc uses @Elegant Beef it doesnt ping me in discord Mask: wow Mask: that was easy Mask: i've tried nim before but this is refreshing disruptek: it's nice having all the answers; keep lobbing the easy pitches across the plate and i'll keep crushing them. disruptek: beef: use irc. Elegant Beef: None of the clients look good Elegant Beef: So no Elegant Beef: 😄 Mask: yeah i didn't have the discord server last time Mask: this is a big help Elegant Beef: Go make me a good looking irc client in nim disruptek, and ill consider it disruptek: enums are also a very strong type in nim. leorize: what do you consider good looking? Elegant Beef: I dont know something that's not an affront to my retinas disruptek: i thought about it but despite my heavy use, i don't really /need/ a better client. Prestige: how about weechat? disruptek: i might do it on stream; it's the sort of thing that people like to watch for some reason. Elegant Beef: Isnt weechat text only? Elegant Beef: TUI isnt very nice imo for something that has multimedia support disruptek: multimedia support isn't very nice imo for something that is text-only. Prestige: ^ Prestige: irc is text only isnt it? disruptek: yes. Elegant Beef: Well i mean images,and videos get shared disruptek: however, i wouldn't use text-mode in my client. Elegant Beef: Be it links or not, seems quite silly to constantly open links in a browser to just close the tab disruptek: that's how i browse. leorize: any web irc client would work for you then leorize: the lounge is the most powerful one, but requires hosting Elegant Beef: Also imgui for status bar is silly as hell but is working Elegant Beef: https://cdn.discordapp.com/attachments/371759389889003532/701613588191772682/unknown.png disruptek: why would i want that? disruptek: that dog has /seen some shit/ Elegant Beef: But with the imgui status bar my wm crashes Elegant Beef: Lol Elegant Beef: Can Xephyr emulate a multiple monitor setup? disruptek: i'm glad i gave bentley a run. he'd have been barking his head off if he were awake. Mask: can i implicitly cast this integer array to the polyomino array of `Direction`? Mask: Mask: https://cdn.discordapp.com/attachments/371759389889003532/701614285239091210/unknown.png KingDarBoja: How many dogs do you own dis? disruptek: use enums. Mask: okay disruptek: one dog is enough when you live in an rv. KingDarBoja: Hey Mask, use imgur to upload images 😄 KingDarBoja: rv? Mask: is it easier to see on gitter or smth? KingDarBoja: I have 4 dogs and 2 cats KingDarBoja: Images don't get into IRC I think Elegant Beef: I mean it sends the discord url AFAIK Elegant Beef: It sends the discord upload url, im 99% certain Mask: i'll just copy paste the code next time Mask: thanks for the tip i was wondering about that KingDarBoja: Nooo xD use the playground Elegant Beef: *that's even worse* disruptek: ~paste Mask: hmm why disbot: paste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead. -- disruptek KingDarBoja: 😄 Elegant Beef: Muliline messages on irc is cancer afaik Mask: lmao KingDarBoja: Don't worry bro, welcome 😄 KingDarBoja: And yeah, use enums as disrupt3k said disruptek: it's not a big deal. disruptek: 3 lines are fine, five starts to be excessive. Mask: how do i get a link from the nim playground Mask: to show code KingDarBoja: Anyone has used Elixir lang? Man, that's the top notch of Enumerables and pipes disruptek: there's a button. disruptek: Share to ix Elegant Beef: Any clues how i should debug my WM crashing on startup? Doesnt crash using xephyr but when using it as a proper wm it crashes Mask: i tried i get 502 error disruptek: gdb disruptek: maybe ix is misbehaving. KingDarBoja: https://play.nim-lang.org/#ix=25Cj disruptek: try again; it just worked for me. Elegant Beef: But how would i use GDB if i dont exactly have a way to attach it to the wm Mask: i think it's because i had nothing written in Mask: lmao disruptek: you run your wm from gdb. Prestige: you can attach the PID as well disruptek: enums can have ordinal and string values at the same time. disruptek: they can have holes (though it's generally a bad idea), you can easily type-convert them, iterate over their range, and they compose beautifully with sets and case statements. disruptek: case statements can consume sets and ranges as clause determinants. disruptek: ranges work great with enums, too, of course. leorize[m]: @Elegant Beef: https://srain.im/ Varriount: I really like sets in Nim. Sure, they are limited in what kinds of data types they can hold, but you usually get very good performance Mask: sets have no duplicates? disruptek: correct. Mask: how do you have efficient insertion disruptek: lots of lube. Mask: since you have to check every element to make sure no duplicates Mask: lol leorize: they are designed as bitsets disruptek: they aren't arrays underneath. Elegant Beef: In most cases they're hashmaps Mask: ah leorize: found you an IRC client @Beef disruptek: i don't think that's right. leorize: also Nim sets are not hash maps leorize: we have hashsets if you're into that disruptek: iirc, they are a series of integers. Elegant Beef: Hey i know nothing of this nim you speak, KingDarBoja: Oh god, found another bug due to Python using None for string variable KingDarBoja: x.x Mask: back to the enum thing. You are saying to use an enum instead of the range[0..4] type? KingDarBoja: Yeah KingDarBoja: https://nim-lang.org/docs/tut1.html#advanced-types-enumerations Mask: does that have any bonus features besides just being more standard? Elegant Beef: Never ever use magic unnamed numbers KingDarBoja: I feel like you want that disruptek: yes; i just listed the bonus features. Mask: oh Mask: oh i see KingDarBoja: It's basically what you wanted Mask lol Mask: the ordinal types things Mask: yeah but that wasn't really my issue Mask: this is good i will use enums instead disruptek: they are what you want. disruptek: lightweight typed ordinals. Mask: but i mean how do i cast the array of `[0, 0, 1]` into the polyomino thing.. Will it do that? disruptek: lemme find the code. KingDarBoja: the ord proc can convert it to its underlying integer value. KingDarBoja: So `South.ord` yields its integer Mask: is there a way to do those things and still use numbers instead of words for the directions? disruptek: that code should work fine. Mask: i don't see anything is it going through disruptek: numbers are accepted if they are valid for the type. Elegant Beef: Why would you want to use numbers?! disruptek: a /cast/ is a separate thing from mere assignment in nim. disruptek: a cast is you saying, "look, just copy the value without regard to type" disruptek: generally, you won't use a cast. Elegant Beef: ~~Unless you use glfw + xlib and have to convert a raw pointer to a TWindow~~ 😄 KingDarBoja: @Mask Can you share the code? disruptek: bbiab, i wanna see if this hardware works. Mask: yeah i'm reading the anum thing to try to understand what you guys are talking about Mask: one moment Mask: https://play.nim-lang.org/#ix=2iKU Mask: https://play.nim-lang.org/#ix=2iKV Mask: i realized the int thing was wrong mb KingDarBoja: Gotcha KingDarBoja: https://play.nim-lang.org/#ix=2iKV Mask: don't you have to share again? Mask: it hasn't changed for me speckledlemon: Is there really no better way to represent a sum type than this? https://pastebin.com/raw/mE4fujx9 leorize: use discard for that branch if you don't need it leorize: also we have Option[T] KingDarBoja: Oh crap speckledlemon: I had been trying `discard ""`, didn't know you could have bare discard, thanks KingDarBoja: https://play.nim-lang.org/#ix=2gcb speckledlemon: I'm not sure yet if Option makes sense, it might, it might not leorize: !repo nim-result leorize: disbot? Mask: isn't it tilda Mask: ~repo nim-result leorize: for commands it's `!` Mask: ah leorize: disruptek probably broke the bot again Mask: amh Mask: s* Mask: so can i do this implicit casting thing? Mask: or if it's not called casting then something else skrylar[m]: hmm someone sending me patches for 1.2... guess its time to do the rounds and see what broke this time speckledlemon: ah screw it, option is a better solution for now, good call leorize: there's also the nim-result package if you ever need something more complex leorize: I think in nimble it's called results speckledlemon: found it https://nimble.directory/pkg/result KingDarBoja: It is possible that string can be nuil? KingDarBoja: Nil* I know it could be done if using ref (for types for example) leorize: nope leorize: use Option[T] :P KingDarBoja: fffffff Mask: could i override nnkBracket to accomplish this? leorize: what are you trying to do? Mask: make an array of integers construct an array of range[0..4] KingDarBoja: Who? leorize: @Mask: `let arr = [0.Type, 1, 3, 2]` leorize: specify the type for the first element, and everything after will follow suit Mask: i don't think that's exactly what i'm looking for Mask: https://play.nim-lang.org/#ix=2iL7 leorize: why would you wanna do this? Mask: so i can create the polyominoes easier Mask: it just looks nicer leorize: you already gave them a name leorize: you can just use the enum names leorize: if you don't wanna use them then why do you even use enums? Mask: if i use for example `[n, n, e]` instead the code still won't work Mask: `Error: type mismatch: got but expected 'Polyomino[system.int]'` leorize[m]: https://play.nim-lang.org/#ix=2iLa leorize[m]: the static int part is a bit of a gotcha, but you used the `array` part wrong :P Mask: oh so i was declaring the array wrong to begin with? leorize[m]: yea, arrays are `array[Idx, T]` Mask: i thought that's what i was doing? leorize[m]: you did it the other way around :P Mask: bruh Mask: i knew that it was just a dumb dumb mistake Mask: lol Mask: i even wrote it correctly elsewhere in the code Mask: thanks leorize[m]: np leorize: disbot: alive? leorize: ~arc disbot: arc: 11a new memory manager for Nim; see https://forum.nim-lang.org/t/5734 leorize: nice disruptek: i should really move the bot offsite. leorize: maybe you can ask dom96 for a spot on Nim's server? disruptek: i have servers. disruptek: it's just that the bot also throws my notifications and stuff. leorize: why does everyone have a server or two disruptek: so it's convenient to have just one bot local, etc. disruptek: anyone can have a server; just pay a few bucks to amazon or w/e. disruptek: i think a nano is like $45 for 3y. disruptek: that's what i paid, anyway. disruptek: i used to have lots of bigger boxen but i've moved everything to lambda. i only use servers for vpc'ing compiled code into neptune or w/e. skrylar[m]: i used to have one for a site until i couldn't afford it anymore Chiqqum_Ngbata: So maybe nimble doesn't have a post-install hook of some kind ? skrylar[m]: theres also places that rent pis/arm so the cost of microservers is really going down disruptek: hmm i cannot build version-1-0 with 0.20.0 because pure/collections/setimpl.nim(41, 24) Error: undeclared identifier: 'isFilledAndValid' Mask: https://play.nim-lang.org/#ix=2iLn Mask: https://forum.nim-lang.org/t/703 Mask: can someone help me understand this template posted here? Mask: what does the star in `new*` do? Mask: is that like regex or something? Mask: i couldn't find anything in the manual or anything Mask: and also the difference between the two he has posted disruptek: it's pointless afaict. Mask: the star? disruptek: the template. Mask: right Mask: i got that but what is the point of the star disruptek: the star exports the symbol. disruptek: a la oberon. Mask: i'm confused Mask: what does export mean in this context. and what symbol? disruptek: else it will be invisible outside the module. Mask: oh right disruptek: new is a symbol. Mask: i read that somewhere disruptek: an identifier. Mask: what is expr Mask: is that like `untyped`? disruptek: an expression, yes. disruptek: untyped literally has no type. disruptek: could be anything. disruptek: or nothing. Mask: i thought it was just text Mask: basically disruptek: could be a block of code. disruptek: well, i shouldn't say it could be nothing. disruptek: i wouldn't put much stock in forum posts from 2015. disruptek: the language has changed a lot since then. disruptek: expr is deprecated afaik, for example. disruptek: anyway... i feel like we should be able to bootstrap 1.0. nisstyre: I actually find a lot of old results on google and it's annoying nisstyre: even the date filtering thing on google doesn't work reliably sometimes disruptek: i don't read the forum. 🤷 UNIcodeX: Duckduckgo !date Varriount: disruptek: typed/untyped was such an improvement over expr/stmt. So much easier to understand KingDarBoja: How can I simulate passing arguments like Python partial? I know we dealt with this before but forgot the part of passing another param KingDarBoja: I had this -> "let partialValueLiteral = proc(self: Parser): ValueNode = parseValueLiteral(self, false)" KingDarBoja: But should provide the bool on the proc argument leorize: wdym? KingDarBoja: The idea is calling the function inside another function KingDarBoja: You know that Python Partial let's you pass an argument to the function without evaluating leorize: I still don't understand :P need examples KingDarBoja: From leorize: _looks like you're having trouble separating functions call and functions as a value_ KingDarBoja: https://imgur.com/RiDpF3Q a refresher KingDarBoja: I remember when we tackled this but forgot the other param until I made a test right now KingDarBoja: The idea was (still is) pass a proc as argument to another proc BUT only call it on the body of second proc KingDarBoja: The idea works if there is no other param besides `self: MyType` KingDarBoja: But doesn't seems to work if I try to pass an argument to the proc (being passed as argument to the second proc) 🤔 Varriount: @KingDarBoja Their are two ways. The fastest is to create a closure function, the most efficient is to create a callable type containing the parameters required Varriount: *fastest as in fastest to write KingDarBoja: The callable sounds like what we did that day KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/parser.nim#L143 KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/parser.nim#L723 Used here KingDarBoja: But `isConst` param isn't being passed KingDarBoja: Which should be... Varriount: In pseudocode: `proc wrapFoo(a, b): auto { return proc(): auto { return foo(a, b) } }` Varriount: With that method, the compiler creates the data structure required to hold the parameters captured by the inner procedure, and passes it along with a pointer to the inner procedure behind the scenes. KingDarBoja: 🤔 KingDarBoja: Ok, I declared that KingDarBoja: Then in order to pass it to the other proc as param, just use `outerProc(param1: int, param2: wrapFoo(), ...)`? Varriount: https://play.nim-lang.org/#ix=2iLL KingDarBoja: Checking right now Varriount: That is a brief snippet which shows (generally) what the compiler translates closures to. Varriount: Note that is an estimation. It gets a lot more intricate when you have scenarios involving closures that share the same parent scope. KingDarBoja: Mate, thanks, solved the issue by looking at your sample KingDarBoja: 😄 😄 KingDarBoja: I almost got the same, but was missing the correct types on the second Proc KingDarBoja: I will keep that example somewhere on my project KingDarBoja: Quick question, what does auto do? InventorMatt: according to the nim manual "The auto type can only be used for return types and parameters. For return types it causes the compiler to infer the type from the routine body:" Prestige: nim-lang.org down atm? Rika: yes KingDarBoja: Thank you Rika: oh. no Rika: its not down Prestige: seems to be spotty Rika: loads just fine for me, switch dns to either googles or cloudflares Mask: how do i test if a number is within a certain range and return a boolean leorize: num in a..b Mask: oh okay i was close Mask: num in range[a..b] Rika: range[] is a type Prestige: Having a strange issue using a table declared in another file, can anyone take a quick look? https://0x0.st/i19-.png Prestige: same code outside of the file doesn't work as the same code inside the file (where the table is declared) Rika: you didnt import tables Rika: prestige ^ Prestige: oh I need to also import tables from this file, that makes sense. Thanks Rika Rika: classic "forgot that procs arent bound to type" 😛 Varriount: @Rika I like your avatar Rika: thanks skrylar[m]: i ended up just not using tables and wrote my own hashmap ._. Araq: skrylar[m], why? skrylar[m]: well mine exports the hash function, so you set if you need a security or a speed hash skrylar[m]: i haven't crosstested against stdlib yet https://git.sr.ht/~skrylar/skmap skrylar[m]: although right now it just uses blakes which is overkill because i haven't fixed spooky or finished the xxhash port :/ Milerius: nimsh died few hours ago Milerius: the installer for linux Milerius: ./init.sh Milerius: curl: (22) The requested URL returned error: 522 Milerius: choosenim-init: Downloading choosenim-_linux_amd64 Milerius: curl: (22) The requested URL returned error: 404 Not Found Araq: skrylar[m], ok well. at least in Nim you can write your own hash tables ;-) skrylar[m]: i feel like you are saying something about javascript here skrylar[m]: beans are for drinking not scripting :leers: skrylar[m]: on an unrelated note my poking at the haxe toolchains from the other day lead me on to this gem https://github.com/mapbox/earcut and i see nimble does not list an earcut package. :ponders: livcd: is nto nimforum today a bit slow? livcd: https://forum.nim-lang.org/t/6236 this took my to open like 6s Araq: livcd, it's slow for me too Benumbed: I gotta say, I don't have many gripes with Nim at all, but needing to import something like 'tables' in a module when I'm importing another module that imports it, is not a happy Benumbed: The compiler errors if I don't also tend to slow me down and give me pause when it happens. I end up in "What the hell are you talking about?" territory when the proc signatures don't have the expected type (but that is also how I end up remembering to import the other module) skrylar[m]: isn't that only true if you want to interact with the table directly Benumbed: It's true in cases where I have a type defined in the other file using a table, then want to assign to that type Benumbed: That's really the big bit that throws me skrylar[m]: i *have* gotten bit by it saying there was no `[]=` alternative because i didn't import the robin hash module along with the object using a robin hash, which was a bit derpy... you can export the module explicitly but i dunno Benumbed: So `type MethodMap* = Table[uint16, DispatchMethod]` in one module, and the other one imports that module and does `var channelMethodMap* = MethodMap() Benumbed: channelMethodMap[11] = channelOpenOk` Benumbed: and that will throw weird compiler errors unless you import tables Araq: Benumbed: I agree but don't have a good solution Araq: the module can do 'export tables' though Benumbed: Okay, I'll stop bitching then 😄 Araq: IMO it's caused by Nim's childish "let's not attach procs to types" stance skrylar[m]: but i like that part of nim :eyes: Araq: skrylar[m], I know and it's currently very fashionable Benumbed: I'm not entirely certain if that's humor or not, given you're the Father of Nim haha Araq: language design is fashion driven skrylar[m]: well, since c# and haxe got extension methods and extension methods aren't uncommon it sort of implies types owning their procs is warm and bad skrylar[m]: hell none of the original OOPs even did that, it was some dumbo bolted on by java skrylar[m]: to make vtables easier i guess Benumbed: I'm just used to C/C++ where #include brings the world in from the other file Araq: a hash table is an "abstract data type" and ADTs have little to do with OOP, in fact they are opposites Araq: there is an excellent paper about this from Cook iirc Benumbed: TBH I don't even mind needing to import, I think better compiler errors would suffice Araq: fair enough Recruit_main707: imho it would be nicer not needing to though Benumbed: If I can improve my experience with the core, that's something I'd like to contribute to, clearer compiler errors Benumbed: Although that may be a maze of twisty passages I'm talking about getting myself into 😄 skrylar[m]: well. all i'm saying is types owning their procs don't really show up in the classical literature. and 'even' the classical OOPs you didn't even own it, since CLOS you define methods that belong to no-one and objects simply provide implementations for those, and in smalltalk you can bolt any new receiver to any object, i'm not entirely sure if haskell and ocaml even do it, but i haven't used the last two in a long while Araq: https://www.cs.utexas.edu/users/wcook/papers/OOPvsADT/CookOOPvsADT90.pdf this is it. skrylar[m]: could just use a factory method to get around importing table to construct it, but you still need the import to get access to `[]` and `[]=` Araq: well just because we attach procs to types doesn't mean we cannot just leave the Nim syntax as it is Araq: it would solve quite some problems of Nim's design, I suppose I should write an RFC... Araq: for example, it would solve the common gotcha of "gah, I used system.$ instead of the custom $ by accident" skrylar[m]: i'll be verily surprised when i see a time you aren't tripping over your own creation trying to undo it Recruit_main707: its not undoing, its maturing i guess Araq: skrylar[m], I call it "progress" Prestige: How do I import modules relative to another in a directory hierarchy? Gary M: Hey Araq Gary M: https://i.imgur.com/kFACdMq.png Gary M: all of these are functionally the same but syntax highlighting it consistently seems impossible... Prestige: I have two sibling directories with a module in each, and I'm trying to import one into the other Benumbed: Prestige: Same way you'd ref it on the command line '..// inv2004: is it possible to make enum ord-number to byte ? mratsim: yes enum less than 255 are represented as byte in the backend mratsim: @skrylar, why is this patentable? this seems like mp3 or AAC which are prior art inv2004: A bit confused: the first field after case kind has not the same offset like in plain structure inv2004: object m: cchar, a: cchar, case kind of kT: tu: cchar . Without kind tu offset is 3, with kind tu offset is 8 PMunch: inv2004, because the kind needs space, and because of alignment inv2004: PMunch, I have kind like byte in plain structure PMunch: What do you mean? inv2004: I mean - that it uses some space in plain structure, the question is about alignment only or size of enum inv2004: so, anyway is a bit unclear why there are not aligned the same way PMunch: Does this make any of it clearer? https://play.nim-lang.org/#ix=2iNY inv2004: PMunch, No, I mean it is clear that offset is not the same, but why PMunch: So in the first example you can see everything alignment as you expect. Adding a simple enum with two fields (Nim is able to detect that this could be stored in a single byte) you end up with the two branches sharing the same memory, and the kind taking one byte. Defining that the kind is 4 bytes leads to it triggering alignment (to speed up the reading of the field, CPU/memory performance reasons) so that enum is now aligned in the struct, PMunch: otherwise nothing changed. PMunch: What offset do you expect to be the same? PMunch: Obj1.offsetOf(c) and Obj2.offsetOf(c), or Obj2.offsetOf(kind) and Obj3.offsetOf(kind)? inv2004: PMunch, https://play.nim-lang.org/#ix=2iO3 inv2004: I did not know about size inv2004: but if I remove it is still correct PMunch: Yes PMunch: Because it only has two values, so it fits in a byte mratsim: Nim uses the same alignment as C mratsim: if you want packed fields use the {.packed.} pragma but unaligned loads are slower and might not work at all on some architectures PMunch: So if your enum takes more than one byte to store (either because it has too many fields, or some fields have specified values: https://play.nim-lang.org/#ix=2iO6 mratsim: and if you work with the raw byte representation of a type for serialization for example, use "offsetOf" to get the field position inv2004: In your example everything is fine, let me try to copy my code PMunch: Huh, why does Obj3 grow to 6 bytes? https://play.nim-lang.org/#ix=2iO6 PMunch: c and d should share memory.. inv2004: because looks like 255 is too much clyybber: Araq: I rebased https://github.com/nim-lang/Nim/pull/12220, should I remove the style changes too (they rely on typeof(typedesc) being a noop and they only look more ugly? disbot: ➥ allow generic typedesc field access ; snippet at 12https://play.nim-lang.org/#ix=2iO7 Araq: you need to remove them so that we see the old variant still works inv2004: PMunch, https://play.nim-lang.org/#ix=2iO9 sorry, full structure is a bit bigger, I tried to remove a lot inv2004: anyway you can see that tu and u are not the same offset, which I expected Araq: btw there is network outage which is why the forum is slow PMunch: inv2004, ah, that is because the other fields in the struct force alignment PMunch: The `l` wants to be aligned, and so it forces alignment of the entire memory region PMunch: You can around this if you add {.packed.} to your object PMunch: But keep in mind that `l` will now be unaligned and cause reading to be slower inv2004: PMunch, ah, I just put something to the l, because I have not converted the type yet :) inv2004: can I dismiss any fields for variant ? PMunch: What do you mean? inv2004: I want just remove l:int and make kList ampty inv2004: empty PMunch: Ah, use `discard` PMunch: So `of kList: discard` PMunch: Those other integers in the struct will likely force alignment still though PMunch: Hmm, they would already be aligned though since you have four bytes ahead of them clyybber: Araq: Done inv2004: I discarded l, but still not aligned :( clyybber: @mratsim https://github.com/nim-lang/Nim/issues/14021#issuecomment-616516089 `Tensor` is not the same as `Tensor[int]`? disbot: ➥ `sameType` magic doesn't work for seq (and generics?) ; snippet at 12https://play.nim-lang.org/#ix=2iOf inv2004: PMunch, https://play.nim-lang.org/#ix=2iOh inv2004: How do you detect which field cause the misalign ? Araq: clyybber: merge it once it's green clyybber: K clyybber: Araq: Btw, does https://github.com/nim-lang/Nim/pull/14028/commits/e8759c44ea65d34c96f205edb8194ac1cfc6c181 mean that we can't catch segfaults anymore? disbot: ➥ refactor system.$ for objects a little; refs #13398 Araq: the segfaults module keeps existing clyybber: Ok, nice Araq: --nilchecks:on was something else clyybber: @arnetheduck What should be fixed in segfaults.nim ? arnetheduck: @clyybber uh well, I don't know where to start even 😉 I mean, what's the objective of `segfaults.nim`? why would you want to use it? clyybber: to catch segfaults obviously; Yeah its a bad idea generally, but its still interesting clyybber: to catch segfaults obviously :p ; Yeah its a bad idea generally, but its still interesting arnetheduck: well, `nilchecks` takes a behaviour and defines it, ostensibly: if you deref a pointer, you can hopefully handle it and the compiler can ensure it works by inserting `if not nil` checks or statically analyze the code mratsim: @clyybber, no because I want to handle Tensor[bool] specifically and have a fallback for Tensor and then for the rest arnetheduck: raising from inside a segfault handler? you're taking undefined behaviour and use undefined behaviour (raising, allocating and a whole bunch of things that you're not supposed to do in a signal handler) to define it? clyybber: @mratsim You should use `is` then and check via sameType for Tensor[bool] specifically mratsim: that's what i'm doing mratsim: and that's what I said in my first message, currently the solution is to delegate the type processing to "runtime" and `when is` instead of trying to work with types in macros arnetheduck: ie `nilchecks` has a chance of being well-defined and therefore a tool that you can rely on - `segfaults`? not so mratsim: look at this beautiful type handling that I have to do since I can't do it in macros: https://github.com/mratsim/Arraymancer/pull/434/commits/46d32d98740d5adc3a9092ff2ad4510c1d0e6444#diff-0a37ef587fec15ad8eb65962b6f01f88R253 disbot: ➥ Implement Numpy fancy indexing clyybber: @mratsim I'm referring to your last reply in the issue, you are using sameType there to check `Tensor` against `Tensor[int]`, and I'd argue it should return false like it does mratsim: `is` returns true mratsim: i.e. for the canonical type comparator this should be true clyybber: is returns true, but sameType is intuitively true when a is b and b is a mratsim: then I need a `is` that works on NimNode PMunch: inv2004, that is a bit strange indeed. It seems like in isn't able to detect that the kind+tu would mean that tr is aligned and thus aligns the whole thing to the next border Chiqqum_Ngbata: `when FancyType is (array or seq):` Chiqqum_Ngbata: *presses record button on forehead* PMunch: Probably nothing you can do about that though, you might need to use {.packed.} to force it and then just manually verify that it isn't out of alignment (or by some compile-time assert checking) Araq: arnetheduck: I know you don't care but the customer is always right and I was paid to write segfaults. it's also useful during code reviews. if the code contains 'import segfaults' you can fire the person who used it :-) mratsim: "The customer is always right", looks at RFC/feature rebuttal ... --> doesn't compile 😉 arnetheduck: well, we're not using it 🙂 it breaks core dumps, and I get no valuable feature in return - I'm a bit sad at seeing `nilchecks` go away though - like I wrote, the compiler _could_ generate the code necessary to allow me to catch nil dereferences at runtime Araq: I want nil checking at compile-time Araq: the run-time mechanisms all suck mratsim: btw where is the DrNim repo? arnetheduck: so do I, but not all cases can be resolved at compile time, so I'll settle for runtime and defined behaviour clyybber: @mratsim DrNim is inside the nim repo afaik Araq: mratsim: it currently lives in the Nim repo as a separate tool, it requires a compiler API extension mratsim: looking, looksgood mratsim: so it's a DLL that can be added to the compiler? Araq: mratsim: the build is simply 'koch drnim', works for all OSes I tried Araq: hmmm with the new exception handling impl we could actually turn signals into exceptions clyybber: \o/ clyybber: Araq: Phi nodes, do they help with reassignments? Araq: clyybber: it's standard SSA Araq: the only difference is that I don't store it in the AST nor in an IR but compute it on-the-fly for the static analyser Araq: but the next step is to intergrate it into our CI and use it for the nim compiler clyybber: Cool, I like the on-the-fly approach, and were just read phi node somewhere and figured you had plans to bake it into the ast clyybber: The current approach is really nice IMO Araq: the way I do the "versionization" of variables is still wrong Gary M: it doesn't mean all that much, but I made the Nim extension go from over 300 files and over 1mb to 14 files and 218kb by properly packing the js 😄 Gary M: it doesn't mean all that much, but I made the VS Code Nim extension go from over 300 files and over 1mb to 14 files and 218kb by properly packing the js 😄 Gary M: sorry for the edit oops clyybber: Oh, btw did you try nimlsp? Gary M: no Gary M: microsoft's lsp doesn't support syntax highlighting Gary M: I ended up rewriting the syntax highlighting for the extension anyways. Gary M: A lot of things are now uncolored but it's more idiomatic, I think PMunch: There is an unofficial extension to LSP that offers this. So I'm looking into implementing that in nimlsp clyybber: \o/ Gary M: https://i.imgur.com/644FlKJ.png Gary M: it's not public yet but it should be soon clyybber: nice! Gary M: https://i.imgur.com/tBD5tKh.png Chiqqum_Ngbata: Link to VS Code Nim extension? Gary M: the original or mine? Chiqqum_Ngbata: Damn there's a lot it looks like Chiqqum_Ngbata: Yours Gary M: I said it's not public yet. Gary M: I'm making sure it's not all borked before publishing Gary M: @Chiqqum_Ngbata ok I published it but the browser page is currently a 404 😄 Gary M: but you might be able to find it searching Nim or Nim alt Gary M: if not, it's probably just going to take time to verify the package Gary M: https://marketplace.visualstudio.com/items?itemName=garym.nim-alt looks like it's here Araq: oh sorry I was wrong, Clyybber. the way I do PHI nodes is entirely different because ordinary PHI nodes lose information gogolxdong: @livcd, haha , nimx again mratsim: now we just need a LLVM IR mapping and we can generate code on GPU Araq: nlvm is that IR mapping you're talking about bung87: how to pass `ENABLE_STRICT_OBJC_MSGSEND` flag, I googled someone using it in xcode build config, dont know how to pass it during nim build Araq: --passC:-DENABLE_STRICT_OBJC_MSGSEND bung87: `--passC="-DENABLE_STRICT_OBJC_MSGSEND=0"` I can see it in result command bung87: but it still static type check msg send Recruit_main707: @Gary M why is self highlighted in your plug in? Gary M: What? bung87: I found the solution. Recruit_main707: Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/701799480445370460/unknown.png Gary M: Give me a sec to take a look Gary M: As noted colors are going to be different from the other plugin Gary M: But I'll look into that Recruit_main707: also, the * symbol to determine a function is public is not being highlighted, i dont know if thats not done yet Gary M: That's not done at the moment. Recruit_main707: ok Recruit_main707: the theme is dark+ (i think it comes installed) Gary M: I need to do some extra regex magic Gary M: Dark+ isn't very good. Gary M: Most themed will give you an extra color or two is any given file over the pre-installed themes Gary M: Most custom themes* Recruit_main707: another big issue ive found, do you have a github for this so that i dont fill the channel? Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/701800966789398538/unknown.png Gary M: DM me Recruit_main707: ok, i will clyybber: lol, my github dark theme triggers when searching for github on duckduckgo gogolxdong: nimx requires Android Studio as far as I know, I remembered someone said he can pack android apk in Nim without Android Studio. gogolxdong: generate apk zacharycarter: yeah you can zacharycarter: but you still need the android NDK zacharycarter: and cross compilation toolset zacharycarter: which the NDK includes zacharycarter: https://github.com/fragworks/frag-android zacharycarter: might help zacharycarter: there's also this - https://forum.nim-lang.org/t/4840 shashlick: @Recruit_main707: did you see my comments on the nimterop group? Gary M: ok so my alternate Nim extension for VS code is up so if anyone wants to bug test it go ahead and install it and shoot me some DM's where your syntax coloring isn't what you expect 😄 I haven't covered everything, yet. Gary M: and araq or someone is going to have to explain what the problem is with nimsuggest apparently opening more than one instance bung87: ```code paste, see link``` ⏎ ⏎ what am I missing when I using thread runs a webview? [https://gitter.im/nim-lang/Nim?at=5e9db8dfd240da24338a0fee] EdgyNerd: I wanna create a simple compiler in Nim, is there a good library for that? mratsim: Do you want it to work at compile-time or runtime? EdgyNerd: compile-time probably mratsim: I'm certainly not a compiler dev but I have a proof-of-concept of a compiler implemented as macros for an embedded DSL here: https://github.com/numforge/laser/tree/master/laser/lux_compiler mratsim: and various experiments that gradually led me to that here: https://github.com/mratsim/compute-graph-optim mratsim: if using an embedded DSL, you can skip all the lexing/scanning/tokenizing/parsing and just let Nim macros do it. mratsim: you only need to work on the AST. zacharycarter: question - I want to be able to mutate a pointer inside of a procedure but `var pointer` seems wrong... Also, I'm unable to pass `nil` to a proc with a `var pointer` parameter - any ideas? mratsim: This may also be seen as a compiler. It takes a state machine in a declarative syntax and produces the code: https://github.com/mratsim/Synthesis mratsim: I suggest you use `var ptr T` mratsim: "pointer" is problematic because it gets implicitly converted and upon conversion it misses the "mutable"/var tag mratsim: I've had that issue when implementing channels in Weave zacharycarter: gotcha, I'll do that thanks mratsim! mratsim: otherwise you can use ptr pointer or use cast[var pointer](p.addr), there are ways around that be just be aware of the implicit conversion zacharycarter: makes sense disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: i need a recommendation for a zoom replacement. disruptek: 3 party video chat. matrixbot: `Zoom` Jitsi? disruptek: jitsi? disruptek: looks promisin. disruptek: thanks. disruptek: have you used it? disruptek: this has to be used by old people. zacharycarter: we just tried Jitsi lol because zoom was so laggy today and Jitsi noworki disruptek: ugh. matrixbot: `Zoom` It had some issues with FF so I had to use ungoogled chromium for it. Worked fine. Hope they'll make it work with Firefox Recruit_main707: shashlick: right now, thank you, i will have a look at it when i can zacharycarter: I was using the native app shashlick: okay no problem brentp: this: https://github.com/brentp/somalier/blob/master/somalier.nimble#L5-L10 used to work, but doesn't seem to any longer, apparently due to order in which files are sent to the .nimble install location (?). Is there a reliable way to get the version in a .nimble file without copying it? mratsim: I've noticed that nimble used to use this trick and removed it recently brentp: exactly. that's where i originally copied it from and also noticed it is now gone. zacharycarter: I want to create an object pool with 16 bit alignment - should I just use alloc / dealloc and pointer arithetic? or is there a better way? zacharycarter: I can specify a capacity for the pool at runtime zacharycarter: and ideally the pool is growable mratsim: use the {.align 16.} pragma mratsim: example on my static preallocated pool: https://github.com/mratsim/weave/blob/master/weave/memory/persistacks.nim#L15-L51 zacharycarter: thanks Gary M: Gpu stuff? mratsim: and my growable pool: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim#L133 zacharycarter: perfect mratsim: in my case the pool design is somewhat complexified by the need to make them thread-safe zacharycarter: thanks mratsim mratsim: well "complex", because the only multithreaded part is things that use remoteFree: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim#L115 mratsim: you also have an example of using LLVM/GCC Asan (Address Sanitizer) to make sure you don't introduce memory bugs mratsim: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim#L174-L182 with the wrapper proc here: https://github.com/mratsim/weave/blob/master/weave/instrumentation/sanitizers.nim#L11-L37 zacharycarter: ah cool - I'm just compiling my entire program with those compiler / linker flags mratsim: the design is here: https://github.com/mratsim/weave/tree/master/weave/memory#how-does-that-work zacharycarter: but that is nice - I'll use that mratsim: one thing of interest to you is that the pool has a "heartbeat" and can trigger heavy/maintenance after a deterministic amount of allocation mratsim: so to deal with trillions of tasks allocated in a couple of milliseconds I have a second layer of caching on top of the memory pool, and regularly it calls a heavy maintenance proc to release some of the cached memory to the pool if needed: https://github.com/mratsim/weave/blob/master/weave/memory/lookaside_lists.nim#L101-L102 mratsim: (I'm supposing you need that for a game engine that needs to deal with particles for example) mratsim: the field is called "hook": https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim#L153-L162 zacharycarter: niceee zacharycarter: right now I'm implementing a job system similar to the one described in naughty dog's slidedeck using fibers as job contexts zacharycarter: but I should just see if the fix for --gc:arc that worked to allow me to use threads also works with weave mratsim: I yes I saw that one shashlick: brentp: you might be able to get around that nimble issue with a nim.cfg and a --path: mratsim: mmmh having Weave more optimized for games shouldn't be too hard, I've outlined what would be needed here: https://github.com/mratsim/weave/issues/88 disbot: ➥ Latency-optimized / job priorities / soft real-time parallel scheduling mratsim: also if you look there: https://github.com/numforge/laser/blob/master/research/runtime_threads_tasks_allocation_NUMA.md I've linked to 2 implementations of Naughty Dogs fibers - https://github.com/RichieSams/FiberTaskingLib, https://github.com/SergeyMakeev/TaskScheduler mratsim: I suggest you also look into Intel task scheduler for games: https://github.com/GameTechDev/GTS-GamesTaskScheduler zacharycarter: thanks for the protips zacharycarter: btw mratsim: weave seems to work with `--exceptions:setjmp` with `--gc:arc` mratsim: if you can comment in the Weave issue about what you care about in games that would help me as well zacharycarter: sure mratsim: Weave used to work with arc for all the benchmarks/test suite, the main unknown is Nim seq/strings mratsim: 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 edge: exit Yardanico: lol treeform: What is the state of GC arc now? Does it support async stuff? disruptek: yes, but not without leaks. Yardanico: you can *run* async with it, but it'll leak because async has cycles :) Yardanico: or something like that Recruit_main707: therefore, not production ready we will call it disruptek: don't count on it working with this async impl. Recruit_main707: wdym? async wont work in a close future with arc? disruptek: not in its current form, no. Yardanico: 4raq himself said so, disruptek is right Yardanico: we'll probably need another async impl or really rework this one (which will mean basically the same) :P disruptek: arc is the much more valuable property in nim. treeform: how well does gc arc work with threads? disruptek: better than gc:ref afaik. disruptek: and improving, still. Yardanico: @treeform you can access GC'd global data from threads :) but it's still not perfect, there are some regressions over refc Yardanico: like https://github.com/nim-lang/Nim/issues/13935 disbot: ➥ SIGSEV encountered when creating threads in a loop w/ --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2ioe leorize[m]: #13201 is merged! disbot: https://github.com/nim-lang/Nim/pull/13201 -- 6Make file descriptors from stdlib non-inheritable by default Araq: fwiw I'm continuing my work on the cycle collector leorize: orc? Araq: yeah disruptek: Araq: why can't we use the TInstantiation seq to figure out when new generic type instances are created? leorize: thinout didn't work out? disruptek: thinout works. disruptek: it's just not automagic. disruptek: people hate that. Araq: well currently both thinout and orc have the same underlying bugs Araq: so it doesn't really matter what I work on, the bugs must be fixed leorize: orc can have a flag like -d:printCycles to tell us where to put thinout() :P Araq: hmm Araq: maybe, it's a new idea, congrats disruptek: maybe i should have started here. Faulander: hi guys Yardanico: hello disruptek: or maybe that was a response to leorize. Faulander: I have a quick question: i am trying to convert the content of a header to a string, i get it like this var tmpCookie = response.headers["set-cookie"], its of type HttpHeaderValues or something. How to i get the values? leorize: run a for loop on response.headers Araq: there is also a converter to string or something Faulander: i know that its set-cookie, i just need the value :) Yardanico: @Faulander .headers is not a string, it's a sequence by the way Faulander: var tmpCookie = response.headers["set-cookie"] Faulander: echo $tmpCookie, ":", $tmpCookie.type.name Yardanico: becaue there might be more than 1 header of the same name Faulander: and i get: Faulander: SID=AS8q6lmkBLQM6Wg/1uTe2/QpxckqroVl; HttpOnly; path=/HttpHeaderValues Yardanico: for header in response.headers["set-cookie"]: echo header Faulander: yes, then i get exactly that output Faulander: as you see, the type = "HttpHeaderValues" Yardanico: yes, that's "distinct seq[string]" Recruit_main707: how can you avoid the ugly error lines when working with threads Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/701857177689784340/unknown.png Yardanico: add switch("threads", "on") to your .nims config file Yardanico: or --threads:on to your .cfg file Yardanico: for the project Yardanico: nim.cfg for .cfg, yourfilename.nims for nims (same name as the main file in your project) Recruit_main707: i dont have a .nims file, nor a .cfg Yardanico: you need to create one :) disruptek: Araq: ??? disruptek: http headers should be unique UNLESS they are cookies. disruptek: per RFC. Yardanico: disruptek: well sorry but when I made a PR 3 years ago I didn't know about that :P disruptek: i believe it's fixed in 1.2. Recruit_main707: Yaradinco: errors at compile time also Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/701858310722420807/unknown.png Yardanico: not literally Recruit_main707: oh Yardanico: just switch("threads", "on") Recruit_main707: i see :P Yardanico: without "just" word ofc Recruit_main707: xD Araq: disruptek: we probably can use TInstantiation seq, I simply never tried disruptek: okay. i will mess with it. Faulander: yeah, if i would understand that: Error: implicit object field construction requires a .partial object, but got HttpClientBase:ObjectType Yardanico: црфе фку нщг екнштп ещ вщ, Yardanico: what are you trying to do?* leorize: does it mean exactly that in russian? :P Faulander: no, theres the question mark missing Yardanico: leorize: nothing, I just forgot to switch kbd layout Generic: I was about to ask Faulander: let client.headers = newHttpHeaders({ "set-cookie": self.cookie }) Recruit_main707: leorize: Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/701863393304510554/unknown.png Generic: even russian there aren't so many words without vocals Faulander: self.cookie is a string, which i got from the login method by parsing the set-cookie from there. Yardanico: "let client.headers " not like that Yardanico: you shoudl first have a client like "var client = newHttpClient()" and then do "client.headers = stuff" Faulander: yes, i have that brentp: @shashlick, can you expand on that? not sure how to do it Faulander: https://play.nim-lang.org/#ix=2iQU Faulander: part of the code Yardanico: as i said "let client.headers = newHttpHeaders({ "set-cookie": self.cookie })" is not corrent Yardanico: correct* :P Yardanico: "let" or "var" or "const" are for declaring new variables, not modifying existing ones Yardanico: you should remove "let" from this line Recruit_main707: happens to the best of us :P shashlick: @brentp so when you install the package, you just need import x/y shashlick: Problem is only when it is not installed and the src directory is present shashlick: So you can create a nim.cfg with --path:src in your project root shashlick: So when you run without install, the same import x/y will work shashlick: No need for any special code in the nimble file to import version Faulander: thanks yardanico, but now i get no connection anymore :) But continue to dig into it. leorize: I need help choosing the direction to implement async anonymous pipes for windows brentp: @shashlick. of course. thank you! will give it a try leorize: I can either implement it using true asynchronous pipes, but then I'll need to use threadpool to implement the async part since those stuff are blocking only leorize: or I can make named pipes and use overlapped i/o for normal async leorize: the bad part of named pipes is that they are inherantly insecure compared to asynchronous pipes leorize: anonymous* leorize: but threadpool will certainly be slower :/ leorize: so it's performance vs security I suppose Recruit_main707: who needs security, risk it for the biscuit nerdrat[m]: dom96: Just for the record. I just had updated to nim 1.2.0 through choosenim 0.5.1 which I have in the laptop. Choosenim issue #194 does not seem apply to choosenim v0.5.1 leorize: ping shashlick nerdrat[m]: Is shashlick in charge? leorize: I'd say so, dom hasn't been active in development shashlick: sup shashlick: this is the extraction issue right? shashlick: what's interesting is that nimarchive was introduced in 0.5.0 and nothing was changed in 0.6.0 related to extraction Rika: maybe its not triggered in certain cases Varriount: leorize: https://stackoverflow.com/questions/60645/overlapped-i-o-on-anonymous-pipe leorize: well I know that leorize: my problem is what approach to go on leorize: whether I value security or performance more leorize: not security but "correctness" or performance Varriount: Yeah, but I'm not sure anonymous pipes are intrinsically more secure Varriount: They may just be named pipes with a generated name leorize: they are, anon pipes can only be accessed by whoever got the handle leorize: not anymore since windows 7 leorize: named pipes can be accessed by whoever got the rights leorize: heck it can even be accessed over the network leorize: and named pipes also make the distinction of "server" and "client" Varriount: https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-security-and-access-rights Varriount: Oh, hm. The owning account has full control of the pipe Varriount: By default, anyway leorize: yep, meaning any process can access the pipe knowing the name leorize: there's a walkaround for that leorize: you can make a pipe bound once leorize: but any user with admin context will be able to modify that :) Varriount: leorize: Do you know offhand what rights are required to read process memory or inject a thread into a remote process? dom96: nerdrat[m], yeah, as shashlick said, that doesn't make sense. Are you sure it happens with 0.6.0 and not 0.5.1 on the same machine? Varriount: (read another processes memory under the same user) leorize: not sure, but administrative rights are required dom96: leorize: what are you using pipes for btw? dom96: I'd avoid threadpool as hard as I could fwiw leorize: implementing an osproc replacement dom96: you are aware of the asynctools package right? leorize: it's based of osproc and face the same restrictions dom96: fork it? AFAIK it implements pipes leorize: and asyncpipe for windows is designed using named pipe leorize: and network access to those pipe is not disabled as well leorize: I can borrow code from it when I need it leorize: but I aim for different things than that project, it's better to start fresh nerdrat[m]: The thing is, am I the only one getting this choosenim behavior? Varriount: leorize: It _seems_ (though I can't test this, so I'm not sure) that a user has full rights to access their own processes PMunch: Hmm, is there a way to turn off "Spacing" warnings in a DSL? Yardanico: well you can always add {.push hint[Something]:off.} and then {.pop.} Varriount: And since a process, by default, inherit's a user's rights, one process can call read/witeprocessmemory on another of the user's processes. Varriount: https://devblogs.microsoft.com/oldnewthing/20040312-00/?p=40273 leorize: niceeeeee windows Zevv: PMunch: Not that I know of. I need to do {.push warning[Spacing]: off.} all the time :/ leorize: I'd still want to do this thing correctly though, it's better to have less vuln than more Yardanico: Zevv: well if he has a DSL he can put that push to be automatically inserted :P leorize: I think I might have a good enough compromise to use named pipe, but I'm not sure :/ Zevv: Yardanico: I don't think so. Wrong compiler phase. But I'd love to be proven wrong because NPeg also suffers from this PMunch: Yardanico, well the code the macro generate doesn't have the spacing warning, so it wouldn't help to expand to something with the push pragma.. PMunch: Zevv :( Varriount: leorize: yeah, but if an enemy process can read another process's memory, it's a moot point leorize: it's easier to read from a pipe than from memory :) leorize: but I think I'll settle with named pipes leorize: true anon pipes for synchronous ops leorize: and pseudo anon for async leorize: seems like a good compromise leorize: for short and simple things most people would use synchronous pipes anyway leorize: thanks for the help @Varriount Varriount: leorize: Again, I'm not 100% certain. Normally I would test this, but my personal laptop barely stays up for 5 minutes before panicking Varriount: I think the hard drive had failed leorize[m]: that's bad leorize[m]: looking at Rust's implementation, I can see that they care about who get the "server" side of the pipe leorize[m]: hmm, what exactly does the owner of the server side of the named pipe have that the client doesn't disruptek: data leorize[m]: not that, I mean whether they have any additional rights or smt like that PMunch: Turned my HackerNews Q&A reply into a post on my site: https://peterme.net/nim-qa-originally-a-hn-reply.html Zevv: hn q&a? Link? Zevv: oh it's in your post :) Varriount: PMunch: Should we submit it to HackerNews? 😉 PMunch: Varriount, haha that would be great :P PMunch: A HN reply turned article, turned HN post dom96: ooh submit it :D PMunch: Varriount, you want the honors? :P shashlick: nerdrat[m]: i think this is the second time someone has reported an extraction issue but last time, stuff was not extracted at all shashlick: or maybe i'm misremembering shashlick: regardless, we need your help to root cause this if you can make it fail consistently shashlick: could definitely use the help cause i'm not able to recreate the issue locally disruptek: Araq: this is gonna work. brentp: anyone got a docker image with the zig CC set up and working for nim static builds? sealmove: guys would you recommend BSON? Zevv: if you pay enough, sure Zevv: I would recommend anything disruptek: wut disruptek: whore. Yardanico: D: Rika: bson sounds good disruptek: what, whores don't sound good? IanIAnIAN: I use BSON every day IanIAnIAN: it keeps my hair soft any shiny sealmove: pay enough? disruptek: you don't have to pay much for a whore. sealmove: sorry Zevv, didn't get your joke :3 disruptek: well, depends on the customer, i guess. PMunch: Wow, that question derailed at record speed :P Varriount: @IanIAnIAN I use the all-in-one cant-decide-if-its-a-string-or-a-number YAML Rika: oh man not yaml Rika: easy for humans to read horrible for humans to code a parser Yardanico: really? Prestige: I think yaml is hard to read Yardanico: isn't it just indentation Yardanico: if I need a config for my project I just use TOML Yardanico: it's quite easy to understand and has "parsetoml" nim lib :P disruptek: it cannot read what it writes. disruptek: also it looks like shit. Varriount: Yardanico: The thing I dislike about TOML is that it's less-than-ideal for storing arbitrarily nested data Varriount: For example, a Cloudformation or Terraform template. Varriount: (Although I guess those aren't examples of arbitrarily nested data, just heavily nested data) Varriount: And the big thing YAML has that I've only ever seen XML have is support for non-native (to the configuration language) data types. disruptek: lua Varriount: Lua is a data format? disruptek: dhall disruptek: lua has non-native (to the configuration language) data types. Varriount: Oh, this is neat: https://dhall-lang.org/# Varriount: I'm not super excited about some of the syntactic constructs, but I guess you have to make tradeoffs somewhere. Araq: ah that again Varriount: Oh dear. I'm sure you're going to point out some horrible flaw, aren't you? disruptek: he loves to comment on the whole Turing Complete thing. Araq: ^^ :D Araq: if you bring it up, you have no clue about it. disruptek: not such a hard concept. Araq: apparently it is Varriount: Should I care whether it's turing-complete or not? disruptek: it's a bothersome "feature" of a configuration language. disruptek: also, who gives a shit. Araq: you shouldn't care. disruptek: there are better reasons not to use dhall. 😁 Araq: there are instruction sets with 1 instruction that are turing complete. Easy to write an interpreter for. now write "Doom" in it. you can't, why not? because turing completeness doesn't mean you can access the graphical subsystem, for example. TC is not about "arbitrary code execution", that's the job of so called "sand boxing". disruptek: no, the point in dhall is that you can be sure your config will complete execution. disruptek: i'll take "Problems We Don't Have" for $400, Alex. Araq: :-) yes, that's the only thing that is really related to TC. same you can do with other mechanisms though Araq: and arguably via better mechanisms disruptek: such as? Rika: what the hell, that hash thing they have in the main page Rika: thats funky as fuck Araq: just stop running the VM after N processed instructions, disruptek disruptek: you always fall back on that. Araq: it's the best mechanism, otherwise I can give you the ackermann function Araq: it does terminate. eventually. disruptek: it doesn't feel like the best. disruptek: it feels like it requires knowledge of the code/env that i may not have or be able to presume. disruptek: practically, sure, but impractically? no. Araq: well it's not an important problem to begin with Araq: plenty of systems use Lua for configuration and "omg, does this ever stop" is rarely a problem disruptek: as evidenced by the occassion of your solution in the compiler. 🤣 disruptek: like i said... $400. Elegant Beef: Then there is me planning on using nims for configurating my window manager Araq: my solution works well and the VM is used for programming, not for configuration disruptek: use the simplest possible thing. disruptek: nim ships with several config formats. Varriount: > nim.cfg, nimble, nimscript... Elegant Beef: Yea but none are as fun as using nims for configuring values inside the wm disruptek: "fun" Varriount: Elegant Beef: What WM is this? disruptek: know what's fun about wm? disruptek: managing windows. Rika: ok Elegant Beef: im making my own WM disruptek: embedding the nim vm in your wm... not so much. Elegant Beef: If only i wasnt forcing the usage of a status bar Elegant Beef: Damn, my wm has a forced shitty status bar Elegant Beef: Not that it couldnt use another status bar with about 60 seconds of changes Varriount: Elegant Beef: What about pluggable toolbars, like internet explorer. Elegant Beef: eh? Varriount: Just imagine, the fun of misc. toolbars, but for every window. Varriount: https://i.stack.imgur.com/pOAAU.jpg Elegant Beef: Lol sounds great! Rika: make sure you enforce at LEAST 20 Elegant Beef: My current issue is with my status bar being silly crashes my wm if i have two open Elegant Beef: so dual monitor a no go Elegant Beef: *Use imgui, it'd be funny i said* disruptek: lol Elegant Beef: But i mean it doesnt look abohrrent Elegant Beef: https://cdn.discordapp.com/attachments/371759389889003532/701908739917348946/unknown.png Rika: i have a feeling this is abuse of imgui Elegant Beef: psh Elegant Beef: Totally Varriount: Elegant Beef: Of course. Don't you know imgui isn't supposed to be used near cute pictures of dogs? Elegant Beef: Cmon guys how could i be abusing imgui it's not like it takes 1.8% of my cpu to draw a single bar Yardanico: limit FPS to like 5 Yardanico: you won't need more anyway Elegant Beef: yea i know Elegant Beef: Im only drawing if i get an xevent and if it hasnt drawn within the last x seconds Yardanico: and how do you check if you got an xevent? :D while true? Elegant Beef: XCheckMaskEvent, so i dont block Elegant Beef: So yes Elegant Beef: Anyone else here the screeching of disruptek reading how im handling this status bar? Elegant Beef: hear* Elegant Beef: Yea im at less or equal to awesomewm now Elegant Beef: Also considering how daft i am i dont think ill suggest this to anyone Varriount: Elegant Beef: What is the 1-9? PTYs? Elegant Beef: They're workspaces Elegant Beef: Mostly everything there is a button so i can test stuff in xephyr easier Elegant Beef: since i have the keybinds setup manually, and dont have config loading yet Elegant Beef: And truthfully i do want to use nims for configs, but i do realize how silly it'd be Varriount: Eh, I don't think its silly. Isn't there a lisp-powered WM out there that essentially does the same thing? Rika: 5 fps? why not 1 Elegant Beef: well there is button highlighting Elegant Beef: so that will feel a little bad Elegant Beef: roughly 3-10 fps should be intuitive Elegant Beef: But my main issue right now is this imgui context shit crashing hard 😄 Varriount: This is probably a stupid question, but has anyone written a WM in javascript? Yardanico: well yes there's that thing.. Yardanico: eDEX-UI it's not really a DE though Yardanico: not a WM either Yardanico: found https://github.com/rlamana/Ventus https://github.com/mixu/nwm Yardanico: ah the first one is a wrong one skrylar[m]: @mratsim its from 1999 so it probably would have been the prior art of aac if anything :p disruptek: hearts and minds, people; hearts and minds! companion_cube: seems like I came back at an inspiring moment Yardanico: yes sealmove: Sorry this has been asked 3985299 times but what's the best Nim GUI package atm? skrylar[m]: araq has a libui wrapper if you don't need anything complicated InventorMatt: NiGui is pretty good but it missing quite a few widgets still leorize: the libui wrapper is one of the higher quality ones leorize: it feels like native skrylar[m]: it is native Yardanico: @sealmove I think gintro Yardanico: yes its gtk but it's really complete leorize: skrylar[m]: I mean it feels like native Nim skrylar[m]: nfltk works if you don't need to subclass any widgets, but its non-native sealmove: how about imGui? Yardanico: yeah there are quite good bindings leorize: PMunch/wxnim is there if you want all the features Yardanico: but it doesn't look native either Yardanico: I'd prefer gintro over imgui for GUI apps :P leorize: and wxnim if you need cross-platform leorize: because gtk is terrible cross platform Elegant Beef: The best surprisingly depends on you and what you're making 😄 sealmove: I want something like this: https://ide.kaitai.io/ Yardanico: @Beef, for you gintro might be actually quite a nice choice IMO Yardanico: @sealmove for that imgui will be pretty good sealmove: Basically turning this to a native app in order to add editting (because hex editing can get pretty heavy for large files) Yardanico: https://github.com/ocornut/imgui#demo Yardanico: https://github.com/ocornut/imgui#gallery sealmove: Should I use C++ or Nim? Yardanico: Nim, ther is an cimgui wrapper Yardanico: https://github.com/nimgl/imgui sealmove: Good, thanks guys Yardanico: https://github.com/nimgl/nimgl is a superset, it includes bindings to other libs too Yardanico: like glfw, opengl or vulkan (you'll need at least one of those for imgui) Elegant Beef: a gtk based status bar, hmm Elegant Beef: Would make widgets easier sealmove: So how do I approach this? I only have a little experience in Java Swing. Do I start by reading the C++ imGui docs? Elegant Beef: I started by using the imgui example Elegant Beef: Then just ramming my head into imgui and getting something that works sealmove: the Nim one? Elegant Beef: yeaa Yardanico: see https://github.com/nimgl/nimgl/blob/master/examples/timgui.nim Rika: what a big brain move Elegant Beef: Im a person that prefers to learn through ramming my head into a wall over reading how to Yardanico: it's not the most high-level wrapper but it's pretty nice nonetheless Rika: tbh its what i do for most of my "learning xxx lib" projects Rika: though i read docs Elegant Beef: I mean it works extrodinarly well for technical art Elegant Beef: Breaks down on graphics programming Elegant Beef: Since things have to be done in a specific way or it implodes Yardanico: although I've only used imgui once in a C++ program (it was a hack for a game) Yardanico: it worked nicely :P Elegant Beef: My status bar works well for 1 monitor 😛 Elegant Beef: I was also using imgui for my funky terminal, but that is dead in the water until i learn how pty works Elegant Beef: Who would've thought that things like vim dont just use stdin for controls? Yardanico: terminal stuff is really complicated Yardanico: and has a lot of backwards compat stuff you need to deal with :P Elegant Beef: Yea another thing you cant exactly just ram you head to get to work Elegant Beef: I have a fair bit of vt100 support but the whole properly managing inputs for cli applications is a nogo since i didnt realize i needed a pty Elegant Beef: It's a fairly good prototype as it sits Elegant Beef: https://streamable.com/5pzu7 Yardanico: but WhY iTsS nOT OpEnSoUrCe?! or is it? Elegant Beef: I dont like opening source before it's functional Elegant Beef: Weird thing of me Elegant Beef: I love OSS but i dont like broken software 😛 Yardanico: well the point of this is that your code might help others :P Rika: and vice versa 😛 Elegant Beef: A fair bit of my unity technical art stuff is OSS, but that is cause i can wrap it up in a day Elegant Beef: Does funky thing, add comments and publish, easy Yardanico: easier: don't add any readme, comments or description :D Elegant Beef: Lol, nah i prefer my public repos be a bit more nice looking Yardanico: well I kinda try to do it too Elegant Beef: For instance for anything technical art related i tend to include a gif of it in action Elegant Beef: https://github.com/beef331/stringlights Elegant Beef: My WM is OSS right now cause prestige and i were volleying back and forward in talking about xlib and x Yardanico: well yeah, also I don't like publishing small stuff in separate repos, but for this thing I had to :P https://github.com/Yardanico/nim-strenc/blob/master/src/strenc.nim Rika: oh hey its that Yardanico: yes Rika: haha, gaEE Elegant Beef: Yea i suppose i could have a single repo of "Shaders and shiz" and push there, but eh Yardanico: @Rika that was fully random though :P Rika: i was jokin Yardanico: I mean I just mashed on the keyboard a bit Elegant Beef: Not truely random Rika: it sounds korean tbh Yardanico: although the lib is pretty useless if someone knows a bit of IDA or Ghidra Elegant Beef: It's your sub concious coming out Yardanico: just breakpoint where stuff is being printed, find this function and see that it's just simple xor Rika: how do you determine whether a string is random or not, given nothing but the string itself Yardanico: still very cool Elegant Beef: Well if the string exists it's not random Elegant Beef: At most pseudo random 😛 Yardanico: also see https://godbolt.org/z/nyeELQ for the generated assembly Yardanico: and try to remove {.noinline.} from that proc - the assembly listing will become like 3x larger Rika: well what i mean is how do you determine whether some value given (by anything, we're in theory world rn) is random or not Elegant Beef: Well if someone is giving me value, they surely dont know me Elegant Beef: Well you look at the source, if the person is named R. N. Gesus it might be a random valu Yardanico: @Rika https://en.wikipedia.org/wiki/Randomness_tests sealmove: Elegant Beef wow! looks nice Elegant Beef: The console? Elegant Beef: Well if anyone wants to do the pty stuff for nim i'll gladly OSS my console 😛 exelotl: I can't use `|` to insert a blank line in nim doc :( Yardanico: you just do an empty string Yardanico: ## Yardanico: or two empty lines, I don't exactly remember sealmove: imgui says: could not load: cimgui.so but in the README.md it doesn't state anything about dependencies. What do I have to install? Yardanico: you have to compile cimgui Yardanico: https://github.com/cimgui/cimgui Yardanico: and since you're on linx you'll have to do LD_LIBRARY_PATH=. ./myapp or LD_PRELOAD=./cimgui.so ./myapp or something like that Yardanico: since library search path doesn't include the current directory on *nix Elegant Beef: or if you're a twat copy it to your lib folder sealmove: sounds complicated Elegant Beef: It's rather easy Yardanico: yeah it's really not hard Elegant Beef: I mean i copied the .so to my lib folder since im silly and prefer it over having a .so in my git directory Elegant Beef: ~~Git ignore's exist~~ Yardanico: btw this simple 6-line string encrypting/decrypting function got compiled into 200 lines of assembly when I added --passC:"-march=native" on godbolt :P Yardanico: it's ~25 lines of assembly without that Yardanico: https://godbolt.org/z/Av2oCV you can scroll a bit down and see a lot of SIMD stuff sealmove: Yardanico can you elaborate on LD_LIBRARY_PATH=. ./myapp? sealmove: I compiled cimgui exelotl: Yardanico: I mean like this exelotl: https://cdn.discordapp.com/attachments/371759389889003532/701940018998149130/unknown.png Yardanico: @sealmove LD_LIBRARY_PATH specifies additional paths for the OS to try to find libraries in Yardanico: so after you compile your app (and assuming it's in the same folder as cimgui.so) you do Yardanico: LD_LIBRARY_PATH=. ./myapp sealmove: how comes I have to specify myapp in LD_LIBRARY_PATH instead of imgui? Yardanico: please read it closer Yardanico: LD_LIBRARY_PATH=. ./myapp as in LD_LIBRARY_PATH=myapp sealmove: ah lol exelotl: I wanted to put extra space between the two paragraphs. It seems like `|` is the standard reStructuredText way to do things, but when I put `|` on a line with no text, it gives me a literal `|` exelotl: https://cdn.discordapp.com/attachments/371759389889003532/701940768046055454/unknown.png Yardanico: with LD_LIBRARY_PATH=. you specify that the OS should also try to search in the current dir Yardanico: and then just launch your app like ./myapp sealmove: ohh I see, thanks sealmove: ok it works Elegant Beef: Yea that was an issue i ran into also when starting to us it Elegant Beef: Yea that was an issue i ran into also when starting to use it Yardanico: btw your edits on IRC are just sent as new messages :P Rika: are Rika: they? exelotl: lol exelotl: quality bridge Yardanico: how would you do it otherwise? Yardanico: diff'ing between text is not easy, and IRC doesn't support any kind of edits Elegant Beef: Yea i know they are Elegant Beef: It's instinctive to me Yardanico: ? Yardanico: well it's instinctive to me on Telegram too, but I restrain myself when I use Discord for Nim :P Elegant Beef: I dont proofread so i instinctively hit up and correct issues Elegant Beef: I do attempt to prevent it here but it happens exelotl: Yardanico: hmm that's a fair point, could get the bot to give you a notice that edits are ignored Yardanico: good night everyone exelotl: is it possible for bots to post messages that only 1 person can see (like Discord's own Clyde messages?) Elegant Beef: buh bye Yardanico: @exelotl no, on irc that's not possible exelotl: cya exelotl: oh I meant on discord Yardanico: Ah then it might be possible, I'll check it maybe Elegant Beef: If you're suggesting to tell people not to edit, bots can pm users Elegant Beef: So a bot could pm a user on their fist edit exelotl: Yeah, it could work. I generally don't like being PM'd by bots though x) Elegant Beef: Since people dont read 😄 exelotl: so an inline message would be much preferred Elegant Beef: Yea, i dont know if that's possible exelotl: At least a discord bot could post a warning only in the discord channel, and not on IRC. I guess that would be acceptable Elegant Beef: > Some people here use an ancient communication service which lacks features, dont do anything but send messages 😄 Yardanico: On the other hand it's completely open and has a lot of clients for any possible platform, OS and editor (like emacs) Elegant Beef: Yea i dislike discord as much as the next person, but the alternatives arent as fancy imo, riot.im is interesting but still from my understanding video/voice is trash Rika: imagine using discord for games Elegant Beef: inb4 Use a different application for different services Yardanico: And Nim IRC channel was here long before Discord even appeared Elegant Beef: Hey i said ancient exelotl: I don't mind the lack of features in IRC... except for missing out on messages when you're offline Yardanico: You misspelled "battle tested" Yardanico: @exelotl for that I have Quassel skrylar[m]: i saw this came out recently https://haxe.org/blog/shirogames-stack/ and gave me a few minutes of pause KingDarBoja: WHAT KingDarBoja: DUDE KingDarBoja: I remember I was trying to mod one of Shiro Games KingDarBoja: But then devs said it wasn't allowed on some QA I think KingDarBoja: I know some dude is still modding that KingDarBoja: I don't remember how much memory it was, need to check that again KingDarBoja: I have to admit, that was a great article to read skrylar[m]: yea it made me reconsider haxe since i saw a youtube about the article, looked around a little bit. i've been doing the low level gles2 stuff in nim and kind of sighed since on the haxe side that's pretty much already done skrylar[m]: some of its not super hard. i have a very basic little meshing module that lets me just pop out quads and it builds the vertex tables in the background zetashift: Yeah Haxe is great zetashift: but their docs are even worse than Nim lol skrylar[m]: haxe is also not self hosted which is what made me go meh zetashift: iirc they were/are working on an OCaml -> Haxe part zetashift: so it becomes self hosted skrylar[m]: i looked around and all i found was a 2014 thread of people asking why it was still ocaml and were told because the devs like it that way skrylar[m]: but skrylar[m]: haxe also has a lot of things i don't miss like capitalization and objects owning their procs KingDarBoja: What is self hosted in this case? skrylar[m]: compiler written in itself KingDarBoja: Also not sure what you doing skrylar, sorry, newbie here KingDarBoja: Oh zetashift: 'objects owning their procs' ? skrylar[m]: class Bleh { public void Doit() { .. } } zetashift: ah like that zetashift: doesn't that boil down to OOP vs procedural? disruptek: CAPITALIZATION IS AMAZING THOUGH skrylar[m]: nim assumes foo.bar is bar(foo) and you're done, haxe does the c# thing where you have to define it with the object or do an extension class which makes you wonder what the point is skrylar[m]: "wow you can make a class that *isn't really a class* but just looks like one for the sole purpose of bolting a method on to another class" skrylar[m]: but yeah they have a couple of really neat things like lime and haxeflixel disruptek: YOU CAN'T SPELL KOOP WITHOUT OOP KingDarBoja: KOOP? skrylar[m]: compile speeds in my nim code are still pretty snappy so .. eh. disruptek: you're probably using it wrong. 😁 skrylar[m]: well yes i only allow macros for syntax sugar skrylar[m]: the people who were here some months ago writing cryptomonies and bignum libs with heavy generator macros had a lot of pain, but honestly the Go philosophy of bake it all to the vcs is the right one if you aren't using lisp skrylar[m]: part of why gtk-rs takes 30 seconds to compile hello world is it sits there deep tracing through piles of macros every single build, whereas in lisp you compile everything as you see it and macros actually get baked down as you go, so you never re-scan old macros unless you are specifically building a proc that uses it skrylar[m]: afaik nim and rust have to suffer through the macro expansion every build, so. disruptek: not after ic. skrylar[m]: is that actually working now disruptek: well, no. disruptek: i'm making progress; i'm just slow. disruptek: peak cognitive ability is reached at age 20 and goes downhill from there. skrylar[m]: was poking around with janet and saw `make-image` was kind of interesting. loading modules just 'runs' it in to its own environment, importing then copies the symbols in to the current environment, but then `make-image` accepts an environment table and spits it out in something you can load later. which .. has the interesting bit where you can have a bunch of self-generating code that deletes itself and the image will just be skrylar[m]: the built module :think: skrylar[m]: i dont think i've often seen systems save the final result of loading a module.. usually they just compile that part to bytecode too disruptek: that's sorta how our backend cache works at the moment. skrylar[m]: well if you want some nice hashing stuff, i have a working blake2{b,s} in skyhash. skrylar[m]: they have a mode that does tree hashing disruptek: what kinda trees? skrylar[m]: spruce disruptek: fair enough. disruptek: we actually record all the mutations to a module and cache each of them individually. skrylar[m]: it probably wouldn't help actually because you can merkle hash with just about anything, and an incremental compiler doesn't really need the height protection skrylar[m]: i juts remember a whitepaper for one of those smart contract systems and they were using them to track memory changes disruptek: all our doorways have been enlarged with clyybber's head. skrylar[m]: were hashing pages and basing runtime costs on pages dirtied after a run completed disruptek: i guess that's a way to do it. disruptek: me neither. Elegant Beef: so a glfw function for getting the x11 window returns a pointer, to use with the xlib i need that as a TWindow, so how do I manage this? skrylar[m]: ~~by using SDL~~ check if the binding you are using equates twindow with a pointer or if it does something special with it. if they're both void pointers, just cast it with dot or cast Elegant Beef: I mean i suppose i could use sdl Elegant Beef: When this doesnt work ill probably hop over to sdl skrylar[m]: in all liklihood they are both pointers in the wrappers skrylar[m]: when this happens you just cast it skrylar[m]: then we judge whoever gave you the raw pointer type harshly Elegant Beef: ok skrylar[m]: (if it were instead a named pointer type like it should have been you can write a `converter` to implicitly cast it to the other type, so you can maintain some semblance of type safety) Elegant Beef: yea just a rawdog pointer so i was scared to do anything with it 😄 skrylar[m]: eh then make your own getter that does the cast and gives you the right type Elegant Beef: Well that doesnt seem to crash it, as much as `glinit` is skrylar[m]: does glfw actually return a twindow Elegant Beef: I couldnt find a twindow, it returned a pointer Elegant Beef: Think i have a bigger issue of attempting to use imgui for my status bars Elegant Beef: Since i dont think i can thread the rendering, and XNextEvent blocks until it gets an event skrylar[m]: https://stackoverflow.com/questions/8592292/how-to-quit-the-blocking-of-xlibs-xnextevent :b s0kil: Could I modify an JavaScript object prototype from Nim? Even though Nim supports UFCS? skrylar[m]: you could always use emit to force it, although nim won't be aware of it type-wise s0kil: @skrylar Could you show quick example? leorize: ufcs doesn't affect anything? Elegant Beef: So yea the pointer works, i have bars being drawn on my screen but the gl part isnt so need to figure out how to draw to multiple windows from 1 thread Chiqqum_Ngbata: Is there already a function in std to turn a version string into tuple[major: int, minor: int, patch: int] ? Rika: i dont think so, no KingDarBoja: This sounds very semver so better split and put that into a tuple disruptek: we used to have this feature but no one used it, so it was removed. Chiqqum_Ngbata: Just the function you mean? : ( KingDarBoja: The good thing is that prob you can search the git history and find the proc that had the functionality disruptek: no; lots of features were removed. KingDarBoja: Oh yikes Chiqqum_Ngbata: I don't need to know how to do it. I've already done it for another project, just wondering if I'm typing unnecessarily KingDarBoja: Ah okie dokie... Chiqqum_Ngbata: The `since` stuff wasn't removed right? disruptek: since no one used it? awr1: is there a way in nim to convert a single UTF-16 character to a `Rune`? The `encodings` module seems a little heavyweight awr1: since it is string -> string awr1: i suppose MultiByteToWideChar() should be fine, and then i assume i should be able to cast it to a Rune? awr1: err awr1: WideCharToMultiByte() awr1: i mean KingDarBoja: I am interested on what you doing awr1 KingDarBoja: Like, trying to get a entire char like `\n` from some string is a bit messy if you ask me disruptek: i like to read them 2-bits at a time. KingDarBoja: And yeah, I heard unicode module is pretty heavyweight disruptek: cleaner that way. KingDarBoja: 🤔 skrylar[m]: @ElegantBeef you have to activate the gl contexts, issue the draw calls and flush, move to next context .. leorize: @awr1: encodings module is heavyweight because it gotta verify the formatting too leorize: and unicode spec is nowhere near "small" KingDarBoja: Any example ? disruptek: yeah, but i'm not supposed to post dick pics online. KingDarBoja: I remember Variount guidance and I ended up reading one cahr and then using a if to check if the next one was something KingDarBoja: LOL awr1: i'm trying to get WM_CHAR messages KingDarBoja: Win4Life zacharycarter: job system almost working with fibers :D - https://github.com/zacharycarter/junkers zacharycarter: ala https://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine awr1: what on earth awr1: RegisterClassEx() is giving me "The specified system semaphore name was not found." skrylar[m]: hmm you can do a big chunk of unicode simply skrylar[m]: when you get to the stuff that needs the character database though. oof. lmariscal0641: All the nim packages without submodules and as bare weights 1.39gb curious note Rika: ok KingDarBoja: 🧐 shashlick: @leorize - you around? KingDarBoja: He has joined the dark side leorize: shashlick: yea but I'm gonna sleep now leorize: Araq: can you review this? https://github.com/nim-lang/Nim/pull/13201 disbot: ➥ Make file descriptors from stdlib non-inheritable by default Araq: leorize: upcoming week is PR week leorize: sure Araq: will review it, thanks for your patience Araq: it looked good last time though shashlick: Araq: does importc work on static inline functions with {.header.} Prestige: Is there a place where all pragmas are documented? shashlick: The manual Gary M: so I have a weird situation with this syntax highlighting right now. Considering how procedures can be used without parentheses, how am I supposed to parse the different between procedures and variables like Gary M: Gary M: init addr vk Gary M: (proc) (proc) (var) Gary M: difference* Gary M: it's all done with regex matching Prestige: shashlick: they're just spread out between the different sections? I haven't found like, a list shashlick: https://nim-lang.github.io/Nim/manual.html#pragmas Prestige: ah I was trying the search feature on that page and didnt see it come up Prestige: leorize: What do you think about separating nim.nvim's ftdetect into different filetypes? Prestige: I'm using PMunch's nimlsp for nim files but it throws tons of errors for nimscript, because nim.nvim sets *.nims files as a nim file Prestige: filetype* ftsf: hmm anyone have a simple example of how to use async httpclient? ftsf: what does "Error: unhandled exception: No handles or timers registered in dispatcher. [ValueError]" mean? ftsf: when I call poll() ftsf: also, does httpclient work in the js backend? jorjun_twitter: Tech I like keeps getting bought. Is nim safe? nerdrat[m]: Here is the issue report on github https://github.com/dom96/choosenim/issues/194 . I'll stick with the buggy one until newer release I fixed the problem by replacing manually corrupted files. 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 Araq: ftsf: pretty sure it doesn't, but see karax and friends for how to do http requests alehander92: happy Easter, guys ! Yardanico: orthodox easter you mean :P alehander92: /going back to holidaaays/ alehander92: yeah, yeah alehander92: well, almost Yardanico: well yeah, happy easter to you too alehander92: orthodox country Easter, e.g. protestants here(like me) also celebrate it today alehander92: thank you alehander92: russian brothers :P :) as people love to say supakeen: @alehander92: Happy paskha :) Yardanico: supakeen: are you slavic too? :P supakeen: No, but at my church there's a bunch of people from those areas :) Yardanico: oh guess I only got 3 more chapters to finish before my first Lox interpreter implementation (as in the book) will be completed alehander92: supakeen is it an OCA church? alehander92: happy paskha to you :) supakeen: @alehander92: It's an English speaking catholic church in the Netherlands so it combines people from a lot of communities who have come here. It's not eastern orthodox :) alehander92: cool! its interesting that some of our catholics(using the eastern rite) also celebrate today IIRC supakeen: You celebrate with the community! alehander92: exactly :) supakeen: Not that we really can right now normally there used to be big celebrations for easter a few weeks back but with all the lockdowns it's all on-line. alehander92: here the orthodox churches are still open iirc but with big restrictions alehander92: but our lockdown overally is not so severe i think, mostly almost no intercity travel and no going to parks + masks outside, but you can still walk on the streets jorjun_twitter: Anyone can assist with an enum problem I have? https://pastebin.com/Y8mncarL Yardanico: https://play.nim-lang.org/#ix=2iDQ ? Yardanico: actually "echo numeral" will work just fine too Yardanico: on line 16 Yardanico: but on line 20 your $ was applied to numeral.repeat, not to numeral Yardanico: echo calls $ for everything that's passed to it by default jorjun_twitter: Aha, I tried brackets, like this but no joy: $(numeral).repeat n_repeat Yardanico: that would still apply to numeral.repeat Chiqqum_Ngbata: Has anyone seen custom stream implementation? jorjun_twitter: ($numeral).repeat n_repeat boom. Thanks so much dom96: nerdrat[m], your issue implies that you've used choosenim 0.4.0 previously and that it worked, is that correct? Can I assume that this issue does not happen with 0.4.0? dom96: ftsf, can you show us your code? That usually means there is nothing for the async loop to do, i.e. nothing is pending. __ibrahim__: noob question: can i just throw the generated C code into wasm and expect it to work? sealmove: is there a range limitation for enums? sealmove: I get: ⏎ fatal.nim(49) sysFatal ⏎ Error: unhandled exception: over- or underflow [OverflowError] sealmove: when trying to use large values for enums sealmove: example: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e9c3542c7dcfc14e2cefa53] Yardanico: 9223372036854775806 works fine Amun_Ra: hmm, is it me or FileStream's setPosition does not support whence Yardanico: Amun_Ra: wdym "whence"? setPosition for "Stream" in general doesn't support specifying "from" or maybe I misunderstood you Yardanico: with setPosition you set the current positition in the stream Amun_Ra: Yardanico: I wouldn't expect set/cur/end in a Stream but it's FileStream Yardanico: so? Yardanico: FileStream *is* Stream Yardanico: Stream is basically an interface Amun_Ra: hmm, I have to switch to File and implement my own readUints Yardanico: I really can't understand the problem you're having, sorry Yardanico: readUint will work just fine for FileStream Amun_Ra: I need to set position X bytes from the end and read the structure from there zacharycarter: you can do that with a stream zacharycarter: https://nim-lang.org/docs/streams.html#setPosition%2CStream%2Cint Amun_Ra: I can't operate on absolute values Amun_Ra: perhaps I'll just add file size to function prototypes sealmove: @Yardanico any idea why it doesn't work for high(int64) == 9223372036854775807? sealmove: seems like a bug sealmove: or at least undocumented implementation limitation Yardanico: do you really need an enum value of int64 though? :P sealmove: yes, I need to make it work in the general case, because I am making parsers and this value could exist in some file Araq: this is not much of an "enumeration" sealmove: so I have tests in place for testing even these edge cases, and my tests fail right now :3 Araq: it's a distinct int. sealmove: Araq I know, initially I modeled it as distinct int, but I want these nice Nim enum features like exhausting coverage :3 sealmove: exhaustive* sealmove: except enums, does any other construct offer exhaustive coverage? how about sets? Araq: well you can overload the 'case' statement these days but yeah, only enums really offer it sealmove: Araq, if I overload `case` for my distinct int, this will work? Araq: hopefully sealmove: And could I have an insight on why int(64) doesn't work with enums? Just curious. sealmove: `high(int64)` I mean Araq: compiler bug, fix it sealmove: okay, got it Araq: many of these bugs are actually more conscious than many think. sealmove: I can imagine it can be an implementation decision Araq: I'm aware of overflows but keep thinking "nobody will ever stumble upon this" Araq: I'm usually wrong :-) sealmove: haha Araq: https://github.com/nim-lang/Nim/pull/14008#issuecomment-615879473 anyhow vote please disbot: ➥ enummaps: library based generalized typesafe enum with holes ; snippet at 12https://play.nim-lang.org/#ix=2iER federico3: Araq: +1 on stability. Perhaps a issue label to track ideas for Nim 2.0? sealmove: I agree with federico3 Araq: yeah good idea. as I said before, the current plan is to grow/fix Nim and then in a couple of years focus on the cleanups in a 2.0 release sealmove: btw is there a pragma to disable exhaustive coverage? Yardanico: else: discard Yardanico: assuming you have a case statement :) sealmove: yeah I know about this, but when generating code and you don't know whether you have covered all cases or not, you can either get error like "not all case covered" or "all cases covered but found `else: discard`" sealmove: well, if there isn't, I can use `if` instead of `case` of course. Yardanico: do a macro or a template? Yardanico: also there's compiles() in system sealmove: Sadly I am not generating code with Nim X_X. Anyway I will use an `if` Yardanico: even if you're not generating it with nim you can still insert a compiles() call sealmove: Is this nice though? I prefer to have an if instead of case than inserting a compiles() call sealmove: but really, we could have a pragma for example called {.dirtyCase.} if it's not hard to add federico3: was there an httpserver in Nim at some point? Yardanico: you mean a stdlib module? idk ftsf: nimhttpd ? ftsf: @dom96, yeah there's nothing pending, is there a way for poll to do nothing without error if there's no jobs? federico3: nimhttpd serves only files from disk (pretty useless!) ftsf: federico3, what do you want it to serve? supakeen: I mean there's the asynchttpserver module which you can use to build one, or did you mean a built in one to server... what exactly? :) dom96: ftsf, there is a function that tells you this, hasPendingOperations or something, take a look in asyncdispatch federico3: the same as asynchttpserver from the stdlib but without the async ftsf: federico3, i'm using jester to serve stuff via nim dom96: federico3, yeah, there was httpserver ftsf: @dom96, thanks sealmove: Guys what do you think? https://github.com/nim-lang/Nim/issues/14019 disbot: ➥ Add pragma for disabling enforced exhaustive case coverage Chiqqum_Ngbata: The exhaustive coverage hasn't been an big issue for me so far. I'd lean toward not adding things but maybe this is a bigger pain in your kaitai stuff? Chiqqum_Ngbata: Now I forgot what I came here to ask... sealmove: sorry for that :3 sealmove: Yes, it would help me a with my implementation. Of course this is an edge case so it's not an important feature. I don't know what's the policy regarding pragmas. Maybe we don't introduce pragmas that are subject to abuse? If this is not a concern though, and if it's easy to add, then I don't see any other problems with introducing it. Chiqqum_Ngbata: Is it possible to configure nimble post-install task? disruptek: make the pragma, show its use, create an RFC to add it to stdlib. disruptek: simple. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: persistent storage macro. leorize: Prestige: to be fair we should fix nimsuggest so that it can work with nimscript :P livcd: i am also watching federico3: most nim packages age like fish livcd: they rot away? federico3: yep federico3: how can expose a variable defined in a template to another template nested inside its body? inv2004: Good Sunday of quarantine! inv2004: Few days ago I asked about problem with UncheckedArray, I spent some time trying to reproduce and found that for simple structure it works perfect, but for more complicate structure with unions it does not work inv2004: I created an example (I removed all bycopy because I am not if it is necessary or not here, but it does not change behavior): https://github.com/inv2004/test_nim_c inv2004: .. I am not sure if the is ... leorize: inv2004: you should always add `bycopy` when interfacing with C shashlick: http://ix.io/2iGU/nim is the output from nimterop inv2004: leorize, I had it - problem was the same. Let me convert it to the link from shashlick leorize: yea, but a tip is that you should always have it when building C wrappers leorize: the pragma is to prevent Nim from doing optimizations (ie. pass by reference) zacharycarter: are custom allocators supported in --gc:arc? livcd: federico3: that's one of the biggest issues i think. That packages break too often as Nim develops further. Winim is broken with every release :D leorize: zacharycarter: IIRC it was removed federico3: livcd: that and the general quality and debuggability zacharycarter: leorize: gotcha EdgyNerd: https://play.nim-lang.org/#ix=2iH5 how can I speed up this Pi program, it's currently taking around double the time of a similar crystal program (5000 digits takes 3.2s EdgyNerd: https://play.nim-lang.org/#ix=2iH5 how can I speed up this Pi program, it's currently taking around double the time of a similar crystal program (5000 digits takes 3.2s in Nim, 1.7 in crystal) Araq: zacharycarter, it got removed because the destructors feature is about how you can implement your own seqs and containers Yardanico: @EdgyNerd how are you compiling it and can you show the crystal source? also please don't edit messages on discord Araq: and when you do, you get to choose the allocator Yardanico: I just tested and with -d:danger it took me 300ms on 5000 digits EdgyNerd: what does `-d:danger` do? Araq: EdgyNerd: also put the code inside a 'main' proc Yardanico: @EdgyNerd -d:release is the release mode, and -d:danger implies -d:release but disables various runtime checks Yardanico: It's 600ms for me with -d:release EdgyNerd: ah ok Yardanico: if you compile like "nim c file.nim" you're compiling in debug mode with every possible check enabled EdgyNerd: oh ok Yardanico: also check if you're compilng crystal code in release mode :) EdgyNerd: yeah I was, I just didn't find the flag in Nim EdgyNerd: it's still taking 2.5 seconds even in danger mode, how long does it take for you to run the 'debug' mode? EdgyNerd: it's still taking 2.5 seconds even in danger mode, how long does it take for you to run the debug mode? Yardanico: What's your Nim version by the way? EdgyNerd: latest I think Yardanico: What's the time if you try with -d:release ? leorize: nim --version for the version number EdgyNerd: oh my version is 1.2.0 EdgyNerd: is that latest? leorize: yep Yardanico: Yeah Yardanico: "nim c -d:release file.nim" EdgyNerd: 2.6 seconds with -d:release leorize: how are you measuring the time? Prestige: leorize: good point, didn't know if it was an appropriate issue to open on your repo. I still think nimlsp would have to know about different filetypes, no? leorize: it ran in less than one second here livcd: TotalMilliseconds : 58.0343 livcd: here EdgyNerd: the unix time thing (time ./pi) leorize: Prestige: my repo is not a nimsuggest bug tracker :P leorize: ❯ bash -c 'time ./test' leorize: 3141592653 leorize: real 0m0.001s leorize: user 0m0.001s leorize: sys 0m0.001s EdgyNerd: set the digits to 5000 Yardanico: Leorize - change DIGITS to 5000 Prestige: Yeah I meant as setting a different file type for .nims leorize EdgyNerd: (also if digits is set to 5000 you might wanna comment out the stdout line since it has a lot of output) Yardanico: well it just takes 600ms with -d:release and 300ms with -d:danger for me Yardanico: I'm checking with fish's "time" built-in command leorize: 2s here :P leorize: oh fish have `time` now Yardanico: well I have 3700X but single-core it's not the best CPU livcd: 2.3s here EdgyNerd: actually my time is basically exactly 2s leorize: can we have the crystal version too? Yardanico: in debug mode I get 2.22 seconds EdgyNerd: oh yeah EdgyNerd: https://pastebin.com/9uLPq1Xu EdgyNerd: (ignore the part at the end, it's a special case I was too lazy to implement in Nim, and only affects about 1/30 digits) Yardanico: the code seems different though? leorize: ah int vs int32 Yardanico: leorize: that doesn't make any difference for me really EdgyNerd: the code is basically the same except I used until loops instead of for loops EdgyNerd: yeah changing the int size doesn't really do anything EdgyNerd: (to the time) leorize: the crystal code is a bit better structured Yardanico: @EdgyNerd but really I wouldn't suggest you to compare on microbenchmarks :) Yardanico: I leorize: I'm gonna clean up the nim one and see what can I improve Yardanico: I'll try with crystal 0.34 on my PC Yardanico: that seems to be the latest Yardanico: well Crystal version takes 640ms for me too lol livcd: int32 brings it down to 1.5s for me Yardanico: (nim with -d:release is around the same and nim with -d:danger is ~300ms) leorize: Yardanico: big cpu perks :P leorize: I'm doing this on a weak intel Yardanico: maybe LLVM does a better job at optimizing stuff than GCC? can you try with clang? Yardanico: on your CPUs I mean leorize: lol the nim code is not the same as the crystal one leorize: we miss an iteration for our for loops Yardanico: actually it's the other way :P Yardanico: with crystal I get "741326047" at the end Yardanico: with nim "7413260472" Yardanico: but it's only 1 digit difference leorize: I'm talking about the code :P EdgyNerd: what's different about it? leorize: you used `..<` zacharycarter: is there any alternative of codegenDecl for types? Yardanico: @EdgyNerd basically can you try compiling the nim program with clang (I hope it's installed on your machine) leorize: which is `..` but stop before the end point zacharycarter: I want to specify the aligned attribute for a type I'm defining in Nim Yardanico: nim c --cc:clang -d:release file.nim EdgyNerd: clang doesn't speed it up at all EdgyNerd: also: the reason I used `..<` is because I based the crystal and Nim programs off of this python program EdgyNerd: https://pastebin.com/NqYE796H EdgyNerd: (python ranges work the same as `..<`) Yardanico: well then I don't really know, it might depend on your CPU or something, as I said I get same speeds - 600ms - with crystal ("crystal build tt.cr --release") and "nim c -d:release file.nim" and I get 300ms with -d:danger instead of -d:release Yardanico: @EdgyNerd they don't though Yardanico: ah they do sorry I misunderstood EdgyNerd: it's weird that for you Nim is double as fast, whereas for me Nim is 2 seconds and crystal is 1.7s EdgyNerd: I guess it could be based on the CPU (my laptop has a pretty awful CPU) Yardanico: Also just for fun info the Nim compiled binary (after strip -s) is 80kb, while it's 320kb for Crystal :P EdgyNerd: haha EdgyNerd: I wasn't really trying to compare them, I was just confused why Crystal was so much faster than Nim (because I didn't realise about -d:release and -d:danger) leorize: hmm, does crystal array start at 1 lol EdgyNerd: nope they start at 0 leorize: I read the loop in correctly :P leorize: incorrectly* EdgyNerd: I've tried Nim and Crystal and I'm probably gonna stick with Nim (mainly because it's syntax is more similar to python, and it looks like it has a more active community) Recruit_main707: yeah, this comunnity is small, but they are very helpful and active Yardanico: Also by the way if you want some number crunching (and matrix and more) stuff - https://github.com/mratsim/Arraymancer and https://github.com/mratsim/weave EdgyNerd: "Compile with -d:release -d:danger to get the same performance as in 0.19.x" why both? leorize: you don't need both leorize: @EdgyNerd: http://ix.io/2iHC/nim leorize: complete port from python leorize: 1.72 secs Yardanico: @EdgyNerd that was fixed in 1.2 Yardanico: -d:danger is supposed to imply -d:release but it didn't got some time Yardanico: *for leorize: -d:danger on my port and it's 1.57s :P leorize: -d:release --gc:arc and it's 1.58s leorize: so as fast as -d:danger without being dangerous EdgyNerd: what does --gc:arc do? Yardanico: switched to ARC memory management model skrylar[m]: i have never used crystal and i am more a rubyist than a pythonist, but nim works Yardanico: https://forum.nim-lang.org/t/5734 some info about arc skrylar[m]: now if only the reset password button on the forum worked :headbandage: Yardanico: skrylar[m]: ask dom96 :P leorize: we really need more reliable forum software :P Yardanico: as 4raq would say: go fix nimforum Yardanico: :D KingDarBoja: Hi guys such father that father not: Hey! KingDarBoja: Welcome! sealmove: guys, since we have a working Kaitai Struct back-end now, I started work here: https://github.com/sealmove/kaitai_struct_forensics __ibrahim__: hello, can someone explain to me why my silly code gives SIGSEV? __ibrahim__: https://pastebin.com/fN25W3wD Yardanico: you forgot to initialize Test in newTest __ibrahim__: wow that was fast, thanks Yardanico Yardanico: https://play.nim-lang.org/#ix=2iI3 Yardanico: both newTest and newTest2 will work __ibrahim__: i guess this also works __ibrahim__: https://play.nim-lang.org/#ix=2iI4 __ibrahim__: thanks Yardanico Yardanico: yeah in your case newTest works because Nim assumes that that the last expression (not statement) in a proc is a return value __ibrahim__: true, nice feature __ibrahim__: how would you implement template specialisation on a type? using enums? Yardanico: wdym? __ibrahim__: say i have a component that can be a transform component or a render component or a physics component Araq: maybe via 'typedesc[T]' overloading, not sure tho __ibrahim__: Thanks Araq! i will check that out for sure! __ibrahim__: Here is a sample C++ code: __ibrahim__: https://pastebin.com/x1fWkTCh __ibrahim__: kinda lost between programming paradigms, should i go oop? or meta-programming? __ibrahim__: kinda lost between programming paradigms, should i go oop? or meta-programming dsl? disruptek: oop is dead. Recruit_main707: tell that to python stats :P __ibrahim__: i really like Nim's metaprogramming into declarative dsl __ibrahim__: trying to learn how to do things i usually do in cpp __ibrahim__: okay i guess this needs macros skrylar[m]: Yardanico: i've been bothering him to fix it about once a month now disruptek: sealmove: how did you make kaitai work? skrylar[m]: i dont have the same resentment to objects and still do object-based stuff in nim, i just think people might have missed what oop was about while they were badly copying it out of clos/st-80 __ibrahim__: dod seems to be the new rage in game dev KingDarBoja: _oop is dead._ wut KingDarBoja: I have never heard of DOD to be honest __ibrahim__: data oriented design __ibrahim__: something about optimising the way data is loaded to the L1 cache of the CPU to minimise cache misses that you would otherwise have in OOP __ibrahim__: unity's new data oriented tech stack/ entity component system is based on __ibrahim__: structs of arrays vs arrays of structs __ibrahim__: that's about as much as i can explain it :p KingDarBoja: I see KingDarBoja: Not an expert on the topic but must be a good approach as a quick google search shows several applications on game dev __ibrahim__: Mike Acton's talk about dod from a c++ perspective is interesting Araq: DoD is nice but in practice cumbersome to work with disruptek: should be easier to make it ergonomic in nim. Araq: indeed, we should have a DSL for it Araq: I designed one once but my employer wasn't willing to pay for it Araq: and I have no need for it since I don't write games :-) __ibrahim__: too bad for him xD disruptek: what bugs me is that so much of these problems feel like things we had solutions for decades ago. we're already too old or too young; doomed to repeat history. liblq-dev: Eh. new weird patterns that in reality are just unnecessary microoptimizations. at least for (relatively) simple 2D games like the ones I make disruptek: i'm thinking more of optimizations that shouldn't need to exist if the design wasn't perpetrated by a novice in the first place. __ibrahim__: If you have alot of 3d rendered entities, they make a great difference. else, no need. disruptek: computers are fast. we made them slow. __ibrahim__: well, dod is the answer to oop's "slowness" i guess __ibrahim__: since entity/component is oop style liblq-dev: but oop isn't *that* slow if you know how to use it liblq-dev: ie. not have millions of subclasses each contributing to bloat disruptek: they are designing for the lowest common denominator. __ibrahim__: https://www.youtube.com/watch?v=0_Byw9UMn9g __ibrahim__: interesting talk about oop vs dod, talks about "millions of subclasses" issue __ibrahim__: nim dod dsl would be something amazing :D declarative game programming leorize: liblq-dev: the "mainstream" languages shepherd people into subclassing like hell :P KingDarBoja: My brain hurts while trying to differentiate all those paradigms liblq-dev: leorize: true KingDarBoja: OOP vs Functional, Composition vs Inheritance, etc leorize: I don't really care about paradigms anymore leorize: I write whatever that fits KingDarBoja: leorize is right disruptek: i have a bug in nimph that i'm not how to handle. disruptek: not sure, rather. liblq-dev: leorize: same here KingDarBoja: Mainstream languagesare pretty focused into OOP (and few functional examples) nerdrat[m]: dom96: Let me do some tests with 0.4.0 because I didn't install the nim-1.2.0 toolchain with choosenim 0.4.0. I updated choosenim first and then I installed Nim. __ibrahim__: i think nim has the most interesting paradigm i have ever seen, making a dsl using metaprogramming to program at a higher level leorize[m]: nim is multi-paradigm leorize[m]: why focus on one when you can do all? __ibrahim__: https://www.youtube.com/watch?v=JO0iqGDgFqA __ibrahim__: really cool demo by krux02 KingDarBoja: That explains why OOP is minimal here KingDarBoja: But glad to see how it can be used in multiple paradigms leorize[m]: we take what works, then get rid of the rest leorize[m]: that's how programming should work imo __ibrahim__: it's cool that it is multi-paradigm , which led me to some confusion to pick which paradigm to go with, after some research i learned about many paradigms and im still thinking how i should approach building a simple 2d engine in nim. leorize[m]: don't build an engine, build a game leorize[m]: then you will know how to build an engine disruptek: this. KingDarBoja: Shouldn't it be the other way? __ibrahim__: it's cool that it is multi-paradigm , which led me to some confusion to pick which paradigm to go with, after some research i learned about many paradigms and im still thinking how i should approach building a simple 2d engine in nim. __ibrahim__: whoops i deleted my comment and repasted it, didn't mean t spam sorry leorize[m]: imo the problem with toy engine is that a lot of people don't even know how a game work and/or what it needs KingDarBoja: RIP IRC people Araq: DOD is also mostly a workaround for badly implemented prefetcher that doesn't understand memory strides KingDarBoja: https://miro.medium.com/max/3632/1*wS8DsmEejvsswkQjNA-BoQ.png leorize[m]: so if you wanna build something generalized, you gotta know the specifics first KingDarBoja: Oh god, why I googled it Araq: not sure why they don't just fix the hardware but apparently it's hard __ibrahim__: i dont care to build something generalised at all, i just want to build a simple game. leorize[m]: then build the game leorize[m]: an engine is the game without the game part in it :P __ibrahim__: lol epic advice, but i come from an oop background, and i want to write idiomatic nim ( at least as best i can ) __ibrahim__: i guess idiomatic nim is procedural metaprogramming leorize[m]: idiomatic nim is "whatever that works" KingDarBoja: lol really? disruptek: nah. leorize[m]: I'm outta words :P leorize[m]: well we try to use as little advanced features as possible EdgyNerd: how would I manually compile the C source files that Nim produces? (is there just a simple gcc command I can use) leorize[m]: only use them when it's needed disruptek: gcc works. leorize[m]: @EdgyNerd: pass --genScript to the compiler leorize[m]: it'll generate a script with the commands needed to build your project leorize[m]: the script will be in your nimcache though, so you might want to move it elsewhere with `--nimcache` __ibrahim__: thank you leorize EdgyNerd: "it'll generate a script with the commands needed to build your project" where are the commands? leorize[m]: check your nimcache leorize[m]: there will be a script inside it EdgyNerd: oh yeah I missed 'compile_pi.sh' dom96: nerdrat[m], thank you :) leorize: anyone knows how to use `{.multisync.}`? dom96: sure leorize: so how do I use it? :P leorize: what should my return type be? KingDarBoja: OMG just finished another test round and now a previous tests is failing lol KingDarBoja: I hate when that happens x.x dom96: leorize: take a look at the stdlib for examples mratsim: What is DOD? inv2004: shashlick, I just copied all bycopy from your link and commited, but nothing really changed. structure was ~ the same before inv2004: https://github.com/inv2004/test_nim_c/blob/master/c.nim#L9 inv2004: and it is the same "Illegal storage access." inv2004: ah, except that I replaced your array[1, cuchar] with arr*: UncheckedArray[S] inv2004: UncheckedArray[SS] inv2004: I did the same for S-struct and it worked fine leorize: inv2004: the sizes of the arrays where different leorize: in the C code they are `unsigned char` leorize: but you use a `pointer` here for nim code inv2004: leorize, I have the same for S-struct, which works fine. the arr is just offset for allocated array of pointers inv2004: that is why I suppose it is not important for C is it is char array of something else inv2004: I compile the code with nim only (not nimble) - where can I find generated .c file? I see it in nimcache for nimble projects only - strange disruptek: set your --nimcache:/some/where inv2004: thx Yardanico: inv2004: ~/.cache/nim leorize: inv2004: yea the char is the problem inv2004: hm, hm, should I cast it then? why it works for S ? leorize: http://ix.io/2iJ5 leorize: this is probably due to the C compiler attempting to align the struct inv2004: It works! thank you! inv2004: another question - how bycopy works? If I have 1000Gb of data in one array - will it copy it every access? or will it make deep copy (not, because it is byte right now I think) leorize: `{.bycopy.}` means pass to parameters like C does leorize: in Nim, if an object has a size > 3 * sizeof(float), it will be passed to functions as reference (ie. proc(o: BigObj) -> void(BigObj* o)) as an optimization leorize: since we're dealing with C, that pragma forces Nim to not do this kind of optimization inv2004: interesting, thank you inv2004: another question: if I have the ptr object - does it mean that GC do not care about it? leorize: yea Prestige: Is there a way to get a string representation of a const's name (at compile time)? I don't think there is but I'm trying to avoid potentially "extra" work leorize: astToStr() leorize: it can convert any ast into a string inv2004: what can I do with it? in my lib which defines the S and SS structure - I have some kind of reference-counter to clear the structure - can I link it somehow with nim? inv2004: ... with nim's GC Prestige: leorize: thanks leorize: inv2004: you can't, however we do have a destructors system that you can exploit to link it to Nim leorize: inv2004: https://nim-lang.org/docs/destructors.html leorize: wrap your pointer in an object with one field (there won't be any overhead), then define `=`, `=destroy` and `=sink` for it leorize: `=` should be mappable to `inc_ref()` leorize: `=destroy` to `dec_ref()` leorize: and `=sink` should just copy the pointer over inv2004: Perfect, thank you! leorize: so from this: https://stackoverflow.com/questions/5435841/memory-alignment-in-c-structs leorize: it appears that you should always wrap structs as-is leorize: as C compilers are allowed to add paddings however they like inv2004: ok, so the two structs does not match, got it inv2004: I have an idea, probably (original idea for the chat) to rewrite everything in nim, and just to pass .addr to C sometimes - I should not cafe about GC or anything else inv2004: cafe = care . Looks like I need better keyboard :( leorize: it does work leorize: you can expose Nim's reference tracking to C also leorize: then you should make the struct opaque and use getter/setter procs to access it from C inv2004: Yep, have to think about it exelotl: How do I publish docs for my library? Do I run `nim doc` and then manually copy the result into a gh-pages branch? leorize: yea disruptek: nim doc --project --outdir=docs some.nim leorize: there's `nim doc --project` leorize: oh that works too Prestige: is there a way to have `when defined` statements in a table declaration to selectively initialize it with certain entries? disruptek: sure. exelotl: what does --project do? Prestige: this is what I'm trying to do: https://0x0.st/i112.png exelotl: I don't see the difference compared to just running nim doc leorize: it recursively generates documentation for all modules in the project iirc exelotl: oh wow, so it does! exelotl: that's epic, I can delete my script to do that now. 😅 lolgab: Hi everyone :) ⏎ Do you know a way to attach a pipe to an external process started with `startProcess` to a file descriptor different from `stdin`, `stdout` or `stderr`? I want to read what the process writes to fd `3` leorize: sorry, that's not here yet leorize: for now you gotta do plain old fork()-setup-exec() lolgab: No workarounds like attaching to the underlying process or something available? lolgab: I tried but didn't achieve anything Recruit_main707: lolgab: that sounds to dll injection ;) leorize: lolgab: setup a pipe then forward it as fd 3 to the target process? Recruit_main707: the file descriptors in other processes lolgab: I want to implement a proxy of a protocol similar to this one: https://github.com/apache/openwhisk/blob/master/docs/actions-actionloop.md#implementing-the-actionloop-protocol lolgab: > setup a pipe then forward it as fd 3 to the target process? ⏎ ⏎ Yes, something like that.. I have to try deeper leorize: posix_spawn should simplify the process lolgab: Thank you, I'll try with `posix_spawn` Prestige: Is there a way I could do this at compile time with an immutable map, or is this the best I'll get? https://play.nim-lang.org/#ix=2iJv disruptek: you can use a ct const table. leorize: Prestige: you can just... import all of them Prestige: you mean just not bothering with `when defined` and having them all exist? leorize: yea Prestige: hm I suppose so disruptek: a .compileTime. var is immutable, fwiw. disruptek: sad but true. Prestige: disruptek: what is a ct const table? disruptek: tables can be consts. Prestige: if I do that here using when defined, I thought I'd get an error for adding more elements disruptek: const someTab = when foo: {...} else: {...} Prestige: ahh perfect, thanks Prestige: actually maybe not if multiple things could be defined and added to the map disruptek: .compileTime. then. disruptek: or just define the contents as consts and then add them all at once. Elegant Beef: prestige what is that for? Prestige: reading a user config file and getting the keysyms from the names Elegant Beef: Xlib can convert string to keysym, which then can convert to keycode Prestige: Yeah, I'm wanting to have some custom names though Prestige: like just using "c" instead of "XK_c" Elegant Beef: I mean Elegant Beef: https://hatebin.com/jiydsehajg Elegant Beef: That's from my config loader EdgyNerd: is there a way to get arbituary precision floats in Nim? Elegant Beef: It's hardcoded right now, but it will support loading chars leorize: !repo decimal disbot: https://github.com/Sud0nim/Decimal -- 9Decimal: 11A big/arbitrary precision Decimal class in pure Nim 15 23⭐ 0🍴 7& 1 more... leorize: !repo nim-decimal disbot: https://github.com/Sud0nim/Decimal -- 9Decimal: 11A big/arbitrary precision Decimal class in pure Nim 15 23⭐ 0🍴 7& 1 more... Prestige: Elegant Beef: You can just pass in "d" and it will auto convert to XK_d? leorize: !repo status-im/nim-decimal disbot: https://github.com/status-im/nim-decimal -- 9nim-decimal: 11A correctly-rounded arbitrary precision decimal floating point arithmetic library 15 12⭐ 3🍴 Elegant Beef: I mean that works so when i hit mod4 + d it opens rofi Prestige: interesting Prestige: thanks Elegant Beef: My WM is actually mostly functional leorize: @EdgyNerd: ^ use nim-decimal KingDarBoja: How can I convert a parent type to a child type? KingDarBoja: Just curious, seems like I can do the opposite Elegant Beef: `Child(parent)` is i think the standard, or `cast[Child](parent)` Elegant Beef: But im a numpty in nim so 😄 KingDarBoja: The child(parent) didn't worked KingDarBoja: Let me try the cast KingDarBoja: As the first one yields `Invalid object conversion [ObjectConversionError]` leorize: Child(parent) work if it's a ref object KingDarBoja: Both are ref objects 🤔 leorize: inherited? EdgyNerd: actually how do I download/use libraries in Nim? KingDarBoja: Ye Elegant Beef: Nimble leorize: you either use nimble or nimph Elegant Beef: then import module/name leorize: @KingDarBoja: make sure you check it with `if obj of Child` before doing the `cast` then Elegant Beef: so currently prestige im stuck at drawing status bars for monitors, and having workspaces KingDarBoja: Hold on, sharing a screenshot KingDarBoja: I am doing it at the newMyType proc of the child type Elegant Beef: I've tried multiple things to unmap and remap but it seems unmapping causes the window to bork leorize: @KingDarBoja: I can see why it didn't work now :P KingDarBoja: :'v KingDarBoja: https://imgur.com/gE4jB2w KingDarBoja: Left child, right parent leorize: yea you can't do that leorize: but... couldn't a variant object work here? leorize: well but I guess exceptions are built on inheritance Elegant Beef: Is there an OOP environment where that'd be allowed? Cause im fairly certain C# wouldnt allow that either leorize: python would allow it Elegant Beef: Yea but python also allows you to cry while coding Elegant Beef: So that's a low bar 😄 KingDarBoja: Python shashlick: @leorize - question from last night - does importc work on static inline functions with {.header.} shashlick: I'd think so since the header is being pulled in with the nim code during compile so it should work KingDarBoja: https://imgur.com/JXlbRPl KingDarBoja: Sauce from Python leorize: KingDarBoja: anyhow, create an `init` proc for GraphQLError KingDarBoja: It has one already, it is new shashlick: It won't work with dynlib, depends if compiler stripped it out KingDarBoja: Cuz it must be a ref or I will not be allowed to raise it leorize: KingDarBoja: no, an init that take a GraphQLError leorize: shashlick: `static` functions are limited to the file that contains it leorize: you can't link against them leorize: for standalone headers: translate them to Nim leorize: for non-standalone, use `{.header.}` and it should work shashlick: But that's why I'm saying if Nim importc has header pragma, the header gets included during compile time KingDarBoja: But why a init if I have a new already, (GraphQLError is a ref) KingDarBoja: Or maybe I don't get the idea? shashlick: Other cases its no go leorize: yep, that's why I said you gotta translate that function to Nim in non-{.header.} case leorize: @KingDarBoja: well we don't usually use exceptions for this kind of errors KingDarBoja: 🤔 so? Prestige: Elegant Beef: Thanks for sharing that, going to make my life a lot easier lol leorize: but here's how this can be done: make an `init(g: GraphQLError) = g.field = "foo" <- basically a helper setup proc like this` leorize: then in your inherited object, do this `new result; init(result); ` Elegant Beef: Check out my loadconfig in config.nim and goodwm.nim's setup procs to see more how im handling Elegant Beef: I have a system for hardcoded events and user defined commands Prestige: only thing I need to do it add modifiers and I should be good leorize: @KingDarBoja: ping just in case you didn't see the above KingDarBoja: Looking at it shashlick: so that's the thing - why would anyone expect to share static inline procs as an API if the header isn't supposed to be available KingDarBoja: So the init "helper" proc should just return the GraphQLError type so I can use it on my inherited obj, rigth? shashlick: as a C lib writer, if I am using static inline and expect my user to use those procs, I will be giving them the header leorize: the helper proc take a GraphQLError, then set the needed fields KingDarBoja: Right shashlick: so I don't see the point in converting them into pure Nim leorize: static inline procs are like macros, but with better syntax and semantics Prestige: Elegant Beef - how would you add/load a modifier key from a string (like shift)? Elegant Beef: I mean i'd have a map for modifiers Elegant Beef: there's only like 8 of them afterall leorize: shashlick: you can try to convert them, but if you can't just bail and tell the user to either enable `{.header.}` or override it with their own hand written version shashlick: so my logic is that nimterop is all about wrapping headers at build time, which means the header is right there leorize: yea but there are users that want to use nimterop to generate standalone headers, no? shashlick: creating wrappers that don't need the header anymore might be a legitimate use case no doubt shashlick: but I don't think it is realistic for large wrappers leorize: worst case, just import the proc verbatim to the wrapper with `{.emit.}` shashlick: cause people do all sorts of platform, compiler and package detection at build time shashlick: I tried to explain my rationale in the latest nimterop readme in the why nimterop section shashlick: I know 4raq doesn't agree with it but that's my experience so far leorize: 4raq wants a tool that can generate platform-agnostic wrapper leorize: your tool is not that :P leorize: so just ignore him, focus on the use case that your tool targets shashlick: I don't believe that's possible without reimplementing everything configure/cmake and preprocessor does in Nim leorize: to be fair I think nimterop is not something anyone should use to generate generic wrappers shashlick: that's not going to be my goal - I've explained that in the readme now shashlick: please take a read and let me know your feedback leorize: for simple stuff, like sdl2 or kmod this can be done leorize: since they're not a maze of configurations leorize: but for more "configurable" ones like openssl, yea it's impossible shashlick: basically stuff like this issue - 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 shashlick: call me lazy but I don't want to reimplement all that #ifdef in Nim because then it is my responsibility for the user to pass all the #defines for that specific platform/compiler/package combo to the nim wrapper so that it renders the right thing at compile time shashlick: so I'm willing to toss this `static inline` stuff also into the same bucket, even though we could wrap it into pure Nim shashlick: another - call me lazy - classification shashlick: just want to make sure I'm not missing something, hence the questions and explanations shashlick: I'll consider the {.emit.} thing later for non {.header.} cases KingDarBoja: leorize: got it, thanks KingDarBoja: It seemed messy but that works lol KingDarBoja: https://imgur.com/b8pXb5l leorize: that's not how I meant it to be... KingDarBoja: Uhhh? leorize: https://play.nim-lang.org/#ix=2iJT leorize: it's a pattern in Nim for exceptions to be object type and not ref object dom96: it's a historical defect ;) leorize: the lack of documentation for asyncdispatch is annoying... dom96: leorize: I agree, can you help us improve it? :) KingDarBoja: Impressive, never expected such approach leorize: dom96: I'm still trying to make sense of how to do things lol KingDarBoja: Darn leo, you are pretty good at this ❤️ dom96: leorize: feel free to ask questions leorize: I'm still unsure whether to use FutureVar or FutureStream leorize: the use case is to read data from a pipe inv2004: leorize, my previous example works, but I moved everything to real lib and found that struct in totally misaligned, but on another fields. Do it mean than my definition of nim-struct is not correct (but looks it is ok) . Or are there any way to align my nim-struct to match C ? leorize: yea your definition might not be correct leorize: if you can share the C and Nim definition I might be able to figure out why inv2004: ok, let me recheck dom96: leorize: what's the pipe implemented as? dom96: is it an async pipe? leorize: both leorize: but yea for this it's an asyncpipe inv2004: @leorize, How do you check it? I just printed all offsetof in C and nim leorize: inv2004: manual inspection and experience :P dom96: leorize: not sure why you'd need either then inv2004: @leorize, ah, I do not have it, ok :) dom96: You're presumably reading from the pipe and then writing it somewhere else? let data = await pipe.read(1024); await foo.send(data) leorize: that's an use case inv2004: heh, looks like I have a bit :) probably found a bug in c2nim inv2004: typedef char*S,C - S is char*, but C is char. looks like how it is in C, but c2nim set cstring for C leorize: dom96: the other one could be that you wanna parse something and you start trickle data in from the pipe leorize: hmm actually I can implement both lol dom96: You only need FutureStream if you're offering an API for someone else to consume streaming data dom96: It seems you already have a streaming API with the pipe leorize: I got kinda confused when I saw asyncfile.readToStream :P inv2004: should I try to send PR to c2nim or it is outdated already? I remember previous struct was generated by something else leorize: sure, make a PR to c2nim shashlick: Please fix it if you can inv2004: shashlick, but you generated it by something else leorize: the other tool is not a c2nim replacement :) shashlick: Nimterop inv2004: thx, too late to ask the difference :) KingDarBoja: Hey leo, looking at the example KingDarBoja: Does that means that all my setup stuff for the base error shoul be on init call instead of new, right? leorize: yea KingDarBoja: Okie Dokie KingDarBoja: Makes sense leorize: on another note, EINTR is horrifying in so many levels KingDarBoja: Ok moved all setup of base error into init with it's parameters KingDarBoja: But now the `newError` proc is asking for those leorize: uhmmm, just forward all the parameters to init? KingDarBoja: .-. KingDarBoja: wdym leorize: now i'm not sure what you mean KingDarBoja: https://play.nim-lang.org/#ix=2iK7 KingDarBoja: Check init of `Error` KingDarBoja: -> missing parameter: param1 KingDarBoja: this is what I mean leorize: https://play.nim-lang.org/#ix=2iK8 <- like that? KingDarBoja: 🤔 KingDarBoja: That looks like a mess with more params IMO leorize: well it's not like you'll need it for every param leorize: your newGraphQLSyntaxError already got less param than newGraphQLError KingDarBoja: 🤔 KingDarBoja: Ok, now it works KingDarBoja: The only thing that bother me is having the same proc arguments for the parent error KingDarBoja: On the init and newError call leorize: then maybe instead of so many arguments you should try to see if it can be derived from some state object? KingDarBoja: Nah KingDarBoja: Or wait, not sure what you mean leorize: it's a parser, right? then you can probably derive most of the data in the parsing error from the parser state? leorize: but then I'm not sure how your parser even work :P KingDarBoja: I do prefer it like it is right now, I don't have issue with the duplicated arguments on both init and new call KingDarBoja: Still nice idea KingDarBoja: Didn't know about the Exception being handled like that KingDarBoja: Jumm, I expect the guys to show up at this time voltist: @Vindaar o/ Rika: it is i KingDarBoja: Rika-sensei! Rika: ._. the nim syntax highlighting regex is still pretty wonk Rika: https://cdn.discordapp.com/attachments/371759389889003532/700874922045472898/unknown.png Elegant Beef: @Gary M has been working on it a bit got to here yesterday Elegant Beef: https://cdn.discordapp.com/attachments/371759389889003532/700875971862986823/MzNOi4v.png Rika: i know Rika: i was there Rika: @Gary M new bug lol Elegant Beef: I mean i know him from a different server, so he pmed me, so didnt see it here Rika: something weird from the string literal highlighter it seems KingDarBoja: Eleigant: what editor is that? Looks neat 😄 Rika: still vscode im psure leorize: @Rika: I have a degree in parsing Nim with regex, do you need my help? :P Rika: nah this plugin needs your help leorize: so what's the prob? leorize: I mean, where can I see the code? leorize: is it written in nim? Rika: uh no its just a json soup of regex Rika: actually i think Gary M did a lot of work on it Rika: so maybe wait for them to report leorize: can you generate this json? leorize: if you can't you're in for trouble Rika: you can... from yaml leorize: yea you're doomed Rika: it just looks like this Rika: https://cdn.discordapp.com/attachments/371759389889003532/700879475721764945/unknown.png leorize: I don't know how vscode treat these patterns, but I will tell you that `##[` can start anywhere Elegant Beef: Yea that was gary's vscode Elegant Beef: I believe he is using tree-sitter now to get better highlighting Rika: leorize: that's what the regex says though Rika: "get any combo of space or tabs and `#[`" Rika: 0 to inf amount leorize: uhmm then why do you even need it? Rika: i dont know with the creator Rika: i didnt make this KingDarBoja: I am curious by the theme Elegant is using on VSCode right now Prestige: Elegant Beef: you have any thoughts on using XSelectInput vs XSetWindowAttributes? Prestige: I haven't found much info on why to use one over the other, for setting up event masks for the root window leorize: vscode should implement proper semantic highlighting leorize: then they can use nimsuggest to highlight the code leorize: much better than trying to use some third party parser Rika: i think PMunch is planning to do it? Rika: also vscode already uses info from nimsuggest to show popups Rika: and suggestions of course leorize: well but not highlighting, arguably the most important :P Rika: yeah haha Rika: the issue with that is that the file has to be saved before highlighting updates leorize: not really leorize: it can save the file to a temporary location leorize: the plugin probably already do so Rika: nope i dont think so leorize: it does, that's the only way nimsuggest communication can be done leorize: suggestion data don't just appear out of nowhere Rika: suggestions dont update after modification, Rika: only after save leorize: oh you mean you gotta save it atleast once? leorize: then yea gogolxdong: Will there be problem when insert into a sequence head in a thread and pop in another thread Elegant Beef: No i dont prestige, i just got tiling somewhat working, using maprequest over create window Elegant Beef: But when i close windows 1 mystery window survives Prestige: Nice good to know Prestige: hm close them how, like a key shortcut? Elegant Beef: No internally Prestige: hm is the root window not closing maybe? Elegant Beef: Maybe not Elegant Beef: or it's not sending a message properly Elegant Beef: or it's not sending a message i expect Prestige: Is there a simple way to debug that while it's running? Like using notify-send or similar Elegant Beef: I've been doing `Xephyr :5 & sleep 1; DISPLAY=:5 wm Elegant Beef: I've been doing `Xephyr :5 & sleep 1; DISPLAY=:5 wm` Prestige: hm I guess u can see echo statements from there Elegant Beef: yea Elegant Beef: Wrote this nimscript to handle it Elegant Beef: https://hatebin.com/cckjjcwbzz Elegant Beef: Ah my issue was my delete logic was only attempting to delete if i had more than 1 window not equal or greater KingDarBoja: Arrr KingDarBoja: Been like 2 hours looking for the difference on my code with python source code Rika: nice KingDarBoja: Ugh only 1 tests isn't passing lol KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/print_location.nim My module KingDarBoja: https://github.com/graphql-python/graphql-core/blob/master/src/graphql/language/print_location.py Source on Python KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/tests/language/test_print_location.nim#L52 The test failing, I can't pinpoint what's missing Rika: did you compare the outputs KingDarBoja: I did but not sure why the first two tests are okay whereas the third one is completely different KingDarBoja: The string ("thirdLocation") is the thing that's different KingDarBoja: Quote from leorize (I think): "Maybe I am not looking at the right angle" Gary M: Like beef said I'm looking into using Tree-sitter mainly as a syntax highlighter passing through a Vscode extension. It will probably take a while to write it all but it has the ability to right comprehensive tests so in the end it should be pretty robust 😄 We'll see. Gary M: Ha, write* Rika: yeah right Rika: 😛 disruptek: wut Gary M: Hey, it's the default for Atom :P shashlick: its also the backend for nimterop Gary M: Yes disruptek: why aren't you guys using lsp and such? Rika: does it work just as well :thonk: disruptek: just as well as what? Rika: as the regular vscode nim extension disruptek: i dunno. i admit i don't know anything about this. i use nvim. disruptek: i'm just surprised that anyone ever wants to reinvent this wheel. Gary M: Vscode LSP support doesn't have syntax highlighting I'm pretty sure. disruptek: that'd shock me. leorize: lsp don't have semantic highlight Gary M: It's a wheel that's built in a pretty REGEX flavored rubber thanks to Textmates grammar leorize: nimsuggest was ahead of its time :P Rika: realtime semantic highlighting when leorize: once they finally merged the lsp semantic highlighting proposal Gary M: So it's either struggling with correctly formatting a json using some Ruby flavored REGEX called Oniguruma leorize: once that's in I'll fix nimlsp up and nim.nvim will move to nimlsp Rika: thats a nice name Rika: oniguruma Gary M: Or maybe doing something different with tree sitter Gary M: And I believe it won't be running regex all the time so it's supposed to be faster, idk Rika: sounds better Gary M: Or at least it won't be running a large textmate file worth of regex KingDarBoja: Sup Mask: hello gogolxdong: I found sometimes program stucks somewhere gogolxdong: when inserting into a sequence in a thread and pop in another thread KingDarBoja: Okay, I found my issue KingDarBoja: I was missing a equal sign on some if comparison KingDarBoja: Like val + 1 < string.len Rika: nice KingDarBoja: But actually, it was <= as `..` is not inclusive Rika: ???? `..` is inclusive KingDarBoja: And ofc Python handles the list subset safely, but Nim doesn't, so I always do these kind of checks KingDarBoja: `..<` oops Rika: nim does it safely just doesnt assume you want until the end KingDarBoja: Yeah but what I meant is KingDarBoja: Python can handle index values out of the limit KingDarBoja: Like "abcd" is a string, yo ucan subset it like a[0:999] Rika: i dont think thats good design KingDarBoja: And it will be fine KingDarBoja: That's why I always keep on mind the len check KingDarBoja: But looks like I missed this one lol Rika: use templates or macros KingDarBoja: Explain sensei Rika: `template withinBounds(idx, arr) = idx < arr.len` or something like that KingDarBoja: But this also means that I should check again my proc that uses those checks as I always use `<` KingDarBoja: Instead of `<=` for comparing things like `i + 1 < someLength` KingDarBoja: https://tenor.com/view/simon-cowell-laser-eyes-gif-10617238 The red eyes gif btw Rika: not a meme i know of Elegant Beef: Prestige, did you add `_NET_ACTIVE_WINDOW` to your root window? Elegant Beef: If so, how Prestige: probably set the atom but I haven't Elegant Beef: Yea i dont get the atoms Elegant Beef: Like the XChangeProperty takes 2 Atoms one being property and the other being type Mask: hi i'm having an issue installing a package Mask: Mask: https://cdn.discordapp.com/attachments/371759389889003532/700922867038158879/unknown.png Mask: Mask: https://cdn.discordapp.com/attachments/371759389889003532/700922904552144926/unknown.png Mask: i literally just installed nim Mask: i'm on linux Mask: it says i am using version 0.17.2 Elegant Beef: did you use choosenim? Mask: Mask: https://cdn.discordapp.com/attachments/371759389889003532/700923034147749928/unknown.png Mask: no i'm not familiar with that Elegant Beef: Using ubuntu derivative? Mask: linux mint xcfe yes Rika: nim 0.17 is very old Elegant Beef: Yea Mask: how can i get the updated verison Mask: i installed with apt Rika: uninstall the nim from apt Elegant Beef: Get choosenim Rika: install choosenim either from apt or from somewhere Rika: then use choosenim for nim Mask: i can just alias it right Elegant Beef: Yea the nim version on the ubuntu repo is shite Mask: for less typing? Elegant Beef: its 0.20.2-1 on ubuntu Elegant Beef: choosenim is a nim version manager Mask: uh it can't find the package. Is it called choosenim or something else Mask: nvm i can figure this part out i think Elegant Beef: You can just download a release from nim's site iirc Mask: works. Thanks for the help Mask: well i'm having another dependancy issue Mask: i've tried numerous ubuntu support things for this error, various installs of sdl dev packages etc. nothing seems to work Mask: https://cdn.discordapp.com/attachments/371759389889003532/700929744761257984/unknown.png Prestige: this xlib code is killing me inside KingDarBoja: I had to rely on a bool flag to pass into a tuple so I can use it as a None check cuz I was too lazy to rely on Options module lol Mask: is nimgame2 really the way to go for making games in nim Rika: theres the godot bindings Varriount: Or if you're comfortable with C, SDL or Allegro Rika: man i'm loving npeg, or maybe making PEGs are just super fun Rika: parsing legitimately hasnt been easier Zevv: \o/ Zevv: don't forget to make friendly colorful little graphs every now and then for even more gratification Elegant Beef: Same prestige it feels poorly documented and very obscure on what's supposed to be done voltist: @Vindaar That spike raster plot you devised has been working well. Have you seen my new issue on the ggplotnim repo? Prestige: Elegant Beef I figured out a few things (maybe things you already had set up) but I'm feeling pretty good moving forward Prestige: Do you want a link to my repo? Vindaar: @voltist: sorry, I was asleep Prestige: Bb Vindaar: happy to hear the spike raster plots work well for you! `geom_bar` indeed does not support negative heights so far. I'll take a look at it Vindaar: it's a one line fix though. I simply didn't think about that case voltist: @Vindaar Coolio Elegant Beef: Sure prestige Elegant Beef: Mine's currently private cause i dont like having unfinished software publically available Prestige: https://github.com/avahe-kellenberger/nimdow Prestige: I am just learning nim and like open source so, no shame :) Elegant Beef: Well i love open source to Elegant Beef: but i dislike unusable software visible cause it just fees weird 😄 Elegant Beef: feels* Vindaar: @voltist: just pushed a PR to fix it https://github.com/Vindaar/ggplotnim/pull/65 disbot: ➥ Allow negative bars when using stat = "identity", fixes #64 Guest69899: Error: internal error: getTypeDescAux(tyProxy) Guest69899: does this mean I hit on a Nim bug? leorize: dadada: yep voltist: @Vindaar Neat, thanks! Vindaar: you're welcome! dadada: leorize: it says I should rerun the compilation with ./koch , but there's no ./koch, and no koch in PATH either dadada: when koch is this important, why isn't it setup by choosenim? leorize: koch is the build tool for the compiler leorize: that instruction is for when you want to debug only dadada: as long as Nim is in a state where the user is likely to need to debug it, I think koch should be installed per default dadada: or maybe koch's functionality should be integrated into nim/nimble leorize: dadada: ./koch is like `make` dadada: I somewhat agree with krux02 that Nim could use a better CLI, if it was command based (git-like), it could have nim koch .., etc. Elegant Beef: Well prestige if you want here is my shitty wm currently, made it public just for you :P Elegant Beef: https://github.com/beef331/goodwm Prestige: Ay thanks, that's great Elegant Beef: No organization cause im a gibbon dadada: leorize: I understand that, it's just not very helpful to split up tools a Nim developer is likely to require in his Nim life, because eventually you're going to need them and the hassle of separate installation is unjustified in times where everybody has 1TB+ of storage Rika: uh Rika: *hides in 500gb* dadada: Rika: you're really proving my point, when 500gb is considered "not a lot" leorize[m]: dadada: well do you want the entire compiler source bundled with your compiler installation? leorize[m]: oh wait it's already bundled :p dadada: leorize[m]: you're wording it as if that was a giant file, when in reality the average video on youtube, probably requires more space than Nim's entire compiler source (by far) dadada: leorize[m]: when somebody installs the gcc-toolchain, you can always expect there to be make, so when somebody installs the nim-toolchain, I think it should be expected that there's koch solitudesf: thats just not true dadada: solitudesf: what's not true? voltist: @Vindaar Great, it works! How would I go about putting a line down the x axis? Just geom_line with its own data entry? dadada: leorize[m]: the same works seems to work on play.nim-lang.org, there's only the one difference that I merged two modules into one file on play.nim-lang.org dadada: s/the same/the same code/ dadada: both on version 1.2.0 Prestige: Hmm I need to look into how nimble wants me repo structured dadada: what OS is play.nim-lang.org running? Rika: linux Prestige: I fought it for a while and dislike the structure it was okay with dadada: I'm on linux to dadada: too Vindaar: @voltist: yes, essentially. Not quite sure what you mean by "down the x axis" though. In parallel to the x axis or orthogonal? Vindaar: e.g. on the y = 0 line: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ using `linerange` is easier, because then you don't have to specify two points and thus add something to a DF [https://gitter.im/nim-lang/Nim?at=5e9abd9ee920022432b44c7a] Vindaar: note that the `xMin` and `xMax` values are from 0 to 1, since the x axis is discrete and thus covers (0, 1) by definition voltist: Yeah that's exactly what I had in mind, thanks Vindaar: :) Vindaar: ok, the PR is merged now voltist: @Vindaar Good stuff https://liamsc.com/misc/forward.png Rika: oh no, small issue i have with PEGs now; theyre slower than my current solution. at least the one i made... Vindaar: @voltist: nice! __ibrahim__: hello, i try to compile server.nim on linux centos it says `Error: cannot open file: asyncdispatch` __ibrahim__: hello, i try to compile server.nim on linux centos it says __ibrahim__: `Error: cannot open file: asyncdispatch` Yardanico: @__ibrahim__ how did you install Nim? and what's it version (run "nim -v") __ibrahim__: nim 1.2.0 __ibrahim__: i installed it on centos 8 using snap Yardanico: really strange, maybe nim can't find the stdlib with the snap image, what if you try to import any other module like "import strutils"? __ibrahim__: cannot open file: strutils Yardanico: huh, guess something's wrong with the snap image then __ibrahim__: maybe there is a better way to install thatn snap lqdev[m]: try installing using choosenim. __ibrahim__: ok lqdev[m]: anything is better than snap, to be honest __ibrahim__: im gonna delete the nim in snap Yardanico: yeah, do that so there would be no conflicts __ibrahim__: exporting file path to ~/.profile with snap didnt work either Yardanico: that wouldn't work, nim has it's own logic for detecting stdlib location __ibrahim__: it worked Yardanico: nice __ibrahim__: btw i have __ibrahim__: `export PATH=/home/***/.nimble/bin:$PATH` __ibrahim__: but the terminal isnt detecting nim __ibrahim__: in ~/.bash_profile Yardanico: what terminal? __ibrahim__: any ideas? Yardanico: bash_profile will only work for bash __ibrahim__: default centos Yardanico: well, did you reopen the terminal after adding that to ~/.bash_profile ? __ibrahim__: nim __ibrahim__: bash: nim: command not found... __ibrahim__: yes i have Yardanico: alsl does /home/Discord, but it manages "FromGitter" and "[m]" names in IRC so they appear with nice suffixes on Discord Yardanico: creating a matterbridge alternative to bridge different platforms is kinda harder :) Rika: you should also manage kde bridge style names, -m i think is what they use Yardanico: I don't think we have any in Nim channel here :P Rika: we had one before Yardanico: ok help me fix the bridge itself instead so we can finally use it here Rika: aight im out Recruit_main707: so, it cant connect a gitter server and a discord one? Rika: i mean i would but i still have no clue what the issue is Yardanico: @Recruit_main707 "ircord" is for Discord<->IRC Yardanico: there's also my 2-year-old simple twitchrelay app to bridge IRC and Twitch IRC chats Yardanico: when dom or 4raq started doing some streams on Twitch Yardanico: you can still find references of it, e.g. on gitter #nim-offtopic is mapped to nim-lang/twitch Yardanico: https://github.com/Yardanico/twitchrelay Recruit_main707: how could i check the endianness of the machine my code runs on? Yardanico: https://nim-lang.org/docs/system.html#cpuEndian Yardanico: that const is either littleEndian or bigEndian depending on your target, but generally most architectures are LE Yardanico: like x86 and x86_64 are little endian Recruit_main707: is it available at runtime? Yardanico: ehm Yardanico: you can't run the code you compiled for little endian arch on a big-endian really Recruit_main707: yeah, that const answered me Yardanico: maybe you want functions which swap endianness instead? Skaruts: is there a Nim equivalent to C's `#define Foo`? Yardanico: -d:Foo Yardanico: it depends on what you want to do Rika: `when defined(Foo):`? Recruit_main707: Yaradinco: i want that, (i already found them) but i must check wether it should be done Yardanico: @Recruit_main707 yeah it's not hard Yardanico: lemme show Skaruts: something that can be used with `when` conditions Skaruts: when defined, or something along those lines Yardanico: when defined is for any symbol Rika: i was ignored 😦 Skaruts: so it checks for the existence of a variable? Skaruts: @Rika no you weren't :), just that that's what it's for, but not what I'm looking for here Yardanico: can you better explain what you want? Rika: that ^ Skaruts: well, conditional compiling, based on whether something has been defined Yardanico: when defined Yardanico: there's also "when compiles" Yardanico: https://nim-lang.org/docs/system.html#compiles%2Cuntyped Skaruts: but how to define something, is what I'm asking Yardanico: https://nim-lang.org/docs/system.html#defined%2Cuntyped Rika: on compile, add `-d:Foo` Skaruts: can't be done through code? Yardanico: @Skaruts mainly it's done via -d (short for --define) in the compiler, yes Yardanico: @Skaruts will also work for consts Yardanico: and types Yardanico: ah wait actually no Yardanico: it only works for -d:, for variables you need https://nim-lang.org/docs/system.html#declared%2Cuntyped Rika: defined is for feature flags aint it Yardanico: for any compiler defines Skaruts: that may help Skaruts: gonna give it a try Yardanico: @Recruit_main707 see how I did it here https://github.com/Yardanico/nimnbt/blob/00b6ff31547ea3bbe5d4027bd9e5b03415f1f8a4/src/nimnbt.nim#L35 Yardanico: about endianness Yardanico: and after that code there are usages of it Recruit_main707: nice, thanks Yardanico: I do it because "The datatypes representing numbers are in big-endian in the PC version, but Pocket Version is in little-endian." Yardanico: that code is pretty old though, but I still remembered that I used endianness here 😛 Recruit_main707: this code only complains the second time, why?? Recruit_main707: https://play.nim-lang.org/#ix=2ix9 Rika: ran it once and it complained Recruit_main707: i mean, those two lines are the same, but it only errors in the second one, (here i have isLittle defined: https://play.nim-lang.org/#ix=2ixd) Yardanico: becaise there's no isLittle Yardanico: that's my own constant Yardanico: check my code again Yardanico: https://github.com/Yardanico/nimnbt/blob/00b6ff31547ea3bbe5d4027bd9e5b03415f1f8a4/src/nimnbt.nim#L33 Recruit_main707: i know, i have it defined obv :P Recruit_main707: that second url has it Yardanico: type mismatch: got but expected 'uint16' is pretty self-explanatory Yardanico: byte is 1 byte, uint16 is 2 bytes Rika: @Recruit_main707 islittle is true Rika: when collapses the statement Yardanico: and what buf[0..1] is supposed to mean? Rika: so 1st is never read Yardanico: oh I get what you're trying to do Rika: when is compile time so any nonmatching branches are completely removed from runtime Recruit_main707: i will swapEndian16 one of those Yardanico: you want to make an uint16 from two bytes? Recruit_main707: yes Yardanico: are you dealing with streams? Yardanico: (streams module) Recruit_main707: no Recruit_main707: at least not for now Recruit_main707: `uint16(buf[1] shl buf[0])` should i do something like this? Yardanico: try https://forum.nim-lang.org/t/2626#16256 Rika: buf[1] shl 8 and buf[0] or something like that i'd do Yardanico: or https://forum.nim-lang.org/t/2626#16241 Araq: buf[1] shl 8 or buf[0] Araq: 'or', not 'and' Yardanico: and then jus swap endianness if you need Rika: oooops Rika: sorry for being brainlet lol Recruit_main707: ok thank you all federico3: https://github.com/nim-lang/Nim/issues/9785 how comes this is high priority and had no updates in years? disbot: ➥ Crash in Nim's SSL handling code ; snippet at 12https://play.nim-lang.org/#ix=2ixp leorize: federico3: because no one could reproduce it Recruit_main707: `buf[1] shl 8 or buf[0]` how would this code be used for 32 bit, and 64 bit? leorize: I played with FutureStreams and the API of it is kinda useless leorize: guess I'm off to design my own :/ Rika: buf[4] shl 24 or ... 16 or ... 8 or buf[0] Recruit_main707: another vscode error, openArray never gets highlighted despite being a type... Yardanico: it's not that smart really dom96: leorize: please do and make a PR for the stdlib Yardanico: it highlights only stuff which starts with an uppercase character (because most nim types are like this) and for special stuff like "openarray" Yardanico: yes it highlights "openarray" but not "openArray" krux02: leorize, you mean mean FutureStreams don't provide value to Nim? leorize: krux02: I mean that the API make it useless leorize: maybe I'm using it wrong leorize: Yardanico: so it has no concept of Nim's style insensitivity Yardanico: leorize: yeah, it really only differentiates between Type and type by first character Yardanico: so Type and TyPE will get highlighted, but not openArray even if it's a type leorize: dom96: I'm not even sure if I'm using FutureStream correctly leorize: how are you even supposed to use that? leorize: I'm having an input stream from a pipe and it's async Rika: well, syntax highlighters cant determine if a symbol is a type Rika: it can prolly do openarray properly though Yardanico: well vscode nim plugin uses nimsuggest for other things Yardanico: and believe it or not - nimsuggest can provide highlightings too Yardanico: indirectly, but you can get all symbols from the file and highlight all types for example Rika: yeah Rika: but it doesnt use that Rika: because syntax highlighting is faster than semantic highlighting Yardanico: you can use both leorize: I don't think vscode even support dynamic highlighting leorize: yea you can use both leorize: try nim.nvim Rika: in vscode? Yardanico: in general exelotl: wtfff I accidentally enabled a Nim REPL in vcode???? exelotl: https://cdn.discordapp.com/attachments/371759389889003532/701105879709122649/unknown.png Rika: well yeah but not in vscode i dont think Rika: @exelotl yeah, `nim secret` Yardanico: @exelotl yeah for some reason it binds "Alt+Enter" for "nim secret" Yardanico: "nim secret" is called like that for a reason though Yardanico: ah wait it's not alt enter exelotl: shift + enter Yardanico: ye shashlick: Araq: seeing a crash when printing a PNode, any ideas? https://pastebin.com/CRPNMtTw shashlick: This is devel on osx krux02: Yardanico: for emacs I highlight everything as a type that follows a `:` Yardanico: krux02: well I mean types appearing in code Yardanico: like "newSeq[MyType]()" krux02: sorry, I don't do that anymore krux02: now it is everything that is declared as a type in system.nim and everything that starts with a capital letter. Recruit_main707: Araq: is it openarray or openArray by "default" krux02: regular expression based highlighting only. krux02: Recruit_main707: you can just look at the declaration in system.nim krux02: and then you see it. Yardanico: it's openArray but I've always used it as "openarray" lol :D krux02: Spoiler: it is `openArray` Recruit_main707: ok krux02: The nim compiler uses a strict mode that enforces to use the style of the declaration. krux02: So you would get an error if you use `openarray` instead of `openArray` in one of the files. Rika: why is it lowercase? Rika: compat? exelotl: vscode only highlights `openarray` exelotl: I kinda find it more readable too :\ exelotl: or rather, more aesthetically pleasing disruptek: leorize: did you say you had a fix for nimsuggest? leorize[m]: fix for what? disruptek: compiler misbehavior. leorize: what misbehavior lol :P leorize: in general then I don't have any fix disruptek: doesn't work. disruptek: doh. leorize: if about the forward decl problem then I do have an idea disruptek: includes support? leorize: yea the forward decl problem leorize: include is processed correctly by nimsuggest leorize: just that forward decl is not disruptek: oh, well, i guess it's something wrong with my setup. leorize: anyway to reproduce this? leorize: and what kind of include support are you talking about? disruptek: cgen.nim imports a lot of other ccg* files that have lotsa errors for me. disruptek: and i cannot jump to defs in them. leorize: it's due to your auto linter leorize: can't jump to defs because I haven't fixed the forward decl thing yet leorize: though it appears to be rather hard :/ leorize: so the idea I have now is to capture the symbol `ref`, then if it has `sfForward`, wait until compilation is completed, then evaluate the symbol again leorize: oh yea, how stable has `indent-rewrite` been for you? leorize: I'd like to merge that one in to work on other things disruptek: i dunno, i think nimsuggest is very unstable for my work. disruptek: what's my linter called? leorize: i dunno what you use leorize: ale? leorize: neomake? leorize: or syntastic? disruptek: ale, but even disabled, it's still broken. disruptek: missing symbols. disruptek: on an include. leorize: hmm gotta investigate that one then :/ disruptek: not sure it could ever work. leorize: I'm working on something rn, so it'll be awhile before I can work on it disruptek: np zacharycarter: Is this valid C? `typedef volatile int* foo` - most of the explanations and example code I've encountered around volatile show it being used in variable declarations not type declarations` leorize: yea it's valid zacharycarter: I couldn't figure out how to do this in Nim so I did - {.emit: "typedef volatile int* foo_t".} and then type Foo {.importc: "foo_t".} = object zacharycarter: then I declared `var f: Foo` and checked out the generated C code and it seems produce what I expect zacharycarter: I know I need to use volatileload etc with this Recruit_main707: `@Recruit_main707, you want to check if Nim has native ways to read scalars from memory` so thats the question :P leorize: if you have a pointer you can get a value Recruit_main707: https://play.nim-lang.org/#ix=2iy1 cant you edit an openArray? Yardanico: you need to write it as "var openArray[byte" Yardanico: *] Recruit_main707: ah right 😁 livcd: wth is wrong with vscode and nim. Sometiems I just dont get any syntax error checking wtf Yardanico: it runs "nim check" and it's not always perfect :) Rika: wish you could pass in raw text via some sorta IPC instead of needing to save the file Recruit_main707: i clicked randomly over the problems ta and it fixed it, dont know if it had something to do though xD Rika: actually, nim check needs the whole project directory Rika: so im not sure how well that would go... Rika: huh wait why does nim check need project directory anyway what livcd: Yardanico: sometimes i dont see anything "running" Yardanico: well "nim check" isn't running constantly Rika: i think he means he doesnt see it running when it should leorize: @Rika: well the IPC here is a file :P leorize: it's arguably much simpler than any alternative Rika: hmm i guess it is leorize: though I think LSP have its own way fALSO: Hello leorize: hi fALSO: Trying out nim for the first time, going to take a look at the parseopt library leorize: I'd say don't use that one :P fALSO: i need three arguments leorize: usually these third party packages get the job done faster: leorize: !repo cligen disbot: https://github.com/c-blake/cligen -- 9cligen: 11Nim library to infer/generate command-line-interfaces 15 168⭐ 12🍴 7& 1 more... leorize: !repo argparse disbot: https://github.com/iffy/nim-argparse -- 9nim-argparse: 11Argument parsing for Nim 15 33⭐ 3🍴 7& 1 more... fALSO: -m name [ -r time ] [ -s repeats ] disruptek: 2nd argument: you can get better support for cligen. fALSO: ok fALSO: gonna look into your urls ;-) Yardanico: fALSO: yeah cligen will be really easy to use for your use-case fALSO: i have this made on a bash script using getopt, but its becoming too huge and hard to understand fALSO: going to take a look at doing this in nim ;-) fALSO: read about the lang on hacker news fALSO: looks like python somehow fALSO: thank you yardanico leorize disruptek: the interwebs add 10lbs. Yardanico: fALSO: it might look like python on the first glance, but it really is very different :) fALSO: this clingen also seems to need = separating the key from the value Recruit_main707: someone knows a bit of go in here? leorize: most of us kinda do :P Recruit_main707: `math.Float32bits(n)` is this the same as `cast[uint32](n)` in nim? Yardanico: "Float32bits returns the IEEE 754 binary representation of f, with the sign bit of f and the result in the same bit position. Float32bits(Float32frombits(x)) == x." Yardanico: yeah Yardanico: "func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) }" implementation Yardanico: it's the same as casting leorize: https://github.com/alaviss/nim-ryu/blob/master/basicconv.nim#L34-L52 Recruit_main707: thank god, because i didnt understand shit in the wiki (that thing you have cited) leorize: I have a bunch of helpers here that you're free to copy Yardanico: @Recruit_main707 you could just check the source code :P Yardanico: by clicking on "Float32bits" in the header here https://golang.org/pkg/math/#Float32bits Recruit_main707: oh disruptek: ~bentley disbot: bentley: 11https://imgur.com/gallery/yEXiWWG -- disruptek disbot: bentley: 11a good boy dom96: disruptek, is that your pupper? disruptek: yeah. Zevv: I can see that lump you found while petting him some time ago disruptek: yeah. disruptek: wait. disruptek: yeah, it's still there. Zevv: good! disruptek: it's wore down to a nub. Araq: disruptek: my code works disruptek: what? Araq: SSA for DrNim disruptek: i wish that meant something to me. disruptek: single something assignment? Araq: but it's very complex. now what? rewrite? document it well? if so, where? disruptek: just tests. Araq: and I should really work on something more important... disruptek: it is the nim way! disruptek: people think you spend too much time on drnim and not enough on arc. Araq: so ... how to get out of this dilemma? Zevv: which is more fun? Araq: disruptek: cooldome fixes ARC though and I review and merge his PRs Zevv: let the minions do the mundane work, focus on the stuff that keeps you going! disruptek: itym nimions Araq: Zevv: right now DrNim makes my head explode which is why I'm doing it. I pretend to work on stuff nobody else can do Zevv: araq: sweet, that's the stuff worth working on. Noone wants to see araq burned out on boring jobs Araq: check this out: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e9b4d87a9ca1862064921cb] Zevv: that is darn sweet! disruptek: #12818 Zevv: Will it be performant enough for real use? disbot: https://github.com/nim-lang/Nim/issues/12818 -- 3inheritance and generics and ambiguous error message ; snippet at 12https://play.nim-lang.org/#ix=24K1 Araq: Zevv: it's pretty slow Araq: but we can cache the results, I ensured the string representation is sound and cachable disruptek: #13510 disbot: https://github.com/nim-lang/Nim/issues/13510 -- 3mutable iteration over mutable type produces a codegen error ; snippet at 12https://play.nim-lang.org/#ix=2cJp sheerluck: Don't you think that is nice for gitter users that from IRC switched to @Araq from Gitter when he wanted to paste code snippet? Yardanico: he could paste code right here in IRC and nobody will say a thing :P KingDarBoja: Hi guys Yardanico: greetings KingDarBoja: ❤️ zetashift: hiya KingDarBoja: o/ KingDarBoja: Watching anime right now instead of coding xD zetashift: sounds like me leorize[m]: dom96: did you model FutureStream[T] after C#? leorize[m]: I don't quite understand how this interface should be used leorize[m]: at first I thought it would the the async equivalent of `Stream` KingDarBoja: Sounds very Dart to me leorize: the greatest feature that I can see in FutureStream is the ability to reuse memory leorize: since you consume the value in the stream leorize: but then with a little tweak to Future[T] it would work like that too leorize: I think I'm misunderstanding futurestream leorize: gonna see how rust do this kind of thing Yardanico: oh guess I found a bug with gc:arc with my interpreter, maybe it's related to object variants Yardanico: seems I can make a relatively small repro, hmm disruptek: yeah, variant objs are a little tricky for discriminator reasons. Prestige: Elegant Beef: Why do you use XChangeWindowAttributes and XSelectInput? I thought they'd both do the same thing (registering the event mask) Yardanico: disruptek: it seems to not be caused by object variants though :) Yardanico: can't think of a good title though Yardanico: also discovered a compiler SIGSEGV crash in the process, lol Araq: Saturday night, nothing better to do Araq: https://github.com/nim-lang/Nim/pull/11865 we can discuss it here if you want to disbot: ➥ [feature] allow `import foo {.privateImport.}` ; snippet at 12https://play.nim-lang.org/#ix=2iAE Yardanico: Araq: is code like https://play.nim-lang.org/#ix=2iAF supposed to work at all? It works with refc, but not with arc Yardanico: I'm in the process of creating the issue so I wanted to ask Yardanico: also doesn't work with orc Araq: Yardanico, no. well the fact that it moves is a bug but afterwards you would have a cycle anyway Araq: it's a known bug, somewhat hard to fix :P Araq: or maybe not disruptek: this private import is definitely a problem. Yardanico: ah ok, then I don't need the issue? Araq: it's a known bug Araq: but once fixed you're left with a memory leak Araq: :P Araq: disruptek, the feature or the lack of this feature? disruptek: lack of Araq: why? Recruit_main707: sorry to interrupt. Can something like this be done? https://play.nim-lang.org/#ix=2iAG disruptek: because i have to introduce /structure/ just to hide exports. Yardanico: Araq: and what about compiler SIGSEGV if "type A = TableRef[string, B] B = A" Yardanico: when trying to use these (I understand it's a endless recursion) disruptek: openArray is for use in proc params. Araq: Yardanico, that's new :-) disruptek: it's senseless as a /type/ definition. Recruit_main707: disruptek, so i should use a seq then right? disruptek: yeah. Recruit_main707: oki disruptek: or array, etc. Araq: Recruit_main707: you can use ptr UncheckedArray[byte] Recruit_main707: is ptr necesary? Araq: yes Araq: disruptek, please elaborate disruptek: i want to hide code in different files. Recruit_main707: as the language creator, which one is the best way (and i stop disturbing) disruptek: these bits need to talk to each other, so a lot of stuff gets exported. disruptek: but i really don't want to impose all that shit on the user of my library. Araq: Recruit_main707: depends on the use case disruptek: or even expose it to them. Yardanico: I think private imports might be useful in some (not a lot of) cases Yardanico: but still disruptek: i think it's reasonable to hand my users unloaded weaponry. Araq: disruptek, this changes the argument entirely disruptek: i'm nothing if not predictable. Yardanico: https://github.com/nim-lang/Nim/issues/14015 disbot: ➥ Compiler crash when types recursively depend on each other ; snippet at 12https://play.nim-lang.org/#ix=2iAJ Araq: the argument as I understood it was "other programmer X wrote Y and I seek to sneak into it" Araq: your argument is now "I myself private import my own stuff so that I don't have to export fields to others" Araq: which is a totally different viewpoint that I'll sleep over, thanks Recruit_main707: the original go struct has this: `Bytes []byte` this transpilation is pretty big and id rather dont go back to things i considered done. Araq: Recruit_main707: use a seq[byte] then or a 'ref seq[byte]' to emulate zero-copy slices disruptek: the way krux does it explains the problem quite well. Recruit_main707: ok cool disruptek: he just includes everything in a single file. disruptek: stuff he exports is exported. everything else just works and has access to everything else. disruptek: this is a solution but it's not a pleasant one. disruptek: i guess you can use this strategy across directories, which means it's the go technique. i like the way that works. Araq: I prefer it over faking privacy fwiw. "Ah ok, these fields are hidden, only the getters/setters can mutate it. -- Er argh, private imports everywhere" Araq: it's faking hygiene where there isn't any, it's the typical "as long as it's beautiful it cannot be bad" feature Araq: see also "we need a more beautfiul .emit statement" disruptek: if you import a dir, we import dirname.nim. if you import a dir and no dirname.nim exists, we simply concat all files? but they are unordered. :-( disruptek: i guess we have this today without changing anything. Araq: the Go way is simply to 'include' all the files, you can do the same in Nim disruptek: that's what i'm saying. disruptek: but we could have the compiler re-order them and then you don't need a root-level `include`. disruptek: but, go gets away with that. disruptek: it'd take work that we agree the user can do instead, for us. disruptek: plus, it lets you further fracture the directory and stuff. disruptek: i like it. Araq: maybe but it's beginning to look like an entirely different feature Araq: "I want 'import dir' to work, it shall create a concat'ed file with .codeReordering inside" disruptek: it changes nothing. users just need to be taught how to best use the semantics we have. disruptek: no, i don't want that. Araq: well too bad Araq: it would be simpler to do than .privateImport disruptek: we don't need to change anything. disruptek: we just use krux02 approach; works great. krux02: what is my approach? disruptek: include everything in a file. krux02: ok krux02: yea I do that. disruptek: we are on mumble. krux02: Araq recommended me to do it krux02: ok Yardanico: xdd Elegant Beef: So prestige, i've got window selection working now, but still have not implemented `_NET_ACTIVE_WINDOW` Prestige: Nice Prestige: I'm trying to think of a way to allow a config file for keybindings Prestige: Maybe I'll just hardcore it for now and do that later Yardanico: Prestige: use cfg (parsecfg) or TOML (parsetoml) :P Yardanico: TOML is really nice and has a nim lib https://github.com/NimParsers/parsetoml Prestige: oh nice, thanks Yardanico Yardanico: parsecfg is in stdlib Elegant Beef: Look at my config.nim file and the setup proc for inspiration on how Elegant Beef: I was sorta interested in using nims as a config file but that seems silly 😄 Yardanico: well you can do that Elegant Beef: setup proc inside goodwm.nim Yardanico: just embed the vm in your app Yardanico: nimvm I mean Yardanico: and you will be able to evaluate .nims in your compiled apps Elegant Beef: Yea i intend to Elegant Beef: Looking at this for it Elegant Beef: Since i also want widgets Elegant Beef: widgets using nims* Elegant Beef: I do plan on doing the thing that will probably turn anyone away from my WM and that is forcing the usage of my status bar, although it'll be made using either nuklear or cimgui so atleast should be fairly customizable awr1: https://github.com/nim-lang/Nim/pull/13985 disbot: ➥ Make bitand, bitor, bitxor varargs-friendly awr1: by a macro, is a template sufficient? awr1: or is there something i'm missing about how varargs for-loops are implemented awr1: also i was thinking of an addition to bitops: `func bitSlice[T: SomeInteger](bits :T; slice :Slice[T])` awr1: that extracts a slice of bits and shifts them accordingly leorize: @awr1: varargs is just a syntactic sugar for openArray awr1: i see awr1: is that totally true though? because individual members of varargs can have differing types can't they? leorize: nope they can't awr1: or wait no they can't disruptek: nope. awr1: yeah awr1: because echo works by $ing them in the argument awr1: yeah i think i might make an extra PR for this, making slices work with bits awr1: i think it would make for a nicer API Recruit_main707: i have no clue how to do something like this: https://play.nim-lang.org/#ix=2iBc (sorry for all this lame questions i am asking) Araq: !rfc writeLine disbot: https://github.com/nim-lang/RFCs/issues/9 -- 3osproc: `waitForExit` can leave process object in inconsistent state (Windows) 7& 3 more... Araq: !rfc write disbot: https://github.com/nim-lang/RFCs/issues/197 -- 3Allocation free printing: remove write(a: varargs[string]) 7& 29 more... leorize: Recruit_main707: well I'm not sure what you're trying to do leorize: but fwiw `streams` let you implement interfaces like that Recruit_main707: I have a type, with a Bytes field, and I want to write something in that field, but I’d need it to be initialized, and I don’t know how to do it because it’s a field Recruit_main707: (Having the Table initialized didn’t seem to work) leorize: try not to uppercase everything first :P leorize: well fwiw I'm still not sure what you're trying to do leorize: are you porting some C/C++ code? Recruit_main707: It’s go leorize: can you give us a small complete example? awr1: what on earth leorize: the snippet doesn't compile because it doesn't have all the types awr1: i hope i screwed up something and this isn't a lexer bug Recruit_main707: leorize: sadly, I can’t right now, but the only type it’s used and not defined in there is VOffestT which is an in32 iirc Recruit_main707: It’s not very important awr1: okay it was my bad lol leorize: Recruit_main707: https://play.nim-lang.org/#ix=2iBv Recruit_main707: [self pin] Recruit_main707: So that I can search for this tomorrow morning :P Recruit_main707: Thank you zacharycarter: if you're debugging in lldb - how do you deal with templates and line numbers? zacharycarter: I mean for adding breakpoints in nim source files zacharycarter: ah you can do regex for setting breakpoints - perfect zacharycarter: Hmm - so I thought that `--exceptions:setjmp` solved my problems related to `--gc:arc` and threads but my program is intermittently crashing and whenever I run it through lldb I run into an EXC_BAD_ACCESS signal zacharycarter: I looked at the frame variables and saw there was a nimErr local which I dereferenced and the message it has was - `error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory` zacharycarter: this is happening inside `threadProcWrapper` Araq: zacharycarter, which OS? zacharycarter: Araq: macOS Mojave 10.14.6 (18G103) zacharycarter: The body of my thread function is simply `discard` Araq: zacharycarter, try --tlsEmulation:off zacharycarter: okay let me give that a shot disruptek: Araq: yeah, ima eat. have a good night; effects system seems to work, but messages are tough. zacharycarter: well that got me to a new error - will try to look more into this - thanks Araq awr1: and did the PR: https://github.com/nim-lang/Nim/pull/14016 disbot: ➥ Added bitslice operations for bitops ; snippet at 12https://play.nim-lang.org/#ix=2iBP awr1: wasn't sure if adding the non-mutating procs would be very helpful but i found it strange that they were mutating KingDarBoja: Ofc, being developed by Microsoft... that's what you get KingDarBoja: Like C# is Microsoft Java audiophile: oh I see krux02_: that is how it started audiophile: as long as it gets rid of the weak typing I'm cool with it haha companion_cube: still much better than js krux02_: KingDarBoja: C# started as a Java fork. KingDarBoja: Yeah, agreed KingDarBoja: oh krux02_: Embrace Extend Exterminate, they tried with java, got sued, and then they had to call their fork C#. KingDarBoja: Wait what krux02_: yes krux02_: they really wanted to dominate Java. krux02_: https://www.cnet.com/news/sun-microsoft-settle-java-suit/ krux02_: > Though Microsoft may clone Java, it won't be allowed to say its products are Java-compatible. KingDarBoja: Reading the article, hold on KingDarBoja: Well, although Java phrase is "Code Once, Run Everywhere", since Sun got bought by Oracle, the language has been more limited to the public on every new version Yardanico: oh nice not everyone's asleep :P Prestige: o/ KingDarBoja: 😄 Yardanico: time to continue reading this craftinginterpreters book, so far most of the stuff is not new for me (like recursive-descent parsing, lexing, etc), although scoping stuff is interesting Yardanico: also it's additional excersise to translate Java to Nim as you read the book :P Prestige: Yardanico: learning for fun? audiophile: are you interested in compilers? audiophile: compilers is the only course I nearly flukned audiophile: *flunked Yardanico: Prestige: yeah, why not Yardanico: maybe I'll make my own best (TM) language /s KingDarBoja: https://www.reddit.com/r/java/comments/a0ngus/explain_the_java_no_longer_free_for_commercial/ Prestige: I'd love to work on a language, even if it were just to learn audiophile: relevant xkcd https://xkcd.com/927/ Yardanico: so far the most surprising thing is that I'm really just using a few nim std modules Prestige: I've never gotten into anything very low level before though Yardanico: tables for the environment (scoping), strformat for formatting a few error messages, "os" for reading files, strutils for some string stuff Yardanico: but I'm still not in the end of the first part of the book where all fun (functions, classes, etc) happens audiophile: wait what book Yardanico: audiophile: http://www.craftinginterpreters.com/ audiophile: oh nice thanks! audiophile: is it good for those new to this? Yardanico: in the book you basically write two interpreters for the same language Lox, first one in Java (I'm doing it in Nim instead), second in C (I'm not sure which one to choose yet though) audiophile: ohh audiophile: are you open sourcing your code by any chance Yardanico: yes audiophile: ok :) Yardanico: I only had a bit of experience with recursive descent before reading the book (https://github.com/Yardanico/nim-mathexpr/), but it's quite interesting KingDarBoja: ❤️ Dart audiophile: so this book might give you more ideas for your nimexpr KingDarBoja: Like the Google TypeScript but without JS cons Yardanico: My source is in https://github.com/Yardanico/nim-lox , there is also https://github.com/cabhishek/nimlox but I don't look into it because I want my own implementation :) Yardanico: you might compare them both but mine's not complete yet since I only completed chapter 8 audiophile: ah that's ok! audiophile: I star your repo because I will follow closely >_> audiophile: why interpreter? because it is easier than writing a compiled language? KingDarBoja: I did the same cuz I like Yard Yardanico: audiophile: well kinda yeah audiophile: ah ok audiophile: but it should still help understand what makes nim tick right? audiophile: at least to some extent Yardanico: yeah Yardanico: AST and stuff audiophile: NICE Yardanico: although later in the book you implement a bytecode compiler and a VM audiophile: I've been emailing senior devs around asking for help on how to approach this audiophile: VM meaning something like the jvm? audiophile: kinda Yardanico: audiophile: well, not that advanced Yardanico: more like in CPython audiophile: kinda :) audiophile: oh :( Yardanico: or NimScript I guess Yardanico: nim compiler has an embedded VM too Yardanico: for running nim at compile-time audiophile: I'm a bit fuzzy on compiling etc so I'm lost here ? companion_cube: how do I make an openArray from a `ptr T` and a length? Yardanico: companion_cube: openarray is not a concrete type Yardanico: meaning you can't create variables of this type companion_cube: oh, it's only for arguments? ok Yardanico: it's meant to be used when you want some routine to accept different container types like seqs/strings/arrays companion_cube: I actually just want to print the pointer's content companion_cube: for debug purpose Yardanico: well you can cast it to UncheckedArray companion_cube: how do I set the length though? Yardanico: you don't :P audiophile: what you mean by concrete type audiophile: builtin/ audiophile: ? companion_cube: Yardanico: so that doesn't help me putting my ptr+len into a `fmt"…"` :D Yardanico: companion_cube: you can cast to UncheckedArray and make a seq out of it Yardanico: like for i in 0.. Latest, I did `choosenim update self` first. nerdrat[m]: I think is `v0.6.0` leorize[m]: what does `nim --version` give you? nerdrat[m]: ``` Yardanico: nerdrat[m]: it got stripped in IRC Yardanico: we can't see :P just tell the version and (possibly) the hash leorize[m]: please don't use the reply function in matrix leorize[m]: the IRC way is to just mention people nerdrat[m]: Ok it is 1.2.0 leorize[m] leorize[m]: hmm, you're on the latest leorize[m]: what's your nimble version? leorize[m]: `nimble --version` nerdrat[m]: v0.11.0 leorize[m]: ping dom96, shashlick nerdrat[m]: I also cleaned the cache leorize[m]. leorize[m]: I've no idea why it doesn't work then, hopefully the choosenim authors I pinged will have some ideas nerdrat[m]: The issue in github is closed, I don't know what else can I do. leorize[m] leorize[m]: you don't have to ping me for every message :P leorize[m]: can you link the issue here? nerdrat[m]: Sorry nerdrat[m]: https://github.com/nim-lang/nimble/issues/693 disbot_: ➥ Document how to recover from corrupted nimble cache ; snippet at 12https://play.nim-lang.org/#ix=2ilH leorize[m]: can you try to compile a file with just `import strformat`? nerdrat[m]: It gives me the same error using `nim c -r myproject.nim` nerdrat[m]: `Error: cannot open file: strformat` leorize[m]: looks like your nim installation is botched leorize[m]: can I have the output of `nim dump`? leorize: try reinstalling nim then leorize: your nim installation seems to be corrupted disruptek: nimph includes a working choosenim, fwiw. disruptek: !repo nimph disbot_: https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 59⭐ 4🍴 7& 1 more... nerdrat[m]: I simply delete the `.choosenim/toolchains/nim-1.2.0/` or how can I reinstall nim with choosenim? leorize: `choosenim stable`? leorize: I'm not sure, I don't use choosenim nerdrat[m]: Dammit! I'll select another toolchain that works and then I'll delete the toolchain directory of nim-1.2.0. nerdrat[m]: I hope this doesn't break anything else disruptek: what is choosenim buying you, here? shashlick: Common disruptek, not this again disruptek: what? disruptek: you think i put this user up to this? shashlick: Quit your bashing disruptek: quit trying to justify poor software behavior. disruptek: oh, actually you aren't doing so. or helping the user. my bad. shashlick: Gosh, way to inspire disruptek: i agree. i'm tired of merely accepting the status quo. disruptek: i wish you were, too. shashlick: nerdrat: agree with leorize, would have helped to see contents of the lib directory shashlick: Seems like an extraction issue of some sort with nimarchive Zed: this may get a biased answer, but how do you guys find nim against crystal?, im wanting to learn one or the other disruptek: depends on what you want to write. nerdrat[m]: Crystal is a bloated ruby copy Zed: more embedded things, raspberry pi etc.. Zed: why do you say that? disruptek: i don't really think crystal is comparable for that. leorize[m]: crystal leans a bit further on the application programming spectrum than we do nerdrat[m]: leorize[m]: Reinstalling nim-1.2.0 didn't work disruptek: i'm trying to think of anyone in the nim community that writes crystal, but i'm drawing a blank. Zed: lol, what would say nim is best used for? Varriount: leorize: I like to think Nim is suitable for application development too shashlick: nerdrat: can you check the lib directory for contents nerdrat[m]: I checked `strformat.nim` is where it should be. nerdrat[m]: inside the `pure` directory shashlick: does it have anything in it shashlick: well, the error says file not found so hm shashlick: can you zip the entire folder and post it somewhere disruptek: nim is like a more elegant python that is hugely performant and has the chops to compete with lisp in terms of abstraction. nerdrat[m]: yes 713 lines of nim code KingDarBoja: Hold my beer disruptek: i think crystal is a supercharged ruby. if ruby is what you want, crystal lets you make it run faster. zacharycarter: does crystal have windows support yet? Zed: nope disruptek: it has no place in my toolbox, so i can't speak on it much. no, no windows support afaik. zacharycarter: yeah - still not interested in it then Zed: the only way you can get windows support is if you run a linux subsystem zacharycarter: probably won't be when it does shashlick: also can you zip the ~/.choosenim folder (without toolchains) zacharycarter: I like Nim - and Nim is getting better afiact zacharycarter: afaict KingDarBoja: No windows = Not my interest shashlick: presuming you are on linux Zed: crystal seems to have more libraries for it then nim does disruptek: you have to understand that nim boils down to really simple C that can be compiled and run anywhere, very quickly. simple C that is infinitely portable and offers little undefined behavior. zacharycarter: yeah but extending Nim's ecosystem is simple zacharycarter: just find a comparable C/C++ library and write bindings to it disruptek: does crystal compile to javascript? Yardanico: disruptek: well crystal uses LLVM and LLVM isn't exactly bad at portability between popular OSes zacharycarter: Windows is pretty popular zacharycarter: and Nim has nlvm Yardanico: Zig works on most major OSes which support LLVM fwiw Yardanico: linux, macos, windows, freebsd, netbsd, and probably others if you can compile llvm on them disruptek: i think my dad uses windows. it's blue, right? zacharycarter: yeah but Zig is extremely immature and doesn't have async or netcode yet Yardanico: zacharycarter: it does have async though zacharycarter: a preliminary release of it Zed: I think V is a better zig Yardanico: no zacharycarter: I think V is vaporware disruptek: lol Yardanico: pls don't bring V into discussion Yardanico: disruptek: btw glad to see you back :P disruptek: zig is a legit v, maybe. Zed: why not? disruptek: Yardanico: o7 Yardanico: because V is overhyped zacharycarter: because the V author makes bold claims that never end up being accurate disruptek: it's nothing. disruptek: no rule. Yardanico: also V is a good example of why github stars are useless disruptek: no role, rather. zacharycarter: If you want to compare all these languages - my suggestion - try to build something with them zacharycarter: then you'll have something to back your speculation disruptek: good advice. zacharycarter: I've tried doing what I do with Nim with Zig and I hit major roadblocks Zed: what would your default project be? zacharycarter: I can't use Crystal because there's no windows support Yardanico: well yeah I know Zig stdlib is really undocumented and there's no real network facilities yet zacharycarter: a game that doesn't use SDL2 zacharycarter: for instance, with Nim I have this working right now - https://imgur.com/a/ExIVYLm disruptek: i wrote a crossword solver as my first nim project. Chiqqum_Ngbata: I began working on a project in nim and was doing this sort of comparison myself. Zig was appealing until I realized it wasn't at all documented (it is now but at the time it wasn't) zacharycarter: doesn't look like much but I'm using sokol_app, sokol_gfx, cr (For hot reloading plugins) and physfs Yardanico: yeah I tried writing some simple stuff with zig Yardanico: https://github.com/Yardanico/zig-osureplay and a version of my recursive-descent math evaluator (it got lost when I cleaned my home partition though) Yardanico: I like cross-compilation in Zig so you don't have to build the cross-compilers yourself :P and you can already use it with nim Chiqqum_Ngbata: Nim probably fits (personal opinion) a similar niche as Python; good for glue code, super readable, but obviously performs much better out of the box. Much more mature than Zig Yardanico: yeah Yardanico: Nim is the sweet spot between performance and code readability ;) disruptek: i don't zig ever achieving the abstractions we can with nim's metaprogramming, though. disruptek: it's a better C, sure. Yardanico: yeah, Zig is against all that disruptek: but we don't need another C. Yardanico: Zig's main goal is to be as explicit as possible :P Chiqqum_Ngbata: I've enjoyed Nim in general. Some parts have felt hostile but I actually have a theory that weird warts is probably a good sign that there is less aversion to experimenting, and is ultimately a good thing zacharycarter: you can avoid cross compilation with Nim using nlvm too Yardanico: "There is no hidden control flow, no hidden memory allocations, no preprocessor, and no macros. " Yardanico: zacharycarter: well but Zig just acts as a C compiler (it bundles clang) Yardanico: also it's a pretty small download for what it has Yardanico: well, not clang, but libclang KingDarBoja: https://www.slant.co/versus/395/5522/~nim_vs_rust Random comparison link disruptek: pretty heavy though, when you think about it. KingDarBoja: Oops, wrong link Yardanico: @KingDarBoja see https://www.slant.co/topics/6032/~systems-programming-languages btw disruptek: just ask yourself what these languages are going to be doing in 10 years. KingDarBoja: Thank you 😄 Zed: nims at the top with the big boys Zed: that's good Yardanico: yeah I added quite a lot of pros a few years ago :D Yardanico: "Tiberium" there is me Chiqqum_Ngbata: Unfortunately I don't really see a clear path to adoption for Zig. Rust serves basically the same niche, has significant features Zig doesn't, and Zig isn't radically simpler--common Rust complaint KingDarBoja: _No big name backer_ as cons Yardanico: yeah ikr KingDarBoja: Oh boy, there is Elixir KingDarBoja: 😄 But I find the lack of distinction between the "system" programming category distrubing Yardanico: yeah Zed: what about micro python? Yardanico: what about it? Zed: or is that basically nim but worse KingDarBoja: I didn't expected Golang to be really focused on system leorize: python is always nim but worse :P Yardanico: that's entirely different from nim KingDarBoja: As I pretty much heard it being used mostly for backend stuff Yardanico: micropython is python for microcontrollers KingDarBoja: Whereas Rust is the big one for embedding and stuff like that Yardanico: and it's not the best option if you want your microcontrollers to be fast :P KingDarBoja: Python is the big one besides Javascript for most stuff nowadays KingDarBoja: As again, the syntax and the HUGE community and libraries has made it so popular leorize: IMO languages with fibers kinda restricted themselves from approaching low-level KingDarBoja: But ofc doesn't mean it is the best Zed: i see go mentioned alot KingDarBoja: And where is my boy Dart KingDarBoja: 💔 leorize: Dart is DOA KingDarBoja: DOA? leorize: google is desperately trying to keep it afloat with Flutter leorize: dead-on-arrival KingDarBoja: Ahhh KingDarBoja: Well Flutter seems very comfortable to work on KingDarBoja: Too bad it is only mobile mostly Chiqqum_Ngbata: I think Flutter has a chance. It will become much more appealing if Fuschia sees daylight KingDarBoja: But I find Dart like the TypeScript-brother shashlick: nerdrat[m]: just tried installing choosenim and running the strformat test 25 times locally in a loop, no luck reproducing the issue so anything you can share will be helpful KingDarBoja: But hey leorize: nerdrat[m]: can you post the full output of running `nim c thing/that/import/strformat.nim`? KingDarBoja: Ruby has been on DOA if it were by ROR Zed: why doesn't google just merger fuchisa and android? Zed: *merge leorize: they can't KingDarBoja: Sounds easy, but doesn't leorize: they are fundamentally different leorize: actually they can leorize: they're google, they have the resources to put things together leorize: the blocker might just be that fuchisa is not ready yet Yardanico: well yeah, but they started Fuchsia to have a platform they can have full control of :P KingDarBoja: Well what about V? I remember the Odin author blaming its perfomance Yardanico: a lot of false claims leorize: V stands for vaporware Yardanico: As I said before the only good V is https://github.com/belamenso/v KingDarBoja: WTF Yardanico: ok gonna continue my interpreter , need to figure out how to add break statement :P Yardanico: @KingDarBoja I've also made a fork of it https://github.com/Yardanico/nim-emojify Yardanico: it uses different emojis instead of V KingDarBoja: looool Yardanico: took me a while to figure out how it works the first time I looked at the src tbh KingDarBoja: https://github.com/vlang/v/issues/35 Zed: https://www.emojicode.org/ disbot_: ➥ This language is not as advertised ; snippet at 12https://play.nim-lang.org/#ix=27la Yardanico: @KingDarBoja well right now they try to fix things Yardanico: like they actually have a proper AST now (they didn't until start of 2020 or something like that) Zed: emojicode is the future guys Yardanico: yes Yardanico: time to write nim -> emojicode compiler Zed: it's how the egyptians coded on their walls Yardanico: and they funniest thing is that it's fast Yardanico: written in C and compiles to native code with LLVM KingDarBoja: I do rather let V evolve KingDarBoja: As everything has its own peaks and falls Yardanico: also see https://andrewkelley.me/post/why-donating-to-musl-libc-project.html about some V language drama Yardanico: article by author of Zig leorize: to be fair after their marketing stunt I don't really trust V anymore leorize: not that I ever trusted their magical claims Zed: V has a sponsor now as well Yardanico: who Yardanico: i'll find them' KingDarBoja: The Doom Guy Zed: https://www.mx.com/ Zed: some finance company leorize: V has more sponsors than Nim + Zig before it even release :) Zed: it's actually a front Zed: the company is also vaporware Yardanico: leorize: well if Nim development started in 2015+ 4raq could've done the same hype thing :D KingDarBoja: Idk but sponsors seems to be hard to earn as they will try to push things faster on the worst case (?) Zed: pretend you have a sponsor to draw more sponsors in Yardanico: big brain Zed: well anybody can setup a website and a product, doesn't mean it's real Yardanico: ah yeah I also remember how V author did twitter polls to decide on language syntax leorize: Yardanico: well you can try to find the original marketing of Nim in the Lazarus forums Yardanico: yeah I know it was like Pascal++ or something initially :P Yardanico: and I also know the compiler was in object pascal leorize: well let just say that the pascal people wasn't happy with Nim :P leorize: 4raq said the forum only spread FUD about Nim KingDarBoja: FUD? Yardanico: wow http://nimrod-lang.org/ still works Yardanico: "FUD is an acronym for fear, uncertainty and doubt. " zacharycarter: https://github.com/vlang/v/issues/35 disbot_: ➥ This language is not as advertised ; snippet at 12https://play.nim-lang.org/#ix=27la Yardanico: well yeah some of these are fixed but generally it's true zacharycarter: yes Yardanico: I guess it's time to make my own language called V++ XDDDD Yardanico: also I wonder why would you ever release an UI lib for your language in GPLv3 https://github.com/vlang/ui Yardanico: meaning that all apps which use it must be open-sourced leorize: they are a FOSS advocate :P zacharycarter: also lol at that UI lib's syntax Yardanico: also what is this "verified" symbol https://github.com/vlang Yardanico: can nim org get it too? :P ask github support pls zacharycarter: or interface rather Yardanico: https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/verifying-your-organizations-domain huh zacharycarter: so much nesting zacharycarter: that's about the only thing they can verify when it comes to vlang Yardanico: probably the "best" thing is that the docs mention Yardanico: "(Work in progress) There's no garbage collection or reference counting. V cleans everything up during compilation. If your V program compiles, it's guaranteed that it's going to be leak free." disruptek: hey, it's only been a year. disruptek: give them a break. Yardanico: well anyway I wonder how they'll implement this memory management model Yardanico: when they have raw pointers disruptek: maybe they'll figure out how to pivot to some other absurd claim in the next year. KingDarBoja: I see Volt being mentioned but no idea how that related to Vlang leorize: "V is the first language to use machine learning to provide leak-free memory safe code" zacharycarter: lol Yardanico: Volt is a multi-service chat client *supposedly* written in V and *supposedly* using vlang's UI lib disruptek: V is the last language to use machine learning. KingDarBoja: Also, didn't know there was so much criticism on V but ofc, it is better to not trust because scammers could show up kungtotte: They're working under the Dorothy model of software development where they make a claim, click their heels three times and wish for it really hard Yardanico: @KingDarBoja it would not receive critisicm if it didn't make very ambitious claims when it was in pre-alpha state KingDarBoja: Yeah, I think the guy lost the focus and got too cocky KingDarBoja: But let's see how it goes disruptek: shashlick: just how many pairs of ruby slippers do you have in your closet? kungtotte: I wonder how they're going to achieve hot code reloading since so many features depend on compiler magic KingDarBoja: But holy cr*p that's a lot of money on patreon Yardanico: just for a simple example of ambitious claims Yardanico: https://github.com/vlang/gitly Yardanico: very nice repository shashlick: just sold my favorite pair a week ago on Craigs disruptek: damnit. KingDarBoja: Machine Learning Scam = Siraj Raval KingDarBoja: Lol wtf that vlang repo Yardanico: ok lets stop talking about it already :P Yardanico: we have nim :) disruptek: i heard there's a new package manager for nim where bugs aren't just fixed, they also inform features and growth in the compiler and the ecosystem as a whole. Yardanico: disruptek: wow how much does it cost?! disruptek: my bad. it's not new. Yardanico: @KingDarBoja nim at home: Object Pascal KingDarBoja: LOL disruptek: people have been using it for six months and there have only been like 3 bugs reported. KingDarBoja: Someone should start making Nim memes and share at offtopic Yardanico: https://github.com/nim-lang/Nim/commit/405b86068e6a3d39970b9129ceec0a9108464b28 Yardanico: for first commit in nim git repo Yardanico: and yes its object pascal Yardanico: although a lot of stuff looks the same as it is today :) Yardanico: most of the core language didn't change since then Yardanico: hmm I actually got curious, gonna try to compile it Yardanico: nimrod 0.2.1 version Yardanico: had to patch it a bit (change shell -> fpsystem since "shell" got removed in FPC) but it worked Yardanico: it actually compiled Yardanico: "Nimrod Compiler Version 0.2.1* (2020/04/17 05:39:30) [Linux: amd64]" Yardanico: wait what leorize: Yardanico: 4raq wrote pas2nim for a reason Yardanico: leorize: xddd leorize: yep, a lot of the code in the current compiler can be traced directly to the pascal code Yardanico: i know that :) really facsinating stuff KingDarBoja: Awesome KingDarBoja: Yard, how old are you mate? Yardanico: I turned 20 today :D KingDarBoja: I think I asked that before, right? KingDarBoja: OH KingDarBoja: Happy Birthday disruptek: older now. Yardanico: thanks leorize[m]: happy cake day KingDarBoja: Someone make a Nim cake and put him a Crown disruptek: 👑 leorize[m]: 🎂 👑 KingDarBoja: Can we have a Nim emoji on Discord? Yardanico: I'll try to add nim crown now leorize[m]: looks like Nim is not only consisted of old people :P Yardanico: @KingDarBoja :nim1: KingDarBoja: Ewww KingDarBoja: Better the goldish crown KingDarBoja: Hold on Yardanico: the one on the website? KingDarBoja: https://raw.githubusercontent.com/vscode-icons/vscode-icons/master/icons/file_type_nim.svg?sanitize=true Yardanico: yeah that's the website one Yardanico: https://nim-lang.org/assets/img/logo.svg KingDarBoja: Yeah, svg 32x32 for ya, Prestige: Is there a way to assign a variable to an iterator at the top level of a module? Yardanico: svg doesn't have a size Prestige: er assign an iterator to a variable* Yardanico: well you can do that, yes KingDarBoja: Viewport if you wish leorize[m]: yes you can, the syntax is weird though KingDarBoja: And maybe the nimble box? 😄 leorize[m]: note that us IRC users can't see your custom emojis Yardanico: yeah KingDarBoja: Oh :/ Prestige: I can see them O.o Yardanico: you can see the text Yardanico: they're icons on discord Prestige: https://0x0.st/iQUw.png leorize: those are just unicode emojis leorize: custom emojis are stuff like this :nim1: KingDarBoja: What chat is that? IRC? leorize: we can't see it, it's just text leorize: that's weechat leorize: customized I think KingDarBoja: I love how we moved from E-v-il topic into emojis Yardanico: :nim1: KingDarBoja: Awesome! KingDarBoja: Much better than the black-gold one Prestige: leorize: what was the syntax? I'm trying to do something like https://play.nim-lang.org/#ix=2im0 disruptek: ~araq Yardanico: we have a real king who goes by the name of 4raq :P disbot_: araq: 11👑 the powers that He 👑 -- disruptek Yardanico: @KingDarBoja :nimble: Prestige: oh you all meant the :text: leorize[m]: Prestige: https://play.nim-lang.org/#ix=2im2 Yardanico: Prestige: on discord it's like this https://i.imgur.com/boZQxEH.png Prestige: ah Prestige: come join us on irc Yardanico :P Yardanico: well I'm everywhere leorize: he is on irc disruptek: only chumps use irc. Yardanico: nim forum, nim discord, nim gitter, nim telegram, nim github Prestige: rip well all the discord folk come over Yardanico: Prestige: well discord is more and more used for nim :) KingDarBoja: nim whatssap? KingDarBoja: Xd KingDarBoja: NVM Yardanico: Nim server has 820 members as of now, but most of them are not really active leorize[m]: if I use matrix to bridge discord here, then everyone from discord will appear as irc users :P Prestige: leorize[m]: that's interesting about the iterator example Prestige: can we just not specify the type? Yardanico: of course? Yardanico: nim supports automatic type interference leorize[m]: do specify the type if you have overloads though Yardanico: you only need to use types in proc declaration/type declaration, in most other places it can be omitted Yardanico: well you also need to specify them with generics Yardanico: btw "auto" exists :P Yardanico: and yes it can be even used for proc arguments Prestige: I actually have a type/class that has the iterator as a member so I was hoping to type it, just curious how you'd write a type for that example leorize[m]: Prestige: https://play.nim-lang.org/#ix=2im6 leorize[m]: or easier, just `echo typeof(variable)` and you'll know what to put in there Prestige: ah I see, thanks leorize[m]: closure iterators are really weird leorize[m]: https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators leorize[m]: take note of that before using them KingDarBoja: A offtopic question (as most of you guys are on IRC) KingDarBoja: Do you guys have a system engineer degree or something related? KingDarBoja: Just curious leorize: i don't have any degree Yardanico: I'm 2nd year in uni (CS) KingDarBoja: Noise, now I am feeling old here xD Yardanico: how old are you? :P KingDarBoja: 26 leorize[m]: don't worry, we have our share of old people here too leorize[m]: I think KingDarBoja: No CS degree, only electronics & mechanical engineering Prestige: no degree, 25 and work as a software engineer Yardanico: ok now I have to figure out how to add break statement to my Lox interpreter (it's an exercise in the book) KingDarBoja: Pushed into soft dev because no jobs for me Prestige: trying to cross over from JS land KingDarBoja: Awesome Presti KingDarBoja: IMO, JS land is blessed with TS KingDarBoja: Ofc not perfect Prestige: Yeah, I just spend a while writing documentation for TS so our company can switch over leorize[m]: nah, JS land is blessed with Nim :) Prestige: just got approved by the VP this week Prestige: Anyone writing JS using nim? I'm curious how nice it is to work with Yardanico: well there's karax for SPA but I didn't try it leorize[m]: I did write an app with it, but I'm not a frequent user Yardanico: nim forum frontend is in Nim KingDarBoja: karax ~= angular (?) leorize[m]: alehander92 uses the JS backend a ton IIRC KingDarBoja: ohhh leorize[m]: according to an outdated benchmark, karax is lighter and faster than all major frameworks Prestige: that's pretty awesome KingDarBoja: x2 KingDarBoja: Hopefully Nim will not have tons of libraries like JS on npm does KingDarBoja: I mean, unnecessary, out of maintenance libraries leorize[m]: we don't have unnecessary, but we do have rotting libraries Yardanico: my interpreter is finally turing complete :D https://github.com/Yardanico/nim-lox/blob/master/examples/testloop.lox Prestige: Reading about methods vs procs, methods are preferred for new object types right? Also looks like it requires a base pragma, now Yardanico: not really leorize: method and proc are different things leorize: you can't compare them Yardanico: the preferred is still "proc" unless you need runtime dispatch Yardanico: what warning? Yardanico: about --multimethods:on ? Prestige: ah I see, thanks KingDarBoja: I think it was that, can't remember KingDarBoja: But pretty much I use procs everywhere Yardanico: yeah, me too Yardanico: there are object variants too KingDarBoja: Even when I code Python stuff, I started to use proc isntead of def Prestige: Cool, just want to make sure I'm using best practices Yardanico: I use them in my interpreter KingDarBoja: Best practices is relative Yardanico: https://nim-lang.org/docs/nep1.html for style guide btw Prestige: sweet KingDarBoja: But if someone with a good background suggest you something, better follow it KingDarBoja: Okay I am writing non-sense Yardanico: this style guide also has a pretty good table of name conventions for identifiers disruptek: prefer object variants to methods. Yardanico: like initT, newP, find, contains, add, etc disruptek: er, s/methods/object inheritance/. leorize: https://nim-lang.org/docs/apis.html Yardanico: yeah this table Prestige: how have I not stumbled upon that link leorize: iirc there were talks about removing methods and replace them with a macro disruptek: strongly doubt that'd happen. disruptek: but i expect dispatch performance will improve. disruptek: i used to think that multi-methods were cool, and why would i not want that flexibility if it's supported? now i think it's pretty much a misguided feature. KingDarBoja: I think I have followed everything except this disruptek: probably i just need to encounter fewer inheritance bugs. disruptek: use `result = something` instead. KingDarBoja: I know, but used to return instead disruptek: i almost never use return. prefer block: result = ... ; break disruptek: it works, it's just code smell imo. disruptek: style nit. leorize: yep I also prefer `result` disruptek: when you use result instead, you provide the ability to inspect the result at the bottom of the scope or add control flow there at a later date. leorize: though it's a habit from my days of using pascal disruptek: lean on block. it's awesome. especially named blocks. leorize[m]: `return` is like `goto` zacharycarter: what if you need to exit eraly from a function? zacharycarter: early* leorize[m]: it breaks your reading flow zacharycarter: how do you avoid return? leorize[m]: zacharycarter: structure it so that you don't have to, or use it if you can't disruptek: break a block. zacharycarter: I don't get the breaking a block thing KingDarBoja: `break` leorize[m]: nim-style goto zacharycarter: no I get that disruptek: block found: for i in 0 .. 10: if foo[i]: break ... echo "not found" zacharycarter: I know what break does and what a block is, I just don't understand how this helps KingDarBoja: But being serious, I don't see harm on using return KingDarBoja: But ofc, newbie here disruptek: when you break a block, you skip the remaining statements in the block. zacharycarter: ah okay zacharycarter: so just wrap the entire proc body in a block essentially leorize[m]: KingDarBoja: well there aren't any harm, but the reading flow is better when you use `return` less disruptek: zacharycarter: yes, though obviously there are exceptions when that's just plain silly. zacharycarter: yes zacharycarter: but I now understand thanks disruptek: i err on the side of silly. 😁 KingDarBoja: I don't get the idea, sorry Yardanico: @KingDarBoja with "result" you don't "return" disruptek: when you break the block, you haven't returned from the proc. Yardanico: so the compiler is free to add whatever it wants at the end of the proc leorize: Yardanico: it's not something for the compiler :P disruptek: so after the block, you can add some inspection or debugging or w/e. KingDarBoja: Ah ok KingDarBoja: That's sounds useful KingDarBoja: Ofc when needed disruptek: https://github.com/disruptek/nimph/blob/master/src/nimph/project.nim#L403 disruptek: i use return in something like 8% of my procs. you see block all over my code. disruptek: that's an example of a simple and efficient exploit of the semantics for a typical found/unfound scenario. disruptek: https://github.com/disruptek/nimph/blob/master/src/nimph/project.nim#L540 -- nested named blocks KingDarBoja: That's seems very golang-like KingDarBoja: But nice leorize: nim blocks are `go to` but a bit better KingDarBoja: Ok, that last one is another level disruptek: they open new scopes. Prestige: Going to push some code soon, would anyone mind reviewing it? Not many lines yet leorize: sure, just post it here :) KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/parser.nim#L867 me ~abusing~ using return leorize: nah, that's not abusing return Prestige: Thanks! - https://github.com/avahe-kellenberger/nimdow/tree/development leorize Prestige: It will eventually be an actual window manager leorize: https://github.com/alaviss/nim.nvim/blob/master/indent/nim.vim#L95 <- this is abusing return disruptek: converters will hurt you in the end. Prestige: ah what's wrong with converters? leorize: I take literal days to fix a bug in that indent plugin KingDarBoja: I will give you a star 😄 leorize: so I wrote a better one: https://github.com/alaviss/nim.nvim/blob/indent-rewrite/indent/nim.vim#L169 leorize: Prestige: they have the weirdest semantics in Nim :) disruptek: there are basically two uses of converters that i can get behind. leorize: they apply when you don't want them to, and they don't apply when you want them to KingDarBoja: Holy cr*p, that's a lot of if-else disruptek: 1) grandfathering types; convert new to old, vice-versa. leorize: @KingDarBoja: yep, but now everything is structured and you can follow the code leorize: in the older version `return` was literally `goto` leorize: esp when vimscript hinders your ability to follow code by 150% disruptek: hmm, i cannot remember my second use of converters. Prestige: Should I just manually cast instead of using a converter? disruptek: help me out, leorize. disruptek: cast is unsafe. use foo.int32 or int32(foo) Yardanico: Prestige: you don't need to specify "void" btw leorize: https://github.com/avahe-kellenberger/nimdow/blob/development/nimdowpkg/event/xeventmanager.nim#L17-L19 <- this is weird syntax Yardanico: as I said before Prestige: Yeah I just like the verbosity cuz of old habbits Yardanico: Prestige: oh, in the link above you don't need () Yardanico: the one leorize shared leorize: disruptek: sorry, I used converter once to try to mimic "object composition" and I'm scarred for life Yardanico: term rewriting macros are still more fun than converters though :DD Prestige: Yeah, I kind of like having the separation disruptek: i prefer my iteration with .items or .pairs to name those procs explicitly, but that's another style nit. Prestige: maybe I'll just use a blank line instead leorize: yea, a blank line is what people usually use disruptek: https://github.com/avahe-kellenberger/nimdow/blob/development/nimdowpkg/event/xeventmanager.nim#L29 leorize: ah, there it is, the evil use of return disruptek: araq makes a good case for removing the return and inverting the if clause so it dominates the body of the proc. Prestige: What do you mean by inverting the if clause? disruptek: if e.theType in this.listenerMap: ..do things.. Prestige: I usually return early to avoid a bunch of nesting leorize: I think the `if not something: return` pattern was shepherd to people by C-family of language disruptek: i used to code that way. disruptek: i got better since i came to nim. Prestige: What changed your mind about it? disruptek: i still use block: if x: break if y: break if z: break sometimes. disruptek: but i almost never use `continue`, either. it's sloppy. disruptek: araq's point is that it helps the reader understand the nesting. leorize: for me, turns out a bunch of nesting works better when you read the code than a return Prestige: I think returning early makes it easier to read disruptek: the problem is that you have to remember everything that the if clause is NOT. disruptek: by the time you get half a page down, it's hard to see what's in play. disruptek: easy for the author, hard for the reader. leorize: https://github.com/alaviss/nim.nvim/blob/master/indent/nim.vim#L95 <- exactly what happened here Prestige: Hm I always thought it was easier to read 🤷 leorize: I `return` so much I can't even follow my own code :P Prestige: although I like to make my functions very short disruptek: it's subjective, of course. disruptek: i'm just telling you that i changed my style recently. disruptek: also, i'm old. leorize: well, you'll understand once you got hit by it :) Prestige: I used to program the other way but switch a few years ago Prestige: switched* Prestige: Anyway thanks for the feedback - guess most of it looked correct at least lol leorize: remove all the `: void` please :) disruptek: i don't like a lot of nesting, either. i also almost never have multi-line if clauses. leorize: I hated nesting until I implemented code folding in nim.nvim :) disruptek: i want to see how big procs are. disruptek: i don't want to forget what's inside. KingDarBoja: https://imgur.com/Cmv8yiR disruptek: king i'm looking at your language parser. disruptek: you realize that #[]# is not a doc comment, right? KingDarBoja: WHAT disruptek: ##[]## disruptek: #[ is the multi-line version of # KingDarBoja: 🤦 disruptek: try multi-line let and var blocks. you might like them. KingDarBoja: Thanks for the review, didn't know I was wrong disruptek: also, they are nicer to read and have less impact on a diff. KingDarBoja: Ah yeah, I think Rika said the same about AST type disruptek: about what? KingDarBoja: I mean, using a single one for all disruptek: oh, yeah. KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim Look at this, scroll down a bit 🌱 leorize: Prestige: https://github.com/avahe-kellenberger/nimdow/blob/development/nimdowpkg/event/xeventmanager.nim#L6-L10 <- can share the type block leorize: https://github.com/avahe-kellenberger/nimdow/blob/development/nimdowpkg/event/xeventmanager.nim#L13 <- unneeded `return`, though this is subjective Yardanico: btw it's actually pretty fun to help people learn nim :P Yardanico: e.g. see https://github.com/wiremoons/weather-nim/pull/2 disbot_: ➥ A lot of changes KingDarBoja: Oh ffs, my internet is trash, I can't wait for the monday to get new ISP provider Yardanico: although this PR is subjective too of course Prestige: Thanks leorize :) leorize: Prestige: I'd have to warn you that the `eventPoller` might not work the way you'd like it to leorize: closure iterators are expensive Prestige: was just about to read a link about closure iterators - what would u suggest, just a normal iterator? leorize: read it first then decide if you wanna use it leorize: I feel like you don't need this, though I've never written any WM Prestige: just by the definition of an inline iterator, that sounds better disruptek: usually we say newLocation() to alloc a new Location and then initLocation() to do some setup logic on it. leorize: we use `create` for `ptr` and `new` for `ref` respectively disruptek: you can simply result = Location(start: startToken.start, ...) Yardanico: btw guys, a PR from the dark times of Nim https://github.com/nim-lang/Nim/pull/2849 disbot_: ➥ Feature #2811 hump, snake and now dash Yardanico: apart from allowing unicode in identifiers it added ability to use unicode dash symbol in identifiers Yardanico: (it got removed later though) leorize: are you diving the history of nim? :P Yardanico: was searching for "norecurse" in Nim, stumbled upon https://irclogs.nim-lang.org/10-01-2018.html and it turns out I actually saw this issue myself 2 years ago KingDarBoja: disruptek: you reviewing it? disruptek: i mean, i was. KingDarBoja: oh Yardanico: https://github.com/nim-lang/Nim/issues/2811 is the #2 commented issue in nim repo right now disruptek: this kinda thing is pretty painful: disbot_: ➥ Unicode dashes as "lisp'ish" alternative to hump and snake notation disruptek: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L25 KingDarBoja: 🙈 disruptek: 😄 Yardanico: the #1 being https://github.com/nim-lang/Nim/issues/8363 disbot_: ➥ Rework Nim's exception handling ; snippet at 12https://play.nim-lang.org/#ix=27OQ KingDarBoja: Remember, it is a 1:1 port so I do it like a python guy leorize: we are still working torward that proposal disruptek: i get it. read some small projects to get ideas. KingDarBoja: ofc I will improve my code disruptek: everyone starts as a newbie. disruptek: i am hesitant to recommend any of my smaller stuff because my style has already improved. disruptek: and of course there's dogshit in my larger work, too. Prestige: leorize: I think this may be better in general: https://play.nim-lang.org/#ix=2imm disruptek: nim is very forgiving, though. Yardanico: Prestige: you don't need to inherit from RootObj for XEventManager Yardanico: you only need to inherit from RootObj if you want to inherit from your own object later KingDarBoja: I know, I have been collecting suggestions on some text file Prestige: Oh nice, thanks KingDarBoja: And I will improve the code, just rushing the port a little bit disruptek: cool. KingDarBoja: Btw, I haven't pushed latest features KingDarBoja: Been dealing with the GraphQLError class to see what's need disruptek: ima use that shit when it's done, btw. KingDarBoja: But ended up writing extra utils as needed disruptek: it will go into nimph for actions support. KingDarBoja: Also, got accepted into the Graphql-python org yey disruptek: github actions. Yardanico: by the way I found a good way to format floats so they don't have ".0" if they don't have a floating-point part :P Yardanico: formatBiggestFloat(ffDecimal, -1) and then trimZeros on that variable disruptek: i just email my floats to timothee for print-out. Yardanico: lul KingDarBoja: lol Yardanico: i use it for my interpreter since it only has floats for numbers KingDarBoja: Oh just tested the let indent disruptek: wut KingDarBoja: This is some good stuff Yardanico: disruptek: http://www.craftinginterpreters.com/ disruptek: https://github.com/disruptek/gittyup/blob/master/gittyup.nim disruptek: this thing is pretty cool, but it never could have been written without shashlick's nimterop. his work is the backbone of too many projects. we need insurance on him, i think. disruptek: also, `once()` is a cute template to know about. Yardanico: disruptek: what's it for? Yardanico: oh found Yardanico: "Executes a block of code only once (the first time the block is reached)." actually pretty nice, yeah Prestige: hm seems weird that the bitops functions don't take varargs[T] disruptek: so, converters... kinda like the auto keyword. disruptek: very, very specific use-cases that you probably don't have. disruptek: i used auto to write a generic against a type that wasn't exported, for example. disruptek: very, very specific. KingDarBoja: Is there a equivalent to Python unpack asterisk ? Yardanico: for what specifically? disruptek: nope. KingDarBoja: Oh disruptek: also, converters are less dangerous if not exported. that's a whole 'nother story. disruptek: varargs is a little trappy, too. i advise against it. disruptek: here's a demo of some abuse: disruptek: !repo jsonconvert disbot_: https://github.com/disruptek/jsonconvert -- 9jsonconvert: 11lazy json node conversion 15 0⭐ 0🍴 Prestige: disruptek: just cuz of implicity or something? Prestige: I could use a an array for this I suppose disruptek: varargs are troublesome elsewhere in the language (macros) so they may hinder your code ultimately. disruptek: openArray is probably what you want. Prestige: cool, I'll use arrays then disruptek: king: use discard less, if at all. disruptek: basically, it's a nice feature and discard discards it. keep it and use it instead. disruptek: okay, that's enough criticism for now. good on you guys for writing nim. keep it up! leorize[m]: you can use this to format float leorize[m]: !repo nim-ryu disbot_: https://github.com/disruptek/ryu -- 9ryu: 11ryu for nim 15 5⭐ 2🍴 7& 2 more... disruptek: lol leorize[m]: get you the nicest float :P Yardanico: leorize[m]: "This repository has been archived by the owner. It is now read-only." hm disruptek: not that one. leorize[m]: if you feel like printing your float at x4 the speed, then disruptek: !repo alaviss/nim-ryu disbot_: https://github.com/alaviss/nim-ryu -- 9nim-ryu: 11An implementation of the ryū float-to-string conversion algorithm. This version is written from scratch based on the paper. 15 1⭐ 0🍴 leorize[m]: s/speed/x4 the time*/ Yardanico: but there's no license :( Yardanico: so it's all rights reserved leorize[m]: ^ yea use that for x4 the time spent leorize[m]: you got my word, it's ISC licensed Prestige: So if I'm not to use converters, should I just manually cast ints to x.cint? leorize[m]: I just forgot to push the license :p disruptek: that's not a cast, but yes. leorize[m]: though I might just re license it to MIT for easy adoption disruptek: cast[cint](x) is a cast. Prestige: That's what I am doing atm since I'm not using converters Yardanico: right now I just do https://github.com/Yardanico/nim-lox/blob/master/src/types.nim#L21 and it works fine :D disruptek: cint(x) is a safe conversion whereas cast[]() is not. leorize[m]: `cast[]` in nim is `reinterpret_cast` in C++ Prestige: ah thank you disruptek Prestige: I couldnt find much on casting/type conversion leorize[m]: the `Type(x)` is `static_cast` and/or `dynamic_cast` in C++ leorize[m]: just in case you came from C++ :P Prestige: I came from java and javascript D: nerdrat[m]: leorize[m]: I finally found the problem. I Wonder who else in here updated through `choosenim leorize[m]: nice :) disruptek: what was the issue? disruptek: i mean, what was the solution? nerdrat[m]: Choosenim is doing something weird at extracting the tarball disruptek: that sounds like me in about 25mins. disruptek: if you can shed more light on it, i think shashlick would be interested. nerdrat[m]: I downloaded the tarball myself, verified the checksum both choosenim's and the one that extracted had the same checksum. However when I check the toolchain directory inside `.choosenim` directory, various files including the `nim.cfg` and all files inside `dist/nimble` were binary data!!!! I think choosenim is messing the tarball, I wonder who else had this problem? am I the only one? disruptek: what platform? leorize: probably the nimarchive version used was broken nerdrat[m]: linux amd64 leorize: I gotta write a proper cli library for nim sometimes leorize: actually I planned that long ago when I was writing my own tool, but was too lazy to work on it :P disruptek: nerdrat[m]: well, i'm surprised. but i don't use that choosenim. disruptek: i use this one: https://github.com/disruptek/nimph/blob/master/choosenim nerdrat[m]: I solved it copying the config directory from the tarball I extracted to the `.choosenim/config` "these are text files of course". And also all `dist/nimble`. disruptek: i recommend using git. it works well and millions of people use it for software distribution every day. nerdrat[m]: This is a problem. I wonder if dom96 is aware of this behavior. disruptek: it's disappointing, yes. disruptek: only shashlick can fix it, though. KingDarBoja: I just read this -> king: use discard less, if at all. KingDarBoja: The lag with my internet xD nerdrat[m]: I saw this open issue but I don't know if it is directly related https://github.com/dom96/choosenim/issues/193 it seems so. disbot: ➥ choosenim installs Nim/config/nim.cfg but not Nim/config/config.nims ; snippet at 12https://play.nim-lang.org/#ix=2imo Varriount: Disruptek: You're still up? Prestige: Hm I am not sure, but I don't think a window manager requires more than one thread.. Zed: dumb question, how do you make a function return nothing? like c has void, kotlin Unit, what does nim have? Varriount: Omit the return type, or put void Prestige: implicit void Varriount: Preferably the former Zed: awesome thanks shashlick: nerdcat[m]: good to know, so it is an extraction issue - that helps shashlick: can you provide any info on your platform / OS shashlick: nerdrat[m] rather shashlick: what distro and version are you using KingDarBoja: https://www.youtube.com/watch?v=lkaqxonhLLg KingDarBoja: Oops, this isn't off-topic, ignore that Zed: im confused with nim, do you guys program in a main function? and then have all your code and function calls inside of there? or just write code and then call functions when you need them outside of a main Zed: if that makes any sense KingDarBoja: I do the second right now KingDarBoja: Put all the code outside any main and just call it when need it KingDarBoja: But ofc, I am a mewbie so someone expert on the topic should answer KingDarBoja: newbie* Rika: ah finally, booted into linux now Rika: @Zed theres an optimization nim does when you do the former (i dont know why) Zed: weird, are nim functions like C? where you have to define a function prototype if you want to use a function underneath your main code? Zed: this language is really confusing me Yardanico: @Zed yes you need forward declaration Yardanico: there's also "reorder" pragma but it won't work if you have recursive dependency Yardanico: e.g. if proc a calls proc b, proc b calls proc a leorize[m]: the best practice is to just order it correctly leorize[m]: make your program compiles faster, and the macro system also benefits from it leorize[m]: and in Nim we don't have the idea of a "main" function Rika: is the optimization thing i said right? leorize[m]: modules instead have "initialization" code, which is called to initialize the module leorize[m]: any top-level statement is a part of this initialization code leorize[m]: @Rika yep leorize[m]: the "write a main function then call it at the top-level" is a way to optimize the code Rika: why though? leorize[m]: this is mainly due to Nim interpreting any top-level variables as "global" (which isn't wrong), so optimizations can't be done on them. leorize[m]: that's my speculation fwiw leorize[m]: function-scoped variables are guaranteed to not be accessed outside of the stack frame, so they can be optimized away for example leorize[m]: globals are never easy to optimize Zed: how do you import a function from another file? looking through some nim code and they use Zed: import function/fileWithfunctions Zed: which i have done but i cant seem to use the functions i have imported Zed: sorry for all the dumb questions guys Yardanico: you need to export a symbol so other modules will be able to use it Yardanico: you do that with an asterisk (*) Yardanico: like proc myexportedproc*(...)... Yardanico: or const MyUrl* = "stuff" Zed: do you have too type Zed: export thatFunction Zed: i have seen this done somewhere Zed: no you do not have to leorize[m]: the export is for you to reexport some symbol from module you imported leorize[m]: it's not something done often though silvernode: Got my first issue: https://github.com/silvernode/space-nim/issues/4 disbot: ➥ Connect player with grid silvernode: Haven't had time to really work on some of the suggestions people here gave me. Such as creating a position type with a reference to a grid type. Some terms were used in that suggestion that I don't understand, terms like "ofc". silvernode: Creating a new branch called "grid" to experiment with code. I have never done a grid before so the code is probably not going to make sense. dadada: does somebody know whether staticRead/slurp cache their file reading? When different macros use staticRead in the same module, then you can assume there not be changes to the underlying source, so this is why I'm asking. dadada: to clarify what I mean... when using staticRead to read Nim source files, of the same project, that the macro is running in, while macros run it can be assumed that the sources aren't changed PMunch: Hmm, question. Nimlsp uses jsonschema which can be strict or relaxed when it comes to extra fields in the json data. This manifests in issues like the one Prestige had where it just refuses to do certain things. I like that nimlsp was strict, because it has led us to find at least two implementations with bugs in them, so I kinda want to keep it strict. But from a usability standpoint it should probably be lenient. Would defaulting it to strict PMunch: but adding a flag to make it lenient and adding a section in the README about it telling you to turn on lenient mode and to report a bug with the editor in question be an acceptable solution? PMunch: dadada, I don't think they cache dadada: PMunch: okay, then I won't be stupid to use my own cache dadada: s/be/feel PMunch: Hmm, I generate a procedure and a forward declaration in a macro (in two different quote do blocks, later glued together). But I get an ambiguous error when I try to call it. Tried to make the name of the procedure an ident node and quote it in the quote do macro, but that didn't work.. faulander: good morning guys. since i am coming from python, what is the best way of implementing classes, init procs and class methods. If you could point me to a resource which explains that? Yardanico: nim doesn't have classes, for init procs - just use initT if your object's type is "object", and newT if it's "ref object", like initTable if it's "object" and newTable if it's "ref object" Yardanico: read https://nim-lang.org/docs/tut2.html#object-oriented-programming Yardanico: contains quite a lot of useful info about OOP in nim, but you rarely need real methods and inheritance PMunch: Aaah, all the parameter names need to be quoted.. Recruit_main707: Faulander: I also came from python, don’t let nim’s simplistic OOP push you back, you will realize they have everything you will need Yardanico: most stuff in nim is done via composition :) Yardanico: also nim UFCS or MCS (method call syntax) is really good Yardanico: a.b() == a.b == b(a) == b a Yardanico: not in all contexts of course, but generally it's like this PMunch: faulander, to expand on that Nim initialises memory to null when you create a new object. And most types are made to accept null as an empty state so you rarely need initialisation (e.g. `var x: Table[string, string]; echo x.hasKey("hello")` would work and return "false" even though the table isn't initalised) Yardanico: well also it should be mentioned that some type have a proper "default" value Rika: not null, zeromem Rika: all default to default state Yardanico: all the "primitive" types and all "object" types have a default value, not neccessarily correct one though Rika: strings are "", ints 0, floats 0 PMunch: Well yeah, I just assume that Python people don't necessarily know about things like zeromem.. Rika: any objects that arent ref are initialized w/ fields that are in default state Yardanico: also "ptr" and "pointer" are not initialized of course, but that's another topic :P Recruit_main707: he left?? Rika: who is he Recruit_main707: Faulander Rika: how do you know, are you in irc Yardanico: Faulander is from gitter Rika: didnt notice lol mratsim: The citizen of this country are not accounted for Recruit_main707: > how do you know, are you in irc Recruit_main707: thats why i asked xD Yardanico: English is not Nim, you can't just omit punctuation Yardanico: ah nvm Yardanico: I just thought that "he left???" was meant as a surprise on the fact, not the question PMunch: Are you on IRC or in IRC? PMunch: I've always said "on" Rika: same here PMunch: "in" a channel, but "on" the network Rika: at Rika: 😛 Recruit_main707: id say in ngl Yardanico: PMunch: there's that thing about how to properly say "in Ukraine" in russian too PMunch: Wouldn't that just be "in Russia" nowadays? /s Yardanico: xd, not (yet) :D Yardanico: some people say "в украине" -> "in ukraine", some say "на украине" -> "on ukraine" PMunch: Yeah it's always confusing for people learning Norwegian as well Yardanico: well it's a political issue mostly :D PMunch: Where I live "Tromsø" you say in "Tromsø" but the city is on an island named "Tromsøya" and you say on "Tromsøya" PMunch: And of course we say in the kitchen and on the bedroom. faulander: oh, beautiful norway right? Yardanico: PMunch: same about irc Yardanico: "on github", "on discord" PMunch: Oh no, we say on the kitchen as well, but in the living room Yardanico: "in nim server on discord" faulander: and i am here, my browser just hang Yardanico: PMunch: we say "on the kitchen" -> "на кухне" too lol PMunch: faulander, yeah Norway is quite beautiful :) faulander: i visited all european countries, but norway was too expensive to stay long ;) PMunch: Hehe, yeah it's not the cheapest place to be PMunch: Nice for us when we're on vacation though, pretty much anywhere else is comparatively cheap faulander: i am getting close to rewrite all of my python utilities in nim. i just struggle with the more complex ones. i am not sure to understand nims "Type"-System well. PMunch: Not so much now though that the oil price and Norwegian currency has plummeted.. Recruit_main707: Faulander: do you know about c/c++ structs? faulander: @pmutua : Except Switzerland ;) mratsim: imagine in Venezuela mratsim: oil price were already an issue and now covid drove them further down Recruit_main707: do we have some kind of python vs nim about oop? faulander: > ** Faulander: do you know about c/c++ structs? ⏎ ⏎ unfortunatelly not. i was programming in 6502 assembler, all kind of basic dialects, then pascal, delphi, vb - then stopped programming for 20 years, started with python again 2 years ago mratsim: @faulander, if you make everything a ref object, it works like Python mratsim: pascal delphi can help you, there was a translator tool to convert pascal to Nim 😉 mratsim: bootstrapping was done in Pascal a very very long time ago AFAIK faulander: that was 30 years ago in school ;) Yardanico: @mratsim yeah you're right Yardanico: pas2nim mratsim: well you didn't forget your multiplication tables did you? faulander: i cannot remember much, only that i liked that i don't need linenumbers :D Yardanico: you can still find traces of pascal code in nim compiler mratsim: 6502, that reminds me that my SNES emulator has been collecting dust for 2 years faulander: and that i hated the procedures had to be declared before usage - i like nims forward declaration. python has no such reglementation. mratsim: the "type" follows Pascal record section mratsim: Nim forward declaration is considered a limitation so will likely be lifted at one point mratsim: you can already use {.reorder: on.} faulander: oh jesus. then i am f*cked. Yardanico: reorder won't help if you have recursive dependency though Yardanico: but yeah it's good mratsim: well the issue with those is that you can't have files with types that depend on each other Yardanico: nah I mean procedures mratsim: which is a common pattern in other languages Yardanico: proc a = b() proc b = a() I have a few places in my wip lox interpreter where I need forward decls, I'll probably refactor that once I finish the boot (or at least the first part) mratsim: boot? is there an OS tutorial as well? Yardanico: book* Yardanico: sorry :P Yardanico: http://www.craftinginterpreters.com/ Yardanico: the book talks about implementing a simple C and JS-like language first in Java, then in C Yardanico: I'm following it but instead of Java I use Nim Yardanico: oh right you already know since you starred the repo :D mratsim: Yeah, when I was trying to optimize interpreters 2 years ago I scoured the web for all interpreter resources faulander: so let me try to outline an example in python, would be nice if you could tell me how you would write that in nim, that would get me going: ⏎ class Person: ⏎ variable1 = "hello" ⏎ variable2 = 123 ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e996f8263e7b73a5fe1551d] mratsim: I saw that he published the last chapter about optimization, but it's too high-level for my needs which are optimizing the bytecode interpretation mratsim: The sum of my interpeter optimization is collated here: https://github.com/status-im/nimbus/wiki/Interpreter-optimization-resources mratsim: knowledge* mratsim: @faulander, your edits are not transferred to IRC/Discord Yardanico: huh, so I actually found the place where I needed to put "{.noinline.}" :P Yardanico: was adapting https://forum.nim-lang.org/t/1305 (see bottom) to publish it on nimble, and turns out the C compiler aggressively inlines all calls to the decode procedure so for each string there's like 600 lines of assembly instructions added Yardanico: after adding "{.noinline.}" it's fine though faulander: what is the irc server/channel= Would prefer it over gitter anyway, oldschool as i am Yardanico: freenode #nim dadada: is there any way to set the lineInfo of a NimNode manually? copyLineInfo only works if you already have a NimNode with a the lineInfo that you want, is there anything else? dadada: parseExpr sets the macros.nim file/lines as fileInfo, which isn't helpful Yardanico: yay PMunch: dadada, I don't think so dadada: PMunch: well, I suspected it :-( Faulander: back in 1990! ;) mratsim: @faulander, in pseudocode: https://play.nim-lang.org/#ix=2inp PMunch: Welcome back! mratsim: you have what I saw from the broken formatting at the top Yardanico: with httpclient it's basically the same but getContent :P Faulander: perfect @mratsim, that will get me going! Faulander: oh, i need to learn IRC again haahaha PMunch: What is there to learn? Text goes in, text comes out mratsim: We said that in machine learning "garbage in, garbage out" PMunch: W08el10l 12th02er04e 06ar08e 10co12lo02ur04s 06of08 c10ou12rs02e Faulander: oh jesus, i did use IRC for some ... not very legal ... "things" back then Faulander: registering nick, mentioning users, etc. PMunch: mratsim, I was referencing this: https://photos.app.goo.gl/Y7DBUYSLpnt6Njj8A PMunch: Woops, wrong link PMunch: https://youtu.be/wb3AFMe2OQY?t=113 that's the link I meant to share Faulander: i have added some comments and cleanup: https://play.nim-lang.org/#ix=2inr dadada: I think there should be an optional argument for parseExpr/parseStmt (s: string, info: LineInfo = LineInfo()) (or something like that) ... mratsim: you can use "let x = initPerson(...)" mratsim: echo x mratsim: and let value = x.someOtherProc() dadada: parseExpr puts some default LineInfo now, that's not very helpful, this would help me to override it Recruit_main707: Do we hav some kind of py2nim tool? Faulander: and now it should be working python code ;) https://play.nim-lang.org/#ix=2ins Recruit_main707: I probably ask the dumbest shits ever, sorry :P mratsim: we do mratsim: it was used at Status mratsim: https://github.com/metacraft-labs/py2nim PMunch: I think there was a macro as well that rewrote some Python code to Nim :P Rika: was? PMunch: Like you just typed Python code in your Nim file and it rewrote the AST to be actual Nim code mratsim: 3rd commit of Nimbus was py2nim generated: https://github.com/status-im/nimbus/commit/8ce5fa17736cd582c5e22feac2b18ec64633e2c1 PMunch: I think it was just a for fun project though Recruit_main707: It could be useful mratsim: was because it was for bootstrapping Recruit_main707: How reliable it is? Yardanico: PMunch: yeah it's in nimpylib mratsim: then we cleaned up the code, removed all the OOP and built Nim code Yardanico: but it's almost entirely useless, just to show off :P mratsim: it's serviceable but you will get Python-like code with lots of ref objects and methods Faulander: that would help me alot ... i don't want to write python code and convert it, i want to learn the nim way of doing things, and if i can write python code, that would translate into how nim is doing it structurewise, that would be of immense value Yardanico: well it won't show how "proper" nim should be written :P Recruit_main707: Just don’t take it as the Nim way mratsim: did you read this btw? https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers mratsim: in particular the section about objects: https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#objects Recruit_main707: Being efficiency the most important feature, and having imho the cleanest syntax of all the programming languages shows how great of a project Nim is Rika: am i the only dumbass who makes ref seq[] fields or is it totally valid to have ref seq[] fields mratsim: ref seq are valid and Araq made some ref seq for TableRef iirc Yardanico: yeah it is valid Yardanico: a pointer to a pointer to seq data mratsim: I prefer to use type foo[T] {.shallow.} = object \n data seq[T] Faulander: aaah, that link is glorious. thanks mratsim! mratsim: this avoids a ref indirection Yardanico: you can do "ref ref ref ref seq[int]" :P Rika: ref seq[] is valid, but is it smart Recruit_main707: from my complete ignorance, I’m gonna say no Rika: i just want to be able to share a seq, where contents are changed in both "accessors" mratsim: there are tests for ref seq mratsim: 5* Rika: i'd like a better solution of course since seqs are pointers internally no mratsim: yes in that case use ref seq Rika: is that the only possible way? or can i escape refseq mratsim: you can use raw pointers mratsim: with finalizers PMunch: Hmm, could nimsuggest support semantic highlighting? Rika: that sounds debatably worse Rika: I HEARD SEMANTIC HIGHLIGHTING? mratsim: something like this: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/backend/cuda.nim#L29-L41 Rika: (tbh though i really want that in vscode-nim) PMunch: Rika, yes I'm looking at the proposed LSP spec for doing semantic highlighting PMunch: Hmm I guess the highlight command in nimsuggest should give me everything I need dom96: Reports of choosenim corrupting the extracted files, doesn't bode well for nimarchive :( Rika: ??? really? PMunch: nimarchive? dom96: oh, I see shashlick stepped in, thank you shashlick. Faulander: type Animal = ref object of RootObj --> inheritance, type Animal = object --> new object? Rika: 1st is reference object, basically "pointer to actual object" Rika: 2nd is regular object, can still have "inheritance" but i dont think it works too well dom96: nerdrat[m], please report this as an issue on GitHub if you can. You can also give choosenim 0.4.0 a try, it's the version before nimarchive was introduced: https://github.com/dom96/choosenim/releases/tag/v0.4.0 PMunch: Looking at the Java language server and getting PTSD from my Java days PMunch: The project is 1148 files.. PMunch: Not lines, files Yardanico: what Zevv: 1448 lines, that's not much! Yardanico: Zevv: LMAO Yardanico: oh java is 1 class per file right Yardanico: everything MUST be OOP, every single thing Yardanico: PMunch: can you give link please? PMunch: https://github.com/eclipse/eclipse.jdt.ls PMunch: For comparison nimlsp is 40 files PMunch: Oh wait.. PMunch: It counts the .git folder.. Yardanico: PMunch: 120 thousand lines of Java code Yardanico: what the heck Yardanico: (I counted with cloc) Yardanico: and that's excluding comments Yardanico: and blank lines Yardanico: now I wonder if I should add my 30-line library to nimble .. PMunch: nimlsp is 14 files, java lsp is 1009 files.. Yardanico: I mean people asked in https://forum.nim-lang.org/t/1305 but I refactored it a bit so it's just 30 lines now Faulander: rika, do correctly understand you. if intend to use inheritance i use ref object, if not, i CAN use object, but also ref object, correct? Rika: yes yes Yardanico: Faulander: yes, but there's other difference too Yardanico: if you use "object" and want to modify the instance in the proc you'll need to add it as "var MyType" in arguments Rika: object is usually copy by value, ref object is "copy by reference" Yardanico: but when you have "ref object" you just write it as "MyType" Yardanico: yeah Rika: techinically theyre both by value, just the value being copied differs Faulander: hmm, i need to try that out to correctly understand i think. PMunch: Lines in the project as counted by "find . -not -path '*/\.*' -type f -exec cat {} \; | wc -l" PMunch: Java LSP: 230211, Nim LSP 1785 Yardanico: PMunch: well seems like it has a lot of Eclipse-specific stuff too PMunch: No, that's not a typo, 230k lines of.. stuff.. PMunch: Still.. Yardanico: and cloc gives 120k lines of pure Java code (without comments and blank lines) Yardanico: for nimlsp "cloc" gives 1314 lines of pure code :) Faulander: so i understand "cope by reference right"? Copy by value is clear, thats a separate copy, copy by ref means if i change the referenced object, the reference object is changed too? Yardanico: Faulander: if you pass your "ref object" to a procedure it can change it, yes Yardanico: even if your "ref object" instance was declared with "let" Yardanico: because "let" actually still works there -> it won't let you modify the reference itself Rika: ok so faulander, `var a = someObject; var b = a; changing b will not change a` Rika: `let a = someRef; let b = a; changing b will change a too` Faulander: thanks Rika, thats exactly what i meant PMunch: Just to put this into context, the Nim compiler (as counted by "find . -name '*.nim'") consists of 336890 lines Yardanico: and that's including the whole stdlib PMunch: The Java LSP plug-in is more than 2/3 the size of the entire Nim compiler and tools.. PMunch: Yup Faulander: so if i only have one instance of the object in my program, i can savely use ref object without putting much thought in it Yardanico: with "cloc compiler/" it's just 60k lines of compiler code (with 7k blank and 10k comments) PMunch: So by cloc the Java LSP plug-in is twice as much code as the entire Nim compiler, tools, and stdlib PMunch: No wonder RSI is a big problem in the software industry.. Yardanico: well not exactly :P Yardanico: Nim repo has 260k lines of Nim code in total PMunch: Ah okay :P Yardanico: wonder where does that amount come from, hmm PMunch: I was wondering how much documentation was in there :P PMunch: Cloc should have a mode like baobab Yardanico: ah right Yardanico: "tests" 100k lines of Nim code :DDDDD Yardanico: more than the whole compiler mratsim: Tests for such complex piece of machinery are expected to be longer than the code Yardanico: PMunch: yeah it has "--by-percent" mratsim: each "if/elif/else" or case statements technically needs a factor 2 to N more tests to cover all branches PMunch: Yardanico, should have a mode to output as .dot circle diagram :P Yardanico: oh Yardanico: hmm can't find it in "cloc" program Yardanico: Cloc being https://github.com/AlDanial/cloc PMunch: Oh no, not that kind of should, the other kind PMunch: As in, they should have implemented it PMunch: Hmm, I appear to need a hierarchy of style scopes to implement this semantic highlighting feature PMunch: http://ix.io/2inQ <- something like this Yardanico: lol PMunch: For all of these kinds: https://nim-lang.org/0.19.2/idetools.html#parsing-idetools-output PMunch: Hmm, highlight doesn't do string literals.. PMunch: Not sure if this is really sufficient to implement syntax highlighting.. PMunch: http://ix.io/2inS PMunch: I guess I could implement some basic keyword recognition as well PMunch: Along with strings and comments Yardanico: yay Yardanico: I mostly use VSCode because of the Nim extension Yardanico: if there was a way to have good Nim support in an editor like Sublime Text or similar I would use it instead :P Yardanico: and nimlsp solves that PMunch: Exactly dom96: I'm constantly considering writing my own Nim extension for VS Code Yardanico: in Nim? :P dom96: no PMunch: Help with NimLSP instead :) Yardanico: what's wrong with current nim extension for vscode though? Recruit_main707: its wonky Yardanico: I know it has its own issues but not sure why a full rewrite is needed PMunch: For every fix in NimLSP you fix something for every editor, much less cumulative work Araq: I would have fixed it a long time ago but it's much code written in TypeScript and I don't even know how to test out my changes krux02: Yardanico, A full rewrite is usually necessary if the old codebase is unmaintainable and the original maintainer is gone (probably because of this state) Araq: or maybe because he was paid to do it and found a new job... Yardanico: lol Yardanico: well the original creator of vscode-nim still seems to make occasional commits https://github.com/pragmagic/vscode-nim/commit/dbff0e830945a059f1990461c7c8215ede8dc822 Araq: the original author is rarely the person who thinks "omg my code is so messy it needs to die already" Recruit_main707: pragmatic has some of the bes projects of nim, but he tends to abandon the ones i like the most :p Yardanico: it's not a single person Yardanico: "Pragmagic, Inc." Yardanico: http://pragmagic.io/ dom96: Yardanico, it does a lot of annoying things, the bracket behaviour is wrong for example. Yardanico: they even mention nim on their page Recruit_main707: the more you know dom96: So I don't have a lot of confidence that the extension is well built flywind: A new async http server(based on asyncdispatch and nativesockets). Now it works and begins to add more tests. flywind: https://github.com/iocrate/netkit Recruit_main707: nice Rika: Interesting dom96: Nice! zacharycarter: why doesn't it bill itself as that then? the project description is rather misleading Yardanico: zacharycarter: ? zacharycarter: instead of - Out-of-the-box, stable and secure network facilities and utilities written by pure Nim. Yardanico: "Netkit is not intended to be a high-level productivity development tool" is about development, not usage Yardanico: " ut rather a reliable and efficient network infrastructure." (but) zacharycarter: yeah but the only functionality I see is an async http server zacharycarter: not really network facilities and utiltiies flywind: Now only server part is finished. Yardanico: well they'll add more later (TM) zacharycarter: well what else is going to be added? it mentions TCP / UDP/ Websockets zacharycarter: that's pretty vague zacharycarter: I still find myself going to enet for reliable udp sockets zacharycarter: either way - cool stuff Yardanico: there's also https://github.com/zielmicha/reactor.nim Yardanico: but it's not really maintaned Yardanico: but has quite a lot of stuff implemented Rika: ooh reactor style Yardanico: not really zacharycarter: I've never gotten anywhere with that project PMunch: I think I might have a problem with implicit return abuse: http://ix.io/2io0/nim Yardanico: @flywind https://github.com/zielmicha/reactor.nim worth checking out as it's related to your project Araq: PMunch: definitely. dom96: Rika: pretty sure async await itself is an example of the reactor pattern Araq: once again, we need an async that works with --gc:arc flywind: Thanks. I'll check it. @Yardanico Yardanico: Araq: would it be hard for current implementation to support it? Araq: Yardanico: IME yeah, it's very hard. PMunch: It used to be worse though: http://ix.io/2io2/nim Araq: it works with --gc:orc though PMunch: --gc:urukhai Yardanico: ahaha Yardanico: "Uruk-hai (for short, Uruks) were brutal warriors of Middle-earth, and the strongest Orcs" ORCs :DD Araq: thanks for the lecture PMunch: Huh, didn't know they were considered orcs Araq: but I think many knew already Rika: not me livcd: does nim-chronos work with arc? Rika: only one way to test zacharycarter: Araq: is the fix for https://github.com/nim-lang/Nim/issues/13935 to not make this assert - https://github.com/nim-lang/Nim/blob/a6682de0045468ae1d15afbd2fd5378960e15eb7/lib/system/mmdisp.nim#L87 - when `nimV2` is defined? disbot: ➥ SIGSEV encountered when creating threads in a loop w/ --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2ioe Yardanico: zacharycarter: I don't think so, sysAssert is just an assert Yardanico: it's a template which only checks if condition is false Yardanico: and if -d:useSysAssert is defined and it's false, it prints out a message Yardanico: it doesn't quit the program or anything like that zacharycarter: hmmm leth: is there a way to join arrays together in a static block? leth: (a simple way) Recruit_main707: do we have any web browser made in Nim?? Yardanico: that's a very complex task if you actually mean implementing a whole browser (with layout, rendering, etc) in Nim Yardanico: so no Recruit_main707: :( Rika: even firefox is just partially in rust Yardanico: just a tiny bit though Yardanico: most of it is C/C++/JS of course Yardanico: browsers are the most complex single piece of software we have nowadays Yardanico: like chromium literally can take 50-100 times longer to compile than linux kernel Rika: all because it has to implement 3 languages Yardanico: HTML and CSS are not programming languages though :P Recruit_main707: the forbidden debate :0 Rika: i said LANGUAGES Yardanico: which ones? Rika: did i say programming did i Rika: hmmmmmmmm Rika: smh cant read PMunch: Haha :P Generic: can the nim compiler invoke multiple c compiler instances in parallel? Generic: like make -j4 Yardanico: it does that by default PMunch: @Generic, --parallelBuild:4 lqdev[m]: @Generic it does that by default PMunch: Oh it does? Yardanico: yes PMunch: Neat Yardanico: https://nim-lang.org/docs/nimc.html "0 for auto detect" Yardanico: and 0 is default PMunch: Right Yardanico: on my 3700X it uses all 16 threads Yardanico: so the compilation is pretty darn fast :P Generic: ah, then it must have been the lack of conflicting console outputs which kept me from noticing it sealmove: guys, I am trying to play around with some windows paths but some procs don't work with them. Do I have to convert `\`s to `/`? Yardanico: you can use / proc Rika: "parent" / "childdir" Yardanico: like "myfolder" / "myfolder2" / "myfile.nim" will construct a path with DirSep for the OS Rika: in `os` Yardanico: so if you're on linux it'll use /, on windows \ Rika: module `os` sealmove: when I use `/` proc I get a mixed string with `\` and `/` Rika: ? really? Yardanico: yes they're escaping and stuff Yardanico: they'' work anyway Rika: i mean \ AND / for windows? sealmove: I mean, I already have a string with `\`s and want to manipulate it Rika: thatString / newString to add a folder then sealmove: yes, this gives me mixed string Rika: can you show the output Yardanico: @sealmove oh then that's harder Yardanico: well actually wait Yardanico: maybe you do stuff like "myfolder1/" / "myfolder2" ? sealmove: https://play.nim-lang.org/#ix=2iov Rika: i mean show output since playground is linux sealmove: I am working on linux, but the paths are taken from Windows Rika: then thats the reason Rika: maybe set nim to compile for windows Yardanico: yes sealmove: hmm, or I can manually convert the string to linux format in order to use the procs and then convert it back to Windows format? Yardanico: you need --os:windows or manually concat with "\" sealmove: I see, thanks shashlick: dom96 second time someone has had extraction issues but not sure what how to debug without reproducing locally dom96: shashlick, do you know what OS/arch this user is on? shashlick: Everything is statically linked with nimarchive, maybe we need an older libc or musl, I don't know dom96: would be strange if this is a libc issue dom96: I would expect an outright crash then dom96: but maybe there is some weirdness possible here too shashlick: They mentioned Linux amd64 that's it shashlick: If the wrapper was bad, it would fail consistently dom96: yeah, we need more info. The Linux distro and version for example dom96: if all else fails we can ask for ssh access to their machine shashlick: I couldn't repro locally shashlick: Like the damn nimterop issue on osx with 1.2.0 and devel, consistently segfaults on Travis with no stack trace but works fine locally dom96: shashlick, is that still a problem? AFAIK you can at least grab the same docker images that Travis uses and/or maybe even ssh into Travis, although that may require paying them shashlick: Can you do that for osx as well? shashlick: I've used the Linux image in the past successfully dom96: I've never done it, but there must be a way. We can't be the only ones having such problems. shashlick: I'll dig around disruptek: livcd: chronos does not work with arc. shashlick: Would you mind running nimble test on nimterop head? You have osx right? dadada: why does https://play.nim-lang.org/#ix=2ioH output foo, echo bar echo foo dadada: instead of foo: echo bar echo foo dom96: shashlick, supposed to be doing non-hobby work right now, but I'll get to that in the evening, just remind me in around 6 hours. dadada: I'm looking for a way of getting the accurate original code for a NimNode dadada: args.toStrLit.strVal gives the same result here dadasdad: node.repr solitudesf: you cant dadada: dadasdad: that's what I used, you should have looked first, but your nick is splendid dadasdad: once the code is parsed, it's in a new format. you can render it but you cannot recover the original string. dom96: yeah, the rendering isn't perfect either (fixing these would be appreciated) dadada: nodes keep their original line/col in the lineinfo object, all that's missing is that the lineinfo object also keeps the original finalline/finalcolumn, and then it would be easy to extract from the sources, if needed solitudesf: your complaint is about comma/column, which arent a part of any NimNode so thats irrelevant clyybber: Araq: How should we treat tuples of vars? clyybber: Since mutability is not part of a type normally they are a bit tricky clyybber: My first intuitive guess would be that they should only be allowed as return types/rvalues mratsim: var tuple as return value have similar issues to var arrays as return value mratsim: it crashes the compiler mratsim: unless it's for iterators clyybber: Yeah. Where are var arrays as return values used? clyybber: Or allowed/working rather livcd: disbot: so no async works with arc atm gotcha! clyybber: @mratsim ping clyybber: Do you mean returning arrays of vars? What would that be useful for? disruptek: livcd: async works with arc, it just leaks memory. disruptek: i run all my async code in a thread, anyway. solves the many problems i have with async. disruptek: i thought var tuples are fixed now. cooldome closed my issue. clyybber: disruptek: Oh hey you're back! disruptek: sup dawg companion_cube: I still need to get back to openapi disruptek: are you the one that filed an issue for v3? companion_cube: yep disruptek: ah, cool. disruptek: did you see that the schema is contained in a schema2 file or w/e? companion_cube: it's encoded in nim constructs, right? companion_cube: (I did see the file) disruptek: yeah. clyybber: IMO the way to fix this date time issue is to make `var a: DateTime` equal `var a = default(DateTime)` disruptek: yes, but we're just using datetime as a proxy for all reqinit objs, right? clyybber: Which Yeah clyybber: d/Which disruptek: i want an operator for that. disruptek: ?mydate clyybber: What would it do? disruptek: x == default(x) clyybber: Ah disruptek: x != default(x) i guess. disruptek: tricky. maybe it cannot be unary. disruptek: ?+ and ?- maybe. treeform: Is there a way to get current modules path, or main module path during compile? I want to compile in the path it was compiled from. clyybber: Why can't it be unary? clyybber: I thought every op can be unary clyybber: Maybe I'm wrong disruptek: because it's confusing. disruptek: treeform: sure; using the compiler's config. disruptek: see nimph/src/nimph/config.nim clyybber: I think there is currentSourcePath or something like that no? clyybber: That points to the current module treeform: yes thanks currentSourcePath disruptek: i think the project path isn't well-propogated. disruptek: i jump through a ton of hoops to figure this out in bump. clyybber: Yeah, but when doing it in your own project its simpler clyybber: Since you know where the file is disruptek: also, shashlick added some way to query the compiler for an arbitrary options list. mratsim: @clyybber it would be useful for big integers mratsim: you often work on half/half an array to implement multiplication and division mratsim: this requires being able to split a bigint in 2: https://github.com/status-im/nim-stint/blob/master/stint/private/uint_div.nim#L123-L169 clyybber: The issue with this is that it conflicts with nims way of not attaching var to the type clyybber: So ptr would be more appropriate there I think clyybber: If I understood your right you meant to use `array[2, var array[...]]` right? mratsim: well not even zacharycarter: is there a way for to choosenim to list the current toolchain directory? mratsim: I would like to be able to do `proc lo[N, uint64](x: array[N, uint64]): var array[N div2, uint64]` clyybber: Ah, gotchu mratsim: see bug: https://github.com/nim-lang/Nim/issues/8053 clyybber: Okay, thats a codegen bug mratsim: ah it was closed mratsim: I missed that mratsim: have to retry clyybber: Yeah 😄 disruptek: when did this datetime issue arrive? disruptek: !issue datetime disbot: https://github.com/nim-lang/Nim/issues/11081 -- 3DateTime field on Exception produces inconsistent C/++ handling 7& 29 more... disruptek: not that one. disruptek: #14002 disbot: https://github.com/nim-lang/Nim/pull/14002 -- 3fix https://github.com/nim-lang/RFCs/issues/211: `var a: DateTime` compiles and is usable disruptek: whatever changed actually broke working code i had. clyybber: But its not merged? disruptek: i mean, i cannot build disbot in 1.2. clyybber: Oh clyybber: Because of DateTime? disruptek: yeah. clyybber: I thought this issue has existed since forever zacharycarter: Question - https://github.com/nim-lang/Nim/blob/devel/lib/system/threads.nim#L148 - shouldn't that also check to ensure that `nimV2` isn't defined? zacharycarter: `nimV2` = `--gc:arc` correct? disruptek: there's a better define. zacharycarter: what is that? dom96: IIRC nimV2 is something else clyybber: Nope nimV2 is essentially gc:arc disruptek: it's in alloc.nim iirc. zacharycarter: well regardless - shouldn't that check include checking for arc? clyybber: Not sure, why would it? zacharycarter: because if it doesn't it's going to execute `nimGC_setStackBottom` and `initGC` etc zacharycarter: we don't want that to happen in the case we're using `arc` correct? clyybber: Oh, yeah then it probably should :D zacharycarter: :D zacharycarter: okay I will try to find a better suited define in alloc.nim and then PR leorize: nimV2 is --seqsv2 iirc disruptek: gcDestructors disruptek: technically, #11081 is consistent now. disbot: https://github.com/nim-lang/Nim/issues/11081 -- 3DateTime field on Exception produces inconsistent C/++ handling ; snippet at 12https://play.nim-lang.org/#ix=20PX zacharycarter: `gcarc` is it I guess disruptek: all three examples fail to compile due to uninit datetime. disruptek: not gcDestructors? zacharycarter: https://github.com/nim-lang/Nim/blob/9c46927fad6535cf7e172f5af5e93d179cec1020/compiler/commands.nim#L494-L504 clyybber: leorize: Yeah, optSeqDestructors implies nimV2 clyybber: And so does optOwnedRefs leorize: zacharycarter: https://github.com/nim-lang/Nim/blob/352232e62dea88191339af3aaa943cb93fb4db02/lib/system/gc_interface.nim#L3 leorize: fix that instead disruptek: oh, i see; it's both. 😁 leorize: hmm, it already disabled that code path zacharycarter: leorize: what needs fixing there? I'm dumb - please explain more clyybber: disruptek: lol :D leorize: zacharycarter: look at the when you referred to leorize: it has `not usesDestructors` zacharycarter: oh so add gcarc there leorize: gcDestructors has already been added there disruptek: just PR the removal of one of the names. leorize: that code path is already disabled on arc zacharycarter: gotcha zacharycarter: so nothing needs fixing - good zacharycarter: just trying to hunt down what's causing this thread error and why it only happens in the c backend and not the cpp backend disruptek: probably exception-related. zacharycarter: okay good to know that dadada: does Nim have any generalized wasy of distinguishing specific kinds of types? ie. int, int8, Natural, are all useful for counting stuff (countables?); seq[foo], array, tables, ..., are all containers/collections (enumerables/collections); I'm asking this because this would help me with writing a template that takes two arguments, where one argument is the former category and the second is in the latter one dadada: s/wasy/way disruptek: int or int8 clyybber: Ordinal for the first narimiran: dadada: Ordinal clyybber: And for the latter there is none. Concepts are probably what you want dadada: okay, thanks so there's one :-) clyybber: Or unbounded generics disruptek: oh, i thought you were asking about typeclasses. companion_cube: disruptek: I'm new to nim, why is nimph a separate thing from nimble? disruptek: because its approach is so fundamentally different. dadada: I'd like to do something like template myTempl(ord: Ordinal, e: Enumarable) # I think in C# they call it Enumarable companion_cube: because of lockfiles? disruptek: no; nimble asserts environment while nimph merely vets it. disruptek: if you look at the code, i've added {.warning: "this needs implementing to warn of foo".} in the doctor. disruptek: there's a lot more that we know about the environment and can teach the user about. companion_cube: hmmmmmmm disruptek: what language are you coming from? companion_cube: OCaml mostly zacharycarter: Yardanico: I don't think this comment is accurate - https://github.com/nim-lang/Nim/issues/13935#issuecomment-614271961 disbot: ➥ SIGSEV encountered when creating threads in a loop w/ --gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2ioe zacharycarter: I tried the commit you said is working, and it's not leorize[m]: disruptek: I need some help on this: https://github.com/nim-lang/nimble/pull/768#issuecomment-611113450 disbot: ➥ nimscript{wrapper,api}: don't copy generated script to package directory disruptek: you can forge your location and run the compiler's config parsing. leorize: yea but nimble don't link to the compiler disruptek: oh, i forgot. disruptek: you're basically screwed. disruptek: maybe i don't understand the use-case, though. dom96: leorize: I was going to suggest a compile change to make this possible. dom96: *compiler disruptek: you cannot run the nimscript from the package directory? leorize[m]: if I can this PR wouldn't be there :P disruptek: no; chdir package-dir; nim e /some/script/elsewhere.nims dom96: imports break then leorize: already did, the compiler still won't parse the configs disruptek: ah; it thinks the project dir is where the script is located. leorize: yea disruptek: can you pass that as an override in the command-line? leorize: nope, you can't disruptek: shit, really? leorize: the compiler isn't really geared for scripting, yet disruptek: hey, let's stream it. disruptek: just have to merge obs. leorize: I think we'd want something along the lines of: `nim e --realScript:/path/to/nims file.nimble` dom96: you may want to get Araq's approval first disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek leorize: disruptek: project .nims file will be run along side the .nim file leorize: check twitch chat lol dadada: why is the len proc not documented for sets like it is for strings/seqs? https://nim-lang.org/docs/system.html#system-module-sets leorize: it's just an alias for `card` dadada: I mean, in this table, it might be somewhere else, but in this table it looks like you'd have to use card instead leorize: yea, the right term is `card`. it's a set, and a set don't have a length mratsim: @dadada, len is new, less than a year old disruptek: that's my fault. mratsim: the rational is that `len` is for O(1) but for a set you need to iterate on the set to get the number of elements contained disruptek: i added len and didn't add it everywhere in the docs. disruptek: len is an alias. mratsim: well before you added it, it wasn't there because of the reason I explained dadada: suppose you're new to Nim, you look at the sets table and compare it to the seq table, you're likely to conclude that there's no len for sets, because you rightly expect there to be consistency in documentation, and if there's len documented for seq and not for sets, you'd expect that to accurately reflect the way things are mratsim: in-between counting set elements was changed to popcount instead of testing bit by bit mratsim: sure disruptek: the idea of len() is not to differentiate from card() semantically; it's to enable the same code to be written against sets and seqs. mratsim: yes, but in the past len for sets was very slow disruptek: what it means is, how many elements are in this collection. leorize: I don't even think speed is something that we concern ourselves with the API dadada: disruptek: yeah, exactly why I need len for sets now, and then I looked it up in the docs, was disappointed, tried len on sets nevertheless, and then I didn't know whether it is deprecated or not (thought that may be the reason for it not being in the docs) leorize: iirc even linked list have `len` disruptek: nope, they don't. disruptek: i thought about adding it, though. leorize: btw check twitch chat again mratsim: there was some discussion I don't know where, were we didn't want to have a len for set because it would automatically make an user algorith O(n^2) if called in a loop and it was assumed to be like seq.len zacharycarter: disruptek - I think you were right, looks like this commit broke threading for `--gc:arc` and the C target zacharycarter: c3344862b0d6061cc1581f29c81b29b75c78615 zacharycarter: which is - --exception:goto switch for deterministic exception handling (#12977) disbot: https://github.com/nim-lang/Nim/pull/12977 -- 6--exception:goto switch for deterministic exception handling disruptek: mratsim: it makes sense. i hate it, too. disruptek: maybe we just issue a warning. disruptek: i mean, it's really not on us to explain the complexity of every algo in the stdlib. leorize: zacharycarter: try --gc:arc --exceptions:setjmp zacharycarter: okay leorize: if that works, then the bug is in --exceptions:goto disruptek: we have to be able to provide slow-but-useful algos as well as fast ones. mratsim: @disruptek, with the popcount implementation it's fine zacharycarter: leorize: yeah `--exceptions:setjmp` works :D I'll add that to my comment in the issue mratsim: a popcount is as fast as retrieving the data from memory dom96: disruptek, documenting the complexity would certainly be helpful mratsim: well base data structures need to be reasonably fast disruptek: i get it. disruptek: i hadn't read your popcount comment. leorize[m]: https://github.com/nim-lang/Nim/blob/devel/compiler/bitsets.nim#L99 leorize[m]: pretty sure it's not implemented like that atm mratsim: isn't that just for compile-time? mratsim: pretty sure I saw a PR from @narimiran on that mratsim: otherwise that's bad leorize: ah, I see it leorize: lib/system/sets.nim leorize: it's not popcnt though mratsim: still much better than looping on each bits mratsim: and the length is 1 or 2 since we can store uint16 at most in a bitset Araq: mratsim: problem is the slow loop is O(1) still ;-) Araq: sometimes CS theory is a failure leorize: Araq: what do you think about the `--realScript` idea above? Araq: I rarely read the logs leorize: it's something like this: `nim e --realScript:/path/to/nims project.nimble` Araq: everything that improves Nimble is fine with me Araq: still need to write my RFC about nuking Nim's config system .... :P dom96: oh really leorize: lol I'm adding this to make nimble work with the config system leorize: you can't just nuke it like that dom96: I'll put that on a poster and start writing PRs for the compiler then :P Araq: dom96: be my guest, I'm not hostile to PRs. I'm hostile to PRs that fix X while at the same time change Y and then remove Z because the OP doesn't like Z dom96: Araq, a while ago you were really against me changing anything in the compiler for the sake of Nimble. 0ffh: hi, sorry noob question: what was the keyword top have something execute (like closing file for cleanup, etc) when leaving scope? dom96: Araq, by "a while ago" I mean years ago of course :) leorize: 0ffh: `defer` Araq: I also don't understand your point. iirc we introduced the whole nimbleDir feature for Nimble 0ffh: thx Araq: dom96: yet the better *design* is often the result of making the Nim compiler unaware of Nimble leorize: can we eventually get rid of nimbleDir? :P dom96: Araq, fair enough, you allowed that. dom96: leorize: sure, what will we replace it with? leorize: configuration files for package manager leorize: nimph use that and it works well disruptek: what do you need a config file for? dom96: you mean *for Nim* not for the package manager? mratsim: we use NIMBLE_DIR extensively to make nimble compatible with our submodules system mratsim: and not pollute our own personal repo mratsim: i.e. in our work environment "export NIMBLE_DIR=vendor/.nimble" mratsim: and then we're good dom96: mratsim: I think leorize is referring to something else dom96: i.e. the --nimbleDir switch supported by the compiler leorize: afaict the idea of `nimbledir` is so that you don't have to use a `cfg` file to point the compiler to the actual packages leorize: you can just use a cfg file that do `for i in walkDir(nimblepath): switch "path", i` dom96: so you want Nimble to generate a cfg file which the compiler can then read dom96: Right now Nimble generates a .nims file, so that the compiler can read it dom96: and you're working to fix that dom96: :P dom96: Can you see the irony? :) leorize: the compiler is chasing nimble :P Araq: nimble generating the .nims file to run seems to me the best way to do it, what's wrong with it? Araq: shashlick did a terrific job on that. leorize: disruptek: does nimph work with Nim's `pkg` import prefix? disruptek: if it works in nim it works in nimph, afaik. leorize: i think the pkg import prefix requires --nimbledir to be configured disruptek: nimph doesn't express the environment except in ways that the nim compiler reads the environment. that's how they communicate. mratsim: sometimes I accidentally commit the ".nims" file generated 😛 dom96: mratsim: :'( mratsim: https://github.com/mratsim/constantine/pull/24/commits/47bc4289381eb3bbbe7d2c1a1b9dee96891e7875 disbot: ➥ Initial support for Elliptic Curve Araq: sounds like a job for a better gitignore dom96: Yeah, say what you will but I personally dislike having dozens of these files and needing to remove them manually dom96: Maybe that's a bug and Nimble should be removing them, but since it's still happening the best way to ensure it stops happening is to stop generating these files. clyybber: Araq: What do you think about this: https://irclogs.nim-lang.org/17-04-2020.html#13:41:25 ? shashlick: Why lot a flag to specify explicit project path to Nim shashlick: So it will load imports and cfg files even though the nim or nims file is elsewhere shashlick: But nothing generic about that Araq: dom96: huh? for me they are deleted Araq: or maybe they are stored where I don't notice :P leorize: they're deleted unless nimble crashes leorize: or if you run an old nimble that doesn't have the bug fixed shashlick: this is based on leorize's PR Araq: clyybber: it's covered by our RFC regarding borrowing shashlick: he avoids the copy altogether and makes imports work Araq: at least it should be shashlick: but cfg files get missed shashlick: it would be cool if we could override the project dir - wondering what other use cases it will benefit to make it worthwhile Araq: well here is my idea once again: Araq: the config should only be concerned with user specific or machine specific settings (like which C compiler to use or whether you like colors in the compiler's output) Araq: everything else should be done inside the .nim file via pragmas Araq: for two reasons: Araq: - simplicity audiophile: :D Araq: - composability Araq: in fact, inside a Nimble package only pragmas really work Araq: as the package config is simply ignored altogether Araq: (the Nim compiler does it this way since forever) audiophile: any idea when competitive programming websites will add support for nim? or is that something we have to request? leorize: Araq: --path is a popular one that people use Araq: leorize: yeah Araq: --path is an open problem but a .path pragma sounds feasible shashlick: i like that cfg files for packages are ignored shashlick: but i do agree pragmas for everything possible in cfg files is very useful disruptek: ugh .path sounds bad. shashlick: but what about all the legacy cfg files out there Araq: shashlick: we support them for another decade but phase them out shashlick: i'm on board with that idea clyybber: Araq: Yeah, I don't really refer to the safety of that feature, just that it introduces var to the type system, because we then have tuple[var int, var int] for example. shashlick: i'd really like a {.define.} Araq: shashlick: we have it, check it out on devel shashlick: peace Araq: clyybber: it's an old feature though, how else would 'mitems' and 'mpairs' work? clyybber: Yeah, I am aware clyybber: I'm just thinking about how it fits into the type system clyybber: And how it fits with view/lent/var Araq: well it's a type. Araq: so that's how it fits :P shashlick: okay but are there other cases where overriding the project dir would be useful clyybber: Because in theory having an object field thats a view into some array isn't too crazy either clyybber: Araq: Heh, ok so do we want to support object[field: var int] ? Araq: clyybber: yeah, every type that contains lent/var becomes a "borrowing" type leorize: if `var type` becomes first class can we get rid of `byaddr`? :P shashlick: leorize how did you fix the import issue with your PR clyybber: Ah okay. That makes sense leorize: shashlick: --path Araq: and a borrowing type must be derived from the first parameter yada yada shashlick: yep clyybber: Or we use that from syntax? Araq: leorize: yes Araq: clyybber: yes, as a later extension clyybber: But yeah, first parameter is good enough for now shashlick: the thing i still don't like is that we need to prepend text to the nimble file for it to work shashlick: would be cool to tell nim here's two nim files, put them together and run it as one leorize: shashlick: in fact I can now generate `include file.nimble` instead of copying the content leorize: still won't make the configuration parses though Araq: leorize: I think we need 'var x = byvar(y)' instead of .byaddr leorize: yea Araq: but we can always map .byaddr to the new, better implementation Araq: which is why I accepted it. leorize: I'm still waiting for first-class borrowing :P Araq: don't wait for it, implement it leorize: I'm working on some other things Araq: fair enough leorize: it's harder than I expected to make sure that the GC is not touched, at all in a code path Araq: well you use --gc:arc and there you go leorize: if I'm gonna implement an alternative `osproc`, I want it to work everywhere leorize: can't have users if I can't get it to work without --gc:arc Araq: ah I see your problem. Araq: still there is GC_disable/enable dom96: Araq, so in each module I would need multiple {.path.} pragmas? dom96: how would this work? clyybber: Araq: Another thing regarding default fields (since its required to fix the DateTime issue properly), I think I'll do the transformation in transf.nim for now, as injectdestructors doesn't process VM code. But that means I can't optimize the unneccessary initializations away. dom96: How would you deprecate the global config files? clyybber: So the question is, do we want to make the VM ready for injectdestructors? clyybber: I feel like we must eventually, since people probably expect their custom destructors to be called for closing files and things like that dom96: I'm starting to think it may be a good idea to set up dedicated chat rooms for things like Nimble or maybe even specific Nim/Nimble feature/change proposals dom96: Otherwise it's just way too easy to lose context and get lost in the noise of other discussions Araq: clyybber: yeah... the VM needs to run destructors, yay Araq: dom96: well the config remains but we don't add more features to it Araq: and we also see the pragma system is powerful enough so that you can avoid the config system altogether shashlick: Araq: so you talking about deprecating .cfg files only, or .nims files getting autoloaded as well? Araq: shashlick: both .cfg and .nims files are wrong... *cough* Araq: .nims files had a good idea, use Nim instead of the undocumented .cfg file format Araq: but the implementation is messed up and continues to cost development resources Araq: it's very subtle that system.nim is actually processed twice dom96: based on user experiences, it seems that most user's expectations are that nim configuration should go into the .nimble file dom96: and I think that is the least surprising and might be worth pursuing Araq: so here is a possible implementation, shashlick disruptek: that's bananas. dom96: of course I know that Araq does not want everyone to use Nimble-by-default so this won't happen Araq: disruptek: let me finish please and then you can raise your voice, ok? disruptek: i'm responding to dom. disruptek: but, sure. Araq: inside system.nim at the end of it we have something like {.autoinclude: "globalconfig.nim".}; {.autoinclude: "$project.nims".} Araq: and that's it, pragmas inside these autoinclude files do the configuration Araq: so ok, these are my thoughts, now I'm ready to take your feedback disruptek: mumble. clyybber: I find deprecating .cfg a good idea disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek Araq: hmm ok clyybber: About the other stuff, I don't know. In theory it seems like a cool way to solve the problem clyybber: But nims files are also used to compile dependencies, right? clyybber: Won't that break here? clyybber: Maybe I misunderstood what you proposed Araq: clyybber, discussions was moved to mumble... clyybber: Okay dom96: That's a nice way to get a less noisy conversation :) dom96: as long as multiple people don't speak at once Yardanico: no recordings though :( supakeen: Mumble can be recorded of course if you'd want to. shashlick: just jumped on so missed part of the discussion supakeen: dom96: If it gets out of hand mumble offers a lot of things to ensure that doesn't happen :) disruptek: this is recorded. disruptek: you can participate live or watch later. dom96: lol dom96: you should make that clear disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek Yardanico: disruptek: well doesn't twich remove all streams if you don't pay? Yardanico: after a month I mean disruptek: nope. Yardanico: recording of the stream disruptek: well, yes. disruptek: if you need to know what happened here next month, i'll let you know. supakeen: hehehe opi: reading IRC channel over Twitch, heh Yardanico: opi: you can connect to twitch from irc too btw opi: Yardanico: I'm just a Nim lurker, so I did not expect to crash head on into *deep discussions* ;-) Yardanico: ~mumble disbot: no footnotes for `mumble`. 🙁 leorize: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) Yardanico: yeah treeform: PMunch, the 15GB of free memory is an interesting problem . The memory is "freed" for nim, but its not "freed" for the os. I can see some sort of system that goes, hey I have a GB of free memory, lets return it to the OS.... treeform: Another solution could be that when allocating 100mb chunks of memory it would use system malloc and system free, by passing the free pool logic... treeform: Avatarfighter, about UDP hole punching is code-wise pretty easy, but it requires servers to exist... its a system problem not a library problem. treeform: faulander, I added a way to resize images, I don't know if you saw. disruptek: shashlick: there's a newer fork/replacement for plumble iirc. Prestige: PMunch: didn't read all of your chat earlier, but I think having a "non-strict mode" for jsonschema would be a good idea someunknownuser: Are methods currently supposed to work with --gc:arc? Yardanico: someunknownuser: try it :P someunknownuser: I am asking because I am having problems getting them to work properly someunknownuser: In some cases the base methods are called instead of the overwritten ones Araq: someunknownuser, is that specific to --gc:arc? someunknownuser: yes Araq: then report it please, it's supposed to work, the impl was ported someunknownuser: ok, I am trying to create a mininal example Recruit_main707: are they on different files? someunknownuser: yes Recruit_main707: are you sure thats arc specific?? Recruit_main707: and you are calling it from the first or second file? someunknownuser: yes, but you can try for yourself. The project in question is on github: https://github.com/pseudo-random/editor someunknownuser: calling from the file which defines the base methods someunknownuser: that would be window_manager.nim someunknownuser: when I rename the arguments to be the same as in the base method it seems to work zedeus: damn, jester crashes with arc but asynchttpserver alone doesn't Recruit_main707: Araq: is thats how its supposed to work?? someunknownuser: even if it is how that is supposed to work, changing the gc should not affect method resolution imo dadada: hmm, you can't access the sons of a NimNode directly, what I want to do is to add something to the beginning of a nnkCommand dadada: there's add() for adding stuff to the end dadada: of course I can create a new command NimNode, but that seems inefficient disruptek: shashlick: might have reproduced the choosenim problem? https://api.travis-ci.org/v3/job/674719467/log.txt shashlick: that's the github API limit issue disruptek: ah, cool. shashlick: a pain nonetheless Varriount: Do we currently have a good, cross-platform way to dynamically allocate something on the stack? leorize[m]: no, and please never do that leorize[m]: dynamic stack allocation and cross platform is a recipe for disaster leorize[m]: usually the best way would be to allocate a static chunk (ie. an `array[2048, char]`) then use parts of it as needed Varriount: leorize: I should use recursion then? leorize[m]: depends on what you're doing Varriount: Path processing. Specifically collapsing `..` elements. leorize[m]: though recursion is a kind of dynamic stack allocation, just a bit more structured leorize[m]: I think a seq acting as a stack works here Varriount: I guess. Seems like a waste to allocate something that will only store a couple of integers on the heap though. leorize: systemd devs thought so and they stack overflowed their stuff to oblivion :P leorize: a big static array works too if you feel like it Varriount: Good point. leorize: a nim int is 8 bytes on a 64 bit machine leorize: a typical path is usually < 256 char leorize: so around 2kb of stack space for an array[256, int] SrMordred: Are nim incremental compilation working? i´m experimenting on windows and looks like it compiles eveything again even if nothing is change leorize: should be affordable given how stack size are typically 2-4MB companion_cube: gosh I read `8 bits` and was panicked for a second' leorize: @Varriount: as an optimization I guess you can use this for path shorter than 256 char leorize: of course the true optimization is to bring out SIMD and get position of all path seps simultaniously :P leorize: but until someone create a lib that let you do low overhead runtime function selection based on processor I don't see SIMD getting used in generic library code anytime soon Generic: @SrMordred afaik there was some work on incremental compilation though it's not complete and currently paused leorize: disruptek is working on incremental compilation SrMordred: @Generic oh, i thought that it was already working. thanks! Recruit_main707: how does incremental compilation work?? PMunch: Prestige, yes but should it be the default? Prestige: I think most have that set by default, so it may be implicitly expected by the end user of the lib PMunch: treeform, it's a tough problem indeed.. And one that can't really be properly solved without either A moving memory or B having better control over memory (something that OSes don't provide unfortunately) PMunch: A requires another level of indirection if it should be completely hidden from the caller though.. Prestige: PMunch: before you go, let me PM you my pub key Elegant Beef: So im currently playing around with xlib making a tiled window manager, and any clues how to manage createnotify messages? It seems some applications send more than one and the parent isnt set Prestige: Elegant Beef: I'm doing the same currently, haven't gotten quite there yet though. Using this for a reference https://tronche.com/gui/x/xlib/ Elegant Beef: Yea same Elegant Beef: Nothing quite explains how to handle windows on created Elegant Beef: A lot of what i see frames them but if i do that it just ends poorly Prestige: I'm also using an existing wm in C as reference as well, if that will help you Prestige: I'm about at the same step as you are Prestige: https://github.com/avahe-kellenberger/dwm/blob/master/src/dwm.c the run function handles the events Elegant Beef: I've looked at basic_wm and dwm Elegant Beef: The C code is written so minimalistically it's hard for my tiny brain to follow Elegant Beef: atleast in DWM Prestige: It's been taking me some time to determine what some variable names stand for but I'm making progress Prestige: I don't see dwm handling any createnotify events actually Elegant Beef: IIRC it usues the map or other notify message to handle it Elegant Beef: uses* Prestige: Yeah Prestige: I'm away from my computer for another 30 mins but I'll let you know if I find anything when I'm back Elegant Beef: Ok, idk about you but my plan is to use nimscript for customizing/widgets, and nuklear or cimgui for the default bar Elegant Beef: The embeddedNimScript repo looks promising for this, since it can communicate from nims to nim and vice versa Prestige: I'm probably going to not have a bar integrated in the WM, I'll make it a separate program disruptek: !repo nuklear disbot: https://github.com/zacharycarter/nuklear-nim -- 9nuklear-nim: 11Nim bindings for https://github.com/vurtun/nuklear/ 15 94⭐ 8🍴 7& 1 more... shashlick: folks, appreciate feedback - made a big README update for https://github.com/nimterop/nimterop Recruit_main707: ill read it now Prestige: Elegant Beef: this might be useful https://tronche.com/gui/x/xlib/events/processing-overview.html KingDarBoja: Hi guys Elegant Beef: I just dont quite see which windows on created are important and which arent KingDarBoja: That single tests that doesn't work on your suite and you have no idea why lol Prestige: hm Elegant Beef do u know the difference between DefaultRootWindow and XDefaultRootWindow? Elegant Beef: No Recruit_main707: can you write some kind of program that reads c2nim errors and tries to fix them? (ie: put a `;` where it expects it and pray that works :P ) KingDarBoja: I think I request some help on checking a module from Python source code vs my Nim approach KingDarBoja: I think I will have to* Recruit_main707: ask KingDarBoja: Hold on, watching some anime OST right now Recruit_main707: xD KingDarBoja: SAIDO CHESTOOOO exelotl: shashlick: I don't think it should link to "theindex". Not twice, and especially not as the first mention of links docs. It's a bad user experience x) exelotl: *of links to docs exelotl: the new readme content is good though! much better organised Recruit_main707: Downloading https://github.com/alehander42/Nim using git may i ask why does this appear when running a nimble file? shashlick: exelotl: cool, ya theindex lists all modules, that's the only reason, but it isn't really the best exelotl: I've accidentally clicked on it multiple times because it's the most promising-looking link on the page shashlick: 😄 exelotl: One thing that I think is missing - as a newcomer, it needs to be explained somewhere early on, that the code in the readme goes into a file which *is* your wrapper, as in, you can import it in a real program and use it. dadada: krux02: hey yo! mathAstFind would definitely be plenty useful! krux02: dadada, what is mathAstFind? dadada: like you wrote in the discussion section of https://github.com/krux02/ast-pattern-matching/ dadada: it's at the bottom dadada: I assume you wrote that "A matchAstFind that would recursively search though the ast and stop at the first match would make sense. Here it would also be sane to use the else branch for the case that the entire ast does not have any match at all." krux02: Ah I remember now krux02: yes I wrote that krux02: a long time ago though exelotl: shashlick: What I mean is, it's a small thing but I think the readme really needs to say what to *do* with the code. Because, initially, I was still in the mindset that I somehow need to run the code by entering some command or something krux02: dadada, yes that else branch is good krux02: I just don't get the time to implement it. krux02: I will probably implement it as needed. dadada: ahm, I could use it right now :-() dadada: :D Recruit_main707: Languist (py2nim) seems to be outdated, does anyone know if it’s dead? krux02: ok fair point krux02: good to know that ast-pattern-matching is useful for you krux02: Recruit_main707: I am not even sure if py2nim is a sane projet to begin with. dadada: stuff like is what separates Nim from the rest :D krux02: yea I use ast pattern matching in my opengl wrapper generator krux02: sorry I mean my nim to glsl compiler Recruit_main707: krux02: py2nim now works with languist, (it just basically calls it) shashlick: exelotl: will try to cover that better - also realize i didn't talk about command line as much - the -d:xxx stuff dadada: so we have a walker for iterating/walking through a NimNode tree recursively? dadada: s/so/do dadada: I'm really not in the mood for rolling my own :-( Skaruts: doesn't nim support this: `echo "$1" % [10]` zetashift: I have no idea what that is Skaruts: I'm getting `undeclared identifier: '%'` Yardanico: import strutils Yardanico: and 10 needs to be a string so use $10 Yardanico: or just use strformat :) Yardanico: !eval import strutils; echo "$1" % [$10] NimBot: 10 Skaruts: oh thanks zetashift: huh I've always used strformat's fmt and & Yardanico: lol Yardanico: I remember the old times when we didn't have strformat :P Yardanico: there was strfmt but I didn't really use it, I only remember that nimbench depends on it zetashift: you're at the stage you can have nim nostalgia huh Yardanico: well even though I don't do nim stuff that often, I've been around for like 3 years :D Skaruts: what does !eval do? Yardanico: executes nim code via nim playground and shows output Yardanico: https://github.com/nim-lang/nimbot/blob/master/src/nimbot.nim#L98 Yardanico: !lag NimBot: 88ms between me and the server. Yardanico: !ping NimBot: pong Skaruts: 🙂 Skaruts: !eval import strutils; echo "$1" % [$10] NimBot: 10 Skaruts: oh I see Skaruts: lol Yardanico: !eval proc b(x:int):int=(result=5;(if x>5:(if x<3:(if x==0:(echo x;echo x-1)))elif x==0:(echo 0;echo 5)else:return 5)) NimBot: Yardanico: from https://forum.nim-lang.org/t/5858 if someone's wondering Skaruts: !eval echo "I'm a nice bot!" NimBot: I'm a nice bot! Yardanico: It's literally same as on https://play.nim-lang.org/ :) Prestige: I'm having an issue exporting iterators and calling it from another module, is there something I'm missing? https://play.nim-lang.org/#ix=2iej Yardanico: you can't get a value from an iterator like that Yardanico: you need to use a for loop Yardanico: like "for event in eventpoller.nextXEvent(display): stuff" Yardanico: also "continue" on line 11 is unneccesary since you don't have any other code in a while loop anyway Prestige: Thanks! Prestige: was a little confused looking at the bottom of https://nim-by-example.github.io/for_iterators/ Yardanico: the bottom example is a proc returning an iterator Yardanico: so "let next = countTo20()" doesn't get a value from an iterator, it gets an iterator itself Prestige: ah Yardanico: sadly you can't have next() like in Python in nim currently, but there's https://github.com/nim-lang/Nim/pull/11992 Prestige: Hopefully I can learn this language well enough to start contributing soon Yardanico: well you can always start with simpler stuff like finding typos or contributing more docs :) Prestige: I'll keep an eye out :P It's been a fun few days so far Yardanico: I'm reading crafting interpreters book, and after making a scanner (it's pretty simple, I've mostly same stuff in my nim-mathexpr lib, but in there it's just single-pass so there's no separation between scanning and evaluation passes) the creator now wants to use "metaprogramming" by making a Java program which will generate Java classes for different AST node types Yardanico: (I'm doing it in Nim though, I don't want to touch java xD) Yardanico: and I don't think I'll need this "metaprogramming" hack either Yardanico: i'll use object variants instead just how I did with the scanner/lexer/tokenizer (I guess these all mean roughly the same nowadays) :P Yardanico: I just checked and Nim AST uses object variants too of course Yardanico: https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim very interesting to look at of course shashlick: I agree the ast is very well designed Yardanico: wait I can do nested object variants? amazing Prestige: I was trying to find something like a map/dictionary in nim and came across this: https://nim-lang.org/docs/options.html#map%2COption%5BT%5D%2Cproc%28T%29 but I'm confused about its use Yardanico: you mean a hash table? Prestige: Couldn't you just invoke saveDouble(a) without calling map? Prestige: Yeah Yardanico: https://nim-lang.org/docs/tables.html leorize: tables Prestige: Thanks - my question about map is unrelated though (I realized it was a different thing) Prestige: Don't understand what its use case would be Yardanico: "Applies a callback function to the value of the Option, if it has one." Yardanico: basically "do something on an Option object if it has a value" Yardanico: it's literally 2 lines of code, just to make your life simpler and code shorter :) Yardanico: https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/options.nim#L239 Yardanico: don't fear the stdlib, most of the code in stdlib is really nice and understandable Prestige: ah so it's checking if it has a value, cool Prestige: Would there by any performance differences/advantages to passing a pointer rather than its dereferenced value? Yardanico: well it depends on the size of objects you operate on I guess Yardanico: and also if you need to modify them leorize: it doesn't depend on the size fwiw leorize: nim do pass by reference if obj > 3x float size Yardanico: oh Prestige: They're just xevents so they should just be read KingDarBoja: Woah, just finished reading the whole stack of messages KingDarBoja: Too sad to know the vscode nim plugin is doomed :c Yardanico: wdyn? Yardanico: *wdym? Yardanico: I mentioned that vscode nim plugin is the most "complete" one == the best Yardanico: althoug nimlsp is getting there so maybe I should search for other editors with LSP support :) KingDarBoja: I didn't saw your comment D: Yardanico: what did you mean then? KingDarBoja: Oh I got it wrong KingDarBoja: It says: "VSCode's syntax highlighting is just broken in all sort of ways" Yardanico: well it's not perfect but it works fine Yardanico: oh I see where that was KingDarBoja: Btw, in my case, it is annoying to save some file and then move into another file that uses the previous saved module as saving trigger errors on it Yardanico: well how would you want it to work instead? :P Yardanico: use autosave maybe KingDarBoja: Usually the file I work on, trigger the errors on the same file without relying on another different file save for checking it. KingDarBoja: I didn't know it was the supposed behaviour 😆 Yardanico: well vscode nim plugin doesn't "rely on another different file save" itself Yardanico: it uses nim check for checking files Yardanico: and "nim check" needs, well, to read the file from the disk in order to check it for errors :) Yardanico: vscode nim plugin uses "nim check" for different kinds of highlights, nimsuggest for code completion, and syntax highlighting is built into the plugin itself KingDarBoja: So it only find errors after checking the whole file by using another file in my case? Yardanico: well, "nim check" is just nim compiler but without the actual "compile to binary" step KingDarBoja: Arrrgh sorry if it sounds weird, it is better if I provide some recording Yardanico: it imports modules as the nim compiler does Yardanico: so if the file you want to check uses an unsaved module "nim check" will use the older source because that's what is available on the disk KingDarBoja: I always save the file first KingDarBoja: The errors usually comes while writing the test file and saving it KingDarBoja: Like, some proc I wrote seems okay, I hit save and no errors KingDarBoja: Then go to tests folder, create some test suite and hit save, then the first module shows some errors like "dude, you forgot to cast this thing" KingDarBoja: Something like that is what it happens to me Yardanico: because nim has dead code elimination :) Yardanico: and it's always enabled Yardanico: but it will show errors for stuff like proc anyways Yardanico: but not for templates or macros for example Yardanico: if you have incorrect code in a template or generate incorrect AST in a macro you'll only know that when you use it Yardanico: that's how the language works :P KingDarBoja: I see, well I am using proc everywhere so... KingDarBoja: Didn't know it was the "cause" KingDarBoja: Maybe because the languages I have use aren't statically typed and all that stuff (Python I am looking at you) KingDarBoja: In the meantime, I didn't noticed I opened a issue pretty much like this one -> https://github.com/pragmagic/vscode-nim/issues/107 Yardanico: oh yeah that's very old Yardanico: vscode nim plugin doesn't properly parse .cfg and .nims files KingDarBoja: https://github.com/pragmagic/vscode-nim/issues/107 KingDarBoja: Yeah, closing mine right now KingDarBoja: Dang, I have lost my desire to keep coding these days due to my job lol Yardanico: what's your job? coding? :P KingDarBoja: Yes KingDarBoja: "FullStack Dev" lol Yardanico: well yeah that's understandable KingDarBoja: But even thought one of my projects is awesome KingDarBoja: The new one is pretty much like styling components using CSS (Tailwind) KingDarBoja: And ofc I am more biased to handle logic and coding than UI/UX stuff Yardanico: btw, I wonder what's better for AST: object variants or methods, guess object variants for performance (since Nim itself uses them), methods for shorter code? Yardanico: i just hope we get ability to use fields of same name in object variants (if they hold the same type at least) Yardanico: AFAIK there's a PR for that KingDarBoja: I wished for that too KingDarBoja: So I could get rid of this Yardanico: dont do big pastes KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L194 KingDarBoja: I know bro, calm down 😄 Yardanico: well Yardanico: you can do your code with object variants Yardanico: you'll just do stuff like "boolVal: bool" Yardanico: "floatVal: float" Yardanico: so fields are of different names Yardanico: also btw you can have multiple types in one "type" block, you don't need it for each type separately Yardanico: like https://play.nim-lang.org/#ix=2ieO KingDarBoja: I haven't got deeper with the port but I feel like the value is gonna be needed with that name somewhere else KingDarBoja: Oh, yeah, I have that on my TODO list Yardanico: well with object variants you do a big "case" statement in your type declaration Yardanico: and then in code which handles different token types you do stuff like "case tok.kind of Literal: do stuff with literal" etc Yardanico: you can put that into separate procs too of course KingDarBoja: Yeah, it was the earliest KingDarBoja when asking for that and I went into full mode inheritance 😆 KingDarBoja: I will do a quick check to see if I really need to maintain the same prop name for things like that Yardanico: you can always live without it, it just depends on how much code you'll need to change KingDarBoja: like "value: float" for one type and ""value: int" for another KingDarBoja: Let me check... IntValueNode Yardanico: so you'll have a single "Node" type with a kind field (of ASTKind) Yardanico: Just fyi - nim standard style guide prefers to write abbreviations like Www or Http for easier typing and stuff :) Yardanico: but it's styling and nim doesn't enforce you for a single style, so you can write like you want Yardanico: here https://nim-lang.org/docs/nep1.html Prestige: Can someone tell me what's wrong with this? https://play.nim-lang.org/#ix=2ieQ Prestige: Getting a type mismatch on the last line KingDarBoja: That tip was because? KingDarBoja: The Node names? Yardanico: Prestige: "const" -> "var Yardanico: "const" is compile-time only Prestige: ah thanks Yardanico: "let" is runtime immutable, "var" is runtime mutable Prestige: so is there no way to declare it as let? I thought that would be okay Yardanico: no Yardanico: well you actually can if you use "newTable", but there's no reason to really Yardanico: "let" itself is immutable, but in case of ref objects the underlying value is mutable but the reference (ref object meants a reference to an object) is immutable, so you can't point it to another object after assigning KingDarBoja: https://github.com/search?q=org%3Agraphql-python+parse_int&type=Code Yardanico Prestige: ty ty Yardanico: @KingDarBoja so? Yardanico: I mean if it's a 1:1 port it's ok KingDarBoja: I find the lack of code uses disturbing KingDarBoja: LOL KingDarBoja: Now I need to check the source of the source, the JavaScript Implementation Yardanico: i'm reading craftinginterpreters.com book, and the author uses Java for first implementation so heavy use of interfaces and classes (for Visitor pattern and AST nodes), I prefer object variants so I write it like this Yardanico: https://play.nim-lang.org/#ix=2ieT Yardanico: it would actually be less lines than Java code anyway KingDarBoja: Seems clever KingDarBoja: By the way Yardanicco-sensei Yardanico: wat KingDarBoja: https://github.com/graphql/graphql-js/search?q=parseInt&unscoped_q=parseInt Looks like I have no issues with properties names as those are only used to pass value KingDarBoja: Nothing else it seems Yardanico: well I'm just saying that in case of AST trees it's always possible to replace inheritance with object variants :) Yardanico: nim compiler itself uses object variants for AST so ... KingDarBoja: Nvm, I found a possible need of value name KingDarBoja: Yeah, I know what you mean Yardanico: I didn't say you can't keep value name Yardanico: you can keep it KingDarBoja: I know, but would be awesome If I could use object variants AND same property names across several kinds KingDarBoja: Like the PR KingDarBoja: If that get's merge, I would rewrite it for sure 😄 KingDarBoja: But I would like to have some good example between each approach advantage and cons KingDarBoja: pros and cons* Yardanico: @KingDarBoja i'll try to find that PR but you with that PR you won't be able to use same name for fields of different types KingDarBoja: WAT Yardanico: ? KingDarBoja: https://github.com/nim-lang/RFCs/issues/19 Yardanico: yes Yardanico: "And while we are at it, should it also be possible to have attributes of the same name but with a different type depending on the branch? No." KingDarBoja: Ohhhh right, they can't use different type KingDarBoja: 🤦 Yardanico: there's my own comment in that issue too btw KingDarBoja: "Allowing to do this would allow much nicer type definition and usage for types (in some cases)" KingDarBoja: Oh yes KingDarBoja: `I mean if it's a 1:1 port it's ok` ❤️ Quote of the day Rika: Hi KingDarBoja: ❤️ hi Rika: So I stopped porting some calculation code for my osu library project, and started creating a PEG to replace my manual parsing instead for some reason Yardanico: use npeg Yardanico: also i created a git repo to follow my progress for some reason https://github.com/Yardanico/nim-lox KingDarBoja: So weird, I thought I had a note explaining the diff between object variant and type inheritance Yardanico: @KingDarBoja object variants are just mapped to C's union types :P Yardanico: for JS backend it's different though Rika: yardanico i am already KingDarBoja: So pros and cons between each approach? Just to copy into my notes? 🙈 KingDarBoja: I have zero knowledge of C 😄 KingDarBoja: I mean, only the very basic knowledge which means zero hahaha Yardanico: well to be honest I can't really answer that question, I've just always used object variants because I feel that they're more "idiomatic" in Nim :) Yardanico: maybe object variants are a bit faster at runtime, I'm not really sure Rika: you cant use object variants if 2 kinds share only certain fields KingDarBoja: Makes sense to me Yardanico: @Rika you can, just name these fields differently KingDarBoja: The idiomatic reasoning I mean KingDarBoja: 😋 Rika: defeats the purpose imo KingDarBoja: What's the main purpose ? Not just bring all kinds into a shared Main Kind, in this case, a root Node Type? KingDarBoja: And use the case stmt to specify certain fields? Prestige: Yardanico: does this look correct? Was having trouble getting it to compile (it's compiling now) https://play.nim-lang.org/#ix=2ieZ Rika: example: i have 3 kinds, only 2 kinds share this one field, and all kinds have unique fields, what do i do aside from naming the shared field differently per kind? Prestige: Also I was at first trying to call listenerMap[theType].add(listener) but it seemed to be trying to call a different add method Yardanico: well, 1) nim seqs nowadays are initialized by default, 2) you don't need to explicitly use "system.add" Yardanico: hmm Yardanico: it works for me just fine though Prestige: well add(...) works but listenerMap[theType].add(listener) wasn't Yardanico: it works for me too :P Yardanico: also in nim you don't have to specify "void" return type Rika: also `if not listenerMap.hasKey(theType):` can be `if theType notin listenerMap:` no? Prestige: hm Prestige: oh neat Yardanico: https://play.nim-lang.org/#ix=2if0 Yardanico: ah sorry you were checking for the key Yardanico: ah actually no Yardanico: you can remove it, yes Rika: no i dont think you can Yardanico: @Rika the original code was checking if a key already exists Rika: you're adding to a key that isnt created Yardanico: ah yeah Yardanico: so keep it :P Rika: lol Yardanico: Prestige: https://play.nim-lang.org/#ix=2if2 Prestige: ah Yardanico I was having the issue when declaring - let listeners = listenerm Prestige: 1 sec Yardanico: "a notin b " is just sugar over "not (a in b)" Yardanico: and tables have "contains" proc defined so "notin" and "in" just work for them (TM) Prestige: https://play.nim-lang.org/#ix=2if3 <- was having issues with this particular setup actually Prestige: if I declare listeners then try listeners.add(listener) Yardanico: yes Yardanico: because "let" is for immutable stuff Yardanico: and you are trying to modify an immutable variable :P Prestige: ah I thought that was just for assignment, mb KingDarBoja: Rika: I don't see any other use case for objects variants Yardanico: https://narimiran.github.io/nim-basics/#_immutable_assignment Yardanico: Prestige: ^ Prestige: Thanks :) Yardanico: that book generally covers most of Nim Yardanico: well, the simpler stuff Rika: i think object variants work best if you can make them work Yardanico: it doesn't cover macros/iterators/templates/converters/generics/etc, it's for people who are relatively new to Nim or to the programming in general KingDarBoja: Or maybe I got your example wrong Rika: otherwise youre stuck with inheritance i assume KingDarBoja: Yeah, inheritance is way more familiar for newcomers that are used to it. Yardanico: I wasn't really used to inheritance when I (re)discovered Nim in 2017 :P Yardanico: I was using Python at the time Yardanico: also I mean (re)discovering because I vaguely remember visiting (then) Nimrod's website in 2014 KingDarBoja: Python inheritance is kinda weak Yardanico: with old design Yardanico: oh yesss Yardanico: the old crown KingDarBoja: As everything in Python is an object, You couldn't trust at all with inheriting from a base type KingDarBoja: But object protoyping in Javascript is way weird IMO Rika: i want more ways to identify whether some type adheres to container mechanics, i guess i just want better concepts no? Yardanico: concepts are for compile-time only KingDarBoja: So better look at Java for these examples hahahs Yardanico: like you can't store "concepts" in a sequence Yardanico: concepts are not interfaces Rika: i never needed to Yardanico: otherwise concepts can be quite cool Rika: i dont think ive needed it for runtime Yardanico: I've (re)discovered Nim by pure chance - was having a heated argument with a guy on a social network about languages and stuff, and he mentioned Nim KingDarBoja: Don't tell me concepts is another Num stuff Yardanico: it is Yardanico: it's an "experimental" feature since some version though Yardanico: one of the simplest examples is https://github.com/Yardanico/nimpylib/blob/master/src/pylib.nim#L10 KingDarBoja: Nim* Yardanico: You "describe" what a type should have Yardanico: and then you can make proc which accept any object which matches with a concept Yardanico: https://nim-lang.org/docs/manual_experimental.html#concepts Yardanico: also there are term-rewriting macros in Nim too :P KingDarBoja: I got tempted to use that but preferred to do it on my own Yardanico: https://nim-lang.github.io/Nim/manual_experimental.html#term-rewriting-macros Yardanico: really neat stuff Yardanico: arraymancer actually uses them to apply some optimizations Yardanico: https://github.com/mratsim/Arraymancer/blob/532f45a6/src/tensor/optim_ops_fusion.nim#L53-L74 Yardanico: ah yeah I remember a very funny example KingDarBoja: By looking at that iterable KingDarBoja: Does that means I can pass a tuple or sequence as those are the "same" type KingDarBoja: By same I mean, iterables Rika: oh yeah i remember someone writing a string obfuscator with them term rewriting macros Yardanico: it wasn't with term rewriting macros was it though? if you mean xor it's just macros Yardanico: not term rewriting macros Yardanico: https://forum.nim-lang.org/t/1305 Yardanico: ah nvm found https://forum.nim-lang.org/t/338 Rika: yup Yardanico: https://forum.nim-lang.org/t/338#1767 idk if that works rn though Rika: the one where you dont need to invoke the macro on the string Yardanico: @KingDarBoja it won't work for tuples because they don't have an "items" iterator KingDarBoja: Gotcha KingDarBoja: Still I do better feel using pure Nim code to get away of Python lazyness KingDarBoja: From* Yardanico: well this is nim code Yardanico: @KingDarBoja @Rika term-rewriting templates/macros are very "fun" https://play.nim-lang.org/#ix=2if5 😄 Yardanico: run it Yardanico: well, the compiler shows hints when a term-rewriting pattern was applied Prestige: Hm this is weird, is HashSet not in hashes? Yardanico: https://nim-lang.org/docs/sets.html Yardanico: "hashes" is for, well, hashes themselves Yardanico: like get a unique hash of a string or of a number KingDarBoja: Loool Rika: ? lol? KingDarBoja: Brainf"ck with that rewrite Yardanico: power of nim :PP Rika: imagine how many people you can fuck over with term rewriting macros... Yardanico: @Rika compiler shows hints tho 😦 Yardanico: ah wait actually Yardanico: HAHHAHA KingDarBoja: Imagine someone putting that on someone code 😋 KingDarBoja: That's a new level of trolling hahshsh Rika: who the fuck reads hints 😛 KingDarBoja: X2 KingDarBoja: I am on bed right now listening some OSTs Yardanico: @Rika, that term rewriting macro for encrypting string actually worked btw Yardanico: works* Yardanico: i'm adapting it to the encryption used in https://forum.nim-lang.org/t/1305 Rika: nice, id like to see the code once youre done 😄 shashlick: yay for varargs support Yardanico: shashlick: really? you actually did it? :D shashlick: yep - i can push a branch, want to test? Yardanico: yeah Yardanico: @Rika https://play.nim-lang.org/#ix=2if9 maybe it can be simplied a bit but it works and no recursion at compile-time Yardanico: and the binary will contain "\xB2\xBE\xA8\xA9\xA9" bytes for "hello" Yardanico: actually on each recompile the values will change because the key uses compilation time and date Yardanico: of course it won't save you from professional reverse-engineers, but will certainly help to hide some info from the less experienced "users" 😛 shashlick: Yardanico: pushed a varargs branch for nimterop Rika: something that would save from amateur reverse engineers would be a per string key Yardanico: ehm Yardanico: this code has a different key for each string Rika: ah its a counter Rika: not a key Rika: 👀 Yardanico: it's a compile-time counter yeah, the resulting binary will only contain generated keys Rika: so string order influences bytes too Yardanico: shashlick: testing now Rika: is +% and *% saturated arithmetic? Yardanico: how do I enable debug mode for this build? Yardanico: I got "/home/dian/.nim/lib/core/macros.nim(1827, 31) Error: undeclared identifier: 'vlc_object_t'" Yardanico: @Rika https://nim-lang.org/docs/system.html#%2B%25%2Cint%2Cint Rika: yardanico: i read that Rika: in one ear, out the other Rika: `The result is truncated to fit into the result` this fooled me shashlick: Use -d for flags shashlick: If you need it of course Yardanico: it's already there Yardanico: I just get "/home/dian/.nim/lib/core/macros.nim(1827, 31) Error: undeclared identifier: 'vlc_object_t'" shashlick: Ok, where is vlc_object_t defined shashlick: In the headers Yardanico: ah it was my fault Yardanico: seems like the old nimterop backend just ignored that type (?) Yardanico: it's in "vlc_common.h" which I did not import before Yardanico: now I get "Error: unhandled exception: getters.nim(109, 14) `name[0] != '_' and name[^1] != '_'` Identifier 'vlc_value_t:_Bool' (nskType) contains leading/trailing underscores '_' [AssertionError] [AssertionError]" Yardanico: fixed that by adding another "elif" to onSymbol Yardanico: now I get a different assertion error, will get the output Yardanico: shashlick: it's quite long https://gist.github.com/Yardanico/313b472a16fdf39b4b4603dae12845c8 Yardanico: seems to fail on vlc_callback_t Yardanico: https://git.videolan.org/?p=vlc.git;a=blob;f=include/vlc_common.h;h=222ce81bc40185031f69c2d8985c7decbc7c31bb;hb=HEAD#l490 shashlick: Ya added nested struct support yesterday shashlick: Must be comments throwing it off Yardanico: how can I modify a header and say to nimterop to not re-fetch? shashlick: It won't refresh unless you -f shashlick: Refetch Yardanico: well it seems to revert old file state, I have "-f:ast2 -d" flags shashlick: Well it does git reset at the beginning shashlick: It could be the void * Yardanico: yeah I thought that too Yardanico: that's just "pointer" in Nim right? shashlick: Most likely the char const * shashlick: Ugh, the gift that keeps giving Yardanico: yeah it's pretty complex Yardanico: I would've only used the "libvlc" headers but they refer to VLC headers :/ shashlick: Try skipping that proc for now, I'll fix it shashlick: What else breaks Yardanico: wait I think I can just ignore these headers if I skip vlc_log_t Yardanico: so I can only use libvlc headers Yardanico: ah no I can't :/ Yardanico: can I just get a few functions from the header? Yardanico: libvlc seems to need "vlc_log_t" from vlc_messages.h and nothing more shashlick: Nope it just pulls everything unless skipped Varriount: Hm, I tried using term-rewriting macros to automatically rewrite type declarations, but it didn't work (unfortunately). shashlick: I might have a simple fix, let me see Prestige: Random question, why do sets use incl and excl instead of add/remove? Yardanico: for what? Prestige: adding and removing elements Yardanico: in where? :P narimiran: `add` in strings, seqs, etc. adds *to the end*, which is not the case for sets Prestige: in sets, like a HashSet Yardanico: they don't have "add" anyway shashlick: Yardanico: will check back in the morning, quite late now, thanks for testing again Yardanico: it's more of a mathematical notation I guess Yardanico: "include in the set" Prestige: ah Prestige: just used to other languages I suppose haha Varriount: shashlick: https://play.nim-lang.org/#ix=2ifm Yardanico: maybe you wanted to reply to me instead? :P Varriount: Yardanico: Do you know if there's a way to do what I'm trying to do? Yardanico: yeah I'm trying, although I'm not really experienced with term rewriting macros :P Yardanico: @Varriount with this it calls the macro "macro foo{a}(a: typed{nkTypeDef}): NimNode =" Yardanico: but there's an error for some reason "Error: invalid expression: Foo = int" Varriount: "this"? Yardanico: I mean change macro definition to this Yardanico: the code in quotes I sent 😛 Yardanico: ah you need nnkTypeSection maybe? Varriount: Yeah, I was just trying that Varriount: So that code, along with a `--include` or `--import` argument to the compiler, would provide a (probably hacky/half-baked) way of automatically generating run-time type information. Varriount: @Yardanico I also don't know if term-rewriting macros affect code generated by regular macros. KingDarBoja: https://github.com/vcg-uvic/viper Yardanico: what's the best way to copy a ref object instance? Yardanico: so it'll work with --gc:arc and whatnot sheerluck: 17000 commits in devel leorize: Yardanico: obj[] = another[] Yardanico: thanks :) Yardanico: @sheerluck yay! Yardanico: 16999 though XD Yardanico: who will make the 17000th commit Rika: ara q ofc Rika: i kid leorize: forum is down for me leorize: 504 :( narimiran: same here narimiran: dom96: ^ narimiran: leorize: now seems to be ok for me.... PMunch: Might've just been something on CloudFlares side (I think that's still used) leorize[m]: the systemd service probably auto restarted :p PMunch: Or that, of course .P PMunch: Hmm, this is a bit worrying: https://forum.nim-lang.org/t/4932. So Nim will always occupy it's peak memory usage.. leorize[m]: nim does release memory PMunch: Well, looking at this quote: "Fix nim's GC so that it returns memory back to the OS more reliably. It's not that hard, we can give it a shot." it seems like it releases memory sometimes, possibly, maybe leorize[m]: the reuse pool is around 8MiB PMunch: Why does treeform have issues with it using 15Gb then? leorize[m]: logical leak PMunch: Meaning? Varriount: Yardanico: I feel like term-rewriting macros could be used for more things, they just aren't well known. Yardanico: yeah, that's true Yardanico: and they have a lot of bugs probably too :P Zevv: PMunch: returning memory is hard because of fragmentation Zevv: You get a huge chunk from the os, you need to return it as a huge chun. But if even one tiny little object lives on that chunk, it can't be returned Zevv: it's a very common probplem and by no means specific to nim. In practice it is not as bad as it sounds, because these pages end up stale and will be swapped out under memory pressure. livcd: "Fix nim's GC so that it returns memory back to the OS more reliably. It's not that hard, we can give it a shot." Zevv: well, I'm interested in how that would work! PMunch: Well you could have a pager in the Nim GC PMunch: So that if you request 15Gb of data it would allocate it in chunks so that it could free chunks of it later Zevv: sure, that's basically how it works. But the problem is that a chunk needs to be 100% unused Zevv: so imagine you slurp 15Gb of json and keep 1% of the nodes referenced Zevv: these are spread all over the heap Zevv: so now all these chunks have 1% of them used and the rest unused Zevv: still you can not return Zevv: we do not have a moving GC Araq: livcd, Zevv with -d:useMalloc is outside of our domain though Araq: and once again we should focus on ARC, IMO Yardanico: I forgot, "use" got removed from Nim? Yardanico: ah, seems so Araq: what's "use"? Yardanico: Araq: ah, sorry, I meant "using" Yardanico: oh wait it's still there Yardanico: XDD Yardanico: oh yess amazing I love it Yardanico: when you have 15+ procs which take the same first type "using" is good Araq: Yardanico, please fix the docgen so that it understands 'using' ;-) Yardanico: to expand types from "using"? Yardanico: I'll try dadada: ? get's recognized as Prefix, but I want it to be treated like a command, can achieve this by using `?`, but I'd like to teach Nim that ? should always be assumed to be `?` PMunch: That's unfortunately not possible PMunch: Huh in the manual under lexical analysis -> other tokens it mentions [: being a token (but not :]). What is this used for? Yardanico: PMunch: [: is for specifying generic instatiations with UFCS Yardanico: like if you have proc test[T](a: Interpreter, b: T) Yardanico: you can call it as myinterp.test[:int](5) PMunch: Aaah, that's how you do that! Yardanico: it's in https://nim-lang.org/docs/manual.html#procedures-method-call-syntax Yardanico: in the end of that section Yardanico: @zetashift did some stuff today https://github.com/Yardanico/nim-lox PMunch: Is this a new thing? Recruit_main707: it would be so cool writing a python interpreter in nim Yardanico: it's not hard to write a *minimal* one with a subset of Python Yardanico: like RPython Yardanico: but if you will implement all features it'd be harder :P Araq: IMHO it's easier than you think to simply copy compiler/vmdef|vm|vmgen.nim and mutate it heavily Yardanico: well yeah that too Araq: to give you a VM for Python PMunch: Haha, that would be a fun project indeed. Not sure why you'd want that for anything though :P Araq: I cringe every time I see people write new stack based VMs in Nim Recruit_main707: lmao PMunch: Well, I guess as a way to embed PythonScript® in a Nim project Recruit_main707: i dont get the point of embeding python in nim Yardanico: yeah lua is better for an embedded language Yardanico: or NimScript even better :P Recruit_main707: id like to do it the other way around Recruit_main707: basically being able to use autoswig with nim or something Recruit_main707: has someone tried running some of this tools with nim's generated c/c++ code?? Yardanico: ? Recruit_main707: pybind11, autoswig... Recruit_main707: all those things PMunch: Hmm, is there a way to get Nim to generate a .h file for the exported symbols and types in a module? Recruit_main707: --header? Recruit_main707: i think thats exactly what you want Araq: --header is not supported PMunch: Yeah it's not in the manual, or in --fullhelp.. Araq: the code generator simply wasn't designed for this and Nim is not a transpiler ;-) dadada: so the only path I see to do what I was going to do is to write a preprocessor for nim files that converts occurances of ? to `?`, obviously that's complicating things a lot and introducing an imcompatibility with regular Nim code Recruit_main707: wdym? ive used it Yardanico: dadada: there's that thing... Araq: dadada, why is it so important though? instead of ? x you can use 'q x' Recruit_main707: i dont understand why do you say --header is not supported dadada: Araq: technically yes, want to use ? because it's much easier to grasp what the code is intended to do Yardanico: you can do it with https://nim-lang.org/docs/filters.html Yardanico: but please don't Araq: dadada, what is it intended to do? dadada: Araq: I'm experimenting with creating a concise syntax as a drop in replacement for if-else ladders, from past experiences in this channel I know that things like this aren't always welcomed here, so let me stress that this is my personal fun project, not more, not less, and I'd this to be respected Yardanico: what's wrong with if: a else: b Yardanico: a little more characters but much more consistent Araq: dadada, it's fine and I'm sorry that this channel can be unwelcoming dadada: Yardanico: I just KNEW, this was going to instanstly be the response here, hence my last sentence, it's just so annoying to be criticized for every single thing you might try PMunch: dadada, when did people hate on stuff like that? As long as it's for fun it's cool :P Yardanico: I don't criticize you Yardanico: I just don't understand why PMunch: For fun! dadada: PMunch: exactly, a couple of times, and I've only been here for a few months Araq: x ? y ! z # like so? PMunch: I've sometimes tried to see just how far I can stretch the syntax, even though I know it's a bad idea to actually use it for anything :P Recruit_main707: look at me! i am supporting nim for a framework, and no one else is gonna even use it! PMunch: dadada, I don't think people are really criticising it, they just don't understand why you'd want to do it that way. It's just genuine curiosity dadada: Yardanico: the thing is, I'm in search for the technical solution to this in general, even if it wasn't about if-else-alike, I'd still want to know how to do such things, so I could solve similar issues in the future, so the usefulness of my idea is partly beside the point PMunch: Recruit_main707, what framework? Recruit_main707: rlbot PMunch: Cool! PMunch: dadada, do you have a syntax sample of what you want? PMunch: I might have an idea Recruit_main707: sadly, after a few days trying to wrap the flatbuffer headers needed, it seems like nimterop is still not ready, so i will wait for sockets i guess... dadada: Araq: no, it's the same structure like if-else-elif, but just more concise... if no one ever uses it besides myself, it'd be okay for me. The basic idea is that if becomes ? and elif/else both become L. Because the plural of L has the exact same sound as else. I did experiment with this syntax, and it grew on me fast, saves some column space to, and it's nice that all if-else parts are aligned vertically dadada: (while traditionally if-else have different lengths, so it's not possible), saves some column space too PMunch: So do you have a syntax sample? dadada: PMunch: took some random Nim code from github (MIT), and applied it there: https://play.nim-lang.org/#ix=2ign Yardanico: why not just use "F: " for "if" part then? :P dadada: of course you'd also be able to do var foo = ? someTest: "hello" L: "bye" Yardanico: oh you want without the : hmm dadada: Yardanico: because I don't think it'd be half as intuitive Yardanico: I wouldn't exactly call "?" intuitive but ok :P dadada: Yardanico: if you can't admit that an if statement resembles a question (is this true?), then you're not honest Yardanico: it's not "is this true?", it's "if this is true, do:" Yardanico: at least for me PMunch: A source code filter works, but it replaces all occurrences of ?: https://play.nim-lang.org/#ix=2igp dadada: PMunch: already have a solution for the L part. PMunch: Part of your problem is that if/else is one block PMunch: Wait, how? dadada: PMunch: and a solution for the ? part, but it only work when it's written with `?` Yardanico: PMunch: template? PMunch: I mean this works: https://play.nim-lang.org/#ix=2igr PMunch: For ? dadada: PMunch: my solution is a bit hacky, but I like it nevertheless, I'm using an empty macro for L, that simply replaces the L blocks with nothing. but the clue is in the ? part, it uses lineinfo to learn where the after-part (what comes after the ? block) is and reads only L blocks following it (not anything else because it'd be wrong), then converts it to NimNodes using parseStmt/parseExpr, and then converts dadada: the whole thing to a regular if-elif-else dadada: so the `?` macro reads the L blocks directly from the source PMunch: Ooooh PMunch: That's hacky :P I love it! PMunch: How do you determine if it is after? PMunch: With lineinfo you only get a line number, do you go by indentation from there? dadada: again it's easy to find out where the ? is using lineinfo, and you can use idention rules to know the rest, indention is not hard to code dadada: basically you look for the next line where the L starts in the same column as the ? did dadada: s/line/lines dadada: lineinfo gives you not only the line number, but also the filename of the source, so you can directly read the source files PMunch: Yeah I know dadada: the source filters are too aggressive alehander92: Yardanico alehander92: yeah writing a python vm might be cool alehander92: you can even directly load the bytecode there alehander92: without going through parsing etc dom96: ooh, this is cool https://github.com/wltsmrz/nimler dadada: it'd be nice if you could define that it should only replace stuff that comes first in a source line, or directly (not counting whitespace) a = alehander92: this way you can support much more of python alehander92: as the bytecode isn't complicated i'd say alehander92: but what would you do about c extensions is another question alehander92: Araq i dont agree with that, people need to write their own code to learn alehander92: reading the compiler/vm source is of course very useful to learn as well supakeen: You would likely only support it trough CFFI, alehander92. It's the 'general' recommended way in Python to interface with C nowadays if you're note mbedding. alehander92: thank you, but how easy would it be to simulate that in a custom vm is what i dont know alehander92: as i am not sure how does cpython encode the "ffi" invocations Araq: alehander92: writing a stack based VM isn't "learning", it's repeating well documented mistakes :P alehander92: ahhh so its about stack vs register alehander92: well the cpython vm opcodes are stack-based already .. alehander92: of course here one can just parse python to his own custom register-based bytecode Araq: but the industry is on your side, so now we can reinvent .NET as webassembly. Learning from .NETs mistakes like actually having a type system in the IR or supporting non-reducible control flow. Hmmm dom96: cool, looks like I fixed openssl problems in Nimble with my patch https://github.com/nim-lang/nimble/issues/792#issuecomment-614516847 alehander92: @dom96 cool ! alehander92: Araq i feel you are ironic, but why is it bad to have types in the IR Araq: nothing, it's great. .NET has it and wasm doesn't. Yardanico: @dom96 I feel I should retry my attempt at cross-compiling a nim binary with statically linked libressl to arm Yardanico: it was crashing with SIGILL too 🤔 alehander92: Araq so what about https://webassembly.github.io/spec/core/syntax/types.html alehander92: (i dont really know honestly , just searching for docs) dom96: Yardanico, go for it, but note that my patch fixed dynamic linking specifically dom96: alehander92: what are you suggesting? Araq: alehander92: well yeah, it has this poor excuse of a type system alehander92: @dom96 i am not suggesting anything , sorry, just discussing vm-s dom96: Ahh. alehander92: Araq but isn't having a too specific type system in IR making it harder to target from 20 languages alehander92: @dom96 i am going to push fixes to my async PR dom96: I'm going to suggest something: can we start writing a wasm backend iteratively? i.e. allow me to mark procs with {.wasm.} and have Nim automagically compile them to wasm and integrate them with the existing code generated by the JS backend? :) Araq: well yeah but you can look at .NET or LLVM for type systems that work for a range of languages. or you can base the design on the previous Emscripten hacks. Yardanico: @dom96 nlvm has wasm support via LLVM already btw :P Araq: wasm is about the latter. dadada: dom96: why isn't Nim -> C -> WASM sufficient? dom96: Yardanico, is it mature enough for production? alehander92: @dom96 interesting, but how much is the overhead for wasm<=>javascript Yardanico: well a new backend wouldn't be so mature for production either dom96: dadada, I tried it but couldn't figure out how to fix the segfaults Araq: dom96: it runs 95% of our test cases iirc, so I suppose it works good enough. never used it though. dom96: alehander92: doesn't matter, I would use it in key areas of my code base to make sure communication between JS and wasm is minimal dadada: alehnader92: very little overhead, I read some blogs on it, and that stuff is highly optimized, basically javascript/wasm share the same vm, in many cases there 0 overhead dadada: there's PMunch: dadada, something like this? https://play.nim-lang.org/#ix=2igy alehander92: dadada yeah but there was some problems with e.g. writing wasm to call javascript to access the dom etc alehander92: but they might have changed that alehander92: i might be wrong alehander92: dom96 yeah we've also thought about that for our electron app IIRC? dom96: Araq, how hard would it be to get {.wasm.} started for simple procs? dom96: Have you got any experience with wasm? alehander92: but it's probably easier to that in nlvm in this case alehander92: as it already should have both wasm and javascript support Araq: dom96: my knowledge is outdated, now it has "Table Types" Araq: (a step in the right direction) PMunch: dom96, what's the benefit of nimler over just importing C functions? dom96: Araq, I bet I could follow the same approach I took with my asm adventures (way way back) Araq: but when I looked at it, it was bad all around dadada: PMunch: pretty much, note that this only works, because you're not using infixes in your condition, (I thought it would be easy like this at first, but it isn't), as soon as you do something like x or y, "or" x and y, you must strope ? to get it parsed dom96: PMunch, no idea, I just saw Erlang and NIm and love that people are making such packages alehander92: dom96 can you build your game with nlvm? Araq: dom96: it's very hard because wasm is a moving target and you have to emulate so many features on top of it dom96: alehander92: I might give it a try tonight. But I'm doubtful it'll work. alehander92: but the problem is alehander92: how would you do it in the compiler to use two backends for two functions Yardanico: Araq: do parameters created with "using" have an actual type somewhere in PNode fields? so far I couldn't find it dom96: dunno, I'm sure there is a way :P alehander92: maybe it should be easy dom96: Araq, yeah, guess it would be a lot to bootstrap everything, in particular the GC. alehander92: just somehow detecting it in the last stage and redirecting to TargetGenPass Araq: alehander92: you can create a new "pass" in the compiler or you hack it into an existing pass, that part is easy (but maybe a bit ugly) dadada: PMunch: but apart from that, really nice implementation! Araq: dom96: you can always map a subset of Nim to wasm, but you would surprised how much work that really is alehander92: @dom96 i'd really try to see nlvm and ask @arnetheduck Araq: I'm not talking about the GC. it doesn't even support function pointers properly dom96: would be nice if I could emit wasm in JS code like I can asm in C code alehander92: he works with wasm sometimes IIRC for his projects alehander92: and it wouldn't make sense to put so much work before actually seeing the alternative dom96: I think I should talk to yglukhov, he probably knows how to get emscripten to work with Nim dom96: I got it to almost work, but kept getting segfaults deep in GC code dadada: PMunch: putting conditions in () would get around it, too, but that's not good enough for my taste... alehander92: @dom96 probably its very easy to emit directly wasm even now PMunch: dadada, hmm that is hard to get around.. Araq: it also doesn't offer an aliasable stack, so you get to emulate that too. and when you do, you need to ensure your emulation is like C++'s emulation or else you cannot call foreign code Araq: "everything should be as simple as possible but not simpler", well wasm is the "simpler" design. alehander92: @dom96 something like https://developer.mozilla.org/en-US/docs/WebAssembly/Loading_and_running maybe where you just hardcode the bytes somehow dom96: hah alehander92: @dom96 and you can also call staticExec in `{.wasm.}` if you have a way to compile a text representation of wasm dom96: it sounds like a really fun project, but I sure have far too many projects already, I do need to try to get something that exists to work again alehander92: and then just put the bytes somehow in alehander92: (if you just want to emit text(?) wasm) Araq: it's really not "fun" but ymmv. dom96: the initial implementation will be fun, finding and fixing the hundreds of bugs to get the implementation to work 99% of the time will not be :) Araq: personally I would target x86 16 bits and run the code inside DOS Box clyybber: lol Araq: because that stuff actually works. Yardanico: https://copy.sh/v86/ :P Yardanico: has msdos dom96: lol, does DOS Box for the browser exist? :P dadada: PMunch: if source code filters could be made to only replace actual code, and not characters inside string literals, and also understand some whitespace rules, they might be useful for this alehander92: they run linux in the browser man Yardanico: @dom96 https://js-dos.com/ alehander92: iirc Yardanico: "Project uses dosbox as emulation layer for running dos programs." Yardanico: and yes they use emscripten PMunch: dadada, didn't solve the () problem, but I added elif support: https://play.nim-lang.org/#ix=2igA PMunch: You can't combine it with else though PMunch: Or have multiple elifs dadada: a full Linux instance running client-side in the browser would be cool, I'd run folding at home there Yardanico: see https://copy.sh/v86/ PMunch: Hmm, I guess you could define `?` as a varargs[untyped] macro and just use lineinfo on the first one alehander92: PMunch why Yardanico: dadada: [email protected] needs proper GPU acceleration :P and CPU too alehander92: why Yardanico: @alehander92 because dadada wants to :P alehander92: fun PMunch: F04or06 t08he10 g12lo02ry04 o06f 08sa10ta12n!02 :04D Yardanico: my eyes dadada: alehander92: 1) people wouldn't need to install stuff, they could just load them into their browsers (i.e. folding at thome) 2) to control running programs would be as easy as opening/closing browser tabs, and it doesn't get easier than that Yardanico: please no PMunch: Yardanico, you're welcome Yardanico: I don't want to use my browser as an OS PMunch: I made a script for it, so if I write /rainbow it will rainbowize my entire text :P Yardanico: sadly only IRC people will see it :) PMunch: S02oo04o 06fa08bo10ul12ou02s! Yardanico: I mean on discord/gitter it's just plain text ;( PMunch: Looks great in the logs as well: https://irclogs.nim-lang.org/16-04-2020.html#10:32:16 PMunch: :P Yardanico: lol dadada: alehander92: I'm an experienced Linux user, I'm positive on systemd, and even I sometimes get annoyed with systemctl, just opening/closing tabs would be way more convenient 3) you could send people a link/URL and by simply opening it they could take part in something like folding at home, which would lower the bar for starting with something like that a lot, which can only be good Yardanico: dadada: cryptominers already do this dadada: alehander92: and because I want to @Yardanico Yardanico: even without asking users ;) Araq: Yardanico: the typ.n[1..N].sym.typ field should have the type too PMunch: dom96, maybe the irclogs should use https://github.com/PMunch/ansitohtml ;) Yardanico: Araq: oh thanks will try dadada: Yardanico: I know, it'd be cool if this wasn't something exclusive to black hats dom96: PMunch, PRs welcome ;) PMunch: What repo is it in? dom96: nimbot alehander92: PMunch Glory to God, man alehander92: dadada oh interesting PMunch: alehander92, it's an old meme :P alehander92: sorry i was asking other stuff but this is very interesting alehander92: but i still feel its too heavy alehander92: PMunch doesnt matter dom96: This reminds me of https://en.wikipedia.org/wiki/Hail_Satan%3F dom96: It's a pretty good documentary PMunch: Huh, that looks good dom96 dom96: PMunch, did you see Midsommar? I recently watched it on Prime and rather enjoyed it. As a Scandinavian, it might be right up your alley as well (note, it's a horror though) PMunch: Nope, haven't even heard of it PMunch: Not a huge fan of horror though.. dom96: ahh, then don't watch it. It's a horror's take on the midsummer celebrations PMunch: From the trailer it didn't look that bad (although I did watch it without sound, because pulseaudio) dom96: FWIW my SO doesn't like horrors either and she watched this one and seemed to enjoy it quite a bit. She also loves Scandinavian culture though so maybe that had a lot to do with it. alehander92: dont put your trust in shock value docs Gary M: final: proc = proc() = return Gary M: I have a parameter like that ^ Gary M: is there a better way of having an empty default proc? Recruit_main707: what are you trying to do here? PMunch: proc () = discard? Gary M: It's a template I made to throw an exception, but if there is anything I want to do first, I'm passing a proc Recruit_main707: parameter: proc() Recruit_main707: but that wont work if you proc has a return type or parameters Recruit_main707: iirc PMunch: In a template it will I think Gary M: it's currently working the way it is Gary M: it's just ugly Recruit_main707: may you show it in playground? Gary M: sure one sec Gary M: https://play.nim-lang.org/#ix=2igI Recruit_main707: and the proc you are passing pls Recruit_main707: PMunch: you sure about that? PMunch: Nope, that's why I added "I think" :P Recruit_main707: xD Gary M: https://play.nim-lang.org/#ix=2igK Gary M: obviously you won't be able to run it in there heh alehander92: Araq talking about the vm alehander92: the debug vm flag seems good Gary M: I'm interfacing with C a bunch 😄 alehander92: thanks for it PMunch: Recruit_main707, yeah it works: https://play.nim-lang.org/#ix=2igL PMunch: Since the type is just `proc` PMunch: Which in a template matches any procedure Recruit_main707: interesting Gary M: cool, that'll make things easy Gary M: nim is pretty awesome PMunch: That `default(proc)` doesn't work though Gary M: it's working for me, though Gary M: well, hold on Gary M: let me try something else PMunch: Until you don't pass anything Recruit_main707: thats what i meant, yep, it doesnt work if you pass it arguments PMunch: Well of course not, because you're not passing it anything in the template Recruit_main707: i learned how to do it with a macro though Gary M: https://i.imgur.com/AiRnKxv.png Gary M: it's working without passing anything 😄 Gary M: https://i.imgur.com/3jNYZcK.png Gary M: and then here when I pass in a proc without arguments Gary M: so I'm guessing if I want arguments there's a problem? PMunch: Not as pretty, but you can do this: https://play.nim-lang.org/#ix=2igO Gary M: ah that looks alright let me try Recruit_main707: can you run a function passed as a `typed` argument to a macro?? Recruit_main707: from withing the macro that is Gary M: https://i.imgur.com/4RuPKww.png Gary M: works 😄 Gary M: don't need macros Gary M: Thanks PMunch Recruit_main707: what should i do to check the return type of a proc inside my macro like here: https://play.nim-lang.org/#ix=2igS PMunch: Recruit_main707: https://play.nim-lang.org/#ix=2igO Recruit_main707: ? PMunch: Look at the output Recruit_main707: i dont get the point PMunch: You can see that the params node type is FormalParams PMunch: And the 0th element is float, your return type Recruit_main707: yep, but how do i check that in an if statement? alehander92: ok, so it seems calls alehander92: rewrite lineinfos alehander92: but i am not entirely sure if this is intended always Recruit_main707: got it working Recruit_main707: you have to check for its strVal Recruit_main707: next question about macros.... Recruit_main707: can they easily edit the function's body, but in the generated c/c++ code? probably by filling the function's body AST with emit pragmas? Recruit_main707: "easily" dadada: PMunch: with 2 additional features for SCF it could be done 1) allow source code filters to use a macro for taking in the whole AST of a file (excluding the SCF and SCF-macro itself, of course) 2) make SCF a project wide feature so that nim knows to use specific SCF for all files in a project dadada: there were network issues, therefore I resend something, sorry, if it was already received dadada: PMunch: with 2 additional features for SCF it could be done 1) allow source code filters to use a macro for taking in the whole AST of a file (excluding the SCF and SCF-macro itself, of course) 2) make SCF a project wide feature so that nim knows to use specific SCF for all files in a project dadada: PMunch: pseudo code: https://play.nim-lang.org/#ix=2ih3 and then allow to put that SCF-macro into a project wide config file, that nim knows how to read liblq-dev: anybody ever tried to use cairo-trace with the cairo wrapper for Nim? liblq-dev: I'm trying to cairo-trace my program (`cairo-trace --no-file ./program arg1 arg2`), but I'm not getting anything printed in stdout alehander92: Araq we need alehander92: TSym info alehander92: right? dadada: liblq-dev: cairo wrapper? shouldn't cairo be usable with gobject introspection, you could simply load it with nim's support for gir (gobject introspection) liblq-dev: please no, gintro is already bulky as it is. i don't want my program to compile 20 seconds. liblq-dev: well anyways I solved my issue without cairo-trace liblq-dev: turns out I was clearing my surface with cairo_paint *right* after rendering it… inv2004: Hello, I have a question about c2nim, I have header with typdef struct s0{...}*S; which is ok for gcc, but c2nim print an error: token expected: ; inv2004: If I do s0{...} S; - it works fine. krux02: inv2004, c2nim is a tool that doesn't work reliable. krux02: that doesn't mean that it isn't useful. krux02: I thinkou you can apply your change to the header, run c2nim and then fix the generated file. shashlick: inv2004 - nimterop should be able to handle that case shashlick: typedef struct s0 { ... } S1, **S2, ***S3; shashlick: let's just say supporting 200 ways of writing the same thing is not fun inv2004: looks like that I have to define {}S and do type SREF = ref S krux02: a ref is not a pointer from C krux02: a ptr is a pointer from C ZoomZoomZoom: Hi! 0day newbie here. Trying to compile a hello-world with nimx statically under Windows with mingw-w64 `nim c --threads:on -d:release --dynlibOverride:SDL2 --passL:-lSDL2 main.nim` but the executable still errs unable to find SDL2 Araq: ZoomZoomZoom: that linking command seems Unix specific krux02: ZoomZoomZoom, on windows you should put the sdl DLL in the same folder as the binary ZoomZoomZoom: Of course, but can't it be statically linked? krux02: I am also a bit puzzled, doesn't the SDL library try to link against SDL automatically? krux02: ZoomZoomZoom, everybody asks this. But sdl is really designed to be a dynamic library. krux02: it allows them to create more renderer backends and gampads to be supported just by updating the SDL dll ZoomZoomZoom: I'm just exploring my options for writing what's supposed to end up as a plugin with GUI which should ideally be statically linked. krux02: you want a plugin for what? krux02: General advice, if you want to create a plugin for anything, you should use the plugin API zacharycarter: what's the plugin API? ZoomZoomZoom: That's really not the point ATM zacharycarter: oh SDL2 has a plugin API ZoomZoomZoom: zacharycarter, Just the API which is provided by a software your plugin is written for. zacharycarter: yeah - I thought someone had developed some library for Nim - I know shashlick has but it only works with bohem GC atm zacharycarter: I'm using cr.h in my project to hot reload my game which I compile to a shared library zacharycarter: this only works with gc:arc/orc zacharycarter: and I haven't done anything very complex yet on the plugin side of things zacharycarter: but anyway about your SDL2 problem - I don't think i've ever statically linked sdl2 zacharycarter: not even for emcsripten - but it should be fairly straightforward - use dynliboverride and then link the static lib zacharycarter: need to keep in mind linking order if you're on linux zacharycarter: I need to run to the vet but I"ll be back later and can try to help more then alehander92: Araq should i expect tasyncawait_cyclebreaker.nim to fail? alehander92: i made some seemingly syntactic changes to make await template and now it seems to lead to ~150_000 allocations more Araq: what's 150_000 allocations among friends, it's fine alehander92: also how do you guys see errors i see a black page(loading?) for run ci error alehander92: https://dev.azure.com/nim-lang/Nim/_build/results?buildId=4330&view=logs&j=30931762-47c4-53b3-6a83-316eb5a6b9d7&t=b1c7d701-c448-5ecb-905d-689d8a5921e0 Araq: alehander92: the test is a bit fragile so see if it's green on your machine before your changes Araq: and then ensure it stays green after your changes Recruit_main707: why is this throwing an error? `newIdentNode("emit")' ZoomZoomZoom: Ok, for anyone looking for how to statically link SDL2 on Windows, look at your SDL2 sdl2-config.cmake, line 18. Pass all those arguments EXCEPT "-static-libgcc" PLUS "-static" to --passL: and it works. ZoomZoomZoom: `--dynlibOverride:libSDL2 --passL:"-static -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid"` Varriount: That's quite a mouthful. dom96: ZoomZoomZoom, you may want to add a new section into the Nim package's readme with this info :) ZoomZoomZoom: Yeah, and the resulting file is rather fat, but it worked. Varriount: Well, that's often what happens with static linking. The only thing I can think of that would reduce the size is turning on link-time optimization. ZoomZoomZoom: I'm rather wary of using my results because IDK What I'm Doing here basically :) ZoomZoomZoom: ... using for the readme mratsim: @Araq would it be fine to add sanitizers template in Nim memory management so that ASAN in GCC and Clang can have a better idea of Nim custom memory management: see https://github.com/mratsim/weave/blob/master/weave/instrumentation/sanitizers.nim#L27-L37 for the templates usage, example: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim#L174-L182, https://github.com/mratsim/weave/blob/master/weave/memory/memory_pool dom96: ZoomZoomZoom, just preface it with the classic "I Dunno What I'm Doin'" dog gif :) mratsim: This would help for our fuzzing efforts of Nimbus Araq: mratsim: we have these annotations for ASAN already mratsim: ah Araq: proc markStackAndRegisters(gch: var GcHeap) {.noinline, cdecl, Araq: codegenDecl: "CLANG_NO_SANITIZE_ADDRESS N_LIB_PRIVATE $# $#$#".} Araq: but probably more are required so that ASAN can understand our alloc/dealloc mratsim: yes, for example detect out-of-bounds accesses on sequences mratsim: well we do have indexerror Varriount: mratsim: Out of bounds accesses on unchecked arrays? alehander92: sorry, ZoomZoomZoom: I'm not familiar with cmake syntax, but since "sdl2-config.cmake" already has all the necessary switches, can't we leverage it with some option? alehander92: it does the ~same amount of allocs alehander92: but a bit less deallocs alehander92: in most cases it does 41, not 48 deallocs alehander92: ok, i'll wait to see if someone has a hint, i might look at it later alehander92: huh i didnt see the received messages Araq alehander92: sorry alehander92: i'll fix the test than alehander92: then* Recruit_main707: why is this not working?? https://play.nim-lang.org/#ix=2ihA alehander92: but still i hope its not some kind of leak, as it does seem to deallocate less on each step Rika: @Recruit_main707 if you dumptree the emit pragma you'll see the node you're missing Rika: (ExprColonExpr) inv2004: Another question: C-struct: struct {...}*S; Nim: S = ref INNER_C_STRUCT; INNER_C_STRUCT = object ...; and I have a c-function which is f(S* x, S y)) Recruit_main707: @Rika, i am grabbing it from https://nim-lang.org/docs/macros.html#callsslashexpressions-pragmas inv2004: How can I define and pass the reference to the C function ? mratsim: @Varriount that may be one thing mratsim: but it's mostly because we've had some memory issues Araq: inv2004: stop at 'ref INNER_C_STRUCT' already, it's a ptr, not a ref inv2004: Ah, its without type of course Rika: @Recruit_main707 and it clearly says `nnkPragma(nnkExprColonExpr(nnkIdent("emit"), nnkStrLit("#include ")))` Recruit_main707: https://tenor.com/view/hmm-hmmm-hmmmm-thinking-gif-16016977 Rika: bruh Recruit_main707: mega bruh shashlick: does anyone have OSX and proficient at debugging crashes treeform: Nim can staticRead big files. But then the compile times get really slow. I wonder if a technique like this can be used https://flak.tedunangst.com/post/embedding-binary-objects-in-c ... Maybe it already does use it? Rika: cant reach the site Gary M: it looks like the Nim extension for Vscode doesn't syntax highlight variables properly Gary M: https://i.imgur.com/oSsp9va.png Rika: yes. Rika: Rika: https://cdn.discordapp.com/attachments/371759389889003532/700362517033123930/unknown.png Gary M: it's getting the incorrect color applied Gary M: https://i.imgur.com/r04n3h8.png Rika: yes its pretty jank Gary M: as though the variable is a procedure Rika: im really wanting my semantic highlightinh Rika: the regex is just super fucked i think Gary M: I'll give them $5 to sort that shit out 😄 Recruit_main707: maybe they are your color themes Rika: nope Gary M: I made sure it wasn't Rika: its not Recruit_main707: my variables dont get highlighted as functions :p Gary M: I'm manually applying the color red to all variables Rika: update your extension Rika: and try using augmented multiply assignment `*=` Rika: you will get the wrong color for the variable Gary M: absolutely nothing in any of my nim files is being colored like a variable Rika: also happens with augmented add assignment but not division Rika: your game and test is? Gary M: the test was just to see the syntax highlight fuck up 😄 Gary M: the game is just initializing sdl2 and working through setting up vulkan Rika: hm Rika: https://cdn.discordapp.com/attachments/371759389889003532/700363696270082059/unknown.png Rika: "Other"???? Recruit_main707: 0.6.6 is the latest and i still see dont see my variables as procs Gary M: @Rika how did you get that prompt Rika: its not even being recognized as a variable i dont think Rika: @Gary M Rika: https://cdn.discordapp.com/attachments/371759389889003532/700363897554599946/unknown.png Gary M: they're all Other for me inv2004: INNER_C_STRUCT {.bycopy.} = ptr object ... ; is it equals to S in typedef MyStruct {...} *S ? Rika: i see Rika: look at textmate scopes Rika: and foreground Gary M: except comments Gary M: comments are comments Gary M: everything else is "other" Rika: thats fuckin weird Rika: man this extension is jank as hell Gary M: there's no consistency with the textmate scope and foreground stuff either as far as I can tell Gary M: at least there's mostly consistent coloring Gary M: just not with variables Rika: > echo is a keyword Rika: hmmmmmmmmmmm Gary M: lol Gary M: ok yeah it's jank Recruit_main707: the only problem i know of is that when you overload a function or use * in its name, then try to make it public (with *), it will not highlight it, and when using an array combining strings and variables with emit, highlight breaks Rika: am i really gonna move to vim just because of the jankiness of this nim plugin Gary M: that should be entity.name.function.nim Gary M: well the only problem you know clearly isn't all the problems we know Recruit_main707: i cannot replicate yours Gary M: https://i.imgur.com/0Ye8tqu.png Gary M: do this Gary M: ```nim Gary M: var test = 1 Gary M: test += 1 Gary M: ``` Gary M: and screencap it please Recruit_main707: now i see it :p Gary M: variables shouldn't be getting recolored as procedures Rika: haha Rika: it really only does that for += and *= Rika: not for /= Gary M: they should be getting colored as *variables* to begin with Rika: i dont know if -= is fucked either Gary M: regardless of all this other weird behavior Recruit_main707: > i dont know if -= is fucked either Recruit_main707: nope Gary M: https://i.imgur.com/lKpea6z.png Rika: thats so odd Rika: why is += and *= broken but not the others? Recruit_main707: i still think its not so bad of an issue, (how do you display all that?) Rika: also regex syntax highlighting is not something i would do Rika: or like to fix Rika: its pretty bad since its super noticeable Gary M: ctrl+shift+p Inspect editor tokens Rika: try multiplying 2 variables Rika: you'll get the fucked colors too Recruit_main707: the issue its with the * symbol specially? (also strings have token) Gary M: I'm pretty sure it is a problem with the * Gary M: and + Gary M: there's the coincidence of the opposites not being fucked, but there's no proof that it's directly related Gary M: the + - * / operators are templates aren't they? Gary M: I don't think it should be doing anything weird in the syntax highlighting though... Rika: the highlighting doesnt know anything past the symbols Rika: it only sees the file, not the compiler stuff Gary M: maybe it's just the regex being fucked Gary M: I mean variables at all just don't work Gary M: and idk if it's even done with regex Recruit_main707: but... if almost everything is other? how do they have different highlights? Gary M: whatever it is, it's fucked Gary M: well look at the other weird thing Recruit Gary M: https://i.imgur.com/KHB0aPF.png Gary M: the procedure echo get the highlighting of a keyword Gary M: https://i.imgur.com/14gWl34.png Recruit_main707: have you thought of openning an issue? Recruit_main707: clearly all of this is not right Rika: echo highlight as keyword kinda makes sense but i still think it shouldnt Recruit_main707: ^ Gary M: actually might be using textmate rules idk Gary M: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide Gary M: it does mention textmate scopes Zevv: pff, had to make a Nim comment in this silly HN thread about "Embedding Binary Objects in C" Gary M: found it Recruit_main707: wasnt that ZomZomZom? XD Gary M: in the user path in .vscode, then in the nim extension folder Gary M: syntaxes>nim.json Gary M: ew there is regex Recruit_main707: just in case someone fixes all of this, pls leave echo as it is (as an exception to the rule or something) Gary M: reasoning? Recruit_main707: it would be very ugly :p Rika: @Gary M told ya it was regex Gary M: well, it's a combination of regex Gary M: you can look at the file yourself, too Rika: i already did Rika: before you raised the issue Gary M: going to have to bust out the regex translator for this 😦 krux02: @alehander92: Can you please take a look at my issues about gara and the PR I made? krux02: 18 days ago Gary M: found a minor issue in the operator regex @Rika Rika: 👀 nice Rika: hotfix where Gary M: (=|\\+|-|\\*|`right here`/`this is not escaped`|<|>|@|\\$|~|&|%|!|\\?|\\^|\\.|:|\\\\)+ Gary M: dunno that it will do much 😄 Rika: nice Gary M: but it should be escaped I think, anyways Gary M: operator highlighting was working fine, anyways Gary M: really need to fix that variable stuff Gary M: at LEAST make them not color like functions zetashift: @Yardanico oooh nice, I've browsed through it, looking forward to seeing more zetashift: I'm also working on the book using Scala, but I'm trying to stick to some FP-isms but find it hard since the book uses mutability a lot Recruit_main707: @Gary M does that fix something?? Gary M: not sure yet Gary M: but I think I have something else to fix 😄 Gary M: I'm looking at some other things right now Rika: @Gary M i cant find the issue that you pointed out Rika: ?? Rika: https://cdn.discordapp.com/attachments/371759389889003532/700374011657584770/unknown.png Rika: i dont see the issue] Gary M: it's just an unescaped forward slash, but it might not make a difference Rika: i dont think vscode cares about it Gary M: https://i.imgur.com/tKh1PQq.png Gary M: @Rika boy Rika: ? Gary M: or girl, dude, whatever Gary M: look Rika: ??? what am i supposed to see Gary M: *look harder* Rika: im kind of colorblind btw Gary M: oh Rika: legit ;; Gary M: it's not coloring on that operator now Gary M: on the plus Rika: the test + 2 Gary M: yes Rika: what regex did you fic Rika: fix Gary M: * is also fixed rn not sure why Recruit_main707: if it works, leave it like that and ignore the logic :p Rika: WHAT REGEX DID YOU FIX Recruit_main707: lel Gary M: THE ONE THAT FIXES IT Rika: WHICH ONE GOD DAMN IT Gary M: lol Gary M: ```json Gary M: "comment": "Function call (no parenthesis).", Gary M: "match": "(?!(openarray|varargs|void|range|array|seq|set|pointer|new|await|assert|echo|defined|declared|newException|countup|countdown|high|low|((uint|int)(8|16|32|64)?)|float(32|64)?|bool|string|auto|cstring|char|byte|tobject|typedesc|stmt|expr|any|untyped|typed|addr|as|asm|atomic|bind|cast|const|converter|concept|defer|discard|distinct|div|enum|export|from|import|include|let|mod|mixin|object|of|ptr|ref|shl|shr|static|type|using|var|t Gary M: "name": "support.function.any-method.nim" Gary M: ``` Gary M: that's one motherfuck of a regex Gary M: at the very end it was doing (-+ a couple times Rika: REST IN PEACE IRC PEOPLE zetashift: I've seen worse codeblocks pasted tbh Recruit_main707: F Gary M: which was matching characters from range ( to + Gary M: kind of a weird thing Rika: so just remove that and its done Gary M: seems like it Rika: also * is behind + so it makes sense that * is fixed now too Gary M: I already did in that code block Rika: bless your soul, i dont like looking at regex Rika: though i am perfectly capable of doing this myself Rika: i just do not want to Gary M: well at least all of my variables are the same color for now 😄 Rika: yeah! Rika: fuck Rika: https://cdn.discordapp.com/attachments/371759389889003532/700376557382008862/unknown.png Gary M: oh great. Rika: HAHAHAHAHA Araq: that regex looks wrong on multiple levels Rika: memed Araq: 1. mixes keywords with stuff that happens to be in system.nim Gary M: it's the regex that's in the nim vscode extension 😄 arnetheduck: outputting `wasm` bytecode is easy - `nlvm` does that perfectly. a fibonacci example will fly faster than any javascript bird - emulating all of nim's std lib features is the hard part - you need a runtime corresponding to the `c` library - there's two options: emscriptem (easy) or wasi (hard) - also, you want to avoid a bunch of nim things or the experience will suck, in general: exceptions, gc.. GC works kind of if you manually collec Rika: thats what i said for echo being a keyword!!! Gary M: I don't know the spec OR regex nearly as well as you must, so we probably need some help cleaning this all up Rika: its like saying print() is somehow a keyword in python Rika: it USED to be one, it no longer is Araq: 2. "Function call without parenthesis" is like er, every Nim construct ever. Rika: Araq: why do you think it has basically every nim construct ever in the list Gary M: yeah that's a weird one Rika: lmao Gary M: so what should we do, start the regex from scratch? 🤣 Gary M: that doesn't sound fun Rika: fix it up i guess Rika: major rewrite Rika: not from scratch though Gary M: should div be a keyword or an operator? Rika: lets wait for our lord and savior 😛 Recruit_main707: function? Gary M: actually it's technically a proc Rika: div is an operator function Rika: since it's backticked Gary M: ah ok Gary M: https://i.imgur.com/17OG0IV.png Recruit_main707: @Rika is that a rule or something? Gary M: so this is fucked Rika: @Recruit_main707 any proc name in backticks uses "operator" style usage Recruit_main707: oh Rika: so \`add` is used like 1 add 2, add is used like 1.add 2 Rika: symbols MUST be backticked Gary M: would you say it should be colored the same as the + - * / operators Rika: i would yes Rika: not sure with ara q Recruit_main707: what color though, mine are white XD Rika: that's on the theme Rika: not the highlighting Gary M: https://i.imgur.com/cHctGR9.png closer to this Recruit_main707: i know, i just dont remember seeing it highlighted Gary M: although the variable is still fucked on that one Rika: i really really do not want to deal with this 😛 Recruit_main707: open an issue and wait :smart: Recruit_main707: open an issue and wait :p Rika: or let the king gary m fix it Recruit_main707: also, i got this to work, generated code is not as clean as i would have liked, but meh ¯\_(ツ)_/¯ Recruit_main707: https://play.nim-lang.org/#ix=2iim alehander92: krux02 sorry alehander92: i knew about it but i always delayed looking at it alehander92: merged Rika: @Recruit_main707 you know you could have just used quote do https://play.nim-lang.org/#ix=2iiq Recruit_main707: https://tenor.com/view/themoreyouknow-star-rainbowstreak-nbc-gif-4884642 Rika: F Rika: should have told you earlier lmao Recruit_main707: ill take it as learning experience xD Rika: if its simple and valid nim syntax, try quote do Rika: if it doesnt work, use manual ast creation Recruit_main707: ill have it in mind alehander92: i think quote also need something like `{.lineInfo: node.}` similar to `{.inject.}` Gary M: I made negative progress! Gary M: https://i.imgur.com/GWcod7R.png Gary M: now all the variables are orange 😄 Gary M: but only on the left side of an operation Recruit_main707: bruh Gary M: or even the right, it looks Gary M: just, even less consistent than before, awesome Gary M: regex is a *bitch* Rika: sigh Rika: who thought syntax highlighting should be in regex Gary M: sadists krux02: Gary M: what are you working on? Gary M: krux02: the syntax highlighting for the Nim extension in Vscode Gary M: it's all sorts of messed up Gary M: https://i.imgur.com/7AeidB3.png Gary M: this image for example Gary M: variables aren't at all colored as variables Gary M: and then variables on the left of operations like + and * get colored like procs Gary M: and some other fun things Gary M: but that's the most annoying krux02: yea I had similar experience with emacs syntax highlighting. krux02: It was all messed up. But the worst part there was, it was messed up in performance. krux02: Making editing of large files practically impossuble, unless you turn off syntax highlighting. Gary M: ouch Gary M: one reason to just not use emacs? Rika: not really idt krux02: not really. It wasn't the fault of emacs the the guy implementing syntax highlighting didn't care about files larger than 10 lines of code. krux02: It is now fast btw. Recruit_main707: (its totally off topic, but i dont know if the bridge is working so) does anyone know how to write spanish quotes in the keyboard?? (the ones that look like this: << >>) companion_cube: «» Recruit_main707: ye, but how XD PMunch: dadada, yeah I guess it would be doable with some modifications. The question is if we want to allow that kind of rewrite ZoomZoomZoom: Alt+0171, Alt+0187 Recruit_main707: thx companion_cube: I use a compose key Zevv: I just cut&paste from companion_cube companion_cube: https://www.fileformat.info/info/unicode/char/search.htm?q=guillemet&preview=entity Zevv: oh look gnu screen can do digraphs: « » dadada: PMunch: after a quick survey of what SCF can do now, I think this feature needs to be rewritten/expanded anyway, there are many ways in which this can be useful, i.e. for templates, but it's much too restricted, for example why should all replace(..) be in one line? why can't you put them in multiple lines? why is regex not supported by default in replace and other SCF functions? then also the possibility on dadada: calling a macro on the whole code as I said. As for allowing it, if you don't all you're really doing is, to force userdevs to create their own external preprocessors (that of course will use Nim's own AST-parser/macros anyway) and thereby each such userdev will roll his/her own solution. That will create repeated work. Of course, such a need is not the norm, but it definitely comes up once in a while. Rika: fuck, i should really read through the whole of docs Rika: literally was thinking "hmm npeg would benefit from templates" and right in the docs there it is PMunch: dadada, well SCF is seen as a bit of a "please don't use this unless you really need to" feature dadada: PMunch: officially macros are described in a similar manner in the docs (you should prefer everything else over macros) and yet it's one of Nim's main selling points :-) Zevv: Rika: always one step ahead! PMunch: I think it's mostly made to allow using Nim as a templating language (like HTML templates) and possibly to silence the "why no tabs" crowd. PMunch: And it's been considered for removal many times Recruit_main707: what, macros? dadada: it should be improved/built upon, not removed Gary M: https://i.imgur.com/hPgnV3A.png PMunch: Recruit_main707, haha no not macros Gary M: yeah this regex is just butchered. PMunch: dadada, well macros should be your last ditch effort for "normal" usage. But it's super helpful for writing ergonomic libraries and such Rika: jesus what the fuck did you do Gary M: absolute monstrosity dadada: it's definitely not a feature that you should use all the time, but it's nice to have Gary M: @Rika that's how it currently is 😦 Recruit_main707: yes, 4 spaces tabs wtf Gary M: it's like, just not a good regex Gary M: anyways it's 10am and I haven't slept. I should sleep 😄 Rika: jesus christ thats pretty bad Rika: wait wait Rika: btw PMunch: Recruit_main707, everyone knows that 4 spaces for indentation but combine every 8th space with a tab Gary M: I'll try to work on it when I've had some rest. Rika: vscode uses `\\` instead of `\` for escaping @Gary M Rika: just in case you didnt notice Gary M: I know dadada: PMunch: I don't like the SCF in the current state much, however I see their potential, and then I like them a lot, so I vote against removal Gary M: it's really that json uses that krux02: PMunch, I really wonder who came up with that idea Gary M: you have to escape the escape, otherwise json tries to parse it before the regex does krux02: dadada, what is SCF? dadada: krux02: source code filter krux02: ah krux02: yea, I vote to remove them krux02: put them on an experimental feauture branch or somtehing dadada: you'd vote to remove varargs, too, and I love that feature PMunch: krux02, haha yeah I got some code formatted that way for an assignment in uni. Was so confused by it until I remembered hearing someone mentioning an old Emacs indentation scheme, and sure enough, that was it! owl_000: in nim 1.2.0 what are those warnings? `/stdlib_io.nim.c: In function ‘raiseEIO__ZYk14k3sVNZUIjJjtqzFZQ’` `/stdlib_io.nim.c:627:1: warning: ‘noreturn’ function does return` krux02: dadada, I don't want to remvoe varargs, I want to replace it with a varargs that works. krux02: But that isn't possible without breaking varargs first. dadada: krux02: that's a thing I can get behind, it's just that for me in the few months of using Nim I had, varargs didn't fail me a single time (yet) PMunch: owl_000, where do you see those? krux02: dadada, maybe you will stop loving varargs if you try to fix its problems owl_000: when i compile krux02: dadada, for me it did PMunch: Anything? I've never seen that warning.. Rika: me neither Rika: it looks like something went wrong with your nim compiler or something krux02: btw I realized Nim has now 17000 commits Rika: nice krux02: precisely dadada: cool krux02: not sure if that measures anything Rika: so who IS the author of the 17000th commit krux02: probably effort krux02: timotheecour it is krux02: not that there is a price for it owl_000: https://ibb.co/qr3hjK9 look at the screen shot dadada: krux02: if we knew how much work goes into an average commit in human hours, then we could approximate the number of work hours that have gone into creating Nim so far krux02: dadada, that depends on the person creating the commit. Gary M: @Rika ok one last fix before I log off Gary M: go back to that same long ass regex krux02: Some people work all day long for a commit, some people create a commit for just a few minutes of work Gary M: right after "comment": "Function call (no parenthesis).", Gary M: change the start from (?! to (?= owl_000: `let content = readFile("test.txt")` compiling it in linux shows those warning. Gary M: https://i.imgur.com/6KVqv55.png Gary M: seems to have unborked the variables better now. Gary M: also I removed div from that one and put it in operators Rika: nice Gary M: generic operators for expressions Gary M: just div| before the other things Gary M: hope that helps 😄 Rika: does good, nice Rika: thanks krux02: div and or mod and all the other word operators? Recruit_main707: that was hard to read lol zacharycarter: ZoomZoomZoom: you figure out your issue? ZoomZoomZoom: zacharycarter, yep, moreover, I've made a PR for SDL2 library (#124) with an instruction Recruit_main707: i should try to make sdl2 work again i guess ZoomZoomZoom: zacharycarter, Thanks for getting back to me Rika: @Gary M uh oh Rika: https://cdn.discordapp.com/attachments/371759389889003532/700394700414124052/unknown.png Rika: how the fuck does that happen lmaoooo Gary M: LiVe WiTh It Rika: haha go sleep Rika: im just showing ya Gary M: I'll work out the KINKS later ugh Gary M: it's matching the alternate "of" and just moving on Rika: go, before i report more bugs owl_000: `echo "hello world"` nim 1.2.0 in linux 64 produces this warning too. https://ibb.co/vc7M4F1 Prestige: my eyes disruptek: holy shit. Gary M: @Rika ok try this owl_000: `--gc:refc` produces no warning though. Gary M: lmao Gary M: (?=(\b Gary M: it's just adding \b right before the first thing Rika: where should this go Gary M: actually \\ for json Rika: and you must sleep Gary M: double \ Gary M: so \\\\b Gary M: same place as last time Gary M: function call no paren Gary M: ah I also move of to the start... Gary M: lemme just shoot you a message lol zacharycarter: ZoomZoomZoom: np! glad you got it figured out :) Gary M: @Rika add me ZoomZoomZoom: zacharycarter, "np!"="no problem"? ZoomZoomZoom: P ≠ NP :D disruptek: hearts and minds, people; hearts and minds! dadada: disruptek: glad to see you here again! we want streams dadada: hope you've been well disruptek: dude. disruptek: i know you only tune in for the music. dadada: exactly! :D disruptek: i'm fine but i've had a lot of hardware issues. disruptek: wetware is tip-top, i'm happy to report. Zevv: \o/ disruptek: awwww sup dawg Zevv: so how the hell did you get through the days like that?! Zevv: reading, like, books, or stuff like that?! zetashift: ewww disruptek: we don't read in 'murica zetashift: did you shoot some stuff disruptek: actually, you have to read this writings.stephenwolfram.com article. disruptek: it's got the gears turning. zetashift: the plottwist it is reading disruptek: i'm desperate to learn what it says. disruptek: i just look at the pictures. zetashift: Link to the article? zetashift: or is it the first one disruptek: whatever was posted on 4/14. disruptek: i don't have a gui atm. zetashift: "Finally We May Have a Path to the Fundamental Theory of Physics… ⏎ and It’s Beautiful" zetashift: for the curious: https://writings.stephenwolfram.com/2020/04/finally-we-may-have-a-path-to-the-fundamental-theory-of-physics-and-its-beautiful/ disruptek: honestly, it's about the most interesting thing i've read in years, and it meshes with a lot of my graph work. Zevv: it's pretty pictures and all, true that disruptek: what have the nimions been up to over the last week? Zevv: no idea, I hardly come here these days leorize: you're back disruptek \o/ Prestige: PMunch: I opened a quick PR for nimlsp to fix the issue we talked about yesterday narimiran: disruptek: easter leorize: and disbot is back too, it's missed :p leorize: narimiran: can you add dochack to list of triggers for the docgen ci? disruptek: i can wake up the bot once i get wayland running at >0.2fps. narimiran: leorize: yeah, it might be a good idea leorize: disruptek: did you screw up your graphics driver? Zevv: running on an e-ink display I bet disruptek: i can't tell what's up. it's like, i have a 2020-01-03 bios and apparently the 5600 doesn't play nice with linux until a bios refresh, but it doesn't seem like a refresh is available for me and apparently my linux-firmware is up-to-date. disruptek: thanks for the help on libimobiledevice. i gave up on it. it felt kludgy and i was seeing double-frees and stuff and i was like... fuck it. leorize: lol leorize: what brand of card is that? maybe I can find you a bios disruptek: gigabyte leorize: https://www.gigabyte.com/Graphics-Card/GV-R56XTGAMING-OC-6GD/support#support-dl-bios disruptek: don't waste your time, though; i will have to flash it in windows anyway, and i have network now, so it's no big deal. Rika: i wish i had an e-ink monitor disruptek: what's the latest date there? i have no browser. leorize: 2020-01-21 disruptek: iirc you can get e-ink panels pretty cheap. disruptek: ahh, i bet that's what i need. disruptek: Zevv: we shoulda made those nim-based corona badges. disruptek: there's still time if you are interested. Rika: panels are cheap afaik, monitors arent Rika: oh, panels ARENT cheap Rika: lmao Zevv: disruptek: what would a "nim-based corona badge" do, exactly? Zevv: flash "don't panic" in big friendly letters? disruptek: you wear it on a lanyard and it displays how much adjacency you've had with other spreaders. disruptek: it's like those radiation badges. disruptek: didn't we talk about this a couple months ago? Zevv: I recall you dropping the term "corona badge" once, but no background info Zevv: I might have missed that disruptek: gamification of the 14-day decay. Zevv: privacy! implications! disruptek: you prefer the google/apple solution? Zevv: nope Zevv: I do not believe in any technological means for this, I guess disruptek: are walls technology? Zevv: narrow that down to anything that runs on batteries disruptek: it's batteries you have a problem with. Zevv: and 5G, right disruptek: leorize: you wanna weigh in on this ryu thread? leorize: what ryu thread? disruptek: #7717 disruptek: i think your impl is the one we want, right? leorize: no, I haven't even started on the impl :P leorize: clyybber impl is a 1:1 translation of the C one leorize: mine can be used as a guide to navigate that mess :P disruptek: but, i don't think it makes sense to use the translation. disruptek: i thought you were like 3/5ths done. leorize: I've only finished the reference impl, not ryu leorize: I haven't even started on ryu :P disruptek: disbot: can you work at 0.2fps? disbot: yep. 😊 leorize[m]: disruptek: oh if you don't have windows you can actually flash from uefi if you're brave enough :P disruptek: i'm brave, but i'm also not an idiot. Varriount: Hey krux02. 😄 audiophile: can someone explain how nim deals with the whole package management craze? it's a mess in python right now. Do we have virtualenv in nim? leorize: no audiophile: k leorize: it's a mess in python because python separate packages by python version leorize: we don't do that here Varriount: audiophile: You don't generally need something like virtualenv for a compiled language, because it doesn't require a runtime to be installed. leorize: also nimph is more reliable than nimble :P audiophile: what if i want to use a library version x instead of latest y? audiophile: oh first time hearing of nimph will check it out leorize: nimble install [email protected] leorize: !repo nimph audiophile: Varriount I iddn' understand that :( leorize: disbot is dead again :P audiophile: leorize but where does it get installed? audiophile: does it overwrite global installation Varriount: leorize: I believe what's being asked is, "what do I do if I am working on 2 different projects, `foo` and `bar`, each of which require a different version of `baz`?" leorize: installed alongside the global one leorize: then each one will be compiled with the version they require Varriount: How do you specify the version required? leorize: kinda terrible imo, but it works because some people want it to leorize: `requires` in .nimble leorize: you can specify version constraints there audiophile: oh that's kinda like a virtualenv I guess, except your different versions of `baz` also get installed globally? audiophile: Varriount could you explain the 'because it doesn't require a runtime to be installed' part? do you mean after it's compiled into a binary? leorize: yea audiophile: uh yeah to which question =) leorize[m]: both audiophile: ah audiophile: nice! disruptek: yeah, lemme try flashing this thing. then the bot can return to service. audiophile: dont flash audiophile: it's illegal O_o audiophile: PMunch hullo Varriount: audiophile: Yes. audiophile: uh im a bit confused audiophile: what does that have to do with not needing virtualenv audiophile: you specify in the .nimble and just compile, that's all? audiophile: specify the package versions I mean Zevv: what's "phi nodes"? Varriount: audiophile: One of the problems I've faced is that virtualenv is required when you want to install multiple Python applications on a system, because the applications might have conflicting requirements. audiophile: ohhh i see what you mean audiophile: it all goes away with statically compiled bins right? Varriount: Well, yes. You can still have problems with DLLs, but various operating systems have that mostly sorted out. Varriount: Windows says "just bundle your required DLLs with your application", Linux says "version your DLLs by name"... I don't know exactly what OSX does, but it seems to work too. audiophile: oh I see audiophile: a lot of headache avoided nicely in nim audiophile: is this messy situation common with interpreted langs? Varriount: Javascript seems to have it sorted out, but then again, it essentially creates a virtual environment by default. supakeen: Javascript package managers create an environment by default, Python is working on that bit as well. Zevv: but there's always the problem of package A depending on B and C, where B and C both depend on different versions of package D Varriount: Zevv: Yeah, but that's hard to support unless you have some sort of object-oriented module system, where versions of the same module can coexist. Varriount: I guess C/C++ technically allow that with DLLs? You tend to get odd behavior though. krux02: Varriount: hey krux02: @Varriount: just saw your message krux02: what's up? Varriount: krux02: Nothing much, just interested to see what you're working on. krux02: currently, I am trying to figure out a healthy way to continue Nim development. Varriount: krux02: You can always fork the compiler. Or work on a library. krux02: yes I can do that. Varriount: For what it's worth, I agree with Araq on the `emit` stuff. And nothing says those functions can't be in a nimble package. krux02: I don't really care too much about emit. krux02: It should be improved, but it is not high on the list of priorities. companion_cube: maybe an alternative compiler would be a healthy way of continuing nim development? krux02: maybe yes, an alternative Nim compiler would be good. krux02: But I can't maintain a fork of Nim. krux02: Not alone. Recruit_main707: if someone does this, either a more pure nim to c transpiler or an actual nim -> exe compiler krux02: I am thinking of a more pure Nim krux02: no surprise features Varriount: @Recruit_main707 See NLVM https://github.com/arnetheduck/nlvm Recruit_main707: linux only to my known :( companion_cube: a smaller nim means a smaller compiler, right? :) krux02: I am on Linux as well, I don't even have windows. krux02: a smaller Nim means less bugs. Varriount: I have Windows... or will have, once my personal computer is fixed. krux02: you want to help me build a fork of Nim? companion_cube: oh boy, wish I had the time Araq: do you want me to say anything? Varriount: krux02: Well, what kind of help/support are you looking for? someunknownuser: krux02: What exactly do you mean by "no surprise features"? leorize[m]: krux02: are you planning to create an another implementation of Nim? leorize[m]: or are you gonna take the current compiler and trim it down? sheerluck: You know what is hard? To come up with a good name for a fork of Nim. Jennifer is a good name. Araq: fwiw I can give you many guideliens for a trimmed down Nim... Araq: *guidelines dadada: for what it's worth, I think there are still a lot of gaps in Nim functionality, so a smaller Nim is definitely not the direction that I'd be heading to, although the motivation that krux02 has, of producing something by higher quality by concentrating on the core of it, is awesome, I believe there's a much better path by growing Nim and its community, and therefore bringing new devs into the fold who can dadada: maintain different parts of it, increase the number of hands/eyes, and I don't think Nim should become like LUA, it's a multi-purpose programming-language, not something geared to a niche, and therefore it offering many tools for different kinds of programmers and tasks makes sense, of course not all of it has to reside inside Nim itself, I'm working on a kind of Nim extension package myself (in an early dadada: state, nothing that I want to show off at this time), and when I release this I'd of course welcome others to contribute, but it'd also be great for Nim to pick up more features, because in the end we have to compete with Java/Python-world, who are used to getting a lot of batteries included sheerluck: Brunhilda is a good name too. Araq: but I'm the scapegoat so I doubt you want my input, krux02 Araq: my trimmed down version of Nim is called 'Nox', 'Nox' because it's what Araq works on at night. Nah, I'm kidding. I like the name though. companion_cube: could be called 'trim' krux02: Varriount: If I actually do a Nim fork, there should be a homepage for it. krux02: leorize[m], I am thinking of trimming down Nim. companion_cube: maybe with the same compiler and a -betterC flag! companion_cube: ah wait, that's D. zacharycarter: I don't really understand the motivation - aren't extra features hidden behind feature flags anyway? sheerluck: Why are you always tend to choose short names for programming languages? Ekaterina is a good name too by the way. krux02: zacharycarter, nope leorize[m]: I'd personally welcome an alternative implementation more zacharycarter: I think Nim has grown larger and more complex because it's tackling larger and more complex problems krux02: extra featuruse sprinkled around the codebase as gunk that nobody needs, but hinders bug fixes. zacharycarter: wouldn't a simpler nim be a nim that's less usable in certain situations? krux02: no krux02: The feautures that I want to remove are probably feautures that you never even heared about. zacharycarter: I guess so Araq: which ones would that be? zacharycarter: I'm definitely not very much into language design companion_cube: krux02: a list would be interesting krux02: I don't have a list ready, but I will produce one. companion_cube: that'd be nice Araq: .liftLocals krux02: Things that I would adress that bothered me since the beginning is proper editor integration that works 100% reliable. krux02: No more false error messages because a fil is included. Varriount: fil? Varriount: Oh, file krux02: file yes krux02: sorry dadada: krux02: to say that nobody needs them is hyperbole by definition, (if nobody needed them, the feature would not have been added), I used SCF today, they were also heavily used in Nim in Action (for templates), there are clearly some people that need features that you don't need, I've seen this kind of hyperbole from you a couple of times, and it neither helps your arguments (makes you look weaker in my view), dadada: nor does it help you, when you railed against a certain person it looked like the same to me, and nevertheless I truly value your contributions in this channel and to Nim, because you're an awesome dev without a doubt! Prestige: krux02: what do you mean about the editor? I haven't run into that issue (yet?) krux02: thanks Araq: he means that 'nim check' works as documented and that editors misuse it Varriount: Prestige: You will if you've ever worked in a project that uses the `include` statement. Araq: and it's of course Nim's fault. been there, discussed that. krux02: Araq: yes, we discussed it. You are in denial that there is a problem. Therefore I could never fix it. Araq: I don't mind changing 'nim check' though but the PR would likely contain random crap and it's my fault I won't merge it krux02: no the problem is deeper. Araq: ah I'm in denial again. krux02: yes. dadada: comedy and tragedy are very closely related! Prestige: Hmm idk if I'll run into that issue since my editor just uses the lsp krux02: I gave up on convincing you that there is a problem. Recruit_main707: tragedy is comedy without the punchline krux02: Can only be addressed in a fork. krux02: I would also redo the command line interface. krux02: ``nim c`` what does c stand for? compile. Ok, then ``nim cpp`` what does cpp stand for? Recruit_main707: c++? companion_cube: compile plus plus krux02: yes Recruit_main707: https://tenor.com/view/nickyoung-questionmarks-what-excuseme-huh-gif-4486363 Varriount: krux02: I could certainly help with that. Prestige: Maybe just update the help output but it seems fine Araq: Prestige: his editor doesn't use the LSP though and it's Nim's fault once again. krux02: I would change the command line interface to probably just `nim myfile.nim` Prestige: Araq: stop writing these bad editors /s Varriount: krux02: How would the various commands (check, etc) be represented? dadada: talking about editors, has anyone here seen moe, which is a vim-like editor written in Nim? it looks like it's of to a good start? dadada: ! Prestige: Looks decent but I can't get away from vim Recruit_main707: but its abandoned right? dadada: since it's written in Nim, you can assume that it's Nim support will be awesome dadada: Recruit_main707: no, very active on github krux02: Varriount: not sure yet Recruit_main707: oh really? does it work on windows? dadada: Prestige: it has vim keybindings, and plans to support mor vim features dadada: more krux02: but this `c` mean `compile` but it kinda also means `C` as in the language, I really hate it. krux02: same with `cstring` Prestige: I mean I have vim working with nim already krux02: meaning string from C. dadada: krux02: I'd appreciate a git-style command based interface, they're relatively easy to intuit about krux02: But then it is also in javascript, and it is also called `cstring` Prestige: krux02: I thought it was just the compile target, not actually meaning "compile" Recruit_main707: krux02: would you prefer jsstring? krux02: yes Recruit_main707: lol, no, something else to worry about and not necesary imo leorize: cstring is officially called "compatible string" lol Prestige: I suppose you could just submit a pr for the cli if you wanted? But it doesn't seem very necessary (even though the cli doesn't follow common argument conventions) Recruit_main707: gotcha there krux02: leorize, yes exactly leorize: which makes zero sense tbf :p krux02: but cint and clong is compatible int and compatible long? leorize: Prestige: the way nim cli work is ingrained into the compiler itself Araq: sure, "compatible with C" in this case, but *shrug*, this is not even nitpicking, it's trolling Prestige: Interesting. I think it's fine how it is sheerluck: while I was listening to your debate, it occurred to me for the first time how hard it is to create programming languages leorize: I'm not a huge fan of the nim cli either leorize: but I gotta create some good cli first before I can give ppl advise :p Prestige: Can just follow normal cli conventions, like -c, --compile would both be the same thing Prestige: But it's like dadada: all I want is for disruptek to stream, so I can hear his music, pretend to listen to him, and then I'll be in the mood to do some programming Prestige: It's working so who cares really shashlick: krux02: just so that i can understand, don't you think you are bundling your experience with the compiler codebase with the end user experience? Prestige: Araq: you have any thoughts on zig? leorize[m]: Prestige: good cli go a long way. gcc thought so until clang forces them to up their game Prestige: Fair enough Araq: Prestige: no, I don't see the point. Just use Rust with unsafe blocks if you don't mind verbosity. dadada: in the mood for promoting this: https://github.com/fox0430/moe there's this feature: Written in Nim ... I might join that project, too PMunch: Prestige, sweet! Prestige: It was only like 2 lines but I thought I'd save you the trouble Prestige: dadada: looks interesting, if they add plugin support I'd actually check it out someunknownuser: I also wrote my own editor in nim for editing nim code (See https://github.com/pseudo-random/editor). dadada: Araq: I see one point in Zig, and I think it's actually a really big one, there're tons of old yet still important projects written in pure C, and Zig is one of very few languages, that make it relatively easy to convert a C project to a somewhat more modern language, if there's ever somebody at the helm of the Linux kernel who wants can admit that Linux would never be written in C today, Zig would be one of dadada: the most realistic and least painful paths of transition. Araq: maybe. because Linus officially hates C++ Prestige: Nice someunknownuser :) you should add some gifts/screenshots imo, world be cool to see it in action Prestige: I heard a lot of people discussing rust for kernel development but it isn't quite there yet companion_cube: ZIg goes a bit further than rust in its handling of allocators companion_cube: no global allocator is unusual someunknownuser: Prestige: Thanks, I am planning on doing that at some point in the future. dadada: Araq: Linus did say that he thinks C++ is fine for creating desktop apps, I believe he even wrote his scoopadiver desktop app in C++. So hate is the wrong word, or he definitely wouldn't have done that. I think it'd be many times harder to convert a C project to a C++ one, than to a Zig project. Araq: and why do you think that? it makes no sense. Araq: rename the .c file to .cpp and add some casts for the different void* handling. Araq: it's harder when you used many C99 features but what's the point anyway, they think C99 is fine and are willing to stick with it until forever. Araq: it's also not going anywhere, it's fine. I'll simply use RustOS when it's ready and won't look back ;-) companion_cube: you mean https://www.redox-os.org/? :) Araq: yeah Prestige: Nimos when? arnetheduck: @Araq help me with https://github.com/arnetheduck/nbindgen then 😉 companion_cube: there's also serenityOS which is pretty cool dadada: Araq: I have converted C code to CPP code, and to convert it to idiomatic CPP is many times harder than you just described, there are subtle differences between C/C++ than can bite you (and I'm thankful that I didn't have to deal with that crap for a long time), Zig goes a long way to make sure such crap is avoided, of course you can compile a lot of C code in CPP, but that doesn't make it CPP code, when you dadada: start to incorporate CPP idioms it can get really hairy, and now think about a code base with millions of lines like the Linux kernel, C -> CPP can never happen there realistically now (while it might have been possible in the early 90s), but Zig makes a point of allowing for smooth transition from the beginning to the end, and that's why I think it could work, and it still would be a giant project dadada: s/than can/that can Araq: why does it have to be "idiomatic C++"? Araq: you can write the new code in more idiomatic C++, you don't have to convert the other trillion of lines PMunch: Prestige, those are the hardest to do, because of the overhead dadada: Araq: have you looked at Linux kernel code? Just curious, don't want to troll you or anything? Araq: but ok, so go use Zig instead for that, I don't care. I personally think that not even C is good for kernel development when you restrict your stack size to 8KB dadada: Araq: I'm not going to use Zig for anything, I'm currently deep in the Nim trenches. relax! PMunch: And Prestige, I think dom96 made a POC OS in Nim PMunch: Not sure if it still compiles though Araq: C makes stack allocation the easiest way to do allocations so you're fighting the language all the time and cannot use 3rd party code. In C++ you can use refcouting for the heap allocations Prestige: Interesting - I don't think I'll ever get into anything so deeply involved though tane: how do stack allocations make anyone fight the language? dadada: Araq: the Linux kernel guys have implemented their own in-kernel library for pretty much everything, I'm positive they have their own library for refcounting heap allocations, the Linux kernel code is its own world, they even use special GCC extensions that are made for specifically for the Linux kernel, which add features, so they're not even using pure C, they use C+FeaturesNeededForLinux dadada: s/guys/guys and gals/ companion_cube: s/guys/y'all/ Araq: dadada: I know. companion_cube: don't thank me sheerluck: I thought in English the gals are included in the guys so you never have to s/guys/guys and gals/ dadada: companion_cube: I don't thank you! liblq-dev: hmm, I'm getting a segfault at popFrame() somewhere in the stacktrace system liblq-dev: no clue why leorize[m]: depends on what english you're using I guess :P dadada: sheerluck: yes, but I want to please the thought police leorize[m]: liblq-dev: now that definitely doesn't sound good sheerluck: leorize dadada how about I fork English language? liblq-dev: leorize: it's probably something because I'm interfacing with C liblq-dev: worst thing is, it's not my library dadada: sheerluck: there are already hundreds of forks of English liblq-dev: so I have to debug someone else's code. leorize[m]: should affect too much, I think Prestige: sheerluck: in the USA you can say "guys" to mean the immediate group of people you're talking about, which is genderless leorize[m]: what are you using? companion_cube: Prestige: y'all is just better 🤷 Prestige: If you're from Texas ;P companion_cube: well I lived in Texas, and it's clearly a good invention of theirs companion_cube: all y'all dunnow what y'all are missin disruptek: in philly it's you's. dadada: Prestige: well, I had instances in my life where woman complained that I didn't address them, even though my intention was to address them, and I used a word much like guys to do it, which I thought to be applicable to all, but some people can make a point of being offended for no reason, so I play this game now of making a point of addressing the female gender, although I know precisely that all reasonable dadada: people should feel included anyways and assume that I'm a well-meaning person PMunch: sheerluck, great idea, let's fork it clean up the cruft, add some nice features and call it English++ Prestige: dadada: I've been in that situation, I guess I just don't care enough to change my speech liblq-dev: hm, --gc:arc still segfaults but I get a way different result leorize[m]: then maybe we need to see your code :p disruptek: leorize: i had to actually abandon the radeon card. it turns out that there's no updated bios for the version i have. so i'm returning it for another. disruptek: !repo nimph disbot_: https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 59⭐ 4🍴 7& 1 more... leorize[m]: disruptek: that's sad then dadada: Prestige: I do it in a playful way, there's no significant change under the hood, for me all genders are the same, the only thing that matters is, do you write good code? :-) disruptek: nope. dadada: Prestige: and it should be FOSS code sheerluck: In my fork of English I will 1) remove all articles A AN THE bc we russians don't remember them 2) add suffixes to nouns so you can tell male/female apart // like ship is female in english which is ridiculous Prestige: love me some foss Prestige: The whole 'ship' being female thing is some weird sailor shit I think leorize[m]: I definitely don't know enough english for this conversation dadada: sheerluck: 2) is a big mistake, not having this is one of the best assets of the English language IMO dadada: sheerluck: I'm not going that fork :D supakeen: Can I submit a fork to this English PR to replace -ed with -t. Prestige: I wish we had a genderless shared version of he/she like we do in Farsi supakeen: So we can write walkt and burnt and learnt and talkt and it'll be consistent? PMunch: supakeen, poor people named Ted will now just be known as Tt supakeen: Hehe poor Ted. sheerluck: ))))) Prestige: lmao PMunch: Prestige, they? PMunch: supakeen, oh yeah that'd be nice Prestige: sounds weird to me, but what if you're telling a story with a male and female in the same sentence? PMunch: What do you mean? Prestige: my brain keeps mixing up he and she when I say sentences like that supakeen: They is the common form used for ungendered stuff but it's not very common especially for non native speakers. Prestige: "He told her that he did x and she said to him...." supakeen: Where it might map onto something that doesn't exist at all. PMunch: Prestige, ah right dadada: supakeen: the endings usually sound more like ed than t, so I'd vote for the opposit, drop t, and take ed everytime, as that also looks nicer IMO PMunch: That sentence would just be massively confusing without the genders though PMunch: Xe told xe that xe did x and xe said to xe.... PMunch: That's just completely unreadable :P supakeen: dadada: Fine, I'll fight you. supakeen: ;) PMunch: Two forks, the most stars wins! PMunch: But I'm off to bed now, ttyl Xe: hi Xe: oh Prestige: o/ Prestige: Is nimph the common way to manage nim packages for repos? I need to figure out how deps are set up for builing packages disruptek: it's the only sane way to handle arbitrary local/global dependency relationships, but it's not the common way. disruptek: most people use nimble alone. disruptek: we call those people, "throwbacks." supakeen: did you know that what we call mars in eu is actually milky way in the usa and our milky way is called something something musketeers or something? supakeen: anyways if you get a milky way in the us it's our mars Prestige: dadada: I lol'd sheerluck: supakeen speaking of musketeers -- did you know that Marsha was a name of some bitch that killed d'Artagnan in "Django Unchained (2012)" dadada: Prestige: wanted to see if somebody could go lower than me, apparently nobody can sheerluck: And I spent 2 hours wondering is that "Marsha" is close to russian name "Masha" or is it just coincidence supakeen: @sheerluck: the dogs? sheerluck: yes dadada: enough with this silly chit chat, I've some hacking to do supakeen: @sheerluck: I think Marsha was just a normal Egnlish name in the 50s or so when Marcy was popular as well supakeen: Masha in Russian is Maria in English isn't it? sheerluck: yes disruptek: udev renaming eth ifaces according to hardware address is stupid. supakeen: @sheerluck: Do you spell it wit that 'w' letter? supakeen: (for sh) sheerluck: yes leorize: I find it kinda useful supakeen: Nice :) disruptek: huge pita when the hardware happens to change. disruptek: i'm just renaming them manually now, eg. san0, wan1, etc. supakeen: Anyways, if Masha = Maria, Marsha != Maria so I don't think the names are related! naught-fowl: howdy nimbos Araq: naught-fowl: is it you? fowl? disruptek: naught. disruptek: Araq: whassup boss Araq: disruptek: waiting for your PR disruptek: i know, i will work on it tonight. but, y'know, i think it's too much work to break out just the little refactor. Araq: well try it for one hour please Araq: after that, throw in the towel and tell me "dude, impossible!" disruptek: the whole file changed. i may as well just finish the refactor and push just that one file's changes. disruptek: don't worry; we're not going to lose this work product. it's on gh, fwiw. dadada: installed moe with nimble install moe dadada: and get this: could not load: libncursesw.so dadada: hmm, I thought that nimble takes care of such things... this is the first time something like that happened to me dadada: with nimble I mean, usually if you can nimble it, it'll work leorize[m]: libncursesw.so is a system library disruptek: you sweet, summer child. Araq: disruptek: is it? which branch? leorize[m]: nimble won't be able to deal with it :P disruptek: ic2 leorize[m]: what distro are you using? dadada: leorize[m]: yeah, I know that dadada: leorize[m]: fedora 31 Araq: gah this SSA stuff is so hard, maybe I should stream about it Araq: forces me to focus when I stream... disruptek: ssa? Araq: "static single assignment" form leorize[m]: dadada: try installing ncurses-devel? dadada: leorize[m]: already installed leorize[m]: I'm not sure what's the name for the development package there leorize[m]: `/lib` and/or `/usr/lib` have no libncursesw.so? dadada: leorize[m]: they do, but there's a version number coming after .so, that's probably the issue here leorize[m]: that means you haven't got the development package installed :P dadada: leorize[m]: I do have them installed, dnf install ncurses-devel dadada: Package ncurses-devel-6.1-12.20190803.fc31.x86_64 is already installed. leorize[m]: or fedora is weird dadada: /lib/libncursesw.so.6 -> libncursesw.so.6.1 dadada: there's no /lib/libncursesw.so leorize[m]: usually development packages will have a `lib.so` (w/o version) for developers to link with `-llibname` disruptek: just make a link and move on with your life. sheerluck: dadada /usr/lib/libncursesw.so ? dadada: leorize[m]: I assume they want to make sure that no package compiled against an older ncurses can accidently use the newer library?! leorize[m]: once linked the library will be referred to by its soname dadada: lib is a symlink to /usr/lib in fedora, so there's no difference shee dadada: sheerluck disruptek: i'm sure that's it. those well-intentioned fedoralists. leorize[m]: in your case `libncurses.so.6`, but linkers can only find `libncurses.so` dom96: alehander92: reviewed your diff dadada: leorize[m]: created the link, moe still complains about the same thing.., hmm dadada: could not load: libncursesw.so leorize[m]: where did you put the link? :p dadada: maybe there's simply another incompatibility dadada: leorize[m]: inside /usr/lib/ leorize[m]: have you verified that the link points to the right place? dadada: leorize[m]: here's what strace output looks like for moe https://pastebin.com/iUeg3xH7 dadada: as you can see it tries to open the lib from different places dadada: I've verified that /lib64/libncursesw.so exist dadada: exists leorize[m]: dadada: lol I see the problem now leorize[m]: your `libncursesw.so` is a linker script :p dadada: yeah, does look like it leorize[m]: looks like you gotta build moe with some special flags leorize[m]: `nimble build --dynlibOverride:ncurses --passL:-lncursesw` <- that's how it should be built for you leorize[m]: alternatively fix this so that it uses a search regex :P https://github.com/walkre-niboshi/nim-ncurses/blob/master/ncurses.nim#L7 dadada: leorize[m]: I wonder why the thing looks in lib64, but not lib leorize[m]: because that's what fedora configured it's glibc to do dadada: I'll see what #fedora has to say leorize[m]: they will tell you that you gotta link it instead of `dlopen` like so :P dadada: can someone verify that nimble install moe works in other distributions? leorize[m]: definitely not mine leorize[m]: got a linker script too dadada: which distro? leorize[m]: gentoo leorize[m]: actually, maybe it could work leorize[m]: wait dadada: https://github.com/fox0430/moe/issues/508 disbot_: ➥ Unable to locate installed libncursesw.so leorize[m]: lol the linked PR remains unmerged to this day leorize[m]: yep moe doesn't work here dadada: don't like that he closed the issue becaue a symbol link worked, there must be a better solution than to require your users to find a closed issue and then create symbolic link dadada: s/he/he or she dadada: I think moe shouldn't even be based on ncurses, we need a pure Nim library for such stuff, if I'm not mistaken clybber was working on something like that inv2004: Hello, another hour - another question: I have c-func: S myF(S) {S->arr} , but in C code I use myF(S)[10] , how can I do the same within nim with array within my C-structure ? Araq: array[10, S] inv2004: thx dadada: this is related https://github.com/nim-lang/Nim/issues/987 dadada: and this also https://github.com/rnowley/nim-ncurses/issues/15 disbot_: ➥ Problem with using 'libncursesw.so' (Linux) dadada: seems like Linux users are getting a worse experience than Windows/Mac users in this case dadada: this leads me to asking, what do we do about wrappers that aren't well maintained, but a lot of projects rely on, there's a pull request for the ncurses wrapper that probably fixes this, but the maintainer apparently has no time for it, yet ncurses is still a popular API for the CLI alehander92: @dom96 thank you alehander92: i'll look at this after a few days, sorry guys alehander92: Easter vacation alehander92: for us here dadada: I'd rather trust a well done tool like nimterop to provide wrappers on the fly than a random guy to maintain a wrapper by hand and to care about his users years down the line ZoomZoomZoom: I'm reading the --gc:arc announcement thread and I wanted to say that I'm pleasantly impressed with Araq's handling of questions. Short but exhaustive and to the point! ZoomZoomZoom: Great work Araq: thanks Araq: development is on-going dadada: ZoomZoomZoom: where? ZoomZoomZoom: https://forum.nim-lang.org/t/5734 Araq: this is outdated btw Araq: sink inference is in 1.2 Araq: as is the new exception handling implementation ZoomZoomZoom: I'm at the stage of emerging into the ecosystem ZoomZoomZoom: So trying to suck in the info with some historical perspective :) ZoomZoomZoom: Where to read next? Araq: ZoomZoomZoom: watched my video about it? ZoomZoomZoom: Not yet, will do Araq: it's outdated too but was done later :P Araq: dadada: I like hand written wrappers but regardless, I think the solution is to fork the package Araq: happens all the time ZoomZoomZoom: Ok. I'm pondering over using nim for audio, so arc is what came up first. Araq: ZoomZoomZoom: IMHO all new development should use --gc:arc ZoomZoomZoom: Sure looks like it, but what do I know dadada: ZoomZoomZoom: we have a commonality dadada: ZoomZoomZoom: 3x da 3x Zoom ZoomZoomZoom: nice catch liblq-dev: is it possible to specify a git repository URL in nimble requires()? ZoomZoomZoom: Although, I'm mostly go by ZoomZoomZoom/3 Araq: liblq-dev: yeah, iirc you simply write down the URL shashlick: here's a nimterop curses wrapper if anyone needs it - http://ix.io/2ila/nim shashlick: http://ix.io/2ilb/nim is the output on Linux ZoomZoomZoom: Wait, I've seen the video from FOSDEM already. Oh, boy... zacharycarter: I want to emit `__attribute__((used, section("__DATA,__state")))` in my C code before a function definition - is this possible? zacharycarter: I was thinking of trying to use a template as a pragma to do this - but I'm not sure how to make it prefix the function definition zacharycarter: ah nevermind I Found examples of this leorize[m]: I'm not a fan of `codegenDecl`, but it works for this kind of things zacharycarter: yeah - that's what the example I found was using dadada: shashlick: thanks, is there a central place for all nimterop wrapper generator files? would be useful to stop people from reinventing the wheel ZoomZoomZoom: BTW, is "Nim in Action" a recommended read, or considered outdated? dadada: ZoomZoomZoom: still good, go read it, I recommend this blog post to new Nim people https://totallywearingpants.com/posts/nim-language-highlights/ ZoomZoomZoom: Thx leorize[m]: dadada: https://github.com/nimterop/nimterop/wiki/Wrappers KingDarBoja: Hi 😄 shashlick: There is a wrappers repo but I haven't had time to get it up and running shashlick: Right now I maintain them in individual repos shashlick: Nimarchive and nimgit2 Recruit_main707: Has someone tried using c2nim/nimterop to wrap a Python.h? dadada: shashlick: putting all in one repo would have the advantage that no individual wrapper would have to rely on the original maintainer of that wrapper, the wrapper repo could have multiple maintainers, and someone should always be around to accept pull requests leorize: Araq: is there a proper way for --gc:arc and cycles to live together? leorize: or is --gc:arc capable of warning me about potential cycles? Araq: Recruit_main707: there is a python.nim somewhere shashlick: https://github.com/nimterop/wrappers Araq: leorize: it can warn but it's not reliable. I'm not sure the problem has a solution beyond what 'owned' did Recruit_main707: Araq: It didn’t work so well when I tried it Araq: well you can either write a bug report or re-wrap it :-) Recruit_main707: I think I actually have one... sealmove: Guys I did it :) You can already use Kaitai with Nim https://ci.kaitai.io/ Recruit_main707: Well, a github issue KingDarBoja: What is kaitai? Sorry for my ignorance 😄 Recruit_main707: Similar to flatbuffers I think liblq-dev: I made a program for animating things https://github.com/liquid600pgm/pan liblq-dev: still a WIP, there are a few things I'll need to sort out before I can call it done leorize[m]: kaitai is a binary parser language liblq-dev: eg. a timeline, importing audio files leorize[m]: it lets you parse any binary data, given the schema dadada: when will arc be the default GC? leorize[m]: once Araq solved cycles Recruit_main707: libq-dev how about you add support for Nim? leorize[m]: :P zacharycarter: aren't cycles solved with --gc:orc? leorize[m]: --gc:orc kinda ruins everything --gc:arc stands for zacharycarter: Does it? Couldn't --gc:orc still be used in soft realtime apps? Like games? zacharycarter: it still gets one past the lack of a shared heap leorize[m]: determinism is the main feature of --gc:arc inv2004: Sorry for so simple question: cast[S](t.un.g.addr) <- it is return my S struct, but how can I extract 2nd element? .g.adde is start of the C-array of S leorize[m]: zacharycarter: orc breaks this leorize[m]: inv2004: `cast[ptr UncheckedArray[S]]` zacharycarter: I get it - but I think it still allows me to make progress haha KingDarBoja: I feel like dumb after seeing all those nim projects 😄 KingDarBoja: Pretty awesome the Lua-Nim program leorize: you'll get used to it soon sealmove: what Lua-Nim program? leorize[m]: !repo pan disbot_: https://github.com/liquid600pgm/pan -- 9pan: 11puny animator – create motion graphics using Lua 15 0⭐ 0🍴 7& 1 more... sealmove: hmm inv2004: @leorize[m], type mismatch: got but expected 'S = ptr S:ObjectType' leorize[m]: what are you trying to do? inv2004: I have addr of beginning of c-array of S-struct. I want extract N-th struct from the c-array inv2004: ... of S-structs. liblq-dev: @Recruit_main707 how about no? the Nim VM is slow and hard to work with liblq-dev: all that passing PNodes around and what not leorize[m]: liblq-dev: or you can make it a library :P liblq-dev: I could, but then I'm losing out on fast hot code reloading. liblq-dev: don't think I didn't consider that :P leorize[m]: inv2004: then `ptr UncheckedArray` is what you want leorize[m]: but I can't tell you why it's erroring out without seeing the code leorize[m]: liblq-dev: or you could have make it do both :p liblq-dev: maintaining two different APIs is hard. I want to have one unified API and reference. inv2004: leorize[m], my nim's type S = ptr object ... . inv2004: because C:typedef struct s0{...} *S liblq-dev: do you guys really hate lua so much? :P liblq-dev: it's not a bad language for fast prototyping. leorize[m]: you're in `#nim` leorize[m]: in `#nim`, nim is the best liblq-dev: but pan is written in nim! KingDarBoja: You gained a follower liblq-dev KingDarBoja: I used LUA with Love2D cuz it was the language being used at the CS50 Videogame design course leorize[m]: not enough, you still used the inferior lua KingDarBoja: it is* Recruit_main707: > in `#nim`, (and everywhere else) nim is the best liblq-dev: leorize: dude, I know. it's just that I needed something fast and didn't want to mess with long compile times leorize[m]: i know, i was just joking around lol liblq-dev: ikr liblq-dev: though I would've used Nim if it compiled as fast as a lightweight VM language Recruit_main707: compiled VM? Recruit_main707: Either one or the other :p liblq-dev: this is partially why I'm developing my own scripting language. to be able to enjoy an experience similar to programming in Nim while having the benefits of a VM liblq-dev: well anyways, I'm out for now. goodnight. leorize[m]: you could have developed an alternative Nim VM :p KingDarBoja: https://www.slant.co/versus/395/1418/~nim_vs_lua leorize[m]: 'night Recruit_main707: As an expython programmer, I will say vm advantages are not as much as compiled ones. Recruit_main707: Good night Recruit_main707: Surely you can rerun it fast and all that, but performance men... lqdev[m]: @Recruit_main707 negligible when you're sending expensive commands to the GPU. audiophile: waht is dsl/domain specific lang and why should I care? just curious audiophile: is it dll stuff? lqdev[m]: as long as it runs fast enough to play at 60fps, I'm happy. KingDarBoja: Didn't you went to bed? audiophile: hello king KingDarBoja: ❤️ KingDarBoja: Sup mate audiophile: :D not much here working on building some C source code wbu KingDarBoja: Nice, I am right now updating my local repo of TS-website to keep translating sections of the site KingDarBoja: To spanish lang audiophile: TS? audiophile: teamspeak?? leorize[m]: lqdev[m]: oh do you finally get the lqdev name? leorize[m]: they should've done the old nick purge on the 11th sealmove: audiophile: TypeScript KingDarBoja: TypeScript audiophile: ah audiophile: statically typed js? KingDarBoja: Yeap krux02_: audiophile, it really feel like a C# ish javascript. KingDarBoja: That's true too awr1: Hmm awr1: you can't place a lower bound on length of varargs[T] awr1: right? shashlick: what i mean is build the header files into object files and then link them to the final binary zacharycarter: yeah that's what I was thinking you meant - okay let me try that shashlick: nested struct/union/enum support is coming in ast2 zacharycarter: sweeet shashlick: took a couple hours, amazing, this new arch awr1: trying to think if these signatures should be just `varargs[T]` or `x, y: T; z: varargs[T]` awr1: I suppose i could just add a `when args.len < 2` awr1: https://github.com/nim-lang/Nim/pull/13985 clyybber: nice! clyybber: I think this approach is the best zacharycarter: shashlick: so I can produce an object file for the cpp source or the objc source - but then I have different problems with each timotheecour: can anyone please merge https://github.com/nim-lang/Nim/pull/13984 to unbreak nim CI? zacharycarter: with the cpp source, when I try to compile my nim sources with the C compiler and link to it, I get an error about algorithm.h, which is a cpp header zacharycarter: if I compile the objc sources, and compile my nim sources with the cpp backend I get errors because of name mangling and definitions not being found for importc zacharycarter: is there a way to get nimterop to use the importc pragma and be explicit about what definition is being imported? zacharycarter: I guess the first way doesn't make much sense - I can't really link a cpp object file when using a c compiler zacharycarter: or I guess I can zacharycarter: yay got it to work zacharycarter: just had to link libc++ and use the c++ linker Prestige: Is nimlsp supposed to be showing diagnostic info? I don't seem to be getting any error/warning info shashlick: Yes was about to say that shashlick: Awesome zacharycarter: thanks for the protip Prestige: Anyone familiar with xlib? I'm attempting to use XGrabPointer, and if I click on the root window I will get an error "BadWindow (invalid Window parameter)". Just attempting to pass in the event's window/root/subwindow, they all give that error Prestige: ah I needed to check if it was of type x.None Varriount: Hm, what would I call an iterator that returns a stream of file path component indices? leorize: componentSlices Varriount: leorize: Thanks. Varriount: It's frustrating trying to design the API for this path library, because what's convenient isn't what's efficient, and there's not an easy way to bridge the two. Varriount: Araq: With distinct types, is there any way of avoiding the gymnastics required for conversions across generic containers, something like `var foo = LinkedList[ParentType](variableOfLinkedListChildType)`? awr1: @Varriount can you clarify what you're asking awr1: are you asking for ways to decrease verbosity of that awr1: if you know the mapping from child to its parent type, you could make a template that takes a type and returns a type arielfe: i really want to learn nim, but also thinking about lisp. i have read interesting things about the way using lisps might help promote a deeper understanding of programming. do you i can have the same experience by learning and using nim? Zevv: Nope, nothing compares to lisp. arielfe: i see. thats what i thought. well - ill just have to do it as quickly as possible and then come back to nim :) Zevv: But there is no reason to do both, and they're kind of different beast. Lisp brings you nirvana, but Nim is a powerful practical workhorse. Zevv: For lisp, work your way through "Structure and Interpretation of Computer Programs" and you will see the light Zevv: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/1a-overview-and-introduction-to-lisp/ arielfe: thats exactly what i was thinking :) arielfe: yes the famous SICP book :) - which brings up another question - should i start from it? or some more introductory material for lisp and then move on to it? arielfe: ok got all the answers i needed from searching and the start of the lecture you linked. Thanks a lot :) Zevv Prestige: PMunch: does nimlsp report diagnostics? It looks like it should, looking at the README. My lsp client isn't reporting any, didn't know if it's because of nimlsp or a misconfiguration on my end PMunch: Define diagnostics Prestige: Syntax warnings/errors, like incorrect params, unmatched quotes and parens, etc PMunch: Oh yeah, those should show up Prestige: Thanks, I'll dig into my coc-nvim setup then to see what's going wrong PMunch: It only appears on file save though number_one: Hey, maybe a weird question, anybody have any ideas for removing terminal styling from lines in files? PMunch: number_one, this might help: https://github.com/PMunch/ansiparse PMunch: Simply parse it with that, then go through and only pick out the kind == String entries Prestige: PMunch: I seem to be getting autocompletion from nimlsp but nothing about diagnostics? Like if I declare let foo: string = 123, nothing shows. Is that expected? Prestige: I thought maybe the lsp wasn't working at all, but I am getting completion PMunch: Hmm, even when saving the file? Prestige: Yeah :/ Prestige: Idk if you have touched coc-nvim at all (it's what I'm using) but their docs for setting up for nimlsp seems really straightforward. Idk what I could be missing PMunch: Well, either nimlsp doesn't get the save message, or it fails to check your code for some reason, or your nimlsp plugin doesn't support diagnostics, or your editor doesn't show them properly. PMunch: Never even heard of it :P PMunch: You could try to compile nimlsp with debug logging and see if that shines some light on the situation Prestige: I have it working for a number of other languages, so maybe it isn't getting the save message Prestige: Hm okay I'll try that out next Prestige: only message I currently get from nimlsp is Hint: used config file '/home/redacted/.choosenim/toolchains/nim-1.2.0/config/nim.cfg' [Conf] PMunch: Yeah, that comes from the compiler Prestige: Looks like it is working https://0x0.st/iQ9A.txt number_one: PMunch, thanks, this looks super helpful! sealegs: This may be a dumb question, but is there a wsy to get unix time in milliseconds? sealegs: way* PMunch: sealegs epochTime()*1000? PMunch: Prestige, yeah so it's definitely sending didSave notifications Prestige: ah PMunch so a few lines down it says "versionSupport": false for publishDiagnostics Prestige: I think that has something to do with it Prestige: I'm not well versed with lsp though Prestige: found some details here https://microsoft.github.io/language-server-protocol/specification.html Prestige: hm so that seems to have nothing to do with it. Looking at the output from nimlsp, I get autocompletion options but nothing back regarding diagnostics PMunch: Nothing from any of these echos? https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L439 Prestige: Should all be here: https://0x0.st/iQ9A.txt Prestige: Seems odd that nothing is output regarding diagnostics. Gotta go for now but I'll be back at it tomorrow, thanks for looking into it PMunch sealegs: PMunch, I mean like milliseconds since 1-1-1970 PMunch: Yes sealegs: Oh wait nvm thx, I thought epochTime() was just like toUnix() lol. sealegs: My bad PMunch: It's kinda in the name `epoch` in this context refers to 1-1-1970 PMunch: Or rather, that is the specific epoch it refers to PMunch: There are systems that use different epochs sealegs: Interesting. kayabaNerve: Does Nim have shortcircuiting outside of and/or? PMunch: I encountered it a lot when working with satellite data, they are afraid of rollover if the satellite stays up for longer than expected. But they still want to save on bandwidth since the downlink is limited. So they come up with all sorts of weird time systems in order to avoid using 64-bit timestamps kayabaNerve: I assume it follows C and it's only applied to and/or, and only because it compiles down to &&/||. Just checking as I'm writing a macro that needs to detect short circuiting. Gary M: float queue_priorities[max_family_queues];memset(queue_priorities, 0, sizeof queue_priorities); Gary M: whoops Gary M: float queue_priorities[max_family_queues]; Gary M: memset(queue_priorities, 0, sizeof queue_priorities); Gary M: that's a pretty shitty piece of C code that I need to write similarly in Nim Araq: kayabaNerve: only 'and' and 'or' do that, other constructs rely on 'if' expressions Rika: let queue_priorities = newSeq[float](max_family_queues) Gary M: so I did var queuePriorities = newSeq[float](maxFamilyQueues), but the whole memset thing is throwing a wrench into the equation Rika: you dont need to memset it i dont think Araq: Nim does the memset for you, you don't have to write anything for it Gary M: oh Gary M: well cool then 🙂 Araq: zeroMem(addr(s[0]), sizeof(s[0]) * N) # would be the equivalent, but it's not required and harmful low level stuff Rika: and is redundant too Gary M: another question Gary M: how do I do additional conditions in a for loop in nim Rika: additional conditions? Gary M: like for(int i = 1; i < 4 && i < someMaxVariable; ++i) Rika: you just use a break inside the for narimiran: you use while loop Rika: for i in something: if i < someotherthing: break Rika: or that too Gary M: ok, thanks kayabaNerve: Araq: Thanks for the confirmation. Working on Result unwrapping and the lack of short circuiting will break a lot of my code. Need to make sure I don't rely on it some place I don't think I do. Rika: how do you debug npeg stuff? Rika: ah, theres a define PMunch: Yea.. Most macros have that, but it's a bit random what it's called :P PMunch: Even my own macros aren't consistent in what I call it.. PMunch: With expandMacro it might get better, but it currently doesn't expand if the macro has an error in it, which is mostly what I use my `echo result.repr` for.. Zevv: Rika: what do you need? Rika: never mind 😛 timotheecour: can anyone merge https://github.com/nim-lang/Nim/pull/13984 to un-break nim CI ? clyybber: Done : ) Zevv: Rika: ok, just ping me if you need a hand timotheecour: thanks @Clyybber ! Rika: your docs are really good though Zevv: Ah I thought it was the lack of users resulting in no support requests, but it's just the quality of the docs :) Zevv: I hope Rika: what do you mean lmao Recruit_main707: do we have an align prgma? Araq: yes we do Recruit_main707: yes, ive found it, thanks Araq liblq-dev: Zevv: are you familiar with the Lua C API? liblq-dev: 'cause I'm getting a "too many local variables" error for seemingly no reason Araq: krux02, Scala does not have 'emit: ' at all Araq: stop your nonsense krux02: Araq: scala does not need an emit Java code here, because you can just used Java classes directly. krux02: No need to emit anything. Araq: and the trollish behaviour Araq: likewise C++ has no #emit feature krux02: Scala classen and Java classes with seamless. krux02: This isn't possible for C and C++ because of the lack of modules. Araq: so what, it doesn't have an emit krux02: Maybe we might be able to do something smarter with c++ modules. Araq: the RFC and PR are about "fixing" emit, but there is nothing to fix with it, it works Araq: it's a sharp tool, no need to make it less sharp krux02: Araq: you are just in denial that there is a problem with emit. krux02: And that hurts the fixing process. krux02: That isn't helpful. Araq: ok so enlighten me Araq: where is the problem with emit? krux02: I don't need to. krux02: It is already written down by @timotheecour federico3: https://starchart.cc/nim-lang/nim.svg <-- heyy Araq: it says "what if I mistype TYPESECTION?" well so what, the C code then fails to compile, otherwise the section annotation wasn't reqired to begin with krux02: maybe it fails krux02: maybe it doesn't fail and just does the wrong thing. krux02: I don't want to prove it to you. Recruit_main707: federico3 wikipedia stats? krux02: It is your job to detect that here is a potential problem that should be addressed. federico3: Recruit_main707: github stars (FWIW) Recruit_main707: nice Recruit_main707: lets reach the thousand forks, 2 left! Araq: krux02, it's also my job not to feed trolls krux02: Who is the troll? Araq: you. krux02: Then why do you post such things like "Why do we need an even more powerful emit statement though? Why not let Nim be a real language that compiles via C or LLVM to binary code." in a conversation that tries to address detected problems with `emit`? krux02: That doesn't help the conversation at all. krux02: You are not offering a solution at all. You are just trollin the conversation with snark. Araq: features must be justified well krux02: If you do so, don't get offended if I reply to you. krux02: ok Araq: I like replies that don't imply "Araq is a fool, Nim is doomed" krux02: Then stop posting foolish stuff. krux02: Or comments that let me assume that you are in denial of problems leorize[m]: eventually we should move torwards not having `emit` at all Araq: I'm trying ;-) can you try the same please. Araq: and "you are in denial" is 100% troll speak, just fyi krux02: ok, then admit at least that `emit` isn't perfectly designed. krux02: yes emit is a hack. But a damn useful hack that solves real problems. Araq: emit is a hack, of course it's not perfectly designed dadada: stop guys, just stop, this bickering is incredibly sad to see Araq: it hardly was designed at all krux02: yes Recruit_main707: emit is useful, i asked Araq about this and he told me we could pass the emit code by a c/cpp compiler right? krux02: Me and timothee were just discussing on ideas on how `emit` could be converted from "a hack" into a nice language feature that would also work well with editors. leorize[m]: emit was a hack for the lack of proper interop fwiw leorize[m]: I think we should find ways to deprecate it, not making it easier to use Recruit_main707: imho emit is useful because its hacky leorize[m]: the reason why emit is ugly is because you're not supposed to use it Recruit_main707: it allows you to do some dirty things to avoid complex things krux02: please don't teach me about emit. Recruit_main707: (at least thats how i use it) krux02: I know what it is good for and when it should be avoided. Recruit_main707: i still dont get whats all of this for, redesigning emit? krux02: When there is a proper way to do it, always do the proper thing. The problem is, C++ is a very dirty language with preprocessor magic and weird syntax for compiler secific features that can best be accessed with `emit`. krux02: Recruit_main707: The problem is, we were just discussing emit and how to improve it. krux02: Because there are things that don't work well with it. leorize: I generally think that the syntax is fine, if that's what you wanna change krux02: here is the context: https://github.com/nim-lang/RFCs/issues/210 Araq: exactly, that's the *context* but there is no *motivation* and no *justification* krux02: whatever Araq: it simply says "I don't like triple quoted strings and I want indentation based strings" and then conflating it with .emit and its quirks krux02: It is a discussion. krux02: not a finished proposal Araq: it could start with a problem statement though. leorize: so apparantly the main bug that I can see here is that `backticks` captures in emit have unclear semantics krux02: There are multiple problems with emit. krux02: The backticks are one of them krux02: The magic comment like /*TYPESECTION*/ is also one of them. clyybber: I don't like the part of the proposal to put emit and asm out of the triple quoted string literals krux02: commants arn't supposed to have semantic. krux02: The last one is. I have a C code within Nim code. My editor can highlight C code nicely: Is there a reliable way to tell my editor to highlight a subset of my file as C instead of Nim? clyybber: Thats an editor problem leorize: yes, highlight a region that starts with `{.emit:\s+"""` and ends with `"""\.\?}` krux02: clyybber: that is means the language doesn't need to care about how hard it is for the editor to support it? clyybber: Yeah krux02: no krux02: I disagree. clyybber: And also its not hard leorize: well I just gave you how to highlight inline C code :P krux02: leorize, that would work Araq: how exactly are "indentation based string literals" easier for the editor support? Araq: and are we even talking about "indentation based string literals (via asm?)" or are we talking about emit Araq: this is all messed up, which is why I seek to close both the RFC and the PR fwiw Araq: but hey, I'm "in denial", so I re-opened it, have fun krux02: Araq: The problem with end tokens is, they might be ambiguous. A ) always closes the last opene (, An xml end tag for example is named, when you encounter it closes the opened krux02: that helps the editor a lot during the time when the text isn't fully written yet. leorize: I'd tell you that indentation-based literals make things harder to support, at least with vim krux02: incomplete stant end tokens often meke the editor rehighlight the entire file clyybber: Yeah, and it also opens a whole can of worms clyybber: Better to leave emit taking a string literal Araq: there is an existing RFC for indentation based string literals too krux02: leorize, yes thank you, this is the type of comments I am hoping for. krux02: If you say it is really hard to support in popular editors it is an argument to not use indentation based string literals. clyybber: So whats left is the enum for where we emit stuff krux02: In org-mode (emacs specific) there are code sections in other programming languages. Org mode fully supports syntax highlighting for these embedded code sections. But it does so by using very unambiguous start and end tokens. krux02: clyybber: No Recruit_main707: as a side note: if youd need C++ highlight for the code inside your emit, dont you think it would be more fitting to just have it in a separate cpp file, and wrap it in nim? krux02: clyybber: Just because an idea seems to be bad. It isn't rejected yet. And if it is rejected it doesn't mean the search for an alternative is over. leorize: I think it helps to present the problem and what you're trying to improve in a RFC krux02: Recruit_main707: depends krux02: not necessarily. leorize: currently all I see is "I don't like this, can we change?" krux02: That is like saying you never want embedded javascript in an html document. clyybber: And I really don't see whats wrong with having C code in a string literal clyybber: Whats the advantage of having it without """ Recruit_main707: but being that small, you should not need highlight then clyybber: Its really ugly IMO since it blurs the lines between nim code and C code. Just imagine what happens to preprocessor statements clyybber: Its a can of worms that need not be opened clyybber: Simply use string literals clyybber: And if you want to indent them write a helper and do """...""".unindent dadada: how about developing indention based markdown support for Nim, that get's converted to a string in compilation, and enable an extension for this markdown that supports embedding of code including a hint for the lang, that way this feature could be reused for anything and not only emit, and editors would simply have to understand how Nim designates a markdown section (by indentation) and to support markdown krux02: leorize, there has been a lot of aggrevation of timothee's RFC's issues and pull requests. Please don't take them too serious. This what was proposed here in this PR by him was something that I mentioned in a conversation might be a good idea, and he converted it into an RFC because that is all we have right now. But to be honest it is nothing more than a proto RFC. The verbosity of timothee's style of writing RFC's krux02: make it seem more than it actually it. krux02: s/it\.\>/is./ Araq: well I'm still waiting for an analysis of 'emit's problems krux02: tsizeof.nim Araq: so far I heard arguments against triple quoted strings which we have an RFC for already. krux02: the c_sizeof doesn't work top level because of the way `emit` works. krux02: The solution is "HERE" generation flag. clyybber: So can we cut the RFC down? Recruit_main707: dadada: from my complete ignorance, that seems utterly complicated and not useful krux02: clyybber: That is something that you have to figuer out with timothee. krux02: You can take the RFC over by making your own less verbose RFC that includes all the necessary information. krux02: But it really wears you down if you do it all the time. clyybber: @timotheecour Can you extract the emit("here") into a seperate RFC? leorize: you know that highlighting `emit` is not hard when even github can do it :p leorize: and they can't properly highlight `8'u8` literals dadada: Recruit_main707: since markdown has become kind of a standard, first class lang support for it seems quite support dadada: s/quite support/quite useful leorize: sorry, but it's still no justification for overcomplicating things clyybber: dadada: Sounds like you want macro DSL leorize: and iirc docgen supports an RST/markdown mix clyybber: This is about emit tho clyybber: A builting pragma Araq: btw .emit doesn't take a string literal. it takes a string literal or an array of string pieces to avoid the quoting hell krux02: Araq: yes and the array is ugly. Recruit_main707: a very good decision imo krux02: It makes the potential support for syntax highlighting in emit code sections completely impossible. Araq: krux02, ugly syntax for ugly semantics is a fair deal IMHO. leorize: krux02: the array just make it not possible when you're using it leorize: if you use the triple-quote syntax it's easy to highlight it Recruit_main707: and allows some nim syntax highlight leorize: case in point: github can even highlight `emit`, while they struggle with `'i32` suffixes leorize: I think the biggest issue with `emit` is how it lures the user into thinking that "the generated C code is ordered exactly like the Nim code" leorize: tsizeof demonstrates this problem: you have an emit block before a `type` block (in the middle of the file), thinking that they will be added in the same order mratsim: the array is ugly ... very ugly: https://github.com/mratsim/constantine/blob/master/constantine/primitives/extended_precision_64bit_uint128.nim#L32-L99 mratsim: interpolation would be much nicer (note this code is working by luck): https://github.com/numforge/laser/blob/master/benchmarks/transpose/transpose_bench.nim#L144-L167 mratsim: I could do a macro though that transform interpolation in correct emit code Recruit_main707: thats a good idea Araq: mratsim: and why is that a problem? why is the real problem not identified as "Nim should support C's int128 type"? Araq: and why is tsizeof relevant for anything? it's a test testing nasty stuff, it's not representative for anything. mratsim: the array being ugly makes it harder to write correct code mratsim: it's easy to miss a parenthesis in the forest of quote and commas for example krux02: leorize, for editors it is good if there is an unambiguous regular expression to detect the beginning and the end. tripple quotes alone are ambiguous. Including the full pragma though could work. Clyybber: triple quotes are not ambiguous.. leorize: krux02: they are not ambiguous... leorize: I wrote editor plugins, I know Araq: and indentation based literals have no regex to begin with. krux02: tripple quots can be any tripple quotes, how should the editor know that this string should be C code? krux02: It needs context. Clyybber: So look at the emit leorize: krux02: I gave you the regex needed earlier krux02: I know I kno krux02: I also reference that Araq: template ccode(x: untyped): untyped = x Araq: .emit: ccode"""works""" krux02: Araq: yes that works leorize: if markdown's inline code can be highlighted by editors, I see no problem in highlighting emit krux02: I don't think tripple quotes within C code is a thing. leorize: you need a more convincing case krux02: And we don't support emitting python code. mratsim: VScode properly highlight the emit code, unless "lo" appears mratsim: not sure why krux02: lo? mratsim: yes lo mratsim: you can check with this file: https://github.com/mratsim/constantine/blob/master/constantine/primitives/extended_precision_64bit_uint128.nim#L32-L99 cs this one https://github.com/numforge/laser/blob/master/benchmarks/transpose/transpose_bench.nim#L144-L167 mratsim: vs* Araq: VSCode's syntax highlighting is just broken in all sort of ways krux02: mratsim: do you have a screenshot? I don't have vscode installed right now. leorize: file a bug I guess, though I don't maintain that plugin :P Araq: leorize, I gave up on it krux02: I maintain emacs syntax highlighting. That doesn't mean I have a solution for everything though. Araq: it doesn't even understand Nim's keywords properly krux02: The process to fix nim syntax highlighting in emacs was to remove most of it. mratsim: mratsim: https://cdn.discordapp.com/attachments/371759389889003532/699974199934189568/2020-04-15_15-27.png Araq: ^ I can imagine the same is true for VSCode's highlighter mratsim: or it's the emit array that is broken leorize: yea the vscode highlighter is broken Araq: mratsim: how did you manage to use the same color for 'proc' and 'for'? leorize: I know how to highlight that in vim, and I'll add that in just to prove the point :P mratsim: afaik it's the C code highlighter mratsim: or not mratsim: just the color scheme alehander92: krux02 that indented other code idea seems interesting alehander92: but kinda radical krux02: alehander92: The thing about that is, if the editor can support indeted blocks of foreign code. It is impossible to mess it up. krux02: The editor won't accidentally make half of the file C code. leorize: usually editors try not to care about indentation rules when highlighting krux02: leorize, that is the problem Araq: 5 minutes ago you argued for regex based highlighting though krux02: I am just explaining my reasoning behind the indentation besed idea. krux02: currently they are both ideas. krux02: I did not fully reject any of them. alehander92: ok but how many editors can do it alehander92: i'd guess markdown support is the closest thing alehander92: if most ide-s support markdown with random code in sections krux02: mratsim: thanks a lot for the screenshot. I had no idea on its support for C syntax highlighting in Nim code. alehander92: this might be achievable alehander92: but i find something else bad krux02: alehander92: you mean gihub markdown? alehander92: if you have long C/JavaScript snippets alehander92: yes, sorry krux02: ```nim <--- not standard markdown alehander92: so if you have those, you can open nim files and just look at a lot of random otherlanguage highlighted code alehander92: and this is somehow confusing companion_cube: Araq: fwiw, vscode will move to tree-sitter, I think? which is more powerful than regexes alehander92: like, e.g. rst/github markdown: one expects alehander92: that alehander92: i can think mostly of html/php as other examples of this style krux02: mratsim: this `lo` in code that breaks everything doen't make sense at all for me. krux02: alehander92: yes krux02: also html/javascript krux02: or JSP mratsim: @krux02, I think it aws the "{.emit:[" syntax mratsim: lo just happened to be at the beginning when I noticed highlight breakage mratsim: I think it's* nc-x: well, vscode just stabilized semantic highlighting a few days ago. And I think nimsuggest already provides that output (leorize's nvim.nim uses it for semantic highlighting IIRC) krux02: since you actually use the `emit` statement your opinion on this idea we just discussed might be important: https://github.com/nim-lang/RFCs/issues/210 nc-x: so somebody just needs to add support in the vscode nim plugin krux02: but don't participate in anying emotianl stuff. mratsim: @Araq, regarding int128 support in Nim, it's a good idea but I think providing MSVC API is probably easier to support on most platform: https://github.com/mratsim/constantine/blob/master/constantine/primitives/extended_precision_x86_64_msvc.nim#L24-L31 krux02: Only in ideas, becauese it is just an idea, nothing more. zacharycarter: I have a app built with --gc:arc that is loading a shared library and calling a function in it via the dynlib module Araq: and here is the other, older RFC https://github.com/nim-lang/RFCs/issues/161 krux02: mratsim: Are you talking about `int128` as a builtin type that is just supported, or are you talking about the internal `int128`? zacharycarter: It's being passed a ref object and I'm assigning a value to a field defined in the object zacharycarter: I'm then creating another object and passing that to some C code, and I'm copying that field's value into another field in this new object zacharycarter: my program hangs when the c code tries to dereference the cstring for value assignment zacharycarter: because of an EXC_BAD_ACCESS krux02: zacharycarter, my recommendation: debug it. krux02: but build without line information, just with debug information. alehander92: guys zacharycarter: okay krux02: Then you debug the generated C code, that allows you to spot incorrect code generation.. alehander92: sorry for offtopic alehander92: especially krux02 as you are good with debug/codegen alehander92: how should i generate lineinfo-s for generated nodes alehander92: with copyLineInfo or with other more idiomatic way? krux02: alehander92: currently you can't set the line information for generated nodes. krux02: you can set the line information of other already existing nodes though. mratsim: @krux02 we were talking about the runtime int128, not the one in the compiler krux02: yes copyLineInfo is the only option right now krux02: mratsim: ok krux02: but as soon as runtime `int128` is supported as a builtin type the internal integer must be lifted to int256, or at least `int129` (if that is even a thing) to reintroduce all the problems the compiler had before the internal `int128` was introduced. alehander92: krux02 sorry, that's what i mean alehander92: e.g. if i generate a procedure, and i copyLineInfo to the symbol node of its name / the node of the iterator itself, this should work for linedir mratsim: it doesn't need to be a builtin type and there is no need to allow compile-time computation on it mratsim: for starter, just allowing additoon/substraction/negate/multiplication/division/shifts is good mratsim: and to be cross-OS, you probably need an umul128 and udiv128 mratsim: and otherwise if we want to allow compile-time compilation of those, it probably makes more sense to have a generic fixed precision library in the compiler like LLVM APInt Araq: that's all true, I hesitate to do that because of the Nim VM Araq: a VM that uses bigints for a language that otherwise uses machine integers is a recipe for inconsistencies. though extensive testing helps. mratsim: If you want the same representation as what an "wide-integer" would be in an underlying platform, it's just a "when cpuEndian == bigEndian" switch away Araq: it's also diverse bitmask operations away mratsim: besides Stint which only operates on power of 2, in constantine I also have my own VM compatible bigint library and it can operate on weird sizes like BigInt[17] or BigInt[381] sealmove: how to make this work? https://play.nim-lang.org/#ix=2i9x shashlick: Araq: for types which are importc shashlick: ```Error: cannot evaluate 'sizeof' because its type is not defined completely``` shashlick: but the entire object is defined shashlick: https://play.nim-lang.org/#ix=2i9A mratsim: int64/float64 should work mratsim: your types are target dependent shashlick: I tried 64 and get the same error shashlick: basically, i'm trying to add a feature to nimterop to check that the types it generates matches the sizes of the actual C type mratsim: this worked for me: https://github.com/nim-lang/Nim/issues/7675#issuecomment-383405960 shashlick: but not able to get the size, and even emit is not working as expected mratsim: see the int128 code with dummy uint64 fields mratsim: the fields were added for sizeof shashlick: hmm, cannot do that when generating types from C headers shashlick: my other option is to use emit and do the check during runtime - it is purely for test purposes but am wondering how to check sizeof(Ctype) == sizeof(Nimtype) if they have the same name alehander92: Araq alehander92: i am not good at the vm thing alehander92: how are hints printed alehander92: e.g. i do echo stuff; symbol.copyLineInfo(code); echo stuff alehander92: and i print stuff from vmgen when copyLineInfo is invoked alehander92: and this print seems to happen way before the stuff thing alehander92: i guess the vm executes all the opcodes and .. somehow flushes the echo after finished? alehander92: ah i need to add `static:` , still wonder why are those printed at all otherwise faulander: since today i get an indentation error on line 14 when compiling. same code, copied/pasted works in nim playground. i even tried putting comments in line 1-20 and i still get the same error. any clues? alehander92: can you link the code faulander: it works in playground faulander: https://play.nim-lang.org/#ix=2ial faulander: compiler tells me its on line 14, i even deleted the first two lines, so the line which was before 14 is now 12. i still get the exact same error faulander: i think its in the proc hash*s last line alehander92: are you .. sure alehander92: you are not compiling the wrong file alehander92: this happens from time to time alehander92: to me alehander92: and it's always very confusing alehander92: it really sounds like this kind of thing faulander: aaaaaaaaaaaaaaaaaaaaaah faulander: i am soooooo sorry, i am such a total newb faulander: this did cost me an hour now! grrrrrrrr faulander: thanks alex, thanks so much! :* Rika: lmao alehander92: @faulander no problem it happens a lot to me as well faulander: at least i can make you laugh :) alehander92: especially when you maintain several versions of the same code/project alehander92: one possible hint i can think of is somehow the compiler hinting a warning "no changes to source since last compilation with the same flags" alehander92: which would be great in detecting stuff like that alehander92: but it's very niche and probably too expensive for big projects , maybe a more general solution can be integrated in build systems which already track files alehander92: faulander laughing can be quite helpful :P Rika: i dont think its too expensive, given that nim already doesnt recompile if no change has happened Rika: its probably just a matter of adding some print statement shashlick: ping leorize alehander92: not if you run `nim c` alehander92: it detects that only for the c files alehander92: which are organized in nimcache alehander92: at least thats what i guess? faulander: i have now made a task file in visual studio code, which automatically compiles the open file. faulander: if someone wants it --> https://play.nim-lang.org/#ix=2iaD faulander: must be in folder .vscode in tasks.json Rika: big brain uses playground for nonnim code/data Recruit_main707: bold statement faulander: very nice Rika faulander: big brain Rika doesn't recognize that big brain faulander is making newbie mistake ... faulander: +s faulander: (a lot of them) Rika: i aint yo personal code proofer faulander: did i ask something directly from you may i ask? Rika: nah Rika: why faulander: because you state that "i am not your personal code proofer" and i never asked you to be. Rika: `big brain Rika doesn't recognize that big brain faulander is making newbie mistake` shashlick: chill guys Rika: this implies that i should have recognized it Rika: i thought you jokin faulander: well, that was a reply to your nice comment Rika: i aint serious Rika: lmao okay Yardanico: @faulander if you have nim extension installed in vscode you can just hit F6 to compile and run currently opened nim file Yardanico: no need to create tasks manually shashlick: is it possible to hide certain procs from doc output shashlick: they still need to exist, cannot just use when not defined(nimdoc) shashlick: alternatively, is it possible to have the export marker as a variable that can be on and off without having to duplicate the entire proc line Skaruts: man... this is a bit of a trap in templates: https://play.nim-lang.org/#ix=2ibq Varriount: Skarut's: True... but the only good way for the compiler to show that would be to show the "expanded" template. Varriount: That's also why it's good policy not to re-use identifiers anywhere in a template, if you can help it. Yardanico: yeah, because then you can get all sorts of interesting bugs because your code will be run twice instead of being run once :P Skaruts: I fell for this a few times :S zacharycarter: question - I'm allocating a string inside of a shared library I'm loading with the dynlib module's `loadLib` proc zacharycarter: I pass in a var object to this proc and assign a string to one of its fields zacharycarter: back in the host program I then assign this field's value to another field in another object, and then I unload the library zacharycarter: It seems like the string gets collected though when I unload the library - which makes sense zacharycarter: can I allocate a new string and copy the value from the old string? zacharycarter: or should I use GC_ref or something Yardanico: well I know there's deepCopy in default GC but I'm not sure if it's what you need really Yardanico: I'm not experienced with memory management really zacharycarter: I'm using --gc:arc Yardanico: oh zacharycarter: in both the host program and the shared lib zacharycarter: GC_ref seems to work zacharycarter: oh cool - I don't even need to rely on GC_ref I can just do `let foo = $foobar` Skaruts: another trap, but this one's on me: https://play.nim-lang.org/#ix=2ibI 😄 Yardanico: playground shows a different error though Skaruts: gotta remember not to put that discard there because I always forget it's there when I add the block of code... Yardanico: /usercode/in.nim(15, 8) Error: expression 'echo ["template fooing!"]' has no type (or is ambiguous) Skaruts: yup that's the error I get Skaruts: remove the discard and it's all fine Skaruts: oh I forgot to take the previous error comments Skaruts: disregard those Rika: The discard immediately ends the block so technically the echo fooing is an invalid indentation error, isn't it? Rika: But I think what nim interprets it as is that the discard statement is discarding the echo Yardanico: let's check with a macro Rika: Since echo is void, it spits the no type error Skaruts: oh, yea that's probably what it's doing, @Rika Yardanico: @Rika's right Yardanico: https://play.nim-lang.org/#ix=2ibN Yardanico: gives Yardanico: (Arglist (StmtList (DiscardStmt (Command (Ident "echo") (StrLit "template fooing!"))))) (changed to lispRepr so it's 1 line) Yardanico: so it discards an echo call Skaruts: heh, knowing that would've saved me 10 minutes figuring it out moerm: Hello everyone Yardanico: i'm still really confused about that though @Skaruts Skaruts: about what? Yardanico: about the error Yardanico: and why it happens Skaruts: seems to me you're both right, it's pretty much interpreting as a statement `discard echo "template fooing!"` Skaruts: https://play.nim-lang.org/#ix=2ibU Yardanico: basically yeah https://play.nim-lang.org/#ix=2ibV Rika: It really should give an indentation error instead though Yardanico: yes Yardanico: well discard is quite special leorize: shashlick: you pinged me? shashlick: ya had a question around the enum implementation in nimterop shashlick: distinct int ends up in wrong size in nested structs so had to change it to distinct cint shashlick: will be ideal if you could join the nimterop gitter room shashlick: was thinking of https://play.nim-lang.org/#ix=2iaK as the new implementation but then A or B won't work as proc params since they get converted into int leorize: wait you implemented them as distinct int? shouldn't they be distinct cint? shashlick: yes have changed it now shashlick: https://github.com/nimterop/nimterop/blob/nested/nimterop/types.nim shashlick: have nested struct support now in nimterop Prestige: Looks like nimpretty isn't respecting --maxLineLen, anyone else seeing that? shashlick: does it make any sense to wrap static inline functions? leorize: usually you translate the function into nim :P leorize: btw what's the gitter room? Yardanico: nim-lang/nim leorize: I mean for nimterop :P shashlick: https://gitter.im/nimterop/Lobby shashlick: folks can ask their questions around nimterp Recruit_main707: aka: i fill the chat with questions :P shashlick: once compiled, those inline functions don't really exist right? they aren't callable? Recruit_main707: depends on the compiler i think, i guess if you call them they wont be inlined leorize: shashlick: usually they are fully inlined Skaruts: is there a way to prevent the docs from going in dark mode all the time? Prestige: Does anyone know what "nimcheck" is? Yardanico: "nim check" checks if your program is correct Nim code :) Yardanico: and if it's not, it'll show what errors you have Prestige: ah thank you Yardanico: basically it has the same behaviour as the compiler but without the code generation step Yardanico: you can also supply it with the same arguments as the Nim compiler like "nim check --threads:on" Prestige: still debugging why nimlsp diagnostics aren't working with my lsp client, but ALE was. It was getting error info from nim check, rather than nimlsp Yardanico: "nim check" is mostly used for IDEs/editors to highlight errors in your code right in the editor, but of course it can be used stand-alone too Yardanico: the most complete nim extension is IMO the VSCode one, it has stuff like error highlighting, F6 to compile & run current file, nimsuggest integration, nimpretty integration Prestige: PMunch: are you sure diagnostics are being reported from nimlsp itself via the protocol? kodkuce: lol i using vscode whole time only like a month used neovim and i dident know F6 is compile and run Prestige: I compiled nimlsp from source and copied nimsuggest into src/nimlsppkg/ then edited a file, here's the output PMunch https://0x0.st/iQJe.txt Prestige: The very last line is "Trying to read frame" I wonder if something failed? Yardanico: wow git bisect is impressive Yardanico: I never used it but just found the first broken commit for https://github.com/nim-lang/Nim/issues/13935 in a few minutes Yardanico: and it's easy to use too, just "git bisect start", "git bisect bad # current is bad", "git bisect good , )`? awr1: one seq containing the whole strin awr1: g leorize[m]: depends on who you ask awr1: *seq with one element containing just the original string Varriount: Python and Java at least appear to raise an exception. Go splits the string into UTF-8 runes. I don't know what C# does. leorize[m]: either that ^ or seq containing every character (this is a pcre thing) leorize[m]: iirc we actually have an issue debating this Varriount: Do you interpret `''` as "containing no matching separators", or "matching between every character"? leorize: I interpret it as the former Varriount: I somewhat favor the idea of raising an exception, because it's clearly ambiguous enough to cause discussions. leorize[m]: you can PR it and we can discuss there Prestige: Hm I think I agree with leorize[m] here Varriount: leorize: It would break backwards compatibility, so I won't propose it. leorize[m]: with the `--useVersion` thing it's not too bad anymore leorize[m]: though you should fix the infinite loop problem shashlick: awr1: just pushed a fix for nimterop#172 zetashift: Anybody got some tips for me making this type definition less shitty: https://play.nim-lang.org/#ix=2hWT ? ftsf: hi, has anyone got an example of how to use htmlgen in a more complete way? the examples in https://nim-lang.org/docs/htmlgen.html are super minimal. zetashift: like the docs says aren't you better off using Karax then, it has more examples too? ftsf: "Note: The Karax project (nimble install karax) has a better way to achieve the same, see https://github.com/pragmagic/karax/blob/master/tests/nativehtmlgen.nim for an example. ftsf: " hmm seems to suggest it's a better way of importing some things, not how to use. I'm not sure what karax is, but if it obsoletes htmlgen it should probably say that. ftsf: seems like karax is a lot bigger than htmlgen zetashift: @ftsf : https://forum.nim-lang.org/t/5851 see araq's response zetashift: oh fuck I hope I didn't ping him ftsf: zetashift, thanks zetashift: yea karax is bigger but I don't think it'll hurt if you only focus on the htmlgen part zetashift: I don't know htmlgen so I'd still wait for a second opinion on using htmlgen ftsf: ok, htmlgen seems more what i'm looking for, but i'm not really sure how to get started with it other than the examples given where it's pretty much a single tag in isolatin, zetashift: I can't find the test suite for htmlgen Gary M: I'm pulling my hair out trying to figure out a way to interface with a large C++ library, or at least with a C API. Gary M: and trying to do so with a dynamic linked library zetashift: Who knew comparing floats would be this troublesome Rika: are you trying to == them? zetashift: yep zetashift: ` (4, [20.0, 22.0, 50.0, 48.0, 44.0, 54.0, 114.0, 108.0, 40.0, 58.0, 110.0, 102.0, ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ 0, 108.0, 40.0, 58.0, 110.0, 102.0, 16.0, 26.0, 46.0, 42.0]) ` [https://gitter.im/nim-lang/Nim?at=5e952461c52b6a38abe4412d] zetashift: that errors out for me, but I have a separate test for equality ( == ) that runs fine Rika: never do == for floats, you ofc need a ~= operator Rika: well i assume you already do zetashift: I mean I have an operator `==` defined that calls a proc named `equal(a, b: float): bool` zetashift: I don't know if that counts I can rename ~= leorize: @Gary M unless it's Qt, I'd say it's not too hard zetashift: man it wasn't the floats I'm multiplying this array like an idiot zacharycarter: Gary M: as leorize said - shouldn't be that difficult. What are you pulling your hair out over? Gary M: https://github.com/DiligentGraphics/DiligentEngine Gary M: This is what I've been looking at. Gary M: I've tried using c2nim and nimterop and nimline but I'm misunderstanding how any of this is done. Gary M: I'd be happy with doing this manually, but even linking to a dll isn't working Gary M: I just have zero idea of what the proper workflow is for any of this and documentation/guides are very few and far between or outdated. shashlick: That's a big repo, what specifically do you want to use Gary M: https://github.com/DiligentGraphics/DiligentCore/blob/4c73f2d3fd5305b82d3413ebeab74cc566b57f33/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h Gary M: here's the Vulkan interface Gary M: so there's part of the C interface exposed under DILIGENT_C_INTERFACE Gary M: but it seems like there's a fair number of things I'd have to wrap just to reproduce one of the samples in the samples repo shashlick: Nimterop might be able to pull it off, have to bed though Gary M: I did try nimterop but got an error for a missing bash executable shashlick: You can nimble install nimterop and then use toast to wrap it - command line is documented online Gary M: I have bash with git but it's not seeing that shashlick: You on windows? Gary M: yes shashlick: If project supports cmake, just install cmake instead shashlick: Else make sure git bash is in the path shashlick: Git ships with bash.exe Gary M: Yeah, I made sure it's in the path. It's just not seeing it. shashlick: findExe needs to find it Gary M: the path to Git\bin is in my User Path Prestige: Is there a standard way to document procs? Zevv: Use double ## after the proc opening Prestige: But the rest doesn't really matter? Prestige: Also, same question for wrappers Zevv: for the rest there's no formal rules. There's nothing like javadoc with explicit description of all arguments, for example Zevv: but it all depends on your context. Nim stdlib encourages runnableExample blocks in the docs, for example Prestige: I'm mostly looking at documenting the x11 wrapper Zevv: For pure wrappers often it does not make too much sense to document everything at the proc level, since these are just FFI calls into the originals. It might make sense to just point to the original docs instead. Zevv: if I want to call XChangeDeviceKeyMapping from nim x11, I can jus lookup the XChangeDeviceKeyMapping man page, right Prestige: I'm just used to having docs in the editor so I was going to copy the docs over and maybe rename the parameters Zevv: The X11 API is *huge* Prestige: ah I didn't know there were man pages, that's handy Zevv: sure, for X11 the man pages are the go-to docs Zevv: and my editor knows about that. I can just hit a key when the cursor is over a function and it finds the man page for me jfilby: I have a problem with nimble terminating with a SIGILL on Mac: https://github.com/nim-lang/nimble/issues/792 jfilby: can anyone advise what to do? it looks like it dies on trying to call an OpenSSL function leorize[m]: you need to replace your openssl, maybe jfilby: I have openssl 1.1 which was installed by brew jfilby: so I can look into it, but it should work Prestige: Found the proc for bitor, but is there a way to do this to many values (built in)? Prestige: Like if I wanted to or 3 ints, would I just have to invoke bitor multiple times? Araq_: a or b or c Prestige: ah didn't know about `or`, thanks Araq_: 'bitor' is the future though :-) and should have/get varargs support Prestige: very neat - I'm really liking this language, have a lot to learn awr1: wasn't aware `bitor` got added jfilby: fixed my issue... had to specify OpenSSL v1.1 when compiling nimble Prestige: Can you use logic/code blocks to define a variable at run time? e.g. if you had an array of ints you wanted to add together and assign to a variable Prestige: Oh you can use a block to do it, that's so cool alehander92: morning. alehander92: how are you guuyys alehander92: ftsf karax can be used to generate it alehander92: using `$` on a vnode alehander92: e.g. something like `$(buildHtml(tdiv()))` alehander92: i guess? PMunch: Prestige, some more fun with using code in assignments: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html Prestige: Thanks :) Prestige: I'm looking for a blog post I was reading yesterday, I think about macros.. being able to use something -> "foo" Prestige: Can't remember where I saw it PMunch: something -> "foo"? Prestige: Yeah, maybe I'll run into it later. Was calling a proc to perform something with "foo" as a param PMunch: Like this? https://play.nim-lang.org/#ix=2hY8 narimiran: https://nim-lang.github.io/Nim/sugar.html#->.m%2Cuntyped%2Cuntyped ? Prestige: Yeah, exactly PMunch: Oooh, that syntax :P PMunch: That's to define a proc return type alehander92: nicee PMunch: And => can be used to create anonymous procedures alehander92: hm, can one pass iterators actually PMunch: Huh? alehander92: like, to a function PMunch: You can pass closure iterators alehander92: e.g. `toList[T, U](a: iterator[T]: U)` alehander92: `iterator(t: T): U` probably alehander92: hm, makes sense alehander92: maybe if `toList` was a template it would make sense to pass inline ones PMunch: As in, you can do this: https://play.nim-lang.org/#ix=2hYa PMunch: I mean, this also works: https://play.nim-lang.org/#ix=2hYb PMunch: Nim automatically creates closure iterators in that scenario PMunch: (This is how async is implemented by the way) Prestige: Interesting, the example of closure iterators I saw was an iterator that returned another - but just using the closure pragma does that for you? PMunch: Yes Prestige: Dang that's cool PMunch: Wait, an iterator that returned an iterator? PMunch: You can make a procedure that returns an iterator to create a closure iterator Prestige: Ah maybe that was what I saw Prestige: I'll have to dig through the tutorial again PMunch: (just by the same logic that the inline iterator I used there is automatically converted to a closure iterator an iterator created within a procedure will also be a closure iterator) alehander92: huhh alehander92: interesting alehander92: so there is a `finished()` function ! PMunch: Yes, it checks if closure iterators are done PMunch: Calling the iterator after that will just return the last value alehander92: ah so yeah it turns it to it alehander92: have you used channels btw alehander92: i wonder about one debugging feature for things like them in my job alehander92: and wondered how do people usually use them PMunch: Yes I have ftsf: will give a karax a try =) PMunch: What do you mean how people usually use them? alehander92: do people always do `send` `recv` `send` alehander92: or do they like batch many things with several `sends` alehander92: i am not entirely sure how are they idiomatically used PMunch: Depends on your usage mytxd: @alehander92 you mean network programming? alehander92: and do people usually know `X channel sends from this line in the code and receives on this line of the code` or do they often get selected/received in many locations (similar to calls) alehander92: @mytxd more like language-level channel primitives alehander92: e.g. something like nim / go channels PMunch: Well it really depends on what you use them for mytxd: @alehander92 I get it mytxd: @alehander92 you can impl it by yourself alehander92: yeah but i dont want to alehander92: i don't need them in my code PMunch: If you're doing a producer/consumer pattern where some threads create work and others perform it I would say it's fairly normal to have a single place in either thread where you recv/send alehander92: (maybe) alehander92: ok, great alehander92: (actually i maybe use some, but not the reason for my question :)) alehander92: and how do people synchronize stuff without "awaiting" PMunch: Another is of course something like a tree traversal thing where all workers can create more work, then it might be multiple paths to `send` but typically only one `recv` at the start PMunch: What do you mean? Channels are used with threads, so you don't have await.. alehander92: ok, so alehander92: yeah, you just wait and let the `os` schedule everything PMunch: Pretty much alehander92: and with fibers alehander92: you just wait for your own language runtime to do so PMunch: Yeah Araq_: PMunch, if you think it helps nimlsp, we can add it to Nim like we integrate Z3 PMunch: Sure, as long as I can still push to it Zevv: leorize[m]: Yeah, sorry. I think I asked this before but not sure: would it be possbile to '*' and '#' to the next occurence of an identifier, properly handling style-insensitiveness? Zevv: I find I use that a lot, but when navigating code that is not strict that misses occurences PMunch: By the way alehander92, fibers/coroutines cooperatively scheduled like async alehander92: yes indeed alehander92: so how do people synchrronize fibers? PMunch: Pretty much the same way you do with async alehander92: so you can "wait" for them? alehander92: that's what tips me off PMunch: Yes PMunch: See for example Go's WaitGroup PMunch: That allows you to wait for multiple goroutines to finish PMunch: Hmm, would be nice to have something like Go's select in Nim dom96: definitely, someone "just" needs to implement it :) PMunch: Haha Yardanico: is it better to use `.add` or `&=` when adding stuff to a string variable? Yardanico: I almost always used &= but maybe that's wrong 🤔 dom96: .add Yardanico: I guess because &= will create a new string and concat two of my strings, and .add will add a string to an existing one so less allocations? dom96: no, both are the same dom96: it's just that .add has been around for longer and so I consider it more idiomatic Yardanico: ah ok alehander92: and its more "generic" alehander92: as you use `add` for e.g. seq Yardanico: time to replace &= with .add in all code I have :P PMunch: dom96, got any better way of doing it than this? http://ix.io/2hYA Araq: &= is more flexible as it also supports files and sockets too iirc dom96: lol, I remember arguing against allowing that, and I still hold that view zedeus: maybe a silly rule but personally I use &= for strings and .add for seqs, feels natural to me dom96: PMunch, hrm, not sure Yardanico: never knew there's &= for sockets :D dom96: just use `send` please PMunch: So it would look something like this: https://play.nim-lang.org/#ix=2hYG PMunch: zedeus, I follow the same "rule" PMunch: dom96, that link was for you PMunch: I'm not too stoked about having the completed sequence, but deleting things from a sequence is tricky.. PMunch: I guess I could have a set of indexes for the completed futures.. liblq-dev: dom96: agreed, operators look weird liblq-dev: for IO awr1: I prefer `&=` alehander92: you just reassign alehander92: futures to futures[1..^1] should be quick and safe imo alehander92: ah nvm sorry alehander92: i didnt see you delete those on each cycle anyway awr1: idk how to put it but denoting such a common operation with an operator sigil helps for readability PMunch: There dom96, I like this solution better: https://play.nim-lang.org/#ix=2hYP PMunch: Although it will go through all the futures even though they are completed.. liblq-dev: holy moly liblq-dev: Welcome to Matrix™, I guess dom96: PMunch, shouldn't this `select` work inside async procs not outside them? dom96: liblq-dev, why I don't use matrix :P PMunch: Hmm, I guess.. liblq-dev: dom96: I stopped using matrix because of its horribly high latency (at least on the official homeserver) liblq-dev: IRC feels sooooo snappy PMunch: What I'm doing should be called something like waitSelect Yardanico: liblq-dev: well matrix bridge on freenode is written in nodejs :P Clyybber: @timotheecour Damn good job on https://github.com/nim-lang/Nim/pull/13976 ! Yardanico: https://github.com/matrix-org/matrix-appservice-irc liblq-dev: Yardanico: that's why it's so horrible. Clyybber: I wanted to fix that bug too, but I was under the assumption that sigmatch relies on this mutation to work liblq-dev: rewrite it in Nim, problem's gone. Clyybber: Good to see thats not actually the case alehander92: PMunch love it alehander92: can i use something like this example to test my async stepping Clyybber: @timotheecour It should fix https://github.com/nim-lang/Nim/issues/12713 too afaict PMunch: alehander92, yeah, that's what I wanted it for :P PMunch: Hmm.. PMunch: Can I inject a block label? PMunch: I want to be able to break out of the select statement before all the futures complete alehander92: hm, are you modelling it after the go select: i also looked at go/crystal goroutine/fibers alehander92: thanks for the explanations PMunch PMunch: Kinda PMunch: The go select has a case statement kind of syntax PMunch: Hmm, I guess I should do that instead.. alehander92: but do you need to do `of fut1:` PMunch: Yeah that would be how it would work alehander92: how would you make it fast PMunch: What do you mean? PMunch: Hmm, can't you make a template that uses await? Yardanico: PMunch: you mean with current async implementation? PMunch: Yes Yardanico: https://github.com/nim-lang/Nim/pull/12085 kodkuce: am i retarded cuz i cant get simple sort to work kodkuce: https://play.nim-lang.org/#ix=2hZ3 Yardanico: @kodkuce .sort is in-place Yardanico: it modified the original variable and doesn't return anything PMunch: Ah.. kodkuce: oh Yardanico: if you want it to return instead, use "sorted" instead PMunch: I really dislike the pattern of rewriting idents in a macro.. Good that async will (hopefully) get this fix soon. kodkuce: yep that kinda solved it, tought error "ambiguous" i was thinking i am pasing wrong args whole time Yardanico: well it says "no type" Yardanico: so you're trying to assign something which has no type (because sort procedure doesn't return anything) to a variable Yardanico: also it helps when you know a lot of stdlib :P PMunch: Hmm, why do callbacks to async procedures need to be gcsafe? alehander92: PMunch yes, i can fix this tomorrow alehander92: i am using a version of it from a long time in our codebase alehander92: good thing is one can add "no waitFor in async" after that alehander92: maybe PMunch: dom96, not quite as pretty, but was it something like this you had in mind? https://play.nim-lang.org/#ix=2hZe dom96: I suppose PMunch: alehander92, why would you disallow that? dom96: tbh I don't really see what I would use `select` for :) Yardanico: I wonder if we'll be able to use threads GC'd memory with async with --gc:ard Yardanico: *arc PMunch: Read multiple files and start processing them as soon as any of them are read? Yardanico: I mean using global GC variables with threads and async or something like that with arc PMunch: I guess adding callbacks to them would work as well PMunch: But eh.. PMunch: It's a bit annoying that `of` can't be used without a case. Would be cool for macros alehander92: PMunch because .. its a bad idea? alehander92: async shouldn't block alehander92: https://github.com/nim-lang/Nim/issues/11911 PMunch: Well, just because it's a bad idea doesn't mean it doesn't have some use-case.. PMunch: A warning sure, but just making it an error seems a bit too much alehander92: i think we argued about that before :P but i might misremember PMunch: Haha, yes this does ring a bell alehander92: also https://forum.nim-lang.org/t/3920 alehander92: i dont know, people ignore warnings easily alehander92: they have their place, but sometimes i enjoy go's idea of "no warnings only errors" alehander92: i'd say an error for waitFor and if really needed an escape hatch which always produces a warning might be nice PMunch: Yeah that would be fine PMunch: I just feel like if it isn't something that would break anything it should be possible to do alehander92: it breaks a basic assumption of how async is used PMunch: Well yes, but it doesn't break the code alehander92: but it can break code alehander92: it can lead to hard to diagnose weird behaviors PMunch: Oh, for sure PMunch: But it won't cause asyncdispatch to crash for example Rika: You can say that for many things can't you alehander92: iirc i had some of those problems exactly because i thought waitFor is a good workaround PMunch: Maybe my use-case requires some weird behaviour alehander92: and finally i managed to use await: it took some pain, but i am happy about it now alehander92: do you have a usecase where you can only use waitFor ? very interested in any such case PMunch: Can't think of anything off the top of my head alehander92: i have to admit i cant think of an obvious example of waitFor breaking code alehander92: but i'll try these days :PO alehander92: breaking expectations maybe8 dom96: alehander92: agree with you 100% dom96: we need to disallow waitFor in async contexts Yardanico: wait why people use waitFor in async anyway? stefantalpalaru: To run the event loop until a certain future is finished: https://github.com/nim-lang/Nim/blob/1e3bdf04d8db35f4ec6c697f0bb812d9903d1368/lib/pure/asyncdispatch.nim#L1883 dom96: Sure, but why would you want to run the event loop from inside the event loop? faulander: howdy ho guys. anybody know what a benc list is? From an RPC Documents: qa JSON array is equivalent to a benc list, a JSON object is equivalent to a benc dictionary, and a JSON object's keys are the dictionary's string keys.q Yardanico: where is that from? Yardanico: seems to be context-dependent Yardanico: maybe byte-encoded? just a wild guess faulander: "The JSON terminology in RFC 4627 is used." Yardanico: that RFC doesn't mention benc Yardanico: Erlang BEncode ? Yardanico: seems so faulander: it's here: https://github.com/transmission/transmission/blob/master/extras/rpc-spec.txt Yardanico: yeah I found that Recruit_main707: leorize, you told me i could create a static sequence of strings, how would i do it? Yardanico: it's BEncode faulander: in 1.1 Yardanico: https://github.com/jlouis/benc Yardanico: https://github.com/notpeter/benc faulander: so i have to write a bencoder/decoder in nim aswell ... i thought my nim-transmission library would be easy to do :) alehander92: huh i have written bencode libs alehander92: in elixir alehander92: it seems as a common thing to do there, i had bad reasons tho :( faulander: @alehander92 so you want to convert it to nim? :) alehander92: no, i dont like torrent tech anymore faulander: the rpc specs say: " JSON is fairly common now, but for the benefit of ⏎ torrent developers familiar with benc: ⏎ a JSON array is equivalent to a benc list, ⏎ a JSON object is equivalent to a benc dictionary, ⏎ and a JSON object's keys are the dictionary's string keys." ... [https://gitter.im/nim-lang/Nim?at=5e959d91e24b4d6c4408fe38] Yardanico: no, it doesn't say so Yardanico: it just means that benc is fairly similar to JSON in usage faulander: ok, thats a language issue. my english is pretty good, but sometimes i am not sure. Recruit_main707: can i cast an string into an static strning?? Yardanico: uhh Yardanico: is that an "x y" problem? Yardanico: why do you want to do that? Yardanico: a static string is a string known at compiletime and you specify that type if you want to ensure that a proc/macro/etc gets a string which is known at compile-time Recruit_main707: cImport wants an static string, and i want to automate it a bit Yardanico: cImport is a macro Recruit_main707: yep Yardanico: and it needs that string at compile-time Yardanico: not runtime alehander92: @dom96 stefantalpalaru PMunch is right Recruit_main707: Yaradinco: cant i do it then? Recruit_main707: creating a const array? Yardanico: idk, try Yardanico: but is it worth the effort? Recruit_main707: not at all probably :P my lazyness is what makes me work for some reason alehander92: @dom96 stefantalpalaru PMunch we do need an example of valid usecase waitFor alehander92: before going with that error alehander92: i think i remember discussing with someone (zah?) if we need waitFor at all alehander92: if you think about it, with the proposed error, one would use waitFor asyncCall only in sync mode alehander92: and await asyncCall only in async mode alehander92: then why not just use the same name PMunch: My point is that we don't need a valid usecase, but that we shouldn't explicitly disallow things just because we can't think of a usecase for them.. alehander92: `await asyncCall` everywhere and do the corresponding thing alehander92: PMunch that's not true, at the very least having un-useful choice is a bad thing PMunch: That would definitely lead to errors with the current implementation.. alehander92: why does one need to choose between waitFor, await, discard, asyncCheck alehander92: it doesnt make sense to offer so many "keywords" for only 2 possible cases PMunch: The async as template PR must be merged for that alehander92: you either wait or you start it in the background alehander92: you can combine waitFor and await into just `await` overloaded differently in sync and in async PMunch: So you want to default have the asyncCheck callback, and then overwrite it if you await it? alehander92: and discard future/asyncCheck future to just asyncCheck alehander92: no, i want to also disable `discard future` inside `async` alehander92: so e.g. your programs just do ⏎ proc run {.async.} = await stuff(); # toplevel => ; await run() stefantalpalaru: alehander92: https://github.com/status-im/nim-beacon-chain/search?q=waitfor&unscoped_q=waitfor alehander92: stefantalpalaru i am talking about waitFor inside `async` alehander92: basically the point is that the existence of both `waitFor` and `await` keywords is a problem as it creates the artificial "what if i use waitFor inside `{.async.}` situation alehander92: and they could just be the same keyword with different overloads in both contexts faulander: i have found a c implementation of bencode here: https://github.com/transmission-remote-gtk/transmission-remote-gtk/blob/master/src/bencode.c ⏎ how would i include that in my program? alehander92: (but i guess then this would be confusing because people expect `await` only in async .) faulander: sorry, but i am a complete newbie when it comes to compiling and dealing with c code. Rika: im up for a warning for waitFor, but not an error Rika: an error sounds too extreme, and if people wanted it to error, they'd set the warning into error anyway alehander92: sorry, but you can have a warning for 1 & @[2] using that logic alehander92: the default for many things should be an error, and if there is an escape hatch, users should opt-in to use that/to turn the error into warning alehander92: turning X into Y requires work and time and its basically a roadblock alehander92: you should put roadblocks for people when they try to escape errors, not when they try to get those alehander92: (of course backward compat changes everything :D ) dom96: alehander92: yeah, to be honest it's good that this is called out: that you cannot use await outside {.async.} because then it would be more confusing dom96: and yeah, `waitFor` inside async should be an error dom96: not a warning dom96: You should never block inside an async proc dadada: hey Yardanico: hallo alehander92: @dom96 yeah alehander92: i also want to find a way to detect stuff like blocking syscalls inside async dadada: why do unittest unittests default to success? Isn't that illogical? An empty test being successful? Shouldn't there always be a check() or something to that liking be required be successful before a test as a whole can be? alehander92: it almost seems to be workable with tags dadada: s/be/to be alehander92: well, maybe its a bit like a `SKIP` test Rika: `You should never block inside an async proc` (disclaimer: im kidding) so are we banning all non-async procs in async procs too now? dom96: Rika: not all non-async procs block dom96: if we could annotate the ones that do then yes, banning them would be ideal dom96: (and I have considered doing this using the effect system, it's just a lot of effort) dom96: regarding `asyncCheck` too, we should get rid of it, I also considered what alehander92 suggested: to make it implicit. IIRC there were some blockers for that alehander92: @dom96 yeah exactly, but we can add a bit to the tags system, so it becomes quite easy alehander92: to annotate something like `{.tags: [not Blocking].}` Yardanico: yeah, we already have IO tags alehander92: the problem is different imo alehander92: we need to be able to check for the absense of tags alehander92: not to have to write down all found ones alehander92: in all cases alehander92: iirc Araq thought `not tag` might be ok to add dom96: if you do that then you'll end up needing to annotate a lot of procs which are just doing CPU work dom96: indeed, what Yardanico said, we may be able to reuse IO tags alehander92: but we still need `not` alehander92: because otherwise you need to annotate all other effects dadada: uh, are tags a new Nim feature? :-) dom96: yeah, the effects/exception tracking system always needed this expansion alehander92: which often people dont care about alehander92: in their own code dom96: I've always wanted to be able to state "raises anything but MyExceptionType" alehander92: about the cpu work: that's very true, and it would be perfect if was possible to somehow annotate on base of some kind of limit (e.g. this function call costs "X", i want my async-s to call only up to Y) Rika: `if we could annotate the ones that do then yes, banning them would be ideal` if only the halting problem were solvable 😛 alehander92: but this is very very far for now dadada: if Nim didn't use # for comments, given that this symbol is known as hashtag all around and generally used for tagging things, we could #notblocking , which would be a lot of shorter (and IMO better looking) dom96: Rika: we're talking about IO here, not CPU taking forever Rika: hey, im still joking dom96: dadada, let's not derail into a syntax discussion :) alehander92: at least the cpu taking forever ones are probably easy to detect/debug alehander92: and indeed one can move that to profile-like tools: "report all sync calls taking >x ms in async functions" Skaruts: is there not a proc to empty a sequence? dadada: dom96: I'm sorry, for derailing alehander92: and finally one can always add a `Blocking` or `CPUHeavy` tag for his own function that does a lot of calculations etc alehander92: if e.g. he wants it to be forced in another thread Skaruts: or maybe simply doing `a = newSeq[T]()` will be enough? dadada: s/of shorter/sharter dom96: Skaruts: you can setLen(0) on the seq or just assign @[] to it dadada: shoter alehander92: @dom96 hm the `raises but` seems interesting Rika: setlen is better dadada: shorter .. what's up with my typing skills Skaruts: ah thanks Skaruts: didn't think of that Skaruts: (didn't know about setLength either) dom96: alehander92: let's lobby Araq to make it happen :) alehander92: @dom96 i am ok with that, (i have to admit i start to like result types more and more tho :P) alehander92: but we push for `not tag` as well :P Recruit_main707: shashlick: i have an issue with nimterop, i wrote it in gitter Araq: IMHO we should use the type system to encourage correctness and profilers to encourage efficiency dom96: tags are part of the type system :) Araq: and in my code a[i] can be "blocking" and yet I don't want to write 'await a[i]', go figure dom96: the purpose of this is to know that something is blocking dom96: it would be a very useful feature and of course we can make it possible to disable it if you just don't care Yardanico: just fyi (I don't feel this is a better approach, but still) - zig chose to enable/disable async "globally" Yardanico: if you enable async in your app everything in stdlib (where possible) will be used in async mode Yardanico: but of course async in zig is implemented in the compiler :) alehander92: Araq well we wouldn't annotate stuff like `a[i]` as blocking alehander92: its more about a limited set of known calls+codebase-specific calls which every user can decide on himself dom96: It's about annotating things like Socket.send as blocking alehander92: and it is about correctness Araq dom96: the compiler can the infer anything that calls into that proc as blocking dom96: that may in fact be a `[]` proc which for some reason calls `send` alehander92: i did have an actual bug once where i didnt realize a future running in the background cant be woken up because of a long syscall somewhere Araq: alehander92: interesting Yardanico: lol sealmove: that's weird, I get "Error: type mismatch: got " when doing `a > b` sealmove: `a > 0` actually, and `a` is a `uint32` Yardanico: huh narimiran: do `a > 0'u32` Yardanico: well yeah that's understandable Yardanico: but people might expect a > 0 to work :P sealmove: why doesn't it work? Yardanico: because by default number literals are assumed to be of type "int: Yardanico: " dom96: `import lenientops` may help you out here sealmove: so `<` is not defined for `(x: SomeUnsignedInt, y: SomeSignedInt)` Yardanico: !eval import lenientops; let a: uint32 = 5; echo a > 0 NimBot: true dom96: yay sealmove: wow! I didn't know about lenientops, this looks like exactly what I need, thanks! <3 Yardanico: yeah, some modules get less attention sadly Yardanico: like strscans, parseutils, etc dom96: What would be cool is if the compiler could suggest imports based on type mismatches dom96: or at least have it hard coded to suggest lenientops for these kinds of situations Araq: I thought about an error message filter Araq: it would translate error messages into helpful URLs/wiki pages Araq: could be an external tool even dom96: that would be cool too dom96: that way we could improve the compiler's error messages without new Nim releases dom96: the tough part would be ensuring the URLs stay the same between Nim versions dom96: but I love this idea Araq: hmm I need a persistent data structure Rika: strscans, parseutils, strtabs, lexbase, a lot of stdlib modules pretty much unknown to anyone Araq: any experience here about these? Araq: I usually use a 'seq' with another seq stack Yardanico: @Rika parseutils are actually very cool Yardanico: when you need to parse things :P skyhawk172: hello, can someone help with re-sending email confirmation email for the nim forum? Yardanico: dom96: ^ Araq: PMunch, didn't you implement a "persistent" lookup table once? Yardanico: @skyhawk172 what's your forum nickname? skyhawk172: martinc skyhawk172: the original email never came and I can't find any way to re-send it myself 😦 companion_cube: Araq: give a try to the "HAMT" structure maybe? companion_cube: (and if you have access to the refcount internally and it's 1, you can mutate) companion_cube: (if you want a persistent map) Krey: Are different versions of the compiler gcc/clang a concern for nim runtime? Krey: Krey: ``` Krey: choosenim-init: Downloading choosenim-0.6.0_linux_amd64 Krey: Prompt: Can choosenim record and send anonymised telemetry data? [y/n] Krey: ... Anonymous aggregate user analytics allow us to prioritise Krey: ... fixes and features based on how, where and when people use Nim. Krey: ... For more details see: https://goo.gl/NzUEPf. Krey: Answer: Forced Yes Krey: Tip: 1 messages have been suppressed, use --verbose to show them. Krey: Error: No C compiler found. Nim compiler requires a C compiler. Krey: ... Install clang or gcc using your favourite package manager. Krey: ##[error]Process completed with exit code 1. Krey: ``` Krey: *me is processing https://github.com/RXT0112/Zernit/pull/101* Yardanico: pls don't paste in irc Yardanico: I mean don't paste in discord Yardanico: in irc it's split in messages Krey: Yardanico: Sorry didn't know it's bridged on IRC Krey: Yardanico: paste: http://dpaste.com/3ZSKAVT Rika: Yardanico: do you use lexbase too? Yardanico: not yet, might try late r:P Yardanico: @Krey I don't know how your package manager handles dependencies, but nim needs a C compiler to be available Yardanico: either clang or gcc (well, a lot of others are supported but these are the main ones) Krey: @Yardanico this is CI running on debian:stable docker Yardanico: does it have a C compiler though? Krey: i figured as much but are different versions of gcc/clang a concern for nim runtime? Krey: if so -> i need to implement CI for it euantor: Try installing `build-essential`: `apt-get install -y build-essential` Yardanico: not really, nim supports most GCC versions Yardanico: and clang Krey: @Yardanico It doesn't have anything by default Yardanico: if it's newer than 3.x Krey: @Yardanico Noted version >=3.X Yardanico: well, not equal, just > 3.x Krey: can you elaborate on other compilers? Krey: noted Rika: Yardanico, which is more recommended to use or smth, parseutils or npeg? Yardanico: full list of compilers can be found there https://github.com/nim-lang/Nim/blob/devel/compiler/extccomp.nim#L66 Yardanico: gcc, clang, tcc, icc, vcc (visual studio c compiler), etc Yardanico: @Rika depends on your usecase Rika: what do you mean? Rika: what factors would it depend on Yardanico: on what do you need it for? why would you use npeg if you, say, want to parse a simple string of 4 ints separates by a comma fast Araq: companion_cube, thanks, for now I'm trying my hacky solution which is likely to be fast enough anyway Yardanico: my mathexpr lib uses parseFloat and parseIndent from parseutils kodkuce: can i concant string whit terary in it kodkuce: echo "Running on " & $pnumber & " uploading:" & if uAllowed: "enabled" else: "disabled" kodkuce: it crys error Yardanico: yes you can Yardanico: just put if expression into parens Yardanico: echo "Running on " & $pnumber & " uploading:" & (if uAllowed: "enabled" else: "disabled") kodkuce: oh Yardanico: also check out strformat for string formatting 🙂 Recruit_main707: why is this not printing all the subfolders and only the first one? https://play.nim-lang.org/#ix=2i0T Yardanico: @Recruit_main707 you need walkDirRec Yardanico: walkDir is not recursive Recruit_main707: ok Yardanico: also check out splitPath if you want to check extension 🙂 Yardanico: ah sorry splitFile Recruit_main707: ok, thank you kodkuce: ty Rika: i guess npeg is for more complicated structured formats Yardanico: well I can rewrite my whole mathexpr using npeg probably, but idk if I need that Yardanico: right now lexer and evaluator are glued together in mathexpr :) I remember I did a version with AST and then evaluation of that AST later but there was a lot of code duplication Yardanico: maybe I should just write an interpreter for my own language to learn how to properly do AST stuff Yardanico: seems simple enough Yardanico: xd Yardanico: https://github.com/search?q=language%3Anim+interpreter Rika: got any tutorials or books on parsing and lexing? i got no fuckin clue where to start Yardanico: maybe you want to build a compiler instead? :DD Rika: nah i just wanna parse files into data (see: the osu library) i wanna move it from some hacky shit to something more "professional" or something zetashift: @Rika http://craftinginterpreters.com/ and https://interpreterbook.com/ zetashift: A long time ago I also read a tutorial where they used OCaml to make a parser combinator but I can't seem to find it :/ Yardanico: Well you don't always need to use stuff like npeg. People do manual lexers (so you do all parsing manually) for performance or sometimes to understand better Krey: @Yardanico Thanks Yardanico: If I'm not mistaken Nim compiler uses manual lexing too Krey: How is nim on security? Do i need to implement valgrind or something? Recruit_main707: as safe as you want it to be (almost sure) Krey: As safe as i want it to be does not seem very comforming for the end-users.. Yardanico: Well you can use valgrind with Nim, yes. Usually Nim is safe unless you do FFI or low level stuff like raw pointers and manual memory allocation Yardanico: There's no null safety by default though Recruit_main707: essentially, if you dont want to mess with very low level stuff, safe, thats what i meant Yardanico: Well it all depends on what you mean by "safe" Recruit_main707: id say, based on the meaning ive been hearing Nim is very safe (and also allows you to not be safe if you really want to) but you wont get something pointing to null if you dont want to Krey: @Yardanico Not leaking any memory and doesn't do anything unexpected in such a way that can't be influenced by random 3rd parties Recruit_main707: The default garbage collector doesnt have any known memory leaks, arc only leaks when used with async, about the random libraries, i dont even know how that works Krey: > The default garbage collector doesnt have any known memory leaks, Krey: Krey: Is there any tracking for known bugs? i.e Vlang implemented this for me: https://github.com/vlang/v/issues/3972 alehander92: Yardanico you can really do it easily Yardanico: I know Yardanico: @Krey well kinda alehander92: what i mean is that alehander92: there are many places to start alehander92: e.g. you can start from existing AST alehander92: like importing the nim parser module Yardanico: https://github.com/nim-lang/RFCs/issues/4 Krey: @Yardanico Ideally i would like to implement a logic in a software that warns the end-users about known issues Yardanico: ? What does that mean Krey: @Yardanico i.e using Github API to fetch issues with specific label and if any is fetched -> Output huge security message for the end-user every time they use the software Krey: prompting to update or providing logic to hotfix Yardanico: What's the point then? Yardanico: I'm not sure how that can be useful Krey: if there is anything done on nim that can be used this way in software logic Krey: Assuming that provided software is beeing rewritten in all other languages to provide options in case major security issue is discovered moerm: Hello everybody zetashift: hiya zetashift: @Krey you might be looking for Ada and not Nim, though I don't see any 'security risks' using Nim and it's current GC Krey: How do i make `nim check` to die on code-quality issues? (https://github.com/RXT0112/Zernit/pull/101/checks?check_run_id=586025506#step:7:23) -- It returns 0 on failure.. Krey: @FromGItter what do you mean by Ada? zetashift: @Krey https://www.adacore.com/about-spark this is what I ment moerm: Krey wait a little (weeks rather than months) and you'll find nim having a static analyser akin to SPARK for Ada Krey: zetashift: All languages are expected to be supported by Zernit project so Ada is irelevant for the implementation of Nim atm companion_cube: this kind of thing takes a long time to mature, though companion_cube: static analysis is hard zetashift: ah okay then I misunderstood moerm: Key Expected by *whom*? moerm: And btw, do have a link "Zernit project"? moerm: -Key +Krey zetashift: @moerm he posted it a bit ago I think: https://github.com/RXT0112/Zernit Krey: Relevant https://github.com/RXT0112/Zernit/pull/101 moerm: Thx Krey: How can i make nim to use different compiler? Krey: *me wants to force it to use different compiler for tests* Yardanico: --cc:clang dom96: @skyhawk172 activated it for you Yardanico: --cc:zig dom96: Yardanico, also, note I'm not the only one that can do that ^ Araq can too :P Yardanico: lol Krey: @Yardanico `nim --cc:clang path/to/file` ? Yardanico: yes, if you have clang installed Krey: thanks Yardanico: nim c --cc:Clang Recruit_main707: ^ Yardanico: nim c --cc:clang path/to/file * Yardanico: also nim has c++, objective c and JS backends Yardanico: the C backend being the main one Krey: Can `nim check` with different compiler output different results ? Yardanico: uhh, nim check doesn't compile your code Krey: it checks the code afaik Krey: i meant if it can find different problems depending on compiler user Krey: i meant if it can find different problems depending on compiler used zetashift: No it shouldn't Krey: > shoudn't ? -> Implement CI just to be sure? Recruit_main707: syntax will be the same despite the backend (except backned exclusive things obv) skyhawk172: @dom96 it works now, thank you! 🙂 zetashift: the code you feed to the C compiler will first be nim `check`'d so the output will always be the same and then it will be fed to a compiler so it's a separation Recruit_main707: being c the chosen backend i guess right? zetashift: yea if you have JS as a backend it'll still nim check but since the output are just js files it doesn't really matter zetashift: So it cannot find different problems depending on (C) compiler used, ofcourse the C compiler might output some different stuff zetashift: AFAIK there is a clear separation between `nim check` and `nim c/js` Yardanico: @zetashift thanks for http://www.craftinginterpreters.com/ , I guess I'm gonna disappear from the real world for some time XDD zetashift: haha I've been following it using Scala it's an absolute delight alehander92: awesome alehander92: yardanico better come more often to share with us your progress :P Yardanico: I wonder if there's pdf for that book Yardanico: or epub PMunch: Araq, sorry I was at the store. I did make persistent vectors, but not lookup tables moerm: Araq is here and actually present? Rika: i kinda only wanted parsing and lexing, im not looking into creating a programming language Yardanico: moerm: unbelievable right? Yardanico: xD Rika: i'll look into some other resources Yardanico: moerm: without joking 4raq is almost always in IRC zetashift: @Yardanico from the books github issue the author states "Hi, I plan to create and sell a PDF version once the book is complete, like I did with my previous book. :)" zetashift: @Rika I mean you can just read the chapters about parsing and lexing? PMunch: I was meaning to do the trees as well, but never got around to it moerm: Yardanico No, that's not my point but rather why I can't see anythin from him Yardanico: well he's busy you know :D moerm: So he's here but not present? Yardanico: well if you ping him he'll probably reply zetashift: he watches over us like Batman Yardanico: the overlord moerm: Yardanico Nuh, I don't want to disturb him moerm: Btw is there some trick to avoiding to have to type the Names in IRC? Yardanico: ?? wdym Yardanico: if you want to ping someone you have to write their name, since pinging is client-side, not server-side Yardanico: the IRC client checks all messages and makes a notification if it matches your nicknames or whatever lines you might add in your config moerm: Thx PMunch: moerm, if you want to avoid having to type the name your client might support tab completion (at least HexChat does) supakeen: Also in general people leave their clients open just so they can read backlogs when they get back to a computer and/or any mentions of their name they have missed. PMunch: irclogs.nim-lang.org can help you there for this specific channel though Yardanico: supakeen: I use Quassel so yeah :P Yardanico: I'm *always* online moerm: PMunch, A big Thx! I happen to use Hexchat and that was exactly what I was looking for. Nice. PMunch: No problem :) It's a great feature Yardanico: damn, just from the start of this book "was enough to convince me language hackers were a different breed of human. Some sort of wizards granted privileged access to arcane arts." I feel the same really :P moerm: As for reading backlogs etc. I know that, but as for myself I feel it to be impolite to seem to be present but not really be. That is no criticism of anyone, just my personal and possibly too oldschool view Yardanico: moerm: IRC has Away status moerm: Yardanico, Ho can I activate that? moerm: or toggle Yardanico: moerm: it's not a toggle, it's a status in IRC Yardanico: you can check it by whois Yardanico: like /whois nickname Yardanico: or maybe i'm wrong moerm: Yardanico, Yes, but how can I set it for myself? PMunch: Alt+A to toggle it in HexChat Rika: so the wiki article on lexing and parsing is what actually helped me the most lmao Yardanico: moerm: /away i'm gone Rika: pretty funny stuff Yardanico: or there are some automatic tools like I just enabled in my Quassel client that I'll have away status once all quassel clients close Yardanico: i'm back PMunch: I think you then get a message as well when being pinged? Try now moerm: Yardanico, Uh, OK, thx. moerm: PMunch, Thx again PMunch: No problem PMunch: As soon as you type something you will be marked as active Yardanico: or sometimes you have to type /away again without any reason Yardanico: (I mean without any arguments) Yardanico: https://bisqwit.iki.fi/jutut/away.html PMunch: You can set your away message in Chatting -> General inv2004: Anyone tried to to clone benchmarkgame ? Yardanico: there's https://github.com/kostya/benchmarks but I don't know about benchmarkgame in Nim really inv2004: Yardanico, Yes, I saw it, but I saw it is just few benches there Yardanico: well benchmarkgame author himself refused addition of quite a few languages Rika: damn, nim's still slaying Yardanico: yeah, and json is slow because languages implement JSON parsers differently Yardanico: I mean in this benchmark, not in real life Yardanico: (for nim) Rika: json is slow tho Yardanico: "I know a lot of language hackers whose careers are based on this. You slide a language spec under their door, wait a few months, and code and benchmark results come out." lol Recruit_main707: has this been tested with Arc? Rika: they dont try it Yardanico: @Recruit_main707 arc performance is not that great for these benchmarks currently Yardanico: like I tested bf benchmarks there and with arc they were like 2x slower Recruit_main707: :/ Yardanico: it all depends on the concrete example of course, Yardanico: arc can beat default nim GC but as you know this default GC has been around for a lot of years Yardanico: and ARC is not even a year old Recruit_main707: yeah, i was thinking about that rn Recruit_main707: i have a lot of hope in arc still Recruit_main707: i think its definetely the way to go Yardanico: the main advantage is that it's _deterministic_ Yardanico: it inserts all calls to freeing objects at compile-time Yardanico: so it should always behave the same Yardanico: @zetashift do you think I can follow it with Nim? :) Yardanico: I mean the first part at least Araq: *why* is our JSON slow though? the parser hardly allocates and is a state machine... Recruit_main707: slower than python smh Araq: let me blame the stupid benchmark :P Yardanico: https://github.com/kostya/benchmarks/blob/master/json/test.nim#L24 Yardanico: this line seems stupid Recruit_main707: `defer: socket.close()` whats this for at the beggining? Yardanico: these benchmarks use sockets to notify the "master" program of completion moerm: Possibly Python uses a C module (we might want to look into that) Recruit_main707: python does use a c module Araq: Yardanico, is that the benchmark I used for packedjson? Yardanico: idk, probably Yardanico: ah yes it is Araq: if so, that benchmark is flawed... but my packedjson was faster than everything else anyway Avatarfighter: lmao the json section of that benchmark moerm: Araq Wouldn't be the first time some result turned out to be due to the test rather than to the testee ... Yardanico: well it's really not a good example of a json usage Yardanico: it parses one huge json file Yardanico: almost everywhere else nim is on the top or near the top Avatarfighter: its a terrible example of json usage imo Yardanico: I really wonder how they did implementations if Vala (!!) is faster than C in bf benchmarks Araq: the benchmark mostly tests floating point parsing which is hard to optimize inv2004: I like the nim-chat, just asked one question, and you descussed all the results and ~ fixed halh of them :) Yardanico: I mean Vala compiles to C anyway but how it can be faster than C :D Araq: Yardanico, same as Nim can be faster Avatarfighter: inv2004: we gotta be number one 😛 Recruit_main707: no pain no gain Yardanico: Araq: well yeah, but the point of these benchmarks to use the same implementation Avatarfighter: ^ Yardanico: and that doesn't seem to be the case zetashift: @Yardanico yes absolutely! supakeen: I suggest to hash the inputs and compare to a known set of benchmark results then just short circuit the parsing. supakeen: Everyone in favour? Recruit_main707: where is the used json file? Yardanico: It's generated by https://github.com/kostya/benchmarks/blob/master/json/generate_json.rb Araq: produced C code can be better than hand-written C code. hand-written C code is usually written by cargo cultists who cannot look at the produced assembler and instead bath in their manhood Recruit_main707: thats huge lol zetashift: I wanted to do it in Nim but I wanted to get better at Scala that's why I didn't go for it, but it's really easy to follow and when in doubt you can always peek at https://github.com/cabhishek/nimlox moerm: Yardanico, HOW "huge" ist that test file? Yardanico: yeah but I'll try not to :P @zetashift zetashift: yeah major spoilers :D Yardanico: moerm: I just ran it manually and it made a 107mb json file Yardanico: ... moerm: Araq, Careful there. While you are right generally I found that I still get faster code for critical stuff by hand supakeen: I guess a large file is also a valid thing to optimize for. supakeen: It's a common usecase. Yardanico: not really Yardanico: small JSON is a much more common usecase IMO Recruit_main707: i have an app that uses python nim and json, sending about 9000 characters on average and i cant get it to more than 20 fps :p supakeen: Yardanico: But large files are definitely not uncommon and where you might get larger gains :) moerm: Yardanico, About 100 MB? That's not frightingly large. I suspect the error could be with the test rather than with Nim Yardanico: moerm: there's no error Yardanico: it's just that nim stdlib json module is not tuned for that kind of usage really moerm: Sorry, I meant the poor result Recruit_main707: moerm: thats probably because compilers are made to be used by the people Araq described, and optimised thinking in them (i guess) Yardanico: packedjson will use much less memory in that case Avatarfighter: Do you guys know if there is anywhere you can get stickers of the Nim logo? Just curious Yardanico: well there's this on stickermule Yardanico: https://www.stickermule.com/artworks/1123185?token=bb1e25bf6e79678069238604d8101454 Avatarfighter: that's cooler than the one I had just found imo https://www.redbubble.com/i/sticker/Nim-Programming-Language-by-korsfarer/34701567.EJUG5 Yardanico: that is meh Yardanico: and why list languages it's influenced by Yardanico: better show a smol code example Recruit_main707: jajaja, that always looks great, and with nim it will look greater Yardanico: where does https://nim-lang.org/sponsors.html get list from? PMunch: Hmm, is telebot broken? http://ix.io/2i1C PMunch: This is the echo_bot example from examples/ PMunch: UpdateCallback is defined in private/types.nim as UpdateCallback* = proc(bot: Telebot, update: Update): Future[bool] {.gcsafe.} zetashift: Yardanico maybe a mix of BountySource OpenCollective and paypal donations? Yardanico: Well I'm asking because i was donating a bit to Nim on OpenCollective but it doesn't show on the website :P maybe it's not updated oftenly Yardanico: ah last update 9 months ago https://github.com/nim-lang/website/blob/master/jekyll/_data/sponsors.csv supakeen: On that page the link to the 'salt campaign' (yellow button) ends up with NXDOMAIN as well. supakeen: Or is that me? Yardanico: salt? Yardanico: ah yeah same for me alehander92: well json is a pretty popular alehander92: so people write very well optimized libs about it, not so surprising zetashift: what happened to that simdjson for nim thing? Yardanico: wait wat Yardanico: craftinginterpreters mentions nim "It doesn’t have negative connotations across a number of cultures. This is hard to guard for, but it’s worth considering. The designer of Nimrod ended up renaming his language to “Nim” because too many people only remember that Bugs Bunny used “Nimrod” as an insult." zacharycarter: if I need to define a preprocessor for the C compiler - should I use `emit`? Or is there some other way of doing this? zacharycarter: I know I can use `--passC` but I don't want to have to type that in every time zacharycarter: I guess I could also use the `passC` pragma? Yardanico: you can put it in the config instead :P zacharycarter: but wouldn't that just be a Nim define? not a preprocessor define? Yardanico: I mean --passC zacharycarter: oh zacharycarter: yeah that's probably the cleanest way, thanks zetashift: naming is hard tho yardanico Yardanico: yeah I know that myself inv2004: Could please someone remind how to clean nimble cache? Yardanico: just name your language Yet Another Useless Language :P Yardanico: inv2004: it's in ~/.nimble inv2004: I remember that on windows it does not recompile all the times Yardanico: ~/.nimble/pkgs specifically Yardanico: but Nim and Nimble cache are different things supakeen: I once wrote a tiny post on naming things but the gist of it is: think of 5 things that you want to think about related to your project, then think of 5 things for each of those 5 things, then pick from this second or third row of things and combine words. inv2004: pretty sure there was special nimble command supakeen: Not that I use it myself but people sometimes find it useful. inv2004: probably I am about nim - not sure inv2004: -f should help zetashift: I'd use the wutang name generator cause why not supakeen: I usually just pick words in another language. supakeen: That are related to the project. supakeen: All my python projects are german words, for c it's dutch, and of course, always have 1 exception for each ;) zetashift: I don't think nimble has a command to clean cache btw zetashift: I like the 5 things approach supakeen: @zetashift: Here it is with a few more words written: https://supakeen.com/weblog/how-to-name-a-project.html faulander: https://play.nim-lang.org/#ix=2i1S faulander: a more sophisticated question this time. questions are in the playground Yardanico: "I declare the decode_fuc after the procs, the procs do not know of the decode_func" use forward declaration Yardanico: oh, not if it's a variable kodkuce: i think i finished my simple http.server ptyhon alternative + upload faulander: note to myself (what is forward declaration, read it up!) leorize: Zevv: it already does? leorize: did you map NimStar and NimGStar? companion_cube: kodkuce: care to share the code? :) faulander: @Yardanico : ok, so i forward declare both procs, is there any problem with that? faulander: and how would i call a proc where i get the name from a table-keys, value? zetashift: you mean how to get a value out of a table? zetashift: or get the key and value out of a table? faulander: no. i want to call a proc, lets call it "decode_string" and in the table i have ⏎ key: "s", value: "decode_string" zetashift: `decode_func['l'] = decode_list` also is this even possible? You declare decode_func as `[int, int]` faulander: yes, thats wrong, there are alot of mistakes still Yardanico: https://github.blog/2020-04-14-github-is-now-free-for-teams/ faulander: i need to get the basics right zetashift: will the proc put the value in the table or something else? Yardanico: github scared of gitlab now :D Yardanico: "We’re happy to announce we’re making private repositories with unlimited collaborators available to all GitHub accounts. All of the core GitHub features are now free for everyone. 🎉" faulander: its a bencoded string(https://de.wikipedia.org/wiki/Bencode) companion_cube: ahaha nice zetashift: aber ich bin nicht deutsch zetashift: dull joke but I'll check what bencode is faulander: me neither ;) faulander: its a long string, like a json in one line faulander: a integer looks like: i29410e faulander: and the int proc is: faulander: https://play.nim-lang.org/#ix=2i22 zetashift: I think I saw bencode in Nim Days zetashift: are you trying to make a parser for it? Araq: hmm we could use a streaming approach for JSON faulander: i look it up in nim days zetashift: Sorry faulander I'm not sure what you're trying to do, maybe return a tuple one containg the proc and one containg the string representation? Araq: then we use less memory and can optimize parseFloat in order to look good on this benchmark. if streaming is allowed, I don't remember zetashift: also: https://github.com/xmonader/nim-bencode faulander: no this is a more general question let me ask it again faulander: can i call a proc which name i get from a variable? zetashift: so you'd have something like `let foo = "bar"` and you want to 'convert' that to 'bar()' which is a proc Rika: Huh. Rika: Bencode doesn't have float support Rika: faulander: no, unless you mean converting the string on compile time, in which case you can, but it would be hacky Yardanico: another question - s == "" or s.len == 0 Yardanico: which one is better to use for empty strings? :) leorize: s.len == 0 leorize: because in the end, s == "" still have to compare the len first :) Varriount: faulander: What are you trying to achieve? Recruit_main707: s.len == 0 becuase it looks better Prestige: I think he meant invoking a proc by its name at runtime? leorize: @faulander: you can't, runtime reflection is not a thing in Nim Araq: leorize, we optimize s == "" to s.len == 0 leorize: however you can store a "string" -> proc pointer table kodkuce: hmm if i take someones code (my example dom96/jester parser) and on his github he licenced it with MIT do i have to licence it too on my github as MIT or can i put CC0 licence ? Yardanico: you need to have a copy of MIT license for the code you used Yardanico: but you can license your project in CC0 kodkuce: ye in my file i have part of his code and i copyed his licence text there Yardanico: yeah that's ok then dadada: hope Nim will have an empty method for all collection types, cause questions about s == "" or s.len == 0 should really be answerd with s.empty IMO dadada: it's not only shorter, it also looks nicer, but I guess stuff like that is a matter of taste leorize: back in the old days, `isNilOrEmpty` was how it's done leorize: so maybe we can now have `isEmpty` :P dadada: I think we could drop the is leorize: it's better to have it dadada: why? leorize: since isEmpty(string) is a thing too dadada: we don't use getLen either leorize: empty(string) looks like you're trying to empty a string :P dadada: no, that would be clear dadada: but, I do see your point Zevv: leorize: oooh no i didnt! Prestige: Empty is also a verb so yeah that looks confusing dadada: if s.empty: <- can in my mind only man that you want to know a state (is it empty?) Prestige: Imagine empty(seq) dadada: s/man/mean dadada: Prestige: I can't remember that word empty being used in that way anywhere, most of the time it's something like clear, or even deleteAll leorize: Zevv: lol I literally implemented that feature because you asked leorize: dadada: it's still a verb leorize: "can you empty the bottle?" is still a sentence people use dadada: leorize: it can be a verb, but it can also be an adjective, empty on its own is an adjective, to empty is a verb leorize: I'd say verbs don't really cut out for property name dadada: leorize: https://www.dict.cc/?s=empty dadada: if I'm reading this table right, empty is used more than 10 times more commonly as adjective, compared to it being used as verb leorize: I don't even know what the table mean :) leorize: isn't this just an english -> deutsch table? dadada: leorize: I'm using this site regularly, so I have a feel for it, and I'm pretty sure the english words on the left are ordered by their occurances in regular English usage leorize: and highlighting how empty in english can be translated to various forms in deutsch? dadada: leorize: it's a very advanced translation site dadada: dictionary site dadada: leorize: yes, but it's most common translation by far is (see number 6120) is the adjective form, and the other adjective forms also are all in all more common than the verb form Prestige: Either way I think it's best to prevent any ambiguity Prestige: If we were to use empty at all I think we'd want to use it as isEmpty dadada: it's extremely common for English words to have both verb and adjective form, we would always have to use isAdjective... leorize: in practice it appears that we don't have to :) because they are not that common dadada: leorize: did you check them all with a dictionary? name a random adjective that you believe not to have a verb analog? zetashift: I like how Elixir does it for functions that return true or false, they add '?' to the function name e.g. `Enum.empty?(collection)` dadada: zetashift: I believe Crystal does also use ? for something like hta dadada: tthat kodkuce: why github has no Zero-Clause BSD in options for licence 😦 zetashift: maybe it's a Ruby thing then leorize: dadada: my bad, noun is what we use 99% of the time :P leorize: and for adjectives we do use `isAdjective` dadada: okay, I appreate if it's consistent leorize: @kodkuce: it's just a shortcut to have a license in your repo dadada: appreciate dadada: leorize: would you accept something like if s.empty?: leorize: sure, but we don't have that kind of syntax dadada: maybe I can wrote a macro that enables this... dadada: write leorize: sorry, but macros don't magically make invalid syntax work :) zetashift: NEP-1 doesn't mention proc naming huh dadada: simply rewite .whatever? to .isWhatever , but honestly even I think it might not be worth saving one character leorize: @zetashift: yea it's in apis.html instead leorize: https://nim-lang.org/docs/apis.html zetashift: yea I had it :p leorize: @kodkuce: if you want to use a license that's not in the license selector, then just go and download the license.txt you want and add to your repo zetashift: I would be surprised if apis.html wasn't under docs leorize: nep-1 is still the only nim enhancement proposal zetashift: handy reference I didn't know about, saved iit leorize: because we don't have any process for writing more :P zetashift: but didn't know `?` was an illegal char for a name zetashift: weird error tho: `Error: invalid visibility: '?'` leorize: the identifier set consists of `[a-zA-Z][a-zA-Z0-9_]` leorize: for ascii leorize: if utf-8 then it can be anything zetashift: I'll keep it ascii Yardanico: wow, probably the single longest error message (I mean single line) I've ever seen in Nim Yardanico: "Error: A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature." audiofile: wheres the recipe Araq: Yardanico, it wasn't written by me, maybe that's why :P Yardanico: haha Recruit_main707: does somebody know why nimporter generates something that doesnt exist? Recruit_main707: (it tries, it obv errors) Yardanico: wdym "doesn't exist"? Araq: why would generate somethingt that already exists though? Araq: *would you Recruit_main707: i mean, not existing in the header Yardanico: what exactly does it make? kodkuce: https://github.com/kodkuce/nimple.http.server hmm, i hit a doom, is asynchttpserver limited to 8mb post request Yardanico: why not jester Recruit_main707: well, the problem is not that it creates it, its that it doesnt, but it uses it Yardanico: well nimterop isn't perfect companion_cube: oh, multipart? Yardanico: it might fail to generate something so you'll need to use c2nim or translate it from headers manually companion_cube: kodkuce: have you looked at the chunked encoding? kodkuce: nah newer heard of it, i can google it Yardanico: audiofile: if you're still wondering Yardanico: !eval var prc = (proc (a: auto): int = 5) NimBot: Compile failed: /usercode/in.nim(1, 12) Error: A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature. companion_cube: it's how you can upload a 10G file onto a machine with 200MB of ram :) companion_cube: streaming content, in http audiofile: thanks! Recruit_main707: its very weird, `NSbuilder_t` doesnt appear in my whole project, neither in nimterop's source sealmove: this incopatibility issue with ints and uints is getting on my nerves! sealmove: I even define the `<` op and still doesn't work kodkuce: hmm i have 16gb or ram but still it wont let moe more then 8mb, i think asynchttp is limiting it of 5 freezes it responed 1 time with file limit error sealmove: also lenientops is just for `float <-> int` not for conversions betweens different kind of integer types faulander: @leorize faulander: @leorize: thanks for the clarification kodkuce: and have one more question, writeFile from IO its not async right, i am atm calling it from async proc that will block whole async thingy right? Yardanico: yes Yardanico: one way to solve that is to use THREADS (yes :DDDD) kodkuce: any suggestion how to fix this? leorize: Yardanico: or use asyncfile Yardanico: oh right forgot about that sorry kodkuce: ok so TODO is adding asynchfile and figure out this upload thingy 🙂 moerm: The goal of an error message is not to be a short as possible but to provide a *useful and helpful* message. Or at least that should be the goal Yardanico: well yeah I understand why that happens Yardanico: the error message is pretty clear moerm: related to *readibility*. Do not underestimate it. well readible code is code that is easily maintainable and likely contains less bugs in the first place. moerm: One of the many things I like about Nim Yardanico: lol Yardanico: https://play.nim-lang.org/#ix=2i2Q sealmove: when did we re-enabled += op? Yardanico: ? sealmove: x += 1 always worked? leorize[m]: @sealmove: it's always been there? Yardanico: yes? Araq: Yardanico, I have an RFC in the works for taming 'converter' Yardanico: oh no :P sealmove: hmm, for some reason I thought it wasn't, maybe because we don't have `++` (well we have the better `inc` of course) Yardanico: some stuff in nimpylib wouldn't be possible without converters (yes I implicitly convert values to bool like Python does to mimic some behaviour) but it's just a fun and kinda stupid project :P leorize[m]: Araq: so finally it's gonna be clearer when a converter will apply? Yardanico: if that means less bugs in the compiler I'm all for it sealmove: so I am working on Nim 1.0.0, this works on devel https://play.nim-lang.org/#ix=2i2U but doesn't on 1.0.0. I wondered what changed, and if there is a workaround for 1.0.0 which doesn't require convertion or adding suffixes to literal (maybe define some proc, but I couldn't make it work) leorize: one thing for sure it does work on nim 1.2.0 leorize: I think you should move to 1.2.0 and use --useVersion:1.0 :P sealmove: yeah, I can use 1.0.6 max because of study travis using ancient gcc Search Results ⏎ Web results ⏎ ⏎ 🤦 [https://gitter.im/nim-lang/Nim?at=5e960197e7ca460b065eaae1] sealmove: (oops copy pasted more stuff than just emoji 🤦) sealmove: (also study = stupid*) Araq: leorize, version 1 has --useVersion:1.0 sealmove: (no I am not drunk, despite the looks) Araq: leorize, yeah Araq: the RFC is mostly "instead of converter let's have a convert[T, toT] type like varargs" plus some special mechanism for 'distinct' types sealmove: hmm what exactly does --useVersion:1.0? Yardanico: wait I can simplify that macro to a simple template Yardanico: template `:=`*(name, value: untyped): untyped = (var name = value; name) Yardanico: this behaves roughly like a simple version of walrus operator in Python Yardanico: if (a := 5) > 3: echo a Yardanico: basically saves a few characters and shows that nim is cool :P companion_cube: don't you need a `block` in there? Yardanico: no lol, it just works (TM) companion_cube: or do the () act like one companion_cube: ah cool. Yardanico: it's the same as writing Yardanico: if (var a = 5; a) > 3: echo a leorize: @sealmove: here's your 1.2.0 fix: https://play.nim-lang.org/#ix=2i2Z leorize: save it in your config.nims moerm: Let us leave looking cryptic (and a short-cut operator zoo to the curly braces languages ... companion_cube: Yardanico: just tried it, it's pretty cool indeed Araq: Yardanico, well as you noticed, there is 'if (var a = 5; a) > 4' Yardanico: companion_cube: if you sell your soul to Nim compiler you can do stuff like https://play.nim-lang.org/#ix=2i33 Yardanico: Araq: well, I know, := is just to mimic Python, I don't really use this if expression in code anyway moerm: Don't we have better and more important things to work on than creating "cool" sugaring? Yardanico: moerm: yeah, but I don't really do any nimpylib stuff anymore, just pushed a few fixes today because I was bored moerm: Yardanico, And that's good, because that's poor coding companion_cube: ahahah jeez Yardanico: companion_cube: it's not a theoretical example btw companion_cube: showing off your macro-fiu companion_cube: fu Yardanico: tonim is a simple macro, the real magic is in projects like nimterop moerm: "Mom, I saved a line!" (but oh well, my program is actually of worse quality now ...) Yardanico: Or async or jester companion_cube: did you suddenly move to discord?! Araq: moerm, be gentle, people are allowed to have fun and play syntax games Yardanico: I just got out of my room and I carry my phone with me moerm: No, he is using NSA tech * whisper Araq: it's not like 'pylib' is for a production setting Araq: I mean, maybe some fool uses it in production but then it's still better than not using Nim :D moerm: Not to lack modesty but why would I care about Python when there is Nim? (Python has become fat) Yardanico: Hmmm, seems like Juan removed a bold warning I had on the top of README to not use pynim in real code moerm: *g Araq: because Python still has more libraries moerm: Araq hmmm ... Yardanico: We can already use them with nimpy anyway :D moerm: Saturn is way bigger than earth. I'll stay here anyway moerm: I'm probably a victim of my field. Pardon me Araq: you wouldn't believe how many, many people approach "programming". Search on stack overflow for a snippet, copy it into your "Program", done. moerm: Araq And the result is: OS is buggy, libraries are buggy, and even critical stuff like openssl is buggy moerm: Welcome to the "programming is fun" world! companion_cube: not sure openssl's state is caused by stack overflow copy pasting, really sealmove: hmm 1.2.0 brought some very nice improvements, I hadn't noticed Araq: moerm, well one gets for what one paid for sealmove: collect is here too :) moerm: companion_cube, probably not. But by the "programming is fun" attitude (and when it turns un-funny "1000 eyes" turn into "not even 4 eyes" ... Araq: > Hmmm, seems like Juan removed a bold warning I had on the top of README to not use pynim in real code moerm: Whenever I interview a developer candidate and I hear anything about developing being "fun" he's out of the race companion_cube: that sounds… a bit rigid supakeen: `k alehander92: guys alehander92: i am trying to call a magic alehander92: copyLineInfo moerm: companion_cube, Oh gawd! "rigid" ... well, rigid happens to also describe what I want. Solid ("rigid") code. Thank you alehander92: from a macro but it seems like .. it just isnt invoked from vmgen! alehander92: which is strange, as it seems defined correctly alehander92: i tried to debug it in many ways companion_cube: moerm: what's your fiekd? companion_cube: field* sealmove: I think Nim 1.2.0 deserves an Araq youtube video moerm: companion_cube, security, vaguely Araq: moerm, my litmus test is more like "imagine a language where array indexing starts at 1" if the reaction is "wtf" I become skeptical. if the reaction is "I don't care" I'm happy. moerm: Araq Let me guess ... not many pass the test ... companion_cube: Araq: what if it's "ugh"? moerm: companion_cube, I don't need "cool" people. I need engineers, preferably ones for whom coding starts with proper modelling (incl. verification) Araq: moerm, indeed moerm: But, but ... "C is THE language and in C arrays start at zero!" sheerluck: Araq Julia is a language where array indexing starts at 1 Araq: companion_cube, "ugh" is like "wtf", but don't take it too serious, it's not the only question I care about Araq: sheerluck: I know matrixbot: `donpdonp` for i in 0 .. I don't know enough about nimble to know what the correct procedure is Araq: uh oh, moerm: * laughing Asmodeus: " donpdonp zetashift (Gitter): ..." zetashift: Araq I can assure you this time it's not the package manager who is lacking, it's me hehe Asmodeus: good heavens zetashift: you just added discord to that "** " donpdonp zetashift (Gitter): ..." Northstrider: How many layers of indirection are too many heh Yardanico: Please use IRC->Matrix and then Matrix->Gitter and then Gitter->IRC moerm: moerm can I talk to myself in IRC Yardanico: we've come full circle moerm: Yay! moerm: moerm, I can even auto-complete my name. awr1: we need a ICQ, MSN messenger, and AIM bridge Yardanico: what about Skype Yardanico: also don't forget facebook Araq: zetashift: for me it's always the PM because PMs are bad moerm: Yes, Skype and facebook PLUS javascript based !!! moerm: It's a shame anyway that todays fat fat fat super-bloated browsers still don't have a built in OS! Yardanico: I have bad news for you iffy: Araq: what's the alternative? Yardanico: https://copy.sh/v86/ zetashift: I mean the web has become so big, is it really bloat Yardanico: yeah zetashift: some sites take it too far sure moerm: Yardanico, Ts those surely are std. OS versions. *My* FreeBSD is smaller Yardanico: moerm: some of them are Yardanico: ReactOS is really small zetashift: reactOS is that windows clone no? Yardanico: it is, an open-source one moerm: What I found amazing is that Oberon is relatively large. Larger than FreeBSD for example Yardanico: for userspace it's mostly wine, but they have their own NT kernel Yardanico: it's still active moerm: Yeah ... and in 2054 they'll be at 1.0 Yardanico: well there's no one to blame them Yardanico: it's just that nobody is interested in it :) iffy: Araq: and if you want to just point me to something to read, that's fine -- I'm genuinely curious, but I haven't had problems with nimble (I have with npm/yarn though) Yardanico: btw maybe I should try to check if Nim works on it dom96: iffy: with the little development that Nimble's getting, that's a miracle :) iffy: :) Yardanico: let's just use npm for nim, even the name is almost the same! Araq: iffy: glad to hear it Araq: iffy: dunno good articles about it but the one talk from Rich Hickey about it is good moerm: Yardanico, Why not take dog poop right away? It's almost the same as npm and it's less ugly zetashift: Every big package manager/build tool gets complaints zetashift: Is it even possible to make the perfect PM? moerm: I like nimble zetashift: I like it too, it just werks moerm: And I like non-bloat zetashift: but I admit I don't maintain big projects leorize[m]: anyone want a DSL for spawning processes like this? https://play.nim-lang.org/#ix=2i3S moerm: I'm gone. Have a good time everyone Yardanico: see ya zetashift: bye leorize[m]: o/ zetashift: @leorize looks nice Araq: iffy: https://www.youtube.com/watch?v=oyLBGkS5ICk leorize[m]: @zetashift: thanks leorize[m]: I figured that instead of adding more options to createProcess, I can just invent a DSL instead :) Yardanico: ^any nim user when they discover the power of macros zetashift: yes I looked at that and I was like why wasn't a function enouugh zetashift: and then I remembered it's Nim Yardanico: well yeah Nim "spoiled" be a lot :P Yardanico: *me Northstrider: leorize[m]: What's the [m] in your name? Yardanico: matrix Yardanico: he's using freenode matrix->irc bridge Northstrider: Ah gotcha, thanks leorize: yep Northstrider[m]: o Northstrider[m]: or it could just be a nick thing Yardanico: no :D leorize[m]: yea I use both matrix and logging into freenode directly :) Northstrider: So in this chat we have irc, gitter, discord, and matrix users Northstrider: :D Northstrider: https://xkcd.com/1782/ leorize[m]: we also have a telegram channel, but we don't bridge that one to irc Yardanico: yeah Yardanico: https://t.me/nim_lang Avatarfighter: We have a telegram too!? we have everything Yardanico: yes and I'm quite active there too :P Northstrider: What's the purpose of having so many? This is the only community I've seen that has so many Yardanico: Northstrider: not really, most languages are like that Yardanico: people prefer different messaging platforms Yardanico: python has multiple IRC, Telegram, Discord, Gitter chats Avatarfighter: Its to provide the motivation to make a bridge between all the messengers 😛 Yardanico: yeah, rewrite matterbridge in nim leorize[m]: I could bridge them all via matrix if the freenode bridge wasn't so terrible Avatarfighter: lmfao Northstrider: leorize[m]: why is it terrible? Yardanico: JS Yardanico: and it's pretty "stable" in crashing every few days Yardanico: when you see 30-50 matrix users leave and then reconnect after a few hours leorize: crashing isn't the problem leorize: the problem is that it chokes for a few weeks before it crashes leorize: this is due to how overloaded matrix.org is leorize: and how overloaded that bridge is leorize[m]: I'm currently on a KDE-hosted bridge Northstrider: Is it a nim specific bridge or something offered by your matrix network? leorize[m]: but to bridge between networks I gotta use the matrix.org one, because kde don't expose the tools needed to create a plumbed room Avatarfighter: I'm curious to know but if I have a func with the same name as an attribute of a type will and I access the attribute will it call the func or get the value directly from the type? E.g: https://dsh.re/74428 Yardanico: Northstrider: it's offered by freenode leorize[m]: @Avatarfighter: attribute Yardanico: and matrix Yardanico: https://github.com/matrix-org/matrix-appservice-irc Yardanico: that's the source Avatarfighter: leorize thank you, I was about to try my thing Northstrider: Yardanico: I imagine it would just be for a specific network though? leorize[m]: the matrix.org bridge used to bridge to all networks leorize[m]: now they just do freenode Yardanico: leorize[m]: really? lol Northstrider: Oh, why? Abuse? leorize[m]: because centralization isn't good :) Northstrider: Hm, might give matrix a go. Is riot still the go to? leorize[m]: and with just freenode the bridge already kinda stalled leorize[m]: imagine bridging all networks :p leorize[m]: I use riot and weechat-matrix Avatarfighter: is riot good? leorize[m]: ok-ish Yardanico: in the browser? ok Yardanico: on desktop? electron Avatarfighter: tbh anything is better than xmpp for me atm leorize[m]: xmpp is too fragmented leorize[m]: go on matrix, it's already performing better leorize[m]: just make sure you never use the matrix.org home server Northstrider: why? Yardanico: too overloaded Northstrider: ah leorize[m]: https://www.anchel.nl/matrix-publiclist/ leorize[m]: ^ either pick a public one or just host one yourself Northstrider: If you start your own server, is it hard to "link" to other servers? i.e. will you get filtered out for being a small network? leorize[m]: I'm using a public one though :P leorize[m]: nope, in fact people do it all the time :) kennymalac: how to escape " in regex? kennymalac: csvd.replace(re"\".*\"", "") kennymalac: 12, 21) Error: undeclared identifier: '.*\' Yardanico: why are you using regex for something like that? :( kennymalac: it doesn't matter leorize[m]: `csvd.replace(re "\".*\"", "")` leorize[m]: yes I literally just added a space :) kennymalac: thanks Northstrider: welp, guess I'm setting up a matrix server then kennymalac: examples online say re"" no space though , kennymalac: interetsing leorize[m]: @kennymalac: it's a nim syntax sugar leorize[m]: `re""` == `re(r"")` leorize[m]: and `r""` is a raw string, you can't escape anything in there kennymalac: rip zetashift: what a small mistake lol leorize[m]: it's useful when you want to type `re"\t"` leorize[m]: since `\t` won't turn into an actual Tab kennymalac: yep kennymalac: wish it were clearer from the error I suppose Varriount: Hm, is there a way to construct/allocate a returned object value to a reference of the object type? Varriount: I tried doing something like `var x = (ref objectType)(functionReturningObject(...))`, but that doesn't seem to work... leorize[m]: var x = new(ObjectType); x[] = functionReturningObject() leorize[m]: * `var x = new(ObjectType); x[] = functionReturningObject()` Varriount: Hm, no one-liner? leorize[m]: well a template and you got your one-liner leorize[m]: looks like edits on matrix don't translate well to irc Gary M: Part of a C api I'm working with requires passing a pointer to an array, but in nim I have to type the parameter as a fixed length Yardanico: ? Yardanico: you want to get a pointer to a nim array? Gary M: is there a better way of handling this? I tried using ptr openArray instead but that sure didn't work Yardanico: the C function accepts an array or returns an array? Gary M: it accepts a pointer to an array Yardanico: addr yourarr[0] Yardanico: to get a pointer to an array Yardanico: it should be "var" Gary M: yes but as the parameter Yardanico: ? Gary M: proc(instance: VkInstance, pPhysicalDeviceCount: ptr uint32, pPhysicalDevices: ptr array[2, VkPhysicalDevice]) Yardanico: you can just say "pointer" Yardanico: and call this proc like myinstance(myarr.len, addr myarr[0]) clyybber: @Gary M Take the address of the nim array leorize[m]: does physical device count has any relation to the array? Gary M: @clyybber I was, and it works if everything is fixed clyybber: Yeah Gary M: but that means fixed size in the wrapper which isn't really correct clyybber: Yeah, which wrapper are you using? leorize[m]: is this a raw wrapper? clyybber: You could use mine: https://github.com/Clyybber/vulkanim ? clyybber: 😄 Gary M: it's the nimsl vulkan wrapper Gary M: which previously only accepted a pointer to a single VkPhysicalDevice Gary M: instead of an array clyybber: Which is the right way here clyybber: Give it addr thearray[0] clyybber: The address to the first array element so to say clyybber: You can do that for seqs too Gary M: ah, thank you 😄 clyybber: np Gary M: does your wrapper cover 1.2 spec? clyybber: Ah, not yet. Let me update it Gary M: cool, I'll see about switching over then sealmove: kill this guy https://www.youtube.com/watch?v=DCfDLWfPqiA Yardanico: he just used "Nim" to make his video more popular Yardanico: too long to watch sealmove: he does it with all languages and finishes each video with something like "learning X is a waste of time because PHP will get you more money" Yardanico: I quickly skimmed over the video and it's just "python is popular" and "money matters the most" sealmove: pretty accurate sealmove: (description of the video content) sealmove: also the article he refers to is garbage! it says Nim is a scripting language sealmove: I don't know, this guy is toxic to programming community kaushalmodi: yeah, that was a garbage article; I commented on Twitter Yardanico: what would you recommend for a personal blog guys? I mean software kaushalmodi: Hugo zacharycarter: Hmm - I have a cpp file in my project that I need to compile as well as an objective-c source file zacharycarter: not quite sure how to do this... clyybber: @Gary M updated `:)` zacharycarter: anyone have any suggestions? zacharycarter: I don't need my Nim code compiled to cpp, but I do need to compile a cpp source file when building my project companion_cube: is there a way of imitating C's `struct foo { int n; char c[] }` where the array has size n? companion_cube: (in one block, I mean) kaushalmodi: zacharycarter: https://nim-lang.github.io/Nim/manual.html#implementation-specific-pragmas-compile-pragma ? zacharycarter: thanks zacharycarter: well I"m using that in one of my files with the cpp source zacharycarter: maybe it's nimterops fault :P let me try replacing `cCompile` with a compile pragma in my nimterop module kaushalmodi: zacharycarter: hmm. I'd think that nimterop should be then doing the Right Thing here zacharycarter: here's what happens - I have one file in my lib folder named `cr.cpp` which contains a preprocessor directive - `#define CR_HOST CR_SAFEST` and then includes a header file - that's it leorize: companion_cube: ^ zacharycarter: then I have a `nim` file named `cr.nim` which contains a Nim wrapper for this lib as well as `{.compile: "./lib/cr.cpp".} zacharycarter: then I have another file named `sokol.nim` which uses nimterop to wrap the sokol_gfx and sokol_app single header files companion_cube: leorize: oh cool, and it will have the same layout in one block then? zacharycarter: and in that file I call `cCompile` to a `.m` file which does essentially the same thing as the cpp source file, just with sokol preprocessor directives / includes companion_cube: I haven't really found how to display the generated C in a nice way zacharycarter: and I end up with this error - `error: invalid argument '-std=gnu++14' not allowed with 'Objective-C` leorize[m]: you can't :P companion_cube: sad :D leorize[m]: zacharycarter: I don't think the compiler support multiple backend in one module zacharycarter: ooph zacharycarter: I guess I'm screwed then exelotl: Trying to use nimterop's toast and I keep getting errors such as `Identifier '__NEWLIB__' (nskConst) contains leading/trailing underscores '_' [AssertionError]` Yardanico: you need to use onSymbol Yardanico: https://github.com/Yardanico/nim-libvlc/blob/master/src/libvlc.nim#L31 see like I for example replace libvlc_ with "" exelotl: ah so I have to give toast a plugin source path? Yardanico: oh idk how to do it directly with toast Gary M: @Clyybber cool, and do you mind me bugging you in DM's about your API? exelotl: I want to write a program that generates bindings Yardanico: why not use nimterop itself? clyybber: @Gary M go bug ahead! exelotl: I don't understand how to troubleshoot nimterop issues, it could really do with a tutorial or something zacharycarter: leorize[m]: the restriction doesn't even appear to be per-module but instead for the entire source tree zacharycarter: I just split my imports into different modules, and I get the same error zacharycarter: so there's no workaround for this? this kind of stinks inv2004: Are there any way to disable overflow check just for one function? my proc hash. leorize: zacharycarter: sadly, nope leorize: inv2004: yes, but wouldn't a hashing function use uint instead? clyybber: inv2004: Use uint zacharycarter: ugh well I guess I'm just going to use Nim for game code only then companion_cube: leorize: it'd be nice to see at least type declarations in C leorize: you can see them, they are just not pretty leorize: zacharycarter: doesn't nimterop let you build using the target library build system? zacharycarter: yes but these are both single header files zacharycarter: one of the projects does have a build system, but it's fips which I'm guessing nimterop doesn't support leorize: wouldn't emit `#include` work? zacharycarter: the implementation still has to be compiled leorize: write some nimscript to setup the target build system then zacharycarter: I'm not sure I follow - I am not compiling anything to a shared library - I'm just compiling these sources when I compile the Nim source that depends on them zacharycarter: I'm pretty sure you get that - but I'm not understanding what I can do with Nimscript to fix the need for multiple backends during compilation exelotl: can anyone see what I'm doing wrong here? https://github.com/exelotl/nimterop-test exelotl: oh... is it just because set_n is an inline function? inv2004: leorize, it did not help, but ok, will check it later :) inv2004: While chat is not sleeping, can I ask another question: https://gist.github.com/inv2004/74b7067050f3d1421e95b967f493d377 inv2004: Its about: Error: cannot create a flowVar of type: CountTable[system.int] leorize: try using the threadpool at https://github.com/yglukhov/threadpools instead inv2004: Cannot find it in nimble leorize[m]: yea it's not on nimble leorize[m]: you can just clone it as a submodule inv2004: can I somehow include it .nimble file from git ? shashlick: you can use -E and -F on the command line to strip leading and trailing chars shashlick: or pass it to the flags param for cImport shashlick: exelotl, will check out your issue in 30 mins shashlick: z as well Northstrider: test leorize[m]: are you on matrix now? Northstrider: Can you see my messages on matrix? Northstrider: @chance:carey.sh leorize[m]: I'm not in the matrix.org bridge :p Northstrider: I see messages, but can't seem to send them leorize[m]: but if you're on IRC then matrix sees you dadada: is æ easy to produce on an English keyboard? it's easy with Alt Gr + a on a German one leorize[m]1: chance: yep I see you leorize[m]1: welcome to the matrix.org bridge inv2004: are there any way to apply some operation to varible and immidiately pass it like var ? leorize[m]1: now you know why I said it's trash :) leorize: inv2004: wdym? zacharycarter: shashlick: thanks but I think this might be a mom limitation and not an issue with nimterop leorize[m]1: #_freenode_#nim:kde.org <- join that instead leorize[m]1: * `#_freenode_#nim:kde.org` <- join that instead Northstrider: #_freenode_#nim ? Northstrider: Underscores like that? leorize: yea, it's the KDE freenode bridge leorize[m]: it's not on matrix.org and less people use this one leorize[m]: so it's much more responsive chance-M: Oh wow, that was a good bit faster zacharycarter: https://github.com/nim-lang/Nim/issues/2748 chance-M: Was wondering if it was my synapse server killing itself chance-M: Ran into the weirdest issues and, as always, it was fucking DNS chance-M: Wasn't sure I'd solved them all exelotl: ok so I got `toast` to load my plugin... how do I tell it to throw away the symbol? exelotl: ```proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = #something``` InventorMatt: did you try using discard? Northstrider[m]: Alright, seems to be all set up, wonder how stable this will be. Have to say, riot isn't the most responsive of clients, and joining medium sized rooms takes absolutely forever leorize[m]: chance: it depends on what server the room is on :P leorize[m]: but yea, the riot client UX is terrible for this Northstrider[m]: hoho, setting a different nick to my matrix name was a mistake, as you'll see me as @chance, and irc will see northstrider[m] leorize[m]: use /nick to change it here shashlick: exelotl: set it to blank to discard exelotl: It doesn't like that: `Blank identifier, originally 'Override:_NEWLIB_VERSION_H__' (nskConst), cannot be empty` exelotl: that's if I do `sym.name = ""`, or `sym = Symbol()` dadada: is there a std proc for reading the nth line of a file? dadada: ie. the 700th line, without having to go through 1-699 leorize: the sad story is that to do so you still gotta read through the other ones :P dadada: ya, it's for convenience Prestige: hm so compilation doesn't seem to fail if I make incorrect calls to external libs? I passed extra params of incorrect types to XGrabButton and compilation succeeded. Is there a way to check for these kinds of issues? shashlick: @exelotl can you point to the code you are wrapping leorize[m]: dadada: https://play.nim-lang.org/#ix=2i5n this for now dadada: thanks, I'll use it :-) dadada: leorize[m]: should there not be a inc i somewhere? dadada: an inc i leorize: oh yea I forgot :P dadada: there a macros/pragmas specifically for forstmts? am I right? dadada: if so, does somebody have examples? inv2004: Any ideas how to improve getSeq here? https://github.com/inv2004/knucleotide_nim/blob/master/src/knucleotide_nim.nim#L61 inv2004: Because it takes x4 more times than my rust implementation Yardanico: how are you compiling it ? :) inv2004: ??? nimble build -d:danger leorize: what's your rust implementation? inv2004: leorize, its here: https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/knucleotide-rust-9.html Yardanico: that is what encrypted message inv2004: It was on the first place, but looks like they broke something again and it is on the second now. leorize: omg this is spaghetti inv2004: I can translate :) leorize: is this how idiomatic rust supposed to look like? :P inv2004: leorize, you see, I am in the nim-chat, even after I created the fastest Rust implementation :) leorize: I can see why KingDarBoja: videofile: you there bro? Gary M: so uh, I'm linking to a vulkan dll on windows like {.link: """C:\Windows\System32\Vulkan-1.dll""".} but hard coding the path feels wrong Araq: inv2004, try with --gc:arc and somehow fight the seq implementation not to auto-initialize the memory Araq: good night leorize: add {.noInit.} to the function and see if it's faster leorize: @Gary M: I don't think you even have to link inv2004: --gc:arc has some conflict with threads. .noinit. to the var line did not help also, and I did not expect it would help leorize: I mean `{.noInit.}` to the function declaration itself :) leorize: it will prevent the `result` variable from auto initializing inv2004: ah, ok, but I am not sure that one allocation takes all the time Yardanico: did you profile it? Yardanico: to see which takes the most time Yardanico: *what inv2004: not yet, did not profile in nim anything inv2004: but pretty sure it is readline Yardanico: well the simplest way is to just use "perf" if you're on linux leorize: inv2004: genericReset is a creepy performance killer leorize: and it's implicit for result variables leorize: though we should probably ping @mratsim, as he is the perf king inv2004: leorize, just googled it "Always use a main proc" interesting leorize: I consider it really wrong when the C++ version is more readable than the rust one inv2004: leorize, a-ha-ha, I pointed it also. My main "rust" idea was to use generics for primitive types, for hashtable for u8 u16 and u32 is a bit more affective than plain u64 solution. And it worked. inv2004: ... effective ... irc :( inv2004: C++ do this optimization for hash by templates, I am pretty sure it is very hard to beat it with any other's languages' hashtables inv2004: anyway generics helped a bit even in rust's implementation leorize[m]: well Nim can do that kind of optimization too :) awr1: is `export except ` valid Yardanico: I think so awr1: i know `export ` is valid Yardanico: !eval import sequtils; export sequtils except mapIt inv2004: leorize[m], wrapping in main did not help, but it would be too easy NimBot: awr1: thanks! awr1: bitops disappoints me...no varargs bitor/bitand leorize[m]: maybe write one and pr it in? :) awr1: good idea leorize[m]: inv2004: you should try to profile the Nim version. Build with debuginfo `-g` and -d:release and you can use pretty much any C profiler to profile the program inv2004: yes, thank you, it is clear, I will try zacharycarter: does anyone have any idea how difficult it would be to make the compile pragma invoke different backends based on file extension? shashlick: it should already right? awr1: if it doesn't already, you could do a macro leorize[m]: it probably doesn't know about objc awr1: ahhhhh awr1: i see awr1: hm awr1: you should raise an issue imo zacharycarter: yeah apparently it does not zacharycarter: I will - I'll see if I can fix it first though shashlick: you could just compile it manually and add it to the link call zacharycarter: link the object file? zacharycarter: I don't want to actually build any library from the code zacharycarter: it's like three single header libs - two need to be compiled with objc and the other needs to be compiled with cpp KingDarBoja: Well another power outage KingDarBoja: I am back! KingDarBoja: I just noticed that the manual uses `divmod` as example but can't find it on the search, only div and mod as separated Varriount: @KingDarBoja How are things coming? KingDarBoja: So far so good, been passing tests and doing well, still need to see if I can replace the Options by multiple procs KingDarBoja: What about you? KingDarBoja: Just took a break to finish my CV on english Varriount: I've successfully converted Go's filepath module to Nim, however I'm still going through it to make it idiomatic Varriount: CV? Varriount: Curriculum Vitae? KingDarBoja: Curriculum Vitae KingDarBoja: That's sounds cool! KingDarBoja: Haven't tried GO but looks like a nightmare to work with Varriount: Eh, it's not too bad. My biggest complaint is the lack of good code-generation tools Varriount: Go is kinda the opposite of Nim, in that in relies quite a bit on runtime type information. KingDarBoja: Wait, isn't supposed to rely on compile time? Varriount: Which is fine, it means that it's quite easy to work with varying types, however there's a performance cost for such things. KingDarBoja: I thought it was statically typed and also compile time checks were made Varriount: Yes, but it's polymorphic dispatch mechanisms rely heavily on runtime type information. Rika: interface{} Rika: or whatever its called Varriount: @KingDarBoja For example, if you were to write a JSON serialization procedure in Nim, you might use a macro to generate the struct->json logic at compile-time. In Go, you use type information available at runtime. KingDarBoja: My internet is trash right now Varriount: University internet? KingDarBoja: No, home internet, thrid world internet lol videofile: hello videofile: why is & the concat operator instead of + Rika: because + is for arithmetic Rika: & makes more sense cognitively does it not videofile: yeah, but curious why the distinction between strings and arithmetic Rika: have you ever arithmetically added a string? videofile: well, is most of the languages I've used (which is not tens of them), '+' is overloaded to support strings by default :) Rika: it should cause less confusion regards js' '0'+1 == ???? videofile: because nim syntax seems to resemble py a lot videofile: oh Rika: it RESEMBLES python Rika: thats it videofile: weak typing is a sin anyway videofile: pls resemble it moar xD Rika: there are limits Rika: like that & operator videofile: I assume this has to do with compiler right videofile: not a willful choice maybe Rika: i dont think + is a great idea for strings anyway Rika: no videofile: ok all is forgiven! Rika: its a willful choice im pretty sure Rika: the & videofile: heretics videofile: >:( Rika: you'll grow to love it videofile: I hope so! Rika: i never liked adding strings Rika: btw what happens if i play you in a media player Rika: what shows up 😛 videofile: true, but with a little stretch of imagination (I remember my java class), you can assume adding == concat videofile: I play darude-sandstorm :P Rika: hm anyway if you need more help just ask lol videofile: yessir videofile: just woke up from a nightmare so I decided to continue learning nim \shrug KingDarBoja: lol videofile: I hope you're not implying i jumped into another nightmare haha videofile: ouch that's too deep videofile: do you guys see nim replacing C in the next decade, instead of golang? videofile: not entirely videofile: as much as realistically posible KingDarBoja: Errr Rust is supposed to replace C (?) Rika: not really MapleSyrup: @Varriount hello KingDarBoja: Variount, Maple has issues with unicode MapleSyrup: is nim handling of unicode similar to runes in golang? @Varriount Rika: i dont see Rust replacing C either Rika: @MapleSyrup yes Rika: we also call them runes at leeast videofile: go too I guess Rika: import the `unicode` module and read the docs videofile: and that's where the similarities end?? Rika: no clue if thats where the similarities end videofile: okok, I just hate having to handle unicode Rika: https://nim-lang.org/docs/unicode.html videofile: unicode can go off itself Rika: unicode is a blessing videofile: s/unicode/unicode handling Rika: imagine needing to handle 15 different encodings for 15 different languages Rika: that would be much worse dont you think videofile: did our grandparents do that? videofile: before unicode Rika: japanese had 2 major encodings for its one language before videofile: oof videofile: I hate python2's unicode stuff but yeah Rika: i think its easier in nim Rika: since nim is so damn flexible Rika: man i love it videofile: I hope I will find it like that for me too KingDarBoja: Python 3 handles unicodes and ASCII under the hood videofile: tired of switching languages man KingDarBoja: So devs haven't to worry about it videofile: yeah, that's python3, but python2 SUCKED at it Rika: i was sick of python's lack of static typing, so i was pretty much hooked on to nim from the start KingDarBoja: That's why Python 3 came out videofile: had a TON of issues porting python2 unicode stuff to 3 KingDarBoja: I get sick of that typing support too videofile: Rikaaaaaa Rika: eyyo KingDarBoja: That's why I code on TypeScript instead of JavaScript videofile: the number of times I had to do type(reference) to find out what was in that was too damn high in python lol Rika: lmao videofile: King why do you js? videofile: web stuff? Rika: `if type() is int: do this else: do that` Rika: maybe its their main language videofile: looks hacky amirite Rika: you can still do it in nim Rika: its just on compile time KingDarBoja: Yeah KingDarBoja: But jumped right inot Angular/TypeScript at my current (and first) job Rika: `proc a(something: int or string) = when a is int: do this else: do that` videofile: hmmmm Rika: oops, something, not a KingDarBoja: lol wut videofile: wish generics was more flexible videofile: oh I see videofile: so where do you use nim then king videofile: hobby stuff? Rika: i dont see what you mean by "wish generics were more flexible" Rika: theyre pretty damn flexible KingDarBoja: I always get triggered by union types on proc xD videofile: was thinking of golang KingDarBoja: As I am noobish handling that videofile: union types videofile: say what KingDarBoja: Yeah, hobby stuff, I discovered Nim because someone wanted to change the old Nim icon with the new goldish one Rika: `int or string` is a union type i think videofile: oh thus began your headfirst dive into nim eh? videofile: ah ok rika KingDarBoja: And I started to read the website and I thought it was going to be way better than Python due to its static typing videofile: idk why but your name sounds pokemon-ish KingDarBoja: Yeah, what Rika-sensei said, union types aka `or` `|` videofile: I guess dynamic typing is a plus for beginners? videofile: hehe KingDarBoja: That's why Python is so popular KingDarBoja: Because it is so high level and pretty much anyone can jump into Python and do stuff KingDarBoja: Like data science, web development, etc videofile: true, I felt like I was invincible when I picked up python haha KingDarBoja: Bu try using it for mobile development videofile: mobile dev be damned lol KingDarBoja: Or making it optimal for embedded systems videofile: if nim covered data science and ML stuff, it would be much more versatile than python for sure Rika: arraymancer videofile: just curious, is the mentioning of type after identifier a consequence of having 'dynamic typing' in nim? videofile: yeah I saw the latest benchmarks, really good but we're not there yet Rika: what do you mean videofile: variable_name string Varriount: videofile: It's a consequence of Nim being statically typed. videofile: instead of string variable_name Varriount: Oh, before or after, that's just a syntactic difference. videofile: doesn't C do it the other way around? videofile: oh that's odd videofile: because iirc the golang creators provided that as a justification for having to mention the type after the identifier videofile: compiler limitations videofile: type inference != dynamic typing? Varriount: Hm, I don't see how that impacts things. Rika: yes Rika: !- videofile: at least by some stretch? Rika: !=* videofile: why not videofile: is dynamic typing run-time only? Rika: type inference doesnt allow you to change the type after assigning Rika: dynamic does videofile: ah silly me Rika: dynamic doesnt care what kinda type you put into a var Rika: you can put whatever, before or after assignment videofile: aaand that's where the bugs hide KingDarBoja: Lol I distract a little to play music and this happens videofile: what happens videofile: and what music videofile: and why distract KingDarBoja: Discussing about GO lol KingDarBoja: Playing the weekend - michael gray videofile: GhOst has GO in it Varriount: It's just "Go" or "Golang" KingDarBoja: Cuz I want the next weekend to start videofile: oh I thought you were playing a musical instrument, my bad KingDarBoja: I type GO because the icon lol videofile: go GO videofile: I haven't really checked out nim logo brb videofile: it's either a crown or a bearded guy with a crown KingDarBoja: A crown KingDarBoja: A goldish crown videofile: no man? KingDarBoja: Nope, it is REX logo videofile: what it mean videofile: happy monday everyone KingDarBoja: It's 11 PM here videofile: happy monday in 1 hour KingDarBoja: 😄 videofile: so...why was it called nimrod KingDarBoja: Same question videofile: Rikk videofile: oh and btw where can I find count of total num of nimble packages videofile: total num of packages on nimble to be specific Rika: parse the nimble json packages file lol Rika: theres a little over a thousand videofile: I havent even written a single line of nim yet... videofile: ok videofile: ! KingDarBoja: https://github.com/nim-lang/packages/blob/master/packages.json KingDarBoja: I was going to suggest the same lool videofile: tyty KingDarBoja: Use json module videofile: I do not like this increasing dependencey of langs on github, just a pet peeve of mine videofile: :/ KingDarBoja: The best way to start learning is by reading the tutorials and using the playground 😄 videofile: im a quarter through the Nim in Action book videofile: anyway I can parse webcam feed in nim? videofile: manipulation of web cam feed, rather Rika: well, whats the feed in? Rika: and how is it sent videofile: uh video stream? videofile: just hoping there's a lib out there to interface with my laptop webcam Rika: dont know videofile: :) videofile: *:( videofile: is it ok if I can only donate $10? videofile: no income atm and basically subsisting on ramen rn :P Prestige: Take care of yourself first videofile Rika: sure why not but think about it first videofile: nothing has made me so excited in quite a while KingDarBoja: Lol calm down, first live then help others KingDarBoja: Also, got another power outage... Again videofile: okok once Im back on my feet videofile: power outage?? KingDarBoja: Probably going to have a bad night again KingDarBoja: Yeah, energy is off at my neighborhood videofile: is it common? in my area I've never had an outage....yet videofile: custom array ranges sounds so unique videofile: I think the name nimrod is applicable here leorize: custom array range is something taken from pascal I think videofile: ohh good to know! videofile: it really seems like nim has cherrypicked a lot of good stuff from many langs leorize: that's how many started videofile: true videofile: but this particular collection seems a bit dare I say..eclectic videofile: a touch more than other languages videofile: it's like a huge sandbox videofile: oop, fp, imperative, you do whatever you want yadda yadda leorize: well everyone else wanted to be a C replacement Prestige: Is there a place to look up x11 code docs leorize: usually giving up is a good option :P Prestige: I can see declared types and such in nim (for the wrapper) but no actual documentation Prestige: eh I'm no good at that leorize: but there's a huge set of man pages for them leorize: it depends on what component of the x11 wrapper do you use leorize: yea, the x11 module is just a wrapper KingDarBoja: I live on Colombia, South América, it's pretty common here KingDarBoja: And every language always try to pick the best thing leorize: well "best" is subjective leorize: that's why we ended up with so many different ones videofile: I love me some competition KingDarBoja: Yup silvernode: Well Here I am working on Space Nim again. I got a 2d grid going and my character type has x and y coordinate properties. Time to larn how to plot my character and space stations on the grid and add boundries so that th playr cannot go off grid Prestige: leorize: I've just been reading https://tronche.com/gui/x/xlib/introduction/overview.html to get an idea of what these types/classes are silvernode: learn* videofile: hey why is https://github.com/VPashkov/awesome-nim archived? videofile: nothing awesome in a while or what KingDarBoja: Let's go older and code on Perl leorize: videofile: probably the author don't want to maintain it anymore videofile: aww that sucks videofile: would be nice if it were updated silvernode: player.x += 1 and player.y += 1 is the basic concept for moving around but at this point it is arbitrary and not connected to the grid at all. I am trying to think of how I would tie everything to the grid. Any good websites to go read just so I can at least get the basic concepts down? videofile: no idea how to do that but can I have a look at your source code, if it's open source? videofile: first time hearing of a game in nim Rika: tie everything to the grid? silvernode: videofile: yeah I will give you the github link Rika: id do this: A position type, with the position fields ofc and a ref to the grid Rika: the grid type doesnt have to be ref, but whatever field itll be in on the Position type should be a ref Grid Rika: then you can make a move proc that takes a Position, and refers to pos.grid[].bounds or something like that Rika: of course, check if grid is nil too silvernode: Rika, hmm, I never thought of a type for position KingDarBoja: It should be like Coordinates KingDarBoja: Position stores x, y Rika: yeah name it Position or Coordinates silvernode: videofile: https://github.com/silvernode/space-nim/tree/experimental videofile: ty KingDarBoja: Then ofc the grid should be an array of positions silvernode: I have code that hasn't been commited yet but I removed the location property of the Character type and added x, y silvernode: All of my types are in the entities file KingDarBoja: You could try to read the CS50 course on Game Dev, it has good suggestions :) KingDarBoja: On Harvard website, it is free yo access KingDarBoja: To* silvernode: Oh nice KingDarBoja: It is called Game development using Love (Lua 2D frameworks) videofile: starred repo very nice KingDarBoja: I think. videofile: love2d? KingDarBoja: But the explanation is pretty much what you looking for on Game Dev design KingDarBoja: Like colissions, grid, etc silvernode: videofile: Love2d is awesome but I really want to make a text based game in nim silvernode: Taking notes of people's suggestions here KingDarBoja: I have several notes but will share tomorrow KingDarBoja: As still have no energy hence no pc silvernode: About to commit the stuf I just wrote so that you can all see where I am at right now. I am still learning programming in general btw Rika: im just here improving my image dithering program 😛 silvernode: Pushed changes to experimental branch silvernode: I basically added early movement KingDarBoja: Oww silvernode: but a lot of work needs to be done in order to actually do this on the grid. KingDarBoja: Scrap z axis and go full Gravity Zero silvernode: just getting down the concepts right now. Makes me feel dumb at programming lol KingDarBoja: XD joking silvernode: :) silvernode: ugh, well as some of you might know, I generally work on this game while waiting to clock in at work. Sadly it is time for me to clock in. Thank you all for the suggestions. ttyl silvernode: I'm off the next 2 nights after this though videofile: goodbye Rika: what do yall recommend for CLI interfacing? is parseopt good enough? leorize: iffy/nim-argparse or c-blake/cligen Rika: which is better in your opinion videofile: i dont quite understand blocks in nim Rika: theyre just like "if True:"s in python Rika: whats there to not understand? videofile: nono videofile: the breaking out of nested loops using block labels Rika: break label will jump to the end of the block w/ the label videofile: but you have to indent after the block right? videofile: just confirming Rika: yeah because its like if True: videofile: oh thats what you meant videofile: gotcha Rika: block label: (since theres a colon, next line must be indented videofile: +1 videofile: is there no namespace prefix for imports? Rika: no need videofile: why not videofile: creates confusion :/ Rika: not really Rika: from experience, it doesnt Rika: if you want to force it do `from module import nil` videofile: if I see os.walkFiles, I'll know quickly that it's from the stdlib! Rika: you can also use it with `import module` but its not forced then videofile: oh it's optional then? Rika: yes videofile: that's nice videofile: very flexible Rika: 😛 leorize: @Rika: it depends on what you want Rika: what does it depend on? leorize: just look at both module leorize: one let you quickly prototype leorize: the other let you carefully craft your cli experience :P Rika: okay Rika: ill go with the carefully craft one videofile: lol having levenshtein dist is so random haha videofile: is mixing of datatypes in a sequence only possible in dynamically typed langs? videofile: like i cant do discard @[1,"a"] narimiran: videofile: use json for that videofile: oh nice KingDarBoja: Yeah KingDarBoja: But not willing to use json as better keep using the same type on the sequence videofile: ah ok makes sense videofile: was just cruoius videofile: curious videofile: wow im butchering spelling which means i should probably sleep videofile: https://robert-mcdermott.gitlab.io/posts/speeding-up-python-with-nim/ is very interesting! videofile: WAIT KingDarBoja: It is good but still as every post, it talks about benefits but not contras videofile: you can disable the gc entirely? videofile: contras? videofile: contras == cons? videofile: ok gonna nap videofile: gnight KingDarBoja: Same, good night myphs: hello everyone: can i pass variables from a template to the body without declaring them in the calling block? Rika: ? Rika: Declare the template as dirty Rika: {.dirtt.} Rika: Oops, dirty myphs: is this documented somewhere? myphs: probably nooby, but this explains it, i hope: https://play.nim-lang.org/#ix=2hOJ myphs: the syntax is wrong of course narimiran: try with `for i {.inject.} in 0 .. nr` solitudesf: https://play.nim-lang.org/#ix=2hOL narimiran: or simply as that :) myphs: interesting! thank you a lot, solitudesf! i had something similar, but `iter: int`. why wouldn't that work? myphs: * had tried solitudesf: because you need to pass identifier, not value Benumbed: Anyone know off the top of their head if Nim keeps track of the EOL characters for the current platform? Benumbed: I'm writing a lexer and would rather just reference something provided by the compiler to find line endings if I can Rika: maybe look at the `lexbase` module Rika: @Benumbed Benumbed: Yeah unfortunately it's a static const in there 😦 Benumbed: was hoping for platform detection, but looks like I'm out of luck Zevv: Benumbed: it might be the best to be newline agnostic, just make sure you accept both Zevv: because on platform X you still might want to ingest a file created on platform Y Rika: also i am not sure of any platform that isnt either crln or ln Benumbed: But I liiiike throwing errors at the people who write files in Windows.... 😾 Rika: i mean crlf Zevv: Benumbed: well you can just properly lex all newlines and still throw random "Unknown error" message every now and then Benumbed: lol I like you Zevv you're alright 😄 Zevv: yeah, that's what I always say. Rika: how do you use lexbase anyway... Rika: theres not much instruction on how Zevv: mumble mumble npeg mumble mumble narimiran: !repo npeg Zevv: disbot is dead, long live disbot Zevv: he's in lockdown together with disruptek. They both come out ravingly mad, I bet Benumbed: annd the sneaky case non-sensitivity just bit me in the ass >.<, albeit lightly Zevv: well, if you're new to Nim you're allowed to complain about that for the first few days. But after that you should just keep silent and take the pain like a man. Benumbed: why not take it like a woman? Benumbed: They're far better at pain management after all 😄 Zevv: fair enough dzamo[m]: 098poiPOI)(* Benumbed: Also, this is the first time it's bitten me, up until this point I haven't used anything name-wise to cause me to notice it Zevv: @leorize ping kodkuce: dom96: @dom96 can i steal your parseMultiPart from utils jester, will comment "Stolen from dom96" am trying to make a simpleHTTPserver like pythone one and kinda sux for it to depend on jester, plan to copy paste your proc and hack it little cuz i dont want table as result Rika: @Benumbed what did you type to make it bite you Rika: its never bitten me Rika: @kodkuce you can base on httpbeast Benumbed: @Rika I had a struct in one file named 'Streamer' and created a variable in a file that imported it called 'streamer' Benumbed: Compiler said "NO" and slapped me Rika: it should be okay Rika: since Streamer != streamer anyway kodkuce: httpbeast is only linux, i allreayd got all working just mising multpart and dont really want to read whole rfc to parse it myself xD Benumbed: Tell that to the compiler 🙂 Rika: its legit Rika: https://play.nim-lang.org/#ix=2hPz works Benumbed: oh wait no, it's more likely the module name Benumbed: which is also 'streamer' Rika: thats the issue there 😛 Benumbed: It's very late, and I am tired Benumbed: Waiting for my damn sheets to dry so I can go to bed Zevv: yeah. speaking of which, what is the type of 'streamer' here then. I can't echo it. I can't repr it. I can't typeof() it. Zevv: What is it then?! Benumbed: No idea Benumbed: Technically it's a module Benumbed: But modules are not a type Rika: i just echoed the repr of streamer in the link i sent Rika: what do you mean Rika: or do you ask benum Zevv: I guess it's kind of rhetorical Zevv: although I do not know the answer. It's something voidish, but not quite Zevv: https://play.nim-lang.org/#ix=2hPB faulander: question: if i use locally declared variables in an imported proc will that work? narimiran: nimporter is on HN frontpage: https://news.ycombinator.com/item?id=22850374 kodkuce: i have no hw acount to spam 🙂 narimiran: and let's keep it that way ;) __ibrahim__: I was looking for some guidance on using nim without GC for realtime 3D rendering. __ibrahim__: the only thing I could find was this: __ibrahim__: https://rosettacode.org/wiki/Pointers_and_references#Nim __ibrahim__: is it better to use `--gc:arc` than `--gc:none`? Recruit_main707: gc:none wont let you use a lot of things such as echo() or slices or strings or sequences, arc is already fast enough i think narimiran: use `--gc:arc` __ibrahim__: ok cool, no need for memory management! yay __ibrahim__: ok cool, no need for manual memory management! yay kodkuce: @__ibrahim__ you making some game engine or what? demotomohiro: if I remember correctly, Nim's gc works only when you try to allocate memory __ibrahim__: @kodkuce well, i really like opengl directx and vulkan, so i am playing around with opengl for now to make nice stuff, then i want to add animation and maybe then some physics etc... so it may end up to be a miniature game engine. thats why i am asking if i should use manual memory management. __ibrahim__: but the main goal is to do rtx raytracing in real-time kodkuce: smart wize i cant help you i am moste uneducated person here 🙂 , tough should play more with vulkan guessing it is the future, 1 day i want to try to make a Game engine but i am long long long looooong awya form that __ibrahim__: i am new to nim too and been only coding for 2 years. __ibrahim__: i only drew my first opengl triangle by porting this tutorial to nim: __ibrahim__: www.learnopengl.com Recruit_main707: its a good start __ibrahim__: thank you very much, and nim has such nice syntax it was really easy porting the "ugly" c++ source Northstrider: https://github.com/nim-lang/Nim/blob/devel/compiler/extccomp.nim#L94 What is "nintendoSwitchGCC"? A joke? clyybber: Nope clyybber: Its a platform nim can target Recruit_main707: its for creating nintendo switch games lol Northstrider: Oh, fair faulander: can someone tell me, why this code doesn't work? https://play.nim-lang.org/#ix=2hPO Recruit_main707: it seems to work even in the playground __ibrahim__: here is the opengl triangle if anyone is interested: __ibrahim__: https://pastebin.com/NTBesm5M faulander: @Recruit_main707: It should only return the last path part, not the whole path, right? Recruit_main707: idk about that then :p faulander: (https://files.gitter.im/nim-lang/Nim/tpft/image.png) faulander: This is what it should return, but it returns the whole string. Asmodeus: Doesn't seem to handle windows paths very well __ibrahim__: you're right, it worked perfectly with "/" faulander: yes, it works with *nix paths, but not with windows __ibrahim__: maybe create a replace proc then last path part then revert to original faulander: yes, i'll write my own proc, but the function should still work. where to i post a bug report? faulander: to = do Rika: I think it only works with windows paths if you run it in a windows target Recruit_main707: makes sense i guess kodkuce: can i do html alert whout js? Asmodeus: Oh hey think I found the commit where the pascal source was converted to nim Asmodeus: https://github.com/nim-lang/Nim/tree/e254741541b0389dfb0b675116c76a6a144b90b7 Recruit_main707: ive seen this on the nim official page: Recruit_main707: `Macros cannot change Nim's syntax because there is no need for it — the syntax is flexible enough.` Recruit_main707: is it completely true? and why not? Recruit_main707: id say it would be a cool Recruit_main707: feature faulander: @Rika: i AM running on a windows machine Recruit_main707: !test echo("is this working?") Recruit_main707: nope Asmodeus: Heck, comments are included as part of the nim grammar? I thought they were usually filtered out during lexing Rika: it's eval Rika: not test Rika: !eval echo "nice" NimBot: nice Rika: and also yes, you cannot change Nim's syntax (as in the structure); you can exploit it, though Rika: faula...: then damn i dont got a clue Rika: @Asmodeus comments are stripped from parsing, theyre not part of the AST Rika: only doc comments are part Rika: you can put comments anywhere, but not doc comments Recruit_main707: i dont understand this: https://play.nim-lang.org/#ix=2hQ5 Asmodeus: @Rika What are the COMMENT fields in https://github.com/nim-lang/Nim/blob/devel/doc/grammar.txt ? Rika: part of the lexer Rika: im pretty sure thats part of the lexer Rika: @Recruit_main707 a is a set containing the type int16 (or an int that can range from 0 to 65535) Asmodeus: @Rika ah looks like the parser handles it https://github.com/nim-lang/Nim/blob/devel/compiler/parser.nim#L319 Recruit_main707: @Rika does it work like in c++? Rika: wdym? Recruit_main707: i know very little about cpp, but ive seen some things like `{12, 21, 32}` Rika: thats an array Recruit_main707: oh, ok faulander: same problem with splitFile, doesn't work on windows: https://play.nim-lang.org/#ix=2hQa solitudesf: faulander, works fine under wine livcd: faukabder: probably it gets treated as linux path in playground? dom96: kodkuce: you should learn about software licensing faulander: yes, it does. but i used a hardcoded windows path dom96: Jester is MIT kodkuce: ye i know kodkuce: but i am polite kodkuce: 🙂 faulander: @SolitudeSF but it doesn't in the playground, neither on my windows machine livcd: faulander: What do you mean by "hardcoded windows path"? It works fine when executed locally kodkuce: and ofc wanted to harass you for explanation for some parts xD kodkuce: anywya i go now on run while there is still sun outside faulander: @livcd: with hardcoded i mean i gave a string as argument like: var fullFile = r"c:\users\xxx\Pictures\2019 - Scotland the beautiful\img-001.jpg" faulander: just try this playground: https://play.nim-lang.org/#ix=2hQa livcd: faulander: that code works on my windows machine faulander: @livcd: it doesn't on mine :) livcd: faulander: and are you on Windows? livcd: https://play.nim-lang.org/#ix=2hQq faulander: you are using "/" as DirSep, which is *nix, Windows uses "\" faulander: as i mentioned, it works on *nix faulander: i already wrote my own proc for it, it still is strange faulander: my own proc works btw, on *nix and Windows livcd: faulander: right I am just telling you I get the same output on Windows with "\" as I do with "/" on *nix as shown in playground livcd: faulander: i am on 1.2.0 faulander: wait ... does it make a difference which shell i use to run the program? faulander: i am using git-shell inside visual studio code, how does the os module gets the DirSep constant? faulander: and why doesn't it work in playground if i use the hardcoded windows path? Rika: because nim doesnt distinguish the target os with the string you pass in Rika: it does matter, since git bash essentially tells whatever programs it runs that the os is not windows Rika: nim doesnt care what string you give it, it doesnt use that to check what os its on when it compiles Rika: faulander ^ forgot to ping faulander: ah ... ok, i try powershell as shell in visual studio faulander: on cmd i now get: C:\Users\xxx\scoop\apps\nim\current\lib\core\macros.nim(557, 8) Error: undeclared field: 'exe' audiofile: hullo audiofile: 👑 faulander: any clue what the macros error means? alehander92: you need a traceback alehander92: it probably comes from alehander92: some code that is expanded using a macro audiofile: tf is a gitter faulander: @alehander92 how do i get a traceback? i still have to say sorry, i am into nim since 3 days and still used to python. traceback is automatic there. arnetheduck: `nlvm` at 1.2, and llvm 10 clyybber: nice livcd: faulander: are you trying the same code? audiofile: PMunch whoa is this you? https://news.ycombinator.com/item?id=21057751 amazing answer :D livcd: faulander: dont you have a typo somewhere for ext/exe ? faulander: found it. livecd you're a genius. livcd: faulander: You have a typo in my handle. It's livcd not livecd. PMunch: audiofile, haha yes that's me PMunch: And thanks :) audiofile: was referenced in https://www.zdnet.com/article/python-inspired-nim-version-1-0-of-the-programming-language-launches/ if you're interested in seeing how far it's gone! PMunch: Oh fun :) faulander: @livcd: With our without 'e': genius, i said to you, not to me ;) arnetheduck: Sure, if you stay with 1.0, programs won't break 😂 audiofile: discord peeps if you see this say hi alehander92: @faulander sorry alehander92: it is only automatic alehander92: if you compile for debug mode alehander92: i think alehander92: and macros expand on compile time, so this kind of traceback is alehander92: a bit different alehander92: do you have an example we can run jorjun_twitter: Any wisdom on threejs and nim? Can I easily target a three.js canvas with a nim setup? Rika: we can hear stuff on discord, just not send (we can here, not in nim offtopic) PMunch: jorjun_twitter, shouldn't be hard Rika: because the bridge is still funky over there PMunch: You can tell Nim code to run JS functions, so you can just use the three.js functions directly jorjun_twitter: @FromIRC Very new to nim and going thru the exercism track right now. But if there is any small sample I can peak at.. I wouldn’t know where to begin right now krux02: @jorjun fromIRC is not a user, it is a bridge krux02: it is a bot sending stuff that is written on IRC krux02: my user name is krux02 jorjun_twitter: gathered that from the bot message krux02: ok krux02: I don't see that bot message krux02: are you on twitter? jorjun_twitter: I edited my message, but that didn’t work. Yep @jorjun krux02: interesting, because I see your message from as FromGitter and then with the username krux02: double indirection jorjun_twitter: Currently using Mac OS X Gitter client, authorised by my twitter a/c jorjun_twitter: More convenient option ? krux02: not really. krux02: I just use IRC. krux02: I recently was on the Telegram Nim channel (that one is unconnected), and it is too much visual communication for me. krux02: I prefer pure text. krux02: but it is a mess. krux02: whenever somebody posts source code on gitter, it is really ugly to read here. krux02: and when I post source code, I put it on a pastebin service (ix.io), because IRC isn't made for large messages. krux02: IRC even actively slows you down if you post too fast. It is to prevent spammers. jorjun_twitter: maybe discord is better for not spamming others… can’t see other channels in here. krux02: I really do like IRC, because it is one fast ancient client that works for many opensource projects. krux02: And when I have a question, I can just enter the channel. krux02: I mean Discord really gains popularity recently. But it is closed source software. jorjun_twitter: ooh long time since I fired irc up. But I am receiving a strong hint .. :D [ going to look at client options ] PMunch: krux02, on gitter is fine, we just get a line and a link from that. It's the Discord bot which is the problem dom96: how's everybody doing? PMunch: I'm doing fine :) Just got back from a little Easter getaway, but I think I slept weird because my back is hurting like a motherfucker.. sealmove: Guys, currently I am using `string` instead of `seq[byte]` because the procs in `streams` module work with `strings` and do not have equivalent procs for `seq[byte]`. In reality I am fiddling around with sequences of bytes. The string representation often does not make sense for my data. Is it "correct" to keep using `string` despite this, or should I make wrappers for the procs in `streams` module and start using FromGitter: ... `seq[byte]` instead? PMunch: jorjun_twitter, here is a super minimal example from the docs: https://nim-lang.org/docs/backends.html#nim-code-calling-the-backend-javascript-invocation-example sealmove: PMunch :O getaway? PMunch: It should at least point you in the right direction in regards to how to call JS functions from Nim. PMunch: sealmove, 45 minutes by car out to a cabin in the middle of no-where :P sealmove: that's still great nord501: https://www.youtube.com/watch?v=4o_tmccinds - Exporting C APIs from Zig, D, and Nim Rika: nice, did you make that? PMunch: sealmove, yeah I thought you were criticising me for travelling during the pandemic :P sealmove: nah, just jealous krux02: @jrjun: All clients to IRC are crap. None of them give you this straight forward experience that you are used to by modern applications. krux02: But if you get used to ignoring the UI and just use the commands, then they are all the same and usable. dadada: irssi is not crap clyybber: weechat isn't either clyybber: but yeah both have commands as the main interface zetashift: HexChat worked fine for me on Windows, the server configuration etc where the only thing I had to figure out kungtotte: For a non-op user, the only commands you ever use are /connect, /join, /part, /quit, /msg, /me, and possibly /ignore sealmove: So anyone has an opinion on what I wrote above? :3 kungtotte: Connect can be skipped if you set up auto-connect Rika: i use string instead of seq[byte] and have had no issues PMunch: sealmove, I tried to have seq[byte] accepted into the stdlib, but I tagged it onto some other features that people didn't like.. PMunch: But you can cast between string and seq[byte] just fine Zevv: *for now* PMunch: For now? Zevv: strings are not seq[bytes] for a reason dom96: Yeah, I would avoid doing this dom96: Things might change between Nim versions or implementations of Nim Rika: what would you recommend for the missing procs then? clyybber: maybe we should add a stringtoSeq to the stdlib then Zevv: the implementation is not guarenteed to be castable forever. I once got started moving short strings on the stack, everything up to 15 bytes does not go onto the heap then. Rika: if something changes then thats for sure on a 2.0 and not a 1.4 up no? clyybber: so as to abstract the cast away Zevv: never finished it, though Rika: clyybber you can always do toSeq().mapIt(it.byte) (is it byte??) or something no? clyybber: Yeah, but a cast is faster I think sealmove: if I made wrappers I would do `.mapIt(it.byte)`, but should I? Performance-wise it's bad, but using strings also feels wrong... clyybber: I'm not sure its bad. Measure it I guess. clyybber: Both should do a copy clyybber: sealmove: The best you can do currently is make yourself a stringToSeq proc in which you abstract the cast/mapIt away krux02: clyybber: I would not disagree to support conversions like ``seq[byte](myString)`` and ``string(myByteSeq)`` clyybber: Hmm krux02: but don't introduce new names to Nim. Especially not in system.nim sealmove: krux02 yes!! I'd love this clyybber: krux02: Yeah, I wouldn't like a new name either clyybber: Maybe a converter really is best here? dom96: krux02, that would be a great feature dom96: clyybber: no. Implicit conversions are always risky clyybber: True Zevv: The current implementation would be free tot do a copyMem(), as long as the binary representation is the same, and any future implementations can do the Right Thing what that changes. Zevv: /when that changes/ clyybber: dom96: I forgot that converters enable implicit conversion clyybber: I was thinking about a way to enable this via a system.nim addition, rather than a compiler patch krux02: clyybber: builtin type conversions always require a compiler patch clyybber: Not really clyybber: Assuming we could restrict converters to explicit conversion only krux02: In Nim? yes. krux02: C++ has type conversion operators, but you can't create them for builtin type to builtin type conversions. sealmove: `seq[byte](myString)` not working is just a limitation. There are no drawbacks for enabling this. sealmove: Even if it needs a compiler patch I think it's worth it. sealmove: And also additions to `streams` module are also good idea I think PMunch: Zevv, wouldn't that be useful for seqs as well though? The short strings on stack thing sealmove: for example we have `newStringStream` sealmove: why not have `newBytesStream` or something? sealmove: `newByteStream` * Zevv: PMunch: as long as it is seqs of very short things. Seqs and string (at least in ARC) now have two longs on the stack: one is the capacity with some flags, the other the pointer. This little block could be used to hold string data by adding a 'short string' flag bit and then using the leftover bytes (15 on x64, 7 on x86) for literal data Zevv: so for seq[byte] it would make sense, but not for seq[SomeObj], usually PMunch: Oooh, that would be a neat optimisation indeed PMunch: But yeah it would make sense for SomeObj as long as sizeof(SomeObj)<=[15|7] KingDarBoja: https://github.com/epiphone/serverless-nim Zevv: anyway, I looked into this once but Ar4q discouraged me and told me to go fix slicing Zevv: which is of course way over my head so I never got anywhere arnetheduck: short strings: https://github.com/elliotgoodrich/SSO-23 arnetheduck: what we do for `string<>seq[byte]` conversion: https://github.com/status-im/nim-stew/blob/master/stew/byteutils.nim#L144 (specially tostring is onerous because of the null byte requirement) Recruit_main707: audiofile: about the offtopic conversation, if you know enough about flatbuffers and think you can use them on nim, i also have a request :p audiophile: sorry, first time hearing of it! :( Recruit_main707: not blaming you Rika: its like the sister of protobuf no? Rika: sounds interesting Rika: im no pmunch but maybe ill try it out some time PMunch: Hih? Recruit_main707: i think its actually older, (not sure at all) Rika: whoops, irc lol PMunch: Haha :P PMunch: I like to know when I'm mentioned Recruit_main707: also, making some noise in here would be nice guys: https://github.com/google/flatbuffers/issues/5855 PMunch: Feel free to shamelessly copy from the protobuf module if you want to implement flatbuffers Recruit_main707: the protobuf nim module? Rika: PMunch: ooh can i? TuT PMunch: Recruit_main707, yes Rika: @Recruit_main707 ill try working on it tomorro PMunch: Rika, of course, it's MIT :P Recruit_main707: @Rika there is a flatbuffers implementation for nim, but it cant parse .fbs files to my known Rika: PMunch: actually, why aren't you making one? Rika: what is an fbs file PMunch: Rike, never had the use for one Recruit_main707: https://github.com/RLBot/RLBot/blob/master/src/main/flatbuffers/rlbot.fbs Recruit_main707: and then, the thing is that this gets transpiled for nim to be used Rika: i am now Rike PMunch: I mostly make modules that I think I'll need :P Rika: Rike sounds like a horrible version of Mike Recruit_main707: PMunch: were is the protobuf thing? PMunch: https://github.com/PMunch/protobuf-nim I'd guess Recruit_main707: thanks PMunch: Damn, got it right :) Recruit_main707: can it do what i said about the .fbs files though? Rika: its for protobuf, not flatbuffer Recruit_main707: so sad geotre: Has anyone got a decent guide on setting up neovim to edit nim? zacharycarter: Recruit_main707 - why not try wrapping: https://github.com/dvidelabs/flatcc zacharycarter: Nimterop can probably help here Yardanico: http://nibblestew.blogspot.com/2020/04/your-statement-is-100-correct-but.html sealmove: @Rika @Recruit_main707 if you are into these stuff, check out Kaitai Struct ;) sealmove: https://github.com/kaitai-io/kaitai_struct/issues/619 https://ci.kaitai.io/ Recruit_main707: sadly, i need flatbuffers because its a framework Rika: sealmove: ive been looking for an efficient binary data transmission format yeah sealmove: when you say "efficient"? sealmove: KS is focused on expressiveness and ease of use. It's not focused much on performance. Rika: `Python is a complete joke, it will fail hard when you need to process ten million files a second on an embedded microcontroller using at most 2 k of RAM.` LMAO this point though Rika: (from yardanico's link) Rika: sealmove: size and speed efficient Recruit_main707: lmao Rika: size and speed efficiency doesnt imply difficulty of use though zetashift: yea I saw that post on lobster, funny but true kodkuce: hmm whats moste efficient way to take part of string, mysting = "abcdiefgejklmopqar" wantIndexedMidlePart = mystring[2..5] ? zetashift: Did Nim get accepted for GSoC? livcd: Can I somehow tell from a Nim binary if it uses ARC? livcd: What I mean. I can trivially find out? livcd: Can I* Rika: not reliably i dont think livcd: https://github.com/juancarlospaco/plz -> outrageous claims! Rika: that icon though... sealmove: Rika let me explain: During serialization you want your format to be as simple as possible usually, so serialization software can focus on performance rather than features. KS focuses on parsing rather than serialization, so it includes crazy features which enables you to parse very weird/complex formats in an easy way. Also it can produce parsers in ~10 different languages. They try to keep the compiler architecture FromGitter: ... simple, so some optimizations are discouraged and/or hard to integrate into the current codebase. Rika: h-how?! Rika: https://cdn.discordapp.com/attachments/371759389889003532/699270984582168606/unknown.png sealmove: kodkuce: your example should be as efficient as it gets Rika: sealmove: okay, doesnt matter, ill take a look at it sealmove: What I like about it is that you can use it for stuff like this: https://github.com/kaitai-io/kaitai_fs Asmodeus: Which compiler does nim include/use by default? livcd: The one that you have installed! Asmodeus: Oh it just calls out to one? I assumed it bundled one by default dzamo[m]: Has anyone got a decent"> I installed nimlsp using nimble and pointed coc.nvim at that which got autocompletion going. But to get syntax highlighting I had to pull down and install a separate Vim syntax file geotre: @dzamo yeah I'm having trouble finding the right combination of plugins to get everything to work Asmodeus: Does nim compile out to a single .c/.h file? And does it use libc? Rika: nim on windows uses mingw if you tell it to install with that clyybber: it compiles to multiple .c files livcd: see nimcache Asmodeus: Ah okay, makes sense, thank you livcd: anyone thought about implementing an rdp client in Nim? Rika: rdp? livcd: microsoft remote desktop clyybber: why tho clyybber: Windows has its own RDP server and client shashlick: Recruit_main707: do you want flatcc wrapped? livcd: clyyber: for automation ofc Recruit_main707: shashlick, i want a flatbuffer parser for nim shashlick: does https://github.com/dvidelabs/flatcc meet your needs? Recruit_main707: if it was done for nim, yes Rika: its in c Rika: wrappers are easy enough livcd: shashlick will do his magic wrapping :) shashlick: i'm asking if you want it wrapped, which means you are okay with the functionality it offers shashlick: not reimplementing the whole thing in Nim Recruit_main707: then no Recruit_main707: Rika, doesnt that kind of make it losse the point? Rika: why? Recruit_main707: because if i have to wrap the generated code i could do it in nim (if it was not so big) shashlick: http://ix.io/2hSy/nim is the wrapper output for flatcc zetashift: Did you just wrap flatcc like that using nimterop? :O shashlick: yep kaushalmodi: shashlick: does Nim playground have nimterop installed? kaushalmodi: if so, it would be cool to share short nimterop recipes kaushalmodi: *hmm, but it might not be able to do the git pulling of the header files* Recruit_main707: you know, shashlick, could we get to talk in some kind of private msg form so that you help me understand how to wrap the flatbuffers.h file now? that would actually be useful for, and a good idea to even make public at github Recruit_main707: because based on the size of the flatbuffers.h file and the current nim implementation, i can see it lacks a bunch of things shashlick: http://ix.io/2hSB/nim is the nimterop wrapper itself which also builds the library static or dynamic shashlick: only tested on linux so far Recruit_main707: but this is the flatcc one, isnt it? geotre: @dzamo what did you put in coc-settings.json to hook up nimlsp? I can't get it to work shashlick: ya, and it only wraps flatcc.h - was there something else you wanted? Recruit_main707: flatcc is the compiler i think, i would need the library Recruit_main707: this one i think... https://github.com/google/flatbuffers/tree/master/include/flatbuffers dzamo[m]: @dzamo what did you put"> @geotre I used the example for Nim here https://github.com/neoclide/coc.nvim/wiki/Language-servers Recruit_main707: CoC XD Recruit_main707: (im sorry) shashlick: flatbuffers is C++, nimterop doesn't support C++ geotre: @dzamo weird I tried that but I just get "[coc.nvim] Definition provider not found for current document" when running stuff on a nim file shashlick: and flatcc has a compiler and runtime stuff shashlick: i'll recommend you see all the functionality it offers Recruit_main707: i will shashlick: cause it is pure C and easy to wrap zetashift: @geotre any reason you can't use https://github.com/alaviss/nim.nvim ? dzamo[m]: @geotre I also had to tell Vim that files with a. nim extension have filetype "nim". Try running :set ft=nim in a Nim buffer for a once off test and then look for output in :CocInfo geotre: @dzamo good point, that's probably it geotre: @zetashift it didn't work for me kodkuce: how to write forward slash in string Rika: just type it Rika: "/" Rika: backslash needs escaping, with another backslash "\\" Rika: damn it discord aEverr: "\\" aEverr: just double it damn it Rika: or you can do r"\" Recruit_main707: `"\\"` Rika: AUFYBN Rika: `r"\"` geotre: @dzamo that was the problem. Thanks for the help! dzamo[m]: @geotre nice :) geotre: @dzamo what did you use for the syntax highlighting? I guess I can just pull one of the files from the various nim.nvim plugins right? kodkuce: hmm dzamo[m]: @geotre any reason y"> If you've already got a completion framework like coc installed then you first look for things that work within that I guess Recruit_main707: @shashlick, i know perfectly understand what i want to do, i dont need to wrap the flatbuffers thing, only the emmited header :smart: Recruit_main707: now** dzamo[m]: @dzamo what did you use"> Yes I took an older one in the end dzamo[m]: @dzamo what did you use"> Because the newer one from the nim.nvim repo had dependency on another part of that plugin dzamo[m]: So I used the one here IIRC https://github.com/baabelfish/nvim-nim geotre: I just found the same thing geotre: But copying the function into that file seems to stop it complaining dzamo[m]: But copying the functio"> Oh cool I'll go back and give that a try then, thanks Recruit_main707: id like to see something to clear the nimcache Recruit_main707: kind of `nim --clearcache` or something Yardanico: --forceBuild ? Recruit_main707: that does it? Yardanico: fully rebuilds everything Yardanico: "-f, --forceBuild:on|off force rebuilding of all modules" mantielero: Hello Zevv: hi mantielero mantielero: I am having an issue with a macro Recruit_main707: that doesnt delete the cache files whose projects might have been deleted Yardanico: ah well I just do rm -rf ~/.cache/nim if I need to "clear the cache" :P Recruit_main707: ok mantielero: I am getting the error: "/home/jose/src/ipopt.nim/src/ipopt.nim(322, 15) Error: type mismatch: got but expected 'array[0..0, float]'" when I compile "ex01" from https://github.com/mantielero/ipopt.nim/tree/master/src mantielero: The problem dissapear when I comment: https://github.com/mantielero/ipopt.nim/blob/master/src/ipopt.nim#L473 mantielero: Which doesn't makes much sense to me :o/ mantielero: Besides, these lines show the content that I am expecting: https://github.com/mantielero/ipopt.nim/blob/master/src/ipopt.nim#L428-L429 Zevv: mantielero: hard to debug that for us, it's pretty big like this. Zevv: I'll take a peek but no promises. mantielero: I understand Zevv: If you suspect you found a bug, it pays to reduce the size of your problem to the bare reproducable minimum mantielero: I don't think it is a bug Recruit_main707: some nimterop gurus that might be able to help me? Yardanico: ask any question right away :P Yardanico: https://dontasktoask.com/ Recruit_main707: idont know how to use nimterop :p i need to wrap some headers Recruit_main707: lets call them `header1.h` to `header5.h` mantielero: I would start first with c2nim (IMHO) Recruit_main707: could try Yardanico: @Recruit_main707 well nimterop isn't hard Yardanico: see https://github.com/Yardanico/nim-libvlc/blob/master/src/libvlc.nim Yardanico: you can ignore the symbol stuff and cPlugin and cOverride for now Yardanico: the main thing is just "cImport(baseDir / "include" / "vlc" / "vlc.h", recurse = true, dynlib = "dynvlc")" mantielero: Take a look at the documented templates: https://github.com/nimterop/nimterop/blob/master/nimterop/template.nim faulander: anyone here compiling with WSL on Windows? Windows Executable works just fine, but the Linux-Version doesn't do anything when run. no compiler errors, no ouput Recruit_main707: sorry, i had to leave, i will have a look, thanks kodkuce: i wanted to cheat pars this multypart wasted 2 hours and in end i saw its broken cuz as soon i added second field it doomed me xD zetashift: @faulander do you mean the binary that is created when using WSL doesn't do anything? shashlick: ya just ask your questions on nimterop - will reply shashlick: Yardanico: can you test your libvlc wrapper with ast2? Yardanico: shashlick: sure Yardanico: how to? :P zetashift: WSL hello world runs fine for me Yardanico: -f:ast2 ? shashlick: yes - just add flags = "-f:ast2" shashlick: to cImport shashlick: of course, will help most if you have real tests 😄 kodkuce: dom96: how to reed data form this multypart thingy Yardanico: shashlick: should I install @#head ? Yardanico: or just "nimble install nimterop" kodkuce: MultiData is some orderdTable but i cant do md[4] or md["mykey"] Yardanico: did you do "import tables"? shashlick: you'll need #head shashlick: ast2 is not tagged yet kodkuce: beh i am tard, yep frogot to import Yardanico: well it's not intuitive really Yardanico: shashlick: got an error :) Yardanico: "Error: unhandled exception: getters.nim(117, 12) `name.nBl` Blank identifier error [AssertionError] [AssertionError]" Yardanico: how do I make a usable stack trace for you? Yardanico: https://gist.github.com/Yardanico/756cc013510352e1b3f1704794a8164b this is what I get shashlick: nice - try with -d shashlick: will tell whicih specific symbol Yardanico: https://gist.github.com/Yardanico/71bdc412caeb5bd91dc174a0c2080beb full output Yardanico: guess it's vlc_Log ? Yardanico: https://git.videolan.org/?p=vlc.git;a=blob;f=include/vlc_messages.h;h=b6d5843985dccfad5d24a6d7ae1e4a4728023ccd;hb=HEAD#l122 the source Yardanico: "struct vlc_logger *const *logger" it can't parse this argument maybe? kodkuce: grrrrrrrrrrrrrrrrrr that multypart parses skips filename 😦 will need to beat it more shashlick: Yardanico: are you running this on command line with toast shashlick: or with cImport Yardanico: with cImport shashlick: how come VLC_API isn't stripped? Yardanico: wdym? I only remove libvlc_ prefix in my onSymbol shashlick: hah, also varargs which isn't supported shashlick: cImport always calls the preprocessor so VLC_API should have been processed shashlick: okay let's come back to libvlc - might be biting off more than I can chew at the moment Yardanico: shashlick: it's okay, thank you for creating nimterop in the first place :) I wish I could help but I'm not good when it comes to C or AST stuff videofile: yay discord is back up again videofile: welcome back discord gang Yardanico: ? videofile: the relay was broken Yardanico: doesn't seem so videofile: omg youre the nimexpr guy Yardanico: I acn see messages just fine in Discord, even those before your messages Yardanico: *can Yardanico: videofile: well yes but it's a simple lib really Yardanico: and not that efficient since it's recursive videofile: huh but it didnt show up in irc for a while kodkuce: undeclared field: 'data' for type strtabs.StringTableRef [declared in /home/me/.choosenim/toolchains/nim-#devel/lib/pure/strtabs.nim(75, 3)] hmm am i retarded or what kodkuce: StringTableRef = ref StringTableObj Yardanico: so? Yardanico: "data" is private kodkuce: oh Yardanico: Why would you want to access it though? Yardanico: you can iterate over all values kodkuce: i am trying to do that just duno how shashlick: Yardanico - no worries - will be good to test all existing wrappers with ast2 before final release Yardanico: @kodkuce for (key, val) in yourTable: do stuff Yardanico: or you can use "keys" and "values" iterators if you need only keys or only values shashlick: will get back to you when I have time to focus on fixing specific bugs Yardanico: also for string table you need "strtabs" not "tables" awr1: hello kodkuce: i have both i think i am getting how it works zetashift: hiya aw1 Recruit_main707: shashlick, i have a multiple directories, only headers project that i need to wrap, but it doesnt stop giving me errors, any help? kodkuce: yey got it wokring ty shashlick: sure, we can chat here or the nimterop room in gitter Recruit_main707: I will go into the gitter room shashlick: cool Varriount: I'm so lonely, no one's on Discord or Mumble. 😦 Varriount: *Discord Voice chat videofile: what dyou wanna talkaboot Varriount: Hm.. I don't actually know. -_- videofile: :P videofile: talk about gc vs arc? Recruit_main707: but thats an easy one Varriount: I did some recent benchmarks on `for element in x` vs `index = ... ; while index <= high(...)`, and somehow the first one come out faster. videofile: Recruit tldr version? Recruit_main707: ?? Prestige: Varriount can you make a post about it? Or show how you benchmarked them? awr1: did you turn on the optimizer zetashift: @Varriount maybe one can find out looking at the assembly or generated C code? e.g.: https://godbolt.org/z/AqiD9Y Varriount: Prestige, awr1, zetashift: https://gist.github.com/Varriount/d7c3961f95870a1c6520523131c3971e Varriount: I used "nim c -d:release --linedir:on --debugger:native" Varriount: Actually, "-d:danger" Prestige: On line 86, is there no way to just get the name of the proc? Varriount: Not at runtime, no Varriount: Actually, there might, but I couldn't be bothered. kodkuce: can i chain sortedByIt or do i have to wirte cmp myself Varriount: What do you mean by chain? kodkuce: like sort first by name then sort by age if name is same Varriount: Oh, you mean, is the sort stable Varriount: I don't really know... Does the documentation state that it is? kodkuce: what, i used this before for my poker obj kodkuce: https://play.nim-lang.org/#ix=2hUP leorize: Zevv: did you ping me? kodkuce: just duno how to do same for tuple kodkuce: anyway i go sleep my eyes are burning Varriount: zetashift: Any idea what "test rdi,rdi; je
" is meant for? I understand what it does, but not why it's added. videofile: is there any recommended resource on templating, macros and metaprogramming? I want to know what all the fuss is about Varriount: videofile: The manual is a good place to start. videofile: the docs? Varriount: https://nim-lang.org/docs/manual.html Varriount: videofile: For macros, general reading on what an AST (abstract syntax tree) is will help. Varriount: https://en.wikipedia.org/wiki/Abstract_syntax_tree videofile: gotcha, I do remember a little from my python days videofile: it's from teh parse tree right? videofile: ok thanks! Varriount: I don't know if Python uses a separate tree structure for parsing information. Nim doesn't. videofile: slightly offtopic but does FFI mean I can use C functions directly in nim? videofile: I see Varriount: Yes. Varriount: Well, when compiling Nim to C/C++, anyway. videofile: only C or is CPP also included? videofile: ah yes videofile: of course Varriount: Obviously you can't easily do that when compiling to, say, javascript. videofile: 'easily' meaning it can still be done? zetashift: @Varriount sorry I have no idea D: videofile: INTERESTING videofile: that manual is so extensive Varriount: zetashift: Ah, some reading suggests rdi is used to pass the first integer (or pointer?) parameter. The first parameter is a string. Because of the whole "dereferencing null pointers is undefined behavior" thing, the compiler is free to assume that, if the pointer to the string is invalid, it can just immediately return. Prestige: When wrapper are created for libraries (e.g. the x11 wrapper) are they typically documented? I've found some decent docs for x11 elsewhere, but there aren't really docs for our x11 wrapper zetashift: @Varriount oooh my ASM isn't that strong, that's good to know Varriount: Prestige: If the wrapper is "low level" or "bare" (that is, it replicates the C library API exactly) then there typically isn't much documentation. zetashift: yeah Nim and documentation don't go well together currently zetashift: It's getting better though Prestige: Perhaps I'll open a PR on x11 when I'm done reading this massive webpage about it Prestige: Can #[ ... ]# be used for docs, or is it only ##? Would be nice to have multiline leorize: Prestige: `##[ ]##` can be used leorize: but we don't usually use it :P zetashift: docgen guide doesn't even mention it Varriount: zetashift: Ah, I might have been wrong, actually. Prestige: Hm okay I'm not sure how I feel about it anymore, lol Varriount: Because Nim now treats a nil string as equal to "", looping over a nil string just skips over the loop Varriount: Or rather, sets the amount of times to loop to 0. The C compiler is smart enough to recognize that if `input_arg == nil`, it should just directly return. awr1: that was pre 1.0 awr1: and has been around for like a year and a half Varriount: awr: Well, yes. I just didn't connect that with the assembly I was seeing, as the assembly was the result of optimizing this fact leorize: FutureStream kinda resembles io_uring :P Recruit_main707: Can you create a sequence of static strings? leorize: you can create a static sequence of strings :) Recruit_main707: But then if I need to pass one of those strings to a function that needs static string, will it work? leorize: yes, but I gotta warn you about how static strings don't really work as you'd expect them to leorize: static[T] semantics is so weird that I don't really know how it actually composes with Nim Recruit_main707: Well, it's not my function, just a fancy thing to keep the code clear Recruit_main707: I will try it tomorrow Recruit_main707: Also, Google contributor has answered the flatbuffers Nim support question, sadly, one of us will need to create it, the only positive thing I can think of is that if someone ever does it, it will be added to the main repo, and maybe attract more people leorize: I'm not surprised :P Recruit_main707: But it doesn't seem like Google wants to do it by their self :p leorize: not too surprising :P Recruit_main707: Well, something is something I guess, so @Rika if you ever finish/start that, have it in mind leorize: google wanna push adoption by implementing it for a bunch of langs leorize: and I'd say that the Nim community is too small for them to bother companion_cube: so flatbuffer is the next protobuf? Varriount: What's flatbuffers? zetashift: I think some grpc thing just like protobuf zetashift: "FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. It allows you to directly access serialized data without parsing/unpacking it first, while still having great forwards/backwards compatibility." zetashift: this page has some why's: http://google.github.io/flatbuffers/ Yardanico: wow they have a .github.io page Yardanico: i mean google zetashift: I guess some team decided why not companion_cube: I guess they didn't want to use capnproto, cause, it's not from google videofile: test dadada: so I looked at the go.cxx in swig/source/modules, and there's really a lot of code that a possible nim.cxx could share with it dadada: there's the possibility that a nim version could exist with less code, since in the go module many things are implemented twice: for gco and gccgo dadada: 6000 lines looked scary at first but a lot of it are helper functions and boiler plate code, so when it comes down to it only about half of the code really deals with creating the wrappers dadada: I'm sure anyone who's versed in Nim/C++ and dedicates enough time will be able to create a swig Nim module, there're standard C++ testunits/examples in swig, and if you can get a module to correctly create wrappers for them all, that should basically be the ticket to getting upstreamed dadada: I bet it wouldn't take someone like say Araq longer than a week to get done, and you'd get creation of nimwrappers for C/C++ libs with very little effort, swig interface files allow for additional specification of how exactly a header/lib should be wrapped, and I think a lot of that could even be further automated by using nim macros that create those swig interface files on the fly zetashift: adding a SWIG wrapper or adding support for C++ using nimterop, which one would be better? dadada: starting by copying the go.cxx is a good idea, since just like go nim supports overloading of procs/funcs and there are some similarities in how types are handled dadada: zetashift: you don't understand what swig is, you're not adding a swig wrapper to nim, swig is a universal C++ wrapper creator Recruit_main707: SWIG? Like, the python CPP thing? dadada: zetashift: it's basically what nimterop is, but instead of being specialized for C++->Nim it's generalized for C++->D/Go/Rust , but the end-result, the created wrappers are wrappers in the same vein that nimterop creates them dadada: zetashift: the task/project of creating a C++ parser that extracts all the relevant bits is the hardest in all this, and the swig project is specialized in exactly that, and it also has a series of specialized transformers, that allow to create those wrappers for different languages leorize: well we do have a c++ parser that can do just that :P dadada: leorize: you mean clang? leorize: yea, and tree-sitter, though I won't count of that leorize: on* zetashift: I thought SWIG was just an easy way to get C++ code working with X lang leorize: well swig is pretty mature dadada: zetashift: yes, and that's possible because it creates wrappers for X lang leorize: the only problem is that if someone wanna add nim support they gotta write a lump of c++ :P Yardanico: go big brain and write it in Nim instead Yardanico: by wrapping swig xDD videofile: anyone heard of any mention of vtk library in nim? videofile: I'd love to finish my final project in nim instead of python Yardanico: videofile: only found this https://github.com/Psirus/Nimfem/blob/6dd0d7b31209c70d8b2e565a387dad86cc42dffc/io.nim#L6 dadada: leorize: don't know if you read what I wrote just earlier?! but my analysis of the go.cxx swig module clearly indicates that it's far less hard to create such a module than you would think, you can copy a lot of the logic of the go module, and nothing in there really is hard, it's just that someone has to do it, but a really good C++/Nimmer wouldn't need much more than a week in my estimate videofile: ooooh nice find Yardanico ty! tervay: Hi all, having some troubles with OOP in Nim. Trying to assign a child class to a variable that is specified as the type of the parent class, if that makes sense? Essentially I have an "abstract" class `Skill` that should be able to be subclassed and assigned to different subclasses of `Survivor` https://gist.github.com/tervay/f30176f03f8ed5e75c6af5a685b08a86 Any help would be greatly appreciated. Thank you, hope FromGitter: ... everyones staying healthy leorize: dadada: you focused on the wrong part :P the problem is "lump of c++" tervay: ah perhaps the IRC is more active Yardanico: we see IRC leorize: tervay: don't worry we see you Yardanico: from* tervay: Oh dope Avatarfighter: Hello everyone 🙂 videofile: hullo videofile: from the other side leorize: dadada: it's not hard, but you gotta convince someone to do it or do it yourself videofile: is this bridge written in nim? leorize: nope dadada: leorize: that's exactly what I focused on, the lump of c++ is just a bunch of class member methods and helper functions, those aren't highly specialized C++, everyone with basic knowledge of C++ can both understand and rewrite/write that Yardanico: videofile: no Yardanico: you can help the pure-nim one by contributing to https://github.com/Yardanico/ircord Yardanico: most of it works but need to fix discordnim closing connections leorize: also if you can get pinging to work that'd be awesome Yardanico: I think I can zetashift: if it's easy for beginners I'd love to help :P leorize: the discord to matrix bridge can do this and it's dope leorize: esp once you bridge the room to irc discord users show up as irc users Yardanico: well that wouldn't really be possible in freenode Yardanico: since every nickname has to be registered Yardanico: well I mean for most channels Avatarfighter: ooo can I get the context behind your conversation leorize and Yardanico it sounds interesting leorize: Yardanico: not #nim :P leorize: yea but it's definitely a problem with #nim-offtopic Yardanico: @Avatarfighter https://github.com/Yardanico/ircord Yardanico: well guess I can try fixing some ircord Yardanico: I'm sad Discord doesn't have any kind of json schema or something like that Yardanico: so I can generate nim type definitions programatically videofile: macros? videofile: id love to contribute but im a noob right now Yardanico: no, it can be possible without macros InventorMatt: videofile: I've been contemplating creating a wrapper to bring vtk into nim since I frequently use vtk myself. but I want to see if anyone would help me with it since I am no expert in nim Yardanico: well I'll try to work on ircord right now a bit dadada: leorize: shashlick admitted that it's years away for nimterop to support C++ at the current pace, and I think for a skilled dev the swig module route would be much much faster, since swig supports c++17 and is adding c++20 features that really gets you a lot, while nimterop still can't handle all of C, I don't want to diss nimterop or shashlick, but I'm really impatient for seamless Nim<->C++, there's just so Yardanico: I'll test it in #nim-offtopic as usual dadada: much relevant C++ code out there videofile: well, InventorMatt, sorry to let your hopes down but I'm no expert in vtk and nim :/ leorize: dadada: well you gotta advertise it on the forum videofile: was just hoping someone had started and maybe had some clear way for noobs to contribute haha leorize: dadada: there's a better chance of finding someone interested there than here Recruit_main707: Despite needing to change a bit the project structure and therefore the headers because the include directory thing doesn't seem to work on windows, nimterop is working like a charm Recruit_main707: In fact, it seems like a good way for using flatbuffers (when their structure files are considerably big) leorize: dadada: also note that Nim can interact directly with C++ templates, something that the majority of language supported by Swig can't do dadada: Recruit_main707: maybe I overinterpreted nimterop github issues about C. But I definitely know there's no easy/seamless way to create wrappers of C++ libs for Nim yet. dadada: leorize: noted! leorize: I don't know if swig still do that "generate c++ -> c wrapper library then wrap that library for the target language" flow Recruit_main707: dadada: there are also c flatbuffers dadada: leorize: from the go code it looked like it mratsim: I don't know if I should be happy or appalled but I managed to create working co-recursive concepts and as a bonus I've added types that use the unicode identifier β, ξ, γ 🙂 (https://github.com/mratsim/constantine/pull/25) leorize: dadada: so swig gotta account for the fact that Nim can interface directly with C++ for it to be viable :) dadada: leorize: I think it's possible now with swig, the C intermediatary wrappers were created for the go swig module, because I think go can't directly deal with C++, I'm pretty sure when I looked at the code I thought to myself, this step can be skipped for Nim (no C wrappers for C++) mratsim: @InventorMatt when you're stuck, ask in the forum and either have a code snippet that shows the problem (that we can just copy-paste) or have instructions to clone your repo and reproduce the problem if you can't reduce it to a small snippet dadada: leorize: the module is responsible for creating all wrappers (including C intermediary wrappers), so of course you can skip on that, and directly write Nim wrappers to C++ mratsim: i.e. similar to this thread: https://forum.nim-lang.org/t/6164#38091 dadada: leorize: but there's a good reason for still creating those C wrappers, since some people might want to compile Nim with a C compiler, that's not a C++ compiler, ... dadada: I mean it should be optional leorize: please don't dadada: don't what? leorize: support for the hypothetical case can always come later dadada: it's not really hypothetical, I currently compile my Nim stuff to C leorize: well but now you gotta find someone willing to write some C++ for swig :) leorize: that's the hard part dadada: we need a billionaire financing Nim, how can we get Zuckerberg or the like to pay attention videofile: any interest expressed in a telegram client for nim? Recruit_main707: Nah, Zuckerberg no, Elon musk better videofile: zuck has monay dadada: I mean, there are so many great project ideas for Nim, but not enough people that can dedicate time tothem videofile: true videofile: we crossed 1250 modules recently I think videofile: 🎊🎊 dadada: Recruit_main707: I named him cause fb financed a shit ton of FOSS projects, and some languages too videofile: graphql is a good one yeah dadada: it really doesn't matter who, Nim needs a sugardaddy or mommy Recruit_main707: Rocket league bots framework might get a good, acceptable support for Nim soon too! Either by me, or by a general sockets support, and I will make it nimble available once it does, so if anyone has RL and wants to code some bots. dadada: Recruit_main707: nice zetashift: I was just about to start Rocket League inv2004: Hello, I am trying to use threadpool, but a bit confised with the following error: flowVar of type: CountTable[system.int] inv2004: Error, maybe is clear, but how to resolve it? :) zetashift: can you show your code using play.nim-lang.org? inv2004: let me try to create one videofile: any thoughts on interfacing nim with autohotkey? Recruit_main707: Sounds very painful the least inv2004: here it is: https://gist.github.com/74b7067050f3d1421e95b967f493d377 shashlick: @Recruit_main707 why did you need to change your project structure? Recruit_main707: wdym? I was using a python middle man to connect with the framework, but that was way too slow Recruit_main707: This new general sockets support would firstly be official (that means I don't have to work :p ) Recruit_main707: secondly, it would be directly done by the framework, therefore performance would not be a problem leorize[m]: general sockets? shashlick: your comment about nimterop Recruit_main707: I was gonna tell you tomorrow, cOncludeDir doesn't seem to work on windows shashlick: dadada: if someone adds nim support to swig, i'll be happy to archive toast Recruit_main707: That's more or less what I was doing my macros for shashlick: i looked at swig in detail recently and it does provide a lot of nice info, more than tree-sitter and even clang Recruit_main707: Not with swig, but bare python.h dadada: shashlick: yeah, it's purposebuilt...! dadada: shashlick: the only downside I see with swig is that it's not clang, and naturally the swig developers will always be a little behind the C++ standard dadada: although even clang/gcc are sometimes behind it, to be fair to swig shashlick: there is some frustration around that in swig world from what little i read shashlick: keeping up is impossible dadada: it's the same reason why people like myself think that you'll have an extremely tough time to get nimterop C++ ready dadada: C++ is simply a monster :-) shashlick: all said and done, the fact that you have multiple compilers, besides clang, it doesn't help to focus on just that dadada: although I don't doubt you could do it shashlick: i have no illusions about it, 4raq warned me years ago shashlick: but i am doing this for fun anyway shashlick: the ultimate goal is to push the envelope within Nim dadada: oh, fully understand that! shashlick: like the text editor i spent several months on, it gave us a plugin system which is now usable standalone shashlick: likewise with nimterop - it can show what's possible and then someone can use portions or ideas in other things shashlick: ultimately, the real deliverable is nim itself dadada: true shashlick: tools can come and go leorize[m]: I really need some motivation to work on more nim projects shashlick: leorize: help me! i need to get nimterop for C done so that we can move onto C++ 😉 dadada: the only reason I'm bringing up swig is that I want more wrappers to be created sooner rather than later, so Nim becomes more attractive, and more people develop stuff in it, growing the community is what I'm all about leorize[m]: dadada: just wrapping is not enough leorize[m]: it has to feel like you're writing Nim leorize[m]: and not many people can spend time doing so leorize[m]: shashlick: that's a good motivation :P leorize[m]: there are so many things in the stdlib that I wanna rework... leorize[m]: how can people balance working on multiple projects? shashlick: one at a time is all i can say shashlick: otherwise mind is all over the place and one i get out of a project, i have high inertia going back into it dadada: sometimes it's good to step away from a project to get a better perspective dadada: indeed, I do most of my creative thinking when I'm not coding at all, my best ideas come to me in bed or something like that leorize[m]: my problem is that my focus is all over the place :/ dadada: leorize[m]: it's really hard not to be in times of YouTube and 24/7 news :-) leorize[m]: it's more that I work on one project then I suddenly jump to another when they come to mind :) shashlick: only suggestion would be to push and then move on shashlick: and you can only push if it is working leorize[m]: yea that doesn't sound too bad KingDarBoja: By cut off the larger container, you mean it was splitting the string? leorize: it means zip("123456", [1, 2, 3]) -> @[("1", 1), ("2", 2), ("3", 3)] KingDarBoja: Oh okay, gotcha krux02: so zip on two strings should not create strings, it should create characters KingDarBoja: https://docs.python.org/3/library/functions.html#zip yeah it is at the Python example KingDarBoja: But pretty clever fix if you ask me KingDarBoja: Didn't expected the x != y comparison was the issue KingDarBoja: Due to zip not creating characters leorize: that's not the only issue :) leorize: also it wasn't creating characters because you didn't use it correctly leorize: !eval zip("abcd", "1234") NimBot: Compile failed: /usercode/in.nim(1, 1) Error: undeclared identifier: 'zip' leorize: !eval echo zip("abcd", "1234") NimBot: Compile failed: /usercode/in.nim(1, 6) Error: undeclared identifier: 'zip' leorize: !eval import sequtils; echo zip("abcd", "1234") NimBot: @[('a', '1'), ('b', '2'), ('c', '3'), ('d', '4')] leorize: ^ characters leorize: another issue is that you weren't using a raw string __ibrahim__: hi, what is the equivalent of: __ibrahim__: (void*)0 __ibrahim__: in nim? leorize: so `\t` and `\n` turns into literal tabs and newlines instead :) leorize: __ibrahim__ nil __ibrahim__: ok thanks KingDarBoja: Where it was? I didn't saw it KingDarBoja: 🙈 leorize[m]: line 6 and 7 in your version leorize[m]: you can see that in line 3 and 4, the python code was passing raw strings KingDarBoja: The regex? leorize[m]: yep KingDarBoja: Oh, the "r" KingDarBoja: I definetively feel a bit confused due to how Nim split string in several definitions while Python is pretty much string for all (ofc for users) KingDarBoja: That happens with unicode handling too KingDarBoja: But Variount explained that to me (the char as data type and character) KingDarBoja: How old have you been coding on Nim? just curious KingDarBoja: Umm, just tested a special case, when it has `\t` character on the string KingDarBoja: https://repl.it/repls/SoggyFabulousPhysics Prestige: procs implicitly return values? Looking at https://nim-lang.org/docs/tut1.html#advanced-types-open-arrays Prestige: seems openARraySize is returning oa.len, thought you'd have to assign it to result or explicitly return Rika: Prestige: if every last statement matches the return type, that is returned Prestige: Neat, thanks Rika: every, since there can be multiple last statements Prestige: I'll probably avoid doing that but it's good to know KingDarBoja: I tend to use return instead of assigning to result unless it is a initMyType / newMyType proc 🙈 KingDarBoja: And yes, I know return performs a call to result Recruit_main707: It’s a matter of preferences Rika: ^ Rika: i use last-statement and result more than return Prestige: yeah, I think using `return x` is much more readable Prestige: but all preference Rika: i only use return when its control flow is needed Prestige: was just confused cuz I didn't know about the implicit return Recruit_main707: I use return specially when it’s one line long Rika: i especially avoid return when its one line long Recruit_main707: Or on specially long procs that don’t need result KingDarBoja: String literals can also be delimited by three double quotes """ ... """. KingDarBoja: Oh yikes! KingDarBoja: So I can't put `\t` inside a string literals surrounded by triple double quotes Prestige: I suppose you could just press tab on your keyboard? hm Prestige: that is a bit odd though KingDarBoja: Just comparing some Python vs Nim code KingDarBoja: And noticed that while passing the `\t` inside triple string quotes leorize: Nim has r"string" too btw KingDarBoja: Yeah but that one do not interpret escape sequences leorize: well choose one :P leorize: !eval echo "\\t" NimBot: \t leorize: or you can compromise a bit KingDarBoja: Did you ran the Python example with that? leorize: ? KingDarBoja: https://repl.it/repls/SoggyFabulousPhysics KingDarBoja: This one KingDarBoja: I changedt he string inside triple quotes leorize: I still don't know what you mean :P leorize[m]: How old have you b"> been writing Nim for 3 years I think Rika: nim: r"\t" will look like `\t` and not the actual character; same with """\t""" leorize: echo """\t""" leorize: !eval echo """\t""" KingDarBoja: Yeah, what Rika said NimBot: \t leorize: ok sounds like a bug Rika: @KingDarBoja wahts your aim then?? KingDarBoja: Not a bug, the docs stated that triple quote strings doesn't excape characters KingDarBoja: Which is different to how Python handles that, just noticed after testing both dedent implementations KingDarBoja: escape* leorize: ah, yea KingDarBoja: So Nim one will crash xD Rika: crash? Rika: why so? KingDarBoja: Oops, wrong word KingDarBoja: I mean, not escape it 😛 leorize[m]: about result or return: I use result all the time, unless I can't leorize[m]: return is kinda like `go to` leorize[m]: `goto`* Rika: @KingDarBoja you can still input the actual character, you just cannot use escape sequences im pretty sure KingDarBoja: Yeah, by pressing the tab KingDarBoja: Like, whoever tries to use it, will have to check the docs 😄 leorize[m]: luckily no one ever does :P KingDarBoja: Well, not very experienced on graphql projects besides the ones I made at my job but maybe someone does that xD KingDarBoja: Ofc speaking about Python Rika: well, whoever knows nim is bound to know that """ """ is raw leorize: I learned that just now lol Rika: so they'd know \t isnt gonna be converted Rika: leorize: ah well fuck KingDarBoja: Plus ultra! KingDarBoja: I just replace it by pressing the tab, xD Rika: i dont use tabs anyway 😛 KingDarBoja: Tabs > spaces Avatarfighter: imagine indenting ur code smh leorize: tabs are evil Avatarfighter: the strat is to set tabs to spaces of size 4 in your editor so you can say your using spaces even though your pressing tab lol leorize: they create the illusion of "you can size it however you want" KingDarBoja: LOOL leorize: that never work out in practice leorize: @Avatarfighter: the Nim standard is 2 spaces :P KingDarBoja: Well, 1 tab = 2 spaces KingDarBoja: You saving one extra button press Avatarfighter: smh leorize[m]: well I didn't save one extra button press Avatarfighter: https://dsh.re/7bf3c guess im a rebel 🙂 leorize[m]: I save my thumb :p Rika: ah man here we go again w/ the tabs vs spaces argument Avatarfighter: naw im using spaces leorize[m]: @Avatarfighter: don't worry it's kinda common too Rika: i mean w/ boja and leo Avatarfighter: ah lol Avatarfighter: ugh why is it that whenever I need a specific algorithm its always explained in a written fashion but doesn't include pseudocode or examples of it Rika: its reading comprehension time Avatarfighter: :GWaobloChildPepeSweat: Avatarfighter: I needed the LEDBAT algorithm and it took me like an hour look for code that wasn't spaghetti haha Avatarfighter: it also took a bit to find something that wasn't someones thesis leorize[m]: sometimes you just gotta read the thesis :P Avatarfighter: yeah sadly sometimes you must KingDarBoja: Options > proc overload awr1: 2 spaces is good for nim awr1: Often DSLs/untyped macros will leave you with numerous indentation levels awr1: Cue Linux Style guide excerpt about how too many indentation levels == bad awr1: in general though while adopting a new style might be awkward you get used to it eventually. certainly i didn't like nim's pythonic indentation style the first time i tried it, but gradually grew to prefer it Rika: @KingDarBoja well, i guess you can go have fun doing none type and some value and optionval.get() and stuff like that Rika: also, not compiletime i dont think KingDarBoja: I was being funny, not serious KingDarBoja: 😄 Rika: ok KingDarBoja: I still need to look the advantages for each one, so far using the Options one KingDarBoja: https://play.nim-lang.org/#ix=2hG6 leorize, I had to read the whitespaceOnly as this case wasn't stripping the leading whitespace KingDarBoja: the regex I mean Rika: i really only use options when "the value has a none type other than 0 or "" or whatever default" Rika: aka "if the field is empty and theres no default" KingDarBoja: Nvm, it doesn't KingDarBoja: https://play.nim-lang.org/#ix=2hG8 🤔 KingDarBoja: Rika: Well it seems my use case, mostly for `MyCustomType or seq[MyCustomType]` on proc parameter (with multiple params being like this) awr1: https://play.nim-lang.org/#ix=2hGd awr1: my take on it awr1: probably broken KingDarBoja: We are using the base implementation of Python textwrap.dedent KingDarBoja: In this case, Leo and I did the implementation on Nim by following almost the same algorithm KingDarBoja: I said almost because Leo optimized the loop KingDarBoja: Or well, fixed my broken implementation lol KingDarBoja: But all cases passing except this one xD KingDarBoja: Also awr1, you are asuming it start and ends with braces, which is not the only use case 😛 leorize: ok so why did you ping me? awr1: ya i figured awr1: the python version is probably correct KingDarBoja: I didn't ping you lol leorize: ah mentioning someone name is pinging in irc land :P KingDarBoja: Unless typing ur name means KingDarBoja: Ok, then I did KingDarBoja: You saw the example? leorize: yea, what about it? KingDarBoja: Not sure why it didn't worked out KingDarBoja: Did we miss something? leorize[m]: what didn't work? leorize[m]: if you're talking about this: https://play.nim-lang.org/#ix=2hG8, then it's working exactly as it should KingDarBoja: https://play.nim-lang.org/#ix=2hGj KingDarBoja: Well, was basically the same example but I put the expected result on a comment in this case KingDarBoja: Unless... KingDarBoja: Wait a minute... leorize[m]: https://play.nim-lang.org/#ix=2hGl leorize[m]: I reframed it a bit leorize[m]: now can you see why it's working as expected? KingDarBoja: Yeah, just checking if Python did the same, so weird leorize[m]: it's not weird when you think about it :P KingDarBoja: Yeah yeah, got the thing KingDarBoja: It's a matter of how it is written on the statement KingDarBoja: https://play.nim-lang.org/#ix=2hGn leorize[m]: please don't tell me you're really using `dedent` just so you can have your string indented :P KingDarBoja: No no.. Rika: does graphql even care about indent Rika: it has braces for gods sake KingDarBoja: It's more like a utility KingDarBoja: Calm down 😄 leorize[m]: https://play.nim-lang.org/#ix=2hGq as far as Nim goes this is how we usually write our long string literals leorize[m]: the first newline will be removed leorize[m]: but not the last though, so if you don't want that one you gotta inline the closing `"""` with the last line shashlick: @leorize - if nim ast cannot store comments, how does nimpretty work? Rika: i assume with the raw text Rika: or maybe it parses the ast but modifies as raw text, then does the comments after that shashlick: sounds too messy shashlick: anyway, i'd really like comments support Chiqqum_Ngbata: Is there no way to get -o compile flag value at compile time (linux) leorize: shashlick: yep, raw text + ast :p shashlick: eww leorize: Chiqqum_Ngbata: see std/compilesettings shashlick: so i'd have thought that at least for nimpretty, you'd end up with comments support in the ast leorize: nah, the AST isn't a miracle shashlick: cause then all you'd do is read nim to ast and then render it back out and you have standard looking nim shashlick: but life's never that easy Rika: not exactly no? leorize: it has most of the syntax elements there, but it has none that nimpretty actually care about leorize: also the renderer don't give out idiomatic nim code :p Chiqqum_Ngbata: Perfect, thanks leorize: most of the time the code looks fine leorize: but when you go for a full file it looks kinda weird leorize: also nimpretty care about stuff that the AST can't capture leorize: not really "can't" but more of "doesn't make sense to" leorize: like how much indent is being used for one space leorize: how much spaces is being used as an indent is what I meant :P Skaruts: am I the only one who finds two spaces unreadable? Skaruts: just curious 🙂 Skaruts: (not quite unreadable, just a bit confusing) Elegant Beef: I do Elegant Beef: I much prefer indents equal to 8 characters, cause im weird and prefer clear indentation Skaruts: 😄 Skaruts: that's a bit too much for me Skaruts: but I understand Elegant Beef: Which is why im very pro-tabs, cause why not Skaruts: yea me too... Skaruts: I have a bit of a problem here: I have a template that takes a block of code, but I'd like to give it a few named parameters, BUT that creates the problem that they must go after the code-block parameter, but that doesn't compile when I call the template with the named one before the block Skaruts: Is there some way to turn the code-block parameter into a named parameter? Skaruts: this is my template sig: `template button*(x, y:int, text:string, code:untyped):untyped =` Skaruts: the goal was to give it optional parameters for styling and other button properties, with default values Skaruts: I could go with overloads, but I think that would force me to have an additional overload for each additional optional parameter... KingDarBoja: https://nim-lang.org/docs/marshal.html just found this right now KingDarBoja: But eww at the output on some type KingDarBoja: Seems like it was a mistake trying to use initTable as default value shashlick: @leorize but isn't the whole point of Nim pretty to give a consistent output independent of existing formatting and indent shashlick: And if the renderer isn't pretty enough, it could be updated Skaruts: nevermind my problem, I actually managed to use overloads in a much simpler way that I was thinking KingDarBoja: Show us? 😄 KingDarBoja: I am curious because been using Options module for that case but starting to feel the struggle of using some, none and get() as Rika said leorize: shashlick: no, actually nimpretty respects its user shashlick: is there any way to control the order in which dynlibs are loaded shashlick: actually, i don't think that will help shashlick: loading libbass and libbass_fx as dynlib doesn't work since libbass_fx looks for libbass and cannot find its procs even though it is loaded shashlick: works on windows, not on linux Avatarfighter: Does anyone know if nim already has a UDP hole punching library? I'm making one right now because I couldn't find one but just incase someone knows one Avatarfighter: and as I say that I find treeform's NetPipe library KingDarBoja: Anyone knows how to provide a default value to some Table[string, string] as proc parameter? awr1: @shashlick strange. i thought the dynamic loader on linux also skips if a dynlib is already loaded into memory shashlick: ya but i think the way Nim loads dynlibs with the {.importc, dynlib: "xyz".} is not the same as -lxyz shashlick: when I changed it, it worked fine shashlick: finished porting nimbass to ast2 - https://github.com/genotrance/nimbass/tree/nimterop shashlick: @jyapayne - added nim-sdl2 to https://github.com/nimterop/nimterop/wiki/Wrappers lbart: Hi, I have a problem with the forum. I can't activate my mail (so I can't post) since I never received the link to activate it. I deleted and recreated it several times, but each times. I have "an error has occured", long minutes after a mail with the link, and when I go the link to activate my account. I have a "Invalid ident hash" lbart: Any idea? Solution? lbart: Thanks leorize[m]: lbart: ping dom96 sheerluck: github told me "dom96 starred Pebaz/nimporter 9 hours ago" sheerluck: so I immediately became interested sheerluck: added {.exportpy.} to my mkv.nim sheerluck: and when I said "import nimporter, mkv" inside of ipython, I've got a result sheerluck: It feels like magic sheerluck: https://media.giphy.com/media/VHngktboAlxHW/giphy.mp4 dadada: sheerluck: agree dadada: my only mild criticism would be, why do you need {.exportpy.}, couldn't it simply import everything by default? Yardanico: dadada: well it needs that pragma to be able to know which stuff to import dadada: I'd love to see some performance tests of nimporter put against cython or the like Yardanico: I think it would be harder without the pragma dadada: Yardanico: in all the examples they're importing everything, might as well just create a macro that parses the whole file and adds the {.exportpy.} macro to all funcs/procs, and then the usual processing could start Yardanico: dadada: well that's examples Yardanico: in real life you wouldn't always do that :) Yardanico: and exportpy comes from nimpy Yardanico: https://github.com/yglukhov/nimpy dadada: ah, didn't know that came from nimpy, still, this could be made more comfortable, I think the usual case for this is that you'll be wanting to use a nim module in python, the same way you'd use this nim module in nim Yardanico: well nimpy isn't only calling nim from python, it's also for calling python from nim dadada: and when using a nim module in nim, obviously no special macros are needed Yardanico: well I understand what you mean but I think it would be harder to do Yardanico: since you'll have to circumvent the compiler and manually include the needed nim files via macros Yardanico: well, or just put a pragma call on the top of the file dadada: it would only be marginally harder, as I said, you simply write a macro that reads the whole module as a block of code, then puts the {.exportpy.} in the right places, saves this to a tmp-location, and then the same algorithm as used now gets used on this tmp-location, done Yardanico: well that seems hacky for me :P Yardanico: I don't think it's worth the effort honestly dadada: Yardanico: the point is that you shouldn't have to put a pragma/macro in the file at all, I suppose people have working nim modules, when the goal is to make them seamlessly available in python, the ideal is not to have to touch the file at all dadada: Yardanico: and I think the effort isn't even that high to do it Prestige: I'm going to have to re-read much of the docs, there's a lot to take in dadada: in an ideal world you do not have to maintain two versions of the same module, one for using it with python, one for using it in a nim project as usual, you'll ideally just want to have one file and one source history dom96: lbart, give me your nickname and I'll activate for you zacharycarter: What does drnim do? I got it compiling and ran it against a source file but it didn't produce any binary or anything Yardanico: it allows you to add special pragmas zacharycarter: ah Yardanico: see doc/drnim zacharycarter: thanks dadada: https://www.phoronix.com/scan.php?page=news_item&px=Wasmtime-Go-WebAssembly dadada: can't wait for Nim bindings for this dadada: "Wasmtime has already provided bindings for Rust, C, Python, and Microsoft .NET while Go is the latest on the list." Recruit_main707: I want flatbuffers for Nim Recruit_main707: That would be great dadada: Recruit_main707: I support you in that wish dadada: Recruit_main707: stuff like this would have been perfect for a GoogleSummerOfCode Recruit_main707: I will open an issue on the GitHub repo and try dadada: Recruit_main707: awesome gogolxdong: Is there any Fourier transform library? Zevv: yes Zevv: !package fftw3 sealmove: Hi everyone faulander: hi guys planetis[m]: hi Vindaar: @gogolxdong there are also bindings to kiss fft planetis[m]: are there any plans for the enumerate macro to replace pairs iterators or was abandoned? planetis[m]: there is an rfc: https://github.com/nim-lang/RFCs/issues/74 planetis[m]: great sealegs: Hey guys is there a way to convert string to int64? I've tried using parseInt but I get a value error saying that it's out of range. Generic: try parseBiggestInt Generic: and cast that one to int64 krux02: biggest int is int64 sealegs: it says "Error: type mismatch: got but expected 'int" sealegs: code: sealegs: ```nim sealegs: proc getShardID*(gid: string): int = sealegs: result = (parseBiggestInt(gid) shl 22) mod 1 sealegs: ``` sealmove: the box that appears when you search in nim docs looks shitty in dark mode krux02: yes the type is not automatically converted, but what I mean it is actually a 64 bit integer. Recruit_main707: `(gid: string): int64` the return type must be int64 krux02: there is currently no supported platform where the biggest int is more than that. sealmove: guys parseBiggestInt returns an int sealmove: actually there is `parseutils.parseBiggestInt` and `strutils.parseBiggestInt` sealmove: sealegs you need `strutils`'s one Recruit_main707: that doesnt seem the issue, its just that result expects an int Recruit_main707: not in64 sealegs: I already imported strutil's one krux02: sealmove: parseutlis.parseBiggestInt returns an int that is not the parsed int krux02: sealegs: you should convert the result of parseBiggestInt into an actual int krux02: result = int((parseBiggestInt(gid) shl 22) mod 1) krux02: int(expr) is a range checked conversion to int krux02: cast[int](expr) is a non range checked bit copy sealmove: ah right sealmove: guys, what's an easy workaround for recursive module dependency when you can't move types from file to other file? sealmove: `include`? sealmove: or is there an experimental feature that takes care of it? sealmove: a hack is fine by me for now zacharycarter: I haven't used this in anything beyond a very simple test - but I was able to get hot reloading working with `--gc:arc` and `cr.h` zacharycarter: will play around with it more later today - I was hoping shaslick's plugin project would work with `--gc:arc` but the tests fail presently planetis[m]: sealmove: https://forum.nim-lang.org/t/4745 sealmove: oh actually maybe I can solve it with export sealmove: https://nim-lang.org/docs/manual.html#modules-export-statement shashlick: @zacharycarter will be awesome to get plugins working with arc shashlick: That's the eventual goal zacharycarter: I agree - I'm just not sure how to do so at the moment shashlick: I need to port nimterop as well to work with arc shashlick: Too much to do, only so much time shashlick: For plugins, need to compile the plugins also with arc, not just the main binary zacharycarter: how should the plugins be named>? zacharycarter: ? zacharycarter: running the tests is a bit poorly documented I think zacharycarter: does the test command also compile the plugins? zacharycarter: I tried building a dylib from them myself but every time I run test they get deleleted zacharycarter: oh I see the plugins module compiles it for you - okay let me try that zacharycarter: yeah - crashes still when plugins are compiled with `--gc:arc` jb: hi guys jb: I'm compiling the following to the JS target: jb: import jsconsole jb: type MyEnum {.pure.}= enum jb: One = "A".cstring, Two = "B".cstring jb: console.log(MyEnum.One) # output: 0, expected: "A" jb: Is this a bug? Yardanico: is it the same if you try console.log($MyEnum.One) ? Yardanico: also please don't make code pastes in discord, it's a bit ugly for people in IRC here :P jb: Ah that did the trick, awesome. Sorry didn't know about the line splitting bot Yardanico: well I think the reason why the behaviour is different is because "echo" in Nim calls $ for all arguments, and console.log doesn't do that, so it outputs the numerical value of the enum element jb: That must be it, thanks a lot Yardanico: you can just use "echo" though I think Yardanico: no need for console.log, "echo" will work for JS target too Yardanico: nim "echo" in JS target uses console.log anyway jb: cool, didn't know that kodkuce: hmm is something wrong with 1.2 and async, just tryed to run exmaplel form https://nim-lang.org/docs/asynchttpserver.html Yardanico: yes kodkuce: basic usage simplest example Yardanico: it's already fixed in devel and will be in 1.2.2 kodkuce: so i can do chosenim head kodkuce: and it will wokr Yardanico: https://github.com/nim-lang/Nim/issues/13866 kodkuce: devel Yardanico: yep Yardanico: it's quite sad that it got into 1.2.0 but now we have proper tests for asynchttpserver :) kodkuce: hmm oh i frogot this mereged to irc kodkuce: wanted to say ty lbart: dom96: Thanks, my username is lbartoletti kodkuce: duno what does thunb up icon do ower irc or whawer dom96: lbart, getting a 404 for that, did you delete the account? lbart: dom96: Yes, and I try to recreate it lbart: I receive a mail to activate it lbart: but I got an "invalid ident hash" dom96: right, well I cannot bring that one back dom96: at least not easily dom96: do you have another account you didn't delete? lbart: I can create a new one lbart: dom96: "lbart" is created and activated lbart: (with the same adress as my former nickname) lbart: and the mail was instantanely dom96: good, I gave you "user" permissions lbart: dom96: thanks Recruit_main707: can macros affect emitted code?? Yardanico: what do you mean exactly? Yardanico: well macros can insert "emit" calls to emit raw C and stuff Recruit_main707: its hard to explaint, wait a min __ibrahim__: is there a way to automatically generate procs from a C or C++ lib? Yardanico: nimterop works for most C libraries Yardanico: but it still requires some manual work __ibrahim__: nice __ibrahim__: cpp is manual __ibrahim__: ? Yardanico: well there's c2nim which will work for some stuff, also nimterop might work a bit too __ibrahim__: thanks mate! im asking coz i couldnt find 3d physics in nimble Recruit_main707: this is more or less what i want to do: https://play.nim-lang.org/#ix=2hJn (i know about nimpy, this is different) Yardanico: well yeah you should be able to do this supakeen: Yardanico: Thanks for putting that back in my mind, I need to extend those tests to cover more of it now that the basis is there. Especially now that my own projects are running out of issues with all this staying at home stuff :) Yardanico: macros can add ANY ast to valid Nim code Yardanico: well I mean valid Nim syntax Yardanico: not code Yardanico: https://nim-lang.org/docs/macros.html#callsslashexpressions-pragmas supakeen: Is there any sort of coverage report for the nim testcases I could generate by the way? Yardanico: also @Recruit_main707 in the case of an example you've shown you can get away with a template I think Yardanico: ah no, you want to apply it as a pragma, sorry Recruit_main707: yes, and i will have to modify more things of the function body also very likely Yardanico: yeah then you need a macro shashlick: @zacharycarter thanks for checking zedeus: shashlick your telegram bot is reposting images kodkuce: hmm is there an easyer way to format this string """
Visit W3Schools.com!""" Yardanico: strformat module kodkuce: frogot closing div on end but, my point is if i have strings that contain " and i need in them to put my vairables is there some faster thing like kodkuce: ok will check kodkuce: hmm i think i am blind PMunch: kodkuce, you can backslash escape " kodkuce: beacomes or what kodkuce: lol i even mised backshals postion PMunch: And those are forward slashes :P kodkuce: oh ye that too xD kodkuce: ok got it working ty :0 kodkuce: and i missed now ) should buy new hands of kayboard inv2004: Hi, can someone explain the magic: I have a file with lines like "> test line\r\nABC", when I do file.readline(line): echo line - it outputs " test line\n A B C\n". inv2004: So => I do not see '>' and spaces? why ? PMunch: Because you're reading the wrong file? Yardanico: https://play.nim-lang.org/#ix=2hJJ Yardanico: works just fine Yardanico: https://play.nim-lang.org/#ix=2hJK this works too inv2004: Can you try this file? https://gofile.io/?c=s8RJDZ inv2004: I am very confused: I have one file which works on, and another one which is not. but in vscode both of them are ok inv2004: on = ok Yardanico: inv2004: it probably doesn't work because it's not just > Yardanico: repr for the first line gives this Yardanico: 0x7f615e6b7058"\255\254>\0O\0N\0E\0 \0H\0o\0m\0o\0 \0s\0a\0p\0i\0e\0n\0s\0 \0a\0l\0u\0\13\0" Yardanico: so there are \255 and \254 before the > PMunch: UTF BOM marker? inv2004: hm, hm, hm. Thank you inv2004: Looks like something wrong ... with Rust which generated it :) Yardanico: PMunch: seems like it's UTF-16 little-endian BOM xdd Yardanico: 0xFF 0xFE PMunch: Yardanico :D Yardanico: but it should be fine after you skip those two bytes I think Yardanico: since all of it is just plain ASCII except those two first bytes PMunch: Well, the file is still UTF-16 PMunch: See all those \0 in there? Yardanico: ah right PMunch: And since it's LE it's not ASCII compatible Yardanico: yeah you're right PMunch: Well, it wouldn't be either way.. PMunch: So Nim prints all the way to str.len, that's nice to know Yardanico: yeah, seems like it ignores null terminator in these lines kodkuce: hmm can i order interator first before using it or do i have to dump all from interator to seq then order it kodkuce: in my case iterator walkDir Yardanico: yes, you need to first get all values from it and then sort/order/etc kodkuce: hmm then question too is there some proc that returns me all file/dirs or do i have to walkDir add, am looking in OS modul duno if i am blind or what Yardanico: I don't think there's a module like that, you can just use toSeq from sequtils kodkuce: ok ty kodkuce: hmm i am getting some wierd error isent a tuple just an int? kodkuce: var paths = toSeq( cdir.walkDir(true) ).sort do ( x,y:tuple[kind: PathComponent, path: string] ) -> int: cmp(y.kind, x.kind) kodkuce: var result`gensym19665080: seq[type(cdir.walkDir(true))] = @[] kodkuce: for x`gensym19665081 in walkDir(cdir, true, false): kodkuce: add(result`gensym19665080, x`gensym19665081) kodkuce: result`gensym19665080, do (x, y: tuple[kind: PathComponent, path: string])-> int:result = cmp( kodkuce: y.kind, x.kind), Ascending)' has no type (or is ambiguous) Yardanico: pls don't paste like that, people in IRC suffer :P PMunch: Haha, was just about to type that up Yardanico :) dadada: kodkuce: use play.nim-lang.org kodkuce: i should start using irc for nim i alwies frogot stupit discord kodkuce: https://play.nim-lang.org/#ix=2hK0 Yardanico: @kodkuce how do you want to sort? Yardanico: by what I mean kodkuce: basicly i just want to compere if pcDir or pcFile thats pathComponent enum kodkuce: just wanted to put dirs on top Yardanico: oh Yardanico: well ok kodkuce: am trying to make simple http server like python one + option to upload too kodkuce: does bot show draged images or have to upload somwere else? Yardanico: it shows images just fine (as links) kodkuce: ok Yardanico: @kodkuce if you want dirs on top, you can do something like "var paths = toSeq(cdir.walkDir(true)).sortedByIt(it.kind).reversed()" Yardanico: but isn't it cleaner to have a for loop mantielero: Hello Yardanico: hi mantielero: How can I convert a NimNode into an identifier? Yardanico: what do you exactly mean? kodkuce: hmm how uou mean for loop Yardanico: @kodkuce nvm it would be a bit more complex Yardanico: but the code i gave you will work, but also import "sequtils" kodkuce: like from what i see only walkdirs is for going woer files kodkuce: wtf, ) Error: internal error: environment misses: result`gensym19665080 kodkuce: what is this gensym thingy mantielero: I want to create to create a random identifier that I can refer later. "let myname = genSym()", but I want to use it as an identifier Yardanico: genSym proc in macros has an "ident" arg KingDarBoja: Got a power outage last night 😢 kodkuce: hmm on nim playground it wokrs meybe its cuz devel? mantielero: when I do "myname.ident" I get a "node lacks field: ident" Yardanico: ah well I understood what you mean Yardanico: genSym is for creating symbols, not indents really Yardanico: can you provide a code example? mantielero: How can I create a random ident Yardanico: just create a random string? :P Yardanico: randomly generated* Yardanico: and "ident" proc Yardanico: https://nim-lang.org/docs/macros.html#ident%2CNimNode Yardanico: I had something like that in my own project, you can either use random module or just a global compile-time counter Yardanico: ah actually not "ident" but newIdentNode Yardanico: ah actually just "ident" :D mantielero: Let me try this (I have never used the playgraound): https://play.nim-lang.org/#ix=2hKa kodkuce: https://play.nim-lang.org/#ix=2hKb can somone comfirm this crashes on devel? mantielero: Do you see the code? Yardanico: yes Yardanico: @kodkuce I'll check just in a sec kodkuce: ty Yardanico: works just fine for me on latest devel here Yardanico: exact same code on linux Yardanico: are you sure you're on latest devel? :P Yardanico: it should work on 1.2.0 too Yardanico: since it works on playground which is 1.2 mantielero: Another thing that puzzles me is the comment "Deprecated: Deprecated since version 0.18.1; All functionality is defined on 'NimNode'." Where is that functionality defined? kodkuce: hmm i did choosenim dvel like 30min ago sealmove: on NomNode kodkuce: meybe i broke it somwere else brb mantielero: https://play.nim-lang.org/#ix=2hKc Yardanico: @mantielero https://play.nim-lang.org/#ix=2hKe Yardanico: in playground it will have no output, try it locally Yardanico: also ident argument for genSym is optional Yardanico: just try to use `eval_ff` in your quote do and comment out eval_f kodkuce: Yardanico: http://ix.io/2hKf kodkuce: meybe cuz its in async Yardanico: @kodkuce Yardanico: it's a known issue with asynchttpserver Yardanico: it's broken on 1.2.0 :P Yardanico: that's already fixed in devel though Yardanico: lemme try your code Yardanico: it works just fine kodkuce: did you uncooment kodkuce: that sort before run kodkuce: kodkuce: https://cdn.discordapp.com/attachments/371759389889003532/698934969598476288/2020-04-12_183643.png Yardanico: still works Yardanico: ah nvm it doesn't Yardanico: and I actually know whyt Yardanico: why kodkuce: 🙂 kodkuce: i would like to know too Yardanico: https://github.com/nim-lang/Nim/issues/10456 Yardanico: instead split it into two lines like https://play.nim-lang.org/#ix=2hKh mantielero: I get: Error: unhandled exception: transf.nim(1112, 10) `prc.kind in routineKinds` kodkuce: ok ty Yardanico: @mantielero hmm that's a compiler crash :P can you share the whole code to reproduce the same issue or try to minimize it? Yardanico: you can also open an issue on nim github mantielero: I have my code here: https://github.com/mantielero/ipopt.nim mantielero: It requires the library "ipopt" mantielero: The file that I am trying is: src/ex01.nim mantielero: It is a numerical solver that I am trying to wrap Yardanico: ok I'll try to run it locally mantielero: Thanks mate Yardanico: sorry, it's partly my fault, it seems to happen if you try to use a node made by genSym in quote do, also - do you plan on using that eval_f procedure outside of the macro or it'll be called by code generated inside of the macro? Yardanico: ah I understand why it's like that Yardanico: right mantielero: It is used by code outside of the macro. Yardanico: well then how will the user know the correct name for it? Yardanico: since you want to generate random names each time Recruit_main707: how did you print the ast Yardanico: expandMacros Yardanico: that's not for the AST though, it outputs Nim code Recruit_main707: of a given node Yardanico: for AST there's treeRepr, lispRepr and astGenRepr Recruit_main707: ok thanks Yardanico: @mantielero well your code will work if you call gensym like that "genSym(nskProc, ident="eval_f")" Yardanico: because symbol must be of a specific kind for declaration, in our case we want to use it for a procedure so we define it to be nskProc mantielero: I will try Yardanico: that macro will create a procedure with a name like "eval_f_13970296" Yardanico: so I guess you might want to ask the user to provide the name for the resulting procedure Yardanico: like that - https://play.nim-lang.org/#ix=2hKn Yardanico: basically just remove eval_f line, add first argument to the macro "name: untyped", in quote do use it like "proc `name`" Yardanico: and when calling the macro call it like problem(myProcName): body mantielero: I tried the nskProc thing. It seems to work, but then it fails on during linking: mantielero: Error: execution of an external program failed: 'gcc -o /home/jose/src/ipopt.nim/src/ex01 /home/jose/.cache/nim/ex01_d/stdlib_assertions.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_formatfloat.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_io.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_system.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_parseutils.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_unicode.nim.c.o FromGitter: ... /home/jose/.cache/nim/ex01_d/stdlib_strutils.nim.c.o /home/jose/.cache/nim/ex01_d/stdlib_strformat.nim.c.o /home/jose/.cache/nim/ex01_d/@mipopt.nim.c.o /home/jose/.cache/nim/ex01_d/@mex01.nim.c.o -lm -ldl' Yardanico: huh, can you paste full error on some paste service? Yardanico: also as I said even with nskProc the user will not know the name of the resulting procedure Yardanico: so he won't really be able to call it Yardanico: so you might want to let the user name a procedure himself (like in the modified ipopt.nim file I sent above) mantielero: On second though this all might be unnecesary. Because I will end up creating the call to the function. Like in here: https://github.com/mantielero/ipopt.nim/blob/master/src/ex01.nim#L205 Yardanico: oh maybe mantielero: But I want to be able to reference the function within the macro in any case Yardanico: yeah, with gensym and nskProc you'll be able to do that mantielero: https://pastebin.com/dTQyteDS mantielero: Strange because it complains about multiple definitions of `eval_f` Yardanico: yeah, strange, can you try removing nim cache by rm -rf ~/.cache/nim ? Yardanico: and trying again mantielero: Same failure mantielero: It is strange becuase `expandMacro` shows: https://pastebin.com/nZX6GrfT mantielero: So `eval_f_12805296` shouldn't clash with anything else Yardanico: try renaming ident in the proc to something else, maybe it'll work, not really sure mantielero: Fixed by doing: `let eval_f = genSym(nskProc, ident="eval_ff")` mantielero: I thing this might be bug in Nim mantielero: I believe it might be checking "ident" content instead of the final symbol ident kodkuce: can i tag a global variable to be .gcsafe. so it stops harrasing me with warinings mantielero: (Not sure these are the right words) kodkuce: let cdir = getCurrentDir() like how is this unsafe if in global kodkuce: its not mutable so hmm Yardanico: it talks about GC memory Yardanico: you can ignore it if you don't use multiple threads Yardanico: strings are GC'd in Nim kodkuce: so if i use threads it will will not copy it to seperate thread? Yardanico: nim has thread-local GC heap, but that'll be solved by arc memory management model which is in development kodkuce: or GC will dump it in one thred Yardanico: so with the current default GC you can't really pass GC'd objects between threads without using raw pointers kodkuce: i can use raw pointer for this i guess cuz it will newer change anyway Yardanico: you need threads? kodkuce: or use beohem but think its better to use raw pointer kodkuce: 9999% noth but why not Yardanico: ??? JohnAD: @dom96 You around today? kodkuce: Error: expression has no address; maybe use 'unsafeAddr' Yardanico: it should be "var", not "let" if you want to get its address kodkuce: beh i will just call evry request getCurrentDir like tard Yardanico: why not use simple caching? kodkuce: hmm what kodkuce: feed me like i like metal oval things xD Yardanico: check if less than 10 (or whatever) seconds passed since the previous request and if not, reply with old cached string Yardanico: otherwise walk the dir again and return the new value Yardanico: and don't forget to set the cache variable to the new value Yardanico: and change last time too kodkuce: hmm dont i need to build catch first, i dident know asynchttpserver stores catches automaticly, anyway my issue is this is retarded cuz getCurrentDir() is dir from where i run my server and it newer changes Yardanico: ?? asynchttpserver doesn't cache anything Yardanico: @kodkuce well you can specify absolute path to walkDir and ask the user to provide the path Yardanico: although there's no need for caching well (I mean there is, but it would be a bit harder to implement since you'll need to use a table or two of them) kodkuce: i think you are owerthinking what i am doing, i just trying to make like python -m http.server kodkuce: just server currten dir kodkuce: user has nothing to input whatewer i just need a string that will alwies be same Yardanico: ok kodkuce: like it gets populated on first run with let cdir = getCurrentDir() dadada: where is disruptek? wanna watch his stream Yardanico: dadada: his router died I think Yardanico: so he isn't online kodkuce: but insted using that one, now i for ewry request i do let cdir = getCurrentDir() and thats kinda retarded Yardanico: well just do simple caching as I said Yardanico: although python -m http.server doesn't do any caching at all kodkuce: cuz it probbaly has curent dir in variable or someting Yardanico: ??? kodkuce: like i need constant path to dir from what i run myserver Yardanico: you don't ? Yardanico: well you might need it yeah but that's the issue Yardanico: I just don't understand what's the problem you're having kodkuce: hmm, like i open some Folder, and i run myNimSimpleHttpServer, i want to serve that dir and cuz of that i need to have dirpath in variable or to evry request do let cdir = getCurrentDir() thats probbaly infecient to do and retarded cuz you can store it in variable Yardanico: if you do "let cdir = getCurrentDir()" in global scope getCurrentDir will only get called once Yardanico: since "let" is not an alias, it's for ASSIGNING a value to a variable kodkuce: my problem is if i expose let cdir = getCurrentDir() as global var then GC crys how its not usnefe Yardanico: it's just a warning as I said Yardanico: and it can be safely ignored if you don't use threads Yardanico: and asynchttpserver doesn't kodkuce: i know but i hate it and i say i can use gc:beohem or try that pointer thingy but then it coplains 'unsafeAddr' Yardanico: you can disable warnings kodkuce: hmm so asynchttpserver does not use threads if too much requests? Yardanico: it's async so it doesn't use threading at all kodkuce: if i turn threads:on Yardanico: it won't use threads anyway Yardanico: "threads:on" is not a "magical" switch Yardanico: it doesn't magically make all of your code threaded :) kodkuce: ye but i thinked it has some limit and if i 0thread is stucked with CPU it will spawn new thread kodkuce: guess i watched too much harry poter then Yardanico: it won't, and that would've been mentioned if that was the case Yardanico: "httpbeast" can do threading by the way Yardanico: and it's used by "jester" if you run on a supported OS like Linux kodkuce: hmm ye i run linux, but anyway am making this for just times when you need a simple http server and kinda dont give a crap about pefomance xD Yardanico: well so why are you worrying so much then? :P Yardanico: warnings are not errors kodkuce: cuz i hate that warring thingy kodkuce: ye i know i can suppress but i have to type stuff for that kodkuce: guess can bash alias it Yardanico: or you can create a config file for your nim file Yardanico: either .cfg (old config format) or .nims (nimscript) Yardanico: if .nims, name it "nameofyourmainnimfile.nims" and put warning("GcUnsafe", false) there Yardanico: and put it in the same folder with your main file kodkuce: ("GcUnsafe", false)' is of type 'tuple of (string, bool)' and has to be discarded kodkuce: to add discard infront or what Yardanico: in .nims Yardanico: and ignore the errors from VSCode, it can't properly handle .nims files right now kodkuce: yes its in simpleserver.nims Yardanico: I mean the Nim extension kodkuce: not in simpleserver.nim Yardanico: it'll work fine Yardanico: it's just that nim extension thinks that .nims is same as .nim eagledot: Hello nixfreak: !hash nixfreak: !help Yardanico: ? nixfreak: bot commands Yardanico: disbot is down nixfreak: oh sorry didn't know eagledot: Is it possible to just forward declare a struct in C and use it in a function prototype in a header file like leorize[m]: yea, disruptek's router is kinda broken, so disbot went with him leorize[m]: @eagledot: I'm not sure what you're trying to achieve here... eagledot: Is it possible to forward declare a struct and then use it in a function prototype in a header file like... ⏎ `typedef struct temp` ⏎ `void function(temp **)` sealegs: When I do `parseBiggestInt(id).int` it gives me a range error Yardanico: how's that related to Nim? :P Yardanico: @sealegs how the error looks like? sealegs: ``` sealegs: fatal.nim(48) sysFatal sealegs: asyncfutures.nim(431) asyncCheckCallback sealegs: asyncfutures.nim(383) read sealegs: Error: unhandled exception: value out of range: 571359938501410826 [RangeError] sealegs: Error: execution of an external program failed: 'C:\Users\KrispPurg\Desktop\Projects\Programming\nim-lang\discord_bots\dimscord\main.exe '``` eagledot: https://github.com/Picovoice/porcupine/blob/master/include/picovoice.h ⏎ There is this header file...i was trying to call `pv_porcupine_init` Yardanico: @sealegs well don't convert it back to "int" then Yardanico: seems like your' compiling for 32-bit arch so "int" is 32-bit Yardanico: hence it can't hold this value in an "int" type Yardanico: s/your'/you're eagledot: There is no definition of struct ..just declaration...and then it is passed into a C function ...when i try to just declare an `object type` and try to get the pointer ...it says expression has no address leorize[m]: @eagledot: you're doing it wrong :) eagledot: `typedef struct pv_porcupine pv_porcupine_t; ⏎ void pv_porcupine_init( ⏎ ⏎ ``` pv_porcupine_t **object);```` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e9356e53a85536c4325ba39] Yardanico: can you show nim code? sealegs: sure sealegs: ```nim sealegs: proc getShardID*(id: string): int = sealegs: result = (parseBiggestInt(id) shl 22) mod 1``` Yardanico: well I didn't ask you @sealegs but ok :) and I already answered sealegs: oh lol leorize[m]: @sealegs: please don't paste code into discord Yardanico: either compile for 64-bit or use int64 everywhere where you handle id leorize[m]: use play.nim-lang.org for pasting leorize[m]: `BiggestInt` is an actual type too btw leorize[m]: @eagledot: you gotta explain what exactly does that init function take :) awr1: `type PVPorcupine = object; proc initPVPorcupine(obj :var PVPorcupine)` awr1: or `proc newPVPorcupine() :ref PVPorcupine = result.new` leorize[m]: anyhow, this is how we would wrap it in Nim: https://play.nim-lang.org/#ix=2hL7 awr1: yeah without more context i'm confused what you're trying to do awr1: https://github.com/Picovoice/porcupine/blob/master/include/pv_porcupine.h awr1: are you trying to generate bindings to this? awr1: i reccomend nimterop awr1: https://github.com/nimterop/nimterop eagledot: @awr1 Yes.. eagledot: I was confused as there is no defintion of `struct pv_porcupine_t`. eagledot: The c code is passing `pv_porcupine_t **` awr1: does Porcupine need to build anything separately or can you just import it as a header eagledot: https://play.nim-lang.org/#ix=2hLg leorize[m]: @eagledot: that is a C idiom for opaque struct leorize[m]: see my example above for how to define it in Nim awr1: yeah if you wanted a opaque struct that is C-compatible do leorize's thing awr1: i was confused if you were just writing nim code by itself and wanted to know the equivalent to something from C or actually making bindings to something eagledot: Now i actually wanted equivalent in NIM ...by reading C header file...they provide dll. ⏎ Thanks for the help. i will try your code eagledot: what does pragma `cdecl` does? kodkuce: how do i send file in respons in asnchttpserver kodkuce: i read it with streams and just put it as repsons string and add {application type} kodkuce: or what awr1: what is the dll name leorize[m]: @eagledot: it tells Nim to use C calling convention eagledot: @awr1 `libpv_porcupine.dll` ⏎ https://github.com/Picovoice/porcupine/tree/master/lib/windows/amd64 eagledot: Is it not the default i.e C convention? leorize[m]: yea, the default is Nim calling convention leorize[m]: which differs depends on which OS you're on awr1: https://gist.github.com/awr1/d3b7198a0c3941e971e78ff9091ae07f awr1: this might work awr1: uhh awr1: whoops awr1: fixed it awr1: i think leorize[m]: https://play.nim-lang.org/#ix=2hLn <- that's a handwritten high-level wrapper awr1: i didn't test it fwiw but it seems simple eagledot: @awr1 I am a newbie to nim:) ⏎ That is alot for me to undestand ...thanks though :) awr1: nimterop is an advanced binding generator awr1: you can install it with `nimble install nimterop` awr1: then all you do is just import that file eagledot: is it like c2nim? leorize[m]: it's better :P awr1: it can use c2nim if you want awr1: but in general it's very easy to use, is automatic and doesn't require you to have to implement extra steps in your build system awr1: once you make that, procs like `porcupineInit()` should be available eagledot: @ leorize[m] In your code your are using `ptr porcupine` while C prototype expects ` struct **`, am i missing something? leorize[m]: https://play.nim-lang.org/#ix=2hLt <- better wrapper that accounts `pv_status_t` leorize[m]: @eagledot: I use `var Porcupine` eagledot: Should it not be double `pointer.` i.e like `ptr ptr PorcupineObj` leorize[m]: which expands into `var ptr PorcupineObj` leorize[m]: this requires some understanding in C semantics leorize[m]: the generated Nim code will be `ptr ptr PorcupineObj` eagledot: OK. awr1: also speaking of nimterop, did you read my comments @leorize https://github.com/nimterop/nimterop/issues/177#issuecomment-612507171 Prestige: It appears you can omit pragmas on procs if you forward declare procs with them, is this recommended though? E.g. https://play.nim-lang.org/#ix=2hLw Prestige: I feel like it'd be easier to maintain if it's a proc you're forward declaring, at least Prestige: Also leorize[m] does your plugin have autocomplete for pragmas? leorize[m]: Prestige: typically, I'd avoid forward declaring altogether leorize[m]: and no, I don't autocomplete pragmas or keywords leorize[m]: they are short so I don't really bother Varriount: Forward declaring (for now at least) is a necessary inconvenience. Prestige: I have keyword autocompletion set up but nothing for pragmas unfortunately, think it's just useful to prevent typos leorize[m]: my plugin highlights them KingDarBoja: I had to use forward declaring in order to keep things consistent with source code leorize[m]: so if you made a typo you will see it :p Varriount: Ideally there would be a tool that would create and sync forward declarations with their implementation. Prestige: hm that's nice. What plugin am I using for syntax highlighting... Prestige: ah, zah/nim.vim Prestige: Varriount that would be very nice leorize[m]: zah/nim.vim syntax highlighting is terrible Prestige: Yeah I'm going to try yours for highlighting Prestige: Im just hoping the autocompletion doesn't conflict with coc-nvim leorize[m]: it won't do anything if you don't configure it Prestige: I love it, that's how plugins should be set up by default leorize[m]: I'll see if it's possible to hook this up with coc-nvim Prestige: Which nim.vim was it again? idr your github username leorize[m]: does templating works on coc-nvim with nimlsp (ie showing you the proc prototype as you write your code)? leorize[m]: Prestige: alaviss/nim.nvim Prestige: Yep Prestige: ty leorize[m] leorize[m]: for maximum highlighting, make sure the file you open is saved on the disk :) Prestige: oh that's much better highlighting! leorize[m]: it just have to exists, then I can employ nimsuggest on it :P dadada: PMunch: any tryExtract news? PMunch: dadada, not really PMunch: I've been away at our cabin for easter PMunch: Just got back today :) dadada: PMunch: convenient excuse for burying bodies in the woods :-) Prestige: s/bodies/eggs (nothing to see here FBI) tane: how is one supposed to obtain a "ptr proc(foo,bar)"? (trying to set a callback in the linenoise module) PMunch: The bodies of those who's sticking their nose in the macroutils module where they don't belong dadada: I knew it leorize[m]: Prestige: if it's convenient, can you show me how nimlsp + coc-nvim looks like? :) Prestige: hm sure I'll make a very short video PMunch: coc-nvim? zetashift: an LSP provider for neovim? zetashift: and iirc also autocompletion Prestige: Yeah Prestige: https://0x0.st/iQrs.mp4 Prestige: leorize[m]: ^ leorize[m]: nice, can you show how it's like when you're typing parameters? thanks :) Prestige: Hm I don't think I'm getting param autocompletion like I normally do with other languages, I'm just setting the proc signature PMunch: Huh, neat Prestige: s/setting/getting Prestige: My brain is off this morning Prestige: leorize[m]: with other langauges with coc-nvim, I usually am shown the function signature each time I use a comma to start entering the next parameter Prestige: but I guess that's not happening with nim yet KingDarBoja: Anyone said syntax highlighting? leorize[m]: it will once I found the motivation to work on it :P KingDarBoja: Been using the vscode-nim extension, is there a different one 👀 leorize[m]: use neovim and you'll get first class syntax highlighting :P kiwi_41: Hi Prestige: I think just has to do with nimlsp features? kiwi_41: how is embedding smh like Lua to nim program? kiwi_41: are there any libs for that? PMunch: Might be a missing feature in nimlsp as well leorize[m]: nimlsp still gotta base its feature on nimsuggest :p Prestige: coc-nvim interacts with the lsp so I think it's just that, but it's nbd. nimlsp works really well Prestige: True KingDarBoja: Ah Lua, I remember taking free courses on 2D game dev on Lua lol PMunch: leorize[m], indeed, but not everything in nimsuggest is in nimlsp yet PMunch: kiwi_41, depends on what you need leorize[m]: PMunch: the `con` command should get you the function signature for as long as the cursor is inside the function call params kiwi_41: I guess id like some scripting options for data my nim program will spit out PMunch: Then maybe look into tying NimScript into Nim kiwi_41: i would prefer smh mainstream like Lua :D leorize[m]: https://github.com/jangko/nimLUA KingDarBoja: Nice leorize[m]: PMunch: the only reason why nim.nvim doesn't use nimlsp is because you haven't got it merged into Nim yet :P leorize[m]: and that you haven't cracked semantic highlighting over lsp too :P PMunch: Well, it uses external Nim packages.. PMunch: There is an extension to LSP that does that.. leorize[m]: dr nim uses external packages too :) PMunch: It does? Yardanico: z3 leorize[m]: and zevv's nimz3 wrapper PMunch: Huh, when I decided not to make a PR for nimlsp it was because of external dependencies. But maybe now that the flood gates are open.. Prestige: hm this is interesting: https://nim-by-example.github.io/variables/result/ Prestige: In the 'unexpected' proc, I would expect `result` to be shadowed Prestige: Or is it that, if you shadow `result`, you must explicitly return result? kodkuce: i got GET part working but hmm how do i upoload a file to asynchttpserver, am trying to net depend on js , so i tryed with plain HTML5 post and int but nothing for the other way. leorize: int is it's byte representation :) Avatarfighter: o leorize: or if you want the boring way: `cast[array[sizeof(int), byte](int)` KingDarBoja: https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants leorize: @Avatarfighter: maybe you actually have to cast the address, I'm not sure :p leorize: but that's basically how it's done __ibrahim__: how can the same nim code work on mac but give errors on windows? could it be the compiler differences? leorize: depends on the error Avatarfighter: welp I've found a little bug https://dsh.re/937b2 Avatarfighter: or rather unexpected output Avatarfighter: hm idek what that is it has like all the method names in my binary near the bottom leorize: did you just `cat` your own binary? Avatarfighter: i did not lma Avatarfighter: https://dsh.re/e1cdf Avatarfighter: just messing around atm KingDarBoja: Hey leo, by using object variants, the `ref` is needed for the base Node? leorize: no, but yes leorize: yes because you're going to reference the type within itself leorize: no because it's not a requirement of object variants KingDarBoja: Okay, let's do this, gonna see if that will send to trash 2 days of porting lol leorize: @Avatarfighter: lol you don't simply cast that into a `string` leorize: use `$` instead lol leorize: actually `repr` is better since it can display blank characters KingDarBoja: Mate and what happens if I want to provide one of the main Node kind (lookin at the example) to a child indent? KingDarBoja: i.e. `nkAdd` has leftOp: anotherNodeKind ? Avatarfighter: Leorize ik I'm just messing to see if I can get a int into its binary representation lol Avatarfighter: Welp I got what I was looking for its less that I was trying to get my int into its binary representation but rather I was trying to write big endian into a StringStream which is basically an impossible task with the current streams lib but I understand why since that lib doesn't say its meant for binary data KingDarBoja: https://github.com/nim-lang/RFCs/issues/19 leorize[m]: @Avatarfighter: it's... possible? Avatarfighter: leorize: Yeah it's possible I just was doing it the exact opposite way of what was easy to do leorize[m]: lol Avatarfighter: leorize do you mind telling me if this is the best route to write big endian by any chance hahah 😄 https://dsh.re/357d3 leorize: lol no leorize: you already messed it up Avatarfighter: I swear im not this bad at nim I've never used these libraries before and I'm in unknown waters haha leorize: note that the two pointers passed to bigEndian must not be of the same one :P Avatarfighter: but it works though? leorize: for when you're on an architecture where the compiler implements the intrinsic, yes Avatarfighter: ah leorize: but the generic implementation straight up copy between the two pointers lol Avatarfighter: hahah ok Avatarfighter: So I should add another var to hold the number im passing in like so: https://dsh.re/5c369 ? Avatarfighter: the reason why I don't want to pass a var into the proc instead is bc I still need the int i pass into my proc for later KingDarBoja: I just finished reading this entire issue KingDarBoja: https://github.com/nim-lang/Nim/issues/6638 KingDarBoja: And just made a quick change by removing ref of all my object types (base and derived) to see how it works the `==` operator KingDarBoja: But damn, can't use `nil` for my object so any usage of `isNil` breaks my code lol KingDarBoja: Going yeet with custom `==` for my ref objects xD leorize: Avatarfighter: sure that doesn't look bad Avatarfighter: Cool thanks for the help leorize 😄 KingDarBoja: I just noticed `unindent` removes any whitespace character for every line in a string on Nim whereas Python textwrap.dedent does search for the common leading whitespace and removes it. KingDarBoja: So the Nim version will keep any triple string quotes aligned on the same column whereas Python will keep the indentation Rika: what KingDarBoja: A picture will show u KingDarBoja: https://imgur.com/sOq9zLt KingDarBoja: Left side, Python, right side Nim KingDarBoja: https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#string-ops Rika: unindent(2) Rika: pass in a number, it will do that much whitespace Rika: if you dont, itll do all whitespace possible Varriount: Araq: Why can't iterators be forward-declared? KingDarBoja: Nope, it should be dynamic Rika KingDarBoja: I mean, detect the common indentation and remove that only KingDarBoja: Need to look at textwrap.dedent to see how they do it Rika: `Nope, it should be dynamic Rika` well i mean Rika: its not what it does Rika: the cost of it being dynamic would prolly be much more expensive than what it does right now KingDarBoja: Yeah, don't get me wrong, I know what you mean 😄 ryukoposting: https://chromaengine.gitlab.io/ABOUT.html ryukoposting: coming soon to a git repo near you Rika: ryukoposting: i have an idea, make it a goal to "be able to run DDLC" on that platform (of course after translation from python/renpy to nim/chroma) Rika: because i think ddlc has some interesting renpy usage, not too sure ryukoposting: oh it could easily do DDLC ryukoposting: It could do 95% of DDLC in its current state lmao, I'm not even done with the beta release yet ryukoposting: idk if DDLC's creator would like it if I literally copied his game though Rika: i mean dont post it of course Rika: use it as an internal test haha moerm: Hello, everyone Gary M: Hello Prestige: Anyone here using nimlsp? For some reason the build is failing for me with nimble install nimlsp Prestige: https://0x0.st/iSgd.txt Prestige: Nim version 1.2.0 [Linux: amd64] Prestige: hm I think I may have gotten it to install but don't know how to search for installed packages Recruit_main707: Has someone tried to run autoWIG on the produced Nim code? solitudesf: Prestige, `nimble list -i` Prestige: ah thank you. It seems it did fail to install solitudesf: you can add --debug flag, to also show compiler output Prestige: https://0x0.st/iSEs.txt Prestige: Error: cannot open file: /usr/nimsuggest/nimsuggest.nim - hmm solitudesf: yes, it need nimsuggest source, which distros dont package solitudesf: you need to clone nim repo solitudesf: and use -d:nimsuggestpath: flag Prestige: Thanks I'll give that a shot solitudesf: you can pass flags to compiler with `nimble install` using `-p/--passNim` Prestige: I attempt giving it the directory of nimsuggest and also the nimsuggest.nimble file: https://0x0.st/iSEK.txt Prestige: s/attempt/attempted solitudesf: nimble install nimlsp -p:-d:nimblesuggestpath:/home/avahe/programming/nim/nimsuggest/ solitudesf: wait solitudesf: its nimsuggestpath not nimblesuggest solitudesf: cmon man solitudesf: nimble --debug install nimlsp -d:nimsuggestpath:/home/avahe/programming/nim/nimsuggest/nimsuggest.nimble solitudesf: nimble install nimlsp -p:-d:nimsuggestpath:/home/avahe/programming/nim/nimsuggest/ solitudesf: 3rd time the charm moerm: Hello, again Prestige: hi moerm Prestige: woo thanks solitudesf danielo515: Hello everybody. I was wondering what is the best way to iterate a sequence from certain index, or if it is better to create a new sequence from it? Yardanico: there are slices Yardanico: https://play.nim-lang.org/#ix=2hzt Yardanico: https://nim-lang.org/docs/tut1.html#advanced-types-slices Varriount: @danielo515 If you want efficiency, use a `for` loop on a range `x..y`, and grab the element using the loop variable. danielo515: Yes, I want efficiency, but not at the cost of readability 😄. danielo515: What I want is, to iterate the seq from certain index (than can be achieved with the range starting at the index, nice) and stop when the sequence is exhausted or certain condition is met Prestige: niche question, does anyone have nim editing set up with coc-nvim? danielo515: @prestige, no I don't but I know one vim "distribution" that has it set up, it's on a docker container so you can try it Gary M: Hey guys, so I'm curious about the proper steps towards wrapping a C++ library with nim. I've read a few sparse things in the docs but overall I'm not clear on how to actually write a wrapper. Prestige: with coc-nvim? That'd be cool if I could see how they have it set up danielo515 danielo515: yep, it is called vindi danielo515: https://github.com/D-Nice/vindi danielo515: Here is the init.vim danielo515: https://github.com/D-Nice/vindi/blob/master/etc/init/.config/nvim/init.vim moerm: Have a nice day all Prestige: Looks like they are actually using other nim plugins maybe Prestige: oh maybe not, they are registering nimlsp in coc-settings.json Prestige: maybe my nim setup just isn't proper Prestige: when attempting to run nimlsp, I get "Unable to find "config/nim.cfg" in "/usr". Supply the Nim project folder by adding it as an argument." Prestige: I can supply it a config and it doesn't complain (from a terminal), but I'm getting no lsp features in the editor Prestige: ah yep. 'Error: cannot open '/home/avahe/.config/nim/lib/system.nim' danielo515: @Prestige, this VIM distro is on a docker container. Maybe you can run it, see if it fits your expectations and then investigate it's folder structure Prestige: It appears my distro just didn't package nim in the way nimlsp expects, so I'm going to create some directories and symlink the config file Yardanico: just use choosenim :P Prestige: didn't know that existed, looks good Prestige: But I did get it working with a single symlink so I'm happy for now danielo515: mmm, is there a way to iterate a sequence of custom types? danielo515: This is telling me there is no match for my sequence type: danielo515: danielo515: ``` danielo515: proc printFile(file:FileInfo, belowFiles: Slice[FileInfo]) = danielo515: for f in belowFiles: danielo515: ``` alehander92: guys alehander92: i got my solid code book alehander92: starting to read books alehander92: about stuff alehander92: posts are awesome, didnt expect such a good delivery+service solitudesf: @danielo515 Slice is not a sequence, its just a range Prestige: Have syntax highlighting, autocomplete, docs and everything in vim now. This is so awesome planetis[m]: i bought "classical computer science problems in python" in february but it got lost but thankfully manning will sent me another danielo515: > @danielo515 Slice is not a sequence, its just a range danielo515: Oh, so I can not iterate it then? Yardanico: you can, but you need a seq Yardanico: belowFiles should be seq[FileInfo] and you should pass it as a sequence danielo515: My intention was to pass a sub-seq of the original and iterate it, but I think that may be to inneficcient danielo515: I better pass the idx and the entire seq Yardanico: if you want to pass " sub-seq" you need to use a seq type anyway Yardanico: Slice of a sequence returns a sequence Yardanico: !eval echo @[1, 2, 4, 5][2..^1] NimBot: @[4, 5] danielo515: How do I slice a sequence? danielo515: that's what I tried danielo515: And I thought that created a slice. I may be wrong though danielo515: By the way, how can I create a sequence with certain size and filled with one repeated value? Yardanico: There's "fill" in algorithm module Yardanico: and certain size - either newSeq or newSeqOfCap planetis[m]: newSeqWith Yardanico: oh Yardanico: from sequtils danielo515: newSeqWith is exactly what I was looking for danielo515: Thanks danielo515: I was looking for on the nim tutorial, and in seqUtils and I didn't found it danielo515: my bad danielo515: Is there an equivalent for arrays? Yardanico: arrays :) Yardanico: https://nim-lang.org/docs/tut1.html#advanced-types-arrays Yardanico: arrays in nim are fixed-length (you can't change their length at runtime) danielo515: yep, I tried to create an array and the compiler yelled at me danielo515: I'll stick with seq then Yardanico: the simplest way to create an array is "let a = [1, 2, 3]" danielo515: Thanks again danielo515: Why other sequences has a len prop but this one does not? danielo515: ``` danielo515: let depth = path.parentDirs.len danielo515: ``` Yardanico: because parentDirs isn't a sequence Yardanico: it's an iterator Yardanico: https://nim-lang.org/docs/os.html#parentDirs.i%2Cstring Yardanico: you can either process its values in a for loop or do "let data = toSeq(path.parentDirs)" Yardanico: and use data.len where you need Yardanico: toSeq is from sequtils danielo515: I already have seqUtils imported danielo515: I was doing this: danielo515: ``` danielo515: var depth = 0 danielo515: for f in path.parentDirs: depth += 1 danielo515: ``` danielo515: But is kinda ugly danielo515: Wow, I got an unexpected behavior danielo515: I changed that to danielo515: ``` danielo515: let depth = toSeq(path.parentDir).len danielo515: ``` faulander: good morning guys. if i get a Error: invalid indentation but there's clearly no indentation problem, what might be the error? danielo515: And depth goes from 2,3 etc to 2, 11, 15... Yardanico: also @danielo515 can you please not use ``` ? in IRC we see it as 3 lines Yardanico: @faulander can you show the code example? danielo515: Ok, how should I do it then? Yardanico: just like "let depth = toSeq(path.parentDir).len" or use paste services :P Yardanico: @faulander or maybe you forgot to place some symbol like : or = somewhere faulander: for pattern in unWantedDirNames: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e91a342cc370f0b07d91310] faulander: ok, indentation is lost here Yardanico: that's not corrent nim anyway Yardanico: " dir[:posUnwantedDirName+1]" I assume you wanted a slice? faulander: yes, true Yardanico: if you want to have this slice in nim do dir[0..posUnwantedDirName+1] faulander: from the beginning to the start of th match Yardanico: nim slices are different from python slices Yardanico: oh, or dir[0..posUnwantedDirName] faulander: (https://files.gitter.im/nim-lang/Nim/p4kh/image.png) faulander: (https://files.gitter.im/nim-lang/Nim/p4kh/image.png) faulander: aaaah, i need to learn to read first! Yardanico: xddd faulander: haha, i was happy that it's the same as in python ... the error is VERY missleading though Yardanico: well I hope you understand that Nim has much less common in Python than it seems at first :) Yardanico: and yeah, error could've been better faulander: yes, that's why i chose to consult the notes ... i just didn't read that the code example was for python, not nim. dom96: What a lovely and sunny quarantine Easter weekend we have going on here, how's everybody doing? faulander: being in quarantine sucks ... but: Less clothing to wash, shorter way to work, more time for learning nim ... you continue. faulander: less possibility to waste cash, not needing to look at the face of the most unwanted employee, GOOD coffee, being able to vape ... i am an optimist and find good parts of almost any situation ;) dom96: Nice, definitely a lot of silver linings :) eliezedeck: Hey guys, when trying to `koch temp c ...`, I get an error saying `Error: system module needs: echoBinSafe` if I add `echo` something in `sysstr.nim` eliezedeck: how can I solved this? dom96: I guess us programmers, who are typically not very social anyway don't find it as tough as most people Yardanico: very true for me :P dom96: eliezedeck: importc printf and use it instead eliezedeck: ok, thanks eliezedeck: I'm still curious as to why is it this way? danielo515: I am playing with walkDirRec... and by default it only yields files, if I add a yieldFilter like `yieldFilter={ pcDir, pcFile }` then it yields all the folders, then all the files. Isn't a way to yield everything as it is traversed? danielo515: like folder a, file a1, folder b, file b1, file b2 faulander: for dir in walkDirRec(sourceDir, yieldFilter={pcDir}): #traverse all dirs in source path ⏎ for file in walkDirRec(dir, yieldFilter={pcFile}): # traverse all files in dir faulander: just use nested for loops, that's what i did anyway. faulander: another file related question to the pros here. i cannot find a renameDir proc ... is really moveDir the only option? Yardanico: it does the same faulander: speedwise not, or? Yardanico: no, the same Yardanico: when you MOVE the directory the FS doesn't actually copy any data Yardanico: it just changes the "place" where it's stored faulander: ok, perfect. thanks faulander: @dom96 faulander: unfortunatelly i am not a programmer by profession, i am head of support and after project management. i code as a hobby. dom96: ?? kungtotte: I drive a septic tank truck for a living and spend my spare time in front of the computer, so aside from having to keep my distance at stores and not being able to go some places with my kid because they're closed, my life is identical during social distancing compared to before it. kungtotte: I'd say it's even better in some regards because now I don't have to do some things I'd rather not, like go to my cousin's birthday party or his wedding :P faulander: i miss my family and friends. that's the only downside for me. danielo515: > just use nested for loops, that's what i did anyway. danielo515: @gitterirc danielo515: In other languages I just use recursion. But since there is already a recursive for traverse I wanted to take advantage of. I can't use nested for loops because I want all directories and all files recursively, so I need to know when I "enter" a nested folder. I guess the best bet is to get all the folders rec, then list each folder for its contents go|dfish: @danielo515 https://github.com/nim-lang/Nim/tree/version-1-2/lib/pure/os.nim#L2129 go|dfish: that's the code for walkDirRec - don't think there is a way to get it to do what you want with how it's implemented alehander92: use recursion alehander92: kungtotte well birthdays can be fun danielo515: Tha KS for the reference faulander: can i do something like that? ⏎ proc test(s:string, posStart:int = 0, posEnd:int = len(s)): string = Yardanico: I think there was an issue and PR for that, but it wasn't merged, but let me find it Yardanico: oh actually it works faulander: otherwise i set it to 0 and right after the declaration to len(s) - or is there a better way? Yardanico: your code will work just fine Yardanico: also you don't need to specify the type when you have a default value faulander: i got an error ... but maybe it's again because of something else :D Yardanico: proc test(s: string, posStart = 0, posEnd = len(s)): string = stuff Yardanico: https://play.nim-lang.org/#ix=2hAq faulander: if i set the default to nil i don't have to set a type either? faulander: and thanks for the demo code Yardanico: you have to set the type if you use "nil" Yardanico: but "nil" can only be used for ref types anyway faulander: how would i use optional arguments then? Yardanico: set a default value? faulander: just with an empty default value? faulander: ah, sure. makes sense :) faulander: i am such a newb :) faulander: i have to use the "*" for procs which should be useable after import. does it have any negative side effects, if i use the star on all procs right off the start? Yardanico: well the worst is that your proc might clash with some procedure from other module (since nim imports the whole module namespace by default), but it's really rare Yardanico: and programmer can fix it by specifying what to import from a module, or what NOT to import faulander: yes, i thought that. thanks. faulander: one more question. An empty string doesn't evaluate to false, is there a reason behin it? Yardanico: wdym "evaluate to false" Yardanico: you can't really convert a string to a boolean Yardanico: nim is not python :) Rika: hey, you can faulander: yes i know. but since i am coming from python, i am used to that behaviour and wonder why some decisions have been made. i don't have a problem to write if s == "" instead of if not s, but pythons clearer here Rika: `string != ""` Rika: easy sealmove: guys, is there a way to make this work: https://play.nim-lang.org/#ix=2hAu ? Rika: it Rika: oops Rika: premature enter key Yardanico: *cough* Rika: it's only clearer because most people think that "when strings are empty, theyre false" Recruit_main707: sealmove, let the a variable be of type A instead of ref RootObj Rika: but that is a baseless assumption sealmove: Recruit_main707: I want to achieve polymorphism on fields sealmove: I know it's possible on procs with "method", but is it possible on fields? I expected it to work by default since inheritance is used faulander: Rika, you are of course right: empty isn't false. Rika: https://play.nim-lang.org/#ix=2hAw Rika: sealmove: ref RootObj isnt a valid class to use Rika: RootObj is abstract AFAIK sealmove: ok, but your example makes no sense sealmove: I need x to be declared under B, not A Rika: faulander: thats exactly why there's no truthiness here, what do you consider true and false is dependent on the person Rika: sealmove: change it to B Rika: still works sealmove: https://play.nim-lang.org/#ix=2hAy Rika: huh? Rika: that makes no sense sealmove: yeah Rika: the one you sent Rika: makes no sense Rika: i mean the code, not the result Rika: the result makes sense given the code Rika: think this: not all As have an x, but all Bs do Rika: not all subtypes of A have an x either Rika: which is why that fails Rika: okay Rika: i understand what you want now Rika: ` I know it's possible on procs with "method", but is it possible on fields? I expected it to work by default since inheritance is used` its not sealmove: I see Rika: i dont see why it would be added either Rika: faulander: you good? sealmove: So with method both the supertype and subtype should have the method implemented, while with fields it's different because supertype and subtype can't even have a field with the same name. I see now. danielo515: Is it possible to call `result.add` more than once in the same proc? Rika: sealmove: if you think about it, what are you supposed to change when it comes to "dynamic dispatch" fields? values are assigned on instantiation, types are types and must be the same even on methods, names must be the same for it to even work Rika: @danielo515 i dont see why you can't Rika: result isnt return, using result doesnt end the proc danielo515: mmm, then the problem should be something else Rika: mind showing the proc? danielo515: Oh, walkDir fails silently if the folder does not exist or can not be reached Rika: silently? danielo515: Well, maybe not fails, but just returns an empty iterator Yardanico: https://github.com/nim-lang/Nim/pull/13642 Yardanico: use checkDir argument for walkDir Yardanico: with checkDir = true it'll raise an error if directory is not found Rika: @danielo515 ^ Yardanico: it needs to be documented though, it's documented in removeDir but not in walkDir danielo515: Oh, thanls for the ref faulander: i don't understand the unittest module Yardanico: wdym? danielo515: It is a pitty that walk dir rec does not yields both files and directories. I'll have to handle recursion myself, and because I need to know the number of files on each dir I'll have to convert iterators to sequences. Unless there is a way to know when an item is the last on an iterator __ibrahim__: quick question, (sorry, don't mean to interrupt): is the Nim in Action book up to date? sealmove: eh, argument passing doesn't work either Yardanico: yes, the code in it will work with current Nim version Rika: @__ibrahim__ not really, but its not that out of date Rika: sealmove: wdym? Yardanico: Well it might not explain some new features which appeared in Nim after it got released, but the code there will still work and it's a part of a test suite __ibrahim__: cool, i reckon it's good for a nim noob? Rika: deffo Rika: @danielo515 wdym it doesnt do both? Yardanico: well yeah, but it assumes that you're not really new to programming :) Yardanico: You might want to read https://narimiran.github.io/nim-basics/ if you're a programmer newbie (but even if you're not it's still worth reading to learn Nim stuff) __ibrahim__: fascinating! thank you very much guys! yes i have some experience with C++ JS and Py Rika: then the book is good Rika: ~~i'd suggest the one on manning because of livebook~~ Yardanico: ? __ibrahim__: that narimiran link looks nice, thanks Yardanico Rika: https://www.manning.com/livebook-program Rika: this thing Yardanico: Nim basics is still worth reading if you want a relatively quick start for Nim, Nim in Action of course has much more content Yardanico: @Rika https://narimiran.github.io/nim-basics/ is in the browser too __ibrahim__: i got the nim in action pdf from manning, time to dig in! wish me luck 😸 sealmove: hmm seems to work after all: https://play.nim-lang.org/#ix=2hAG ⏎ something else must be going on in my code Rika: i dont see why that shouldnt work Yardanico: "seems to work" Rika Rika: that implies it shouldnt does it not? Yardanico: that implies that it works Yardanico: "seems to work" is like "I'm not sure why, but it works" :D Rika: "it works, but i dont know why" -> i dont know why may imply it shouldnt work Rika: thats what i thijnk Yardanico: no Rika: anyway Rika: lets not Rika: lmao Rika: this is useless Yardanico: you just sent 4 separate messages for saying "let's not discuss this further" sealmove: also another thing. I observed differences between castA (myVar) and A(myVar) sealmove: `cast[A](myVar)` * Yardanico: well cast shouldn't really be used unless you're dealing with FFI or raw pointers Rika: yardanico: and is there a problem with that? danielo515: > @danielo515 wdym it doesnt do both? danielo515: @Rika danielo515: Can do both, but not in the correct order. If you provide a filter saying yield folders and yield files it will firsr yield ald folders and then al files, but that is not useful for my particular case (and probably for any) Yardanico: why not yield files and split them to get the directory they're in? Yardanico: splitPath Rika: well, order is not predictable for most walkxxx procs no? Yardanico: well I don't understand what danielo515 wants to do :) Rika: me neither Rika: what is the "correct order" sealmove: my code works with cast[] and not normal type conversion sealmove: no idea why Yardanico: well that's not okay :D Yardanico: cast reinterprets memory Yardanico: it is unsafe Rika: scary stuff you got there sealmove: I have something like `let root = if root == nil: cast[A](this) else: root` sealmove: (`this` is actually `result`) sealmove: It feels like I am trying to reinvent inheritance planetis[m]: hi sealmove, how's quarantine? sealmove: Hey, very good for me. Gives me time to study :> and also do open source sealmove: You? planetis[m]: same couldn't be better lol planetis[m]: online classes ftw planetis[m]: yesterday i went for a bath and someone called the police!! sealmove: yeah, I am erasmus and took classes from both home and outdoors university planetis[m]: are you home or abroad? sealmove: huh? and said what? sealmove: abroad, in Krakow planetis[m]: oh, and you didn't return why? sealmove: why would I return? planetis[m]: i dunno... planetis[m]: the idiots in charge here banned swimming planetis[m]: but all other sports are allowed planetis[m]: that have no teams that is sealmove: so you went "for a bath" in sea :D planetis[m]: i left though so i didn't pay a fine supakeen: For a second here I thought you took a bath in your own home and the police broke down the door to tell you you're only allowed the shower. sealmove: I thought the same supakeen planetis[m]: lol supakeen: Would've been both way worse and way funnier. supakeen: For what it's worth I think most people are trying to do the best they can even if sometimes a bit misguided :) sealmove: Do you usually swim in April though? supakeen: It's acceptable in a rapidly evolving situation. sealmove: btw are you in Greece or Cyprus? Forgot. alehander92: ohh sealmove i now alehander92: hmm no alehander92: i remember stefanos82 planetis[m]: greece and water is fine, if you mean that alehander92: we're neigbhours alehander92: which part of greece planetis[m]: yes! sealmove: @alehander92 right, I confused the nicknames planetis[m]: i live in thessaloniki and have visited bulgaria twice alehander92: i love thessaloniki alehander92: from what i've heard about it alehander92: but i've actually never been yet :D alehander92: i've been to athens and naxos and volos planetis[m]: sandanski is great for vacations alehander92: oh i lived in blagoevgrad for my childhood alehander92: the whole region is pretty nice and friendly alehander92: but i think i haven't been in sandanski as well :D :D :D planetis[m]: did they banned swimming in bulgaria? alehander92: no idea alehander92: they banned going to parks alehander92: and common playgrounds alehander92: so i guess swimming might be stopped, but not sure planetis[m]: same alehander92: they would require us to planetis[m]: all swimming pools are drowned alehander92: put masks on alehander92: from tomorrow! alehander92: or scarfs or stuff danielo515: > well I don't understand what danielo515 wants to do :) danielo515: @gitterirc danielo515: > me neither danielo515: @Rika danielo515: I'm building a ls-tree progam in several languages as a KATA, and now I'm just doing it in nim. danielo515: I only need to print each file and each folder once, if I have to split to get the parent dir, then I'll get as many parent dirs as files inside each dir. alehander92: now the weather is amazing btw danielo515: In any case, I already have a quite short recursive algorithm that I'm quite happy with alehander92: yeah simple short recursion is great Yardanico: @danielo515 well why? you can just iterate over all files recursively and get folder with splitPath planetis[m]: you can still go walk around the house right? alehander92: well yeah, i actually went to another neigbourhood alehander92: just now alehander92: but i do this rarely alehander92: i stay inside most of the time alehander92: but walking outside is not forbidden, just frowned upon, parks and stuff are forbidden alehander92: we also have like "border" checks with police on the entrances of many cities danielo515: > @danielo515 well why? you can just iterate over all files recursively and get folder with splitPath danielo515: @gitterirc It's not that simple (albeit it looks it is). I need to store the folder tree on a structure, so I can post-process it. So in order to save a folder I need to save it just on the first appearance. Not to mention that, if a folder contain no files it will not be listed. But, nevermind, I already have what I want and it's quite simple planetis[m]: its the same here danielo515: It's 4 lines danielo515: proc traverse_dir(dir:string, depth=0): seq[FileInfo] = danielo515: for kind, path in walkDir(dir): danielo515: result.add FileInfo(name:path.splitPath.tail, depth:depth) danielo515: if kind == pcDir: danielo515: result = result.concat traverse_dir(path, depth+1 Yardanico: pls don't paste in discord :P Yardanico: and don't use quote alehander92: don't you need to send sm-ses planetis[m] planetis[m]: sure Yardanico: almost no one reads channel description in discord :( "PLEASE don't use multi-line messages or code snippets (use some paste service instead)." alehander92: we don't have the sms -es thing alehander92: only declarations if you go out of the city Yardanico: we have the SMS thing in some regions in Russia, and police checks between cities too danielo515: Well, it is quite easy to miss Yardanico: not all, but in some cities for sure danielo515: On other places you have to read on the welcome channel before you can write on any other channel alehander92: danielo515 use walkDir Yardanico: well that needs a yet another bot :P alehander92: no walkDirRec alehander92: from os.nim Yardanico: yeah I think walkDirRec should just work for ls-tree structure, idk why it doesn't work for danielo515 alehander92: danielo515 ah that's a good trick, we might need to add the welcome channel reading too Rika: `almost no one reads channel description in discord` tbh, channel descriptions are really secluded in this damned program Rika: is secluded the right word Rika: no clue Yardanico: for me it's a web page :) Rika: either way Rika: theyre both web pages really Rika: the program one is a glorified web browser anyway danielo515: > yeah I think walkDirRec should just work for ls-tree structure, idk why it doesn't work for danielo515 danielo515: @gitterirc I already explained why. The correct thing to use is walk Dir and handle recursion yourself Rika: why??? alehander92: you can pass a filter alehander92: but maybe a very custom behavior might require custom code alehander92: and also its good to exercise alehander92: ah i see alehander92: yeah it does work like that alehander92: because it uses a stack alehander92: yeah one needs to write a custom one for that thing dadada: hi, so there may be a way to use Qt with Nim that works now, but I can't confirm it yet, I just don't see why this wouldn't work, although it relies on playing a trick Yardanico: compiling Nim to C and then using it in a stub C++ project ? dadada: 1) we already have gobject introspection support for Nim, which enables us to use Gtk and the like with no issues dadada: Yardanico: better IMO Yardanico: well I'm waiting dadada: 2) there's gobject introspection (kind of a bridge I think) project for Qt, that enables to use Qt with python/lisp and the like that already have gobject introspection support dadada: 3) as you noticed from 1) Nim also has gobject introspection support, so 2) should also work with Nim at least in theory Yardanico: but how it provides access to Qt features? dadada: 4) the ugly thing with this solution is, you need gtk for this to work, which is an odd dependency for Qt project Yardanico: you mean https://github.com/mrosset/giqt ? dadada: Yardanico: yes, that's it! dadada: look at this example for python https://github.com/mrosset/giqt/blob/master/examples/hello.py.in dadada: the first 4/5 lines of python are gtk/gi related, the rest looks like normal Qt code would Yardanico: seems like you'll have to wrap all types manually for each Qt type though Yardanico: see https://github.com/mrosset/giqt/blob/master/application/qt-button.cpp Yardanico: or https://github.com/mrosset/giqt/blob/master/application/qt-web-view.cpp dadada: there's even a lambda in there to connect the button click with Yardanico: not a lot of code but you'll need to write it for every Qt type and function Yardanico: to fully cover Qt :P Yardanico: also the project is GPLv3 Rika: oh man, GPL Rika: rest in peace dadada: I'm mostly interested in FOSS projects, so this isn' dadada: t a big drawback at least for me, but I think this kind of out of the box thinking is always nice to see Yardanico: well I just don't like people who always use GPLv3 even for stuff like libraries :) Yardanico: it makes sense sometimes, but not in this case for example dadada: Yardanico: for libraries I tend to agree dadada: Yardanico: most UIs you'll write will be applications, not libraries Yardanico: dadada: the "giqt" is technically a library so if you use it in your application it'll also need to be open sourced dadada: Yardanico: I know that, man danielo515: What's the go to for desktop apps on nim? dadada: as I said, almost everything that I'm going to develop will end up FOSS, and for applications I'm more than ok with GPL Yardanico: @danielo515 the most complete one is "gintro" gtk bindings for nim Yardanico: https://github.com/StefanSalewski/gintro Yardanico: it's really nice dadada: Yardanico: you're right though, those "bindings" aren't complete, I got overly excited there for a moment zacharycarter: if I'm building a shared library to consume in some C code, do I need to set the define `useNimRtl` when I'm building the shared library? zacharycarter: that's only if I'm using the shared library in another Nim project right? kennymalac: Hello, I am getting a type error creating a table of seq of tables as value kennymalac: let outTable = newTable[string, seq[Table[string, string]]] kennymalac: home/kenster/Company/COVID-19-Dashboard/csvparser/src/csvparser.nim(14, 26) Error: expression 'newTable' has no type (or is ambiguous) Yardanico: you forgot () kennymalac: oh lol, thanks Yardanico: also there's a difference between Table and TableRef Yardanico: with newTable you create a TableRef, with initTable - Table kennymalac: good to know flywind: Hello, I try to use `testament`. It's fine to use `testament r single_file`. But when I use `testament all`, I got some errors. I have to use `testament cat /` as a work-around. flywind: https://play.nim-lang.org/#ix=2hBr krux02: flywind you can run a single test in testament krux02: for example: testament/testament run tests/misc/tsizeof.nim krux02: flywind: do you use testament in your own project? flywind: I use testament in CI, if one test fails, others won't test? Yardanico: they will get tested krux02: I personally don't recommend to use testament. It is highly specialized to test Nim. krux02: It might have useful functionality, but it might be better to copy them in your own testing framework and shave off everything that you don't want from testament. flywind: I use `testament cat /` to test all files, it seems fine. krux02: If that works for you, then do it. krux02: for file in $(find ./tests -iname '*.nim' -type f -print); do echo nim c -r $file; done krux02: not sure why you would want a dependency like testament for that functionality. flywind: because of unittest's note? Instead of unittest.nim, please consider to use the testament tool which offers process isolation for your tests. flywind: https://nim-lang.org/docs/unittest.html krux02: flywind: Well I am/was a developer on Nim. I remember a discussion with Araq about making testament public. I told him not to do it because it is highly specialized in to test the compiler and the implementation might chage anytime if the tests are refactored. He just ignored my advica and made testament public. krux02: Now we have a testing tool that that is recommended for people to use, but if they actually use it, they get burned. krux02: sorry that you see it. krux02: You can now decide to ditch my atvice as well. Or you can listen to the advice of Araq (the founder of Nim). Or you can decide to ditch Nim alltogether because it has problems like this. dadada: don't ditch Nim flywind: Thanks @krux02.I will think about it.😄 alehander92: @krux02 i also thought `testament` shouldn't try to take `unittest`'s place alehander92: but this attitude sucks, man krux02: alehander92: do you mean my attitude? krux02: flywind: you are welcome. krux02: I highly recommend trying out Nim as an iteresting language to observe, because it really has the most powerful macro system That I am aware of. But it does have many problems as well. companion_cube: what's your list of top problems krux02 ? zetashift: sweet: https://github.com/Pebaz/nimporter/releases/tag/v1.0.0 alehander92: well, it's a bit like the opposition party in a parlament :D "if i become elected i will make this and this" alehander92: like, i completely get you alehander92: but its like, politics krux02: Well, I guess it is a death by a thousand cuts problem. Nim doesn't have this one fundamental flaw that will make the language ultimatively fail. krux02: It is more this attitude in the development of careless inclusion of feauters by developers who can't maintain their contributions anymore nor did they finish up their contribution. dadada: krux02, one reason why someone might get the impression that you might have a bad attitude might be the following comment of you. "I remember a discussion with Araq about making testament public. I told him not to do it because it is highly specialized in to test the compiler and the implementation might chage anytime if the tests are refactored. He just ignored my advica and made testament public. why do you shashlick: If you dive into the compiler code, it might feel that way but as a user I don't at all dadada: think Araq ignored your advice? When someone doesn't follow your advice, do you really think that implies he ignored you? Wouldn't you assume a guy like Araq is smart enough to evaluate the positions of others (including yours) and then come to his own? krux02: There are many half way implemented feautures in Nim that you can stumble upon that just don't work. And nobody is responsible to fix them. shashlick: Fact is that it's a large code base and will have young and old code shashlick: That doesn't make it bad dadada: krux02: also its a bit rich to call the creator of nim a contributor :-) shashlick: It makes it like any other code base krux02: dadada, I am not. shashlick: I don't know why people think things should be perfect, there is no such thing krux02: What I am talking about is hot code reloading. alehander92: krux02 i think that you and Araq maybe have different design philophies about software development/project maintenance etc krux02: It is half way implemented. It works for some cases. It has problems, but nobody is resposible to fix them. alehander92: like, after all, you have som good points, he has some good points, but its his project, so one cant really argue he has to do X or Y krux02: So there is no point in trying it out and reporting bugs about it, because nobody is going to fix them. Nobody who contributes understands that codebase. krux02: Its just a blob of code unmaintained that makes the Nim code harder to read. It makes it harder to fix bugs because hot code reloading may not break. krux02: And it lures people into disappointment who are excited to try out hot code reloading. krux02: If it doesn't work, don't recommend it. Declare it as experimental. dadada: I do think you're making valid points here krux02 krux02: I am also frustrated by the premature release of Version 1.0 dadada: some projects have a status matrix of different features that are in planning, work in progress, beta, stable etc., I'd like to see something like that for Nim krux02: dadada: That is a good idea. companion_cube: what's missing from 1.0? arc, not nil? krux02: There should also be a feature combination matrix. dadada: this would help new contributors to know where they should focus their efforts, and it would also help maintainers to organize, it would help new users, to know which features they can rely on and which they can't planetis[m]: https://github.com/nim-lang/RFCs/milestone/1there is planetis[m]: sorry https://github.com/nim-lang/RFCs/milestone/1 krux02: does hot code reloading work with generics? does hot code reloading work with js backend? etc shashlick: There should be a lot of things and a lot of things should be removed as well - in general - in the world dadada: planetis[m]: while that is something, it contains far less information than a matrix would krux02: does inheritance work with generics, you get it. A full matrix of all features and how well they perform with each other. shashlick: Redirect your frustration into contributions else nothing will change dadada: (where matrix is a fancy word for a table :-) ) shashlick: But don't expect everything to change krux02: shashlick, I did my contributions. Code refactoring. Deletion of dead code. alehander92: krux02 however i dont see a big problem: X% of your ideas would be accepted and Y% would not alehander92: the same as timothee, and when he complained, this annoyed you a lot alehander92: and now you are complaining shashlick: You cannot contribute what is not welcome krux02: The reaction from Araq was: I didn't ask for this. This is just a matter of taste. I don't want to review this, closing alehander92: that's what seems strange to me planetis[m]: my PRs got rejected mostly and its okay. they weren't that good krux02: to be fair about timothee, I hated his contributions a lot. But recently I really appreciate them. companion_cube: is timothee the one who wrote the comparisons with D? dadada: alehander92: as far as krux02 complaints about missing documentation for features and their current status, as well as their planned future directions, I'm all with him shashlick: You have to work within the boundaries, going outside is not productive krux02: I don't like his naming scheme I also disagree often with his solutions, but his error and problem detection qualification is great. shashlick: You have to learn how to invite people outside shashlick: And some people might never come out shashlick: While other times you might need to realize it's not a good spot in the first place shashlick: Point is to do what's healthy, you cannot always be successful, that's not how the world works dadada: krux02: I think the 1.0 was important to put Nim on the map for a lot of people, I'm not sure if I'd be using a non 1.0 language, it's purely psychological, but we're psychological animals like it or hate it, and in times where people are used to version numbers like chrome 80, 1.0 doesn't mean the same as it used to mean anyway, I think a 1.0 after more than a decade of development time is well justified shashlick: Most importantly, you are sharing all this because you care about Nim and that's what everyone should focus on krux02: dadada, well after the feature cutting phase, yes. krux02: But Nim didn't have a feature cutting phase. krux02: Yes I do care about Nim. krux02: I have projects depend on it. companion_cube: dadada: 1.0 for a lang is not the same as for a browser companion_cube: a language is something you invest a lot of work in, imho, so you want to work to keep being relevant krux02: The Go language is a language that did it correct. krux02: To be fair, Go has the advantage of a big company behind it. krux02: So they can keep it internal until it is ready to be frozen. shashlick: I'll recommend building a case to kill one specific thing, build consensus and a full plan to deprecate and eventually remove shashlick: And provide an alternative Recruit_main707: and not an small company, but google companion_cube: go is ridiculously limited though, krux02 Recruit_main707: not any* dadada: companion_cube: we can play with words all day if you want to, it's important that you got what I meant, I can turn your words around with the simple fact that browser development (especially engines) is a lot of work as well, and browser developers for sure want to be relevant, let's stop such silly word play shashlick: Just creating PR's won't work, even with your best friend companion_cube: dadada: I mean, to the users… danielo515: Is there a shorthand for accessing the last item of a seq? Like seq[^1] or something like that? shashlick: Some things are cultural too, some are very conservative and disciplined while others are more liberal and okay with imperfections and fixing as you go shashlick: Never release until it's perfect companion_cube: a good recipe for never releasing shashlick: Have to see how the community operates shashlick: There is a middle ground but it's a life long journey to maintain it shashlick: I'm totally for venting and frustration but at the end, it should be productive companion_cube: krux02: Go also doesn't move fast enough, 'generics' is a joke word for it now krux02: companion_cube, go is ridiculously limited yes, but they cut out everything they didn't need. And then they stick to it. dadada: companion_cube: I get what you mean, and still think 1.x+ is well justified, C++ compilers had countless issues in the 90s, it didn't make me think of the language as a beta (non 1.0) language, the release of 1.0 was important to draw people like me in the community, all it did for me was to signal a certain level of stability that I could rely on krux02: companion_cube, It was a design decision for go not not require generics. So I understand that it isn't coming. They really don't want it to be part of the language. krux02: And that is by design. krux02: Putting it into the language is resignation. dadada: I'm impressed with the quality libraries the go community has developed, it's really sad that this happened solely because of the weight google has, imagine Nim with that number and quality of libraries companion_cube: krux02: not putting them was stubbornness, rather, I think companion_cube: oh well krux02: dadada, no this didn't happen because of the weight of google. dadada: ie. goldmark looks like a markdown parser I'd love to use, but it's for go :-( krux02: Go grew, because it was an easy to pick up language that lets you write fast and memory efficient applicaitons quickly krux02: the language was designed with tooling in mind dadada: krux02: don't even try to argue against the special role google had in go's development and the many internal users at google who also cross-pollinate with the FOSS community? alehander92: ok krux02 but after all go has its own philosophu alehander92: its like going in the go community companion_cube: go got a lot of attention because of who created it alehander92: and telling "guys haskell did all of this right" krux02: I did use go for a long time. alehander92: well .. then use haskell dadada: krux02: yeah, and which company wanted a programming language that was easy to pick up and with good tooling and paid for its development, by paying its developers? :-) krux02: It really is a good language with almot no friction. alehander92: i respect their philosophy but i wouldn't want to use this language alehander92: and i've used it as well companion_cube: krux02: depends on your taste companion_cube: "friction" is relative krux02: no friction is not relative. alehander92: after all that's why people use different languages dadada: I kind of like go, but I'd never prefer it over Nim given a choice companion_cube: krux02: ok. to me Go is so badly designed I can't use it, but if you mean friction from the tooling, ok danielo515: I work with go on a daily basis and I wish it were nim... krux02: I really do like Go. I really like its minimalist design. Something I did not expect from a company like google. krux02: It is just that its minimalism doesn't cut my use cases for it. dadada: someone needs to come up with a way to easily wrap go libs for Nim, pretty please! :-) krux02: I would live in a world where I would not need my metaprogramming requirements. I would be so happy to develop in Go. dadada: so I can use stuff like this without reinventing the wheel https://github.com/yuin/goldmark krux02: I am am just not in that world where the corneds the Go language cut apply for me. companion_cube: have you seen Zig? krux02: yes I've seen it. krux02: I didn't use it. krux02: Didn't use it, but read about its design. krux02: But I have my opinion about it. And similar to Go, it doesn't cut for me. krux02: Nim does cut, but with a constantly broken knife. companion_cube: there's no perfect language, so it's a question of finding the one that fits you the least badly companion_cube: (I wish there were languages closer to my tastes, tbh, but nope) Rika: Krux, I hope you're the whetstone then blackbeard420: one thing i love about go over nim is the goroutines. makes it way easier then using nim with asynchttpserver when you have long running background tasks dadada: blackbeard420: https://github.com/stefantalpalaru/golib-nim "Nim language bindings for golib - a library that (ab)uses gccgo to bring Go's channels and goroutines to the rest of the world." dadada: I haven't tested/used this, the dependency on golib is strange to say the least blackbeard420: its not even necessarily the goroutines. its just painful using asynchttpserver with threads for background tasks (it works just doesnt feel to clean) companion_cube: krux02: you could also fork nim and cleanup ;) Rika: I'd use the fork if it meant more big fixing :P Rika: Bug dadada: I think (wo)manpower is the answer to a lot of woes, so we'd need to be picked up by say a game company or significant FOSS project, and soon a lot of things would improve. I'm fascinated with watching the commit log of vscode every other day, the number of commits may not be indicative of their quality, yet if you also look at the changelogs, it becomes clear that this project moves at a staggering pace, so dadada: one of the main concerns for Nim people should really be how do we get Nim to be thought of as relevant in the programming language space, so that our number of developers increases. I still want to write a Nim-learning application, maybe that'll help a little?! Rika: Also lemme get this straight, go routines are basically green threads? companion_cube: something like that Rika: So a green threading library in nim would be great is all? Rika: Hmm, I've also been thirsting for something like that companion_cube: isn't async/await the alternative for that? Recruit_main707: ok... so i am trying to make some seamingless interop from nim to python, and its a good time to start using macros for it, so that means im gonna fill this chat with stupid questions! :D Recruit_main707: lets start with, how can i know the return type of a proc passed to a template/macro? alehander92: is it `typed` macro alehander92: argument* alehander92: you can also generate code which checks that on compile time if untyped Recruit_main707: lets say its typed for now Recruit_main707: (which i think it will be anyway) companion_cube: are you talking about nimpy? Rika: cube, it is, but I've had some conceptual understanding issues with it Rika: Also, it is time for me to sleep Recruit_main707: cube: no, i know about nimpy, it is really good, but i want something different stefantalpalaru: Goroutines are MxN green threads with a very efficient scheduler that uses multiple CPU cores and implements work stealing. Implementing something like this from scratch is not trivial. stefantalpalaru: This C library has a couple o schedulers that are MxN: https://github.com/Qthreads/qthreads companion_cube: rust has a bunch of schedulers like that too (like tokio) stefantalpalaru: Qthreads is used by the Chapel language: https://www.osti.gov/servlets/purl/1458180 stefantalpalaru: So it's old and battle-tested. krux02: dadada: Regarding (wo)manpower. I don't think this is true here. In over ten years, a language can get done even with just a few contributors. The problems is focus on the right battles to fight. alehander92: krux02 however if you interview 10 contributors, you'll get 10 lists of things which are "right battles" alehander92: recruit sorry, you can use `getType` or `getTypeImpl` iirc alehander92: and access them similarly to nim node Recruit_main707: ok, thanks krux02: alehander92: `getType`, `getTypeInst`, `getTypeImpl` is one of those things that are just bad in nim and should be fixed. krux02: getType is something that was "deprecaded" years ago and was replaced by `getTypeInst` and `getTypeImpl`. krux02: but getTypeImpl doesn't properly work because sometimes you get some typedec node instead of the actual type implemenation. alehander92: i'd expect `getType` to do stuff like this and `getTypeImpl` to always get me the implementation alehander92: if i go only by naming Recruit_main707: so, `getTypeImpl` will give me the return type of the function, right? `getTypeInst` i guess it will give you the "full type" (ie: `proc(arg: x): y`) sealmove: `myString == ""` is the same as `myString.len == 0` right? alehander92: no no, `getType` family of functions can get you the "full type" alehander92: and then you need to find in it the return type etc Recruit_main707: getTypeImpl.returnType ? alehander92: no no no alehander92: they are just nim nodes alehander92: with nnkNameTy (e.g. nnkObjectTy) alehander92: kinds alehander92: so you can use `.treerepr` on the "types" alehander92: and see how to access the children Recruit_main707: is there a list of all this nodes? alehander92: in `lib/core/macros.nim` alehander92: not sure about the manual alehander92: but i'd recommend to just echo `treeRepr` results of getType functions alehander92: to get a feel Recruit_main707: ok, thanks alehander92: no problem! alehander92: @sealmove logically yeah, not sure if it's optimized to the same code alehander92: okk zacharycarter: I'm trying to build a shared library with Nim that's getting loaded as a plugin in a C app, and then procs defined in the Nim shared lib are getting called zacharycarter: I keep running into EXC_BAD_ACCESS errors - am I compiling the Nim shared library correctly? zacharycarter: `nim c --noMain --app:lib -o:libtest.dylib test.nim` ? zacharycarter: seems to have something to do with the GC when I try to call `echo repr` on the parameter passed in krux02: hehe krux02: I guess it has something to do with RTI krux02: runtime type information krux02: the shared lib can't see the RTI from the types passed in. zacharycarter: I'm getting EXC_BAD_ACCESS errors even when I try to echo an int32 zacharycarter: let me check the backtrace on that error krux02: you get an error on `echo 123'i32` or you get an error on `echo repr(123'i32)`? zacharycarter: I got the one error when I tried to `echo repr` a pointer passed into the Nim proc from C zacharycarter: I get another error when I simply try to `echo` an int32 passed into the Nim proc from C zacharycarter: that backtrace includes calls to `prepareForInteriorPointerChecking` and then lowGauge` zacharycarter: the crash occurs in `lowGauge` krux02: call you say host and client? it is more clear to me if you use those terms. krux02: I don't really know if you mean host when you say "from C" zacharycarter: the procedure is getting called from the C application zacharycarter: the application written in C is loading the Nim shared library with dlopen I guess zacharycarter: I'm guessing it's because Nim' sealmove: I want to make a convertor that converts all none-option types to option types zacharycarter: s collecting memory sealmove: but `converter toOption*[T](x: T): Option[T] = some(x)` doesn't work because `T` includes Option types. zacharycarter: maybe it doesn't happen with gc:arc let me try that sealmove: what type restrictions can I apply? krux02: sealmove: that one could be fixed with zacharycarter: yeah it works fine with gc arc heh krux02: toOption*[T: not Option](x: T): Option[T] = some(x) krux02: I would approve such a patch sealmove: wow this works? krux02: yes sealmove: wow I love Nim krux02: well it enforces that T does not include Option krux02: Nim has a lot of great features. And also in many ways the right features. krux02: zacharycarter, good thing that Nim finally has a real option to turn off the GC. sealmove: hmm, I still get "type mismatch: got but expected 'Option[system.int]'", but maybe something else is interfering sealmove: aaah I know why, because uint8 is different from int zacharycarter: krux02: yes I agree krux02: sealmove: yes uint8 is a different type than int. sealmove: and chaining converters (fortunately) doesn't work alehander92: <3 alehander92: ops danielo515: Is the default compilation good for release? It runs quite well. If I add -d=release the first execution takes a lot, like half minute or more konsumlamm: release does optimiations, so ofc it'll be slower konsumlamm: but the executable will be faster danielo515: Sorry, when I say slow I mean the generated executable danielo515: The first execution of the generated executable is very slow, it can even reach a minute danielo515: While, usually, it takes under half a second leorize: are you on windows? danielo515: Macos queersorceress: what do you mean by "it runs slow"? Avatarfighter: I believe @danielo515 means the building of the release executable but I could be wrong Avatarfighter: I'm probably wrong actually danielo515: Compile, get file.exe, execute file.exe, takes a minute. Execute file.exe again, runs in under a second danielo515: Hope that clarifies danielo515: I used exe extension to make it clear, doesn't mean anything special danielo515: And that only happens when I compile with optimizations queersorceress: things don't just magically go faster after a first run unless you are doing something on the filesystem or something konsumlamm: caching? Avatarfighter: @danielo515 does the first run include compiling the program ? mratsim: if building is slow it's usually the antivirus danielo515: > @danielo515 does the first run include compiling the program ? danielo515: @Avatarfighter nope, they are two separate steps awr1: hello all danielo515: > things don't just magically go faster after a first run unless you are doing something on the filesystem or something danielo515: @queersorceress well, that's why I would expect, but my only interaction with the fs is listing dir contents danielo515: > things don't just magically go faster after a first run unless you are doing something on the filesystem or something danielo515: @queersorceress well, that's what I would expect, but my only interaction with the fs is listing dir contents danielo515: > caching? danielo515: @konsumlamm unless the compiler injects some kind of caching, I'm not caching anything konsumlamm: youre not, but your CPU might queersorceress: can you do a pastebin or something of the commands you are running and the timing benchmarks of how long execution is taking so we have something to work with? danielo515: Sure, but I'm not on my computer RN danielo515: Give me a sec danielo515: This is the folder danielo515: https://github.com/danielo515/explore-new-languages/tree/7e26a817278b3fff383fed92c802cb147ec0f182/ls-tree/nim_tree danielo515: The build.sh is the normal build danielo515: In order to make it slow at first run I just add `-d=release` or `--opt=speed` danielo515: Then you just run the generated executable. You can compare the normal build (the one on build.sh) with the optimized one solitudesf: hmm, release build runs slower than debug for me. about 30%. danger runs fast, as expected. solitudesf: nvm, i guess my nimchache was to blame nisstyre: It would be nice if https://nim-lang.org/docs/rationals.html could work with a type other than `int` for multiplication, e.g. BigInt, to avoid overflowing krux02: solitudesf, danger is the old release solitudesf: i know solitudesf: actually, its because of lto. when i compile with lto performance goes to shit. yikes. krux02: what is lto? zacharycarter: link time optimization? zacharycarter: I think it's mostly useful for reducing binary size krux02: no zacharycarter: oh krux02: link time optimization is actually inlining a lot of functions zacharycarter: ah krux02: you know C, compilation units don't know functions of other compilation units krux02: in other words inlining can't be done. krux02: only after linking krux02: That probably is also very expensive, because many optimizations can only be done after inlining has already been applied. dadada: there's a new link time opimizer called propeller, that was developed by google, it's claimed to require less resources than bolt from facebook dadada: optimizer shashlick: Can you add default values for importc procs? dadada: https://github.com/google/llvm-propeller/blob/plo-dev/Propeller_RFC.pdf dadada: s/link time optimizer/post link optimizer dadada: when you need to eke out those additional 2% of perfomance Prestige: Reading the first tutorial about integers - 'Lossless Automatic type conversion is performed in expressions where different kinds of integer types are used' Does this mean and int8 could become an int16 dynamically if its value becomes too big? Prestige: Also I don't see it mentioning what `int` defaults to, like int32 uint64 etc dadada: Prestige: I assume that ints default to int32 on 32bit systems and int64 on 64bit systems, just like you would expect from C Prestige: makes sense, just default to the word size dadada: so you're starting with Nim? Prestige: Yeah, set up my ide last night and just reading through the tutorials atm dadada: great, may I recommend https://play.nim-lang.org/ dadada: this is the place where even nimheads go to play around with Nim features and ideas Prestige: ah that's pretty neat Prestige: I'm ultimately wanting to rewrite the window manager I'm using in nim dadada: what window manager? Prestige: going to be a fun ride Prestige: dwm dadada: PMunch (not here?) is also writing a window manager (tiling one I think) in NIm dadada: this tutorial gives a nice overview: https://totallywearingpants.com/posts/nim-language-highlights/ Prestige: Sweet, thanks - I saw https://github.com/minimalwm/minimal recently as well Prestige: Not sure if it's the same wm but I'll be referencing it dadada: Prestige: get familiar with macros as soon as possible, they're Nim's killer feature I'd say dadada: which ide that you setup? Prestige: neovim as an lsp client Prestige: I'm going to read through the first two tutorials then start checking out how to work with x11 Prestige: wow macros are neat Prestige: dadada: what are you using nim to build? dadada: Prestige: what I'm doing with Nim? Prestige: Yeah dadada: started to develop a small library of helper macros/templates/procs that I later want to use for creating actual Nim applications Prestige: I saw the rust rewrite of the gnu coreutils, thought that could be fun to try out. But maybe after the wm dadada: still a learner about Nim, too, my journey began this year federico3: any good example of using the dom module? shashlick: gosh nimgrep --filenames is still broken since https://github.com/nim-lang/Nim/pull/12779 dadada: is github's c-blake also in IRC? shashlick: usually active on github KingDarBoja: Hi all Prestige: Hello KingDarBoja leorize: are you also an user of nim.nvim? :) Prestige: Well I'm using zah/nim.vim and coc-nvim leorize: you should move to nim.nvim if you are using neovim :) leorize: I'm totally not advertising my own plugin :P KingDarBoja: dadada: I am somewhat newbie too on Nim, so welcome to the community 😄 KingDarBoja: By the way, Rika or leorize, you there? Prestige: leorize: looks neat, but I'm trying to route all my lsp servers through coc-nvim leorize: nim.nvim don't use lsp though :P KingDarBoja: Hey leorize, was looking at the source code of textwrap.dedent on Python KingDarBoja: https://repl.it/repls/SoggyFabulousPhysics KingDarBoja: Basically it is what it does (copy paste) Prestige: leorize: yeah that's why I didn't pick it up KingDarBoja: I did the same on Nim because wasn't satisfied by the result of undedent (which is supposed to be the equivalent) leorize[m]: Prestige: your choice then :) though you might wanna import the indenter I got in nim.nvim Prestige: Thanks, I'll be sure to check it out if my intenting solution doesn't work well Prestige: indenting* KingDarBoja: https://play.nim-lang.org/#ix=2hFn KingDarBoja: Got *almost* same behaviour but looks like the final step (the regex sub) didn't work as I expected leorize: well it's called unindent and not dedent for a reason :p leorize: we don't have same proc KingDarBoja: https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#string-ops KingDarBoja: Well this "tutorial" does compare it as its equivalent KingDarBoja: And yeah, it almost do the same shashlick: @leorize: do you think one could use the procs exposed in macros on compiler PNodes? KingDarBoja: Anyway, the point is, not sure why the final regex is eating the "}" leorize[m]: shashlick: I don't think so leorize[m]: the procs in macros are strictly compile-time shashlick: why couldn't they work at runtime? probably cause they are macros i guess KingDarBoja: I tested on regex.io and seems to be correct the regex `(?m)^` whereas the margin are two whitespace chars KingDarBoja: But on Nim, it looks like margin isn't any whitespace lol shashlick: of course, i think nim might have even more advanced procs to work on the AST within the compiler than what's exposed via macros KingDarBoja: In fact, margin val on nim has the "}" leorize: this algo is super slow leorize: what exactly does this proc do? leorize: can't it just find the shallowest indent then use it as the common? leorize: the logic seems weird KingDarBoja: Just copy pasta from Python implementation 🙈 KingDarBoja: Was testing it to see how it works KingDarBoja: But expected same result leorize: I think I know what's wrong leorize: I'll try to clean up your solution as well KingDarBoja: ❤️ Avatarfighter: Hello everyone 😄 KingDarBoja: Hi avatar! leorize[m]: @KingDarBoja: https://play.nim-lang.org/#ix=2hFB leorize[m]: I also reduced the amount of modules used leorize[m]: the algo is slightly faster than python's (since I don't use zip) KingDarBoja: I see there is no longer the whitespace_only_re KingDarBoja: and also curious about the loop, I see you used high (which gets the max index of the array) KingDarBoja: Does `0 .. min` is the correct way? the whitespace is optional? leorize: yea, your strip handled that proc function :P leorize: yep, the algo does this: compare each character in margin and indent and cut off margin if indent contain a character different from what's in margin KingDarBoja: I see KingDarBoja: Btw, didn't about the global pragma KingDarBoja: Could you explain? 🙈 leorize[m]: it means that the value is stored in the global scope leorize[m]: meaning that it will persist between proc calls leorize[m]: I use it since we only need to compile that regex once leorize[m]: it's similar to putting the let outside of the proc KingDarBoja: CLEVER leorize[m]: just different in the sense that you won't consume an identifier :) leorize[m]: (in the outer scope) KingDarBoja: Added to my notes KingDarBoja: Man, I love you, thanks! KingDarBoja: I added a note on the proc doc to thank you 😄 KingDarBoja: By the way -> Does 0 .. min is the correct way? the whitespace is optional? leorize: yep KingDarBoja: Ok ok leorize: zip() will cut off the larger container leorize: so this is the same algo, just without spending time making a seq KingDarBoja: https://play.nim-lang.org/#ix=2hoY awr1, I think this would be the issue 🤔 flaviu: https://play.nim-lang.org/#ix=2hp1 -- I'm almost certain that this worked in 2014, but it doesn't seem to work anymore. thoughts? Been having a lot of trouble bisecting and so on. Rika: that shouldnt work i dont think flaviu: well I think it's debatable whether it should work or not, but it doesn't. I'm just hoping one of the folks that's been around for a while to tell me I screwed up back then :) iffy: When the compiler complains that you discard a Future, how does it know you did that? And can I make the compiler fail if callers discard my own custom return type? ryukoposting: anyone else getting "undeclared identifier" when trying to use the capture macro from sugar? ryukoposting: 1.0.6 companion_cube: if I have a `x: var Foo` with Foo a ref object, does x.addr point to the foo, or to x itself? ryukoposting: x itself, I believe ryukoposting: I could be wrong though companion_cube: how do I get the address of the object itself? (if I want to compare or hash by address) iffy: `.repr` will get you the address usually -- or `.addr` or `.unsafeAddr` ryukoposting: companion_cube https://nim-lang.org/docs/system.html#addr%2CT seems to indicate how to use repr and addr together companion_cube: so p.addr is like &p, and p[] is like *p in C? ryukoposting: yup companion_cube: thanks! ryukoposting: no problem, what are you working on? companion_cube: trying my hand at a small CLI tool, a proof checker ryukoposting: that's pretty sweet, the pointers are to interface with a C library presumably? companion_cube: oh in this case no, it's just because I'm implementing a DAG structure and comparing addresses companion_cube: same way I'd do in C companion_cube: when I create an object with a table inside, do I need to initialize it automatically? companion_cube: manually* companion_cube: (also: is there a way to derive $ for a simple object?) companion_cube: ok so it doesn't initialize tables... sealmove: so I've got a gcc 5.4.0 ... sealmove: Does Nim 1.0.0 support it? sealmove: actually it might be even older, 4.8 sealmove: 🤮 leorize: @sealmove: yes leorize: you need newer gcc for nim 1.2 without -d:nimEmulateOverflowChecks leorize: though I'll see if I can make it so that you don't have to sealmove: nice companion_cube: there's a syntax for default values, right? can't seem to be able to declare a field of type `TableRef[A,B]` with an initializer companion_cube: so I have to create this table in `newFoo` and it's error prone since the default behavior is `nil` leorize: do you have a failing example? leorize: just `= newFoo`? companion_cube: declare the type, `proc newFoo(): Foo = init(result)` sealmove: meanwhile, is there a convenient way to download an install a previous version? currently I use the recommended `curl https://nim-lang.org/choosenim/init.sh -sSf | sh` companion_cube: I mean, I'd like the compiler to tell me I didn't initialize a field leorize: @sealmove: you can use it companion_cube: `not nil` should be the default :/ leorize: companion_cube: tag the field with `{.requiresInit.}` companion_cube: :o nice companion_cube: not nil would be nice, but well leorize: not nil will work once we iron out all the bugs :P companion_cube: is it "safe" to enable the experimental not nil? leorize: https://github.com/nim-lang/RFCs/pull/169 <- here's a related RFC leorize: companion_cube: "safe" in the sense that there won't be memory errors, yes leorize: "safe" in the sense that it actually work well, no :P leorize: the thing is so terrible you gotta pretty print all the checks if you want it to actually function companion_cube: in the sense that it won't disappear in the future companion_cube: ah :/ leorize: we got the tech to get it rolling, just that no one spent time to do so leorize: well it's pretty low on the list, even in our surveys companion_cube: "faster horses" and all that :) companion_cube: (`type Foo = ref object not nil …` isn't valid. btw) leorize: it's vaild, you just gotta be a bit creative leorize: type Foo = (ref object) not nil companion_cube: :DDDD nice companion_cube: ah yeah, but I meant, to declare the fields afterwards leorize: it will work once someone report a bug related to it :P companion_cube: `cannot prove 'newTable(64)' is not nil` ahhh right leorize: you gotta do a lot of spoon feeding just to prove it to the compiler leorize: we have a CFG that can analyze these kinds of things leorize: but it's a new technology in the compiler, and not nil is an old one, so it's not hooked into it tjpalmer: I have a question. The following code builds without `--gc:arc`, but not with arc: tjpalmer: ```nim tjpalmer: func call_me(n: int32): cstring {.exportc.} = tjpalmer: let hi = "hi" tjpalmer: system.GC_ref(hi) tjpalmer: hi tjpalmer: ``` tjpalmer: The error I get is: tjpalmer: ``` tjpalmer: Error: type mismatch: got tjpalmer: but expected one of: tjpalmer: proc GC_ref[T](x: ref T) tjpalmer: first type mismatch at position: 1 tjpalmer: required type for x: ref T tjpalmer: but expression 'hi' is of type: string tjpalmer: tjpalmer: expression: system.GC_ref(hi) tjpalmer: ``` tjpalmer: Any thoughts? companion_cube: leorize: thanks, opened an issue Varriount: This is interesting.. how is `x == 'a' or x == 'b'` slower than `x in {'a', 'b'}`? Varriount: I ran some benchmarks, and the latter solution was slightly slower Varriount: *former companion_cube: `{'a', 'b'}` is a bitset, I think companion_cube: so that's just a mask operation and != 0 companion_cube: ah maybe a bit more, but still companion_cube: less branching I guess, especially as the set goes bigger companion_cube: hmm seems like my distro (arch) has a bad packaging, `nim doc` can't find the css file KingDarBoja: Arrrghhh been struggling with this thing, it is not possible to the compiler to assign a derived class type to a base class type on some type property? KingDarBoja: https://play.nim-lang.org/#ix=2hps KingDarBoja: And been looking for some issues / posts about it KingDarBoja: So far the only thing requires type casting ... KingDarBoja: https://matthiashager.com/nim-object-oriented-programming Hummm Varriount: You need to have a parent ref object Varriount: Er, parent ref type dumjyl: Just upconv them, https://play.nim-lang.org/#ix=2hpu KingDarBoja: @Varriount at the example, it is supposed to be "Foo" the parent ref object KingDarBoja: While Bar is the derived class which stores a property as `seq[Foo]` Varriount: What are you trying to model? Show me the Python code. KingDarBoja: awr1 helped me but we stomped on some weird (or maybe we are wrong) behaviour KingDarBoja: Hold on KingDarBoja: https://github.com/graphql-python/graphql-core/blob/master/src/graphql/error/graphql_error.py#L95 This line defines some property on the class GraphQLError, in this case, the `nodes` property is what you looking for KingDarBoja: I did pretty much the same on Nim -> https://github.com/KingDarBoja/Phosphate/blob/master/src/error/graphql_error.nim#L73 KingDarBoja: The problem is that you can pass a `SelectionNode` type to that init parameter (`Node`) KingDarBoja: It's not big deal on Python as SelectionNode is the derived type of Node base type (AST file) KingDarBoja: But here, when trying to run the test, looks like it gets mad because the passed type isn't "Node" but "SelectionNode" KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/tests/error/test_graphql_error.nim#L51 This tests. KingDarBoja: awr1 pointed out some possible fix -> https://play.nim-lang.org/#ix=2hoN KingDarBoja: I tried it and didn't worked out, also tried this -> https://play.nim-lang.org/#ix=2hpy Varriount: @KingDarBoja Is the Node type an object, or a reference? KingDarBoja: It is a ref -> type TypeNode* = ref object of Node KingDarBoja: -> type Node* = ref object of RootObj KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L86 companion_cube: how to return `something or nil`? as a type? companion_cube: ah wait, nevermind KingDarBoja: @Varriount Seems to be something that I can't avoid as seen on this sample -> https://play.nim-lang.org/#ix=2hpE KingDarBoja: The part that says _With reference objects, we must treat it as a Node before using it as one_ Varriount: @KingDarBoja Would methods work? https://nim-lang.github.io/Nim/manual.html#multiminusmethods Varriount: I think the part about requiring a compiler flag might be erroneous, but otherwise that looks correct. KingDarBoja: So methods allow dynamic parameters, in this case, pass derived objects if parent object type is specified? KingDarBoja: Also, should I worry about this note -> _Note: Starting from Nim 0.20, generic methods are deprecated._ Varriount: Are you using generics? Varriount: (and if so, why?) KingDarBoja: No, not using generic on my code KingDarBoja: If you mean passing [T] KingDarBoja: But looks like if I want to pass a derived type I MUST provide proc calls for each derived type lol KingDarBoja: Not really want I want lol Varriount: Well, yes. That's presumably why you're deriving types Varriount: You don't have to provide a new call, unless you want to change behavior. Varriount: Child types will inherit parent methods that haven't been overridden. KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/error/graphql_error.nim#L71 so this proc can be turned into method and any node parameter that is a derived type of `Node` should work? Varriount: Yes kungtotte: https://play.nim-lang.org/#ix=2hpH Varriount: Though, your when statements won't work. `when` is for compile-time evaluation. KingDarBoja: You're right... D: awr1: i don't really understand what you're trying to do here KingDarBoja: Arrghh hard to test, changing stuff but looks like Option module could be ruining it Varriount: awr1: They are trying to model an AST using inheritance. KingDarBoja: What variount said awr1: this sort of thing is why i like variants more often than not KingDarBoja: Without changing the when and using "method" instead of "proc" -> required type for nodes: Option[seq[Node]] or Option[ast.Node] but expression 'fieldNode' is of type: SelectionNode KingDarBoja: I want to hang myself KingDarBoja: Probably as I said, the Options thing messing kungtotte: awr1: variants are easier if you're making something that's for internal use only, or something where you expect consumers of your library to add many new uses of your types but no new types. If you're making something that's supposed to be extendable, variants become a pain in the butt awr1: variants do have their limitation awr1: s KingDarBoja: if I remove it, I have to deal with `Node or seq[Node]` and that thing seems to be another pain in the a** awr1: i was talking about this sort of thing in regards to nim's macro systems, that i wish we could have StmtList, Expr, etc. types instead of passing around NimNodes everywhere awr1: a few days ago kungtotte: Node vs. seq[Node] is fixed more easily with overloading I think awr1: maybe make Node a typeclass awr1: /shrug KingDarBoja: A typeclass? awr1: well awr1: you can have a inheritance tree, RootNode, SpecialNode, ExprNode, whatever it is you have awr1: and then `type Node = RootNode or SpecialNode or ExprNode` KingDarBoja: Node is my root Node lol KingDarBoja: But I feel like I have seen that before leorize: @Varriount: it's a bitset, so checking took one operation instead of two. KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L86 This is it, sitting as my Base type for all the rest of types on the AST Varriount: leorize: But wouldn't the character need to be converted to a bit representation? Varriount: @KingDarBoja https://github.com/Varriount/commandant/blob/master/commandant/parser.nim#L5 KingDarBoja: There is a flaw to that approach and it is related to not being able to use the same parameter name for multiple derived kinds leorize: @Varriount: what does that even mean :P leorize: here's how it's implemented: https://github.com/nim-lang/Nim/blob/devel/compiler/bitsets.nim#L39 KingDarBoja: Okay I gave up for todat awr1: @leorize did you get a chance to see this? https://github.com/nimterop/nimterop/issues/177 Varriount: KingDarBoja: What do you mean? All my nodes have the 'token' and 'unlinked' fields. leorize: @awr1: can't you not do this already with `cPlugin`? awr1: cPlugin isn't advanced enough to my knowledge, unless i'm missing something leorize: I'm all in for a way to better transform things though awr1: you get a collection of node kinds, but no real node tree shashlick: We can certainly add the ability to manipulate the resulting ast shashlick: Will share my thoughts tomorrow KingDarBoja: But what if one of your Nodes requires a diferent type for let's say, `unlinked` being a integer instead of bool for `NKCommandSub` KingDarBoja: kungtotte: Yeah, it is the options module -> https://play.nim-lang.org/#ix=2hpP KingDarBoja: Check the second error message kungtotte: The first warning gives you a clue about the issue. It's telling you that the second method is a baseless method (base method without {.base.} pragma), meaning that it sees the two methods as separate base methods due to differing type signatures kungtotte: It errors out on two.print() because it can't match print(ChildTwo) to either print(ChildOne) or print(Option[BaseObj]) KingDarBoja: So if providing the pragma to the second method and chaning its type signature to use Option too, it still fails KingDarBoja: Just curious right now why KingDarBoja: https://play.nim-lang.org/#ix=2hpQ kungtotte: Because you're mixing different type signatures, BaseObj and ChildOne are wrapped in Option[] but ChildTwo isn't, so it's not matched against the same type signature Yardanico: is there a way to make Nim not pass "-g" to the C compiler? Yardanico: ah, debuginfo probablyh Yardanico: or not leorize: Yardanico: just don't pass `-g` to Nim? KingDarBoja: Ohhh, so wrapping in Option[] is different that letting those be without it Yardanico: leorize: I don't? kungtotte: KingDarBoja: yes, why wouldn't it be? It's a different type after all. leorize: are you passing --debugger:native or anything like that? Yardanico: no KingDarBoja: That's why your first example works with type inheritance Yardanico: wait let me check if -g is actually there or not leorize: maybe check your config then? KingDarBoja: And this one with Options[] don't Varriount: Yes Varriount: `Option[ChildRefType]` cannot be converted to `Option[ParentRefType]` Yardanico: ohh I'm bashing my head against the wall Yardanico: when cross-compiling a binary from my PC to aarch64 (to test in termux) it can't do address resolution (getaddrinfo fails with EAI_AGAIN ) Yardanico: when I compile it in termux itself (it has nim in its repos) it works just fine Yardanico: maybe it's due to me using musl, not sure Yardanico: https://androidsavvydev.wordpress.com/2020/01/28/getaddrinfo-from-musl-does-not-work-on-android-try-again/ Yardanico: oh leorize: musl needs /etc/resolv.conf :P leorize: android certainly don't have that Yardanico: well I can try to create it to try xd Yardanico: (since i have root on my phone) Yardanico: just to test Yardanico: yeah you're right it works leorize: did dom96 quiet all unindentified users? KingDarBoja: ARGH, @Varriount well I will keep using Option as I am dumb to know how to handle Union types as proc parameters, e.g. `int or seq[int]` kungtotte: I would make two procs instead kungtotte: proc foo(num: int) = discard and proc foo(nums: seq[int]) = discard KingDarBoja: And how you would handle múltiple params that uses union types ? More procs? KingDarBoja: Would you* Yardanico: you can have them in same proc but use "when" to differentiate kungtotte: v0v it all depends on your overall design Yardanico: but can't you design your program so it's easier to understand rather than use union types? :P kungtotte: I get anxious when the number of params go above ~4 KingDarBoja: I like your thinking Yardanicco KingDarBoja: Can you provide an example of that Yardanicco? Using the when and two parameters with Union Types? KingDarBoja: Like so: proc sample(a: int or seq[int], b: Foo or seq[Foo]) Rika: the body of the proc is just a `when a is int and b is Foo: dosmth` and `else: dosmth` Yardanico: @KingDarBoja https://play.nim-lang.org/#ix=2hpX leorize[m]: that looks like a mess :P Yardanico: of course you don't have to put ALL code in the "when", you can have common code for different branches Yardanico: leorize[m]: yeah I agree leorize[m]: what kind of use case are we striving for here? moerm: Hello everyone kungtotte: I tend to use something like the bottom version here: https://play.nim-lang.org/#ix=2hq0 kungtotte: If your algorithm doesn't work with sequence of len == 1, then I don't think it should be the same proc. You should have a processOne and a processMany proc if the algorithm is sufficiently different for int vs seq[int] kungtotte: And if you have so many parameters that doing that becomes unwieldy, maybe you have too many parameters supakeen: moerm: Good morning! KingDarBoja: Oh yeah, a mess as I thought lol KingDarBoja: Last question before going to bed KingDarBoja: Doesn't matter if I set as default parameter a nil value for Unión Types? Yardanico: seqs and strings can't be nil anymore KingDarBoja: Yikes KingDarBoja: Okok KingDarBoja: So you are forced to provide some value to Union Types in case of passing a sequence of some type or the type itself, i.e `myHumbleType or seq[myHumbleType]` KingDarBoja: And not just nil Yardanico: so just use procedure overloading please Yardanico: also I found a codegen bug right now, xD Yardanico: just modified that code I gave you a bit moerm: Maybe till later ... cu Prestige: Anyone know of wrappers for xlib or xcb? I haven't found any, but it would be awesome Yardanico: Prestige: yeah there is Yardanico: https://github.com/nim-lang/x11 Prestige: Oh very nice, thanks Yardanico Yardanico: "nimble install x11" Yardanico: You can use https://nimble.directory/ for finding Nim packages Yardanico: or "language:nim query" in github search since almost all Nim libraries are hosted on github Yardanico: https://github.com/search?q=language%3Anim+x11 Prestige: I was just searching specifically for xcb and xlib, ty Prestige: Ah that's handy dom96: Good morning everyone Yardanico: good morning t1273446_twitter: Morning sealmove: morning Vindaar: good morning :) faulander: good morning! :) faulander: although it's already almost lunchtime in central europe ;) faulander: @Vindaar can you give me the link to your notes once again please? forgot to save it and can't find it here and in my history :/ Vindaar: @faulander my notes? Are you thinking about @kaushalmodi's notes? Vindaar: https://scripter.co/notes/nim faulander: ah yes, sorry and thank you sealmove: guys, where is the usual place to put stuff you install manually on travis, or linux in general for that matter? sealmove: /opt? Vindaar: @sealmove kinda depends, but either /opt or /usr/local are the most common I think sealmove: thanks Yardanico: https://github.com/nikku/works-on-my-machine Yardanico: https://github.com/auchenberg/volkswagen Rika: LMAO Rika: that volkswagen one sealmove: how does one deal with prompts like `Prompt: No local packages.json found, download it from internet? [y/N]` on CI? Rika: i think it was a flag, -y maybe Vindaar: yes, most tools have flags to auto yes those things. And yes, it's -y for nimble too sealmove: I am running ./build_all.sh sealmove: and nimble install Rika: `nimble install -y` isnt it? Rika: package name ofc forgot that sealmove: nice sealmove: finally fixed this hell X_X kaitai ci is so complicated Amun_Ra: is there a way to check if the given value is in enum? Amun_Ra: I mean other than use 'case' __ibrahim__: sorry to interrupt, what does this error mean? __ibrahim__: https://cdn.discordapp.com/attachments/371759389889003532/698123113384378398/unknown.png __ibrahim__: __ibrahim__: https://cdn.discordapp.com/attachments/371759389889003532/698123191616274522/unknown.png Vindaar: @Amun_Ra can you give an example? narimiran: Amun_Ra: `typeof(myEnum)` Rika: @__ibrahim__ seems like youre missing some stuff for glfw? __ibrahim__: yeah seems like some directx library sealmove: 1) 9% https://ci.kaitai.io/ :) Amun_Ra: Vindaar: narimiran: http://dpaste.com/0CSDXTB narimiran: Amun_Ra: https://nim-lang.github.io/Nim/strutils.html#parseEnum%2Cstring ? Vindaar: yeah, since you have strings already anyways, just use `parseEnum` Amun_Ra: that enum is an int Vindaar: hm, for a second there I thought It'd work anyways, but yeah you're right Amun_Ra: but looking at the parseEnum gave me an idea Rika: Amun_Ra Rika: are you trying to make a bitset? Rika: ah Rika: never mind haha Vindaar: @Amun_Ra: you can do this: https://play.nim-lang.org/#ix=2hro Vindaar: And note that `Enum(someVal)` (from your code) will fail anyways, if you compile in debug mode. So you could also just activate the flag that checks enums instead Amun_Ra: I writing a BMP reader and I thought I'd use Enum instead of an uint32 filed and a bunch of consts Amun_Ra: http://dpaste.com/2XTZ507 Amun_Ra: the only drawback it does not skip gaps Amun_Ra: (the real enum does not contain only fields of (1< that's right, and for the latter you need to instantiate it alehander92: ref is a managed pointer planetis[m]: this is done with ``new(result)`` or with ``let foo = Foo()`` alehander92: i prefer Foo() as its the same for objects/ref objects alehander92: but iirc `new` is also useful in some generic cases companion_cube: planetis[m]: with `new(result)` or the likes, ritght? planetis[m]: me too companion_cube: I wanted ref semantics, so the object could be shared easily (should really not be copied), is all planetis[m]: yes companion_cube: for now I dropped the `not nil` companion_cube: so far the lack of nil safety is the thing that worries me a bit in nim, otherwise it's quite nice alehander92: it is supposed alehander92: to be added soon alehander92: it's even planned ref to be `not nil` by default companion_cube: yeah that's good. companion_cube: the other thing is better safety when using case structs alehander92: can you give an example? alehander92: of case unsafety Spy653: so this is what irc looks like companion_cube: when using `case` on the tag, one can access the wrong fields without warnings planetis[m]: what does this mean though? the compiler will insert ``if foo != nil: foo.member = 8`` ? zacharycarter: I think - https://github.com/nim-lang/Nim/pull/13897 - might fix the --gc:arc sigsev issue I raised yesterday zacharycarter: is there a way to install nim from a specific commit hash with choosenim? krux02: Spy653, IRC is the future alehander92: planetis[m]: what? krux02: all these hip technologies will fade away, but IRC with stay with us until the end of time. alehander92: companion_cube hm, this shouldn't be the case companion_cube: alehander92: I tested last week, and it's not checked by the compiler krux02: zacharycarter, git checkout && koch boot -d:release krux02: zacharycarter, git checkout && koch boot -d:danger zacharycarter: yeah I know I can do that krux02 but since I'm already using choosenim I wanted to continue to use it if possible zacharycarter: but it doesn't look like the commit hash feature works? or I'm using it improperly - so I guess I'll go with your suggestion :) krux02: yea krux02: I never used choosenim. I never heard people telling how awesome choosenim is, only how they have problems with it. zacharycarter: it's pretty nice IMO krux02: and effectively it replaces "git checkout my-branch && ./koch boot -d:danger" krux02: often I don't even use koch boot krux02: I use koch temp krux02: `koch temp c -r scritch.nim` zacharycarter: but you can also switch between versions of Nim which is nice zacharycarter: it's also a version manager krux02: bit it can't switch to hashes or branches, which is most important for me. zacharycarter: yeah - I don't think it's great for folks hacking the compiler zacharycarter: but for end users of Nim it's nice krux02: a version is just a number, I don't need a manager for that. krux02: maybe it is nice krux02: I would prefer though, if it wasn't necessary to swtich between different version of Nim. planetis[m]: test zacharycarter: the only time I've really found doing ^ necessary these days is when I want to see if something is broken in devel planetis[m]: finally works krux02: I am always on devel krux02: anyway, good luck, I will be back soon. Get some food now alehander92: sometimes one needs different branches/versions for different projects alehander92: this is normal, come on :D planetis[m]: sorry alehander42: i was talking about not nil planetis[m]: if it works at compiletime or runtime alehander92: but yeah i also usually use repos and git easier for maintaining patches alehander92: planetis[m]: sorry, yes, it works on compiletime planetis[m]: nice alehander92: https://github.com/nim-lang/RFCs/pull/169 planetis[m]: matrix doesn't work well maybe its time to switch back to irc alehander92: the rfc is a bit rough, but at least this was the original idea alehander92: after some discussions alehander92: now i am not sure if this is how it's gonna be implemented planetis[m]: thanks for the link alehander92: there exists an example implementation actually alehander92: but it's still not clear if it's going to be the accepted one + it needs some optimization alehander92: no problem zacharycarter: well nevermind - that branch does not fix the `--gc:arc` issue I posted yesterday KingDarBoja: Good morning KingDarBoja: Couldn't sleep well due to doubts at my head lol alehander92: about programming? dude :D alehander92: don't sweat it KingDarBoja: Happens to me sometimes lol xD KingDarBoja: But today is friday, I will relax alehander92: good! KingDarBoja: Just copied all the suggestions and stuf that I discussed yesterday on a notepad file lol KingDarBoja: I will analyze it later, now working a bit leorize[m]: planetis[m]: if you're still on matrix.org, switch to another homeserver leorize[m]: also switching the bridge to the kde one is also a good move :p planetis[m]: i will try the kde bridge alehander92: guys alehander92: so iterators are coroutines right planetis[m]: thanks for the suggestion alehander92: like, i know people don't call them coroutines and have more specific definition alehander92: but i can't understand how is it exactly defined KingDarBoja: I just noticed Araq is Nim creator D: alehander92: basically, coroutines can yield alehander92: cooperatively alehander92: and coro.nim seems to me to be about .. preemptiveness? leorize[m]: technically, only closures are alehander92: as it seems you can `suspend` leorize[m]: and when they say coroutines they usually imples having automated task scheduling leorize[m]: which we don't have krux02: @timotheecour: are you around in chat? alehander92: i dont think so alehander92: from what i find they are about yielding alehander92: and cooperativeness alehander92: you can use them to implement task scheduling of course alehander92: the difference i find in wikipedia(eh sorry) alehander92: is that coroutines yield to particular next locations alehander92: and semicoroutines/generators just yield but dont control to where alehander92: and indeed async probably uses something like that planetis-M: ryukoposting: hi! are you a kate user? https://github.com/ryukoposting/NimKate krux02: I used Kate a lot when it was still KDE3 Guest86017: still use kate for small text files planetis-M: nope it's not a bridge issue, my messages are stuck at sent but don't get delivered planetis-M: but now it works!! Guest86017: I wish someone would write a swig module for nim, the go module should be comparable, so it would be around of 7000 lines of code, the best bet probably would be to hire a long-time swig developer to do it, but we would need a fund-raiser for that, my rationale is that C++ support for nimterop is a long-time away (if it ever comes), and a clang-based solution won't be easier to develop than a swig-based Guest86017: one, once a nim module is accepted into swig upstream, it would be maintained there, the swig 4.0 extensions documentation (how to write a module) is pretty good (on a quick read), it's not an impossible task at all, it's just a lot of work, swig is looking to support c++20 features (currently they're at c++17), and they existed since 1996, it looks like they're not going away anytime soon, judging by the Guest86017: go module you need a scary amount of special knowledge to get everything just right, but on the other hand there're shorter modules like the perl5 one (2500 lines), so a initial nim module that doesn't support all features might be doable in a shorter amount of time ... I'd definitely chip in if there was a fundraiser for someone to do this work, I'm offering 100 bucks, although I'm aware this would be at Guest86017: least a full month of work for a good developer, so we'd need a bit more, the pay-off for the community is that we'd get really good wrappers for most C/C++ libs at almost no additional costs Yardanico: nimterop exists :P Guest86017: Yardanico: the author of nimterop admitted that full C++ support is years away, if it ever comes, it's not even at full C support, and C++ is infinitely more complex Yardanico: I suggest you to make the 4 messages before this one a forum post, that'd be much better since IRC is a real-time chat so your messages will get lost eventually :) Guest86017: I was under the impression this channel had logs? Yardanico: yes, but if you post it on the forum it will get much more exposure alehander92: yeah its very very easy to miss stuff in the irc logs alehander92: even you take a look there from time to time shashlick: If i can get some help, it can come sooner shashlick: i was able to rebuild C support with nim compiler backend in 3 months part time shashlick: and it is more feature rich than the legacy algorithm Guest86017: shashlick: what do you mean by legacy algorithm? shashlick: the original C -> Nim algorithm which is shipping today in 0.4.4 shashlick: i was basically experimenting to see how feasible the idea was to leverage tree-sitter shashlick: i've since rewritten the backend to use the Nim compiler AST and this implementation is a lot simpler, reusable and easy to enhance Guest86017: shashlick: swig supports very advanced C++ features, and new ones are planned https://github.com/swig/swig/pull/1678 leorize[m]: planetis: you should move away from matrix.org, [here](https://www.anchel.nl/matrix-publiclist/) is a good list to look for one Guest86017: shashlick: this is why I have doubts that you'll be able to pull of a similar feat of feature completeness with treesitter, when swig is purposebuilt for the task leorize[m]: doesn't swig require integration into the project itself? leorize[m]: the last time I tried to use it to generate wrappers for pascal that was my biggest blocker Yardanico: So I decided to leave some IRC channels I don't really read and "Yardanico ([email protected]:4f8:c2c:df22::2) has quit (Killed (Sigyn (Spam is off topic on freenode.)))" lol Yardanico: emailed them already, hope they don't take too long to unban me :D Guest86017: leorize[m]: you mean into nim? no! you need to write a swig module, that can become upstream part of swig if it fullfills testcases shashlick: I don't doubt it might be impossible, even 4raq has that opinion shashlick: but i'm going to try nonetheless and see how far we can go leorize[m]: Guest86017: I mean exactly what you just said, you gotta write a swig module :P Guest86017: shashlick: did you ever read the swig 4.0 extensions documentation, it does seem straighforward, apart from being loads of work Guest86017: leorize[m]: why would that be a bad thing? leorize[m]: not all upstream is open to the idea, though I don't doubt it's a good tool Yardanico: @Guest86017 but assuming we have a nim backend for swig, can you for example generate a wrapper (with swig) which will NOT depend on swig? shashlick: quite frankly, i'd rather write Nim than C++ Guest86017: Yardanico: definitely, swig is wrapper generator, once it has run, you can use the generated wrappers, so yes leorize[m]: Guest86017: don't you mean that I have to write a module to push to the target project's upstream? Guest86017: leorize[m]: no, only one swig module for the swig project itself, the targets don't need individual swig modules, swig generates wrappers automagically, there's the possibility of finetuning wrapper generation with additional swig interface files, but you won't need that for generating most wrappers I'd assume faulander: hi guys, anyone know if flippy only support PNG and not JPG? Which library can open JPG, get dimensions, resize and save? Guest86017: these are all swig modules https://github.com/swig/swig/tree/master/Source/Modules Guest86017: and all we need is someone to write a nim.cxx Vindaar: @faulander: tried https://github.com/SolitudeSF/imageman ? leorize[m]: Guest86017: well you should also pitch that on the forum, more people hangs around there and someone may be interested :) Guest86017: this is a good read on what would need to be done approximately http://www.swig.org/Doc4.0/SWIGDocumentation.html#Extending Guest86017: leorize[m]: understood shashlick: Guest86017: do you know swig well? Guest86017: shashlick: can't say that, I've read some of the documentation (like the link above), skimmed some source code of swig modules, and was a user of swig a couple of times shashlick: how does it handle preprocessor declarations? Guest86017: shashlick: it has it's own preprocessor parser, all of the information is transformed to swigs own AST format, and then it does a series of transformations, that you (the swig module writer) can control to produce the wrappers dynamically shashlick: so the generated wrapper ends up with all the preprocessor defs and you need to influence it approriately with Nim -d:xxx statements for example faulander: @Vindaar Thanks, but i found a way. i need to compile flippy with -d:useStb then it handles jpg aswell ... I learn additional things by the minute! Guest86017: shashlick: read Execution Model 39.4 http://www.swig.org/Doc4.0/SWIGDocumentation.html#Extending shashlick: pulling #ifdef equivalent stuff into the target language means also pulling in all the discovery that tools like autoconf/cmake etc do into Nim shashlick: which is why nimterop relies on these build tools and preprocessors to do their job before getting involved Vindaar: @faulander good to hear Guest86017: there's #swig by the way Guest86017: this provides a good overview too http://www.swig.org/compare.html faulander: i know it's not really a Nim-Issue, but can someone maybe still help? https://github.com/treeform/flippy/issues/14 solitudesf: thats not how you resize an image solitudesf: there are magnify/minify procs faulander: i just saw them, yes. i'll try that next solitudesf: you should never assign height and width manually, unless you also modify underlying data/know what you're doing Yardanico: @faulander also you shouldn't use "cast" Yardanico: you can for example do float(myintvar) Yardanico: also "float64" is same thing as "float" solitudesf: yes, cast are not safe conversions, they reinterpret underlying memory as different type https://nim-lang.github.io/Nim/manual.html#statements-and-expressions-type-casts leorize[m]: you definitely should not use cast leorize[m]: float and int have different memory representation faulander: ok, forgive me - i am coming from python, no need for conversion there. still a beginner faulander: i have read the sourcecode of flippy, it seems the scale is a factor right? so if i want 90% size, i set it to 90. it does a for 1 ... scale loop, which itself calls minify by 2. i don't get it. Yardanico: integer scale, and no, you don't set 90 Yardanico: if you want to minify you use minifyBy2 Yardanico: sorry "minify" faulander: bullshit. the scale is how many times it divides the width/height by 2 Yardanico: yes, but you don't set it to 90 if you want to get 0.9 of original faulander: so if i want 25% i call minify(image,4) solitudesf: 2 faulander: i have a maxsize setting for width and height and depending on which of them is bigger, i want to resize exactly to that size. don't know how i can do that, i don't think it'll work. Yardanico: yeah that's more complicated faulander: my code calculates the new width and height correctly faulander: with pillow in python i just do: ⏎ image.thumbnail((maxsizeHeight, maxsizeWidth), Image.ANTIALIAS) Yardanico: thumbnail in pillow is not for RESIZING an image though Yardanico: it's for making a thumbnail faulander: doesn't matter, it works perfectly - i have resized a few hundred thousand pictures that way faulander: is there no lib in nim which can do that resizing? Yardanico: also if you're looking for performance gains they might be much less than you expect since pillow is written in C Yardanico: i mean all the number cruncing stuff Yardanico: sadly I don't know how to use flippy to resize an image, but treeform is here quite often so he'll of course reply to your issue leorize[m]: @treeform leorize[m]: don't know if this work or if you gotta get on discord to ping him :P Yardanico: yeah I'll ping him from discord Yardanico: @treeform Yardanico: see messages above pls :) faulander: yes, i was looking for performance and to train my nim skill ... that python script is horrible slow, mostly due to io though faulander: hmm imageman can do that it seems: ⏎ import imageman ⏎ let img = loadImageColorRGBU ("sample.png") ⏎ let img2 = img.resizedBicubic(512, 512) ⏎ img2.savePNG("out_resize_bicubic.png") [https://gitter.im/nim-lang/Nim?at=5e90a18c1aaf8e4b8e741562] solitudesf: dont use bicubic if you need speed faulander: but? Zevv: Bilinear is faster treeform: hey what? faulander: works good, but the size is 70% higher. before it was 9mb, now it's 16mb Yardanico: @faulander was asking how to resize an image with flippy Yardanico: with custom width/height treeform: hmm, I don't think I have a method for that. treeform: I have minify/magnify but they take integer scale faulander: yes, i've read the source. faulander: @treeform i have a maxsize setting for width and height and depending on which of them is bigger, i want to resize exactly to that size. don't know how i can do that, i don't think it'll work. treeform: I need to write a method for that treeform: there are different resize mods like Bicubic bilinear... solitudesf: @flaunder, are you saving as jpeg? treeform: oh wow BIcubic is not simple! treeform: https://blog.demofox.org/2015/08/15/resizing-images-with-bicubic-interpolation/ solitudesf: *@faulander (wtf am i typing) faulander: yes, i am using JPG but the PNG was even bigger. I set the quality to 75% and still only got down to 7mb from 9mb. Pillow gets down to roughly 1mb treeform: sorry I don't support jpg yet faulander: yes you do @treeform if you compile with -d:useStl ;) treeform: thats true stb does support it faulander: just missing a function like imageman has :) faulander: @SolitudeSF : It must've been that test image, with my usual images i get down to 1mb aswell ... so far so good. queersorceress: Hi, I was wondering if there is a proper way to include multiple build configuration files beyond the default language level config, user level config, and project level config files. treeform: Yeah imageman looks great. solitudesf: there is also per file config queersorceress: it looks like it is possible with using `.nims` and using the `import`/`include` directives, but i'm specifically asking about it with regards to the `.cfg` variety. Yardanico: why though? Yardanico: but I think it should be possible since cfg supports @if Yardanico: see https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg Yardanico: for an example of .cfg usage queersorceress: @solitudesf these aren't bound to particular files, as i'm working on additive tooling queersorceress: @Yardanico i don't see how the existance of the `@if` and companion directives relate to having the nim compiler include the contents of another, separate, `.cfg` file. treeform: solitudesf, did you run into problem with unicode with stb? https://github.com/treeform/flippy/issues/5 Yardanico: @queersorceress ah, sorry, I misunderstood your question treeform: I see you use the open call: https://github.com/SolitudeSF/imageman/blob/master/src/imageman/images.nim#L293 queersorceress: i would rather not have a single massive (and hard to parse) configuration file that has to be evaluated as part of the build vs multiple smaller files that wouldn't take as long. queersorceress: no worries, i'm just asking 🙂 solitudesf: @treeform, i dont see unicode in the issue snippet. just tried opening image with emoji in filename and it worked. treeform: solitudesf, are you on windows? only happens on windows. solitudesf: nope, never tried it on windows treeform: I found a work around to always read it into memory with nim and then have stb load it. solitudesf: yeah, errors under wine. i want to switch from stb to libpng and libjpeg-turbo anyway. treeform: yeah that is what I did, but libpng does not work with --gc:arc treeform: so I am in the middle now... supporting both stb and libpng solitudesf: you mean nimPNG? treeform: sorry yes nimPNG. Yardanico: wait, since when code like "var x, y, z = 3" works? Yardanico: I thought I can't do that in Nim 🤔 treeform: looks like a bug to me Yardanico: well it works correctly Yardanico: !eval var x, y, z = 3; echo x, y, z NimBot: 333 treeform: !eval var x, y, z = "na "; echo x, y, z NimBot: na na na Yardanico: I'm honestly really surprised since I didn't see this anywhere in the manual Yardanico: seems like it was in Nim since forever though, it works on 0.13.0 treeform: !eval var x, y, z = @["na "]; echo x, y, z NimBot: @["na "]@["na "]@["na "] treeform: !eval var x, y, z = "na "; x.add("oh"); echo x, y, z NimBot: na ohna na treeform: strange! alehander92: where is disruptek alehander92: disbot tell me Yardanico: !last disruptek alehander92: oh i forgot the command Yardanico: !seen disruptek Yardanico: wait which one is it alehander92: is disbot even here Yardanico: he's not :O treeform: !where disruptek Zevv: "disruptek, [09.04.20 20:05] Zevv: My router finally shit the bed so I probably won’t be properly online for a few days." alehander92: !repo nim alehander92: ah i see Zevv: I can also do some rambling and obscene remarks for you if you want alehander92: please do rambling alehander92: no obscene remarks alehander92: i just saw a bot printing weird stuff alehander92: and it reminded me of him Skaruts: What is `Impl` for? Yardanico: where? Yardanico: ah, it stands for "Implementation" Yardanico: if that's what you wanted to ask Skaruts: I've seen some people using that in quite a few places Skaruts: as a suffix Yardanico: in nim? Yardanico: well for example streams module uses it for procedures Yardanico: "closeImpl" and stuff alehander92: yeah its almost a convention alehander92: but i forget to use it Skaruts: NiGui uses ControlImpl as a ref object of Control Skaruts: what confuses me is that it seems to me that Control also is an implementation Skaruts: I think what I'm trying to understand now is when to use this and why shashlick: looking for feedback and ideas on https://github.com/nimterop/nimterop/issues/177 alehander92: i think its used when you have a public api like alehander92: mymacro or myproc alehander92: and actual more hairy implementation in mymacroImpl alehander92: e.g. useful for recursion maybe if you need to pass an initial value and other args which are not public alehander92: not entirely sure Skaruts: this has been bugging me to ask: while I was making a retained mode GUI, at first I considered making Control a variant type. I decided not to because that would force me to use `case of`s to determine which procs to call for each kind of Control object, BUT... Skaruts: as I delved into it in an OOP way, I learned about dynamic dispatch, and while I've been keeping the number of methods to a minimum, I'm wondering: is dynamic dispatch faster than a `case of`? Skaruts: araq once told me methods are about 6x slower Skaruts: (than procs) kungtotte: Have you profiled your code to see if it's slow? Skaruts: no, and it doesn't seem slow. but I also never made the variant type to compare kungtotte: I'm sure you can make slow object variant code and fast dynamically dispatch code, but in theory dynamic dispatch will be slower queersorceress: another compiler question: is there a way to silence particular hints ,specifically the "declared but not used" hint from showing up in the build log? Skaruts: you mean slower than static dispatch or slower than variant type? kungtotte: Both Skaruts: oh Skaruts: I would assume though that if the variant type has many kinds, at some point it'll be slower, no? shashlick: Yes you can silence specific hints Yardanico: is it just me or I feel like most of the discussion in https://github.com/nim-lang/Nim/issues/11764 is too complex for me to understand :P kungtotte: queersorceress: --hint:XDeclaredButNotUsed:off Yardanico: about all these PRNG and hashes Skaruts: @queersorceress you can silence hints like `{.hint[XDeclaredButNotUsed]: off.}` and warnings in the same way `{.warning[UnusedImport]: off.}`, iirc that affects only the code in the file where it's used kungtotte: Skaruts: Yes, that's what I meant by making slow object variant code. Slow/fast is meaningless without measurements though. Measure if it's slow first, then profile to see where the performance is lost companion_cube: is there someone working on nimsuggest/LSP ? Skaruts: @queersorceress see the compiler notices to know which name to put inside the [..] queersorceress: @Skaruts do i need to push+pop that or does the presence on a single line only count for said line? kungtotte: queersorceress: You can also silence that particular complaint by exporting the symbol, or by using the {.used.} pragma. I tend to go with option #2 there when testing since I'll be trying stuff out Skaruts: I usually place the pragma at the top of a file queersorceress: @kungtotte ah, right; that is what i want then Skaruts: above the imports Skaruts: @Kungtotte well I was thinking one might be able to tell what would be expected to work faster in terms of raw performance if one knows how both work under the hood, I know specific cases will make a difference, but fundamentally one might be expected to be faster than the other Skaruts: That's what I was hoping to find out anyway kungtotte: If you're really curious you could write a toy example with both versions and inspect the generated C code kungtotte: And better still, write a benchmarking program for it to see how it shakes out Skaruts: not be a bad idea sealmove: why this doesn't work?selector must be of an ordinal type, float or string sealmove: sorry: https://play.nim-lang.org/#ix=2huj sealmove: I see in manual "For reasons of simplicity of implementation the types uint and uint64 are not ordinal types. (This will be changed in later versions of the language.)" Skaruts: well if you do `case ord(x)` it works Skaruts: no idea if that's desirable though leorize: companion_cube: PMunch is working on nimlsp leorize: you can query me for any questions about nimsuggest though, I got a lot of experience with it companion_cube: it doesn't seem to do completion (in vim at least), is that right? companion_cube: the error reporting is cool, though. leorize: nimlsp should do completion leorize: if it doesn't then that's a bug companion_cube: I didn't succeed in installing it companion_cube: ('build failed for [email protected]') leorize: ah, the ultimate nimble descriptive error messages leorize: run nimble --verbose --debug build leorize: it will be much much more useful companion_cube: indeed :D companion_cube: ah, it cannot open `/usr/nimsuggest/nimsuggest.nim` companion_cube: no idea why that would be a thing companion_cube: (same kind of error when I tried to use nim doc… maybe the package is low quality) leorize: I think I know why it doesn't work companion_cube: nothing urgent, really, I'm at work leorize: just nimlsp being nimlsp :P leorize: if you use neovim then my nim.nvim plugin is better than trying to setup nimlsp :P leorize: the issue with nimlsp is that it needs nimsuggest as a package leorize: and well, no one actually set it up correctly leorize: so it just assumes that your nim resides inside the compiler source code leorize: works about 90% of the time since a lot of people compile Nim themselves leorize: the last 10% is anyone that installs nim companion_cube: it's in /usr/lib/nim/compiler/suggest.nim apparently companion_cube: but yeah, assumptions about packages… oh well leorize: nah, not even that one :) companion_cube: and I do use nim.nvim :) Varriount: Araq: Is there any spec on what happens if you give different parameters to a closure iterator between calls? leorize: companion_cube: then completion should work for you if you set it up leorize: you don't really need nimlsp if you use nim.nvim leorize: nimlsp is nimsuggest but translated to LSP lingo :P companion_cube: which is sane, but well companion_cube: how do you do completion, if I may ask? given that everything is in the global namespace it seems like a hard(er) problem leorize: you forgot that everything is typed :) companion_cube: well still! leorize: everything is typed :) companion_cube: ahh I use ALE, that's why I may not have completion leorize: for example, how many times do you actually call a proc like this: foo(a)? companion_cube: all the `new` and `init` stuff I guess? leorize: and how likely is it to even have procs colliding with foo() :) companion_cube: I'm very new leorize: well you can see a clear pattern in new and init API leorize: their names are unique :) companion_cube: sure, sure leorize: and there are only a few of them :P leorize: it's not like you'll be showered by 1k symbols to choose from :) companion_cube: who knows… :) leorize: you type init and you filtered 80% of them away companion_cube: `new` and bim! leorize: around 20 symbols leorize: be a little more specific and you cut that amount by half alehander92: i'd write Type.new alehander92: but i am used to it from ruby alehander92: maybe companion_cube: yeah, there's no namespacing in nim, it feels a bit like C alehander92: you can use optional namespacing alehander92: e.g. mymodule.myfunc(b) alehander92: and you can almost enforce it by from mymodule import nil leorize: we do have namespacing, just optional leorize: to experience Nim I recommend not using from-import-nil alehander92: namespacing , whitespacing, we're big on space Skaruts: alehander92: that makes it required to do `module.foo`? Skaruts: the import nil thing leorize: yes, but if you're new, don't use it alehander92: in principle yes, but i am not sure if there aren't exceptions Skaruts: I gotta play around with it 🙂 leorize: too many people come to Nim from Python and they expect Nim to be like Python :p companion_cube: heh, gotcha leorize: they were taught that global namespaces are evil in python then they just assume the same to nim leorize: this is why I tend to avoid introducing from-import-nil to people until they're familiar with how to write nim :P leorize: ~imports leorize: oh disbot is offline :( Prestige: Going to deep dive into nim in a couple hours after work, pretty excited. Any tutorials/guides aside from the official docs that anyone recommends? leorize: nim in action is still a recommended book (i mean it's the only one :P) leorize: https://nim-lang.org/learn.html leorize: we also have third-party links in here too, so be sure to explore them all :) Prestige: Thanks leorize :) awr1: i don't really get the global namespace stigma that much awr1: i know in idiomatic C++ land people get very particular with namespaces sometimes awr1: a lot of people cringe at the basic hello world examples for using `using namespace std;` __ibrahim__: hi, how can i debug this? __ibrahim__: https://cdn.discordapp.com/attachments/371759389889003532/698254357048590406/unknown.png alehander92: hmmm alehander92: try to run the \test.exe alehander92: but i am not sure what `--app:gui` does __ibrahim__: without --appgui, a bit better __ibrahim__: https://cdn.discordapp.com/attachments/371759389889003532/698255062065086474/unknown.png __ibrahim__: without `--app:gui`, a bit better __ibrahim__: https://cdn.discordapp.com/attachments/371759389889003532/698255062065086474/unknown.png __ibrahim__: sorry im day 2 nim __ibrahim__: same with `` __ibrahim__: https://cdn.discordapp.com/attachments/371759389889003532/698255377292197898/unknown.png alehander92: welcome ! alehander92: no problem, it seems that alehander92: maybe you need to debug it somehow alehander92: you can run it under gdb or windbg i guess __ibrahim__: my code could be bad, but in mac it runs fine. on win, many problems alehander92: but you need to `nim c --debugInfo --lineDir:on -r stuff` alehander92: yeah what is supposed to happen alehander92: if it works __ibrahim__: nice that gave me something to go on from __ibrahim__: ``` __ibrahim__: Hint: C:\Dev\nimrodev\staticglfw\test\test.exe [Exec] __ibrahim__: HELLO GL __ibrahim__: Traceback (most recent call last) __ibrahim__: C:\Dev\nimrodev\staticglfw\test\test.nim(20) test __ibrahim__: SIGSEGV: Illegal storage access. (Attempt to read from nil?) __ibrahim__: Error: execution of an external program failed: 'C:\Dev\nimrodev\staticglfw\test\test.exe ' __ibrahim__: PS C:\Dev\nimrodev\staticglfw\test> __ibrahim__: ``` Yardanico: pls don't do big pastes, people here in IRC suffer a bit :) Yardanico: use services like bpaste.net __ibrahim__: im sorry, i didnt know. even images? Yardanico: well, images will be as links __ibrahim__: sir yes sir alehander92: images are kinda ok alehander92: but if you send code, send it as pastes __ibrahim__: roger that alehander92: as people cant edit/copy it otherwise alehander92: yeah you need to generally add alehander92: --stacktrace:on --linetrace:on maybe alehander92: to see if this gives a better traceback alehander92: but maybe its one line actually __ibrahim__: cool, im trying some glad + glfw. ill try those commands right now. trying to translate from C++ to nim alehander92: you need them + your --debugInfo stuff but maybe alehander92: you can just setup a nim.cfg alehander92: and write the flags there __ibrahim__: ill look up the docs for nim.cfg companion_cube: hum, c2nim segfaults… __ibrahim__: i must be misusing the function Chiqqum_Ngbata: How to prevent nimble from installing develop branch? Yardanico: it always installs the develop branch if you have to releases/tags Yardanico: you should create a tag so it will install the latest tag Chiqqum_Ngbata: I see. So as long as there tags, it gets the latest Skaruts: is it possible via macros to create a proc with lua-style varargs, like `foo(...)`, which could then take an arbitrary amount of arguments of arbitrary types? leorize: if you can't do it by hand, macros won't safe you :P leorize: macros however, does let you iterate through items of arbitary types Skaruts: can a macro not generate proc overloads or something like that? leorize: save* leorize: well yes, but why? leorize: it's possible, but I think it's better if you present the problem out leorize: there might be some idioms to solve it without having to touch macros leorize: because they are not that easy to deal with Skaruts: I mimic'ed Godot's signal system, but one problem is that I can't call `emit_signal` with arguments, because those could be anything or nothing at all leorize: you can have an overload without any arguments Skaruts: yea but the problem is the overloads with arguments, they could be anything... currently no arguments is the way I have it leorize: use generics? leorize: it's kinda hard to imagine without some example of how you'd want to use it :p Skaruts: hmm.. I guess that might work for a limited amount of arguments Skaruts: I've been using it without arguments lately, so real use cases aren't fresh in my mind atm... but when coding in Godot I've come across many times where I wanted a button to return an id, or an index number, or something like that Skaruts: well in godot's api itself, some signals return certain properties from the class emitting the signal, like ray_trace info, camera info, normal from collision, etc Skaruts: but that can be preset, it's on the user side of things that it's unpredictable leorize: I'm not sure of how you architectured your system leorize: but usually this can be done by having all signal emitters inherit from a base ref object leorize: then you can use the `of` operator to verify if something is of the type you want Skaruts: well, I figured this out on my own, so it may not be the most ideal, (and this is on the UI part of my code) but my signals are just sort of hashed into a sequence along with a closure that is invoked by `emit_signal` Skaruts: there is no signal object Skaruts: and each widget stores its own signals, so you do e.g `button.connect("released", self, "on_released", proc() = self.on_released)` (which is slightly more complex than in Godot, but works), and then within the button you call `self.emit_signal("released")` Skaruts: (the self on connect is just a way to reference the caller, to make the hash more unique -- it gets stringified) leorize: this reminds me of gtk :p Skaruts: I can't remember the name of this kind of thing, but I heard some other libs use it, yea Skaruts: but then a file loading popup, for example, might want to call `self.emit("accepted", self.selected_file)` leorize: why strings though, can't it use enums instead? Skaruts: currently I can only do `self.emit("accepted")` and the closure that was sent to this signal has no information about the file, so I have to workaround it Skaruts: tbh I can't remember why I chose strings. It's how godot does it, so maybe that had something to do with it Skaruts: gonna mess around with generics then, to see if I can get it to work with at least a limited number of arbitrary args dawkot: Why doesn't Karax's `redraw()`... redraw? leorize: it should? dawkot: Nevermind, it's actually working fine __ibrahim__: what could be causing the 'could not load glfw3.dll` on windows? __ibrahim__: what could be causing the `could not load glfw3.dll` on windows? awr1: is the DLL in the same folder as exe __ibrahim__: yes Yardanico: @__ibrahim__ is it the same bitness as the .exe itself? Yardanico: e.g. if you have a 64-bit exe the DLL should also be 64-bit Yardanico: and also the DLL should also have all its dependencies in the same folder too leorize: if a deps of the dll is not met, it will scream, so we don't have to worry too much about that part leorize: matching the architecture is much more important __ibrahim__: im trying to check the bitness awr1: perhaps the Nim DLL loader should check for the appropriate magic and give a more detailed error awr1: https://superuser.com/a/889267 awr1: this seems to be a common issue __ibrahim__: i tried to drap and drop into sublime but all i got was binary 😹 __ibrahim__: oh ok need to drop in notepad.exe leorize: @awr1: we can't actually leorize: windows have it's own searching logic __ibrahim__: okay they are different in bitness Yardanico: which one is which? Yardanico: glfw is 32-bit and your app is 64-bit? __ibrahim__: other way around awr1: doesn't LoadLibrary() give an HRESULT or something that is more useful Yardanico: strange Yardanico: ah choosenim uses 32bit by default Yardanico: on windows Yardanico: or something like that __ibrahim__: must I tweak something in the nim.cfg? leorize: @awr1: welcome to windows, where the returned result is never documented, ever :) __ibrahim__: ive been trying to make it work on windows all day long. on my macbook air from 2008 it just works awr1: https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya#security-remarks Yardanico: leorize: might check reactos and wine for info :) leorize: playing the guessing game with microsoft is never fun leorize: it's best to just avoid it __ibrahim__: linux? leorize: ? __ibrahim__: i meant, is linux better :D Yardanico: @__ibrahim__ well the easiest way to you is probably to find a 32-bit glfw Yardanico: well yes, linux is better awr1: looks like GetLastError() can give you STATUS_DLL_MIGHT_BE_INCOMPATIBLE __ibrahim__: yeah totally doing that Yardanico: at least you can have some docs or check the src :P __ibrahim__: lmao __ibrahim__: i have a centos8 installed i have yet to dive into it, i couldnt even make the ~/.bash_profile to work properly xD leorize: > The error codes returned by a function are not part of the Windows API specification and can vary by operating system or device driver. For this reason, we cannot provide the complete list of error codes that can be returned by each function leorize: @awr1: even microsoft gives up :P awr1: idk, if its documented here its probably good enough awr1: in any case the alternative is to use SearchPath fisrt awr1: and then check the magic leorize: we should only use SearchPath when we fail leorize: or maybe try piping the error code into FormatMessage leorize: maybe it'd spit out better errors awr1: FormatMessage gives nothing interesting, i just tried it with a 32-bit SDL2.dll awr1: or wait maybe i'm being dumb awr1: i'm dumb, i was using "SDL2.h" as the string awr1: when loading a 32-bit DLL from 64-bit EXE awr1: FormatMessage() gives "%1 is not a valid Win32 application." awr1: if it can't find anything it gives "The specified module could not be found." Yardanico: what if you try to load a 64-bit dll from 32-bit app 🤔 awr1: same thing Yardanico: cool, now make a PR :P awr1: sure, after i cook this tomato basil soup KingDarBoja: I am back guys 😄 KingDarBoja: Hi there awr1 awr1: hello KingDarBoja: What's up? I feel free today 😄 __ibrahim__: the 32-bit dll worked KingDarBoja: I got lost at the manual searching for my own custom `$` proc for my custom types lol KingDarBoja: I mean how to do it * I have read it before leorize: just make a `$`(o: YourType): string Yardanico: also don't forget to export it with * leorize: exporting is only for outside modules to use it leorize: if it's internal you don't have to export KingDarBoja: It is for outsiders 😄 Thanks KingDarBoja: Do you have any suggestion of how should be the format of a custom type? Like the stringified version when calling ``$`` Yardanico: usually I do like "MyObject(field1: value1, field2: value2)" kinda like repr :P Yardanico: but you're free to do however you like KingDarBoja: Thinking on something like json Avatarfighter: Hello everyone 😄 KingDarBoja: But now I remember the tables module is what I am looking for leorize: @KingDarBoja: you don't just implement `$` for fun :P Avatarfighter: Stupid question for you guys but I'm converting the endianness of int16s that I'm reading from a StringStream and I was wondering if my current solution is written in a "clean" way. https://dsh.re/c7f6b KingDarBoja: What do you mean leorize? 😛 Avatarfighter: Is converting string data to an int via a cast the best way of doing it? E.g: cast[int16]("\x00\x15") ? leorize: @KingDarBoja: that means you should implement it with an actual use case in mind :P leorize: for example for Duration, it's `$` prints out the duration like: 2 seconds 110 milliseconds KingDarBoja: I want to use it for debugging my types, instead of relying on repr leorize: Avatarfighter: it's a terrible way to do it :P KingDarBoja: But just did a search for json module and found the `*%` operator KingDarBoja: %* KingDarBoja: Which gives me a nice output string leorize: repr is the best debugger :P Avatarfighter: leorize I was expecting it to be a terrible way haha 😄 Is there a better you know of ? I couldn't think of anything else off the top of my head awr1: did the PR https://github.com/nim-lang/Nim/pull/13950 awr1: i'll check for CI fails later, i need to finish this soup KingDarBoja: https://play.nim-lang.org/#ix=2hwg leorize 😄 leorize: @Avatarfighter: https://play.nim-lang.org/#ix=2hwh leorize: https://github.com/status-im/nim-stew/blob/master/stew/endians2.nim <- status endians2 have a much much better API for this that doesn't look confusing leorize: @KingDarBoja: I'd recommend repr instead :P leorize: `%*` is not that efficient leorize: it builds a JSON tree at runtime, then print it Avatarfighter: Leorize: you're a wizard I had tried something similar by casting stuff to pointers without using "addr"(lmfao) and was getting scary error thank you very much Avatarfighter: Yeah status' apis look super nice but I'm trying to keep my bittorrent library free of as many external libraries as possible atm Avatarfighter: oh jeez you shouldn't have shown me nim-stew now I might have to retract what I just said of keeping my lib free of external libraries lol leorize: you can try to introduce endians2 into endians and make a PR :) leorize: the folks at status would thank you :P Avatarfighter: I actually really like how status does their endians tbh and I would definitely do a PR but I'm not exactly the best when it comes to making them leorize: well, practice makes perfect :) Avatarfighter: I'm about to get roasted lmfao KingDarBoja: https://play.nim-lang.org/#ix=2hwt KingDarBoja: Wut? Avatarfighter: I'll make two variants of my lib one using status' lib and the other the std one and if there is truly an advantage to using the status one I'm making a PR haha 🙂 leorize: @KingDarBoja: s/=/:/ on line 8 lol leorize: also it doesn't work since we don't have a default `$` for ref object, dereference it first KingDarBoja: 🤦 KingDarBoja: https://play.nim-lang.org/#ix=2hwA KingDarBoja: Hold on, I think I found something KingDarBoja: https://play.nim-lang.org/#ix=2hwC Why the test that runs after adding the JSON operator is more verbose? lol leorize: it tries to bind `$` if available KingDarBoja: Intriging KingDarBoja: Intriguing* __ibrahim__: hello! __ibrahim__: how hard is it for a c++/python noob to try nim opengl __ibrahim__: i literally just found nim xD companion_cube: Araq: what do you think of `yield from`? konsumlamm: you actually could implement that as a macro konsumlamm: or template even companion_cube: I'm trying a template right now companion_cube: (could still be in the stdlib!) konsumlamm: fair, but it doesnt need tp be a builtin konsumlamm: fair, but it doesnt need to be a builtin companion_cube: no, that's cool number_two: __ibrahim__: Difficulty of actually learning how to use it is about the same as any other language. You're essentially using the same library as C's openGL. But Nim abstracts a lot of the complexity away from C, so I guess it may be a little easier number_two: Unfortunately means that if you're looking at tutorials, you do needa do a little bit of fiddling to fond the equivalent of doing stuff in Nim companion_cube: ok idk how to write that companion_cube: tried https://paste.isomorphis.me/OeZ leorize[m]: companion_cube: isn't that just a for loop? leorize[m]: also you don't need quote __ibrahim__: @gitterirc Thanks for your answer! Makes sense. I'll fiddle away then companion_cube: wrong kind, it seems… InventorMatt: I'm trying to use the httpclient library but when I compile my code I get "could not load: (libcrypto-1_1-x64|libeay64).dll" both of those libraries are found in my nim bin and they are on my path. does anyone know what is causing this or how to fix it. I am using windows 10 and nim 1.2 number_two: InventorMatt: I think you can use '-d:nimDebugDlOpen'. I might give you more info InventorMatt: number_two: I've tried that but I getting an error for that as well saying "argument for command line option expected: '-d'" number_two: InventorMatt: Can you paste your call to nim here, please? InventorMatt: nim compile --verbosity:0 -d:nimDebugDlOpen --run "c:\Users\matth\My_Projects\nim_scripts\http_tests\http_tests.nim" number_two: InventorMatt Which command line app are you using? ie command prompt, powershell, git bash etc? number_two: That seems to run fine on bash, but I'm also on linux. InventorMatt: number_two: I'm using powershell. I tried it on command prompt and the command runs but the output isn't any different from the usual and its the same error as well number_two: InventorMatt: Hmm, that's weird. Can you try making a bat script that executes it? Or, better yet, add a config.nims file to the root directory of the project and add 'task build, "build me": exec "nim compile --verbosity:0 -d:nimDebugDlOpen --run \"c:\Users\matth\My_Projects\nim_scripts\http_tests\http_tests.nim\"' to it number_two: Maybe that helps InventorMatt: number_two: I got that to run and the output was this "Error: unhandled exception: FAILED: nim compile --verbosity:0 --hints:off -d:nimDebugDlOpen --run c:/Users/matth/My_Projects/nim_scripts/http_tests/http_tests.nim [OSError]" InventorMatt: with a few more tracebacks InventorMatt: as well as the same failed load error from before number_two: InventorMatt: Oooh, anything interesting in the tracebacks? Maybe pastebin it? InventorMatt: ould not load: (libcrypto-1_1-x64|libeay64).dll InventorMatt: Error: execution of an external program failed: 'c:\Users\matth\My_Projects\nim_scripts\http_tests\http_tests.exe ' InventorMatt: stack trace: (most recent call last) InventorMatt: C:\Users\matth\scoop\apps\nim\current\lib\system\nimscript.nim(401, 18) InventorMatt: c:\Users\matth\My_Projects\nim_scripts\http_tests\config.nims(2, 10) buildTask InventorMatt: C:\Users\matth\scoop\apps\nim\current\lib\system\nimscript.nim(260, 7) exec InventorMatt: C:\Users\matth\scoop\apps\nim\current\lib\system\nimscript.nim(260, 7) Error: unhandled exception: FAILED: nim compile --verbosity:0 --hints:off -d:nimDebugDlOpen --run c:/Users/matth/My_Projects/nim_scripts/http_tests/http_tests.nim [OSError] InventorMatt: just that mhessler97: ould not load: (libcrypto-1_1-x64|libeay64).dll ⏎ Error: execution of an external program failed: 'c:\Users\matth\My_Projects\nim_scripts\http_tests\http_tests.exe ' ⏎ stack trace: (most recent call last) ⏎ C:\Users\matth\scoop\apps\nim\current\lib\system\nimscript.nim(401, 18) ⏎ c:\Users\matth\My_Projects\nim_scripts\http_tests\config.nims(2, 10) buildTask ... [https: FromGitter: ... //gitter.im/nim-lang/Nim?at=5e8e7d9e9316f34b8d8cf646] number_two: InventorMatt: Can you try just compiling the code and not running it? number_two: Using the command line InventorMatt: number_two: it compiles successfully without any errors. the errors only show up when it is run number_two: InventorMatt, Are you using SSL in your code? InventorMatt: import httpClient InventorMatt: var client = newHttpClient() InventorMatt: discard client.getContent("https://covid.ourworldindata.org/data/ecdc/total_cases.csv") InventorMatt: here is all the code has number_two: InventorMatt maybe you need the -d:ssl flag? number_two: so 'nim c -r '? number_two: Sorry number_two: 'nim c -d:ssl -r ' InventorMatt: I just tried that and I am still getting the same result number_two: Sorry, I don't debug DLL imports often (if ever XD). Try putting the DLL's in the same directory as the exe maybe? InventorMatt: number_two: well that solved it. thanks for your help. I just wish there was an easier way to point to it so I don't have to copy those file into every folder I need that library number_two: InventorMatt: Huzzah! I'm sure there a way. It sounds like an issue with your PATH without context. If it's in the same dir as nim.exe and you can just call nim, then that implies that it in in the PATH... number_two: InventorMatt: Is your %PATH% big? I saw a post where there was another version of pcre64.dll that was being loaded from another folder in the path (but it's an invalid version, so it couldn't load it) number_two: InventorMatt: Try moving the DLL's back and moving nim's directory to the very front of your %PATH% number_two: https://github.com/nim-lang/Nim/issues/5541 for reference. Could be the same issue? InventorMatt: I tried moving the path up the front and still nothing. my path length is about 31. I don't know if that is considered too large of an amount number_two: InventorMatt: Any chance you could post your path? If there's not anything sensitive on there InventorMatt: there is nothing sensitive in there InventorMatt: C:\Users\matth\scoop\apps\nim\1.2.0\bin;C:\Users\matth\scoop\apps\gcc\current\bin;C:\Users\matth\scoop\shims;C:\Users\matth\AppData\Roaming\Python\Python37\Scripts;C:\Users\matth\AppData\Roaming\Python\share\applications;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShel number_one: Nothing wrong with the path length. Looks OK to me... InventorMatt: I'm pretty sure on an earlier version of nim I got the script to work. but that was using 1.06 so maybe the transition to 1.2 messed something up number_one: InventorMatt: Ok, one last thing. Maybe try passing a direct path to the DLL's with the `-p` argument? number_one: ie nim c --path:"C:\Users\matth\scoop\apps\nim\1.2.0\bi" -r number_one: * ie nim c --path:"C:\Users\matth\scoop\apps\nim\1.2.0\bin" -r leorize: uhmmm, that's not how you do it, ever leorize: usually it should just work with the DLL in your PATH leorize: note that the DLL must be in the same architecture as your executable Varriount: leorize: My guess is that the DLL and executable are for 32 and 64 bit respectively (or vice-versa) Varriount: InventorMatt: If you have Python installed (which it looks like you do) you can use this script: https://raw.githubusercontent.com/tgandor/meats/master/missing/arch_of.py Varriount: @InventorMatt ^ KingDarBoja: Oh noes! https://ziglang.org/ KingDarBoja: Another programming language lol InventorMatt: @Varriount I just ran the script and got x64. everything should be 64 bit as far as I know Varriount: Did you run the script against your compiled program? InventorMatt: yes, I did leorize: @KingDarBoja: wait only now you realize that it exists? :P Varriount: InventorMatt: Did you modify your path (such as add the Nim path) after you had your terminal window open? Varriount: In your system settings KingDarBoja: Oh yes... KingDarBoja: Everyday I know something new leorize: well zig is a pretty cool language leorize: though I wouldn't use it :P Varriount: @InventorMatt Or rather, I should say, try closing your terminal, reopening it, and compiling. InventorMatt: @Varriount that I forgot to do and it seems to be working now. thank you so much for seeing that. Varriount: (finally my years of developing on Windows bears fruit) awr1: what is `nnkExprColonExpr` KingDarBoja: Win4Life Varriount: *bares awr1: i don't see it mentioned in the macro docs awr1: oh nvm Varriount: awr: Might be part of the AST when dealing with `for` blocks and such? awr1: i realized what it was KingDarBoja: 🙂 awr1: encountered this strangeness just now awr1: https://github.com/nim-lang/Nim/issues/13932 awr1: curiously `repr()` gives the correct result leorize: looks like astGenExpr didn't process type data correctly awr1: it's not only astGenRepr, navigating down the tree, it is a intlit dongbei: hmm dongbei: leorize thanks for the answers from before leorize: you're welcome :) dongbei: anyone know how chang the cpp compiler version from gnu++14 dongbei: string_view doesn't exist for me lol leorize: --passC:-std= dongbei: you'd think that would work leorize: so what's your issue? :P dongbei: nim cpp --passC:-std=c++17 --cincludes:"uWebSockets/uSockets/src/" hello.nim dongbei: the dongbei: Error: execution of an external compiler program 'g++ -c -w -w -fpermissive -std=gnu++17 -std=gnu++14 -funsigned-char -I/home/parallels/.choosenim/toolchains/nim-1.2.0/lib -I/home/parallels/work/scratch/nim/uWebSockets/uSockets/src/ -I/home/parallels/work/scratch/nim -o /home/parallels/.cache/nim/hello_d/@mhello.nim.cpp.o /home/parallels/.cache/nim/hello_d/@mhello.nim.cpp' failed with exit code: 1 dongbei: essentially both flags are in there dongbei: gnu++14 and gnu++17 dongbei: c++17 also doesn't work dongbei: so gcc++ doesn't recognize string_view as a member of std leorize: looks like Nim passes that by default dongbei: yah leorize: try this then --gcc.cpp.options.always:-std=gnu++17 dongbei: same error as before dongbei: should I compile nim myself with extccomp.nim modified or something? leorize: try putting `{.passC: "-std=gnu++17".}` in your .nim file dongbei: checking dongbei: Error: expression 'staticExec "gcc-c additionalfile.cpp --flags ", "", ""' is of type 'string' and has to be discarded; dongbei: first day, doing this, I'm probably including it wrong. dongbei: i didn't include the back ticks leorize: you don't need them dongbei: k leorize: how did you put them in? dongbei: one sec, pastebinning dongbei: https://pastebin.com/zdCq9mNL dongbei: oh dongbei: OH dongbei: i need to check this error, one minute, thank you leorize: the error was simple leorize: staticExec returns a string, and you didn't handle it leorize: also that concatenation is faulty dongbei: yeah leorize: also, do you know that we have a `{.compile.}` pragma? leorize: though it might not be what you want dongbei: no, googling it dongbei: ok so instead of using emit I'm using `{.compile: "uWebSockets/src/App.h".}` and instead of the cli option passing I'm using {.passc: "-std=c++17".} dongbei: but the default gnu++14 problem persists dongbei: nice that I can avoid the emit I think leorize: I'd say raise an issue on the compiler tracker for not being able to override -std=gnu++14 leorize: and also that's not how you use compile :P dongbei: but it gave me the same error lol dongbei: i'll change it back to emit and see what happens dongbei: https://github.com/nim-lang/Nim is the tracker? leorize: yep leorize: we do have a websockets library that you might want to use: https://github.com/niv/websocket.nim dongbei: not as fast dongbei: I've been benchmarking with wrk leorize: can you share the benchmark? :) dongbei: the interoperation of nim and c++ seems like it would be a complete winner in my usecase leorize: yes, but you gotta know how to use it :) dongbei: that's my strugle right now lol dongbei: gimme a bit and I'll post the bench dongbei: you want it here or on a gist or something? leorize: a gist would be nice dongbei: kk dongbei: issue created, getting the bench dongbei: hey before i go any further, the fastest compilation options are nim c -d:danger --gc:markAndSweep nimsocket.nim, right? I'm only doing a hello world and I don't want this to be skewed dongbei: i tried --gc:none and --gc:arc but that causes errors with asynchttpserver or something dongbei: oh what, none works now dongbei: ignore me pls dongbei: ok dongbei: https://gist.github.com/ibsusu/0ffd8a3effcaf701e070b17d3ded9c6a dongbei: barebones simple hello world test dongbei: uWebsockets is over twice the speed dongbei: I tried using both arc and none for gc dongbei: if there's another technique I don't know about I can try again dongbei: gonna go try and build nim to get past my previous bug, let me know what your thoughts after you take a look pls dongbei: i don't want to miss anything leorize: dongbei: he fastest are -d:danger gogolxdong: What 's this exception `/mnt/c/Nim/lib/system/refs_v2.nim(139) nimDecRefIsLast` leorize: dongbei: you can't really compare a websocket server and an http server :P leorize: but I'll try to tinker with this :) leorize: @gogolxdong: are you using arc? gogolxdong: using regions leorize: you should use arc leorize: region is deprecated and it doesn't even work correctly gogolxdong: the project is based on gc:regions, impossible to migrate in couples of days. gogolxdong: which version should I use with gc:regions? leorize: you might want to see this: https://github.com/nim-lang/Nim/pull/11920 leorize: if 1.2 doesn't work, try switching to an older version faulander: stupid question: ⏎ filename = filename.strip(chars={'\x00', '\"', '*', '/', ':', '<', '>', '?', '\\', '^', '|'}) ⏎ doesn't strip the chars, why? faulander: (and i know there's a const for it, just used it this way for testing) faulander: https://play.nim-lang.org/#ix=2hj1 Vindaar: @faulander what do you expect to happen? Vindaar: `strip` only removes characters from the beginning or end of the string faulander: aaaaaaah sure! i need to use replace! faulander: thats why i said "stupid question" :) Vindaar: Ah, don't say that. It's fine to ask something like that Vindaar: but usually it's a good idea to state not only what you're doing, but actually what you expect the end result to be. Because I saw your message (before you posted the example), but didn't understand your problem :) faulander: you're right of course faulander: and now i am struggling mit multireplace :) faulander: proc multiReplace(s: string; replacements: varargs[(string, string)]): string {...} Vindaar: by how to use it? faulander: yes faulander: i want to replace all chars in the filename which are invalid with "" faulander: ah got it: ⏎ filename = multiReplace(filename, [("?", ""), (":", "")]) ⏎ (and so on) Vindaar: yep, that's how to do it Araq: +1 for multiReplace Vindaar: @Araq: have you seen https://github.com/nim-lang/Nim/issues/13913? Just wondering if this is really a bug or simply not supported faulander: i have a question (again). i have a seq of Table. can i directly access the key:values of the table? Currently i do: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e8ed6eafea5216d6969600d] faulander: seq[i]["title"] isn't working Vindaar: @faulander it should work though. Can you post a more complete example? moerm: hello faulander: i presumed it should work ... let me try again and otherwise create an example on playground Vindaar: ok! faulander: hahaha, now it works. i tried it yesterday before writing the workaround code and it didn't. I must've messed up somewhere else :) Vindaar: good to hear Yardanico: "nim c --cpu:arm -d:release -d:danger --cc:zig --passC:"-target arm-linux-musleabi" --passL:"-target arm-linux-musleabi" main.nim" :P Yardanico: ah forgot, no need for -d:release here anymore Yardanico: but yeah, Zig as C compiler works just fine Yardanico: it's better than manually cross-compiling a GCC musl toolchain :P Araq: Yardanico, nice that it works Zevv: what is this fuzz about the zig compiler Zevv: is it just a packaged cross compiler with sysroot built in or someting like that? faulander: i get could not load: (libcrypto-1_1-x64|libeay64).dll when running the compiled exe outside of the source directory ⏎ i a compiling with -d:ssl option and running windows10 Yardanico: Zevv: well they package 30+ different libcs with headers for different linux targets, libclang itself (and of course Zig compiler too) Yardanico: and it's only a ~40mb tarball Yardanico: (tar.xz) Zevv: sounds pretty pragmatical Yardanico: https://ziglang.org/#Zig-ships-with-libc Zevv: so I can finally get rid of this pain: http://zevv.nl/div/toolchains.png :) Yardanico: uh-oh Yardanico: well, it doesn't have uclibc sadly Yardanico: glibc and musl Zevv: aw that kind of defeats the purpose for me :/ dongbei: anyone know wha tthe equivalent for c++ lambdas are? dongbei: i'm trying to pass a proc to a c++ function that I'm importing with importcpp dongbei: i'm nearly able to run my hello world in nim (๑˃ᴗ˂)ﻭ mratsim: proc map[T](x: seq[T], lambda: proc(x: T): T): seq[T] mratsim: if it's a C++ function you might have to proc map[T](x: seq[T], lambda: proc(x: T): T{.cdecl.}): seq[T] dongbei: what is this wizardry dongbei: ok, gonna try moerm: bye, have a nice day dongbei: bye dongbei: u2 dom96: Yardanico, cool that Zig works, we may wish to consider enabling the download of it for choosenim Yardanico: now I need to figure out how to build libressl with "zig cc" and then use it to cross-compile a static nim binary which uses SSL (via httpclient) :P Yardanico: oh well zig cc worked for libressl cross-compilation just fine dom96: This is actually pretty genius of the Zig creator, lots of C programmers will download it just to use it as a C compiler. dom96: Trying out Zig then becomes easy Yardanico: :P faulander: out of options on my compiling problem. tried putting the dll inside the exe dir and inside windows/system32 directory - still get the same error when running my program :( Yardanico: @faulander maybe some DLLs have wrong bitness? Yardanico: like if you're mixing 64 binary with 32-bit dlls Yardanico: or these DLLs have dependencies themselves too, in that case they wouldn't get loaded too Yardanico: unresolved dependencies I mean faulander: i would prefer having all requirements inside the exe, but have no clue about compiling and linking since i am coming from python and not been using a compiler since 30 years or so. faulander: the exe works fine inside the src directory btw, just not on another directory like c:\tmp faulander: so which dlls do i need to use when compiling with -d:ssl option to run it on windows? faulander: windows 10, 64bit that is kodkuce: can Nim mix GC like make 1 library thats gc:none and then an main.nim that uses default gc or whatwer clyybber: Vindaar: Looks like a valid bug clyybber: @kodkuce Yeah Vindaar: @Clyybber: ah, thanks! Glad to hear that this should work clyybber: Vindaar: Oh, actually. Could it be that you have multiple overloads of sqrt imported? Vindaar: Yes, that's the point clyybber: Yeah, they probably should count as typed Vindaar: Essentially I want to look at all possible overloads of different procs. If there's only one match I use it to extract type information. If there's multiple I check if there's no ambiguity given certain possible arguments. Vindaar: using `dynamicBindSym` I could do the same in the actual untyped macro. But without that I have to delegate that to another macro I call Vindaar: the actual application is that in ggplotnim if a user writes `f{mean(c"someCol")}` I can just look at possible `mean` to decide if this returns a value or a seq / tensor Araq: kodkuce: don't see how that would be possible clyybber: Araq: Huh, should be possible no? clyybber: If the library doesn't use strings and seqs? Araq: I think there is some confusion about what 'library' means Araq: if you mean some binary, then yes it's possible Araq: if you mean "Nimble package A combined with B" Araq: then the answer is "no", they have to agree on the MM strategy dongbei: I can't seem to make lambdas work dongbei: been at this for a couple of hours Rika: what's the issue dongbei: I'm trying to create a lambda in nim that I pass to a c++ method I'm importing dongbei: I've tried importcpp and emit dongbei: kinda lost dongbei: calling methods on objects that have class methods works just fine but i can't seem to get the lambda right Araq: dongbei, you mean C++ lambdas? dongbei: correct kodkuce: Araq: so package A + packageB cant work, but if i compile packageA with gc:none and use it from PackageB like c# dll(if that even possible duno?) ? dadada: is zig support in nim 1.20? kodkuce: can Nim make lib files like c# dlls at all or would i be foreced to call it like process and read stdouts or whatewer Recruit_main707: more like a c dll, but probably it will work Yardanico: dadada: no Yardanico: it was merged after 1.2 release Yardanico: https://github.com/nim-lang/Nim/pull/13757 Rika: DAMN zig support in nim Recruit_main707: whats zig? Yardanico: @Rika well Zig exposes "zig cc" which acts almost like clang Yardanico: @Recruit_main707 a programming language Yardanico: which also happens to distribute a toolchain for easy cross-compilation Recruit_main707: and how is that? Recruit_main707: we compile to zig? Yardanico: no, we compile to C Yardanico: Zig already bundles libclang so they just made it so "zig cc" acts almost like clang Rika: That would be insane though lmao Yardanico: (With some zig extra options for cross compilation) Yardanico: @Rika not really, Zig can translate C code to Zig actually Yardanico: so to compile a nim app to arm (with musl, statically) you can do nim c -d:danger --cpu:arm --cc:zig --passC:"-target arm-linux-musleabi" --passL:"-target arm-linux-musleabi" Rika: Zig has "less" features than c right? Yardanico: with no need to manually find and compile a toolchain and stuff Yardanico: @Rika I'm not sure what do you mean by that Rika: Me neither :) Recruit_main707: i guess its a simpler language Yardanico: not really Yardanico: you can write C-like Zig code anyway Yardanico: same goes for Nim too Recruit_main707: is nim big endian or little endian Rika: both Rika: i dont seem to understand clyybber: a language is not big or little endian clyybber: a processor is.. clyybber: or a file Recruit_main707: i have issues passing an integrer from python to nim (theorically using my machine´s endian), but not working: Recruit_main707: 98005 this should be received, Recruit_main707: 2 but i recceive this Rika: how are you passing it Recruit_main707: `struct.pack("@i", my_len)` Recruit_main707: and then sending it Recruit_main707: https://docs.python.org/3/library/struct.html this could be helpful, i think i am doing it as i should, but idk Rika: print that in python, then also `echo result.repr` in nim Recruit_main707: that number was the python number, i will try .repr awr1: zig is okay awr1: feature wise it's kind of a middle point between C++ and D Recruit_main707: seems to print the same think Rika Rika: it shouldnt show a box but the escaped bytes thing Vindaar: @Recruit_main707: do you try to read the data as int32 or int64? Because `i` in the context of python's `struct` is a 4 byte integer Recruit_main707: `rootsocket.recv(4)`, thats right isnt it? awr1: i think if you try to compare zig and nim, nim has a more ambitious set of goals Vindaar: I think if you do "rootsocket.recv(4).parseInt32" it'd work, but not if you use `parseInt` on the result awr1: for instance zig has some compile time flexibility (kinda similar to `const` and `static` in nim) awr1: but it holds itself back from having a fuller macro system (by design) Vindaar: ah wait Recruit_main707: Vindaar, parseInt32 doesnt exist :/ Rika: parseInt Rika: ah Rika: thats the strutils one Rika: hm i dont know what to do for converting a bytes string to an int Recruit_main707: a few months ago i asked a guy in here, and he gave me some roll and unroll bytes, which worked, but now my header is so big i cant fit it into an uint16 :p Recruit_main707: bytes functions* Rika: you can prolly adapt those functions Vindaar: If you had a stream you would just use `s.readInt32()` Rika: you can convert the string into a StringStream Recruit_main707: readint32 doesnt seem to exist either Rika: https://nim-lang.org/docs/streams.html Rika: it does Vindaar: https://nim-lang.github.io/Nim/streams.html#readInt32%2CStream Recruit_main707: should i import something? Rika: `import streams` Recruit_main707: ah ok, i thought this was stdlib Vindaar: it is stdlib Vindaar: just not system Recruit_main707: ok Recruit_main707: ok, how do i convert it into an stream? Rika: newStringStream(theString) Recruit_main707: fingers crossed Recruit_main707: well, now my header seems to be bigger than it should be :p Recruit_main707: but at least its an actual number Rika: so, um, why is stringstream not available for JS? clyybber: didn't make it work yet :p clyybber: I made it work for CT js at least Recruit_main707: working :D, (but so fricking slow its useless) but well see what i can do about that, thanks clyybber: @Recruit_main707 how did you build your compiler? clyybber: if you say ./koch boot then I know why its so fricking slow Recruit_main707: its probably the 14000 characters python needs to send :p Rika: AKA it's prolly python? clyybber: @Recruit_main707 yeah, but did you build your compiler using ./koch boot ? Or did you install the binary? Recruit_main707: installed clyybber: ah ok clyybber: @Rika you could try removing the {.compileTime.} from the procs that are in the `when defined(js)` branch clyybber: I can't quite remember whats missing Recruit_main707: how realistically possible is that by using nim sockets in the python part it will go faster? Rika: @Clyybber twas just a question, I'm not using js backent clyybber: ah ok Zevv: yayk Zevv: I won another Nim soul today Zevv: that makes three Zevv: I did my part clyybber: ha nice! Zevv: Every day I check the exponential graphs of Nim growth Recruit_main707: i got someone into nim, but he is a bit busy so he hasnt started yet mratsim: Aren't you supposed to do that for COVID? Zevv: nah, I stopped caring about that. After two weeks I decided my life is pretty much unchaged. mratsim: @Recruit_main707 Nim sockets are just raw system sockets, I suppose Python is the same. Recruit_main707: probably federico3: https://news.ycombinator.com/item?id=22820852 dom96: TIL Swift has an interpreter dom96: Sounds like they should hire Andreas Yardanico: lol :D dom96: They literally hired the creator of Swift, and asked him to do something dom96: They then evaluated other languages and no surprise here, chose Swift for their project alehander92: its interesting because the creator of Rust alehander92: went to work on Swift iirc dom96: Lots of different programming language creators went to work on Swift shashlick: $$$ dom96: Not sure about the creator of Rust, but Slava (creator of Factor) is one example alehander92: ah interesting alehander92: well, graydon said he burnt out alehander92: which is also possible: working on the same thing for years is so hard dom96: AFAIK creator of Clay also works at Apple on Swift Yardanico: @alehander92 I wonder how 4raq manages to do it :P alehander92: well, people are different :P alehander92: i always thought microsoft is a cool place to work alehander92: for language design alehander92: as they often have those random research langs/os-es mratsim: Well Swift creator left Swift to work at Google mratsim: and then he left GOogle alehander92: no, he left for Tesla dom96: Nice, so soon we'll have a programming language suited for car programming alehander92: no, he left Tesla for Google alehander92: and now it seems he is in SiFive which is cool alehander92: sorry mratsim yeah you're right for the second thing Yardanico: also, an unrelated question - recently a guy I know on Telegram has been pursuading me towards reading SICP - is it worth it ? :) Araq: so you're asking on IRC for confirmation on something you heard on Telegram Yardanico: well I trust IRC more, people seem to be more professional here :D zacharycarter: there's one way to find out zacharycarter: https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html Yardanico: yeah I already read the introduction and did some first excersises :P alehander92: its very famous alehander92: i am not entirely sure why its so famous alehander92: but it seems cool if you're learning lisp zacharycarter: I think it actually focuses mostly on scheme alehander92: yeah sorry Yardanico: yeah, but scheme is lisp :P zacharycarter: lisp is like the C++ of scheme alehander92: but i guess some ideas kinda translates to other lisps alehander92: i think its the opposite alehander92: lisp was there before scheme zacharycarter: no alehander92: so scheme is like the Go of .. C++ ? alehander92: yes Yardanico: zacharycarter: lisp is when it all started :) alehander92: its a dialect companion_cube: when you say lisp you mean common lisp? zacharycarter: but scheme is simpler than lisp zacharycarter: scheme dialects can be tiny alehander92: you're right lisp it is kinda like C++ to scheme Yardanico: one thing I don't like is that if you want to have some good editor support for any lisp-like language you have to use emacs (or DrRacket for Racket) zacharycarter: okay so lisp predates scheme, scheme is just a minimal dialect of lisp - my bad I needed to wiki alehander92: no problem alehander92: i enjoyed alehander92: an article about restarts in common lisp iirc Yardanico: although that guy on telegram is also a very heavy zealot about emacs and lisp :D alehander92: it seems as an interesting construct tho i am not sure fully that i'd use it in nim narimiran: Yardanico: https://susam.in/blog/lisp-in-vim-with-slimv-or-vlime/ - you can use vim too ;) Yardanico: xdd Yardanico: and what about *dare I say* vscode or something which doesn't require me to use keyboard that much? I mean I can kinda get away with simple editor functionality with emacs already (with doom configuration) narimiran: i would guess there's some extension for it Yardanico: only for syntax highlighting Yardanico: no fancy auto suggestions or LSP narimiran: alternatively, you do SICP using Nim and whatever editor you like :) Yardanico: lol alehander92: yes kodkuce: i would like to get auto suggestion for micro but duno how 🙂 kodkuce: i find neovim wasting too much time thinking how to do stuff i want then doing it Yardanico: create a nim plugin for it :P kodkuce: i can invest stome time trying kodkuce: hmm from what i see they dont have lsp implemented Yardanico: is "nimlsp" good now? :P faulander: can someone explain to me, why getHomeDir is not getting the correct homedir at runtime? Its trying to access MY homedir (i compiled it) when run on another machine. Yardanico: wdym? Yardanico: getHomeDir gets a home directory of the user who ran the binary Yardanico: not *the developer* Yardanico: ah Yardanico: maybe you've used "const" instead of "let"? Yardanico: "const" means "calculate at compile-time" so maybe that's why it saves your own home directory faulander: no faulander: ah, yes. i used const faulander: you're a genius Yardanico: well it's important to understand the difference between const and var/let in nim, it's different (and IMO more correct) than in other languages because it literally means "a constant" mratsim: maybe the doc of getHomeDir needs a caveat Yardanico: @mratsim most procs from "os" module will need that then :P mratsim: who needs files anyway ;) Yardanico: I think it's not an issue, just need to tell new Nim programmers the difference between var/let and const early on faulander: i was wondering what the difference between let and const is - now it makes alot of sense. Yardanico: @faulander it's actually in the tutorial https://nim-lang.org/docs/tut1.html#constants Yardanico: "The compiler must be able to evaluate the expression in a constant declaration at compile time" Yardanico: Also I really suggest superb https://narimiran.github.io/nim-basics/ faulander: yeah, but that sentence is maybe understood by a science professor, not a self taught developer. faulander: i got it now. let's see if my first finished product now runs on that other machine. i still have no clue how to get the compiler setting -d:ssl work on windows. my workaround is to install openSSL binaries. but that's not what i want, this should be a REAL standalone program. Yardanico: well, your options are: 1) use some "exe packer" (a tool which packs an executable with other files into a single .exe) or 2) compile and link openssl statically Yardanico: as for 2 I really don't know how you would go about that on windows, probably by using mingw and building static openssl yourself Yardanico: but really there's no problem in shipping .dll's with your .exe, it should work Yardanico: most apps do this - they have an .exe and a bunch of .dlls in the same directory faulander: it doesn't. i tried to have it in the exe dir, also in win/system32 Yardanico: what .dlls did you use? Yardanico: Did you try DLLs from https://nim-lang.org/download/dlls.zip ? faulander: even after a restart it didn't work, only the installation of the OpenSSL package worked finally Yardanico: and how did you install nim itself? faulander: no, i used the official ones. i might give it another try with the nim packaged ones. Yardanico: well you should really try nim own openssl .dlls since they're properly separated into 32 and 64- bit faulander: i used scoop to install nim Yardanico: well not sure if it installs the dlls too faulander: i think it did. the exe worked in the src directory where it was compiled faulander: then i moved it to .temp and there i got the errors Yardanico: well that's expected Yardanico: you need to distribute the dlls together with an .exe Yardanico: in an archive for example, or create an installator for your program Yardanico: and these DLLs are located where "nim.exe" is, but you can also get them from https://nim-lang.org/download/dlls.zip kaushalmodi: @faulander may be the table here helps distinguish among `let`, `const`, `var`: https://scripter.co/notes/nim/#variable-types faulander: i would have preferred a single exe without installation, but if that's the only possibility i'll choose that path. Yardanico: well I described the two of your options above about single exe Yardanico: @kaushalmodi s/evallable/evaluable :P kaushalmodi: Yardanico: Yes! I will fix that faulander: yes, thanks. i'll ship it with dll's kaushalmodi: I meant to write something like *eval'able* faulander: if i only need to copy them, its no problem. the target machines are VERY restrictive with installers, so thats not an option. Yardanico: yeah, you can just bundle your exe and the DLLs into an archive or something (I suppose you're allowed to unzip ZIP files? :) faulander: yes, i can do that with ansible ;) Yardanico: by default windows searches DLLs for your app in the current folder and in $PATH AFAIK faulander: yes, i know that. must have been the wrong versions of dll i used. faulander: true that. deleted all installations, put the dlls into the dir and it worked - at least on my machine. Skaruts: I'm having this problem where I'm storing closures for later use in a for loop, and using `i` as parameter for them, but then when I call them they all have the same value. Skaruts: Here's an example: https://play.nim-lang.org/#ix=2hlz Yardanico: you need capture Yardanico: i'll find it :P Skaruts: I can't for the life of me remember how to do that (someone told me once) Yardanico: it's in sugar module Yardanico: https://nim-lang.org/docs/sugar.html#capture.m%2Cvarargs%5Btyped%5D%2Cuntyped Skaruts: oh! Skaruts: thanks 🙂 Skaruts: hmm, is `capture` a recent addition to nim? On nim-playground it works, but not in my project. It's undeclared identifier 'capture', even though I imported sugar Yardanico: do you have 1.2? Yardanico: https://github.com/nim-lang/Nim/pull/12712 Skaruts: ah no, I'm still on 1.0.4... Yardanico: lol :P Skaruts: but I solved this issue before though, is there no other way? kaushalmodi: I'd upgrade Nim Yardanico: @Skaruts you can always just copy "capture" to your code, but better update Nim :) Skaruts: I'd like to be lazy about updating nim for another day or two... Skaruts: 🙂 Vindaar: `closureScope` was available before 1.2, no? Vindaar: maybe that's enough for you Vindaar: https://play.nim-lang.org/#ix=2hlG Skaruts: yea that was the way I was told once. (found it in the irc logs now, as it rang a bell in my head) Skaruts: thanks clyybber: or just copy capture Skaruts: or that... Skaruts: gonna go with closureScope for the moment, as copying capture still doesn't work (some othe stuff is new too) Yardanico: did you forget to import macros? Yardanico: maybe Skaruts: no I copied that too from there Skaruts: both the imports Skaruts: it's working though, I'll update Nim later and replace it, no big deal faulander: do you know of a good datetime lib for nim like pendulum for python? https://github.com/sdispater/pendulum Yardanico: "times" stdlib module Yardanico: Nim stdlib is quite usable ;) faulander: i have to work through the standardlib i see. that times module is quite useable :) Vindaar: the `times` module is awesome. @GULPF did amazing work (he's responsible for most of the changes in the last couple of years, afaik) Yardanico: yeah you're right Vindaar: so as someone who has to work with sql databases like for the first time every starting today... is there a good reason why e.g. the stdlib db modules don't use any types / provide type safe access to data? Having done so much work on data frames lately, it just makes me want to write a sql table -> DF proc and work on that instead (the database I have to work with is small) Vindaar: *the first time ever Yardanico: yeah, I too had to work with mysql (mariadb) a bit recently Yardanico: it looks too unsafe without proper ORMs Yardanico: There's Norm, ormin and a couple of other Nim ORMs, but none of them support MySQL :D Vindaar: Yeah, I currently have to deal with a mysql db too. ⏎ I saw those modules, but didn't even check which databases are supported. First gotta acclimate myself to this weird new world :D Yardanico: seems like https://github.com/nanoant/nim-orm has mysql support, but it's quite old (from 2015) Yardanico: and it's not a full-blown ORM Vindaar: not sure how much work adding mysql support to e.g. ormin would be. Can't imagine too much? Yardanico: oh, found https://github.com/encorehu/nim-orm fork of that nim-orm Vindaar: the db specific files in ormin are only 200-300 lines. So doesn't sound too bad. Well, I'll keep it simple for now. Might try to add support at some point alehander92: type safe access would be useful alehander92: especially with checking schema on compile time alehander92: somebody wanted that ^ i think alehander92: but some people dont like the idea Yardanico: ornim does that AFAIK Yardanico: and Norm too Yardanico: since in Norm you have to define a type for the table as an object (with some additional annotation fields available) alehander92: yeah but alehander92: you can generate the table from the orm alehander92: but the other option is to just check that the existing schema is compatible with the types alehander92: ormin i think was loading ? the types from the database schema alehander92: which i guess is maybe the same alehander92: otherwise i've used norm for one library, they both seem good Varriount: I'm wondering if I will ever understand javascript viewpoints: https://github.com/airbnb/javascript/issues/1271 Varriount: Especially this comment: https://github.com/airbnb/javascript/issues/1271#issuecomment-283424710 Yardanico: lol Yardanico: of course continue/break can be avoided, but then code can become much uglier Varriount: Yardanico: It especially puzzles me, because I've working with path parsing code for a recent project, and it's full of breaks and continues Varriount: Trying to write code that doesn't use them would make the code even harder to reason about. Or at least a lot longer Yardanico: also slower :P kungtotte: Cargo cult programming is bad: news at 11 :P Yardanico: "@binoculars you use some, every, find, findIndex, or you simply don't - break is goto, and that's not good for anyone. If you provide me an example of something you think you need break for, I'll be happy to show you a better alternative." Yardanico: "Performance is the least important thing when coding. If you're not iterating over millions of results, it's not going to matter at all." Yardanico: lmao kungtotte: Sounds like something a JS dev would say ;P Varriount: Also: "performance isn't important. It's easy to make clean code fast; it's hard to make fast code clean." zacharycarter: do threads work with --gc:arc currently? kungtotte: The second sentence is correct there though. Write the good code first, the fast code second. kungtotte: *After* profiling. Varriount: zacharycarter: I believe they work, however the existing restrictions still apply. Araq: well every time it comes up, 'break' and 'continue' destroy my analysis. So I'm definitely in the "yeah, it's goto, it sucks" camp Yardanico: zacharycarter: I don't think so :( Araq: threads do work with --gc:arc Yardanico: hmm I had some error with them, weird Araq: and with --threads:on the default is shared allocation, enjoy Yardanico: seems fine now Yardanico: Araq: yay zacharycarter: okay - I'm getting a sigsev when calling `createThread` so I'll investigate further since they're supposed to be working Varriount: Araq: But is reference counting atomic? Araq: anyhow. here is what you know for 'while B: body'. you know 'not B' holds. Araq: here is what you know when the body has a break: nothing. Araq: (actually you know more than that but it's tricky and gets ugly) Araq: Varriount: no, you have to 'move' stuff around completely Araq: bll Araq: bll Araq: bbl Yardanico: lol Varriount: Araq: I would like to note that `egrep '\b(break|continue)\b' --recursive nim/compiler/ | wc -l` results in `455`. 😜 Amun_Ra: is foo(x, y: int; z: cint) ever be preferred over foo(x, y: int, z: cint)? Yardanico: you mean , vs ; ? Varriount: Amun_Ra: It's completely up to you. Varriount: Personally, I can't be bothered, but would gladly allow a linter to add the `;` for me. clyybber: Araq: When the body has a break you know everything you know in the breaks scope Varriount: (Has anyone written a linter for Nim yet?) Yardanico: wait so about arc and threads - what exactly does "shared heap" mean? Yardanico: @Varriount "nimpretty"? Yardanico: ah sorry "nim check" Varriount: That checks more for syntactic and semantic patterns, not textual ones. Amun_Ra: Yardanico: yes Yardanico: ah actually --styleCheck:error Yardanico: or --styleCheck:hint zacharycarter: well - I get a SIGSEV on devel when calling createThread in a loop with gc:arc zacharycarter: I'll try to reproduce in a minimal example Yardanico: well I mean the shared heap question Yardanico: can I use and modify GCd variables from different threads at the same time in ARC? mratsim: not a good start for weave compat with gc:aarc Yardanico: with arc* leorize: Yardanico: yes zacharycarter: https://gist.github.com/zacharycarter/dbee66c50a6c26e7f187512235c4ed1f zacharycarter: Araq ^ Yardanico: leorize: so I tried to declare a global string and modify it inside a thread proc, but the compiler complains about gc safety, maybe I understood something wrongly? Yardanico: with --gc:arc Yardanico: no globals maybe leorize: it's an old requirement and hasn't been phased out leorize: `{.thread.}` literally means `{.gcsafe.}` Yardanico: oh lol leorize: note that you'd still need a lock to safely modify the string leorize: but it's possible now zacharycarter: is there a specific branch or something where threading works with --gc:arc. because I run into that error in the gist I posted on latest devel Yardanico: well I still wonder how :D Yardanico: https://gist.github.com/Yardanico/f61c67d9700733c907925f2591c9da1d this errors because of gc safety Yardanico: if I remove {.thread.} - createThread complains, maybe I can modify it, hmm leorize: use a `{.gcsafe.}` block to tell the compiler to shut up Yardanico: doesn't work :D Yardanico: "Error: 'threadFunc' is not GC-safe as it accesses 'mystr' which is a global using GC'ed memory" Chiqqum_Ngbata: Is there a way to disable all inferred .noSideEffect. Yardanico: @Chiqqum_Ngbata what for? it's automatically when the proc doesn't have any side effects Yardanico: automatically added* Chiqqum_Ngbata: I have a case where it's erroneously added Yardanico: well, can you post an example please? and maybe make a bug report Chiqqum_Ngbata: Maybe because I'm accessing a non-const? Chiqqum_Ngbata: I'll try to create minimal example in a bit leorize: Yardanico: this works: https://play.nim-lang.org/#ix=2hmv Yardanico: leorize: oh Yardanico: nice leorize: zacharycarter: can you file a bug report? zacharycarter: sure Yardanico: although it doesn't for me xd Yardanico: seems to run forever Yardanico: with no CPU usage Yardanico: and I get SIGSEGV with -d:danger Yardanico: with -d:release too leorize: same :P Yardanico: so I guess they don't work just yet or there was some code change in devel that broke them zacharycarter: I don't think `--gc:arc` is out of devel yet is it? Yardanico: it's in 1.2 zacharycarter: oh Yardanico: but not default ofc Yardanico: not *yet* :D zacharycarter: let me try on 1.2 Yardanico: can also try on playground Yardanico: ah, no, can't modify compiler opts, forgot zacharycarter: yeah, still present on 1.2 mratsim: I have a crash on my test for my very simple channel: https://github.com/mratsim/weave/blob/master/weave/channels/channels_spsc_single.nim mratsim: with gc:arc Yardanico: yeah it seems borked rn :/ Yardanico: @mratsim also, about weave - can I use it for making a lot of threads which will call into a .so library (it's proprietary), and the calls are blocking? the thing I want is ability to timeout threads , I tried to do it with normal nim threads but kinda failed someunknownuser: what is a method lock level? Yardanico: someunknownuser: ? someunknownuser: I am getting the following warning and was wondering what it is. Warning: method has lock level , but another method has 0 leorize: method lock level is how many locks that the method uses iirc leorize: it's underdeveloped and the warning is a hit and miss leorize: 99% of the time it's meaningless someunknownuser: ok, so I should not be worried about it? leorize: yep someunknownuser: ok, thank you mratsim: @Yardanico, you can but don't block your main thread mratsim: Weave doesn't support timeout though mratsim: it's for compute not IO Yardanico: well I would use async if I was able to, but this lib is blocking :P Varriount: Hm, one thing that will require threading at some point is the subprocess library I'm planning... mratsim: isn't async supposed to handle blocking? Yardanico: is it? alehander92: no mratsim: for long running process that can blcok just use createThread, like usual to handle the terminal? Varriount: mratsim: Well, I guess, however I'd like to make it framework agnostic. Yardanico: @mratsim well I thought about how to implement timeouts - one "watch" thread for every working threaD? mratsim: if you can describe your scenario in an issue in Weave I'll think if it makes sense to allow that Varriount: You get these situations where the parent process is trying to write or read from the child process, and the child process is trying to write or read from the parent process, and things deadlock due to buffers becoming full. alehander92: async can be made to auto-create threads, but this is probably better to be explicit mratsim: shouldn't you use the Erlang stuff, the restarter/manager trees? Varriount: Are you talking to me, or alehander92? mratsim: Supervision tree: https://erlang.org/doc/design_principles/des_princ.html alehander92: e.g. if we add "blocking" type/effect inference, one can change async to auto-spawn a thread when it "awaits" a blocking call mratsim: I think that should be a library mratsim: @Varriount the supervision trees are for you alehander92: but this might be too implicit alehander92: and unexpected for the user Varriount: mratsim: Wouldn't that dictate the kind of pattern that users could use the (theoretical) library with? I was imaging more something like execProcess or Python's Popen Kiloneie: Does anyone have the definition of what exactly Impure libraries in Nim mean ? Im getting a little lost trying to explain them along with Wrappers... mratsim: It seems to work for Erlang and they have been using that in critical system that cannot have any downtime for the past 30 years mratsim: (i.e. for telephone and communication backend) mratsim: "impure" means depending on C/C++/JS mratsim: pure is pure Nim Yardanico: @Kiloneie also see https://nim-lang.org/docs/lib.html#impure-libraries Yardanico: https://nim-lang.org/docs/lib.html Yardanico: "Pure libraries do not depend on any external *.dll or lib*.so binary while impure libraries do. A wrapper is an impure library that is a very low-level interface to a C library." Yardanico: so for example db_mysql is an impure library, and "mysql" module is a wrapper Araq: zacharycarter: try with an 'array' of Threads please Varriount: Hm, do iterators support forward declarations? Yardanico: Araq: what about https://play.nim-lang.org/#ix=2hmv Yardanico: is this supposed to ever work? :P Kiloneie: okay thanks, i will work with that Araq: Yardanico: it's supposed to work already zacharycarter: Araq: sure Yardanico: Araq: well maybe it's some regression but it doesn't on latest devel, in default debug mode it seems to hang forever, in -d:release or -d:danger it SIGSEGVs Yardanico: oh seems like it always SIGSEGVs when stacktraces are disabled zacharycarter: same error with an array Araq Araq: strange, I remember this code being part of the test suite :P Yardanico: GDB says it crashes at nim/lib/system/avltree.nim:74 Araq: maybe Zevv messed up the new alloc() interface :P Araq: Yardanico: please check if the calls pass through allocShared() and friends Yardanico: they pass through deallocShared Yardanico: I mean the backtrace Yardanico: https://gist.github.com/Yardanico/a381a09b943b2618de534e49a99ed0a8 Yardanico: if I replace that string addition with echo "ok" it prints "ok" 3 times and then SIGSEGVs Yardanico: ah, 4 times Yardanico: so it runs the threads but crashes after that Yardanico: or not, seems like it crashes after 4 "ok"s even if I do array of size 150 Yardanico: ah it behaves differently each time Varriount: Hm, who worked on adding Nim to the compiler explorer? I'm wondering how hard it would be to implement the "reveal linked code" functionality. Varriount: (https://godbolt.org/) alehander92: some people Yardanico: initial https://github.com/mattgodbolt/compiler-explorer/pull/1753 alehander92: https://github.com/mattgodbolt/compiler-explorer/pull/1753 alehander92: what do you call alehander92: reveal linked code Yardanico: @alehander92 probably the feature when you can see how source code is mapped to assembly Varriount: Yes alehander92: ah i think it worked Varriount: If you right click on a line in the editor, there's an option to reveal linked code. alehander92: at one point Varriount: Ah! Got it. Yardanico: it works with "--debugger:native" Varriount: Adding `--debugger:native` Yardanico: lol alehander92: yes you need to add it to options Yardanico: now we need to add nlvm to godbolt :P Yardanico: to check LLVM IR alehander92: wow this is a good point alehander92: we might need to add it to codetracer just as a cool target alehander92: probably godbolt can just follow the rust/zig modes alehander92: for nlvm Chiqqum_Ngbata: Unfortunately I can't distill my erroneous .noSideEffects. problem, but I'd still like to know if there is a way to disable, either with runtime flag, pragma, whatever Yardanico: add some effect or tag to your proc? Chiqqum_Ngbata: Possibly the reason it's adding .noSideEffects. is because the side effect is predicated upon a C binding Yardanico: like proc myproc: string {.tags: [IO].} = discard Yardanico: https://nim-lang.org/docs/manual.html#effect-system-tag-tracking Chiqqum_Ngbata: Still getting a type mismatch on a proc type annotated with .nimcall. Chiqqum_Ngbata: Maybe I can touch something (else) global, let's see leorize: what's your problem? Chiqqum_Ngbata: (That did work) Chiqqum_Ngbata: leorize: A proc is being inferred as .noSideEffect. erroneously, possibly because of the side effect's dependence on C binding (just guessing; a global var is created via call into another library and accessed in proc) leorize: use `{.sideEffect.}` to counter that :P Chiqqum_Ngbata: That had me excited for a hot second but it's not working for me, going to try some things Varriount: Yardanico: This is interesting. The source -> assembly mapping gets confused if Nim functions are too close together. The return logic in assembly gets mapped to the line of the following procedure. leorize: @Chiqqum_Ngbata: if you got a reproducible example I might be able to help zacharycarter: mratsim: are there any benchmarks / examples of a job queue in weave? Varriount: mratsim: You have a benchmarking library, don't you? Zevv: Araq: possible, but not likely after 3 months, is it Zevv: go dawkot: Is Karax broken for anyone else? https://github.com/pragmagic/karax/issues/138 iffy: I'm calling a C function which expects a `uint8 *buffer`I've done `let s = newString(expected_len)`, so which of the following do I pass in? ⏎ ⏎ 1) `s[0].unsafeAddr` ⏎ 2) `s.cstring.unsafeAddr` ⏎ 3) `s.unsafeAddr` ... [https://gitter.im/nim-lang/Nim?at=5e8f93131aaf8e4b8e71a499] dawkot: `s[0].unsafeAddr` should work leorize: you pass in s.cstring dawkot: Oh, because of GC? leorize: nah, it's shorter :P iffy: They both work! I had been doing something else wrong -- thank you! sealmove: guys, I get "stdlib_io.nim.c:(.text+0x725): undefined reference to `__builtin_saddll_overflow'" sealmove: anyone has any idea what this is? leorize: do you have a recent gcc? sealmove: oh sealmove: hmm leorize: it's used to speed up overflow checks, requires gcc > 5 iirc sealmove: no idea, I get this error on travis, not my local pc leorize: if you don't have a new gcc, use `-d:nimEmulateOverflowChecks` Araq: config travis to use software released after 1990 sealmove: this is my config: https://pastebin.com/brb8jUgr sealmove: `compiler: gcc` is wrong? leorize: the wrong part here is that you use travis leorize: check if they finally have a newer ubuntu version Araq: the wrong part here is also that GCC versions are tied to a Linux distribution... Varriount: Araq: Or that you can't install multiple versions. leorize: you can on travis actually Araq: I think you can but then you need to call gcc-$version leorize: Araq: I think we can just use a conditional to test gcc version leorize: gcc 5 introduced these functions leorize: clang has these since 3.5 Araq: yeah but some builds of gcc 5 lack them Araq: because some distros like patching gcc leorize: then they can use the flag Araq: fair enough Araq: aligns well with my plans to remove nimbase.h from Nim leorize: so do you want me to make addNimDefines generates some ifdefs, or do you want me to put it in nimbase.h? Araq: I want you to patch the codegen to not generate #include "nimbase.h" Araq: instead the codegen should emit the declarations it needs Araq: fixes that niminst regression issue dom96: You're getting rid of nimbase.h? __ibrahim__: fortunately, it didn't take much fiddling to get opengl to work. 35 loc with glfw3 and glad and that's it! i ❤️ Nim leorize: it's about time we do so Araq: dom96: yeah dom96: hm, won't that create lots of needless duplication? :) dawkot: Any idea what to look for when VSCode stopped highlighting warnings and errors in Nim code? dawkot: nimsuggest seems to work fine on commandline dawkot: and auto-completion is there in the editor leorize: when it stopped doing that, you kill all nimsuggest instance and hope that it restarts :) leorize: you will be amazed of how many problems that restarting nimsuggest solves dawkot: Unfortunely, I even tried reboot and it didn't work dom96: Best thing to look for is another VS Code extension, better yet, create a better one :) dawkot: I don't even know if it's the extension, I tried previous versions and it didn't work either dawkot: And I literally didn't do anything in the meantime other than use the editor Araq: dom96: yeah but I don't have a better idea dawkot: Looks like importing asyncjs hides warning/errors, despite `nimble build` working... dawkot: So, yeah, it's the extension's fault dawkot: How do you make nimsuggest assume js is the backend? dawkot: I would like to fix this dawkot: I guess it's `-d:js` leorize: that works, but not the best leorize: there are VM changes in JS mode too, and -d:js won't emulate that leorize: but it will give you suggestions, so it's good enough :P KingDarBoja: Awr1, are you there? awr1: hello awr1: i am now awr1: was busy all day KingDarBoja: ❤️ KingDarBoja: https://github.com/nim-lang/Nim/issues/13922 KingDarBoja: we got an answer __ibrahim__: tried running the stuff from this repo: https://github.com/rafaelvasco/nimrod-glfw __ibrahim__: it works fine on mac. __ibrahim__: windows gives this error: could not load: glfw3.dll __ibrahim__: now trying on centos8 shashlick: @zacharycarter was trying junkers on osx and it crashes even with 0.4.4 zacharycarter: shashlick: with what flags? shashlick: Toast flags? Nothing really zacharycarter: how are you running it and are you getting any type of error on crash? shashlick: Sigabrt zacharycarter: weird - it's working fine for me with the verison that gets installed with `nimble install nimterop` alehander92: Araq: many issues can be hard to fix because we need to find the root cause, what if we just find potential bugs by looking for invalid invariants and ways to trigger them and prevent those => after this checking how many issues does this fix zacharycarter: if I use the head vesion I need to do the headers flag but then it works fine awr1: should i close the issue then KingDarBoja: No KingDarBoja: I am not okay at all with it KingDarBoja: Just tried it and couldn't instantiate it lol shashlick: I reverted to 0.4.4 cause it was failing even with -H awr1: okie zacharycarter: weird... zacharycarter: let me try checking it out and submodules and running ti KingDarBoja: Unless I am doing something wrong KingDarBoja: If I wanted to export the proc, I should put the * after the name zacharycarter: git clone https://github.com/zacharycarter/junkers.git junkers_test KingDarBoja: But now that it is instantiated, putting it in front of the name before or after the [] brackets yields error zacharycarter: cd junkers_test && git submodule update --init -recursive zacharycarter: nim c -r src/junkers.nim zacharycarter: everything runs fine :/ shashlick: https://ix.io/2hoB zacharycarter: I'm using nim 1.2 shashlick: Ok was on 1.0.6 zacharycarter: also - I wonder what all those errors are from the linker zacharycarter: ld: warning: text-based stub file /System/Library/Frameworks//Metal.framework/Metal.tbd and library file /System/Library/Frameworks//Metal.framework/Metal are out of sync. Falling back to library file for linking. shashlick: I'm on 10.13 zacharycarter: I have a feeling it's failing because of that maybe KingDarBoja: https://imgur.com/uGEczkH awr1 shashlick: Can't go any further since this machine is 8 years old zacharycarter: https://stackoverflow.com/questions/51314888/ld-warning-text-based-stub-file-are-out-of-sync-falling-back-to-library-file zacharycarter: I'm on 10.14.6 shashlick: I don't have xcode either zacharycarter: me either shashlick: Same with 1.2.0 zacharycarter: oh - you will probably need xcode command line tools awr1: your issue might be something else @KingDarBoja awr1: https://play.nim-lang.org/#ix=2hoI shashlick: Ok I fixed those errors but still see the crash shashlick: https://ix.io/2hoJ awr1: try `[T :Node; N :seq[T] or T]` shashlick: @zacharycarter a windows shows up for 1/2 a second shashlick: Then aborts awr1: https://play.nim-lang.org/#ix=2hoM @KingDarBoja KingDarBoja: On it zacharycarter: looks like it's the call to - `sapp_metal_get_device()` KingDarBoja: Definitively there is something wrong zacharycarter: seems like the `MTLCreateSystemDefaultDevice()` call is faliing KingDarBoja: Still same error 🤔 awr1: it works with a default parameter awr1: https://play.nim-lang.org/#ix=2hoN awr1: shave off the extra params and see if you can isolate the issue KingDarBoja: I was doing the same on the playground lol KingDarBoja: On it awr1: looking at the rest of your code, have you changed the body accordingly awr1: e.g. `nodesCopy` KingDarBoja: Shaving off the default parameter make it work KingDarBoja: made it* KingDarBoja: But I didn't changed the body 🤔 KingDarBoja: Changing the body, e.g. `nodesCopy` to be `seq[T]` doesn't seem to work shashlick: @zacharycarter any ideas? Is it the same as what you originally reported zacharycarter: no this is different zacharycarter: I have a feeling it is something with your mac - for some reason the metal device isn't getting created KingDarBoja: Definitively removing the default parameter solves this but that isn't what it should be zacharycarter: sweet - SSE intrinsics are working zacharycarter: time to work on shader hot reloading awr1: yes awr1: my original idea for it, because using `_m128`s invoke their own problems, was to have a "fast" vector type and a "strict" vector type awr1: `_m128`s aren't tightly packed, for instance ryukoposting: text entry box with support for japanese and chinese input almost finished :) ryukoposting: https://cdn.discordapp.com/attachments/673968364598853662/697242864383426600/2020-04-07_19-29-43.mp4 ejstembler: Does Nim have something equivalent to Ruby's ERB (https://ruby-doc.org/stdlib-2.7.1/libdoc/erb/rdoc/ERB.html), or Crystal's ECR (https://crystal-lang.org/api/0.21.1/ECR.html) ? Basically the ability to render templates with embedded nim code. leorize: source code filter seems to be the closet thing that I could think of leorize: https://nim-lang.org/docs/filters.html ejstembler: Thanks @leorize ! Looks like that may work for my use-case. I'll give it a try... Benumbed: Wow that was a quick turnaround on the httpclient bug I filed, thanks Araq and narimiran! awr1: @ryukoposting looks cool! are you using the SDL text input API or are you getting stuff directly from the windows IME ryukoposting: awr1: I'm using SDL2's text input system. It's not great (no autofill suggestions) but it's portable Rika: is SDL really easy to use? Benumbed: Relatively yeah Benumbed: Esp if you're comfortable with C Benumbed: I use it in the game engines I've written for the input, window and OS events because it's petty simple and stays out of my way Benumbed: and means I don't have to write abstraction layers for that stuff zacharycarter: I'm using sokol in my current game project and like it so far ryukoposting: The nim port of it is pretty much a 1:1 clone of the normal library, so the official wiki is a good resource even though you aren't using C ryukoposting: I plan on stripping my engine's abstraction layer out, and making it into its own library so you can get easy access to some higher-level facilities ryukoposting: I'll definitely make my audio thing into a separate library. It's like SDL_Mixer except it can handle multiple audio streams simultaneously. only supports WAV at the moment, though. shashlick: @zacharycarter - if you have time, would you be able to test how the new ast2 algorithm works on sokol? zacharycarter: shashlick: sure - what do I need to do? shashlick: are you using toast on the command line or cImport in a nim file? zacharycarter: cImport zacharycarter: and cCompile shashlick: okay, just pushed latest stuff to #head so if you can pull that first zacharycarter: sure shashlick: and then update cImport with a `flags = "-f:ast2"` param shashlick: i've not tagged any of the new stuff until it is good to replace the legacy algo shashlick: but even #head should work the same as 0.4.4 from a legacy perspective shashlick: idea is to tag 0.5.0 with legacy deprecated but still the default, followed by bug fixes on ast2, finally making ast2 the default in 0.6.0 and removing legacy in 0.7.0 shashlick: let's see how it goes zacharycarter: if I just nimble install from the cloned repo's master branch, will that be okay? zacharycarter: how do I install #head? zacharycarter: oh I guess head is origin - okay let me add that flag shashlick: ya just nimble install [email protected]#head zacharycarter: hmm ran into some errors zacharycarter: I threw it on both of the libs I'm using nimterop with - let me just add it to sokol and see what happens shashlick: i guess first might just want to try #head as is without -f:ast2 and see if it just works shashlick: then try -f:ast2 one at a time shashlick: ast2 has a bunch of stuff fixed so it should be better - https://github.com/nimterop/nimterop/issues?q=is%3Aissue+is%3Aopen+label%3Afixed shashlick: but it is new so bugs for sure zacharycarter: I'm compiling my program with `nim c --gc:arc` and switching to #head causes a SIGABRT zacharycarter: without the ast2 flag shashlick: hmm, i've not tested with gc:arc at all, not even 0.4.4 shashlick: are you compiling toast also with gc:arc? zacharycarter: seems to be working fine with nim devel zacharycarter: I'm just installing it with `nimble install nimterop` zacharycarter: so I guess not shashlick: at the very least, #head should work as is like 0.4.4 so if that's not working, please let me know zacharycarter: doesn't seem to be with gc arc :/ I can try with the default gc if you'd like KingDarBoja: Trying to pass to some procedure a inherited type but getting a error message like -> "first type mismatch at position: 2 KingDarBoja: required type for nodes: Option[seq[ParentType]] or Option[ParentType] KingDarBoja: but expression 'some(@[someChildValue])' is of type: Option[seq[ChildType]]" zacharycarter: irc or tmux or something just froze... anyway, shashlick: I get that same SIGABRT error with `nimble install [email protected]#head` whether I use `--gc:arc` or not on nim devel shashlick: hmm - can you share something that I could test and reproduce? zacharycarter: I only have things working on osx atm :/ zacharycarter: I'm about to watch a movie and go to sleep but I can try to help debug more tomorrow shashlick: sure, don't want to send you down a rathole shashlick: but anything you can send my way to debug, will appreciate KingDarBoja: Found this at the manual: Object fields that should be visible from outside the defining module, have to be marked by *. In contrast to tuples, different object types are never equivalent. KingDarBoja: But inherited object types are somewhat equivalent to its parent type. Varriount: Yes, but not equivalent KingDarBoja: So if I try to pass a object, let's call it ChildA to some procedure whose argument uses ParentOfChildA, it will throw an error, right? KingDarBoja: https://nim-lang.org/docs/manual_experimental.html#covariance Maybe this is what I am asking for? leorize: no, it won't error out leorize: you can just try :P KingDarBoja: Well I am getting one unless I cast the child type to the parent type leorize: can you post an example? KingDarBoja: Not sure, I do have pushed my code on the repo KingDarBoja: But let me explain KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/error/graphql_error.nim#L73 This proc should accept any child type (nodes) that inherits from "Node" type KingDarBoja: On the test, I am trying to pass the proper sequence whose object type is a child of "Node" https://github.com/KingDarBoja/Phosphate/blob/master/tests/error/test_graphql_error.nim#L51 KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L140 The inherited type (the child type) is called "SelectionNode", but for some reason, the terminal isn't accepting it unless I cast the value to "Node" KingDarBoja: But if I don't cast, I get: "first type mismatch at position: 2 KingDarBoja: required type for nodes: Option[seq[Node]] or Option[ast.Node] KingDarBoja: but expression 'some(@[fieldNode])' is of type: Option[seq[SelectionNode]]" KingDarBoja: Not sure why I am needing the cast on my code... awr1: maybe try `let nodes :Option[seq[Node]] = @[fieldNode]` awr1: the compiler needs more information to know that the sequence isn't just constrained to the root obj awr1: i mean `let nodes :Option[seq[Node]] = some @[fieldNode]` awr1: *constrained to the inherited obj KingDarBoja: On the test you mean? awr1: yes KingDarBoja: Instead of directly passing the `some(@[fieldNode])` ? awr1: yes awr1: if that doesn't work, you may need to do `let node :Node = fieldNode`and then do `some(@[node])` KingDarBoja: Nope -> type mismatch: got but expected 'Option[seq[Node]]' KingDarBoja: Let me try KingDarBoja: Well it works, either setting as you said or just setting the type to FieldNode to be Node KingDarBoja: "let fieldNode: Node = operationDefNode.selectionSet.selections[0]" awr1: try making it a `method` KingDarBoja: But I expected the compiler to treat fieldNode (which is SelectionNode type) as Node awr1: https://github.com/KingDarBoja/Phosphate/blob/095101d74e236e91a9350034cf1f04b464431ab1/src/error/graphql_error.nim#L71 awr1: `method newGraphQLError(..` KingDarBoja: Doesn't work if doing that, getting same error as before awr1: use the method with the original call awr1: `let e = newGraphQLError("msg", some(@[fieldNode]))` KingDarBoja: Nop KingDarBoja: https://imgur.com/HRMMA10 awr1: i think maybe this deserves an issue awr1: a compiler issue awr1: i did a minimal example, the issue is with the optionals KingDarBoja: Arrrh KingDarBoja: Again the optionals awr1: https://play.nim-lang.org/#ix=2h7q KingDarBoja: There is another bug (I think) I found with Options module KingDarBoja: But related to Table on that same error file KingDarBoja: https://github.com/KingDarBoja/Phosphate/blob/master/src/error/graphql_error.nim#L78 If you try to use Option to specify the type with Table[string, string], you will get an error too awr1: but this is not really `Option[T]` specific on a technical level, it is more with how generics wrap inheritable types and what is supposed to happen in regards to type resolution KingDarBoja: I see KingDarBoja: The other issue (not sure if bug) -> Use something like this: "someArgument: Option[Table[string, string]] = some(Table[string, string])"" KingDarBoja: You get the following error: _"first type mismatch at position: 1 required type for val: T but expression 'Table[string, string]' is of type: type Table[system.string, system.string]"_ KingDarBoja: Like... both **are** the same type lol KingDarBoja: Looking at your repr awe1 awr1: https://github.com/nim-lang/Nim/issues/2686 disbot: ➥ Dynamic dispatch doesn't work properly when types are generic KingDarBoja: Ugh? KingDarBoja: By the way, you are right with the bug awr1: technically what is described here is different awr1: this is referring to when the ref type itself is the generic i think awr1: i'm gonna make an issue anyway KingDarBoja: Thank you awr1 KingDarBoja: I will follow the issue, just be sure to share it here 😄 KingDarBoja: In the meantime, I will specify the type so my test work awr1: https://github.com/nim-lang/Nim/issues/13922 disbot: ➥ Generic call doesn't resolve when working with inherited ref types ; snippet at 12https://play.nim-lang.org/#ix=2h7t KingDarBoja: That was fast awr1: if this is intended behavior, then your workaround is awr1: `let node :Node = fieldNode; let e = newGraphQLError("msg", some(@[node))` KingDarBoja: Yup KingDarBoja: Looking forward on the issue (I just subscribed) KingDarBoja: Now I must go to sleep, midnight here KingDarBoja: 😄 KingDarBoja: Cya awr1: cya treeform: VTune works with nim through --debugger:native flag. This is amazing. Thank you to who made this work. number_one: Hey folks, with the setControlCHook, I assume that it's pretty much an `onSignal(SIGINT)` under the hood. Sorry if it's a dumb question, but if you set a handler for it, can you ever return to the execution point where the SIGINT was raised? number_one: I'm also assuming that you can only really use it for clean exiting etc mayse: hey everyone. i'm trying out the code here : https://nim-lang.org/docs/hcr.html - i've got the sdl bits working, but compiling this ends with `dlopen(libnimhcr.dylib, 2): image not found` mayse: I've searched on google and the only source that talks about this is here, back in 21/03/2020 which someone mentioned doing some PATH thing. I haven't been able to progress from there. mayse: Here's how I compile it: `nim c -d:nimDebugDlOpen --hotCodeReloading:on --verbosity:2` number_one: Whoal, hotCodeReloading works for C now? mayse: do you mean that hotCodeReloading is only for javascript output, @number_one ? leorize: number_one: I think if you don't exit, the execution point will be returned leorize: @mayse: you gotta build nimrtl and nimhcr leorize: the files required are in nim's base directory leorize: how did you install nim? mayse: thanks leorize. I'll try that! any idea how to do that with choosenim ? Araq: number_one: signal handling is just broken, don't use it mayse: I installed nim with choosenim devel leorize: ok, then it should be in ~/.choosenim/nim-current/lib leorize: if my understanding of choosenim's layout is correct leorize: you'll see the two files: nimrtl.nim and nimhcr.nim number_one: @Araq, Just broken flat out? Any workarounds in circulation? Or should I handle this in C? mayse: i see them leorize, they're at `~/.choosenim/toolchains/nim-#devel/lib` leorize: run nim c --outdir:$PWD /path/to/nimrtl.nim leorize: and nim c --outdir:$PWD /path/to/nimhcr.nim leorize: you'll get libnimrtl.dynlib and libnimhcr.dynlib in your current directory Araq: number_one: no it's broken in C... see http://man7.org/linux/man-pages/man7/signal-safety.7.html leorize: number_one: it means: it works, just that the idea is fundamentally broken mayse: it's working! thank you so much `leorize` ! . to leave a message for posterity if anyone searched into here, the two commands leorize mentioned should be ran in the source dir where you have your .nim, not in the ...lib/ dir. number_one: :/ number_one: Wow number_one: Daaaang Araq: leorize: :-) mayse: a question aside from that, the code that is in that file won't work because nimble package sdl2 changed how it works (a lot). how would I contribute back the version that works to the documentation? (I'm very new to this, please be patient with me) Yardanico: is it expected that this doesn't work? Yardanico: !eval var a = ""; a &= if true: "hello" else: "no" NimBot: Compile failed: /usercode/in.nim(1, 18) Error: expression expected, but found 'keyword if' Yardanico: I thought it'd work narimiran: !eval var a = ""; a &= (if true: "hello" else: "no") NimBot: narimiran: Yardanico: ^ Yardanico: well but then Yardanico: var a = ""; a = if true: "hello" else: "no" Yardanico: !eval var a = ""; a = if true: "hello" else: "no" NimBot: Yardanico: i got a bit confused :P Rika: i think = isnt a proc, whilst &= is? Rika: no clue but yeah if it's an "augmented" equals, then you need parens., even w/ blocks Yardanico: somehow I didn't notice that until now :P Rika: and you've been here for real long... Yardanico: xdd Araq: mayse: I don't understand the question mayse: @Araq I found it I think. so to change that document, would I need to send a request to change this file on github ? `https://github.com/nim-lang/Nim/blob/devel/doc/hcr.rst` Araq: yes mayse: thanks, will do that mayse: it's just that sdl2 changed since (I can see now jun 2019) and the example code does not work anymore. so I'll send in a version that works. (cf: `https://github.com/nim-lang/sdl2/blob/master/src/sdl2.nim`) eliezedeck: Hey guys PMunch: Morning :) Vindaar: Good morning :) eliezedeck: 🙂 eliezedeck: @Araq: https://github.com/nim-lang/Nim/issues/13923 ... I could not find any more ways to solve the high memory usage disbot: ➥ Outrageous memory usage due to numerous inefficiencies in the STD lib (async) ; snippet at 12https://play.nim-lang.org/#ix=2h84 eliezedeck: I hope this problem is cause by OpenSSL ... but I highly doubt that eliezedeck: I hope this problem is caused by OpenSSL ... but I highly doubt that Yardanico: it's easy to test - just compile without -d:ssl and test with an HTTP website eliezedeck: good idea ... let me ... eliezedeck: @Yardanico 830 MB -> 530 MB ... so, in some part, it is ... but not fully OpenSSL only dom96: Araq, narimiran: we're still doing 1.0.8 right? Can we include #13919? disbot: https://github.com/nim-lang/Nim/pull/13919 -- 3Fixes issues with dynamic loading OpenSSL. Fixes #13903. narimiran: ok narimiran: (when merging, add [backport] tag) dom96: should I modify the commit msg to include that? narimiran: just add it when you (squash) merge dom96: I might just amend dom96: Can someone review my PR? :) Araq: eliezedeck: COW strings means "copy on write" Araq: but it's cheaper to fix the stdlib than fixing Nim's builtin string type Araq: with --gc:arc the builtin string type became very hackable but --gc:arc isn't yet ready for async code :-/ alehander92: eliezedeck just a very friendly note: please try to use objective language in your issues: you can say something is "very high", "outrageous" is subjective (its useful to do in general, would you read a science paper called "outrageous values of protein in mice when a" :D Araq: fwiw I LOL'ed when I read the title alehander92: otherwise i've heard before that we can use more streams for stuff alehander92: yeah, it's very human, i like it, but i can just imagine "scandalous segfault when using expr as a type parameter, people riot on the streets" mratsim: Btw, now that we have dup, can we refactor all the strutils proc? mratsim: I'm always saying this but it's the biggest performance trap of Nim in my opinion, and I don't use strings that much narimiran: @mratsim it is on my personal (long-term) todo :) federico3: dom96: what test? Araq: mratsim: fine with me but we should also take the opportunity to introduce strbasics that is a strutils with the few procs that I acually need Araq: the existing strutils can be kept and do 'import strbasics; export strbasics' dom96: federico3, ci-ssl dom96: Araq, what's the point? we have dead code elimination for a reason Araq: dom96, we still lack IC though dom96: so you'll save 1 or 2 seconds at most, not worth the extra maintenance and knowledge about another module Araq: fair enough Araq: (it's much less than 1s btw) supakeen: Speaking off, would it be silly to PR `getBit` as a partner get `getBit` in bitops? :) supakeen: Wow that sentence didn't make sense. As a partner to `setBit`. Araq: I like it supakeen: Neat :) supakeen: I'll make it so then. eliezedeck: @Araq, @alehander92 ... alright, I'll update the title to "very high" 😛 Araq: eliezedeck: I can guide you to the problem eliezedeck: and happy to bring about some lols eliezedeck: yes please Araq: right here, right now eliezedeck: alright, let's go ... Araq: compiler / lambdalifting.nim line 203 Araq: we used the quick string assignment called 'nkFastAsgn' but had to use the slower assignment because of reported bugs exelotl: fug exelotl: https://cdn.discordapp.com/attachments/371759389889003532/697385906042306671/image0.jpg Yardanico: @exelotl how much RAM? exelotl: 512mb exelotl: maybe if I close the web browser... Yardanico: yes, and do a swap :P Araq: eliezedeck: you can try to use 'nkFastAsgn' and see if it makes a difference eliezedeck: alright Araq: and if it does, we can figure out how to do this properly Araq: via some analysis inside the compiler Araq: and maybe you need to check for ri.kind notin {nkStrLit..nkTripleStrLit} Araq: as the comment indicates eliezedeck: ok, thanks for the pointers eliezedeck: so, I suppose I have to build_all.sh, right? Yardanico: no Yardanico: you can do ./koch temp c path_to_your_nim_file Yardanico: in the dir with nim compiler eliezedeck: alright, that's useful eliezedeck: thanks Yardanico: that'll compile nim compiler in debug mode and that compiler will compile your file eliezedeck: interesting and much appreciated Araq: https://nim-lang.org/docs/intern.html#debugging-the-compiler eliezedeck: unfortunately, it doesn't compile: eliezedeck: ``` eliezedeck: /Nim/lib/system/gc.nim(239) asgnRef eliezedeck: /Nim/lib/system/gc.nim(184) incRef eliezedeck: SIGBUS: Illegal storage access. (Attempt to read from nil?) eliezedeck: ``` mratsim: mmm mratsim: does gc:markandsweep help? mratsim: if yes can you compile with "-d:useSysAssert -d:useGcAssert" as well Recruit_main707: currently, there is no tool to transpile c/c++ to nim right? Yardanico: if you mean something which works for everything - no :P Recruit_main707: and, something that kind of works? Araq: c2nim mratsim: c2nim Araq: it parses C89 and C++98, kind of :-) Recruit_main707: i hope it likes flatbuffers generated code because if not im gonna go crazy eliezedeck: yes, gc:markandsweep got rid of the crash ... but the memory usage hasn't changed Yardanico: what about trying without async and with --gc:arc :P Araq: Yardanico, it's all about async Araq: eliezedeck: if memory usage didn't change we need a better analysis of the problem than just "closure parameters are copied" eliezedeck: @Yardanico use multiple system threads? I don't think that would be a good idea for my case, it will receive multiple requests from clients eliezedeck: right, so what's the next step? Araq: do you use --gc:arc? eliezedeck: no mratsim: I thought it didn't work with async yet? Yardanico: it works but leaks memory AFAIK :P eliezedeck: and that's the reason I didn't Araq: ok, good, just wanted to be sure Recruit_main707: how severe is the leak? eliezedeck: @Araq ... just for compleness, --gc:arc increased memory usage back to 700MB eliezedeck: and as I leave it running, it went-up to 1GB Araq: well it leaks, it will go as high as you want to go eliezedeck: 🙂 right Araq: open lib/system/sysstr.nim Araq: if (src.reserved and seqShallowFlag) != 0 Araq: is the test you want to be true but isn't Araq: try something like: Araq: if (src.reserved and seqShallowFlag) != 0 or src.len > 6_000: # never copy long strings Araq: as a hack and see if that improves the situation for your test program eliezedeck: there are 2 of them ... I should I go to copyString or copyStringRC1? Araq: to both eliezedeck: ok Araq: bbl lunch here eliezedeck: @Araq Mazoto homana (a malagasy way to wish you courage in eating 🙂 ) eliezedeck: lunch also here, bbl too eliezedeck: I have switched to the sample bug report file that I have reported, which uses 830MB RAM without any change ... when doing `if (src.reserved and seqShallowFlag) != 0 or src.len > 6_000:`, the memory usage dropped to 330 MB eliezedeck: when just using `nkFastAsgn` and `--gc:markandsweep`, it dropped to 435MB clyybber: @eliezedeck I think I have a different solution that doesn't require relying on compiler optimizations eliezedeck: when (`nkFastAsgn` and `--gc:markandsweep`) and `if (src.reserved and seqShallowFlag) != 0 or src.len > 6_000` is used, it remains at 330MB eliezedeck: I'm all ears clyybber: Can you try using ```type rcstring = object clyybber: damn clyybber: hit enter too fast eliezedeck: 🙂 clyybber: ```type rcstring = object clyybber: s: string clyybber: ``` clyybber: ```type rcstring = ref object clyybber: s: string clyybber: ``` clyybber: Can you try using this instead of string? clyybber: string has value semantics by default in nim, so with this wrapping ref object you would get a refcounted string clyybber: `type rcstring = ref string` maybe works too, but I'm not too sure the backend can already handle it 😄 eliezedeck: so, i should do a cast? clyybber: Nope, do rcstring(s: yourstring) clyybber: That should yield you a refcounted string eliezedeck: and how do I pass it to the stdlib for use? buff.s ? but then, wouldn't that be the same thing? clyybber: Yeah, it will not eliminate all copies eliezedeck: https://play.nim-lang.org/#ix=2h80 clyybber: Oh, thanks. I didn't see your example yet eliezedeck: I can eliminate copies right before the calls, but once it gets passed into the stdlib, I have no control of what it's doing anymore clyybber: Yeah clyybber: Are you certain the stdlib is the problem here though? clyybber: And not async? eliezedeck: no, I'm not sure Yardanico: well *technically* async is a part of stdlib :D eliezedeck: Araq said it's the async, but what do I know eliezedeck: yes clyybber: Hmm, I'm gonna take a look at where those copies happen. One moment eliezedeck: you can run the example yourself, I'm not experienced Nim developer, may be you could help eliezedeck: that would be very helpful eliezedeck: as I tried yesterday to find-out where the memory goes to, but I couldn't ... already tried -d:useMalloc, but no ... valgrind won't report anything meaning full or anything close... tried Xcode's Instruments this morning, not much thing either clyybber: Yeah, valgrind is best for leaks, so not sure how it would help here eliezedeck: valgrind --tool=massif clyybber: Ah eliezedeck: it is very unfortunate that valgrind didn't work Yardanico: well, maybe because ther weren't any leaks? :P eliezedeck: it could have been a valuable tool for this eliezedeck: @Yardanico if we consider that, then how can we explain 830MB resident memory being consumed? you could try the example yourself and you'll see ... and the thing is: I don't believe it's a leak, it's just that there are too many unnecessary copies of the original 100MB, passing from one proc to another, and so on Yardanico: well, valgrind doesn't detect "copies" and stuff like that Yardanico: I'm not saying it's okay eliezedeck: and yes, Xcode said it didn't have any leaks too eliezedeck: yes, but valgrind --tool=massif is supposed to help in pin-pointing where are all the memories that were allocated coming from eliezedeck: https://www.valgrind.org/docs/manual/ms-manual.html clyybber: @eliezedeck if you remove the async annotation and use the non async httpclient what does the mem usage jump to? clyybber: Araq: Do the "old" strings use refcounting? eliezedeck: without async, the memory usage for that bug report is 101.2MB clyybber: Ha, ok. So it really is async eliezedeck: 830MB with async clyybber: Ok, thank you eliezedeck: if the string is immutable (shallow), it should not be copied, like, **at all** ... is that a wrong supposition? clyybber: Curious, whats the memory usage with gc:arc and without async? eliezedeck: 101.1 MB clyybber: And with async? clyybber: 830 I assume eliezedeck: yes clyybber: Not more? eliezedeck: a little bit more, may be eliezedeck: hovers around that number clyybber: Ok eliezedeck: and I really didn't expect it to be so different eliezedeck: bbl clyybber: Ok, I'll investigate a bit in the meantime Araq: clyybber: no implementation yet uses COW but I planned to play with it with ARC Araq: because the new implementation is easier to tinker with clyybber: Yeah definitely clyybber: @eliezedeck Put a bunch of `echo getOccupiedMem()` s in there. clyybber: The mem usage is spiking in the last 2 lines of `infeficientCopiesAllOver` clyybber: @eliezedeck Can you try maybe patching asynchttpclient to take rcstrings instead of strings for the body? clyybber: Just for testing for now. clyybber: Just to test for now. clyybber: @mratsim Hey, I was wondering if you have any fft implementation in laser? mratsim: nop, but AFAIK xflywind has one mratsim: otherwise just use fftw clyybber: Ok, thanks! mratsim: There are a couple of fft benchmarks in C for multithrading runtime as well mratsim: so I wanted to do one for Weave mratsim: for example: heather.cs.ucdavis.edu/~matloff/OpenMP/Examples/OmpSCR_v2.0/applications/c_FFT/c_fft.c mratsim: and I remember seeing one super complex as well mratsim: maybe this one: https://github.com/bsc-pm/bots/blob/master/omp-tasks/fft/fft.c mratsim: I nope'd out of this one though flywind: Hello, is it wise to use Natural everywhere instead of uint? For example function parameters, minus or plus and return type? clyybber: Natural introduces range checks without -d:danger mratsim: it's broken as soon as you want to use generics mratsim: like "Natural or seq[Natural]" won't type check mratsim: https://github.com/nim-lang/Nim/issues/9136 https://github.com/nim-lang/Nim/issues/7446 disbot: ➥ Generics: type mismatch "SomeunsignedInt or Natural" ; snippet at 12https://play.nim-lang.org/#ix=2h98 mratsim: otherwise it works clyybber: @flywind https://github.com/xflywind/scim/blob/master/src/scim/fft.nim#L146 What does this comment refer to? alehander92: stacktrace alehander92: with -d:danger: is it fast ? alehander92: or do we need libstacktrace? flywind: It only supports when array length is 2 ^ N? I can't [email protected] clyybber: Ok, thanks! clyybber: @mratsim Do you know of a more up to date fftw wrapper than this one: https://github.com/ziotom78/nimfftw3 ? flywind: I think this book is a great introduction to fft algorithms. flywind: The electronic version of this book is available free of charge at http://www.jjj.de/fxt/#fxtbook, it is identical to the printed version. flywind: flywind: https://cdn.discordapp.com/attachments/371759389889003532/697416290339651674/fxtbook.pdf clyybber: Thanks! flywind: no problem. clyybber: > radix-2 Cooley-Turkey algorithm: this algorithm can't handle transform of data which size is not a power of 2 clyybber: So thats the reason for the comment probably Araq: mratsim: that has nothing to do with generics though, but with the "convertible" type relation Araq: and you can always use 0.Natural much like you can use 0'u32 eliezedeck: > The mem usage is spiking in the last 2 lines of `infeficientCopiesAllOver` eliezedeck: @clyybber yes, that's because that's where the interesting part of the program begins ... I'll try rcstring; is there something you think we should test by doing that? because I can `shallow randomBuff`, which I believe would have the same effect eliezedeck: once it enters `HttpClient.send()`, the string becomes immutable, right? dom96: Araq, can I get a review? #13919 disbot: https://github.com/nim-lang/Nim/pull/13919 -- 3Fixes issues with dynamic loading OpenSSL. Fixes #13903. Araq: bummer Araq: my tool is smarter than me Araq: ah no it isn't eliezedeck: @Araq: in `sysstr.nim`, is there anything that would indicate that the souce string is currently immutable? eliezedeck: source* alehander92: Araq alehander92: `old` is an interesting annotation alehander92: can it apply to globals alehander92: and overally can globals be somehow used in require/ensure? probably impossible, (tho one can indeed count them as "invisible params" as clyybber says) Araq: globals don't cause any trouble alehander92: but can you say `global == old(globalVariable)` Araq: not yet, but in principle, yes alehander92: e.g. to ensure the function doesnt change this variable alehander92: ok alehander92: what did you decide about break/return etc Araq: return is harmless, just check the .ensures holds Araq: break needs some additional logic but seems to work too Araq: you need to combine the break condition with the condition of the loop Araq: e.g. Araq: while A: alehander92: so can it detect like dead code , or does the whole analysis happen after dce Araq: if B: break Araq: --> postcondition: not A or B alehander92: yeah, this makes sense, so basically it can detect some code would be never ran alehander92: and e.g. `list[list.len + 1]` is not an error after if true: break Araq: muhahah 'old' works :-) zacharycarter: shashlick: is there an easy way to capture the output from what nimterop produces? I added a call to `cDebug` but if I pipe the output to my clipboard tool it doesn't copy it zacharycarter: I want to compare the output of sokol with nimterop vs nimterop head mratsim: is there a defined(danger)? clyybber: Yeah! clyybber: And its defined(danger) clyybber: :p shashlick: There's no cOutput yet shashlick: But cDebug works usually zacharycarter: hmm zacharycarter: I'll try to figure out how to capture it dom96: yay, thanks for merge faulander: hi, nim newbie coming from python here. Ok, originally coming from assembler (6502) in mid 80ie, but that doesn't count. Looking forward to use Nim alot in the future. Just wanted to say hi and thanks for this cool language. kaushalmodi: @faulander The language and this community is awesome kaushalmodi: Welcome faulander: i am still struggling alot, but i'll find my way around. someone who was self-teaching assembler will get the hang of everything - will take a while though :) zetashift: Enjoy your stay faulander Vindaar: @faulander Welcome! Don't worry about asking questions, people are really nice around here zacharycarter: welcome! dom96: hello faulander! Welcome :D faulander: i have a question indeed. i am using django for web projects alot - but i am not, and never will be a frontend guy. i read that Nim can be compiled to JS - so where would i start reading on it? mratsim: nim js yournimfile alehander92: or `nim -d:nodejs js yournimfile` alehander92: if you just try it in the terminal alehander92: `nim js` is the browser one tho livcd: and there's karax livcd: although I dislike how karax reads :/ faulander: i hate c notation - so i would prefer python (or nim) notation to write my frontend code. Do i need to read up on something? how would i create dom manipulation in nim? That's what i meant when asking for a starting point, not how to compile it ;) alehander92: but this is important too zacharycarter: shashlick: https://gist.github.com/zacharycarter/52030f74296fc3662746b94ae1e87f70 livcd: faulander: https://github.com/pragmagic/karax alehander92: yeah, you can use karax which does vdom diffing: something like what react/vue/similar do internally alehander92: you can also just call the normal browser dom API-s alehander92: or jquery or whatever you need zacharycarter: the jsffi module is a good one to get familiar with alehander92: you can look at `jsffi` and `js/dom` in stdlib indeed zacharycarter: but there's also this module https://nim-lang.org/docs/dom.html faulander: ok, i start reading jsffi and karax. thanks guys. zacharycarter: those are the two modules I'd check out livcd: faulander: check dom96's nimforum as a reference alehander92: and also note: you can use all kinds of 3rd party modules in two way: either dynamically with `JsObject` which you might need to cast on the boundary with normal nim typed code zacharycarter: karax is a library, not part of the stdlib - so you may want to check it out after you see what the dom and jsffi modules have to offer alehander92: or with annotating them with `importcpp` alehander92: we can port typescript definitions to nim types one day .. but the older tool that did it isnt maintained anymore :( livcd: is Araq still working on knete? alehander92: and usually its easy enough to type the several functions you really need typed Araq: livcd: no but why? faulander: imports made me already struggle, haha. Last time i was writing pascal or code like that was in school in early 90s. Of course i knew i have to create procs before calling them, but since i am so used to python where this is not necessary i forgot it and struggled an hour :) livcd: Araq: because you said it will replace karax alehander92: something like svelte for nim might be interesting too Araq: livcd: I say many things zacharycarter: can the modern web die already please? zetashift: @alehander92 isn't that really hard though? They use some tricks specifically tailored to the dynamic nature of JS I think alehander92: i am not sure honestly faulander: i would love to see a modern dreamweaver like tool which creates css and framework code. that would sell like cut bread. zacharycarter: would be cool to see someone build something like blazor with Nim alehander92: ahh are you talking for typescript sourcemaps alehander92: types* zacharycarter: I started to make an attempt and then rapidly lost interest when I remembered how much I hate the web livcd: zacharycarter: are you back in the states? zacharycarter: yeah - in Austin now livcd: cool! zacharycarter: yup! just in time for quarantine! livcd: Did you also find a new job? livcd: sorry ...we an perhaps go to #nim-offtopic Araq: zacharycarter: lol :-) +1 for hating the web zetashift: fwiw alehander92 I do think a no vdom solution for Nim would be nice, e.g. like svelte or this one: https://github.com/raquo/Laminar faulander: +1 from me to, atleast for fronted alehander92: maybe! Araq: zetashift: karax has a vdom nisstyre: I'm writing a window manager in Nim. If I want to support dynamically recompiling and reloading, all that's needed is to serialize my state somehow, recompile with nimble, then call execv on the freshly built executable. Does that sound right? Araq: not sure, for NimEdit I used the compiler as a library to make everything theme-able Araq: and while nimEdit sucks big time, I never regretted using nimscript nisstyre: that might be a better idea shashlick: @zacharycarter that's a working version? zacharycarter: shashlick: the file named `nimterop_sokol_master.txt` is the working one zacharycarter: the one named `nimterop_sokol_head.txt` is the one that is produced when I run with [email protected]#head zacharycarter: both of those are just from me running `nim c -r` on the wrapper file itself, not on my whole project sheerluck: sokol is falcon in Russian zacharycarter: so they don't produce the SIGABRT I mentioned yesterday zacharycarter: sheerluck: yes it is shashlick: Ok but still arc right? livcd: sokol is falcon in slavic languages zacharycarter: shashlick: no no arc when I produced those zacharycarter: I can produce the crash without involving arc zacharycarter: lmk if you want the same thing but for the entire project - I can produce that as well shashlick: well, so you aren't seeing the failure without the entire project right? zacharycarter: shashlick: yes the runtime error occurs only when I run the entire project zacharycarter: and only when I use [email protected]#head zetashift: @Araq I know, I ment that Svelte and Laminar don't use one( a VDOM), and that option would be nice to have in Nim too shashlick: @zacharycarter: can you share some minimal example I can reproduce here? do you get a stack trace or something i can debug zetashift: But I think Svelte offloads a lot of complexity to it's compiler too zacharycarter: shashlick: what OS are you using? shashlick: i'm on linux but can debug on osx if needed Araq: fwiw I don't want "reactive"ness anymore, it's complex stuff, had reactive seqs in Karax zacharycarter: shashlick: well the repo is up on github and currently works only on OSX. Give me a few moments though - looking at the files I produced and checking them against sokol.h and the stack trace I have. shashlick: awesome - i can pull and run and see how it works here Araq: but yeah, I'd probably try to make 'Knete' more convenient zacharycarter: shashlick: https://github.com/zacharycarter/junkers - should just need to do `git submodule update --init --recursive` and then `nim c -r src/junkers.nim` from the project root disruptek: fwiw, ic will probably do dce automagically. zacharycarter: I'm wondering if it's being caused by - `sg_buffer_desc* {.importc: "struct sg_buffer_desc", header: headersokol_gfx, bycopy.} = object` in master vs `sg_buffer_desc* {.bycopy.} = object` on #head shashlick: but are you using -f:ast2 with #head or legacy shashlick: oh ya, #head also has the optional {.header.} feature shashlick: can you try with the `-H` flag and see if it works zacharycarter: shashlick: sure where does the -H flag go? on `cImport`? zacharycarter: and I'm not using `-f:ast2` yet in any of this shashlick: ya, just provide flags = "-H" shashlick: basically I added https://github.com/nimterop/nimterop/issues/169 disbot: ➥ Skip `{.header.}` generation zacharycarter: yup that fixed it zacharycarter: now let me try with ast2 shashlick: it's interesting - including the header fixes the issue but need to understand why zacharycarter: can I do `flags = "-H -f:ast2"`? shashlick: yes zacharycarter: okay let me try that shashlick: header is opt in shashlick: is this supposed to work on linux zacharycarter: no not yet zacharycarter: only on macosx right now zacharycarter: okay adding - `-f:ast2` to the flags for sokol works, but if I add it to the second library I'm using nimterop with: `physfs` I get an error zacharycarter: and I can reproduce it without the entire project shashlick: nice zacharycarter: need to go to a meeting but will be back after that shashlick: cool shashlick: the original issue without -H, is it failing at runtime? zacharycarter: yup shashlick: okay, need GUI so not running on SSH disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: today we try to find a way around broken .loc in the ast. Rika: Has anyone ever thought of adding namespaces to nim, or is there a better solution Rika: Actually, I have to go, so I'll just ask it again or not some other time, please disregard Rika: Don't try pinging either, since you can't exactly ping from irc to discord, so yeah Recruit_main707: ngl, i never got the point of namespaces Araq: Rika: modules have namespaces Recruit_main707: @Rika Recruit_main707: i tried :( faulander: can you point me to a resource on how to create a list of dict (python) or a linked list of tables (nim) (at least i know that already) Rika: I mean like the namespace of C# where you can define a symbol for namespacing within a file Rika: I really have to go now, I'll think this over later Rika: It's prolly not needed in Nim Rika: faulander: see the tables module Rika: Then just wrap the Table type you want in a seq Rika: I have to go (sleep, it's late) kaushalmodi: @faulander And list could be sequences (or arrays .. a bit unlikely) on how you implement in Nim Recruit_main707: good night Rika faulander: @kaushalmodi i don't understand? faulander: so i create a list like a seq and append the table to it? kaushalmodi: In Nim, there are sequences and arrays.. check out https://narimiran.github.io/nim-basics/#_containers kaushalmodi: > so i create a list like a seq and append the table to it? ⏎ ⏎ Yes, you can create a seq of any type kaushalmodi: If you haven't already, check out https://play.nim-lang.org/ Rika: Python list == Nim seq Rika: Python diff == Nim table kaushalmodi: first play with Nim tables there.. and then extend that to play with seqs of tables Recruit_main707: u need to sleep faulander: and what is the type of the seq? Rika: I don't know why I'm still here :) kaushalmodi: @faulander check out that nim-basics link kaushalmodi: you can have a seq of *any* type.. ints, floats, objs, tables, you name it faulander: @kaushalmodi will do, thanks. i know i am asking basics :( kaushalmodi: no worries; that's why I pointed you to a good resource faulander: i read the article. It states nowhere, what the type of the seq must be if it's tables. kaushalmodi: it will be of the `Table` type: https://nim-lang.github.io/Nim/tables#Table kaushalmodi: so, first play with the Table type faulander: that's what i wanted to hear :) thanks kaushalmodi: I built up some Nim notes over time.. here are some on tables: https://scripter.co/notes/nim/#tables faulander: Error: cannot instantiate 'Table[A, B]' inside of type definition: 'tradl'; Maybe generic arguments are missing? faulander: var possible_downloads: seq[Table] = @[] eagledot: This is my first time .Can i just ask a question directly? faulander: same error on the playground faulander: @eagledot if someone is still here? :) eagledot: yes. i am here. faulander: i meant, someone who can answer your question :) faulander: i presumely cannot - also newbie zetashift: You can just ask the question directly heh eagledot: Ok. Thanks eagledot: I am having a problem as raised in issue here. https://github.com/dom96/nim-opencv/issues/11#issue-595597351 eagledot: I thought of asking here directly than waiting on github. dom96: $ and then toSeq with 'cast' seems like you're asking for trouble :) dom96: no idea what's in frame.imageData but have a look at how they do it in C and just translate that eagledot: I am a newbie to Nim donot know my way around much. :) faulander: me neither, stuck on soooo many basic problems - but its fun! :) eagledot: i have stated the problem more clearly here . https://forum.nim-lang.org/t/6163#38052 eagledot: I have pointer (i.e cint type) for a camera frame. So the data size i think should be fixed for a frame? Vindaar: @faulander your error message says what's wrong. You need to specify the table, e.g. `Table[string, int]`, so `seq[Table[string, int]]` or whatever types your table should hold eagledot: @dom96 how to get data from a cint type into a sequence? zetashift: @faulander glad to know you're enjoying it dom96: Firstly a `cint` is not a `pointer` dom96: either the wrapper is incorrect or you're doing something wrong :) faulander: @Vindaar so if its 6 times string i do Table[string, string,string,string,string,string,] faulander: or Table[string:string, string:string ..] eagledot: @sorry my bad i wanted to say cstring as pointer not cint dom96: I guess the frame data is an fixed size array? If so you can just cast[array[64, uint8]](myPointer) Vindaar: @faulander no, a Table holds keys of one type (the first arg in `Table[arg1, arg2]`) and has values for each such key of type `arg2`. Vindaar: The table doesn't care how many elements it has to hold faulander: aaah, yes. of course. so its key:value pairs, dumb me. so its string, string Vindaar: and your `seq` of tables is only required if for some reason you actually need several Tables of course eagledot: It defines it as imageData*: cstring # Pointer to aligned image data. eagledot: @dom96 So i can directly cast imageData as array[64,uint8] faulander: yes, i have a table with 2 key:value pairs and a seq of many of these tables, its a small downloader for internal use. the table holds filename:filename, url:url and the seq is a list of these dom96: eagledot: if that is what the C code examples do, then yes eagledot: @dom96 i meant to ask if a variable is of type cstring. Then would it mean it is a pointer to an array of bytes/characters ? Vindaar: @faulander ah, I see! faulander: @Vindaar it works, thank you so much! Vindaar: you're welcome! dom96: eagledot: sometimes, it can be anything really dom96: assuming that the wrapper is correct though, it is an array and likely contains bytes, yes. eagledot: @dom96 Your nim-opencv code works fine. and it returns a reference to type i put here. https://forum.nim-lang.org/t/6163#38052 . Can u take a look? zacharycarter: shashlick: back - sorry that meeting was long shashlick: No worries, I'm meetings myself shashlick: How much of sokol are you using in your code eagledot: @dom96 Sorry you were right .It was foolish of me first casting `cstring` to string using `$` .Direct casting to eagledot: @dom96 As i gather casting to desired type generally using `cast[T]` works basede on T .It is heavily overloaded proc right?? ryukoposting: how efficient is iteration over key-value pairs in a table? Say, versus iteration over just the keys, just the values, or a seq Yardanico: @eagledot "cast" is not "type conversion" Yardanico: it's literal casting with same memory representation Yardanico: you usually only use it when doing FFI or some low-level stuff mratsim: key should be efficient, values and key-values should be same speed and slower because there is a need to dereference eagledot: @Yardanico Can u tell me a more about `cast ` operation. I am generally confused. Yardanico: https://nim-lang.org/docs/tut2.html#object-oriented-programming-type-conversions ryukoposting: thanks mratsim. Was just curious. Chroma uses tables to store the objects representing each UI element, character, dialogue, etc declared by the user, and there are many places where it has to iterate over those tables. Yardanico: "cast" is not really implemented as a normal procedure, it's a compiler magic ryukoposting: Trying to figure out why it occasionally has a weird performance hiccup. Yardanico: you can "cast" any type to any type, but it's an unsafe operation so you can get crashes and all sorts of interesting stuff ;) mratsim: cast does that conversion just for integer/floats but that's likely inherited from history, now it's really a reinterpretation of the memory layout for everything else mratsim: @ryukoposting, if you search for hash or table and performance on the github there are several threads ryukoposting: yup, cast[T](x) is exactly like doing (T)x in C. Just gives you a variable at the same place in memory with a different type. Very useful for interfacing with C libraries, very dangerous otherwise mratsim: many were addressed but had other corner case perf issues eagledot: @Yardanico Thanks for explanation.I wanted to know that i can get different results based on what i cast ? Yardanico: what do you mean? Yardanico: well, if you do something like casting a int to a pointer and try to dereference it... Yardanico: !eval echo cast[ptr string](123123)[] ryukoposting: embedded guys be like NimBot: Traceback (most recent call last)↵/usercode/in.nim(1) in↵SIGSEGV: Illegal storage access. (Attempt to read from nil?) eagledot: like if i cast a `cstring` to int and if i cast the `cstring` to an array[64,uint8] Chiqqum_Ngbata: How to accomplish https://play.nim-lang.org/#ix=2heZ mratsim: you can directly cast the cstring to arra[64, byte] ryukoposting: Chiqqum_Ngbata looking at your code rn, one moment mratsim: fn should be untyped mratsim: in the macro ryukoposting: haven't touched pragma macros much, so trying to read this is making me dizzy eagledot: @mratsim Ok Earlier i tried to first cast it using $ and then to a sequence.It gave weird results. mratsim: don't cast to GC-ed type unless you now the internal representation of set:string mratsim: I thought I had a forum post or Nim issue with lots of example of macro as pragma mmm :/ Chiqqum_Ngbata: That errs @mratsim https://play.nim-lang.org/#ix=2hf9 mratsim: ah yes: https://forum.nim-lang.org/t/5450 mratsim: see the second version: https://forum.nim-lang.org/t/5450#34078 zacharycarter: shashlick: I'm using sokol_gfx and sokol_app atm eagledot: @mratsim Ok,So i know the exact data type like `T= array[64,uint8]` I just use casting as `cast[T](x)` while interfacing with C libraries? zacharycarter: but will eventually be using some more of the modules i imagine Chiqqum_Ngbata: I don't think I've seen an example that does what I want. Is it actually possible for the pragma macro to return a non-function mratsim: @eagledot, you can directly use array[64,uint8] in your wrapper signature mratsim: @Chiqqum_Ngbata yes mratsim: if you modify the runHook macro in my example mratsim: you can make it return anything mratsim: it's just an AST transformation and the last argument gets passed the proc declaration mratsim: use the example and put some "toStrLit" on some of the AST node, it should be simple enough Chiqqum_Ngbata: Is there an obvious reason why this minimal example does not work https://paste.ofcode.org/YzB78fSG2AwgfcqgZdKfqf Recruit_main707: how did i initialise a result sequence? Yardanico: nim seqs are initialized by default since 0.20 or something like that Yardanico: same for strings Yardanico: if you still want to do it explicitly, "result = @[]" Recruit_main707: yep, i was doing something else wrog, thanks anyway Yardanico: Also, does anyone know what's the best way to implement thread timeouts? Yardanico: so that for example I can stop all threads which execute for longer than 10 seconds Yardanico: while having a lot of threads running simultaneously shashlick: @zacharycarter awesome cause just wrapping doesn't mean much, need to use the generated procs too so glad I can test with your code base shashlick: Will do the same with lqdev's rapid as well zacharycarter: nice! dumjyl: Chiqqum_Ngbata: you can't use an nnkProc as an nnkLambda, you need to transform it: https://play.nim-lang.org/#ix=2hfr Chiqqum_Ngbata: Oh, right. This makes sense Chiqqum_Ngbata: Thanks dadada: hi dadada: maybe you guys can appreciate some Miles Davis https://www.youtube.com/watch?v=OcIiu1kQMx0 companion_cube: that's a good idea companion_cube: dadada: https://www.youtube.com/watch?v=YYTIXJuxvgY dongbei: good day, I was reading about arc and then I watched this vid on the different memory management models https://youtu.be/yA32Wxl59wo?t=20m43s dongbei: at that time in the video rumpf talks about object pools dongbei: I don't understand what he's explaining dongbei: does that have anything to do with arc and how can I use it? dadada: rumpf is Araq here dongbei: yah dongbei: ok so Araq dongbei: sorry dadada: no need to be sorry yglukhov: Hey guys, how do I make an object outlive NimMain with --gc:arc. Or better - all objects. yglukhov: A global variable that is leorize: I thought global vars are not destroyed? leorize: but what would be the use case for outliving NimMain? doesn't that basically mean that your program continues to run after it exits? yglukhov: I thought so too, but apparently gdb shows `eqdestroy___Zdkyao3Rp9cTCBDO7vWqjWw` for a global var at the end of `NimMainModule` yglukhov: It makes sense for a library. Araq: hmm well it's a feature leorize: dongbei: it's a specialized scheme of memory management leorize: basically you allocate a large pool with enough space for all of your objects Araq: makes no sense to me, but it's a feature leorize: say, a big seq[T] leorize: when you "free" an object, just basically mark the space as empty and re use it later leorize: save you the time spent allocating and deallocating memory leorize: @yglukhov: that sounds like a bug then Araq: yglukhov: tried --noMain ? leorize: global vars shouldn't be destroyed in a shared lib because we don't know when the program that use it quits yglukhov: Araq: so I'm using this pattern a lot. for nimpy, for emacs, for android and emscripten apps. It basically goes like this. NimMain is called first to initilialize and execute global scope, setup callbacks etc. then other exported functions are called and they kinda may rely on the global vars. leorize: Araq: --noMain just disable to auto initializer leorize: NimMain is still there Recruit_main707: can you convert a sequence into an array? yglukhov: Araq: noMain would not help, as i still need to execute main. If I do noMain and run main manually I bet I would still see the same result leorize: @Recruit_main707: yes leorize: not that I'd recommend it :P Recruit_main707: how would that be done? leorize: a for loop copying/moving all elements over :P yglukhov: Araq: as a counterstatement,I see no sense in destroying global vars in NimMain in app:lib mode :) yglukhov: Why would anyone call _dllmain if it can't setup the global state Araq: sure, consider it fixed yglukhov: Wow, really? That was easy. Thanks :) Recruit_main707: `seqToArray*(aseq: seq[(Vector3, float)]): array[aseq.len, Vector3]` how would i do something like this? leorize: you can't leorize: arrays are statically-sized Recruit_main707: passing the length as another argument? zetashift: I think you'd need an other data structure for that as leorize says arrays need to know their size leorize: if you want a variable sized array it's a seq :P Recruit_main707: ill try something else then yglukhov: Araq: same goes for staticLib I think. leorize: to be fair we might need a nimrtl for static libs :P leorize: nim's handling of static libs is kinda useless atm companion_cube: you mean it's ahrd to statically link? companion_cube: to build a statically linked binary* leorize: no, the static lib created by nim is well, not the best stefantalpalaru: It can be done: https://github.com/status-im/nimbus/blob/927a5f3afeee05e82557f1070cd4ee3e1b69ec7f/Makefile#L129 leorize: basically you will have a "fat" static lib stefantalpalaru: Here it's being used from C and Go: https://github.com/status-im/nimbus/blob/927a5f3afeee05e82557f1070cd4ee3e1b69ec7f/Makefile#L147 leorize: Nim don't split functions into smaller objects (it's hard anyway), so you are certain to have a "fat" static lib that increase the binary size by a ton when linked yglukhov: leorize: for android i'm actually produce a staticlib with nim, which is later fed to gradle. leorize: not to mention because of the stdlib, you can't link two static objects into a binary because of symbol clashing between them leorize: though libnimrtl can be used to mandate this leorize: but NimMain will still clash companion_cube: leorize: ah ok, I was just wondering about producing one statically linked *binary*, not a lib companion_cube: something easy to copy on other machines leorize: ah, that part is simple, if you're using musl libc :) companion_cube: ✔ cool. kaushalmodi: companion_cube: https://scripter.co/nim-deploying-static-binaries/ kaushalmodi: That blog post and the technique described there came to fruition thanks to a lot of help from leorize and folks in this Gitter/IRC companion_cube: thank you 😊 companion_cube: nimble.directory doesn't list the dependencies of a package, that's strange leorize: @kaushalmodi: zig cc support has been merged :) maybe time to revisit that post? kaushalmodi: yes I know.. I am staying away from another rabbit hole kaushalmodi: *if it's working, don't touch it right now* Yardanico: I've also had success with https://github.com/richfelker/musl-cross-make Yardanico: for building a cross-compiling toolchain Yardanico: and then manually building libressl with it and then a nim app :P Yardanico: (statically of course0 kungtotte: Am I misunderstanding what "side effect" means in Nim, or does func/noSideEffect not work? I'm able to modify external values passed in without a single complaint from the compiler. It picks up on things like using I/O though. Is that the only side effect that Nim is concerned about? Rika: Side effects mean anything not accessible by params Rika: Var params can still be edited with no issue Rika: YES I KNOW ITS BEEN 3 HOURS SINCE I SAID I'LL SLEEP leorize: I didn't even notice :) leorize: kungtotte: Nim's idea of "side effect" is no where near FP's "pure" definition narimiran: kungtotte: yes, you are misunderstanding what it means in nim :) kungtotte: Yeah I can tell :D Rika: Why are they different though I wonder leorize: because Nim's idea is much more practical :p kungtotte: It's not named well in my opinion. CS and pretty much every other programming language (FP or not) has mostly the same idea about what "side effect" means, so Nim using it to mean something different is for sure a gotcha! solitudesf: but its not a side effect, you clearly annotate parameter with `var` Rika: That is true, all params in fp are immut aren't they leorize: "in theory" leorize: I'd say that Nim's version of noSideEffect is much more practical than the FP version Rika: You said that already leorize: we should clarify this pragma in bold so people stop being confused :P iffy: @krux02 I'm interested to know your qualitative opinion about what it's like to use https://github.com/arnetheduck/nim-result throughout a project. Do you like how things end up when using it? Or do you miss try/except at all? Does the code seem better or too cluttered? leorize: not krux but I use both that and exceptions in the same project narimiran: @iffy that Arne is not the Arne you mentioned :P iffy: oh, oops leorize: @arnetheduck is the one you're looking for iffy: Thanks -- and now I know there are 2+ Arne's in the community :) leorize: I'd say that nim-result works well when you have to handle all of the errors (ie. interfacing to C, or a proc used on the public interface of your web server) leorize: otherwise I like exceptions more, since stacktraces are a killer feature :) Rika: I only use a result when there is explicitly a value of none for the field, like an "optional" field or so iffy: Right... I didn't consider the absence of stack traces. The forced handling of errors is what's making me consider it. Rika: In where the optionality isn't defined by a kind leorize: @iffy: if forced handling is something you desire, then nim-result is what you want Recruit_main707: i dont know what scares me more, that you havent slept yet, or that you have already woken up leorize: but the moment you found yourself using the `?` operator too much, I'd say exceptions is what you want Rika: I haven't slept :P Recruit_main707: u should :) Yardanico: @Rika is nim chat that interesting? 🤔 Yardanico: I should probably sleep too, I've been awake for like 18 hours at least Rika: No, I'm thinking that I'm just deprived of programming leorize: you can take Yardanico and make it work without having to restart every 8 hours or so leorize: Yardanico's bot* leorize: :P leorize: the discord bridge Recruit_main707: what kind of float is "inf"?? Yardanico: infinity Yardanico: ∞ Recruit_main707: that would also explain the overflow Yardanico: well, about the bot - it seems that "irc" nim module is really stable, but the discord part is much more meh (they are very "modern" and use stuff like websockets) Yardanico: well it might be the discordnim's fault, i'm not sure leorize: I'd be worried if irc module is not stable :P Yardanico: also sad to say but matterbridge is really stable too leorize: it might be that the web server disconnects after `n` packets or so leorize: so you just have to reconnect when that happens companion_cube: haven't looked, does `irc` auto-reconnect? I saw it supports TLS, whcih is already more than most IRC libraries in other langs Rika: leorize: I have been trying already for a few months leorize: companion_cube: I guess it does leorize: it's the backbone of NimBot and disbot leorize: and they almost never disconnects Rika: I have a feeling I know pinpoint the issue with discordnim but haven't gone into it yet companion_cube: yeah that's quite neat Yardanico: i'm embarrased to say that the current running version of matterbridge in this channel is from march 2018 :D Yardanico: maybe I should finish ircord Yardanico: with @Rika Rika: Basically I think it doesn't handle disconnected websockets that well Rika: Oh, no, my code changes are insanely radical Yardanico: that's for the best Rika: I made a God macro for the objects... Yardanico: ircord doesn't need a lot of advanced discord functionality anyway Rika: I'll have to refactor that macro Rika: It's 3 am Yardanico: also seems like "ircord" is used by at least 5 other projects on github which do irc <-> discord, because I'm very good at naming projects Yardanico: 22:16 here Rika: I should have slept 6 or 7 hours ago Rika: I just name my bots with some anime or Japanese game character name Yardanico: well I've only watched ~200 anime but I guess I should do the same as you Rika: I mean, if you want to do so sure Rika: I'm just saying what I do Rika: Also 200 is a lot Rika: I think I only number at a hundred Rika: Though I do number at 600 manga mratsim: 200 x 26 episodes x 20 minutes --> 72 days 24/7 of watching animes? Rika: Most anime have one cour, that is to say, 13 or 12 episodes Rika: Some people don't skip openings and endings, which makes an episode 24 minutes dadada: Rika: what's a god macro?= mratsim: `macro worship(altar: untyped): untyped = discard` dadada: heh mratsim: But I suppose it's similar to a god object in OOP mratsim: A macro that does everything including the coffee and the kitchen sink dadada: what's a devil macro? clyybber: the same dadada: so god and the devil are one? :-) dadada: just found the naming funny supakeen: I sometimes see procs with a signature such as `proc foo(value: var Something)`. What does the var denote here? supakeen: (it's a bit of a difficult searchterm) dadada: supakeen: mutability clyybber: It denotes that its a mutable parameter solitudesf: https://nim-lang.org/docs/tut1.html#procedures-parameters supakeen: Aha. supakeen: So that implies that functions like this: https://nim-lang.org/docs/bitops.html#setMask%2CT%2CT will mutate their argument instead of returning a new value? solitudesf: yes. lack of return type also implies that. leorize: Araq: resolved all conflicts in #13201 disbot: https://github.com/nim-lang/Nim/pull/13201 -- 3Make file descriptors from stdlib non-inheritable by default leorize: solitudesf: that could be parsed in the wrong way :P supakeen: solitudesf: Thanks for the explanation, I guess the 'returns' text in the docstring confused me :) companion_cube: hmm I'm surprised, the stdlib doesn't have zlib bindings awr1: i think it used to leorize: bindings are only in the stdlib because it's used somewhere in there leorize: if it's not then it won't be in the stdlib awr1: https://github.com/nim-lang/zip awr1: https://github.com/nim-lang/zip/blob/master/zip/zlib.nim companion_cube: are the DB bindings used in the compiler then? awr1: the compiler uses sqlite leorize: companion_cube: the stdlib provides db_* abstractions companion_cube: yeah that's why I ask, I'm surprised companion_cube: anyway, thanks for the answer. It makes sens companion_cube: e leorize: the stdlib used to be a kitchen sink leorize: we kinda slim it down and cut parts that no one use into packages Prestige: Was looking at this comparison of nim vs typescript https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers#comparison does it say typescript code is formatted with npm? O.o Yardanico: ask @juancarlospaco :P Yardanico: maybe he meant that it's a package that needs to be installed via npm Prestige: nim looks so nice, going to start using this for everything arnetheduck: @iffy see for yourself: https://github.com/status-im/nim-eth/pull/211/files#diff-1428a55e5654ff6e85a6177d4f6101afR343 - like others have said, exceptions work best if you don't care about errors and can crash (which is the only time you need a call stack, if you think about it) ryukoposting: what does it mean if the compiler is saying "export only allowed at the top level" but there's no exports in the module it's complaining about leorize: it means that you might spot an export marker `*` somewhere that's not the top-level ryukoposting: ... is that it ryukoposting: I've spent 2 hours rearranging imports trying to make the damn thing work arnetheduck: from a pragmatic point of view - in our medium-sized application, the parts of our codebase that don't use exceptions are also the ones that turn out to be the most solid / have the fewest bugs leorize: though beware that there might be some hidden bias in play Varriount: @arnetheduck Personally, I don't mind either style (C-style errors or C++-like exceptions). What I do mind is the fact that it is generally harder to get stack traces when using C-style errors. leorize: +1 arnetheduck: yeah, but when do you need stack traces? predominantly when you're not handling errors arnetheduck: that's the point kind of -they're great in a script that you're iterating on leorize: I spent hours pin pointing where an error was coming from Haiku code base because they have a strict no-exceptions policy Varriount: When I'm debugging? When the system is throwing an exception that I haven't anticipted. dom96: Varriount++ Varriount: With errors, there's then the temptation to add logging before returning each error... and suddenly you get 100 line pseudo-tracebacks that are horrid to read. And you have logging logic in places that shouldn't have logging logic. leorize: arnetheduck: I don't think it's too hard to have nim-result gather stacktrace arnetheduck: there's a bias in our issue tracker, that's for sure 🙂 Varriount: arnetheduck: That being said, errors in Nim are much more easily handled. arnetheduck: leorize: https://github.com/arnetheduck/nim-result/blob/master/result.nim#L344 Varriount: You can have templates that do the stock "if err != nil: return" for you. Varriount: (or is that too much implicit flow control) dom96: @iffy: if forced handling is something you desire, then nim-result is what you want arnetheduck: Varriount: https://github.com/arnetheduck/nim-result/blob/master/result.nim#L516 dom96: That's wrong, you can also use Nim's exception tracking leorize: @arnetheduck: I mean hidden bias in terms of "this part is more carefully crafted since it's mission critical", and so on Varriount: @arnetheduck Yep. That get's rid of 50% of my concerns. Varriount: I'll say that trying to determine whether an error should collect a stack trace or not is tricky... leorize: I don't like comparing error handling schemes unless you have two similar projects going with two different schemes Varriount: leorize: I'll soon have that, once my port of Go's filepath module is complete. leorize: otherwise there's a lot more to factor in than just "it doesn't use exceptions and it has less bugs" Varriount: I have a nearly-semantically-correct version, if not a functional one that I can post. leorize: sure :) that'd be great Varriount: https://gist.github.com/Varriount/65a91d2d74baba4d9ec25a173d31e945 leorize: dom96: that works, but when you want forced forced it's different :P leorize: every scheme has it's own use case dom96: forced forced? dom96: what does that mean? :) leorize: I'm making an UI, and I want pretty errors :) Varriount: leorize: I also posted the Python file used to do the initial syntactic transformation leorize: sure I can use a custom exception handing scheme, but at that point it just look like I'm using `try` in place of `if` Varriount: It would be interesting to see a compiler plugin that converted possible exceptions to error return values. dom96: FWIW I think we should have a Result[T, E] type in the stdlib. But I doubt I'd personally adopt it as much as I have adopted Option[T] arnetheduck: exceptions have it in their name that they're good for exceptional situations - that's also when you want to have a call stack - for errors that you intend to actually handle, it's a tremendous waste leorize: a call stack is also useful while debugging fwiw arnetheduck: here's a funny thing: `type Option[T] = Result[T, void]` Varriount: Hm, is it theoretically possible for a compiler to determine code paths in which an exception is handled, and "turn off" stack traces for those situations? leorize: the problem I have in C: I got an EACCES, I display to the user "Access not granted" leorize: now when I'm debugging, where does that EACCES came from? leorize: I don't know, since it's forwarded from god knows where leorize: that's my biggest issue with the Result scheme arnetheduck: you're using it wrong if you're letting that bubble up the abstractions though arnetheduck: but whatever, each scheme has its benefits leorize: it's the case in C, sadly leorize: they don't have exceptions so they went with this poor man's scheme leorize: @arnetheduck: do you think having "optional" stack trace support (like -d:resultStackTrace) would be useful? arnetheduck: not reallly - I don't believe global defines are ever a good idea beyond toy projects arnetheduck: not really - I don't believe global defines are ever a good idea beyond toy projects arnetheduck: and toy projects are easy enough to reason about without that kind of crufty arnetheduck: and toy projects are easy enough to reason about without that kind of cruft dom96: Here is the problem with the Result scheme, you have to handle the results explicitly. Then you either end up with Go (simplicity so you just copy and paste `if (err, res) ...` everywhere, or you get more and more complex mechanisms to deal with Result like all sorts of monads and you end up with Hasell dom96: *Haskell leorize: I don't think we are arguing about that anymore :P leorize: I use a healthy mix of both schemes dom96: leorize: Are you sure? :P :P :P leorize: the only time that I'd have a problem with the result scheme is when you wanna replace exceptions as the default scheme with it leorize: otherwise they are useful in their own way arnetheduck: > a call stack is also useful while debugging fwiw arnetheduck: gdb? awr1: hello all leorize: @arnetheduck: I can either step from the start until I found my error, or I can make it spit out a stacktrace for me and I'd know where to set my breakpoints arnetheduck: I guess if that's your workflow, gathering stack traces might help sometimes.. or using a `Result[T, cstring]` and making sure each error has a more or less unique string which lands you the line where it was triggered which is usually the part of the stack trace that you're looking at leorize: https://ziglang.org/documentation/master/#Error-Return-Traces <- even something like this will help dom96: I do actually wonder how Rust/Golang programmers figure out why their program crashes leorize: our exceptions stacktrace when used without --stacktraces:on is also implemented like that dom96: I often just run things in debug mode so I can get a stack trace on my server companion_cube: I think rust can give stacktraces? arnetheduck: well, the stack trace implementation in the nim c backend is preposterous 🙂 arnetheduck: rust gives traces for panics - panics in rust btw are exceptions, for all practical purposes: they unwind the stack, you can mostly catch them dom96: right, but they are likely very rare. What I imagine happens is that everyone spends extra time handling all possible Result variants arnetheduck: it's about defaults: exceptions by defualt let you ignore errors, stuff like Result encourage you to handle them - in rust, the default is encourage people to handle/think up-front about errors, but there exists a mechanism to ignore as well - so for example, most of the nim std library is not exception safe, because nobody's really thought about what happens when an exception bubbles up the stack arnetheduck: they're rare - yes - they're used as asserts mostly, ie to signal situations the programmer didn't expect would actually happen, and it's even more rare to try to catch them dom96: yes, and that definitely works much better for certain types of applications dom96: for Nim that ship has sailed, you'd have to rewrite the stdlib to get the same conventions dom96: and we all know how that turned out for D. companion_cube: but nim has checked exceptions, right? dom96: yep awr1: https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#def-directive awr1: out of curiosity awr1: it seems like #def does everything #define does, so...what's missing? companion_cube: so checked exceptions should be as safe as result types… moerm: Hello everyone leorize: if you know what you're doing, you're safe no matter what scheme you use :P Varriount: awr: Normally Nim tries to turn `#define`s into Nim templates. This isn't always possible, because a `#define` can be a syntactically invalid piece of C code. Varriount: So `#def` essentially says "don't try to turn this into a template, just treat it like a C define" Varriount: *awr1 ^ awr1: i see exelotl: is it recommended to have the "nim" in ".. code-block:: nim" ? exelotl: it seems that syntax highlighting will still be applied in docs even if you omit it leorize: yep leorize: for general purpose RST, yea you need `nim` Varriount: Well, right now it's applied. That might now always be the case. companion_cube: nim should use readthedocs, it's where RST people go ! leorize: we have our own docgen, no thanks :P arnetheduck: and our own RST! Varriount: I wish there was a slightly nicer RST... a cross between RST and markdown. awr1: hm Varriount: On the one hand, I love the advanced formatting/markup RST allows... but things like not having line breaks is anooying. moerm: I gave up on md and use asciidoc Varriount: *annoying kaushalmodi: Varriount: Are you being sarcastic? awr1: i wish c2nim could skip #defines, as like a cmdline arg leorize: Nim's RST is a cross between markdown and rst :P Varriount: kaushalmodi: I am not. I used RST to write a user manual for a utility I wrote. kaushalmodi: *what leorize said.. I am already not liking the hybrid RST/md that Nim uses* Varriount: RST -> Sphinx -> HTML -> wkhtmltopdf -> PDF moerm: What an abomination! Varriount: Nah, it worked quite well, and the CSS was easy to tweak. exelotl: RST is quite painful sometimes, I have a table with 4 columns and some hyperlinks, it's really not nice exelotl: it also seems quite hard to style hyperlinks because backtick does so many different things companion_cube: hmm, I'm trying to use `openapi` but it fails with a `undeclared routine: 'endsWith'` (eevn though strutils seems imported) companion_cube: seems like I need to import it from where I *invoke* the macro? leorize: sounds like a bug to me leorize: ping disruptek leorize: oh he went offline companion_cube: hmmm, build happens out of tree, right? companion_cube: how do I get a .json to be available at build time? leorize: yea, but macros should bind whatever symbols they plan to use beforehand leorize: so you shouldn't have to import things in companion_cube: right companion_cube: it's weird because `strutils` is imported in the original `openapi` code moerm: Have a good time, cu Varriount: Anyone here running Windows? KingDarBoja: Me Varriount: Do you know how one would escape a double quotation mark in the PATH environment variable? Varriount: @KingDarBoja So, if you want to add a path containing a semicolon to the PATH environment variable, you surround the path with quotes. But what do you do if you want a single quote in your path? KingDarBoja: Like this? `"\'"` KingDarBoja: Wait, I think that doesn't work Varriount: I don't know. I looked through the Microsoft documentation, on the web, and even the source code of ReactOS/Wine, and couldn't find an answer. Varriount: And my personal laptop (which runs Windows) is away on repair. KingDarBoja: I think you must escape it KingDarBoja: As it is surrounded by double quotes, and viceversa KingDarBoja: -> `"some\path\'in\my\dir"` KingDarBoja: Nvm, tested it and doesn't work KingDarBoja: At least not on CMD, trying powershell KingDarBoja: Oh yeah, powershell works Varriount: You might want to test by changing the variable value through the system settings, rather than the prompt. Varriount: Otherwise prompt parsing comes into play. >_< Varriount: And it uses double quotes ("), not single ones (') KingDarBoja: Not sure what you wanna do Varriount: Hm. KingDarBoja: https://imgur.com/CZSWiOQ KingDarBoja: Now let me see if I can set it using the env system settings that's what I think you asking for KingDarBoja: I set the same path and echo on my CMD KingDarBoja: `...;D:\Programming\ts_projects\some'sample;...` KingDarBoja: Just copied and pasted the path into the system PATH list krux02_: @iffy: Regarding nim-result. I did not use that particular implementation. But generally speaking such a type is really useful. I really recommend to use it. krux02_: This is what rust does as well. krux02_: But after all it all depends on the implementation of that type and how it is used. krux02_: good night folks Rika: so is `|` a compatibility thing shashlick: @zacharycarter figured that convertor out? zacharycarter: shashlick: I ended up just overloading `[]=` and `[]` for that type zacharycarter: couldn't figure out the converter KingDarBoja: Just tested the `or` and looks like it will asign the type to the parameter on the call but then if I use a if-else statement to cast, it will throw an error KingDarBoja: Hold a second, I will attach a pic KingDarBoja: https://imgur.com/a/Prl8c88 konsumlamm: ```nim konsumlamm: proc test[T](x: T) = discard konsumlamm: konsumlamm: test[12](42) konsumlamm: ``` konsumlamm: ok, why does this work? KingDarBoja: idk KingDarBoja: Maybe it discard as does return nothing konsumlamm: ? konsumlamm: im confused because i can pass 12 as type and 42 as argument KingDarBoja: Ah, you mean that.... probably the compiler is guessing the type according to the type value konsumlamm: ye, but why does it accept 12 as type parameter then? Benumbed: Because both 12 and 42 are of type `int` KingDarBoja: Ah, found my error, it should be `when` not `if` Benumbed: I imagine if you tried `proc test["foo"](42)` it would fail Benumbed: @konsumlamm For the record you don't need that [12], `test(42)` is equivalent konsumlamm: youre right konsumlamm: ik that i dont need it, im just confused that it works Benumbed: The compiler infers the type `T` refers to from the `x` argument Benumbed: 🙂 ¯\_(ツ)_/¯ konsumlamm: why does the compiler accept an instance of a type when it actually should be a type? Benumbed: I think there's probably meta stuff where you could potentially use that? But I haven't looked that closely into it yet Benumbed: Because an instance of a type is still typed? The compiler knows what the underlying type of that 12 is Benumbed: May just be because sugar, I dunno there, maybe disruptek would know, they seem pretty knowledgeable of Nim internals Benumbed: There are other core devs over on IRC, but I forget their handles, disruptek was just the loudest when I was asking lots of questions 😄 KingDarBoja: Jummm, trying to figure out if it is possible to pass a procedure to another procedure without triggering its logic. That means, not returning the value while being passed to the other proc and instead, trigger it once it is inside konsumlamm: just pass it as an argument? Benumbed: ^ KingDarBoja: That's what I did Benumbed: Did you read https://nim-lang.org/docs/manual.html#types-procedural-type in the manual? KingDarBoja: Nope Benumbed: That explains how to do what you're talking about KingDarBoja: I got very confused reading that KingDarBoja: The key is `{.closure.}` ? Benumbed: no, the key is the `proc(someArg: someType)` Benumbed: That's actually a type konsumlamm: that pragma is just a calling convention Benumbed: like an int or a string Benumbed: So you should have a proc definition that looks like `proc someProc(firstArg: string, callback: proc(someArg: someType))` KingDarBoja: without the return type of the proc being passed? Benumbed: and then you'd pass your external proc in as `someProc("foo", yourProcNameHere)` Benumbed: No, if you have a return type, it needs to be in the type definition too, I just didn't use a return type for brevity KingDarBoja: ok Benumbed: `proc someProc(firstArg: string, callback: proc(someArg: someType):returnType)` KingDarBoja: Done... but now getting error KingDarBoja: "type mismatch: got but expected 'seq[MyGenericType]'" while trying to trigger the proc inside a seq KingDarBoja: Wait a second KingDarBoja: https://imgur.com/gLHDDpj Left side is the proc and the right one the call of that procedure konsumlamm: you have to call the proc konsumlamm: `parseProc(self)` konsumlamm: like this Benumbed: They probably are calling it elsewhere, the stuff on the left is just building a dispatch list Benumbed: Oh I see the problem Benumbed: You can't do `seq[T]` Benumbed: You're assigning a procedural type to the sequence, not the return value Benumbed: you'd have to do `seq[proc(self: Parser):T]` Benumbed: Although I'm not quite sure why you're adding it twice 🙂 konsumlamm: i assume they actually want a `seq[T]` and just didnt call the proc Benumbed: Good point, no idea KingDarBoja: Neither I am sure why it got called twice on source code (Python) Benumbed: Can you link to the Python source? KingDarBoja: Sure! Benumbed: May be easier for us to help you if we see what you're porting from KingDarBoja: https://github.com/graphql-python/graphql-core/blob/master/src/graphql/language/parser.py#L1074 Benumbed: I continue to be uncertain whether I love or hate type-hinting in Python Benumbed: Yeah @KingDarBoja They're calling the method not storing it, @konsumlamm was correct Benumbed: you're trying to store it as the code stands Benumbed: Need to call the proc KingDarBoja: I assumed it was being called inside the other proc KingDarBoja: But wasn't sure how it was the proper approach Benumbed: No you need to call it within manyNode on both lines that reference it KingDarBoja: like @konsumlamm said? right? Benumbed: yep KingDarBoja: Okay, did that but still an error, I will share another pic, please forgive me if asking too much KingDarBoja: https://imgur.com/RiDpF3Q Benumbed: Um, Not sure what you're up to with `[:DefinitionNode]` there but I think that's your problem Rika: That's the generic brackets thing Rika: You need a colon at the start for it to work with method style syntax Benumbed: I have not encountered that yet KingDarBoja: Yup, what Rika sensei said Rika: Suddenly Japanese word usage Benumbed: Well I have no ideas at this point because I know nothing of the `generic brackets thing` 🙂 KingDarBoja: > I continue to be uncertain whether I love or hate type-hinting in Python Rika: I hate dynamic languages because of python KingDarBoja: I love it because it annoys me trying to guess the type everytime I declare a variable and later reasign it KingDarBoja: And TypeScript is somewhat the same stuff on JS KingDarBoja: Feels like C#-Script Benumbed: @Rika You must ❤️❤️❤️ JavaScript then 😛 Rika: ゴミ Benumbed: Python is downright pleasant compared to JavaScript, which I, sadly, have been forced into at work KingDarBoja: Well let's keep on the topic, I am stuck xD Rika: Types riot? Rika: Ugh Rika: Typescript Benumbed: But in these times, a steady job is a steady job Rika: Thanks SwiftKey lmao Rika: @KingDarBoja can you run the code so I can see the error message better lol KingDarBoja: I use both Python and TypeScript at my job Rika: I don't got a job KingDarBoja: Error: type mismatch: got KingDarBoja: but expected one of: KingDarBoja: proc (self: Parser, openKind: TokenKind, parseProc: proc (self: Parser): DefinitionNode{.closure.}, closeKind: TokenKind): seq[DefinitionNode]{.noSideEffect, gcsafe, locks: .} Benumbed: I'm most likely going to be furloughed in the next month myself :/ KingDarBoja: There you go mate KingDarBoja: I hate my job, not because what I do but because my boss KingDarBoja: Tired of having to report everything I am doing besides having a software which takes screenshots every time I want to work on... and also "computes" my perfomance leorize: KingDarBoja: looks like you're having trouble separating functions call and functions as a value leorize: so here's the rule: function name without arguments and/or `()` = a value leorize: otherwise it's a call KingDarBoja: So everytime I do `self.myProc()` it is a value? Benumbed: Well it will run the proc and return a value leorize: @KingDarBoja: reread the text again :P Benumbed: `self.myProc` without the () is a value leorize: that's still not a value fwiw Rika: `aProc` is a value function, `aProc()` is a called function leorize: unless myProc is just a field leorize: but I don't have the context here Benumbed: Well yeah, it's techically a function pointer KingDarBoja: -> function name without arguments and/or () = a value, i.e. `self.myProc(someArg)` ? leorize: **without** KingDarBoja: Ah KingDarBoja: So a **function call** is only the proc with arguments, like `self.myProc(someArg)` KingDarBoja: Whereas the **function value** is the proc without arguments and/or "()", like `myProc` KingDarBoja: Right? Rika: yes Rika: note that `self.myProc` is a **function call** since self is an argument KingDarBoja: Yeah, I was confused by the self itself Rika: of course, this is given that `myProc` is a ***proc*** and not a ***field that takes a proc*** KingDarBoja: So that leads me to this question -> https://github.com/graphql-python/graphql-core/blob/master/src/graphql/language/parser.py#L434 This "partial" on Python performs a **function value** but pass the argument without making it a **function value**, right? If that's the case, is there a equivalent on Nim? Rika: okay so partial leorize: a closure Rika: partial takes a function value, then returns a function value Rika: so lets say this is passed to (next message): ```proc(a: int, b: int): int``` Rika: ```partial(thatProc, 2)``` Rika: partial then returns a ```proc(b: int): int```, and `a` now assumes 2 always Rika: this is a very FP style thing so i dont think nim has it KingDarBoja: Owwww Rika: was my explanation good? KingDarBoja: Yeah, I knew that on Python, my question sounded like I didn't KingDarBoja: The real question was if that's the case, Nim equivalent is? KingDarBoja: Of course I don't expect the answer now but I am worried as now I am needing that lol Rika: ```let newProc = do (proc arguments) -> return type: theProc(all arguments, w/ the applied and the nonapplied)``` is what i would do KingDarBoja: Pass it like a pipe to another proc which returns a proc? Rika: uh no, make a new proc that just uses the old proc w/ whichever filled in values you want Rika: ok so with the old example it would be Rika: ```let newProc = do (b: int) -> int: theProc(2, b)``` Rika: it can also be ```let newProc = proc(b: int): int = theProc(2, b)``` i think... KingDarBoja: So in my case, would be self as argument and "isConst" as fixed value (true in this case) Rika: i guess eyah Rika: yeah KingDarBoja: "let partialValueLiteral = do (self: Parser) -> ValueNode: parseValueLiteral(self, true)" Rika: basically yes KingDarBoja: But getting "expression expected, but found 'keyword do'" KingDarBoja: wtf Rika: oh Rika: i think do syntax needs a proc... Rika: use the other one i sent KingDarBoja: Ok KingDarBoja: Ok, no error on that syntax KingDarBoja: DUDE KingDarBoja: I LOVE YOU KingDarBoja: ❤️ KingDarBoja: Thanks all 😄 😄 Manage to make it work (the test is passing now leorize: partial is not really a thing in nim the people do afaik KingDarBoja: I see... eliezedeck: Good morning everyone konsumlamm: ```nim konsumlamm: proc test[T](x: T) = discard konsumlamm: konsumlamm: test[12](42) konsumlamm: ``` konsumlamm: i think i kinda get why this works konsumlamm: but *why* konsumlamm: like, whats the reasoning for this design? konsumlamm: why isnt this an error? number_one: Doesn't it derive the type T from the int literal? konsumlamm: my question is not how it works, but rather why it isnt an error eliezedeck: intersting eliezedeck: it's good that the compiler can infer all sorts of thing, but here, it shouldn't try to derive for the sake of correctness ... imagine `test["hitman"](47)` ... now, it looks as if one would like to access an array that contains an element of `proc(v: int)` type and calls it ... total confusion konsumlamm: `test["hitman"](47)` doesnt work actually, it only works when the generic parameter has the same type as the argument eliezedeck: @konsumlamm I would suggest you report this as a bug eliezedeck: oh, right .. but still konsumlamm: will do ¯\\_(ツ)\_/¯ ryukoposting: figured out why my VN engine is so memory hungry. Every time I push the game state (which happens pretty regularly, so you can move backwards and forwards in the script), it's like 50MB of stuff lmao eliezedeck: so, `test["hitman"]("fourty seven")` would then work, right? konsumlamm: mhm eliezedeck: and that is still confusion Rika: ryukoposting: maybe consider using a ref for that lmao number_one: Hey guys, am I doing exceptions wrong? Shouldn't this code be raising an EOFError and not an IOError? https://play.nim-lang.org/ number_one: One sec, sorry number_one: https://play.nim-lang.org/#ix=2h1p leorize: wait, we have EOFError? leorize: well the problem is simple, EOFError inherits from IOError leorize: so the branch for IOError catches first number_one: Ah, wow! number_one: Thanks companion_cube: seems like this would deserve a warning? companion_cube: ("unreachable case") ryukoposting: aaayy, proper image caching took idle memory usage from 900 MB to 460 MB leorize: companion_cube: feel free to open an issue for that :) number_one: hey guys, is it possible to ask the compiler to override the version of linenoise wrapped in the nim stdlib with a custom version when compiling a file? leorize: no, sorry wgetch: is there a way to inspect the type of a proc call generated by a macro? Rika: you can inspect the output of a macro with expandMacros Rika: if thats what you need wgetch: that did end up getting me exactly what I needed! thank you eliezedeck: Hey guys, are strings passed by reference around or by value? more specifically, I'm sending a string to a `FutureStream[string]` ... is Nim going to copy the string or send it by reference, and how can I control this? Benumbed: It'll copy it unless its a `ref` eliezedeck: alright, thanks Araq: it's pass by reference Araq: don't mess with it, the compiler is good at it and getting better eliezedeck: @Araq thanks for the clarification Rika: so what things are pass by ref and not? eliezedeck: so, it's safe to just pass string around Araq: in a nutshell: Nim passes things as const& T or as T depending on sizeof(T) Araq: if you know C++ this is the quickest explanation eliezedeck: yes, I'd like to know that too ... looking at the output of --gc:arc ... there are `Performance` hints here and there, and so, I was wondering eliezedeck: oh, right eliezedeck: that sounds great Araq: and 'sink T' is very much like C++'s "want speed, pass by value" Araq: for a sink parameter the compiler emits a move but this means the parameter must be owned. if what you pass to it isn't owned, the compiler has to introduce a copy for correctness Araq: and that's when the warning kicks in. eliezedeck: and how do you control ownership? eliezedeck: how do you know if something is owned or not Rika: araq what size does nim convert to pass by ref Araq: Rika: 3*sizeof(float) Araq: eliezedeck: well the compiler knows. you own your local variables and your 'sink' parameters eliezedeck: so, suppose that I have the warning, what should I do and should I do something about it (take below a real example that I ran just now): eliezedeck: `Nim/lib/pure/httpclient.nim(980, 38) Hint: passing ':envP.:up.client3.userAgent' to a sink parameter introduces an implicit copy; use 'move(:envP.:up.client3.userAgent)' to prevent it [Performance]` Araq: eliezedeck: you cannot do anything and this warning is a bug :-) eliezedeck: Ok, alright ... So, should I ignore all of these warnings from this point on then? I also get these warnings in my own code, and adding a `move ...` before the assignment does get rid of them, but then I seem to have a lot of move here and there ... should I remove those and stop worrying about them? eliezedeck: not before the assignment, but as suggested by the warning, sorry Araq: warnings in your own code might be worth looking at eliezedeck: out of curiosity, `httpclient` doesn't seem to contain any `sink` parameter at all ... and yet, the compiler will mention about it in that file; how is that so? eliezedeck: so, it looks as if the compiler will auto-consider certain proc to have sink parameters, is this the case? and if it so, is it worth knowing these kind of proc? Vindaar: @Araq: how experimental is `dynamicBindSym` considered to be? I think it might really help me, but I don't want to rely on it if it might disappear at some point alehander92: hey guys eliezedeck: hello @alehander92 eliezedeck: @alehander92 I saw you had a patch to allow using `await` in a template, but it's not yet merged ... what's the status on it? and why is it blocked? alehander92: yes alehander92: well..i dont remember alehander92: i use it! alehander92: locally in my code alehander92: i think i had some strange type error alehander92: but cant remember how to reproduce alehander92: otherwise have to check if multisync works.. but alehander92: i can try to fix it and let it be merged: i'd like to get closer to upstream! ⏎ the patch is basically just a port of the chronos solution tho eliezedeck: I see ... I'm be interested to try it, but if it breaks multisync, then it might not be a good idea eliezedeck: I personally prefer to be closer to upstream as well alehander92: it doesn't have to break it i think alehander92: i just dont remember, have to look again alehander92: what are you working on eliezedeck: well, it would greatly help everyone if you manage to get it working eliezedeck: GraphQL client eliezedeck: I prefer to have the same exact thing on client and on server, that's why I'm writing it with Nim alehander92: yes alehander92: ok, hmm eliezedeck: I'm planning on use it on a Flutter app alehander92: how does the dsl look eliezedeck: unfortunately, the Dart API isn't really appealing to me eliezedeck: and current graphql library doesn't seem to be able to do what I exactly want alehander92: i wonder because one can typecheck a lot of things in such orm-like things eliezedeck: which dsl? alehander92: the graphql lib one alehander92: well, api* eliezedeck: how does it look... I'm not sure I understood you eliezedeck: (be back in an hour, lunch) alehander92: i mean Araq: eliezedeck: the compiler does sink parameter inference alehander92: can i see how it is invoked alehander92: :D Araq: Vindaar: if you can avoid it, do so. it's an ugly beast alehander92: i think https://github.com/nim-lang/Nim/pull/12085#discussion_r319680783 disbot: ➥ Make await a template alehander92: i had a strange problem if not using `auto` alehander92: otherwise i should mostly answer the objections alehander92: and fix Vindaar: @Araq: ok, thanks. I'll see if I can find another way Recruit_main707: i am having some issues trying to override a method, what am i doing wrong here? https://play.nim-lang.org/#ix=2h2Q konsumlamm: you have two definitions of `get_output` that have the same sgnature konsumlamm: you have two definitions of `get_output` that have the same signature konsumlamm: so the compiler doesnt know which to choose Recruit_main707: so how can i fix that? because i need a definition of get_output in the first file konsumlamm: idk what you want konsumlamm: dont import get_output from the first module? PMunch: import RLNim except get_output Recruit_main707: didnt work, let me elaborate a bit more that code Recruit_main707: https://play.nim-lang.org/#ix=2h2T this is much more self explanatory Rika: hi Recruit_main707: hello Rika Rika: thats not how methods work Rika: the signature should be different Rika: if you want to "override" it, exempt it from your import Recruit_main707: ive done this, but it throws me an error still: `import RLNim except get_output` konsumlamm: why does `get_output` in RLNim even exist? you can't override it with the same signature anyway konsumlamm: and what error do you get when doing `import RLNim except get_output`? Recruit_main707: because `receive_and_respond()` calls the method Recruit_main707: the error is the same one, "should override this method" Rika: make it a proc konsumlamm: you need to define the two methods in the same module then konsumlamm: or import get_output where you define receive_and_Respond Recruit_main707: making it a proc didnt work, and if i have to import it it would kind of loose the purpose Recruit_main707: i will see what can i do eliezedeck: @Araq string doesn't seem to be passed by reference as you said ... every-time I cross to another function, passing it around, the memory usage increase by the amount of the original string ... I'm testing with ~65MB file, and in the end, the memory usage of the program is 700 MB+ ... that is not good eliezedeck: I tried both --gc:arc and without it, it's right about the same memory usage eliezedeck: I'm using devel branch eliezedeck: not using any `sink` or ref or whatever ... just plain `string` ; i'm currently testing upload of a large file (65MB), and for some reason, the CPU usage also is not where it should be ... trivial task like that would typically not consume more than 5% CPU on my internet connection, yet, it reached 25 - 30% eliezedeck: of course, I was testing with `-d:release` eliezedeck: this is for testing the WIP that I'm hoping to contribute to Nim about the `bodyStream` for HTTP requests (https://github.com/nim-lang/Nim/issues/13856) disbot: ➥ httpclient: Ability to stream HTTP request body Rika: elieze are you absolutely sure its string causing you issues zedeus: Related? https://github.com/nim-lang/Nim/pull/12982 disbot: ➥ Implement file streaming for httpclient's MultipartData alehander92: elieze alehander92: string is just a small struct alehander92: in nim alehander92: eliezedeck* alehander92: which contains capacity, length and char pointer if i recall correctly alehander92: (maybe with some differences between gc modes) Araq: eliezedeck: 'async' changes the picture Araq: I described Nim's calls, not what async layers on top of it Araq: alehander92: you're wrong, it's a pointer to a variably sized block of memory that contains the length, cap and character data eliezedeck: @zedeus your PR is more multipart centric, I was building one that is absolutely dumb where you are responsible of the correct headers (Content-Length) and for composing the whole POST (or any request for that matter) body alehander92: Araq sorry, so a pointer (but isnt it still to a struct?) eliezedeck: @Araq, yes, it's all async eliezedeck: so, what is then the behavior in async context? eliezedeck: I suppose string copy? alehander92: maybe they get preserved in the closure? eliezedeck: no wonder a program that should stay at ~65 MB memory usage end-up using 700+ ... there is a chain of async proc that is being called until it finally arrives to socket.send() Araq: the closure "captures" the string causing the copy, I think Vindaar: @Araq: managed a way around without `dynamicBindSym` by writing a macro that creates bindSym calls to my computed idents and calling that macro as an argument for another macro. Kinda hacky, but gets the job done eliezedeck: hmmm... and how do I completely send the string fully to the next proc? may be `move`? alehander92: hm, thats an interesting problem eliezedeck: I'm sure this is not the first time this kind of problem has been raised here, and I'd like to know what is the idiomatic Nim-way of solving this problem Araq: eliezedeck: via 'move' clyybber: eliezedeck: Are you trying async with gc:arc ? eliezedeck: @clyybber yes alehander92: is gc:arc doing alehander92: what is it doing differently for async closures clyybber: @eliezedeck heh, its not working yet. Its leaking eliezedeck: oh, ok eliezedeck: good to know eliezedeck: trivial question, but I don't know the answer: how to convert `TaintedString` to `string`? narimiran: `myTainted.string` eliezedeck: lol... thanks lqdev[m]: if you don't use taint mode you don't need to convert at all dom96: yeah, the compiler should probably have some logic to make it obvious that TaintedString is the same as String when tainted mode is off eliezedeck: the issue is, on VSCode, I suppose it defaults to tainted mode = on ... unless there is a way to disable that, but I really don't want to ... I want to stay with the default behavior, plus, the `.string` is fine alehander92: hmmm dom96: Ehhh, VS Code shouldn't be setting that by default. dom96: Nim has it's own defaults, VS Code really shouldn't be changing them dom96: taint mode isn't on by default in Nim zacharycarter: is a `var` return type valid, for example does this proc signature make sense? It seems to work - proc `[]`(a: var openArray[sg_color_attachment_action]; b: int): var sg_color_attachment_action = dom96: yes zacharycarter: Okay thanks - I guess I'm returning a managed pointer in this case? zacharycarter: or a managed reference? eliezedeck: ohh eliezedeck: @Araq ... I only managed to avoid 2 copies, once the 65MB buffer gets passed `FutureStream.write`, I no longer have the ability to have `move` applied to the rest of the call chain eliezedeck: isn't there a way to have an immutable string that it should be copied at all? I'd like to see where is the code that does this copying ... this is a very serious problem for me eliezedeck: *should not be copied zacharycarter: gitub pages being down is super annoying eliezedeck: for example, if I say: `let fileContent = readFile("...")` ... fileContent should be immutable, right? eliezedeck: if it is immutable, the compiler shouldn't copy it at all, may be just increment GC ref counter, and as it is passed around, it stays immutable (and AFAIK, a parameter will be immutable) ... and since nobody is going to modify it, it is safe to use the original Araq: run 'shallow(str)' on the string to do that Araq: but this feature isn't available for ARC (yet?) eliezedeck: i'm no longer using ARC for now, from @clyybber 's suggestion eliezedeck: @Araq that reduced memory usage from 700+ to 350MB 🙂 ... a good progress, but not quite there yet eliezedeck: it should be lower than 100MB eliezedeck: there may be at least still 5 copies of that buffer, roughly ... what's the typical memory debugging tool for Nim? alehander92: try to use maybe valgrind with `-d:useMalloc` alehander92: but not sure if this works only for `--gc:arc` alehander92: i think there was some config file for a normal gc and valgrind tho zacharycarter: shashlick: I'm trying to use nimterop on another header file - https://github.com/RandyGaul/cute_headers/blob/master/cute_math.h - and a lot of types definitions are being skipped over. Mind pinging me when you're around today? zacharycarter: nevermind I think I understand why it's happening eliezedeck: thanks @alehander92 shashlick: Sup zacharycarter: well I figured out it was skipping those type defs because the types had no fields zacharycarter: now I'm trying to figure out how to make nimterop deal with namespaces zacharycarter: also when we're out of quarantine, we should hang out. disruptek mentioned coming to Austin to visit companion_cube: you're in Austin? damn shashlick: That will be fun zacharycarter: yeah! Recruit_main707: is this the only flatbuffers implementation we have in nim? https://github.com/Skrylar/skflatbuffers zacharycarter: :( shashlick: This header is implementation zacharycarter: well it's everything zacharycarter: it's just a single header lib zacharycarter: same with the library I used nimterop for yesterday - sokol shashlick: Ok but those online procs won't be wrapped right shashlick: Inline zacharycarter: gotcha zacharycarter: maybe I'll just try to port this shashlick: @zacharycarter: I guess you could modify the header and get a wrapper if you want alehander92: companion_cube where you livin now companion_cube: just moved to DC, and I miss Austin a bit already :p eliezedeck: How to detect Linux / macOS? (using when ...) narimiran: `when posix` narimiran: `when defined(posix)`, to be more precize eliezedeck: @narimiran thanks, I want to separate the two eliezedeck: detecting Linux from macOS narimiran: `when defined(linux)` eliezedeck: 😄 thanks narimiran: you can guess the other one, i hope :P :D disruptek: !last zevv disbot: Zevv spoke in 12#nim 12 days ago eliezedeck: yes 😛 shashlick: companion_cube: whoops zacharycarter: companion_cube: I'm originally from Northern VA haha zacharycarter: but I was in Helsinki for the past 9 months, just moved to Austin in Feb companion_cube: ah well, you'll be able to enjoy Barton Spring once the quarantine is over companion_cube: also, be careful with this thing called the sun zacharycarter: yeah - I'm looking forward to getting out and exploring more of Austin zacharycarter: haha yeah - I have 100 spf sunscreen. I've already had skin cancer once and I'm only 35 haha companion_cube: oh shit, yeah companion_cube: and sunglasses zacharycarter: for sure companion_cube: (but yeah, look for barton springs, best thing in austin) zacharycarter: will do - my gf lived here for a few years so she knows all the hot spots, but I've heard about barton springs from multiple people, so def going to check that out Zevv: disbot: sup companion_cube: I still have plenty of friends in Austin… will fly back to see them when it's safe disruptek: hey zevv, do i just use nimLUA for lua in nim? disruptek: or something else? eliezedeck: Using Valgrind Massif to analyze where are the 350 MB memory usage going ... tried with and without `-d:useMalloc`: memory reported by massif is always about 78 KB (yes, kilobytes) eliezedeck: What up here? mratsim: with -d:useMalloc should work, if it doesn't it's a bug mratsim: without Valgrind cannot analyze memory because Nim does raw mmap/VirtualAlloc calls eliezedeck: so, it's a bug then ... I tried many times with -d:useMalloc, nothing eliezedeck: 😔 alehander92: well, please just give us a repro example alehander92: its not easy to discuss without one mratsim: And I've checked the recent refs_v2 code and it properly calls c_malloc / c_free when using -d:useMalloc alehander92: oh i just have a nice tool to check quickly this stuff alehander92: let me try eliezedeck: is that dev channel? alehander92: eh? eliezedeck: devel* alehander92: i thought stuff_v2 is only for newruntime alehander92: yes, it is in `devel` branch :) mratsim: ah maybe eliezedeck: is that devel branch? eliezedeck: going to try 1.2.0 ... ryukoposting: dom96: noticed you have a commit in the SDL2 library called "fix TextInputEventObj and TextEditingEventObj padding." I'm starting on my engine's text entry stuff today, but I'm running on the most recent tag, not #head. Did the padding break those objects to the point of un-usability? dom96: ryukoposting, yeah, it prevents casting because Nim checks sizeof of each type ryukoposting: oh man. If you guys have a process for this, obviously I understand, but if you could get that v2.0.3 tag made soon, that'd be very nice. dom96: why do you need a tag? disruptek: this again. dom96: you can just depend on a specific commit for now ryukoposting: I can have the engine depend on head for now, but once I move towards releasing an early beta version (which should happen in the next couple weeks), I'd prefer not to disruptek: ryukoposting: dom only has a couple tags left and he's hoarding them. ryukoposting: I know "make a tag so my random library will work!" is kind of an asinine question lol disruptek: after all, they are pretty expensive. we only use them to fix software we care about. disruptek: yours obviously doesn't rank. dom96: disruptek, stop your cheek disruptek: stop being a douchebag. ryukoposting: oooooooh suddenly I remember why disruptek is a familiar name disruptek: they guy is trying to help. eliezedeck: hmm... 1.2.0 also has the same exact graph and peak of 78KB ... Wondering if it has something to do with openssl, as somewhere at the end of the call, it calls a sslWrite in an sslLoop eliezedeck: at least, that should point to the fact that devel hasn't broken -d:useMalloc alehander92: guys i have 65k alehander92: =destroy calls ryukoposting: dom96 I promise I don't want to come off as pushy. You surely have more important things on your plate alehander92: in one small binary alehander92: is that normal disruptek: ryukoposting: i'll fork it and tag it. what's the package? alehander92: like, when i run it * dom96: ryukoposting, not pushy at all, don't worry. I just wanted to give you a workaround while the tag is made. alehander92: huh, its probably a bug because i have like super many one after another ryukoposting: disruptek, actually, come to think of it, it wouldn't be a horrible idea for me to do that myself. I've made this giant abstraction layer over the SDL2 library to make my engine work, and that library is likely to be very useful on its own ryukoposting: dom96, for sure. Thanks! disruptek: cool. disruptek: i made a tag maker because it's so hard for mere mortals to do. disruptek: !repo bump disbot: https://github.com/disruptek/bump -- 9bump: 11a tiny tool to bump nimble versions 🍻 15 13⭐ 1🍴 7& 1 more... disruptek: hope it helps. ryukoposting: ...!repo <>, interesting command. alehander92: hm sorry probably a bug in my text graph ryukoposting: !repo CEASER-DS disbot: https://github.com/ryukoposting/CEASER-DS -- 9CEASER-DS: 11Directory-based cache coherence with encrypted addressing 15 0⭐ 0🍴 alehander92: the =destroy thing ryukoposting: oh that's really cool ryukoposting: have a link to my project for my advanced computer architecture class last semester lmao companion_cube: is disbot based on the `irc` package? disruptek: yep. disruptek: !repo xs disbot: https://github.com/disruptek/xs -- 9xs: 11xstreamstartup.com 15 2⭐ 0🍴 companion_cube: ahah the `ix` package :D disruptek: the bot needed it. companion_cube: not critizing alehander92: mratsim yeah, it seems to me alehander92: the default gc doesnt use `useMalloc` ryukoposting: dom96, for what it's worth, my engine and test game run a-okay on #head, and it uses all of the new audio-related calls. ryukoposting: and I got to delete the module from my project that just has the new calls in it lol dom96: awesome :D ryukoposting: I'm hoping to have a sort of alpha version on my gitlab soon. right now, the code is littered with uses of an old project name that I need to replace, and the test game is using art I ripped from another VN so I can't really publish that disruptek: why do i have to export a symbol that i use in an imported template? disruptek: ~salewski is a cool book on nim: http://ssalewski.de/nimprogramming.html disbot: salewski: 11a cool book on nim: http://ssalewski.de/nimprogramming.html disruptek: !repo inim disbot: https://github.com/AndreiRegiani/INim -- 9INim: 11Interactive Nim Shell / REPL / Playground 15 229⭐ 18🍴 leorize: disruptek: shouldn't be needed disruptek: and yet, somehow, i am still needed. leorize: do you have an example? disruptek: !repo nimph disbot: https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 55⭐ 4🍴 7& 1 more... disruptek: the export issue? i ran into it in the compiler. leorize: ok I give up there :P leorize: usually that'd only happen if the template copy the AST elsewhere than the site of declaration leorize: you might want to employ `mixin` disruptek: i dunno anything about mixin. disruptek: the idea here is that the template is the api, not the goods it represents. leorize: can I see the template? disruptek: but i'm not working on the compiler today. disruptek: it's in my ic2 branch, filename is compiler/rod.nim and it's at the bottom. disruptek: or i can put it on stream quickly. leorize: disruptek: hmm, interesting, the template looks fine leorize: I don't really know why you'd need to export symbols when you use it then disruptek: i think i can make a macro that calls it instead. disruptek: this is probably a "feature". leorize: nah, this kind of template is used everywhere leorize: and you don't need to export symbols for it leorize: it's injected to the caller's scope afterall leorize: or do you mean that you have to export things like `.reject`? disruptek: maybe because i have an inject stmt in there. disruptek: i dunno, i'll take a closer look at it tomorrow. thanks for checking it out anyway. leorize: np :) disruptek: leorize: seems to be a problem for macros as well. leorize[m]: if you can give me some examples it'd be great disruptek: writing one now. shashlick: great - nim-regex broke non-greedy in the latest release alehander92: disruptek `mixin` is about late binding iirc shashlick: https://github.com/nitely/nim-regex/issues/61 disbot: ➥ Non-greedy ? operator broken in 0.14.0 ; snippet at 12https://play.nim-lang.org/#ix=2h5j shashlick: cc @nitely exelotl: a friend was asking what's the best way to append 2 or more elements to a seq exelotl: spent a long time searching the docs but couldn't find anything leorize: .add twice or more :P leorize: jk .add also takes an openArray exelotl: huh, I could've sworn I tried that exelotl: guess not shashlick: https://github.com/yglukhov/emacs leorize: krux02: ^ now you can make the ultimate nim emacs plugin krux02: leorize, maybe krux02: I currently need to reevaluate my priorities though. kaushalmodi: shashlick: Thanks for sharing that link.. I have reached out to that repo's author: https://github.com/yglukhov/emacs/issues/1 disbot: ➥ Want to collaborate? Varriount: @krux02 You still up? eliezedeck: @Araq, specifying `shallow` (line 212) for `data` in the `asyncnet.nim::sendPendingSslData` reduces memory usage from 350MB -> 280MB; I wonder, how many of that kind one may find in the standard library; can't the compiler know to do that automatically? it was obviously a local variable ... Behold, the quest for `shallow`ing local vars 🙂 krux02: Varriount: yes I am still up, it is not yer that late krux02: 21:47 Varriount: eliezedeck: Do you know if sink analysis would have caught it? eliezedeck: @Varriount I not sure what is "sink analysis", is that a tool? dom96: hello hello leorize: it's just a thing in the compiler that try to infer if move optimization if possible leorize: it's not a thing for oldruntime strings/seqs iirc leorize: hi dom96 awr1: @leorize thoughts on this? https://github.com/nimterop/nimterop/pull/176 disbot: ➥ Preprocessor mode fixes dom96: So let's see if I can fix this openssl bug eliezedeck: @dom96 cool ... Varriount: leorize: If a sequence can be moved, then it doesn't need to be copied. eliezedeck: but I don't think it's really specific to openssl eliezedeck: it's more something that the compiler should have optimized leorize: @Varriount: I'm not sure if it's a thing for old runtime strings dom96: eliezedeck: I'm referring to something else I think eliezedeck: there's a lot of inefficient and unnecessary copy happening dom96: #13903 disbot: https://github.com/nim-lang/Nim/issues/13903 -- 3openssl wrapper corrupts stack on OpenSSL 1.1.1f + Android ; snippet at 12https://play.nim-lang.org/#ix=2h0G leorize: @awr1: please don't process .h.in eliezedeck: oh, ok leorize: those files are usually incomplete leorize: they have to be passed through their build tools before they become valid C for consumption awr1: i only did it because AppVeyor was complaining about it awr1: but i will fix that awr1: specifically when processing PCRE leorize: dom96: do you think that our implementation of dynlib isn't adequete for android? leorize: the openssl wrapper is patchy, but I don't see any problems in it dom96: leorize: I'm not sure, the code works if I comment out the first attempt to load the "old" C function leorize: yea, sounds like that might be our problem dom96: I tried unloading the lib handle pointer dom96: didn't help dom96: I guess I can try loading the methods using the same lib handle and see if that helps dom96: any other ideas? awr1: i don't get it though, aren't the build tools executed before toast awr1: https://github.com/awr1/nimterop/blob/master/tests/tpcre.nim shashlick: hey awr1 shashlick: yet to review that PR but same feedback as leorize shashlick: i don't see the point of the changes in toast awr1: the issue is with c2nimport shashlick: and why mode = "" by default awr1: because you already have mode selection awr1: *automatic mode selection shashlick: right now, it isn't doing it at all which is why I'm debating removing c mode altogether awr1: `if gState.mode.Bl:` won't ever get followed through, unless you explicitly are like `--mode=""` to toast shashlick: since it is set to cpp and never changed by anyone awr1: c2nimport gets toast to do the preproc pass, which does it in cpp mode awr1: meaning things like `#ifdef __cplusplus` get followed through leorize: dom96: can you check if it's reproducible in environments like termux? shashlick: okay i see where you are going awr1: and c2nim doesn't play nice with `extern "C"` so by default it tries to skip `__cplusplus`, but it can't anymore because the preproc already cleaned those out leorize: then we can make a reproducible sample and it'd be easier to debug shashlick: keep c2nim aside for a minute shashlick: looking at the issue 175 submitted shashlick: the extern "C" piece is only of interest to the C++ compiler shashlick: what you are saying tho is that since the mode is default c++, we end up with the extern "C" portion that c2nim doesn't like shashlick: toast doesn't care shashlick: what you are saying tho is that c2nim can process extern "C" but I don't think it does today shashlick: ideally c2nim should be able to ignore that since many headers have that for compatibility shashlick: and more often than not, c2nim is used without nimterop shashlick: but i agree having a fix for this in nimterop will make c2nim work better in this use case leorize: what he is saying is that c2nim doesn't define __cplusplus leorize: so it escapes the `extern "C"` problem shashlick: okay makes sense shashlick: so this is finally a legitimate use case to process .h with c mode and .hpp with c++ mode shashlick: but will need a bunch of testing to verify that it doesn't really break every wrapper out there since everything has been parsed with tree-sitter-cpp dom96: leorize: I guess, but seems like a faff :) leorize: I can't really help you on this one unless I can reproduce it :P awr1: i removed the `.in` thing shashlick: can you also check if there's any hard-coded c/cpp in build and cimport that can be handled correctly? awr1: sure dom96: leorize: just grab the latest openssl and try to use httpclient.get() on an https site? dom96: oh, I think I just fixed it leorize: what lol dom96: I believe the problem is that loadLib() and loadLibPattern are called twice leorize: well according to linux dlopen, they can be called as much as you'd like leorize: the entries are ref-counted dom96: well I moved the loading of each method into sslSym and it works dom96: hopefully I'm not just getting lucky leorize: I heard that dlopen was broken on android til mashmallow leorize: but you're unlikely to be on an android version that old dom96: yeah, I'm just above that, Android 7 (Nougat) leorize: nice, nim 1.2.0 is in termux repo already leorize: dom96: openssl 1.1.1f, no prob leorize: on android termux env leorize: I use get() on https://example.org leorize: on android pie though dom96: interesting, thanks for checking dom96: #13919 disbot: https://github.com/nim-lang/Nim/pull/13919 -- 3Fixes issues with dynamic loading OpenSSL. Fixes #13903. leorize: dom96: that patch introduces more corruptions btw :P leorize: sslModule() and thisModule() caches the handles they create leorize: if you free them then they will be invalid dom96: I changed that leorize: can you have them cache? leorize: it's not cheap to open then close shared libraries, esp since they are used a lot dom96: yeah, I guess I should dom96: okay, good, it still works :) dom96: pushed dom96: looks like there is a test failure leorize: loadPSSLMethod can be make a bit simpler leorize: you can do the cast right when you use sslSym leorize: since it's still a pointer .isNil would still work dom96: why does it matter? leorize: so you don't need the weirdly named method2Proc? leorize: also I'd recommend dropping the `else`. `raise` is already a noreturn statement dom96: I disagree with you here. dom96: It's clearer this way. dom96: That I can do leorize: actually do you think sslSym can be made fatal? leorize: the other APIs just ignore when sslSym returns nil dom96: federico3, props to you, your tests just caught a bug in my PR dom96: GitHub's CI is pretty freaking awesome leorize: yep dom96: Our CI runs each file's main module tests right? dom96: Any ideas how to run those? leorize: ssl ci? leorize: https://github.com/nim-lang/Nim/blob/devel/.github/workflows/ci_ssl.yml#L85 dom96: that's just for untestable things dom96: I'd rather be part of the main CI leorize: just put it in a subfolder in tests leorize: file name starts with `t` leorize: it will be run as part of `testament all` leorize: run individual then `testament r ` dom96: yeah, but what I want to test is better being a part of openssl.nim leorize: https://github.com/nim-lang/Nim/blob/devel/testament/categories.nim#L695 leorize: we don't test lib/wrappers dom96: that sucks, I assume we've got openssl in our main CI leorize: we test the things that use openssl instead dom96: I would like to have some unit tests for openssl specifically dom96: our testing infra really needs someone's time commitment dom96: anyway, I updated the PR dom96: I guess testing will have to happen some other time leorize: you can just put it in the tests folder for now leorize: it doesn't have to be pretty, it just have to prevent the bug dom96: Spent too much time on this already KingDarBoja: Hi all leorize: gah, Nim is generating overflow checks for C unsigned types nisstyre: leorize: that doesn't sound right...maybe there's a way to disable that nisstyre: https://forum.nim-lang.org/t/3434 nisstyre: seems to imply there is leorize: nah, false alarm nisstyre: but would that disable it for signed ints too I wonder nisstyre: ah ok leorize: because some cross platform code is a bit out of date nisstyre: yeah I generally think Nim does the right thing when interacting with primitive types like that zacharycarter: https://imgur.com/a/wAq7UoG zacharycarter: cube with sokol! zacharycarter: now I can play with hot reloading shaders and also simd for the linalg module I'm composing KingDarBoja: Awesome! leorize: Araq: nim is generating range checks for importc-ed types, is this intended? krux02: zacharycarter, where do you use simd? zacharycarter: just adding it to matrix operations zacharycarter: adding SSE instructions krux02: cool krux02: is in an optimization for you existing vectormath operations? krux02: or is it custom SIMD vectormath? krux02_: I am currently trying to optimize some glm as I am totally unhappy with its performance. krux02_: got a reconnect krux02_: somehow I can't set my name back to krux02 zacharycarter: I'm porting https://github.com/HandmadeMath/Handmade-Math/blob/master/HandmadeMath.h and combining it with some of the syntactic sugar you provided in glm Recruit_main707: We don’t have any flatbuffers parser for Nim yet right? awr1: i have an algebra module that i never released, uses SSE intrins awr1: including SSE 4.1 zacharycarter: linear algebra? ryukoposting: (update on GC_ref extravaganza: maybe I should just not be lazy and redesign my audio buffer queueing) wgetch: well thanks again for the help. finally parsed this binary format that eluded me for months :P leorize[m]: looks like the 1.2 release bought a lot of newcomers here :) ryukoposting: nice ryukoposting: and every single one wants to know how to turn an array of bytes into a string wgetch: ^_^ IWSnim: But wow I'm glad I've found this lang. After doing the same in rust and in C this is a real breath of fresh air IWSnim: So thanks for the answers guys :) Rika: what was wrong with rust or C??? ryukoposting: for sure, there's always someone here to help IWSnim: Nothing really wrong with them, it just didn't click like this has ryukoposting: C is very good at a certain set of tasks that it was designed to do, and it's pretty terrible at everything else Rika: C is good if the programmer is 😛 ryukoposting: C is my job lol IWSnim: my primary lang is PHP (ducks), but I am loathe to do anything that involves sockets or bit-heavy things like protocol emulation in it Rika: quack Demos[m]: I hear modern PHP is a pretty nifty language IWSnim: Yea, it's gotten a *lot* better in the past few years Rika: companies are stubborn to update though arent they lol ryukoposting: for a long time it was the constant subject of ridicule IWSnim: sadly lots of the world is still running on ancient versions and there's so much "bad idea tutorials" out there IWSnim: like the first tutorials you find for forms + mysql are like leorize[m]: nim used to have a php backend fwiw :p ryukoposting: it's like how junior car journalists pick on the pontiac aztek, it's an easy target. PHP was every new hacker news member's punching bag Demos[m]: hmm. I almost always learn a new language by reading the manual cover-to-cover (some exceptions like c++) IWSnim: INSERT INTO users (name, password) VALUES (" . $_POST['name'] . ", " . $_POST['password'] . ")"; IWSnim: or something Demos[m]: and kinda fortran, unfortinately the manual is written in standardese and there are no resources for really learning modern fortran other then its standard Rika: `PHP was every new hacker news member's punching bag` i fear for nim IWSnim: and that's obviuosly horrific IWSnim: but that's the state of PHP tutorials. ryukoposting: nim will never be that, too fringe IWSnim: That or you go straight to laravel or Symfony and quickly explode your DB due to lazy loading ORMs Demos[m]: fun fact. I wrote a nim module that let you write that but always extracted the subs to paramaterized queries leorize[m]: you can read c++ spec cover to cover if you're crazy enough Demos[m]: oh, I know Rika: `nim will never be that, too fringe` not sure if good or not Demos[m]: (my dayjob is a c++ standard library implementer) IWSnim: Yea, I got my toy projects. I'm super excited to play around with raw sockets and implement IS-IS or something IWSnim: this looks perfect for small stuff like that Demos[m]: grrr I don't like IS-IS Demos[m]: and not just because it's the most unfortinately named protocol out there IWSnim: CLNS got ya down? Demos[m]: prefer OSPF3 Demos[m]: since open implementations are a little better IWSnim: Yea can't argue there IWSnim: I've always used quagga + BGP if I needed an appliance to peer with the network though IWSnim: like Anycast dns or whatever. IWSnim: haven't tried opsfd or whatever else is there in Zebra? etc ryukoposting: if I have a global non-ref object, is that safe for another thread to stick its fingers into, provided I handle synchronization right? leorize[m]: yes, as long as the gc is not involved, you're fine ryukoposting: pray to the nim gods that I've finally found a way to make this stupid thing not segfault ryukoposting: okay, loop 2, no explosion yet dongbei: hi dongbei: i was just wondering why they get so much praise. To me they only seem like a way to make a domain specific syntax but don't do anything super important over anything that functional programming concepts can accomplish. Hopefully someone can explain how my point of view is flawed. I don't mean to start a fight btw, just lost. dongbei: i have a question about macros and why they're important. dongbei: out of order, please excuse me dongbei: i'm still not grasping the importance of macros so I'd like some help dongbei: hi chemist leorize: dongbei: so for starters, it let you write your own features without explicit compiler support :) leorize: a big feature that's the prime example of this is Nim's async-await system leorize: implemented completely using macros, no special casing in the compiler was used, at all leorize: this also bring up the possibility of creating nice syntax and efficient code at the same time leorize: !repo weave disbot: https://github.com/mratsim/weave -- 9weave: 11A state-of-the-art multithreading runtime: message-passing based, fast, scalable, ultra-low overhead 15 134⭐ 8🍴 leorize: and if you're used to functional programming things such as pattern matching, we got you covered leorize: !repo gara disbot: https://github.com/alehander92/gara -- 9gara: 11 15 63⭐ 5🍴 Bawbby: quick q: how do i pass --threads:on for compile flags with nimble? dongbei: leorize: thank you, I'm reading about those projects right now leorize: @Bawbby: add it to your config.nims file Bawbby: never used a config.nims before, how would I do that? leorize: make a file named config.nims in your project leorize: then add --threads:on in there leorize: the syntax of this file is nimscript leorize: https://nim-lang.org/docs/nims.html leorize: you can read more over here Bawbby: alright, I'll take a look at that, thanks. KingDarBoja: Oh, TF2 engineer is here! ryukoposting: FINALLY audio queueing works, explosion-free disruptek: use .cfg instead, please. KingDarBoja: https://play.nim-lang.org/#ix=2gNh KingDarBoja: Trying to pass a generic procedure to some type procedure but getting the error on the playground (which is the same I got locally on some different setup) KingDarBoja: The procedure argument will be different procedures with different return types KingDarBoja: But those return values will be used by the generic one to perform the same operation KingDarBoja: Forgive me if I didn't make it understandable 🙈 leorize: KingDarBoja: here you go: https://play.nim-lang.org/#ix=2gNj leorize: to pass generic params with UFCS, use `[:T]` KingDarBoja: UFCS? Rika: TIL Rika: nice, been trying to figure out how to do that for so long leorize[m]: method call syntax Rika: why the weird syntax though? leorize[m]: to not be ambiguous w index addressing number_two: Hey all, congrats on 1.2! KingDarBoja: Replaced the `:int` by `:Student` (and did the same on my local code) and got pretty much same error KingDarBoja: "type mismatch: got " KingDarBoja: But expected this -> "proc (self: Classroom, someParam: int, a: proc (self: Classroom): Student{.closure.}): seq[Student]{.noSideEffect, gcsafe, locks: 0.}" KingDarBoja: I dont see the difference... leorize: KingDarBoja: int vs Student disruptek: ~news disbot: news: 11the #nim-news channel has a Nim news feed of updates to pull requests, issues, and packages. -- disruptek disruptek: supakeen: thanks for that pr. Rika: @KingDarBoja your proc that your passing returns an int, when it expects a Student KingDarBoja: 🤦‍♀️ KingDarBoja: You're right Rika: lmaoooo eliezedeck: https://play.nim-lang.org/#ix=2gL9 ⏎ @dom96 @Araq : all versions of Nim is affected by this bug, not just latest or 1.x ... I would say this is a *priority bug* (unless there is a define or something that I should use instead), and I'm wondering how this got past the 1.x ... I mean it's not uncommon to have multiple await on a single future value. I'm currently writing a program that does exactly this, and it's FromGitter: ... basically broken because only the last await will be triggered. @dom96 as per your suggestion, where in the source code should I go in order to patch this? I should be able to send a PR, hopefully. KingDarBoja: But still doing that on my code (the local one) yields something similar, I do better check again to see if I am missing something KingDarBoja: I think it is because I am trying to get the value of the passed procedure into the sequence, perhaps? https://play.nim-lang.org/#ix=2gNF Rika: one moment, ill look into it Rika: humbleSample returns a seq[proc], not a seq[T], i think you didnt call the proc is why Rika: https://play.nim-lang.org/#ix=2gNG here @KingDarBoja ksandvik_gitlab: It it deliberate that nim source files with a dash, like foo-thing.nim is considered a module? KingDarBoja: Oh... KingDarBoja: I thought the procedure was being called as soon as the parameter refering to that was called eliezedeck: @dom96 @Araq so I posted a bug report about it: https://github.com/nim-lang/Nim/issues/13889 disbot: ➥ Critical: 1 completed Future, multiple await: Only 1 await will be awakened (the last one) ; snippet at 12https://play.nim-lang.org/#ix=2gNK eliezedeck: @ksandvik_gitlab I believe so ... it seems a bit limiting too from my point of view, but I haven't written big modules yet to be hindered by it so far ... largest file I wrote so far is about 500 lines of code, I'm just beginning to use Nim now after years of not using it eliezedeck: I think, every file is a module ... or, at least, that's how I feel ksandvik_gitlab: OK, just an interesting gotcha using a '-' in a file name. eliezedeck: simply because every-file has its own context, not visible to other files, unless exported ... to me, that's a module ksandvik_gitlab: I like Nim's module system as it's not over-engineered, usually you just want a path wherefrom to import and annotate vars or functions with a *. eliezedeck: in the old days, I believe it was a convention (I might be wrong) to not use any dash or underscore for file names ... like, asyncdispatch, not async-dispatch; I suppose that is still the case nowadays eliezedeck: indeed, it's simple and convenient ksandvik_gitlab: I like something to separate meaning in file names but I could live with this. leorize: @ksandvik_gitlab: module name must be a valid identifier leorize: the restriction can be lifted, but no one really pressed it so it's there :p ksandvik_gitlab: OK, was just interesting to see that the warning was mentioned with a single .nim file with no modules, but if every file is basically a module then it makes sense. Rika: i like how nims modules are super straightforward Rika: breath of fresh air from something like pythons system KingDarBoja: Good night everyone, 😄 Rika: gn supakeen: Good morning :) Rika: good morning eliezedeck: good morning :) Benumbed: oh my god, whoever added dark mode to the docs by default, I am your biggest fan Benumbed: my eyes love you Rika: it was added on release of 1.2 eliezedeck: indeed Benumbed: I know it was added in 1.2, but someone had to make that decision and fix the docs to do it Benumbed: And I wanted to express my appreciation to that person, whomever they are Rika: devel docs were like that before 1.0.4 afaik voltist: Is there a proc/macro in the standard library that takes a string and a series of arguments, then executes the proc of that name with those args? Rika: no, but a macro is doable voltist: Ok I might give it a go Rika: https://play.nim-lang.org/#ix=2gOj how would i go by this more elegantly? Rika: `current.hitObject is HitObject` but can be `of AnySubtype` axion: That is a good case for `case` Rika: can you even case this? Rika: also youre not on mumble today axion: Nope, and won't be Vindaar: @voltist: I fixed a lot of things yesterday and it should work for you now. I haven't merged the PR yet, but will probably do it later today. I added the neural spike plots as recipes here: ⏎ https://github.com/Vindaar/ggplotnim/blob/arraymancerBackend/recipes.org#creating-a-neural-spike-plot-in-ggplotnim voltist: V1ndaar: I'm getting an error now about there not being a data scale for setting ticks or something? I will be at my computer in a bit if you want specifics leorize: @Rika: use a method Vindaar: @voltist: Did you pull the current changes from the branch? Vindaar: That error usually means that your x or y axis has no data Vindaar: which could of course be a bug Rika: leorize: all but Circle are fields, Circle's the only one that's a proc Rika: hmm Rika: okay Vindaar: @voltist: and btw why do you write my name with a 1 instead of i? And if possible add an `@` before my name, because otherwise it doesn't show up as a ping on gitter Benumbed: Um, has anyone else had problems with httpclient and HTTP 204 responses? Benumbed: When I get one, the client just hangs indefinitely Rika: what's the issue exactly Benumbed: I just said what it was ^ 🙂 Rika: yeah, that was sent before i saw the 2nd mesasge Benumbed: Extend hands, recieve HTTP 204, and hang Vindaar: oh and @axion if you wondered why I asked about your name a few weeks ago, look for instance at: ⏎ https://github.com/Vindaar/ggplotnim/blob/arraymancerBackend/recipes.org#tell-me-an-axion-story-without-telling-it-to-me-story Benumbed: I think the client's expecting to read body data when it can't, because I left a process running and it eventually fell through Benumbed: Yep, found it Benumbed: It's trying to `recvFull` on a connection that won't give it any data exelotl: @Benumbed I believe it was Yewpad who added the dark theme, but I can't see them on discord now voltist: @Vindaar Ah my fonts must be weird because it looks like a 1 to me Benumbed: Well I just had to hack the stdlib of my Nim install to get things working again, that's a first 🙂 Rika: you can submit the fix as a pr to nim's code Benumbed: Yeah, I know Benumbed: I already dropped a ticket that shows the fix, but I won't submit a PR without a test Benumbed: which means pulling the repo and figuring out all the contributor stuff Benumbed: Which I will do eventually, but not tonight Vindaar: @voltist: haha, no worries Benumbed: Hmmm it appears httpclient has no tests Benumbed: not that I can find anyway... Benumbed: NM I'm an idiot Benumbed: Ok well, now that I've found everything I'll do something about this tomorrow voltist: @Vindaar Nah still getting that error "A data scale is required to calculate tick positions!" Vindaar: can you post a paste of the ggplot call and the output of your input DF? Vindaar: by output of the DF I mean just printing the DF of course voltist: Yeah I will in a moment. Could the problem be caused by all the data points being identical? Eg, only one x value and y value across them Vindaar: oh, that's a good point indeed voltist: Oh wait no one of them is different voltist: So it can't be that Vindaar: but that could have indeed been a possible explanation, because in that case min == max, which might run into trouble somewhere voltist: @Vindaar: Code and DF https://pastebin.com/YxUrqULT Vindaar: thanks, give me a minute voltist: Of course there is only one neuron (rows on the x axis) in this data voltist: *rows along the X axis Vindaar: yep, that I think is the problem voltist: Oh? Vindaar: oh Vindaar: I was just typing up what the bug is, when I noticed that your `ylim` call is `ylim(1, -1)` Vindaar: The signature is `func ylim*[T, U: SomeNumber](low: T, high: U, outsideRange = ""): Theme` Vindaar: that's why it gets confused voltist: Ah Vindaar: I could of course determine the min and max value by comparing low and high voltist: Unfortunately the problem persists when that is changed to `ylim(-1, 1)` Vindaar: yeah, I had a bug in my recreation of your code, haha Vindaar: the point still stands though Vindaar: the problem now is that indeed it cannot determine a data scale, because neurons is 0 everywhere. There is bug though, namely that the call to `ylim` should override that scale Vindaar: Should be an easy fix Vindaar: without the ylim call the y scale is not well defined, since it doesn't have a range deducible from the data. ⏎ Well, it does, but only if one takes into account `ymin`, `ymax`, which we should, but don't right now for some reason. That's bug number 2 Vindaar: bug number 2 I was aware of though Vindaar: (that's the comment already mentioned behind the ylim call) voltist: I also had the ymin and ymax in the geom_linerange the wrong way round (1 in min and -1 in max), but changing that doesn't fix it either Vindaar: I'll fix both Vindaar: I'll let you know once I'm done. Shouldn't take long voltist: Cool dom96: eliezedeck: FWIW I and many others have written large async programs without running into this bug, so I wouldn't call it "critical" dom96: It's not common that you create a global future and then await it in an async proc eliezedeck: Well, I don't agree that "it's not common" ... and it's critical because it had fundamentally incorrect behavior for such a trivial thing ... critical also because it is already taken for granted that a future when complete must yield its value/error eliezedeck: just to give you an idea: dom96: async has been in Nim for many years now dom96: if it was common we would have seen this bug dom96: someone else would have reported it dom96: it's quite likely that what you want to implement is typically implemented differently by everyone that used async await clyybber: well, he encountered it and it was critical there eliezedeck: I'm creating a GraphQL client right now, it is supposed to be always trying to reconnect, and it should be transparent to its user whether the client is connected or not ... so: the client is allowed to send any GraphQL query they want, it's just not going to be executed until there is connectivity. So, there will be several queries `await`ing one single future (when the client is connected). ⏎ Now, tell me: how FromGitter: ... uncommon is that kind of scenario ... sure, it is debatable, but *what's important is correctness, not that it's common or not* clyybber: yeah Rika: i agree that how common something is done does not mean it is not to be considered, thats like disregarding edgecases because theyre just edgecases dom96: I'm not saying we should disregard it dom96: I am just responding to eliezedeck's comments above dom96: where they were speculating about how this could have gone past 1.0 eliezedeck: @Rika I couldn't say it better myself supakeen: @eliziedeck be careful with that, if a connection gets lost you could end up queuing a *lot* of requests that will all suddenly go through :) supakeen: I'd think about thundering herds and backpressure. eliezedeck: @dom96 I don't know how you would implement this above scenario yourself if you were on my shoes, but I sure am not going to do a lot of `sleepAsync` just to poll something supakeen: Or at least those are terms to look at :) Araq: "(I don't trust the Nim CI nowadays)." FUD machine Araq: the CI is better than ever before dom96: eliezedeck: I don't think I ever ran into a case where a client should always be trying to reconnect, you're either connected or not, if you're not connected and you want a response why not reconnect then? Why do you need to constantly be reconnecting? eliezedeck: @supakeen ... it is a native GraphQL client, for mobile device ... so, it will be coupled with a Flutter app; so, yes, I'll try to be careful not to queue many requests, thanks dom96: If you have something like an IRC client, which implements reconnection logic then you are always asking for data from the server using `recv` dom96: `recv` returns "" and you know to reconnect dom96: if you have something like HTTP, you call `get`, if the HTTP client has a connection open it reuses it dom96: if not it reconnects eliezedeck: @dom96 I'm not really good at explaining, sorry ... it's a GraphQL library (client might be misleading) ... it's using Websocket also, not POST requests ... so, it needs to be connected before it can send any GraphQL query dom96: eliezedeck: it's exactly the same when it comes to Websockets eliezedeck: right, and the goal is: Flutter app shouldn't care about it supakeen: Araq: Is there some sort of coverage report or such to easily counter that type of FUD? supakeen: Or did they mean something else. eliezedeck: it will just queue a bunch of string to execute (the query) ... the library will try to reconnect on its own, and at the same time, it will queue queries to be executed as soon as the library is connected Rika: and i think what dom is saying is that the logic for reconnecting can be written into the library dom96: eliezedeck: I'll be honest: it sounds to me like the mechanism you've fixed is not necessary, but until I see the code it's hard to say for certain. Rika: and he doesnt see the issue i dont think dom96: supakeen, Araq: every other PR I see shows the CI failing for unrelated reasons, how can I trust that? eliezedeck: @Rika it IS in the library clyybber: dom96: > it sounds to me like the mechanism you've fixed is not necessary clyybber: Do you mean the fix is not necessary? dom96: No. I mean eliezedeck's use case doesn't call for it dom96: And it's certainly not "critical" dom96: since there are alternative ways to achieve it eliezedeck: @dom96 :) well, let's agree to disagree dom96: Sure :) dom96: I want it to be fixed anyway, I'm slightly concerned about what it might break but I suppose we'll find out :) Vindaar: @voltist: ok, I pushed the fix now. ⏎ You would right now still run into trouble if you only set e.g. `yMin`, but not `yMax`, since all neurons would be `0` still and the resulting data scale would end up just taking into account `yMin`. I still need to come up with a more reliable way to allow scales of (0, 0) Vindaar: also the `ylim` does not matter in this case after all, since the bug came from the post processing phase, where the theme (which is what `ylim` is part of), plays no part. It's a thing I need to think about whether that is required. I rather have to avoid calling `calcTickLocations` in the post processing phase when the scale is invalid. But anyways, that's just internal details :) eliezedeck: let's think about those people who see Twitter post, and they say, "well... Nim v1.2.0 ... let me try that" ... oh, they are Golang programmers, used to writing codes that are awaiting on a single channel, and they end-up awaiting on a single future in Nim ... then they bang their head on the wall and they think... "well... this Nim thing is pretty unstable" ⏎ I find beauty and value in Nim, and other people should FromGitter: ... see it too ... but trivial bugs like these are *critical* in that they drive out adopters eliezedeck: @dom96 I believe we do have tests right? clyybber: yeah we do dom96: yes, but not for this issue specifically voltist: Ok I'll give it a go shortly clyybber: and I agree that its critical in this case eliezedeck: in any case, it's a PR, I trust you can assert its quality, and you're free to do whatever you want clyybber: eliezedeck: Can you split the PR up? dom96: Okay, let's stop. Arguing about whether it's critical or not is a waste of time. We'll be merging it, that's all that matters voltist: Hmmm, who would have thought that doing 30 million regex searches would take a long time... dom96: we can even back port to 1.0.x clyybber: We should, yeah alehander92: :) alehander92: morrning eliezedeck: @dom96 well, you could probably use the code in the actual bug report (https://github.com/nim-lang/Nim/issues/13889) disbot: ➥ Critical: 1 completed Future, multiple await: Only 1 await will be awakened (the last one) ; snippet at 12https://play.nim-lang.org/#ix=2gNK dom96: yes, but I want you to add it as part of your PR :) clyybber: alehander92: Morning clyybber: eliezedeck: If you are ok with it, I can create a PR with a testcase included for you (if its too much of a hassle for you) Vindaar: @mratsim sweet, even the search works! :) eliezedeck: @dom96 thank you! much appreciated eliezedeck: @Clyybber no problem eliezedeck: all I care is that Nim also has super correct behavior ... not really the PR Vindaar: @voltist: ups, I messed up an if condition. Your example should work (that's what I used to test), but other stuff broke.. voltist: Aww snap Vindaar: pushed the fix for the fix ;) Vindaar: wasn't anything complicated, just me being stupid voltist: @Vindaar I'll give it a test tomorrow as I'm having technical issues and i'd much rather have a break this evening. Thanks for all your help though! Vindaar: @voltist: no worries and you're welcome! Thank you for playing beta tester! Vindaar: enjoy your evening! krux02: Araq: your reviews of my PRs are just worthless. clyybber: krux02: The repr change is unrelated right? clyybber: @timotheecour, dom96: Should we really have both `defined(macos)` and `defined(macosx)` ? dom96: context? clyybber: https://github.com/nim-lang/Nim/pull/13892 disbot: ➥ [TODO] openDefaultBrowser now works on OSX clyybber: This line: https://github.com/nim-lang/Nim/pull/13892/files#diff-6d2a31accaa1994357340dccfeb4ba53R24 disbot: ➥ [TODO] openDefaultBrowser now works on OSX krux02: clyybber: If you have a very long sing expresiong ast and print it with repr, the output is ugly. I didn't fix repr, instead I postprocessed the output of repr to make it look good for this single use case. krux02: The postprocessing can be removed after repre works for my use case well krux02: my postprocessing eats all whitepace and reintroduces whitepsace bast on () positions clyybber: Yeah, but it doesn't really belong into the PR clyybber: I guess thats why Araq complained krux02: Araq just complained because he just wants to shit on MY PRs without actually looking into what I accomplished. krux02: Otherwise he could have provided constructive criticism, which he did not do. eliezedeck: @Clyybber @dom96 thanks for the merge ... sorry about the mixed PR, it was a really stupid thing on my part clyybber: Hey np. Its not merged yet but I opened https://github.com/nim-lang/Nim/pull/13896 and am waiting for the tests disbot: ➥ Fix #13889 with testcase eliezedeck: oh, ok eliezedeck: @Clyybber it might be better to reduce the `sleepAsync` to lower number, I'd say 10 milliseconds each should enough, so, at the minimum it will have a runtime of 20 ms eliezedeck: I'm worried 3 seconds total runtime for the test I wrote might be just too much, given the fact that we're likely to have hundreds even thousands of test to automate each time dom96: please avoid sleepAsync if you can dom96: it makes tests flaky eliezedeck: so, how would one have a delay in an async proc? that's the only one I know clyybber: Yeah, the test is 3 seconds long now, but then its also less flaky clyybber: I'm not sure how I would do it without the sleepAsync clyybber: dom96: Any idea? dom96: just do sleepAsync(1) eliezedeck: I'm wondering, how are the tests done? I'm not sure how sleepAsync is making tests flaky ... unless there are thousands of system threads all fighting for CPU cores at a given moment, may be dom96: I think you just need to yield eliezedeck: yeap, sleepAsync(1) works supakeen: Some asynchronous frameworks often offer a `await checkpoint()` or such as a macro for `await sleepAsync(0)` just to yield control back. clyybber: dom96: So I would just change sleepAsync(1500) to sleepAsync(1) ? eliezedeck: or may be, the test system's scheduler has been tuned to very large granularity ... the highest I found so far is 10 ms, and it was on a MIPS router ... eliezedeck: @Clyybber that worked for me eliezedeck: and so is `sleepAsync(0)` clyybber: But doesn't that mean that it will fail if it takes longer than 1 ms clyybber: ? eliezedeck: @supakeen so, I suppose that's `sleepAsync(0)` for Nim, right? supakeen: @eliezedeck I won't say I'm familiar enough with Nim's async system to say 'yes'. I'd assume so but you know what they say about assumptions :) clyybber: Whats the first sleepAsync for btw? eliezedeck: @Clyybber please use `sleepAsync(0)` ... first sleepAsync can be removed ... clyybber: I don't want to use sleepAsync(0) eliezedeck: the example was meant to simulate a christian belief, in Nim :) clyybber: As I don't want the test to get flaky clyybber: eliezedeck: lol eliezedeck: so, the first sleepAsync is like the savior's delay eliezedeck: the second one is just so to see who have been saved clyybber: Yeah, and the test checks the output alehander92: @eliezedeck imaginative! eliezedeck: right ... well, Nim is inspiring clyybber: ok, chronos is waiting 100 ms clyybber: So I'll be doing that too. eliezedeck: @Clyybber I think the timing is really not important eliezedeck: 0 will not be flaky clyybber: But it won't print the messages? clyybber: Right? eliezedeck: it will clyybber: Ok, I'll leave it at 50 then eliezedeck: the await sleepAsync will not return unless it has been given back control ... and control won't be back unless all previous callbacks have been processed (all 3 believers have been saved) ... well, who am I? I'm a beginner in Nim ... but that would be how other event loops act, at least, those that I have seen clyybber: I see clyybber: Thanks! eliezedeck: man, it's been a while since I wrote event loops manually in C ... my mind is rusted ... but it's ok, because we just take it for granted and just use Nim or the likes nowadays eliezedeck: thank You! eliezedeck: ... eliezedeck: question: do we have a cancellable timer? eliezedeck: or, in another way: can we cancel `sleepAsync` *efficiently* (not just let it timeout) alehander92: @eliezedeck God is inspiring :) alehander92: clyybber is there a way to control explicitly those yields eliezedeck: @alehander92 very true alehander92: :)) clyybber: alehander92: Which yields? clyybber: Ah, those. I dunno :p alehander92: the event loop giving control back etc, the seconds thing seems a bit not ideal clyybber: Yeah, but the test doesn't depend on it so its fine alehander92: not a big deal eliezedeck: without the sleepAsync after the completion, the proc will exit immediately, thus: waitFor() will exit as well, and so, the callback had to chance to execute, hence: nothing will be printed eliezedeck: *had no chance alehander92: yeah i wondered if there is a way to just wait for "n" callbacks executed or something alehander92: but this actually doesnt make a lot of sense maybe alehander92: as you test that they are executed at all eliezedeck: there is, but it would make the test file more complex eliezedeck: we could also store the futures, and check them one by one if they have `.finished` eliezedeck: but I strongly believe that the current test is not flaky dom96: eliezedeck: no way to cancel timers right now eliezedeck: ok, thanks alehander92: ook PMunch: Damn, running some stuff with gc:arc and seeing some serious memory and time improvements! PMunch: From 4.52s, 1.32Gb down to 3.14s, 1.08Gb PMunch: And I just realised I need to seriously optimise this algorithm for it to be useful for me.. kaushalmodi: @Vindaar Your ggplotnim recipes and the plots in them are music to my eyes :) I do not understand many of the plots, but I am amazed that ggplotnim can create those. Awesome work! Vindaar: @kaushalmodi you mean like plotting a periodic table? :D ⏎ Thanks, really appreciated :) kaushalmodi: hehe yep, also those neural spike plot you mentioned above PMunch: Hmm, am I missing something here or should `for x in y.toHashSet: echo x` never print duplicates? Vindaar: Hehe yes. But to be fair, the majority of the praise has to go to Leland Wilkinson for thinking up the grammar of graphics concept and Hadley Wickham for expanding it and building ggplot2 :) PMunch: http://ix.io/2gPl PMunch: On the left is the trees I have in a sequence, on the right is the hash of the node. PMunch: The hash set doesn't seem to remove the duplicates.. kaushalmodi: PMunch: I vaguely remember issues opened by @timotheecour on the topic of hash and duplicates keys, somewhere in last 1-2 months PMunch: Am I doing something wrong here? Or is the hashset module just completely broken? https://play.nim-lang.org/#ix=2gPm PMunch: Hmm kaushalmodi: .. may be it was tables: https://github.com/nim-lang/Nim/issues/13499 disbot: ➥ `==` incorrect for tables with repeated keys ; snippet at 12https://play.nim-lang.org/#ix=2gPo Vindaar: yeah, I also only remember the issue with using `add`. Hash collisions of course might happen, but seem unlikely for a small set. Also the iterator over a HashSet surely should still only contain one such hash, since in case of a collision information on hash insertion should be lost, no? PMunch: Yeah, I mean isn't the whole point of a set to only have one of each thing? Vindaar: I agree narimiran: PMunch: print `combinations` kaushalmodi: That's what I thought too, but given that duplicates are supported, I am not sure I know enough to comment on that narimiran: oooops, disregard, i haven't seen it correctly PMunch: kaushalmodi, they are supported for HashTables, which is fine PMunch: But HashSet shouldn't ever have duplicates.. narimiran: PMunch: `echo combinations[3] == combinations[^1]` gives `false` narimiran: sorry, that's `^3` narimiran: same for `echo hash(combinations[3]) == hash(combinations[^1])` PMunch: Okay, adding == that uses hash works PMunch: Okay, that fixed most of my performance issues :) PMunch: By removing all the duplicates PMunch: Man, the memoize package is really nice PMunch: 6.7s -> 0.4s PMunch: By adding a single pragma to my function :) PMunch: RAM usage also dropped from 22Mb to 12Mb supakeen: I was wondering re: consistency. Is there a preferred thing between `x == nil`, `x.isNil', `isNil(x)` etc in stdlib? PMunch: isNil is the preferred way narimiran: PMunch: nice numbers there! PMunch: I personally like `x.isNil` supakeen: Then my next PR with general asynchttpserver cleanup/features will rewrite them to isNil :) shashlick: I need to get nimterop working with arc as well PMunch: But that's just because I find it easier to read PMunch: Then again I use postfix for pretty much anything shashlick: Hopefully it will speed up toast supakeen: It's fine currently it's quite literally `if x != nil` and then 2 lines down `if not x.isNil()` :) Araq: supakeen: use != nil please supakeen: Araq: Ah. Araq: isNil could be deprecated, it's pointless PMunch: After adding in memoize and HashSet gc:arc is actually slower PMunch: Oh really? I was told once that the preferred thing was to use isNil Araq: yes Araq: it used to be the other way round :P PMunch: Ah :P Araq: but now that seqs and strings cannot be nil anymore 'isNil' should be removed PMunch: Wasn't that because it wasn't 100% clear that nil should be kept? PMunch: Why was isNil better for those? Araq: it was better for seqs because PMunch: I'm loving the seqs and strings can't be nil thing by the way shashlick: What about ref objects - I use isNil for PNode Araq: PMunch: the == for seqs is lifted from the elements' == Araq: that's problematic if the element type lacks the == PMunch: shashlick use cast[Option[ref MyType]](myObject).isSome :P PMunch: Aaah Araq: shashlick: use != nil for refs shashlick: Ok PMunch: I'm curious if a converter that casts nilable things to options would be practical PMunch: When using optionsutils for example alehander92: but so much code uses .isNil PMunch: Then you could use ?. for example on nilable types alehander92: one really needs to provide nim rewriting tool for deprecations like that alehander92: look at ast => find dot/call nodes with isNil => turn to arg != nil nodes => nimpretty render Recruit_main707: is there an easy way of converting a json node into an object? alehander92: a.to(Type) Araq: alehander92: well a single isNil template in system.nim doesn't kill us Recruit_main707: cool, and... will it work if my type has some fields which are other types?? Araq: but currently it's even a magic, silly alehander92: Araq yeah, less builtins is good alehander92: Recruit_main707 well .. all your fields have types :D Recruit_main707: but, my own types :p alehander92: it doesnt matter alehander92: yes, it should work recursively .. maybe it has limitations with case objects not sure Recruit_main707: i will try i guess Recruit_main707: thanks, and sorry for interrupting the conversation alehander92: if the types can be reasonably mapped to json, it should work alehander92: no interruption clyybber: does it still *need* to be magic? alehander92: i feel that many things can be not special anymore Araq: clyybber: nah and it hurts DrNim Araq: more special cases to consider alehander92: e.g. in system/jssys many things seem to be possible with just nim code not so much `asm` clyybber: Araq: Ok, I'll make a PR to unmagic it shashlick: Best to do that early in devel cycle and see who all break shashlick: Araq: did you see the arc related issue I commented on? Araq: no arc development will continue tomorrow, today is DrNim day shashlick: https://github.com/liquid600pgm/euwren/issues/17#issuecomment-609573188 disbot: ➥ Build fails when using --gc:arc. ; snippet at 12https://play.nim-lang.org/#ix=2gPy shashlick: No worries shashlick: I plan on porting to arc for nimterop so wanted to understand how to deal with such issues Araq: shashlick: well a stacktrace would be helpful, use 'koch temp' companion_cube: Araq: https://nim-lang.org/docs/destructors.html <-- is nim getting closer to rust? (not meant to be a loaded question) clyybber: Araq: Ok to merge https://github.com/nim-lang/Nim/pull/13896 ? disbot: ➥ Fix #13889 with testcase clyybber: companion_cube: Yes, in some ways companion_cube: interesting how D seems to follow the same path shashlick: Araq: I've attached it to that issue, should help when you get to see it Araq: companion_cube: yeah, it's definitely getting closer Araq: we're also getting some borrow checking companion_cube: with lifetime variables and everything? companion_cube: seems like a very complicated thing to do Araq: well it's simplified Araq: you can only borrow from a location that is derived from the first formal parameter Araq: seems to work out for every example I ever wanted to be able to express companion_cube: do you prevent the variable from being mutated while there's a borrow? companion_cube: seems to me you keep some runtime checks (which is valid, it's simpler than full on rust semantics) Araq: companion_cube: it depends on the mutation, I think. resizing is much more harmful than mutation Araq: no runtime checks are planned for it companion_cube: also, case types, when you borrow a field and change the tag companion_cube: as you were saying earlier Araq: true Araq: but Nim is well prepared, consider that you can pass a 'seq' to 'var openArray' (no resizing possible) or to a 'var seq' (resizing possible) companion_cube: ah nice indeed companion_cube: `var openArray` is like `&mut […]` in rust then rishavs: quick question on tables, how would I define a type for tables? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Here I want to define a custom table type., where the key is an id and the value is a room. But I am not able to find what should be the correct way to declare this type [https://gitter.im/nim-lang/Nim?at=5e8b3ffef87c5956a23e5cbb] Araq: the way you did it is fine PMunch: Found a use for `isNil`, when defining a `==` operator rishavs: Thanks Araq. Araq: PMunch: you can simply use system.`==` to avoid the infinite recursion PMunch: True PMunch: `isNil` looks nicer though Araq: good point Araq: template isNil(x: typed): bool = system.`==`(x, nil) # prevent endless recursions in clients disruptek: we support repr for runtime now? Araq: --gc:arc does support repr but uses a different implementation disruptek: okay. kraptor: noob question: varargs pragma doesn't enforce a parameter when binding against C/C++, this conforms with varargs.h but not stdarg.h, therefore having linking errors on CPP but not C... is this intended behavior? Araq: kind of, but we map .varargs to '...' so both ways are supported Araq: you need to specify the first parameter separately though Araq: proc printf(fmt: cstring) {.varargs.} kraptor: aham, what I found is in cpp + stdarg.h, that va_list requires always at least one value, but from nim side, you can call without value, therefore failing while linking... disruptek: Araq: shouldn't =destroy have a sfUsed? Araq: er ... yeah disruptek: hmm, okay. i will fix that too. disruptek: krux02: can i have your .ctags please? krux02: yes krux02: http://ix.io/2gPY krux02: I just realized I don't have the = in the regex. disruptek: =? Recruit_main707: @Araq: packedjson should probably include the normal json `to` function krux02: yes I think I said it in the stream krux02: you get false positives on forward declarations if the regex doesn't required the = sign krux02: but on the other hand if the proc declaration is really complicated with multiple lines and temple/macro expressions for the types, you might miss out on the declaration of you do include the = in the regex. krux02: there is a tradeoff, but the regex works really very well for Nim. disruptek: oh, gotcha. disruptek: thanks. Araq: Recruit_main707: PRs are always welcome disruptek: krux02: it seems no better, unfortunately. leorize: Araq: looking at the SSL issue, fixing it would mean to bump Nim's openssl requirement to 1.1 leorize: because openssl developers doesn't care about backward compatibility leorize: do we wanna bump the requirement or should I try to do it without having to bump the requirement? Araq: bump the requirement, on windows we ship the DLLs we need and Unix users are happy to constantly babysit everything krux02: disruptek, what is no better? disruptek: tags. disruptek: couldn't make it work. disruptek: very spotty performance. krux02: for me they work very well. krux02: interesting krux02: they are instant for me disruptek: i will show you onstream sometime. krux02: sorry the script you have, it generates emacs TAGS file, you should remove the -e flag disruptek: yeah, that didn't help me. disruptek: i did use your script, though. dom96: leorize: add a define like -d:insecureOpenSSL to get the best of both worlds leorize: sure shashlick: i'm still getting SIGSEGV: Illegal storage access in some builds of nimterop - no stack trace, works fine when run through gdb disruptek: yeah, i run all my arc projects in gdb. disruptek: only way to fly. shashlick: this isn't even arc - just regular gc shashlick: and has been reported on 1.0.6 disruptek: wut disruptek: nimterop? 0.4.4? shashlick: has been reported yes disruptek: whoa. shashlick: https://github.com/genotrance/nimarchive/issues/10 disbot: ➥ SIGSEGV Nim 1.2+ shashlick: went away when toast was recompiled shashlick: is failing randomly in my CI runs disruptek: might explain some of my issues. shashlick: but are you recompiling toast? disruptek: it's one way i solve this problem, yes. shashlick: okay shashlick: yep - restarted that job and it passed now gour: hello, would it be feasible to write back-end for desktop app in Nim as python extension and hen write front-end in e.g. wxpython call Nim-extensions? zetashift: @gour this might help you: https://github.com/Pebaz/nimporter kodkuce: karax has no support for websockets right? gour: thanks! gour: other option would be to do everything in Nim, but not sure what is the state of wxnim... leorize: kodkuce: karax is just for ui, use a websocket lib for websockets zetashift: friendly ping to @PMunch I think he worked a fair bit on it PMunch: Worked a fair bit on what? leorize: wxnim PMunch: Oh wxnim PMunch: Yeah I wrote genui and fixed up some bits and pieces PMunch: wxnim should work just fine, not sure why you'd want to drag Python into this.. gour: PMunch: well, wxpython is actively supported...there are several gui-options for nim, but not sure if any is production-ready? leorize: I'd say gintro and wxnim are the more solid ones leorize: the rest are incomplete gour: PMunch do you still have interest for wwnim? gour: @leorize how much of wx is covered (approx.)? gour: PMunch do you still have interest for wxnim? leorize: only PMunch can answer that :P PMunch: wxnim is essentially just a wrapper for wxWidgets, so it doesn't really require much maintenance. Only thing it could need is a couple helpers here and there to make it easier to use in Nim, but with genui I haven't really found any of those pain points. leorize: but afaict, fairly complete kodkuce: leorize: i can use websocket lib for backend but dont think i can use it for fronted UI cuz dont think it supports js leorize: !repo websockets disbot: https://github.com/niv/websocket.nim -- 9websocket.nim: 11websockets for nim 15 79⭐ 25🍴 7& 6 more... PMunch: Sorry, I was writing that. I do still have an interest in wxnim, and I make sure that it keeps working on new releases. gour: @leorize gi ntro is gtk3, right? i t wo uld be ok for linux, bu t to deliver multi-platform, i believe wx is better option PMunch: It's also automatically generated from the wxWidgets sources, so it's got close to 100% coverage leorize: @kodkuce: you gotta use native js apis leorize: it's easy to wrap them so you'll be fine gour: @leorize gintro is gtk3, right? it would be ok for linux, but to deliver multi-platform, i believe wx is better option livcd: someone please do sciter bindings already livcd: :D gour: PMunch: that's good to hear. thank you! PMunch: livcd, you mean like these? https://github.com/sciter-sdk/nsciter livcd: yeah but these do not work PMunch: I'm sure he'd accept a PR to fix them :) livcd: i am too stupid for that :-( livcd: trust me i tried PMunch: Haha gour: is ST (with vim emulation) still considered viable option to write Nim code or majority of folks moved to vscode? leorize: sublime? gour: yes leorize: well there's still a fair amount of users using it leorize: currently neovim and vscode are the more well supported ones though gour: ST4 is improving auto-completion etc. PMunch: Should still work fine with nimlsp though :) gour: PMunch: ST package for Nim uses nim-lsp? PMunch: Don't think so gour: ST community is working on st-lsp plugin zetashift: talking about nimlsp could you take a look at this PR :P: https://github.com/PMunch/nimlsp/pull/41 disbot: ➥ Add emacs for setting up PMunch: Ah, I can merge it. But I have no idea if those instructions work or not :P gour: here is it: https://github.com/sublimelsp/LSP shashlick: is it fair to say that {.header.} and {.dynlib.} cannot coexist shashlick: with {.importc.} Araq: shashlick: yes shashlick: cool PMunch: Yeah I know, that's the one I used when I was testing LSP in Sublime leorize: fun, SSL_CTX_set_min_proto_version is an actual function in libressl, but a macro in openssl zacharycarter: Hi shashlick: quick question - doesn't look like the `cCompile` mode parameter accepts objc. Is this a limitation or just an oversight? zacharycarter: I'm inquiring about nimterop - sorry for not making that clear shashlick: oversight i guess - never tried it and don't even know if it works shashlick: if you can make a PR, will gladly accept zacharycarter: Okay thanks - I guess I'm not quite sure what it does - it says it recursively searches for c / cpp files - but what I really want to have happen is for the objc compiler backend to be used zacharycarter: I'll try to figure out a way to make it happen - thanks for the clarification shashlick: cCompile is to create {.compile.} calls for c/c++ files shashlick: if you want to use a different backend, can be done with your `nim objc` call itself right? zacharycarter: Well I do want to create a compile pragma (I think) but I want to use the objc backend - even if I try calling `nim objc`, things still don't work. I'll play around with this more - clearly I'm not doing something correctly. shashlick: backend used is determined by how you call nim up front on the wrapper shashlick: {.compile.} calls the correct gcc/g++/??? depending on the file type shashlick: that's determined by Nim itself zacharycarter: ah it may just be because I'm not doing `{.passC:"-objc-arc".} alehander92: kodkuce it does iirc alehander92: i think i used it shashlick: what are valid objc file extensions? zacharycarter: m, mm and h - m is objc mm is objcpp and h for header files zacharycarter: I was able to get it to work - I just didn't have objc arc support explicitly enabled shashlick: https://nimterop.github.io/nimterop/cimport.html#cCompile.m%2C%2Cstring%2Cstring shashlick: https://github.com/nimterop/nimterop/blob/master/nimterop/cimport.nim#L527 shashlick: I can add objc search to cCompile if there's interst zacharycarter: eh I guess I just was thinking that mode did something else - so maybe don't bother unless someone else asks for it :P zacharycarter: you probably have way more important things to do shashlick: sure and given it will be untested zacharycarter: yeah that too shashlick: another question - today nimterop pulls in tree-sitter-c and tree-sitter-cpp but I only use cpp mode to parse both types of headers shashlick: of course c++ is not really supported but i'm wondering if I can remove tree-sitter-c altogether shashlick: from a wrapping perspective, do c headers have stuff in them that are invalid c++ shashlick: i haven't seen any issues raised around this and nimterop has used cpp mode as the default since the beginning shashlick: https://github.com/tree-sitter/tree-sitter-c/issues/15 is some additional context - appreciate some feedback disbot: ➥ Question: use tree-sitter-cpp all the time? disruptek: shashlick: what does it buy you? shashlick: one less package to pull, build and compile in shashlick: completely unused disruptek: i would leave it in. shashlick: comment it out? until it might be useful some day? ryukoposting: shashlick, you are the guy who develops feud, right? or is genotrance a different guy shashlick: same ryukoposting: ok cool, just double checking ryukoposting: making sure you're the right one to piss and moan to when stuff doesn't work shashlick: yep 😄 ryukoposting: this thing is really cool though, props for cooking up such an elegant design shashlick: glad to hear that shashlick: but before you get too deep into the feud plugin system, i'd recommend reading up the updated system in http://github.com/genotrance/plugins ryukoposting: I've hardly touched it, feud as-is is already 95% of what I need ryukoposting: My plan is to distribute a "project manager" program based on nigui that'll have a button for "open script file," which will open feud then use that socket thing to open the script file in the new feud instance shashlick: why not just add a project.nim plugin and it can manage projects for you shashlick: then users can run feud and say openproject xyz ryukoposting: ooooooh man, I should look into this plugin thing lol shashlick: you can add callbacks for loadproject, saveproject, etc as simple procs ryukoposting: so, how does one add a plugin to feud? or is that a question that will be answered once I dig into this plugins package? shashlick: you can start by adding a new feudCallback to an existing plugin and doing something int here shashlick: adding a new plugin is simply adding a new x.nim to the plugins/server directory and making sure it has feudPluginLoad section shashlick: see any of the plugins in that dir ryukoposting: will I need to rebuild feud to add a plugin? shashlick: this should help understand the system - https://genotrance.github.io/plugins/api.html shashlick: no feud will build it for you on startup shashlick: and if it is edited, feud will unload, rebuild and load it back ryukoposting: that's pretty sweet shashlick: you need to be careful with the objects you create and fill out the right load/unload event callbacks zacharycarter: does the plugin system you write for feud work with the arc gc shashlick? shashlick: not yet z, haven't tested it zacharycarter: hopefully I can be your guinea pig shashlick: but genotrance/plugins works across all OS zacharycarter: niceeee shashlick: unlike feud which is mainly tested on windows shashlick: so you can definitely build on it shashlick: note that the plugins system does need boehm today shashlick: so getting it to work with arc is crucial ryukoposting: I hope that, as a general rule, if a program works in the current runtime, it will work fine in arc as well. ryukoposting: Chroma may be an exception since it's dealing with a multithreaded C library at a fairly low level. shashlick: that's the hope but there might be some modifications needed, i don't have first hand experience brentp: what's the simplest way to add auth to a jester app? even a single user, single password specified on command-line. Araq: ryukoposting: there are differences but once we fixed even more bugs porting code is easy enough companion_cube: is there info on how `object` is compiled? a struct + a typeinfo field? leorize: a struct, but don't depend on that leorize: the typeinfo field only exists if dynamic dispatch is used iirc leorize: in general you should never count on Nim `object` ABI companion_cube: oh for sure, I'm wondering about the overhead and layout Araq: if you don't use 'of ...' there is no type field and it's a C struct companion_cube: oh ok, I thought you'd have to use `tuple` for that. cool. companion_cube: and if there's no `ref object` it's a value type? Araq: yes companion_cube: makes a lot of sense, thanks. companion_cube: (interesting too how crystal has similar choices) Yewpad: @Benumbed I plan on doing more design stuff regarding the docs. Glad you like the dark theme. 🙂 Recruit_main707: dom96: how can i uninstall choosenim? zetashift: remove the binary? clyybber: @Yewpad cool to hear! shashlick: Delete $HOME/.choosenim clyybber: looking forward to it shashlick: But all toolchains go with that shashlick: So copy what you need Yewpad: Don't know whether or not the design changes will be implemented in the default Nim doc gen or I'll make a custom doc gen. Reason for this is that the default Nim doc gen is so messed up that... I don't know. I can't even find words for it. 😂 But the design changes focus on readability and structure. The coloring probably stays the same. Yewpad: @clyybber clyybber: ah ok Yewpad: Something like a OFL (Open Font License) font that is more easy on the eyes etc. Yewpad: I figured that it would be better to just make a custom CSS file people can drop in their directories. I think the custom doc gen is a bit far fetched and unnecessary. Benumbed: Nice, good to hear @Yewpad 🙂 exelotl: @Yewpad oh you're alive! Discord app wouldn't let me @ you for some reason earlier :/ exelotl: Glad you're thinking about big structural changes, I think the docgen really needs it Yewpad: No no, it's not your or Discord's fault. I re-joined the Discord after I left because of some heated discussions. exelotl: Ah I see Benumbed: It would be nice to have the manual and stdlib available as PDFs, so a custom docgen [email protected] it’s uses too if it supported multiple renderers awr1: hello all zetashift: hiya Yewpad: Hm. So a custom doc gen !could! be beneficial, that's for sure. Because there's this one golden rule: "Never change a running system" and I don't want to delay any other development process in Nim's repository. And yeah, custom render frontends. awr1: nim doc gen can output json, can't it? Yewpad: And after some battle testing, the new docgen could be integrated by Nim awr1: perhaps you can develop your own site frontend for docgen Yewpad: awr1: Don't know for sure awr1: https://nim-lang.org/docs/docgen.html Yewpad: Hm, that is actually really nice. Benumbed: Hmm json to reST and MD would pretty much open up the world in terms of output Yewpad: Yeah I think a transformer could be way more better than actually touching the docgen itself. TBH I don't wanna lay hands on the docgen. Hell no Benumbed: Don’t blame you at all haha Benumbed: Ok back to work with me, while I still have work... :/ Yewpad: 😄 Araq: just touch the docgen, there is nothing to be afraid of Araq: I looked at it a minute ago, apparently it's source code disruptek: wut Yewpad: I feel like if anybody touches the docgen, everything falls apart. Like you would accidently bring your Domino imperium to collapse. 😄 Araq: feelings are overrated disruptek: especially your feelings, yewpad. Benumbed: That’s not what Star Wars taught us!! exelotl: I was thinking of making a proposal for custom headings for the existing docgen. As opposed to the predefined "Types", "Procedures", "Iterators" sections, which aren't the most human-friendly categorisation Yewpad: With pragmas? Like `{.doccat: "Parsing".}` or `{.doccat: "Encoding".}`? (doccat = doc category) exelotl: Maybe! Or with some custom rst directive Yewpad: araq: The problem with docgen is that if you make any changes to it that could cause problems, people aren't gonna be pleased. I had planned structural and even more design-specific changes. And the thing is: It is hard to please everybody. That's why I think working on a new docgen somewhere else is more practical. Otherwise, I think, we would have to build in a flags and conditions so people can do switcheroo between behavior A and B. If t eliezedeck: With `httpclient`, is it possible to send a `multipart/related ` POST request? eliezedeck: I suppose the default mode would be `multipart/form-data` Yewpad: brb, shop will close in 20 minutes eliezedeck: @Araq now comes the need for a `bodyStream` for HTTP requests :/ Araq: PR please Yewpad: Yewpad: https://cdn.discordapp.com/attachments/371759389889003532/696793526381314108/20200406_204751.jpg Yewpad: For fuck sake Yewpad: "2m safety distance" my ass lol eliezedeck: lol eliezedeck: @Araq I'll try ... again, this is *all new* to me krux02: Yewpad: I have the idea in my head to allow module scoped macros that allow you to post process en intire module. With this you could write an documentation emitter as a macro. inv2004: Did anyone trying websockets with deflate compression? inv2004: ... tried ... stefantalpalaru: Did something change in the object AST on 32-bit platforms? zacharycarter: https://gist.github.com/zacharycarter/0e97b0e88ec04ce957b3649c7fcb5f24 zacharycarter: I'm getting an error trying to access an array on devel zacharycarter: an element in an array rather zacharycarter: not really sure why... zacharycarter: oh I think I know why zacharycarter: nevermind :/ eliezedeck: when contributing changes to the standard library, how can I make the compilation faster? like only compile the changes I recently made, not build everything all over again, and of course, exclude stuffs like `nimble` and `nimsuggest` from the build disruptek: lemme know if you figure it out; i'm supposed to be adding that feature. eliezedeck: @Araq any pointers? ^ leorize: that's by default? eliezedeck: @leorize doesn't seem to be the case leorize: change whatever in the stdlib, then just compile a test file to see if it works leorize: all the nim code will be processed again, but the C code will only be recompiled when any nim code changed eliezedeck: oh, right, so I don't really have to recompile the compiler for that ... leorize: lol eliezedeck: stupid me eliezedeck: thanks @leorize :D eliezedeck: good night everyone :) inv2004: Q: how to extract last version of the package from nimble? I see --ver, but it does not help to show something about ver stefantalpalaru: Any known problems with uint64 on 32-bit platforms in Nim-1.2.0? leorize: no leorize: did you found something? stefantalpalaru: A weird heap corruption, but I don't know yet where it comes from: https://github.com/status-im/nim-beacon-chain/pull/829 disbot: ➥ Bump modules to deal with the Nim 1.2 upgrade stefantalpalaru: The "slot" field is a "distinct uint64" type. stefantalpalaru: I got a small reproducibleprogram for you: https://github.com/nim-lang/Nim/issues/13902 disbot: ➥ "distinct uint64" type corruption on 32-bit, when using {.borrow.} operators ; snippet at 12https://play.nim-lang.org/#ix=2h0c leorize: stefantalpalaru: try -d:nimEmulateOverflowChecks stefantalpalaru: No change. stefantalpalaru: It does not look like a uint wrap-around, because that resulting value keeps changing from one run to another. leorize: I'm using an older version of devel and these pass leorize: 6e0c06f50e0450522b32a1bad23a3d2a4e36e9f9 leorize: let me try to update this stefantalpalaru: Time for a Git bisection? zacharycarter: shashlick: is it possible to have nimterop define an enum as consts instead? There are some array member properties defined on types in the C code I'm binding to, and in the C code, the size of the arrays reference an enum zacharycarter: this creates problems when using `[]` and `[]=` so I tried using cOverride and cSkypSymbol but then the arrays don't have a size in the generated Nim code from nimterop leorize: nimterop always define enum as consts iirc zacharycarter: hmmm zetashift: what are you up to zacharycarter? :O zacharycarter: Hi zetashift! Working on sokol bindings right now leorize: zacharycarter: they will be distinct cint though, so you gotta convert them back to cint zacharycarter: hmmm shashlick: can you post a gist to explain? zacharycarter: sure shashlick: also which enum - if it isn't being converted, might not be recognized by the old algorithm zacharycarter: I guess it's being defined as a const but then being coerced to another type that's declared using `defineEnum` as leorize described zacharycarter: but I'll throw together that gist shashlick: you might just need to implement a converter for that to work zacharycarter: let me give that a shot shashlick: as long as the enums are converted correctly shashlick: check out nimterop/types.nim for the default converters for enums zacharycarter: thanks will do moerm: Hello everyone alehander92: :)) dom96: lol whoever came up with this crazy openssl backwards compat mechanism dom96: There is a bug in here somewhere that's causing stack corruptions Araq: hi moerm, I decided to build the SA on the "structured programming" aspects for version 1 disruptek: holy shit it works leorize: you cracked ic? disruptek: i'm so bad at this. dom96: Someone want to help me find a corruption? dom96: Could use a second pair of eyes on the implementation here: https://github.com/nim-lang/Nim/blame/devel/lib/wrappers/openssl.nim#L327 dom96: #13903 disbot: https://github.com/nim-lang/Nim/issues/13903 -- 3openssl wrapper corrupts stack on OpenSSL 1.1.1f + Android ; snippet at 12https://play.nim-lang.org/#ix=2h0G moerm: Araq Hi ;) oops, sorry was largely away ... leorize: dom96: it's simple, just look loadPSSLMethod implementation leorize: it doesn't account for both method being nil dom96: yes dom96: I fixed that leorize: the reason we need such stupid fix is because openssl is a living hell :p dom96: Noticed it too, didn't solve the problem after fixing dom96: I stepped through it in GDB and it ends up in some unknown function, which suggests to me a stack corruption leorize: dom96: https://github.com/nim-lang/Nim/blame/devel/lib/wrappers/openssl.nim#L285 dom96: I also tried to use sslModule first instead of thisModule. leorize: this is super hacky dom96: I agree leorize: but again we don't have any better choices here... dom96: we do actually dom96: but there are drawbacks dom96: which for some might be too much dom96: but we should at least give users the ability to statically tell the wrapper to link against a particular openssl version dom96: to be honest, I wonder if at this point the old API that this wrapper implements is even supported by OpenSSL leorize: it's still "supported" leorize: openssl just use C macros to redirect people to the newer symbols leorize: but they don't care about the ABI zacharycarter: hmm still having trouble with this enum array accessor issue - I tried writing a converter from my distinct int type that nimterop generated to int - but it doesn't seem to be getting called zacharycarter: so I'm still not sure how to access these C arrays that use an enum value to specify their size leorize: dom96: directly linking with openssl seems to be the only way out here dom96: leorize: yeah, that's what I'm using as a workaround dom96: had to modify the source code though :( leorize: why? leorize: if you use --dynlibOverride:ssl it should disable all of those hacks dom96: yeah, but then I cannot dynamically link dom96: I still want to link with my .so leorize: you can, just use --passL leorize: --dynlibOverride just tell Nim to not do the dlopen() dance leorize: you can decide to link however after dom96: oh really dom96: til dom96: How? leorize: --passL:"-lssl" or --passL:"/path/to/lib.so" dom96: Doesn't -lssl statically link? leorize: only if you add '-static' dom96: hm, but then I need to grab the header files into my Android project dom96: meh leorize: you don't need the headers lol leorize: you just need the .so leorize: the wrapper acts as your header already leorize: if you ship the .so next to the binary, throw in `--passL:'-rpath,$ORIGIN'` <- yes, that's a literal dollar leorize: it will tell the runtime linker to look at the current directory for .so files dom96: or I can just do what I'm doing now and reuse Nim's dynlib mechanism dom96: it's 11:30pm and I spent too much time faffing with this already :) iws: Is there some easy way to convert a uint8 to a signed int8? leorize: iws: int8(your_uint8_here) disruptek: they want an /easy/ way. iws: I tried that actually. iws: iws: [email protected]:~$ ./test iws: /home/zoey/test.nim(2) test iws: /home/zoey/bin/nim-1.2.0/lib/system/fatal.nim(49) sysFatal iws: Error: unhandled exception: value out of range: 250 notin -128 .. 127 [RangeError] iws: [email protected]:~$ cat test.nim iws: let u = 0xFA'u8 iws: let x = int8(u) iws: echo x iws: leorize: iws: well what are you expecting? :P iws: I did try to read the docus :) leorize: also don't paste iws: oh, my appologies leorize: if you want bit-reinterpretation then use `cast` leorize: cast[int8](value here) leorize: conversion like above will be subjected to bounds checking iws: Ah, I'd seen that in the source for toUnsigned template iws: I'll flip it around and see how it goes iws: oh, yea, sure enough, I should have tried that first, but I figured there was a reason not to since it wasn't in the bitops lib iws: thank you shashlick: @zacharycarter gist? shashlick: Or some test code KingDarBoja: Hi all Rika: hello KingDarBoja: ❤️ Rika: has anyone implemented a skip list in nim? moerm__: cu and have a good time everyone konsumlamm: whats the point of `|`? leorize: konsumlamm: for creating type classes konsumlamm: hmm, so that you can write multiple conditions in one line? leorize: no, for smt like this: `proc foo(i: int | uint)` konsumlamm: huh konsumlamm: is it a builtin then? konsumlamm: because its definition is just discard leorize: yea konsumlamm: ah, ok konsumlamm: i experimented a bit with it and it seems like the first time you assign something it chooses the type, is that right? leorize: yea konsumlamm: kk leorize: it's generics with constraints zacharycarter: https://imgur.com/a/WwGz3Hs - got sokol working with nimterop Rika: cant you use `or` isntead of `|` too? KingDarBoja: U can KingDarBoja: At least I have seen it working the same ryukoposting: hexchat probably moved more bytes around to send this message than your kernel needs to copy in order to make a forked page table ryukoposting: the cost comes in when you deal with the page faults caused by exec ryukoposting: but either way, you're loading something from disk awr1: https://unix.stackexchange.com/a/155020 awr1: hm awr1: so the whole memory image is COW'd ryukoposting: my *guess* is that linux probably immediately makes a copy of whatever page the bottom of the stack is currently in, since those are almost certainly going to change very quickly ryukoposting: and, if it's immediately followed by an exec in one of the processes, copying anything else would be inefficient leorize: https://github.com/rtomayko/posix-spawn#benchmarks leorize: well so instead of guessing, we can just know the difference and use whatever suits the use case best ryukoposting: the numbers illustrate exactly what I'm saying. If the linux implementation copies the entire page table, it copies the entire page table. That's a performance problem. The OSX one works fine leorize: still 2x the time though :P ryukoposting: use the faster tool when it makes sense, but that doesn't make fork() bad ryukoposting: that's the thing I'm trying to defend here leorize: well you could have just said the other use cases of fork() than trying to defend fork-exec :P leorize: openbsd got a pretty compelling one regarding security ryukoposting: no, it's the thread thing that set me off ryukoposting: totally different thing for a totally different purpose leorize: pthreads doesn't exist until posix finally gets that fork() is not a replacement for it ryukoposting: you wanna know what sets me off even more than people trying to compare processes and threads ryukoposting: people that use C for things C isn't designed to do, then complain about how bad it is ryukoposting: go write a kernel in Java, have fun leorize: C is designed to do everything, except when it isn't :) ryukoposting: that's what posix thinks at least leorize: someone even have the balls to write a kernel in C# actually, I've seen it ryukoposting: until some other language has even half the support for cross-compilation, C will always rule the worlds of systems and embedded programming leorize: zig pulled it off ryukoposting: is Zig LLVM? leorize: their aim is to dethrone C anyway leorize: yea, zig is llvm-based ryukoposting: that's the only way anyone is gonna do it within the next 10 years leorize: and yes, I do know places where llvm don't want to support :P ryukoposting: Zig makes Nim look like a well-known mainstream project leorize: gotta say, you can hate the gpl all you want, but thanks to gcc's licensing we got compilers for all sorts of weird architectures ryukoposting: good god dude Rika: `Zig makes Nim look like a well-known mainstream project` what do you mean ryukoposting: the weird abominations of ancient versions of GCC I see at work ryukoposting: Nim's not exactly a ubiquitous thing is all I'm saying. It SHOULD be leorize: to be fair, zig has shown how slow nim grow :P ryukoposting: I think nim's long beta stage was good leorize: it's rather poor marketing Rika: nim needs more media prescence leorize: our userbase doesn't even grow half the rate of everyone else Rika: presence leorize: which is the main reason why nim has so little users compared to its age leorize: 4raq solo-ed the project for several years before dom joins in iirc Rika: he's got some dedication ryukoposting: even worse marketing would have been going 1.0 with a compiler that doesn't work right, no package manager, and a miniscule support team that couldn't handle millions of scornful HackerNews comments Rika: or maybe intense disliking of other languages 😛 Rika: ryukoposting, who are you implying lmao Rika: V? ryukoposting: nobody, but that's what Nim would have been if it went 1.0 say, 2 years ago Rika: did nimble exist back in 0.18 or so? leorize: iirc nim only got a surge of contributors around 2017 leorize: 4raq was ahead of his time :p leorize: it appears that when he first advertised it on the Lazarus forums, they shunned him away ryukoposting: Rika: yes, but it didn't work great. I don't remember exactly when nimble.directory became it came long after I started using Nim around 0.17 IWSnim: New to nim...how do I turn @[84, 69, 84, 82, 73, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0] back into an ASCII string? IWSnim: I've been digging through the stdlib for quite a while now ryukoposting: oh i had to do this like 2 days ago and now I forgot ryukoposting: one sec leorize: IWSnim: a for loop should do there IWSnim: oh, then I can just use $ on the standalone to cast back to ascii? ryukoposting: is it a char sequence or a seq of bytes? IWSnim: sequence of bytes ryukoposting: if it's seq[char] then yeah I'd do import sequtils, strutils; asdf.mapIt($it).join leorize: https://play.nim-lang.org/#ix=2gGE leorize: IWSnim: ^ ryukoposting: I always forget that exists lol leorize: I'd advice against using `$` unless needed leorize: it's slow by design IWSnim: fantastic Rika: then its still the same `import sequtils, strutils; asdf.mapIt(chr it).join` ryukoposting: that's a better way to do it for sure ryukoposting: either leorize's or rika's leorize: there's a faster way but not beginner friendly IWSnim: Thank you all :) Yea, I started implementing opcodes and started on the template route ryukoposting: does it involve alloc IWSnim: nopped out of that for now :) leorize: ryukoposting: once ryukoposting: dude I love alloc so much leorize: https://play.nim-lang.org/#ix=2gGF IWSnim: but otherwise I'm loving this language. so clean :) leorize: implicitly alloc :P ryukoposting: that is the thing every new lang like nim is missing. All of them want to be so much better than C that they refuse to allow access to the very thing that makes C useful leorize: IWSnim: here's the safe but faster version: https://play.nim-lang.org/#ix=2gGG ryukoposting: IWSnim watch these 2 videos I made a while ago if you wanna learn about iterators https://ryuk.ooo/videos.html Rika: leorize: aint it time to also show off nim's new collect macro? 😛 leorize: it creates a string with the right length so you don't have to pay the cost associated with `.add` (resizing strings so it fits more) leorize: @Rika: ah, yea IWSnim: Thanks ryukoposting :) ryukoposting: so, I have a connundrum ryukoposting: conundrum? conunndrum. idk leorize: @Rika: nope it doesn't work here :( ryukoposting: I am nearly done with a beta version of a nim visual novel engine. however, I am not an artist and cannot make my proper art for a demo of the engine ryukoposting: so, do I make stick figures in MS paint, or do I go out and find an artist Rika: what??? how doesnt it work? leorize: @Rika: it requires a function with signature of proc[T](...): Container[T] leorize: obviously newString isn't one of them Rika: eeeh Rika: boo ryukoposting: also going to put together a modified version of the Kate text editor and make that into a little IDE for the engine. very excited about this, I'm gonna post some sample code of how the engine is used one sec leorize: go find an artist :) KingDarBoja: Hey guys, it is possible to get all type definitions from a module and filter (like grouping) by inherited parent object? leorize: wdym? KingDarBoja: For example, moduleA has several types that inherit from MyHumbleType and other that doesn't. I want to extract all the ones that inherit from MyHumbleType in another module and save its names in a list. leorize: well you can, though not in the way that you would expect KingDarBoja: 😛 wdym leorize: you gotta use parseStmt(readFile"/path/to/other/module.nim") leorize: then you got the entire AST to play with KingDarBoja: That sounds interesting and complex at the same time 😄 awr1: do you need `readFile`? KingDarBoja: The funny thing is that the file I want to get the types is called AST too 😄 awr1: why not pass `include` to a `typed` macro ryukoposting: whipping up a demo real quick awr1: @KingDarBoja https://play.nim-lang.org/#ix=2gGL KingDarBoja: Woaaah KingDarBoja: Clever solution awr1 KingDarBoja: Can I use that macro you made? awr1: sure thing KingDarBoja: So the input can be some module by using include, right? KingDarBoja: let x = grabTypes:include filepath ? leorize: try it I guess? awr1: i think so awr1: because it is `typed` KingDarBoja: On it awr1: and `include` is kind of like a template expansion ryukoposting: an example of the VN stuff https://play.nim-lang.org/#ix=2gGN awr1: interesting DSL ryukoposting: everything in that sample compiles into a fully-functioning game. Only major feature still in progress is audio, and I just pushed out a PR today that will get that stuff very close to completion awr1: in regards to the `if` exprs, e.g. `alice_happiness` awr1: are the layers reeavluated on certain events ryukoposting: yep, they get reevaluated when the user touches any gamevar ryukoposting: I make up the performance hit by caching images very aggressively awr1: that was the other thing i was going to ask awr1: whether this was all cached or not clyybber: disruptek: I'm probably missing something, but why not blacklist $nim from the path minifying thing awr1: do you just grab everything from images/, etc. on program boot ryukoposting: I designed the image caching thing so that I could come back and swap it out for a better one later. clyybber: getting the path to be as short as possible is a heuristic anyways right? ryukoposting: right now, it caches any image shown in the game, forever, without ever evicting any of them. So the game runs fast as hell but it's rather memory hungry ryukoposting: that's an easy thing to fix, though, since all images get cached in a common structure that's part of that `internal` variable you see in there awr1: how will text be stored awr1: plan on using something like gettext? awr1: or making something yourself ryukoposting: it uses a font texture caching system, which is set up so that certain changes (color and alpha) don't require re-drawing of the same text ryukoposting: everything sits on top of SDL2 awr1: no i mean awr1: the source text ryukoposting: oh, like how does the game get compiled? awr1: more or less ryukoposting: everything you see there is a nim macro. there's a couple of imports that go at the top of the file, and you're off to the races awr1: oh so all your strings for dialogue, etc. will be in a nim DSL? clyybber: ryukoposting: Damn nice. So thats why you added audio stream support to sdl? clyybber: the nim wrapper I mean ryukoposting: *are* in a nim DSL. All of that stuff compiles, and the game loads. you can save the game, load one, go backwards and forwards in the script, everything ryukoposting: clyybber yep ryukoposting: AudioCVT is annoying to use so I wanted something better awr1: interesting awr1: plan to handle i18n with it? clyybber: Incidentally I just finished wrapping libsndfile this minute clyybber: 😄 ryukoposting: i18n is a long term goal KingDarBoja: awr1: Sorry for the noob question but how I can pass another parameter to that macro? like change the ancestor string comparison so I can compare with different strings instead of fixed one ryukoposting: with a VN, localization is really not a task the engine can help much with. No matter what you do, the game developer is gonna have to translate their entire script. awr1: @KingDarBoja you might want to add a `static[string]` as the first parameter and leave the `typed` as the second, then you could do: `grabTypes("myType"): include blah blah` ryukoposting: that is why I have it set up so you can put every part of the game in separate files. that way, you could have a script block for each language. still thinking about ways to make that better though ryukoposting: long story short, I took on a freelancing job helping this guy make a game in ren'py, a python-based VN engine. Ren'py was great until you try to do anything beyond a couple characters on screen, and a single line of dialogue you click through one screen at a time. ryukoposting: beyond the most basic stuff, ren'py fights with you the whole way. So, I want to make a better ren'py, something with all of its strengths and fewer of its weaknesses clyybber: ryukoposting: i18n support is killer clyybber: This whole VN engine in nim thing is killer clyybber: Is it on your gitlab? ryukoposting: dude I didn't know how to use quote do: for a long time ryukoposting: and quote do: doesn't even work for a lot of these macros ryukoposting: so at least 2/3rds of the macro code is literally nnkWhatever.newTree(nnkSomeOtherThing.newTree(...)) Rika: thats most macros in a nutshell though tbh clyybber: I almost only use newTree clyybber: Instead of the helpers Rika: also still looking for a dynamic i18n pure nim library clyybber: Check out PMunchs macroutils tho ryukoposting: dumpAstGen is my best friend clyybber: its a bliss clyybber: https://github.com/PMunch/macroutils ryukoposting: the entire script: block gets compiled into a single proc definition awr1: macros are too verbose. i wish instead of `findChild`, is that child nil, etc. there was something like the `withValue`stuff you get from `tables` ryukoposting: it turns the script into a gigantic case statement, and each line has a different integer ryukoposting: making sequtils stuff work with macros would be a godsend clyybber: awr1: pssst macroutils awr1: hm? ryukoposting: I googled macroutils and a crates.io link showed up lol clyybber: I posted a link 5 mins ago I think clyybber: assuming the discord bridge hasn't bugged out clyybber: https://github.com/PMunch/macroutils clyybber: there it is again ryukoposting: Rust: the only language so bad that it's best feature is its package manager ryukoposting: Rust: C++ for masochists awr1: i'll take a look at it in a second clyybber: ryukoposting: Rust isn't bad IMO awr1: in an ideal world this would be something like how i would write that marco awr1: *more ideal awr1: https://play.nim-lang.org/#ix=2gGT clyybber: its just that it disallows some stuff that is valid code clyybber: So its overly pessimistic ryukoposting: I like the concept but it is profoundly annoying to use clyybber: yeah KingDarBoja: I am so noob at this thing, was trying to change the code to return the type instead of the string value, without success ryukoposting: everything about its compiler is lovely. its error messages are always easy to read, and super specific. It has probably the single best package manager of any language. It has an immensely expressive type system. It has wonderful metaprogramming tools. awr1: or even awr1: imagining that you could navigate down multiple nodes looking for a node, but even more concisely awr1: https://play.nim-lang.org/#ix=2gGU KingDarBoja: As I really wanted to pass a list of types to some procedure to check if they are a child of another child ryukoposting: everything about Rust should make it the best language ever, yet it is burdened with a memory management system that sounds nice until you actually try to use it KingDarBoja: Sounds crazy I know.. awr1: allright now let me take a look at this macroutils KingDarBoja: No language is the best as each one has its own use case and isn't always nice to use for everything KingDarBoja: But have heard tons of compliments about Rust and GO since last year ryukoposting: I find this one quite helpful https://play.nim-lang.org/#ix=2gGW ryukoposting: Turns a tree of statements like the one in the doc comment into something that can be processed with a bunch of procs awr1: this `macroutils` module looks interesting awr1: although for me i would like to depend less on the magic number indexing ryukoposting: these two help a lot with making easy-to-read error messages https://play.nim-lang.org/#ix=2gGZ ryukoposting: the first makes a human-friendly description of a NimNode's contents, and the other gives a human-friendly description of a NimNodeKind ryukoposting: the former being a bit more verbose since it has more information to work with awr1: right now i've been working on a nim DSL that will translate to HLSL (and possibly MSL) ryukoposting: then those two come together in this glorious 3-liner: https://play.nim-lang.org/#ix=2gH1 ryukoposting: a lot of my error-checking in my macros is just `expect node, nnkStmtList` and stuff like that awr1: @ryukoposting IMO in a more ideal macro system that should be be conveyed in the type somehow ryukoposting: dom96, any chance we can get a git tag for version 2.0.3 of the SDL2 package? I can throw the new procs into a module inside my engine for now, but having them in the actual SDL2 package feels better awr1: e.g. `proc (x :StmtList)` vs `proc (x :NimNode) = expect blah blah ...` KingDarBoja: awr1: how do you return the type (not as string but as type) on the macro you made? ryukoposting: you can do stuff like `macro(foo: string)` awr1: i don't know *precisely* how that might be done, maybe through converters possibly, which would be the site of the type check ryukoposting: if every node kind was a different subclass of some root class, it could be done awr1: @KingDarBoja you can get the type in the macro, but you can't really "return the type" as an expression KingDarBoja: Ohhh ryukoposting: how's that fancy new gc coming along by the way awr1: nim is still statically typed: you can't have a sequence consisting of different types without taking some things into account ryukoposting: yeah the tree would be NimNode, then you'd have type `StmtListNode = ref object of NimNode` ryukoposting: all the nodes would have lists of children represented as seq[NimNode], a seq of the root class awr1: My opinion would be instead of getting the macro to try and return something, have the macro itself construct the type-specific code you want awr1: @KingDarBoja gogolxdong: How to turn an array into a string variable? KingDarBoja: I see KingDarBoja: You mean join all array values into a string? KingDarBoja: Do you* gogolxdong: when put `var buf: array[16384, byte] ` into a string with `$` , it includes [] which causes some issue. gogolxdong: make a string without [] from array ryukoposting: https://play.nim-lang.org/#ix=2gH4 gogolxdong ryukoposting: or do you mean just without the [], but still the numerical values? gogolxdong: how about ``` ⏎ var x: array[3,char] = ['A','B','C'] ⏎ var y = castcstring (addr x[0]) ⏎ echo y ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e893de6d021c45cc7c5937a] ryukoposting: well, x isn't a cstring since it isn't null terminated, but if it was that'd be fine yeah awr1: you need some kind of dependent typing or contractual system for the strict StmtList thing ryukoposting: (or inheritance) awr1: that too ryukoposting: are you familiar with the new gc thing? awr1: did you watch araq's presentation on it ryukoposting: there's a presentation? awr1: https://www.youtube.com/watch?v=yA32Wxl59wo ryukoposting: dope gogolxdong: there is a issue about this casting, if array is all 0, string length will be 0. ryukoposting: "copying bad design is not good design" that is both amusing and extremely german KingDarBoja: Just tried to use the `include` on the macro and the file being refered started to show errors lol KingDarBoja: I mean, the macro is at one module, the file that calls the macro is in another and tries to load another different file ryukoposting: quick side thought: opinions on being able to import modules within a proc, and having those imports only affect code inside the proc? leorize: terrible leorize: modules can have initialization code (any top-level statement) Rika: yeah that ryukoposting: an in-proc import would only import symbols, no top-level statements Rika: im kinda missing namespaces tho leorize: ryukoposting: how are you gonna deal with `var global = newSeq`? ryukoposting: import the symbol global, with type information, but don't produce initialization code leorize: as I said, how are you gonna deal with the above? ryukoposting: And I told you exactly what I'd do leorize: now you can pass by without init a seq, but how about something with side-effects? leorize: like opening a db? leorize: do you not initialize them too? ryukoposting: put the initialization wherever it would go if the import happened at the module level ryukoposting: python does this and it works fine. assume that whatever nim would do is whatever python was doing leorize: I don't think copying python is considered good practice, but ok disruptek: this isn't possible and it would never be merged if it were impl. ryukoposting: it was just a thought, not sure how I feel about either. there were a few places in my VN engine development where putting a module import in the output of a macro would have made it easy to clean up a lot of boilerplate crud disruptek: you can do that, sure. ryukoposting: and having that import inside of a proc produced by the macro would allow the symbols to only be visible in places where they should be visible disruptek: now, that's not a thing and never will be. ryukoposting: does it just come down to how the module import system works? gogolxdong: oh , doesn't need all set 0 , only one 0 hidden in the array will truncate the length. disruptek: it comes down to how the backend works. leorize: not really a problem tbh leorize: it's doable leorize: whether we want it or not is something that's up to debate ryukoposting: I found ways around that problem, they just aren't pretty lol disruptek: would i rewrite the backend if i could? yes. leorize: python is that language that can get away with "if you don't hit this branch, it doesn't matter if it's broken" disruptek: will it be easier with my ic stuff? yes. leorize: I don't know whether bringing in a concept like this from them is sound disruptek: but that doesn't mean it's a good idea. ryukoposting: oh wow, sink is really cool. Stopped paying attention to nim's evolution when I discovered the glory of macros disruptek: cyclic imports first, then it won't be an issue. ryukoposting: god yes PLEASE leorize: once disruptek is done with ic, then you can have cyclic imports ryukoposting: give me cyclic imports and I will never update my compiler again ryukoposting: no need ryukoposting: lang's done disruptek: i don't think they are very hard, but i do think i need to change my approach to compiler code. ryukoposting: if the module system can't import symbols without importing the whole shebang, and assuming that's the reason in-proc imports wouldn't work, that could get kinda nasty leorize: it can, just whether if we want that is something else leorize: if you can write a good rfc describing the idea, then you'll get more feedback ryukoposting: I'm not sure if I want it lol disruptek: honestly, i wouldn't bother. ryukoposting: the only non-abusive use case would be shoving imports inside of procs spat out by macros to confine special symbols to that part of the AST disruptek: do you have a demonstration of a problem? disruptek: weakening the spec in pursuit of problems that don't exist is a unlikely to garner many upvotes. ryukoposting: yeah kinda figured disruptek: what we need are fewer features, not more. ryukoposting: just a hypothetical thing that kinda popped into my head while writing all these macros disruptek: yeah, i missed that feature of python, so i get it. ryukoposting: it seems stupid until you actually have a use for it disruptek: but i like that imports are more weighty in nim. ryukoposting: for sure disruptek: include is a thing. i wish it wasn't, most of the time. ryukoposting: with some code shuffling and a couple of carefully placed `include`s, I got around the issue disruptek: if it didn't exist, we'd already have seen more work on imports. shashlick: I wish more features were focused on compile time macros rather than actual compiler code disruptek: agree. i wish transform was easier to hook. ryukoposting: on the bright side, there are ways around every problem in the module system ryukoposting: if anything, the no-cyclic-imports rule forces you to think about how you organize your code disruptek: yes, but it's not ergonomic. redviking: What digital signature libraries exist for Nim? ryukoposting: not enough leorize: none, we have wrappers though redviking: Which would you recommend? disruptek: what kind of signatures? disruptek: status has like 8 different crypto libs. leorize: !packages openssl disbot: https://github.com/cowboy-coders/nim-openssl-evp -- 9openssl_evp: 11Wrapper for OpenSSL's EVP interface disbot: https://github.com/genotrance/nimssl -- 9nimssl: 11OpenSSL wrapper for Nim leorize: !packages gnutls disbot: https://github.com/FedericoCeratto/nim-gnutls -- 9gnutls: 11GnuTLS wrapper leorize: !packages gpg disruptek: !repos jwt disbot: no packages match 😢 disbot: https://github.com/ekarlso/nim-jwt -- 9nim-jwt: 11JWT implementation for nim-lang 15 11⭐ 11🍴 disbot: https://github.com/h3rald/litestore -- 9litestore: 11A lightweight, self-contained, RESTful, searchable, multi-format NoSQL document store. 15 74⭐ 2🍴 disruptek: !repo sigv4 disbot: https://github.com/disruptek/sigv4 -- 9sigv4: 11Amazon Web Services Signature Version 4 15 4⭐ 0🍴 ryukoposting: redviking, are you talking about stuff like Windows exe signing? That's something I really wish Nimble let you fiddle with ryukoposting: though I guess nimble really doesn't have full control of that redviking: I'm interested in XML digital signatures (https://www.w3.org/TR/2008/REC-xmldsig-core-20080610/). gogolxdong: Is there any AEAD implementation? disruptek: !repo sodium disbot: https://github.com/judofyr/sodium.nim -- 9sodium.nim: 11 15 6⭐ 0🍴 leorize: !repo libsodium disbot: https://github.com/FedericoCeratto/nim-libsodium -- 9nim-libsodium: 11Nim wrapper for the libsodium library 15 25⭐ 5🍴 7& 1 more... leorize: ^ that's more up-to-date disruptek: yeah, that one. leorize: redviking: I don't think we have the kind of lib to deal with that ryukoposting: is anyone here familiar with aporia? would it be a decent foundation for a little IDE for my VN engine? leorize: it'd be a terrible foundation, sadly ryukoposting: :( ryukoposting: does it work? leorize: it's written in gtk2, and unmaintained disruptek: !repo feud disbot: https://github.com/genotrance/feud -- 9feud: 11Fed Ep with UDitors 15 25⭐ 1🍴 ryukoposting: maintained or not, I'd be forking it and modifying it to fit a purpose where only very basic IDE functionality is needed disruptek: feud is what you want. disruptek: you can simply impl your needs as a plugin. leorize: yea if you're going that route, use that ryukoposting: is this a terminal editor? ryukoposting: it's hard to tell from the screenshot disruptek: what? leorize: it's a gui editor ryukoposting: nice, that's what I want. the target userbase is predominantly people who aren't software engineers by trade disruptek: the main thing is that you can get support for it. ryukoposting: I will look into this, for sure. My current plan is to use Kate as my foundation, since I already use that editor and I know how to write syntax highlighting files for it ryukoposting: all this thing really needs to do is decent syntax highlighting, and have 4 buttons: open project, save project, run game, create release package. disruptek: !repo lua disbot: https://github.com/jangko/nimLUA -- 9nimLUA: 11glue code generator to bind Nim and Lua together using Nim's powerful macro 15 43⭐ 5🍴 7& 7 more... KingDarBoja: Just noticed the macro doesn't work with ref objects, awr1 Rika: Is there a macro or library for simulating inheritance with composition leorize: inheritance with composition? leorize: can you elaborate a bit on this pattern? leorize: @KingDarBoja: should be an easy fix? Rika: uh, instead of using inheritance, i use composition disruptek: i would look at nesm for inspiration. 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⭐ 1🍴 Rika: but i'll be able to "surface" the procs that are usable Rika: on the composed object KingDarBoja: Not sure, still a newbie with all that macro stuff Rika: onto the new composed object KingDarBoja: Reading the docs looking for answers leorize: Rika: we don't have any macro like that ryukoposting: just got this really ugly error from nimble https://pastebin.com/AjF42He4 Rika: leorize, is it recommended to make a macro like that? is it even possible? leorize: it's possible leorize: I did it then I threw it away because I designed around it :P Rika: what did you do? leorize: converters leorize: lot's of converters disruptek: yuck. Rika: sounds worse leorize: that's why I threw the macro away disruptek: look at nesm. i think it will help. ryukoposting: nimterop 0.4.4 fails to build on 1.0.4, interesting disruptek: i am beginning to think that i have a weird environment. ryukoposting: nimterop 0.4.4 also fails to build on 1.0.6... disruptek: it's the simplest explanation for why i have so much trouble with nimterop, nimble, etc. ryukoposting: how do I ask the compiler which C compiler it's using? disruptek: use `please`. ryukoposting: I hope you get coronavirus disruptek: me too. i hope it happens soon, though. ryukoposting: or was that an actual answer and someone was being funny when they came up with the compiler commands shashlick: disruptek: once you give me something I can reproduce, I will fix it disruptek: i know, buddy, i know. shashlick: But I know there's a real issue disruptek: i know you realize there is a limit to patience, too. leorize: ryukoposting: std/compilesettings leorize: or just when defined(gcc) <- using gcc disruptek: that's madness. leorize: defined(clang) and defined(msvc) is valid too shashlick: Yay compile settings - need to use that in nimterop ryukoposting: well that's the problem, I have 3 different gccs disruptek: --listcmd shashlick: I extracted the plugin system from feud leorize: ryukoposting: it'll use whatever is in your PATH shashlick: But I'm yet to update feud to use it instead of the built in one shashlick: As part of making it separate, made several improvements shashlick: disruptek: one of these days, I'll get on mumble and we'll figure it out disruptek: i know it's hard for you to do much from work. disruptek: what are the improvements to the plugin system? shashlick: Heh I need to go back and check disruptek: somehow i wasn't watching it. disruptek: maybe i can use this in my streaming app. disruptek: is lqdev using it? shashlick: I don't think so ryukoposting: huh, as soon as I switched from x86_64-pc-msys to x86_64-pc-mingw64 It worked fine shashlick: https://github.com/genotrance/plugins shashlick: but i incorporated feedback from those who reviewed it ryukoposting: well, nimterop built but that git tag makes it angry disruptek: Rika: let us know what you come up with. i am in the market for a pattern with which to add object persistence and versioning and introspection. it will be similar. shashlick: ryukoposting: have some failing build logs? disruptek: shashlick: it's a big api. ryukoposting: okay how does feud build disruptek: slowly. ryukoposting: oh wait, this looks like a nimble thing ryukoposting: shashlick https://pastebin.com/FzuWHpAn ryukoposting: this isn't a nimterop thing but it's still me trying to make feud build ryukoposting: either that or I cloned the repo instead of downloading a tag disruptek: you're a madman. ryukoposting: god above what am I looking at ryukoposting: this looks like a very barebones editor which is exactly what I want disruptek: indeed. ryukoposting: does it do nim syntax highlighting disruptek: i dunno, i was never able to get it to run. ryukoposting: the zip artifact with the latest tag works fine for me disruptek: it's been 6 months since i last tried. awr1: lol awr1: https://play.nim-lang.org/#ix=2gHe awr1: this is profoundly janky but it "works" ryukoposting: I have never seen someone to their types :LikeThis ryukoposting: but I kind of like it awr1: i do it a lot because it's easier to align my types awr1: i know in some various typed lisps you have to do that ryukoposting: hey, it does syntax highlighting! It isn't great syntax highlighting, but with some tweaks it'll do the job kayabaNerve: So ARC is the main feature of Nim 1.2. Does it finally work with async and is used by default, or is still 'almost ready'? disruptek: no, no, and no. kayabaNerve: So it's not working with async, not used by default, and not almost ready, meaning it's far from ready? disruptek: "public beta" is probably the right term. disruptek: i believe it's closer to alpha, but the important thing is that people can test it with a tag that is pretty serviceable otherwise. awr1: but ya that check macro - it "works" - StmtList would fail for a empty node awr1: i would not use it in practice though awr1: in an ideal world, like i said, this would be solved with dependent types disruptek: 1.2 is a dev release, not a stable release. awr1: however the likelihood nim will ever get dependent types is low shashlick: ryukoposting: you got feud to build? shashlick: yes syntax highlighting was one of the first things shashlick: it shouldn't be trying to build tls.c ryukoposting: shashlick: no but I downloaded a prebuilt version from a tag ryukoposting: works like a champ but how do I make/add a plugin? shashlick: ok i've not built it in a while and like I said, the plugin system is old and not replaced by the standalone version ryukoposting: hmmmm shashlick: further it is windows only cause that's all i had time to experiment with ryukoposting: I'd be using it as part of a package that's windows-focused so that's perfect actually shashlick: but it is very good in practice - performant and very flexible ryukoposting: I like the socket thing, remotely controlling the editor is pretty sweet shashlick: can code in real time and plugins reload ryukoposting: that's something you can do with Sam, the editor I use when not on windows shashlick: ya with nim a lot of cool stuff is possible very fast shashlick: i stopped working on it cause i realized i don't have enough time to give it my 100% but I did extract the plugin system cause i know it will be useful for others too shashlick: what's your goal for this? ryukoposting: I want an extremely simple editing environment for people who want to make games with my engine shashlick: ok i think most of the functionality for that is in place - colors, highlighting and load/save/etc shashlick: but the main part of the experiment was to have no UI elements shashlick: everything is command driven ryukoposting: not the most approachable thing on earth, but any user could figure out how to ctrl-S ryukoposting: and I could have a separate program that opens the project, and just gives them buttons saying "open script.nim" "open screens.nim" etc shashlick: i think most of that should be possible with little change ryukoposting: the alternative is modifying Kate, which is a collossal rats nest of Qt shashlick: basically there's configurable hotkeys and aliases and a config system so you can build all that easily ryukoposting: yeah that ini is sweet shashlick: see the test script as well kayabaNerve: I thought odd numbers were dev releases. 1.2.0 is even. 1.2.1 isn't. kayabaNerve: That's why we have 1.0.2 and 1.0.4. leorize: yes? kayabaNerve: > ** 1.2 is a dev release, not a stable release. kayabaNerve: just responding to disruptek. kayabaNerve: Unless he's referring to the inclusion of ARC in 1.2 shashlick: i guess he meant that about arc kayabaNerve: It wasn't clear, but that sounds right. ryukoposting: feud is pretty sweet, perfect for what I need really ryukoposting: just need a signed version of the binary so windows doesn't yell at you when it opens lol leorize: ryukoposting: you can buy a license I guess :P leorize: certificate* kayabaNerve: Can you not sign for free? I thought you could. kayabaNerve: Either via a leaked cert or developer program. shashlick: ryukoposting - if you can figure out how to do that, will make life fantastic ryukoposting: pretty sure you can shashlick: IT is a nightmare kayabaNerve: Seems to be free https://docs.microsoft.com/en-us/windows/win32/appxpkg/how-to-create-a-package-signing-certificate shashlick: i don't know if self-signed certs are good enough Rika: `method has lock level , but another method has 0 [LockLevel]` what does this mean... axion: o/ Rika: oh hello axion: Looks like 1.2.0 doesn't break any of my code woohoo axion: Oh hey Rika. I haven't seen you on the mumble chat Rika: yeah its uh Rika: dunno really why i didnt join Rika: was watching a livestream axion: I've been mostly chatting there to varriount and krux for hte last week. so much so that i forget to say i'm alive and still using Nim in this channel :) Rika: had no doubts that you were alive lol axion: well i'm almost always there, and i made some fixes to my stream so it shouldn't flicker for you any more! Rika: wait wtf how did you discover the issue? axion: i just noticed that my refresh rate was 30hz, probably after a driver update or something axion: it's now 120 Rika: you on mumble right now? or are you about to sleep or something? axion: i'll be there for a few more hours at least leorize: axion: wait you stream? axion: Sorta axion: I mostly just share my screen and ask dumb questions leorize: when are you streaming? I'll try to tune in :) axion: I'm on mumble now and sharing on Jitsi leorize: ok, how can I tune in? :P I don't do either :P axion: gotta install a mumble client and connect to uberalles.mumbl.io axion: a few of us here use that. surprised you dont know about it :) leorize: I do, I just like chatting more :P leorize: (mainly because my spoken english is terrible) Araq: leorize, can you please fix https://github.com/nim-lang/Nim/issues/13870 disbot: ➥ Gcc cross compiler doesn't know '-mno-ms-bitfields' ; snippet at 12https://play.nim-lang.org/#ix=2gHR leorize[m]: Araq: I don't think there's anything to fix. They didn't specify the flags for the cross compiler, so the compiler ended up using the host flags leorize[m]: also without details on how they did the compilation, I have doubt it's being done correctly livcd: who is "nugatty" here ? Oo eliezedeck: Hello everyone, I seem to remember that in the old days, Nim would mangle symbol names in the final binary (or I might be wrong) ... How does one typically *obfuscate binaries* so that no names from the original symbols will be seen in the binary? supakeen: You could strip your binary, or do you want to specifically mangle them? eliezedeck: yes, completely mangle it supakeen: I'm not too sure how to mangle but perhaps you can say what you want to achieve instead of the means to achieve it? :) eliezedeck: right, so: if I open the binary file in the editor, I'll be able to see a bunch of symbol names that would indicate features that I'm using in the binary ... I want to mangle these symbols so that it is not going to be obvious, what features or technology the app might be using eliezedeck: I already found a way to obfuscate strings, symbols obfuscation is next step eliezedeck: I'm not looking for *fullproof* protection, just trying to make things not too obvious supakeen: Sure I understand, I thought stripping the binary would already resolve much of this but I might be wrong :) eliezedeck: I've already stripped the binary, but I'm still seeing stuffs, plenty of them eliezedeck: using existing C obfuscator tools might be a way, but if there is already this feature (which I remember Nim did), I prefer it to be at Nim level eliezedeck: this way also, I don't have to avoid mangling names that shouldn't be mangled mratsim: use exportc mratsim: @eliezedeck, example: https://github.com/numforge/laser/blob/master/laser/openmp.nim#L13-L25 mratsim: https://github.com/numforge/laser/blob/master/laser/openmp.nim#L207-L208 mratsim: and you can push/pop {.push exportc: myRandomName().} as well mratsim: this way you can apply that to proc and temporary variables supakeen: Hola, I've been working on writing testcases for asynchttpserver and this is my current layout: https://bpaste.net/3I3Q I'm not entirely confident in my Nim yet, does anyone have any remarks to improve/make it more idiomatic? :) supakeen: Perhaps a template or macro for the request/handler definitions inside the test procs? Rika: you got pragmas wrong Rika: {.async} should be {.async.} supakeen: Ah. Rika: you dont need to append system. in system.void Rika: aside from that i think its okay Rika: also looks like youre using testament, interesting supakeen: Rika, I run it with './bin/testament --print r stdlib/tasynchttpserver.nim' so I can run only this testcase at a time. supakeen: What is the importance of the postfix dot in the pragmas, is it part of the name or does it have more meaning? Rika: its part of the pragman syntax Rika: its required, otherwise its invalid syntax isnt it? supakeen: I didn't get any compiler errors before that change :) supakeen: (not that a lack of those proves correctness) Rika: well it seems like it works Rika: just know that ive never seen it ever in nim >= 0.20 supakeen: Things looking wrong are good remarks, looking at the other testcases they also use {.async.} so consistent++. lqdev[m]: @Rika the {.async} syntax is valid and supported, actually lqdev[m]: but yeah {.async.} is generally preferred supakeen: Is there a meaning to the postfix dot, I see some pragmas don't have one. supakeen: Or is that a mistake of the person who wrote those and should they tend to end in the dot :) exelotl: Never seen a pragma without the ending dot until today lol exelotl: I don't think omitting it is recommended Rika: i have, but on older code Rika: its not eliezedeck: @mratsim Thanks man! that's a pretty cool feature eliezedeck: @mratsim hmm... I'm not getting the intended effect ... it seems that it doesn't have any effect at all; I have tried exportc and extern, they look just the same, and the original proc name is still visible in the binary eliezedeck: *desired effect mratsim: that's strange, what if you add manually {.exportc: myRandomName().} to the proc instead fo via push/pop eliezedeck: ok, let me try ... eliezedeck: in fact, this is what I have already tried: {.async, extern: "aizaaryahooh".} eliezedeck: also {.async, exportc: "aizaaryahooh".} eliezedeck: didn't have any effect, the binary still had the original proc name, and I didn't find the "aizaaryahooh" string anywhere eliezedeck: without any extern/exportc, the binary contained 3 occurences of the original proc name, with either of extern/exportc: same thing eliezedeck: using 1.2.0 mratsim: can you try on a non-async proc mratsim: the async pragma might be rewriting the proc and dropping additional pragmas in the process eliezedeck: I'm not sure what the section of the binary is, but redacting the visible name of the proc from the binary doesn't break the program ... which begs the question: why are then these symbols in the binary in the first place? (I've already stripped the binary, using default compiler/toolchain on macOS 10.15.4) eliezedeck: Ok, I'll try, but I've also tried on a type, and it didn't have any effect either eliezedeck: yep! that worked ... dom96: Using channels on Android is like a minefield dom96: Sending enums works, as soon as I try an object variant I get segfaults on memcpy eliezedeck: @dom96 that's scary ... I'm planning to run on Android too ... I'm interested in your quest since I might take the same road as you dom96: #13880 disbot: https://github.com/nim-lang/Nim/issues/13880 -- 3Channels segfault on Android ; snippet at 12https://play.nim-lang.org/#ix=2gJi eliezedeck: thanks dom96: Android is quite painful, I don't know how easy it is when using Java/Kotlin but I've been feeling like I'm walking on egg shells for a while now eliezedeck: does this apply to 1.2.0 also? eliezedeck: I guess, a version change will probably not make a difference ... but still dom96: It's even worse with 1.2.0 :) dom96: Well, it may be better once the regressions are fixed eliezedeck: wow mratsim: I thought they were slated for complete rewrite? mratsim: like they are the one thing that prevents Araq from removing the typeinfo module mratsim: My naive guess would be that there is a sizeof issuewith variants in the channel module mratsim: or offsetof for padding dom96: probably Araq: dom96: compile with --gc:arc -d:useMalloc and run valgrind. if that works on Android at all... dom96: I cannot, I'm stuck on 1.0.6 dom96: I can try that later if I can fix the problems introduced by 1.2.0 dom96: or if my current planned workaround doesn't work out Rika: https://play.nim-lang.org/#ix=2gJv what are the advantages and disadvantages of either? exelotl: I guess it mainly depends if you're planning on using `test` in this circumstance more than once? Rika: i only have `test` for the `A` object Rika: no other one should have it exelotl: and does the loop only appear once too? Rika: not relevant though, but no it doesnt exelotl: hmm idk I guess I'd lean towards the first approach unless i was going to be adding more cases or duplicating the logic a lot. exelotl: interesting to see you catch the ObjectConversionError like that though, I'd have done something like `if i of A` Rika: ... Rika: i forgot about that Rika: me dumbo exelotl: it's nice in languages like Kotlin where you can do that and it's smart enough to know that `i` is an instance of `A` for the duration of that block. So you don't have to perform the type conversion manually Rika: its 9 pm, im supposed to be sleeping, no thoughts head empty Rika: thanks though Rika: i shall now sleep exelotl: night! Bulbasaur: :L pretty active. Perkol: So I try to download file using winim library, yet I get wrong file format https://bpaste.net/HCUQ Perkol: File bigger than it should be Perkol: What may be wrong? livcd: Why would you do it that way? Rika: Just use httpclient exelotl: @Rika that's not sleeping 😠 Rika: Hey, I'm lying down on my bed Bulbasaur: lol Rika: It'll come sooner or later Perkol: Don't want to have ssl deps dom96: That's a good reason, sadly I cannot help (and I doubt there are many other here who have winim for this). Might want to create an issue in the winim repo, maybe the maintainer can help. dom96: *others clyybber: Does nimpretty use compiler/renderer.nim? clyybber: Doesn't look like it.. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: fix this nimph bug. clyybber: @eliezedeck FYI dom96's issue has been resolved. It was not a stdlib error clyybber: But a user error clyybber: #13880 disbot: https://github.com/nim-lang/Nim/issues/13880 -- 5Channels segfault on Android ; snippet at 12https://play.nim-lang.org/#ix=2gJi dom96: yeah, still not fun spending 3 hours chasing these kinds of bugs clyybber: disruptek: Does #13876 help? disbot: https://github.com/nim-lang/Nim/pull/13876 -- 6add nimPath to nim dump ; snippet at 12https://play.nim-lang.org/#ix=2gK0 clyybber: dom96: Yeah disruptek: nope. leorize: @clyybber: nim dump already have prefixDir, so we don't need that anymore clyybber: So revert it? clyybber: Because it was created to help you with that issue afaik leorize: now just need someone to make it work without having to specify a path name leorize: clyybber: I'm pretty sure it wasn't clyybber: disruptek: Not sure if you read it last night, but I asked why you can't just blacklist $nim from the path minifying thing leorize: not that its a bad feature disruptek: because that's dumb. leorize: he wanted it to be portable clyybber: leorize: https://github.com/disruptek/nimph/issues/127#issuecomment-609297698 disbot: ➥ Path error when using choosenim ; snippet at 12https://play.nim-lang.org/#ix=2gK1 disruptek: this is just such a boring bug and everyone wants to talk about it. disruptek: find something else to work on. disruptek: this will be fixed in 10mins. clyybber: Lol clyybber: still, I wonna know 😄 disruptek: you wonna know what? disruptek: c'mon mumble so i can work while i explain it. clyybber: does it choose the path substitutions so that the paths ascii representation is as short as possible? disruptek: yes, and so you can export the cfg to other users. clyybber: disruptek: am on a pc without a mic :/ disruptek: not my problem. clyybber: disruptek: but then the cfg depends on where my nim is installed right? disruptek: i don't understand. clyybber: $nim is the compilers location, is that right? dom96: lol leorize: isn't that the point? dom96: same questions I had disruptek: jesus you guys are dense. clyybber: leorize: But isn't that bad? clyybber: Depending on the compilers location? leorize: why? leorize: no? clyybber: Because its better to depend on the projects location, no? Or is there no way to do that? leorize: I don't think you understand the problem here... clyybber: Yeah, I think so too clyybber: leorize: AFAI understood it the problem is that $nim is not the compilers actual location with choosenim, since it uses symlinks and shims, right? leorize: yes, because of nimph faulty detection leorize: that'll be fixed now leorize: it has no impact on the actual compiler leorize: just nimph clyybber: But isn't another "solution" to simply not depend on the compilers location at all? disruptek: every tool will have this problem. leorize: clyybber: you don't understand the problem :P clyybber: I just don't see a scenario where it would be benefitable to depend on the compilers location clyybber: leorize: probably disruptek: i guess you don't write code that parses .cfg files. dom96: What is the damn problem? disruptek: i tire of explaining it. leorize: nimph tries to minify the --path so that it starts at a common root, so it can be portable between system dom96: yes, but whyyyyy leorize: iirc it uses $config for the project location clyybber: I get that clyybber: yeah, thats cool leorize: $nim is just an artifact due to the faulty detection dom96: why does it use $nim to shorten the path? leorize: faulty detection of $nim clyybber: so it uses $nim to shorten the path because of faulty detection of $nim? clyybber: leorize: Or was that an appendix to your last sentence? disruptek: i'd hate to have to watch you guys debug anything. clyybber: I hate to watch you debug anything 😛 disruptek: suit yourself. clyybber: hey, at least I'm not stupid alone oka clyybber: y disruptek: yeah, you're in great company. solitudesf: what the FUCK is going on clyybber: dunno clyybber: I don't get the bug disruptek: so what? disruptek: move on. disruptek: it's a waste of time to talk about. disruptek: already fixed. clyybber: nice clyybber: is the fix online? disruptek: sure. clyybber: ok cool, so now you parse the compilers dump, and the bug is fixed. I get that clyybber: I just don't get why you have a need for the compilers location at all? disruptek: i'm okay with that. shashlick: You can import compiler as a package shashlick: So $nim is useful clyybber: ah I see clyybber: And when the path using $config happens to be shorter than using $nim it won't use it? shashlick: And nimph generates nim.cfg files so that you don't need to use Nim's code that searches nimble dir itself to figure out where packages are shashlick: Yes it will clyybber: but then its unreliable shashlick: No one will put nimble packages in the compiler directory shashlick: config will be most likely for local deps Lea-Kitty: Hi 🙂 , Lea-Kitty: Lea-Kitty: I am interested in NIM (https://nim-lang.org/) and V (https://vlang.io/), I would like to know what is the main difference between them put a by the community ? 👀 leorize: Nim exists :) shashlick: Short answer, Nim's been around for a decade+ clyybber: nim works clyybber: and V is hot air leorize: technically V does work now, with a lot of asterisks :p Recruit_main707: "it works on my machine" lang konsumlamm: also with a lot of memory leaks konsumlamm: and a lot of WIPs leorize: why does everyone keep writing Nim "NIM"? leorize: it's not an abbrevation or anything exelotl: lol it's the Lua curse konsumlamm: you mean LUA? IWSnim: hey all, I'm attempting to figure out why 1) overloading isn't working as I'd expect and 2) why I'm hitting a type mismatch for mutability IWSnim: I have a snippet here https://pastebin.com/TQccVrwk dom96: shashlick, so it's just for the compiler? dom96: you know, you can install `compiler` as a package Lea-Kitty: You mean that Nim instead of NIM ^^ compared to V is more serious about development, that V is just a dying language ? Lea-Kitty: @gitterirc Out of habit, as soon as I name a language, I put everything in bold. 😋 zetashift: @Lea-Kitty something that never was alive can't die leorize: dom96: `$nim` is the path to the compiler itself konsumlamm: V is mostly empty promises as i see it leorize: the compiler package have nothing to do with this clyybber: so dom96: leorize: yes, I know. As far as I understand nimph is using it as a hack to get shorter paths clyybber: why use $nim at all? dom96: $nim/../pkgs/blah-1.0 zetashift: there are a lot of differences between Nim and V, but the biggest one is Nim is production proven and V is still getting started, but I agree with konsumlamm, V is mostly empty promises at the moment dom96: because Nim sometimes happens to be in ~/.nimble/bin leorize: dom96: no, it's not doing that dom96: then wtf is it for? disruptek: just to confuse simps. dom96: haha, cool leorize: if you do `--path=/path/to/nim/lib/pure/ioselectors`, then it can be safely shortened into `--path=$nim/lib/pure/ioselectors` leorize: completely portable between systems dom96: why would you do that? dom96: It's already added to the path by Nim leorize: `$nim` is never used as a relative path in the `..` sense clyybber: ah leorize: dom96: no one does that, but it doesn't hurt to have the code dom96: lol leorize: he has the code to convert it one way, doesn't hurt to do it the other way as well clyybber: So why does it end up in kungtottes cfg? dom96: if no one uses the code then yes it does hurt to have it leorize: esp since it saves parsing time dom96: it's just untested code that will rot leorize: @clyybber: the compiler path is detected as this: `~/.nimble` clyybber: Ah leorize: was* clyybber: gotcha disruptek: that's just how the bug was /found/. disruptek: the real problem is that config parsing is broken unless you know the true path to the compiler, which is obscured by choosenim's hack. disruptek: 😜 clyybber: What will end up in kingtottes config now that its fixed? disruptek: on 1.0.6? $home/.nimble/pkgs/... disruptek: on 1.2? $nimbledir/... clyybber: Ah cool clyybber: Thanks I get it now clyybber: sorry for being annoying bro disruptek: because he doesn't use choosenim anymore. 🤣 Zevv: disruptek: how do I unsubscribe a disbot channel? disruptek: a what? Zevv: radio thingy disruptek: i think it's `detune`? disruptek: notune, untune, detune. Zevv: okay! Zevv: thanks for that disruptek: lemme know if it works. Zevv: okay! Zevv: it says "okay!" disruptek: yeah, i don't trust that mofo though. Zevv: better safe then sorry, right dom96: so you're not actually putting `$nim` into nim.cfg files, would have saved us a lot more trouble if you just made that clear ;) disruptek: yeah, it's all my fault. disruptek: whenever you don't understand something, just blame someone else. shashlick: Ok so what next shashlick: People asking questions to understand != blame shashlick: They actually care else they wouldn't ask disruptek: it's just noise. shashlick: It got us a fix :p disruptek: now fix the rest of the tools. dom96: This is what I was concerned about FWIW, maybe I misunderstood it completely but it sounded like shashlick was saying that nimph uses something like: --path:$nim/../pkgs/blah-1.0 because "It's shorter" dom96: https://irclogs.nim-lang.org/04-04-2020.html#23:13:20 dom96: and disruptek wasn't disagreeing leorize: this is the loss of data in communications :p leorize: they were talking in the context of the bug leorize: the detailed explaination is there if you wanna read shashlick: Nimph is shortening yes but $nim wasn't right sure to choosenim symlinks - he has fixed this in nimph but the issue persists if anyone assumes that $nim can be found using findExe clyybber: shashlick: I don't understand. It is fixed in nimph now, and its not using any workarounds. So theres nothing anymore to fix in choosenim right? shashlick: My last message leorize: this is a tooling problem clyybber: Hmm, IMO thats no ones problem. findExe can't find $nim . clyybber: not a problem really clyybber: get $nim from nim dump leorize: well how else are you supposed to find it when the compiler code does exactly that? :) disruptek: hard to parse configs without this information. clyybber: leorize: Were you replying to shashlick or me? leorize: the old detection code was based on how the compiler does it itself iirc leorize: you clyybber: the compiler does findExe? leorize: getAppFilename() leorize: because it knows exactly where it is :P clyybber: Yeah. So it doesn't do findExe clyybber: So it doesn't have the shims problem clyybber: Problem solved? disruptek: it's never a problem for the compiler. clyybber: Yeah disruptek: it's a problem for any other tool that wants to parse a config. disruptek: for the 10th time... clyybber: They should use nim dump clyybber: for the 2nd time... disruptek: "they" are. where "they" are nimph. leorize: clyybber: do you know that nim dump don't get you the path unless you pass in some undocumented flags? :) clyybber: So document them :p liblq-dev: shashlick: does nimterop support ARC? clyybber: choosenim doesn't really have an alternative afaict disruptek: rename. dom96: rename? shashlick: Not yet - the last few times I tried, it r crashed dom96: rename what? clyybber: rename the binaries I guess disruptek: or a directory. liblq-dev: shashlick: right. I just had a bug report on euwren from a user trying to compile it under --gc:arc, I'll let them know that nimterop doesn't support it yet dom96: elaborate disruptek: nope. leorize: dom96: https://github.com/disruptek/nimph/issues/127#issuecomment-608991164 disbot: ➥ Path error when using choosenim ; snippet at 12https://play.nim-lang.org/#ix=2gK1 leorize: though please don't argue there :P clyybber: IMO findExe simply shouldn't be used for that purpose, until it gets an option to follow symlinks leorize: or you can use expandFilename(findExe) leorize: :P clyybber: AFAICT findExe even has an option to follow symlinks clyybber: And its on by default disruptek: i'm told it doesn't work on windows. clyybber: Yeah, but kingtotte wasnt on windows leorize: well can we just rest the issue now? disruptek: i'm not going to guess at what code works there. leorize: it's fixed. shashlick: Renaming directories for choosenim is an option but then you need to add two directories to path clyybber: leorize: Yeah, but it may have surfaced an issue with findExe dom96: As far as I can tell Araq's suggestions doesn't work when you want to only add ~/.nimble/bin to the PATH dom96: and then what, you want me to add a new PATH entry for each Nim version I install? leorize: @clyybber: choosenim uses shim binaries everywhere fwiw dom96: I can't see how else that can work shashlick: No add a second path and rename toolchains to that dir clyybber: leorize: Oh, I was under the assumption that it used symlinks on posix shashlick: It is symlinks on posix solitudesf: no? dom96: is it? clyybber: shashlick said so :p dom96: shashlick, hrm, that could work shashlick: But that's a second directory added to path shashlick: Will be third if you consider gcc ryukoposting: just realized that building Kate would require me to install 40GB worth of Qt crap, a special version of cmake, and another build tool that sits on top of that, then string all of that stuff together perfectly so that it all works perfectly ryukoposting: guess I'm using feud as the development environment for my engine shashlick: But everyone else using Nim without choosenim already add more dirs to path leorize: ryukoposting: now you know why qt stays with C++ devs exelotl: lol Qt is tragic dom96: shashlick, yeah, not sure it's worth it dom96: The way Nim handles paths is hacky already IMO ryukoposting: I really like Kate, it gives a nice balance of np++'s simplicity and vscode ryukoposting: 's featureful-ness ryukoposting: but sweet jesus the code that makes it tick dom96: findExe cannot always work because of how Unix package managers install it for example clyybber: shashlick: So is it symlinks on shims on posix now? dom96: so there are special cases for that exelotl: the software made with Qt is so nice and lightweight... but I don't have that many gigabytes to spare on my hard drive clyybber: dom96: WDYM? leorize: it's still more lightweight than electron, fwiw dom96: clyybber: /usr/bin/nim and stdlib is /usr/lib/nim, so stdlib isn't in $nim/lib ryukoposting: it's a good thing I'm doing this on windows, my windows drive has that space available but my linux disk? hell no clyybber: dom96: Ah gotcha, I was thinking that you were talking about a problem with findExe dom96: clyybber: unless something changed it should be shims on all platforms. deech: Does anyone here care about high level Nim binding to FLTK? I've done it for Haskell and found it quite nice. deech: I know it's not Qt. leorize: its never hurt to have more libraries :) exelotl: yeah that would be neat @deech leorize: I kinda hope that we would have something that's as lightweight as LCL clyybber: dom96: k, thx for clearing it up deech: FLTK is and LCL is hard to use on macos leorize: yea but LCL is native and I like that :P exelotl: where can I find out about lcl? shashlick: I think the current solution is good - don't assume where the compiler is shashlick: We can change choosenim if there's other real issues with shims and symlinks shashlick: Else there are better things to do leorize: @exelotl: https://wiki.freepascal.org/LCL clyybber: shashlick: choosenim isn't using symlinks ryukoposting: what do other tools use? e.g. multirust shashlick: Ok maybe, I thought it was symlinks there ryukoposting: if there's no good solution, copying someone else's bad solution at least gives you a scapegoat shashlick: @ryukoposting: looks like feud it is - I can commit to work on porting it to use the plugin system package and help getting it to compile on windows clyybber: ryukopositng: I think they do the rename approach ryukoposting: shashlick, how were you compiling it before? dom96: IIRC they use shims leorize: shims are used by chocolatey since forever :P dom96: well, rustup does shashlick: There's a nimble task dom96: not sure about multirust ryukoposting: well I have multirust so I guess I can find out real quick shashlick: I think nng might have changed causing that failure clyybber: multirust is deprecated btw ryukoposting: o shashlick: @liblq-dev: I don't think that issue is a nimterop issue with arc ryukoposting: shows how long it's been since I used rust shashlick: Need to try and check leorize: @clyybber: how's your ryu port? leorize: have you managed to clean it up? dom96: https://github.com/rust-lang/rustup#how-rustup-works Zevv: disruptek: well,there you have it. it says "okay!" but didnt do it dom96: yep, I copied rustup :) ryukoposting: sounds good shashlick. Is feud dependent on a particular toolchain? I plan to use mingw64 leorize: shashlick: I'm kinda out of ideas now. nim.cfg in the project dir can't be honored by my way of doing nimble -> nims clyybber: leorize: Cleaned it up, but didn't change semantics disruptek: Zevv: i knew it. shashlick: @ryukoposting ya I was using mingw too ryukoposting: sweet shashlick: @leorize I'm secretly considering adding the compiler back into nimble ever since I discovered $nim clyybber: don't leorize: don't shashlick: Using compiler as a nimble package didn't work since you could have different versions dom96: yeah, don't shashlick: But $nim fixes that shashlick: There will only be one ryukoposting: btw where did "Fed Ep with UDitors" come from? leorize: I consider the compiler unstable for any inclusion into any program disruptek: Zevv: it looks like it worked. shashlick: I was fed up with going back and forth looking for a good programming env shashlick: Vscode is too fat, but I've compromised with it since I mostly use remote ssh now which works well dom96: shashlick, how does it? ryukoposting: for the record, I like the idea of having a $NIMPATH environment variable or similar, that just points to a particular nim/bin. Nimble knows to call the compiler from that, and you leave it up to the user to configure their $PATH as they please shashlick: When you add --path:"$nim", then import compiler/options will import the active compiler's instance of the file leorize: ryukoposting: how are you gonna call nim without nimble? ryukoposting: the user is instructed to put it in their PATH if they want it leorize: shashlick: that's quite a hack tbh shashlick: So there's no scenario where you have a new options.nim being built by an old compiler.exr dom96: shashlick, what does that solve? You'll get whatever Nim the user has, which may be 1.0.6 or it may be 0.8.0 leorize: ryukoposting: or you could just put it in their PATH for them :P shashlick: Ya and nimble will be built with that clyybber: Why? shashlick: What's the harm - it's not like nimble lives outside the nim directory ryukoposting: yes but then they might fiddle with their path so there's multiple nim.exe's in it. now what does choosenim do when they ask it to switch versions? clyybber: Why not use the abstraction "executables" given to us by the os shashlick: When you change your compiler version, you use a new nimble with it leorize: ryukoposting: it just swap out the shims? leorize: it knows where they are clyybber: shashlick: Maybe we don't want that? ryukoposting: what I was proposing gets rid of shims entirely dom96: shashlick, what does it actually solve? shashlick: That's how it works today too dom96: from my perspective it is just like we had it before shashlick: You can nimble install nimble no doubt but almost no one does that dom96: and even worse since the compiler source code isn't pinned shashlick: The issue in the past was that there was the nim compiler and a compiler package in nimble pkgs which conflicted ryukoposting: nor would a "use-a-separate-env-variable" solution require symlinks. It'd be elegant, if not the most tightly integrated thing on earth leorize: ryukoposting: oh, the proposal was much simpler: have a ~/.choosenim/nim-current directory, which will be in PATH, then rename ~/.choosenim/nim- into that directory everytime a version switch is requested ryukoposting: I'd prefer shims over that clyybber: what? dom96: shashlick, the issue was that Nimble was compiled against a Nim version that mismatched the one that was installed leorize: I'd prefer shims over the environment variable mess too :P clyybber: I'd prefer renaming ryukoposting: ok so we're back to chims clyybber: No, why not rename? clyybber: Theres no reason against it so far leorize: to be fair, the current solution works :P dom96: yeah, the current solution is there already clyybber: Yeah, but it could be cleaner dom96: there isn't really a good reason to change clyybber: True shashlick: I'll fine with leaving it as is ryukoposting: question: what happens on unix vs. windows when a process starts with some path /x/y/z in its $PATH, then /x/y/z get renamed to something else and some new directory gets named /x/y/z ryukoposting: that would decide whether renaming makes sense shashlick: The issue was with compile failures though shashlick: Cause you could have an old compilers package sitting in pkgs dom96: ryukoposting, that's a good point. Windows will screw you up: if a .exe is running you cannot move it IIRC so this may prevent renames leorize: unless the exe was opened with FILE_SHARE_DELETE, which 100% of windows programs don't do ryukoposting: if it just tells you "no" that's fine, then just tell the user "no, wait until this other thing is done" clyybber: is someone on windows here? dom96: so there is your reason for not doing renames ryukoposting: currently yes clyybber: I wonder if it applies to renaming the parent folder clyybber: or if it only applies to renaming the exe itself ryukoposting: my main toolchain is x86_64-pc-msys clyybber: ryukoposting: Can you check? ryukoposting: aight let's find out ryukoposting: one sec deech: leorize, if you like native doesn't WxWidgets already get you there? dom96: Even if it works, this isn't enough to convince me to switch to this mechanism. The current way works pretty well. leorize: @deech: it's heavyweight, and the Nim API for it is ugly leorize: though PMunch's genui pretty much solved that ryukoposting: no, windows will not let you do that clyybber: thanks for testing clyybber: heh, someone tell Araq leorize: I'm thinking of making a genui-like thing for karax actually leorize: so I can build the dom and get whatever `Node` that I want dom96: hah. Already posted on that thread leorize: complete control over the state :P Recruit_main707: btw what happened with the online talks? deech: leorize, seems there's some initial work on genui+karax? https://github.com/PMunch/genui/tree/master/genui/platforms/karax dom96: So I now have the prospect of linking openssl on android. This does not sound like fun. leorize: deech: that's for generating the vdom deech: leorize, ah, got it. leorize: Araq said that my best bet of actually having Components is to use a Node leorize: because the dom have a state and you gotta accept that fact :P deech: This is part of the Svelte approach I think. ryukoposting: leorize if you want macros that turn ui-definition language into stuff that you can make a proc for, I've spent 3 months doing that for Chroma leorize: ah, mine is gonna be simpler leorize: just the karax ast, but output a Node clyybber: I should be able to rely on fspSet/Cur/End being the same SEEK_SET/CUR/END right? deech: I think Nim can do Svelte better than Svelte. :) ryukoposting: man, I didn't even think to look at karax first lol leorize: then I can have the same syntax as genui: `variable % tdiv` and I'll have the Node for tdiv in my variable leorize: this allows for easier tinkering :) leorize: @deech: Araq actually tried, he gave up in the end though, because you gotta wrap every type in React[T] wrappers ryukoposting: it actually looks very similar to an earlier iteration of Chroma's ui language. I moved away from command-style syntax like that the karax sample uses, and went to assignments leorize: deech: https://github.com/pragmagic/karax/blob/master/karax/reactive.nim ryukoposting: so instead of button: text "hello", it's button: text = "hello" ryukoposting: I'm not enough of a web guy to know what any of this stuff is lol ryukoposting: my entire website is hand-written HTML and CSS without a single line of JS leorize: ryukoposting: you should still study them leorize: they open a pretty interesting path for native ui ryukoposting: I've used JS plenty, granteds ryukoposting: granted* ryukoposting: my current job (which I'm leaving soon! oh boy) uses it to make our android apps scriptable, so I maintain this entire JS interpreter tangle that's mashed together with an android app leorize: lol ryukoposting: this was not my idea ryukoposting: had I been around, I would have made it clear how stupid of an idea that is ryukoposting: I wonder if my ladder logic nimble package will ever be used ryukoposting: I made that so I could prove to my employer that Nim could work as a replacement for IEC 61131-3 leorize: was he convinced? ryukoposting: the ones who understood what a Nim macro is, and what the compiler does to make them work, were seriously impressed leorize: how about the people that actually makes decisions? :P ryukoposting: nah they didn't care leorize: lol ryukoposting: I still used nim to made a makefile generator that we use for at least one codebase ryukoposting: did that under their noses leorize: once you left they will pluck that out for cmake, guaranteed ryukoposting: I don't have my hopes up for getting nim into my new workplace though. Defense contractor, and a big one at that ryukoposting: nah they'll never use cmake ryukoposting: we have one software engineer who pretty much runs the show, dude's a soviet union expat who lived in isreal for a while as a kid, then in canada, then came to the US ryukoposting: he wrote the kernel we use on nearly all of our products, and his name is on the patent for said kernel. management knows he knows more than they do, and they know he's worth millions to the company leorize: damnnnnnnn ryukoposting: and he HATES cmake ryukoposting: he sees it as a non-solution to a non-issue leorize: yes, but is he gonna write his kernel in nim? leorize: did you manage to impress him enough? :P ryukoposting: I showed it to him. His earliest professional work was with Borland so the Pascal influences helped ryukoposting: or, sorry, not borland, delphi ryukoposting: he's been a DOS guy since the very beginning disruptek: leorize: are you alive? disruptek: can you come on the stream? ryukoposting: me and this guy are good friends now, couldn't have found myself a better mentor in the beginnings of my career. leorize: disruptek: I'm on the stream leorize: what's up? awr1: @exelotl @supakeen i think the pragma ending dot omission is unlikely to be removed at this point leorize: it's not a bug, it's an actual feature leorize: but tbh, `{. .}` looks better :P supakeen: awr1: Sure, but for now I'll use the ending dot like the rest of us :) awr1: i remember there was an issue about a while ago and i think dom or araq said that it wasn't going to be removed leorize: yea, it's a part of the actual grammar awr1: yes exelotl: what if we got rid of the leading dot too? 🤔 exelotl: then I guess it conflicts with the Set syntax leorize: `{ }` is the set/array construction syntax awr1: there have been people before that have argued for the pragma syntax to be changed awr1: but idk awr1: pragma syntax is fine exelotl: yeah it's fine how it is supakeen: Interesting. supakeen: Wonder if this is intended, setting a custom Content-Length on a response makes httpclient's body that length even if there was more data :) supakeen: I can understand why, but a thought. leorize: the less you send, the faster it becomes supakeen: https://github.com/supakeen/Nim/blob/add-asynchttpserver-tests/tests/stdlib/tasynchttpserver.nim supakeen: I really need to get rid of the repetition :( leorize: supakeen: write a template :) supakeen: Yea, next step! exelotl: doing some very evil things lol exelotl: https://cdn.discordapp.com/attachments/371759389889003532/696413181941252216/unknown.png exelotl: result is that I can group together related definitions like so: exelotl: https://cdn.discordapp.com/attachments/371759389889003532/696413560623988827/unknown.png clyybber: Ha nice clyybber: Thats actually very neat IMO exelotl: yeah would be nice if there was a real feature like this x) exelotl: was planning to make a feature request for it clyybber: Make a PR ? clyybber: Seems like you managed to do it clyybber: I actually prefer it like this clyybber: seperation of concerns and so on clyybber: Maybe we could add it, and document it supakeen: How do I tell my template to accept 'await' in it, I'm using it an an {.async.} pragmaed proc but it seems template's themselves don't take those pragma's. leorize: supakeen: that's a well known bug supakeen: Is there a well known workaround? exelotl: this solution is pretty hacky, it just *undoes* the spacing. Would be nice to add a directive that tells the compiler not to create the spacing element in the first place. leorize: #12743 exelotl: and also it could play nicely with Nimsuggest and stuff leorize: disbot? leorize: wait it died? clyybber: lol clyybber: zevv accidently turned disbot off leorize: https://github.com/nim-lang/Nim/issues/12743 clyybber: in his quest to unsubscribe supakeen: leorize: yield is indeed a bit tricky because I actually need the result :) supakeen: But it seems I can use waitFor(..) instead in my specific case (was said in an issue linked-to from that one). Thanks! leorize: note: don't use waitFor() in an async proc leorize: supakeen: just yield it, then check if it's finished, then get the value from the future supakeen: In my specific case I can use the waitFor even though it won't work in general (I only start two futures at a time, the second one ends the first one). kaderallam: Hello everyone, I have a question which will certainly sound stupid to you but let's say i have var a:string = "test" and i want a reference to the same object, liek var b: ref string , how do i assign a reference to the object ? leorize: you can't leorize: it has to be a reference from the start leorize: it'd be helpful if you can give us an example use case kaderallam: interesting KingDarBoja: How to specify a proc parameter of type `proc`? like this maybe ?-> proc myCustom(a: proc) = ... ? shashlick: Put the full proc signature including return value ND pragmas if any supakeen: For example: proc test(handler: proc (request: Request): Future[void] {.gcsafe.}) KingDarBoja: Ok KingDarBoja: Hummm if the passed procedure is a generic? eliezedeck: https://play.nim-lang.org/#ix=2gL4 ⏎ I feel it is a bug because not all async procs are aware that the future has been resolved; but I tried older versions down to v0.17.0, and it behaves the same ... why is it *only one await aware of the resolved future*? eliezedeck: in the example, I was expecting "Foo and Bar to be saved" eliezedeck: no just one of them Varriount: axios: When disruptek said that he muted you, he was talking about a local mute (local to disruptek's computer). eliezedeck: @Araq @dom96 @mratsim guys, this really doesn't seem right, what am I missing? https://play.nim-lang.org/#ix=2gL4 ... normally, instinct and experience from Javascript and probably other languages with promise/future/... would say that both "Foo and Bar will be saved", but no, only one await will be awakened; that's really not right eliezedeck: I hope I'm wrong leorize: https://play.nim-lang.org/#ix=2gL8 leorize: well to be fair I'm not sure what's wrong :P leorize: @Varriount: he is axion eliezedeck: yes, it's not clear why asyncCheck works ... but then, what if I want the value sent from the savior proc? https://play.nim-lang.org/#ix=2gL9 kaderallam: guys i am confused with seq it is said to be a ref in the doc but when i assign the value to another var it is copied. And when i tried to do something simple like this, it doesnt work: kaderallam: var d:ref seq[int] = new seq[int] kaderallam: d.add[int](1) leorize: kaderallam: you gotta dereference the `ref`: https://play.nim-lang.org/#ix=2gLb kaderallam: thx axion: wut KingDarBoja: I just noticed I was trying to do some dumb check and remembered what Rika said about Nim being compile check lol KingDarBoja: For real, I must stop thinking like it is python KingDarBoja: Welcome axion! kaderallam: > kaderallam: you gotta dereference the `ref`: https://play.nim-lang.org/#ix=2gLb kaderallam: @gitterirc is it possible to dereference a string ? leorize: no leorize: string and seq are value types in nim kaderallam: is there a way to create a ref string or req seq from an existing string or seq leorize: no kaderallam: thanks leorize: well yes, but it won't have the effect that you expect kaderallam: actually i dont want a ref on the actual string or seq, i just want a copy of it but as a ref leorize: ah, then just make a ref, then `ref[] = what you wanna copy` Yardanico: I forgot, is it possible to split Jester routes between multiple files? leorize: yes, though it's painful leorize: use the `router` template leorize: but beware, everything you put in there must be accessible by the module that routes into it leorize: since the AST inside will be copied verbatim ryukoposting: how easy is it to build a nim compiler that can be embedded inside another software package? leorize: ryukoposting: wdym by can be embedded? ryukoposting: let me simplify the question: how easy is it to compile the compiler Recruit_main707: this remembers me to silentrinity Recruit_main707: reminds* Zevv: ryukoposting: the compiler is available as a nimble lib IIRC Zevv: never tried it though Zevv: `nimble install compiler` ryukoposting: hmmmmm that's got me thinking ryukoposting: maybe my SDK's installer could basically just install Nimble, then just tell nimble what packages to install jken: I have a question about nim wrappers for c, looking at https://github.com/barcharcraz/nim-assimp its missing a function I want (pMaterial->GetTextureCount). it's defined in the C header here: https://github.com/assimp/assimp/blob/5a674bb464f7cba4b4c14356b04779bab656ccb9/include/assimp/material.h#L749 jken: I was thinking that getting access to it woul be as simple as copying and modifying the getTexture proc in nim-assimps' assimp.nim, but GetTextureCount belongs to their material class jken: s/c/cpp/ jken: Is there an easy way to get access to the function from nim? eliezedeck: @jken c2nim? eliezedeck: AFAIK, I suppose it also works with C++ ryukoposting: remind me, can nimble be passed a git repo url to install from? Yardanico: yes ryukoposting: perfect, my installer will just download and install nimble, then give it git tags to install components from supakeen: Is it possible to fetch the compilers Nim version at runtime? supakeen: Found it, I should search before I ask. dom96: eliezedeck: interesting, possibly a bug. I think this happens because when you await the `promise` the `await` **sets** a callback, so the second time it is awaited the previous callback gets overwritten. dom96: I could be wrong, but if not then we should change it to add a callback (i.e. `addCallback` vs. `callback=`) moerm: o everyone moerm: +hell supakeen: Hello. yumaikas: heyo Yardanico: is there any difference between using $ for cstring, or setLen(mystrvar, 0); add(mystrvar, mycstringvar) Yardanico: ? Yardanico: I just needed to reimplement PHP's mysqli_fetch_assoc in Nim (it's actually just a few lines of code added to db_mysql, but I won't modify the original module ofc so I copied stuff I need from it) shashlick: @ryukoposting what are you trying to do with compiler shashlick: I'd recommend not using the compiler as a package, use $nim instead shashlick: But will help to understand what you want to do ryukoposting: what do you mean by $nim ryukoposting: I need to make an installer for all the tools needed to make games with my engine, it's nearing that point shashlick: Ok then why not just download the latest stable zip that has everything in it ryukoposting: fair, just trying to find ways to make that whole thing easier to make shashlick: I have some ideas around it shashlick: Do you need the entire Nim or just a subset shashlick: Do you care about install size ryukoposting: compared to competitors, this install should be very small ryukoposting: users will have to switch windows into developer mode, then the installer will install mingw64-gcc, nim, the SDL2 DLLs, libz DLLs, and nimble. then nimble will be responsible for installing the libz and sdl2 packages at a minimum shashlick: Nim already installs mingw if you want to leverage that kaderallam: > ah, then just make a ref, then `ref[] = what you wanna copy` kaderallam: @gitterirc Thanks shashlick: Of course I'm assuming that you've not already done all that moerm: Maybe a stupid question: Why not simply use lua? FreeBSD for example uses it too instead of the shell ryukoposting: shashlick, does choosenim do that if you use it to do your first installation? moerm: HAHAHA I just discovered "VerifPal" a kind of crypto analyzer. The idio^H^H^H^H "professor" wrote it in *Go*! Hahaha supakeen: moerm: FreeBSD uses Lua instead of the shell? What do you mean. ryukoposting: I have a rant on my blog where I kind of tear into Go but it's really not that bad moerm: ryukoposting I don't say that Go is bad. I say that re. security it is ridiculous(ly bad). ryukoposting: is it? moerm: Yes, definitely ryukoposting: huh, never heard anything about it. why's that? PMunch: @deech, yeah that link is for my planned library (currently confusingly also named genui). The idea was to have the user declare what they wanted to show/have the user be able to edit, and the UI should build itself based on that. So instead of saying things like I want an input box here with a callback that sets a variable on update, blah blah blah, you just go: hi I want to let the user edit this string variable and the library figures it out on PMunch: its own. moerm: In two words: Rob Pike (plus its weak typing and other factors) PMunch: So that file is not really meant to be used like the other genui macros ryukoposting: a type system doesn't make a language have poor security ryukoposting: a good type system can make a language have good security, sure moerm: Sorry, I've had that discussion often enough and won't have it again. If you trust Go by all means use it for sensitive projects ryukoposting: well most of my professional work is C and ARM assembly so I guess I see security as being something that's not really the fault of the language, especially if that language is meant for a purpose where an overly sophisticated type system becomes a hindrance krux02: what is the meaning of benign? ryukoposting: I suppose you're right though, Go can't really use the C excuse. ryukoposting: benign? it means "not aggressive" or "gentle" moerm: Hint: There are a few good static analyzers for C. For GO? Good luck ... yumaikas: So, does 1.2.0 not support certain versions of gcc? ryukoposting: Those static analyzers are great until you try to use them on an embedded codebase and the freak out every time they see a write to a SFR moerm: krux benign ~ no bad intentions, not negative. Ex: a benign tumor is supposed to not spread wildly and to not kill ryukoposting: cause in code, every single one of those looks like you're dereferencing an integer value. Which is exactly what you're doing, but that's a valid behavior on a device with no MMU moerm: ryukoposting Maybe you are talking about better linters? moerm: yumaikas ?? yumaikas: Well, I'm running on an older ubuntu, and when I try to build from source, it complains about missing a set of fuctions yumaikas: I don't have a ton of into just yet moerm: yumaikas Hmm, interesting. Maybe Nim somehow really depends on min. C versions (possibly (almost) full C99) yumaikas: Perhaps. 1.2.0 is not working, but 1.0.0 was working yumaikas: I get a lot of errors to the effect of "undefined reference to `__builtin_ssubll_overflow" yumaikas: That happens when I use choosenim, or when I build 1.2.0 by hand kaderallam: what is the best way to conver a uint32 for instance into a binary string / big endian shashlick: @ryukoposting yes choosenim also does that moerm: yumaikas that sound really like too old a compiler version (more precisely too old a lib version and runtime) yumaikas: moerm: Hrm... I suppose. Nim 1.0.0 works fine, but 1.2.0 doesn't seem to dom96: yumaikas, if it works on 1.0.0 and not on 1.2.0 then that's a regression, report it moerm: Ah, dom96 is here (hello) - that's good, listen to him yumaikas. He is quite close to Nim devel. yumaikas: dom96: Will do moerm: dom96 In case the Nim team gave up compatibility with GCC 4.x that would be understandable and reasonable to me timotheecour: @ yumaikas a quick code search woul’dve revealed the fix: -d:nimEmulateOverflowChecks dom96: moerm, sure, it would also be great if the Nim team made that clear in the release notes :) moerm: dom96 If in doubt you are right and I'm wrong, no questions. But hey, the Nim teams is human and humans can forget something ... dom96: heh, looks like it is mentioned in the release notes dom96: search for __builtin_saddll_overflow in https://nim-lang.org/blog/2020/04/03/version-120-released.html dom96: well done Nim team :) moerm: *g yumaikas: timotheecour: I suppose I could have done more looking into that, but it'd be nice if the compiler could detect some of that yumaikas: And/or how to I feed that flag to choosenim? yumaikas: (Since that's part of how nim is compiled) yumaikas: Or, it is on my system timotheecour: can u try `nim c -d:nimEmulateOverflowChecks main` (ie, unrelated to choosenim) dom96: If choosenim needs to compile Nim for you then you cannot pass that flag to it yumaikas: dom96: It seems to need to? dom96: Afraid it's not supported dom96: if you try `choosenim devel` you might be able to get a nightly build dom96: strange that we don't have this for stable releases... yumaikas: Or, when I use "choosenim 1.2.0", it doesn't, but it seemed to when I used `choosenim stable`? moerm: yumaikas What's the newest clang/llvm version available on your old Ubuntu? moerm: yumaikas Plus: I'd bet that there is somewhere a repo providing more current GCC versions to old Ubuntu versions yumaikas: moerm: Not sure, I'm on 14.04 atm, I'm kinda overdue to rebuild my server moerm: yumaikas well, in the worst of cases you build (almost?) any GCC version by hand yumaikas: Yeah, fair enough dom96: or just use nim 1.0.6, it's good enough moerm: Btw: Maybe you have the resources to simply create & use a VM with a newer Ubuntu version? yumaikas: I have a build 1.2.0 from choosenim working now, so the -d:emulateOverflows should work. yumaikas: dom96: I'm needing some improvements to the to(JSONNode, type) function that seem to be in 1.2.0 moerm: - afk - yumaikas: moerm: Yeah, in a little bit, I'll be building a new server with the newest Ubuntu LTS. timotheecour: @dom96 if choosenim can build, then choosenim should be able to take cmdline otions timotheecour: that would forward to nim as is timotheecour: => https://github.com/dom96/choosenim/issues/190 yumaikas: I do have a question, tho: I've seen config files that set certain things? Is there a config I can use to always emulate overflow checks? timotheecour: same thing, add `-d:nimEmulateOverflowChecks` to your nims/cfg (see example of nims files for how to pass flags) dom96: yeah, actually you may be able to do that without involving choosenim at all dom96: AFAIK there is a global cfg file that Nim will read dom96: that said, when compiling Nim you usually build C sources... which won't have the code that the -d flag enables dom96: so you're screwed either way dom96: Even choosenim passing flags cannot help you yumaikas: dom96: Well, I have a working 1.2.0 binary atm yumaikas: I'm just trying to figure out how to tell _it_ to use that flag all the time disruptek: Zevv: you really cannot detune the radio? 'cause i don't see you in the tuner. moerm: - back - and Hello disruptek yumaikas: eyo yumaikas: moerm: I seem to have things working now, using the emulated overflow checks KingDarBoja: Ufff almost finishing some translation from Python to nim, reaching 1000 lines x.x moerm: yumaikas Nice. If I could be of help I'm glad ;) ryukoposting: shashlick nice, that makes my life a lot easier shashlick: Yep shashlick: Alternatively you can download the windows binary zip and run finish shashlick: It will setup mingw as well shashlick: Might be simpler unless you want to support multiple Nim versions ryukoposting: will collect work with iterators? moerm: -afk - Varriount: timotheecour: What's the difference between emulated overflow checks and non-emulated overflow checks? timotheecour: perf Varriount: Yeah, but what about from an implementation standpoint? What's the difference? timotheecour: emulated use FP mult for int ops, as done in python, which is 5X slower as i explained here https://github.com/nim-lang/RFCs/issues/199 disbot: ➥ 2X-5X faster integer multiplication ; snippet at 12https://play.nim-lang.org/#ix=2gME timotheecour: also you can browse the code to discover this, nothing is hidden :) moerm: bye. have a good time everyone ryukoposting: dom96, I realize there may be a mistake in my sample code I added to the SDL2 module ryukoposting: I'll have to double check but I might have used normal alloc() to make a buffer that gets passed into the audio thread leorize: we should update our openssl requirement to 1.1 like everyone else then deprecate older protocols: https://github.com/nim-lang/Nim/issues/13884 disbot: ➥ SslProtVersion only supports TLS 1.0 and older. Add TLS 1.2 & TLS 1.3 since TLS 1.1 and older are deprecated. ryukoposting: yes, it appears I did do that. not sure if queueAudio copies its buffer into the other thread safely. Probably better safe than sorry. leorize: this would break code, for good reason I guess :P or we can keep older enums and raise errors ryukoposting: is it safe to assume that if I GC_ref a ref object, everything it references is implicitly GC_ref'd? leorize: wdym? disruptek: nope. ryukoposting: welp, the audio thread just crashed my demo game so it seems "no" is the answer leorize: use arc :P ryukoposting: it wouldn't help, unless arc somehow knows how to track references through a cast to pointer, and a run through SDL2 and back up into a function called by it kaderallam: Guys simple question, how can i add an array[0..3, char] to a string or convert it to a string ? ryukoposting: arr.mapIt(char it).join ryukoposting: import sequtils and strutils kaderallam: thanks timotheecour: thats inefficient kaderallam: seems heavy ryukoposting: OH GOD OH NO 4 BYTES timotheecour: 3 could be N ryukoposting: that's not what he asked for, is it Yardanico: var mystr = newSeq(myarr.len); for i, x in myarr: mystr[i] = x Yardanico: very efficient :P Yardanico: or maybe you can just play with pointers to get even more efficient Yardanico: ah sorry not newSeq but newString IWSnim: while we're golfing, is there a more elegant way to construct a uint16 from two uint8s than this? IWSnim: var word: uint16 IWSnim: ? IWSnim: word = cpu.mem.gameboy.readByte(address + 1) IWSnim: word = word shl 8 IWSnim: word = bitor(word, cpu.mem.gameboy.readByte(address)) IWSnim: it works... but there's gotta be a better way? Yardanico: read two bytes instead? ryukoposting: word = (b0 shl 8) or b1? Yardanico: word = cpu.mem.gameboy.readTwoBytes() :P IWSnim: :P IWSnim: it'd be the same inside that proc as well IWSnim: unfortunately Yardanico: well but how can you make it the other way? you'll still have to call readByte twice anyway IWSnim: Just wondering if there was a way around thie shift / or. Not a huge deal :) IWSnim: just making sure I din't miss some obvious builtin for it Rika: i dont see any other way IWSnim: Thanks :) kaderallam: anyway I did this, var tst = "" kaderallam: var val:array[0..3, char] = extract_32(2001) kaderallam: for c in val: kaderallam: tst.add c kaderallam: but find it inefficient, there must be a better way wgetch: whats a good way to convert an array of bytes (in utf8 encoding) to a string? leorize: it's as efficient as it could be tbh Yardanico: wgetch: nim string is just an array of bytes basically Yardanico: so you don't have to do any conversion at all leorize: we can go the nice way or the not nice way :P Yardanico: and nim strings are utf8-encoded ryukoposting: I think this is the 5th time someone has asked that in under 24 hours kaderallam: to a binary string not utf8 i am building a protocol encoder Yardanico: it'll work the same won't it? ryukoposting: wgetch, how obtuse of an answer do you want wgetch: lol Yardanico: nim strings are just bytes, they don't HAVE to be utf8-correct wgetch: well give me a second, need to parse the situation leorize: @kaderallam: I'd recommend working with seq[byte] or openArray[byte] for working with binary protocols ryukoposting: we're golfing our way from pretty one liners all the way to the nastiest super-optimized stuff you'll ever see wgetch: I'm using binaryparse.nim, but the strings are not NUL terminated wgetch: so I can't use the parser's string type kaderallam: thanks @leorize will look into it wgetch: instead, I just ask for an array of u8's ryukoposting: clever wgetch: but now I am not sure how to convert to string. looked at unicode module but nothing is standing out leorize: you got a seq[uint8]? wgetch: yep! ryukoposting: (testing whether my GC_refs are keeping the audio engine from exploding is awful. I'm sitting here listening to the same 2:30 WAV on repeat) leorize: wgetch: are you new to Nim? wgetch: very new! ryukoposting: wgetch: yourseq.mapIt(char it).join is the way I like to do it if lightning-fast performance isn't a concern ryukoposting: it's slow, but easy to read leorize: wgetch: https://play.nim-lang.org/#ix=2gMV ryukoposting: (update: the wav is on its 4th loop. I am slowly losing my mind but I think I finally put GC_refs in all the right spots) leorize: you can also turn this into a nice proc for usage :) Yardanico: yeah, and that's already efficient :) wgetch: legit, thank you! leorize: this is the kind of operations that we might want in the stdlib :P ryukoposting: those who play video games: how much RAM is an acceptable amount of RAM for a game to use leorize: if AAA, I'd expect 8gb ryukoposting: this is a visual novel Rika: as much ram as i have free 😛 leorize: if not, 500meg is my limit :P wgetch: so far I am liking how nim handles unicode strings. kinda surprised that mapIt(char it) works so well :P ryukoposting: well, it's idling at 800 right now Rika: 800 sounds pretty chonky for a vn ryukoposting: granted, that's with asinine caching systems that I was going to replace later anyway ryukoposting: It loads every image it can ASAP then keeps them there forever lmao leorize: wgetch: our strings don't care about encoding leorize: we aren't python :P Rika: nor rust Rika: afaik rust requires valid utf8 too 😛 ryukoposting: this week on "encoding-agnostic strings: convenient or harmful?" Rika: convenient, dont see how its harmful leorize: add "by default" into the thing leorize: then you'll get a proper answer :P ryukoposting: I refuse to acknowledge the existence of UTF-16 Rika: well, thats fine Rika: you must acknowledge shiftjis though : ) ) ) ) ) wgetch: its all fun and games until your database has screwed up by 8 different encodings used at one time or another Rika: *sobs* ryukoposting: : ) ) ) ) ) is what UTF-16 nerds' smiley faces look like Rika: hey if you do that then thats your fault lmao ryukoposting: they think they're :)))), they're wrong ryukoposting: It's all fun and games until powershell's print-to-file directive "helps" by converting everything passing through it to UTF-16 clyybber: hahaha wgetch: or its the fault of the developer who thought "I really need emojis, lets just change this column to SQL_ASCII" ryukoposting: that actually happened, wasted so many hours trying to figure out why stuff I was sending to a mac using a ps script was getting corrupted wgetch: and also yeah, can confirm about powershell wgetch: like if you do that uh, -encodedCommand thing wgetch: it expects base64 encoded UTF16 iirc wgetch: with powershell, encoding is kinda like USB. doesnt fit one way, you turn it upside down, still doesnt fit. leorize[m]: is there anything on windows that is not expecting utf-16? :p ryukoposting: UTF-16 is microsoft's "standard" KingDarBoja: Oh, new release D: exelotl: "The Nim compiler now supports the --asm command option for easier inspection of the produced assembler code" oh this one is very cool exelotl: very excited to try this on the GBA Varriount: How does that work? I thought the compiler shelled out to GCC/Clang/VCC KingDarBoja: I just discovered the options module few days ago and saw a possible equivalent to Python usage of `none` while setting default parameters on a proc voltist: Does anybody have an experience with using NumericalNim to solve systems of ODEs? treeform: @Varriount, I think it passes --asm equivalent to the compilers. So they output the asm code. treeform: I think its `-S` for gcc... KingDarBoja: But I see that If I do something like this: https://play.nim-lang.org/#ix=2gyD KingDarBoja: It looks like I must pass an Option(2) instead of a common int 🤔 KingDarBoja: What I want to do is set default proc parameters to some Python equivalent to None treeform: @KingDarBoja Nim way of doing that would be some thing like this: treeform: https://play.nim-lang.org/#ix=2gyG treeform: I think that is much more clear what is going on. Rika: if you want to use the options still, you need to wrap it in a some() Rika: though the options module is more suited for return types rather than parameters/arguments treeform: @KingDarBoja another nim way of doing that is https://play.nim-lang.org/#ix=2gyH treeform: I don't use options in my code, I think code is more clear without them... Rika: it only really works when used as a return type, as ive said... treeform: voltist, i have not used NumericalNim, but I find that nim is so fast at numeral kind of problems with just simple for loops and seqs... like insanely fast with -d:danger... voltist: @treeform So just compute each step? KingDarBoja: Jumm overload proc KingDarBoja: That is a big problem to me as the source code (in Python) make use of default parameter as None for a class "__init__" function Yardanico: ? KingDarBoja: Give me a second KingDarBoja: https://github.com/graphql-python/graphql-core/blob/master/src/graphql/error/graphql_error.py#L83 This init function (on Python). Any suggestion to how it would be translated (at least the function parameters) into Nim? Ignore the typings like Optional or Union companion_cube: does inim work? or is there some sort of playground? Rika: one moment, ill convert it @KingDarBoja Rika: @companion_cube play.nim-lang.org Yardanico: weill inim in itself is a workaround Yardanico: :P companion_cube: ah, thank you. Yardanico: @Rika tbh inim is not similar to playground KingDarBoja: Feel free to ignore the source parameter Yardanico: it's supposed to imitate a "repl" Yardanico: there's also "nim secret" which is called this way for a reason Rika: @KingDarBoja okay so for things like this, if you think all parameters are "independently optional", that is to say, any parameters dont come as a bundle, then i think the options module is sufficient companion_cube: I didn't find a a to do `a[2..]` to get "all elements starting from 2" Rika: Yardanico: he asked if there was a playground Yardanico: oh Rika: you use `a[2..^1]` Rika: ^1 meaning "the last element" companion_cube: hu, interesting Rika: `^2` means the 2nd last, and so on KingDarBoja: So I can just write "myParam: Option(MyType)" on my initType proc? Rika: brackets Rika: Option[MyType] KingDarBoja: Oops Rika: i dont see why not Rika: but you need to pass it like this: "some(myTypeInstance)" or "none(MyType)" Yardanico: the thing is just that when you do translating from a dynamic language like Python to a static language like Nim the code wouldn't really look that cood :P Rika: you really need to rethink the whole code yeah KingDarBoja: Yeah, I have seen that issue with the string | char problem I had few days ago, but solved using a custom proc + option module KingDarBoja: I was going to ask, while writing a humble example of what you said (Rika), about something I probably asked before... KingDarBoja: The Union types aren't allowed at proc params ? like the "nodes" parameter on the python code I shared before? KingDarBoja: Please spare me if I asked before Rika: "int or string"? Yardanico: they are, but "sum" types just implicitly create different procedure instantiations Rika: yeah Rika: and then you might need to do stuff like `when param is string:` Yardanico: well I mean there's no difference in proc(a: int | string) = when a is int: stuff else: another stuff Yardanico: and proc (a: int) and proc (a:string) Rika: mhm KingDarBoja: I see.. I do prefer going the lazy way and keep if possible as one type. KingDarBoja: Like it MUST be a int 😆 KingDarBoja: But those "Union types" aren't allowed on the type definition, right? Yardanico: no Yardanico: you can use object variants instead KingDarBoja: Ah, that's what I thought KingDarBoja: Yeah, I think I discussed that question due to the limitation of using the same variable with different type (int, string for value) inside the case kind KingDarBoja: And someone pointed me to a GitHub issue regarding that. Yardanico: well yeah, just name them differently KingDarBoja: Writing all answers on a txt so I don't get lost again KingDarBoja: Ugh, wanted to make an example of what Rika said and ended with errors KingDarBoja: https://play.nim-lang.org/#ix=2gz9 KingDarBoja: This -> but you need to pass it like this: "some(myTypeInstance)" or "none(MyType)" Yardanico: uhh Yardanico: uhhhh Yardanico: I don't think "or" types work with "Option" KingDarBoja: I am feeling the struggle with that Yardanico: you should understand that "or" types don't magically make your code dynamic Yardanico: https://play.nim-lang.org/#ix=2gzc KingDarBoja: Impressive Yardanico KingDarBoja: And I see what Rika meant wit the some downside :/ KingDarBoja: But thinking about it, that is fine as long as the init call is used internally 😄 companion_cube: in it seems like nim doesn't know how to do pattern matching correctly? :((( Yardanico: wdym exactly? companion_cube: it only checks that one uses the right fields for the discriminator, at runtime, not at compile time Rika: huh? companion_cube: I wrote a `case` where the `nkIf` branch uses `strVal` companion_cube: no compile error Rika: huh? Rika: can you playground it Yardanico: @companion_cube well there's https://github.com/alehander92/gara companion_cube: https://play.nim-lang.org/#ix=2gzdhttps://play.nim-lang.org/#ix=2gzd Yardanico: https://play.nim-lang.org/#ix=2gzd * companion_cube: https://play.nim-lang.org/#ix=2gzd Rika: i see companion_cube: this is quite disappointing Yardanico: well that's doesn't mean there's no "pattern matching" Yardanico: it just means that compiler doesn't check for accessing invalid branches of a case object companion_cube: that's not better than C, if you want Rika: can it be added though Yardanico: just write a macro Rika: i dont know much about the compiler shashlick: leorize: you around? companion_cube: wdym a macro? how would a macro add type safety? Yardanico: it can statically check if you're trying to access an incorrect field inside of a "case" branch companion_cube: that's the compiler's job… Yardanico: not really, a macro is enough :) companion_cube: the paragraph above claims this is "like a sum type in other languages", when, not really :/ Rika: its like one Rika: its not exactly one Rika: its just like it companion_cube: it's more like a C struct with tag + union, really Yardanico: well that's what it is in C backend :P companion_cube: it's just sad that there is no typechecking companion_cube: (a bit like `not nil` not being the default, I guess… every language has some baggage) zedeus: nil is useful Rika: what Yardanico: yes Rika: what x2 companion_cube: yeah, it should just be opt-in, not opt-out Rika: why is nil the future what Rika: im still heavily confused KingDarBoja: I was trying to make it like a compliment for the phrase "Nil is useful" Rika: i dont see how it is disruptek: !rfc author:alehander92 disbot: https://github.com/nim-lang/RFCs/pull/169 -- 3Nilable and non-nilable types 7& 2 more... voltist: Woah I knew Nim is fast, but I never thought it was THIS fast! My implementation of a state-of-the-art neuron model runs 100x faster than real life Yardanico: lol Rika: doesnt it literally say as fast as C voltist: I haven't seen it in those exact words, but yeah maybe Yardanico: jesus https://github.com/oakes/vim_cubed has 1.9k stars already :P voltist: Haha! Lots of traffic from Reddit I presume? leorize: that's like 1/9 of nim leorize: damn leorize: and it's like several days old? Yardanico: leorize: well github stars are a very stupid thing Yardanico: *cough* https://github.com/vlang/v *cough* leorize: shashlick: o/ shashlick: Hey so the same question on variable importc Rika: `V's backend has just been replaced on April 1` is this a joke or legit because i cannot tell lmao shashlick: If you are importing from a dynlib, the var doesn't exist right Yardanico: @Rika it's not a joke Rika: omg hahahaha Yardanico: they finally made a "somewhat" proper AST in the compiler Yardanico: v 0.1 didn't have AST at all Yardanico: even Zig author mentioned that "hype" thing with V in his article https://andrewkelley.me/post/why-donating-to-musl-libc-project.html voltist: Lol who would have guessed that 720 million floating point numbers in memory would make my computer hang leorize: shashlick: the var exists, after it's imported from the dynlib :P leorize: I'm not too sure what you meant to be honest Rika: can anyone link me the article on building nim code w/ musl Rika: i dont seem to recall who made it or the link Yardanico: https://github.com/kaushalmodi/hello_musl Yardanico: that's not for cross-compiling though, for cross-compiling it's harder Rika: darn Rika: anything for cross? Yardanico: well, I only know if you want to cross-compile for linux buth for another architecture Yardanico: then there's https://github.com/richfelker/musl-cross-make/ Yardanico: it basically builds a gcc toolchain (with musl) for the target you want Rika: this is complicated Yardanico: what do you want to do? Rika: ill look into it Yardanico: it's actually quite easy Rika: no no im just reading up on it Rika: i have no use for it yet but it seems like itll be useful some other time Yardanico: also, extracted from my project Yardanico: https://gist.github.com/Yardanico/45881fe24222329a0117194fc97ec4eb Yardanico: it's basically for cross-compiling a musl + libressl (for https or other crypto stuff) statically linked binary, based on hello_musl for libressl Rika: is there a nim module for emulating inheritance (in a nicer way) with variant objects Rika: because right now with a variant object im not a fan of making a super large proc with a case statement for separating the types Yardanico: use inheritance then? :P Yardanico: ref objects and methods Rika: okay, already am, was wondering if i could convert to variants Rika: next question Rika: if i store a subtype (lets say YoungPerson of type Person) in a seq[Person], how do i get the "original type" of the object Rika: or is it unchanged? KingDarBoja: That cube is a whole new level Rika: like if i store an instance into the seq[ParentType], can i still call the methods associated with the subtype? Rika: am i making sense shashlick: Use dockcross for cross compiling shashlick: Much easier Yardanico: does it support stuff like musl or libressl? Yardanico: to make statically linked binaries Yardanico: oh I see they have predefined images Yardanico: but almost no with "musl" and static linking only for win shashlick: I thought they had musl also Rika: did i make sense? Rika: or am i spouting nonsense Yardanico: i don't know because I almost never used inheritance in nim :P Rika: i have to because im doing a port... sealmove: Rika, object variants has nothing to do with inheritance Araq: sure they do, both are a way of introducing runtime polymorphism Yardanico: @sealmove his question is "like if i store an instance into the seq[ParentType], can i still call the methods associated with the subtype?" sealmove: yes but, that's not inheritance. It's a sum type which means "either this or that", not "either the parent or child or grandchild" Rika: i wasnt asking anything about inheritance this time Rika: i was just stating it as the name of the uh feature? sealmove: I don't think object variants is true runtime polymorphism. It's manual, but you get the type safety sealmove: rika if you define them as methods instead of procs then the correct one depending on the actual type of the object will be called sealmove: and of course you have to use `X = object of Y` Rika: yeah okay thanks, for some reason i was thinking i'd have to figure out what to cast the instance back to Rika: how do i make a table that's filled on compile time but accessible on run time Yardanico: it's easy :P Rika: uh Rika: ?? sealmove: With macros? Rika: do i really have to make a macro for it ;; Yardanico: no lol Yardanico: https://play.nim-lang.org/#ix=2gzA Rika: noice Yardanico: newTable wouldn't work though, only initTable Yardanico: TableRef vs Table Yardanico: (ref object vs object) Yardanico: you can't make a const TableRef sealmove: Rika: if you have to fill in hundreds of entries and you don't wanna type the assignments, then you would generate them with macros Rika: i dont need a ref table so i'm good Rika: i only have 10 assignments... Rika: i dont need to make a macro for this ;; sealmove: sure, if they are only 10 voltist: Is there an easy way in Nim to map the values of a tuple to variables of the same name? Rika: its macro time, it looks like voltist: Yeah sealmove: voltist example? Rika: sealmove: map a `tuple[a: int, b: int]` into variables `a, b`... WAIT A MINUTE Rika: voltist Rika: i think i know how, but it requires you to write the names in order Rika: you can do `let (a, b) = theTuple` voltist: Yeah like that voltist: Hmm maybe? That wouldn't work for any given tuple though voltist: I mean it doesn't matter much now because I've thought of a better way of doing things Rika: oh ok voltist: Thanks for the help though Rika: if you want it to conform to any tuple youll need a macro Rika: but yeah okay i wont continue w/ the topic lmao KingDarBoja: Just tried to do something like "extensions: Option[Table[string, string]] = none(Table[string, string])" on the initMyCustomType parameter and got an error KingDarBoja: "Error: cannot instantiate: 'Table[A, B]'; Maybe generic arguments are missing?" :/ Rika: that sounds like a bug voltist: Is there a way to have a proc be a property of an object? Rika: uh, make the first argument of the object type Rika: like `proc something(self: ObjectType)` Rika: then you can call it like this `objectInstance.something`, no need for parentheses even KingDarBoja: A bug? Yikes! Rika: if you want, you can have constant properties this way too, make it a template voltist: Nah what I mean is to have an object contain a proc. Like to be able to go `objectInstance.myProperty = something` where something is a proc voltist: So that `objectInstance.myProperty(a)` is equal to `something(a)` voltist: *equivalent Rika: have a field `myProperty: proc()` and replace the proc signature with the intended one Rika: (proc signature -> the `proc()` part) voltist: Ah Ok got it voltist: Thanks KingDarBoja: So pretty much doomed trying to use Option with table 😢 I am using the latest version btw KingDarBoja: (1.2.0) silvernode: Good morning/night everyone silvernode: I hope everyone is in good health. voltist: Not quite either of those two for me KingDarBoja: It is 1 AM here KingDarBoja: So good morning mate silvernode: it is 23:20 here in AZ, sitting in the parking lot at work using th wifi and working on Space Nim as usual. sealmove: Space Nim? what is it? silvernode: I was off work for 4 days and oddly enough never commited one thing to my game in that time. Funny how that works. nekits: I dont need sleep, I need answers silvernode silvernode: Space Nim is my first project in Nim, it's a text based space trading game silvernode: nekits: answers huh? nekits: I need more info on this game Rika: silvernode: are you calling the humanoids in the game `nimmers` Rika: heh silvernode: nekits: Well, I have been trying to commit myself to making a text based game for years but always start it and never finish. So this time I am not allowing myself to give up. It is going to be a single player game that is focused on trading and exploration. Very simple concepts, nothing too ambitious. silvernode: Rika, there are no plans for NPCs at this time Rika: who are you trading with then??? silvernode: Just stations, items and a player silvernode: Rika, space stations silvernode: https://github.com/silvernode/space-nim/blob/planning/design.md nekits: heh, Dave. silvernode: I have some code already but decided I should really focus on what I really need/want in the game so I started a new branch called 'planning' which contains a design doc that is incomplete. silvernode: About to push another commit in a second for the stations section. silvernode: I have been working on this little by ittle every night before work sealmove: hey silvernode, have you heard about CRC cards? silvernode: sealmove, CRC cards? Nope sealmove: I used them recently for a game and it's a surprisingly useful method sealmove: https://echeung.me/crcmaker/ silvernode: sealmove, I will check out that link and see what CRC cards even are. sealmove: example (sorry for long link): https://echeung.me/crcmaker/?share=W3sibmFtZSI6IlVzZXIiLCJzdXBlcmNsYXNzZXMiOiIiLCJzdWJjbGFzc2VzIjoiSGVybyIsInR5cGUiOjMsInJlc3BvbnNpYmlsaXRpZXMiOlsiTW92ZSIsIlNldCBPZmZlbnNpdmUgSXRlbSIsIlNldCBEZWZlbnNpdmUgSXRlbSIsIlNldCBTcGVsbCIsIkF0dGFjayIsIkNhc3QgU3BlbGwiLCJDb25zdW1lIiwiUnVuIEF3YXkiLCJFeGl0IEdhbWUiXSwiY29sbGFib3JhdG9ycyI6WyIiXX0seyJuYW1lIjoiR3JpZCIsI FromGitter: ... nN1cGVyY2xhc3NlcyI6IiIsInN1YmNsYXNzZXMiOiIiLCJ0eXBlIjoxLCJyZXNwb25zaWJpbGl0aWVzIjpbIlBsYWNlIEhlcm8iXSwiY29sbGFib3JhdG9ycyI6WyJIZXJvIl19LHsibmFtZSI6IlRlcnJhaW4iLCJzdXBlcmNsYXNzZXMiOiJHcmlkIiwic3ViY2xhc3NlcyI6IiIsInR5cGUiOjIsInJlc3BvbnNpYmlsaXRpZXMiOlsiIl0sImNvbGxhYm9yYXRvcnMiOlsiIl19LHsibmFtZSI6Ik1vdW50YWluIiwic3VwZXJjbGFzc2VzIjoiVGVycmFpbiIsInN1YmNsYXN ... [https://gitter.im/nim-lang/Nim?at=5e8829780073445dc5626a4e] silvernode: just pushed another commit to the design doc silvernode: interesting, but in making a new card, I don't know what a superclass is. sealmove: It's whatever you want it to be ;P sealmove: Define your own rules voltist: I just got a phishing email pretending to be Github Yardanico: wow voltist: I'm going to slowloris the fake website, which might work because it would be cheaply hosted voltist: One would imagine anyway voltist: Little effect, must not be a threaded server Rika: does nim still recommend mutimethods Zevv: wow, 12 yours on the HN frontpage without *any* case-style whining. This is a major milestone people! vegai: that was my go-to whinge as well before I dove deeper vegai: a classic vegai: I still do think that things would be better without it, but oh well :) Araq: vegai, fwiw the compiler uses --styleCheck:error Araq: to keep contributors from introducing snake_case behind my back Yardanico: xdd Araq: it saved me about 4 seconds this year and only took a full day to develop. But "cost benefit" analysis is unheard of in the entire programming industry so nobody notices. Araq: And here I am claiming it's a success story. ;-) voltist: This is a bit of a stupid question but: how does one create a reference to something in Nim? As in, so if you change the reference you change the variable it refers to Rika: voltist: `let someVar: ref SomeType = new SomeType; someVar[] = # set contents here` Rika: like that? voltist: Maybe, lets see voltist: That seems like it would only work with 'new SomeType'. What if I have an existing object of type 'SomeType' that I want to refer to? Rika: `let someVar: ref SomeType = new SomeType; someVar[] = theExistingObject` voltist: Ah I see! voltist: And then modifying someVar would change theExistingObject? Rika: yeah Rika: you have to modify it like this though Rika: "someVar[].someField = someValue" Rika: because you have to do dereferencing Rika: [] will dereference the reference voltist: Ok Yardanico: @Rika not really though Yardanico: there's auto dereference Yardanico: https://play.nim-lang.org/#ix=2gAp voltist: "type mismatch: got but expected 'ref SomeType'". Thoughts on this? Yardanico: voltist: read my snippet Yardanico: also see https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types solitudesf: you dont have to use `[]` when accessing fields, nim has implicit dereferncing solitudesf: ah, but i cant read that fast Araq: auto-deref needs to be reworked :-) Araq: new rule shall be: x.f() can work as x[].f() Araq: anything going further than that is known to cause way too much trouble voltist: Araq: Is that rule not already the case? I have just tested something similar and it seemed to work voltist: Oh wait I'm using implicitDeref Araq: voltist, the current rule for implicitDeref is more "powerful", too powerful. voltist: Ah, I see axion: Araq: Did you see the huge bug krux reported for me the other day? supakeen: Good morning, I've been playing with asynchttpserver and pasted the example code in a test file but I end up with a SIGSEGV: https://bpaste.net/raw/XEMA my nim version is 1.2.0, what am I missing :) The example comes from here: https://nim-lang.org/docs/asynchttpserver.html Yardanico: uh-oh Yardanico: it's a regression Yardanico: by https://github.com/nim-lang/Nim/pull/13846/ disbot: ➥ fix asynchttpserver content-length header Yardanico: i wonder how CI didn't catch it, it's really bad Yardanico: I mean the implications of this :P supakeen: Ah, are the examples in the documentation ran by the CI? Yardanico: most are by now, yes Yardanico: not all supakeen: Shall I report this an issue? Yardanico: yeah, you can, and please also mention https://github.com/nim-lang/Nim/pull/13846/ disbot: ➥ fix asynchttpserver content-length header supakeen: I will. Yardanico: it's the cause of this issue supakeen: https://github.com/nim-lang/Nim/issues/13866 here you go. disbot: ➥ asynchttpserver documentation example causes SIGSEGV ; snippet at 12https://play.nim-lang.org/#ix=2gAG supakeen: Where do I need to look at how the documentation examples are run by the CI? supakeen: Perhaps a nice saturday project to add it. Yardanico: it's really sad that this regression got into 1.2.0, guess we'll have 1.2.2 soon anyway :P supakeen: Hey, I release software as well, there's never a clean .0 :) supakeen: Yardanico: If I understand correctly the content-length should be moved inside the header if. Yardanico: supakeen: not really, if you do that then Content-Length header won't be added if there's no custom "headers" provided Yardanico: since by default "headers" var is "nil" Yardanico: I'm trying to figure out a good way to fix it too supakeen: Ah let me check out the code so I have some more context then and I'll grab some coffee. supakeen: I went off the PR diff. Yardanico: yeah, the PR is incorrect since if "headers" is not provided it's "nil" Yardanico: the check is not fully correct I mean Yardanico: I showed one of the ways to fix it in https://github.com/nim-lang/Nim/issues/13866#issuecomment-609001843 disbot: ➥ asynchttpserver documentation example causes SIGSEGV ; snippet at 12https://play.nim-lang.org/#ix=2gAG Yardanico: Araq: is the first fix in https://github.com/nim-lang/Nim/issues/13866#issuecomment-609001843 good enough or not? the issue seems kinda important because right now on 1.2.0 asynchttpserver just doesn't work at all :D disbot: ➥ asynchttpserver documentation example causes SIGSEGV ; snippet at 12https://play.nim-lang.org/#ix=2gAG Yardanico: well, I mean it will work if user always provides his own "headers", but not if there's no user-provided "headers" so it's "nil" supakeen: I think I have a slightly better way, Content-Length should not be added if it was supplied in the custom headers otherwise we always add it (old situation). Yardanico: supakeen: well that's what my code does, or maybe I understood you incorrectly? supakeen: By the way, what is the implicit change in that PR for `msg.add content.len` vs `msg.addInt content.len`. Yardanico: it's deprecated Yardanico: "addInt" was deprecated since 0.20 Yardanico: I mean "add" Yardanico: for adding an int to string Yardanico: dom96: are you there maybe? https://github.com/nim-lang/Nim/issues/13866 disbot: ➥ asynchttpserver documentation example causes SIGSEGV ; snippet at 12https://play.nim-lang.org/#ix=2gAG dom96: replied supakeen: dom96: I think we replied at the same time, I added an isNil to the conditional. supakeen: Want me to PR that? dom96: yes please dom96: If you could write a test that would be awesome as well Yardanico: supakeen: but in your case wouldn't it fail if "headers" would be nil? Yardanico: if headers == nil then content-length wouldn't be added supakeen: Ah correct. Yardanico: supakeen: I replied with a fixed snippet supakeen: Ah yes! Yardanico: make a PR then :) Yardanico: guess you could add tests a bit later since this is a pretty bad regression supakeen: Created the PR here: https://github.com/nim-lang/Nim/pull/13867 going to take a look at the testing setup now. disbot: ➥ Add isNil check to custom Content-Length. Zevv: disruptek: how do I *unsubscribe* from a disbot channel? voltist: Calling Python from Nim feels... dirty Yardanico: with nimpy? deech: I'm a Windows noob, I'm trying to get a Nim executable to link with `foo.lib`, can I just pass in `{.passL: -lfoo .}` like I do on Unix? voltist: Yardanico: Yeah Yardanico: why though? Yardanico: looks very nice for me Yardanico: I mean it's the best way to do it probably Yardanico: python is not static typing so you have to explicitly convert the types voltist: Yeah nimpy is good at what it does, but the actual act of calling Python from Nim makes me uncomfortable voltist: The sentiment Yardanico: don't do it then :P voltist: I wish I had the option voltist: But I need a fully featured graphing library supakeen: Are you using a specific Python library? Ah. Yardanico: for plotting? voltist: Yeah matplotlib. It has support for this specific type of plot I need Yardanico: what about https://github.com/Vindaar/ggplotnim Yardanico: https://github.com/Vindaar/ggplotnim/blob/master/recipes.org for examples supakeen: How I've done such stuff in the past is have my $X code output some data so I can write a separate Python script to turn it into plots. supakeen: Instead of calling into Python directly. supakeen: But that might not apply to your case. voltist: ggplotnim calls R though right? Yardanico: no? Yardanico: it's pure nim voltist: Oh it's not a wrapper but a port, I get it voltist: Hmmm I could use it voltist: Nim would have such good potential for scientific computing if it had a more fully-featured plotting library. But, I suppose the way you get to that point is by using it so... voltist: I better try Rika: ` Nim would have such good potential for scientific computing if it had a more fully-featured plotting library. But, I suppose the way you get to that point is by using it so... ` i'm the kind of fucker to use turtle to plot my shit lmaooooo Vindaar: @voltist: if there's something missing from ggplotnim, just let me know and I'll make it a priority to implement! Vindaar: And I think you missed this: Vindaar: https://gist.github.com/Vindaar/9c32c0676ffddec9078e4c0917861fcd supakeen: Is there away to run a specific subtest, currently I am doing `./koch tests cat stdlib` but I'd like to run one subtest of stdlib :) voltist: Vindaar: Woah, that's just what I'm looking for! Missed it? Was it mentioned earlier? Vindaar: @voltist: when you talked about such plots the other day I only saw about 2 hours later and made this. I think by that time you had left irc voltist: Ah yeah my ZNC doesn't work for some reason so I can't see these things. Thanks so much! Vindaar: note though that the way I create the DF in this gist is not quite the way you would do it on the current master branch of `ggplotnim` Vindaar: as in there's no "newDataFrame" (you'd just write `var df: DataFrame`) and you don't have to write `toColumn` when assigning a `seq` voltist: OK, I'll remember that Vindaar: unless I forget something right now it should work. But I should probably have merged the arraymancer backend this weekend anyways, so then it should all work Araq: supakeen, testament r voltist: Vindaar: Cool. If I get this working, its definitely going into this computational neuroscience library I'm working on Vindaar: @voltist: awesome! It should work and if it doesn't I'll help you get it working. ⏎ Is the library open source? voltist: It will be soon. I went on a little tangent from my research project yesterday to make a more accurate model and realized that I could turn it into it's own library, so I haven't been going for long. voltist: Good progress so far though Vindaar: that's good to hear voltist: It means that something more general-use will come out of my project, as well as the paper about a specific nervous system Recruit_main707: is arc default gc in nim 1.2¿ Vindaar: great to hear of other people using Nim for scientific research! supakeen: Araq: Thank you. Yardanico: @Recruit_main707 no supakeen: It's a load of fun figuring out how to setup these asynchttpserver testcases :) Yardanico: it still has bugs Yardanico: but people should test their code with --gc:arc and report issues :) supakeen: PASS: tests/stdlib/tasynchttpserver C ( 2.19 sec) supakeen: Ooh, getting there! PMunch: Async in ARC? Yardanico: i think it still leaks Yardanico: ah, PMunch, supakeen is just making tests for asynchttpserver so regressions like https://github.com/nim-lang/Nim/issues/13866 don't happen disbot: ➥ asynchttpserver documentation example causes SIGSEGV ; snippet at 12https://play.nim-lang.org/#ix=2gAG supakeen: And learning a bunch about async in Nim while at it, I need to solve one more thing and I'll have a pretty clean setup. PMunch: Aaah right PMunch: Hmm, that reminds me. I should continue my multitasking article series supakeen: I'm currently mostly setting up something that "run a server, add this callback, perform request, kill server, return resolved request". supakeen: so one could do `let response = testServerWith(callback, request); doAssert(response.status == Http200)` and such. supakeen: Add an await in there. PMunch: Ah right flywind: Our team has written an article regarding a new streaming mode of asynchronous non blocking io for nim for Nim. flywind: https://dev.to/xflywind/a-new-streaming-mode-of-asynchronous-non-blocking-io-for-nim-3dno voltist: Vindaar: Well I'm not off to a good start with "undeclared identifier: 'newDataFrame'" voltist: Despite having imported ggplotnim and arraymancer Vindaar: @voltist: that's what I mentioned above voltist: Aww snap I forgot about that Yardanico: @flywind will netkit get english translations? :) Yardanico: I see both source code comments and readme are in Chinese rn Vindaar: give me 5 minutes and I'll fix the gist for current master flywind: It's not finished.Maybe have english version later. flywind: https://github.com/iocrate/org/blob/master/README_en.md supakeen: Going through this it might be nice to have a `waitForAll[seq[T]](futs: seq[Future[T]]): seq[T]` and waitForOne or such but perhaps that's my Python leaking through. voltist: V1ndaar: "Error: unhandled exception: Not implemented! nnkCallStrLit [Exception]" Vindaar: @voltist: yep that's another thing I forgot about :) Vindaar: but there's actually a problem on `master`, due to a bug that's present when using `xmin` and `xmax`, which I've fixed on the new branch Chiqqum_Ngbata: What's the website that has nim code runner? Recruit_main707: playground right? Chiqqum_Ngbata: Scratch that Vindaar: so I'd suggest: try to checkout the `arraymancerBackend` branch of ggplotnim with the gist as it is. It should work fine I hope. ⏎ If not or you don't want to do that, I'd suggest you give me a little bit of time to finish the PRs and then it'll work for sure voltist: OK I'll try that first one lbart: FYI, Nim 1.2.0 is available on FreeBSD https://svnweb.freebsd.org/ports?view=revision&revision=530639 Chiqqum_Ngbata: What am I doing wrong here (genericParams()) https://play.nim-lang.org/#ix=2gBj voltist: V1andaar: arraymancerBackend gives me this error "Error: cannot open file: ../playground/arraymancer_backend" Chiqqum_Ngbata: This was working in 1.1 IIRC Vindaar: @voltist: that's weird. The file should be present voltist: Let me try something else voltist: Nope still got that problem voltist: V1ndaar: The file is present in the source but obviously nimble isn't installing it or something? Vindaar: ohhh Vindaar: yes Rika: @Chiqqum_Ngbata internal errors are compiler bugs from what ive heard Vindaar: for it to work you'll have to clone the repository and use `nimble develop`. Otherwise it won't be installed, since `playground` is not considered a `src` directory voltist: Ey, that worked Vindaar: :) voltist: Does that mean I have to change those things back to how it was in the Gist? Vindaar: yes voltist: V1ndaar: OK. I did that, but yet an another error presents: https://pastebin.com/0WB9kcXa Vindaar: @voltist: ah, indeed. I haven't commited the import of `strformat` in column.nim voltist: Ah ok I can fix that real quick on my end Vindaar: ok, just pushed that line vegai: Araq: ah, cool vegai: (styleCheck:error is cool, that is) Chiqqum_Ngbata: Wonder if genericParams() is supposed to work with typedesc voltist: V1ndaar: Well that helped, in the sense that we are now getting a different error: https://pastebin.com/4BR5QFzP Vindaar: @voltist: ah damn. That's because the arraymancer backend depends on a new version of `ginger`, which isn't merged either yet: ⏎ https://github.com/Vindaar/ginger/pull/15 disbot: ➥ Viewport, GraphObject are ref, less cairo calls ; snippet at 12https://play.nim-lang.org/#ix=2gBn Vindaar: sorry for the inconvenience :) supakeen: Is there a nice way to cancel a future? voltist: V1ndaar: Nah all good. I was going to say "Ok I'll just install your fork of Ginger", but of course that wouldn't work would it ;) voltist: I can checkout the branch though Vindaar: for ginger it should work, since it's just a normal change in the main file Vindaar: so: `nimble install "[email protected]#moreRefLessCairoCalls"` should work voltist: Yay it worked PMunch: supakeen, don't think so Vindaar: sweet! voltist: V1ndaar: "Error: unhandled exception: Either `guessType` failed to determine the type due to multiple base types in the column or the data is really `VNull` [ValueError]" Chiqqum_Ngbata: Found an old version of genericParams() that works in case anyone else needs it https://play.nim-lang.org/#ix=2gBp voltist: Could this be because one column is made from an int seq? Vindaar: @voltist: hm, what's the output of the column type when you print the DF you want to plot? Vindaar: This is partly a leftover from the default backend DF, which didn't have typed columns so I had to guess the type by looking at a few elements voltist: V1ndaar: Oh no, its a mistake on my part. There were no rows because I had incorrectly changed the parameters of the simulation Vindaar: ok! voltist: V1ndaar: Hmmm, it seems that the DF only has one row, no matter how long the seqs are PMunch: hmm, I had the idea to use tree edit distance (Zhang Shasha) to layout windows in my WM. But I'm afraid that checking all possible trees would be expensive.. Does anyone know of an algorithm to generate increasingly long edit scripts so I can stop when I have a valid one instead? Vindaar: @voltist: Hmm, that is.. weird? So you only see single row if you print it? voltist: Yeah I'll link a paste Vindaar: ok, thanks voltist: Oh wait no, error on my part again. This is what is actually causing the problem: "Error: unhandled exception: Cannot evaluate a formula of kind fkVector without a data frame as input! [ValueError]" Vindaar: Hm, that could be a bug or due to usage voltist: Oh and it specifies this as well: "arraymancer_backend.nim(2102) evaluate" Vindaar: yep, that's the proc that tries to evaluate the formula. But if I don't see the context in which that formula is created it's hard t say whether it's a bug or not Vindaar: A formula is just something that''s created with the `f{}` macro voltist: Here is that last bit: https://pastebin.com/J7GKcn1p Pretty similar to how you had it but with the axes the right way round and stripped down a bit Vindaar: ah! Vindaar: I think that's just a bug. The problem is that a formula as `f{c"neurons" + 1.0}` essentially means "loop over column "neurons" and add 1 for each element". But apparently the evaluation is broken right now. I'll check it out voltist: Why do you think it wasn't broken with the formula you had in there? Vindaar: I don't quite know yet. Need to see what goes wrong voltist: It seems to work if I go with a single neuron and replace the formulas with 1.0 and -1.0 voltist: And then I get another error Vindaar: oh, I get it Vindaar: it's just a regression from a "fix" I did yesterday Vindaar: the gist doesn't work at all anymore. Sorry, I'll push a fix voltist: Ok voltist: I'll give that one last shot (and whatever this new error is) and then I'll log off for the night Vindaar: yeah, no worries livcd: PMunch: you disappeared :D! PMunch: Huh? PMunch: I'm here! livcd: PMunch: I wanted to talk to you about parsetoml and arc. Did you try it yourself? PMunch: Ah, no supakeen: I have a feeling I totally fubarred my test idea due to unfamiliarity with Nim's futures/asyncawait; here is a reduced example with genericness removed: https://bpaste.net/MP5Q the testcase works but pretty is different. Vindaar: @voltist: ok, I need to think about properly, otherwise I risk breaking other stuff supakeen: Any pointers on how to make this more Nimlike? :) PMunch: Aha, undeclared identifier deepCopy voltist: V1ndaar: All good, I'll leave you to it then. Talk tomorrow maybe. Thanks for all this help! Vindaar: @voltist: yeah, just ping me (but use @Vindaar please) Vindaar: and you're welcome! PMunch: supakeen, this fixes your issue: http://ix.io/2gBD/nim PMunch: I think it's actually a bug in asynchttpserver, line 103 should have a nil check on it. supakeen: PMunch: I've created the PR for that: https://github.com/nim-lang/Nim/pull/13867 disbot: ➥ Add isNil check to custom Content-Length. supakeen: Currently looking at adding testcases to asynchttpserver in general so the CI can catch regressions like that. ++x;: Nim has finally became a bit more popular, you guys did an amazing job. ++x;: Now goodbye people zetashift: ...goodbye? alehander92: i am tryyying alehander92: to rebase my custom branch alehander92: which was based on 1.0.6 to 1.2.0 but i have many new conflicts alehander92: is 1.2.0 supposed to be like linearly continued from 1.0.6 ? alehander92: like, i shouldnt get conflicts between commits in those 2 tags alehander92: or am i getting it wrong? liblq-dev: so I guess incremental compilation didn't make it to 1.2.0? liblq-dev: can't see it in the changelog alehander92: oh no, so probably alehander92: 1) 2.0 is based on 1.0 not on 1.0. alehander92: 1) 0.6 alehander92: makes sense, i should try to make my patch a single commit disruptek: IC is immature. Zevv: "Nim might be great. But how can a great language get traction if nobody big is behind it?" disruptek: 1.2 is a devel-side release w/o LTS. clyybber: Zevv: Oh, that HN comment :/ clyybber: I think its fine to get big in hobbyist space only. Like python did. First get people to love you, then to vote for you Zevv: right. who was behind python or ruby? clyybber: Or research space clyybber: Like at status or in bioinformatics deech: Re-ask in case someone in the morning/afternoon crowd knows: how I do I link in a `.lib` static archive on Windows with `passL`? Ideally I'd like to set the path in an env variable (`PATH` doesn't seem to work) instead of a fully qualified path to the linker. Araq: .passL: "foo.lib" deech: And do you know the env variable? Araq: const e = getEnv("badIdea"); .passL: e alehander92: has someone used wiggle ? alehander92: ahhh ok https://stackoverflow.com/questions/16190387/when-applying-a-patch-is-there-any-way-to-resolve-conflicts alehander92: so git am -3 is what one does joey: I'm trying to use the "-d:nimHasLibFFI" but it doesn't seem to be working (using prebuilt nim 1.2 binary) alehander92: i wonder if people maintain their own patches of nim do this alehander92: who * joey: ./nim-1.2.0/bin/nim c -d:nimHasLibFFI test.nim joey: /home/joey/tmp/2020-04-04/test.nim(4, 3) Error: cannot 'importc' variable at compile time; c_printf alehander92: joey oh yeah, are you installing the libffi package alehander92: no, i think you should compile the compiler itself disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek alehander92: first with that option joey: Ah, the compiler has to be compiled with that? joey: Thanks, I'll try alehander92: oh disruptek you're back here alehander92: joey yes, because in order to do the vm ffi, this has to be compiled in the vm itself i think alehander92: look at this comments https://github.com/nim-lang/Nim/pull/13091 disbot: ➥ enable testing -d:nimHasLibFFI mode liblq-dev: TIL about `@` for strings alehander92: what does it do liblq-dev: convert a string to a seq[char] sealmove: guys, have you seen an error that looks like "could not import: X509_check_host" when trying to install a package with nimble sealmove: ? alehander92: hmm liblq-dev: I think sequtils needs a `find` with a callback and similarly `findIt`, I have to loop through a sequence right now to find the first thing that fulfills a given predicate liblq-dev: or does it already exist in the stdlib somewhere? alehander92: if its not in sequtils alehander92: it should be there alehander92: i am not entirely sure tho where is the difference with `algorithm` joey: thank alehander92, it worked! alehander92: no problem, thank @timotheecour for the comments, i also used them disruptek: i have a codegen bug in nim devel against nimph tests. it's arc only. disruptek: FAILED: nim c --gc:arc -r tests/tpackage.nim liblq-dev: what is cpuRelax() useful for? Generic: isn't it for spinloops? liblq-dev: what's a spinloop? Recruit_main707: why am i getting this error? https://play.nim-lang.org/#ix=2gCo shashlick: @alehander92: 1.2.0 is branched off from devel, like 1.0.0 was shashlick: 1.0.6 was built on 1.0.0 branch, not off of devel Recruit_main707: what does 'export' is Recruit_main707: only allowed at top level mean? disruptek: shashlick: what do you mean by "how did nimph find the package"? liblq-dev: @Recruit_main707 exactly as it sounds, you can't use `export` in scopes deeper than the global scope. Recruit_main707: it seems like a library error then... Generic: liblq-dev: when you have a loop which does nothing but wait for a memory location to be set to a certain value Generic: see https://www.felixcloutier.com/x86/pause for the instruction cpuRelax compiles to liblq-dev: makes sense shashlick: disruptek: back on a laptop, re-reading the issue shashlick: basically asking how did user point to the package disruptek: i dunno, they installed it with nimble i think. shashlick: how did nimph know to look for packages in ~/.nimble/bin? shashlick: did they set a nimble dir or do you look there disruptek: nimph looks at whatever your nimble dir is set to. alehander92: shashlick yeahh sorry] disruptek: actually, it looks at all your nimble dirs. shashlick: then why don't you use $nimbleDir which was recently added shashlick: why reduce it to $nim shashlick: and what made you think that $nim = ~/.nimble/bin? where did that come from disruptek: i do, if nimph is built with a compiler that supports it. shashlick: so 1.0.6 has it right? wasn't it backported? disruptek: i don't think so. i'm using the compiler's path substitution. if it's supported, i can improve it. clyybber: lqdev: a spinloop is waiting for a lock or something similar using this: `while not lock.isAvailable: discard` shashlick: wait, i'm still trying to understand what the issue is here disruptek: the issue is that choosenim puts a shim to the nim binary in place A, which nim then uses as $nim. disruptek: it's a choosenim bug. shashlick: i've used choosenim for 3 years now and use $nim for nimterop every day disruptek: can you reproduce the issue? shashlick: https://github.com/nimterop/nimterop/blob/master/config.nims#L15 shashlick: https://github.com/nimterop/nimterop/blob/master/nimterop/ast2.nim#L5 shashlick: setting $nim with choosenim works just fine - I can import the compiler files - $nim doesn't get substituted for $HOME/.nimble/bin shashlick: the question is why you reduce $HOME/.nimble/pkgs/xyz to $nim/pkgs disruptek: i use whatever the compiler's path substitution provides. disruptek: if $nim == $HOME/.nimble/pkgs then I say $nim/xyz shashlick: where do you get $nim from disruptek: omg dude. disruptek: look at the code i linked to in the issue. disruptek: there's no bug in nimph here. shashlick: fine, I'll just stop caring disruptek: why? because you don't understand it? disruptek: you don't even use nimph, right? disruptek: and i guess kungtotte doesn't use choosenim anymore. so it only matters to you because... i dunno. shashlick: i care about nim, choosenim, nimble and nimph - if you don't want to answer questions about code you wrote then that's up to you disruptek: i don't know how to answer the question except to tell you that i use the compiler's code and as i've explained several times in the issue, nimph is doing exactly what it's supposed to do. disruptek: it shortens paths by using substitutions when appropriate. shashlick: ok then i'll figure it out myself where the issue is, no thanks disruptek: the order in which it tests these substitutions for suitability is defined in the code i linked. disruptek: there's no issue. eliezedeck: Hey guys, how can I fail a `FutureStream` and cause an exception to be raised to the `await`? alehander92: hm, good question disruptek: https://www.dropbox.com/s/mxje14sn8xschlg/map.svg?dl=0 disruptek: s/svg/png/ to maybe help you crash less. Araq: eliezedeck: future's have a 'fail' proc zah: one simple idea for the tables module: have a helper that allows me to make an efficient deletion loop. It takes a block in which I mark slots for deletion. when the block completes, the table is potentially resized/rehashed eliezedeck: @Araq yes, I've already seen that, but what if I want to inform any arbitrary reader of the `FutureStream` of an error/exception, just like with `Future`? I think that is a legitimate use case Araq: zah: interesting companion_cube: Araq: so yesterday I realized that nim doesn't typecheck the proper usage of tagged enums (or whatever the exact name for this is), any reason why not? mratsim: but it does? Araq: companion_cube: and when did you stop beating your wife? ;-) yumaikas: zah: That sounds like a nifty idea mratsim: you have a runtime error if you access the wrong field companion_cube: Araq: that doesn't help :p Araq: questions that imply wrong assumptions are mean companion_cube: hm ok, didn't mean to be mean. I was just kind of disappointed yumaikas: Araq: I'm kinda with companion_cube here, what's the wrong assumption? companion_cube: https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants <--- I thought that the fields would only be accessible in the corresponding branch of a `case` companion_cube: but you can access the "wrong" fields, and it's a runtime error, not a compile-time one Araq: yumaikas: the wrong assumption is that runtime checks to ensure safety are not "really safety" yumaikas: Ah companion_cube: I'm not talking about safety but well-typedness here companion_cube: it's like accessing a non-existing field of an object would fail at runtime yumaikas: It does mean that there are some runtime costs to unions, I suppose, but runtime checks could be later turned into comptime checks if someone was interested enough to do so Araq: it's like an "index out of bounds" companion_cube: right now it is, but I was excited about nim having sum types, is all :/ companion_cube: (hence my question "why not have that" basically) clyybber: Eh, so you complain about being able to do something? clyybber: I guess we could optionally enable a warning mratsim: how can you check at compile-time if the value are known at runtime only? Araq: companion_cube: 1. there is a warning for it and with DrNim it'll be statically checked yumaikas: What is DrNim? clyybber: A static prover mratsim: Nim + Z3 SMT solver clyybber: using z3 companion_cube: I didn't get a warning when I tried… companion_cube: mratsim: you check in each branch of a case that only the fields for this case are accessed Araq: 2. usually there is little difference between memory safety and type safety. companion_cube: it's not as hard as index out of bound mratsim: if you have "proc foo(myVariant: SumType) = myVariant.intField = 0 clyybber: we do that check already, and optimize the runtime checks away if possible AFAIK clyybber: @mratsim He wants it to be disallowed mratsim: ah mratsim: ok I see companion_cube: tbh yeah, that's a weird thing to do companion_cube: (I come from ML languages, so…) companion_cube: I don't even think this should be disallowed if there's a runtime check, I just want a compile error if I do something that will 100% give a runtime error, like `case x.tag of A: use x.bField` Araq: companion_cube: I agree that ML's design is better but Nim followed Ada's design clyybber: You will get one. clyybber: Actually let me test first yumaikas: So no type punning on unions in Nim? Araq: which has the benefit that the enum aspect is distinct from the sum type aspect companion_cube: clyybber: I didn't get one, maybe I missed sth Araq: which is a better fit for systems programming (IMO anyway) companion_cube: Araq: yeah accessing the tag is useful Araq: and makes certain patterns easier to express when it comes to serialization companion_cube: but Zig, for example, has a similar syntax/design but typechecks mratsim: Rust as well AFAIK companion_cube: yes, indeed Araq: Zig has the benefit of not being 10 years old companion_cube: oh I'm not questioning the design itself, just what I perceive to be a missing typecheck in the compiler companion_cube: kotlin does it, too, btw Araq: I know, Nim is a strange outlier companion_cube: in some ways nim seems really similar to D companion_cube: (with different choices when it comes to syntax, obviously) clyybber: companion_cube: Nevermind, it doesn't companion_cube: clyybber: yeah I was also surprised :) Araq: but *shrug* we're getting there and in the mean time you can still write perfectly good code clyybber: companion_cube: We do the same analysis in object construction companion_cube: 👍 sure clyybber: So it warns you there companion_cube: if you use a tag and fields that mismatch? clyybber: Yeah clyybber: For the assignment case it may come naturally with z3 clyybber: Because we would collect the fact that e.kind is 1 in the respective branch companion_cube: indeed it fails at construction Araq: there is warning[ProveObjectFields]:on or similar companion_cube: bootstrapped in pascal… you're a Wirth fan? :) KingDarBoja: Anyone has issues with VSCode nim extension not reporting errors unless you save another file? Varriount: @KingDarBoja I've had it do that when using find/replace Varriount: Although, in that case I've just had to re-save the current file. KingDarBoja: Resaving the current file takes away the error lint KingDarBoja: I have to save another file in order to trigger the lint which is very weird clyybber: companion_cube: bootstrapped in nim now companion_cube: yeah, I saw that in some docs leorize: if you go back far enough in nim-lang/Nim commit history, you'll find the original pascal-based compiler mratsim: @companion_cube, lots of Modula 2 and Oberon inspiration in Nim Varriount: @KingDarBoja Could it be interference from another extension? KingDarBoja: Jummm, this is the only Nim extension I have installed, but worth checking for other extensions Varriount: @KingDarBoja You might also check the debug console disruptek: Araq: seems like drnim requires --threads:on in its nim.cfg. disruptek: <-- linux alehander92: companion_cube is this about rust-like enums? companion_cube: alehander92: yeah, sum types, in a way companion_cube: sum types go hand in hand with pattern matching/exhaustiveness checking/… leorize: !repo gara disbot: https://github.com/alehander92/gara -- 9gara: 11 15 63⭐ 5🍴 leorize: !repo patty disbot: https://github.com/andreaferretti/patty -- 9patty: 11A pattern matching library for Nim 15 173⭐ 10🍴 leorize: companion_cube: ^ one of them provides sum types, one of them provides pattern matching :) Araq: companion_cube: I suppose I used to be KingDarBoja: Ummm how to check a child object is empty (nil?) ? Varriount: if isNil(object) KingDarBoja: That only seems to work for the parent object, not the child one KingDarBoja: Wait a minute and I will bring an example eliezedeck: > Hey guys, how can I fail a `FutureStream` and cause an exception to be raised to the `await`? ⏎ ⏎ Anyone? KingDarBoja: https://play.nim-lang.org/#ix=2gDh the if part liblq-dev: @KingDarBoja regular objects cannot be nil liblq-dev: only ref objects KingDarBoja: https://nim-lang.org/docs/system.html#isNil%2Cref.T Ah, that what it means... KingDarBoja: Thank you liblq-dev liblq-dev: yeah, you probably want an Option if you want this object to be optional. see the `options` module liblq-dev: is there a way of specifying command line params on the nim playground? leorize: liblq-dev: no leorize: well you can write your nim file so that it calls the compiler to compile itself again with all the flags you want :P liblq-dev: but that's hacky and not really feasible for bug reports liblq-dev: imo, if the first line begins with `#! nim` or something, it should be interpreted as command line parameters leorize: or you can just have a field for that :P leorize: https://github.com/nim-lang/Nim/blob/devel/lib/system/repr_v2.nim <- any how the implementations are all in here leorize: so should be simple to add uint support mratsim: @liblq-dev, I've fixed your issue with Weave by the way mratsim: it was due to Nim sets not being able to hold "-1" and somehow at the beginning of June there was a corner case where it worked mratsim: and after some patch it was fully disabled mratsim: (https://github.com/mratsim/weave/issues/106) disbot: ➥ Nim sets don't support negative ID in thief ID checks KingDarBoja: liblq-dev: Yeah, using that right now 🙂 clyybber: @mratsim Can you report it upstream? Seems like a bug to me mratsim: well it was a bug that was fixed and I was relying on the bug clyybber: oh mratsim: I was doing "ascertain: req.thiefID in {myWorker().left, myWorker().right}" and thiefID could be negative clyybber: and now thiefID can't be negative anymore? clyybber: I thought you just changed the if condition clyybber: To an or mratsim: It's a sanity check, I just changed the check to "ascertain: req.thiefID == myWorker().left or req.thiefID == myWorker().right" mratsim: the bug was that somehow you could construct a set with negative int in the past I guess leorize: !issue set variable disbot: https://github.com/nim-lang/Nim/issues/13764 -- 3set[T] construction is not typechecked for variables 7& 29 more... mratsim: but only in one specific situation because I tried with naive {-1, 1} in old Nim version and the compiler refused Araq: I remember seeing a bugfix for that clyybber: but seq[int16] should still allow -1 right? leorize: still no fixes for this problem in set construction mratsim: well that one is strange, int16 should have -32768..32767 range but currently it has 0..65535 Araq: ah mratsim: Weave 0.4.0 released. Finally I can target a stable Nim version Zevv: congrats mratsim! liblq-dev: @mratsim, yeah, I saw that in my e-mail box in the morning :) liblq-dev: thanks for the fix ryukoposting: new PR for the SDL2 bindings https://github.com/nim-lang/sdl2/pull/122 disbot: ➥ Add Audio Streams API, docs, example ; snippet at 12https://play.nim-lang.org/#ix=2gFd solitudesf: ryukoposting, thats cool, but where is new video ryukoposting: lmao ryukoposting: I want to make videos about my new project (which uses a toooooon of macros) ryukoposting: however, due to the rapture, I am currently living out of my parents' basement so the audio would be awful ryukoposting: and I gave my nice mic to my mother, since she's a teacher and needs it more than I do right now, so the audio would be even worse dom96: ryukoposting, nice, merged rayman22201: sigh. No Nim async experiments for me today. I have catch up on day job work that I didn't get finished during the week. dom96: rayman22201, work on a weekend? Keep that work-life balance in mind ryukoposting: now that I basement dwell, suddenly I have more free time rayman22201: Thanks dom96. I try not to make it a habit, but sometimes I can't help it. KingDarBoja: That's terrible, watch out as dom96 said alehander92: companion_cube alehander92: patty and gara alehander92: were supposed to merge eventually alehander92: so in theory we can have this based on macros alehander92: 1) exhaustive checking if i recall correctly alehander92: with a bit more work alehander92: its not really limited by the language disruptek: shashlick: maybe you could explain to me your code that causes nimph to produce extra output in 1.2 and less in 1.0.6? shashlick: What are you seeing disruptek: well, i've tried to explain it many times. disruptek: 👭cloning https://github.com/nitely/nim-unicodeplus... disruptek: Hint: used config file '/home/adavidoff/git/Nim/config/nim.cfg' [Conf] disruptek: Hint: used config file '/home/adavidoff/git/Nim/config/config.nims' [Conf] disruptek: Hint: used config file '/home/adavidoff/git/memrecall/nim.cfg' [Conf] disruptek: Hint: used config file '/home/adavidoff/git/memrecall/deps/pkgs/nimterop-#master/nim.cfg' [Conf] disruptek: Hint: used config file '/home/adavidoff/git/memrecall/deps/pkgs/nimterop-#master/config.nims' [Conf] disruptek: to reproduce, try using nimph on 1.2 versus a version built with 1.0.6. shashlick: What did you run - you bootstrapping nimph? shashlick: Or installing a package disruptek: i'm trying to build memrecall. disruptek: it depends on rapid. rapid depends on glfw, nimterop-wrapped. shashlick: Ok shashlick: You referring to the cfg vs nims order of loading? disruptek: no idea. shashlick: Ok so is the issue that you are seeing more hints or that it doesn't with at all shashlick: Work disruptek: well, i have two problems right now. disruptek: but, i remembered that you care about nimph. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek shashlick: Not able to join the stream right now but give me something specific disruptek: nimble build wants to install [email protected] though i only require 0.7.2 and i have 0.8.0. shashlick: I know nimterop needs more work to make nimph more reliable disruptek: just trying to build nimterop. disruptek: i guess nimph cannot build nimterop anymore. shashlick: What changed? disruptek: nimterop requirements? disruptek: lemme try rolling it inside the nimph localdeps. disruptek: nimble dump is super slow right now. feels almost hung. took 14.2s just to execute `nimph path nimterop`. shashlick: I've been neck deep in getting ast2 working disruptek: yeah, i cannot build nimterop, even an old version. due to needing latest unicodedb. shashlick: Yes regex has made many upstream changes shashlick: Added a new segmentation package shashlick: I was thinking of moving back to pcre but it doesn't work at compile time disruptek: i can build it just fine with nim, but not nimble. disruptek: i usually just `nimble build`. disruptek: maybe nimble is the one producing extra output? disruptek: hmm, no. shashlick: I just ran the bootstrap yesterday and it worked shashlick: What are you running - can you gist moerm: Hello everyone KingDarBoja: Hi Rika: Hello exelotl: Would it be considered good form to do this? https://hastebin.com/raw/eqigusabob.nim exelotl: essentially building 2 or more implementations into 1 function, to reduce clutter in the docs. Rika: i dont see why not shashlick: disruptek: where can I find memrecall disruptek: !repo memrecall disbot: https://github.com/liquid600pgm/memrecall -- 9memrecall: 11This future is war. Go back in time to fix it all. 15 17⭐ 1🍴 shashlick: oki cloned it, set NIMBLE_DIR and ran nimph doctor disruptek: why would you set NIMBLE_DIR? shashlick: for localdeps? disruptek: do i have to do that now? shashlick: no i'm just telling nimph to shashlick: unable to resolve requirement `nimYAML**` disruptek: i don't do that. does it help? shashlick: ok i'll get rid of nimble_dir disruptek: yeah, it's nice that the compiler is case-sensitive but nimble isn't. disruptek: lovely, huh. disruptek: i use localdeps via nim.cfg. i --clearNimblePath and --nimblePath="$config/deps/pkgs/" and then i `mkdir deps` and `nimph doctor`. shashlick: ok cool - how do I deal with this nimYAML thing disruptek: i dunno, i couldn't get past nimterop. disruptek: probably a pr to memrecall or something. disruptek: i am batting .500 on such PRs. disruptek: i think people think they are obnoxious. disruptek: i think people's misuse of capitalization is obnoxious. moerm: - afk - dwdv: When asked about what should be removed for v2: "<4raq> remove proc vs iterator overloading". Why's the overloading regarded as a bad thing? dwdv: What would the alternative look like? disruptek: they wouldn't share the same "namespace" leorize: dwdv: currently an iterator can overload a proc, and vice versa :) dwdv: Sure, sure, what would foo.split look like afterwards? Would we need to put foo.iter.split or something similar? Rika: ~~toSeq(foo.split)~~ dwdv: Alright, or the other way around. Shame toSeq is one of the UFCS exceptions. Araq: it was only an example I remembered, it makes much sense, consider that typeof(x) grew a special mode to distinguish between iters and procs Rika: id like that toSeq be ufcs-able before this overloading removal is done shashlick: disruptek: i need some steps to reproduce some issue - not sure what to try here so any step 1 this step 2 that will be useful disruptek: if you made the nim.cfg, you can issue the following: disruptek: cd `nimph path nimterop` disruptek: then attempt to build nimterop with `nimble build` or `nimph build`. shashlick: how does nimterop get there in the first place disruptek: i issued a `nimph clone nimterop`. i also tried updating it to HEAD. shashlick: ok Rika: is countIt new in 1.2 sequtils? Rika: new thought... how do i access old version docs shashlick: disruptek: I can fix that choosenim issue - are you good with a PR for that in nimph? disruptek: to do what? disruptek: it's a choosenim bug. shashlick: did you see my comment on the issue disruptek: nope. shashlick: see what you think Araq: https://nim-lang.org/1.0.6/manual.html Rika, like so, replace 'docs' with the version number Rika: haha, thanks, it would prolly help if you added a selector in future docs versions like what python did disruptek: shashlick: that PR has to be made against the compiler, as that's where the "bug" is, if you consider it a bug. shashlick: well, if findExe("nim") finds the shim/symlink, it should simply find the real location within choosenim disruptek: i guess you could deprecate $nim and tell people to use $choosenim instead or something. shashlick: its not a nim issue nor nimph issue disruptek: so we agree. shashlick: but given choosenim exists and uses symlinks/shims, it is good to handle that case shashlick: why can't nimph be aware of choosenim disruptek: there's lots of bad software i don't work around. that's why i had to write nimph. shashlick: well, if you want to improve the situation, you have to build on what's already in use and improve as you go disruptek: what exactly should nim do with a nim.cfg that says $nim in it? kungtotte: choosenim is also the officially recommended installation method. disruptek: how does that have anything at all to do with nimph? shashlick: and i think the community deserves nimph to work well regardless of how nim was installed disruptek: no one is recommending that anyone use nimph. disruptek: what exactly should nim do with a nim.cfg that says $nim in it? shashlick: it works just fine regardless of whether you use choosenim or not shashlick: it only breaks because you compile in the compiler code into nimph and override getPrefixDir disruptek: how do you figure? $nim doesn't work when it appears in a .cfg and you use choosenim. shashlick: and you have to override it no doubt, but findExe("nim") isn't always going to work disruptek: am i wrong about that? Araq: if it helps, I'm willing to "fix" it in the compiler, whatever that means shashlick: no it works fine shashlick: i tested it - using $nim is handed correctly by nim since th binary is nim.exe shashlick: whereas in your case, the binary is nimph so you need to find the real nim shashlick: compiler is not broken disruptek: wait, what? disruptek: maybe i don't understand the problem after all. disruptek: when i ask the compiler what $nim means, what does it say? leorize: it says, you gotta be the compiler :) shashlick: https://github.com/disruptek/nimph/blob/master/src/nimph/config.nim#L106 moerm: Araq Hello ;) - A propos fixing in the compiler: I *really* need a clean way to pass compiler args for *only* a given C file along with .compile - but *not* for the Nim file itself shashlick: $nim in compiler is where the exe is and it works correctly irrespective of whether it is a shim or symlink disruptek: blame leorize. disruptek: the one line someone contributed is a bug. disruptek: i told you. leorize: the other way is to hardcode the path to the compiler that compiled nimph :P exelotl: lol I've been using bootstrap recently and the version selector in their docs is completely broken disruptek: yes, and that's what i did. shashlick: that won't work since the compiler in use can change leorize: and I hate it :) exelotl: I expected better from "the world's most popular" frontend library disruptek: look, i want this software to be correct. disruptek: it's on you to convince me what that means. shashlick: i'll submit a PR, please see if you like it moerm: I tried push ... passC ... compile ... pop. didn't do what I needed. The *whole* project was compiled with those args disruptek: as far as i'm concerned, it's correct now. leorize: you can be as correct as you want, but it has to work disruptek: not for people that want to use choosenim. disruptek: this is not a democracy. disruptek: if you want to use software that plays games with the path, you should expect shenanigans. shashlick: come one be realistic, don't restrict your software with such conditions disruptek: what conditions? disruptek: i don't believe that choosenim is doing the right thing. disruptek: it's not correct. shashlick: why is it wrong Araq: moerm: ok disruptek: well, i'm not sure i understand the problem anymore, honestly. Araq: how about this: .compile: ("file.c", "file.o", "more options here") moerm: Araq Thanks a bunch! disruptek: i provide a prefix directory based upon the location of the compiler executable to a config object in memory. that is then later used to compute $nim. disruptek: is there a better way to compute $nim? moerm: Araq yeah that should do it. Great, that will make my life (well, my builds) a lot easier disruptek: we could use the config.library iirc. leorize: nope, the compiler should provide it disruptek: so we should run the compiler? leorize: actually I lied, there's a better way, is to ask the compiler using a small hack leorize: yea Araq: moerm: ah hmm the tuple is already used for wildcard .compile disruptek: we can `nim dump` i guess. moerm: Araq ?? Araq: will come up with something but I should sleep. good night disruptek: peace moerm: Araq Thx, sleep well and a nice weekend ;) disruptek: how is it that the compiler knows where its libs are but i cannot? Araq: leorize: the compiler should be aware of Nim shims and ignore them Araq: disruptek: the compiler uses relative addressing and nimph is not in $nim/bin disruptek: the shim is a shell script? leorize: nim dump seems to be the way to go, since the only thing you needed was the path to system libs leorize: nim dump --skipUserCfg:on --skipProjCfg:on --skipParentCfg:on moerm: Hey guys, let the man fall into his bed! shashlick: well the same issue will occur if nim is installed to /usr/bin and libs to /usr/lib Araq: disruptek: maybe on Unix. on Windows it's a fake nim.exe iirc shashlick: you cannot assume that findExe("nim").parentDir().parentDir() = $nim disruptek: so we need this code added into the compiler so that the config can do proper pathSubs for tooling. shashlick: this is like findExe("gcc") might not be the gcc used by nim since it could be hard coded in nim.cfg disruptek: it's silly to suggest that all tools should implement this themselves. shashlick: that I agree, but using $nim works fine (outside the /usr/bin use case) shashlick: this is an issue because you are compiling in the code shashlick: and that is a valid use case no doubt disruptek: yes, it's an issue that we need to work around for all tooling. leorize: this is why I just never import the compiler disruptek: silly. leorize: it's not designed to be used outside of the compiler shashlick: frankly i'm loving importing the compiler disruptek: the compiler is the most powerful nim program ever made. shashlick: i'd prefer if it were a lib though shashlick: shared by all the tools that use it shashlick: nimgrep, nimsuggest, nim itself shashlick: libnim disruptek: nimph is 540,000 lines of nim. leorize: shashlick: well it's technically a lib :p shashlick: compile the lib once and use it in many places disruptek: i think he means dynlib. leorize: nim shared library story is not a nice one :P disruptek: not on unix. moerm: I'll go too. Have a nice weekend everyone disruptek: cya disruptek: i'm not really clear on how we solve this, though. shashlick: anyway, that's a dream, don't want to distract here shashlick: i think for the near term, we can detect and use choosenim's path leorize: I'd say call `nim dump` then parse the output to get the list of system search path that you're looking for shashlick: longer term, $nim could be more resilient Araq: disruptek: listen to leorize please disruptek: yes, i am inclined to do it that way. disruptek: it will be choosenim-proof. shashlick: how does nim handle /usr installs today? how does it know to find lib in /usr/lib leorize: shashlick: hardcoded leorize: grep for /usr/lib/nim shashlick: but you cannot just run compiler once and cache it cause it can be changed shashlick: so for every time that nimph needs $nim, it will have to run nim disruptek: yes, that's just once per execution, though. shashlick: well, once everytime you actually need $nim, could be omitted if not needed in that particular run shashlick: not sure if that makes sense tho, don't know nimph details disruptek: no, because to setup the config correctly, we need to know the lib paths. disruptek: nimph has complete knowledge of the env. leorize: `nim dump` and you got all the paths :P leorize: we should add more things into `nim dump` disruptek: yes, but the order is brittle. Araq: there is also a json mode for 'nim dump' leorize: the json mode requires a .nim file, for whatever the reason Araq: forgot how to enable it though Araq: great... Araq: good night leorize: g'night dom96: why do you need these paths? disruptek: you can pass it /dev/null disruptek: nimph has complete knowledge of the env. disruptek: it nicely provides the prefixdir for me. 🥳 leorize: we just need a small patch to let it run without requiring a project file passed disruptek: that will be a neat new feature to play with. leorize: lol it doesn't even need the path leorize: you can pass in whatever, it doesn't check disruptek: nice. disruptek: alright, i'll code this up tomorrow. disruptek: thanks, shashlick. disruptek: you see, it can work if you put the effort in. 😉 dom96: right, I still don't understand what the purpose of this is disruptek: choosenim's shim causes nimph to setup the compiler's config incorrectly. disruptek: which causes it to produce $nim paths that are incorrect. dom96: what changes does nimph make to the compiler's config? disruptek: i don't understand. disruptek: none. disruptek: because the compiler isn't capable of parsing nimble package structure, we have to supply --path statements. dom96: in what way does nimph "setup the compiler's config" then? disruptek: we shorten these automagically using the compiler's pathSub routines. disruptek: $nim is one such substitution. disruptek: it holds the wrong value when nimph is used with choosenim. dom96: Nimble packages aren't stored relative to Nim's location disruptek: because the location of nim.exe has no bearing on the location of the libraries. dom96: How are you using $nim to shorten these paths, and why are you even doing that? disruptek: i'm doing it because it's nice. disruptek: it's a nice feature. dom96: In what way is it nice? lol disruptek: i understand that it might not make much sense when you use a package manager that doesn't support local deps. dom96: and I still don't understand how you shorten these, can you give an example? disruptek: sure. my home directory is /home/adavidoff. disruptek: i put most of my projects in /home/adavidoff/git. disruptek: when i have local deps, which is 100% of the time, i put them in project/deps. disruptek: this turns into project/deps/pkgs for nimble-compat reasons. disruptek: so i specify my `--nimblePath="$config/deps/pkgs/"` disruptek: because this is uniformly correct and shorter than specifying my home, etc. disruptek: nimph automatically shortens paths when it adds --path statements to a nim.cfg. shashlick: I think the use case for $nim was probably mainly for compiler disruptek: yes, that's what i use it for. shashlick: Or did you expect packages also to be there?disruptek disruptek: i wanted to vcs a .cfg that specified --path="$nim". disruptek: s/vcs/distribute/ shashlick: Yep so this was just a case where $nim showed up there incorrectly shashlick: dom96: this is the usecfg feature we discussed at length disruptek: no, it's correct. disruptek: what's incorrect is the assumption that `(which nim)/../lib` is the config.libpath. shashlick: Well if you had the right compiler path, you'd never expect anyone to put nimble packages in the compiler base path disruptek: it has nothing at all to do with packages. disruptek: nothing. shashlick: Never know though, there will always be someone disruptek: nimph has a bug regardless of whether it's working with packages. dom96: I'm still lost as to why this is important for nimph. But it's late so I'm likely just too tired to understand. disruptek: it's important because bugs cause grief. disruptek: broken windows. dom96: what bugs? How does this fix bugs? disruptek: i just can't keep talking about this on stream. disruptek: it's really not important. disruptek: it'll be fixed tomorrow. disruptek: 😉 shashlick: dom96: nimph is creating nim.cfg with $ paths so that they aren't hard coded shashlick: Choosenim creates shims / symlinks so $nim was coming out wrong dom96: Why is nimph creating paths containing $nim though? shashlick: So nimph will use nim dump to get right $nim ryukoposting: this is the first time I've heard anything about nimph, shows how long I disappeared for lol disruptek: $nim was the shortest path. Rika: how long have you been gone for? shashlick: Cause findExe("nim") is ~~/.nimble/bin/nim so $nim becomes ~~/.nimble and then path to and pkg in ~/.nimble/pkgs became $nim/pkgs dom96: Now I get it. That's a hack that depends on how choosenim installs nim dom96: If you're putting these into the .nim.cfg and intend it to be pushed to git then that's a horrible idea disruptek: hey, thanks, buddy. disruptek: i think your choosenim shims are a horrible idea. 😁 dom96: Why? disruptek: muddy semantics that serve no purpose. disruptek: but i'm on stream and really don't have the interest in debating it. dom96: You think I implemented these shims for fun? :) disruptek: you can come on mumble if you want to chat about it. ryukoposting: Rika: few months dom96: They have a very particular purpose: Windows has no symlink support ryukoposting: what are shims? Rika: executables that redirect input to the real executable ryukoposting: as a way to have a standard reference point for where to find a program, even when it isn't there? dom96: as a way to emulate symlinks because Windows sucks ryukoposting: I've been developing my current project on Windows since it's something that will almost exclusively get used on windows, yeah this whole "4 different terminals to do what unix does with 1" thing is annoying ryukoposting: why do you need to emulate symlinks? timotheecour: @dom96 i’ve always wondered about this; windows does have symlinks AFAIK https://docs.microsoft.com/en-us/windows/win32/fileio/symbolic-links; btw that’s the issue talking about using symlinks: https://github.com/dom96/choosenim/issues/126 disbot: ➥ `Error: Spawning of process failed` caused by choosenim using a wrapper process instead of symbolic link ; snippet at 12https://play.nim-lang.org/#ix=2gGt dom96: ryukoposting, for choosenim leorize: ryukoposting: choosenim need to switch between different compiler versions without altering paths leorize: timotheecour: you need admin to create them dom96: ^ also they suck, and only work on latest Windows versions AFAIK dom96: I for one care about supporting as far back as Windows XP dom96: or at least I did at the time timotheecour: https://www.wintellect.com/non-admin-users-can-now-create-symlinks-windows-10/ timotheecour: (from dec 2016) leorize: in windows 10 :) shashlick: This isn't 100% ryukoposting: What if you just had an environment variable that pointed to a directory with some kind of compiler manifest? Then that file could just be JSON with either a bunch of absolute paths, or paths relative to the path specified in the env variable leorize: ryukoposting: why are you making this more complicated :P shashlick: Scoop uses links and even as admin I couldn't delete them ryukoposting: environment variables have relatively good portability leorize: or you can use shim binaries shashlick: Modifying path doesn't work either on windows, child process cannot change path for parent cmd process leorize: which is much simpler :p mratsim: @disruptek, are you rewriting PathOfBuilding in Nim? :p leorize: shashlick: I never figured out how chocolatey did it, though it might just be because it's written in batch/powershell ryukoposting: Are the shims pointing to different compilers? leorize: yes, everytime you switch, new shims disruptek: mratsim: yeah disruptek: well, sorta. disruptek: bbiab dom96: nimble does it a slightly different way btw, it sorta works but had flaws too (it generates .bat and .cmd files) leorize: shims are pretty battle proven leorize: chocolatey uses them since forever disruptek: you know what's battle-proven? disruptek: rename. Rika: rename what disruptek: it's atomic and very, very fast. shashlick: Nimble is worse since findExe doesn't work shashlick: On windows ryukoposting: huh. I guess it makes sense. shims have a nice advantage in the sense that you can call them like a normal program mratsim: findExe works on Windows in powershell dom96: disruptek, so tell me, do you have an alternative that isn't horrible? :) shashlick: Cross platform is hard even in Nim mratsim: findExe is broken in bash windows leorize: @mratsim: it's not broken :) ryukoposting: I guess I wouldn't worry about atomicity in something that a user is changing very rarely, and from a command-line tool shashlick: I had to change nimterop to look for toast in relative path since findExe wasn't reliable leorize: bash is broken :) mratsim: It ate about 2 days of fighting against Windows CI to finally have a script that work on WIndows + Mac + Linux timotheecour: I think we could simply add a `—usesymlinks` option: `choosenim —usesymlinks path` leorize: please don't complicate it anymore timotheecour: so vast majority of users who are on a OS that can use symlinks can use that, others (on old windows versions) can keep using shims. leorize: uhmm, on linux it uses symlinks leorize: shims are only used on windows iiuc timotheecour: Huh? not on OSX at least timotheecour: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e89198c167a0419f1877556] ryukoposting: I mean, why would you use them on a system where symlinks exist dom96: it doesn't timotheecour: shims IS the complication. It caused bugs like https://github.com/dom96/choosenim/issues/126, and is less performant as it involves a process call overhead just to invoke nim. It’s fine as a workaround if your OS is old windows, but other ppl shouldn’t have to suffer from its consequences disbot: ➥ `Error: Spawning of process failed` caused by choosenim using a wrapper process instead of symbolic link ; snippet at 12https://play.nim-lang.org/#ix=2gGt ryukoposting: that was directed at leorize, dom ryukoposting: If a single extra process call is the thing causing performance issues with your builds, there's a bigger problem and it has nothing to do with nim timotheecour: I think `—usesymlinks` is the perfect answer. Nothing complicated. leorize: don't add more choices, make the choices permanent leorize: use symlinks when supported, else shims Rika: the shim overhead is barely noticeable leorize: also please avoid symlinks on windows ryukoposting: I can see where shims are fragile, for sure, but what on Windows isn't leorize: anything related to new features in windows that tries to emulate unix is inherently broken timotheecour: on OS where symlinks are always supported, we can make `—usesymlinks` the default. on windows, it makes senses to make it an option ryukoposting: until fork() exists in windows, nothing except the most trivial stuff made for unix will work 100% right on windows leorize: nah, choosenim is supposed to be "the simple tool" to manage your installations leorize: more choices are evil in this case dom96: yep ryukoposting: the entire process model is fundamentally different, and shims seem like the most straightforward way to deal with that awr1: fork() was a mistake ryukoposting: your opinion is trash and you should feel bad awr1 awr1: lol leorize: lol leorize[m]: lol ryukoposting: lol KingDarBoja: lol ryukoposting: KingDarBoja I admire your bravery awr1: windows aint bad ryukoposting: In other news, I'm making a Visual Novel engine to end all other visual novel engines KingDarBoja: I have seen the symlink issue on Windows several times, mostly on NodeJS stuff awr1: https://www.microsoft.com/en-us/research/uploads/prod/2019/04/fork-hotos19.pdf leorize: windows is where bugs are features, tbf KingDarBoja: The only thing that is really annoying are tutorials always being made on linux or mac... But there are few on Windows lol awr1: honestly most of the win32 api is pretty straightforward leorize: WSA_poll randomly broke? oh, we know but everyone has been walking around it, so it's a feature now :) ryukoposting: it's all Nim macros sitting on top of SDL2. dom96 there's a reason I made that PR lol leorize: I don't mind not using fork(), it's an artifact of a time where posix refuses threads mratsim: pitchfork() timotheecour: => https://github.com/dom96/choosenim/issues/189 (regarding shims vs symlinks) disbot: ➥ use symlinks instead of shims where symlinks are supported awr1: introducing the all-new system call, `spoon` ryukoposting: there are cases where processes are the appropriate solution. If you *can* do something with threads, 99% of the time you shouldn't be doing it with processes ryukoposting: that doesn't make fork() bad, it serves an entirely separate purpose from threads leorize: the fork()-exec() pattern for spawning is bad leorize: sans where it makes sense leorize: (ie. security applications) leorize: but for general usage, it's slow and it's completely horrible to work with ryukoposting: compared to what alternative? leorize: posix_spawn Rika: awr1: should have said cutlery ryukoposting: on any system with an MMU posix_spawn is just fork-exec with a couple other minor system calls in between leorize: you don't have to do makeshift message passing just to tell your parent that you couldn't exec() to the child due to some syscall failed before leorize: you don't carry the cost of copying the entire address space ryukoposting: you don't copy the entire address space with fork leorize: yes, you still do leorize: vfork() existed just to avoid that leorize: and then it died because it's too unsafe leorize: also, posix_spawn is implemented efficently on non-linux systems leorize: ie. it's vfork()-exec() on haiku leorize: on linux you have to ask for it to be efficient, which is why we still use our clone()-based implementation in the stdlib awr1: there has been pushback to implementing posix_spawn with fork ryukoposting: fork doesn't copy a process' virtual address space with the exception of the few places it has to, e.g. the page currently containing the bottom of the stack ryukoposting: it's all COW leorize: well it has to copy the stack, and that's not small leorize: gitlab actually measured the impact in their own software caused by fork-exec awr1: COW also invokes its own problems ryukoposting: the default limit on linux AFAIK is 8MB ryukoposting: and it only /needs/ to copy whatever frame the stack pointer is currently in. When the sp drops back below that frame, or a write occurs based on an offset that goes up the stack far enough to be in a different frame, then it copies leorize: well the page table still have to be copied awr1: do fork/COW impls do that in practice RE: stack frame copying awr1: i would have just assumed that they would copy the whole stack leorize: this problem has been well researched and has it's impact measured in a real-world program ryukoposting: in a hierarchical page table, which is all x86 machines, you'd need to copy the outer page and one inner page at a minimum. only 8K dryajov: I'm trying to dump the heap contents using `-d:nimTypeNames` and `dumpNumberOfInstances`, but getting `undeclared identifier: 'dumpNumberOfInstances'`, any hints at how to get it working? Rika: thats not a function anywhere dryajov: interesting, it actually builds, but vscode complains about it... never mind, seems to work 🙂 sagax: hi all! sagax: how to `echo` without new line/ sagax: ? leorize: stdout.write <- use that instead axion: how do i divide 2 uint64's to get a float? Yardanico: float(a / b) ? Yardanico: or you want float(a) / float(b) ? axion: it's telling me that there is no overload for uint64, uint64 Yardanico: ah, use "div" then Yardanico: "a div b" if you want to divide uint64s axion: doesn't that do integer division dropping the remainder? Yardanico: well, if you want to get a float then do Yardanico: float(a) / float(b) axion: Ok cool sagax: thanks axion: @Rika I have more questions for you sometime :) Rika: 😮 Benumbed: So while hunting for something else today, I found this: https://scripter.co/notes/nim/ Benumbed: It may help the Python people who drop in Benumbed: (or other languages, Python just seems to be the common denominator) leorize: that's @kaushalmodi blog iirc Benumbed: It's not linked in 'Learn' narimiran: it is narimiran: Nim Notes: A collection of Nim snippets with brief notes. Benumbed: Ohhh oops, I was looking for 'script' as a keyword 🙂 Benumbed: Hah, I just found the AKB48 reference in `unittest`'s docs Benumbed: Someone's a fan of JPop 😄 munksgaard: For weird reasons I want to `nim compile` a file with no .nim extension, is that possible? It seems like when I try to do `nim compile foo` it automatically adds a `.nim` at the end. Araq: maybe it's possible but files are better with extensions PMunch: Sure it's possible: "mv myfile myfile.nim && nim c myfile.nim; mv myfile.nim myfile" PMunch: Oh wait: "mv myfile myfile.nim && nim c myfile.nim && mv myfile myfile.a; mv myfile.nim myfile" PMunch: Or just use -o I guess munksgaard: Okay, thank you :-) Araq: narimiran, I think it's something like Araq: "converter allowed for distinct types" Araq: and localized conversions based on proc definitions like narimiran: (before anyone gets scared, this is just some "thinking aloud" about converters, nothing serious (yet :P)) Araq: proc `+`(x: Matrix; y: Matrix.alsoAllowedAs(Vector, toVector)): Matrix Araq: something along the lines of varargs[`$`] where we got it right Araq: yeah, like this Araq: proc `+`(x: Matrix; y: convert[Matrix, toMatrix]): Matrix Araq: then toMatrix can also be a template or a method Rika: `use strformat module instead, round is deprecated` what, so i have to fmt it then parseFloat? flywind: `parseFloat` and then `round`? generic round is deprecated, but float round is ok. Rika: i already have it, i dont understand what you mean by generic round flywind: find this: https://forum.nim-lang.org/t/4402 WilhelmVonWeiner: does the db_mysql library keep the mysql socket alive? WilhelmVonWeiner: or will it eventually timeout? Araq: dunno, try it WilhelmVonWeiner: well i think it's timing out but hard to test especially as i cant get very many erros logged from it eliezedeck: Hey guys, using `httpclient` ... how can I POST dynamic data that is not yet known in advanced, and is generated with time? Yardanico: you want to stream POST request? is that even possible with http 1? Yardanico: I'm not really sure if that's possible with httpclient eliezedeck: I have a Golang program that does exactly this, but I'm looking for a way to do this in Nim Recruit_main707: by "dynamic data that is not yet known" you mean you dont know its size? eliezedeck: for Golang, the API takes an io.Reader ... so, you can basically plug in any reader and stream POST anything to the server eliezedeck: I believe one will have to set a size in HTTP/1.1 eliezedeck: but the content, you should be able to stream it, as you create it dynamically Araq: the API uses a 'bodyStream' Araq: er Yardanico: it's only for the response :( Araq: the implementation uses a bodyStream but it's not exported eliezedeck: indeed, Response only Recruit_main707: can we interop with Go? eliezedeck: oh... for the Request? Yardanico: well, scrolling through httpclient I don't think it supports that shashlick: Shouldn't be hard to add eliezedeck: yes, I also looked at it, and it's only for Response ... not request eliezedeck: I'll create a bug report to track this eliezedeck: > but bear in mind that adding new features to the language is currently a low priority. eliezedeck: hmm... Yardanico: it's okay inv2004_: I did: proc auth(): Future[JsonNode] {.async.} and result.add(json) internally. It compiles, but I have "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" is it ok ? Yardanico: can you somehow make a reproducible example? and is it with latest stable nim? Yardanico: maybe your "json" variable is not initialized Yardanico: oh yeah, I just tested it Araq: eliezedeck: stdlib additions are not language features Yardanico: you didn't initialize that "json" variable most likely inv2004_: @Yardanico, if it would not be initialized I would expect compile error anyway, let me create one Yardanico: inv2004_: well I already made it myself kinda inv2004_: Nim Compiler Version 1.0.6 [Linux: amd64] inv2004_: @Yardanico, nice Yardanico: but JsonNode is a "ref" so in "var json: JsonNode" json will be "nil" inv2004_: But I do echo json.pretty and I see it Yardanico: well, then can you make an example? :) Yardanico: in my code I just tries to declare "var a: JsonNode" and "result.add(a)" with the proc definition like in your case eliezedeck: Here is the bug report: https://github.com/nim-lang/Nim/issues/13856 eliezedeck: At this time, I'm going to have to prepare and send a string eliezedeck: and on that subject: how can I get a string from a pointer (created using `alloc()`) ? eliezedeck: may be casting? but then that won't have a proper length eliezedeck: ... it's been a while since I last used Nim, I'm relearning again :) ... Recruit_main707: varname[] will give you what the pointer points to eliezedeck: and what about the length? needless to say that this is an buffer that has plenty of null-char in it Rika: prolly have to figure the length out yoursel Rika: f eliezedeck: I know the length Recruit_main707: then what length do you want? eliezedeck: source is: `pointer` + `length` .... desired outcome: `string` with length Yardanico: well I'm not sure if that's really correct Yardanico: but I did $cast[cstring](outData) in some project where "outData" is "ptr cuchar" Yardanico: basically to create a nim string out of C string (it'll do an allocation too because nim strings are GC'd IIRC ) eliezedeck: it is a `pointer` to a series of `uint8`, just a sequence of bytes ... I allocated it using `alloc()` so I know the exact `length` ... but to create a string out of it, one will have to cast, and *then*, also set some may be hidden field for the `.len` to be reported correctly, right? inv2004_: @Yardanico, https://gist.github.com/0a71607514cb278bcd64543c225e1166 Yardanico: well idk how it worked lol eliezedeck: or, may be, I should have created a `string` in the first place? Yardanico: why are you even doing alloc ? Yardanico: inv2004_: ahhh Yardanico: I understand now Rika: you'd prolly have an easier time making the string first then the cstring Yardanico: basically your "result" is uninitialized eliezedeck: @Yardanico: alloc 50 MB or memory? Yardanico: you must do result = newJsonNode() and after that you can append to it eliezedeck: *of Yardanico: ah sorry Yardanico: it's newJObject inv2004_: @Yardanico, But it is Future. I would say that should be Future[seq[JsonNode]] probably Yardanico: or actually Yardanico: inv2004_: why do you need a seq of json nodes though? Yardanico: why not a json array Yardanico: "result = newJArray()" and then add json nodes to it inv2004_: Because I like normal seq more than json :) inv2004_: But result = newJArray() does not help also inv2004_: maybe because it is Future Yardanico: inv2004_: it does help Yardanico: https://play.nim-lang.org/#ix=2gto inv2004_: Maybe my local nim is 1.0.4 Yardanico: it works on 1.0.4 on playground inv2004_: https://gist.github.com/inv2004/0a71607514cb278bcd64543c225e1166 Yardanico: yes that works for me Yardanico: and it works on playground with 1.0.4 too inv2004_: I am a bit confused - does not work for me :) Yardanico: try to --forceBuild ? Yardanico: maybe something got cached or idk Yardanico: it even works on the oldest nim version on playground - 0.13.0 :P inv2004_: Ah, I have 1.0.6, but --forceBuild did not help inv2004_: let me go to another machine Yardanico: well really strange, are you sure you actually recompile the file? did you save it? eliezedeck: alright ... so, how can I create a string with a specific length? preferably without having to zero-out (or set) its content? inv2004_: ok, it works on another linux machine Yardanico: @eliezedeck there are both newString and newStringOfCap inv2004_: One question: Do I undestand correct that "result" should not initialize Future for {.async.} ? eliezedeck: cool ... thanks Yardanico: inv2004_: yeah, async macro does that automagically :P Yardanico: with newString you need to assign data like str[0] = 'a', str[1] = 'b' , etc Yardanico: with newStringOfCap you do str.add("stuff"); str.add("morestuff") inv2004_: That is why, if I set seq[JsonNode] - then it should init automatically without newJArray Rika: for wrapping i think you want newString and not the OfCap one Yardanico: @Rika I don't think he's wrapping though Yardanico: inv2004_: it depends on how your code works Yardanico: like do you need a JSON with an array of these values, or you _really_ need a seq of json nodes? inv2004_: and fine, seq[JsonNode] is why Rika: Yardanico, im just sayin thougj inv2004_: ok, another question: why the JsonNode is not initialized somehow to default value ? Yardanico: because it's a "ref" Yardanico: all "ref" objects have a "nil" value Rika: anything ref is default nil Yardanico: "ref" is GC'd pointer Yardanico: I mean traced/managed/etc Rika: i still dont know the difference of `pointer` and `ptr`... inv2004_: @Rika, I suppose one with type and another is not Yardanico: yeah Yardanico: 4raq's reply from the forum from 2015: "ptr without anything is a typeclass, perhaps it would have been better to use SomePtr for that instead. ptr[T] is the same as ptr T, pointer is just the untyped pointer, like C's void*." Yardanico: https://forum.nim-lang.org/t/823#4753 Rika: huh Rika: so from increasing "unsafeness", its ref -> ptr -> pointer inv2004_: ok, I have to think is it problem or not to have unitialized ref :) and what would I have in rust Yardanico: well if you will automatically initialize it then you'll lose some performance in some cases Yardanico: like what if you wouldn't want to initialize it? Rika: you cant do much with an uninitialized ref eliezedeck: thanks @Yardanico inv2004_: It is why, probably I would expect warning from compiler Yardanico: well maybe with https://github.com/nim-lang/Nim/pull/13808 some annotations can be added to stdlib types inv2004_: I would be fine, because in 5 minutes I had a feeling like I returned to the age when I was C-dev :) After Rust it was a bit painful :) Yardanico: well, I would prefer nim style over Rust anyway Yardanico: rust just seems too verbose for me Recruit_main707: ^ inv2004_: I do the same, but the question about the nil-refs is also important I suppose Yardanico: well yeah, there's always work in safety direction Yardanico: but you need to understand that it's not easy :P inv2004_: I am just trying to compare how rust would help to avoid the problem Yardanico: well yeah I understand that rust is all about safety, i'm not doubting that Recruit_main707: too safe and verbose for me, there is no fun if there is no little risk inv2004_: I am not trying to compare best/not best. Is it possible with result only? Yardanico: as I said, initialize it eliezedeck: Where can I find the implementation of `string.add()` => `AppendStrStr ` ... in the source, it's just magic :) ⏎ ultimately, what I'd like to know is the behavior of this function in regards to many calls to `string.add()` in trying to create the HTTP request body ... I'm trying to find an analogy with Golang's `bytes.Buffer`, which tries to reallocate the buffer if it grows beyond capacity with some smart FromGitter: ... algorithms to avoid too many memory re/allocations Yardanico: nim does that too AFAIK eliezedeck: Sweet! Yardanico: or not, lemme check :D Yardanico: ah yeah it does kinda Yardanico: https://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L1120 Yardanico: the most efficient way would be to use newString and then set values like data[0] = ... Yardanico: but newStringOfCap is easier to use I think eliezedeck: yes, indeed Yardanico: newStringOfCap preallocates too eliezedeck: but that code looks cryptic/complex Yardanico: well it's C backend's code :) Yardanico: I think the resizing logic is not exactly in there Yardanico: ah right eliezedeck: yeah, that's what I was trying to look for Yardanico: https://github.com/nim-lang/Nim/blob/devel/lib/system/sysstr.nim#L199 eliezedeck: what is `nimIncrSeqV3 `? eliezedeck: or, what does it denote? Yardanico: a define eliezedeck: yes, but do you know what does it mean? Yardanico: these defines mostly exist for bootstrapping new nim compiler with old one Yardanico: see https://github.com/nim-lang/Nim/blob/version-1-0/compiler/condsyms.nim#L34 (nimIncrSeqV3 is in there too) eliezedeck: it doesn't seem to allocate a bit more space that is needed Yardanico: well it kinda does Yardanico: https://github.com/nim-lang/Nim/blob/devel/lib/system/sysstr.nim#L43 eliezedeck: yeah, but that's not helping in trying to know the actual meaning Yardanico: but well, it's compiler logic :P Yardanico: and string implementation alehander92: Araq i see you merged the sourcemap PR, i wondered if you want to somehow test the sourcemap itself eliezedeck: hmm... all I'm seeing is extra 7 bytes ... or may be I'm dumb Yardanico: well yeah, 7 minimum and maybe + 1 (if I understand " + s + 1" correctly) Yardanico: that code is not that new, and string appending is a hot path in quite a lot of programs, so it's all pretty optimized alehander92: i can also PR a little code removal for one global variable that's not needed now i think eliezedeck: but that's not of much importance in regards to large buffer use cases, my current use case is dealing with `string.add()` until it reaches 50 MB Yardanico: well but you preallocate it Yardanico: so why do you care? eliezedeck: and it can be much lower, like less than 5 MB at times eliezedeck: so, one would love for the language/compiler/... to take care of that kind of thing automatically Yardanico: what thing exactly? Yardanico: how it can predict the future? :P Yardanico: let's not try to compare the code but rather compare the actual performance :) alehander92: @eliezedeck the language probably does, but its not clear what you want Yardanico: @alehander92 they asked if the compiler does some "smart" string preallocation alehander92: actually, the simplest way `add` can work is by periodically reallocating stuff alehander92: i dont see what simpler way is to do it alehander92: like, i suppose "allocate certain capacity, if len > capacity, allocate function(currentcapacity)" alehander92: etc eliezedeck: you are right, it doesn't predict the future indeed ... I'm just trying to translate an existing Golang app to Nim ... I used `bytes.Buffer`, which does smart reallocation alehander92: but what is "not smart" reallocation alehander92: is it reallocation after each `add` eliezedeck: that would not be smart alehander92: :)))) eliezedeck: :D alehander92: sorry eliezedeck: anyway, let's drop that alehander92: no, you're right eliezedeck: I think it would be better to manually implement that in a different library eliezedeck: I understand that string is a core part of the language Yardanico: why? eliezedeck: and the feature that I'm referring too, even in Go, is from a library Yardanico: well nim has Stream Yardanico: it's just that httpclient doesn't support it for sending requests (yet) alehander92: @eliezedeck i dont understand the problem alehander92: strings and seq-s do smart reallocation eliezedeck: so, I suppose we don't have this kind of library yet in Nim, right? Yardanico: what kind of library? Yardanico: streams are in nim Yardanico: but if you specifically mean streams for sending requests - they're not implemented in httpclient (yet) kaushalmodi: Benumbed: Glad you are finding my Nim notes useful :) eliezedeck: like I said, I haven't used Nim for years, I'm not aware of a lot of things that have changed ... the last time I used Nim was I think in v0.4.x something ⏎ I don't even know what Streams are now :) ... thanks for the information guys, I'll try to keep up alehander92: maybe you can use them eliezedeck: > strings and seq-s do smart reallocation ⏎ For now, I'll trust what you say, but I'll have to see how it goes. Thanks alehander92: you're right that we should look at the source: i havent studied this particular part of it before alehander92: so from what i see https://github.com/nim-lang/Nim/blob/devel/lib/system/sysstr.nim#L18 alehander92: is being called alehander92: when a resize is needed, so here you can see the reallocation logic alehander92: (unless you use destructors etc which default nim iirc doesnt) Yardanico: how is memory allocated/resized with --gc:arc btw? alehander92: this seems to return the new capacity, which seems to then be malloc-ed and the previous string to be memcopied there alehander92: hm, i have to try with --gc:arc Yardanico: well I mean strings Yardanico: memory itself is still memory, it wouldn't change with --gc:arc :D alehander92: it seems it does something similar alehander92: on low level alehander92: it calls reallocShared alehander92: interesting thing is it seems to often reallocate from existing gc lists free cells alehander92: and it allocates pages if this fails from os, e.g. `mmap` on posix alehander92: but you can also use -d:useMalloc , right Yardanico: yeah inv2004_: Hey, hey, my first nim project :) https://github.com/inv2004/strava_nim alehander92: yes, if you do that, you just get `realloc` indeed alehander92: so thats predictable Yardanico: inv2004_: 4-space indents oh no inv2004_: @Yardanico, it was another question! I set plugin into vs-code, and it did not change default ts=4 inv2004_: + ?nim format? did not change it also Yardanico: it's nimpretty Yardanico: and i doubt it will change number of spaces Yardanico: inv2004_: you have to set indentation level globally in vscode I think inv2004_: yes, nimpretty. Ok, but anyway, I wondered, what nim-vscode did not overwrite default value for nim files inv2004_: @Yardanico, I am not sure that it is a rule, because a lot of plugins change it for your own files-types alehander92: hm, so thats interesting, following memory access patterns eliezedeck: > when a resize is needed, so here you can see the reallocation logic ⏎ ⏎ Thanks @alehander92 ... that is exactly what I was looking for ... now I can code in pease :D eliezedeck: So, I also take it that if I have a `string.len == 500` and the capacity is also 500, and I do a `string.setLen(0)` to truncate the length of the string, the underlying buffer will be reused and will still have the same capacity so I can `.add` more data to it, right? eliezedeck: I'm thinking to re-use the string eliezedeck: and may be: is there a kind of object pool library that I'm not aware of ? Araq: right, reusing memory is easy with Nim's strings eliezedeck: Wonderful! Araq: I think I made a mistake and choosenim already knows about 1.2 :P Araq: bbl eliezedeck: Yay!!! :P eliezedeck: can't wait for the blog post alehander92: @eliezedeck no problem mratsim: @eliezedeck, setLen will reallocate if needed, if you want to preallocate a specific size use newStringOfCap mratsim: then you now that realloc will only occur if you exceed the initial capacity you predefined with newSeqOfCap mratsim: i.e. add + setLen + newSeqOfCap should give you all the flexibility you need mratsim: regarding object pools I have 2 varieties depending on your use cases mratsim: a simple one, that implements a simple bounded object pool: https://github.com/mratsim/weave/blob/master/weave/memory/persistacks.nim mratsim: and a threadsafe unbounded memory pool that can only serve fixed-sized memory blocks: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim eliezedeck: thanks @mratsim ... greetings and best regards from a fellow citizen :) maattdd: The doc website seems down : https://nim-lang.org/docs/manual.html krux02: mratsim: I think `shrinkToFit` and `reserve` from c++ is still missing. krux02: maattdd: maybe you can take this instead: https://nim-lang.org/0.11.0/theindex.html krux02: sorry krux02: outdated liblq-dev: https://nim-lang.github.io/Nim/ liblq-dev: is the latest devel documentation, but most of the time it's fine for regular use Araq: who can update the #nim channel? liblq-dev: I think dom96 can, but he isn't here atm narimiran: https://nim-lang.org/blog/2020/04/03/version-120-released.html clyybber: \o/ Kiloneie: Nim documentation now has dark mode D:, wooo my eyes ! Kiloneie: Wait what 1.2.0, wellp gotta install that liblq-dev: 1.2 yay! \o/ maattdd: @krux02 thanks :) maattdd: Another question: I guess the VM can't deal with opening socket at compiletime right ? maattdd: `/Users/matthieudubet/repos/Nim/lib/pure/net.nim(232, 12) Error: cannot evaluate at compile time: osInvalidSocket` krux02: maattdd: I realized it is very outdated, but better than nothing I guess. maattdd: Official link is back online anyway :) Might be related to the 1.2.0 release dom96: Nice, 1.2 dom96: Some grammar mistakes in that release article dom96: "We tried to keep breaking changes to a minimum" fun narimiran: dom96: fix them ;) dom96: I am dom96: does --useVersion:1.2 work per-module? alehander92: hey is the sourcemap alehander92: in the changelog alehander92: or is it under 1.4 alehander92: i forgot to really write anything in the changelog dom96: https://github.com/nim-lang/website/commit/76e3ce5a22b4badb29ee1f4a828cdbded234ba7e alehander92: i guess it cant be as it just got merged shashlick: unbelievable number of changes, fantastic job folks! alehander92: but i have to ping @skellock about it anyway :D narimiran: dom96: :thumb up: narimiran: @alehander92 your changes are in 1.2, but if you didn't write anything in the changelog then there's nothing about it in the changelog :) alehander92: ohh no alehander92: it should be inside, many people asked for it narimiran: people asked to have a line in the changelog? :P alehander92: well, to have sourcemaps for the javascript backend alehander92: it's something that should be mentioned in the "new features" of the release for sure narimiran: @alehander92 can you write something and make a PR here: https://github.com/nim-lang/website ? narimiran: this is the file you need to edit: https://github.com/nim-lang/website/blob/master/jekyll/_posts/2020-04-03-version-120-released.md alehander92: it might as well be in the `compiler changes`, sorry if i am being pushy, i just think it's eye-catching, as improved debugging/javascript support are often a discussion starter in forums alehander92: no problem dom96: better yet, write a separate article talking about your changes alehander92: well, that might be too much? i dont know alehander92: on the other hand i guess one can share that in javascript/web communities for some exposure dom96: yep dom96: too much? We've got like no articles being written about things that Nim can do alehander92: awesome alehander92: ok, i can write a small one these days alehander92: otherwise writing about 3rd party projects really does it best imho(tho compiler writeups are also very cool) alehander92: e.g. the vim 3d post: suddenly it got so many random people to read about nim/nimble alehander92: because that's what sparks up people's imagination zetashift: 1) 2 looks superb, thanks for all the hard work! Araq: alehander92: do you think it's production ready? (source maps) Araq: I merged it because it looked good and we can always fix bugs later dom96: narimiran, why does the article not have a clear list of breaking changes? alehander92: Araq well, not sure , i think I expected it to be merged later Araq: see? so test it well once again before you announce it :P alehander92: i absolutely want to, but i am not sure why it got included into 1.2 then Araq: because 1.2 is not an LTS alehander92: i just thought we cant announce it in 1.4 if it's released in 1.2 :D alehander92: but yeah probably best to include it in some kind of experimental/compiler changes list with a note for people to play with it dom96: is 1.4 going to be an LTS? alehander92: (but still people need to know that it actually exists now) Araq: dom96, IMO 2.0 is going to be one federico3: "new commits which have not already been backported" ? dom96: Araq, and what is that scheduled to break? Araq: my plan is roughly: we add features in 1.2, 1.4, 1.6. features that can replace older features. and then 2.0 removes the old stuff alehander92: is incremental compilation still coming alehander92: for 2.0 Araq: disruptek is/was working on it alehander92: i am willing to help in my spare time somehow if its still in the plans Araq: and I'm trying to guide him dom96: Araq, right, so which features are you planning to remove? alehander92: ah ok Araq: dom96, don't quote me on that but we could remove implicit items/pairs, 'converter', redo concepts, redo "term rewriting macros", redo the .tags system Araq: remove proc vs iterator overloading alehander92: whats the plan about the `.tags` system? dom96: okay, I can deal with that. Just don't remove GC or async await :P dom96: Also, we should talk about .tags. I wonder why you need breaking changes for that zetashift: feels good Nim 1.2 at the top of HN alehander92: wow, people actually use it fo rweb Araq: dom96, DrNim can check for 'not Tag' leorize: quarantine happens to get people to discover new things :) Araq: and once we have the 'not' operator for tags the system is hopefully more useful Araq: in general I like the fact that DrNim gives us a "staged" type system. the compiler does basic type checking, DrNim does the clever checking and proves things about your code liblq-dev: wtf, repr() does not support uint16 Araq: but it's too early to talk about DrNim really Vindaar: congrats for Nim 1.2! :) dom96: Araq, hmm, okay, interesting idea. liblq-dev: under --gc:arc dom96: Araq, regarding my question above, can --useVersion be used per-module? Is that the plan? Araq: dom96, you cannot. Araq: but it might be a good idea dom96: without that I don't really see the point of this. dom96: You can much more easily and reliably just use an older Nim alehander92: Araq, but still would there be a way to annotate "positive" tags just one by one alehander92: because even if you can just write `not Blocking` for `a` (just my example, dont press on the blocking thing), you still have to write down other non-related tags for `b` which has the effect alehander92: which i think is making it hard, as often people would be interested in just some effects in their codebase, while wanting to ignore the others rayman22201: Yay 1.2 🎉 maattdd: the VM can't deal with opening socket at compiletime right ? I was trying to reimplement some procedural macro from Rust alehander92: what are you trying to do dom96: indeed, you cannot use the FFI at compile-time dom96: but you can call out to a process, so you can write what you need as a nim program and then exec it alehander92: also you might be able to workaround with some flags if its just for personal use slymilano: Nim 1.2 hit the hackernews frontpage 🚀 maattdd: I'm trying to write a func which connect to postgres and typecheck some sql query alehander92: nice! dom96: 90 currently maattdd: (reimplement this basically https://github.com/launchbadge/sqlx#compile-time-verification ) alehander92: @maattdd so you can do this in general using `staticExec` as @dom96 said : in general you can even make this nice by using some serialization alehander92: one we talked with PMunch that one can make an api that lets you call typed runtime code from CT this way leorize: @maattdd: you might be interested in this too: https://github.com/araq/ormin PMunch: Huh? PMunch: Oh nice 1.2.0 is out :) PMunch: I guess it's time to check all my packages again for breakages.. leorize: @maattdd: and here's the documentation: https://github.com/Araq/blog/blob/master/ormin.rst alehander92: well, i had this strange idea that you can write something like `run: code` and on compile time to put it in a file, compile it if needed and staticExec it and decode the results from the exec alehander92: i think this was because of some of your code PMunch but i might not remember well PMunch: Ah right, yes I remember we talked about that PMunch: I don't think I needed it for anything in particular PMunch: But I might've alehander92: @maattdd but you can put your code in a normal nim module, generate all the typeinfo there and just return as e.g. json PMunch: That's kinda how scopes works (the programming language) alehander92: and load it from your lib using staticExec alehander92: which might be even faster, as you dont run this in the vm maattdd: actually I think this kind of "typesafe" ORM is the wrong approach, because it need to support an arbitrary set of SQL constructs. The only way to support *exactly* what your database supports is to call postgres decribe feature. PMunch: Well it certainly depends on what you're doing alehander92: so this way it can work: and you can generalize it for different databases Chiqqum_Ngbata: How to write a type for a proc that may contain a side effect? PMunch: But if you want to do some heavy processing then offloading that to a compiled program might offer a performance benefit leorize: @Chiqqum_Ngbata: then it'd just be a normal proc type PMunch: Chiqqum_Ngbata, what do you mean? leorize: the opposite of `{.noSideEffect.}` is to not specify it :P alehander92: now, calling the other one might feel icky, but i think it is not really hard Araq: maattdd well ymmv but I've never written a single program where I need to support "an arbitrary set of SQL constructs" PMunch: Yeah, that's just a normal `proc`. If you want to have no side effects then you can use `func` or the `noSideEffect` pragma maattdd: @alehander92 indeed, I guess I can glue something with staticExec Araq: it also sounds like a security desaster PMunch: Nice top comment on HN :) alehander92: @maattdd one can even make a good api for that, but if you just use it for one lib, its not needed dom96: That dark mode though. Big props to whoever implemented that! Chiqqum_Ngbata: I have a type for a normal proc. The implementation is a proc that has a side effect (in v1.2 seems os.sleep() side-effects, makes sense I guess) Chiqqum_Ngbata: Not sure how to adjust the type to accommodate proc that may contain side effect alehander92: but procs with side effects are normal procs maattdd: @Araq Well obviously you need a DB access at compile-time :) Chiqqum_Ngbata: type mismatch: got but expected 'tuple of (proc (): Thing{.noSideEffect, gcsafe, locks: .})' Chiqqum_Ngbata: Type doesn't have any pragmas leorize: how did you define the type? alehander92: ah so you want to accept funcs in place of procedures alehander92: huh, yeah there should be a rule for that in the type system somewhere Chiqqum_Ngbata: type FnType* = proc(a: string, b: string): RetType PMunch: Hmm, what's the difference between useVersion and just choosenim-ing the version you want? leorize: you get to use the newer stdlib :P PMunch: Aah livcd: should choosenim update self work? livcd: dom96: dom96: leorize: huh? How do you? dom96: livcd, sure livcd: Error: unhandled exception: 404 Not Found [HttpRequestError] zetashift: shoudln't you do choosenim update stable? zetashift: or you want to update choosenim itself? livcd: update stable works livcd: update self should update choosenim binary no? :D dom96: livcd, yeah, maybe you got a broken choosenim version. Can you update manually and try again? Just download https://github.com/dom96/choosenim/releases/download/v0.6.0/choosenim-0.6.0_windows_amd64.exe dom96: and replace your choosenim.exe with it livcd: yes please livcd: do you also set env vars with choosenim? zetashift: update self works fine for me tho(but I got the latest version already so I don't know how it checks that) livcd: well it's not a biggie i usually just dump Nim to my kitchen sink path Chiqqum_Ngbata: Surely there is a way to capture a proc that might contain side effect? livcd: btw can one get a Nim compiler version from the binary it compled? liblq-dev: what is the overhead of `sequtils.any` and `sequtils.all` compared to just making a regular for loop? leorize: function call overhead leorize: use anyIt or allIt to avoid it leorize: also if the proc passed to is a closure then there's that as well leorize: Araq: what do you think about a function in macros that let you check if a generic matches with the type symbol that you have? Araq: dom96, effictively it's how C/C++ handle this too, eg. -std=gnu++14 leorize: ie. something to check if `int` matches the `T` in `proc something[T: SomeInteger](i: T)` Araq: and if you don't see the point of that consider that you might want to use old code on a new platform Araq: so "just use an old compiler" doesn't work well in practice Araq: leorize, macro expansion is often done before typechecking though leorize: then I guess I should complete the `{.borrow: identifier.}` feature instead of trying to write a macro for it... planetis[m]: congratulations on the new release people! well done! Araq: thanks! rayman22201: @dom96 I would riot with you if async were removed lol, and while I'm an arc fan boi, even I have come around to the idea that leaving the other gc's is a good idea :-) exelotl: "Added a `with` macro for easy function chaining that’s available everywhere" exelotl: This one is a bit misleading because you still have to import it exelotl: At least in the playground where I tried it leorize: yep, you still have to import it:) exelotl: Will it be moved to system in the future, if it sees good adoption? PMunch: Link to an example? leorize: I think we should keep things out of `system` leorize: that module is just huge exelotl: In that case I guess it should be moved to sugar in the future instead then dryajov: question, what is -d:smokeCycles dryajov: this seemed to trigger GC collects much more frequently and aggressively leorize: it basically tell the gc to collect cycles at all costs leorize: the gc usually defers cycle collecting until it passes a threshold Araq: rayman22201, fwiw I still think once I fixed more bugs 'thinout' will work well enough Araq: with a slight modification to async it might work ksandvik_gitlab: Congrats to 1.2! ksandvik_gitlab: Quick question, each time I do choosenim update devel I'm getting: ⏎ Extracting nim-1.1.1-osx.tar.xz ⏎ Is this still top of trunk? leorize: guess we haven't bumped the version to 1.3 for devel yet Araq: ksandvik_gitlab: update your choosenim please shashlick: livcd: for choosenim, do you mean setting up PATH? shashlick: ksandvik - update devel will update to latest nightly release shashlick: if you want 1.2, use stable shashlick: devel will become 1.3.x soon ksandvik_gitlab: choosenim update self ⏎ Updating choosenim ⏎ ⏎ ``` Info: Already up to date at version 0.6.0``` [https://gitter.im/nim-lang/Nim?at=5e87886b17a95e30a19ad48e] ksandvik_gitlab: So I assume then that Extracting nim-1.1.1-osx.tar.xz is dev trunk.... ksandvik_gitlab: or soon.... shashlick: it is the last devel nightly build Zevv: ah 1.2, i missed the party! shashlick: if you want #head then use `choosenim update devel --latest` ksandvik_gitlab: Thx, adding that to my notes. rayman22201: Araq: cool. I hope it works, for the sake of all the existing async code. I still think it's worth investigating this alternative async implementation for the memory efficiency benefits. Araq: rayman22201, oh definitely! alehander92: where is disruptek liblq-dev: oh, hi Zevv alehander92: !last disruptek Araq: alehander92: busy, his country is burning alehander92: ughhhh rayman22201: Lol. He didn't come to my part of the country fast enough alehander92: didnt he live in a truck alehander92: i hope he's fine with their new rules shashlick: he's just on vacation dom96: shashlick, am I misremembering, I thought semantics of `choosenim update devel` were going to remain as-is? :( shashlick: you wanted `choosenim update devel` to install nightlies and `--latest` to install head dom96: right, I was hoping the messages would be clearer about what the nightly being installed is Zevv: liblq-dev: you had problems, but i only saw the error dump, not what caused it. care to share? liblq-dev: yea I was going to submit an issue but then forgot about it liblq-dev: all I tried to do was `patt("frame=")` Zevv: and why are you changing your nick all of the time, thats confusing as hell zetashift: he's on vacation..during lockdown? liblq-dev: sorry dude, lqdev was taken liblq-dev: freenode is purging the nick database soon though so maybe I'll be able to get it back :) Zevv: for me you are now "the guy with something l something q seomething" liblq-dev: lol liblq-dev: but while you were away I moved to plain IRC from Matrix, the lag pissed me off liblq-dev: but it turned out that the name 'lqdev' was taken liblq-dev: I quickly had to come up with a different name, this is the result… shashlick: dom96: #head isn't updated yet so looks like devel is old - https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L2048 Zevv: anyway, i'd like to hear how npeg barfed up on you, if you can reproduce alehander92: is npeg a dog now dom96: shashlick, so we don't have any functionality to detect this and let the user know yet, right? Zevv: it"s whatever you want it to be alehander92: i can use a dog honestly Zevv: its turing complete liblq-dev: Zevv: somehow it's working now, but it didn't wanna work in my bigger module liblq-dev: not sure what caused the crash alehander92: with so much dogfooding .. alehander92: not surprised Zevv: hm ok, just let me know if you need any help on that. I'd like to keep up the hygiene on these kind of errors. dom96: Araq, I am part of the HN hive-mind: https://news.ycombinator.com/item?id=22772362 shashlick: dom96: nope - it just downloads and installs latest release in devel branch supakeen: Is the primary package index for nim the nim-lang/packages repository? :) liblq-dev: yes zetashift: Yes but for easier browsing you have : https://nimble.directory/ supakeen: Yea, I've seen it and some of the discussion surrounding versions/discoverability! supakeen: I was wondering if there had been any movement on that front as most of the discussion seems to date back about a year. eliezedeck: How do I disable the `Async traceback:` stack trace ? I tried `--stacktrace:off`, but no dryajov: thanks @leorize rayman22201: @dom96 and what do you have to say about the counterpoints in that thread? shashlick: i think useVersion should be maintained for n-1 and perhaps n-2 at best so that people get enough time to transition shashlick: after that, older versions should be cleaned out so that people can be expected to move on rather than being stuck with 1989's version of C eliezedeck: It seems that only `-d:release` will get rid of it!: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e8791cb9d4ed673c4256897] shashlick: will make it a pain to keep libraries up to date but an old library from 15 years ago that is unmaintained is probably not useful either shashlick: if it is useful, that someone will update it dom96: eliezedeck: don't think there is a way to get rid of it except that I'm afraid, feel free to make a PR to improve this (you can introduce this with a -d:noAsyncStacks or similar) eliezedeck: Oh, I see ⏎ On another thing, what's with: `Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]`? how to fix this? dom96: rayman22201, ehh I guess. Still think it's time better spent elsewhere alehander92: well, is it initialized @eliezedeck krux02: eliezedeck: The correct way to handle it would be to open an issue on github about it if you can't get rid of the warning. krux02: before enforced initialization becomes a compile time error message, all issues related to it must be fixed. eliezedeck: @krux02 I believe someone already did krux02: well then you shouldn't worry about it becoming a compile time error. dom96: You do, if the compiler is complaining then it's likely to become a compile-time error. You probably just need to use the MyObject(field1: 124) object constructor syntax dom96: instead of setting each field manually eliezedeck: Oh, ok ... thanks for the tips livcd: shashlick: yeah was thinking about setting the PATH shashlick: --firstInstall should ask you if you want to do it shashlick: but only on windows livcd: right supakeen: Hey, I've been playing with asynchttpserver and pasted the example code in a test file but I end up with a traceback: https://bpaste.net/raw/XEMA my nim version is 1.2.0, what am I missing :) supakeen: Sorry, I copy/pasted the example from here: https://nim-lang.org/docs/asynchttpserver.html shashlick: Araq: had a question around wrapping C variables if you're here moerm: everyone matlock: Where is the best place to raise an issue I am having with my account on the Nim forum? Thanks in advance. PMunch: matlock, depends on the issue matlock: PMunch, I am trying to set my e-mail to the e-mail associated with my Gravatar and I use for work, but when I put in it and click Save I get the message 'You cannot set a rank that is higher than yours.' PMunch: Huh, that's strange. Try highlighting dom96 PMunch: Well, I guess I just did.. matlock: Happens in Edge and Firefox. In trying to change it I also got downgraded to moderated, my username here is haydenb. matlock: Anyways, the snap packages of Nim are rebuilt nightly but I went ahead and triggered a build of 1.2 to go out on stable, so those are available with $ snap install nim-lang kaushalmodi: Congrats on the 1.2 release! PMunch: !eval echo NimVersion NimBot: 1.2.0 PMunch: Yes! The auto-build and update of the playground is working :) moerm: Yay! Hurray! leorize: shashlick: just ask, maybe I can answer :) kaushalmodi: PMunch: 🎉 PMunch: Hmm, trying to make my tree edit distance library generic is proving to be a pain PMunch: This for example seems to fail: http://ix.io/2gx5/nim PMunch: It suddenly doesn't recognise that `index` is port a parameter and the name of the procedure.. Araq: PMunch: come on, that's bad code Araq: why not use 'result'? PMunch: Naming things are hard okay! PMunch: Can I use result as the input variable? moerm: Hello, Araq. Thanks for 1.2! Araq: you're welcome. don't use DrNim yet though Araq: it's still junk :-) PMunch: Nope, apparently not.. moerm: meaning? "totally useless"? "unreliable"? "lots of open ends dangling"? PMunch: What about this then: http://ix.io/2gx5/nim PMunch: That last line I get an error: `Error: type mismatch: got ` PMunch: expression: forestdist[i1 - 1][0] + delete PMunch: So it doesn't see delete as the int argument to zhangShasha, but rather as the delete procedure? Araq: moerm: I need to implement 'old' properly and base it on a CFG shashlick: @leorize @Araq - if a C header has a global variable - is there value in wrapping it if {.header.} is not included moerm: Araq Hmmm, OK (a bit grumbly because I was soooo hot for Drnim) Araq: shashlick: what does that mean? moerm: PMunch are you sure you want to name an arg just like the proc? PMunch: I've fixed that now, as Araq said, not very good code PMunch: It was just an issue with index being a verb and a noun.. shashlick: Example https://github.com/svn2github/pcre/blob/10e4adbfe9aab5869079fba5edc0ce56fa1b078e/pcre.h.in#L489 shashlick: Does pcre_malloc even exist if the header isn't included leorize: shashlick: yes, you still have to wrap them moerm: A global var in a header? Someone with a dark sense of humour ... shashlick: Will it refer to the same memory Araq: moerm: still waiting for your article :-) leorize: yes, mark it with `{.importc.}` leorize: and maybe `{.dynlib.}` leorize: but `{.importc.}` should be more than enough moerm: Aray Almost completed, sir Araq: and btw DrNim received about 5 days of development, give me 5 more days and I'll use it myself for the Nim compiler :-) shashlick: Ok makes sense moerm: Praise the Lord ... and right after Him, praise Araq! *g Araq: but for the Nim compiler I'll add --assumeUnique Araq: it's unsound but otherwise not useful for the Nim compiler moerm: Araq ... like "restrict"? Makes sense shashlick: Some questions feel dumb in retrospect but what can you do Araq: moerm: lise 'assume restrict everywhere' Araq: *like PMunch: Huh, curiously removing the [T] from the closure procedure there fixed the issue.. moerm: Araq As long as there is a way to declare an alias, no problem kaderallam: Hello Guys, it's been a long time since i first tried to switch to Nim back in 2015/2016 then had not time and now i am again looking at a language to replace C/Python combination, I am looking at Go/Rust and of course Nim. kaderallam: I have a question, is there a simple way to exchange/synchronise/persist data between nim program sitting on different servers leorize: you can just turn data into json then beam them to whatever servers of your choice :) PMunch: Wait, when was this warning removed? "Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]" kaderallam: Thanks @leorize how do you beam data between servers PMunch: However you want PMunch: HTTP is an obvious candidate kaderallam: http is slow kaderallam: is there a way to keep a tcp socket between nim programs and stream data over it PMunch: You could use a straight socket if you'd like PMunch: Sure kaderallam: Thanks @PMuch PMunch: Lots of new "faces" here today, is it because the 1.2.0 release and HN coverage? kaderallam: Yeah I saw the 1.2 kaderallam: on hackers news kaderallam: and also i am killing myself trying to do rust Rika: what 1.2 released?? Rika: man am i not in touch lol PMunch: Haha, yeah it dropped today PMunch: kaderallam, Nim might be a good fit if you're trying to replace Python/C PMunch: Not sure if you saw the Nim April fools joke, but it basically played on how Nim is great for exactly that usecase Rika: `The compiler now warns about inheriting directly from system.Exception as this is very bad style.` WOOOOOOOOOO Rika: yes! kaderallam: no where can i see ? I did write some code in Nim just to test it a few years ago, ( https://github.com/aallamaa/desirnim ) but finally never made the switch leorize: it's on the forum, you can't miss it :P PMunch: kaderallam: https://forum.nim-lang.org/t/6136 kaderallam: thx @PMunch Rika: oh man, docs dark mode is now on stable docs PMunch: Oof, my .choosenim directory is 11G.. PMunch: https://uploads.peterme.net/choosenim.png PMunch: The red inner circle is toolchains PMunch: The orange is downloads Rika: what versions do you have??? PMunch: And in each of those blocks in toolchains (one for each version) there is a c_sources folder that is the bulk of the thing PMunch: https://uploads.peterme.net/choosenim_list.png PMunch: Rika ^ PMunch: Most of them I think :P Rika: nim 0.11... rayman22201: Nim evangelism strike force engage :-P PMunch: Rika, well I started using Nim around version 0.13 I think.. moerm: - falling back into the chat - hello to the new ones Rika: hello moerm, i saw the post you made in the april fools thread Rika: and i hate it lmao Araq: uh oh Rika: uh oh? Recruit_main707: It was Araq to my iirc leorize: PMunch: https://old.reddit.com/r/programming/comments/fub4s0/nim_v12_released/fmcdyv0/ <- you can advertise here :) Recruit_main707: Released already!!! Recruit_main707: HYPE shashlick: PMunch: choosenim now deletes csources after installation brentp: ```[SYSASSERT] sizeof FreeCell ⏎ Error: execution of an external program failed: ...``` [https://gitter.im/nim-lang/Nim?at=5e87b99a17666550b2024fb3] PMunch: Oh, I guess I should update it then.. brentp: should i open an issue? this is on `Nim Compiler Version 1.3.1 [Linux: amd64]` PMunch: choosenim v0.3.2 (2018-02-28 14:12:37) PMunch: Right, I was a couple of versions behind.. shashlick: v0.6.0 is latest shashlick: but it won't clean up older versions moerm: 1.3.1 ? From what I know we just got 1.2 shashlick: so might want to xargs rm or something shashlick: moerm: that will be the next devel version - like 1.1.1 moerm: Ah, OK PMunch: find . -type d -name c_code -exec rm -rf {} + PMunch: Took that folder from 11.6G to 2.9G :P moerm: Bye, cu soon PMunch: Oh nice, StackOverflow now also has a darkmode exelotl: lol yeah that blew my mind exelotl: I'm still using the april fools skin from last year lol exelotl: (as a userscript) exelotl: I wish github would get a dark mode Araq: my bugfixes break some Nimble package you really want to use. ksandvik: Rust runs nightly compilation tests across all packages/crates it knows about in the git depot. ksandvik: I mean github/gitlab. Araq: we test our "Important packages" Araq: we can always test more ofc Araq: but testing isn't free, it's time consuming. axion: Given the compilation speed of Rust for some even small crates, that build fleet must be expensive to finish in a night leorize: that's a problem that mozilla can solve with more money thrown on the table :P rayman22201: I forget whether it was AWS or MS, but they gave mozilla a crap ton of free server infrastructure recently... Advantages to deep pockets.... rayman22201: for Rust specifically that is clyybber: Re: concepts/generics bugfixes, seems to me like zah's working on a few of them \o/ ksandvik: I think it was MS. ksandvik: And yes, cloud services cost money so if someone is sponsoring that helps a lot. Araq: it's not about the money unless you use the money to pay a fulltime dev to deal with the fallouts Araq: you need to keep every test green all the time. Araq: the more tests you have the harder it becomes. ksandvik: Sorry to compare with Rust but are new features behind feature flags so they are only activated for specific releases when everything is stable? leorize: yes, we have `{.experimental.}` Araq: yes. see --gc:arc clyybber: Araq: https://github.com/nim-lang/Nim/issues/13828 is a valid bug no? Araq: now that I read it again I notice that I misread it Araq: :D clyybber: Yeah, I thought so :D Araq: gah, I should sleep Araq: good night clyybber: same, good night! rayman22201: gn Araq: axion: and if you were to write an RFC about how templates should simply work as in Lisp, I would appreciate it Araq: I suppose at some point we took wrong turns Araq: bye axion: I'll think about what to do axion: But just to make this clear, I think your roadmap is great and you are doing a great job. shashlick: Really good progress today on nimterop - ast2 is close Rika: anyone with extensive arraymancer knowledge? because i cant seem to find the equivalent of "numpy.linspace" in arraymancer, or is it not there? zetashift: @Rika you might be able to use this: https://github.com/HugoGranstrom/numericalnim#linspace--arange Rika: i wrote my own already ;; axion: Anyway. I'm on mumble if anyone wants to talk to me about sticking with Nim :) Rika: what's the server? axion: uberalles.mumbl.io shashlick: Where's disruptek these days leorize: writing a macro to let me borrow proc just by their identifier is hard leorize: because I can't resolve generics in macros... Varriount: leorize: Why? Is that a limitation of macros? leorize: yep, no apis for that leorize: so I guess I will have to wing it myself leorize: still annoying though, as I can't even check if typeclasses match gogolxdong: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e85624be26a9452ed3dd1d4] gogolxdong: tested online the regexp works , but here doesn't match anything. Yardanico: what syntax did you test with? Yardanico: nim uses PCRE rayman22201: https://play.nim-lang.org/#ix=2gjl rayman22201: You have to escape the `[` character rayman22201: and you must use parenthesis to get capture groups gogolxdong: https://play.nim-lang.org/#ix=2gjm gogolxdong: gitter eats escape characters. gogolxdong: oh, yes, need paranthesis to capture. Thanks. Varriount: @Rika I'll be back on Mumble in a bit Rika: axion: did you leave mumble? Zevv: leorize: what was the npeg problem and was it solved? leorize[m]: Zevv: https://irclogs.nim-lang.org/01-04-2020.html#22:23:20 leorize[m]: just bad error message Zevv: yeah, but that's just his error not what he tried to put in Zevv: patt("frame=") is perfectly ok Zevv: nya, nevermind ajaivioqa: _____ ____ _ _ _____ _____ opal ajaivioqa: | __ \ / __ \| \ | |/ ____|/ ____| ajaivioqa: | | | | | | | \| | | __| (___ ajaivioqa: | | | | | | | . ` | | |_ |\___ \ Yardanico: oh no ajaivioqa: | |__| | |__| | |\ | |__| |____) | ajaivioqa: |_____/ \____/|_| \_|\_____|_____/ Yardanico: that was fast Rika: wha is that Rika: supposed to be Rika: tfw discord's not monospace livcd: Rika: can you highlight me please livcd: is it bad that I have beer for breakfast? Benumbed: In these screwed up times? No, you should actually switch to something harder livcd: I dislike liquor livcd: the alcohol in the beer is just an icing Rika: livcd highlight you? for what? livcd: Rika: to see if irssi highlights me livcd: through that bridge Yardanico: livcd: hi Yardanico: @livcd hi livcd: Yardanico: irc->irc works Otoneesk: _____ ____ _ _ _____ _____ opal Otoneesk: | __ \ / __ \| \ | |/ ____|/ ____| Otoneesk: | | | | | | | \| | | __| (___ Otoneesk: | | | | | | | . ` | | |_ |\___ \ Otoneesk: | |__| | |__| | |\ | |__| |____) | Otoneesk: |_____/ \____/|_| \_|\_____|_____/ Otoneesk: lstanley Dingsbums subline qaisjp stratus siinus` bezwzgledny psymin cyphase ghoti pavlushka gardar jlu5 EpicKitty bashNinja WaveHusky Gopa mva PeGaSuS Otoneesk opal foamz petteri Nikky tugrik wim Furai yar Guest31560 hexa- hook54321 illu fredcy cwchristerw Thomas_Wolf matterbridger Yardanico: I'm in 15+ channels on freenode (some of them are quite big) but #nim is the only one getting spammed rn, so the spammer is targeting nim specifically :O narimiran: Yardanico: not true livcd: Yardanico: maybe the other chans you need to be auth @ freenode narimiran: it is in #neovim too Yardanico: narimiran: well, sorry, maybe it just spams in channels i'm not in livcd: is this the internet version of graffiti? leorize: set +S and it should prevent clients without ssl from connecting leorize: see https://freenode.net/kb/answer/channelmodes Rika: what does the opal part mean? leorize: it's just spam usernames to highlight them Rika: discord users are immune! solitudesf: you cant see cool DONGS ascii art tho leorize: given how freenode now have a proper server-side spam filter, the spammer should be quieted soon Rika: damn, i do wanna see the DONGS axion: Hmm. I just spent hours and hours trying to find the cause of very slow performance for one of my math libraries functions. axion: @Rika, it wasn't []= axion: nimprof only sees things from the perspective of Nim axion: The math module's tan function is calling out to a shared library instead of being inlined, and it slows things down A LOT axion: So much so that my Lisp version of the same function is about 4x faster...even with --gc:none leorize: axion: you can help us by freeing Nim from using libc math :) axion: I won't be much help there :) axion: I don't think I can help. I gave up after months of trying to write vectorized instructions for them in Lisp axion: mratsim would be your best bet me thinks Rika: `The math module's tan function is calling out to a shared library instead of being inlined` | inlined to what? Igraa: _____ ____ _ _ _____ _____ opal Igraa: | __ \ / __ \| \ | |/ ____|/ ____| Rika: oh no another one ekreat: _____ ____ _ _ _____ _____ opal ekreat: | __ \ / __ \| \ | |/ ____|/ ____| ekreat: | | | | | | | \| | | __| (___ leorize: yep, freenode mods enabled the ban hammer :P ekreat: | | | | | | | . ` | | |_ |\___ \ ekreat: | |__| | |__| | |\ | |__| |____) | ekreat: |_____/ \____/|_| \_|\_____|_____/ ekreat: madprops EvergreenTree NimBot sepples ljoonal jxy tane_ idxu crem surma Zevv nisstyre stefantalpalaru_ dom96 Kaivo nickster rayman22201 BitPuffin Lord_Nightmare gangstacat kenran SunDwarf blackbeard420 sentreen_ Hotbees hsh go|dfish def- hpyc9 d10n-work l1x Cthalupa tribly npgm mwbrown dv^_^ mjsir911 r4vi sknebel FromGitter pbb jken snowolf arecaceae LyndsySimon evanj lain muffindrake qbradley revere uvegbot Araq deepend nuxdie disbot yumaikas Guest71447 ekreat: bozaloshtsh_ Igraa kitech1 kungtotte d10n njoseph wgetch FromDiscord lbart oz oprypin PMunch matti cornfeedhobo Ekho Esexe Yardanico Ckat sacredfrog vegai xace Cadey gsingh93 pydsigner unclechu Jesin endragor golechwi1 casaca federico3 sendell[m] skrylar[m] Jjp137 opal drewr jwm224 aEverr zama acidx jholland__ EastByte livcd leorize[m] chemist69 zedeus JStoker matlock sz0 sleepyqt_ Vladar skelett so disruptek khanate[m]0 watzon vycb[m] rmt nekits leorize: maybe not that effective yet ekreat: gmpreussner reversem3 leorize clemens3 Amun_Ra literal Mister_Magister xet7 WilhelmVonWeiner solitudesf joshbaptiste planetis[m] beatmox cyraxjoe GaveUp vesper nikita` letto salotz[m] blueberrypie hax-scramper ldlework ehmry qwertfisch narimiran uu91 Demos[m] hoffentlichja koltrast zielmicha__ oculux k0mpjut0r shodan45 mal`` GitterIntegratio vqrs msmorgan CcxWrk euantor sagax junland lmariscal0641 lqdev[m] axion onionhammer shashlick Yardanico: oh no Rika: F to madprops Ckat: rude Rika: LUL tried to ping me narimiran: dom96: can you do something about the above stuff? ekreat: _____ ____ _ _ _____ _____ opal ekreat: | __ \ / __ \| \ | |/ ____|/ ____| ekreat: | | | | | | | \| | | __| (___ leorize: dom96: set +S for the channel and it should bar them long enough ekreat: | | | | | | | . ` | | |_ |\___ \ ekreat: | |__| | |__| | |\ | |__| |____) | ekreat: |_____/ \____/|_| \_|\_____|_____/ ekreat: hsh surma evanj clemens3 Esexe lmariscal0641 onionhammer cornfeedhobo crem hoffentlichja nekits gsingh93 nuxdie revere blackbeard420 Jesin kitech1 opal Yardanico muffindrake l1x sepples zedeus hax-scramper Mister_Magister oprypin jxy sz0 go|dfish livcd qbradley Hotbees blueberrypie gangstacat disruptek matti vqrs lain zielmicha__ xace acidx cyraxjoe kenran jwm224 so uvegbot def- JStoker jken Araq vycb[m] khanate[m]0 dom96 euantor axion msmorgan NimBot ekreat: ljoonal sentreen_ EvergreenTree bozaloshtsh_ Jjp137 k0mpjut0r LyndsySimon disbot nickster sknebel xet7 EastByte chemist69 salotz[m] SunDwarf gmpreussner sendell[m] shashlick ehmry beatmox snowolf sacredfrog nikita` Lord_Nightmare leorize leorize[m] lbart PMunch FromGitter mwbrown Igraa GitterIntegratio endragor golechwi1 kungtotte njoseph tribly hpyc9 qwertfisch aEverr Demos[m] solitudesf drewr Cadey GaveUp Amun_Ra watzon rayman22201 sleepyqt_ Zevv ekreat: shodan45 rmt npgm d10n-work idxu casaca federico3 literal Ekho Kaivo nisstyre vesper Ckat matlock d10n oz stefantalpalaru_ mal`` planetis[m] BitPuffin yumaikas pydsigner junland Guest71447 deepend dv^_^ FromDiscord r4vi ldlework skrylar[m] mjsir911 reversem3 unclechu WilhelmVonWeiner letto uu91 sagax arecaceae pbb lqdev[m] joshbaptiste jholland__ narimiran vegai CcxWrk zama koltrast madprops skelett tane_ Cthalupa wgetch oculux Vladar axion: The only real solution is to set the +r channel mode axion: But it would cut off probably a fair chunk of our users leorize: +S forces SSL matti: Uh oh. matti: Bugger. Zevv: aw, the trolls are locked in their caves and are bored as well Rika: > FromDiscord Rika: LMAOOOOOO matti: I don't even... why would you do such thing? leorize: sometimes people are just bored Zevv: why not? it beats staring at the walls matti: axion: Zevv: We can ask Freenode staffer for help, should there be no +o person available at the moment. axion: +S is worse than +r. It cuts off a lot of clients, like those connecting through a web gateway supakeen: Hola, I've been looking for the terminology in Nim for a IFNDEF so I can define some compile time stuff with -d. axion: At least with +r anyone identified can connect Rika: supakeen: have you seen when statements? tane_: it's an elaborate effort by the slack and microsoft teams marketing teams to get you off irc.. :) PMunch: Well, he won't be coming back.. supakeen: I have seen when statements, those I want to use. Can I use those on possibly undefined symbols? leorize: urgh, they spammed /query on me Zevv: PMunch: you didn't hurt him *too* much, did you? Rika: what do you mean? Rika: for flags? `when defined(flagname):` Zevv: Haha, now I'm getting spammed in 20 privmsg windows tane_: leorize, you can set some option for your user to forbid private messages PMunch: FFS.. Yardanico: oh jesus my PMs Rika: whyre there spambots now? Rika: what caused this to happen xd Yardanico: @Rika they come to freenode from time to time leorize: tane_: yea just did supakeen: Rika, that seems to be the one I want. I'd like to compile my program with say `-d:RHOST:127.0.0.1` and if that wasn't passed use a default RHOST in my program. :) matti: I am getting spammed at the moment, LOL. matti: :D Rika: disconnected my irc client from freenode now lol matti: On query by the same bots. Yardanico: matti: me2 Rika: not using it right now so it doesnt matter leorize: /mode +R PMunch: Hmm, since they have * in their nick I can't whois them.. leorize: +b won't work on these spammers PMunch: Or that might be something HexChat shows to distinguish them leorize: PMunch: prep your /kick :P matti: I did +R for the time being. I will remove it later so users using Freenode web chat can still ask questions (since I often help with some other projects and not everyone registers when they just pop in to ask a question or two). ehmry: late april fools PMunch: Strange, he connected from the same IP but wasn't banned.. axion: PMunch: just temporarily +r the channel mode. It won't affect people already here. leorize: yea but new users won't be able to get in PMunch: And Zevv you make it sound like I sent the mob to his house or something :P axion: They will if they are registered with services. leorize: looks like freenode armed Sigyn up leorize: it should take care of the spam, hopefully Rika: what did they do? leorize: a server bot that detects and k-line spammers leorize: yep, it's working PMunch: What is Sigyn? Yardanico: https://github.com/freenode/Sigyn leorize: an utility bot axion: PMunch: /invite Sigyn leorize: it just k-lined a spammer before they can even post :) axion: if you want her to take this spam in this channel into consideration PMunch: Into consideration? leorize: (and yes I'm crazy enough to keep join/part messages on) axion: The bot klines detected spam. If the spammer spams in here and not a channel she is monitoring, it won't be detected :) PMunch: leorize, so am I, loads of fun during netsplits and Matrix issues :P PMunch: Hmm, says that the invites are reviewed by staff leorize: I have a filter for netsplits :) leorize: probably should roll one for matrix too :P PMunch: Ah, clever PMunch: Ugh, it's such a nice day today, I think it would actually be considered cruel and unusual punishment to not let prisoners go for a hike in the mountains.. Esexe: lots of them are being set free PMunch: Yeah I heard about that, to not have the prisons so over-crowded right? Zevv: yeah, and they go back to IRC trolling right away! Zevv: they got locked up for a reason, you know PMunch: Haha :P Yardanico: wow, just cross-compiled a binary with --gc:arc (does two simple http requests and some shell commands) with a musl cross-compiler and libressl statically linked to arm (EABI5) on the PC Yardanico: used kaushalmodi's musl nimscript for reference on how to build libressl, and https://github.com/richfelker/musl-cross-make for making the cross-compiler toolchain for "arm-linux-musleabi" PMunch: Cool! Otra: _____ ____ _ _ _____ _____ Otra: | __ \ / __ \| \ | |/ ____|/ ____| Otra: | | | | | | | \| | | __| (___ Otra: | | | | | | | . ` | | |_ |\___ \ Otra: | |__| | |__| | |\ | |__| |____) | supakeen: In the documentation here: https://nim-lang.org/docs/nimc.html it describes `-d:SYMBOL(:VAL)` however in this section on the same page: https://nim-lang.org/docs/nimc.html#compiler-usage-compile-time-symbols it describes it as `-d:x=y`. Which one is the correct one or do they both work? :) Otra: |_____/ \____/|_| \_|\_____|_____/ PMunch: supakeen, they both seem to work PMunch: http://ix.io/2gkn supakeen: Ah, right :) otreeplae: _____ ____ _ _ _____ _____ otreeplae: | __ \ / __ \| \ | |/ ____|/ ____| otreeplae: | | | | | | | \| | | __| (___ otreeplae: | | | | | | | . ` | | |_ |\___ \ otreeplae: | |__| | |__| | |\ | |__| |____) | otreeplae: |_____/ \____/|_| \_|\_____|_____/ otreeplae: xace nisstyre BitPuffin WilhelmVonWeiner golechwi1 EvergreenTree rmt Zevv Esexe nekits sacredfrog casaca reversem3 SunDwarf muffindrake kitech1 solitudesf sz0 snowolf kungtotte go|dfish qwertfisch Ckat planetis[m] d10n-work dom96 uu91 Hotbees Araq vegai stefantalpalaru_ nickster dv^_^ Lord_Nightmare vqrs lain clemens3 tribly opal axion Cthalupa kenran def- euantor nikita` vycb[m] jwm224 sagax narimiran letto uvegbot mal`` salotz[m] skelett hsh yumaikas otreeplae: shashlick leorize[m] acidx junland couven92 mjsir911 evanj hax-scramper Ekho cornfeedhobo literal sepples pbb sendell[m] NimBot Vladar skrylar[m] CcxWrk qbradley zama pydsigner surma ldlework gangstacat sleepyqt_ blackbeard420 nuxdie hpyc9 dwdv Demos[m] onionhammer disbot dadada_ federico3 shodan45 Amun_Ra blueberrypie njoseph EastByte lqdev[m] livcd gsingh93 lbart vesper GaveUp matti endragor d10n LyndsySimon mwbrown FromGitter GitterIntegratio bozaloshtsh_ otreeplae: ljoonal disruptek cyraxjoe Kaivo joshbaptiste k0mpjut0r idxu Cadey supakeen tane_ deepend so khanate[m]0 npgm abm zedeus jxy drewr sknebel rayman22201 leorize ehmry oz Yardanico revere arecaceae JStoker oprypin zielmicha__ lmariscal0641 emery[m] msmorgan Jjp137 crem oculux hoffentlichja koltrast sentreen_ PMunch wgetch FromDiscord r4vi madprops Jesin xet7 beatmox jken matlock Mister_Magister l1x otreeplae jholland__ watzon unclechu gmpreussner chemist69 couven92: wtf? dom96: DONGS. My new band name. PMunch: couven92, there are spammers abound on Freenode today.. supakeen: A small quick followup is, is the { .*define } pragma necessary to overwrite through passing symbals with -d? :) couven92: PMunch, well after that dong, now I am fully awake :) PMunch: dom96, pretty sure a band like hat already exists dom96: dom96: So you want better parallellism/concurrency? But you don't want static analysis and gc:arc? dom96: yes dom96: It's not that I don't want it, I don't think it's necessary for better parallelism/concurrency PMunch: supakeen, well it's how you tell the compiler that a define should be able to take a value PMunch: couven92, nothing like a big dong to get you up in the morning? couven92: Actually more like a pling from my Computer when I suddenly get an IRC message :O supakeen: PMunch: Great, that put me on the path to solve my things yay. rmt: So, probably the best way to block the botnet spammers is to require nickserv registration first before being allowed to post here.. that should be a channel mode. PMunch: supakeen, what exactly are you trying to do? dom96: https://github.com/nim-lang/Nim/wiki/IRC-guidelines dom96: This is why I wrote this up PMunch: couven92, mhm, sure Rika: rmt, many people suggested that Rika: i think the ops said they dont want that because it inhibits the new people dom96: the thing is, I bet lots of people here are unregistered PMunch: Yeah I could throw on the +r flag now supakeen: PMunch: I have a tiny application that takes some data from a redis queue and then forwards it to another machine through a HTTP request. I'd like to define some settings for this program at compile time such as the remote host(s) involved. PMunch: Well as long as they are in already it shouldn't be an issue PMunch: But I agree that it shouldn't be set normally dom96: what does +r do? supakeen: Which I've got working now, the missing thing I couldn't find was the .*define pragma to allow supplying values. PMunch: Require registration AFAIK rmt: Hm .. only +r, not voiceless unless-registered? PMunch: Hmm, I wonder if there is a way to see how many are registered.. supakeen: The application gets built before deployment and configuration won't (isn't allowed to even) to change after deployment hence compile time. dom96: it's better to quiet unregistered users PMunch: rmt, I haven't looked at the flags TBH, someone earlier suggested +r with that description (I would obviously check before I set anything) dom96: and then set +z so mods can see those messages dom96: that way if someone joins who isn't a spammers but genuinely asking a question we can respond supakeen: PMunch: For #python we use +r with a redirect to ##python-unregistered which has explanation in the /topic about how to register. dom96: *spammer PMunch: Yeah I think the #manjaro channel does something similar supakeen: But it is a hurdle for users, we just couldn't deal with the amount of spam we'd receive otherwise. PMunch: But it's quite annoying supakeen: And we do have people asking -ops every now and then if they can't figure it out. PMunch: supakeen, yeah that sounds exactly like what *define is for :) supakeen: PMunch: Yes, works a charm first Nim in production in an hour or so then! PMunch: Nice! dom96: Someone needs to update the topic :P Yardanico: too much "nim-lang.org" in the topic lol :P PMunch: Haha, woops Vindaar: does anyone know what decides whether a generated html file from nim doc will include the `dochack.js` script line? skex: _____ ____ _ _ _____ _____ skex: | __ \ / __ \| \ | |/ ____|/ ____| skex: | | | | | | | \| | | __| (___ skex: | | | | | | | . ` | | |_ |\___ \ skex: | |__| | |__| | |\ | |__| |____) | skex: |_____/ \____/|_| \_|\_____|_____/ skex: njoseph letto ehmry gangstacat stefantalpalaru_ l1x vycb[m] andinus dv^_^ Cadey d10n-work Esexe abm blackbeard420 rmt lmariscal0641 salotz[m] CcxWrk endragor skrylar[m] NimBot EvergreenTree sepples euantor Yardanico clemens3 ldlework sleepyqt_ bozaloshtsh_ dom96 rayman22201 qbradley Hotbees narimiran kitech1 sentreen_ go|dfish Demos[m] GaveUp Araq khanate[m]0 EastByte leorize[m] casaca literal uvegbot gsingh93 Zevv Guest65169 d10n supakeen shash skex: crem def- r4vi oculux planetis[m] Mister_Magister nuxdie lain golechwi1 zielmicha__ msmorgan joshbaptiste uu91 arecaceae GitterIntegratio Jesin hoffentlichja qwertfisch nickster oprypin surma so LyndsySimon madprops revere koltrast blueberrypie FromDiscord nekits solitudesf matlock vqrs xace sknebel nisstyre sacredfrog mal`` chemist69 lqdev[m] WilhelmVonWeiner JStoker jholland__ mjsir911 vegai kenran leorize sz0 dwdv watzon zama gmpreussner jke skex: muffindrake evanj pydsigner BitPuffin deepend hpyc9 jwm224 npgm reversem3 axion hsh Kaivo oz vesper FromGitter ljoonal PMunch livcd skelett emery[m] mwbrown junland Cthalupa beatmox nikita` Amun_Ra tribly cornfeedhobo SunDwarf pbb disruptek sendell[m] wgetch k0mpjut0r couven92 zedeus drewr Lord_Nightmare federico3 yumaikas tane_ Vladar kungtotte lbart cyraxjoe sleepyqt jxy skex matti Ekho acidx unclechu xet7 Jjp137 shodan45 idxu hax-scramper sno skex: disbot opal onionhammer Lord_Nightmare: who the hell... euantor: Got to wonder what people get out of spamming like this... couven92: oh for fucks sake! dom96: right dom96: I'm enabling quiet mode for unregistered users couven92: euantor, some perverse satisfaction no doubt :O ljoonal: 👍 Rika: i really feel bad for you irc folk ldlework: In Discord they just spam you privately. Rika: ¯\_(ツ)_/¯ Rika: i got DMs from server members disabled in all servers i dont trust dom96: hrm, I don't know why but setting +z on this channel doesn't work Rika: so i barely ever get spam messages PMunch: I like IRC for its openness though, no registration, just choose a nick and log on clemens3: well, it is not that every other message on irc wins the nobel price.. clemens3: probably someone 10 years old discovered bots or something, we used to have to walk from door to door to annoy people.. ldlework: I'm not sure what server trust has to do with anything. Any server can have a spammer come in and start DM'ing people. Even the servers you like, or whatever. PMunch: Yeah! Back when I was young we used to go around and ring doorbells and run away to annoy people! PMunch: Kids these days have it far too easy.. couven92: I remember when I started a broadcast message loop on all computer in our CS lab at uni once. Was really annoying, every 10 seconds you'd get sudden random output in all your terminals :O dom96: So, what's everybody working on these days? mratsim: sleep quality? 🙂 supakeen: I am replacing some small single use Python scripts that forward data from a redis to another endpoint with Nim to save some memory in our VMs and it seems to be going well :) Yardanico: @mratsim quite the opposite :P narimiran: Yardanico: sleep inequality?? :D :D supakeen: And trying to figure out if Nim is a good fit (so far it is) and in what aspects it should be used. PMunch: Right now I'm doing work stuff, using Nim as a plug-in to a DNS server to add EDNS information to queries. But when I'm not working I've got macroutils that I'm fixing up Yardanico: narimiran: broken sleep schedule :D PMunch: Next project is probably either finishing my article series on multi-tasking in Nim, or writing a web-server framework thingy mratsim: multi-tasking? Is it related to multi-threading? Vindaar: I'm fighting nim's dogen :( Vindaar: *docgen PMunch: multi-tasking as in a common term for both async and multi-threading PMunch: Basically doing more than one thing "at the same time" PMunch: Vindaar, what's troubling you about that? Vindaar: I can't figure out why the whole dochack script line isn't included in some project, but works in others dom96: supakeen, ooh nice dom96: I'm doing work stuff too, eager to continue working on my game after the work day is finished dom96: Working in the same space on "real work" and hobby work is proving very tiring though supakeen: I am switching from living room to study to keep things separate. flywind: We are writing http server and network facilities. Vindaar: @PMunch: ok, now I think I *did* figure it out Vindaar: feeling rather stupid now :) PMunch: dom96, yeah it's strange being done "at work" just to close a tab or two and open a different project.. PMunch: Especially when you've got a proper setup like mine so working in different parts of the house would just be weird PMunch: Vindaar, what was the issue dom96: yeah, I can't really work in the living room for longer than an hour or so dom96: not having an extra monitor with mouse/keyboard sucks supakeen: Mrm for me I have two workstations side by side in my study but it just feels too weird to move 1 metre to the right for 'personal' so I currently do that on the couch with my laptop. Vindaar: @PMunch: my first issue was that I had no idea `nimdoc.cfg` was a thing. Once I figured that out, I didn't understand from which paths those files were loaded. So I changed the compiler to print the paths. Once I did that I realized that arraymancer provides its own `nimdoc.cfg`, which simply overrode the nimdoc.cfg I put into my `~/.config`. So yeah dom96: Vindaar: sounds to me like Nim's messages should make that more obvious PMunch: dom96, I feel you, this is my workstation: https://uploads.peterme.net/setup.jpg Yardanico: wow nice Vindaar: @dom96 that's the thing though. The message is there, just like for `config.nims` files etc. I'm just so used to seing "loaded from bla" that I wasn't paying attention :/ Rika: wish i had more than one monitor Rika: lmao Yardanico: buy a old cheap one Rika: > buy Yardanico: I have first fullhd with a second 1280x1024 with an VGA->HDMI adapter Rika: is it even possible to buy anything currently Yardanico: they're really cheap ldlework: use a tiling window manager and make it easy to switch between workspaces Yardanico: yes, that too Rika: switching workspace aint hard w/o a tiling wm Rika: its a button for me on windows dom96: Vindaar: ahh, so I would be tempted to say that Nim's noisy output is to blame but I'm sure Araq will disagree ldlework: without a twm, then each workspace multiplies manual arrangement work Rika: the 2nd monitor would help me not switch though, also would be useful for streaming Rika: manual arrangement work? what work Rika: i dont have much of that ldlework: k Rika: moving a window from another workspace is just another keybind aint it Vindaar: @dom96 I think it's a difficult choice to make. Between too little and too much output by default I mean. Both has problems, which all come down to human nature imo Rika: i dont see how a tiling wm would fix that alehander92: guys PMunch: Rika, that's what everyone says until they've gotten used to a tiling WM :P alehander92: how should i test alehander92: sourcemap support? PMunch: None of my screens are actually full HD.. But I've got two more in the basement that I should switch them out for.. alehander92: i imagine only providing an example already produced by my code sourcemap that seems relatively correct and checking if it still produce it Rika: pmunch: i like my fancy looking windows thanks, unless you can recommend me a wm that comes w/ that out of the box PMunch: Fancy looking windows? alehander92: because otherwise i need to start a debugger and visit locations and this might be harder alehander92: but maybe thats ok alehander92: Araq ^ (testing sourcemap) PMunch: Rika, just wait until I've finished my Nim based WM, it will be a bit more beauty focused than most tiling WMs krux02: PMunch, I just took a look at your workstation. But what do you use a calculator for when you are at a desktop? PMunch: Are you talking about my HP-41C? That thing is just beautiful to look at :) krux02: ok krux02: At first I thought there were two calculators, but I guess you just prefer the numpad on the left PMunch: To the left of my keyboard is my numpad, it moves around a bit PMunch: Well, currently it's to my right. And my mouse is below it krux02: on my desk there is a Gameboy Color. PMunch: Sometimes its in the centre below my keyboard PMunch: Ooh, mine is currently in the bedroom krux02: not this black and white technology from yesterday ;) krux02: :P PMunch: That calculator isn't even a proper screen, it's a segment display :P PMunch: https://lh3.googleusercontent.com/proxy/6gMlwZp-61iosLKaxz7Tjn4AFqifkzzdORRVyFMY8VWpIPKcCJAZGPBM4pgKdPNBuljVaPU1TSsLBeHSc4idN-4GLk12TBVUiPj6GNE1 krux02: yea, I still have my TI Voyage 200 from School. But I tried to convert to maxima for symbolic calculations. PMunch: Oh wow, that thing actually looks pretty neat krux02: Yea, I think it is the last symbolic 8 bit calculator. krux02: after that they had the nspire krux02: with colors and arm processor PMunch: I've got a Casio fx-9860GII that I got for the couple classes at uni that required plotting krux02: does it have backlighting? PMunch: Nowadays I just use stacklang for my calculating needs :) PMunch: The Casio or the HP? alehander92: i cant believe people use so much calculators still alehander92: but it makes sense Rika: i dont see why not alehander92: i am not even sure i learned the M stuff krux02: no it doesn't make sense, not if you work at a Desktop computer with 1000x more computing power. alehander92: it was popular in local calculators IIRC PMunch: Fun fact, I never learnt how to use that either krux02: it does make sense though if you work on paper. alehander92: it was some kind of memorization PMunch: My first calculator was the 41C, so I've pretty much always been using RPN calculators :P Rika: it's easier to manipulate than a virtual calculator from my experience Araq: test test krux02: I learned how to use my calculator. It came with a relly comprehensive manual. alehander92: yea, i think the value is in limitedness: sometimes its useful to have something that does exactly X, Y and Z PMunch: krux02, I recently found the manual for my HP-41C and started reading it. That thing is seriously impressive PMunch: Fully programmable PMunch: One thing I carried over to stacklang (although it works completely differently) krux02: But if you wait minutes for shitty 3D plots to be prepared, and that in front of a desktop computer, it really isn't appealing. PMunch: And having the possibility to program my own little functions in the calculator is great! PMunch: I really need to port it to Android though.. krux02: Then I prefer to learn the next best symbolic calculator program for desktop and get instant plotting instead with much better picture quality. PMunch: I don't really make graphs and such all that much.. krux02: What I like about the voyage 200 is how nicely everything is integrated. krux02: Modern desktop computers isolate everything for security reasons. krux02: That it hurst usability. PMunch: Only thing I do is plots, and to create those I just have whatever program I'm writing spit out a dot file :P krux02: hurts krux02: well I used to solve mathematical equations. krux02: some stuff I still do on pater, just to understand what I am actually doing. krux02: a calculator doesn't replace thinking. sealmove: guys, https://play.nim-lang.org/#ix=2gl6 sealmove: I am generating such assignments so I need `x: int64 = -9223372036854775808` to work sealmove: but Nim sees it as `-(9223372036854775808)` which doesn't work because the name is out of range :( sealmove: any ideas? Rika: big brain move -9223372036854775807 - 1 sealmove: yeah but I generate them automatically, so need to get rid of special case krux02: sealmove: I tried generating newLit(low(int64)) and it works without problems. krux02: no tricks required. sealmove: but you have to test the number each time and see if it's the lowest possible value krux02: are you generating text? sealmove: yes :( krux02: Why, don't you use a macro? sealmove: because I am not doing the generating in Nim sealmove: (believe me, I wish I was) alehander92: hm, how are you doing it krux02: sealmove: btw that literal doesn't work in C either PMunch: Huh, that is an unfortunate limitation krux02: The Nim compiler also had to do the workaround PMunch: I mean you can throw a "when compiles: else: low(int64)" in there.. PMunch: And hope that you never generate anything else bad :P sealmove: haha, I see... krux02: sealmove: Just test for for -9223372036854775808 and don't generate it as a literal. krux02: if x == -9223372036854775808: write("(-9223372036854775807-1)") else: write(x) krux02: that is how the Nim compiler works around the same limitation in C sealmove: krux02 thanks a lot krux02: np PMunch: Hmm, trying to port stacklang to Android will probably just make me wish for my GUI framework again.. krux02: sealmove: but you are right, nim could emit negative integer literals in the parser. krux02: Nim parses -1 as (Prefix (Ident "-") (IntLit 1)) krux02: but Nim has negative integer literals as well krux02: so -1 could as well be parsed as (IntLit -1) and therefore overcome this limitation. PMunch: Zevv, have you done any more work on Nim on Arduino? alehander92: guys how far away is IC krux02: alehander92: as far as I know, nobody is working on it. alehander92: ah, i'd love to see it krux02: but there is something in the compiler that has bugs. alehander92: i admit not a top priority alehander92: you mean current IC has bugs? clyybber: Its simply not finished yet Araq: where in the spec are these "negative integer literals" krux02: Araq, they are not in the spec. But they do exist in the language. krux02: or maybe they are, didn't read it for quite a while. Araq: they are neither in the spec nor in the language Araq: it's as you say, -10 is unary minus followed by 10 Araq: producing the edge case for low(int64), I considered changing the spec and implementation but then -1 is not the same as - #[ ]# 1 Araq: that might not be so bad but -9223372036854775808 is code obfuscation, instead use low(int64) krux02: Araq: negative integer literals are in the language, did you ever look what the ``newLit(-1)`` produces? krux02: it is a single literal node with a negative value. Araq: it produces a value. Araq: not a literal. Araq: you simply don't even know the proper terms krux02: echo newLit(low(int64)).repr krux02: -9223372036854775808'i64 krux02: which isn't valid Nim code. krux02: (Int64Lit -9223372036854775808) if you prefer that representation krux02: sorry, I just assumed that if the node kind says "Lit" it stands for literal. Araq: it does stand for 'Literal' but it's not a literal on the lexical level Araq: so arguably I don't know the terms either and nkIntLit is misnamed krux02: great Araq: but I was talking about the lexer and 'repr' doesn't always produce correct Nim code anyway krux02: The lexer doesn't need to be changed. krux02: I think krux02: If the parser finds a - token followed by a literal token, it can join them to a single literal (sorry I continue to use that term) Araq: that's harder to implement though and not parsable with LL(1) clyybber: IMO `-` being an operator is a lot 'cleaner' Araq: it's much easier to change the lexer and the spec clyybber: What problem are we trying to solve? krux02: clyybber: Don't worry - will be a valid operator in the future as well. clyybber: Oh, is it that -128 is a valid int but -(128) isn't because it only goes to 127? krux02: clyybber: -9223372036854775808'i64 isn't valid nim code krux02: well, with the proposed change, -9223372036854775808'i64 would be valid nim code, just -(9223372036854775808'i64) would stay invalid. krux02: and the later one is what is currently parsed. clyybber: Int literal is its own type right? Araq: INCONSISTENT! special case! bugs! clyybber: So we could simply lift range restrictions of literals clyybber: And 'range check' when its actually 'converted' to an int krux02: clyybber: well a bit more complicated, every integer literal is a different type. clyybber: That way we could also enable int128 literals krux02: Araq, ctf o.O krux02: Araq, wtf o.O Araq: krux02, I'm not serious krux02: And you should be aware this is just a discussion on how -9223372036854775808'i64 could become valid Nim code. Because this is something people have hit several times. krux02: And yes C has the same limitation. I know. krux02: But that copying bad design isn't good design. Araq: krux02, completely agree, so what's the good design Araq: I would change the spec and the lexer Araq: then -1 is not the same as -(1) but so what krux02: -1 and -(1) is already not the same clyybber: What about my suggestion? krux02: they produce different ASTs krux02: one has a nnkPar in it. clyybber: semantically the same, while not syntactically.. Araq: krux02, yeah but many people use Nim without its macro system and so don't care about nkPar(...) clyybber: So when you have IntLiteral as a type (we do, right?) that behaves like `static int` you could have a `-` defined on that. Araq: clyybber, by the time you do this it's too late clyybber: Why? Araq: and the number was stored inside an int64 somewhere in the compiler clyybber: We could use Int128 no? Araq: and the positive number doesn't fit in an int64 krux02: clyybber: the integer literal type is used for static bounds checking. Araq: that's true krux02: is it possible to have overloads on integer literal types, I never tried to do that, never felt like doing it. clyybber: krux02: Exactly. And what I would do is delay static bounds checking until the conversion from IntLiteral to the respective int type clyybber: Thats already done I think Araq: I don't see how you can do it unless you patch PNode to contain an int128 clyybber: Yeah, PNode must be patched Araq: we could really just leave the literals as *strings* though clyybber: Yeah thats an option too Araq: and evaluate them later. somehow krux02: That would be a really disruptive change though. clyybber: You could make it transparent Araq: parsing them in the lexer is a hack really, nimpretty needs to extract the numbers back from the original source code krux02: why would you need to parse them in the lexter? Araq: as 1000 loses information over 1_000'i32 clyybber: strings really seem like the most sane option here. krux02: sorry, but I am not a fan of string literals for integers. clyybber: Not string literals clyybber: Just that we store them as strings in the PNode krux02: yea, exactly that krux02: not a fan krux02: not convinced krux02: A lot of code is affected. Costs are unclear. krux02: I have a feeling it is very expensive. Araq: before we need to "convince" you, we need to figure out if it could actually work at all clyybber: nimpretty, arbitrarily big custom int literals, fixing the -128 issue clyybber: The only real hurdle here would be backwards compatibility in macros Araq: in the macro system we already have an 'intVal' accessor, we can do the parsing in there clyybber: Nice krux02: what about the lexer, what if the lexer takes -1 as a sigle token? clyybber: It doesn't krux02: that was a change proposal krux02: so that it does take -1 as a single token Araq: krux02, the lexer change would work and is cheap krux02: yes clyybber: But that doesn't solve as many "problems" as the string approach would Araq: but with "literals as strings" we could tackle the bignum problem clyybber: exactly Araq: currently you need to write "122332..." for bignum literals Araq: (with the quotes) krux02: I have a feeling that this string instead of int in the Node is a can of worms. krux02: it changes too much clyybber: everything is a can of worms until you open the can and discover its a can of gems :p clyybber: Theres always worms in the can if you can't look inside it. clyybber: schroedingers worm Araq: fwiw nkIntLit is used in the compiler 131 times, it's quite a change krux02: ok I agree that bignum literals are a problem. But they are a different problem. clyybber: No clyybber: They are exactly the same problem clyybber: Or at least they can be solved with the same solution krux02: I don't think they can be solved with the same solution. clyybber: Can you give actual arguments? I showed how it would solve it. Araq: yeah ok, so what. can you complain about the solution when we have one? how exactly is "let's not even think about it" a healthy attitude towards anything Araq: guess what, I too, can foresee lots of problems. krux02: ok Araq: how about this: Araq: nkStrLit..nkTripleStrLit # previously in Nim v1 Araq: nkStrLit..nkBigNumLit # Nim v1.x Araq: the lexer turns literals that are "too big" into a tkBigNum token Araq: and the parser turns it into a nkBigNumLit node clyybber: Why not turn all literals into BigNum tokens then? Araq: backwards compatibility :-) Araq: plus we don't have to patch the compiler code everywhere clyybber: Hmm clyybber: I think I'm gonna try it Araq: lol Araq: write an RFC first ;-) clyybber: I want to try doing it transparently sealmove: Supporting BigNum literals like that would be super awesome addition to the language :) clyybber: I'm gonna hack a prototype up first, then write an RFC, deal? Araq: clyybber, deal but without an accepted RFC it won't get merged Araq: and beware of AST kind additions, they break bootstrapping, remember? clyybber: yeah Araq: unless you add the enum value at the end of the enum shashlick: Araq: I had an interesting idea, since I already pull in the compiler code into nimterop, is it possible to map compiled procs within the binary to calls made in code that nimterop would compile shashlick: So instead of running some operations at compile time and calling the toast binary in the vm using staticExec, everything would be compiled and run at runtime with toast as the front end alehander92: Araq shashlick: That might still require spawning gcc, so maybe toast should use compiler api to start a vm but instead of the vm spawning staticExec calls to toast, calls to nimterop procs would get mapped to stuff that was already compiled into the toast binary alehander92: should i use p.options or p.config.options alehander92: and should i include lineDir in conf.options or in both conf.options and globalOptions shashlick: Araq: so the question is - can the vm compiled into toast be made to call code compiled into toast alehander92: ah ok i cant put it in global, so in this case alehander92: i say it because there was a bug in `lineDir` clyybber: shashlick: Sounds like you want to use the registerCallback mechanism alehander92: because it checked p.options but for me it seems it worked only with p.config.options in some cases alehander92: but not sure if it's just a wrong setup of options Araq: shashlick, yeah what clyybber said shashlick: clyybber: yes but can I do that without editing Nim compiler code - i.e. the callbacks are still in my codebase clyybber: Yeah shashlick: Ok will be another big change but will avoid living on the edge with Nim compiler and static exec clyybber: shashlick: Look at compiler/vmops.nim shashlick: Maybe the wrapper gen code can eventually be made a part of Nim proper clyybber: Be aware that you must not make mistakes, as its using UncheckedArray for passing the arguments around :p clyybber: So you have to check the arity of your callbacks yourself Araq: new in version 1.2 :P (but it was unchecked before I think) clyybber: Yeah :D shashlick: Ok I'll experiment with that, thanks shashlick: But do you think you'd be open to a tree-sitter dependency to add the ability to natively wrap code within the vm Araq: hardly :-) Araq: but we can always extend the compiler API with yet more callbacks, see DrNim shashlick: But it requires having to compile in the full compiler into these tools shashlick: Perhaps having core Nim as a shared library that can be pulled in instead shashlick: That nim.exe also loads clyybber: Araq: Do you think we should allow 123456789'i128 ? Or in general 'iX / 'uX suffixes? clyybber: Hmm, I guess we should clyybber: When they are not parsed by us/the compiler Araq: shashlick, don't worry about it Araq: it's under 4MB Araq: DrNim pulls in Z3, that's 30MB. the alternative is to use a DLL which only works on Windows Varriount: I wonder why Z3 is 30 MB - surely that's not all machine code shashlick: It's not the size, it's time to compile all this but not something that needs solving immediately shashlick: Nim, nimfind, nimsuggest, nimgrep all build portions of the compiler alehander92: wow treesitter + treesitter-ruby dependency can mean we can compile ruby :D shashlick: When I removed Nim from nimble, compilation was much faster alehander92: just kidding of course muraray: am trying to return a map a postgres data, any idea? alehander92: but yeah depending on the compiler sometimes might slow down a compilation alehander92: @muraray like a dict? which module do you use muraray: tuples shashlick: Anyway, if there's no interest to add wrapping directly into the vm, no real need to make it part of the repo alehander92: hm, what are you trying: i dont know that module well Araq: shashlick, I don't understand muraray: me neither, lol am just start nim today Araq: what we add to the compiler needs to be compiled if you import the compiler as a library Rika: Muraray, can you elaborate more! Araq: so do you propose to add feature X so that you can instead run nim.exe? Rika: That's supposed to be a question marl shashlick: Araq: if I can make nimterop do all wrapping in the vm, it could eventually be part of the nim compiler proper like in zig instead of a separate tool clyybber: Eh muraray: am using jester library to render this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e85e8f001c85847b2cf33b0] muraray: but no resp, seems like i may need to map/cast the data into a json object shashlick: The code today is generating an AST which could directly be consumed instead of requiring a text representation that's recompiled again clyybber: Sounds like you actually want macros.. clyybber: Because those are the way to feed the compiler AST PMunch: Macros! Araq: clyybber, macros don't parse C code though clyybber: But they could call code that does Araq: shashlick, I don't like this at all, I want wrappers that are platform independent... Recruit_main707: macros can use emit (if that has something to do with the issue) Araq: we discussed back and forth and in the end I long for wrappers that e.g. use 'ptr UncheckedArray[T]' instead of 'ptr T' Araq: and we will never get there by automatic C code imports Araq: wrappers are not just an annoying implementation detail that you want to avoid like the plague, wrappers can add value shashlick: Araq: since we are "compiling" nim code when running nim.exe, why do the wrappers have to be platform independent - they are becoming dependent right there shashlick: this is an old debate though clyybber: But why do it this way at all Araq: well previously you ran the C processor before looking at the C code. that's not what c2nim does and it's not what I like clyybber: Why not use c2nim and create wrappers that can be nimified alehander92: well isn't it possible to have both: quick and easy c imports alehander92: for prototyping alehander92: and then quality nim wrappers alehander92: the same way people can use jsffi more dynamically and later type well javascript libs clyybber: Yeah it is, but don't put it into the compiler I would say clyybber: shashlick: Why can't you call nimterop from macros? shashlick: it doesn't have to be, it works fine the way it is today shashlick: but this is a thought experiment alehander92: @murarray sorry, what is the problem with `resp` ! shashlick: clyybber: nimterop depends on tree-sitter which is a C library alehander92: does it lead to an error shashlick: FFI sin't available at compile time alehander92: @muraray * ^ shashlick: so it is built into a separate tool that gets called via macros at compile time Araq: alehander92: but who wants to actually *use* these quick&dirty wrappers. shashlick: see cimport.nim shashlick: everyone has to build on top of wrappers since the C API is a C API Araq: I might as well use .emit: "foobar(&a, 20)" instead then alehander92: Araq well its useful in the javascript backend (its a bit different because there you can just do dynamic `.` though) clyybber: shashlick: Ah, so you already do that? Call toast in macros? muraray: @alehander92 no problem with the resp method (works like a charm for normal), i don't know how to parse the db records into json shashlick: clyybber - you can use toast on the CLI or via macros - i support both ways alehander92: ah you want to say to generate json! clyybber: shashlick: How can I make nimterop generate a self contained platform independent wrapper file like c2nim does? Araq: alehander92: nothing in nimterop mentions "it's for prototyping" either. shashlick: point i'm making is that anyone who wants to use a C lib has to know how that C lib works shashlick: you cannot avoid that fact alehander92: Araq yeah sorry i thought we're talking about an automatic c file import on compile time Araq: shashlick, but you can! alehander92: i mentioned that this seems ok sometimes, but yeah didnt mean nimterop Araq: just give them a high quality wrapper shashlick: anyone who is making a Nim layer on top of it for end users will still need to interface with it clyybber: Yeah, but thats one person clyybber: vs the many users alehander92: @muraray so you need to just use some json method to generate json Araq: but the Nim layer would be built on top of sand muraray: @alehander92 Thanks for the prompt response, seems like you guys busy. ⏎ let me figure out myself (so I can also get familiarize with nim docs) alehander92: e.g. you can import json and do pretty(%(variable)) shashlick: so why is there so much value in a raw C wrapper being checked into your code shashlick: how is it any different from the source C file muraray: @alehander92 noted clyybber: shashlick: Its nimified alehander92: @muraray no, it's always ok to ask: so you do this ,you can also use https://github.com/status-im/nim-json-serialization if for some reason the stdlib json is limited for you alehander92: but i think stdlib should be good for now shashlick: clyybber: it isn't - that's the point - the layer that nimterop offers is the ability to call C from Nim clyybber: Yes, but manual wrappers will always beat it alehander92: `%` turns a expression to JsonNode, `pretty` turns json to string shashlick: the ability to make it easy for Nim users - using var X or other stuff has to be hand written (today) shashlick: why do both things have to be one alehander92: you can also just use `$` which turns it into text on one line muraray: @alehander92 yeah i just found out, thanks for politeness will take a look at the library as well shashlick: and it doesn't mean that 100% of the automated C wrapper is not useful clyybber: shashlick: You only have to handwrite once. clyybber: I understand the prupose of nimterop clyybber: Automating wrapper generating shashlick: maintenance is not cheap alehander92: but again, you can have both: in the javascrpt backend one can both import directly a lib and just use it directly and also write down annotations alehander92: we have a precedent shashlick: libcurl wrapper is missing many things for example alehander92: i agree that it might lead to less quality wrappers if we are a bit lazy tho alehander92: but quality wrappers require a lot of maintenance: they require good dsl-s alehander92: this is not something that can be fully automated anyway clyybber: Exactly clyybber: It can be helped by c2nim and nimterop clyybber: But I think the advantage of c2nim is that I can look at the generated code afterwards and tweak it to my liking alehander92: thats why those are two different things: you can have a quality wrapper helped by a tool X and also a way to just import a 70% quality version when you dont have time to do it shashlick: that's my point Araq: shashlick, "maintenance is not cheap" for your way either, you simply pretend that the install will work on my Linux Power Distro 4K with MuslimC because there is zero chance of testing it for all combinations Araq: in fact, that's exactly what happened to one user of the GTK3 wrapper which also uses your approach shashlick: it is nothing different with a hand-written wrapper shashlick: there's no guarantee that it will work everywhere without actual testing Araq: it's very different with a hand-written wrapper Araq: first of all, it's Nim code that isn't fragile as it exists in source code form Araq: I can read it, I can compare sizeof()s when it comes down to it Araq: I can checkout Nim version 1.0 to see if the Nim code compiles with 1.0 if 1.2 fails clyybber: I can also do fire and forget Araq: with your way I need to checkout nimterop version X, C code version Y and Nim compiler version Z Araq: it's a much more complex setup Araq: and it will bite back. shashlick: it is just not scalable - there's thousands of libraries that are not accessible alehander92: @muraray no problem you're welcome clyybber: of which thousands are not needed Araq: it's the approach taken by Ruby, Python, Rust, ... Araq: it scales well enough for them clyybber: With time we build our own ecosystem alehander92: but cant we do now shashlick: we barely have resources to manage the core ecosystem right now alehander92: c2nim on a randomlibrary and just try to use the output shashlick: having a perfect hand-written solution for everything is not practical today alehander92: after all if there is tooling that can do it automatically alehander92: why cant it be just outside the compiler alehander92: if the core team doesnt want it in shashlick: that's not an issue - it exists today - i am not forcing it to be part of the compiler alehander92: well, what's the discussion about, sorry :D clyybber: about semi-manual wrapping ala c2nim vs fully automatic via nimterop shashlick: but expecting the community to hand write wrappers because they aren't fragile when nim compiler is moving so fast that no one cares about a build from 2 years ago doesn't add up clyybber: I for one couldn't get nimph to build without nimble clyybber: Because of nimterop alehander92: i see, so its about if the community should use nimterop? Araq: shashlick, that only means we need to add more stuff to "important packages" Araq: and be better at not breaking wrapper code shashlick: wrapper code isn't a big deal at all in my opinion - there's a million other things the compiler does Araq: and I don't expect them to "hand write wrappers" Araq: I expect them to use c2nim Araq: and yeah c2nim sux, so let's improve it Araq: or throw it away and use "nimterop" instead but shashlick: see that's a different debate - c2nim also generates a basic wrapper which is what nimterop does Araq: nimterop should produce platform independent Nim code clyybber: shashlick: The thing is I can't get nimterop to do what c2nim does Araq: I'm not married to c2nim shashlick: it doesn't generate a high-level wrapper shashlick: that's one part of the debate shashlick: the other one is about platform independent code which i don't get either clyybber: What do you not get? clyybber: Its far easier and simpler to have one wrapper file which works everywhere clyybber: Instead of having nimterop as a dependency shashlick: the C code is already platform independent - why does the nim wrapper need to be platform independent Araq: for exmaple Araq: so that 'nim --cpu:arm --os:linux' actually works shashlick: when the wrapper is generated, just like the C Nim generates - at compile time Araq: the language is built upon the idea that Nim code is portable shashlick: you are on the target platform - what is this big value in seeing a Nim wrapper, versus looking at a C header alehander92: is this about cross compilation shashlick: again, don't mix the Nimified code versus a raw wrapper to call C clyybber: shashlick: nimterop makes it impossible to tweak small stuff about the wrapper, because its generated at compile time and not before clyybber: Or am I wrong? alehander92: cant one write `after` code blocks which do it shashlick: clyybber - you have ways to override alehander92: or something like that shashlick: i'll really suggest you try it and see Araq: https://github.com/nim-lang/Nim/blob/devel/lib/wrappers/sqlite3.nim#L27 Araq: this is stuff that I'm talking about, the Nim code is platform independent Araq: now you complain "but your sqlite wrapper is missing proc X so I cannot use it" Araq: well, here is the thing: your wrappers is even worse as it's a *platform specific* snapshot. shashlick: again, it is the same argument - I want to see this wrapper, check it into source code and maintain it clyybber: Yeah it is shashlick: when the wrapper layer i'm talking about is just telling Nim about how to talk to raw C clyybber: But you do it through so many indirections clyybber: It becomes more complex than a manual wrapper itself clyybber: But I'm sure its a breeze to work with when it works. Araq: but to turn this into a more fruitful discussion clyybber: shashlick: If I could give a suggestion, can you make it possible/easier to use nimterop without nimble? Araq: shashlick, I think most of your code/work/architecture can actually be kept as is, but the defaults need to be changed shashlick: there's nothing in nimterop that depends on nimble shashlick: i have made it such that you can still use it like c2nim shashlick: use the toast command line Araq: it should really default to producing Nim code we can check-in shashlick: Araq: it already does that today Araq: and it should try to remember #ifdef somehow shashlick: but neither of you have tried it Araq: shashlick, I noticed it's not done when I ran 'nimble install nimph' fwiw clyybber: Yeah, I'm not qualified to judge it shashlick: that doesn't mean it is a nimerop issue clyybber: But I know I couldn't build nimph because of it :D shashlick: if it is, i'd appreciate some issue i can work clyybber: shashlick: It was in my case. I'm sure its fixed by now, I'm gonna try again shashlick: nimph uses gitty which uses nimgit2 which uses nimterop shashlick: and nimble has its own share of issues Araq: yeah and in the end stuff breaks and we blame X when we should have blamed Y Araq: yet it was broken shashlick: anyway - there are 3 things that have been raised - platform specific, nimified vs. raw C wrapper and fragility shashlick: for first two, as I have said, there's no value in header.h with ifdefs being recreated exactly into header.nim to check into a repo (not talking about nimified) shashlick: you already have a C header which is (at considerable effort from author) been made as cross platform as they could themselves test shashlick: a C library might not be as cross platform as Nim code, but a Nim wrapper is only as cross platform as the target lib shashlick: as for nimified, there's no escape from hand-written Nim code since C is less featured than Nim, but we aren't talking about that when being able to call a proc from a C library shashlick: glue code can live on top of a raw wrapper - both don't have to be the same exact thing shashlick: fragility - yes there's more going on, but then folks can argue that Nim generating C is fragile versus direct assembly shashlick: there's a place for everything - but you have to fight the right battles, not aspire for the ideal situation and expect end users to figure it out shashlick: i built nimterop because i want to make it easy for our users to use C from Nim because it has a huge ecosystem that is so easily accessible shashlick: I cannot hand wrap every library out there, but i can make the process of raw wrapping faster so that these users can build cool things Araq: speaking of which, which one? honest question. most of the stuff I am interested in is in C++ clyybber: /home/clyybber/builds/nim/lib/system/fatal.nim(49, 5) Error: unhandled exception: /tmp/nimph/nimterop/nimterop/cimport.nim(131, 12) `fileExists(toastExe)` toast not compiled: /tmp/nimph/nimterop/nimterop/toast make sure 'nimble build' or 'nimble install' built it [AssertionError] clyybber: Looks like I need nimble :) shashlick: how can you use a nimble package without nimble clyybber: Via --path ing the dependencies shashlick: then hand build toast shashlick: Araq: libarchive, libgit2 are two for example Araq: well ok and sqlite, postgre, etc etc are more. I wrapped plenty of them on my own shashlick: I used the scintilla wrapper clyybber: shashlick: /home/clyybber/builds/nim/compiler/lexer.nim(1316, 25) Error: undeclared identifier: 'mode' shashlick: https://github.com/nimterop/nimterop/wiki/Wrappers is the list of ones known to me clyybber: Ah clyybber: nevermind clyybber: thats cuz I'm working on the lexer right now :p shashlick: please use v0.4.4 of nimterop, not #head shashlick: shouldn't matter but ya shashlick: Araq: you shouldn't compare yourself to regular users alehander92: https://www.imageupload.net/image/TMdhE alehander92: ok, so sourcemaps seem almost fine now shashlick: i've been wrapping for 2 years now and still ask you basic questions Araq: but I don't see it as a "huge ecosystem" alehander92: i couldnt find pretty printers in that kind of debuggers tho alehander92: like, custom printing of values clyybber: shashlick: /home/clyybber/.cache/nim/nimterop/cPlugins/nimterop_1595835831.nim(1, 24) Error: cannot open file: nimterop/plugin clyybber: [AssertionError] [AssertionError] shashlick: yes because you don't use nimble clyybber: And before that: /home/clyybber/builds/nim/lib/system/fatal.nim(49, 5) Error: unhandled exception: /tmp/nimph/nimterop/nimterop/cimport.nim(166, 12) `ret == 0` clyybber: Thats what I told you clyybber: I can't use nimterop without nimble clyybber: So c2nim wins for me clyybber: its easy and just works shashlick: that's why i pushed for https://github.com/nim-lang/Nim/pull/13584 Araq: machine learning, Could Engine APIs, time handling, UIs, almost no C available code for it clyybber: shashlick: And its merged shashlick: a and i need to use it now clyybber: Can I build it without nimble somehow? clyybber: Ah ok shashlick: basically you call nimterop with nim flags and nimterop has to build a plugin that it loads clyybber: Well, see; I'd argue that nimterop is moving a lot faster than those semi-manual wrappers would shashlick: to do that i run nim, but since i don't know all the flags, i cannot set the paths shashlick: where is nimterop installed clyybber: /tmp/nimph/nimterop shashlick: Araq: I'll get to C++ some day, getting close with the new AST reversem3: So using javascript to create a blockchain using prototypes, what would be similar to prototypes in nim? shashlick: are you using nimph bootstrap clyybber: shashlick: No clyybber: Requires nimble clyybber: So I'm just doing nim c src/nimph clyybber: With --path:someDep arguments Araq: shashlick, but what if C++ really does require manual tweaking like c2nim always requires shashlick: ok then create a nim.cfg or something with the paths shashlick: + clyybber: Can I not put --path:someFolder in the nim.cfg? Araq: shashlick, I'm sorry but I'm looking at https://github.com/genotrance/nimgit2 Araq: for example https://github.com/genotrance/nimgit2/blob/master/nimgit2.nim#L46 Araq: two points: Araq: 1. this is awesome stuff, really. 'cOverride' looks flexible clyybber: shashlick: Ok, did that now I get: /home/clyybber/builds/nim/lib/system/fatal.nim(49, 5) Error: unhandled exception: /tmp/nimph/nimterop/nimterop/cimport.nim(615, 14) `false` clyybber: And with a really big error coming after it clyybber: With that at the end: Nimterop codegen limitation or error - review 'nim check' output above generated for /home/clyybber/.cache/nim/nimterop/failed/nimterop_2849282564.nim [AssertionError] Araq: 2. there is no nimgit2_produced_code.nim file in the repo Araq: as a backup or as code to "look at but don't touch" Araq: and I'd be so much more relaxed if that code existed Araq: now I have to leave, see you later and sorry for the ranting clyybber: shashlick: Oh, sorry, I also still get the errors from before clyybber: So putting the path="someDep" into nim.cfg didn't seem to have fixed it shashlick: Araq: C++ might very well be impossible but I'm willing to see how far i can push this shashlick: i have nothing better to do 🙂 shashlick: Araq: module documentation is generated and posted (linked from readme) https://genotrance.github.io/nimgit2/nimgit2.html clyybber: shashlick: If you want to reproduce: https://hastebin.com/tadepahuwe.php PMunch: I'm going to have another look at macroutils. Streaming it in a little while if anyone is interested over at: https://www.twitch.tv/pmunche clyybber: That last command can be replaced with nim c src/nimph if you put those paths in the nim.cfg as you suggested clyybber: But it doesn't fix the issue nekits: Pmunch, I'll watch shashlick: clyybber have a meeting in 10, will come back and debug this without nimble clyybber: ok clyybber: thanks for looking into it shashlick: thanks for trying - yours is obviously not a supported use case (no nimble) but happy to enable things alehander92: PMunch love it alehander92: i will watch a bit krux02: PMunch, I am watching your stream. krux02: is this like ast pattern matching? krux02: but how does it handle the unexpected nodes, like stmtList with just a single element krux02: (not visible in the ast) krux02: ok krux02: understood alehander92: it is like a quot+pattern matching, very nice alehander92: it is because you provide a pattern and extract from it alehander92: even if it is in the form of source code alehander92: maybe i am wrong of course, i forgot the lisp equivalent :D krux02: I would expect to get the RecList krux02: `fields* krux02: ok krux02: yes krux02: I just never use seq[NimNode] I always put them in a NimNode. krux02: ok that was a lie krux02: you can always iterate over a NimNode with children krux02: kind of krux02: What is ProcDef (with capital case)? krux02: so it is a top level proc for every node kind? krux02: not sure about that alehander92: hm, nice alehander92: well you can somehow import it conditionally krux02: not a fan of "make it appear like a type" when it isn't. krux02: well newTree is verbose, that is true alehander92: it can be a `t(call(ident()))` krux02: instead of newIdentNode you can just call ident"name" alehander92: where commands are defined just in `t` context alehander92: i think once i wanted to do something like that in jsgen rewrite and krux02 actually proposed at least a `t.name` krux02: newCall(ident"testCmd", newLit(100)) alehander92: i think `new` is still a bit repetitious alehander92: i dont want to repeat myself, but that's basically the idea behind the karax dsl(which i just copied for breeze, but it can be still improved) alehander92: buildHtml: short names => t/buildMacro: short names (but its very subjective sorry stopping with that offtopic) alehander92: ahh alehander92: matching into collections, hard one alehander92: doing it on base of types sounds smart alehander92: but the downside is if one looks at the extract only alehander92: i mean doing it based on the types of the extracted variables alehander92: but if one looks at the extraction he would need to know those types now to know what is it actually doing alehander92: yeah i get it alehander92: i used `$` as a binary operator alehander92: man thats strange alehander92: yes but in the compiler its overriden alehander92: you can write c.config$n.info Zevv: Araq: are you making use of my z3 nimble, or did you just copy the essentials? Zevv: I got people with issues and pull requests, but not sure if and how to proceed with all that, especially if it is now somehow being used for drnim and all clyybber: It's not using the high level wrapper stuff Araq: Zevv, I have your package as a depencency Araq: but I only use z3_api.nim Araq: I used the high level wrapper for tinkering, it's awesome Araq: but in drnim I don't need it alehander92: ugh sorry pushed by mistake a feature branch to upstream nim, deleted it now Araq: yay... :-) alehander92: <3 Zevv: Araq: ok, I'll see what I will do with it then. I'm thinking about giving the package away as I currently don't have time nor motivation to work on it, but then I'd have to find a good new home for it. Araq: I could take it over Araq: but I won't do much with it, for me it's complete and stable Araq: actually Araq: I should check out a specific commit yglukhov: Hey @Clyybber, saw your ping, but lost the context. What's up? shashlick: Araq: were you able to see https://genotrance.github.io/nimgit2/nimgit2.html Zevv: Araq: please do that. Ill put it for offer on the forum I guess Zevv: was more of a toy for me then a serious project, and it deserves people who actually understand that stuff alehander92: Zevv i just look at it : it seems a great dsl the symbolic stuff alehander92: Araq, how should i lex "lazily" alehander92: i read your comment and lexer, and i guess i can just write an iterator alehander92: which returns a "token" (as my code consumes tokens only in one place) alehander92: Araq i benchmarked alehander92: http://ix.io/2gnF! alehander92: http://ix.io/2gnF * alehander92: seems ok , but if you want me to profile it more, tell clyybber: yglukhov: Hey, kayabaNerve discovered a bug and it seems similar to one you already fixed (related to closure iterators I think) Clyybber: @yglukhov It was this one: https://github.com/nim-lang/Nim/issues/13815 Clyybber: This was the one you fixed: https://github.com/nim-lang/Nim/issues/8243 which seems kind of similar, at least from the stacktrace yglukhov: Ah ok, I'll have a look. Recruit_main707: oh COME ON, so close! Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/695351117889929216/unknown.png Recruit_main707: (wikipedia stats) D vs Nim zetashift: D is a great language tho, I don't think the vs stat should be emphasized Recruit_main707: numbers are numbers :p krux02: I tried to create a new Nim issue krux02: github has server issues right now krux02: so here is the code that doesn't work: http://ix.io/2gpv krux02: it doesn't work on the c++ backend krux02: it generates invalid Nim code. dom96: Recruit_main707: looking at daily's huh, nice Recruit_main707: Monthly doesn’t work with March yet dom96: Nice to see my method of popularity comparisons is catching on :) dom96: oh, github is down oz: seems fine here. Yardanico: oz: https://www.githubstatus.com/ Yardanico: it's not fine :P Kitty: is there a way to send/stream large multi GB files with asynchttpserver without loading the entire file into RAM at once? moerm: I'm amused by the github problems, or more precisely by the fact that it won't lead to developers becoming less cloud-dependent dom96: Kitty: yes, you should be able to read the file using asyncfile, read 1024 bytes, send them, read 1024 more, send, and so on dom96: IIRC you just call sendHeaders and then req.client.send Kitty: ah, so essentially i need my own streaming version of req.respond, thanks oz: ah well, I just got lucky when making API requests. :p moerm: Not a lot of action due to github problems? moerm: - afk - flywind: When I use `jester` to send stream response, I had some problems.I think maybe owe to asynchttpserver send flywind: duplicated `content-length` headers? flywind: https://github.com/dom96/jester/issues/241 moerm: Have a good time, all - cu blackbeard420: LOL vim³ looks awesome! rayman22201: lmao, I saw that on HN, and I didn't even realize it was written in Nim. axion: I need some help. dom96: :o axion: Lemme make a playground rayman22201: axion, you are correct. inject makes the variable "dirty". It injects it into the parent scope instead of gensyming a clean variable name. rayman22201: wow, the dude wrote a Nim editor by wrapping libvim. Who is this guy and why isn't he on irc? lol https://github.com/paranim/paravim axion: https://play.nim-lang.org/#ix=2gaF rayman22201: looking and thinking ^ rayman22201: seems to just work? https://play.nim-lang.org/#ix=2gaH axion: nope... axion: https://play.nim-lang.org/#ix=2gaI axion: oh wait...you mapped vec2 differently axion: Yeah ok, that seems to work. Thanks! rayman22201: 👍 axion: ideally i'd want the template to expand to 2 templates. no need for function overhead there axion: wonder if that will cause any problems rayman22201: like this? https://play.nim-lang.org/#ix=2gaL rayman22201: feels like premature optimization. I would expect those functions to get inlined anyway? but you can do it I believe. axion: Cool. How do I expand a template? expandMacros doesn't seem to be doing anything rayman22201: good question... I'm not sure if we have a way to expand templates... axion: Ah hmm madprops: the nim package in ubuntu is practically useless if it's too old rayman22201: poke the ubuntu people to upgrade? madprops: well no use if im running an LTS release axion: If you care about stability, use a Debian derivitive. If you're a developer, don't. madprops: would be ok if nimble could update everything somehow Yardanico: choosenim exists :P madprops: oh forgot about that rayman22201: I think expandMacros **should** work on templates, but I'm not sure axion: Well I'd like to see an example of that working, because I am then doing something entirely wrong. rayman22201: oh, it's working for me? rayman22201: The output gets put in the compiler output, not the output of the program. rayman22201: https://play.nim-lang.org/#ix=2gaO axion: oh so you can't use nim playground to see it anyway? rayman22201: you can. click on the button that shows "Showing: output" rayman22201: it will switch to "showing: debug" rayman22201: it's a toggle switch axion: oh :) rayman22201: probably need better docs for that :-) axion: No idea how I missed that. rayman22201: NP. it's not entirely obvious axion: now it would be super nice if it worked recursively axion: Because that would really be the only use for expanding a template...to see the final code gen axion: ie; instead of printing the inner template calls...expand those too rayman22201: The VM is really sensitive to recursion, that's why it doesn't rayman22201: You can embed "expandMacro" statements in your macro to simulate it though. axion: In Lisp we have macroexpand-1 (which this is doing) and macroexpand (which is what I want). Oh well moerm_: - Back - rayman22201: It's not a bad feature request? Start here: https://github.com/nim-lang/Nim/blob/version-1-0/lib/core/macros.nim#L507, and then make a version that traverses the node and collects the reprs instead of just getting the single node. rayman22201: just be careful about the VM. it has a low recursion limit. I would probably unroll the recursion into a loop. axion: Thanks. It'll be a while before I get to hacking on the language, but I do plan on bringing some niceties over from Lisp sometime soon. For now, just writing lots of code to really get to know the language rayman22201: fair enough. 😉 zetashift: Isn't there a switch that increases that recursion limit? rayman22201: yes, but if you want to add a feature to the core of the language, you aren't going to rely on increasing the limit rayman22201: I was proposing adding to the std lib. As a nimble package / personal utility, sure, go ham lol. moerm_: See you all tomorrow zetashift: gnight moerm_ axion: rayman22201: interesting... axion: if i change the procs to templates like you did, the expansion doesn't have the * for exporting them axion: and i indeed do get compile errors when trying to access the members across modules rayman22201: sure enough... that's a bug. please report! axion: I will, even though my bug reports don't seem to get any replies :) zetashift: limited manpower zetashift: I don't think that means they go unnoticed axion axion: I'm not knocking on Nim, but I do think the 1.0 stability guarantee was a few years premature leorize: stable just means that your code won't break in updates :) rayman22201: *cough* I agree *cough* pre-mature marketing *cough* axion: Just in my first library I'm finding a lot of compiler bugs leorize: the original plan was to pause it until we got rid of all the bugs :) zetashift: I found it too, but more people using Nim (because of 1.0) might also mean more bugs being discovered leorize: yep, 1.0 was the main gatekeeper for people to not use Nim, so in the end the decision was to tackle that :p rayman22201: The problem is, soooo many Hacker News junkies and the "trend followers" were complaining that they wouldn't touch Nim because it was "beta" and "experimental" forever. It was just another excuse to not use the language. axion: That is a valid point. There are never no bugs. users.inc if you ever think so zetashift: I do hope Nim decides to do a like an 'Autumn of tooling' or winter of fixing bugs(which I guess is hacktorberfest) to work more on those areas leorize: I find it interesting that no one complains about style insensitivity any more zetashift: YES rayman22201: lol. lets hope it stays that way :-P Benumbed: Personally, IRT the 1.0 stuff, I just wanted the grammar to be stable, that's why I waited leorize: it was stable leorize: :P leorize: since 0.19 IIRC Benumbed: Ok, well, I never heard or read that 🙂 zetashift: You were one of the few then Benumbed, I saw a lot of comments that couldn't introduce it in their team/work because of no 1.0 Rika: oof rayman22201: It was FUD honestly Benumbed: Not saying it wasn't communicated, just that I didn't actually see a "no more grammar changes" zetashift: I don't think anyone asked if the grammar was stable :P Benumbed: And I came back because I assumed it was in 1.0, haha 😄 leorize: it's still not stable btw :) leorize: it's not like the language is gonna turn upside down in just a release :P Benumbed: Regardless, I'm using it seriously now though, if only for personal stuff leorize: unless you're julia-lang, they messed up their 1.0 hard zetashift: How's the ride so far? rayman22201: 1.0 brought some kind of "stability guarantee" (whatever that means) lol. The best thing it brought was a more measured approach to maintaining backwards compatibility. Deprecation paths are taken more seriously now. Benumbed: That's really all you can ask for too Rika: what happened with julia's 1.0? rayman22201: talking about Nim. I don't know jack about Julia. (sorry, got irc snipped) Benumbed: I just don't want my code that I worked so hard to to randomly break in odd ways 🙂 leorize: julia removed all deprecated things when they release 1.0 leorize: breaking a tons of libraries rayman22201: lol. fail zetashift: wasn't that because 0.6 was basically the road to 1.0 Rika: how much time did they give for the deprecated things though axion: https://github.com/nim-lang/Nim/issues/13828 zetashift: so that basically the jump to 0.6 to 1.0 was non-existant rayman22201: Then again, we always kind of cared about backwards compatibility. Nim still tries to keep examples from a 3 year old book still working... Rika: deprecated things should disappear some update no? Rika: it just depends how much time itll take axion: The people in my circle won't touch Nim because "it doesn't offer anything over Rust". Sigh leorize: rust is the new hip thing now Benumbed: IMO they should warn, then error, with a switch to turn on the old behavior, then disappear, so far Nim seems to handle that pretty well from what I've seen rayman22201: yup. exactly what nim does rayman22201: sigh... Nim offers waaayyy better ergonomics than Rust leorize: yea, we got that ever since packages testing was brought into CI axion: I'm actually looking forward to Jai though, if it ever comes out of vaporware rayman22201: axion, for your usecase in particular, I don't blame you. Benumbed: Rust makes you scale a concrete wall with rusty nails pointing out at you for their learning curve axion: rayman22201: what do you mean for my usecase? rayman22201: games leorize: I just dislike their grammar axion: Oh yeah :) Benumbed: Still plan on learning more of it one of these days, but Nim is actually pleasant to use most of the time, vs Rust or Go leorize: though I haven't looked at rust for quite sometime Benumbed: Also the Nim community is nice, vs Rust, they tended toward the rabid side Benumbed: and Go people and their idoms... Benumbed: lord zetashift: I think that kind of happens when a community get's too big for it's own good leorize: once Nim is big enough you'll see that kind of things too Benumbed: agreed Benumbed: Which is why I'm ok that it's small right now! 😄 zetashift: haha rayman22201: Dr. Nim + arc gives Nim equivalent guarantees as Rust (arguably the potential to have even better guarantees.) Benumbed: and why I'm trying to contribute by writing useful libraries, even if I'm slow as hell at it atm zetashift: I hope they document those stuff for beginners. One thing Rust did really well is their book axion: What is Dr. Nim, and what is CFG? I've seen both mentioned here this week a lot but I am clueless :) rayman22201: https://github.com/nim-lang/Nim/blob/version-1-0/lib/core/macros.nim#L507 zetashift: book/documentation they made the entry really low even tho it's such a hard to learn language rayman22201: Dr. Nim is embedding a proof checker into Nim rayman22201: Ada Spark style leorize: axion: CFG is control flow graph zetashift: Using Z3 zetashift: whoops forgot this: https://github.com/Z3Prover/z3 axion: Ah yeah. I had to use z3 to solve a really complex control flow graph in my game engine. Good stuff leorize: the compiler also got itself a CFG for destructors injection zetashift: I think it used Zevv's z3 bindings as a base? leorize: though it's not used anywhere else yet leorize: maybe we can finally fix `not nil` with it :P leorize: @zetashift: yea rayman22201: CFG can also be used to optimize async :-) zetashift: Is DrNim slated for 1.2? rayman22201: not sure zetashift: Oh well I'm looking forward to it zetashift: Goodnight y'all rayman22201: gn o/ axion: rayman22201: Quick question. With your playground code, how come I'm not allowed to do `Quat.genAccessors(w, 0)` ? rayman22201: Quat is a type. UFC syntax doesn't work on types axion: Ah ok rayman22201: a `typedesc` leorize[m]: rayman22201: ufcs does work on typedesc rayman22201: oh? then why doesn't axion's example work? leorize[m]: someone even used that to simulate python's forced module qualifier in Nim rayman22201: actually, you are totally right. I just tried it, and it works rayman22201: @axion. what error do you get? rayman22201: https://play.nim-lang.org/#ix=2gb0 leorize: the issue you might be facing is how untyped param don't bind too well with UFCS rayman22201: It's a template though, it's all untyped? axion: error| cannot use symbol of kind 'type' as a 'param' rayman22201: axion. see my nim playground link. It works there. axion: yeah i'm trying to find a repro. it doesnt in my code axion: one sec axion: Oh I see axion: https://play.nim-lang.org/#ix=2gb4 axion: I changed `q` to `t` since it isn't specific to Quat now. Non-ucs works, but not ucs Rika: you're getting symbol collision i think axion: But only with UCS. weird Rika: yeah works when you rename t to ty axion: also works if for the below 3 calls using `t`, just not ucs rayman22201: oh yeah, in templates, it will replace the param everywhere. so "proc(t:t)" expands to "proc(Quat: Quat)" rayman22201: probably not what you want axion: Yeah I wasn't going to stay with it. Was just trying to figure out why it only doesnt work with UCS axion: tbh I'm going to convert this into a real macro anyway so I can iterate over a string of characters instead of having many calls Varriount: Araq: Regarding macros for types, it's a shame the macro can't emit other data, like procedure implementations axion: How do I write a macro with `quote do` inside a for loop to generate N forms? axion: Struggling to get it to emit any code here... rayman22201: stupid example but here: https://play.nim-lang.org/#ix=2gba axion: Thanks axion: What's wrong here? https://play.nim-lang.org/#ix=2gbb rayman22201: a is a runtime string. rayman22201: https://play.nim-lang.org/#ix=2gbe rayman22201: that works, though might not do what you expect. (It prints the individual chars) axion: Aha, so it has to be annotated as static. That is the answer to an hour of trying to emit _something_. rayman22201: Glad I could help. axion: Thank you for all your help today :) rayman22201: Static in macros is not the best documented feature... rayman22201: Np 😊 axion: It's unintuitive behavior like this that has caused me to struggle with macros coming from Lisp where I am very familiar with them axion: Like, why not produce any output at all if it's not static? A warning would suffice at least Yardanico: dom96: sorry for pinging, but really want to know if there's any ETA to then next nimforum update will be rolled out? AFAIK the forum still runs the (frontend) version compiled in 2018, not sure about backend Yardanico: s/then/the rayman22201: It's hard to tell if there is no output in the general case. The problem is that the macro took your runtime string just fine. It treaded it as a typed ast node with a len of 0. So the for loop "worked". It just had 0 iterations. rayman22201: Treated* axion: I see. It seems this structure won't work for what I need it for anyway axion: I'd like to produce proc definitions rayman22201: you just make your result node a nnkstatementlist, and add the list of proc definitions. axion: I tried that rayman22201: If you remember that crazy macro I showed you for lifting bool procs, I do exactly this: https://gist.github.com/rayman22201/bfc4ce11fa15e57176130c4855407199#file-liftboolprocs-nim-L137 rayman22201: well, it makes macros, not procs, but there is no difference really. (Just the ast node type) axion: https://play.nim-lang.org/#ix=2gbl rayman22201: off topic. I know how to get rid of the experimental thing now. (I know how to use typedescs better.) But I don't want to spend more time on it :-P axion: That's ok :) rayman22201: https://play.nim-lang.org/#ix=2gbm rayman22201: You don't need `ident` axion: without it i got Error: identifier expected, but found '"x"' rayman22201: oh, hold on. rayman22201: easy fix rayman22201: https://play.nim-lang.org/#ix=2gbn rayman22201: two things. 1. you need static again rayman22201: 2. you can't call ident inside quote do axion: let's see if i can beat myself to death with static today leorize: that's a lot of statics :P rayman22201: lol. I can see why it's not intuitive for a lisper :-P axion: Well thanks. That should be enough to get me going rayman22201: np 🚀 axion: The most confusing thing for a lisper is that ` means quasiquote in Lisp, whereas ` is "unquote" within the quasiquote form quote do :) axion: I keep getting tripped up by that rayman22201: it's inverted? interesting. axion: `(1 2 ,(+ 1 2)) ; => (1 2 3) axion: comma is the unquote in lisp rayman22201: that makes some elisp code I was looking at make more sense now lol rayman22201: unfortunately Nim's quasiquote is a little less ergonomic. You can only embed variables, not full expressions. But it forces you to name unquoted things, so arguably an ok tradeoff. Rika: some of us bullshit our variable names though... axion: It's also inverted in the fact that macros are unhygeinic by default, whereas in Nim you supply the inject pragma to make it unhygeinic Rika: < - - - - - - axion: in Lisp, you manually gensym what you want Rika: i think thats a good thing rayman22201: that is definitely a good thing imo axion: It is rayman22201: isn't that schemes whole schtick? hygenic macros? rayman22201: the common lisp vs. scheme split axion: Yes. I dislike it very much for that reason and more Rika: it -> scheme? Rika: why dont you like hygienic macros? axion: Yes, I don't like Scheme. When I say "Lisp" I mean Common Lisp. axion: Scheme is pretty much an entirely different language for a lot of reasons axion: Elisp is closer to CL than Scheme by far axion: I don't like them because they don't allow for very expressive code, and syntax-case etc make "safe" macros very hard to write comparatively speaking axion: rayman22201: Part of it. The bigger reason is the Lisp-1vs Lisp-2 case axion: Lisp-2 means that functions and variables live in a different namespace. In Scheme, you can't use the name of an existing function, user-defined or builtin, as a variable, so it forces you to think and is the source of a lot of bugs...also not very expressive. axion: So Scheme, is a Lisp-1 Rika: sounds like ass axion: In Common Lisp, symbols are actually objects that include a variable binding and function binding member (amoung other members) axion: and there's full runtime support for querying all the different information about a symbol, such as applying its currently bound function to something, or getting it's string name, etc. The whole language is sort of designed to be as useful for code generation as it is for runtime manipulation of the language. axion: CL is a very interesting language. I used it for so long because of the extensive introspection support like this, which comes in handy when modifying a game as it's running without stopping to recompile. Anyway, enough off-topic for that tangent :) axion: I really like Nim and I'm trying to forget about CL :) I haven't actually used an Algol derivitive before, unless you count a brief Python experience some 20 years ago or so Rika: is nim an algol derivative? axion: Yes axion: http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/images/languages/PLchart.png Yardanico: @Rika https://en.wikipedia.org/wiki/Generational_list_of_programming_languages#ALGOL_based Yardanico: https://cdn.discordapp.com/attachments/371759389889003532/694752249049776259/2020-04-01-06-37-06_grim.png axion: Nim would be somewhere far to the right within the huge cluster of Algol derivatives Rika: Huh, does nim share a lot with Oberon? Or is there a different way of measuring if something is under another language leorize: iirc 4raq say that Nim have a lot more in common with modula 3 rayman22201: Yeah. Iirc 4raq's idea was to try and bring a lisp like macro system to modula. Something like that. axion: How do I make an identifier `foo=` to be used as a proc name, given an existing ident foo? Rika: In quote do? Rika: You need to make an accquoted nimnode I think, then use that in quote do axion: trying to fix the second proc in test2: https://play.nim-lang.org/#ix=2gbz Rika: https://play.nim-lang.org/#ix=2gbA Rika: ah wait, made a mistake Rika: https://play.nim-lang.org/#ix=2gbB Rika: axion ^ axion: ah a new node type to look up. Thanks :) axion: What are the [] and []= names even called btw? I'm writing a new proc and need to name that ident something better than what i have? Rika: id just call them bracket getters and setters axion: ok axion: well my first non-trivial macro seems to work. axion: thanks for all the help! axion: @Rika This is what I came up with. I do have 1 question regarding a small change if you can help: https://play.nim-lang.org/#ix=2gbK axion: Or rayman22201 for that matter. I'm pretty close to how I want it voltist: Could anyone recommend a Nim image manipulation library? rayman22201: voltist: https://nimble.directory/search?query=Image rayman22201: axion: what is your question? axion: rayman22201: For line 37, it would be nice if the high level code didn't see an array of strings. I'd like to somehow modify the macro so the call looks like: genAccessors [x, y] without the stringified items in the caller. I tried a static array of symbols, but the compiler yelled at me and said to use NimNode instead. Tried that, and it errors deep inside the compiler in seminst.nim Rika: https://play.nim-lang.org/#ix=2gbT best i could think of, axion voltist: rayman22201: If I wanted a list of image libraries I would have asked for one. I'm wondering if anyone has any recommendations. Rika: sorry, got no recommendations Rika: only one i used was nimpng but that was more "parsing" than "manip" axion: @Rika tried running it and it errors Rika: oh no did i fuck up Rika: lets see if i did rayman22201: Why don't you give some details on what features you actually want? Image library is pretty freaking general rayman22201: Also don't be an ass hole Rika: what errors axion voltist: rayman22201: Sorry, that came out a little harsh. axion: @Rika just click Run :) Rika: aw shite Rika: ill fix em sorry voltist: I'm looking specifically for a library that has the ability to draw text onto an image Rika: OH i missed one of the calls, axion, do you mind "Quat.genAccessors(w, x, y, z)" instead of the bracketed one axion: Can I call it like `Quat.genAccessors w, x, y, z` without the parens? Rika: dont know, i think you can Rika: testing right now axion: That's what I'm looking for. I'm being anal because this macro is practice for an unrelated DSL i eventually want to write Rika: yeah you can axion: brackets don't matter then Rika: https://play.nim-lang.org/#ix=2gbV axion: What did you change besides the signature? rayman22201: Sorry, on mobile. @voltist, I think this wrapper might be the best we have. Nothing native unfortunately GitHub - zedeus/nimagemagick: ImageMagick wrapper for Nim (MagickCore/MagickWand) (https://github.com/zedeus/nimagemagick) axion: Oh I see. the $ for idents Rika: yeah axion: Thanks. exactly what i was looking for zedeus: nimagemagick is an outdated wrapper, this native one is great https://github.com/SolitudeSF/imageman voltist: rayman22201: Ah well, even if it where an updated library, I may as well just go for a python library that can do what I need rather than implementing the image processing myself. axion: oh very nice. starred voltist: rayman22201: Thanks for the help though. Sorry again for being harsh just earlier, I don't know what came over me. rayman22201: NP. All good. Sorry we couldn't be more helpful 👍 zedeus: voltist: maybe combining imageman/flippy and this? https://github.com/treeform/typography axion: Thanks for the macro help everyone. Really appreciate it. I got a decent amount done today. Will finish tomorrow. o/ voltist: zedeus: I'll have a look at that for future consideration. Right now I'm just going to pass all this data to Python's matplotlib instead of making my own raster plots rayman22201: Oh, we have ggplot zedeus: maybe consider this https://github.com/Vindaar/ggplotnim rayman22201: https://github.com/Vindaar/ggplotnim/blob/master/README.org rayman22201: Sniped again lol voltist: rayman22201: Yeah I saw that, but I'm trying to make a very niche type of raster plot for use in neuroscience research which is already supported by matplotlib, so I may as well use it rayman22201: Fair enough Varriount: Hrm, this is an interesting PR - https://github.com/nim-lang/Nim/pull/13813 Varriount: I'm not entirely comfortable with how we keep adding bits and pieces to the VM's available procedures... But I don't know of a good alternative axion: @Variount you on mumble? axion: @Varriount * Varriount: Axion: I can get on Vindaar: @voltist: not sure if you're still around, but I just saw your posts and did this: https://gist.github.com/Vindaar/9c32c0676ffddec9078e4c0917861fcd Yardanico: Finally a worthy first April's joke knome.org madprops: something weird happened today. apparently compiling a binary using a specific version of glibc, won't work on systems with an older version of glibc .. which kinda defeats the point of a compiled program PMunch: Yardanico, haha that's nice livcd: madprops: Nim program? madprops: yeah livcd: madprops: Could you do this? https://scripter.co/nim-deploying-static-binaries/ madprops: i migh try that, thanks livcd livcd: thanks kaushalmodi :-) Recruit_main707: this guy... XD https://github.com/oakes/vim_cubed rmt: embeddable vim for games .. I like it! :) rmt: Or boss mode. :) dom96: Yardanico: new nimforum will be rolled out when I get the time and will to look at a bug that the new categories have dom96: (and fix it of course) PMunch: Recruit_main707, maybe that's how I should stream my coding Recruit_main707: probably ngl PMunch: I like the README as well, "How do I stop the cube from spinning?" "No" skrylar[m]: so i saw we have an experimental option to make macros that override for loops skrylar[m]: and remembered people were asking about tqdm clones PMunch: Macros that override for loops? PMunch: This paravim stuff is actually pretty neat federico3: https://lemire.me/blog/2020/03/31/we-released-simdjson-0-3-the-fastest-json-parser-in-the-world-is-even-better/ we need a fast parser like this in Nim Recruit_main707: lets just wrap this one :smart: skrylar[m]: @PMunch https://nim-lang.org/docs/manual.html#macros-for-loop-macro looks almost made for tqdm lol PMunch: Huh, that is actually pretty cool PMunch: Not 100% sure what it offers over just an iterator though.. PMunch: Short of allowing some optimisations skrylar[m]: eeh well tqdm is a python package that wraps over an iterator to automatically do a progress bar for it dadada: with experimental dotOperators you can't use macros as I noticed while testing https://play.nim-lang.org/#ix=2gdf skrylar[m]: basically sugar over having to make the prog bar and update it in a loop, you just `for x in tqdm(whatever you were already looping)` dadada: I had an idea in mind that's not possible with this limitation, wanted to build a special wrapper using this method skrylar[m]: altho if tqdm can't figure out what the length is it just makes it an indeterminate progress bar (still counts iterations per minute) PMunch: Sorry for not streaming yesterday by the way.. I procrastinated shovelling snow, and when I finally did it and was done with it it had gotten a bit late.. Varriount: It's fine. I was busy pretty much all day dadada: Araq: would it be possible to add support for macros to work with dotOperators? the thing I've in mind is creating a wrapperobject that uses this to automatically forward all dot operator operations to the wrapped object Araq: I don't know dadada: fiar dadada: fair Araq: explain the issue in an issue Araq: or maybe even in an RFC PMunch: Well I mean this works dadada: https://play.nim-lang.org/#ix=2gdp PMunch: I think this might be a regression TBH PMunch: I could have sworn that this used to work.. PMunch: Hmm, maybe not PMunch: Tried with an older version dadada: PMunch: what do you mean? the example 2gdp seems to work, right? Maybe my example is just buggy? PMunch: Yeah, that works, but try to add a `.` proc that takes a Test and any other type dadada: yeah, then I get undeclared identifier y/x dadada: so the issue is that proc`.` prevents from macro`.` from being considered somewhere in the resolution process PMunch: Yeah PMunch: Which I think is a bug dadada: me too :-) Vindaar: just doing some pandas comparisons over here Vindaar: (https://files.gitter.im/nim-lang/Nim/rJmQ/bench_create_column_openmp.png) Vindaar: ugh, forgot to give that a white background Rika: hard to read indeed Vindaar: (https://files.gitter.im/nim-lang/Nim/F4Ng/bench_create_column_openmp.png) Recruit_main707: when are wikipedia stats updated? gogolxdong: How to append sequence safely from threads? Recruit_main707: Viddaar: is that logaritmic scale? stefantalpalaru: Is there a way to access all the C compiler options passed to {.passc: .} from Nim code? Rika: please choose more distinct colors 😦 Vindaar: @Recruit_main707: yup. x axis is 10^label in column size. y is obviously logarithmic Araq: gogolxdong: you need a 'SharedSeq' Vindaar: if it wasn't clear "pd_" are pandas benchmarks, "df_" my own gogolxdong: What's that , how to make it? Araq: gogolxdong: can you use --gc:arc already? HutchyBen: Im looking to learn nim what kind of programs does it specialize at making Recruit_main707: what would you like to do? Rika: its pretty general Recruit_main707: nim can do pretty much anything HutchyBen: oh nice Recruit_main707: if C can, Nim can, (with more or less effort) HutchyBen: and c can do almost anything so cool PMunch: And if JS can, Nim can as well PMunch: So you should be set to create pretty much anything Recruit_main707: true Recruit_main707: would the js backend be deprecated if a wasm one was ever created? Rika: likely not Rika: is wasm useful for nodejs Recruit_main707: idk XD lxdong007: not sure about CMP, I am working on another project. PMunch: HutchyBen, where did you hear of Nim since you wanted to try it by the way? PMunch: Just out of curiosity :) lxdong007: I was about to ask, I noticed there is a shared heap together with arc, I think it's possible to access global varibale from threads with arc. And yes I am using arc. The project I posted is working with arc. PMunch: Yes, using a shared heap and global variables should be possible with ARC lxdong007: Is shared heap state of art usage of arc? Is there any example? alehander92: https://news.ycombinator.com/item?id=22743267 alehander92: nim on hacker news PMunch: Haha, didn't realise that repo has so many funny issues as well go|dfish: it was #1 on r/programming for most of yesterday too Rika: its great though PMunch: What, vim3? HutchyBen: im trying to set ip vim3 HutchyBen: it cant recognise a dll tho >.< alehander92: rayman22201 alehander92: do you plan on providing async executors alehander92: if you guys make an async with state machines livcd: i tried to compile parsetoml with arc :-[ livcd: no luck alehander92: like i dont understand them very well, but i think i would love to have custom async engines alehander92: so one can like customize how async is running for its domain/app alehander92: e.g. https://os.phil-opp.com/async-await/#cooperative-multitasking-1 alehander92: (and a custom executor if i am understanding corretly) PMunch: HutchyBen, what dll? PMunch: livcd, :( what went wrong with it? liblq-dev: PMunch, @HutchyBen it's vim³™, not any ordinary vim3 PMunch: Vim³, happy? alehander92: https://blog.yoshuawuyts.com/state-machines/ alehander92: araq do you mean this for typestate in rust PMunch: Just forgot how to type ³ on this layout alehander92: i imagine you can do it with `requires` alehander92: but no overloading on requires alehander92: i imagined before that one can overload using annotation like that but probably too confusing Recruit_main707: .b and .a were the equivalent to [0] and [1]? alehander92: and requiring z3 support always PMunch: @HutchyBen, in case it didn't highlight you before: What dll is the issue? alehander92: https://github.com/oakes/vim_cubed/issues/22 alehander92: i think this one Recruit_main707: this code doesnt compile on 1.1.1 https://play.nim-lang.org/#ix=2gdG PMunch: Yeah I realised Recruit_main707: its an issue with the pair.a and pair.b thing Recruit_main707: has it been changed? Recruit_main707: (note that someone gave me this code) PMunch: Run likes a charm on Linux this vim³ thing :( PMunch: :)* PMunch: I like the description in the .nimble file. Vim for masochists livcd: PMunch: something with deep copy :O livcd: PMunch: sorry I have not really investigated more as I did not need arc jken: That forum post about rewriting in python got me :D PMunch: jken, link? jken: https://forum.nim-lang.org/t/6136 PMunch: Oh man PMunch: Throwing shade on Python/C hybrid projects as well, nice :P djazz: I for one welcome our (C)Python overlords! Recruit_main707: this almost got me lol. Recruit_main707: i was like, wtf have they done! PMunch: Haha :P narimiran: :) Araq: XD Araq: and I thought I could have been more subtle federico3: Araq: perhaps by suggesting pypy dom96: finally an april fool's joke dom96: took us long enough :) Recruit_main707: have yall searched Bing in Google yet? dom96: narimiran, your tweet could have been much shorter and much more click baity dom96: "Big announcement: we're rewriting Nim in Python" PMunch: What does "./koch boot -d:release" actually do? narimiran: dom96: eh, probably, but i find that too click-baity and less-believeable PMunch: Recruit_main707, anything supposed to happen? narimiran: PMunch: is this a start of some joke? PMunch: Haha, nope PMunch: Someone on HN asked how fast Nim was at compiling Recruit_main707: PMuch: internet prank to google PMunch: I thought I'd cite him how fast it compiled Nim narimiran: PMunch: it bootstraps the compiler, but it takes several iterations to do that narimiran: maybe `koch temp` would be better to use as an example? dom96: narimiran, it's just the tweet doesn't even say that Nim will be rewritten in Python dom96: the forum thread even says that PMunch: narimiran, yeah that's what I was wondering alehander92: i honestly often do nim -d:release compiler/nim.nim alehander92: with some other flags Araq: IMHO 'koch boot' should now default to -d:release Araq: I use 'koch temp' when I'm after stack traces Recruit_main707: so koch is used to build your local nim compiler in case you edit it? liblq-dev: am I the only one who strongly prefers `import module for a, b, c` instead of `from module import a, b, c`? liblq-dev: I first saw that in Wren and imo it's a shame that Nim doesn't have a syntax like this liblq-dev: the thing that pisses me off with `from x import y` is that it doesn't line up with other imports gogolxdong: createShared, resizeShared,freeShared mratsim: Python does the same liblq-dev: I have to fix that in rod :P liblq-dev: when I get to imports, of course. liblq-dev: right now I'm burnt out after my battle with generics Araq: liblq-dev: it's a good point, 'from x import y' is inferior liblq-dev: in my eyes it just looks bad next to my other imports liblq-dev: that's why I avoid using it liblq-dev: I can always reference the module explicitly anyways PMunch: liblq-dev, that syntax is actually pretty nice liblq-dev: which one? PMunch: The `import module for a, b, c` liblq-dev: yeah, and it doesn't waste another keyword, it just reuses `for` alehander92: Araq alehander92: i am working on the sourcemap PR alehander92: from an old comment of yours, i see i shouldn't use a command for it (i guess its for when compileOp) alehander92: it still doesnt make sense to use one right, just a option flag Araq: option flag seems fine or attach it to the existing --debuginfo flag alehander92: can i reserve a separate sourcemap one? seems useful if we add different options or even different kinds of sourcemaps one day Araq: please don't, the proliferation of flags and options is killing me alehander92: well then it can be just `--sourcemap:on/off` : if one has a sourcemap for e.g. C<->nim in the future, it can be reused alehander92: ok PMunch: Hmm, I wonder if I can take an ASCII art generator and feed it Vim³ so I can run it in my terminal.. alehander92: Araq, one more thing : should it be `sourcemap` `source-map` or `source_map` in options/flag and `Sourcemap` or `SourceMap` in code alehander92: guys what do you think of https://sulami.github.io/posts/common-lisp-restarts/ Kiloneie: why is sleep() an unknown identifier for me ? alehander92: import os ? Kiloneie: ooh Kiloneie: ups alehander92: you're still sleeping :) Kiloneie: forgot os is not default imported Kiloneie: i thought it was for some reason alehander92: yeah, you can write your own `common` file alehander92: to import if you usually use the same imports alehander92: which exports such imports alehander92: e.g. `import os ... export os ` Kiloneie: nice trick okay alehander92: i think local people call it prelude alehander92: e.g. i think karax had it alehander92: but not sure overally dom96: Nim has it Kiloneie: im just, play 2 games, make a program(which i can then use for my planned playlist of How to X program or something like that...) dom96: include prelude Kiloneie: i think people would like that idk, probably help with some examples for the docs Araq: alehander92: the style says sourceMap Kiloneie: which are quite empty in some modules alehander92: Araq ok, but my question is because alehander92: all the flags seem to use lowercase alehander92: e.g. nilcheck alehander92: nilseqs etc alehander92: dom96 but import prelude would be better, right alehander92: as one can just export from prelude: i just try to use `import` if i can, but in this case i agree probably it's ok dom96: sure, but IIRC you cannot export modules alehander92: you can mratsim: @Araq @Andrewrk: were is the joined April’s Fool? https://github.com/nim-lang/Nim/pull/13757 mratsim: where* Yardanico: @mratsim something like "We decided to combine Zig and Nim into one programming language which'll be the best"? mratsim: called Zim Yardanico: Zim name is already taken :P https://en.wikipedia.org/wiki/Zim_(software) mratsim: doesn’t matter, Nig is a bit awkward Yardanico: oof mratsim: and it’s only for a day narimiran: Yardanico: i use Zim, btw deech: https://animesuperhero.com/wp-content/uploads/2017/04/invader_zim_render_by_neonstartapeinvasion-d9m3yz6.png alehander92: dont like 1 april jokes, but i'd like some zig features alehander92: :D Yardanico: me too *hides* dom96: Zimrod :D alehander92: yardanico dont hide alehander92: the borders are closed anyway, Araq can't fight us :D mratsim: Zigrod :p alehander92: guys alehander92: do we have nim syntax support in chrome alehander92: sorry i got confused , we dont :D Yardanico: wdym in chrome? like an extension? alehander92: in developer console rishavs: How can I add new items to a set? ⏎ ⏎ ``` var walledDoors: set[Directions] ⏎ walledDoors.add(West)``` [https://gitter.im/nim-lang/Nim?at=5e84b533a61b811a4f7528ed] Yardanico: maybe you want HashSet, not the built-in "set" type? Yardanico: check out https://nim-lang.org/docs/sets.html rishavs: the way the document is written is pretty confusing but I want the mathematical sets, where I only have unique values narimiran: use `incl`, not `add` narimiran: a.k.a. read the docs rishavs: aye. found it. :D rishavs: Thanks rayman22201: alehander92: just waking up. You pinged me? rayman22201: We have custom async executors already. We call it "the event loop". See httpbeast for an example of a custom one. zetashift: Is there a scenario where you would use sets and not HashSets? zetashift: ah nvm it's right under there, sets are used for bit flags leorize: that's the C FFI use case leorize: though it's used for writing flags in Nim too :P zetashift: leorize do you even sleep leorize: maybe :) inv2004: Hello, are there any way to write in script-style, but with async? leorize: script-style? inv2004: I mean that I do not want to define main() {.async.}, but still want to use async. leorize: I don't think you should/can leorize: do you have an example usecase in mind? inv2004: @leorize, it is quite simple - if you use nim like bash - you do not want to define functions without reasons kayabaNerve: JS has has this debate for a long time. The problem with doing it at the top-level, in Nim, is you'd need to transform the file itself. kayabaNerve: File-wide macros aren't a thing unless you put the entire file in a block. Araq hates the idea, although I personally like it. kayabaNerve: And as the Nim filter system goes line by line, you can't replace line endings with `\r\n ` and compensate. inv2004: @leorize, probably you can write just two lines: let resp = await client.request; let data = await resp.body(); echo data.parseJson().pretty. but defining waitFor main() would add two more lines :) kayabaNerve: If you're going to put the entire file in a block just so you don't have to define `proc main() {.async.}; waitFor main()`... why kayabaNerve: But I mean, hey, if you want to write a macro `asyncMain:` to expand to those two statements, go ahead. leorize: inv2004: or you can write it like this: let resp = waitFor client.request; let data = waitFor resp.body() :p dom96: yeah, you can't dom96: but if you're writing scripts, why even use async? inv2004: @dom96, good question - I did not think about it, because I can :) dom96: lol inv2004: @leorize, nice idea, thank you! dom96: well if the amount of typing bothers you, just don't use it leorize: \o/ macros in typedef is now a thing Benumbed: *sigh* I just spent the last hour slamming my head on an issue that turned out to be StringStream taking `0XCE` and treating it as 32b instead of 8b Benumbed: I'm sure that makese sense at some point, but I haven't slept and omg did that throw me for a loop leorize: yea you should sleep :) Benumbed: Esp since the `0xCE` was the termination byte for a network frame, and so the server would then try to read the next 7 bytes and pitch a fit about how everything was zero Benumbed: I sat there staring at Wireshark thinking I'd lost it Benumbed: I would sleep if I could, bad insomnia for the last 3 days 😦 leorize: not looking at the screen is a good way to change that :) geotre: Are there any libraries for async/await on js backend (apart from asyncjs) ? Benumbed: leorize: I went to bed at 2am as usual and laid there until 5am, no lights, no screens Benumbed: just brain that won't sleep leorize: that doesn't sound good :( Benumbed: Story of my life, haha leorize: well go see a doctor I suppose :) Benumbed: I have, multiple times Benumbed: Oh and sleep aids generally don't work on me Benumbed: My doctor calls me 'an interesting anomaly' kayabaNerve: Is there a way I can force a ref to be freed? leorize: kayabaNerve: yes, but no kayabaNerve: I didn't think so outside of reference count manip leorize: well the idea of the GC is that you don't do this kind of "forcing free" leorize: but if it's the last reference (ie. not referenced elsewhere by anything) leorize: set the ref to nil, then run GC_fullCollect() leorize: (please never do that in real programs) leorize: the memory held by the ref might be freed leorize: though any finalizer will still be called if it's not freed leorize: might be freed because the GC can and does keep a pool of small memory segments leorize: it will accumulate the "freed" memory for a big free() leorize: and can also reuse them irrc leorize: iirc* kayabaNerve: leorize: I'm creating duplicates of 512 MB objects somehow, despite using refs, and need to clear them in my tests Recruit_main707: how can i pass a function to a template/macro, and get the name of that function? leorize: Recruit_main707: wdym by passing a function? like this? `macro(foo)` Recruit_main707: yes leorize: then the node will depend on the type of the param Recruit_main707: the param is the function? leorize: if it's a typed, then it'll resolve into an nnkSymbol. You can use it directly for any expression since it'd be solved leorize: getting the name is as simple as .strVal :) leorize: if it's an indent, well kinda same story :P leorize: kayabaNerve: refc is not really deterministic leorize: you'd really want arc for that Recruit_main707: leorize i didnt understand a shit, sorry, let me show you my code so that i can understand: https://play.nim-lang.org/#ix=2gg4 Recruit_main707: its a very specific problem, it will be shorter if you dont ask why i do it ;) leorize: https://play.nim-lang.org/#ix=2gg7 leorize: the magic of emit :) Recruit_main707: lmao, i didnt know about those XD Recruit_main707: thanks leorize: https://play.nim-lang.org/#ix=2gg9 Varriount: Hm. Araq, how do other languages handle the aliasing situations that the Nim spec currently says are not allowed? leorize: and here's the macro version if you'd like to know how to get the name Recruit_main707: lovely, thank you very much, i am finally seeing the potential of metaprogramming. kayabaNerve: I think I found the problem. I'm defining the types as: ⏎ ⏎ ```X {.importc: "x", header: "x.h", incompleteStruct.} = object ⏎ Y* = ptr X``` ⏎ ⏎ When Nim clears the wrapper ref object, the pointer isn't properly deallocated. [https://gitter.im/nim-lang/Nim?at=5e84d12461967448380eedf4] kayabaNerve: That's my theory at least, given that I'm setting the wrapper ref to nil and calling GC_fullCollect() to no effect. leorize: do you have a finalizer to deallocate the pointer? kayabaNerve: Though I'm not entirely sure how to check that. I guess register a destructor for the ref? kayabaNerve: ... nope. Nim won't do it automatically either. kayabaNerve: That's my fault. kayabaNerve: Thanks. leorize: you can write a destructor and it'll be transformed into a finalizer automagically kayabaNerve: Yep shashlick: Araq: curious why proc pragmas are at a different place in the AST compared to types leorize: finally I can make my `ctype` macro and it wouldn't look weird :) zacharycarter: does anyone use kakoune with Nim? solitudesf-: yes zacharycarter: Nice! Do you use the kak plugin system? zacharycarter: plug.kak or whatever? solitudesf-: nope zacharycarter: ah okay - I have the LSP plugin and just added Nim to the list of languages to set options for, but I have a feeling I'm going to need to do more configuration to get it to work solitudesf-: you dont need plug.kak for that solitudesf-: only thing needed is to do launch kak-lsp and run lsp-enable zacharycarter: okay I'm doing that - so hopefully it's just working already and I'm unaware :) rayman22201: Hey zacharycarter. Been a while since we've seen you on irc. Hope all is well! solitudesf-: there is lsp-capabilities command to check if its working zacharycarter: I'll try that, thanks zacharycarter: Hey rayman22201: Thanks! All is good, just getting settled into my new digs in Austin rayman22201: nice! great timing lol zacharycarter: Haha yeah! Just in time to really really settle into them zacharycarter: hope you are doing well too! zetashift: great to see you again zachary :D zacharycarter: Hi zetashift! Likewise! alehander92: zacharycarter how are youu alehander92: rayman22201 so hm alehander92: i need to write a custom async module? i think sometimes tweaking how async macro works is also needed, but maybe thats too much rayman22201: alehander92 sorry. I need more context. what are you trying to do? rayman22201: I only half read your ping when I woke up lol alehander92: well i just read about https://os.phil-opp.com/async-await/#cooperative-multitasking-1 implementation a bit :D alehander92: but honestly just the idea to write custom ways that futures are executed with seems useful, but you're right this might be already possible here alehander92: ah here it is evening zacharycarter: Hi alehander92! Good thanks! You? rayman22201: ah! yes! I saw that article as well. It's on my reading list :-) rayman22201: Nim promises can pretty much do the same thing, the api is just a bit more messy. I really like the Rust async api. I want to steal a lot of ideas from it for my Async 2.0 project. deech: I'm trying to figure out the current `nimbleDir` setting inside the `.nimble` file but the `nimscript` module doesn't export it and I'm having trouble parsing the `nimble.ini`because `streams` apparently can't be imported in a `.nimble` file. Is there another way to do this? liblq-dev: hey zacharycarter! zacharycarter: Hi liblq-dev! rayman22201: Httpbeast is a good example of what we have today. The standard library event-loop is single threaded. Httpbeast, instead of using the stand library, has a custom event loop spreads the async events over threads as they are triggered from http requests. rayman22201: It's not "the cleanest" architecture, but it works quite well. federico3: :-/ rayman22201: ?? shashlick: deech what exactly you trying to do deech: Figure out what `nimbleDir` is at build time. shashlick: What for, curious deech: So I can pull in some third party sources like llvm. shashlick: Not using standard Nim search of pkgs? moerm: good day everyone moerm: I just opposed Araq in the "Nim goes Python" forum thread. Sorry but his plan looks unsound and timid to me rayman22201: moerm. It's an april fools joke. You are aware of that right? or are you trolling? lol rayman22201: ah. I see. lol. the joke continues Zevv: he best jokes are the ones that keep on giving. Didn't see that coming with this one tho :) moerm: *g moerm: We must be BOLDER! rayman22201: hahahaha. AI for everyone! rayman22201: I think we rewrite nim in Perl 6... wait, I mean Raku :-P moerm: Nope. Nim shall be *danced* and that shall be AI interpreted to detect our *intentions*. Then, the AI expresses it using only void ptrs. It's about time we get rid of the limiting typing paradigma (attention, hidden pun) rayman22201: lol nisstyre: the site is down nisstyre: or it was... rayman22201: it's up for me? nisstyre: I got some cloudflare errors nisstyre: maybe it's region specific moerm: Nuh, I think it's just CloudF§&?# f*cking up as they often do go|dfish: had cloudfare errors here too, back now though rayman22201: 🎉 rayman22201: @krux02, @Varriount, you have to explain to me why you don't like `{.byaddr.}` I don't get it. moerm: "low latency", my ass. I *often* see sites suffering from having made themselves CouldF§&?' dependent moerm: I/we have a couple of dedicated servers in not exactly central locations (but good providers) and we are consistently better reachable and faster for our audience moerm: And btw. I would NEVER give away my private key to a 5 eyes company moerm: (because I wouldn't do hosting with NSA or GHCQ) rayman22201: well, iirc, they give us service for free as an OSS project. So we aren't paying them... nisstyre: it's better than trusting google or microsoft nisstyre: but they do some weird stuff moerm: Yeah, "for free", that's the bait getting many hooked moerm: But it is NOT FREE. YOU DO PAY! Just not with money rayman22201: When you are a small open source project, you take what you can get moerm: Well, I'm not here to preach. If that is what you want then go ahead and BE THEIR PRODUCT rayman22201: 🤷 I just hang out here. If you care that much, talk to the people in charge (possibly with an offer of money to offset the effort to change... I'm just saying...) moerm: No problem, I say things like those but then it's enough. I'm not interested in preaching or in converting people axion: o/ axion: I'm trying to understand if I can rely on something about iterators that doesn't seem to be mentioned in the spec Varriount: rayman22201: It's not memory safe, not documented as memory unsafe, and hides what I feel should be an explicit operation iffy: How would I convert the following C to Nim? c2nim wants a semicolon somewhere near the end of the second line: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e84f4a9302cd3685be07d16] Varriount: If someone feels that their program should be optimized using unsafe mechanisms, I would prefer that usage to be clear and explicit. Not hidden behind syntactic sugar that really only removed the need to dereference things. rayman22201: Hrmm. I agree it's unsafe. Better documentation is always good. It's more than that. Timothees point about pointer escaping is important. krux02: rayman22201, There are multiple reasons I don't like byaddr. krux02: First of all, it is yet again another feature that needs to be mantailed and implemented in all backends. krux02: This is not something that can be resolved in the frontend. Varriount: Yes, but how likely is that? In order for the pointer to escape, you would need to label the return type, structure member, or something else as a pointer type. krux02: Then it is proposed by a specific author who has a tendency of introdcing unnecessary features. krux02: Then the proposal is convoluted with things I don't want to read. rayman22201: Can you elaborate on the point about not being able to be resolved by the front end? krux02: How is byaddr supposed to work in javascript? krux02: rayman22201, byaddr means that something is literally taken by address. Pointers are not a thing in javascript. krux02: they are emulated rayman22201: But there are other features like this that don't work in js krux02: that is not the point. rayman22201: regular addr has the same problem rayman22201: It is the point. There is precedent. JS is a bad example. krux02: Anyway, the proposal is from Timothee, his contributions constantly cause a horrible feeling in me that I can't describe. If you want byaddr, make a spec for it, rename it, and let it be implemented by somebody else. zacharycarter: lol that's mean krux02: I don.t care. moerm_gitlab: Yay, I managed to get a gitter account (had to create a gitlab account first. Weird) krux02: He cause so much pain for me, that I don't care about his feelings. zacharycarter: well - I'd be lying if I said you were the only person I think feels that way zacharycarter: lolol rayman22201: I understand your frustrations, but I'm trying to be objective krux02: moerm: congratulations, now come back to IRC :P rayman22201: Lol moerm_gitlab: Let's crucify him!!!(peoples front of Judea) rishavs: Is there anyway to iterate over the members of a set? Or perhaps to convert a set into a sequence? krux02: rayman22201, the best I can do about staying objective about timothees contributions is if I ignore all his opinions. krux02: I mean bugs are not an opinion. and timothee is very qualified to detect them. krux02: But I don't want his solutions. moerm_gitlab: Do we know how Araq feels about him? rayman22201: Araq accepts the PRs lol krux02: If a feature is added to Nim, there should be a real problem that this feauter solves. THat means the feature should be backed by a project that is using it. krux02: I don't want these features that are hanging in the void and are used by nobody. moerm_gitlab: rayman does that mean that Arq accepts pretty much anything or that he thinks Timothee's stuff is OK? rayman22201: I'm assuming timothee has projects. krux02: A feature needs to have real world use cases to get it right. krux02: and that is not limited to his feature requests. krux02: I would even go so far and delete the feauter request template for github issues. krux02: I am assuming timothee is 100% busy finding issues and solutions for bugs in Nim. rayman22201: Araq liked the feature. Krux wants no new features. Krux is a bit extreme imo rayman22201: But I understand his feelings krux02: just look at the amount of issues and PR he posts. moerm_gitlab: rayman Hmmm, thx rayman22201: But this is all besides the point. I'm just trying to understand this specific feature. krux02: Yes I don't want any new feauturs. The compiler is already burning because of bugs and inconsistencies. krux02: But that doesn't mean I wouldn't accept new feauters. The bar to accept new feauters should be high though. krux02: So high that it is almost impossible to get new feautures into the language. moerm_gitlab: krux Cool down. The new Python based Nim is comping moerm_gitlab: -p krux02: gdb nim integration is written in python if that counts. moerm_gitlab: A good start. But we need an AI that recognizes our dancing moves and expresses them using void pointers only krux02: Especially features where somebody things it would be useful should not become part of Nim. krux02: yea that joke is old by now moerm_gitlab: krux So sorry, pls forgive my attempt to cool you down a bit krux02: But joke aside, I think it is inevitable that soon we will have programs written by AIs. krux02: I am not upset. krux02: I am just frustrated, I am frustrated for quite some time about things that go wrong in the Nim compiler development. rayman22201: You always sound a bit upset these days. krux02: You are not part of that. You just triggerd something so I realeased my frustration. krux02: There are other things as well. rayman22201: I'm an optimist. I think things will improve 😊 krux02: No I don't think so. rayman22201: I hope anyway moerm_gitlab: krux well, yes, maybe Araq is a bit to lenient. But he happens to be the man who gave us Nim so I think it makes sense to let him roll his way krux02: Araq will continue to accept unnecessary feautures and will make it mandatory for future patches that these broken feautures will continue to be as broken as they were when they were first contributed. moerm_gitlab: If Nim *really really* gets unwieldy or, god forbid, unreliable you can fork it and throw out what you consider dangerous, not necessary, cruft ... krux02: Yes Araq gave us Nim, that that is great. axion: As a new developer, I am frustrated too. Everyone I talked to on mumble about the compiler quality issues shares the same opinion for the most part. It really makes me question staying with Nim, but I must stay optimistic if I want to get work done. dom96: FWIW I agree with krux02's concerns moerm_gitlab: axion I get you and I very seriously care about quality. But from what I see, staying away from diverse gadgetry seems to be good enough krux02: And no I don't want to fork Nim. krux02: For the most part, I don't think Nim will survive a community split. moerm_gitlab: Hey guys, Araq is also one who seriously wants to bring Nim close to static verif. So he *does* care about Nim at least offering the possibility to create safe code (albeit I guess only when staying away from experimental gadgetry) krux02: I am not questioning that. krux02: I am questioning his ability to make the right decisions to keep Nim alive. moerm_gitlab: krux No. Not a community splitting fork but one that is, let's call it "conservative" krux02: A conservative Nim that throws out all the dead code krux02: and removes these incomplete feautures like hot code reloading. krux02: and concepts moerm_gitlab: Yes, something along that line. No funny gadgets, no experimental stuff, only plain solid Nim moerm_gitlab: plus static verif. krux02: I am all for that. Varriount: https://play.nim-lang.org/#ix=2ghX moerm_gitlab: You see, we NEED Araq to be "playful" and open to ideas. That's how Nim came into existence moerm_gitlab: At the same time many of us need Nim to be a solid tool. krux02: moerm: I know that. krux02: But now it is time for Nim to become a more boring language. krux02: Stop playing around. Get the shit out of the way and fix bugs. euantor: A lot of the new features are very difficult to discover too. I fear they get added, nobody knows about them and they only exist to site there and collect dust krux02: Playing is for Nim users not compiler developers. moerm_gitlab: That would not be splitting or competive. That would be complementary and and could be a very friendly coexistence. And it would save Araq from concerns about the "conservative faction" and at the same time would give the conservativ Nimians green light. krux02: euantor, you don't know about all the surprise feautures in Nim. Yardanico: to be honest I agree with krux02 axion: I am mostly frustrated that we scrambled to push a 1.0 probably years too premature, leaving a lot of new users, myself included, with a false impression of the language due to all the instability by favoring new features over the plethora of compiler issues unresolved (or sometimes not even acknowledged as with my issues) euantor: krux02: does anybody truly know them all? moerm_gitlab: euantor Yep, solid proper docu would be a part of the "conservative Nim brother" too dom96: axion, premature? We've been working on Nim since 2008 krux02: well, I don't know them, but I guess I triggered them all once. rayman22201: @varriont are you showing me the unsafe nature of the feature? axion: Premature yes. I would not exactly call Nim 1.0 in its current state, especially with the attention to features over all the bugs. dom96: But yes, I agree, 1.0 is the time to get down and fix bugs krux02: I totally agree, version 1.0 was premature. I told Araq so. dom96: not work on ARC, static analysis features and whatever else krux02: But he wanted a version 1.0. euantor: I took a break out of using/following Nim for a couple of months and there have been a lot of changes since then. The 1.0 announcement is what got me back trying to follow things Varriount: rayman22201: Yes krux02: I told him, if Nim doesn't open new issues/bugs for a week, then version 1.0 could get an RC dom96: but I understand that fixing bugs day in day out can seriously affect burnout rate krux02: and if it continues to be bug free for a month it could be called version 1.0. rayman22201: I already knew that @Varriount. Again. I don't think it's worse than our other unsafe features rayman22201: I think 1.0 was good for only one thing, marketing. moerm_gitlab: dom96 Without static verif. Nim will stay "just another language in a sea of languages". SV would push it forward and make it a "todays Ada" federico3: axion: having a stable 1.0 spec enables bugfixing in the compiler euantor: Regarding documentation, I still think the .net documentation is the minimum bar we should all aim for. Most things I look up have clearly documented parameters, return values, exceptions and often examples Varriount: Yes, but how long will proper static verification take? krux02: dom96, for what I can tell you, I didn't work on new features at all, (except sizeof/alignof) I worked on compiler bugs only. dom96: moerm: sorry, but I have no use for static verification, and most programmers don't either krux02: and yes, it is tough especially if you don't know the compiler. dom96: moerm: it's cool, but there are more important things that should have resources put into them moerm_gitlab: dom96 safety was one of the priorities I looked for when I came to Nim krux02: But surprise feauters that are sprinkled accross the entire codbase with a lot of dead code everywhere seriousld affects productivity. krux02: And guess what happens when I tried to clean up that mess. rayman22201: dom96: completey disagree about static verification zacharycarter: +1 - isn't that why Rust is so popular? zacharycarter: because of static verification? rayman22201: Exactly moerm_gitlab: dom96 I get your point that is much to be made solid, cleaned up, etc. But that does not mean that we can *also* do a really important new feature. federico3: is it? Varriount: rayman22201, moerm: Yes, but how long will it take to come out with something that is usable, and actually *complete*? zacharycarter: I don't know - I'm asking krux02: here this is what happens when I try to get red of dead code: https://github.com/nim-lang/Nim/pull/11981 moerm_gitlab: In fact that would be a good example for what I mean. Araq Nim is the experiemental one. Once SV is solid enough there, we can put it into the conservative branch dom96: moerm: it does mean that, resources are limited. federico3: zacharycarter: I doubt it. It's popular because of marketing krux02: It happend every time I tried to clean up the code. dom96: Rust is popular because it guarantees memory safety at compile-time moerm_gitlab: Varriount That's a question for the Nim team, not for me zacharycarter: well yeah - I think that played a huge role in its meteoric rise in popularity dom96: That is not what I am referring to when I talk about static verification rayman22201: What do you think static verification will let you do? krux02: yes rust is popular because of that guarantee, but it struggles in compile time. krux02: it also struggles in being very verbose with move semantic annotations. shashlick: let me ask a basic question here - how many of you can review compiler PRs? not in terms or permissions but know-how moerm_gitlab: dom96 Pardon my french but Rust is popular because memory safety is a seriously pressing problem and because they believe in magic axion: As such a lot of Rust devs have been ironically migrating to using more dynamic dispatch krux02: All of the sudden all I see is a forest of move and borrow operators attatched to everything. krux02: shashlick, I can moerm_gitlab: shashlick That is only part 1. Part 2 is how many of us have the time and resources to work on a compiler shashlick: krux02: wasn't directed at you 🙂 moerm_gitlab: shashlick but at? shashlick: moerm: time is the most basic qualification Rika: good morning Varriount: I could probably learn. zetashift: I think it's hard to manage developer resources on the budget Nim has. I do wish features, like HCR and concepts, got a bit more love they are important in making the foundations of a solid ecosystem shashlick: having big opinions on what Araq should work on is like telling me what I should work on, or me telling you what you should work on shashlick: i've had this conversation before - some people are good at creating, some are good at sustaining moerm_gitlab: Sorry I'm writing quite a bit of my work using Nim. And that part is increasing (but, yes, I stay away from gadgetry) dom96: shashlick, yes, when Araq was working in his spare time krux02: zetashift: I with HCR and concepts would be removed from the compiler core code base. dom96: but that isn't the case anymore, many are giving donations to Nim dom96: they deserve to give their opinion on what should be worked on zetashift: @krux02 moved to libraries you mean? krux02: yes rayman22201: I love the idea of HCR, but I'm ok with killing it if it can't be maintained moerm_gitlab: shashlick That's why I demand nothing from Araq - but I'm very pleased with much of what he does krux02: some compiler plugin. Rika: on stdlib or nimble? zetashift: I think HCR could stay but I wouldn't mind a nim-prelude of sorts that contains it zetashift: it being concepts etc krux02: I don't want their implementation sprinkled around everywhere in the compiler. shashlick: I think it is a lost cause if you expect him to do maintenance Rika: ah so on stdlib sheerluck: leave Araq alone! Maybe he's not in the mood! Rika: stop pinging Ar4q moerm_gitlab: So, maybe maintenance is a good starting point for the conservative faction Rika: xd krux02: I think he isn't online, otherwise he would already have responded. krux02: I said quite a few things that would normally have triggered him. Rika: huh, isnt it 10 on europe or something dom96: HCR and concepts are yet another set of features that are not necessary shashlick: like asking Michelangelo to maintain the Sistine chapel Rika: *shrug* shashlick: fix paint chips because you pay his bills moerm_gitlab: shashlick *g zetashift: HCR is really nice for the data science-y part tho D: dom96: You know what is necessary? Being able to write concurrent and parallel code in Nim without fighting a lot kodkuce: i want to work on game engine but i am uber newb to pull that myself Rika: concepts are nice for those coming from haskell i suppose? not sure, but i liked them zacharycarter: HCR isn't nice unless it works without issues, and it doesn't Varriount: Well, for what it's worth, krux02, would you be open to donations for your work on Nim? zacharycarter: same with concepts moerm_gitlab: dom96 Full ACK krux02: I am not arguing against the usablility of HCR, but in the compiler the HCR implementation isn't maintained by anybody. zetashift: dom96 isn'tthat where ARC comes in zacharycarter: but I don't think Araq wants to spend all his time fixing bugs and writing documentation - he obviously likes to research and prototype krux02: it just sits there and rots away. zetashift: ah fair krux02 krux02: same with concepts. zacharycarter: so like shashlick says: it's pointless to say Araq do this zacharycarter: unelss you're paying him a salary, which none of us are dom96: again, some of us are, partially shashlick: I agree krux02 that junk should be trashed zacharycarter: donations are donations shashlick: but making giant PRs is not received well by anyone Recruit_main707: why is data not getting updated! we could have won D already! shashlick: 82 changed files, come on Recruit_main707: https://tools.wmflabs.org/pageviews/?project=en.wikipedia.org&platform=all-access&agent=all-agents&redirects=0&start=2015-07&end=2020-02&pages=Nim_(programming_language)|D_(programming_language) shashlick: I mentioned this earlier, if I am given free reign on a particular aspect, I can move fast and fix and improve stuff, as I am with nimterop moerm_gitlab: Frankly, it seems I'm not too far off with my idea. Let's have some "conservatives" come together an create a solid Nim branch with lots of experimental stuff cut out and a focus on solidity shashlick: i can also introduce new bugs with less oversight but I can fix those too over time, nothing is perfect zacharycarter: I do think though that these experimental features need to be segregated though from Nim's codebase axion: ^ zacharycarter: might be too late for that to happen though Rika: i feel like it is too late rayman22201: I like the two party system as long as we can come to compromise. I would independently donate to krux02 as long as his PRs are accepted. shashlick: if there isn't trust, you'll have to stick to 10 line PRs which is tedious and boring Rika: sadly zacharycarter: they seem to have tendrils everywhere at this point shashlick: and slow slow slow axion: I think working on new features is great for self-respect and curing burnout, but when this shows what should be worked on _most_ of the time, come on: https://i.lisp.cl/dKF62H.png moerm_gitlab: 1) afk for 2 min - zetashift: DrNim would mean better tools to fix the compiler though no? krux02: rayman22201, thanks a lot donations would actually motivate me to spend more time on the compiler. shashlick: let me ask this - 4raq spent months working on arc, how many of you had bugs there were caused by arc? krux02: Currently I only feel the backlash from Araq. zetashift: Also documentation has been asked for years, I don't think Nim is the language for documentation since it's always so easy to just start stuff shashlick: i don't think any of arc instability was exposed to the general population krux02: I didn't try arc, because I didn't feel like opening a can of worms yet. shashlick: neither have I but that doesn't mean that him working on new stuff is breaking otherwise stable things axion: I didn't try Arc because I am old and have had bad experiences moving to shiny new things that haven't been properly vetted yet. zetashift: I only see ARC on the github issues list besides that haven't noticed anything of it yet Rika: i dont know what the issues are with documentation Rika: iven' Rika: oops Varriount: https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+arc Rika: ivent have any Rika: had* damn it axion: If it ever becomes the default and it breaks stuff I will have to weigh the cost of fixing everything vs jumping ship dom96: At the end of the day Araq is his own boss, but he is responsible for ensuring Nim evolves in the best way possible. My opinion (and I bet a lot of other's here) is that this requires far less working on new features. sheerluck: When exactly 1 April is over in this chat? rayman22201: Lol zetashift: I feel the same, but I ain't stopping him from doing him Araq: ah so it's "let's all shit on Araq" time rayman22201: It's not like he doesn't listen to the community Rika: oh hes awake now 😛 krux02: ah there you are. rayman22201: Oh hi lol Araq: coming soon, "Nim must be easier with multithreading. And it doesn't require new features (ARC) for that." Araq: and also "I don't want to open a can of worms with ARC so I created a PR rewriting the stdlib instead" Araq: (can you guess? that's for me "Opening a can of worms") zacharycarter: I don't know how ARC became the feature that started getting clobbered. It started with HCR and Concepts Rika: i think its because some of us dont see the reason for ARC zacharycarter: Well the reasons are what Araq just described - folks have been complaining about multithreading in Nim for years zacharycarter: and the default GC making multithreading difficult moerm_gitlab: Hello Araq ;) alehander92: krux02 i think Nim is a opionated/powerful language by design, you cant really make a language that expressive/flexible and expect it to get to a "small language no more features for now" feeling alehander92: i might be wrong of course dom96: I think that a lot of people see ARC as yet another feature that is replacing fixing bugs in the GC to enable better multithreading. moerm_gitlab: Araq I don't think they are "shitting on you" but rather that it's two basic factions, each of which is right (and with different priorities) alehander92: maybe one can imagine a smaller type+metaprogramming core and absolutely everything as libs on top but .. oh well zetashift: I certainly wasn't my intention, I like Nim too much for that kodkuce: i want arc krux02: alehander92: I never said no more features. I said new feauters must have a real world use case. alehander92: but krux02 this is very subjective: everybody has his own view of what is really "real world use case" dom96: krux02, I'm sure that's what the C++ committee says too ;) moerm_gitlab: krux that's meaningless. Even for very weird stuff there are real world use cases zetashift: @alehander92 I think he wants more "maintainability of features" not so much as anti-features zetashift: nvm I was wrong lmao kodkuce: yep i as a uber newb thik about exactly like you say dom + better interoperability with other stuff krux02: no featues that feel like a smart idea. krux02: No more smart ideas in Nim. alehander92: but this is just a "i got burned once, no more of this ever for me" moerm_gitlab: As I said already: I think we need BOTH, the "wild experimenters" as well as the "conservative faction" that seeks reliability, well maintained, and documented Nim alehander92: some smart ideas are practical, some not krux02: Dump down the implementation, dump down the lines of code in the implementaion, dump down the complexity in behavior. Make things more understandable. alehander92: that's life krux02: Dosn't matter if they are practical. shashlick: krux02: that's a bit extreme, this is a team sport after all krux02: Smart idea bite you in the ass. alehander92: you can't always code for the ease of implementation: after all, a language is supposed to help users: why not move some of the complexity inside the compiler? zetashift: @moerm_gitlab I feel like we doing well in that regard, 1.0.6 is great for me and 1.2 seems to be better while devel is working on DrNim, IC and ARC alehander92: otherwise you just tell your users "nah, you do this" moerm_gitlab: zetashift Still, there are never ending discussions ... alehander92: its very good to have simple software, but compilers are one of those things where sometimes you have to add hard to understand complexity(even if it should be still as simple as possible) rayman22201: @dom Imho we need arc. Other gcs are fundamentaly inadequate. No amount of bug fixing would help. alehander92: but maintainability and clarity can still be required even for such more complex passes/components of course zetashift: @moerm_gitlab there will always be those kind no? Bikeshedding still happens in OCaml where I sometimes frequent the discussions and that language is 20+ years old axion: I agree but at the same time others look at ARC as just another experiment to add to the needlessly tall stack of GC's alehander92: krux02 also i wonder if that's a bit of "imagine how X would look if rewritten cleanly": nim is already a >10 years codebase, so inevitably there is a lot of stuff hard to change radically now shashlick: cannot call ignorance as justification rayman22201: Sometimes new features are the right answer... But I'm a moderate. I want maintenance too. dom96: rayman22201, lack of resources + spreading ourselves thin = no adoption. The more features we implement, the more thin we spread ourselves, ARC is a reimagining of a lot of Nim, it's not easy and will require the whole community to adopt it, I'm still skeptical it's worth it. moerm_gitlab: zetashift My question is: How can we have *both* factions be happy and productive? zetashift: I'm hopeful it doesn't end up like concepts or HCR, because the plan IS the unify it to ARC krux02: alehander92: The age of code doesn't say anything about the quality of the code. Some people clean up their mess and remove redundant feauters, other don't. shashlick: unless 10 new people commit spending 3 hours a week on Nim working towards becoming maintainers, this is a pointless conversation Araq: dom96: yet here you are, not implementing new features nor fixing bugs. zetashift: @moerm_gitlab I don't know man, you'll always have people that do not like it, I bet if we made both factions happen, a new faction will rise up complaining about case style insensitivity moerm_gitlab: And frankly, I'm not sure that all of us always stay (in discussions) in their realm of expertise alehander92: krux02 otherwise i agree with some of your points, but i cant agree with your tone: this is not your language after all to judge who can contribute and who cant dom96: Araq, I don't work full-time on Nim zetashift: @shashlick yep I concur Araq: so what? whenever somebody touches async you draw them away Varriount: shashlick: I would happily do that, if the internals of the compiler were documented at all, or we could actually fix things in the standard library. moerm_gitlab: Btw Who is the father of Nim's async/await? leorize: dom dom96: I like to think my opinion deserves to be heard, seeing as I have committed a lot of my time to this language. If I'm being told that then you may as well say that to everyone writing in this channel right now alehander92: i cant say i agree, whenever i wanted something about async/await i did receive help/or requirement to rfc properly(which is good! its easy to just propose random things without planning) shashlick: Varriount: it is what it is - ast1.0 in nimterop had zero comments and I got zero contributions to date shashlick: so for ast2, i've put hundreds of lines of comments shashlick: but Nim is several orders of magnitude larger so we have to do what we can moerm_gitlab: Araq what do you mean by dom96 drawing people away wrt async? alehander92: Varriount: documenting important/non-obvious things about the compiler can be part of maintenance shashlick: i won't say I've gotten into the compiler at all but I now know the AST since I used it in nimterop so baby steps shashlick: i know a little about the VM and nimscript, so i look for bugs in that and make minor contributions krux02: Varriount: If you care I can give you an introduction to compiler development, just unmute on mumble shashlick: it is a long journey of mostly learning leorize: the only thing I know about the compiler is how nimsuggest is put together :P shashlick: this is a 12 year old product moerm_gitlab: dom96 Yes, you certainly deserve to be heard. BUT: Araq is our BDFL. *His voice* is the one that counts at the end of the day shashlick: @leorize: then you HAVE to fix the memory leaks pronto rayman22201: krux02: stream that for everyone! krux02: dom96, your opinion matters. After all you wrote the only book about Nim. alehander92: krux02 that's true, but removing features from a language is hard Araq: it's not hard, you simply do it and don't care that N important packages are broken and that the existing users should go to somewhere else. easy krux02: alehander92: removing feautures is hard, that is why it is so important that the bar to accept feauters is as high as possle. moerm_gitlab: krux much less so when it's new and incomplete or not yet solid features ... krux02: after all, the majority of ideas and feautures are bad ideas. shashlick: neither of these approaches make sense - high bar = zero contributions, removing features = instability shashlick: both are extremes krux02: They are not supposde to be crappy code that slows down compiler contributors. krux02: shashlick, not true. alehander92: krux02 yeah, but no features is not better: if nim had no interesting features..why would one use it krux02: I am talking about new feauters in the compiler. krux02: Nim has already enough interesting feautures. krux02: Nim needs stability. alehander92: ok, this is obviousl ysubjective shashlick: what is unstable in the 1.0.x series right now? alehander92: that's the problem with language design i admit, different people just want different things zetashift: Isn't it getting that with DrNim and ARC? Araq: krux02: and how exactly is adding $ to 'distinct T' aligning with "stability" Araq: you say X and then you do Y. shashlick: any project has to move - as long as features are hidden behind flags and deprecation is followed, we can add and remove just fine shashlick: it is about getting agreement on what to do Varriount: shashlick: Concepts, ranges, templates, krux02: Says the man so says at one point to not conflate refactorings with fixes and in other situations expects them to be conflated leorize: shashlick: the leak is somewhere in the vm and I don't wanna touch that Araq: krux02: that's simply not true moerm_gitlab: ... yet some here feel that SV is not necessary ... strange moerm_gitlab: IMO SV (well going for it) is a stroke of genius of Araq Araq: but enough of this. Just tell me what to do, I'm listening, krux02. And don't just say "merge my PRs more quickly". moerm_gitlab: It'll be tremendously valuable when dealing with bugs - in Nim itself, too shashlick: at the end of this conversation, i think we should have one candidate unmaintained feature for deprecation and eventually removal leorize: I don't mind features, but we do need a better timeline for adding features vs fixing bugs shashlick: what will make it a less pointless conversation krux02: Araq: How about you start with not instantly closing my PRs, just because you don't want to review them. Araq: I did that once after an online discussion about it Araq: with you. Araq: and I told you I would do it. shashlick: krux02 - how about not spending several hours on PRs without first getting general agreement on what you are planning Araq: you created the PR anyway. rayman22201: Honestly, I just want Nim to hire a "maintenance person". Their only job is fixing compiler bugs. (Maybe some refactoring). Crappy job, but it might put the community at ease? Araq: shashlick: exactly... krux02: rayman22201, that way my job. shashlick: i mean everyone here has jobs, do you start coding a feature before running it through planning? krux02: But not all of my maintenance was accepted or wanted. shashlick: i've seen several people do it here krux02: Cleaning things up in the compiler, generally I got rejection from Araq. alehander92: :D sometimes you think a feature is very cool and do it alehander92: but i agree its good to talk before leorize[m]: https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+label%3ACrash <- we need to handle all of those :p shashlick: collaboration is more important than code Araq: krux02: yeah, right. because they broke stuff. rayman22201: Yes, well... There have been some HR issues and communication issues with this job... krux02: Araq: no Araq: listen man, you didn't even get int128 right. krux02: My PR to rename conflicting file names did not break stuff krux02: my pr to remove only dead code did not break stuff Rika: oh lord krux02: Araq: how many issues with int128 are open? Araq: whenever there is something you don't understand, it's the fault of the others. moerm_gitlab: krux sorry but this begins to look more and more like "krux angry because Araq is the final decision maker and not krux" ... Araq: for not documeting the code krux02: I am not saying I get all the things right on the first try. But I clean up my mess. Araq: or for not writing tests that test for performance implications krux02: I even had a hard discussion about cleaning up my very own code for sizeofalignof. Araq: or for not writing tests against nlvm so that you notice you cannot just remove field from an object declaration shashlick: I think we need a general Nim policy that no PRs will be accepted before an accepted proposal from the owner on the idea shashlick: can be a one line irc discussion for all i care, or an elaborate design doc shashlick: RFC, whatever Araq: krux02: oh yeah? I told you not to use exceptions for this piece of code. You simply didn't listen. shashlick: don't spend hours working on features and flooding PRs krux02: yes exactly I didn't listen. shashlick: don't work on things that the owner isn't aware of Araq: and everything was indeed a constant fight with you. Araq: and now here you are shitting on me. shashlick: it is 1000x more frustrating if code you worked on wasn't accepted versus an idea krux02: Simply becaues in this case I used what was necessary for maitainability. rayman22201: @shashlick That has been getting better actually if you look at recent prs and issues. krux02: yes I am shitting on you, because cleaning up code in Nim was always frustrating, and now the compiler is full of bugs moerm_gitlab: shashlick come on, let the two settle the issua without interruption shashlick: i'm talking to everyone else, they can discuss whatever alehander92: this is a public chat Araq: krux02: you don't care about the bugs, you care that it's "simple". shashlick: have seen this so many times and have even said it a few times moerm_gitlab: krux Bang, game over. Tilt. One doesn't shit on the creator and BDFL of a language. Period. krux02: yes, simple means that it is more likely to have fewer bugs. zetashift: This uh seems to have gotten out of hand krux02: and bugs are easier to spot in the code. Araq: if that "simple" means "buggy in ways krux02 didn't foresee" it doesn't matter krux02: if it has bugs, complexity is needed as necessary. moerm_gitlab: zetshift frankly I don't think so. I think there is something finally getting back into its place krux02: but that doesn't mean that it you should never even dare to simplify things because it could potentionally break things. Araq: krux02: you simply don't understand the bugfixes in the code and claim "It's all unnecessary complexity" zetashift: @moerm_gitlab fair ksandvik: Maybe it's time to have a dedicated irc channel for internal development and one for the public use? krux02: there is a nim-dev channel. ksandvik: Could this kind of discussion about nim internals reside there? krux02: Araq, that is the point, the code is so full of bugfixes that is almost impossible to understand. Araq: ofc you never look at luajit's code, or LLVM's or Scala's. you look only at the Nim compiler and blame me for your shortcomings. moerm_gitlab: ksandvik It was *here* that the can of worms was opened, so what's wrong with it being settled here? Sorry for disturbing your convenience zetashift: @ksandvik I don't think it's unavoidable, this discussion started here among also regular Nim users krux02: Well at least I did look through the std library implementation of all of Go Scala and Nim, and after all, Nim is by far the worst. And the frustrating part aobut it, simplifications are simply not welcome. ksandvik: Oh Ok, I will check back in about three hours then. Recruit_main707: @ksandvik also, just mute the channel if you dont want to hear it alehander92: i think stdlib vs compiler is an important distinction krux02: And yes I didn't look into scala's compiler implementation, but from the pure observer point of view it also has far fewers bugs than Nim. krux02: Yes it is slow. moerm_gitlab: krux never heard the famous saying "Bow before me for I am root!" *wink wink nudge nudge krux02: But I didn't hit a single bug in the compiler during the years I worked in Scala, I can't say that about Nim. krux02: And that was 2010. krux02: Scala was at that point in time only a few years old. Araq: the point is: see if you can understand the Scala compiler. And if you cannot, you cannot use this fact to blame its quality. Araq: because after all, you just said its quality is good. zetashift: Where you doing same stuff with Scala compiler as you were with Nim? Seems a lot of years to be still trying the same stuff with compilers shashlick: what exactly is the point of these statements? better to debate specific issues instead of general stuff zetashift: Also Scala isn't the greatest comparison they are having arguments with Dotty too lmao Araq: and you need to study all of the Scala compiler, not just the parts you enjoy looking at. moerm_gitlab: shashlick "clearing the air". I may hurt but sometimes it's necessary moerm_gitlab: -I +It zetashift: I'm out for now, good night everybody deech: The Scala compiler has a steady supply of PhD students and substantial industrial funding. shashlick: i'm fine with that, but saying Scala is better than Nim might be true or whatever but doesn't make any progress in unblocking anything shashlick: debate merits of technical issues and be specific Araq: btw I didn't look at the Scala compiler, I'm sure I should and learn my lessons. krux02: zetashift: I wrote a Block building game like mincraft in scala. moerm_gitlab: shashlick do you know the full history between the two? Probably not. deech: I'm saying it's (1) farther along because of the support and (2) far, far less able to fix any mistakes because of it's usage. Nim has the benefit of being small and having some unique ideas. krux02: zetashift: scala and dotty are basically two different scala compiler implementations. Scala is the original branch and dotty a complete new implementation. Dotty din't exist when I stopped using scala. Varriount: deech: how are we more able to fix mistakes more easily? shashlick: so somehow i cannot participate in clearing the air moerm_gitlab: If I were interested in Scala details I'd be in *their* chat deech: Because there's fewer people depending on Nim. Varriount: shashlick: What do you mean by technical issue? moerm_gitlab: krux (friendly and calm) Stop fighting and listen to Araq, really listen, and think about what he says Varriount: moerm: Could you just let people talk? Araq: and one final thing: I don't mind compiler cleanups, but I want real improvements, not differences in taste. Araq: and refactorings shouldn't cause regressions... krux02: Araq: what is an real improvement to you? moerm_gitlab: Varriount Could you let Araq and krux decide whether my comments are disturbing to them? Araq: krux02: for example, replace the C codegen by an AST to AST transformation. Araq: don't optimize the ropes, throw away the ropes. shashlick: Varriount: i'm saying it might be beneficial for krux02 to pick a specific issue or PR and debate the merits rather than general comparisons with other languages Araq: different example: remove the hacks for generics in sem*.nim and make the procs take an explicit "typeMap" Araq: that stores the types that sigmatch did compute Araq: other example: unify the CFG with the AST to give us a solid IR krux02: Araq: the problem is, a good cleanup often comes with a bigfix. And as far as I am concerned, that isn't allowed. Araq: other example: rewrite the PType cycle mess krux02: what is CFG? Araq: control flow graph. krux02: Araq: you can't rewrite the PType cycle mess, becaues macros depend on this mess. Araq: macros only see NimNodes moerm_gitlab: (btw. quite some SVs provide a CFG. Handy) Araq: you can map the new Type to NimNodes krux02: But don't they map directly to the PType? moerm: (switched away from gitter and back to IRC) Araq: no, the mapping is done in vmdeps.nim Araq: speaking of which, bad name, rename it do vm_map_type_to_ast.nim Araq: 1 PR Araq: merged as soon as the CIs are green Araq: and opSlurp() shouldn't be in this file krux02: moerm, 👍 moerm: krux sorry I only see a placeholder for something outside ascii Araq: and there is more: Let's say you throw away 4K C code generation and replaced it by 6K C code generation logic, but this time an aST to AST transformation Yardanico: moerm: *thumbs up emoji* krux02: Araq, ok that are the parts in the compiler that you see are bad and need to be cleaned up, but what are the parts that I see that should be cleaned up? krux02: moerm, it is a thumb up Araq: I would take it even *with* the implied regressions Araq: because it's worth it Araq: same for the PType mess moerm: Yardanico Thx! krux02: what about the VM. I constantly worked in vm.nim, that file deserves some cleanup as well. Araq: definitely Araq: I know you dislike the templates and their injections, throw it out krux02: good. Araq: and it'll be accepted Araq: maybe not "as soon as possible", maybe I will pick on something before it's mergable, that has to be allowed krux02: I think if I do it, I will do it step by step. shashlick: Araq: if krux02 is really competent at particular areas of the code, why not give free reign to work on that? he still has to pass all existing tests shashlick: and probably add more while he's at it Araq: and ARC, we run every GC test with it, "koch boot" is close to working with it, I'm sorry it's so long in development but you *yourself* wanted a Nim without a GC... Araq: and the code is cleaner than the old GCs too IMO. rayman22201: Jeeze. For such an important feature, arc has progressed very fast. How fast can you expect? Araq: and it's based on AST rewrite... liblq-dev: so I have a proc reading from ffmpeg's output, and ffmpeg reports some stats about the video encoding while it's being encoded, like `frame= 1 fps=3.0 [...]` shashlick: looks like it is free rein deech: Araq, a talk on ARC internals at the possibly upcoming remote Nim conference would be amazing. liblq-dev: I'd like to parse that `frame= 1` part and get the number out of it, what's the best way to approach this? moerm: FWIW I don't care at all about fast. I care about solid liblq-dev: strscans? pegs? Araq: most of the time I actually do what I tell others to do. liblq-dev: I tried the strscan "frame=$s$i" and the peg "'frame=' \s+ {\d+}", but both of them don't seem to match my string Araq: shashlick: it's worth considering. jackjia: Araq: what's the next step for DrNim? moerm: Btw, is there any place where one can find stressable solid numbers about how many error there *really* are in the compiler and stdlib? Araq: the issue tracker draws a realistic picture moerm: Araq Thx. And? Is it as grim a picture as some seem to suggest? Araq: impossible to tell because the happy users and silent users. Araq: *are moerm: Hmm, yes quite likely moerm: I'm getting senile. Till yesterday I was still using 1.0.6 and I was suprised to find 1.1 on git *embarrased Araq: jackjia: 'old(x)' needs to be implemented and we need look into using a CFG moerm: Araq If you play it smartly, SA will give you a CFG basically for free leorize: why doesn't distinctBase work on NimNode... liblq-dev: could anyone please help? I'm stuck Araq: moerm: no idea how to do that Araq: Z3 doesn't seem to offer anything like that (and why should it) leorize: liblq-dev: try npeg? :p axion: I can't figure out how to define a `[]` and `[]=` that allows getting/setting a Slice range for an object type that has an array. Can someone please show me how it's done? liblq-dev: leorize: I think it's overkill, but I may have to resort to that if nothing else works leorize: the only overkill part is that it's not in the stdlib :) liblq-dev: not really, it's that I only need a single pattern. I have no need to parse an entire grammar liblq-dev: and npeg was built for that moerm: Araq A SA is *based* on CFG (well, most of them) liblq-dev: but maybe I'm wrong. Rika: axiom https://nim-lang.org/docs/system.html#%5B%5D%2Cstring%2CHSlice%5BT%2CU%5D Araq: moerm: yes I know but Z3 doesn't do CFG construction leorize: liblq-dev: I found your problem, I think liblq-dev: what is it? leorize: your patterns doesn't match because ffmpeg outputs more than just the frame in one line liblq-dev: I thought that regexes ignore the rest of the pattern unless I add an anchor liblq-dev: ah, pegs leorize: you need explicit markers to ignore :P for strscans liblq-dev: yeah I was trying with regex too liblq-dev: ok liblq-dev: no, you use $. to achieve the inverted effect liblq-dev: just checked the doc liblq-dev: $. matches if the end of input has been reached axion: @Rika I have tried using that, but it's trying to using a seq instead of a Slice axion: I'm not sure what I'm doing wrong jackjia: Araq: will you continue working on it or switching to other bug fix? even the current implementation already can found some bugs/uncatched exceptions in my code, it's useful leorize: axion: https://play.nim-lang.org/#ix=2giu Araq: jackjia: I cannot work on it anymore because some people in #nim cannot understand it and it's clever stuff. We should only do dumb stuff. axion: Ah so you have to use a seq Araq: we're programmers after all, we don't like to think. moerm: Araq But *elegant* dumb stuff please! moerm: My aunt Mary used to think occasionally ... and now she's dead. Ergo: Thinking should avoided Rika: anyone got a guide for converting numpy -> nim libs? Rika: numpy usage i mean, not the numpy lib itself Rika: no, im just crunching numbers, no machine learning here 😛 moerm: numpy can be imported once the new Nim compiler is ready *g Rika: pff moerm: ;) moerm: Seriously, don't we have a bigint lib? I seem to remember that we do moerm: Otherwise just use a C lib and c2nim it Rika: its arraymancer or stint dunno which has the functions of numpy though Rika: probably arraymancer Rika: hmm ill look into it shashlick: Araq: question on incompleteStruct - if I use it on `struct X` withotu a header: pragma, it works fine - I can create a `var x: X` liblq-dev: leorize: npeg doesn't even compile for me, no meaningful error message… http://ix.io/2giv liblq-dev: I just tried to do `patt("frame=")` Rika: WHAT Rika: ARRAYMANCER HAS NUMPY FILE READING go|dfish: liblq-dev: how are you reading ffmpeg's output? Rika: god i could have used this for my research Rika: should have checked ;; shashlick: but if I add a header pragma, it complains about storage size liblq-dev: go|dfish: via the inputStream provided by osproc, why'd you ask? liblq-dev: there isn't a problem with blocking or anything, I'm reading char by char using readChar liblq-dev: and discard all \n and \r go|dfish: liblq-dev: ffmpeg prints a lot of stuff to stderr - may have something to do with your problem liblq-dev: nope, I ignore that liblq-dev: aah not inputStream but errorStream go|dfish: yes but the data you're looking for could be going there liblq-dev: it *is* going there and I am able to read it liblq-dev: it's just that I'm unable to match that `frame= x` string liblq-dev: I even checked if the line I'm reading begins with "frame", and it does leorize: liblq-dev: I'm pretty sure that's not how you write an npeg pattern... leorize: though you should report that issue liblq-dev: leorize: how'd I do that then? I'm just trying to match the string "frame=" for now leorize: Zevv likes to have good error messages, and that wasn't one liblq-dev: not even any of the magic stuff leorize: liblq-dev: does strscans work? leorize: can you give me a line you received? liblq-dev: sure liblq-dev: leorize: liblq-dev: frame= 63 fps=2.1 q=0.0 size= 1kB time=00:00:01.51 bitrate= 4.4kbits/s speed=0.0505x liblq-dev: no '\n' at the end, I strip those off liblq-dev: likewise no '\r', because that's what ffmpeg actually uses. leorize: liblq-dev: try scanf again, it should work this time leorize: you don't have to specify the full pattern it seems liblq-dev: oh shit it worked this time liblq-dev: maybe it's because I put the relevant scanning code in a different block liblq-dev: this script I'm writing is so convoluted, man… axion: Well looks like I have to redesign a good chunk of this code, or wait until an issue I reported is resolved. It's causing issues all over the place liblq-dev: should've thought it through a little bit better shashlick: axion: which issue axion: #13828 shashlick: where's disbot, lazy bum rayman22201: Why not use varriounts work around? axion: That would be the huge redesign, because it won't work if you have quote do. axion: My macro is pretty complex (it's now a macro that generates templates instead of a template) rayman22201: You can add the dirty pragma to a generated template. rayman22201: Why won't it work with quote do? axion: The issue is the generated templates are inside a quote do axion: Try it. shrug moerm: Have a good time everyone - cu Araq: shashlick: ok, well? Araq: what's the question about incompleteStruct? shashlick: why does incompleteStruct work without header shashlick: but with header, it complains about storage size shashlick: missing inv2004: I have a question: I did addTimer(1000, false, sendingLoop) proc sendingLoop is closure, but nim raised error with something about GC until I set {.gcsafe.} on the closure which locks one external let inv2004: proc addTimer(timeout: int; oneshot: bool; cb: Callback) inv2004: ... first type mismatch at position: 3 inv2004: ... required type for cb: Callback inv2004: ... but expression 'sendingLoop' is of type: proc (fd: AsyncFD): bool{.closure, locks: .} inv2004: ... This expression is not GC-safe. Annotate the proc with {.gcsafe.} to get extended error information. inv2004: ups, sorry! shashlick: **`struct STRUCT0;`** => `STRUCT0* {.incompleteStruct, header: "header.h", importc: "struct STRUCT0".} = object` and `var **s0: STRUCT0**` shashlick: results in `error: storage size of 's0__X8vUbe3oSrwuT7g3oGFTjQ' isn't known`, `struct STRUCT0 s0__X8vUbe3oSrwuT7g3oGFTjQ;` inv2004: so, the question was: why the closure is not GC-safe and is it correct solution to mark it gcsafe ? Araq: shashlick: it only appears to work Araq: but in reality you can only have a pointer to this struct shashlick: ah, so my test case is bad then Araq: inv2004: .gcsafety inference doesn't work well for lambdas, iirc. shashlick: brilliant shashlick: so once I add bitfield support, ast2 passes ast1 test cases inv2004: @Araq, but how can I be sure that the .gcsafe. is ok here? Araq: write it down, the compiler checks it for you inv2004: ok, probably another question: can I create projection from function and parameter? and pass the projection to addTimer then inv2004: addTimer(..., sendingLoop(myLockedValue: ...)) rayman22201: @axion. Works for me: http://ix.io/2giI/nim and http://ix.io/2giJ/nim sorry took longer to test since I needed to use my local machine. Module imports require two files and I can't do that on the playground. :-( axion: It's ok. I'll inspect, thanks. To be honest right now I am thinking about taking a step back from Nim until it matures a bit more. The bugs I'm running into (there are many more than this one), coupled with the lack of good documentation and learning resources is a constant struggle. Araq: axion: please report the bugs axion: I have reported the ones I could create isolated tests for Araq: and you need no less than 3 `[]` accessors Araq: `[]`(x: Container; index): T Araq: `[]`(x: var Container; index): var T Araq: `[]=`(x: var Container; index; value: T) Araq: not sure why it matters though, it's not like Lisp has anything like that ;-) axion: setf operates on a place, so there is no need for it. Araq: and what about the learning resources? there is plenty of stuff directly linked from our website axion: I'm more concerned with the brief overview style of the manual axion: It's not anything like a language specification. Too many things are unspecified or don't have exhaustive examples. Rika: ive had no issues with writing nim code Rika: i dont seem to see why others are Rika: i need help realizing ;; Araq: we have tutorials too axion: I have read all of the learning resources, including NIA which I bought Araq: ok, so what's missing? axion: Where in the manual is it mentioned that type parameters on an object can be accessed in a proc body that doesn't have type parameters in its signature? Where is it specified that pairs is always chosen implicitly with for `i,x in object` even if object is a var type? Can I rely on that? Where in the manual does it say I can rely on that if I don't want to be explicit? axion: I believe these cases need to be documented so I can choose the right amount of concision without future breakage Araq: https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implict-itemsslashpairs-invocations Rika: i dont understand the former Araq: https://nim-lang.org/docs/manual.html#generics-implicit-generics Araq: and as others have noticed your bug has an easy workardound Araq: template genAccessor(t, a, i) {.dirty.} = Araq: template a*(q: t): float32 {.inject.} = q[i] Araq: template `a=`*(q: var t, value: float32) {.inject.} = q[i] = value Araq: though when I follow what the compiler does, I am not sure it's a bug, I debugged this template expansion mechanism to death axion: Yes I am experimenting with that now, but that's just 1 bug I found in my first trivial code rayman22201: Sure seems counter-intuitive. If I export something, I expect it to be exported... Araq: hygienic templates are simply not intuitive, .dirty templates are Araq: we added lots of rules to make them "intuitive", we failed Araq: instead we should have made them simple, then people can learn them leorize: Araq: I got a generic proc definition, how can I check if a type (an nkSym) can be matched with it in a macro? axion: I understand about hygeienic and unhygeinic macros. They're both pretty intuitive to me after using them for decades. dwdv: Is DrNim intended to be what spark is to ada, an external tool? Or is there a good chance, many moons down the road, that it will be an integral part of the compiler and thus language supporting good old design-by-contract programming? Araq: axion: well Nim's rules are not. rayman22201: question is, is this a doc bug? I.E. the current rules need be explained better somewhere? or is this a compiler bug? Araq: rayman22201: the rules are clear for anything but "templates inside templates" rayman22201: lol. So lets figure out the rules for "templates inside templates" then :-P Araq: dwdv: external tool and unlikely to become part of the compiler axion: There's also export issues elsewhere Araq: and it's not about "design-by-contract", it's about verification. Araq: axion: can't fix what is unreported axion: It was reported Araq: what's the issue number? axion: Well one of them would be #13673 axion: A module, or a whole library with a bunch of mathematical constants in it or something, issues compiler warnings because using just a constant from a module isn't seen as using the module. Harmless, but still a thing. rayman22201: I think part of axions issues are doc discoverability. The docs are there, but it's sometimes seems hard for people to find what they are looking for? Araq: well he did read them all axion: I read the entire manual 3 times linearly from start to finish and I still find a lot of questions that aren't answered there rayman22201: can you write those questions down and give them to us? axion: When the survey came a few months ago, I was quick to write down what I would like to see is more detailed and more example-filled documentation. rayman22201: Araq gave you links to the dos for the examples you posted, but idk if those are satisfactory. axion: Sure, I will do that as they come to me from now on clyybber: Holy shit Araq: axion: thanks clyybber: FWIW I found compiler refactorings/cleanups were pretty welcome clyybber: If they really improved stuff clyybber: And the compiler is not broken Rika: T_T arraymancer doc search doesnt work clyybber: Clearly you haven't looked at other compilers rayman22201: thanks axion. really. We want to improve, but we really need concrete issues. (I know that can be time consuming.) Araq: axion: and btw when people say "better docs" we now think they mean "cannot copy&paste API calls around" clyybber: dom96: So you want better parallellism/concurrency? But you don't want static analysis and gc:arc? Araq: clyybber: you're too late Araq: discussion moved on clyybber: krux02: You want to remove all features, even refs, because you don't understand why you would need them.. Araq: but thanks for supporting me clyybber: Araq: I see clyybber: I'm just gonna finish my rambling 😄 : rayman22201: lol clyybber: Its easy to not like features/improvements and wanting to remove all of them when you don't understand them in the first place rayman22201: araq, you are right about "copy and paste" syndrome lol. I see it my day job all the time. So many "why doesn't this work?". You look at what they send and it's a copy pasted example, with a comment right at the top that says: "THIS IS FOR EXAMPLE ONLY. DO NOT USE IN PRODUCTION" X.X axion: I support Sraq's decision to work on DrNIM ARC in an effort to replace some of the bad parts of the compiler, because what I would like to see is more stability. axion: Araq's* Araq: thanks. and yeah, Nim has stability problems, but let's take https://github.com/nim-lang/Nim/issues/13673 and analyse it a bit axion: err, DrNim and ARC. I do think though that we need to hire someone to start squashing some bugs, especially thoe tagged with "crash" Araq: 1.) the feature "unused import" is actually rather new and iirc I added it for v1 Araq: 2.) it's not as simple as it seems since your usage of the symbol is inside a generic Araq: which has a 2 phase lookup going on Araq: comparable to C++'s problems axion: That said, I have only wanted 1 feature request that I held back from requesting because I don't want to see new features being worked on over bugs squashed. Araq: there is an RFC improving the situation, "let's use concepts to typecheck generics properly" Araq: scheduled for 2021 Araq: and yet I get blamed for not working on concepts. axion: concepts are custom type classes, right? Araq: look, I don't want to fix concept bugs, I seek to redo them completely. Araq: and that can be seen as "bah, a new feature" Rika: do we really need to redo them? Rika: is it at a state of disrepair that it needs to be redone Araq: IMHO yeah clyybber: krux02_: While we are at it, why does it behave like this: https://github.com/nim-lang/Nim/issues/13724 ? clyybber: IMO typedesc should behave like a static type axion: I didn't mean to come as as so critical. I really do love Nim. But I keep asking myself if I will have as much bitrot and stability issues as say D, or (gasp) Rust clyybber: axion: Its FUD clyybber: FUD is maybe the wrong word rayman22201: I also basically agree with your current roadmap araq. for what it's worth. 🤷 Araq: and once again Araq: it's the *bugfixes* that cause regressions Araq: I know it's a terrible situation Araq: but this is the reality: imagine we only fix bugs for one year, and let's say we're good at it and get 200 fixed. Araq: the result isn't a "more stable" nim. Araq: the result is that your code stopped to compile. Araq: if you have a good solution to that problem I'm all ears Araq: so far I came up with an RFC process plus a --useVersion emulation clyybber: Its perfect this way IMO Araq: today's devel broke my Karax project. Araq: I fixed it, no big deal, one line change Araq: but in the larger picture it means Nim's ecosystem constantly breaks Knaque: Has anyone ever heard of the Nim VSCode extension's linting just outright not doing anything? I'm having this issue all of a sudden. Rika: same here, been like that for a while Rika: cant pinpoint the issue Knaque: Do you think it's a bug in the extension, or some weird incompatibility or something like that? Rika: prolly a bug Knaque: Hopefully it gets fixed soon, cause god forbid I ever have to learn Vim or something. Rika: you can just `nimpretty filename` you know Rika: ah linter or formatter? Rika: if the linter, its known Rika: i set my "nimsuggest timeout" to like 5 minutes Rika: then restart (reload window) vscode Knaque: I fixed a mistake (that I found while trying to compile) and all of a sudden everything's back in working order, so... I dunno. sealmove: I realized doing `object of somObj` is not inheritance in the "Java sense" sealmove: It's just a shorthand for not writing out the same fields again right? sealmove: I mean, is there an hierarchy of objects created? Rika: i think you want `ref object of` for the hierarchy dumjyl: Not entirely, generic match is just prefered to subtype match. So with your 'bug' the generic system `=destroy` was used instead of an upconversion. This happens with `$` too. This does make working with overly generic routines a PITA. I have to use a `{.inherit.}` macro pragma for my closed inheritance library to workaround this. sealmove: I see leorize: it's the same kind of inheritance leorize: @dymjyl: that sounds like a bug :P dumjyl: I'm not saying I like it but its in the spec https://nim-lang.org/docs/manual.html#overloading-resolution. sealmove: It's also annoying that you can't define a field with the same name as a supertype's field leorize: that one doesn't sound too bad tbh sealmove: or I am just too used to java... timotheecour: can anyone merge https://github.com/nim-lang/Nim/pull/13814 to unbreak nim CI? narimiran: merged Araq: toProve: (not (=> (and (= realExponent (- (* expSign exponent) fracExponent)) Araq: (= expNegative (< realExponent 0)) Araq: (= digits (+ kdigits fdigits)) Araq: (not (and (<= 16 (+ kdigits fdigits)) Araq: (not (and (<= (+ kdigits fdigits) 16) (<= firstDigit 8))))) Araq: (<= absExponent 22) Araq: (<= realExponent (- 1)) Araq: (<= (- 9223372036854775808) realExponent) Araq: (<= realExponent 9223372036854775807) Araq: (<= (- 9223372036854775808) expSign) Araq: (<= expSign 9223372036854775807) Araq: (<= (- 9223372036854775808) exponent) Araq: (<= exponent 9223372036854775807) Araq: (<= (- 9223372036854775808) fracExponent) Araq: (<= fracExponent 9223372036854775807) Araq: (<= (- 9223372036854775808) absExponent) Araq: (<= absExponent 9223372036854775807) Araq: (<= (- 9223372036854775808) digits) Araq: (<= digits 9223372036854775807) Araq: (<= (- 9223372036854775808) kdigits) Araq: (<= kdigits 9223372036854775807) Araq: (<= (- 9223372036854775808) fdigits) Araq: (<= fdigits 9223372036854775807) Araq: (<= (- 9223372036854775808) firstDigit) Araq: (<= firstDigit 9223372036854775807)) Araq: (<= 0 absExponent))) Araq: --> Z3 takes a loooooong time :-) narimiran: can someone please ban this Araq quy for posting multiline messages? Araq: yeah, so annoying Recruit_main707: smh, disruptek is freaking out rn Recruit_main707: :p Araq: interestingly enough, eventually it did prove it :O Zevv: Araq: you're not pasting long snippets in irc, are you? Zevv: oh wait that was frowned upon my narimiran already :) Araq: my threshold is different Araq: I don't consider this "too long" :P Zevv: Hmm, can Z3 prove it's own implementation to be correct? Araq: there is some joke about that Zevv: I bet :) Recruit_main707: new maximum lines of code before needing to use playground: 27 :0 Zevv: I guess in the end Z3 just takes sooo long that no one can ever tell if it will one day finish Zevv: or "halt", as it is called in some jokes narimiran: @Recruit_main707: quod licet Iovi, non licet bovi ;) alehander92: come on man just talk in german dom96: what is Z3 proving about the Nim compiler? Araq: it goes something like "Milner gave ML a formal semantics. When asked to give the formal semantics a formal semantics his head exploded" dom96: just some predicates you've added or is there more to it? :) Araq: it proves there are no "index out of bounds" errors Recruit_main707: narimiran: Im 'non bovi >:( alehander92: is this like bon jovie alehander92: dom96 btw offtopic: cancellation to async alehander92: do you think it's a good idea to add a simple version of that Araq: or maybe it was Robert Harper, hmm alehander92: dom96: one thing i imagine is one can just use something like token(i called it lifetime before) and have 1) manual checks (if token.stuff => ) or automatically inserted with `{.asyncCancellable.}` alehander92: but maybe there is a better way clyybber: I always wondered if there is a way to get a time estimate out of Z3 clyybber: At least a very pessimistic one Araq: we figured out this morning it doesn't like 'x * x >= 0' ;-) Araq: it can handle it but it tries to find a counter example Araq: and it does it pretty much by brute force apparently so int64*int64 iterations Araq: once you restrict the x to 1..500 it's fast Araq: :D dom96: alehander92: we already have a simple version of that: close the socket and your futures will get cancelled Araq: so it's stuck in nimParseBiggestFloat alehander92: dom96 hmm, but i want alehander92: only some futures to be cancelled alehander92: like, its not a super big deal, just wondered if people had concrete proposals on how would it work PMunch: I've seen CancellationToken in C# which seems to work fairly well PMunch: It's manual checks, so all your procs need to implement it, but it's better than nothing alehander92: yeah but its very manual prone and still you need to return valid stuff from each one alehander92: manual=>error prone alehander92: i wondered if one can preempt somehow :D alehander92: but from what i've read one has to deal with all that cleanup PMunch: Yeah this is used more like this: `while (!cancellationToken.IsCancellationRequested) {
}` alehander92: yes, but sometimes you just have a list of awaits and you'd want to if is cancelled: do this etc before each PMunch: I mean I guess await could auto-check the cancellation token once it got back. And null out the result because it's probably not valid.. alehander92: yeah thats what i imagine optionally PMunch: I'm not quite sure I get how you want this to work.. dadada: PMunch: hey, how are you? PMunch: dadada, I'm godo PMunch: good* dadada: good to hear, any progress on the macroutils front? PMunch: Thinking about streaming after work, hopefully fixing it alehander92: well, asyncCancellable just inserts the `if cancelled: return default` after awaits inside PMunch: Haven't done anything on it since the last stream dadada: what was the result thereof? alehander92: but i wondered if one can just e.g. stop a parent function and async can just wake it up next time, return its default and ignore all the children calls of it PMunch: I think I figured out where the issue was, and how to fix it, but I was unable to do it properly PMunch: alehander92, stop a parent function? alehander92: e.g. it gets to poll, it finds the parent function from the callbacks and it just calls a cancel callback for it alehander92: and then removes it and all of its child futures from the list PMunch: Are async procedures stored hierarchically though? alehander92: well no PMunch: Like can you see these processes were started by this one PMunch: Ah alehander92: but in this case it would be useful to me alehander92: that's another idea i had: PMunch: Yeah the way you'd do it in C# would be to pass along the same cancellation token alehander92: async processing is a bit like cooperative multitasking PMunch: So whichever task starts execution will see that the token is requesting a cancellation, and then they will all shake out of the queue eventually alehander92: and multitasking in os-es has task managers: it would be cool to be able to see PMunch: It is co-operative multitasking PMunch: Just not on multiple threads alehander92: thank you! PMunch: Huh? alehander92: well, for the affirmation, i sometimes confuse all those PMunch: Ah :P alehander92: so in this case you can see alehander92: e.g. a tui similar to task manager Araq: async processing IS cooperative multitasking alehander92: with the currently running/pending async functions alehander92: /futures alehander92: and debug metadata about hthem alehander92: the same way you see process tasks in task manager :D PMunch: Ooh, that would actually be pretty cool alehander92: probably doesnt make a lot of sense PMunch: I mean the async scheduler does have all that information available to it alehander92: but its still like a task tree(even if we dont record which async functions call "await"/start which ones) alehander92: so a similar ui should be still useful PMunch: It wouldn't be a tree though if you don't have information about who is who alehander92: PMunch well one can probably add a bit of info like that in debug mode , like a simple list of child refs alehander92: only on start of an await alehander92: it wouldnt be such a big overhead PMunch: Yeah it wouldn't be horrible alehander92: and if one updates the tree visualization from time to time only this wouldn't also be too fatal at least for some programs alehander92: its not a new idea, i remember chronos are doing many visualizations but i think they are doing statistics like counts of futures of each type/timestamps, this kind of stuff alehander92: (and the dom96 logging leaking thing iirc) but this one looks different to me alehander92: basically something like async-htop PMunch: I mean, if you just allow async to take a Channel argument and then send over the channel some debug information every time you do things to it you can spin up a thread and do whatever you want with that information (log it to a file, aggregate it, visualise it, expose it over HTTP) alehander92: yeah i think they kinda somehow wanted to do something like that in chronos using https://github.com/status-im/nim-metrics alehander92: but i am not sure about the channel argument, that would change the api too much imo alehander92: i can imagine just a global `registerDebugChannel` though kayabaNerve: I have the Nim compiler failing on an assertion check (```Error: unhandled exception: closureiters.nim(397, 9) `n.kind == nkStmtListExpr` [AssertionError]```). How can I debug this? koch debug? I tried `-- verbosity:3` but it seems to happens a few seconds after it finishes processing the last lines of Nim code. PMunch: alehander92, yeah you could have `registerDebugChannel` that just registers the channel globally. alehander92: PMunch but what would we pass PMunch: What do you mean? alehander92: as accessing a data structure full of refs from another thread is not trivial without some annotations right alehander92: ah, you mean one can just send simple "events" PMunch: Yeah alehander92: and to construct data structures/other stats in the thread PMunch: Switched to this thing, fulfilled this future, etc. alehander92: yeah this is possible, i wonder if its a lot of overhead tho with all the strings PMunch: Essentially logging things, but with enough information to see everything that's going on alehander92: one can use enum/future id-s and mapping of course PMunch: Doesn't have to be strings PMunch: Yeah alehander92: yeah, its doable alehander92: and one can indeed configure alehander92: the "sender" to e.g. send each event or just some types of events, or just a % of some events alehander92: which i guess is what chronos does to monitor some metrics statistically alehander92: but that's just on theory not too important PMunch: Well if it's only for debugging then it shouldn't be too bad PMunch: But yeah, if you have events as an enum you can provide a set to filter by kayabaNerve: PMunch: Do you have a second? Sorry for solo'ing you out, I just trust you and this bug is weird as hell. PMunch: Haha, sure kayabaNerve: https://github.com/nim-lang/Nim/issues/8243 kayabaNerve: This bug from 2017 was a regression and is closed. I have the exact same error. kayabaNerve: I have no idea why and no chance of a MRE. kayabaNerve: I do have a traceback from a debug Nim compiler. My question for you becomes is it worth it to file an issue? kayabaNerve: Generally if I can't prove an issue without linking a large codebase, I don't bother. kayabaNerve: https://pastebin.com/d4jjbLbQ kayabaNerve: ^ Traceback for reference. It seems to solo out the location despite not specifying the cause. kayabaNerve: (and yes, I tried 1.0.6 and devel) kayabaNerve: Oh. I also did test that sample code. It's not that regression; just the same error and both dealing with async. PMunch: Hmm, I'd be curious to see what node it actually did get passed PMunch: I mean a minimal example is always the best when you're creating an issue kayabaNerve: Yeah, I may write some debug statements myself. kayabaNerve: Yeah. I've unfortunately not been able to make them lately. I also found a bug in the stdlib where sockets aren't always usable when Nim says they are. It happens when Nim wins a race against the OS. That said, I also couldn't replicate it with a MRE. My guess is I have a balance of sync and async load which causes it to trigger on random chance? But honestly no idea. kayabaNerve: I just ported my entire app from asyncdispatch/asyncnet to chronos. PMunch: Triggering async and/or threaded errors in a MRE is indeed hard.. kayabaNerve: exprToStmtList expects a Statement List Expr. It is not being handed one by lowerStmtListExprs. lowerStmtListExprs is calling itself on the children of `nkCallKinds, nkChckRange, nkChckRangeF, nkChckRange64` where it finds a `nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv, nkObjDownConv,`. kayabaNerve: So it does seem to be related? That one bug had a cast in it. kayabaNerve: So I just need to find every single cast in my branch. Great. kayabaNerve: Eh. Better then being stuck with no idea. kayabaNerve: If I do find the problem, I'll attempt a MRE. PMunch: Hmm, strange that a cast should trip something like that, no? kayabaNerve: I don't have much experience with the internals :P That's why I sought your advice. kayabaNerve: I have written some macros, so I recognize the kinds well enough, but that's about it. alehander92: @kayabaNerve btw alehander92: if you use linux, you can record some runs with `rr` so alehander92: once your record a run with the error in it alehander92: you can reproduce it then many times kayabaNerve: `rr nim c -r main` or...? alehander92: yes `rr ` alehander92: then one you manage to reproduce it once under it alehander92: then you can run `rr replay` and you get a gdb for it (which can be ran in the same way many times) PMunch: Wait what? PMunch: What does rr do? alehander92: it records program runs so they can be replayed in the same way alehander92: wrapping sources of nondeterminism like syscalls etc kayabaNerve: Interesting. If only I knew how to use GDB that well :P alehander92: well its just a normal debugger :P you can even target your visual editor debugger to it alehander92: with some tweaks in the settings alehander92: as i think many of them can call `gdb` internally PMunch: Holy shit, how have I never known about this until now?! alehander92: dude i spam about it often :D alehander92: https://rr-project.org/ kayabaNerve: If only I had a visual editor debugger alehander92: well, gdb itself is simple really dom96: kayabaNerve: why ported to chronos? alehander92: and the good thing about `rr` is that this gives you fast reverse debugging kayabaNerve: Yeah, and `echo n` is even more simple :P alehander92: like reverse-continue etc kayabaNerve: dom96: Because I have an unfixable bug in asyncnet which is consistent yet I can't create a MRE out of it. kayabaNerve: So my only options are to fix it myself in asyncnet, which I can't do it, or fix it by leaving asyncnet. dom96: interesting, and chronos doesn't have it? alehander92: PMunch btw if you're interested we can try to do a simple version of that async debuginfo thing dom96: what does the bug look like? kayabaNerve: dom96: I have no idea if chronos has it. A bug in the Nim compiler won't let me compile my chronos code. dom96: nice kayabaNerve: A socket being accepted crashes the entire async runtime when the standard library can't call fcntl on the file descriptor kayabaNerve: I brought it up a few days ago and I was told its a TOCTOU kayabaNerve: It'd be fine if it was catchable, but it's only catchable @ runForever, which loses all async ops kayabaNerve: PMunch: I may have recreated the worst debugging output to ever exist. kayabaNerve: Apparently, you can't dump the tree of PNode (I assumed they were the internal cousin of NimNodes). That said, they do have a $ defined. alehander92: you can do that kayabaNerve: https://pastebin.com/6w0Eq2s5 alehander92: i think you need to write `debug n` alehander92: if `n` is the node kayabaNerve: I tried dumpTree(n) and import macros; dumpTree(n) alehander92: no no, this is only for macros kayabaNerve: I'm referring to dumping the PNode in a decent format kayabaNerve: Not the above pastebin text PMunch: Haha, so those are the lines of code or something? PMunch: I'm guessing line 38 is your issue though kayabaNerve: They're a printed PNode. kayabaNerve: What does `$`(n: PNode) return? PMunch: Hopefully a string.. kayabaNerve: Anyways. It does inform me of the area. This is post transformation. alehander92: no no @kayabaNerve thats what `debug n` does kayabaNerve: syncAwait is just a custom function to handle time outs/multiple possible futures where only one matters. alehander92: it prints it in a goof romat kayabaNerve: Thanks alehander92: i think* kayabaNerve: `Error: undeclared identifier: 'debug'` alehander92: sorry! clyybber: kayabaNerve: import astalgo alehander92: let me try alehander92: ah ok clyybber: kayabaNerve: Can you post the stacktrace? kayabaNerve: It sounds like converting a value, named chronos internal future, to the type of Future[T], is the problem. kayabaNerve: Seems to be compiling. Will have the astalgo output in a minute or two kayabaNerve: https://pastebin.com/d4jjbLbQ alehander92: ahh kayabaNerve: I posted it a bit ago :P kayabaNerve: Recompiled nim clyybber: oh, missed it kayabaNerve: All good alehander92: i had something like that problem while trying to translate some code of chronos to asyncdispatch PMunch: Hmm, it would be cool if assert could print out the result of the non-constant parts of your expression.. clyybber: kayabaNerve: Can you try devel too? kayabaNerve: clybber: I tried 1.0.6. devel doesn't work as chronicles doesn't work under devel. clyybber: I see PMunch: Like assert(n.kind == nkStmtListExpr) would print something like "Assertion failed: n.kind = nkNilLit != nkStmtListExpr" kayabaNerve: Since 1.0.6 didn't work, I reverted to 1.0.4 which is what my entire ecosystem uses. alehander92: kayabaNerve can you linked the internal future conversion error kayabaNerve: Got the output clyybber: kayabaNerve: I'd try pinging yglukhov Clyybber: PMunch: You can do assert n.kind == nkStmtListExpr, $n.kind kayabaNerve: I didn't know what cut off to use, so I grabbed 83 kB https://pastebin.com/tWJifJNz kayabaNerve: The tail is probably the part to look at kayabaNerve: Here's the last node it handled: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e832869b72a4b77021e57b0] PMunch: Clyybber, yeah I know Clyybber: its a nkSym, this isn't the issue Clyybber: I think.. PMunch: But that's more typing Clyybber: yeah :P kayabaNerve: To clarify placement: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e8328842556e77c713e4cd8] PMunch: And sometimes it's a call PMunch: So e.g. assert(someCheckProc()) Clyybber: @kayabaNerve I think you should try expanding all the macros kayabaNerve: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e8328bff7cff9290c8451c1] kayabaNerve: Is this it? kayabaNerve: I think it is the sym PMunch: I would want that to be rewritten as `let r = someCheckProc(); assert(r, "someCheckProc() = " & $r & " != true")` Clyybber: @kayabaNerve It doesn't have to be kayabaNerve: @Clyybber That's the exprToStmtList call Clyybber: It could be that its not transformed elsewhere so it reaches that code Clyybber: I think that was the cause of the original issue Clyybber: @yglukhov Hey, I think you know the most about this stuff :) kayabaNerve: Wait, my bad, it could be this one: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e832906bd09254f83eadbb2] kayabaNerve: Honestly, I have no idea. I have snippets that look like it and am trying here. kayabaNerve: PMunch: I'll check the exact type now Clyybber: @kayabaNerve Can you try expanding the macros and minifying it? Clyybber: Or is it not possible? kayabaNerve: @Clyybber I could fork chronos and add dumpTree statements? kayabaNerve: I know the general area this is occurring? clyybber: You could also add expandMacros in your code kayabaNerve: TIL that's a thing kayabaNerve: PMunch: Wasted a few minutes on a compilation run where I forgot to recompile Nim in between. Just finished recompiling Nim. PMunch: Any process with more than two steps should be a script! kayabaNerve: PMunch: `debug n; echo n.kind; echo "\r\n"` kayabaNerve: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e832adc5e0bd65308da83fd] Clyybber: @kayabaNerve Not sure if you are already using that, but ./koch temp builds the compiler Clyybber: And puts it in bin/nim_temp Clyybber: Which is handy and faster than doing ./koch boot kayabaNerve: @Clyybber I'm using koch boot. koch temp doesn't support threads. Clyybber: Eh what? kayabaNerve: Yeah, my code has channels. It doesn't always spawn a thread but always declares channels. Clyybber: But ./koch temp builds the compiler kayabaNerve: I'm sure there's a flag for it. I just don't know it. Clyybber: You do ./koch temp kayabaNerve: Without spawn support if you just use `./koch temp` Clyybber: and then you invoke nim normally kayabaNerve: I tried that originally Clyybber: And just replace nim with nim_temp kayabaNerve: It didn't build with support for spawn kayabaNerve: I tried that. It didn't work. Clyybber: Huh Clyybber: Araq: Is that supposed to happen? Araq: yeah, 'koch temp' leaves out a bunch of modules Araq: so that we get faster compiles kayabaNerve: https://pastebin.com/5DjKjfKx kayabaNerve: It looks like this is the failing PNode kayabaNerve: This cast statement tries to call a StmtListExpr only function on a symbol kayabaNerve: So I assume I should create an issue with this and the stack trace? Anyone else have any advice before I do? kayabaNerve: Because to be honest, I believe this hits the peak of my debugging skills. I could try to get the expanded macro data, yet I'm not sure what that would say that the stack trace and PNode wouldn't. Clyybber: @kayabaNerve It would allow you to create a minimal example possibly Clyybber: @kayabaNerve Because this PNode may or may not be the cause. kayabaNerve: ... I mean, it's the one that's failing the assert, and then I grabbed the parent one or two levels up. Clyybber: It may be the symptom, but it could be that it ends up here because its not getting transformed somewhere else kayabaNerve: Right Clyybber: And we have no way to investigate that Clyybber: Without some code alehander92: i think i had an error like that Clyybber: https://github.com/nim-lang/Nim/issues/8243 is actually a good example for that Clyybber: If you look at the fix alehander92: cant find it hm ldlework: .bef kayabaNerve: What's a nnkCommand node? alehander92: `a b, c` kayabaNerve: Just to be clear here. I understand the basic idea. alehander92: command syntax is like calls without parens iirc kayabaNerve: Got it, thanks. alehander92: (offtopic Araq, so what do you need for sourcemaps? just to fix the code and try to merge it) kayabaNerve: MRE'D! clyybber: nice! kayabaNerve: It's a complex as hell MRE alehander92: give it dom96: is this an MRE for the async bug? kayabaNerve: dom96: For the TOCTOU? kayabaNerve: The one that crashes the entire async runtime when accepting a socket? kayabaNerve: I wish. dom96: yeah kayabaNerve: It's one for a failure in Nim's ability to handle chronos generated code. dom96: pity kayabaNerve: Don't get me wrong, chronos could also be at fault, but Nim is asserting instead of erroring. kayabaNerve: dom96: I have a reproducible thing. kayabaNerve: It's just not a MRE. dom96: huh, that's fine kayabaNerve: It's a 12k line Nim project with a Nimble build script and Python script to trigger it. kayabaNerve: https://github.com/MerosCrypto/Meros ⏎ https://github.com/MerosCrypto/Meros/issues/141 alehander92: dom96 we have like two feature requests for asyncdispatch, where should i write them down dom96: the issue tracker kayabaNerve: That issue documents how to trigger it reproducibly. You need to compile with release on, and it should be noted the current Nimble script uses debug. It's easier to trigger with clang than gcc. alehander92: but the nim one or the rfc one kayabaNerve: Nim setup is `nimble build`. Python setup is in the README under PythonTests/. I don't think you'll be invested enough, but I'd appreciate if you looked it over. alehander92: @kayabaNerve oh man kayabaNerve: I did warn him kayabaNerve: It's not a MRE kayabaNerve: I'm minimizing my chronos MRE even further right now Clyybber: do you need python? Clyybber: ok kayabaNerve: I wrote a Python3 script to trigger it. You don't need Python though. kayabaNerve: It's a decentralized application. A network of 5 nodes will cause a crash over a few days. Clyybber: ah Clyybber: I thought you were talking about the chronos MRE Clyybber: now it sounds like chronos is a military kayabaNerve: The Python script, with release and clang, will trigger after 20k sockets. ~30 seconds. kayabaNerve: The chronos MRE is 32 lines. kayabaNerve: Lines of self contained Nim. Just requires chronos. Clyybber: nice Clyybber: ready for an issue then dom96: kayabaNerve: does it take 5 days to trigger? :) dom96: oh, sorry, just read the rest of the messages dom96: Can someone else try to reproduce until I get time tonight to have a look? Would be nice to know that it's reproducible by other people kayabaNerve: dom96: 30 seconds with the script. Multiple VPSs of mine crashed thanks to (18.04), along with my Arch home desktop and some other people's VPSs. kayabaNerve: No idea about Windows. dom96: okay, I wonder if it'll repro on macOS dom96: I'll write a sticky to give it a try tonight kayabaNerve: Thanks kayabaNerve: And then here's the Chronos/Nim MRE https://github.com/nim-lang/Nim/issues/13815 Clyybber: Might wonna tag yglukhov there kayabaNerve: (saying that for PMunch/Clybber/alehander92 and co, not asking you (dom96) to look it over) kayabaNerve: On Gitter or GitHub? Clyybber: github Clyybber: already pinged him here kayabaNerve: Fair enough PMunch: Hmm, a lot going on in that MRE PMunch: Need to dig through it a bit to figure out what's wrong Clyybber: You might be able to get rid of the chronos dependency with a few expandMacro calls Clyybber: Not sure tho alehander92: sorry i thought i will try to repro alehander92: but i got an error alehander92: probably older nim/or newer version for me kayabaNerve: PMunch: It's combining commands, calls, symbols, dot expressions, function pointers, and what Nim calls GC unsafety alehander92: i'll take a look at the compiler thing kayabaNerve: It probably can be minimized even further/chronos can be removed with expandMacro. I just have to go to sleep. Clyybber: ok gn8 PMunch: Did you try to simply remove the assert? PMunch: Just to see what would happen :P PMunch: Ah, night kayabaNerve: PMunch: No because my final solution can't modify the standard library and I'm not going to be the guy who submits a PR to remove a check to fix his own bug when he has very little experience with the Nim compiler internals :p kayabaNerve: (I have no idea how to properly test it; even fully testing it in my codebase would take a few days) PMunch: I would just be curious if it would just immediately fail on something else, or if that check is there to guard your from some future issue PMunch: Oh fun, now we're entering the period where the country-wide stores start pushing spring-time products while we still have over a meter and a half of snow :P kayabaNerve: My guess is the assertion is so when a Nim compiler developer messes up, the assertion points it out. This isn't supposed to be user facing afaict. PMunch: Sure, but the question is if it is actually an error, or someone just being overly cautious alehander92: poor north norwaygians PMunch: I think I might seriously be snowed in at the moment, I've heard snow falling from the roof all day, but I'm too scared to look outside.. PMunch: I just finished shoveling the last of it on Sunday :( alehander92: people in sofia did have snow this month actually alehander92: it was very unexpected alehander92: but not this kind of .. snowfall near 31 march alehander92: :D alehander92: probably PMunch: Our record amount was on April 29th.. PMunch: 1997 alehander92: how much PMunch: 240cm alehander92: why do you even not use ski for shopping PMunch: That's on flat undisturbed ground PMunch: Because taking the car is easier? PMunch: Some people do ski to the store though alehander92: but funnn and gigles PMunch: Or take a "spark" alehander92: yeah i imagine its like biking in southern countries Recruit_main707: if you at least drifted all your way to the mall... alehander92: what is spark PMunch: https://scontent-lga3-1.cdninstagram.com/v/t51.2885-15/e15/914562_693563127342889_164240081_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com&_nc_cat=101&_nc_ohc=YN4lNLM3XiMAX-KLuX8&oh=f3fba8eebb9ab383098af6558a1767a5&oe=5E866E3A PMunch: One of those alehander92: thats a "шейна" :D alehander92: ahhh not really PMunch: When I google that I just get sleds.. Recruit_main707: light trineo alehander92: yeah in this one you're actually behind alehander92: and standing up alehander92: not like in sleds PMunch: Yeah PMunch: "Spark" literally means "kick" alehander92: but whats the point , to just carry baggage in the thing in front PMunch: The full name is "sparkstøtte" which translates to "kick support" PMunch: Well, you stand on the skates in the back, then you kick to create movement PMunch: It's like a scooter, but for the winter PMunch: And you can put a kid or a bag in front alehander92: but isnt the movement similar to what you do when ski on ground alehander92: like ski pushing chair PMunch: Well, not quite PMunch: And this can be used with any kind of shoe, just go outside grab it and go alehander92: ahh, ok i have to see it alehander92: sounds useful alehander92: i am a big fan of this kind of alternative movement, dreaming of channels and boats trhough sofia alehander92: but i'd imagine more like a ski highway from tromso to oslo alehander92: https://www.visitnorway.com/places-to-go/northern-norway/tromso/things-to-do/ wait alehander92: do you have the dogs thing PMunch: Sure PMunch: But no-one uses it for transport around town :P alehander92: пп alehander92: mm* ok Clyybber: Quick question: Do we use ``someVariable`` in doc comments or `someVariable` ? Clyybber: "``someVariable``" vs "`someVariable`" Clyybber: Double \` or single \` Clyybber: ? Araq: Single if it refers to a parameter Araq: single or double otherwise ;-) Clyybber: Ok :) alehander92: i am debugging https://github.com/nim-lang/Nim/issues/13815 and i think i can alehander92: try to generate a simpler rep alehander92: basically one can go backwards from the assertion alehander92: and try to construct a breaking case alehander92: of course i use the existing example node here as a start. Araq: ty alehander92: awesome i got a small repro alehander92: https://github.com/nim-lang/Nim/issues/13815#issuecomment-606691497 lbart: the build.sh file included in the github release is created with niminst right? If I want to add arm64 for FreeBSD, I just have to add in https://github.com/nim-lang/Nim/blob/devel/compiler/installer.ini#L12 Araq: correct lbart: thanks. So I'll open a PR soon. alehander92: so basically the bug is that some `exprToStmtList` are not guarded by `if node with right kind` alehander92: i think this can be solved with z3 eventually :D alehander92: we can add such `{.require` to many procs with similar asserts alehander92: and catch many similar problems statically (except for cases where such a case should've been resolved far away) Araq: only with 'drnim --assumeUniqueness' Araq: which isn't a thing yet but I figured out that 'n: PNode' destroys everything otherwise Araq: there is always some potential alias to the node and there is always some unknown function that can mutate 'n' secretly Araq: ofc 'owned' would also help alehander92: Araq hmmm yeah alehander92: but this mode sounds useful alehander92: and overally many case objects use similar asserts just because there wasnt a better way to actually write that down Araq: the code base suffers greatly from the lack of linear types :-) alehander92: all those assert kind is something are actually a `requires` candidate, as its usually better to just prove you call such functions only in the correct branches Araq: yup alehander92: ok, exciting Araq: I'm still torn between AST vs CFG :-( alehander92: for which case? Araq: drnim alehander92: it works with ast-s right now? which usecases need cfg Araq: 'return' and 'break', as usual Araq: i < a.len and use(a[i]) also seems easier with a proper CFG Araq: who knows if we model the shortcut evaluation of 'and' properly otherwise Araq: 'and' is control flow that looks like an operator alehander92: hm, can `use(a[i])` be a part of a require alehander92: that's actually `relevant typing`, isnt it Araq: I don't know the term 'relevant typing' alehander92: forgive me alehander92: when `var` is used at least once alehander92: afaik Araq: possible, so similar to affine typing alehander92: (once: linear, <= once: affine, >= once: relevant, once in order(stack like): ordered): but thats just my wikipedia :D alehander92: yeah, they are all cases of substructural typing alehander92: ok Araq alehander92: how can i solve the problem that i cant return in async function from a macro alehander92: (it's not fixed by async macro so it leads to yielding nil error) alehander92: i cant think of any workaround alehander92: as macros are expanded lately? alehander92: maybe return result leorize: alehander92: can't return in function from a macro? Recruit_main707: what are the plans for wasm? leorize: none atm Recruit_main707: like, not even fan made? Yardanico: nlvm exists Yardanico: and there's Emscripten for C->Wasm Nickiel12: I am trying to install nim on a raspberry pi, but the apt-get only installs 0.16, and jester requires V>=1.0.0. I tried using a nightly build, but now there isn't a nimble command available Yardanico: @Nickiel12 you should add it to your $PATH Nickiel12: but where is it? blackbeard420: when using asynchttpserver is the best way to access a global variable from within the callback a ptr? otherwise you get the `Not GC-Safe` error Nickiel12: I can't find a folder it might be in Yardanico: Have you considered using choosenim? Nickiel12: I don't think it works for raspberry pi 3b+ Araq: Nickiel12: run 'koch tools' Nickiel12: "command not found" Yardanico: @Nickiel12 you should run ./koch tools in the same folder where you downloaded and unarchived nim leorize: why does asynchttpserver even cares about gcsafe? Nickiel12: ok Yardanico: what did you download exactly? Nickiel12: https://github.com/nim-lang/nightlies/releases/tag/2020-03-31-devel-119b0ce arm6 Nickiel12: there it goes Yardanico: well there's koch in that directory Yardanico: and actually Yardanico: nimble is there too Nickiel12: there is, I don't know why I didn't look there alehander92: leorize if you write if stuff: return as a result in a macro called in async Yardanico: there's both nim and nimble in bin directory Nickiel12: so do I add that folder to the path? alehander92: it would just result in `return` which seems to mean that the async function would yield nil Yardanico: yeah, add that bin folder to $PATH Nickiel12: ok alehander92: which nim shows as an error Nickiel12: do i delete the nim that was created by running install? alehander92: i guess async handles direct non-macro returns leorize: I guess async transformation happened before other macros :/ alehander92: yes Yardanico: @Nickiel12 if you mean nim installed by apt - yes alehander92: but return result seems to work for now leorize: well you can use `yield` Nickiel12: no, I ran ./install.sh and it put a "nim" file into "/usr/local/bin" alehander92: but i want to do an early return alehander92: not sure if yield wouldnt lead to it being continued alehander92: and its the same basically: i just want to return the void result future which should be completed alehander92: but return result seems to work maybe yeah Yardanico: @Nickiel12 seems like ./install.sh only installs nim without nimble and stuff Yardanico: btw is this even correct behaviour? Nickiel12: hmm leorize: Yardanico: yes, because no one uses it :) Yardanico: xd Nickiel12: ... leorize: beside from a few packagers :P leorize: Nickiel12: are you on debian? Nickiel12: rasbian Nickiel12: i think leorize: federico3 should have the latest Nim in backports, can you check that? Nickiel12: no federico3: 1.0.4-1~bpo10+1 to be precise Nickiel12: when I ran sudo apt-get install nim, I got nim -v == 0.16.0 Nickiel12: and ./koch tools is still running blackbeard420: not sure leorize, but asynchttpserver requires the callback to be gcsafe :( Yardanico: blackbeard420: do you use threads? Yardanico: if not, the gcsafe will be a warning blackbeard420: in this particular case yes im using spawn with asyncevent to be able to await long running tasks flowvars Yardanico: well, that's the problem Yardanico: default nim GC is thread-local blackbeard420: well it works as long as i access it via a ptr in the callback blackbeard420: i was just wondering if there was a cleaner way leorize: spawn and async don't really go together iirc leorize: or is async thread safe? Recruit_main707: arent threads async already? Yardanico: no? blackbeard420: no there was work on awaitable flowvars by rayman22201 iirc blackbeard420: but not sure where it stands blackbeard420: i used his idea to work around it alehander92: blackbeard420 oh yeah alehander92: you can kinda do that alehander92: but is your thread long running blackbeard420: just feels sloppy alehander92: or do you spawn a new thread each time blackbeard420: i only need to spawn off certain long running taskes to not stop the async loop for the rest of the request alehander92: so whats the problem blackbeard420: accessing the globals via ptr's... not really a problem. but just feels sloppy alehander92: ah, but why do you need to access globals alehander92: probably hard to change i guess blackbeard420: well the one 'global' is a postgres dbconn. and i cant access that in the asynchttpserver callback unless i do as a ptr. because itll throw the Not GC-safe error rayman22201: Gc:arc is the fix for this rayman22201: Arc let's the threads have a shared heap leorize: blackbeard420: well you can use this little hack Yardanico: but it doesn't really work for async still :P rayman22201: But async has memory leaks with arc. It's a whole can of worms... Unfortunately my day job has not given me much time to work on fixes in a while. blackbeard420: i was using something along the lines of https://github.com/nim-lang/Nim/issues/11564#issuecomment-539317277 to create an awaitable flowvar, but that seems to fail to compile with gc:arc leorize: {.gcsafe.}: <- everything in this block is considered to be gcsafe rayman22201: That makes the compiler not complain, but then you have to make sure it's actually safe on your own. I.e. by using locks etc... livcd: there's still a few pkgs that are not happy with gc:arc leorize: to be fair we can't be sure leorize: gc:arc can only work well if there aren't any cycles leorize: and I don't think the compiler can detect these at compile time yet leorize: I don't think that it can actually :P rayman22201: there is a mode that can detect them, but it can't break them. rayman22201: it's runtime though leorize: until we got a good way to operate on cycles I don't think arc can replace refc :/ Araq: it depends. the Nim compiler disabled cycle collection for --gc:refc Araq: so it can happily use --gc:arc instead, the cycles don't matter :P leorize: I guess now we know where the leaks in nimsuggest are from :P Araq: nimsuggest uses --gc:markAndSweep not --gc:refc but nice try :P axion: Hmm, I noticed a lot of cases when the compiler is unable to infer that a var return type is initialized with result = foo as the last line of the proc. It's always fixable by moving that nearer to the top though. Strange leorize: since DateTime is invalid if uninitialized, should we add `{.requiresInit.}` to it? leorize: axion: sounds like a good test case for the CFG Araq: it's implicitly .requiresInit iirc leorize: maybe you can file an issue? leorize: Araq: there are still people complaining about errornously using it uninitialized :/ axion: Yeah I'll try to come up with a repro, if not link to persistent line of a commit Araq: leorize, btw we don't yet use the CFG for init checking (sad, I know) Varriount: rayman22201: Someone suggested redoing the way async transforms procs Varriount: Turn them into a state machine, rather than a procedure that returns closures (that return other closures, etc). rayman22201: lol. Me. Also read my comment about my day job. :-P Varriount: Oh, woops rayman22201: I haz to make the moneys leorize: Araq: is #13808 aiming to change that? leorize: if it tighten up requiresInit, it should make use of the better analyzer for the job :P axion: I have a question stemming from my ignorance with C: If I care about performance when working multiple array types (just aliases to an array, not objects), would moving to object types hurt much? I kind of want to be able to distinguish between diferent array types of the same length better, so it makes sense, just unsure from a performance standpoint. axion: I value type safety more, so will probably move thee anyway, but nice to know in any case Varriount: axion: Not sure what you mean. Varriount: Also, I'm on Mumble axion: Ok I'll hop on there leorize: axion: should be as fast leorize: though distict can be useful for this as well leorize: distinct* axion: Yeah I want to avoid distinct because of all the borrowing and other stuff leorize: that's kinda a big reason why I don't use distinct often too :p alehander92: but why alehander92: isnt it easy to borrow leorize: axion: but if you put it in an array, wouldn't you still have to borrow? just a bit more explicit? leorize: alehander92: you still have to type out the full prototype to borrow alehander92: well this should be fixable with some more macros :P Araq: rayman22201, dom96 would like to tinker with async + ARC Araq: er Araq: that should have been Araq: rayman22201, dom96, I would like ... leorize: really annoying when you suddenly stomp into an operator while coding dom96: Araq, okay, what do you need from us? leorize: gotta stop and write the entire prototype out just to get it to work :( alehander92: there was an easy way to do it before afaik Araq: mostly explain to me once again why 'iterator x(): Request' doesn't work Araq: we yield requests that the even loop needs to wait for leorize: I would like to borrow some procs too, like having an add() for the distinct seq for example leorize: is this doable via a macro? leorize: so I can do something like T.borrow identifier axion: Ok thanks axion: Another question. I saw some code accessing type parameters in the body of a proc, without type parameters for that proc (only for the type definition). I also noticed this doesn't work all the time. Why is that, and how does the compiler differentiate type parameters from object members? leorize: wdym? livcd: so with arc parallel async/await will become possible ? axion: Sec, lemme find some code that does it leorize: livcd: it's still possible without it axion: https://github.com/stavenko/nim-glm/blob/master/glm/vec.nim#L31 rayman22201: Araq: 'iterator x(): Request' ? rayman22201: I'm not familiar with the idea leorize: axion: ooh, interesting leorize: well it might have something to do with Vec being a typeclass axion: I noticed this doesn't always work, but I haven't found a pattern yet leorize: but I don't think that one is even in the manual leorize: might just be luck axion: It is not leorize: try typeof(v).N? Araq: rayman22201, well .closure iterator build the state machine, no need to reinvent that part Araq: and closure iterators are ARC-able axion: well that's krux's code. I was just playing around with it after I saw it being done, but haven't kept anything because it was too inconsistent for me Araq: the cycle problems come from the callbacks axion: UB as far as I'm concerned, until it's added to the manual rayman22201: araq: sure, but I'm not sure how the callbacks can be fixed without removing the closure iterators. rayman22201: the design interlinks them Araq: https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators Araq: scroll to the part where it says "# simple tasking" Araq: 'runTasks' is our scheduler Araq: it needs to use our event loop dom96: It sounds to me like you'd need to fundamentally alter how async await works rayman22201: exactly rayman22201: what dom96 said. Araq: so what? rayman22201: Araq, what you propose is similar to what I propose Araq: we can't we have async V3 eventually? rayman22201: but it's a totally different design. Araq: of course it starts as a tiny Nimble package etc etc yada yada Araq: but what's wrong with creative tinkering... rayman22201: The idea is a single closure iterator with a yield for every state, yes? rayman22201: My idea is the same, just instead of a closure iterator, use goto's and CFG like mratsim did for synthesis. Mainly because it's more efficient. rayman22201: I'm on board with your idea Araq. dom96: if you're going to redesign async then try to avoid dynamic heap allocs like Rust does please rayman22201: that's exactly what it does dom96: if you're thinking of using iterators then I think you're already losing that AFAICS rayman22201: that's why I like the mratsim approach better. But a single closure iterator is ok for a POC rayman22201: same technique though rayman22201: have the macro "compress all the promises in an async chain" into a single "task" object that is then iterated via the event loop. This is what Rust does. Araq: dom96, the closure iterator has minimal overhead and you need heap allocations Araq: as the whole point of async is to avoid the stack rayman22201: The point is not heap allocation, it's "dynamic" heap allocation. dom96: ^ yeah Araq: what does that mean rayman22201: The single object is allocated once at the beginning. Araq: yeah, the closure iterator's closure. rayman22201: yup. dom96: This video explained it pretty well IIRC https://www.youtube.com/watch?v=skos4B5x7qE rayman22201: I like this one: https://www.youtube.com/watch?v=NNwK5ZPAJCk rayman22201: but Araq is right, a single closure iterator allocated at the front is fine. Araq: dom96, I saw it but it lacks too many details rayman22201: using a custom object gives a bit more control imo, but It's a "6 in one, half a dozen in the other" kind of thing. A matter of taste. livcd: That guy's name is Without Boats? Oo Araq: rayman22201, with a custom object you need inheritance instead Araq: not that i care rayman22201: nah rayman22201: I don't think so Araq: tasks require local variables Araq: local vars must be moved into the object Araq: different tasks have different numbers of locals Araq: ergo you need a base class rayman22201: Yeah. So? The macro generates a unique custom object for each async chain. Araq: the custom object must adhere to a protocol like rayman22201: And then generates overloaded procs that follow an "interface" rayman22201: use a generics Araq: Task = ptr object fn(self: Task) Araq: you can't pass "generics" to the underlying event loop rayman22201: you don't need to. The event loop just needs a callback rayman22201: well it needs the state too. But Why can't that be a generic? rayman22201: the event loop calls `wakeup[T](Task T)` rayman22201: and each unique Task has it's on impl of wakeup rayman22201: it's own* dom96: Araq, just make a secret pragma that will make async await work with ARC and call it a day dom96: we can redesign async later leorize: if life was that easy :P rayman22201: It's called `wake` in Rust: https://rust-lang.github.io/async-book/02_execution/02_future.html Araq: rayman22201: there are no know ways to do this without "type erasure" Araq: in Nim inheritance can be used but of course you can also re-implement the inheritance mechanism Araq: just like you're about to re-implement the closure iterators' state machines :P rayman22201: I'm ok with using closure iterators lol blackbeard420: oh neat leorize didnt know about '{.gcsafe.}: <- everything in this block is considered to be gcsafe' thanks! Araq: I'm ok with you using even more explicit state machines Araq: as long as it works in the end :-) dom96: leorize: is life not that easy? :P rayman22201: now you have given things to think about. I take your advice seriously lol :-P rayman22201: Why can't you have `wake(Task: unique_task_type_1)`, `wake(Task: unique_task_type_2)` etc.... Because the event loop keeps a list of tasks, and they loose their type info if kept in a common collection... hrmmm.... Araq: exactly rayman22201: unless you keep a bunch of closures that contain the correctly typed object... rayman22201: but then you are back to a bunch of closures. rayman22201: They don't have cycles anymore though :-P rayman22201: or you use dynamic dispatch, a.k.a inheritence.... damnit araq, you are right again Araq: usually I keep my mouth shut when I'm clueless. Araq: The secret of why I'm always right. :P rayman22201: hahahaha. I may never learn that lesson. But at least it makes life fun rayman22201: technically you don't need inheritance. You need interfaces (or "traits" in Rust land) dom96: Araq, just remember that if it wasn't for me you'd be implementing fibers in Nim :P Araq: rayman22201: in the end it compiles to the same thing and in C++ it's called "type erasure" livcd: yes please Araq: dom96: I remember and fwiw fibers work with --gc:arc out of the box rayman22201: araq. Yeah. I get it. You convinced me. I'm sold on the single closure iterator idea. Does seem like an elegant compromise. More "Nimish" Araq: that doesn't mean the async design was wrong, but there are always tradeoffs rayman22201: also much easier to implement rayman22201: absolutely. I don't think anybody is arguing that async 1.0 was bad! It worked very well. rayman22201: works still dom96: Well, context is important here, I like to think I saved you from implementing fibers on top of what we currently have as you had some misunderstanding about what they would enable. If I knew what I know now and Nim didn't have an async implementation, I would likely advocate for fibers instead of async await. Araq: dom96: interesting treeform: dom96, I did some experiments with fibers... I want easy to use real threads now... livcd: treeform: me too! rayman22201: I will point out that their are some space efficiencies left on the table by using a closure for async 2.0. There are cases where a local variable is only needed for a single "state", and other cases where a local variable must live across several yield statements. A simple CFG "last read of" analysis can allow the state object to be "as small as necessary". But maybe the CFG we have already does this? Araq: yeah we don't do that :-) rayman22201: That is a big selling point of the Rust implementation. They "prune" the state by knowing the lifetimes. rayman22201: It seems like a nice optimization :-) treeform: Araq do you recommend using protect/dispose for nested ref structures? treeform: https://nim-lang.org/docs/system.html#dispose%2CForeignCell rayman22201: looking at the wider world, async won over fibers. I'm glad we went that way. dom96: rayman22201, did it? Fibers are Go's best selling point and many are using it rayman22201: and that's why Rust abandoned the idea, Windows deprectated their fibers implementation, and the Linux Kernel is racing to make their api's more async. treeform: I feel like OS needs to provide fiber like things... Araq: yeah and the OS does and calls them "threads" rayman22201: Microsoft and Linux both disagree rayman22201: exactly. we already have threads Araq: and unfortunately their overhead is high treeform: Araq, yeah OS just needs to make threads better 🙂 rayman22201: go succeeded because their fibers have a nice api. It makes threading "easy" to do. rayman22201: but it still has many problems. Araq: we need to use "OS as a library" livcd: I await Araq's nimroutines Araq: OSes suck, they are a messy legacy *shrug* treeform: I wish there was more docs around protect/dispose https://forum.nim-lang.org/t/3711 rayman22201: also, nodejs is a counterpoint to Go fibers for making async a selling point. Araq: rayman22201: well both ways have their fans Araq: but our goal should be to write something that works well with ARC rayman22201: fair. It's obvious what camp I fall into :-P treeform: I started 500,000 threads on windows... they appeared to work 🙂 Araq: ha, I did the same rayman22201: the threading api on windows is amazingly good Araq: but it was slow Araq: and the memory consumption was noticable rayman22201: lol, of course. treeform: I bet having 500,000 async thingies would be just as low. Araq: it's not rayman22201: actually, no treeform: At that point you are fighting the memory caching unit. Nothing can stay in memry. rayman22201: less kernel overhead to get in the way with async. rayman22201: still memory overhead, but less kernel context switching. treeform: What if your task is already kind of CPU bound, like pacing JSON and output other JSON? rayman22201: context switching threads still overwhelms any useful work. rayman22201: that task needs SIMD rayman22201: make each thread do more work, instead of more threads. Araq: context switches also make the caches less effective treeform: I guess this is how I feel about this: treeform: treeform: https://cdn.discordapp.com/attachments/371759389889003532/694642318917238925/unknown.png treeform: My work usually dominates not async/thread overhead rayman22201: The thing is, you have a limited number of physical CPU cores. You want to use them effectively. After a certain point, more threads just means more things fighting to get limited physical resources. rayman22201: yeah, well, if you just keep adding threads, the thread overhead keeps going up. rayman22201: That's not true for async. rayman22201: or I should say the rate of growth is mush slower. rayman22201: much* even. leorize: now we just need to make threading & async easy to use :) rayman22201: :-) Araq: async is harder to use but is faster Araq: roughly speaking rayman22201: I agree. treeform: async has issues when you block reading a file, or block on http call because of DNS resolution blocks. treeform: Or use a blocking c library... treeform: Its so easy to block async and get less performance. rayman22201: that's an implementation issue, not a property of async as a concept. rayman22201: which goes back to what araq said. Async is harder to use. You have to make sure all your api's don't block. treeform: yes but nim's implementation of threads already solves those problems. rayman22201: how so? treeform: if you start a thread, that thread blocks on file read, dns, c library... other threads continue to run. leorize: his idea is that he can just offload all the blocking parts to threads :P Rika: threads are easier to use but they have a higher overhead doesnt it treeform: while with async it blocks everything. leorize: I really wish life was that easy :) treeform: I would not call nim's threads easy to use right now. Rika: if you have too many threads it can block everything leorize: on Haiku we are doing exactly that treeform: They are "ok" to use, but not "easy". leorize: the Haiku API is completely threaded with message passing rayman22201: That's how async in all languages work! Nodejs. tries to use your os async apis, but if it can't it farms out to a thread. leorize: and now we are facing a ton of bottlenecks in networking code :) rayman22201: use the async networking api from your OS then! treeform: but not all programs just do networking... Araq: and the async API from all the DBs that you want to use... Araq: async is a hack, ymmv rayman22201: see my Nodejs comment. You use as many async apis as you can, and for what you can't, you farm out to a thread. Araq: I too would rather use threads for everything rayman22201: Nodejs is very successful with async because they pretty much force all their apis to be async. axion: Fibers are an OS level construct for a thread with less state. I think it's confusing to relate them to coroutines axion: Often used with them, but independent nonetheless Araq: well this is getting unproductive treeform: axion, everything is confusing because OS calls them different things with different APIs. Araq: let's get back to the closure iterators rayman22201: It's a good idea. Are you going to try and implement it araq? treeform: I really like the `{.push checks: off.}` feature. Best feature. livcd: so we should use weave? Araq: rayman22201: I'm too busy, I hoped you would pick up my ideas rayman22201: Or do you want me to try? Soonest I can get to it would be the weekend. rayman22201: I want to try rayman22201: livcd: use weave if your problem is cpu bound. It's really freaking good for number crunching stuff. dom96: treeform: you can block a fiber in Go too dom96: we could have hacks that run it in a separate thread automagically too dom96: it's not prevented by async await rayman22201: I want to do it actually. been thinking abou that :-P dadada__: really interested in the new macros for proc types and macros for types feature, waiting for the docs rayman22201: I was a bit harsh on fibers. They aren't "that different" than async. IMO async is more explicit but maps to the underlying apis better. So async plays nice with today's kernels more easily. But if there was better OS support, I would expect them to be pretty similar. (IIRC Google has hacked the Linux kernel to do exactly this for Go for their infrastructure.) dom96: in the end the APIs that fibers use are the same, the implementation is just more hidden and as a result you get less control over what's happening dom96: that is the main reason why async await is better for a systems programming language rayman22201: I agree rayman22201: :-) axion: Whoever maintains nimble.directory, if you need better hosting I'd be happy to help. As it stands, every time I try to browse I got http 500 or 429 error, and today, just times out completely trying to connect to SSL dom96: federico3, ^ axion: Oh, add 502 to that list. Resolved before a timeout for once today :) leorize: rayman22201: so are you gonna do it and stream? :) federico3: axion: that would hepl Araq: dadada__: that has been merged already and the docs are updated treeform: dom96, yes I agree with you. I tried fibers and was not impressed and now I think that just regular threads are just better for most of my use cases. rayman22201: @leorize... Sure I guess? You can watch me struggle with Emacs since I am trying to learn it lol. leorize: and once you give up I can pitch you over to neovim :) rayman22201: believe me, I'm tempted to come back dom96: so this is fun dom96: --threads:on somehow breaking generic type matching dom96: how is that even possible dom96: How fun. Qualifying the T with a concept (that's empty) fixes it rayman22201: ???? wow. dom96: I suppose it's time I show my crazy thrift library clyybber: Can you please open an issue clyybber: That sounds really broken : D dom96: I'm adding a todo over the line I've modified for now. dom96: would take too long to repro clyybber: 😦 clyybber: but this is pretty critical clyybber: if you want nim to get better at it, you have to make an issue.. dom96: oh, that reminds me of my new lesson, I should check if it fails on 1.0.6 clyybber: were you on devel? dom96: oh shit, I didn't actually fix it dom96: argh dom96: same error on both 1.0.6 and devel dom96: okay, `mixin send` helps dom96: very peculiar that it's only needed when threads are on dom96: Araq, any ideas why that might be? Araq: --threads:on adds a 'send' via channels dom96: ahhhh Araq: and if it's the only one proc you get different symbol binding rules Araq: not the best part of our design tbh but I also don't have a better design either Araq: will think about it tomorrow during my run dom96: cool, thanks! dom96: bah, the game runs at least half as fast with --threads:on dom96: and it seems that --genScript doesn't copy nimbase.h when --threads:on is specified but without it does, wtf lol dom96: and Android crashes immediately. This my friends is why I always avoid --threads:on Araq: well Android uses threads so you should use --threads:on Araq: use --tlsEmulation:off too, it's slow dom96: yeah, I know :( rayman22201: sounds like we just need you to keep fighting the good fight and filing bugs so we can have a good threads:on eventually :-) dom96: I just want to finish this game and put it on the play store dom96: that's it dom96: feels like a never ending fight rayman22201: :-( fair dom96: nativeRunMain(): Couldn't find SDL_main in library libmain.so dom96: how? When you could find it with --threads:off dom96: I don't expect an answer from anyone, but I think talking out these problems may help me dom96: i.e I'll use #nim as my rubber duck :P dom96: okay, so devel does not copy nimbase.h with --genScript dom96: https://github.com/nim-lang/Nim/issues/13826 moerm: Hello everyone Rika: hello moerm: Is Araq here? dom96: maybe, maybe not dom96: ask whatever you want to ask moerm: *g Rika: you just pinged them Araq: hi moerm: Araq Hi! First, thanks again for the static anal. efforts! Rika: uh thats a really horrid place to abbreviate analysis Araq: you're welcome dom96: ooh, regarding my issue above: I compiled with devel and --threads:on. Turns out my game breaks on devel on Android. moerm: I'd be willing to write a small intro into static verification - but I'm git stupid, so it woould probably go into our wiki. a) interested? b) If yes, how do I put some articel into our wiki (without using git)? dom96: 1.0.6 + --threads:on works Rika: you dont need to use git to add to the wiki Rika: github wiki is "github specific" Araq: moerm: a) *very* moerm: Araq Ok, you'll get that. That's a modest contribution I can make and I think it might be quite useful/helpful for our efforts Araq: b) iirc our Nim github wiki is open for everybody or write a forum post but I'm PM'ing you moerm: So, if someone holds my hand on how to put an article into our wiki (or other place Araq desires) I'll start writing ... moerm: Araq Great! Thanks moerm: (And as a small extra for you I'll try to bring in at least stome "comparison" to Ada/Spark too ;) moerm: (Btw. Thanks also to Rika for his attempts to help me ;) Araq: I'm close to finishing 'old' moerm: ?? Rika: うう Rika: ah shite, wrong keyboard moerm: you mean in post conditions? Araq: yes Araq: ensures: old(x) + 1 == x moerm: Ah, OK. Hint: You might want to play with Nim's "result" rather than 'old' moerm: meaning: Just turn it around: result == x + 1 Araq: I think you underestimate how far I got with this already dom96: out of curiosity, what are you planning to use these new formal proofing features for? moerm: Sorry, it was just meant as a friendly (and potentially interesting) hint. But going the standard 'old' route is fine too, of course Araq: dom96: I focus on proving array indexing moerm: dom96 you'll find some of the answers in my article ... dom96: moerm, brilliant :) Araq: but we also discussed Rust's "type state" (back when they still had it) dom96: Araq, does that mean we will get compile-time errors telling us our array indexing sucks? :) moerm: Araq and you need/use 'old' for that?? Araq: and I'll likely replace Nim's .tags system by something better Araq: moerm: yes I do moerm: Hint: I'm bored and annoyed by Rust. Your approach (Nim + static verif) is by far better (and easier to use) dom96: I love Nim's .tags system, it just needs some way for me to tell it "shut up, these are the tags" Rika: what's wrong with Rust? Recruit_main707: its not nim obv Rika: lmao, seriously though dom96: Rika: it doesn't have a book about it written by Dominik Picheta :P moerm: One thing - and only one thing - is interesting though: the "ownership" concept (but separation logic has more on offer) Rika: bought your book btw but i havent read it for some reason lmao Araq: if i+1 < a.len: use(a[i]); inc(i); use(a[i]) Araq: --> I need Araq: proc inc(x: var int) {.ensures: old(x)+1 == x.} moerm: Araq don't complicate it by mangling usage, e.g. assignment or read, with bounds verification Araq: of course I can also hack 'inc' into drnim as a special case, but the complexity is comparable so why not add 'old' already moerm: One good way is to check bounds pre any access Araq: dom96: not only do you get compile-time errors, the system usually can give you concrete example moerm: mangling static verif and access operations will immensely complicate things quite quickly Araq: values that make your program fail dom96: :o moerm: Btw (it's probably my fault but) when I tried to build a freshly cloned Nim last night I failed moerm: dom96 He's riht and isn't that super cool?! dom96: yep, it sounds awesome. Araq: https://github.com/nim-lang/Nim/blob/devel/drnim/tests/tbasic_array_index.nim#L2 moerm: But there's a but too: Most static analyzers sometimes fail. They are not wrong but they simply can't "understand" the situation moerm: I had a case recently where even the best analyzers failed. the index var to an array was (x & 0x1ff) -16, so it definititely was o < x < 496 but the analyzer choked on it Araq: for drnim you add moerm: So I had to go the really painful way: frama-c. Beautiful in theory but a PITA practically Araq: .assume: 0 < x and x < 496 Araq: and then you can continue moerm: Araq thank you, I mean it. But keep in mind that I'm git stupid (I work in a totally closed environment) so I'd need a *simple* way to get and build drnim (which I'm extremely interested in) Araq: well we had regressions for BSD Araq: try again with today's devel or wait for the release moerm: Araq If THAT really works in Nim's static verif. that would be awesome. Araq: to build drnim you can use 'koch drnim' Araq: works for all OSes, in theory Araq: tested it on Windows and OSX for now moerm: '... /Nim/compiler/vmops.nim(105, 10) Error: cannot open file: std/compilesettings' was the error I got. I *did use* koch moerm: (on linux) leorize: what version of nim do you currently have moerm: 1.0.6 Jan. 23 leorize: maybe you gotta build it from scratch leorize: switch to devel and pull leorize: then clone csources leorize: git clone https://github.com/nim-lang/csources Araq: yeah you do, Nim 1.0.6 doesn't have the new stdlib moerm: Sorry, I'm really git stupid. My limit is "git clone something" and then build it leorize: actually you can try this hack leorize: how did you install nim? leorize: was it with choosenim? moerm: Will a full cloning and build of the current Nim source do? moerm: no, not with chosenim leorize: good leorize: copy the nim binary to the bin/ folder in the source code leorize: then try running koch again Araq: btw https://dl.acm.org/ is now open for everybody moerm: I'll first clone an build a new Nim Araq: so many papers to read moerm: Araq *g (yes, I saw it both on HN and on lobster) Araq: moerm: and yeah, we do know Rust's ownership system, it's very nice, we're getting something comparable moerm: I'll have to leave for now. And when I return most will probably be gone. So, Araq, I'll get a PM from you, right? (And I'll start the article right away) Araq: I'm trying to PM you... :-( Araq: you don't reply moerm: I'm not on discourse. For some weird reason they didn't send a confirmation/verification email :( Araq: which IRC client do you use? leorize: we don't have any discourse moerm: IRC (The program is called 'hexchat') moerm: or discord, I always mix those 2 up Rika: hexchat, discord aint IRC Rika: oh Rika: you mean discourse vs discord Rika: we have a discord yes moerm: yeah, I guess so moerm: It always worked. But when I tried it yesterday they wanted me to create an account. I tried but they f*cked up the verif. email Araq: willing to use gitter instead? moerm: (the discord thingy) moerm: Araq Sure. Is there some ap-get installable program for gitter? Rika: gitter is web client i think moerm: even better. URL? Araq: https://gitter.im/nim-lang/Nim moerm: Yuck. I must sign in to be able to talk there (gitter) moerm: Give me some minutes. I'll try Araq: telegram, skype, ... moerm: Forget it. I can't. One needs either a github or gitlab or twitter account. I have none of these moerm: skype on linux is a PITA moerm: telegram I don't trust moerm: Araq We could use a free wire room Araq: try to PM me via IRC ksandvik: how to send private messages in irc: https://www.computerhope.com/issues/ch001174.htm Araq: thanks, we managed ksandvik: It's good to have github/gitlab/bitbucket accounts... exelotl: Man I need to revisit my single-user discord-irc bridge exelotl: It worked great but crashed when I left it running overnight. Then it got left behind since it was made with Nim 0.18 exelotl: Idea of using an empty discord server as a personal IRC client is very appealing to me though leorize: just use matrix :P dom96: exelotl: just make sure it works when it restarts and have it restart automatically dom96: works perfectly for NimBot :P Rika: pm2 axion: So after this large refactor my math library/first Nim library will be usable. Trying to decide what the next piece of my Lisp gamedev stack to be ported will be... axion: In any case, the library ecosystem is pretty lacking, so anything I choose would be useful I think (or well, at least for me) leorize: you've just written it :P axion: Hmm? leorize: how come you're refactoring it already :P axion: Because as I learn pieces of the language I find room for improvement in the interest of usability and maintainability. axion: I implemented everything the best way I knew how the first time around. It's complete, but it can be more efficient/maintainable/better interface leorize: sounds great :) axion: It's complete, just not the best axion: I actually have a question. I ran into an issue last night in my refactor axion: How can I overload `[]` and `[]=` so that they can work with an index or a slice like regular arrays? This would just be a light wrapper over my objects which just have an array property. axion: I can get integral indexing/setting working, but not both for some reason leorize: hmm that's weird leorize: even the stdlib way was just to provide a `[]` that takes a Slice as the second param leorize: do you have a reproducible example? axion: i didn't try too hard...i was tired last night, but does the stdlib define two variants for int and slice? leorize: yes axion: Alright...I'll try again when I get there in a few axion: Hmm, I can't find a good explanation of the inject pragma, and I think I need it here. I'm guessing it prevents gensyming, but I am having a hard time finding the right passage in the manual zetashift: https://github.com/oakes/vim_cubed oh wow it's written in Nim too lmao leorize[m]: ah meme will make Nim great :v sealmove: How to do int -> enum? Rika: intVar.Enum perhaps? sealmove: almost... you have to do Enum(intVar), that's why I was confused Rika: you dont???? Rika: UFCS???? sealmove: for some reason UFCS doesn't work in this case Yardanico: if it's like 5+3.enum then of course sealmove: or perhaps I used it wrongly, because of complex expression Yardanico: you need to do (5+3).enum sealmove: yeah, that was my pitfall probably Rika: is it possible to "dynamically" generate test cases in Rika: in unittest* sealmove: what do you mean by "dymanically"? Rika: uh Rika: converting a for loop of a file walk into test cases per file Rika: or something like that leorize: use testament leorize: or leorize: !repo testutils disbot: https://github.com/status-im/nim-testutils -- 9nim-testutils: 11testrunner et al 15 6⭐ 2🍴 Rika: are there docs for testament?... leorize: in some contributing documents iirc Benumbed: "docs" Rika: """docs""" Rika: do you recommend testament or testutils Benumbed: The main thing I don't like about Status' test runner is that the files have to be named .test Benumbed: Like y tho Rika: ok so testament it is Benumbed: Orrr write your own 😉 Rika: lolno leorize: testament is not too hard to use tbh disruptek: use testament. i will probably fix it to run async tests before i return to working on testutils. shashlick: disruptek: how are things in nimph land disruptek: shashlick: i dunno, i guess there might be a bug in how it handles choosenim because maybe choosenim puts packages under $nim, which nimph mistakes for compiler-supplied imports like, say, compiler. disruptek: kungtotte has some sort of problem with mustache and i haven't had time to look at it properly. disruptek: any idea where my extra output came from? sealmove: Rika I had similar needs and made https://github.com/sealmove/testify leorize: do you feel like making a tool that output junit from testament test results sealmove: would be awesome sealmove: but testament is hard to understand for people who have done no work on nim compiler sealmove: i don't understand it at all Rika: i think i understand it now Rika: okay, so i'm pretty dumb Rika: i could actually do what i described in unittest with a template Rika: is this what being in the house for weeks does to you sealmove: unittest's main limitation is that it only works with 1 file. there is no process isolation or anything. Rika: i dont think i have an issue with that sealmove: then unittest should be perfect :> axion: Ok I can sleep now. My first piece of nim code is up on nimble.directory. :) PMunch: Link? axion: https://nimble.directory/pkg/origin I'll read the newbie code hate when I wake up leorize[m]: axion: it's full of lisp code? axion: leorize[m]: I sent a PR. It was a typo for the web link. you can click the actual repo link to go to the correct one. leorize: lol axion: I am tired and should have done this when I'm more awake. :( Araq: I have a minor patch for testament in the pipeline Araq: most C libraries use pointers for everything and the sizes are irrelevant Araq: I don't see how a "dummy C file" helps with anything shashlick: which lib is this PMunch: It's Unbound PMunch: Not really a library, but I create a DLL that it interfaces with PMunch: So I get structures that are defined in the program PMunch: Araq, well Nim is probably smarter about the sizes if I define the objects as proper C structs and tell Nim to use that rather than telling Nim the sizes of things. Araq: narimiran, I don't understand https://github.com/nim-lang/Nim/pull/13803/files disbot: ➥ faster CIs narimiran: Araq: i've just answered your question about nightlies. is there something else? shashlick: PMunch: we already spoke about unbound before 🙂 https://irclogs.nim-lang.org/21-10-2019.html#13:46:03 PMunch: Yeah I know :P Araq: narimiran, which tests were removed? Araq: what was the criterion? shashlick: narimiran: only comment on csources, we use it in nightlies to build csources into release Araq: nightlies should really use 'koch nightlies' (which doesn't exist yet) PMunch: shashlick, this is pretty much the stuff I have now: http://ix.io/2fYu PMunch: And it's not great.. shashlick: narimiran: okay saw Araq's comment and your response shashlick: nightlies does all sorts of docker stuff, some portions could go into koch though, yes shashlick: leorize was looking into github actions tho narimiran: shashlick: yeah, i've spoke to him about it shashlick: cool narimiran: Araq: in most of the tests i just lowered the number of iterations and/or slightly reduced sleep time. after that, some tests were merged into one larger test. and the lowest amount of commits are test removals as follows: narimiran: - in 'assert' category, `testhelper.nim` file was removed and the tests that test that file; `tassert2.nim` was modified to work without that helper narimiran: - `tindexerrorformatbounds.nim` was removed as i felt it was not very useful Araq: why was tests/parallel/tdisjoint_slice2.nim removed? Araq: ah merged into the first test, got it narimiran: it was merged into `tdisjoint_slice1.nim` Araq: ok ganytheodes: Hi guys how can I do something like if foo() and bar(): echo "both ok?" narimiran: same for tbitops2, tdeepcopy2, dcollections_to_string, tstreams2, tstreams3 narimiran: ganytheodes: like you have written it if those procs return bool ganytheodes: both return bool but it does not seem to work narimiran: ganytheodes: can you post your code on https://play.nim-lang.org/ ? shashlick: PMunch: check out http://ix.io/2fYw shashlick: some types are stubbed out but might work for you narimiran: Araq: 'rodfiles' category was removed as i thought "rod" stuff is long gone - if not true, i'll revert that commit ganytheodes: narimiran: i am just checking paths so not sure what's there to post narimiran: ...but the tests there seem to be very basic and (probably) covered by other tests PMunch: shashlick, what's that? shashlick: Wrapper for module.h Araq: narimiran, nah the rest is fine, the question really was about tdisjoint_slice PMunch: Hmm PMunch: I won't be able to access any of the fields though will I? Araq: PMunch, your wrapping code looks fine to me PMunch: Yeah, but I struggle with it crashing PMunch: SIGSEGV PMunch: Traced it back earlier to an issue with alignment Araq: we use C's default alignment rules Araq: wrap all the fields inside the struct in the right order and there should be few problems PMunch: And yet there is.. Araq: PMunch, well you can import from the .header Araq: in fact, I think you're confused Araq: {.emit: fmt""" Araq: #include "{here}/config.h" Araq: #include "{here}/../util/module.h" Araq: """} Araq: means that you really want to use .header instead PMunch: Hmm, just tried to remove that and it builds fine PMunch: So that's probably left over from something alehander92: morning clyybber: morning Recruit_main707: what time is it there? Araq: alehander92: https://github.com/nim-lang/Nim/pull/13743/ disbot: ➥ DrNim (Nim compiler with Z3 integration) Araq: most features have been implemented, now "only" the testing needs to be done timotheecour: @araq any other changes need for stacktrace PR https://github.com/nim-lang/Nim/pull/13351 ? I’d really like to have it merged because it helps when debugging code for other PRS disbot: ➥ stacktraces can now show custom runtime msgs per frame ; snippet at 12https://play.nim-lang.org/#ix=2e0u Araq: ok and thank you for pinging me on open PRs clyybber: hey, we got nim music: https://www.youtube.com/watch?v=rJwnWKFb-m8 timotheecour: yay! thanks Araq: it remains to be the case that I don't get every update Araq: not sure why clyybber: timotheecour: Why are those required in that PR? https://github.com/nim-lang/Nim/pull/13351/files#diff-5cfdfeab79c2d2b7bbc78af7060c38c3R58-R73 disbot: ➥ stacktraces can now show custom runtime msgs per frame ; snippet at 12https://play.nim-lang.org/#ix=2e0u clyybber: To be added to system.nim that is Rika: can i use `when` instead of `case` to make a variant object? Araq: clyybber, he only moved the decls around clyybber: oh clyybber: I see timotheecour: ya alehander92: Araq alehander92: this is good alehander92: i will like to check it out alehander92: two questions: cant it be a flag to the compiler: or is it too much to bundle optionally z3 with it (maybe the flag can just invoke the drnim binary) alehander92: and how do you plan to solve nil checking with it alehander92: also, i want to make a simple rfc about tracking a single blocking effect, but i want to ask first here alehander92: for some clarifications (e.g. can i track just a single tag/effect? without having to annotate the other ones) Araq: it's ok as a separate tool IMHO, the dependency is bad for many Araq: nil checking doesn't really benefit from it though and shouldn't be part of my todo geotre: How do you run a macro on the output of another macro? Araq: getAst(macroCall(...)) iirc Araq: it happens rarely, usually macros only call into .compiletime proc helpers alehander92: Araq ah ok Araq: but we got .requires and .ensures alehander92: but the setLen thing alehander92: seems pretty nice alehander92: overally good work alehander92: does it have a lot of overhead? geotre: Thanks @Araq! Araq: no idea, for now it's opt-in via .push staticBoundChecks alehander92: and do you guys plan to annotate the stdlib eventually, as one needs that to be able to use the feature well imo Araq: that's why the pragmas are builtin, they should always exist alehander92: (yeah one can just assert a variable >= n for a cast so maybe not too fatal) Araq: but the stdlib isn't as crucial to annotate as you would think because currently there is little available alehander92: hm, and can one annotate e.g. requires: a > 0, other > a alehander92: like args depending on each other Araq: for instance, you cannot write down that e.g. socket.read works on opened sockets alehander92: ah something like typestate Araq: my goal was to solve range and index checking and so far it supports that really well alehander92: we imagined a mechanism similar to a generalized version of notnil checking for that once (with zah i think) alehander92: but it was just a dream :D Araq: once that matured, I will extend it to Nim's "disjoint checking" for threads alehander92: i havent used that i think alehander92: but the typestate thing: how would you write down expected transitions (e.g. pre: Open, post: Running) alehander92: would they be based on enums Araq: haven't thought about it but {.requires: f.state == opened.} comes to mind Clyybber: when you have typestates depend on other typestates Araq: proc open(): File {.ensures: f.state == opened.} Clyybber: we have type attached proofs Araq: proc close(f: File) {.ensures: f.state == closed.} alehander92: ha yeah, you might want to ensure the state is just previous toggle of a state or something Araq: pretty easy to do once all the other machinery is in place alehander92: and probably more complicated case clyybber: ATS does it wonderfully alehander92: but thats what i wondered before: can we write a > 0, other > a Araq: try it. alehander92: :D ok, later alehander92: otherwise, my problem is : i want to annotate `a()` with `Blocking` (but you can imagine it for `IO`): can i somehow check only for that effect without writing down all the others alehander92: like, having a separate "group" for each effect independently of each other alehander92: the same way i can track *types* but not *raises* etc alehander92: i imagined that maybe thats what tags are alehander92: but it seems tags and effects are the same Araq: they are, yes. alehander92: so i cant do like `{.exportc, Blocking.}` or something like that alehander92: or like `{.tag[Blocking].}` Araq: I still don't care about "blocking", it's stupid :-) alehander92: and tell the compiler: check only for that in the set of all tags in this function alehander92: well, i had a case where it would've been possible to tell me that my async function is blocking alehander92: and i realized after a strange behavior problem alehander92: like, i agree its not always super useful, but still cool to have Araq: .tags: [not Blocking] Araq: seems to be what you're asking for Araq: we don't have 'not' for tags though alehander92: especially if one can easily write something like "await this from a long-running thread" etc alehander92: well yes Araq: clyybber, how does ATS do it? clyybber: They have proofs as explicit CT only objects clyybber: I guess we could attach those proofs to the type by default clyybber: s/type/symbol clyybber: For example open() would return a file and a proof that the file is open Araq: what's the difference to .ensures? clyybber: Not a lot, or nothing possibly Araq: https://github.com/nim-lang/Nim/pull/13743/files#diff-f0f01a54ace4713173aa55429f9a7a7dR16-R17 disbot: ➥ DrNim (Nim compiler with Z3 integration) Araq: we need to handle join points in a smart way though clyybber: Yeah, so we have ensures and requires. When f = open {.ensures: f.state == opened.}; ... close(f) {.requires: f.state == openend.} work then there should be no difference Araq: probably replace the sempass2 patches with a new CFG based pass clyybber: Araq: We could attach those ensures (axioms/proofs) to the symbol, here f or f.state clyybber: Like in the ast clyybber: Thats what I meant Araq: they are attached to the proc type Araq: so that even indirect calls work properly clyybber: I mean in the caller scope clyybber: When you do f = open clyybber: then the symbol f has a proof for f.state == opened attached to it Araq: in the caller scope we track the "knowledge", currently via a stack clyybber: Yeah Araq: the stack is good for when you only allow structured programming (no 'break', return etc) Araq: *good enough clyybber: I see Vindaar: thanks to whoever wrote this little paragraph: https://nim-lang.github.io/Nim/manual.html#closures-creating-closures-in-loops <3 ⏎ I realized what the problem was, but had no idea how to fix it. clyybber: I think it was foldl clyybber: Araq: It would be amazing to give "us" access to the proofs in our code, so that we could manually construct new proofs when needed Araq: but you can, via .assume clyybber: Yeah clyybber: Right clyybber: Really cool clyybber: Araq: Can you do ifs in assume? clyybber: Like: if ensured x > 0: assume x > 1 ? clyybber: stupid example Araq: you can "assume" an implication clyybber: Ah nice clyybber: so we would do {.assume x > 0 -> x > 1 clyybber: right? Araq: .assume: (x >= 0) -> (y == 4) clyybber: cool clyybber: Araq: I think for open; ...; close; to be provable we need to consume proofs by default clyybber: Thats what ATS does too Araq: what does that mean? clyybber: It means that for example in f = open(); close(f); close "consumes" the proof created by open: f.state == opened, and returns a new proof: f.state == closed clyybber: Similarily any call like someProc(f) needs to consume f.state == opened by default clyybber: And when we can prove that someProc(f) doesn't close f, someProc can return a "new" f.state == opened Araq: seems to be covered by .requires and .ensures Araq: the state transitions need to be path sensitive though and we need to document/clean up the rules about locations alehander92: Araq clyybber: Araq: Yeah, so that we don't get f.state == opened and f.state == closed at the same "time" Araq: well that's the "invalidateFacts" that assignment does Araq: I'm not worried about it, it's simple Araq: I'm worried about things like: Araq: if cond: result = 3 Araq: else: result = 4 Araq: {.ensures: result > 0.} Araq: we need to 'or' together the facts after an 'if' clyybber: Maybe we should give z3 the cond clyybber: and the ifs Araq: we do that clyybber: Oh Araq: but incompletely Araq: but yeah, that's quite do-able when you use structured programming Araq: if a[i] < a[j]: swap(a[i], a[j]) # how to tell Z3 that afterwards a[i] >= a[j] holds? clyybber: Araq: I think you must construct a new a clyybber: That has a[i] = oldA[j] and a[j] = oldA[i] clyybber: And have those as implications of the condition clyybber: So you would have a new copy of a that is the old one with (oldA[i] < oldA[j]) -> a[i] == oldA[j] and a[j] == oldA[i] clyybber: Basically invalidatingFacts about parts of a Araq: bbl Araq: clyybber, keep in mind that Z3 has native array support Araq: we can essentially map a[i] to Z3's a[i] and let it deal with it clyybber: ah, cool! clyybber: Araq: I think skipConv must be a little smarter. https://github.com/nim-lang/Nim/issues/13780 is caused by this: nkObjDownConv(nkObjUpConv(g.vm)) disbot: ➥ arc: codegen or inject destructor error ; snippet at 12https://play.nim-lang.org/#ix=2fZC clyybber: Where g.vm is a RootRef clyybber: And nkObjUpConv(g.vm) is a PCtx clyybber: And nkObjDownConv(nkObjUpConv(g.vm)) is a PPassContext clyybber: So ideally skipConv should skip both clyybber: But because it is "afraid" that the nkObjUpConv would loose too much information it doesn't skip it clyybber: Hmm, or maybe thats not the issue. Somehow a manual (PPassContext(PCtx(RootRef(g.vm)))) = nil works fine clyybber: Ha, think I found the culprit. skipConv skips nkObjDownConv and nkObjUpConv's too hastily clyybber: Araq: I wrote down my thoughts here if you want to take a look: https://github.com/nim-lang/Nim/issues/13780#issuecomment-606024178 disbot: ➥ arc: codegen or inject destructor error ; snippet at 12https://play.nim-lang.org/#ix=2fZC dom96: a virtual Nim conference huh dom96: cool dom96: Araq, what month/date were you thinking about? Araq: dom96, end of April? Araq: hmm no, too early Araq: talkers must have a chance to get prepared Araq: *speakers Araq: so ... I dunno, my birthday is in June... Araq: clyybber, I think I figured it out clyybber: Araq: The DrNim issue? Araq: if cond: a else: b can be translated to 'facts(a) or facts(b)' Araq: but it's much better to translate it into: cond -> facts(a) and (not cond) -> facts(b) clyybber: But we must tell it the condition somehow, right, otherwise we are too pessimistic clyybber: Yeah Araq: and then we should be able to prove the sorting operation Araq: likewise for 'case' statements Araq: we model the machine state completely by propositions clyybber: Yeah, thats the correct approach I'm sure Araq: for example, a = 3; b = 4 ==> a == 3 and b == 4 Araq: yeah, the state explosion could be bad though alehander92: Araq, is there a way Araq: if 'if' becomes an 'implies' I really begin to question our DFA with join points alehander92: to annotate a referece to a const object Araq: as we clearly want the "domination" information to be as easy to see as reasonable clyybber: You mean the DFA that we use in injectdestructors? Araq: yes Araq: it's fine for our 'wasMoved' analysis ofc Araq: but it might be the wrong data structure for DrNim clyybber: Oh, you use it there too? clyybber: I wasn't aware Araq: I don't but I considered it clyybber: ah clyybber: I think its fine. Since its a list when you go through it you can build up your info about the "current state" yourself clyybber: I think its fine as an underlying data structure Araq: maybe alehander92: it might be like `a: const A`: it would require for one to just pass a `const`or a parameter which was already passed as "const" alehander92: which seem enough to me, but i havent used enough c++ to realize all the probable problems :D Araq: would be nice if it worked because then we can continue to use 'return' and 'break' :P clyybber: Yeah, return and break must be usable alehander92: but this way it might look like a "const reference to non-const value" alehander92: which is not what i mean hmm dom96: Araq, I was thinking May alehander92: because my bug was location = process.location; await stuff(location) ... later another function actually works with changed location.path alehander92: i admit, with some code discipline this is probably obvious but after all we are into type checking alehander92: write tracking might be useful for more things like multiple refs i guess alehander92: but can it work without interfunction analysis alehander92: (and yeah in this case one might be able to use a non-ref object, but often this might not be the case) cooldome: Guys, hasDestructor(for tyRef) in compiler returns false in `--gc:arc` mode is this intentional? clyybber: cooldome: Hmm, I don't think so Clyybber: @cooldome Btw, I've investigated #13780 and wrote down the results there: https://github.com/nim-lang/Nim/issues/13780#issuecomment-606024178 . I think the core issue is a backend one disbot: ➥ arc: codegen or inject destructor error ; snippet at 12https://play.nim-lang.org/#ix=2fZC Araq: Clyybber: how can it be a codegen issue? shouldn't injectdestructors produce correct code instead Araq: backends are always allowed to introduce temporaries cooldome: @ clyybber. Thanks @clybber, confirmed if I define ref in type section hasDestructor() gives true, but if write "ref MyObj" in place I get hasDestructor() false. I will fix it Araq: cooldome: there are bugs left... narimiran: dom96: start of may is only a month away (yep, a rhyme); we (both organizers and speakers) will need more time than that to prepare, IMO Araq: we need to schedule a sound&hardware check 2 days before the conference dom96: narimiran, yeah, I was thinking late May dom96: Maybe early May we could have a practice run Araq: first week of June Araq: my suggestion dom96: sure, I'm happy with that clyybber: Araq: Its a codegen issue because the backend shouldn't be allowed to introduce temporaries here IMO clyybber: Since we are talking about lvalues here clyybber: Another option of course would be to disallow PCtx(g.vm) = nil clyybber: And patch injectdestructors Araq: maybe you're right Araq: lvalues are important, yes PMunch: Wait, are we having a virtual NimConf? Yardanico: yeah I saw that post too :P Yardanico: sad that I don't really have anything to talk about, but I'll at least enjoy all other talks :P Yardanico: and I hope it all gets recorded in good quality and put on youtube PMunch: Post? PMunch: I just saw someone talking about it here? PMunch: Ah, found it on the forum Yardanico: https://forum.nim-lang.org/t/6132 Yardanico: ye Yardanico: we really need a feature to pin important threads on top of the forum :P Yardanico: oh wait https://github.com/nim-lang/nimforum/pull/229 got merged, so I hope we'll also have categories soon alehander92: Yardanico does gdb work for you now Yardanico: just fyi the forum frontend is still running the version compiled by nim 0.18.1 Yardanico: (https://forum.nim-lang.org/js/forum.js) Yardanico: @alehander92 I didn't really test it since I don't really use GDB anyway, I just was curious back then alehander92: btw guys what about async lifetimes: something that async functions can check cooperatively to know if they need to drain themselves Yardanico: I might test it now though alehander92: i guess thats like cancellation PMunch: alehander42, you can pass in a distinct boolean as a cancellation token shashlick: are `typedef struct X` or `typedef struct X {}` valid C? Yardanico: https://en.wikipedia.org/wiki/Typedef#Examples Yardanico: oh wrong link sealmove: wow, for inheritance order of declaration in type section is significant clyybber: yeah, and for sets of enums too, but thats a bug clyybber: sealmove: Do you mean you cant inherit from a type that you havent yet defined? sealmove: yes, but I thought order under the same type section wasn't important. for example you can define a type that has another type (say X) as field and define X after it sealmove: Is is possible to make a destructor for a type that uses inheritance? sealmove: https://play.nim-lang.org/#ix=2g17 or https://play.nim-lang.org/#ix=2g18 don't work. sealmove: sorry https://play.nim-lang.org/#ix=2g1a * Yardanico: I don't think you need "var" for a "ref object" Yardanico: but I don't really know about using destructors with ref objs :) sealmove: `=destroy` only accepts var parameter leorize: https://play.nim-lang.org/#ix=2g1c leorize: @sealmove: ^ you gotta test it though :P sealmove: wow leorize nice! what's the difference between `A = ref AObj` and `A = ref object of AObj`? leorize: it's `ref T` vs `a ref object inherited from AObj` :) leorize: @sealmove: I'm not sure if `=destroy` is inherited, so you gotta verify if that's the case leorize: I'd recommend using devel because it has more fixes sealmove: I'm using devel anyway sealmove: this should work, but doesn't? what am I missing? https://play.nim-lang.org/#ix=2g1e leorize: @sealmove: it does work if you use arc leorize: looks like an stdlib bug leorize: I mean compiler bug? sealmove: I see leorize: it won't work if you try it with B though, so maybe a bug report for that too sealmove: I am sure Araq knows that ref objs don't work with destructors leorize: a bug report never hurts clyybber: hey clyybber: ref objects should work with destructors clyybber: but you need to define =destroy on the "dereffed" type leorize: clyybber: they don't appear to be invoked for the --gc:refc clyybber: ah clyybber: yeah sealmove: which gc then? clyybber: arc leorize: it works if you use arc, however not across inheritance, so a bug should be filed for that sealmove: btw where can I see all the --gc: options? sealmove: https://nim-lang.org/docs/gc.html seems outdated leorize: --fullhelp leorize: https://nim-lang.github.io/Nim/gc sealmove: oh thanks, both very useful! alehander92: PMunch yeah i guess i am doing something like that alehander92: but inside an object to have info like name alehander92: hey guys: if i decide to try to candidate for a talk for this online nim conf :D what would you want? 1) playing with a toy os with async primitives and "type checked" function-like processes 2) some kind of thing about our debugger env project 3) gara/pattern matching alehander92: btw why isnt rawWriteStackTrace public Araq: alehander92: 1 or 2 or both :-) ksandvik: If all this is recorded and published to YouTube, the more the better. alehander92: love it! alehander92: btw async cancellation: how hard is it to add this alehander92: i am interested in just being able to `.cancel()` a future and recursively cancel children but maybe this is somehow related to destructors alehander92: maybe thats what i heard last time, sorry for not remembering narimiran: @alehander92: all three, pretty please liblq-dev: is there *any* way besides procCall that a base method could be called instead of an inherited method? Araq: hardly, what's wrong with proccall liblq-dev: nothing, it's just that for some strange reason a base method is called where a child method should be Araq: then you failed to "override" the base method liblq-dev: right *here* in fact: https://github.com/liquid600pgm/rdgui/blob/master/src/rdgui/control.nim#L49 liblq-dev: it works everywhere except in this proc liblq-dev: the method is ctrl.width liblq-dev: (and ctrl.height too, but let's keep it down to one method because the issue is likely the same) Araq: strange, are you sure the Control is a Box? Araq: you can check via the 'of' operator liblq-dev: it's a Button, which is correct. liblq-dev: I checked via `ctrl of Button`, as you suggested Araq: well I only looked at the Box's width declaration Araq: where is Button's? liblq-dev: it's in a different file, https://github.com/liquid600pgm/rdgui/blob/master/src/rdgui/button.nim#L17 Araq: liblq-dev, you used 'proc' and not 'method' ;-) liblq-dev: oh crap liblq-dev: thanks liblq-dev: man, I wonder why bugs like this happen to me. every. single. time. Araq: liblq-dev, ask for linting support Araq: the compiler could issue a warning rayman22201: alehander92 Chronos has promises with cancel. Maybe investige switching async frameworks? leorize: so is chronos the to-go framework now? alehander92: rayman22201 but i dont want a split zetashift: @dom96 are you still using SFML for your Nim games? alehander92: narimiran no, thats a bit much :D dom96: zetashift: only for Ludum Dare, currently using sdl for my new game zetashift: ah okay moerm: Hello. I'm trying my irc client for the first time and hope it works/you can see me Yardanico: moerm: yeah, I can see you :P moerm: Thanks. moerm: I'm stupid with those messenger/chat thingies. discord fails to send the verif. email so I had to try irc moerm: I see the same content/discussion as on discord here, right? ksandvik: Yes. leorize: yes leorize: with a perk of being able to ping people with tab-completion :P moerm: Thanks (whatever "pinging" means on irc ...). I'm grateful for everybodies hand holding/help leorize: pinging on irc is just typing out their name :) moerm: So, it's like tab completion in the shell? Nice. moerm: afk (some minutes) ksandvik: AFAIK you can't see all the previous conversations in irc unlike Discord but you could use https://irclogs.nim-lang.org deech: Is this correct behavior for NimScript's `thisDir`? https://play.nim-lang.org/#ix=2g2V deech: In the above example even though `proc test ...` is in `/tmp/a` because it is imported by `/tmp/b/b.nims` `thisDir` prints `/tmp/b`. leorize: sounds like a bug deech: Great. Thanks. And is that the right way to import a nims file? deech: It seems to do that same as `include`. leorize: usually we just write nim code then import it as usual leorize: (ie. put them in .nim files) deech: How would you import a nim module in a relative directory? `import ../a/a`? Araq: yeah Rika: yeah Araq: leorize: hmmm not sure if I consider it a bug but tbh I don't know its documentation deech: Changed `/tmp/a/a.nims` to `/tmp/a/a.nim` and `import "../a/a.nims"` to `import ../a/a`. Same result. leorize: Araq: looks like not a bug? https://github.com/nim-lang/Nim/blob/1d665adecde3b3bf16e64068e83c0b3cb0171856/lib/system/nimscript.nim#L312 Araq: "Retrieves the directory of the current ``nims`` script file" leorize: or maybe :p Araq: works as documented, you cannot really have multiple .nims files Araq: there is only the .nims file that NimScript executes deech: Where does it say you can't have multiple nims files? leorize: well they mentioned renaming the imported module to .nim, still same result deech: And if that's true why is `import` supported in `nims` files? Araq: you named your other nim modules as .nims but that doesn't mean anything, you can also name them module.txt and 'import "module.txt" ' deech: Oh wait, so the idea is that you have a single nims file that import multiple `nim` files? Araq: exactly deech: Ah, ok makes sense. Then the second case where I changed a.nims -> a.nim and it still did the same thing is a bug, yes? Araq: I doubt it Araq: the compiler knows best what "the current nims script file" is Araq: could not import: X509_check_host Araq: gah leorize: more openssl issues :) Araq: already solved it deech: Suggest adding to the no-multiple Nims files somewhere in the docs. Araq: noted shashlick: has anyone made an easy azure pipelines or github actions setup for testing nim libraries across multiple versions? blackbeard420: is db_postgres threadsafe? i assume it is since DbConn just wraps a PGconn* Araq: yeah moerm_: Araq How can I get and build drnim to have a closer look and play with it (and hopefully can make some sensible remarks/suggestions)? moerm_: Araq - still here? leorize: he is rather busy with his work, so I won't expect answer to come out immediately :P moerm_: Thx leorize: what I do know however, is that you can test this out by cloning the araq-doctornim branch leorize: the tool can be built using `koch drnim` moerm_: I don't know git well. Could you give me a link to that branch, please? moerm_: (that I can put behind "git clone") leorize: if you already cloned Nim, then just get in the folder, run: git pull; git checkout araq-doctornim moerm_: Thanks, I'll try that. And when I did that I use 'koch drnim'? moerm_: (sorry but we use only fossil) leorize: after you have checked out the branch, build koch leorize: run nim c koch leorize: then run ./koch drnim moerm_: OK, thx. moerm_: Yuck, it clones and builds Z3 again (I already have it and it's not a small build). Oh well, git ... moerm_: - afk for a while - (but I will look later for new messages) moerm_: ... /Nim/compiler/vmops.nim(105, 10) Error: cannot open file: std/compilesettings leorize: try bootstraping the compiler first leorize: ./koch boot -d:release leorize: then do drnim moerm__: OK. Thx moerm__: Same error moerm__: (I'm in ... git/Nim created by cloning Nim) Recruit_main707: maybe not :p i do cant Recruit_main707: (is that well written?) Varriount: @Recruit_main707 hm Varriount: @Recruit_main707 identifiers in Nim ignore underscores, that may be why KingDarBoja: It is possible to convert a string like "\x07" into raw string? Tried using repr("\x07") but yields 0x7f59df3e8080"\7" while $"\x07" yields . I want to get the raw value. Rika: r"\x07" Rika: i think Rika: yeah thats it KingDarBoja: But let's said it is a parameter to other function, how I can turn that string without changing the source? KingDarBoja: convert* Rika: no clue actually Rika: i dont think non-string literals can be raw exelotl: a string is only passed as raw if there is no space between the proc and the string exelotl: i.e. `echo"hello\nworld"` is different to `echo "hello\nworld"` Rika: huh. thats good to know qbradley: Is it possible to have a branch of an object variant with no fields? leorize: @Recruit_main707: you can't because Nim identifier can't start with an underscore leorize: qbradley: yes, put discard in that branch qbradley: ok thanks qbradley: it works. perfect! awr1: what does ctoring a `ref object` do (e.g. `SomeObject(foo: 1, bar: 2)`, if `SomeObject` were defined to be `ref object` in the type) does it implictly call `new`? Rika: nope Rika: ah wait misunderstood Rika: hm, im not sure what happens to the contents Rika: yes it works awr1 Rika: it's implicitly `new`'d it seems awr1: thanks KingDarBoja: "i dont think non-string literals can be raw" yikes! Rika: i honestly dont know okay KingDarBoja: I know, just reacting 😛 leorize: KingDarBoja: non-string literals can't be raw? what does that even mean? disruptek: depends on who is uttering them, usually. Rika: you should ping me lmao Rika: also i mean if its not a literal string i dont think you can make it raw exactly since there are many representations no? leorize: "raw" string is a properly of Nim source code :p leorize: property* disruptek: i can make it as raw as you want, sweetheart. KingDarBoja: I am getting sick of trying to handle strings, chars and unicode stuff xD as Python handles all of them as string type disruptek: show off. disruptek: ima stream some more obs plugin stuff for an hour or two. leorize: a lot of languages like to impose that strings must contain valid text KingDarBoja: For example -> "\uFEFF foo" length is 7 on Nim whereas in Python is 5... Rika: shouldnt they? Varriount: @KingDarBoja https://nim-lang.org/docs/unicode.html#runeLen%2Cstring KingDarBoja: Intriguing... Varriount: Nim strings use bytes for indexing (as that is the fastest method, and generally works). For UTF encoding, the unicode module should work. Varriount: Otherwise, `s[i]` would have to iterate through the whole string to find out which rune is at that index. Varriount: You'll notice that only ascii specific stuff is in strutils KingDarBoja: 🤔 Varriount: @KingDarBoja For example, https://nim-lang.org/docs/strutils.html#count%2Cstring%2Cstring%2Cbool Varriount: works with any encoding, assuming that your arguments are all the same encoding Varriount: @KingDarBoja What are you trying to do? Could you show your code? KingDarBoja: I do rather push my changes and share the repo as I mentioned before, doing Graphql port from Python into Nim Varriount: Huh, interesting KingDarBoja: Right now at the lexer, which is "done" KingDarBoja: But not really lol as the tests aren't passing at all KingDarBoja: Give me 10 minutes... KingDarBoja: https://github.com/KingDarBoja/Phosphate there you go, the main issue right now are the first two tests on test_lexer.nim Varriount: They are failing? KingDarBoja: Kinda, "Disallows uncommon control characters" one does work but not as it should be as I had to change the message slighty to match the one from the ValueError Varriount: Line 32 looks redundant/not needed, unless your input source isn't containing the hex character `\x07`, but the actual string represented by `'\' & 'x' & '0' & '7'` KingDarBoja: The next one "Accepts Bom header" is the unicode related, struggling with it due to my lack of knowledge Varriount: Sorry, line 33 KingDarBoja: I see... to be fair, the correct message should be "Cannot contain the invalid character '\\x07'." KingDarBoja: Notice the raw string being outputed instead of '\\7' as it does now :/ KingDarBoja: at the output* Varriount: A raw string literal is a string literal in which escapes aren't processed (as in, what the programmer writes is what will be in the string). KingDarBoja: Just as reference to the source tests -> https://github.com/graphql-python/graphql-core/blob/master/tests/language/test_lexer.py#L33 Varriount: Where's the entry point for the lexer? KingDarBoja: There is none atm, just building the modules one by one Varriount: Generally, you just explicitly check for the BOM Varriount: Then, you use that with your lexer to rearrange the bytes as they are read. KingDarBoja: I don't understand what are you saying mate Varriount: Hm Varriount: Do you know what the byte order mark signifies? KingDarBoja: Think like I just want to get the lexer.py file and convert into lexer.nim ,that's it KingDarBoja: Oh yes Varriount: Can you show me the original python source? KingDarBoja: Sir, yes sir -> https://github.com/graphql-python/graphql-core/blob/master/src/graphql/language/lexer.py Varriount: So this: https://github.com/KingDarBoja/Phosphate/blob/master/src/language/lexer.nim#L122 Varriount: I just see an anime character KingDarBoja: I see my old profile pic, anyway, continue sir with the lesson 🙂 Varriount: @KingDarBoja Are you familier with the size of a character type vs the size of a unicode rune/glyph/etc? KingDarBoja: No, I think that's what you explained few comments ago with the unicode lib vs len() KingDarBoja: But I assume you are being more technical Varriount: So, text data has to be encoded in some way - the characters we see have to have representations as actual data. Varriount: Some encodings encode a character (such as 'a') in using 8 bytes of memory, 16 bytes of memory, or 32 bytes of memory Varriount: Some encodings might represent the character 'a' as the number '61' in memory Varriount: Some might represent 'a' as 1 Varriount: It's up to the program to interpret this data correctly. Varriount: The most common encodings are ascii, UTF8, UTF16, and UTF32. KingDarBoja: Yes Rika: ~~utf8 is variable byte count encoding~~ Varriount: Yes, and some encodings may use a different number of bytes to represent different characters. Varriount: Now, it's important to know the difference between a character (the letter) and char (the data type). Varriount: A character is an abstract representation of a piece of text, separate from encoding. Varriount: A char is a data type, usually composed of 8 bytes. Varriount: When you use `stringVar[i]` in Nim, you are saying, "give me the i'th char in the string" Varriount: When you use `unicode.runAtPos(stringVar, i)`, you are saying, "give me the i'th utf-8 character in the string" Varriount: The reason these are different is that utf-8 is a variable-width encoding. In order to find the i'th utf-8 character in the string, you first have to find the length of the first character, then the length of the second character, etc. disruptek: who was working on a wlroots wrapper? KingDarBoja: Ah... Varriount: It's like trying to find the i'th word in a sentence. You can't just say "the 4th word is always going to be here", because words vary in length KingDarBoja: Just tested what you said... KingDarBoja: var b = "ánt text" -> echo b[0] yields some � whereas echo runeAtPos(b, 0) yields "á" Varriount: Yes, becuase `á` is represented by more than 1 byte KingDarBoja: I thought char was taking care of that but was wrong Rika: this aint python Varriount: Python essentially uses `unicode.runeAtPos` for everything. While this makes it easier for programmers to work with textual data, it slows down string access. Varriount: And/or makes strings take up more space, depending on the version of python you are using. KingDarBoja: I know, these kind of assumptions are the reason I get confused KingDarBoja: That was a great explanation, indeed Varriount: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8 Varriount: I would suggest reading through the unicode module and Wikipedia, and posting any question you have here. Varriount: I'm not an expert with that module (or with utf-8), but I can try my best. KingDarBoja: Essentially I am getting the character but without taking into account the rune itself KingDarBoja: But got another question based on that, does that take care of hex values, the ones with "\xHH"? KingDarBoja: https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals Varriount: What do you mean by "does that"? KingDarBoja: Unicode only takes care of "\uHHHH", right? Varriount: A Unicode character can be represented by "\uHH", just not all Unicode characters. KingDarBoja: And the hex values are handled differently, I assume (i.e. "\xHH") Varriount: Rika: Any idea how "\uFEFF" translates to 3 bytes instead of 2? Varriount: @Rai Nathan Famakai II Varriount: @Rai Nathan Famakai II Varriount: @Rika Rika: oof rip other dude Rika: one moment KingDarBoja: lol Rika: hm Rika: because `\uFEFF` is not `\xFE\xFF` im inferring Rika: `\uFEFF` is 3 bytes as 3 "unicode bytes" can hold 2 "data bytes" Rika: a few bytes are used to determine length and "continuation bytes" Rika: `s/few bytes/ few bits` Rika: @Varriount @KingDarBoja Rika: https://en.wikipedia.org/wiki/UTF-8#Description you can see here Varriount: Ah, gotcha Rika: `\uFEFF` means that whatever the data bytes would be, the data `FEFF` would be in them on read Rika: so `1110 F | 10 E F[part1] | 10 F[part2] F` im assuming is what it would look like Rika: so `1110 1111 | 1011 1011 | 1011 1111` disruptek: fwiw yuri has a wayland lib disruptek: !repo wayland disbot: https://github.com/yglukhov/wayland -- 9wayland: 11Nim bindings for wayland 15 5⭐ 1🍴 7& 1 more... Rika: oh wow disruptek: i plan to write something to scale surfaces using it. shashlick: Can't do anything without a laptop leorize: disruptek: lqdev[m] is working on that kungtotte: disruptek: I don't think I'll be using nimph. There's just too many headaches at this point. I'm playing around trying to see how to fix all the issues I'm having and now it won't even let me install version-pinned packages. A plain requires or a minimum version works fine, but pinned packages errors out with "tried to clone into but it already exists". Benumbed: Could I ask for a second pair of eyes on this code? I'm trying to write a dispatch table for RPC methods coming in over the wire, only what I thought would work, doesn't.... Benumbed: https://play.nim-lang.org/#ix=2fR5 Varriount: @Benumbed I can take a look Benumbed: Thanks... Benumbed: I think my C/C++ experience may be pushing how I think about this in the wrong direction? Benumbed: (more C++ than C, I haven't written C in years) Varriount: @Benumbed: From what I'm observing, Nim is determining the type of the map by the type of the first keys Benumbed: Yeah except the type should be a ref to AMQPMethodObj Varriount: And the type of the first key is `(int, proc (stream: Stream): ConnectionStart {.....})` Benumbed: ConnectionStart refers back to AMQPMethodObj though Varriount: The type of the second key is `(int, proc (stream: Stream): ConnectionStartOk{.....})` Benumbed: ConnectionStart->AMQPMethodObj->AMQPMethodObj Benumbed: ConnectionStartOk->AMQPMethodObj->AMQPMethodObj Varriount: Two children of a parent type aren't directly equivalent. Varriount: You have to create a container with their common parent type Varriount: Also, two procedures that return different types *might* always be unequivalent? I'm not sure. Varriount: (or is it inequivalent?) Benumbed: No idea heh Benumbed: So this isn't going to work like passing pointers to objects around in C++ as a pointer to their parent type? Benumbed: (you have to cast the pointer to get the child-type back at the end) Varriount: Hm, one moment Varriount: https://nim-lang.org/docs/manual.html#types-tuples-and-object-types Varriount: "Different tuple-types are equivalent if they specify the same fields of the same type in the same order. " Benumbed: 🤔 Varriount: The `{...}` construct is syntactic sugar for a sequence of tuples Benumbed: Yeah, I'm trying a different way of packing values into the Table Benumbed: that doesn't involve tuples, but it uglier Varriount: I can't find anything in the manual stating equivalence of procedural types, but I know that you couldn't do something like this if there were arguments. Varriount: Why do you need a map of methods? Benumbed: So I'm writing a client library for the AMQP protocol, and AMQP is basically RPC over the wire. What I get back is a class ID and method ID that tell me what method the server wants to call. The rest of the data that follows those IDs is, essentially, the arguments to pass to the method Varriount: Hm. Benumbed: What I want is a dispatch table which will map those IDs to actual methods that get called Benumbed: Because it simplifies things Varriount: Do the dispatch methods read arguments from the stream? Benumbed: And all the data structures that get returned inherit from the 'AMQPMethod' structure Varriount: And how are return types handled? Benumbed: They read the raw values from the network yep (I basically read from a sock, and shove that into a StringStream) Varriount: Do you know the entire set of methods at compile time? Benumbed: I mean the spec is a static list of methods, so... yeah I think? Varriount: Ok. And what will be done with the return type (AMQPMethodObj)? Varriount: Sorry for the questions, but it helps to have a good picture of what the goal is. Benumbed: No, no problems at all Benumbed: The return type is basically just the collected data from the server, packged into a datastructure that looks like the spec Benumbed: Hang on, I'm tired and I need to re-think my wording Benumbed: I may be over-thinking this Varriount: Is there a reason the dispatch methods can't write their result to a stream? Benumbed: I mean theoretically they could, but there can be many open channels, all handling RPC calls + data Benumbed: I think I need to sit down and draw this out Benumbed: Because I'm no longer certain I have the right design here haha Benumbed: Yeah I need to re-think this, thanks @Varriount 🙂 Benumbed: There may still be a need for a dispatch table, but not in this scope Vindaar: @Benumbed: this *might* work: https://play.nim-lang.org/#ix=2fRd Vindaar: I'm not experienced with inheritance in Nim though. I think wherever you use the resulting type then you have to convert it to the correct type Benumbed: Yeah I have no problems casting it to the correct type, and yeah that might work, although after chatting with Varriount, I'm re-thinking my approach, I think was over-working the problem, and I may not even need methods that return anything Benumbed: Which, in that case, makes said dispatch table very straightforward Vindaar: all the better! Benumbed: It's honestly nice to have a community to bounce stuff off of that doesn't take off the top of your head when you're doing something dumb 😄 Vindaar: I agree. Certainly also one of the reasons I stuck with Nim Zevv: https://abe-winter.github.io/2020/03/28/jitu-brutus.html: "If you don’t know what a JIT is skip to the appendix or better yet, pick up Nim or something and never learn" Benumbed: Yep, I've had my hands on my fair share of languages in my time and I really like Nim for many reasons Benumbed: Now if only I could swap Nim and Go for number of jobs available hahaha Vindaar: @Zevv: haha. Although in isolation that sentence can be read as if to say people using Nim are dumb Benumbed: (Writing Go makes me sad, using Go's package management system ends up with me having steam coming out of my ears) Benumbed: lol yeah, in context it's a lot more flattering of the language 🙂 Varriount: Really? I haven't had much trouble with Go's package system Varriount: I take it that it really improved once modules became a thing, though I have no experience with the system before that. Benumbed: Modules have helped a ton, although I haven't touched it much since 1.13 came out and made them 'official' Benumbed: Before that it was a hot mess Benumbed: And that's coming from someone with a decade+ of Python experience... and _that_ is a screwed up packaging ecosystem Varriount: Benumbed: From what I can gather, it's much like NPM/Yarn now - each project has it's own library of dependencies Benumbed: Yep Varriount: @Benumbed Oh man, I feel you. It feels like you need an astrophysics-level degree to actually do packaging right in Python. Vindaar: > astrophysics-level degree ⏎ I speak from experience. That doesn't help at all :P Benumbed: I started learning Go to expand my job horizons (C++ and Python are my major ones atm), then I got moved to a new team at work because my expertise was apparently sorely needed, although I did not know NodeJS, which is what this team uses, so I have been learning: Go, NodeJs and Nim, all at the same time Benumbed: Leading to some code mistakes that can be quite amusing Benumbed: and yes Python packaging is _mental_ Varriount: I like Go because of it's simplicity - being able to just take a pointer to a object/struct and not have to worry about memory safety is nice - but it also tends to be overly conservative. Benumbed: Agreed, it's got some _weird_ ideas about syntax too Benumbed: I found it hard to read at first, but that's just a learning cuve, I can read it just fine now Varriount: I would love overloading (or at least default/optional parameters) Benumbed: I should have started a list last month when I was working more in it Varriount: It makes me cringe whenever I see that pattern where the constructor takes a variadic number of closures Benumbed: Almost every day I was like "Who on earth made _that_ decision?! WHY?!" Varriount: Like `thing := NewThing(OneOption(value), TwoOption(value), ThreeOption(value))` Varriount: Because I know what actually has to be done in order to support that pattern behind the scenes. Varriount: (The answer is closures and heap allocations.) Benumbed: bleh Benumbed: Oh that is one thing I do like about Nim Benumbed: the let vs var stuff Benumbed: despite how confused I get with JavaScript Benumbed: let means I'm doing stack allocations, var means heap Benumbed: it makes it very easy to see, at a glance, where my memory is coming from Varriount: Eh.. not really? Benumbed: Really? dammit, did I get something confused again? Varriount: `let` just means the variable's value can't be changed. For objects, that mean's the object can't be modified, and for references, that means the reference can't be changed (but the memory it references can). Varriount: @Benumbed If you want a (mostly correct) guide to where something is allocated: Varriount: - Is the variable a reference type? It's on the heap. Varriount: - Is the variable an object type? It's on the stack. Varriount: - Is the variable captured by a closure? It's on the heap. Varriount: That last one supersedes the first two. Benumbed: That's actually quite helpful Benumbed: See I remember reading about how types influenced allocations, but I think it got corrupted at some point Benumbed: Which, given I'm learning 3 new languages, was probably bound to happen, servces me right 😄 Varriount: Of course, if you access an object type through a reference, it's also on the heap. Benumbed: yeah Varriount: And var types can be on the heap or stack (I think. Certainly they can be on the stack). Varriount: Sorry, by `var` I mean `proc add[T](s: var seq[T], T)`. Benumbed: That makes sense, since, in my mind, you're just getting a safe pointer to the data with that Benumbed: rather than a read-only copy Benumbed: copy may be the wrong word Benumbed: ugh I need to go to bed, my brain is not cooperating anymore Varriount: Sleep well. 🙂 Benumbed: Thx! Nice chatting with you 🙂 Vindaar: good night! gogolxdong: Is there anything to take care of when accessing global seq from async proc with arc? Varriount: gogolxdong: Make sure two async procedures accessing the sequence at the same time so so without race conditions gogolxdong: crashes randomly. gogolxdong: It crashes at echo the seq.len randomly. Varriount: gogolxdong: Do you have range checks and stacktraces on? Varriount: What does the sequence contain? And have you tried running the program with GDB? gogolxdong: Does release close these checks? I'm using release. gogolxdong: contains ref object Varriount: Depends on the version of Nim you are using. I believe the latest version keeps range checks on, but turns stack traces off kodkuce: when copile nim cna i suppress hints kodkuce: its sometimes anyoing while debuging Varriount: try using `-d:release --stacktrace:on --linetrace:on` gogolxdong: --hints:off kodkuce: yep just duckduckit was blind Varriount: Or, if you want to use GDB, use `-d:release --stacktrace:on --linetrace:on --debugger:native` gogolxdong: `Traceback (most recent call last) ⏎ httpbeast.nim(287) eventLoop ⏎ httpbeast.nim(219) processEvents ⏎ asyncmacro.nim(313) onRequest ⏎ asyncmacro.nim(34) onRequestNimAsyncContinue ... [https://gitter.im/nim-lang/Nim?at=5e80752eceb76448184266f2] kodkuce: am not really debuging by debuger am just consol login it gogolxdong: the same with what I have. Varriount: Looks like either the sequence is nil, or an element in it is nil Varriount: I can't tell much without examining the code. gogolxdong: sequence is not nil by default? it crashes at the line of echoing sequence length. Varriount: Hm, then something is off. Can you show me the code? gogolxdong: https://play.nim-lang.org/#ix=2fRA gogolxdong: It compiles with a httpbeast based websocket library. gogolxdong: Do you need it? Varriount: Try initializing the sequence explicitly Arrrrrrrrrrrrrrr: Hello there. Is it possible to preserver the ast structure when printing it to str? https://play.nim-lang.org/#ix=2fRN Arrrrrrrrrrrrrrr: *preserve Varriount: Do you mean preserve the original formatting of the code? Arrrrrrrrrrrrrrr: That is Varriount: No. Formatting information isn't encoded in the AST Arrrrrrrrrrrrrrr: Uggh. Thanks anyway, see you. gogolxdong: not the cause, still crashes when I refresh browser which establishes new connection to server. gogolxdong: do you mean var clients = newSeqClient () by explicitly? Varriount: Yeah gogolxdong: doesn't get it work. Varriount: Hm Varriount: I notice that your procedure is annotated with gcsafe, even though it isn't. Varriount: > We call a proc p GC safe when it doesn't access any global variable that contains GC'ed memory (string, seq, ref or a closure) either directly or indirectly through a call to a GC unsafe proc. gogolxdong: sure, but how to get it working without gcsafe enforcement. Varriount: Pass the sequence around in a central server object? kodkuce: hi, am scraping some site want to make some food died for me 🙂 , so duno why but i noticed that xml.querySelectorAll(".row-hover tr") is destroying 1 coulmn for just 1 row in 925 rows, i think its a bug, cuz when i echo just get request with | grep Krast kodkuce: kodkuce: https://www.tablicakalorija.com/povrce/krastavac-oguljen.html">Krastavac, oguljen122,160,590,16Povrće kodkuce: kodkuce: but after doing xml.querySelectorAll(".row-hover tr") i get those rows but just for this row it disapires column-3 for some reason kodkuce: https://www.tablicakalorija.com/povrce/krastavac-oguljen.html">Krastavac, oguljen122,160,590,16Povrće kodkuce: var client = newHttpClient() kodkuce: var g = client.getContent("https://www.tablicakalorija.com/") kodkuce: echo g kodkuce: let xml = parseHtml(newStringStream(g)) kodkuce: echo xml #here its allready broken kodkuce: duno form where this %22 came i just copy pasted but if anyone wants to check it should be whitout it just dot com Varriount: Please don't post code in the chat. Use a pasting service like gist kodkuce: want me to repost with gist or something? kodkuce: or just for future 🙂 Varriount: Just for the future Varriount: If it's a bug, the file an issue and (ideally) find a fix kodkuce: http://ix.io/2fRT can someone just confirm so i dont open for nothing Varriount: Are you downloading HTML, or XML? kodkuce: html i think kodkuce: hmm 🙂 kodkuce: does nim have seprate html parser 🙂 kodkuce: lol kodkuce: but ye i am using htmlparser kodkuce: i just named it xml for some reason Varriount: It looks like a bug. I don't know enough about HTML to be certain kodkuce: np i in no hurry will recheck myself too Varriount: I'd run the website's HTML through a validator to check that it's valid kodkuce: curl gives normal output and echo g gives normal output (at least for manualy reading that coulmn) too so i think it brokes with htmlParser, go|dfish: the html is broken, there is no closing tag kodkuce: where Varriount: Curl doesn't parse HTML, does it? It just grabs data from a URL kodkuce: https://www.tablicakalorija.com/povrce/krastavac-oguljen.html">Krastavac, oguljen kodkuce: yep you right kodkuce: dude probbaly dumped this in DB as a text kodkuce: ok sorry my bad kodkuce: or his bad 🙂 go|dfish: well it may not be your bad, i tried that broken html with 'lxml' and python's beautifulsoup just to test, and they both add in the tag but keep the correct amount of columns - so perhaps it could still be classified as a "bug" kodkuce: that is probbaly a feature and not a bug, like fix broken a tags before try parse 🙂 go|dfish: yeah, quite possibly PMunch: Hmm, dadada, you on? Varriount: go|dfish: It's the question "how hard do we want to parse bad input?" Varriount: go|dfish, @kodkuce See also https://devblogs.microsoft.com/oldnewthing/20200304-00/?p=103527 go|dfish: Will check it out - thanks kodkuce: 🙂 krux02: Araq: Does it feel satisfying to close my PRs with far fetched reasons? dom96: :/ kodkuce: uber dumb question duno if i am blind but how to remove all whitespaces form string, i am scroling strutils up and down but i think i am blind kodkuce: guess i can use replace but then would need 3 time for newlines and similar, tough in my case i have only " " so guess that would do krux02: kodcuce, probably with `filter` Varriount: krux02: Is this about the unexported fields PR? narimiran: `replace(" ", "')` Varriount: @kodkuce: https://nim-lang.org/docs/strutils.html#multiReplace%2Cstring%2Cvarargs%5B%5D kodkuce: yep i used that narimiran , touqh did you misstype last " and wrote ' insted narimiran: of course krux02: Varriount: yes it is. Varriount: krux02: I mean, there are valid points for keeping those members. Wouldn't their removal affect compile-time sizeof? krux02: Varriount: that is exactly what I explained krux02: compile time sizeof is not affected by the fields of types imported from C. Varriount: I mean, in a macro, or compile-time proc Varriount: I get that the generated C code will use the C compiler's `sizeof`, but aren't there (admittedly few) cases where sizeof needs to be known in macros, etc? gogolxdong: How to implement object pooling with arc? gogolxdong: Will it be issue-free like using array of ref object instead of sequence? Varriount: gogolxdong: Do you need object pooling? Memory allocation is fairly fast gogolxdong: Only if it can solve my problem. gogolxdong: There isn't any document about this , is it? Varriount: gogolxdong: I think your problem is that you are accessing globals from a section of code marked as gcsafe Varriount: And gcsafe code isn't supposed to access globals gogolxdong: array won't be gc'ed right? Varriount: Well, yes gogolxdong: Does it count as object pooling? Is there a pattern of doing so, or just make it array? Varriount: Just make an array, and have some flag in an object that shows whether it's in-use or not. Varriount: But you can't reallocate an array Varriount: krux02: Are these failures, or warnings? I can't tell - https://github.com/nim-lang/Nim/pull/13793/checks?check_run_id=542534454 disbot: ➥ unify tuple expressions krux02: Varriount: They are failures. krux02: I am currently looking into them. krux02: The failure in ast_pattern_mathcing I thought I fixed. On my machine I don't get a problem anymore. krux02: That one was also an expected failure, because I had a test in there to ensure the AST doesn't change (so that I know if the ast changes and can adopt). krux02: easy fix. Varriount: I don't suppose there's a way to make the change backwards compatible? dom96: yay, glad my repro is useful dom96: I was afraid I'd be told "You're using it wrong" krux02: dom96, what repro are you talking about? gogolxdong: How to construct derived object variable from base object variable , say `type Client = ref object of AsyncWebSocket`, I have `var ws: AsyncWebSocket`, how to build `var client:Client` dom96: krux02, #13794 disbot: https://github.com/nim-lang/Nim/issues/13794 -- 3hashset regression ; snippet at 12https://play.nim-lang.org/#ix=2fOK PMunch: Hmm, what do you guys use for streaming? krux02: PMunch, twitch krux02: and obs studio PMunch: Have they relaxed their "only games" policy? dom96: that hasn't been a thing ever since I can remember Recruit_main707: i used streamlabs obs, and even though its very intuitive, its very consuming. so probably obs studio is the best option Recruit_main707: btw is version 1.1 devel? dom96: yes Varriount: PMunch: I listen to disruptek's stream Recruit_main707: how much do you calculate for 1.2 to be released? Varriount: He works on the compiler. PMunch: dom96, I'm pretty sure that was a thing in the beginning.. PMunch: Varriount, oh cool PMunch: I was just considering to stream me hacking on something, for lack of anything better to do Varriount: PMunch: I'd listen to it. Varriount: Though, I might not watch it. Hard to watch video and program at the same time. Varriount: What are you thinking of doing? PMunch: Probably trying to fix some of the issues dadada brought up about macroutils Varriount: PMunch: Well post a link when you get things up and running PMunch: I wont do it just yet, have to go out and shovel some snow first :P dom96: ahh, would love some snow right about now PMunch: You can have some of ours.. PMunch: I can barely get out the front door because of all the snow Varriount: Meanwhile, the weather roulette has decided to grace the East coast of the US with traditionally seasonal weather for once. Varriount: (Cool, with mild rain showers) disruptek: in new york, it's raining men. zetashift: Hallelujah? dom96: nooo, don't put that song in my head zetashift: just let it in dom96 Zevv: dom96: you don't really care for music, do ya? disruptek: zevv lives disruptek: dude, let's build some corona badges running nim. dom96: so, good news, my game can handle 60 fps on Android. All I needed to do was build in release mode and add `APP_OPTIM := release` to my Android.mk file :) PMunch: Nice! PMunch: What phone though? dom96: One Plus 3T PMunch: Good, it wouldn't be that impressive if it was a top-tier flagship :P dom96: It gets an avg frame time of 12ms, so there should be room for older phones. Jumps up to 18ms when the camera zooms out, I'll be optimising that. dom96: The next challenge: getting it to work with --threads:on so I can have ads in the game dadada: PMunch: I'll test any updates to macroutils you make, this graceful extract feature, that either returns a value to see if the input was extractable or not, or is usable inside an if-else-branch, would be really nice, sadly I didn't make much progress doing it myself, cause I get distracted a lot :-) PMunch: I think it would need to take a block though PMunch: Because of scoping things dadada: can there be an else: at the end of the block? so either it executes the inside of the block, if the stuff got extracted, or you land in the else part and do something else with it (including repeating extractif with different ideas) PMunch: Sure PMunch: Well, it will be another do block PMunch: It would look like this: https://play.nim-lang.org/#ix=2fTd dadada: PMunch: to be useful, I think the thing needs to either find all the required (quoted) bits, or fail, if it's something in the middle, the user/coder would always have to check what's there and what aint there and what else there's potentially needed to parse based on that dadada: oh man, timeout leorize: dom96: now I see why threading is evil :P dom96: You couldn't see that before? timotheecour: hi @dom96 timotheecour: can you please try https://github.com/nim-lang/Nim/pull/13800 and see if it fixes your problem? dom96: Looks like it does dom96: Tested it with my game and there is no perf degradation timotheecour: awesome timotheecour: thx for the reproducing example and sry for the regression axion: That was a short debug, repro, fix, and merge lifetime. Nice work dom/tim rishavs: Hi. How would I set a seq as an object attribute? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e80daa649e7a8130cd7ae27] liblq-dev: @rishavs `seq[Directions]`, not `newSeq[Directions](4)` liblq-dev: if you want a statically-sized array, use `array[4, Directions]` rishavs: Thanks! liblq-dev: because `newSeq[Directions](4)` creates a new sequence with the size of 4 liblq-dev: and `seq` is a type rishavs: the seq can have anything from 0 to 4 items so I think i should stick toseq liblq-dev: use whatever suits you best. reversem3: How would you do a link list in nim ? reversem3: * How would you do a linked list in nim ? I'm (learning) from C to nim Varriount: reversem3: Use a reference type to refer to itself shashlick: there's a lists module shashlick: see how it works reversem3: ahh ok very cool thanks reversem3: so *head -> blockdata would be a type Node = ref Object firstBlock: head ? reversem3: or is it like this https://github.com/def-/nim-unsorted/blob/master/linkedlist.nim exelotl: gonna re-post this userscript I made the other week: https://gist.github.com/exelotl/c0c4b79932d977869811e518b2198b8c exelotl: it's been coming in super handy to me lately, cause search engines always take me to the stable docs Rika: You can always just make a chrome search engine Rika: Or a Firefox bookmark with keyword Yardanico: @exelotls there's also a very great extension not a lot of people know about - https://chrome.google.com/webstore/detail/module-linker/dglofghjinifeolcpjfjmfdnnbaanggn?hl=en Yardanico: It supports Nim too, for both stdlib (although not for some new stdlib modules), files in same project or nimble Yardanico: also no support for /[] import syntax, but I guess we can send a PR to add that Yardanico: also no support for "import except" :D Yardanico: it looks like that - https://i.imgur.com/r2D4QPo.png Yardanico: and if you click it sends you to that module's github page, and for nim stdlib - to nim docs exelotl: ohh that's cool Yardanico: seems it's also available for firefox - https://addons.mozilla.org/en-GB/firefox/addon/module-linker/ Yardanico: https://github.com/fiatjaf/module-linker no updates since sept though zetashift: is it stable enough that it needs no updates? PMunch: reversem3, I saw you asking about linked lists earlier. If you are coming from C I just wanted to let you know that the more Nimian solution is to use a seq or sequence instead. Linked lists should really only be used if you actually need some very specific performance characteristics. Guest60132: PMunch: (you didn't disconnect, this is a repeat from earlier) to be useful, I think tryExtract needs to either find all the required (quoted) bits, or fail, if it's something in the middle, the user/coder would always have to check what's there and what aint there and what else there's potentially needed to parse based on that PMunch: Ah yes I saw that, that was indeed the plan PMunch: Anything else would just be silly PMunch: Hmm, I have something that start pulseaudio and keeps restarting it when I kill it PMunch: But I'm not sure what.. Yardanico: your DE :P PMunch: I don't have one.. Yardanico: hmm, strange, pulseaudio usually starts when a DE starts it or some program which uses PulseAudio is launched PMunch: Yeah, I'm not quite sure what's going on here.. Zevv: aaah pulse, one of the loves of my life Yardanico: Zevv: you forgot the /s :P Zevv: the other ones are systemd and network manager Benumbed: gross Zevv haha PMunch: Always such a massive pain in the ass.. Zevv: Interestingy enough 2 out of 3 are by the same author PMunch: brb Zevv: one can not simply kill pulseaudio Zevv: one needs to use pasuspender Yardanico: I have Void Linux (no systemd), so maybe I should try not using PA too, it shouldn't be too hard because I've already tried before Zevv: I've been fighting audio on linux for decades Zevv: I'd really prefer to run jack for everything, but it's not widely supported Zevv: and there are apps these days that run on pulse only Yardanico: well, for alsa there's apulse Zevv: so you need pulse, and pulse does not go together with jack clyybber: acktually leorize: PMunch: if you have anything that requests pulseaudio it will keeps respawning leorize: edit /etc/pulse/client.conf and turn off autospawn clyybber: I'm using pulseaudio alongside jack regularily clyybber: and it was working happily PMunch: Ah, it should be fine now PMunch: Just needed the ol' reboot clyybber: but one day it started to fuck firefox up clyybber: pulseaudio isn't in the same league as systemd or networkmanager imo leorize: I'm waiting for pipewire clyybber: its way better clyybber: leorize: Yeah pipewire looks promising leorize: jack is nice and all, but pulseaudio just works :) clyybber: jack just works too Zevv: until you want to do something serious with sound Yardanico: or play osu! :D leorize: jack works after a lot of tweaking and tuning the parameters :) clyybber: eh leorize: also the docs are lacking Yardanico: (osu! is a rhythm game so lower the latency -> the better, ofc you have to change the offset ingame if your latency is not 0ms) clyybber: tuning the buffer size and stuff isn't gonna be helped by pipewire I think Rika: oh no heres the osu dude clyybber: said the other osu dude Yardanico: I only have 2800pp, not really a good osu! player Rika: i dont even have 2k Rika: though i have 5k on ctb Yardanico: wtf leorize: I stopped playing before pp was a thing :) Zevv: I sometimes use ninjam for jamming over the internet. I was never widely used but over the last weeks it suddenly got pretty popular at once for some reason. It has a nice way of handling latency: it just delays all sound for a number of beats, and sends every individual track to all other participants after the round. I've been trying to explain the mechanism to my band mates, but they just can't see how it Zevv: works :) Yardanico: leorize: they're in the process of making an entirely new osu! client rn (osu!lazer), which is fully crossplatform (still written in C# and uses .net core) clyybber: why are there so many osu clients clyybber: I believe theres even one in nim leorize: I saw it, and I found out that I'm still bad at osu! :p Yardanico: well they're not exactly "osu clients" Yardanico: there's only 1 official one, and one in the works (osu!lazer), all others are technically osu! clones and not clients :P Yardanico: @clyybber AFAIK there's only my osureplay lib for parsing osu! replays in Nim clyybber: oh clyybber: then that was that 😄 leorize: there's also a pp calculator made by someone leorize: !repo osu leorize: disbot? Rika: im still working on mine ;; clyybber: is there any particular reason why there are so many osu clients? Rika: theyre not clients clyybber: clones then Rika: theyre just utility libraries Rika: oh really? Rika: dunno Rika: because osu!stable isnt open source Yardanico: @clyybber well, because they provide different options for customization and stuff Yardanico: like McOsu allows you to modify A LOT of stuff about beatmaps and the game Yardanico: oshu is just a simple Java osu! clone Yardanico: (McOsu is in C++ btw) Yardanico: leorize: for osu I only found https://github.com/de-odex/circa but it doesn't seem to calculate pp Rika: IM NOT DONE YET Rika: GOD clyybber: haha Rika: ;; Rika: IM WORKING ON IT PLEASE ;; Rika: i swear ill literally explode Yardanico: actually before discovering Nim I had a fork of a Python lib for calculating pp, and after that I rewrote it in Nim (just almost 1:1 translation by hand) but after that I just deleted it, i don't remember why :P Yardanico: https://github.com/Yardanico/pippy Rika: ok so yall know, i'm `de/odex` and `aEverr`, im only `Rika` in discord Yardanico: lol Yardanico: @Rika i'm gonna hard fork your circa lib!11 Rika: Yardanico maybe because francesco or whatever his name was already made `pyttanko` Yardanico: No, I mean I deleted the Nim version Rika: huh Rika: dunno then, you weird Yardanico: probs because I saw oppai-ng (fast PP calculator in C) and became too depressed PMunch: https://www.twitch.tv/pmunche Rika: what's the e there for Yardanico: wow PMunch can stream too PMunch: Testing out to see if my streaming setup works leorize: so many people streaming these days Yardanico: i should start too Rika: why's there an e on your name, is there really one? Yardanico: I actually streamed Nim programming like 2 years ago Rika: i "started" until i didnt leorize: ah, the best way to test out a stream, showing how nimble doesn't work :) Rika: lmao Rika: Yardanico, since you mentioned it, ill continue with my lib now. reeee Yardanico: and I streamed the programming of my VKontakte (russian social network) bot in Nim, and had 3-7 viewers, that was on livecoding.tv btw (before it became an almost paid-only thing) Yardanico: ahh good times leorize: PMunch: your network is better than disruptek, I'm getting only 3s lag :) PMunch: dadada, are you online? dadada: PMunch: yeah PMunch: What was the other issue you had with extract? PMunch: The horizontal/vertical thing dadada: ah, don't know if I'd call it issue, your approach might suffice, as long as getting the members in a type works clyybber: @Rika lol so you were the guy that pinged everyone dadada: I thought it might be a good idea, to have something like `foo|` to contrast with `foo*`, yet it's probably not necessary PMunch: dadada, yeah but what was your example? PMunch: Like what was the actual issue PMunch: Yeah that's not necessary, but I wanted to make the * work properly dadada: I'm counting on you, I've put the work on macro on hold until this works dadada: :-) dadada: on a Rika: NO Rika: IM NOT Rika: WHAT Rika: ;; Yardanico: ? Yardanico: ah lol clyybber: @Rika I think you are 😄 Rika: ;; sorry Rika: wasnt malicious dadada: PMunch: did you stream? PMunch: I'm streaming now PMunch: But I'm mostly just testing that it works dadada: where? Yardanico: twitch.tv/pmunche dadada: thanks, PMunch, you need to keep posting the link here like disruptek does, this really motivates people to take a look dadada: I'm tuned in :-) what desktop do you use? PMunch: i3 PMunch: krux02, twitch.tv/pmunche Lantos: are you showing us some macro magic PMunch: Right now I'm just messing about PMunch: I was thinking about streaming me fixing macroutils PMunch: But it's getting late, so I'm not sure if I'll do that, or if I'll call it the night and just leave this stream as a test stream Lantos: yes, the successful code streams seem to be like scheduled PMunch: dadada, do you have the example that failed? Yardanico: @Rika why LGPL-3 on your circa lib Yardanico: kinda meh Yardanico: @Rika Yardanico: can you relicense it to MIT/Apache/BSD since you're the sole contributor to it (at the moment)? 😛 leorize: or MPL if you love copyleft Yardanico: the Mozilla's one or Microsoft's one? :D leorize: mozilla's Yardanico: oh MPL is kinda nice Yardanico: it's really a good alternative for MIT/BSD if you want people to contribute to your project I guess leorize: in Nim land, LGPL is the same as GPL, because we don't do dynamic linking Yardanico: yeah, that's the thing Yardanico: that's why I absolutely don't understand when people use LGPL or GPL for licensing libraries Yardanico: I mean in languages where there's no dynamic linking :P Yardanico: a few weeks ago I asked one person on github why they licensed their nim libs in GPL, and they said that's why because their friend said "it's the best license" Yardanico: they relicensed them under MIT after that :) leorize: well gpl is not too bad, it's just not really great given the current status of nim ecosystem Yardanico: I think I might consider using MPL for my future projects :P Rika: @Yardanico well the issue is i cannot tell whether i have to also respect `slider`'s license since i'm "copying" it, but its not a direct port Yardanico: ohhh I understand now yeah Yardanico: I had thought about the same with another projects, yeah Rika: and slider uses lgpl 3 Yardanico: Like should a code translation (with some modifications) be licensed under the same license or not Rika: mhm Rika: actually theres a lot of modifications leorize: yes, it'll be under the same license Rika: because numpy aint in nim lmao Yardanico: you can still use it with nimpy :P Rika: so yeah sadly its not my call to change it lol Rika: i dont want to Yardanico: but calling numpy like nim->nimpy->python->numpy is meh Rika: sounds like unnecessary translation Rika: mhm Yardanico: well ok then I won't look at circa code anymore Yardanico: so I wouldn't be copying it :P Yardanico: https://github.com/Francesco149/oppai-ng is under Unlicense btw, just so you know Yardanico: Unlicense is basically public domain leorize: public domain is not legal everywhere though Yardanico: well they include a statement for that in the license Rika: > https://github.com/Francesco149/oppai-ng is under Unlicense btw, just so you know Rika: but then why would you convert it to pure nim, its in pure C already 😛 Rika: > well ok then I won't look at circa code anymore Rika: this is sad, i'm being cucked by a license choice i didnt make Yardanico: because it will be in Nim and I will be able to understand it better :P Rika: i'll ask lllllllllllll to change the license or something Yardanico: oppai-ng is just roughly ~3kloc (actual code) Yardanico: not that much Rika: what's so bad about LGPL though? Rika: i mean i know its much worse than the other licenses Yardanico: in nim land, as leorize said, LGPL is same as GPL Yardanico: so all your nim apps MUST be licensed under LGPL/GPL Yardanico: if you use circa nim lib Rika: ah license virus Yardanico: so you couldn't create proprietary apps with "circa" lib really leorize: that's a feature :P Rika: oi stop targeting me Rika: its not my fault ;; Yardanico: there's also AGPL which extends GPL for serverside code leorize: it's not that you have to license it under gpl/lgpl leorize: you can license it under anything Yardanico: but you have to keep it fully open source, right? leorize: yep clyybber: deck/stack destruction virus Rika: `stack destruction virus` sounds like altered carbon to me Yardanico: btw, about AGPL - how will people even find out that your website's backend uses AGPL libs? :D Rika: they dont lol clyybber: bb Yardanico Yardanico: well not from IRC, just from mumble :P Yardanico: I'm actually on 24/7 in IRC since I run Quassel clyybber: oh yeah, I just missed saying goodbye on mumble clyybber: like you were already gone so quick :p sealmove: hey is anyone here? I need help with something simple sealmove: I need to make an alias on "result" variable Rika: hello Rika: what do you mean? sealmove: so for example "this.someThing" should be exactly the same as "result.someThing" Rika: i dont understand Rika: still Yardanico: @Rika to be able to alias result as something else Yardanico: so "this.stuff = 5" is the same as "result.stuff = 5" Rika: maybe a template `var \` Rika: damn it Rika: sorry premature enter Rika: some template that does "var `alias` = result; defer: return `alias`" Rika: but this still allows result to be usable sealmove: or maybe it's more clever if I do something like this? https://play.nim-lang.org/#ix=2fW3 sealmove: oh wow, "this" seems to have special meaning Yardanico: yes Yardanico: https://nim-lang.org/docs/manual_experimental.html#automatic-self-insertions Yardanico: it's not a keyword though so you can use it safely sealmove: yes, I checked the keywords, that's why I was surprised Yardanico: well a pragma doesn't need to be a keyword :) Yardanico: I think you can make a macro which, when used as a pragma for a proc, can replace all instances of "this" (or any other name) to "result" leorize: @sealmove: https://play.nim-lang.org/#ix=2fW7 PMunch: Managed to close mumble by accident PMunch: But I'm off to bed now, krux02: good night PMunch: Might stream more tomorrow after work Zevv: sweet dreams Rika: why is `this` deprecated btw sealmove: good night! leorize: @Rika: it can be done with a macro, so we don't need more magic Rika: so what macro is that now leorize: std/with leorize: https://play.nim-lang.org/#ix=2fW7 <- how to alias something :P clyybber: I think one could be able to fully replicate {.this.} as a macro leorize: that's not possible actually leorize: {.this.} work in the same scope clyybber: wdym? clyybber: I mean like as a proc annotation clyybber: It should get the proc definition and body passed to it clyybber: right? leorize: you write {.this: something.} then every proc after that implicitly use `something` as `this` clyybber: oh clyybber: right clyybber: actually, maybe you can do that too leorize: but yes, you can implement it as a proc annotation, though you can just use `with` in the proc body clyybber: via push: someCustomThisMacro leorize: does that even work? clyybber: I dunno clyybber: :p sealmove: guys, I am finally making some progress with the Nim back-end for Kaitai Struct :) clyybber: leorize: Seems like theres an issue about it: https://github.com/nim-lang/Nim/issues/12867 clyybber: sealmove: Nice, congrats! sealmove: I abandoned my ambition of re-writing it in Nim, so I am sticking with the original project which is in Scala. But this way I will get the job done because a lot of things are already implemented. sealmove: Really I want to do it in Nim some day, but there are some issues with it. Here are my thoughts: sealmove: There are 2 options: sealmove: 1) do it at CT sealmove: 1) do it at RT sealmove: 2* exelotl: `with` in the standard library is nowhere close to `this` in terms of convenience or power sealmove: #1 needs a CT yaml parser, and #2 needs compiler as API which is messy imo sealmove: unless I don't use AST and do it with strings sealmove: what do you think guys? would producing nim code with string be such a bad idea? clyybber: why do you need the compiler as an api? clyybber: can't you simply generate type sections? clyybber: out of the yaml? sealmove: Sure, but it would be at string level. I'd imagine one would like to use Nim's metaprogramming and do it with AST. That's what I am asking. Yardanico: what about doing YAML->JSON with some helper tool (can be written in Nim too) and then doing all work at CT? json nim module works at CT Yardanico: YAML can be mapped 1:1 to JSON afaik sealmove: People has recommender this to me before. Well, it's probably the best solution. I just don't like the fact that you have to do pre-work and can't use the yaml files directly. Yardanico: you can check how nimterop does things, I think you may use the same approach sealmove: I'll definitely check it out, it seems the best way out of this mess... shashlick: sealmove happy to help shashlick: See ast2 which does everything at runtime using compiler api which is very nice sealmove: really, i lost half a year just because I was stubborn and wanted to do it "the perfect way". really bad mindset for programming! shashlick: Have been reimplementing the backend the right way for 3 months now sealmove: Thanks shashlick. So you believe option 2 (do it at RT with compiler api) is better than option 1 (convert to json and do it at CT)? shashlick: I think it should be possible to collaborate shashlick: CT is slow shashlick: But what exactly is the goal shashlick: Not familiar with kaitai clyybber: sealmove: What is the perfect way? clyybber: I guess parse YAML at CT and generate type sections clyybber: That should be possible Yardanico: @clyyber nimyaml doesn't support CT Yardanico: but I guess it can be possible to implement that Yardanico: shashlick: https://kaitai.io/ clyybber: Yeah, you'd have to implement it shashlick: Is it like protobuf sealmove: no guys, it's impossible to implement that xD I've been trying for half a year, don't do it at home!!! Yardanico: nimyaml at CT should be entirely possible :P clyybber: sealmove: Impossible to implement yaml at CT? sealmove: I read the whole yaml spec, it's an ugly mess Yardanico: json module works at CT too clyybber: That is definitely possible clyybber: sealmove: Yeah clyybber: thats true sealmove: clyyber yes, it's practically impossible clyybber: for sure its not sealmove: I mean, of course it's possible, but very very difficult, not worth the time clyybber: do you think kaitai in general is worth the time? Yardanico: also I'm wondering this as well :P sealmove: yes, truly believe so sealmove: at least for my type of work Yardanico: we have nesm and binaryparser in nim Yardanico: did you see https://github.com/xomachine/NESM and https://github.com/PMunch/binaryparse ? clyybber: sealmove: Did you try patching nimyaml to work at CT? Yardanico: @clyybber there's this issue, not by sealmove though https://github.com/flyx/NimYAML/issues/70 clyybber: yeah clyybber: I was looking at that right now clyybber: Seems to be a matter of inlining/getting rid of the sourceprovider concept or translating it to a generic sealmove: Yardanico: Yes of course I saw them. When working on forensics though you need a lot more features, and the yaml syntax for collecting file format specs is just perfect. I truly believe this is the future of forensics since at the moment everyone uses 1342342 different random tools for each format. sealmove: clyybber: no I didn't really try, it's beyond me... clyybber: sealmove: I think it would take you far less than half a year clyybber: maybe a few days sealmove: if i knew how to do it probably clyybber: but if you don't want that you could also use staticExec to convert the yaml to json and use that shashlick: Just do it how toast does it shashlick: Runtime for yaml shashlick: Generate Nim shashlick: Pull in using parseStmt sealmove: So compiler as API option clyybber: or just try to fix nimyaml clyybber: a bit harder sealmove: great, nobody agrees how it should be done :P I am so confused now clyybber: making nimyaml work at ct has more benefits clyybber: and it is less hacky clyybber: it is "the perfect solution" sealmove: that I agree... sealmove: and I can make nice interface where you can inject the parser in your binary without even having to produce a seperate nim module. this was my ambition from the get go sealmove: so kaitai struct as nim library, instead of external program sealmove: Ok, I will try to do that next. But first I will finish the native back-end (in Scala). sealmove: thanks for the ideas everyone :) dom96: Here are my thoughts: a package manager created by the community will never be as good as one maintained by the core devs of a programming language. dom96: We need to get Araq to commit to it as a project shashlick: I don't know how true that is - it basically needs someone dedicated to it 100% just like Araq is dedicated 100% to the compiler dom96: yes, and to get that you need to pay someone a wage. shashlick: We all just have too many projects shashlick: Easy to start, hard to sustain dom96: yes, well, unfortunately motivation runs out quickly when it comes to maintaining such projects dom96: good night zetashift: gnight! kayabaNerve: I need some help. I'm trying to compile Nim code, when compilation takes 1.178 GiB of peak memory, on a server with 2 GiB free. That said, GCC still complains about a lack of memory. I tried `--parallelBuild:1`. i do understand the best option is to create a swap file, yet I can't, so I'm looking for a Nim solution. shashlick: There was some flag to reduce mem usage but can't find it axion: I would recommend cross compiling with such severe memory constraints axion: Especially on a sever. The OOM killer could wipe out anything :/ kayabaNerve: axion: I have 2 GB free. axion: I saw kayabaNerve: That's not memory constrained Recruit_main707: Does anyone know how would I export a type into a dll, to import it somewhere else? zetashift: export a proc that returns that type maybe? :O disrupteq: you could add a swapfile, but there's a way to stage the backend compilation after completing compilation in the frontend. something via the nim.json file iirc. disrupteq: i think you should be able to get by with around 500meg of memory. Recruit_main707: zetafish, but what if I need to specify an argument of a function to be of that type? zetashift: zetafish is genius tbqh zetashift: but honestly I dont really know, I was mostly going of this answer: https://stackoverflow.com/questions/33348222/how-to-create-a-nim-dll-and-call-it-from-c-sharp Recruit_main707: I'll see what I can do, thanks anyways leorize: Recruit_main707: you can't export types :) Recruit_main707: That's what I thought, but there must be some way leorize: you can't, period :P leorize: well you can export how to interpret a type leorize: though no one ever do that KingDarBoja: Hi guys! Getting this error: "SIGSEGV: Illegal storage access. (Attempt to read from nil?)". Code right here -> https://play.nim-lang.org/#ix=2fIm leorize: KingDarBoja: your token is a ref object leorize: you haven't allocated the memory for it leorize: call `new(result)` first Recruit_main707: If I remember correctly, references could not point to null right? leorize: they can Recruit_main707: "You cannot have NULL references." From learncpp, does Nim have a workaround to this or something? leorize: wdym? leorize: Recruit_main707: btw your snippet worked for me? Recruit_main707: https://www.tutorialspoint.com/cplusplus/cpp_references.htm Recruit_main707: Recruit_main707: Well, shame on me I guess leorize: Recruit_main707: ah, nim don't have that kind of reference leorize: the nearest to it that we got is var parameters Recruit_main707: So confusing 🥴 leorize: try not to use C++ terminology on Nim :P leorize: our `ref` are managed pointers leorize: and being pointers, they can be nil Recruit_main707: Ok, is this documented somewhere? This kind of differences would be nice to know. leorize: the manual leorize: https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types Recruit_main707: I meant in a more c++ Vs Nim comparison but I guess that works :p leorize: Nim don't have anything similar to C++ references :p leorize: other than var parameters, ofc KingDarBoja: Thanks mate! Varriount: If you absolutely need references, you can use unsafe pointers (`addr` operator) KingDarBoja: Got another question KingDarBoja: https://play.nim-lang.org/#ix=2fIv is there a way to subset the TokenKind enum on my example? disruptek: use a range or a set. Varriount: I don't follow - do you mean create a set? Varriount: disruptek: Long night? disruptek: yep. KingDarBoja: For example, take elements from starting Enum key to ending Enum key, in this case, BANG to BRACE_R disruptek: {BANG .. BRACE_R} disruptek: or, as a type... range[BANG .. BRACE_R] KingDarBoja: Oh, was missing the brackets... 🤦 disruptek: that emoji renders female in my terminal emulator and male in my notifications. i don't have the energy to ponder how fucked up that is. qbradley: (staticExec "gzip -9 -c test.dat").len is returning 112 in my test program, but "gzip -9 -c test.dat | wc" on the command line returns 113 (which is correct). Anyone know how to get my missing byte back using staticExec? disruptek: gzip on the cli adds a newline most likely. disruptek: because pipe. disruptek: write the data to a file and compare with a quality editor. qbradley: If I run "gzip -9 test.dat" the file test.dat.gz is also 113 bytes. The final missing byte is not a newline. qbradley: I suppose either the staticExec command is producing different output or it is losing a byte of output. I'll write out the resulting data from staticExec and diff disruptek: yes. disruptek: !repo hexyl disbot: https://github.com/sharkdp/hexyl -- 9hexyl: 11A command-line hex viewer 15 5117⭐ 137🍴 7& 12 more... Varriount: disruptek: Or just diff the input? Pipe the input from gzip to a file, then compare disruptek: diff is not so useful for binary comparison, especially when what you're interested in is binary values. Varriount: Ah, I assumed that the input to gzip was human readable disruptek: it's the output that we are interested in. qbradley: I hexdumped the files and diffed them Varriount: Yeah, but for the output to differ, the input must differ disruptek: seemingly not. qbradley: The files have differences near the beginning and the last bytes. It seems that gzip is working differently when run from staticExec than when run from command line Varriount: qbradley: Environment variables maybe? disruptek: check that it's the same gzip. qbradley: the command line is consistent regardless if I pipe the output to wc, or tee, or redirect to a file, or not use -c and let it write to the file directly. All consistent. but staticExec different :-( qbradley: Ok, I'll see if "which gzip" works from staticExec qbradley: yes, "which gzip" returns /bin/gzip from command line and also from staticExec disruptek: it's a bad idea to guess in any event. see `findExe()` disruptek: can you repro minimally? qbradley: I'll give it a try disruptek: i'm thinking it's encoding the filename maybe. disruptek: --no-name (timestamp) Varriount: What locations (relative to the start and end) are the differences occurring at? Varriount: http://www33146ue.sakura.ne.jp/staff/iz/formats/gzip.html qbradley: I notice that the last few bytes of the 112 byte file are 0xA. (They are 0x0 in the correctly sized file). Is it possible that staticExec is aggressively stripping a trailing 0xA thinking it is an extra LF? qbradley: Obviously in my case the output is binary disruptek: yes. Varriount: Wait, staticExec strips data from the executed output? disruptek: easy to test. 😉 qbradley: true I'll check qbradley: yes it does disruptek: !repo nimbug disbot: https://github.com/juancarlospaco/nimbug -- 9nimbug: 11Nim Semi-Auto Bug Report Tool 15 6⭐ 0🍴 qbradley: I tried staticExec("echo foo").len and got 3 KingDarBoja: Okay guys, just stuck on something from last example... If I wish to use the integer from the enum subset into the original subset to retrieve the Enum name, how could I do that? disruptek: FUBAR.ord disruptek: 15.SomeEnum disruptek: 15.SomeEnumTypeName 😉 qbradley: and to be extra sure again, I tried staticExec("cat test.dat").len where test.dat only contained 3 LF and I got 2 qbradley: I'll file an issue KingDarBoja: Thanks lol, struggling with these stuff disruptek: ord(FUBAR) and SomeType(15) if it's easier to grok. disruptek: it boggles my mind that there's no $ for TLineInfo. disruptek: the throbbing is real. disruptek: see, this is why i stay stoned all the time. Varriount: WTF does staticExec strip input data? disruptek: it's probably just non-discriminatory. disruptek: wrongly. Varriount: Well, yes, but a function like that shouldn't be messing around with the output data. disruptek: clearly. disruptek: it's what we call a `bug`. qbradley: As a workaround I can staticExec("gzip -9 -c test.dat >/tmp/test.dat.gz") followed by staticRead("/tmp/test.dat.gz") Varriount: @KingDarBoja If you are writing a parser, I highly recommend NPeg: https://github.com/zevv/npeg fl0under: Hi everyone. I have tried to sign up on the forum but the activation email is not arriving so I am asking my question here. My problem is I have a JsonNode object and I am trying to unmarshal it into a type using the 'to' macro, however the JSON data I have contains a key called type, which means Nim won't let me have a identifier called type in my data structure as it is a reserved keyword. Does anyone know a way FromGitter: ... around this? Varriount: fl0under: I would have to see the code, but generally you can use reserved identifiers by putting backticks around them Varriount: fl0under: https://play.nim-lang.org/#ix=2fIB fl0under: awesome, that worked! thanks fl0under: I just started playing around with Nim yesterday and am liking it so far! timotheecour: can anyone merge https://github.com/nim-lang/Nim/pull/13788 so unblock nim CI? @narimiran maybe? disbot: ➥ [CI] fix recent freebsd systematic failure Varriount: timotheecour: Merged leorize: hmm, the fix in #13787 is weird disbot: https://github.com/nim-lang/Nim/pull/13787 -- 3fix regression #13730: `Foo[0.0] is Foo[-0.0]` now true again Varriount: leorize: Isn't `BiggestFloat` bigger than 64 bits? leorize: nope leorize: it's a 64bit float Varriount: Huh. leorize: this might mean that `cast` is not implemented correctly... leorize: but I did use it successfully to implement my float parser... Varriount: leorize: Floating point numbers are just weird leorize: not that weird Varriount: leorize: Perhaps the linked commits that caused the bug might explain the solution leorize: the commit that caused the regression try to make NaN comparision possible leorize: except that you still can't correctly compare NaN that way :) leorize: we'd need a classifier like this one: https://github.com/alaviss/nim-ryu/blob/master/basicconv.nim#L67 to correctly compare for all cases Varriount: leorize: https://possiblywrong.wordpress.com/2013/11/15/floating-point-equality-its-worse-than-you-think/ Varriount: leorize: So, Nim was changed to compare floats according to their bit pattern... but this is incorrect for 0 and -0, because they have a different bit pattern Varriount: Honestly, I don't think it's worth trying to fight the C backend on this. I'd rather stick with common, expected semantics. leorize: ah leorize: I misread the entire thing :P leorize: to be fair I'm not sure if we should even support 0.0 == -0.0 leorize: they are different things kungtotte: disrupteq: re: my URL issues with nimph yesterday, I got it working with this change: https://github.com/kungtotte/nimph/commit/9949de85945c0d5a54ae0e4552981dc32c838d35 but it breaks some existing test assumptions in tests/tspec.nim. From looking at it, I think you can drop a lot of those hardcoded assumptions completely out Varriount: leorize: Again, I don't think Nim should break this particular standard - I'd need to check, but Javascript and (presumably) C both have the `NaN != NaN` behavior leorize: well, yea, it's a part of IEEE leorize: since this affects generics, I think Araq was just trying to make Foo[NaN] == Foo[NaN] leorize: but trust me, if you really want to compare NaN, bringing out a float classifier is always the wise choice Araq: well I was aware of 0.0 vs -0.0 and I didn't care Araq: in fact, my solution is correct Araq: proc foo(x = 0.0) # forward decl Araq: cannot be resolved via Araq: proc foo(x = -0.0) = implementation here Varriount: Araq: So we break with the IEEE standard where `NaN != NaN` and `-0.0 == +0.0`? leorize: !eval -0.0 == 0.0 NimBot: Compile failed: /usercode/in.nim(1, 6) Error: expression 'true' is of type 'bool' and has to be discarded Yardanico: !eval assert 0.0 == -0.0 NimBot: leorize: IEEE strikes again Araq: we don't break the standard omg Varriount: Oh, I was misreading the code. Varriount: I thought this was the code generator Varriount: I'm sorry leorize: I never understand why signed zero was a thing leorize: I guess it was so that gradual underflow is cheaper to implement Araq: signed zero is fine 1.0 / -0.0 = -Inf, 1.0 / 0.0 = +Inf Araq: even NaN is ok. the fact that Nan *always* compares false, even with itself, is unprecedented in human history and breaks basic logic Araq: it's the worst design in computing that I've ever seen leorize: well it came from the same place where two different zeros are equal except when you put it into math Araq: good point Araq: iirc there is a way to do calculus with explicit "finitely small" values that are different from 0 Araq: it's more elegant too, you could model that instead and the leave the 0.0 alone silvernode: so I think I hit a nim bug, none of my files have problems in the error, it just says Error: internal error: genTypeInfo(tyNone) Araq: *infinitely silvernode: I don't want to say it is a compiler bug but it might be leorize[m]: if it said internal error, it's a compiler bug silvernode: the current build of my game produces the error, my friend gets the same error. https://github.com/silvernode/space-nim/tree/experimental Yardanico: silvernode: internal error always means that something is wrong in the compiler :P Yardanico: well, it might mean that your code is not valid Nim, but compiler should output a *proper* error instead silvernode: Yardanico: that was my first assumption but I wanted to be sure I was right. silvernode: looks like line 19 in space_nim.nim is causing the error. I assign the result of newGrid() to a var. newGrid() creates a 4x4 grid composed of seqs silvernode: fixed it silvernode: had var grid:seq = newGrid(4,4), if I change it to var grid = newGrid(4,4), it works Varriount: Anyone read any interesting papers recently? Araq: https://www.twitch.tv/araq4k stream incoming, but I only have time until lunch dom96: Araq, you should really start announcing these on your twitter dom96: what even is DrNim? Rika: proof system i think dom96: oh, a proof checker gogolxdong: How to echo an object? Yardanico: echo myobj Yardanico: if it's a ref object, you can dereference it like echo myobj[] lqdev[m]: also, `echo myObj.repr` lqdev[m]: works for pretty much everything afaik Yardanico: yeah but output is too verbose sometimes lqdev[m]: true gogolxdong: Error: type mismatch: got ⏎ but expected one of: ⏎ proc echo(x: varargs[typed, `$`]) ⏎ first type mismatch at position: 1 ⏎ required type for x: varargs[typed] ... [https://gitter.im/nim-lang/Nim?at=5e7f4ac94a4f8e0a100ef149] Yardanico: if it's a ref object, dereference it as I said gogolxdong: yes , I remembered was using repr, but repr doesn't work for me now? Rika: basically `Client` has no `$` proc it seems Rika: make one Yardanico: well it doesn't have to have it Rika: really? Yardanico: yes? Rika: hmm interesting, never noticed it Yardanico: !eval type A = object; echo A() NimBot: () Yardanico: !eval type A = ref object; echo A()[] NimBot: () Rika: so what is Client? the error differs to what happens if you dont deref a ref gogolxdong: type ⏎ Client = ref object Yardanico: @gogolxdong as I said, dereference it like echo myclient[] gogolxdong: echo client[] Rika: does that work? gogolxdong: no narimiran: implement this: ```proc `$`(c: Client): string``` dom96: Just installed Nim on my new PC, as painless as it could be :D Yardanico: dom96: got that build with ryzen? :) noice dom96: yep dom96: Seeing mentions of people talking about running HL: A wirelessly using Virtual Desktop and tempted to try it dom96: But it's about time I set up Nim on this PC :) leth: Is there any talk on moving away the hosting from digital ocean? I don't feel comfortable whitlisting your domain considering that blocking digital oceans should be seen as an effecive method to deter customers away from them. So I'd rather urge to drop them out than simply whitlisting your domain and ip. dom96: Why deter people from DO? What's wrong with them? leth: They don't respond to abuse reports. dom96: Source? leth: https://www.webiron.com/abuse_leaderboard/ leth: https://www.webiron.com/abuse_feed/as14061 gogolxdong: How to construct a derived object type variable from its base object type? leth: It's common knowledge amongts many security focused communities. gogolxdong: from its base object type variable dom96: FWIW they give us machines for free, so we're not technically customers :) leth: Well atleast that's something. leth: I'll just whitelist you then since it's mostly about them not cleaning up amongst their customers and you're not actively supporting them. leth: Now, since my email first blocked the email confirmation from the forum signup, is there a way to resend it somehow? dom96: nope :) dom96: what's your user name? dom96: I can activate for you leth: leth leth: that is my username. dom96: done leth: Thank you! disruptek: kungtotte: looks good; please PR! disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: just trying to kill this stupid bug once and for all. clyybber: which bug? disruptek: i'm explaining it on stream. clyybber: im watching it krux02: Araq: did you work on the caching behavior of the compiler? Sometimes my file doesn't build anymore if I call nim for my file. kungtotte: disruptek: PR sent disruptek: merged; thanks! clyybber: krux02: I think it happens to us compiler devs clyybber: because it doesn't know when the compiler changed kungtotte: Cool, my first ever PR on anything. Glad it was on something Nim related :) disruptek: it's a good improvement! disruptek: how do you like nimph other than that? disruptek: krux02: IC was slightly fixed and it could be working more than it did. kungtotte: So far I haven't really had a chance to try it out for real, I tested it yesterday after there was a discussion about Nimble vs. nimph and I ran into the error right off the bat, so thus far my only exposure to it has been fixing this issue :) disruptek: that's awesome. first PR on anything... 😁 disruptek: Araq: you didn't tell me this was so broken. disruptek: we really need seq to have an api for mem-size versus usage-len. krux02: disruptek, Regarding IC, I have the same file (root of the project) name in two different folders (projects). And somehow I think this confues nim now and it doesn't rebuild even though it should. krux02: I am on the stream btw, but you are not enabled in mumble Kiloneie: Why doesn't this work ? I've looked at the manual and tried it myself, it works for thetype being object but not tuple ?... https://play.nim-lang.org/#ix=2fMc Kiloneie: wait, i think i forgot something about tuples... Kiloneie: I don't get it: https://play.nim-lang.org/#ix=2fMX leorize: Kiloneie: tuples don't have field visibility leorize: all of the fields are exported by default Kiloneie: Okay... thanks Kiloneie: https://youtu.be/4RIbpChsbFU Rika: nice 😮 Kiloneie: Thanks, except for me realizing after recording that my video will be 2.5 minutes long thus having content index wrong for half of the video Kiloneie: couldn't be bothered to re record Kiloneie: Had to extend it Rika: sounds rough Kiloneie: I usually made my videos too long, so i changed my approach to how i write my videos, made a mistake sadly, small yet it is. Kiloneie: I did yolo most of my video, usually i write for up to 2 hours, this one took like 5-10 minutes. Proved myself it can work 😛 disruptek: Araq: best way to find the module of a pnode? KingDarBoja: https://play.nim-lang.org/#ix=2fOo Anyone knows where the "16" comes from on the second find at this example? leorize: in the string representation of PunctuationTokenKind leorize: what are you trying to do? Rika: sets dont have an order perse Rika: 16 is the index of the character of the string representation of the set Rika: from* Rika: 16 is the index of the character [from] the string representation of the set KingDarBoja: Leorize: check if a value is at the set[TokenKind], which is called PunctuatorTokenKind as the find search will return -1 if not found. leorize: lol find() only works for arrays :P KingDarBoja: Then if it is not -1, find the associated Enum value at TokenKind Rika: find works with something with an order leorize: convert it to TokenKind, then you can check if it's in PunctuactionTokenKind Rika: an enum is individual "variables" Rika: and the first one isnt even 0 Rika: its Rika: 1*, its 1 KingDarBoja: Yeah, forgot to mention that, I realized my mistake after getting the 16 Rika: sets dont have "order" KingDarBoja: The conversion to TokenKind is done with parseEnum, right Leorize? leorize: if you wanna write a lexer, I'd recommend using `lexbase` leorize: yep leorize: lexbase provides a solid base to write any lexer, as it got an excellent buffering system KingDarBoja: I saw the suggestions, but more like writing the same code logic from source code so every change on the base implementation can be reflected on my code.... I know that sounds like non-sense KingDarBoja: Not the best explaining stuff to be honest 😢 leorize: you can read the stdlib's json and cfg parser to see how a lexer is written :) leorize: https://github.com/alaviss/toml/blob/master/toml.nim <- this is my own lexer, it's old though, I've abandoned it leorize: actually I think I wrote a lexer somewhere in rosetta code that's a touch more up-to-date KingDarBoja: I am interested on the statement "the string representation of the set" wtf is that? o.o leorize: the `$` operator returns the string representation of whatever you put into it leorize: try to echo the const you made KingDarBoja: Sure, let me try KingDarBoja: I see this -> {!, $, &, (, ), ..., :, =, @, [, ], {, |, }} KingDarBoja: Oh! got it! KingDarBoja: Yeah, now makes sense to me Recruit_main707: how do i initialise something like this: type Vector3* = ptr object?? Recruit_main707: having as fields x, y, and z? leorize: result = Vector3(x: 0, y: 0, z: 0) <- use the type contructor Recruit_main707: `object constructor needs an object type` leorize: well, try `create(Vector3)` then leorize: why do you want to create an object though? leorize: ptr object* leorize: usually people don't use it unless they're interfacing with C Recruit_main707: to my knowledge, `ref` is very slow, leorize: it's as slow as `ptr` fwiw :) Recruit_main707: shouldnt it be faster than `object` then? Recruit_main707: at least interfacing w/ C? leorize: no leorize: nothing beats the stack leorize: you use the heap when you need it, not because you can Recruit_main707: ok, thanks KingDarBoja: I feel blessed on this community, so kind 😄 dom96: ugh, pretty sure nim devel has a leak in HashSet's leorize: how? :P dom96: I decided to spend my day optimising my game dom96: I reduced the code to a HashSet iteration dom96: and saw it increase in time spent over time dom96: switched to 1.0.6 and that doesn't happen dom96: so yay, nice waste of my time leorize: now it'd be nice if you can fix it :) Rika: time spent over time? dom96: increase in time spent over the run time of my game Rika: me rn: no thoughts head empty leorize: ping narimiran since they worked on hashset Rika: still dont get it, dont bother explaining because itll take too much time dom96: I'm just annoyed now. I'll try to repro but if I can't do it in 20 minutes I will instead rant on the PR that likely introduced this dom96: #13794 disbot: https://github.com/nim-lang/Nim/issues/13794 -- 3hashset regression ; snippet at 12https://play.nim-lang.org/#ix=2fOK Rika: disbot slow? Rika: oh there it is leorize: discord slow to be precise dom96: disbot works via discord? dom96: I suppose the name does imply that dom96: I wonder why though, IRC is so much more reliable and simple to work with disruptek: disbot runs on irc. the delay was either due to github or ix. Rika: what do i do when vscode nim ext spits out "provider FAILED" and then an "undefined" in the logs other than restart? disruptek: switch to nvim. Rika: not willing to switch whole text editors for this Rika: i like my good looking gui on windows blackbeard420: when using std json's `to` is there a way to make it ignore certain fields? KingDarBoja: It is possible to use "except" from unittest to get the error message and check if it is equal to some message? Rika: why wouldnt it? Rika: blackbeard420, not that i know of disruptek: search for noserialize; there are a few discussions/solutions. Rika: you can always remove it from the json node the `to` macro's gonna process disruptek: !issues noserialize disbot: https://github.com/nim-lang/Nim/issues/11415 -- 3Custom pragma ignored on field of variant obj if in multiple branches disruptek: eh... do a better job than the bot. awr1: ugh, does choosenim cause windows defender to panic for anyone else? awr1: i keep getting an "Access is Denied" error awr1: nvm it was emacs? KingDarBoja: Something like this -> https://github.com/nim-lang/Nim/issues/11029 (for my question) but the "as" keyword is giving me this error message "attempting to call routine: 'as'" disbot: ➥ Can't catch an Exception from an async proc and access the message field. ; snippet at 12https://play.nim-lang.org/#ix=2fPm awr1: i think it was connected to choosenim somehow even though i disabled it awr1: sorry not choosenim awr1: nimsuggest KingDarBoja: But instead of using "except", use "expect" from the testutils gogolxdong: How to remove an element from sequence? lqdev[m]: gogolxdong: `delete` if you want to keep the order, `del` if you want )(1) complexity lqdev[m]: s/)/O lqdev[m]: if you want a particular element, use `find` in conjunction with one of the above lqdev[m]: keep in mind that `find` returns -1 if the element can't be found lqdev[m]: so be sure to check for that to not generate an exception gogolxdong: more than excepted, thanks ! awr1: also `pop()` if its at the head awr1: i mean tail leth: can you use an enum as an argument in a macro? Varriount: Yes leth: or rather can you use it for a case statement in the macro? Recruit_main707: why cant i name a proc `__add__`? Recruit_main707: nvm, it seems like a nimpy problem zetashift: Does the playground compile with any special options? My code compiles fine on playground but on my local laptop it fails with a type mismatch zetashift: and the code is just copy pasted >< leorize: no Yardanico: can you share the code? Yardanico: and maybe it's arch/os specific zetashift: https://play.nim-lang.org/#ix=2fBQ zetashift: well it's a type mismatch error zetashift: The error being: `C:\Users\Administrator\.choosenim\toolchains\nim-1.0.6\lib\pure\unittest.nim(665, 14) Error: type mism ⏎ atch: got ⏎ but expected one of: ⏎ proc `==`I, T (x, y: array[I, T]): bool ⏎ first type mismatch at position: 2` [https://gitter.im/nim-lang/Nim?at=5e7d4422d783bb5a9d8dfa18] Yardanico: works for me on latest devel on linux Yardanico: and passes the test zetashift: I'm on Windows but I really don't see how this could be OS specific KingDarBoja: I am on Windows, let me see KingDarBoja: All good here! dom96: different nim version? zetashift: I tried with 1.0.6 and devel KingDarBoja: 1.0.6 zetashift: So in my project I do have the `==` operator defined in another file zetashift: might that be an issue? I made that snippet to repro my error Yardanico: and is Matrix defined in the same file too? Spy653: Hey do you guys mind if I post a survey I've made? It's about what techies think of IoT products (examples in the survey) Yardanico: it's better if you would post it on the forum, this is a real-time chat after all :) Spy653: I'm throwing it around some discord servers Yardanico: well that's not the best way, it's better to post it on relevant forums Spy653: Fair, I'll throw it there when I can zetashift: @Yardanico yeah Matrix is defined in the same file as the `==` but not in the same file as the test Yardanico: well it even works for me even if I define matrix and == in a separate file zetashift: Yea, I have an overloaded func of submatrix that takes no parameter and that works fine zetashift: but I have no idea why this one gives me the type mismatch error zetashift: https://github.com/zetashift/naytracer here is my full project zetashift: I'm also calling it night, too tired to look at this ;__;. Good night y'all disruptek: fucking alcoholic family members are going to kill us all because they cannot get their drugs delivered like the rest of us. KingDarBoja: Whaaat disruptek: irl intensifies disruptek: might have to handcuff some bitches to the radiator. Yardanico: oh noes Yardanico: https://cdn.discordapp.com/attachments/371759389889003532/692940466315984946/2020-03-27-06-37-39_grim.png Knaque: I made a CLI that makes it a bit easier to host a home Git server: https://github.com/Knaque/prigit/ Benumbed: Problem solved Yardanico: !last shashlick disbot: shashlick spoke in 12#nim 29 hours ago Yardanico: shashlick: you around? just wanted to ask a question about nimterop - what if it errors on a header while doing cImport (with recurse=true) if that header imports other ones like "vlc/libvlc.h" even if they're in same dir? I wanted to make a libvlc wrapper so I wrote some code but it errors because of this https://play.nim-lang.org/#ix=2fDd Yardanico: well I guess it would work if I cImport every header separately shashlick: Sup Yardanico: i've never used nimterop before so I'm really stupid with it :P shashlick: No worries shashlick: You need to set the include directory correctly shashlick: I don't remember if it gets set automatically with search dir Yardanico: oh yeah cIncludeDir(baseDir / "include") worked Yardanico: now I get tons of errors but that's expected :P Yardanico: but it processes all header files at least shashlick: Cool ya shashlick: I thought someone else had worked on vlc before Yardanico: yeah, I thought the same, but found no repos Yardanico: shashlick: is it ok if I got a sigsegv? :P Yardanico: https://play.nim-lang.org/#ix=2fDe shashlick: I don't think anyone likes those 😄 shashlick: What's the crash Yardanico: No stack traceback available Yardanico: SIGSEGV: Illegal storage access. (Attempt to read from nil?) [AssertionError] Yardanico: after it inputs some generated nim code on the stdout shashlick: Ugh toast is crashing but it's unclear why shashlick: Can you recompile toast? Yardanico: yeah, I can try shashlick: I've seen this before and tried to compile with debug but couldn't reproduce again Yardanico: do I just need to compile toast.nim from nimterop and put it in PATH so nimterop picks it? Yardanico: ah nvm found toastExePath so I can edit it real quick shashlick: https://github.com/genotrance/nimarchive/issues/10 disbot: ➥ SIGSEGV Nim 1.2+ Yardanico: yeah I have devel too shashlick: I discussed this with Juan on telegram few days ago shashlick: Will be great if you can get a stack trace Yardanico: wair it doesn't sigsegv with a binary compiled manually Yardanico: either in debug or -d:release shashlick: I couldn't get it to print one and it worked fine in gdb as well Yardanico: the one built by nimterop does Yardanico: (when it builds toast automatically on installing) Yardanico: I just tried reinstalling it and it doesn't sigsegv either :D shashlick: You're able to recreate the crash? shashlick: Exactly what I saw Yardanico: maybe a codegen/gc issue then? Yardanico: if the same code works or doesn't work sometimes shashlick: Could be but how to report such an issue shashlick: Nimterop is tested with devel in the CI Yardanico: yeah, IDK how to reproduce it now, after recompiling toast binary it just disappeared shashlick: 4raq's fault :) Yardanico: btw, why don't the generated nim files pick my "dynvlc" thing? Yardanico: nimterop puts them all in "failed" cache dir shashlick: That's cause the generated code has errors or missing symbols shashlick: dynvlc will be set as a pragma but it's only defined in your wrapper Yardanico: seems like there's a lot of code like "media_discoverer_lan* = 1.media_discoverer_category_t" Yardanico: but nim doesn't like it, guess the enum didn't get generated Yardanico: ah hmm "defineEnum(media_discoverer_category_t)" shashlick: Those are enums remapped to distinct int shashlick: Since c enums can be out of order or have duplicates Yardanico: yeah, I know Yardanico: guess that it all fails coz of some syntax error at the beginning on the file :P shashlick: What's the actual error Yardanico: a ton of errors from nim check Yardanico: it fails for every enum member in all enums Yardanico: ah, I guess it all starts because of "'r' << 16* = 1.teletext_key_t" Yardanico: that's of course not corrent Nim syntax :)) Yardanico: this enum https://git.videolan.org/?p=vlc.git;a=blob;f=include/vlc/libvlc_media_player.h;h=5e0255a10ac84c449a15e6e3eb2fba2123dd035c;hb=HEAD#l154 Yardanico: wait why does it try to assign the enum value (?) to itself or something Yardanico: that's how the whole file looks and where it starts - https://gist.github.com/Yardanico/0af5164651914ab17d37daa49af0af41#file-libvlc-nim-L452 shashlick: You might want to cOverride that and hand wrap it instead Yardanico: yeah, I understand that shashlick: And report it :) Yardanico: so I just do cOverride and define this values manually or what? Yardanico: so it doesn't generate enum values for this enum shashlick: Ya shashlick: If you don't need that enum you could hear cSkipSymbol for now shashlick: But it might be used by some other proc shashlick: People do such crazy things with c Yardanico: shashlick: so I do it like cSkipSymbol(@["libvlc_teletext_key_t"]) ? Yardanico: because for some reason it's still in generated Nim code Yardanico: it seems that most of the wrapper generated successfully, there's an issue with this enum, vlc_log_t, video_setup_device_info_t and video_output_cfg_t Yardanico: if I remove all procs/types which use these nim check passes shashlick: What's with those enums Yardanico: well, how can I skip that enum for now? I mean I understand how to rewrite it, but how to say to nimterop to skip it Yardanico: I've even tried using cSkipSymbol and put names of all members and enum itself, both with and without the libvlc_ prefix shashlick: Do you run with -f shashlick: Cause it might be caching stuff Yardanico: yeah shashlick: It should be skipping it, I don't see why not Yardanico: i've tried with putting all the possible names https://play.nim-lang.org/#ix=2fDo shashlick: Run the toast command with -d shashlick: Put rmFile under static Yardanico: it doesn't work there for some reason shashlick: Also cSkipSymbol since it is a proc Yardanico: under static too? shashlick: Yep Yardanico: shashlick: well, how I can remove 1 line from the header then? I don't really need that deprecated.h, but vlc.h includes it Yardanico: I figured out it removes that file successfully, but then toast fails because vlc.h includes deprecated.h Yardanico: well actually I guess it's mostly ok Yardanico: wait, so I just use the code that this program outputs? Yardanico: I mean it outputs some generated wrapper Yardanico: can't I make it output to a file? shashlick: You can redirect and save the output Yardanico: well seems like one file in libvlc folder references a type which is not related to vlc but a part of vlc (include file) shashlick: You'd have to edit the header before processing to remove deprecated shashlick: You can also simply import this wrapper in your code and it will generate only the first time Yardanico: can I cImport multiple files somehow? shashlick: After that it is cached so is fast shashlick: Sure just call it multiple times Yardanico: so I don't understand, nimterop will create actual wrapper files only if it finds no issues with nim check? shashlick: Call that header before vlc shashlick: Well when you cimport, it runs parseStmt on the code shashlick: If the wrapper is bad, it will fail compile Yardanico: well seems like it just straight up skipped the struct I needed :P Yardanico: it's this one https://git.videolan.org/?p=vlc.git;a=blob;f=include/vlc_messages.h;h=b6d5843985dccfad5d24a6d7ae1e4a4728023ccd;hb=HEAD#l55 shashlick: But the error isn't useful to debug so we write the file and run Nim check so that we get a useful error shashlick: Probably those comments throwing it off Yardanico: ah nvm it's my own fault shashlick: Whew Yardanico: I wanted to ignore it at first but then added vlc_messages.h and forgot to remove them from ignored ones shashlick: Ok cool Yardanico: seems like it actually generated that object now Yardanico: well I mean struct shashlick: Neat Yardanico: uh-oh, can nimterop handle this struct? https://git.videolan.org/?p=vlc.git;a=blob;f=include/vlc/libvlc_media_player.h;h=5e0255a10ac84c449a15e6e3eb2fba2123dd035c;hb=HEAD#l511 Yardanico: it's a union struct with structs (???) shashlick: Nope it cannot do nested stuff shashlick: Am working on that for ast2 shashlick: Best to c2nim just that and cOverride Yardanico: shashlick: so how do I actually try again after changing code in the wrapper generator? add -f to nim compiler? it doesn't seem to work Yardanico: ah nvm it works I think Yardanico: so another question - what to do if there's a type on cOverrides which uses an enum defined in one of the headers? shashlick: It should get inserted in place shashlick: In context Yardanico: well it seems like if I have 3 cImports, it gets included into all of them, and already fails with the first one Yardanico: but that enum is defined in the second header (so in the second cImport call) shashlick: Make sure the cOverride is added after you import those files Yardanico: oh Yardanico: it ran with no issues!!!! now where are my files? :P shashlick: Awesome! shashlick: How big is this wrapper output shashlick: Vlc must be huge Yardanico: nah it's not the entire vlc Yardanico: it's libvlc Yardanico: wait lemme actually make sure it's not failing on something Yardanico: yeah doesn't seem so Yardanico: now how can I get the files it made? shashlick: Like I said, either import this wrapper in your code Yardanico: ah yeah sorry shashlick: Or redirect output to file shashlick: And turn off cDebug if the output is too verbose shashlick: Also look at the docs capability if you want to generate html docs shashlick: https://nimterop.github.io/nimterop/docs.html shashlick: https://github.com/genotrance/nimarchive/blob/master/nimarchive.nimble#L17 Yardanico: well, first of all I need to figure out if it works :P Yardanico: I initially wanted to use it together with gintro shashlick: Agreed hoffentlichja: How does nimble solve package version conflicts? Yardanico: ok let's try playing a song Yardanico: it works!!!! Yardanico: amazing Yardanico: i thought it would be much harder than just *that* Yardanico: shashlick: again thanks a lot :) https://github.com/Yardanico/nim-libvlc Varriount: Araq: I really don't think byaddr should be in Nim. It complicates an already tricky memory situation, especially since the move/copy/borrow stuff is still progressing. leorize: + it's not even documented :P Varriount: leorize: And actually, it's not even memory safe in it's current form: https://github.com/nim-lang/Nim/blob/devel/lib/std/pragmas.nim Varriount: Of course, the documentation doesn't say that Varriount: I don't see what advantage it has compared to just using `addr` Varriount: And yes, I know that you have to import it to use it, but that doesn't mean it should be in the standard library leorize: the only good thing that come out of it is that we got proper custom pragma support for variables Varriount: leorize: I did notice that. Varriount: Right now I'm mostly against new additions to the standard library, unless they really implement functionality that can't already be reasonably achieved using existing language/library functionality. Varriount: To be blunt, many parts of the standard library are a mess, because various people have built onto the modules without any greater plan for what the api should be. Araq: Varriount: it's opt-in though and fills a void Araq: and the borrow checking is coming sooner rather than later, other already existing parts of the languae require it Araq: and it's always easy to meta-critic anything (the stdlib has no great plan and is a mess) Araq: maybe it doesn't need a great plan though. Varriount: Araq: Perhaps not as a whole, but there are plenty of modules that don't really have a clean or well thought out interface. Varriount: A prime example are the DB modules that always return result values as strings Varriount: Or the two regex modules Varriount: Or strmisc and wordwrap Varriount: (I could go on) Varriount: And while every standard library has its share of warts, Nim has a far higher relative wart occurrence Rika: the regex ones are just "wrapper vs higher level version" `pcre` vs `re` isnt it? Varriount: Somewhat, but they also have vastly different API styles Varriount: And it's re vs nre Rika: i see Rika: ah so if its re vs nre its more of "theres basically no difference in functionality" lqdev[m]: not to mention weird naming like `flushFile` vs `open`, `setPosition` and `getPosition`, and so on lqdev[m]: too bad we can't change those. Rika: `setPosition` in streams, `setFilePos` in io Rika: `flush` in streams, `flushFile` in io Rika: basically: just import streams and use that instead 😛 lqdev[m]: but `seek` and `position` are better names for `setPosition` and `getPosition` respectively lqdev[m]: even so, the stdlib naming guidelines discourage the use of `get`/`set` prefixes in favor of getter and setter syntax Rika: oh man, i used to always type `seek` instead of `setposition` Rika: also anything with the `get` prefix should have it removed no? Rika: also i'm not sure about `setPosition` being replaced with `position=` PMunch: I agree, the stdlib is a bit wonky in places PMunch: Don't get me wrong, it's great, lots of things supported out of the box, but as you mention there are some weird discrepancies in naming and interfaces. PMunch: Sometimes getting something from one module and passing it to another can also be super inconvenient.. PMunch: I guess we should write a nonstandard library :P Rika: a standard nonstandard library let's call it Rika: perhaps a standardized nonstandard library is more accurate of a name Varriount: PMunch: I'm currently attempting to port various modules from other stdlibs. Go's is quite nice, though a bit anemic in some areas Varriount: We will see how that goes Rika: you got a repo for that? Varriount: Not yet Rika: i wanna see it and maybe report possible mistakes PMunch: Well I guess it's easier to write a cohesive stdlib if it is a bit sparse :P PMunch: Means there is less places you can mess up at least Varriount: Rika: I started from the bottom up, function by function. Line 323 is where I've stopped for now. Rika: incomplete code is code, code doesnt have to be buildable to be pushable 😛 Varriount: Rika: I might take some inspiration from Python's pathlib, but in my opinion it does slightly too much for my taste - https://docs.python.org/3/library/pathlib.html Rika: i love pathlib Varriount: Primarily the filesystem operations. Demos[m]: Check out c++'s std::filesystem::path, it also takes insparation from pathlib but is a little more focused on just paths Rika: the FS ones are a bit weird i think too Varriount: Demos: Thanks, I will Rika: but there's already `os` though, any issues with os? Varriount: Rika: Nothing in particular. I just want to do this. Rika: ah i see that's fine Varriount: Demos: I'll admit I had discounted C++ - I assumed that any path API would be too foreign to take any ideas from Demos[m]: nope! Varriount: Rika: I like pathlib too, although it's a pain when you end up passing a Path object to a function expecting a string path. Demos[m]: tbqh c++ is pretty close to nim semantically Rika: just `converter toSt`-- well python wouldnt have this but if pathlib were a nim module i'd do this in a heartbeat Varriount: Eh, you would still have problems if, say, you passed a sequence of Path types to a function expecting a sequence of string paths. Rika: another `converter toOAString[S: openarray](sq: S[Path]): S[string]` or something or so Rika: i dont think that'd work but you get my idea Rika: ahaha, its gonna be a pain yes' Varriount: Yeah, but what about other containers? Or a sequence of sequence of strings Varriount: Converters are tempting, though, I'll admit Varriount: Demos: It's been a while since I've heard from you - are you in a different time zone or something? Demos[m]: nah just busy, new job and all Demos[m]: less time for nim Varriount: Don't I know it. :< Demos[m]: well less busy now Demos[m]: what with covid-19 Demos[m]: I am in a different timezone though, moved to washington Varriount: Ah, that would explain it. Varriount: My sleep schedule has lost all sense of normalcy without the constraint of appointments, etc. Demos[m]: same Demos[m]: and apperently same for my entire team :D Demos[m]: it's 3AM here.... Varriount: Nearly 6 AM here Demos[m]: that almost reasonable Varriount: It might be, if I hadn't woken up at 3:00 yesterday. PMunch: Depends, is it 6AM because you got up, or 6AM because you haven't gone to bed.. Demos[m]: heh PMunch: I at least have video meetings and such still, otherwise my sleep cycle would be completely out of wack as well PMunch: Last time I was left to myself for an extended period of time my cycle drifted 12 hours in about two-three weeks Demos[m]: yeah we've been less and less productive as this has gone on PMunch: So I got up at 8PM and went to bed around 11-12AM PMunch: That was, strange Demos[m]: my problem is I start playing Kerbal Space Program and forget to take my sleepy meds PMunch: And super inconvenient if I wanted to grab some beers with friends. Basically getting up, having breakfast and then head to a bar. Get home from the bar and realise it's mid-day for me, so now I'm jut going to be drunk for the rest of the day.. PMunch: That game is so much fun! Demos[m]: you can still go to bars? PMunch: Nah, this was last time I was without any schedule restrictions PMunch: When I was studying and my GF was out of town PMunch: nim dump? Vindaar: I remember there was one which just echoed the paths it checked at runtime Varriount: Verbosity maybe? Vindaar: nope :/ Vindaar: well, figured it out without it. I was confused, because I was just testing ggplotnim on windows. And I was sure to get the same "could not load libcairo2.dll" error @Lecale got the other day (and I got a few weeks ago). ⏎ But the thing is, by installing emacs on windows and adding its `bin` dir to PATH I also installed cairo, since emacs on windows uses GTK Araq: > A prime example are the DB modules that always return result values as strings Araq: no, it's a prime example for ranting about what you don't understand. Araq: and what's wrong with 'wordwrap' anyway Rika: i think the DB modules are fine Rika: ive never used wordwrap but i think they think its an issue because its tiny Araq: nre was an external contribution and it shows PMunch: til wordwrap Araq: so instead of 'nre' it should have been left in a Nimble package and then others can import nre and the same API differences would exist and in everyday life nothing whatsoever would change Araq: but you couldn't complain about it *shrug* Araq: > but `seek` and `position` are better names for `setPosition` and `getPosition` respectively Araq: I don't agree Rika: why so for the 2nd one? Araq: 'seek' doesn't "seek" (= search) for anything whatsoever, the name is bullshit Rika: that makes sense yeah Rika: but the position one? Araq: getPosition was chosen but its cost is unclear, could be an expensive syscall (unlikely though) Araq: same for setPosition Araq: setPosition vs setFilePos is a valid complaint but it's nitpicking defection: Question, I'm using the terminal module to make a simple little TUI app, is there a nicer way to clear all of the junk in scrollback rather than using `stdout.write("\e[3J")` Rika: that makes me feel like making an ansicodes module or something defection: That would be cool, have the possibility of merging some of that into the terminal module too considering there's some common escape sequences in there already. Rika: well the issue of having an ansicodes library is that i either > only handle output ansicodes or > i require raw mode to handle input ansi codes too or something Rika: i dont think thats a big issue actually Araq: defection, there is only eraseScreen Araq: and in general terminal.nim only offers what is portable Araq: for posix specific stuff there is also termios.nim defection: Fair enough, I don't know all of the intricacies of terminals/ANSI stuff :P defection: Nice, I'll have to take a look! Araq: speaking of which, 'nimble init' is broken on Windows with its terminal based UI zetashift: what's broken on it? zetashift: seems to work fine for me, using Windows 10 Recruit_main707: for me it also seems finew Araq: run it inside VSCode Recruit_main707: it also seems to work Araq: never mind then, for me it didn't PMunch: defection https://nim-lang.org/docs/terminal.html#eraseScreen.t PMunch: Oh sorry, didn't see that others had answered you already alehander92: guys, what do you think about `nimtrace program.nim` which compiles a program with `-d:nimtrace` and just prints out callgraph in real time alehander92: similar to way `strace program` works for syscalls krux02: hard to say. Usability highly on the quality of the implementation. krux02: also you should explore existing tracers for c++, how much does it apply to Nim as well Araq: alehander92: is your zero-functional currently broken or is it my PR... alehander92: sorry! alehander92: krux02 you're right, i work on something like that in my work, but i admit i havent analyzed enough c/c++ solutions alehander92: the fastest way i've done it until now is by producing a minimal binary trace which is later postprocessed to a more analyzeable callgraph alehander92: but i admit this can be also be maybe doable with `-finstrument`* family of gcc/clang(?) + some objdump info alehander92: however i am not sure how easy is to collect sensible info for args this way : i was more playing with the idea of more naive prettyprinting high level hook alehander92: for smaller/mid programs quick introspection alehander92: Araq hm sorry, have to look at it alehander92: https://github.com/nim-lang/Nim/pull/13776/checks?check_run_id=539189372 ? disbot: ➥ '.push raises: []' now also affects proc types alehander92: honestly sorry, havent looked at it lately no idea alehander92: ugh i pressed re-run, can i like cancel it alehander92: what i dont understand is how can it fail only on windows, if its a type error issue PMunch: alehander92: `when defined(windows)` Recruit_main707: can somebody from irc or gitter or other try to @ everyone and see if it works in discord? Rika: i doubt it doed alehander92: sorry Rika: does alehander92: i cant think of an obvious when defined(windows) alehander92: recruit this can annoy a lot of people :) Recruit_main707: personal @s dont woek because we have an special number after the name, but everyone doesnt. Recruit_main707: alehander92: its in the name of science Rika: the bot probably does sanitizing nonetheless aEverr: <@259277943275126785> Recruit_main707: wow Rika: i see aEverr: <@386230567571554305> aEverr: muahahaha Recruit_main707: is this your alt? Rika: no aEverr: no Recruit_main707: are you copying the number? aEverr: no Rika: no Rika: (i am) Recruit_main707: it works out of the box? wow Recruit_main707: this is new right? Rika: i am copyinh the number pls Rika: right click copy id then <@number> Rika: lmao 😛 aEverr: i'm hesitant on trying an everyone ping though aEverr: for good reasons Recruit_main707: https://tenor.com/view/not-funny-didnt-laugh-not-funny-didnt-laugh-dancing-money-dance-gif-14496446 aEverr: cant see gifs on my irc client lol Recruit_main707: well, we could ping everyone for nim updates and such aEverr: i really wanna try it but also i dont want to fucking die Araq: alehander92: well if you didn't touch it it must be my PR alehander92: guys you can test it in nim-offtopic alehander92: if its connected to discord Rika: we uh did alehander92: and nim-lang/twitch on gitter Rika: uh Recruit_main707: yep, we already have awaken discord offtopic XD Rika: uh yeah we've prolly incurred the wrath of literally everyone on the discord server Simula: anyone have experience with the posix module? how do i use `getgrname`? liblq-dev: quite literally Simula: no matter what i pass it, i get a null pointer in return alehander92: and gitter alehander92: Araq well, i am not sure but https://github.com/zero-functional/zero-functional/commits/master last commit is from february alehander92: sorry for re-running the ci again Simula: oh i'm using the api wrong Simula: aaaaaand i found a compiler bug Rika: ? what happened Simula: `stat` from posix_utils is broken alehander92: thats maybe a stdlib bug Araq: so ... how does 'ensures' work Simula: https://pastebin.com/cgc6QAU6 Araq: SImula: that's a stdlib/OS combination problem, not a compiler bug Simula: aaaaaand i can't get a minimal example to fail Simula: oh fun Simula: ah, it looks like the `$` is just broken for the Stat type Araq: sure continue to claim nonsense, in reality Stat's very definition is broken Araq: for your OS Rika: what os are you on Araq: ZergLinux Simula: im not claiming nonsense lmao, using it properly works fine Simula: fedora 31 Simula: as long as you don't try `$mystat` it works alehander92: is it a valid strategy to alehander92: discard async futures on purpose in test code alehander92: to test that internal logic deals with some possible logic races krux02: Simula: can you try to just delete the filed pad0 and reserved from the definition of Stat? krux02: as far as I can tell right now, they are not used and don't serve any purpose. krux02: Araq: can you please stop insulting people who report problems in Nim? krux02: It is not job of people to correctly categorize a bug in Nim. PMunch: alehander42, why would you do that? Araq: krux02: I'm not aware I insulted anybody, I did categorize the bug for the OP alehander92: PMunch well, because my ui can generate events in a bit random order so two operations might happen in a bit interleaving way PMunch: Araq, Simula, pretty sure it's this error you're seeing: https://github.com/nim-lang/Nim/pull/12655 Simula: it's not the first time you've gotten aggressive because someone was harmlessly wrong alehander92: so i want my cli test runner to simulate that, but asyncCheck is probably what i want yeah :D disbot: ➥ Fix issue with fields trying to use wrong name ; snippet at 12https://play.nim-lang.org/#ix=2aYc PMunch: I don't think he's aggressive, just a limitation of the text medium :P krux02: Araq: Here you did isult: "sure continue to claim nonsense," Araq: I didn't. PMunch: alehander42, yeah asyncCheck essentially just adds a callback that will raise the error PMunch: Hi didn't insult him, an insult would be "sure you idiot, continue to claim nonsense" Simula: the thing is, i wasn't claiming nonsense Simula: i was wrong at first and corrected myself PMunch: Well, it wasn't a compiler bug PMunch: So it was nonsense, just not maliciously so Simula: and i corrected myself Araq: it's neither a compiler bug nor a $ bug PMunch: It's not $ that's broken either Simula: and yet, trying to use $ on a Stat is bhroken PMunch: It's the Stat type that incorrectly imports fields from the C definition PMunch: Yes, because it tries to access the field pad0 which doesn't exists PMunch: As the field is called __pad0 alehander92: i think its just a language thing maybe Araq: Simula: I'm sorry anyway, but no offense was implied Simula: thank you, i appreciate it PMunch: If you look at the PR I linked you will see that there is an issue with some of the posix parts where this is the case, but I haven't found a good way to detect them all.. alehander92: oh well i need to read stuff with nim-prompt, i just realized this is blocking my async loop PMunch: Basically that field should be declared with {.importc: "__pad0".} alehander92: that explains why i saw it used in a thread iirc alehander92: ok todo for now krux02: PMunch: that field just needs to be deleted krux02: that field is supposed to be private. That is the reason it stearts with __ PMunch: Nope, then Nim and C would disagree on the size of that struct krux02: Nope krux02: they won't krux02: I implemented the sizeof calculation in Nim krux02: and when a type is imported, it doesn't calculate the size on the size side. PMunch: Oh, so it actually takes that into consideration? Cool krux02: yes krux02: you should be able to safely delete it. PMunch: I've just run into issues when I've declared a struct wrong krux02: you could test it if you are not sure about it. krux02: can you open an issue about it? Then I can take a look into it. PMunch: But those weren't imported, just declared as the same kind PMunch: You can probably reuse my PR? krux02: I don.t know how to reuse a PR, never did those git magic tricks. krux02: can you link your issue? krux02: PR? PMunch: And alehander92, I think you are right, it's probably a language thing. I'm from a place known for our rough language and cursing, so my bar for insults is probably a bit higher :P PMunch: It's the one I linked a second ago #12655 disbot: https://github.com/nim-lang/Nim/pull/12655 -- 3Fix issue with fields trying to use wrong name ; snippet at 12https://play.nim-lang.org/#ix=2aYc alehander92: PMunch well cursing is bad alehander92: i meant that nonsense might just mean "not reasonable/incorrect alehander92: " in some languages/cultures maybe, not so sure how it translates PMunch: What do you mean "cursing is bad", it's part of our culture.. PMunch: To the point were insulting a policeman is legal where I'm from. Was a ruling on it a couple of years ago sheerluck: I don't like when people quarrel https://bit.ly/33O0WOq PMunch: Some drunken guy called a policeman a "jævla hestkuk" (common curse here, translates to something like a fucking horse cock) and was charged with insulting an officer. But the courts said that in northern Norway that isn't considered a curse and the guy was acquitted. krux02: PMunch, I just wrote a comment in your PR. I can't take it over. I am sorry. I have other things to do. alehander92: well PMunch I believe you , but i still think its ugly clyybber: Araq: What does #13778 do ? disbot: https://github.com/nim-lang/Nim/pull/13778 -- 3new minor feature: macros for proc types, to be documented clyybber: Is it related to pragma macros like {.async.} clyybber: ? disruptek: lets us annotate for drnim. clyybber: how does it look? clyybber: or work? disruptek: proc foo(x: int) {.requires: x > 0.} clyybber: Oh, and that wasn't possible before? clyybber: I thought the async macro did something like that? disruptek: i think it's the syntax that needed doing. disruptek: looks like it's mostly useful for type foo: proc ... {.requires.} alehander92: ok so we can write alehander92: complexity in signatures alehander92: with that ! Araq: clyybber: it's for 'async' proc types Araq: drnim doesn't need it because drnim simply introduces new pragmas :P shashlick: Yardanico: nice work! can you please put tests in place and maybe a CI so that I can test ast2 and make sure stuff still works with it PMunch: Is DrNim the proof thingy? Araq: yes alehander92: Araq is there a reason alehander92: hm, `tags` is not picked up when `async` is used alehander92: is this somehow related to your fix Araq: well it allows you to write 'type T = proc () {.async.}' Araq: and previously you couldn't alehander92: ah sorry ok pigmej: Hey guys pigmej: .choosenim/toolchains/nim-1.0.6/lib/impure/re.nim(77, 28) Error: VM is only allowed to 'cast' between integers and/or floats of same size pigmej: is that known? pigmej: unless I'm doing something very wrong with RE but ... I don't think so leorize[m]: you're definitely doing something really wrong :p clyybber: Araq: Ah, nice! alehander92: Araq so can i use alehander92: tags: [] with async alehander92: sorry, it just seems it doesnt get triggered in my program Rika: pigmej what are you doing?? pigmej: ok so that was clearly wtf pigmej: I just did `const foo = re"foo"` pigmej: and that raises that error leorize[m]: you can't do that leorize[m]: it's to be a `let` clyybber: basically, re doesn't work at CT yet leorize[m]: this is because re is just a high-level abstraction over libpcre Rika: is nitely's regex CT compatible? pigmej: I know that I can't pigmej: but still the error is at least awkward leorize[m]: @Rika: yes Rika: noice leorize[m]: @pigmej: well what caused the error should be fixed in 1.2 leorize[m]: since we get integer casting in VM now iirc clyybber: Araq: Is setLen supposed to zero out the memory? Araq: I think so alehander92: can i somehow alehander92: preserve a non closure reference to a procedure alehander92: in a field alehander92: nimcall ? alehander92: from older nim chats / github Araq: system.rawEnv alehander92: so does nimcall check if something is a closure watzon: I have to say, nim has a pretty nice built in PEG parser https://nim-lang.org/docs/pegs.html disruptek: !repo npeg disbot: https://github.com/zevv/npeg -- 9npeg: 11PEGs for Nim, another take 15 91⭐ 4🍴 disruptek: i guess i can't use dot operators in the compiler. geotre: Is there anything in stdlib to convert camelCase to snake_case etc? "thisCase" -> "this_case" ? disruptek: why? Yardanico: nim has partial case insensitivity anyway Yardanico: thisCall() == this_call() Yardanico: thisVar == this_var geotre: Interop with json APIs that use that for keys Yardanico: you don't have to really Yardanico: you can just define fields in your object as snake_case and then use them as camelCase geotre: Yeah geotre: I just want to ideally write the nim obj defs using camel case geotre: Better for autocomplete etc disruptek: go for it. disruptek: i have a sanitizer in openapi that you can adapt. search for sanitizer. disruptek: !repo openapi disbot: https://github.com/disruptek/openapi -- 9openapi: 11OpenAPI Code Generator for Nim 15 19⭐ 1🍴 7& 4 more... geotre: Nice one will have a look disruptek: it will convert any string into a valid nim identifier. geotre: Would be better if it was in stdlib so I could add something to the nim json module geotre: Ah that's not what I'm really looking for disruptek: no such animal exists. geotre: Ok thanks disruptek: i think you should look at my solution, first. geotre: I will have a look but it sounds like it's doing the opposite (i.e. snake_case -> camelCase) disruptek: that's why you need to look at the code. geotre: https://github.com/disruptek/openapi/search?q=sanitizer&unscoped_q=sanitizer geotre: No results disruptek: it has all the levers that you want. disruptek: see src/openapi/codegen.nim -- sanitizeIdentifier() geotre: Ok got it disruptek: just toggle elideUnder. lbart: what is the best way to create a type with a const field? example type myNewType = object data: t field = 123 Yardanico: there's no such a way Rika: make it a normal const Rika: outside the type Rika: consts are a compile time construct, they no longer "exist" in run time Rika: imagine them as template variables lbart: ok thanks ksandvik: Generic question, would using const for all cases we know will never change be performance-wise better (compiled away) than let? Or it just looks bad? Yardanico: well it'll be a bit better Yardanico: since you will set it at compile-time, and at runtime it will just *be there* Yardanico: you wouldn't spend time at runtime calculating that value ksandvik: I'm all in for as much as possible compile-time away coding. Yardanico: don't overdo it pls :P Rika: let is just an "immutable" RT var Rika: why? whats wrong with overdoing it? Yardanico: because then you have programs which do everything at compile-time and then nothing at runtime Yardanico: dont abuse compiletime xd disruptek: sounds good to me. Rika: is that an issue? disruptek: only for Yardanico. Rika: yardanico prolly got scarred by the mainly compile time discord library ksandvik: With large apps there's always some time needed to initialize the runtime. If that's compiled away then the better. ksandvik: Small to medum ones, does not really matter. ksandvik: I should read the manual but does Nim have a similar concept as constexpr in C++? ksandvik: We use that a lot in large systems to build compile time constants from defined functions. Yardanico: I think nim compiler automatically figures out if something can be computed at compile-time ksandvik: Are macros compile time expresions, that would then do the same thing? leorize: anything when put in a compile-time context will be run at compile time krux02: ksandvik, computations at compile time are generally slow as they are computed on a vm similar to a python like VM. krux02: runtime is much better at computation. leorize: 4raq benchmarks show that Nim VM is faster than python :P leorize: yea, but it's still slow :P ksandvik: That is fine with fast computers, I rather take the hit then than for customers running the app. krux02: After what really matters is turnaround time. And if you can pick for your initialization to run at compilte time or at startup time of the program. You should pick startup time krux02: because it is faster. ksandvik: Well, I rather code for users than for myself. krux02: both is important. krux02: But during development, you are the most important user of your application. krux02: don't underestimate that. ksandvik: I'm talking about large scale programs, though, similar to Final cut Pro X and so on, where every millisecond counts. For these small command line tools and so on, does not really matter. krux02: Final cut Pro X is an application where everey millisecond counts? ksandvik: Indeed. Startup time is measured. Same with other large scale apps. krux02: yea ksandvik: If we have millions of objects that need to be created it impacts the startup time. krux02: you should start thinking about that, as soon as your are as big as tha program. ksandvik: Same with embedded systems I'm working on just now. We try to squeeze everything we get from compile time. krux02: if you create millions of objects during every compilation, your development experience might become invisible. ksandvik: Most embedded system are running low-end ARM chips and not much RAM. And the Flash is also not that fast. krux02: just a figure, what would you choose: ksandvik: It depends, with incremental compilation the large sized pro apps actually built really fast, I could tweak something and have it up and running in 10 seconds. krux02: 1 minute extra compilation time vm 1 second extra startup time. Rika: we dont got incremental compilation yet do we ksandvik: Engineering management would say 1 ms startup time gain. or more. krux02: somebody is working on it. krux02: but we don't have incremental compilation. ksandvik: They just buy us faster workstations if compilation time could squeeze out better performance. Rika: i think what krux is basically saying is that if you're developing it and it's not released for prod yet go for the startup time first krux02: btw how long does final cut pro take to start up? Rika: and once it's a burden then switch to CT Yardanico: yeah @Rika i agree krux02: ^^ yes thask you Yardanico: in most cases switching from rt to ct can be as simple as switching "let" to "const" ksandvik: I don't remember the exact numbers just now - — I know the flow of what needs tobe set up and it's quite a lot. Rika: once the importance shifts from "i must finish this as quickly as possible" to "our users need the speed now" switch Rika: its unnecessary to spend so much time in CT if you're not releasing that binary in prod ksandvik: What I'm saying is for command line tools and simple stuff like that, no worry about all this. Rika: just like why we dont dev with -d:release on all the time krux02: But honestly, you can't compare final cut pro x, with products that are developed by individuals in Nim. ksandvik: If you do large scale embedded work, web servers, or pro apps, then this is what we are worried about on a daily scale. krux02: Final cut pro has apple behind it. Rika: once theyre released and fully fledged sure i guess krux02: no really. You can't. krux02: Final Cut pro (never used it), is probably a pretty bloated application that has a lot of startup time wasted on unnecessary stuff. ksandvik: If Nim wants to be a systems/pro app dev language, these are the things engineers look at. I do like Nim, I think it's a good start, krux02: I don't know how long it need to start up, but I guess is is probably more than 15 seconds. ksandvik: Final Cut pro X, yes and no. It was a full rewrite but the functionality required is *a lot*. ksandvik: Just the UI updating with *thousands* of views takes its own toll. ksandvik: Audio apps same thing. krux02: ksandvik, I don't know what your message here it. krux02: is ksandvik: My message is that for toy apps and command line tools, yes anything goes. For pro apps and embedded systems, thinking about data structures and compile time optimization is a daily task. Recruit_main707: how is this done: `from x import *` in nim? Yardanico: "import module" Recruit_main707: oki krux02: ksandvik, and yet you sound like you have no idea what Nim actually does, otherwise you wouldn't say such things. ksandvik: That's why I asked for constexpr and if macros are compiled time executions. krux02: Nim is fast. Quite fast to compile. Extremely fast to execute, and metaprogramming beyond the possibilities of any other languge anybody ever showed to me. Yardanico: krux02: what about the forbidden word Yardanico: lisp krux02: we recently had a lisper change to Nim krux02: axion is his name Yardanico: well another lisper with who I talked on tg uses emacs with lisp and doesn't agree with that :P ksandvik: Lisp is fine but for runtime execution, uh huh, so many failed Apple projects that tried to use Lisp but that's another story (when I'm retired) Yardanico: yeah, nim is easier to write after all krux02: Nim has better metaprogramming possibilities than lisp, because Nim has type information in the AST Yardanico: I mean it's easier for new people to understand and stuff krux02: I do a bit of Lisp as well, but only emacs lisp. krux02: lisp is cool, especially the dynamic lisp environment where everything can be changed at runtime. Nim doesn't have that. dadada: krux02: do you know how rust's new metaprogramming capabilities compare? krux02: actually I do. Yardanico: uh oh krux02: Rust metaprogramming work on token streams. Yardanico: $*>?%*$ Yardanico: {}#:: krux02: so you basically write your own parser in it. krux02: That also means, no type information. krux02: not sure what functions macros can call though. Rika: sounds super painful to use Rika: macros on nim are unlike any macros ive ever fuckin seen and i love it zetashift: this type mismatch error is driving me insane, can somebody try `nimble test` on my repo https://github.com/zetashift/naytracer and see if they get a type mismatch error? Yardanico: i get it too Yardanico: on latest devel zetashift: ok so it shouldn't be an OS thing Rika: you got no CI? zetashift: No, I don't really have any experience with CI zetashift: most of my programming stuff are small scripts for bioinformatics D: zetashift: oh wow I can reproduce this problem zetashift: in the playground Yardanico: nice! (:P) zetashift: it seems to be because in my tests I have a 3x3 matrix too zetashift: https://play.nim-lang.org/#ix=2fGK anyone know if this is because type inference? krux02: zetashift: what I can tell, your scipt misses a `let`. Rika: your `==` proc only allows for equal size matrices to be compared Rika: wait huh one moment axion: I was summoned. Rika: hello lisp convert axion: Oh talking about Lisp I see. axion: There's a lot of well-known software written in Lisp. It's kind of amazing a language 20 years older than C is still kicking strong. Rika: the discussion passed a few hours ago afaik axion: and newer languages like Nim taking advantage of some of its main selling points for a change is welcome Rika: so yeah sadly it seems like the people who mentioned it are gone ksandvik: There's this saying that each generation of new computer scientists will re-invent something that was available in Li ksandvik: LISP in the sixties. Rika: like haskell? axion: Greenspun's Tenth Rule ksandvik: I've seen in the parking space here a custom number plate CADR. axion: Until last month I was using CL every day for nearly 2 decades. Nim is pretty great. axion: But I haven't been coding in a couple days. Trying to build something :) zetashift: @krux02 yea because I commented out a wrong line :P: https://play.nim-lang.org/#ix=2fGO ksandvik: tuལ༏འ ksandvik: ༣།་མནན \༴qbradley'\349jhngfdsio disruptek: tbh you had me at tuལ༏འ ksandvik: Ooops, cleaning my keyboard and had this view focused. ksandvik: Tibetan :-). ksandvik: Have to take care of these MacBookPro keyboards, tiny particles get in and a key is blocked…. treeform: Tibetan is an impossible language to learn... ksandvik: I have some non-work related small projects I will try to use Nim for. ksandvik: ག་ལེ་ག་ལེར་ - slowly slowly. axion: Also I never got an answer to my nimble question a couple days ago :/ treeform: what was you nimble question? axion: I want a way to be able to run `nimble test` for any project regardless of its nimscript config, and be able to have it placed the compiled code in a dedicated build directory and not clutter up my directory tree, but of course, --outdir:build or any flag for that matter doesn't work with nimble test. axion: Basically, I'm trying to run all the tests for the project whose file I am visiting with an editor key binding ksandvik: Sounds reasonable. axion: I don't want to have to depend on project-specific nimscript to enable flags or anything like that. I just want it to work for any project treeform: axion, I have no clue how to do that. I suggest forum post. Probably will require custom reading of nimble files. ksandvik: Or maybe a feature request via github. A global nimble test that finds all the test targets and keeps the output separate from the src file system sounds like a good idea. axion: It's just unfortunate that no flags are honored for `nimble test`. I also want to hide hints too. My only solution currently is to edit every project's config.nims axion: Mostly because I'm still rather new to this tooling and language in general. I'm sure there is a nicer solution somewhere krux02: axion: my personal recommendation, forget about nimble. It isn't really maintained anymore, and the implementation is beyond repair. kungtotte: krux02: even for package management? krux02: either make your project use submodules/subtrees for the dependencies and add the paths manually to the build script (just bash/bat but only a single call to nim with many args), or try using https://github.com/disruptek/nimph krux02: kungtotte, if nimble works for you and you like it or you rely on it, you can continue to use it. Recruit_main707: is there some python to nim transpiler? at least for classes? krux02: In other words, if it serves your needs very well. I just realized for my part, that nimble tries to do many things that I don't want. Yardanico: @Recruit_main707 There's https://github.com/metacraft-labs/py2nim Yardanico: and https://github.com/metacraft-labs/py2nim_deprecated/ krux02: like it hides basically every error or warning message. Then something goes wrong and you have to restart your job again but this time with the "verbose" flag and then you drown in massages that you don't care about. Yardanico: but really there's no such a tool which works for most python code Yardanico: translate by hand :) Recruit_main707: which is an script that calls another program XD, ill have a look at it. Recruit_main707: Yaradinco: but im lazyyyyy Yardanico: overcome the laziness Yardanico: make your will stronger! krux02: And last but not least, it is impossible to debug a .nimble file. ksandvik: Looks like someone is working on nimble sources in github. axion: Thanks but I was planning on waiting for nimph to mature a bit. I'd rather have reliable yet limited tooling. krux02: axion, yes krux02: but until then, you can just work without a build tool. axion: I don't want to mess with git submodules/version pinning etc manually axion: That's _why_ I use a build tool leorize: nimph actually works better whan nimble :P axion: Well watching disruptek spend hours fixing bugs didn't get me excited about it just yet Yardanico: lol ksandvik: There's something beautiful with cargo, hope we only have one official/supported Nim project build tool. leorize: better than no hours of bug fixing for nimble :P Yardanico: well afaik d0m96 is busy these days ksandvik: build/run/test/doc/publish ksandvik: and new, of course! ksandvik: Even better, a way to add custom tools into this leorize: that's already a thing leorize: nimble files are nimscript, and you can specify custom tasks there that could be run via: nimble zetashift: dom96 should just bribe a facebook manager to let him work on Nim Yardanico: or just rewrite facebook in nim Yardanico: easy ksandvik: Facebook has turned into a big rust-fanfest place nowadays. zetashift: "The secret tool FB is using to spy on you! Try it out now, Nim!" zetashift: Rust did a lot of things well, can't blame em kungtotte: Better they play around with Rust than yet another JS framework Yardanico: better Rust than PHP ksandvik: rust is used there for their back-end dev tools. Mercury was rewritten in Rust. ksandvik: Facebook used to be a big PHP-house, maybe still there are plenty of remnants of that there. zetashift: they are putting a bit of work into a ReasonML/OCaml to PHP compiler zetashift: / transpiler whatever floats your boat axion: The day nimble caves into the "rewrite it in rust" meme is the day I go back to Lisp :) Yardanico: wdym lol zetashift: Nim likes dogfooding a lot I don't think it's gonna get rewritten in another language lmao axion: Everything is rewritten in Rust these days. That technical debt will undoubtedly have to be paid eventually. axion: and plus, this is Nim :) Yardanico: not nim tools though Yardanico: nim tries to rewrite everything in nim Yardanico: playground in nim, forum in nim, nimble in nim, nim in nim leorize: nim compiler still haven't been rewritten in (idiomatic) nim yet :P Yardanico: sadly the website is not in nim (I mean it's static but the generator isn't in nim) ksandvik: Yes, Nim should be written in nim. Same with a build tool (note singular)/ Yardanico: well, it is written in nim axion: Yup, which is why I'm here with Nim to stay. Just don't like that _nearly_ everything is being rewritten in Rust kungtotte: nimph can't handle perfectly valid URLs for remotes, so that's kind of a non-starter for me. leorize: disruptek: ^ leorize: you gotta investigate that axion: I agree there should be a singular build tool. nimble was that, but if it's not maintained and beyond repair, the documentation and official releases need to switch it out Yardanico: well nimble is still maintained leorize: the build tool is the nim compiler itself Yardanico: well yeah Yardanico: nimscript is in nim compiler leorize: I'd say nimble is just a dependency manager disruptek: kungtotte: gimme an example or file a bug report, please. axion: Well, I think more than a compiler and dependency manager is part of build infrastructure, but that's just me kungtotte: Just double-checked the nimph url issue, it works on another repo so it's definitely choking on this specific URL watzon: I'm confused as to how nimble is "beyond repair" kungtotte: disruptek: the URL in question is [email protected]:~kungtotte/dtt watzon: Works pretty well for me ksandvik: The nim community is not that big so the more fractured the build story is, the harder it is to sell. leorize: nimble and nimph uses the same project configuration scheme leorize: via .nimble file ksandvik: I must say, cargo has been a big evangelizing point for Rust. disruptek: honestly, the only nimph bugs i know about arrive from the compiler. Rika: `Just don't like that nearly everything is being rewritten in Rust` what's the issue with that? kungtotte: Because most people do RIIR the wrong way and end up costing tons of resources implementing a version of the old code that doesn't actually deliver all of the features of the old code. Rika: RIIR? leorize: rewrite it in rust kungtotte: ^ watzon: yep disruptek: kungtotte: https://github.com/disruptek/nimph/issues/121 disbot: ➥ special handling is needed for either GitHub or non-GitHub URLs axion: 1) Technical debt. 2) Incompetent developers expecting different results. kungtotte: See? The phenomenon has an acronym. That means it's happening too much. watzon: You end up saying "well I'm rewriting this in rust, may as well rewrite that too" Rika: *whistles* watzon: And before you know is the scope has gotten out of control Rika: I totally don't do that, of course not, no leorize: it's not too surprising tbh Rika: *whistles harder* I swear I don't leorize: you can't even get the same result just rewriting in the same language watzon: I'm guilty haha. It's easy to get a bit over excited. leorize: people thought rust is the "magic" fix for all of their bugs leorize: the sad reality is that it's not, usually you end up with more bugs than what you started with ksandvik: The rust rewrites I know of are usually python or similar tools that need to be rewritten for better performance to scale — something where Nim would be as suitable. kungtotte: No programming language has been invented that prevents bugs at a greater rate than writing more code produces bugs. axion: Sure. After all rubustness is inversely proprtional to the number of users. ksandvik: Or then total new system level projects such as Google's Fuchsia OS. They actually tried go for a while. kungtotte: ksandvik: there's a bunch of zealotry going on where people do driveby suggestions on random projects to rewrite them in Rust. That doesn't really happen (at scale) with any other language. ksandvik: Rust is just now the 'hipster' language, me thinks. It's not that bad, actually. But overkill for many cases. Yardanico: honestly I just don't understand why Rust is good for writing high-level apps like web server backends or typical GUI apps ksandvik: Exactly. leorize: it's mainly driven by rust claims of "1000% memory safety" disruptek: axion: if there's something you can criticize in nimph, i'm all ears. Yardanico: I understand when it's used for writing more low-level stuff Yardanico: where safety can actually hel Yardanico: help kungtotte: Safety helps everywhere, it just becomes a problem much faster in certain domains axion: disruptek: I will let you know if I ever decide to use it. For now, I'm sticking with what Nim ships with and mentions in their docs as it's what most users will have and be familiar with. leorize: people idea was: written in C => full of memory-related bugs leorize: and rust was like this magical cure Rika: Idk, I've seen bandwagoning when it comes to rust ksandvik: It also helps that the Rust project really focused on a very good developer community. ksandvik: Things like that go far. disruptek: sure. it'd be great if nim had nice tooling like rust. watzon: Right? disruptek: but as long as people refuse to use nice nim tooling, it won't improve. leorize: well when you have mozilla backing and use c++-style syntax, it'd be surprising if it doesn't have that much traction disruptek: because, as axion claims, use is inversely proportional to robustness. disruptek: people like this are part of the problem and not part of the solution. axion: It's second main driving point was that it produces efficient machine code. Now look at Rust developers. They are making more use of dynamic dispatch to alleviate the compile times, even though the compiler is 3x faster than it was a year or 2 ago axion: That's mostly because a large project might have the same library in its transitive dependency graph multiple times, with tons of monomorphization for each ksandvik: doesn't that remind me of my morning comments :-) about compilers and runtime. axion: It's kind of ironic that Rust developers are starting to trend towards dynamic dispatch if you ask me. Recruit_main707: function overloading with `+, -, *, /` doesnt work when compiled to dll? leorize: turns out that rust is not easy to compile :) ksandvik: I used to program in Objective-C for 12 years non-stop so I know the pain. Yardanico: @Recruit_main707 what do you mean Yardanico: it'll still work lol kungtotte: Compile times and binary sizes are both major issues with Rust, IMO. They're getting better, but they're not great. Yardanico: you're probably doing something wrong :P Recruit_main707: i guess... kungtotte: This was a while ago but I remember trying some examples from the Rust book and even something as simple as a fibonacci function ended up being like a 5MB binary on my system Rika: So I just extremely quickly skimmed through how Zig does exceptions and errors, is there a way to "enforce catching errors" like that in nim? Yardanico: {.raises: [].} I guess? leorize: return a value :) Yardanico: annonate your procs with that and you'll have to catch all exceptions :P leorize: the best way to enforce error handling is to return a value :) leorize: !repo nim-result Recruit_main707: its throwing this error, which confuses me if its actually the name: https://play.nim-lang.org/#ix=2fHD disbot: https://github.com/arnetheduck/nim-result -- 9nim-result: 11Friendly, exception-free value-or-error returns, similar to Option[T] 15 24⭐ 2🍴 7& 4 more... disruptek: not that friendly. disruptek: !repo badresult disbot: https://github.com/disruptek/badresults -- 9badresults: 11like results but worse 15 0⭐ 0🍴 disruptek: more friendly. leorize: Recruit_main707: can you make a reproducible sample and file an issue? Rika: disruptek what's the differenxe Yardanico: @Recruit_main707 that's a codegen issue Yardanico: if it's erroring on the c compiler stage disruptek: nim-results requires that you impl a side-effect-free $ for every value you return in a Result. Recruit_main707: Yaradinco: https://play.nim-lang.org/#ix=2fHE disruptek: obnoxious, imo. Yardanico: why are you doing exportc? Recruit_main707: dont i need both flags? disruptek: for semaphores, yes. disruptek: highly recommended. leorize: Recruit_main707: why do you need them? Recruit_main707: this is compiled to a dll leorize: so? leorize: do you call them from outside the dll? Recruit_main707: thats it XD, yes, thats the intention Rika: Yardanico: why? leorize: Recruit_main707: then you need to export them with C-friendly name leorize: something like `exportc: "add_vector"` Recruit_main707: well, thinking it better there was no way it worked in python when exported so... leorize: what are you trying to do lol Recruit_main707: essentially, someone made a bet, and if i transpile some utils (compatible with python), they will create a nim rocket league bot and will make a branch for my nim version of this utils. Recruit_main707: so, a python library to sum up :p leorize: ok I still don't know why you want to make it a dll :p Recruit_main707: for interoping with python, i am gonna wrap my functions back to a user friendly python file/s leorize: ah, use nimpy leorize: problem solved :P leorize: !repo nimpy disbot: https://github.com/yglukhov/nimpy -- 9nimpy: 11Nim - Python bridge 15 507⭐ 25🍴 7& 4 more... Recruit_main707: it throwed me some weird errors leorize: they maybe you should investigate that :P leorize: nimpy is the best way to interact between nim and python atm disruptek: ~news disbot: news: 11the #nim-news channel has a Nim news feed of updates to pull requests, issues, and packages. -- disruptek Recruit_main707: nimpy doesnt like nim objects Recruit_main707: and messing a bit with objects inside objects seems to make it give up leorize: have you filed an issue to the project? Recruit_main707: well, it says types and methods are still not very well supported, so i will just let yglukhov extend those functionalities a bit more and then check if the error persists disruptek: we need to get the ball rolling on the nim coronavirus badge project. Rika: On the nim what disruptek: it's a badge that measures how near you've been to other badges and sums/shares your risk. disruptek: a small embedded project; hopefully something we can give away at fosdem, etc. leorize: Recruit_main707: looks like nimpy can help you if you can deal with PyObject directly disruptek: i dunno how else to interop with python in any serious way. leorize: hmm, actually nimpy does support nim objects Recruit_main707: yes, it does work keeping things simple, but i have an object, with one field being an object disruptek: Araq: any reason i shouldn't abstract out the BModule.labels interface? disruptek: it's a pain in the ass. leorize: Recruit_main707: yea it might actually supports that Araq: disruptek: what do you mean? Recruit_main707: its getting confised with PyObjects and my object or something disruptek: its manipulated everywhere with inc and creates something too sensitive. disruptek: too sensitive to order, mutation, on and on. disruptek: i'm stuck with this damned bug again. something to do with a particular append. maybe it's a reflection of a bug somewhere else. disruptek: but it seems to be labels-related and i dunno. i'm irritated. disruptek: damn alcoholics. disruptek: and my dotOperator hack didn't work. disruptek: so now i get to somehow bounce from ast to module, which will be... y'know, fun. leorize: Recruit_main707: wdym? Araq: well sure, replace the label counter with something else disruptek: yeah. it can be anything else as long as it's anything else. Recruit_main707: leorize, do you want to see the error? disruptek: it's actually a loc bug but labels are a similar problem. disruptek: genStrAppend takes a mutable TLoc and merely checks that it's empty. does nothing else with it. leorize: Recruit_main707: sure? shashlick: Looks like the nimble beat down is over shashlick: Fact is that package management is not easy nor solved, see the dime a dozen attempts at it and continuous innovation ksandvik: Yes. ksandvik: Could be good to focus collectively on one project. shashlick: On top of that nimble takes on building as well which has its own dozen of implementations out there ksandvik: That's fine, we only need one tool with the extension option for additional tools. But that's just my opinion. shashlick: I spent some time thinking about it, I'm an expert in neither and unless the community is willing to tolerate some bumbling around, I'm not willing to invest the time ksandvik: I've seen so many build systems so far where just a Makefile works really well, but it's the constant re-innovation factor. Recruit_main707: leorize: https://play.nim-lang.org/#ix=2fHM Recruit_main707: wait, this one: https://play.nim-lang.org/#ix=2fHO disruptek: the real problem is that we cannot agree on the problem. shashlick: The real problem is that PR's just don't have the same velocity as being a maintainer disruptek: i guess you should fork nimble and we'll compete to improve the ecosystem. shashlick: The amount of code I rewrote for nimterop ast2 just wouldn't work as PR's disruptek: i'm beginning to wonder if the amount of code i've written for IC will "work." shashlick: And I'd hate the person who would create a PR with this scale of change disruptek: so you're saying that you should have created a new project instead. zetashift: Reminds me of Scala which also has a lot of build systems disruptek: imo it should just be done in nimscript, but you can't even fetch your cwd in nimscript, so... fuck it. shashlick: disruptek: no, I mean that when you want contributors, you need to let them have some free reign else it is too slow and pointless shashlick: and I acknowledge that it isn't easy to figure that out since visions need to match disruptek: i agree, so why don't you fork nimble and allow contributions? shashlick: i'm neck deep in nimterop so perhaps some day disruptek: visions don't need to match, they just need to be compatible. disruptek: i'm not a fan of the silly banner added to `bump`, but it's compatible with my goals, so i merged it. shashlick: more importantly, it should be possible to experiment, mess up and fix things incrementally than expecting an individual PR to be ready to go qbradley: Is there a way in nim to read a file at compile time, and perhaps include it as static data in the resulting executable? disruptek: see staticRead() shashlick: nimdeps disruptek: shashlick: i dunno what happened but i'm pretty sure you're to blame. now nimph is unable to prevent the compiler's config parser from emitting hints even though i have always omitted hintConf from the config. disruptek: any ideas? shashlick: devel? qbradley: disruptek: thank you disruptek: i believe so. shashlick: i think someone recently merged some code around hints shashlick: is it working on 1.0.6 disruptek: i will test 1.0.6 now. disruptek: qbradley: see also nimdeps disruptek: !repo nimdeps disbot: https://github.com/genotrance/nimdeps -- 9nimdeps: 11Nim library to bundle dependency files into executable 15 14⭐ 2🍴 dom96: I wonder what the context of this Nimble conversation is disruptek: seems to be a PR problem. qbradley: disruptek: very cool - thanks dom96: Anything I can do to help? disruptek: manage your PR? dom96: oh, you mean public relations? disruptek: yeah. dom96: what's the problem? disruptek: shashlick: no extra output in 1.0.6 disruptek: i think some people are unhappy with the pace of nimble development. dom96: Understandable, I'm unhappy with it as well. ksandvik: It's never too late. I could help out with some higher level work, if there's something simple, like just gathering the state and requirements? ksandvik: Or just learn the code base, too. ksandvik: Sorry, have to quit, should be back tomorrow. shashlick: We have 14 commits in nimble in the last six months shashlick: You had 17 commits in one day KingDarBoja: The kind field plus case switch doesn't work as I wanted the "type" prop of "AnotherType" to be either "ChildTypeA" or "ChildTypeB" KingDarBoja: https://play.nim-lang.org/#ix=2fhP KingDarBoja: I found the answer at some post -> https://forum.nim-lang.org/t/4406#27516 alehander92: Yardanico ! alehander92: so basically alehander92: krux02's gdb script works good in vscode alehander92: you just need to test: tables and seq are shown correctly even inline after they have values, problem is if its on top level , then variables are mangled and you see those results, so please try to debug your code in functions KingDarBoja: Well, I tried both approach from the above link on the nim forum but the "sum types" does not let me redefine the same variable for several cases while the inheritance approach does. zetashift: yeah I had that too, I ended up renaming stuff KingDarBoja: I will get "Error: attempt to redefine: 'myTypeVar'" KingDarBoja: Really zetashift? There is no way to use the sum types approach (case kind) with the same variables for some cases? leorize: it's a known limitation KingDarBoja: Oh god! leorize: the issue was brought up for quite sometime leorize: then just die out because no one cared enough :P leorize: https://github.com/nim-lang/RFCs/issues/19 disbot: ➥ Allow usage of the same attribute name in different branches within variant types KingDarBoja: Well looks like this GraphQL Port from JS is going to take a while, need to think about how to handle AST KingDarBoja: I will stick with inheritance approach as it seems to work for me zetashift: oh from that issue zetashift: you might be able to use https://github.com/andreaferretti/patty#constructing-variant-objects zetashift: nope nvm has the same issue KingDarBoja: https://github.com/nim-lang/RFCs/issues/19#issuecomment-173529871 I love this suggestion disbot: ➥ Allow usage of the same attribute name in different branches within variant types KingDarBoja: Which I tried and ofc doesn't work Knaque: I'm trying to make a little CLI tool for myself, and the easiest way of doing what I'd like is through SSH. Is there a good module for this? / Does Nim support SSH on its own? disruptek: there's an async ssh lib iirc. disruptek: !repo ssh disbot: https://github.com/treeform/ssh -- 9ssh: 11Connect to machines over SSH and run commands there from nim. 15 4⭐ 1🍴 7& 6 more... Knaque: Treeform saves the day yet again. Thanks Disruptek. disruptek: sure, let us know what you make. axion: Is it normal that a single unittest module/suite with 50 empty tests (using skip or discard) takes 20 seconds to compile on a modern machine? I'd hate to see what this scales to when I port all ~1000 tests disruptek: sounds slow to me. disruptek: does skip omit codegen at ct? axion: doesnt matter if i use skip or discard. and I literally have 50 empty `test: discard` within a single suite in 1 file disruptek: weird. axion: I had double that and improved it significantly by removing half, but still seems slow to me disruptek: removing half improved it significantly? axion: yeah disruptek: i would expandMacros and throw some timestamps in there. seems nuts that unittest would take much time at all to compile that. axion: it just pauses at CC: test_foo.nim for about 20s axion: and `top` shows it is compiling something like crazy disruptek: openapi generates >1000 loc/s on a 140,000loc file. disruptek: that's obviously c compilation. if you're importing your module, all the nim goes into one file. axion: removing my import shaves of a couple seconds. not much disruptek: how many lines is the c file? axion: about 20k disruptek: my guess is that it's some sorta anomaly with empty tests. disruptek: bump's small test suite is like 15 tests and 50 checks and produces only 3k lines. takes 1.2s to build the tests and indeed the whole project from scratch. disruptek: oh nevermind, i'm using a nutty compiler. axion: well i'm not too worried. it's only a hassle when iteratively writing tests. when it's done, it's not very often i'll be running the tests in such rapid succession disruptek: or, i might be. but still. axion: decided to switch to unittests because my runnableExamples were distracting from the actual code with like 90% of the file not actually code :) disruptek: yeah, i expect it's some sorta edge case. i'd switch to compiling real tests. Knaque: Getting the following runtime error: `kernel32: cannot open shared object file: No such file or directory`. I honestly have no idea what to do about this, or where it's even coming from. Knaque: No, wait, it looks like it's a winlean thing. I'm gonna try to see if I can just cut out the need for that module, but if anyone has a better solution, let me know. Recruit_main707: You probably don't have .dll in your PATHEXT variable Knaque: The funny thing is, though, I'm on Linux. Recruit_main707: But winlean is for Windows Knaque: Yes, I know. I'm using Treeform's ssh module, which imports winlean. Recruit_main707: You can substitute the types used by their primitives Knaque: Well, I just got rid of `import winlean` and replaced it with `import os`, leaving only one proc that doesn't *seem* to serve any purpose, so I've just cut that out and am going to see if it works now. Knaque: Well, different error, so that's something. Seems to me like the ssh module is built pretty exclusively for Windows, at least based on my interpretation of this error message. Knaque: `Error: unhandled exception: Additional info: "Could not find command: \'ssh\'. OS error: No such file or directory" [OSError]` Knaque: As someone who knows nothing about anything, my best guess is that it's just using a different command syntax that doesn't work properly on Unix. Rika: why would you need the ssh in nim if you already have the actual ssh comand Rika: command Knaque: I'm trying to use ssh to automate some stuff on another device. Rika: i see Knaque: So, instead of having so ssh into the other device, run the commands, `exit`, then finish the process on the client, you just run one command and it does the whole thing. sheerluck: @Knaque sounds like http://www.fabfile.org Benumbed: Question... how would y'all go about implementing a dispatch table which has the same proc argument(s) but the return type is different (however the return types do have the same parent object type) Benumbed: What I have so far: `type methodMap* = Table[int, Table[int, proc (meth: AMQPMethod): ref AMQPMethod]]` Where AMQPMethod is the base type of all return types Benumbed: (yes, nested tables :/) Rika: is there an issue with your current implementation Benumbed: If I try to map methods to IDs in the table, I get type errors Benumbed: Basically, the methods will create something like `AMQPConnectionStart` which is a object that inherits from `AMQPMethod` and then I don't know how to pass a reference to that data back through that procedural type Benumbed: because the return values are technically different types, despite having the same base type Rika: can you make `AMQPMethod` into a `ref object of RootObj` instead of what it is now, then remove the `ref` in the proc return? or does it need to be non-ref? Benumbed: it is a ref of RootObj Benumbed: (see inheritence) Rika: so its a double ref on the return type Benumbed: *thinks* Rika: also you can have an `object of RootObj` afaik Benumbed: Hmm yeah, it's technically a ref type Rika: and itll work Benumbed: Still getting used to that Rika: so it ***is*** a double Rika: double ref* Benumbed: yeah, refs still get me a bit turned around Benumbed: Doesn't help that every time I'm trying to write Nim it's right before bed haha Benumbed: Also trying not to climb walls from the COVID lockdown... not a great time to be learning a new language Rika: dont double ref its useless haha Rika: well, very specific use case needed for double ref Benumbed: Oh I know, I didn't realize I was double reffing Varriount: @𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭 You could always join disruptek's Mumble server and chat Varriount: I've become completely unmoored from my usual sleep cycle. It's 4 in the morning right now Benumbed: I don't even have a mic on my dev box haha Benumbed: If my questions aren't a good fit this this channel, pls let me know though, I'm still new here and figuring out where the lines are drawn 🙂 Varriount: Nah, they're fine. Varriount: I'm just bored. Benumbed: haha ok clyybber: Araq: Hey, ok to merge #13741 ? disbot: https://github.com/nim-lang/Nim/pull/13741 -- 3Fix vm.nim for --gc:arc Araq: too risky for 1.2 Araq: but apart from that it's fine clyybber: k clyybber: Araq: Regarding scope based destruction, do you think it'd be a good idea to try branch based destruction? The advantage would be that we could eliminate much more wasMoved; destroy pairs, but the disadvantage would be that its a bit more oblivious to the user Araq: sounds worth it, it's what Rust does clyybber: oh, I wasn't aware clyybber: nice! federico3: any way to escape HTML/XML in a string? matrixbot: `gphykos` federico3: ⏎ `r"yourstring"` matrixbot: `gphykos` That should work federico3: ?? matrixbot: `gphykos` That is a so called raw string matrixbot: `gphykos` It doesn't allow any escape federico3: I'm asking for a proc that escapes or removes HTML from a string PMunch: Is this a bit much? "FromGitter> `gphykos`" matrixbot: `gphykos` Uhh Idk then, that is an hard thing to do PMunch: Escapes or removes? federico3: either - removes would be even preferred PMunch: Hmm, xmltree has en "escape" procedure Recruit_main707: deleting all the keywords of html? PMunch: To remove all the tags (but keeping their contents) I guess you'd have to use parsexml: https://nim-lang.org/docs/parsexml.html and get all the charData nodes federico3: the stdlib should really provide sanitization procs narimiran: @gphykos you can connect to irc directly via matrix, no need for gitter-middleman PMunch: Ugh, one more reason to not like Windows. I'm debugging an issue on a Windows machine. And to download the VM I use for testing is a solid 17Gb.. PMunch: I'm pretty sure my entire Linux distro with everything I've got installed is smaller than that.. liblq-dev: @gphykos please join the channel #freenode_#nim:matrix.org on matrix, thanks in advance liblq-dev: because right now you go through 3 bridges (matrix→gitter→IRC) liblq-dev: and it makes your messages hard to read silvernode: What is the most simple way to write a 2 dimensional array in Nim? I find a lot of examples that I think could be simplified. sheerluck: silvernode maybe https://github.com/unicredit/neo (I didn't try it myself) Recruit_main707: as a type: `array[m, array[n, int]]` Recruit_main707: (without initialising it) ^ flywind: import sequtils;newSeqWith(5, newSeq[int](3)) silvernode: I just want to initialize it at the beginning of the program and use it throughout the entire program dadada: Araq commented that we apparently want cmake integration in Nim https://github.com/nim-lang/RFCs/issues/185#issuecomment-585140925 disbot: ➥ deprecate macros.expectLen, expectKind, expectMinLen in favor of something generic or doAssert ; snippet at 12https://play.nim-lang.org/#ix=2bqJ dadada: can someone explain to me why this is a good idea? I didn't particularly like cmake when I had to use it, and if there's really a need for something like that I'd go with something more modern and pleasant like mesonbuild Recruit_main707: silvernode, then what i told you will work dadada: PMunch: did you start to work on the expectIfgracefulfailingfeature? I might give it another shot now, and send a patch your way. Araq: dadada, cmake is a common build tool, doesn't imply the Python 2 vs 3 fiasco, doesn't depends on the JVM and is of a medium size Araq: the point is more general better integration with other build tools though PMunch: dadada, nah I went to bed. And so far today I've been struggling to make my home PC run a VM so I can debug some stupid Windows-only bug.. dadada: Araq: I'm not saying it's cmake is bad, but it's usability is pales in comparison to mesonbuild, I used both, thankfully the python2v3 fiasco is nearing its end with python2 not being supported any longer and python3 being used almost universally now, I see python in the same light as perl, only that python surpassed it, ..., and mesonbuild is a nice DSL that could be implemented in any language, it's just dadada: that they chose python because today there's practically no developer who doesn't run it any in some form, I'm also not arguing against offering cmake support, but as you may have figured out I'm a fan of mesonbuild since the day I've used it and therefore I think we should support it, too. dadada: -1 s/it's// dadada: s/should support/might want to dadada: PMunch: what do you use for your VM? KVM? PMunch: VirtualBox dadada: may I ask why not kvm? PMunch: First time I needed a VM I probably Googled "howto vm" and it was on the top of the list. I haven't had any major complaints seeing how I only use it as a last resort, so I've never had a reason to look for something else dadada: then what's the problem you're having with running the VM? PMunch: My disk is full PMunch: And my RAM is struggling PMunch: So probably nothing switching to KVM would fix :P PMunch: Unless it can download more RAM for me dadada: lol, using VMs was a motivation for me to get more RAM, and it was a good choice :P dadada: PMunch: as for disk space, if I'm in dire need for space I sometimes go as far as doing ugly stuff like rm -rf /usr/share/doc , none of the stuff there should be essential , and if you need sth for some reason, you can simply reinstall their packages from your distribution , there's also a cache for package downloads depending on your distribution that can grow into multiple GB, there're lots of small tricks dadada: like that that can add up to a lot, maybe I should publish a script that contains my best tricks for freeing disk space PMunch: Oh trust me, that package cache is already trimmed :P PMunch: I'm now copying some (completely legal) movies and shows off to an external drive, that frees up a nice chunk of space :) liblq-dev: PMunch: how much RAM do you have in your machine? liblq-dev: also it's possible to thin down windows to only the basic features PMunch: 8.. liblq-dev: also use windows 7 because it's way lighter liblq-dev: oof PMunch: I have to test on 10.. liblq-dev: why though? PMunch: Yeah, this is an old machine.. liblq-dev: is there any software that requires windows 10? PMunch: Last upgraded while I was a student, on a tight budget PMunch: Well it's our main deploy target.. liblq-dev: hmm liblq-dev: have you tried https://github.com/Sycnex/Windows10Debloater? PMunch: Nope.. PMunch: I haven't had a need for this until today PMunch: My machine at work could probably run this entire machine with the VM running in a VM.. liblq-dev: you can also do some messing around to see if you can remove the windows store, defender, and other crap that noone with common sense needs PMunch: Well, if I remove those then it's not really our deploy target any longer.. PMunch: What if it works because I removed defender for example liblq-dev: it is, as long as you're not using those services liblq-dev: oof liblq-dev: well liblq-dev: you have a point liblq-dev: if you remove those it's almost like microsoft's new way of testing windows 10, how ironic. leorize[m]: well use windows 10 ltsc leorize[m]: you can't get it "legally" but that doesn't really matter PMunch: It's not that big of an issue though.. I just moved some files to an external drive and now it runs fine PMunch: *he said, just as the entire machine froze* alehander92: PMunch do you need help PMunch: Not with this VM issue kodkuce: win sux alehander92: ok alehander92: i need some help alehander92: with some async ideas: alehander92: so i am fixing a nim-gdb library (its a part of a proprietary project, so not sure if i'll open source it: its just not very robust yet :D) alehander92: i need to make sure each async "action" of it is run serially alehander92: as gdb itself needs to run them serially (well .. it can do the queueing itself..) alehander92: so probably i need to have an internal lock in the lib alehander92: and a queue: but then basically there is the question: and all of this alehander92: seems like a common async pattern alehander92: so i wonder if this should be something that uses an standartized interface/lib or not PMunch: Uhm, that doesn't make much sense PMunch: You want to use async PMunch: But run them serially alehander92: yes yes alehander92: well it does make sense alehander92: because i still might wait a lot for each action alehander92: and want to be able to let the main program does stuff in this time alehander92: especially if it talks with several gdb processes in the same time alehander92: so e.g.`await gdb.next()` in `a` and then `await gdb.exec..` in `b` which interleave alehander92: the second one should check like `await asyncQueue.push_or_run("exec .. ")` alehander92: where `asyncQueue` waits for each successive command and runs the next async call only after it alehander92: do we have something like this "queue" thing standardly PMunch: Well you can do that with async callbacks PMunch: And a deque PMunch: dequeue? alehander92: hm, why a deque PMunch: Just to have a queue alehander92: hm yeah and just do the `push_or_run` alehander92: but i dont imagine callbacks alehander92: but more like a queue of `Future`-s alehander92: and `input commands` PMunch: Erm alehander92: i'll write it down PMunch: What you want is a queue of things to run, and when you run something you attach a callback that runs the next thing alehander92: hmm, i imagine liblq-dev: @kodkuce well it's not our fault that it pretty much owns the market… PMunch: I'm doing my best to convert people to Linux :P dadada: why is $setting echoing false inside submac in? It's true, when inside a proc. https://play.nim-lang.org/#ix=2fyC dadada: -in clyybber: Araq: Does DrNim prove assinging or passimg range parameters yet? alehander92: PMunch clyybber: dadada: Thats a bug I think alehander92: i wonder whats the difference with callbacks and futures PMunch: Huh? PMunch: Oh, well a Future can have a callback dadada: clyybber: oh man... PMunch: That's what I meant alehander92: yeah yeah alehander92: but what i mean is that i just use complete alehander92: isnt that simpler PMunch: complete? alehander92: i'll show it dadada: clyybber: thanks for looking at it ... any idea how to get around this bug clyybber: Nope :/ clyybber: IMO this change that {.compileTime.} vars are accessible at runtime should really be reverted clyybber: it's not directly related to this bug, but I wouldn't be surprised if it is in some subtle way Araq: clyybber, yeah it does (DrNim) alehander92: hm, so if i want to an additional thing: deech: I had a PR that tried to address that a while ago where compile time vars have to be assigned to a const before accesssing at runtime but it was rejected. dadada: deech: why was it rejected? leorize: that's just a workaround leorize: it should be accessible in runtime without having to do all that leorize: but then due to how the compiler is architectured, you can't without exposing a heap of bugs alehander92: `await CancellableAction[T].pushOrCall()` # where this calls a long async function but it checks constantly if a new "task" has arrived alehander92: and cancels/returns early from the previous one, does this work only with a token deech: I don't see it as a workaround. It makes reasoning about communication between stages a lot easier. clyybber: Araq: Nice! alehander92: like, i imagine i'd want my internal async function to constantly check manually if its being cancelled, but maybe one can just insert "checkIfCancelled()" after each await with a pragma? Araq: clyybber, dadada every 'macro' gets a fresh set of .global vars or something like that is going on clyybber: Huh clyybber: Araq: So not related: Was the {.compiletime.} vars being accessible at runtime in 1.0 ? Araq: deech: iirc it wasn't rejected but progress has stalled because I don't know a good solution clyybber: I think the best solution is to make compileTime vars only accessible at compileTime and use const as a bridge between the stages shashlick: Araq what do you mean by cmake integration dadada: it doesn't help to define the submacro inside the macro, same result https://play.nim-lang.org/#ix=2fyI ... don't know what else to try deech: clyybber, that's exactly what the PR did! shashlick: Build Nim with cmake? clyybber: deech: Yeah, I know \o Its the best way IMO leorize: isn't koch our "universal" build system? :P clyybber: dadada: Other than waiting for a fix.. maybe passing setting as an arg to your other macro if you can Araq: shashlick, teach cmake about projects written in Nim that produce C code "over there" silvernode: trying to create a grid in one shot: https://play.nim-lang.org/#ix=2fyJ Araq: that is to be compiled too dadada: clyybber: well, I thought about it, but I tried to avoid it, hence the global/compileTime var :D deech: idk, *maybe* a compromise for now is to add that restriction only to compile time `var`s only. clyybber: deech: Can you rebase your PR? Araq: my ideal is basically: CT code mutates global vars, the final state of the global vars is avaiable at runtime as the initial value shashlick: Hmm I don't get it - building Nim projects is so easy - do you mean being able to build the generated C files without Nim deech: I also don't like the compiler tries to evaluate runtime function arguments at compile time. PMunch: silvernode: https://play.nim-lang.org/#ix=2fyL Araq: shashlick, I mean so that you can add some code written in Nim more easily to an existing C/C++ project deech: clyybber, I can try. It's like 6 months old or something now. dadada: clyybber: since macros can call external commands, I could read/write the setting to the linux clipboard, ..., although that'd be too ugly to ship leorize: Araq: so kinda like Pascal's const-but-not-really idea? clyybber: deech: nice, thank you leorize: some context: https://freepascal.org/docs-html/current/prog/progsu42.html#x49-480001.2.42 clyybber: Araq: Yeah, that makes sense, but I think its best to make it explicit, so to use consts as bridges Araq: leorize, yes but by now I noticed it's the viewpoint of a minority. anyhow writing an RFC first how this all should work Araq: would be appreciated. silvernode: thank you PMunch PMunch: No problem Araq: proc r(x: Natural) = echo x Araq: proc sum(a: openArray[int]) = Araq: if a.len >= 4: Araq: let chunk = a.len div 4 Araq: r chunk Araq: nice huh? it understands that chunk >= 0 clyybber: nice PMunch: nice clyybber: deech: Hmm, thinking a bit more about it, we already "promote" static values to runtime when needed. dadada: nice clyybber: So I'm not sure if prohibiting passing {.compileTime.} vars to runtime functions makes sense clyybber: Since we could just work around it by doing `f(static: someCompileTimeVar)` leorize: fun fact, static expressions are still unimplemented deech: How is that different from `const x = someCompileTimeVar; f x`? alehander92: hey clyybber: leorize: Oh clyybber: deech: It isn't alehander92: what's the best way to `await` when in not `{.async.}` (i construct a future and return it directly): i had a workaround i think but what's the idiomatic thing leorize: clyybber: the kind of static you're using is implemented I think, but the static(expr) form is not, even though it's in the manual clyybber: But it makes sense to do it automatically I guess. Since I can just do `f(1)` too clyybber: leorize: Ah okay deech: Not worth adding complication to the compiler to save typing IMO. leorize: @alehander92: wdym? leorize: waitFor? alehander92: no no no clyybber: deech: Its already doing that. I just think that maybe its more consistent this way alehander92: https://gist.github.com/alehander92/09d1698dd615794f0450e3cdaa9fb8c1 dadada: I think the result of this testcase is really interesting https://play.nim-lang.org/#ix=2fyR so if you set the setting to true a second time in the submac (first time is in demo), then it will have the correct value in submac2 (so it will be true) alehander92: i guess `futureToBeAwaited() and future` alehander92: might work leorize: dadada: it's probably due to order of evaluation leorize: the two inner macro call must expands before the outer can evaluate Araq: ah leorize's explanation makes more sense :-) Araq: true macro calls are expanded before any code runs dadada: yeah, that makes total sense alehander92: this is the reason we can't do `return` in `{.async.}` from templates right? clyybber: deech: The "inconsistency" I see is that `f(1)` would work, but `var c {.compileTime.} = 1; f(c)` would not. But its not that much of a consistency as the literal 1 is much closer to a const rather than to a compileTime var dadada: well, great I think I have a workaround now :-) will you even fix this, or this the official but not well documented behaviour? Clyybber: s/consistency/inconsistency leorize: dadada: I will assume that it's the official behavior :P dadada: here is my finale testcase that shows the situation, https://play.nim-lang.org/#ix=2fyV ... I only added a submac3 that's not embedded in demo to prove that it works in that case too leorize: just change those inner macros into procs :) dadada: I'm beginning to feel like nimmer now that I know quirks like that dadada: a nimmer PMunch: A nimrod PMunch: dadada, is this what you expect to happen: https://play.nim-lang.org/#ix=2fyX alehander92: noo just a programmer alehander92: otherwise i had to just return await futureObject from `{.async.}` ! leorize: alehander92: I believe you can't await from a proc :) leorize: await assumes that you're using a closure iterator leorize: since that's the only way for it to resume the function leorize: waitFor/asyncCheck is the only way to do it from a regular function deech: clyybber, I also agree with what araq said that the runtime should only ever see the final version of any compile time artifact but that would require re-engineering the compiler. dadada: PMunch: I also tried to solve it using static, but then another behaviour popped up, that I didn't intend/want, see this https://play.nim-lang.org/#ix=2fyX in demo2 (running before demo, bad naming, I know) I want setting to be false, yet due to static, it already is true! alehander92: leorize yes alehander92: sorry alehander92: i meant that i turned it to async and then you can return a normal future object dadada: PMunch: sorry , wrong link https://play.nim-lang.org/#ix=2fyY PMunch: dadada, wrong link? dadada: yeeah dadada: the other one works Clyybber: @deech Not sure if it really does, maybe a deferCompileTimeEvaluation magic is enough Clyybber: Obviously with some better name :D PMunch: Huh, that is strange indeed dadada: PMunch: I want setting to be true from the point where the line appears and forward, not backward, the only solution that works is to use a submacro and let it do the setting for me, so I'll do just that, it's not even that ugly :-) Clyybber: @deech What do you think about this: compileTime vars are treated like literals/consts with their current value if inserted into runtime expressions. For delayed evaluation we provide the aforementioned deferCompileTimeEval magic Clyybber: And let {.compileTime.} should probably be purged as it doesn't really serve a purpose deech: @Clyybber But "current value" has no meaning when compile/runtime are strictly separate stages. Clyybber: It has, by current value I mean current value during compile time Clyybber: And to get the value that it will have at the end of the compilation stage you would use deferCompileTimeEval deech: What is a use case for the former? dadada: I never particularly liked the length of the {.compileTime.} macro, compileTime is the time when nim is running, the nimTime, so to speak, as clyybber said let {.compileTime.} is a bit superflous, we also have const, so we could theoretically introduce a new keyword that replaces var myVar {.compileTime.} = true ... with ...: nim myVar = true <- the logic that variables declared with nim, are always dadada: var and always only run on compileTime, this would enable a clear distinction and also be more concise code. Even though it's my idea I'm too not 100% sold on this and I'm not a long time nimrodist, so you may as well dismiss it. leorize: it's not a macro btw deech: araq, is there a way to see how 'arc' is tracking ownership? Clyybber: @deech This for example `echo "before some static calc", a; static: a += someCompileTimeCalculation; echo "after", a` awr1: does NLVM still work? deech: How is that different from `static: echo "before"; static: a += ...; static: echo "after"; a`? leorize: awr1: yes, though it tracks stable versions instead of development awr1: hm awr1: it would be awesome if NLVM had mcJIT support Clyybber: @deech The echos would happen at runtime silvernode: Finally created what I wanted partially thanks to PMunch https://play.nim-lang.org/#ix=2fzk silvernode: I am sure there are much easier ways to do it, but my brain works the way I wrote it silvernode: ended up needing to not initialize the seq right away so I went back to the previous method clyybber: silvernode: Here it is, but blursed: https://play.nim-lang.org/#ix=2fzp Araq: deech: there is 'koch temp -d:toDebug=interestingProc --gc:arc temp.nim' Araq: it outputs the transformed Nim code and the CFG silvernode: clyybber: trying to understand your version, I understand most of it, but I didn't know there was a keyword 'inc' leorize: it's not a keyword leorize: it's a function dadada: well, the workaround for setting a global compile time var inside macros works even less well than I thought, in sub macros of sub macros it gets lost again ... frustration silvernode: leorize: right dadada: is building up dadada: :-) Araq: dadada, no need for workarounds, use .compileTime procs inside macros and not macros inside macros clyybber: silvernode: Oh its just the same as x += 1 dadada: Araq: I'm working on PMunch's code and I did want to write a minimally invasive patch, so when he's using a macro inside a macro, I didn't want to rewrite his whole code silvernode: clyybber: I thought so, and I imagine the inc function has all the iteration and loops going on inside of it? clyybber: silvernode: Nope silvernode: trying to figure out what makes it continue iterating clyybber: silvernode: Its relying on the fact that newSeqWith is a template that will evaluate its second argument N times clyybber: where N is the first arg of newSeqWith clyybber: It is like that so that you can do `newSeqWith(n, rand())` and have a seq with random data silvernode: clyybber: so it's all part of newSeqWith? clyybber: yeah liblq-dev: shashlick: you here? silvernode: clyybber: this makes so much sense now although pretty obscure when you don't know about it clyybber: yeah, I just did it for fun clyybber: its not really readable silvernode: clyybber: I still think it's neat though clyybber: silvernode: This is faster: https://play.nim-lang.org/#ix=2fzy dadada: has anyone developed a simple compiletime/macrotime key-value-store/database that could be used as an alternative in situations such as the one I'm in to not have to deal with the limitations of global compile time variables in macros? While it might seem like overkill for dealing with the value of a single variable, I also do have bigger macros in mind that would need to store more leorize: dadada: a table? dadada: leorize: wouldn't a table have the same issues? it would allow me to store key-value pairs, but wouldn't they also disappear in submacros and so forth? leorize: don't do submacros tbh leorize: if someone is using submacro, well force it to not be one dadada: again, I'm working on someone else's code, I didn't put the submacros in there, all I want is to add a feature leorize: due to how macros work, it's not possible... leorize: better rework the code instead clyybber: Couldn't it be made possible? clyybber: dadada: For now use compile time procs instead dadada: hmm, seems a strange answer to simply give up macros inside macros because of one compiler limitation, I'd rather remove this limitation, btw. it's definitely possible, since macros can call external commands, one could read/write from an ini file or the like to pass on values leorize: compile time procs can do that too leorize: compile time procs can do literally anything that a macro can do :P clyybber: yeah, so the reverse should be possible too clyybber: right? dadada: I believe you, though my instinct is that I want to remove limitations, because why not? leorize: well I think the limitation is unavoidable leorize: the inner macros have to evaluate or else you can't get the AST needed to run the outer clyybber: Couldn't we delay the evaluation? leorize: wouldn't that open the doors for incorrectly typed calls? shashlick: liblq-dev - here clyybber: I mean delay until we actually come across the macro "call" Araq: dadada, PMunch's code is an exception Araq: where it makes sense to use macros inside macros leorize: clyybber: so imagine something like this: liblq-dev: shashlick: I think I found a bug with getHeader and `nim check`. when I try to run the command on a wrapper it tries to build the library from scratch, no matter the defines dadada: hmm, I also used macros inside macros a few times (btw. mostly without any issues), so even if it is an exception, it's not a rare exception liblq-dev: shashlick: see http://ix.io/2fzG leorize: clyybber: https://play.nim-lang.org/#ix=2fzJ shashlick: how are you checking that it doesn't use the cache clyybber: leorize: I'd say thats a good thing :D, as its consistent with https://play.nim-lang.org/#ix=2fzM clyybber: with templates and compileTime procs shashlick: also did you patch build.nim for that - issue clyybber: Araq: FYI my vm.nim pr has been merged, but by cooldome, I don't think he was aware that you wanted to delay it after 1.2 clyybber: s/after/until after clyybber: I think its fine tho, in my limited experience any breakage there is pretty obvious/catched by the CI and the tests because it breaks literally everything :D liblq-dev: shashlick: yea, I patched build.nim liblq-dev: and I don't know if it uses the cache or not liblq-dev: but I built the file once with nim c shashlick: okay for whatever reason, it is not finding the header shashlick: what is the library so name shashlick: okay had to add altnames = "wayland-server" Araq: clyybber, ok alehander92: https://gist.github.com/alehander92/f456c84c745b59c6e8a0b1e267840376/ alehander92: leorize PMunch PMunch: Huh? alehander92: this is the thing i wanted to do alehander92: back then alehander92: with the queue + futures alehander92: i only thing the `run` thing might look a bit hacky alehander92: but i didnt realize how people use callbacks PMunch: Yeah, that's what I wanted to avoid by using callbacks.. alehander92: but i like it alehander92: are callbacks simpler Araq: can't figure out how Z3 bitvectors work Araq: Argument ((_ int2bv 32) #x0000000a) at position 1 does not match declaration (declare-fun bvsle ((_ BitVec 64) (_ BitVec 64)) Bool) liblq-dev: shashlick: wayland-server.h, libwayland-server.so liblq-dev: as you'd expect PMunch: Well callbacks would make it so that futures are automatically run one after the other alehander92: so you put the "new" future as a callback to the previous one alehander92: and `complete` is called before callbacks? alehander92: oh useful, i'd keep it in mind alehander92: i like manual queues :( :D Prodigle: Is there a way to ignore a return variable from a function? would like to run it without having to store the return var Araq: discard fun() Prodigle: ty 🙂 clyybber: Is it still true that newSeqUninitialized only works for number types? clyybber: I don't see a reason for that alehander92: Araq hm, why do you need z3 bitvectos Araq: because unsigned numbers are really bitvectors alehander92: hm, ok shashlick: liblq-dev - figured out the bug - when i get std header paths with gcc, it returns a non-zero return code so the data doesn't get cached shashlick: so nim check doesn't work at all liblq-dev: oh crap liblq-dev: why does it return a non-0 exit code liblq-dev: ? clyybber: Oh, god clicking on githubs checklist checkers actually checks them disruptek: !last zevv disbot: Zevv spoke in 12#nim 18 hours ago clyybber: Araq: Maybe cyclic groups? Afaik z3 has support for those clyybber: s/groups/arithmetic, whatever the correct term is :p clyybber: hmm, nevermind, bitvectors really are the right tool here Zevv: disruptek: oi, how's life dadada: this may be crazy talk, but could z3 be useful for step-by-step debugging? bear with me because I only know rudimentary things about it, but obviously it's able to figure out what happens inside procedures, so couldn't there be an introspective z3 mode, where you would set a breakpoint like marker, and then you could follow everything that happens in a procedure (or possibly even multiple procedures, but I dadada: don't know if it can do that) in a special z3 console, of course we have debuggers like gdb, but I just think it's fun to explore new alternatives dadada: what happened? why is it this quiet all of a sudden? livcd: uhmmm livcd: drinking time! ksandvik: 1.20 is not yet out, right? narimiran: ksandvik: right dadada: ksandvik: https://github.com/nim-lang/Nim/releases this is where I look for releases dadada: don't know if there's a better place ksandvik: Releases are not timed unlike some 'other' language platform I assume. axion: Is there a way to have `nimble test` put the compiled code in the build dir without nimscript? It doesn't seem like it honors any flags at all, such as --outdir:build Varriount: dadada: z3 is very mathematical. While it's possible to achieve that, ordinary conditions would be sufficient alehander92: dadada hey, we are working on a sort of more "advanced" debugger environment in one project alehander92: hm, but as an example i'd give you a different, existing one actually : https://pernos.co/about/overview/ (by some previous rr developers) alehander92: are you imagining any of those flows , or something more like automatically detecting an issue alehander92: (sorry, giving you this context to help explain where i am coming from imagining possible step-by-step ideas) rayman22201: alehander92 what async madness are you doing? first of all, await works on any promise. If a function returns a promise, you can await it rayman22201: and "await" multiple promises in sequence, causes them to run sequentially anyway axion: anyone know? I'm trying to make run `nimble test` with a key binding in my editor that will work for any project without a project configuration alehander92: rayman22201 alehander92: sorry :D alehander92: yes, i realized that alehander92: see the last link alehander92: it's not so simple alehander92: i wanted to be able to do `await myOp()` from various places in the same codebase (some might interleave) and ensure `execMI` called internally inside/explicitly is always only one at a time alehander92: https://gist.github.com/alehander92/f456c84c745b59c6e8a0b1e267840376 rayman22201: what is `execMI`? I don't see that in your gist? rayman22201: it just looks like you are re-implementing what async event loop already does? alehander92: sorry alehander92: i explained it bad rayman22201: why this line? `future.complete(await queue.handler(next))` Does the value of the current future need to be fed into the next one? alehander92: `execMI` was a function which does many things but it awaits a `write` to gdb and then later awaits one or more `reads` from it alehander92: so the problem is between those write and read alehander92: the event loop might run another function which calls again `execMI` alehander92: and it gets to `write` again before the previous command has finished (which might be like ok, because gdb is supposed to be able to deal with this, but i didnt want that) alehander92: so the point is that each next execMI actual logic should be called only after the previous one has finished rayman22201: you have `await gdb_read; await gdb_write`and you want them to be atomic rayman22201: ? alehander92: the combination of them alehander92: i want only zero or one `execMI`to be executed at each time rayman22201: the naive thing should just work. alehander92: i was generating an error before if execMI is busy alehander92: well it doesnt alehander92: i was getting into cases alehander92: where it was getting into that case that i described alehander92: so now i want if execMI is busy, to just wait for the previous ones and then for my op alehander92: and thats why the queue of futures alehander92: so i just call it `return await pushOrSend[(string, bool, bool), string](gdb.asyncQueue, (command, ret, isCommand))` rayman22201: some psuedocode, but this should work: https://play.nim-lang.org/#ix=2fAV disruptek: come scheme about nim coronavirus detecting badges for fosdem 2021. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek alehander92: nope, you first call write, then you start awaiting reads .. and reads can take time so the event loop can call other stuff.. rayman22201: https://play.nim-lang.org/#ix=2fAW alehander92: but this is the simple case alehander92: execMI is called from various places all around the codebase alehander92: its not just a simple list in the same function rayman22201: shouldn't matter alehander92: but i saw that it does :D rayman22201: as long as you await it. It will not complete until all internal await complete alehander92: but rayman, while one of those has yielded, from other place another execMI can be started rayman22201: sure alehander92: so gdb_write .. gdb_read waiting yield => loop => another call => execMI => gdb_write => breaking invariant rayman22201: ah ok. you need this: https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncsync.nim#L60 Araq: er ... did Nim just bootstrap with --gc:arc? alehander92: hm, ok it seems like a similar thing rayman22201: 🎉 awesome! alehander92: it uses a deque alehander92: ah ok he also creates an AsyncQueue rayman22201: well yeah, but you don't need a queue rayman22201: you just need the lock alehander92: but i can have 5 of them alehander92: i have to preserve somewhere the inputs/other waiting futures rayman22201: the calling procs save it? alehander92: ah yeah i see what you're saying rayman22201: they just wait until the the lock is free alehander92: ok makes sense, thanks !! rayman22201: 👍 alehander92: i still like my queue as it seems to work but i'll keep it in mind rayman22201: well, your queue is basically a lock. As you can see, that's how locks are implemented. rayman22201: just a matter of maintaining your own vs. relying on someone else. rayman22201: cheatfate wrote chronos and was a big contributor to stdlib async, so I trust his code alehander92: you're right, sorry! but i still want to maintain this one for now as i can tweak it , its not so big alehander92: otherwise i use asynctools as well, so i know his good work :) rayman22201: :-) cool Lecale: Beginner question. I compiled my little nim snippet ok. When I run the executable I have "could not load: libcairo-2.dll" So I installed msys in order to get my hands on that dll, but every location I've tried to add it to hasn't cleared that message. Yardanico: You should add that .dll either to any folder in your windows PATH, or to the same folder with the .exe Yardanico: also check the bitness of the .dll, maybe you compiled for 64-bit but DLL is 32-bit, or vise-versa Yardanico: or that DLL depends on other DLLs too Lecale: Same directory as the .exe fails :/ okay I will try the others too Yardanico: what are the nimble libraries you've used in your snippet? Yardanico: is it gintro by any chance? Lecale: ggplotnim aack have to run. time up for today pmamatsis: Hi everyone! Yardanico: hi zetashift: hiya liblq-dev: hi leorize: sr.ht seems to be really buggy... zetashift: Well they do advertise it as alpha zetashift: Nim playground `latest` Nim version means Nim devel right? Yardanico: check "echo NimVersion", it's just latest stable IIRC zetashift: ah yeah latest stable Yardanico: godbolt.org has nim trunk, but not sure how fast they update it Yardanico: it reports 1.1.1 as of now euantor: I've reported the broken freebsd builds.sr.ht builds, I believe the problem is an out of date pkg database. Hopefully it will be fixed soon leorize: they really have to host their own package server somewhere... leorize: this kind of downtime is not really welcoming euantor: That wouldn't help unfortunately. It's due to the unique way pkg works euantor: They could alter the steps so that freebsd runs a `pkg update` before installing, but that would be a bit wasteful euantor: Or have a cron job update the image after running `pkg update` daily or something leorize: well it still have to get the packages somewhere, right? leorize: they can mirror the package server at a given point in time, then update it weekly or something euantor: I suppose so euantor: Probably easiest to have a caching proxy for packages, as they fetch over HTTP euantor: I've never altered freebsd mirrors before, but it looks like it's super easy KingDarBoja: How I can get the enum item from a Enum slice? KingDarBoja: Like "let item = find($MyEnum, key)" leads to the integer value but I want the Enum value KingDarBoja: MyEnum is a HSlice btw Yardanico: you can convert numbers to enums Yardanico: let item = YourEnumType(find($MyEnum, key)) if I understood you correctly KingDarBoja: Ah, it doesn't use the Enum HSlice but the original Enum I see blackbeard420: is `nim doc --project path/to/file` supposed to generate a dochack.js? sealmove: guys, does anyone know how to make an online game, for example like lichess.com? rayman22201: blackbear420, looks like koch will build dochack.js, but nim doc doesn't. rayman22201: nim js tools/dochack/dochak.nim to build it manually rayman22201: `nim js tools/dochack/dochack.nim` <- typo fix blackbeard420: hmm building with koch or that fails with: /home/blackbeard/src/Nim/lib/system/jssys.nim(53, 6) Error: 'getCurrentException' is not GC-safe as it accesses 'lastJSError' which is a global using GC'ed memory blackbeard420: with nim built from current devel branch timotheecour: @blackbeard420 i can’t repro blackbeard420: interesting, thanks. I was able to build it with nim-1.0.6 package from void-linux. but not with my local built nim rayman22201: I'm using a fresh build from devel as of 24hours ago and it works for me blackbeard420: oh wow it was because i had --threads:on in my nim.cfg blackbeard420: removing that and it worked fine blackbeard420: thanks guys rayman22201: ah, cool. glad you figured it out. Yeah, nim js does not support threads (obviously). maybe we should warn about that... Yardanico: blackbeard420: glad to see another void linux user here :P Rika: why is this so? "continue not supported in a fields loop" treeform: Is protect()/dispose() a good way to pass nested ref object trees between threads? KingDarBoja: Hi all, it's me again, got a quick question, does arrays (or sequences) are immutable? Yardanico: if you declare them with let - yes Yardanico: (or const that is, but const is for actual constants) KingDarBoja: 👍 KingDarBoja: By declaring a property at some "class" (type in this case) like this: KingDarBoja: ```nim KingDarBoja: type MyChildClass = ref object of ParentClass KingDarBoja: fields: seq(other_type) KingDarBoja: ``` KingDarBoja: They will be immutable too? Yardanico: please read the description for the channel on discord :) don't paste the code to chat, people in IRC gonna suffer :P KingDarBoja: Sorry ! Yardanico: in your case MyChildClass object will not really be immutable because with "let a = MyChildClass()" you'll only say that the reference to the object is immutable, not the object itself, so you'll be able to modify "fields" even if you declare the object with "let" KingDarBoja: Interesting... So in order to ensure "fields" is immutable, what shall I do? Rika: make it private Rika: and create a getter and setter Rika: (rename fields to some other name, perhaps pFields) then make procs "fields" and "\`fields=`" Rika: signature: proc fields(self: MyChildClass): seq[OtherType] Rika: and dont actually make the 2nd proc to make it immutable Rika: now it's immutable for any module that imports it Rika: but you cant guarantee immutability within the same file KingDarBoja: Well it is private if it hasn't "*" as far as I know... but let me see the rest of things Rika: the rename part is just to ensure the field name doesnt clash with the proc name KingDarBoja: Gotcha KingDarBoja: Last question, the tutorial part II uses "ref" for types with inheritance but never explained why... zetashift: `Ref objects should be used whenever inheritance is used. It isn't strictly necessary, but with non-ref objects assignments such as let person: Person = Student(id: 123) will truncate subclass fields.` niet really such what truncate subclass fields mean tho zetashift: sure* KingDarBoja: That is what I am talking about, what does truncate subclass fields mean? KingDarBoja: Not being able to use name and age from parent type? zetashift: No idea currently in my raytracer-thingy I have a `type Tuple = object of RootObj` and my types of `Vector` and `Point` both inherit from it with no problems zetashift: but I do get an inheritance problem if I change `Tuple` to a `ref object` Varriount: Zevv: Congrats, your Z3 module is being used by the compiler. 😛 gogolxdong: Is there any SDK to develop APP on Android, ios, web and desktop? Yardanico: nimx is not a SDK but it's the closest you can get to what you want :D Yardanico: "Nimx officially supports Linux, MacOS, Windows, Android, iOS, Javascript (with Nim JS backend) and Asm.js/WebAssembly (with Nim C backend and Emscripten)." Yardanico: it's a GUI framework, sadly there's no multiplatform SDK for Nim like that KingDarBoja: That moment when you doing the migration from some code in another language into Nim and some variable names uses keywords like end, block... KingDarBoja: Type properties in this case Rika: you can use backticks Yardanico: yeah, like `end`, `block`, `proc` KingDarBoja: Really? backsticks? Yardanico: yes? Yardanico: they're also used for defining operators KingDarBoja: Ohhhh niceeee awr1: @KingDarBoja https://en.wikipedia.org/wiki/Stropping_(syntax) KingDarBoja: Yeah, I knew that but had no idea about the naming use case KingDarBoja: Thanks once again guys, I feel enlighten 😄 awr1: huh, from wikipedia: "Line reconstruction converts the input character sequence to a canonical form ready for the parser. Languages which strop their keywords or allow arbitrary spaces within identifiers require this phase. The top-down, recursive-descent, table-driven parsers used in the 1960s typically read the source one character at a time and did not require a separate tokenizing phase." awr1: you learn something new every day awr1: although it almost seems kinda like there is a return to "recursive descent parsers without lexxing" awr1: b/c of PEGs Rika: https://play.nim-lang.org/#ix=2fcD got no clue what i'm doing wrong wrt. making a "setter proc" that works for both types here Rika: huh, what're the different implications of a `ref object of Type` and an `object of Type` Yardanico: why "var Object"? it's already a ref Yardanico: with "var Item" your method basically accepts a pointer to a pointer to an object :P Yardanico: well, maybe the compiler is smart enough to not do that with "ref object", idk Rika: hm i made a mistake yeah Rika: there used to be just an Item = object Rika: for some reason i automated into putting a ref before object awr1: yes i think methods only work with refs only, not vars awr1: also is there a reason you need the getters Rika: i dont want them to be settable Rika: at least the two that dont have setters Yardanico: wtf Yardanico: oh sorry wrong chat silvernode: https://github.com/QB64Team/qb64 silvernode: Here is a recreation of the QBASIC IDE from back in the day. A buddy of mine got a pull request merged that adds Void Linux support for the installer script. silvernode: It is really well done and takes me back to the first time I ever wrote a line of code skrylar[m]: i kinda remember basic from back in the day, before i hopped off to delphi anyway Vindaar: @kaushalmodi Indeed, unless I'm sleeping :) ⏎ @IanIAnIAN not sure if you're still around right now, but as indeed, just ping me Varriount: Araq: Did the Z3 code get all pushed? It doesn't look like all the logic is in the PR branch Varriount: I wanted to try it out Araq: it's all in my branch Araq: I'm adding tests Zevv: oh nim is going z3 now, woet \o/ Zevv: go araq go! Rika: whats this z3 thing? PMunch: Z3 is a theorem prover IIRC PMunch: And if that is indeed the Z3 they're talking about, might be something else as well :P Yardanico: yes, it is indeed the theorem prover one :P Araq: yeah and it's awesome Araq: I figured out how to make it produce counterexamples Rika: so i read the wikipedia article on SATs aaaaaaaand i understood nil Rika: SAT? i mean SMT Recruit_main707: is arc stable enough so that the garbage collected thing can be deleted or marked as optional in the oficial web? clyybber: yes, but we wont delete the gc Araq: yeah, website update upcoming with the 1.2 release clyybber: not for now at least Rika: when is 1.2 releasing again clyybber: Araq: Do we really wan't to delete the mention of GC? Araq: we'll find some marketing term clyybber: Heh 😄 Rika: deterministic 😛 Araq: "pick your memory management strategy" Recruit_main707: i know there is people that didnt like nim because of garbage collector Rika: and i know people who dont like rust because of a lack of one Recruit_main707: although its very fast, but they just read that and think its slow Rika: man dont you just hate faulty assumptions Recruit_main707: specially about nim Recruit_main707: anyway, so was that a yes Araq? i could maybe try and convince them again if that changes Araq: yes Recruit_main707: noice clyybber: Araq: Is the cycle collector still in there, or did you replace it with the cycle breaker? Araq: both exist, both not production ready clyybber: Does the collector have any crashing bugs or just performance issues? Varriount: What's the difference between them? clyybber: Varriount: One breaks up cycles, the other one collects them automatically clyybber: One behaves like a GC the other one like a pseudomanual free Araq: clyybber, it crashes because of a bug in liftdestructors afaict Araq: and it's slow clyybber: Araq: I see Araq: can make it fast via generations but I don't want to :P dadada_: damn, I'm annoyed with all these new langs, some look really cool, mostly because it's impossible for me to learn them all, for example odin's defer statement looks really nice and flexible, but I want that feature in Nim Yardanico: nim has defer Yardanico: :P dadada_: I know that Araq: or write a macro that does the same Yardanico: ah I checked it just now, yeah, it's different Recruit_main707: thats why they exist Yardanico: the only thing that I'd like to see in Nim (but it's really related to LLVM) is Zig's FFI and easy cross-compilation dadada_: Yardanico: that's shockingly easy (cross compilation) if I understood what zig is doing right dadada_: zig IS a c compiler with easy cross compilation, and Nim compiles to c Yardanico: lets use nim with zig lol dadada_: that's what I'm saying :D Araq: it's rumored to work. I don't really see the point Araq: producing the binary for platform X is the *start* Araq: then you also need to test it... Araq: cross-compiles are nice for embedded but LLVM doesn't support as many CPU architectures as GCC does Yardanico: oh lol didn't see https://forum.nim-lang.org/t/6115 dadada_: yes, it's not a panacae, but it would be convenient, and I'm not saying let's making it the default, but why not as an option dadada_: s/making/make Araq: it's great that you can build for foo.exe for your Windows users on your Linux machine and then pray it actually works on Windows Yardanico: we have wine xd Araq: but it's not all that professional :P Araq: and the fight for the **easiest** C interop is also pointless, C has the best interop with C. Araq: and then maybe C++ follows dadada_: Araq: coincidentally I'm currently in the process of writing a defer macro, but it's a different concept from what odin does, and I'm currently stuck with something Araq: (not to mention that many many libraries are in C++ these days) clyybber: dadada_: Whats the difference between odin and nims defer? Yardanico: clyybber: https://odin-lang.org/docs/overview/#defer-statement clyybber: looked at it dadada_: clyybber: bear with me because as you know I'm relatively new to Nim, but it looks to me that Nim always defers stuff to the end of a proc/func, while Odin allows you a more fine-grained scope-based defer that can even contain defers inside a defers Yardanico: btw, what is the correct way to replace deepCopy on --gc:arc ? Yardanico: parsetoml uses it here https://github.com/NimParsers/parsetoml/blob/329cc618fe27a6c89708d1fa17ddc72f8da97e08/src/parsetoml.nim#L1898 clyybber: dadada_: Nims defer is scope based too clyybber: And its also "reversed" Vindaar: @Yardanico: I wondered the same thing before dadada_: clyybber: then I got the wrong impression, maybe Nim's manual could be updated to more clearly highlight this feature! Rika: defer isnt that useful from my experience clyybber: It can be really useful at times Yardanico: it's useful when you want to have things like var client = newHttpClient(); defer: client.close() together Yardanico: so that it's easier to understand the code and the structure is better Araq: Yardanico, it should use result[] = p[] or some variation of it Araq: I personally cannot stand 'defer' at all Araq: no matter how smart you make its scoping euantor: dadada_: Nim's defer expands to a `try: ... finally: ...` construct I believe Yardanico: I suppose it's not ok when code with --gc:arc results in a compiler error "Error: system module needs: newSeq" Araq: Yardanico, not sure, maybe you simply have an installation problem Yardanico: well, it works ok for everything else, maybe it's a bug :P i just tried to compile some 3-year old nim project with --gc:arc and this error appeared Araq: ok so report it jken: clyybber: in your nim/assimp experience, did you ever get material.getTextureCount working? clyybber: Nope, never tried jken: deeper down the rabbit hole I go Araq: oh I know! I'll only enable the CI for Windows Araq: as building the static lib takes 10 minutes clyybber: lol dadada: PMunch: I'm so excited to use your macroutils module, that's in nimble.directory now, thanks so much for this work PMunch: No problem, it's stuff that I've wanted myself for a long while now PMunch: (although I haven't yet used it for anything, so any feedback is highly welcome!) dadada: I'm definitely going to use it today PMunch: Sweet, please tell me how it goes :) dadada: and will be happy to give feedback, hope you continue this, and that it doesn't become stale PMunch: That's the plan PMunch: I mean I think I've written more macro code than non-macro code at this point, so if it works as well as I hope I'll probably be including it in all my projects :P dadada: I also tend to write a lot of macros :D dadada: not related strictly to your module, but I think docs on nimble.dir should have syntax highlighting for code samples https://nimble.directory/pkg/macroutils clyybber: dadada: Who are you on github? dadada: clyybber: haven't done any nim stuff that you can see on github, and didn't use my github account in a long time, but may revive it some time soon clyybber: I see dadada: have to hone my Nim skills before I put anything out there shashlick: PMunch why not add to stdlib Yardanico: oh right, is --gc:arc supposed to work with marshal? I looked at that project which errors with "system module needs: newSeq" PMunch: shashlick, I'm open to add it PMunch: But I wanted to see if people would use it/if it was useful first Araq: Yardanico: no. marshall needs to be rewritten to use macros Yardanico: well, then that's probably due to marshal, but error msg is very cryptic :P Yardanico: so I guess I don't need to report it? PMunch: dadada, I agree that nimble.directory should support Nim syntax highlighting in the README. Looking at the source of the site the sections are even tagged by a CSS class, so it shouldn't be too hard to add a syntax highlighter. federico3, pretty please? dadada: PMunch: critique number 1) add more asserts into your examples, for example your final example (to pick just one example example) contains one assert packages == ..., but to more clearly highlight the extraction capabilities it should have asserts for everything that was extracted there PMunch: Yeah.. At that point I was pretty fed up with writing documentation :P PMunch: Sorry about that federico3: PMunch: a little PR? :) PMunch: For the syntax highlighting? Hmm Zevv: araq: anything Z3 related you can share already? I wonder what your experiments look like federico3: keep in mind that the readme is rendered by GH Araq: Zevv: https://github.com/nim-lang/Nim/pull/13743/files#diff-7f32e88416af5ba545963b024d7e5bd5 disbot: ➥ DrNim (Nim compiler with Z3 integration) Araq: the Unix build is close to working PMunch: federico3, yeah and GH has syntax highlighting Araq: and then everybody can enjoy DrNim PMunch: But it's probably a JS script that runs on a certain CSS tag clyybber: Araq: Ok to merge https://github.com/nim-lang/Nim/pull/13741 ? disbot: ➥ Fix vm.nim for --gc:arc Araq: clyybber: how is that correct? Araq: your cast loses the seq's len information clyybber: But its not needed here clyybber: Look at the original cast clyybber: Oh clyybber: Argh clyybber: Good catch haha Araq: I think the solution is a compiler refactoring so that 'pointer' isn't used for this clyybber: Yeah disruptek: i know `requires` may be more correct, but it's also long. disruptek: needs? disruptek: must: Araq: 'requires' and 'ensures' are the standard and what DrNim will use disruptek: oh it's a standard? Araq: Spec# uses them so yeah :P disruptek: so we need these as noops for stdlib so that the dr can use them elsewhere? disruptek: i guess you'd just want to import them. Araq: yeah that's the plan, nop for the compiler Araq: but DrNim understand them disruptek: next we need to add them in a transform. clyybber: Araq: Can vm callbacks be supplied in usercode? clyybber: Or only when the compiler is compiled? cschardt: Aufsteh'n, aufeinander zugeh'n.pri (https://files.gitter.im/nim-lang/Nim/itr9/Aufsteh-n-aufeinander-zugeh-n.pri) Yardanico: wrong window? clyybber: lol clyybber: wrong advice in these times clyybber: especially in bavaria clyybber: haha liblq-dev: I'm trying to wrap wlroots using c2nim, but it's using these weird array definitions like `const float color[static 4]`. how can I make c2nim reflect those as `array[4, cfloat]`? Yardanico: did you try nimterop? :P liblq-dev: I don't want nimterop, it's slow. Recruit_main707: how can i make a type's field constant? liblq-dev: @Recruit_main707 that's not possible Yardanico: you mean assign once or what? Recruit_main707: something like this Recruit_main707: https://play.nim-lang.org/#ix=2feq Yardanico: well, why not just use a proper constant then? Rika: you really cannot Rika: theres no good reason to Recruit_main707: there are values that might be assigned at runtime and dont change Yardanico: const in Nim is compile-time Yardanico: strictly Yardanico: create setters and getters then Yardanico: https://nim-lang.org/docs/tut2.html#object-oriented-programming-properties Recruit_main707: ok thanks owl_000: out of topic: www.w3school.com server has nim installed, unfortunately version 0.19.4 Yardanico: You mean https://www.w3schools.com/ ? owl_000: yes Yardanico: There's quite a lot of websites with online nim compiler owl_000: not online in their system Yardanico: how do you know? :P owl_000: in python learning section you can try python code, `import os os.system("nim")` return nim compiler info. Yardanico: lol owl_000: maybe it is a security issue of w3school owl_000: you can run many linux commands Yardanico: well, they probably run everything in containers or commands Yardanico: that's not an issues Yardanico: you can do the same on most online compilers/interpreters owl_000: oh Yardanico: play.nim-lang.org https://godbolt.org https://repl.it/languages/nim https://tio.run/#nim for Nim compiler online Yardanico: there are more, but these ones are the best ones :P owl_000: ha ha Yardanico: ah nvm, repl.it still has nim 0.17.2 too, damn owl_000: that is irony, Yardanico: actually there was a discussion about the version in https://repl.it/talk/announcements/Two-new-languages-Nim-and-Crystal/11886 comments, and a year ago they said "will upgrade" alehander92: someone should ping them owl_000: will upgrade coming soon™ alehander92: if something is requested often they might do it, but probably have a big backlog Yardanico: I remember how we managed to add nim to repl.it :P put the link everythere lol Yardanico: https://replit.canny.io/languages-requests/p/add-support-for-nim-lang-to-replit Yardanico: if you check nicknames of people who voted you'll find a lot of familiar names owl_000: question: any news about nim official GUI? Yardanico: what do you mean by "official"? Yardanico: There isn't anything like that, but there's quite a lot of GUI libs too choose from (most of them are not really complete, and are bindings) Yardanico: gintro is IMO the best one out there (it's a low-level and high-level GTK/Glib binding) Yardanico: Nim extension for VSCode got 0.6.5 update - https://github.com/pragmagic/vscode-nim/commit/84e5e548818fca1599f7e0f28e30a740dea10961 owl_000: updating now Araq: why not use the Nim playground instead of repl.it? Yardanico: that's why I put nim playground as the first one :) Yardanico: of course it's the preferred choice alehander92: well its good to have it supported there alehander92: many people use repl.it for many langs probably alehander92: its like "why not use nimspecificedit instead of vim" alehander92: the playground is pretty good tho indeed owl_000: having nim option in repl is good for publicity too Yardanico: but not when it has 0.17.2 dadada: PMunch: what am I doing wrong in this simple constructed example https://play.nim-lang.org/#ix=2fex ? Yardanico: some newbies might try to do something in Nim on repl, following the docs - but their code might not work Yardanico: because that nim version is quite old clyybber: Araq: Lol, that DrNim comment Yardanico: I like how nim playground has all versions starting from 0.13.0 btw :P dadada: btw. it's an awesome feature not everyone might know about that play.nim-lang.org supports importing nimble directory modules ... clyybber: Araq: Tbf you can make it an option, link dynamically and provide your strdefine to wherever the fuck the .so is, or link statically Yardanico: dadada: how? :P Yardanico: ah nvm, only these https://github.com/PMunch/nim-playground/blob/master/docker/packages.nimble Yardanico: quite a good collection though PMunch: dadada, just forgot to import macros :) PMunch: https://play.nim-lang.org/#ix=2fey Araq: clyybber: yeah I know, but it remains stupid shit dadada: PMunch: shouldn't macroutils imply import macros, you an export macros in macroutils!? dadada: can Yardanico: dadada: I feel like that will look kinda weird PMunch: Yardanico, yeah it's based on the important packages list clyybber: Araq: You mean dynamically linking? PMunch: But everyone is free to add a PR to have other packages added :) dadada: Yardanico: why? PMunch: dadada, you might not want parts of macros I guess PMunch: But yeah, it possibly should dadada: it definitely should, if it's core feature doesn't work without it dadada: but that's just my opinion MAAN dadada: :D Yardanico: well, nim stdlib also has some modules like this Yardanico: like xmltree - if you don't import "strtabs" you won't be able to use "attrs" table for a xml node owl_000: question: how do you debug nim in vscode. btw i use echo to check Yardanico: echo is the best debugger out there :) Yardanico: owl_000: but really you can use GDB with nim Yardanico: nim ships with nim-gdb script which kinda should make mangled names easier to read, didn't really try it yet though dadada: Yardanico: this is an odd behaviour, hopefully we'll find a better solution, for example if someone uses attrs, it could automatically trigger export strtabs, but I don't know how hard it would be to implement that owl_000: vscode gdb says there is no a.out file Yardanico: well, you have to edit default vscode gdb config owl_000: oh then, echo is better Yardanico: owl_000: just change "program" to the name of the binary clyybber: Araq: Well that was easy: #13741 :D disbot: https://github.com/nim-lang/Nim/pull/13741 -- 3Fix vm.nim for --gc:arc clyybber: No big refactoring required Yardanico: hmm, GDB in vscode works, now need to figure out how to use nim-gdb.py with it shashlick: liblq-dev - why is nimterop slow? isn't stuff cached? liblq-dev: idk `nim check` is show for me on nimterop liblq-dev: s/show/slow clyybber: Yardanico: Just run nim-gdb liblq-dev: same with compilation liblq-dev: same with nim.nvim Yardanico: clyybber: well, VSCode starts gdb itself clyybber: Oh shashlick: then generate a wrapper and write it to file and import that shashlick: you don't have to use it at compile time liblq-dev: how'd I achieve that? liblq-dev: that's what I wanted to do with c2nim btw clyybber: Yardanico: Look at the shell script, the important part should be overriding GDB_PYTHON_MODULE_PATH shashlick: nim c wrapper.nim > out.nim liblq-dev: but it doesn't support some syntax liblq-dev: oh, and just use cDebug in that file? shashlick: yes liblq-dev: right liblq-dev: will try later, thanks Yardanico: clyybber: I think I can specify gdb binary to be "nim-gdb" in VSCode Yardanico: i'll try at least clyybber: Ah nice shashlick: caching for nimsuggest and nim check is in place though Yardanico: how do I check if nim-gdb works? :P liblq-dev: shashlick: I'll try to update nimterop later and report back on whether anything is better. clyybber: Yardanico: It should say "Loading Nim Runtime support." clyybber: As the last line shashlick: okay, big release is coming though with ast2 which will be able to support all of C eventually Yardanico: hmm, it doesn't say that, strange Yardanico: but it shows "set Nim pretty printers for /home/dian/projects/nimstuff/osu_lazer_saver" dadada: shashlick: where can I learn about ast2? dadada: big release of nim or do you talk about something else? Yardanico: ah, seems like it indeed uses nim-gdb dadada: sorry, I may have lost the context Yardanico: but variables are still like T4_ and T5_ in "locals" clyybber: Hmm shashlick: dadada: of nimterop - it parses C and generates Nim wrappers clyybber: krux02 is the guy to ask dadada: shashlick: +1 for nimterop, I look forward to it supporting C++ disruptek: the mangling for locals will probably change, too. gogolxdong: How to print newline characters in a string variable? Yardanico: \n Yardanico: echo "line\nanotherline\nanotherline" gogolxdong: There is a string variable , I want to see the newline character is \c\L or \n. Yardanico: use repr I guess? gogolxdong: It works for python not for Nim. Yardanico: !eval echo repr "hello\nstring\n" NimBot: 0x55d8eecd96f0"hello\10"↵"string\10"↵"" Yardanico: well almost :P dadada: PMunch: what am I doing wrong now? https://play.nim-lang.org/#ix=2feH clyybber: Yardanico: No no no no DD clyybber: poor repr krux02: clyybber: what about me? PMunch: Using varargs[untyped]: https://play.nim-lang.org/#ix=2feJ clyybber: krux02: You created gdb-nim krux02: yes clyybber: And Yardanico is having a problem with it I think krux02: nim-gdb Yardanico: krux02: well I just wanted to try nim-gdb in VSCode krux02: ok Yardanico: it seems to actually launch nim-gdb now, but in "Variables" window in VSCode it still shows variable names like "_T4" and stuff Yardanico: I compiled the binary with --debugger:native without any other flags, is that right? Yardanico: I mean the binary for the program I want to debug krux02: well, first of all nim-gdb is just the start script to start gdb. shashlick: dadada: C++ seems achievable now, the old design wasn't as flexible, though it worked well for the POC that it was PMunch: Well, you could also do `args[0].extract` dadada krux02: it loads the python pretty printers, and then it is just pure gdb. No fluff attached other than python pretty printers. dadada: ok, thanks PMunch, is there a way that I could extract all idents and types in order? like you can import `packages*` but instead of horizontal, going into the vertical direction? krux02: the problem is, I can't really do anything about nims name disambiguation Yardanico: krux02: https://i.imgur.com/DbrGC5U.png dadada: PMunch: I already have a suggestion for an operation: | cause that's showing in the vertical direction dadada: operator krux02: ok sheerluck: with 1499 issues Nim-1.2 can not be released. 1500 seems a suitably round number. Nim-1.2 will be releases with code name "1500 issues" Yardanico: the more popularity a project has the more issues there are :) dadada: thankfully a good number of those issues isn't terrible stuff Yardanico: rust has 5.2k open issues you know :P krux02: Yardanico, the biggest problem with debugging nim in gdb is, line information is pretty bad. After all nim generates a lot of line directives, but a single line in Nim is most of the time compiled into multiple C files. This means that you get wrong line information until you hit the next line directive. PMunch: Hmm, dadada, the idea was that having a single child in there with * should work. Like this: https://play.nim-lang.org/#ix=2feQ PMunch: But that seems broken Yardanico: well yeah, I just tried it out of curiosity, I mostly use echo :P PMunch: I have to look into that PMunch: (and then you could run a for loop with extract on that if you wanted) krux02: Yardanico, I don't have a lot of gdb experience within VSCode krux02: I only use it from emacs, as this is the only debugger that is basically just window for gdb. krux02: Yardanico, can you write gdb commands in a gdb terminal from VSCode? Yardanico: krux02: yes krux02: ok dadada: shashlick: nice, may I suggest the Qt lib as a goal to work towards for the C++ support, it's not only requested by me, Qt has so many high quality modules, not just the widgets everybody knows, look at this https://wiki.qt.io/Language_Bindings even obscure languages already have bindings for Qt, even Julia and whatever Ring is, I mean we can't let this continue ... :D krux02: then you should be able to type: info locals krux02: print x krux02: bt (for backtrace) krux02: n (for next) krux02: s (step into function) Yardanico: info locals Yardanico: -var-create: unable to create variable object Yardanico: hmm krux02: what? Yardanico: it says that for every command krux02: then something is wrong Yardanico: idk what that means krux02: me neither krux02: can you show me another picture? krux02: You are lucky, I have time right now, you are interested in a screen sharing session with audio? krux02: I am interested to see how well gdb works in VSCode as well. Yardanico: well I can do that, but my english speaking skills aren't the best :P krux02: what language do you speak? Yardanico: i'm russian, but I can understand english pretty well, it's just that I don't have a lot of speaking experience owl_000: speaking is different skill. without being around native speaker it is hard to improve. krux02: Yardanico, I sent you private message shashlick: dadada: C++ is a long road but even if I got there, Qt has all that moc nonsense, i've heard others say it is not so straightforward dadada: shashlick: I know, I think they are making it sound worse than it is, you can look at the methods those other bindings are using, when there are bindings for vastly different langs such as Java and JavaScript, then it must be possible for Nim, I looked at the JavaScript bindings and they didn't seem terribly complicated, there's some special code, but it's far less than you would assume shashlick: anyway, my goal is to provide complete C/C++ => Nim and i've been at this for 1.5 years already and still don't have full C axion: is there a proc for the sqrt of a float? i'm getting an "expected int" error. I feel like I'm missing something because every language I've used defines sqrt for fp :) dadada: shashlick: I'm checking out what happens in github.com/nimterop/nimterop every day, so you must have something right in those 1.5 years, I believe in you! dadada: :-) narimiran: axion: yes dadada: must have done dadada: well every other day narimiran: axion: here's how to find stuff in the future: go to https://nim-lang.github.io/Nim/lib.html and use 'search' on the left shashlick: now that i am using the compiler ast, understanding the backend will benefit and be easy for compiler devs as well so i'm hoping for contributions with wrapping kaushalmodi: axion: https://nim-lang.github.io/Nim/math#sqrt%2Cfloat32 narimiran: axion: or, TL;DR: `import math` axion: yes i am using math axion: hmm maybe there's a custom overload in the way in one of the libraries axion: i'll inspect further, thanks narimiran: axion: try `math.sqrt(1234.56)` kaushalmodi: axion: https://play.nim-lang.org/#ix=2feR kaushalmodi: you can always use the Nim playground to reproduce the issue and share that link dadada: PMunch: this is what I think it should work like: https://play.nim-lang.org/#ix=2feT axion: `0.5 / math.sqrt(trace)` gives me error| type mismatch: got but expected 'int' narimiran: @kaushalmodi, why not `let num = 2.0`? kaushalmodi: narimiran: I just wanted to show that ints work too if the var type is float kaushalmodi: :) clyybber: !eval echo 0.5 / math.sqrt(5) NimBot: Compile failed: /usercode/in.nim(1, 12) Error: undeclared identifier: 'math' dadada: PMunch: this syntax is clearly indicating what's expected to happen, which isn't the same (IMO) as what `packages*` does, although it's very similar of course, vertical vs horizontal clyybber: !eval import math; echo 0.5 / math.sqrt(5) NimBot: Compile failed: /usercode/in.nim(1, 34) Error: ambiguous call; both math.sqrt(x: float32) [declared in /playground/nim/lib/pure/math.nim(261, 8)] and math.sqrt(x: float64) [declared in /playground/nim/lib/pure/math.nim(262, 8)] match for: (int literal(5)) narimiran: !eval import math; echo 10.0 / sqrt(25.0) NimBot: 2.0 clyybber: !eval import math; echo 0.5 / math.sqrt(5'f) NimBot: 0.223606794466938 clyybber: axion: I think your error is about the whole expression axion: hmm the error is in the `/` actually. must be an overload somewhere dadada: PMunch: btw, I'm not just testing this on play.nim-lang, I needed the same in some of my code just now axion: I'm not sure what's going on. I have a `/` proc, but it accepts float32. Not sure how to figure out where this error is coming from: https://i.lisp.cl/fLrYbm.png narimiran: go to definition of that `/` axion: it jumps to https://i.lisp.cl/fLrYbm.png clyybber: axion: See, the problem is the whole expression axion: oops narimiran: are you sure `trace` is a float? axion: proc `/`*(x, y: float): float {.magic: "DivF64", noSideEffect.} narimiran: (it shouldn't matter, silly me) clyybber: your s is an int axion: yes. it is defined to be the addition of 3 float32's axion: ohh clyybber: heh narimiran: i think clyybber got it right :) kaushalmodi: narimiran: If trace is not a float, he would have got ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e7b7ddef778a11920b1a072] axion: thanks. that was it. sigh kaushalmodi: heh `s` was int? narimiran: axion: now when we know where the problem is, you can remove that `math.` if you want axion: Yeah, s was an int. I was being dumb 100 lines back it seems. kaushalmodi: axion: If you don't want to import the whole math, you can even do `from math import sqrt` axion: Yup, I know. Thanks all for the help kaushalmodi: but yeah, doing `PKG.PROC` is very unnimly narimiran: @kaushalmodi, it doesn't "import the whole math" even if you do `import math` axion: I had to do that exactly once in these 5000 lines of code so far in my first project. It does indeed seem to be rare you'd need to do that kaushalmodi: narimiran: TIL dadada: PMunch: nevermind your original `foo*` way would also do the job, as long as it works :-) Rika: yall just `import lenientops` ez fix axion: it's my understanding that instead of math.sqrt you can turn the custom proc into a generics so it isn't less specialized, or over-specialize the custom proc. it's rare i have to explicitly qualify the module to remove an ambiguity axion: err is less specialized* axion: I decided yesterday that I'm sticking with Nim as my primary everyday language. I wrote a lot of code to understand it fairly well so far, so I think Lisp is in my past :) clyybber: Whoo clyybber: we achieved the impossible axion: Ha clyybber: "Lisper switched to it" <- put that on the website kaushalmodi: axion: yay! kaushalmodi: (yay) leorize: axion: does that mean we're gonna see a new blogpost from you? :) Rika: lisper switches to nim unprecedented news axion: leorize: haha i think so, yes. But probably not before I learn jester or whatever the greatest web framework is these days. My blog hasn't been updated in forever due to a maintenance disaster due to like 30 lisp dependencies kaushalmodi: axion: Switch to hugo, it's awesome kaushalmodi: btw where do you blog? axion: well i haven't in some time, but it was https://www.michaelfiano.com/ shashlick: is it possible to test that a type has a specific pragma? i'm using `doAssert name is type` and fieldPairs to check that nimterop is rendering stuff correctly, but what about pragmas leorize: use a macro shashlick: https://github.com/nimterop/nimterop/blob/master/tests/tast2.nim disruptek: pragmas w/o arguments aren't detected correctly. shashlick: note that the types are rendered by nimterop so not sure if you can pass that type to a macro and get an ast or not shashlick: looks like I can get to it with getImpl() - let's see if I can if it is dynamically generated alehander92: krux02 yardanico alehander92: you have to check if it uses the `-mi` option when alehander92: starting gdb in vsocde Yardanico: it does Yardanico: --interpreter=mi Yardanico: it passes that to GDB Yardanico: oh right I get it now alehander92: sorry Yardanico: when gdb is in MI mode you need to do it like "-exec info locals" alehander92: yes basically alehander92: thats the machine input option alehander92: which uses special format for some things alehander92: its used by editors/frontends etc Yardanico: but the thing is that VSCode doesn't take info from nim-gdb at all :( alehander92: i am trying to fix my own nim gdb-mi library lately Yardanico: I mean I can see stuff with "-exec info locals", but in vscode variables window it's still the same alehander92: i am working a lot on gdb stuff the past several years so i should try to help a bit alehander92: sorry alehander92: i'll try to check on my vs code Yardanico: don't worry, it's okay :) alehander92: i should try to help a bit for that tooling, not only for proprietary stuff alehander92: so, do you use just the nim package Yardanico: well yeah, I compile the latest devel from time to time, it's in my PATH alehander92: ! alehander92: o alehander92: ok* alehander92: so can you send me your example file alehander92: wait i can just test with a simple one nvm disruptek: the body painting tag is crap, but we'll try it again today. Yardanico: if you still want https://play.nim-lang.org/#ix=2ffl :P dadada: PMunch: extracting from a lambda doesn't seem to be working https://play.nim-lang.org/#ix=2ffn dadada: at least I don't know what syntax I should use to make it work alehander92: how do you build alehander92: :D alehander92: i mean, what kind of gdb shortcut do you use in vscoe alehander92: i am a sublime user Yardanico: well, I have two files configured Yardanico: https://gist.github.com/Yardanico/fa854f1c5fb6f6ac5beffd24241d7a2e alehander92: wow vscode is good alehander92: awesome!! alehander92: it works alehander92: ok so the problem is nim-gdb.py not loading Yardanico: but it kinda loaded, no? alehander92: ah and source /home/al/nim/tools/nim-gdb.py -var-create: unable to create variable object Yardanico: yeah alehander92: right? is that your issue? Yardanico: yes Yardanico: so do locals in VSCode for you pretty-print? Yardanico: while debugging alehander92: wait i'll use the new nim alehander92: nope Yardanico: @alehander92 the thing is that I even managed to output pretty-printed locals in gdb debug console, but in vscode they're still the same Yardanico: with "-exec info locals" they show pretty-printed in there alehander92: oi alehander92: it seems to work Yardanico: really?! alehander92: if you do `-exec source path to nim-gdb.py` alehander92: in the debug console Yardanico: well I tried that hmm Yardanico: but the locals were still the same Yardanico: like do you get pretty printing for seq/table/string? alehander92: i see e.g. for enum/seq Yardanico: hmm alehander92: yes, string as well Yardanico: can you share how you did it? did you change any configs? and what source file? Yardanico: because it seems to be the same for me even after doing that -exec Yardanico: "-exec source /home/dian/.nim/tools/nim-gdb.py" alehander92: it seems to work actually alehander92: even without it alehander92: but in one of my functions alehander92: not in the other alehander92: hm, we need a good example alehander92: i'll try your one later this evening alehander92: see ya dadada: new release of nim vscode extension was just made :-) dadada: yeah dadada: looks like a nice step forward ksandvik: Nice! PMunch: dadada, sorry I was out getting some supplies. Yeah horizontal vs. vertical isn't really a thing in the NimNode tree structure. So it's just a matter of making * match more cases. PMunch: And yeah, it will only work with a complete tree PMunch: proc () isn't valid without a lambda context PMunch: dadada, so this works: https://play.nim-lang.org/#ix=2ffJ PMunch: (note that statements also doesn't need the *, StmtList is automatically lifted) dadada: PMunch: the thing is I've a macro that takes a lambda as an argument/input, and this is valid Nim code, as I get it in the macro correctly, but there's no way to parse it with your extract utility dadada: I could maybe fake the tree that extract expects, but that wouldn't be great disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: nim/compiler rants on demand. PMunch: dadada, do you have an example? PMunch: Because this doesn't work: https://play.nim-lang.org/#ix=2ffK dadada: PMunch: it looks close to the foo thing I sent you https://play.nim-lang.org/#ix=2ffn, but I use something like d.foo proc(a: int) = statements and the macro is macro foo(d: DObject, args: varargs[untyped]): untyped = ... axion: Hmm, I ran into an issue porting some Lisp code that uses a heterogenous varargs parameter on the stack. i don't see any way to do this without using the heap in Nim dadada: PMunch: like this https://play.nim-lang.org/#ix=2ffL PMunch: So something like this? https://play.nim-lang.org/#ix=2ffM PMunch: dadada ^ PMunch: The thing is that using `:` or `do:` apparently requires stricter rules than without.. dadada: it's funny that it even makes the extraction code looks closer to the thing that it should parse PMunch: Well that is the point ;) dadada: ... all this special sauce should be documented PMunch: You make your extraction code what you want to extract PMunch: It probably is.. Somewhere.. axion: I need to be able to do something like this (pseudo-code) foo(rot, x=1.0, y=2.0, z=3.0), or foo(rot, z=1.0, y=1.0, x=3.0), or _even_ duplicated keys like foo(root, z=1.0, y=2.0, z=3.0), and the body iterating over them in order. Any ideas? dadada: I get that, but for quote do: the do is regarded as purely sugar AFAIK, so how would a random user know that in the case of extract, the do part is functional and what function it has? PMunch: Well it's not so much the `do` but rather the `:` dadada: thanks for leading the way :-) PMunch: And IIRC there was a difference between `:` and `do:` before, but I'm not sure if that's the case any longer. PMunch: The `:` takes a block or statement list as its argument. But without you can pass a single NimNode PMunch: So in your example you couldn't put anything after the lambda, because the lambda is the only NimNode passed to the macro, and to extract PMunch: If you look at the treeRepr of what you get in you will see that with `:` you get a StmtList, possibly with a single element, and without you get whatever node type you passed in directly. sheerluck: "Most loved: Nim" in twitter: ⏎ ⏎ https://twitter.com/me_myself_andY/status/1180098153640411137 ⏎ https://twitter.com/joshbaptiste/status/1180133947998658561 ⏎ https://twitter.com/mcclure111/status/1180146039904505856 ... [https://gitter.im/nim-lang/Nim?at=5e7b9a25c8dae04d8faba2de] dadada: PMunch: to know if extraction is successful I've to use exception as of now, is that correct? I'd prefer something like this pseudocode https://play.nim-lang.org/#ix=2ffR that code runs through dumpTree fine, so maybe it's possible to support it zetashift: Anybody know why I'm getting a type mismatch here? https://play.nim-lang.org/#ix=2ffS axion: Calling all smart Nimmers. I'm need help thinking about this problem please: https://play.nim-lang.org/#ix=2ffT dadada: PMunch: sometimes you've macros that can take in multiple possible asts, and so the extraction should be simultaneously a test and fail gracefully zetashift: `submatrix` should give a matrix that's equal in dimension now yet it gives the same dimensions :o PMunch: dadada, I was thinking one would use the sameTree macro first to check what the tree matched, then extract to get the nodes.. PMunch: But that might be a bit clunky indeed dadada: PMunch: why type something twice, when you can do it in one go PMunch: Can you wrap it in a template that uses a try/finally? dadada: that could work, I might try it myself :-) would that be efficient though? are exceptions in Nim fast? dadada: I assume they are... I'll try to come up with something PMunch: Well this is all in the VM, so performance is a bit peu à peu to begin with.. dadada: true PMunch: Well, I've got to start making dinner before I starve to death dadada: good appetite clyybber: axion: I think foo would have to be a macro clyybber: With untyped arguments axion: Why? It has to expand to something right? clyybber: So as to support foo(x = 1, x = 2) clyybber: Because theres no way to make that work other than have foo be a macro or template axion: Well as mentioned, that is just pseudo code. Ignoring the syntax, I'm only interested in the semantics clyybber: I see clyybber: I think its still best if you start with foo being a macro clyybber: And work from that leorize: yea macro is the best bet axion: I'm trying to write this library without macros first, as I was struggling with Nim macros. This is my first project clyybber: I see leorize: unconventional syntax will always involve macros :p axion: There is no syntax in pseudo code leorize: the only way to handle multiple of the same key is a macro-only thing :( leorize: unless we dive into tables, but then that wouldn't be too efficient leorize: axion: varargs of tuples might be what you want? clyybber: What does x = 1, x = 2 even mean in that context? clyybber: Does it rotate it around the x axis multiple times? leorize: you can constructs tuples like this: (x: 1, y: 2, z: 3) axion: So the function should take some container as its second argument which maps (possibly duplicate) keys of some sort (not necessarily in a table, could just be string lits) to float values axion: and the body will iterate over them in the order supplied, doing something different with the value depending on the key preceding it. key is an axis of rotation, so only possible identifier is X, Y, or Z, maybe some enum or just stringified versions of them axion: this function will rotate around the axes in the order given, and a rotation around the same axis can be done multiple times (hence why duplicate keys are allowed), and also an axis can be represented as a vec3 anywhere in the order, which says to rotate around that vector of Euler angles. in that iteration of the container axion: the original lisp code call would look something like (foo obj :x 1.0 :y 2.0 (vec3 3 4 5) :x 6.0), which says to rotate object 1 radian around the x axis, followed by 2 radians around the y axis, followed by the axes of the vector, followed by 6 radians around the x axis again. krux02: axion: why so complicated? axion: This is for dual quaternion skinning to reflect a paper we wrote at our studio. Why would be too long to explain. leorize: axion: yea that's definitely the land of dsls leorize: you need macros, like it or not axion: macros are for syntactic abstraction and evaluation control, neither of which matter for this axion: i almost got it working leorize: well you're trying to control the evaluation of multiple x-es :P axion: no i'm not leorize: oooh, what api have you figured out? axion: Well instead of keys/values, i'll just pass in vectors denoting the rotation around that axis. [1f, 0f, 0f] would mean a positive rotation of 1 radian around the x axis for example. clyybber: yeah, thats best leorize: nice :) axion: that almost eliminates the need for the distinction between a single axis and multiple axes at once per iteration axion: as long as the vector is normalized before used, we're good Prodigle: Hey, I need some help reading the profiler write out regarding memory usage. A sample: Prodigle: ``` Prodigle: total executions of each stack trace: Prodigle: Entry: 1/4 Calls: 104/7 = 1485.71% [sum: 104; 104/7 = 1485.71%] Prodigle: D:\Coding\nim-1.0.6\lib\system\gc.nim: newSeq 156/7 = 2228.57% Prodigle: C:\Users\rogue\Desktop\Nim Test\funcs.nim: GetNearbyBoids 176/7 = 2514.29% Prodigle: C:\Users\rogue\Desktop\Nim Test\funcs.nim: CalculateBoidMove 176/7 = 2514.29% Prodigle: C:\Users\rogue\Desktop\Nim Test\funcs.nim: DoBoids 176/7 = 2514.29% Prodigle: C:\Users\rogue\Desktop\Nim Test\index.nim: index 196/7 = 2800.00% Prodigle: Entry: 2/4 Calls: 40/7 = 571.43% [sum: 144; 144/7 = 2057.14%] Prodigle: D:\Coding\nim-1.0.6\lib\system\gc.nim: newObjNoInit 40/7 = 571.43% Prodigle: D:\Coding\nim-1.0.6\lib\system\mmdisp.nim: nimNewSeqOfCap 40/7 = 571.43% Prodigle: D:\Coding\nim-1.0.6\lib\system\assign.nim: genericAssignAux 40/7 = 571.43% Prodigle: D:\Coding\nim-1.0.6\lib\system\assign.nim: genericAssign 40/7 = 571.43% Prodigle: D:\Coding\nim-1.0.6\lib\system\assign.nim: genericSeqAssign 40/7 = 571.43% Prodigle: C:\Users\rogue\Desktop\Nim Test\funcs.nim: GetNearbyBoids 176/7 = 2514.29% Prodigle: C:\Users\rogue\Desktop\Nim Test\funcs.nim: CalculateBoidMove 176/7 = 2514.29% Prodigle: C:\Users\rogue\Desktop\Nim Test\funcs.nim: DoBoids 176/7 = 2514.29% Prodigle: C:\Users\rogue\Desktop\Nim Test\index.nim: index 196/7 = 2800.00% Prodigle: ``` shashlick: ~paste disbot: paste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead. Prodigle: Hey, I need some help reading the profiler write out regarding memory usage. A sample: Prodigle: https://gist.github.com/SirProdigle/371b73bb99450dbba967a48e23c0b005 Prodigle: https://gist.github.com/SirProdigle/371b73bb99450dbba967a48e23c0b005 🙂 dsrw: Hi. I'm new to Nim and want to write a macro that expands `@` to `self.`, so that things like `@prop = val` and `@doSomething()` work. dsrw: I'm hoping someone could point me to an example of a macro that does something similar that I could use to get started. leorize: you don't even need a macro for that leorize: something like this should work: ```template `@`(field: untyped): untyped = self.field``` Araq: dsrw, personally I'd use 's.field' instead and name the parameter 's' dsrw: I'm partly just experimenting. I certainly agree that using `s.` is a more sensible approach :) Araq: upcoming Nim 1.2 has a 'with' macro, but it only does some similar Araq: *something similar dsrw: @leorize Thank you very much. Let me try that. dsrw: @Araq I'm trying to make something like a "ruby flavored Nim", and Ruby uses `@` for fields. Thank you, I'll look at the with macro as well. Prodigle: Is there any way to get data back about garbage collection in a way that I can graph it? usage over time, any relevant data reallly? dumjyl: the `@` already has a typed overload so using an undeclared symbol will fail when it tries to typecheck for that overload. You would need to use a different operator. Araq: you can patch system.nim to use @@ instead of @ *cough* dsrw: That's awesome. Thanks. Araq: Prodigle: there is GC_getStatistics() Varriount: Araq: I assume the Z3 integration could be used to remove unnecessary range checks? Varriount: Or even unnecessary numerical checks in general? Prodigle: Thanks 🙂 Araq: well if done right, all of them are unnecessary Prodigle: In my memory profiler, I'm geting a line showing percentages in the thousands Prodigle: Entry: 1/3 Calls: 176/7 = 2514.29% [sum: 176; 176/7 = 2514.29%] Prodigle: Not sure how to read this Araq: me neither, I don't remember how it works axion: Perhaps a dumb question, but is there somewhere that documents all the new features for each new Nim release? shashlick: Araq: why would you use the {.header.} pragma if everything can work (types and procs) without including the header? what cases is it required kaushalmodi: axion: https://github.com/nim-lang/Nim/blob/devel/changelog.md axion: Ok perhaps an even dumber question: How did we jump from 1.0.6 to 1.2? shashlick: odd numbers are dev versions shashlick: 1.0.4 => 1.0.6, 1.0.x => 1.2.x kaushalmodi: yes, so the next major release will be 1.4 axion: I see. I haven't seen that convention in some years kaushalmodi: 1) 2.2, 1.2.4, .. will be patch releases over 1.2.0 kaushalmodi: Emacs does something similar axion: I'm puzzled at the long list of breaking changes after the stability guarantee announcement axion: "New features (which do not break backwards compatibility) will continue in steadily advancing 1.x branches." PMunch: Fuck, this was too good PMunch: It might be that I haven't eating since lunch, but holy hell PMunch: And I'm back by the way :P clyybber: PMunch: What did you do? PMunch: Made home-made dumplings clyybber: oh, nice! Araq: shashlick, I don't use .header but it can give some extra protection against API/ABI changes Araq: axion, which long list of breakages? Araq: I count 6 euantor: Good call on `import macros` rather than `import std/macros` euantor: `koch boot` now appears to be in the process of working too Benumbed: Like axion, kinda confused about there being both stdlib and compiler breaking changes in 1.x leorize: PMunch: damn that looks tasty Benumbed: Is it just that the language spec was supposed to be stable in 1.x? Araq: as I said, I count about 6 breaking changes, all affecting edge cases only clyybber: Exactly Araq: and could also be considered bugfixes Araq: and --useVersion:1.0 emulates the bugs :-) Recruit_main707: bam, backwards compatibility leorize: Araq: have you advertised that in the change log? :P Benumbed: Araq: the markdown document just has a whole bunch of stuff under the ‘breaking’ banners :). Araq: yeah, probably we should reword it but 1.2 isn't out yet Araq: as we're fixing more regressions Benumbed: I’m not complaining just wanted to set expectations so I knew what to expect in the future Araq: and yeah yeah, "aha! so you have regressions!" Araq: yeah we do, fixes causes regressions that cause more fixes leorize: do you mind if I add a warning to ioselectors_poll? Benumbed: No regression means perfection, and, given that’s not possible for humans, I’d have a looot more questions at that point 😄 PMunch: leorize, thanks, it was :D leorize: did you make the whole thing yourselves? leorize: yourself* clyybber: Araq: Is decodeB supposed to ensure the kind of regs[ra] ? Araq: it's supposed to do precisely what it currently does clyybber: Benumbed: No regression means no advancement clyybber: Araq: Ok :D PMunch: leorize, yup, the dough, filling, and folding clyybber: Araq: When we have a var seq parameter does the pointer indirection get optimized away when theres no reassignment? clyybber: Disregard that question.. liblq-dev: shashlick: how'd I approach wrapping a system library using getHeader? Zevv: "and the neckbeards don't understand software development" \o/ liblq-dev: I'd like to wrap wayland-server.h for that matter dadada: +1 for https://github.com/nim-lang/Nim/pull/13757 disbot: ➥ Add support for `zig cc` as C compiler. liblq-dev: I tried to do `const WaylandServerH = getHeader("wayland-server.h", altNames = "waylandServer")` but I get a build error, adding a `static: cDefine(@["waylandServerStd"])` before that doesn't help smiga287: Hi, I wanted to try out Nim and was setting up the Nim layer in Spacemacs, but then it started complaining that nimsuggest isn't there even though I think I set it up correctly in the PATH (I can clearly see the path to nimsuggest and the whole .nibmle/bin folder when I echo the PATH). Can anybody help me with the setup? leorize: does running "nimsuggest" in the command line work? sheerluck: I thought PMunch was drooling over macro foo with treeRepr smiga287: yup PMunch: Haha, not quite PMunch: That was on my clipboard from when I was helping out dadada with using macroutils leorize: smiga287: ah, actually don't bother, and disable nimsuggest-mode leorize: from what I heard about nim in emacs, that mode is broken dadada: smiga287: hey, I'm sadly not a emacs/spacemacs user anymore, so I can't be of much help there, however you're making a great decision by checkint out nim, I needed a while to get the hang of it, but the language is more fun to explore every day you're sticking to it smiga287: @leorize oh okay, thanks anyways leorize: PMunch: that's some rather decent work :) dadada: PMunch: I wasn't successful with creating a template/macro for a if-else-ish extract (yet), but this needs to happen smiga287: thanks for the motivation, can't wait the explore it more! smiga287: > smiga287: hey, I'm sadly not a emacs/spacemacs user anymore, so I can't be of much help there, however you're making a great decision by checkint out nim, I needed a while to get the hang of it, but the language is more fun to explore every day you're sticking to it smiga287: @gitterirc dadada: smiga287: you can start on play.nim-lang.org while your development environment isn't setup correctly, I continue to use it even though my dev environment works, because it's very convenient, and great for sharing the code in places like this one ksandvik: Is ~/.nimble/bin in our PATH? PMunch: leorize, haha thanks. Trying to not go insane from this isolation thing.. PMunch: Yeah I also use the playground surprisingly often PMunch: Just to test out some code, instead of naming a file leorize: the playground indenter is a tad too bad so I don't use it as much PMunch: I guess I could just create an alias for cd-ing to /tmp and creating some random file with a scratch.nim file in it.. PMunch: Yeah it's not great.. dadada: I want vim key support on playground, I can live without it, but switching between an environment that has those keys and one that doesn't is annoying sometimes PMunch: Argh, my Firefox insists on not using a monospace font.. PMunch: dadada, yeah that annoys me as well.. PMunch: I think there is a ready made way to add that to CodeMirror (the editor the playground uses) clyybber: Araq: In the VM can usages of the move template that is an alias to shallowCopy like `move(s, a.slots)` be replaced by `s = move a.slots` or does this move template have a different purpose? Araq: clyybber, instead it should be a .cursor variable, maybe clyybber: the s ? Araq: yes clyybber: Araq: I'm not sure, depends on wether a.slots would be used afterwards. From the templates name I suppose not clyybber: So thats why I asked clyybber: To be on the safe path I'm just not gonna touch it :P Araq: make it a cursor clyybber: Ok clyybber: Araq: So `let s {.cursor.} = a.slots` ? Araq: yeah or maybe Araq: let s = cast[ptr UncheckedArray[typeof(a.slots[0])](addr a.slots[0]) Araq: no known index out of bounds error in this code section for almost a decade, risk is low clyybber: Ok clyybber: I guess thats also a bit better for performance, as what I have now: https://github.com/nim-lang/Nim/pull/13741/files disbot: ➥ Fix vm.nim for --gc:arc clyybber: has two pointer indirections clyybber: Araq: So WDYT, the approach I have now which is just passing the whole seq by address or the UncheckedArray ? shashlick: liblq-dev - is the header in the standard include path shashlick: if you do #include does it work leorize: I though you'll have to run addStandardSearchPath or smt? shashlick: that's for cimport shashlick: this is getHeader which searches standard paths if you specify -d:xxxStd shashlick: the `-` might be throwing it off - https://github.com/nimterop/nimterop/blob/master/nimterop/build.nim#L935 Araq: clyybber, UncheckedArray clyybber: Araq: Ok clyybber: Araq: I think a `template s(): untyped = a.slots` should do it too. WDYT? shashlick: Araq: are bycopy and incompleteStruct orthogonal? Araq: shashlick, no, you cannot copy incomplete structs in C liblq-dev: shashlick: yeah, that works Araq: clyybber, VM is performance sensitive though dadada: stuff like this makes me hopeful for a better future for humanity https://yro.slashdot.org/story/20/03/25/1651232/singapore-government-to-make-its-contact-tracing-app-freely-available-to-developers-worldwide shashlick: if I define **`typedef struct A4 A4;`** as incompleteStruct, with importc and header, it still complains about size shashlick: error: storage size of ‘obj’ isn’t known Araq: then you use it in a context where the size must be known shashlick: i'm calling fieldPairs on it, maybe that's why shashlick: cause i'm testing that it shouldn't have any fields Araq: yeah, that's probably it shashlick: i'm now wondering if I should even support importc + header for types shashlick: cause ast2 works just fine without it leorize: `char ***foo` would be `foo: ptr ptr UncheckedArray[cstring]` in Nim, right? leorize: and, no I can't use cstringArray here because it's not one Araq: leorize, nobody knows what it means Araq: maybe you need 2 UncheckedArrays leorize: the proc I'm wrapping returns an array of strings and it's size leorize: and I don't know how to express that :P Araq: var ptr UncheckedArray[cstring] leorize: thanks shashlick: can anyone give me one good reason to retain importc / header support for types in nimterop? Araq: posix works via C typedefs that are hidden in headers and it can be hard to figure out the real underlying type Araq: so importing from the header is useful for that shashlick: but Nim still needs to know the fields if you want to use it and for that the wrapper needs to cover the details shashlick: are you saying that i can declare a wrapper with a type with 1 field and importc but the type actually has many other fields? PMunch: dadada, were you actually able to catch the error from except? PMunch: Err, extract clyybber: Araq: VMArgs is not a ref object though, so storing it a temporary should have no benefit leorize: shashlick: yes, that's the case leorize: the stdlib does that because you don't know if a structure have more fields than what POSIX said (spoiler: they almost certainly does) dadada: PMunch: 1) I was using a quote do inside a macro and for errors that happen somewhere in the quote do code the compiler often points at the line where quote do is starting, and not the actual line where the issue occurred, this actually harmed my development speed at other times, too 2) I wrapped an expandMacros macro around the extractIf macro I created, but the output didn't make a lot of sense to me, quote dadada: do created let statements where I expected something completely different and I've no clue why ... and then in the end I got tired ... I think it should be possible in principle PMunch: Hmm, okay. But how were you detecting that it wouldn't be able to extract? dadada: my approach was try: thewrappedextracthere; ifwegethereitsasuccess; except: ifwegethereitsfailure PMunch: Huh, I wasn't able to make that catch an error dadada: me neither, I just assumed that it SHOULD work PMunch: Haha, okay PMunch: Yeah I don't think that's an exception dadada: is it an expection ?? pun intended dadada: expect/ation -> exception -> expection dadada: could this be an exception handling bug? shouldn't they in principle catch anything that causes a stack trace? does this again have to do with the limitations of the vm? axion: is there a way to pass the --hints:off flag with `nimble test`? leorize: does switch("hints", "off") works? axion: oh i haven't learned me some nims yet. will try that PMunch: Hmm, yeah this needs to be made a bit more robust.. axion: that didn't work PMunch: To not create those crazy errors axion: oh maybe it did. i see hints up until the config.nims file was read axion: well good enough i suppose. clyybber: Araq: Its now using ptr UncheckedArray instead. It doesn't matter for the temporaries, as those can all be eliminated with no impact, regardless of wether we use ptr seq or ptr UncheckedArray. dadada: PMunch: another possible way would be to prepend your sameTree, but then the syntax that is allowed for extract would need to be programmatically simplified to work with quote do PMunch: Yeah this need to be solved in a different way PMunch: Thanks for bringing it up clyybber: Araq: Now we gotta bet that we really don't make mistakes with registerCallback, but I think thats fair :) right? PMunch: I'll look into it dadada: PMunch: I've an idea, how this might still work, but I need to test it first :-) hold on liblq-dev: shashlick: take a look, http://ix.io/2fhH liblq-dev: how am I supposed to make this work? dadada: PMunch: I thought maybe you could overload error somehow and force the thing to continue more gracefully maybe set a global success variable to false or something, but it's not so easy to overload, overloading of stdlib stuff is sometimes possible, apparently not in this case liblq-dev: if the header has a dash in its name PMunch: Haha, yeah I think this is some weird VM thing dadada: PMunch: hmm, hold on this should really be possible, you're using massert in macroutils to call error, in failgracefullymode massert simply must behave differently, set a macroutils internal global compiletime variable to indicate failure, and then the extractIf can deduce if it was working if noFailure: doStuff else: testNextIfBranchOrNothing dadada: and no calling of macro.error, the error msg and node would then of course need to be logged in a different way PMunch: Oh right, that's from massert! PMunch: I guess massert could just throw an exception instead dadada: PMunch: you can make it dependend on extractIf mode, macro.error has the advantage of pointing the developer to a spot in the code via the NimNode, but an exception is certainly better than nothing PMunch: Hmm, good point.. KingDarBoja: https://play.nim-lang.org/#ix=2fhP I want to specify the type of my class property "type" to be a Union of ChildTypeA and ChildTypeB KingDarBoja: or do I have to use case switch ? axion: is there a f32 Inf/NegInf? dadada: KingDarBoja: using a kind field and a case switch is idiomatic Nim, I suppose, there're also "concepts" in Nim, but those are seemingly in a bad state, are you coming from functional programming to Nim? KingDarBoja: Yup, Python and TypeScript coder here KingDarBoja: A kind like this -> https://nim-lang.org/docs/tut2.html#object-oriented-programming-type-conversions KingDarBoja: ?? leorize[m]: axion: just convert them to float32 leorize[m]: I've verified that they're the same when converted axion: leorize[m]: I'm trying to write a proc signature with an an HSlice[float32, float32] from -Inf to Inf. How would I do that in the signature exactly? axion: as a default value ^ leorize[m]: = -Inf.float32 .. Inf leorize[m]: btw HSlice with both boundaries of the same kind is also a Slice[T] axion: seems like you also have to convert the upper bound to please the compiler axion: Ah ok shashlick: liblq-dev does it work if you set the define with a -? shashlick: I'll have to update the code to remove special chars from the filename shashlick: Can you hack build.nim for now Rika: why so? leorize: because it assumes a totally efficient system leorize: there are other thing running that's not your program leorize: if the core is blocked because the os scheduled some of its thread on it, then your work will only be invoked in small intervals leorize: other cpu cores might be free, but since you pinned it there, it can't go anywhere else leorize: and no, the os won't let you hold the core exclusive Rika: i see Rika: so basically you're saying pinning anything is abd Rika: bad( Rika: bad* leorize: sadly, yes :p leorize: os schedulers can do a much better job than you leorize: just let them do their work leorize: core pinning is even more inefficent now that we have more diverse CPUs rayman22201: https://linux.die.net/man/1/taskset rayman22201: but yeah, it's generally a bad idea rayman22201: also https://linux.die.net/man/8/numactl awr1: yeah emacs for nim is broken. yet i still use it lol awr1: have had to have nimsuggest disabled for the longest time zetashift: nim support for emacs is the only reason I haven't switched yet :( Rika: how do i "put the contents of a seq into an array" Rika: just like i can "convert an array into a seq leorize: Rika: you iterate the array, then copy each elements from the seq Rika: thats the only way? leorize: arrays are fixed in size, so you can't do magical "copy back" kind of thing shashlick: CPU affinity is important when talking to PCI devices like GPUs and FPGAs shashlick: You don't want to go over QPI Rika: i mean, i thought there would be a proc that did that, leorize leorize: shashlick: you won't be doing that in user space :P leorize: @Rika: nope, there aren't, sadly :P shashlick: It's not always bad is what I'm saying leorize: ah, yea krux02_: awr1: yea pretty disappointing with nimsuggest in emacs. leorize[m]: if you don't fix it no one will shashlick: why is it so hard to fix nimsuggest itself zetashift: the memory leaks you mean? shashlick: yep zetashift: I thought this pragma was deprecated: https://github.com/Guevara-chan/Midday-Commander/blob/master/src/main.nim#L3 ? leorize: the memory leaks isn't that bad for me leorize: but I'd expect that the reason was because of how the compiler was designed leorize[m]: zetashift: yes is was leorize[m]: doesn't mean that you can't write code that use it though Rika: deprecated doesnt mean removed Rika: just means slated for removal zetashift: dang okay that it was gone already silvernode: Good morning silvernode: time to work on the game again silvernode: So my code is using a lot of if statements and some while loops, but I know more experienced programmers here might have better syntax replacements for those to make the clode cleaner and more reliable. silvernode: I figured I should ask for guidence before I get too deep into my project Benumbed: Ifs aren't necessarily bad, it's if they're nested and how deep Benumbed: You get into branch predictor performance at that point Benumbed: Loops also aren't bad (and are very much expected in games) it's whether those loops are in your main game loop, and if they are, how optimized they are Benumbed: In fact that's generally the advice I give to people about performance, at least until you're ready to optimize: If it's not in the tight loop (the game loop), don't worry about it Benumbed: If it's in the tight loop, just make sure it's only doing exactly what it needs to do in order to accomplish the goal Benumbed: and with that I'll shut up, because this is #general not #offtopic 🙂 PMunch: Anyone know of a cross platform way to get the MAC address of the different network cards installed in a machine? PMunch: Hmm, I seriously can't find an RSA library for Nim. Is that really the case? PMunch: I found a program called NimChat that has it, but it also has a huge "DO NOT USE THIS FOR SECURITY" at the top.. timotheecour: Hi @araq are you here? i’m trying to understand your comment Araq: hi timotheecour: so what do u mean by https://github.com/nim-lang/Nim/pull/12076#issuecomment-603152631 ? disbot: ➥ `resolveSymbol(foo(args))` and `overloadExists(foo(args))` to return symbol after overload resolution ; snippet at 12https://play.nim-lang.org/#ix=2f86 lqdev[m]: I suppose https://github.com/cheatfate/asynctools is dead? lqdev[m]: issues are not responded to, PRs are not getting merged Araq: cheatfate is busy with Chronos lqdev[m]: right Araq: fork it Araq: timotheecour: I'm refering to the RFC that justifies your implemented feature timotheecour: so with `resolveSymbol` that I’ve implemented , I get `overloadExists` for free Araq: how? timotheecour: and the reverse is not possible, if i only had an alternative implementation that did `overloadExists`, i could not get resolveSymbol timotheecour: look at the extensive test suite: https://github.com/nim-lang/Nim/pull/12076/files#diff-9a85c49130f34040ffe2ca65f07eddf9 disbot: ➥ `resolveSymbol(foo(args))` and `overloadExists(foo(args))` to return symbol after overload resolution ; snippet at 12https://play.nim-lang.org/#ix=2f86 Araq: ah Araq: but then const newName = resolveSymbol f(1) Araq: is unreliable, isn't it? as it can return NimNode(nil) or something like that timotheecour: but `overloadExists(f(1))` would return the correct thing (true or false) depending on whether `f(1)` would sigmatch or not Araq: yeah I understand lqdev[m]: https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/osproc.nim#L1059 doesn't the process here have to be killed, or something? closing its streams seems not enough. Araq: lqdev[m], it's not "kill" the process Araq: well we replace system.compiles because it's too powerful and here you are implemeting overloadExists with something more powerful lqdev[m]: I know, but just leaving the Pid handle as is feels… wrong timotheecour: There are many applications to `resolveSymbol` besides `overloadExists`, eg it’s super useful for debugging as u get access to the file:line where an overload (or field!) is defined timotheecour: overloadExists (and resolveSymbol) is cheaper than compiles, bc it doesn’t semcheck the proc body Araq: today's Nim supports "select overload" via a type conversion much like C++ does timotheecour: and it’s by design. so u can have `compiles(foo(1))` return false yet `overloadExists(foo(1)` return true timotheecour: Basically, almost all cases of `compiles(expr)` ins stdlib can be replaced by `overloadExists(expr)`, and it will be faster to compile and also less error prone (in case a bug is in the body, it will give a CT error instead of silently ignoring it). That leaves some unittests that DO require `compiles`. Araq: I want overloadExists, fieldExists and canImport though, IMHO resolveSymbol is code obfuscation Araq: and the nil-stateof resolveSymbol is particularly troublesome narimiran: ANOUNCEMENT: A new beta of v1.2 is available from nightlies: https://github.com/nim-lang/nightlies/releases/tag/2020-03-24-version-1-2-c8f1ac3 narimiran: Please give it a try ASAP and report any regression you might find. Thank you in advance! jken: I have some code.. for i in 0.. test mratsim: ah, it gives your sequences of sequences, it doesn't merge them so you will have to apply a join mratsim: probably better to triple for loop kennymalac: oh shit lol changed it to -d:bsonStatic and it works kennymalac: well, that problem was averted kennymalac: now there is a different error sealmove: @mratsim: Maybe, I don't know. But let me try to describe you exactly the problem. I am given some filled in data structures (from parsing of a yaml which is done for me) and a code skeleton (a class named "ClassCompiler"), so I have to make "NimCompiler extends ClassCompiler". These datastructures and the code skeleton are setup in a way that you need namespaces to produce code, because for example sealmove: you have a structure called "DataType" which does not retain info for parent types/classes. shashlick: i'm able to cmake both libs with your code shashlick: it fails because bson/bson.h is missing shashlick: you just need that cIncludeDir call sealmove: so mratsis my problem is not emulating namespaces, but using the given code to produce these emulated namespaces... kennymalac: you're not getting this error? kennymalac: /home/kenster/.choosenim/toolchains/nim-1.0.6/lib/system/fatal.nim(39, 5) Error: unhandled exception: /home/kenster/.nimble/pkgs/nimterop-0.4.4/nimterop/build.nim(621, 12) `findFile(check, path, regex = regex).len != 0` # make failed [AssertionError] axion: thanks shashlick: nope PMunch: Hmm, the rsa.nim module in nim-libp2p has verify and sign, but no encrypt and decrypt kennymalac: hmm what changes did you make? are you running with bsonGit or bsonStatic? shashlick: before the cImport calls in mongo.nim, I had to add **`cIncludeDir(bsonPath.parentDir().parentDir())`** and **`cIncludeDir(baseDir / "build" / "buildcache" / "src" / "libmongoc" / "src" / "mongoc")`** PMunch: There is a br_ssl_rsa_decrypt in BearSSL, but no _encrypt equivalent.. shashlick: just bsonGit shashlick: no other changes from your repo axion: @mratsim so in this case the count is an argument to the function, so i'd need a macro right? shashlick: of course now there's some cOverride work that's needed in mongo.nim - `Error: undeclared identifier: 'iovec'` shashlick: but you could try the `flags = "-s"` and see if it is good enough shashlick: stub out missing symbols and then hand-wrap only the ones you really need kennymalac: right kennymalac: what's the flags = "-s" ? shashlick: doesn't look like your mongocPreBuild() is getting used shashlick: toast -h shashlick: `-s, --stub bool false stub out undefined type references as objects` kennymalac: yeah now it says something about invalid indention kennymalac: oh looks like it halted shashlick: i tried -s and looks like mongocLPath is not defined kennymalac: I guess -s is getting rid of a lot of necessary structs, so I'll generate iovec and other failing structs shashlick: at least it tells you what stuff to stub so you can put it in cOverride shashlick: basically iovec, sockaddr and addrinfo in my case shashlick: stub doesn't know what stuff is already declared in bson and other places since toast runs in isolation shashlick: needs some improvement there kennymalac: what's the pragma for using c def from header kennymalac: iovec* {.importc,header:"".} = ? shashlick: object shashlick: it compiles for me now but I don't think your mongocPreBuild was ever run kennymalac: why was it not ? curious disruptek: !last zevv disbot: Zevv spoke in 12#nim 80 minutes ago disruptek: oh shoot kennymalac: oh. can you paste the working version disruptek: we need you on araq's stream. kennymalac: @shashlick do you know why libarchive disables shared library anyway ? was just kinda following in its footsteps there with the prebuild, lol kennymalac: okay got it working :) zetashift: `stack\dev\naytracer\tests\tmatrix.nim(74, 24): Check failed: (m1 * aTuple) ⏎ == initTuple(18.0, 24.0, 18.0, 18.0) ⏎ ⏎ ```initTuple(18.0, 24.0, 18.0, 18.0) was 18.0 24.0 18.0 18.0``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e7a2d37f71b3f0d25f30829] kennymalac: I mean the build, not prebuild shashlick: kennymalac: i had some cmake issues with libarchive, plus didn't need it for my immediate needs so left it out shashlick: there is an issue though - https://github.com/genotrance/nimarchive/issues/5 disbot: ➥ Dynamic linking kennymalac: ah shashlick: the wrappers i make typically need to work across all OS shashlick: and getting autoconf working on windows is a nonstarter shashlick: and not all libs have good cmake support shashlick: have to do the best you can with these things kennymalac: shashlick any reason why nimble build fails with OSError? kennymalac: also the static test fails, not sure if the static lib is being output where it should be kennymalac: exec "nim c -d:mongocStatic -d:bsonStatic -p:.. -r tests/tlibmongonim.nim" shashlick: you don't have any bin = [] defined, what should it build? kennymalac: oh right shashlick: first test worked, but you haven't checked in tests/*tlibmongoc.nim* kennymalac: so if I add it as a project dependency it should just work if I import? kennymalac: yeah I changed that part kennymalac: but the static part doesn't work shashlick: you still need the -d:bsonGit etc kennymalac: I tried with both kennymalac: same error shashlick: nim c --d:mongocGit d:mongocStatic -d:bsonGit -d:bsonStatic -p:.. -r tests/tlibmongonim.nim kennymalac: yeah error :/ shashlick: what's the error kennymalac: /home/kenster/.choosenim/toolchains/nim-1.0.6/lib/system/nimscript.nim(252, 7) Error: unhandled exception: FAILED: nim c -d:mongocGit -d:mongocStatic -d:bsonGit -d:bsonStatic -p:.. -r tests/tlibmongonim.nim [OSError] kennymalac: /home/kenster/.choosenim/toolchains/nim-1.0.6/lib/system/fatal.nim(39, 5) Error: unhandled exception: /home/kenster/.nimble/pkgs/nimterop-0.4.4/nimterop/build.nim(621, 12) `findFile(check, path, regex = regex).len != 0` # make failed [AssertionError] shashlick: see nimgit2 wrapper shashlick: in one case, the same cmake builds both static and dynamic libraries so they can coexist in the same directory shashlick: libgit2 has different targets so i had to put them in different directories shashlick: it's possible that's what's happening here shashlick: but not sure kennymalac: oh okay shashlick: basically when you run make, it looks for the library, if it is not found, it tries to compile shashlick: which goes to 100% but no static library is found shashlick: so either it has an unual name and isn't found shashlick: or wasn't built shashlick: looks like it was built shashlick: but has an unusual name shashlick: ./buildcache/src/libbson/libbson-static-1.0.a shashlick: yep - the first `-` was not expected shashlick: https://github.com/nimterop/nimterop/blob/master/nimterop/build.nim#L961 kennymalac: hmkay so -d:bsonStatic won't work kennymalac: yea shashlick: just edit nimterop/build.nim and add a - in the [_]? and it will work kennymalac: lol okay, kinda means no one else can run my tests though without that in mind kennymalac: unless you are going to add -? shashlick: yes i'll push it shashlick: but i'm sitting on versioning a new release since i'm in the middle of a big feature shashlick: so it might be a couple weeks worst case kennymalac: kk matrixbot: `gphykos` Hello there shashlick: Araq: is {.bycopy.} mandatory for structs when passed to C procs? shashlick: trying understand when {.bycopy.} should and should not be used krux02: shashlick, you should not require ever to add {.bycopy.} at all. krux02: Nim has it's own heuristics weather an object should be passed by copy or by reference. These heuristics might be wrong though. And they might even be changed in the future. So If you don't trust those compiler optimizations, or you know that it is wrong in your case, put bycopy or byref manually to the type. shashlick: i'm trying to figure out what nimterop should do shashlick: so what are the pragmas that should be present on types and unions by default shashlick: i know c2nim puts in bycopy but am wondering why krux02: because that is the C behavior krux02: if you want 1:1 c behavior, everything should be by copy. shashlick: how about C++ krux02: same shashlick: okay good to know shashlick: so the only real pragmas types need are bycopy and incompleteStruct where appropriate shashlick: enums might need size krux02: well krux02: there are also bitfields krux02: (if you use them) silvernode: Apparently the stiulus bill includes a new digital dollar concept. Things are starting to get srange, I don't know what to think anymore. silvernode: stimulus* kennymalac: it was scrubbed silvernode: Well that's good Recruit_main707: is it possible to make nim specify the type of a function, but dont initialise result? shashlick: krux02: will ping you when i get to specifics but thanks for the input shashlick: have rewritten the nimterop backend to use the nim compiler so getting much better results with wrapping leorize: so byaddr is a thing now? leorize: and we're keeping the name? :p disruptek: byaddr was never a problem. disruptek: .byaddr was never a problem. leorize: the documentation for it is lacking though clyybber1: leorize: Consider it experimental shashlick: is there value in generating `proc name(a1: ptr cint)` and `proc name(a1: var cint)` wrappers from `void name(int *a1)` leorize: might be confusing leorize: I'd advice to just generate the ptr variant leorize: you can only be certain in generating `var` if they have the nonnull attribute attached to them zetashift: I'm guessing I'm getting that error because of incorrectly checking for floating point equality shashlick: okay will drop that idea awr1: hello all Rika: hello zetashift: hiya leorize[m]: o/ awr1: so i was thinking about the enum thing and i pored over the AST1 and AST2 stuff in nimterop Araq: shashlick, C wrappers should always use .bycopy shashlick: cool shashlick: aw1: curious on your feedback awr1: originally i thought maybe it should be AST2 exclusive but i was thinking more about it shashlick: enum support is in newalgo-2 branch shashlick: ast1 will be deprecated, i won't maintain it since ast2 will do all of it and much more awr1: but i think the best way to do this would be to implement it with a macro that does take in a typed const section which would require minimal changes to AST1. AST2 would also use the macro, emitting to the enumSection, and then do the semfold pass on the enum section exclusively as a kind of 'bonus' awr1: the semfold pass should be able to deal with the macro shashlick: if you can write code that can take a nim nkConstSection PNode and return an enum AST, will be great shashlick: i don't intend doing anything for ast1 like I said shashlick: and not a macro, by importing the compiler directly like i do in ast2 shashlick: i don't yet know how to call semfold, i tried a bit when experimenting but it didn't work awr1: you're not planning on importing nimterop / types in AST2? shashlick: it is being imported yes shashlick: check the newalgo-2 branch awr1: but you don't want to have the constSection PNode use a macro awr1: the semfold pass should execute any macro i believe awr1: so the actual nim code that a user ends up importing should be macroless awr1: but awr1: if you really didn't want to use a macro shashlick: yes, so the idea is to first generate the const section, get it reduced with semfold and see if the const can be convered to a nim enum - reorder, no duplicates awr1: what i think would have to happen is that, in our "proper enum" mode, you would have first emit the enumerator values as part of a special enum section to fold awr1: well yeah, that awr1: you would need to have a deferred enum composition after you get the folds done shashlick: so the code should do all that at runtime (toast is runtime) and returns an AST using the compiler directly, no macros shashlick: yes awr1: well i think first your foldable consts can't have type conversions like it does in AST1 shashlick: yes that's fair - we don't need anything in types - we can just treat everything as ints shashlick: not sure how it will impact bitfields or size: xyz shashlick: ideally we use it as is though so that if it cannot be reduced, we don't need to regenerate the const section with the conversions awr1: also, i see in what you get back from tree-sitter, `type_identifier?` awr1: and i forgot about anonymous enums awr1: plan on implementing them? or no shashlick: https://github.com/nimterop/nimterop/blob/newalgo-2/nimterop/ast2.nim#L1036 awr1: ah i see shashlick: hope ast2 is readable, original ast was too confusing and zero documentation shashlick: was too hard to maintain awr1: yes ast1 was a little weird awr1: i think maybe this should be made an optional feature, i don't know if you want new enums by default awr1: say a --properEnums cmd line flag shashlick: well, if it can be created as a pure enum, why do this const business shashlick: people expect nim enums shashlick: consts are a fallback shashlick: so if it is possible, it should be nim enum awr1: my concern is people utilizing the old procedures that are generated with defineEnum() awr1: this would be a breaking change shashlick: i'd say the defineEnum() stuff emulates standard enum behavior shashlick: nim enum is more seamless than the consts shashlick: it wouldn't break anyone shashlick: why do you think it would? awr1: https://github.com/nimterop/nimterop/blob/newalgo-2/nimterop/types.nim#L33 awr1: these aren't defined for nim enums shashlick: i'm sure you can add two nim enums shashlick: wow, just tried - you cannot add two nim enums? awr1: https://play.nim-lang.org/#ix=2fae alehander92: well, you need to `.int` them awr1: yes alehander92: i guess alehander92: it's a good limitation alehander92: but yeah it can be surprising shashlick: oh well, cannot do much about that - most people will expect a C enum to become a Nim enum and then realize you cannot add two of them shashlick: meh shashlick: Araq: any reason why this is the case? shashlick: awr1: in this case, user would need to create those borrowed procs manually shashlick: overall, the only benefit to nim enums is that you can print them shashlick: but then you lose this behavior shashlick: i'm wondering whether it is worth the effort shashlick: and the time it will take to process each enum to check if it can be reduced awr1: i'd imagine its because nim enums are intended to be stronger, and without adding those procs you don't need to worry about holed enums. definitely awr1: the procs with awr1: e.g. `+` between an enum and int would be...sketchy for nim enums awr1: too C-ish shashlick: you can set nim enums to specific values resulting in holes awr1: you can but it's not something to encourage awr1: > overall, the only benefit to nim enums is that you can print them awr1: you can for-loop through them awr1: you can use them in sets shashlick: for loop, yes good one shashlick: why cannot you use distinct ints in sets awr1: i mean you can try? awr1: you need to generate borrowed procs awr1: and use a smaller size awr1: e.g. int8 awr1: even then that has a wealth of possible issues awr1: you can't use distinct int verbatim in sets because int will be too large shashlick: okay I cannot say I know what you are talking about shashlick: so i'll take your word for it awr1: set[T] is basically a bitflag thingy underneath awr1: i mean you can have printable distinct ints too awr1: just don't borrow awr1: https://github.com/nimterop/nimterop/blob/newalgo-2/nimterop/types.nim#L67 awr1: this would be replaced by something more intelligent shashlick: yes that's possible awr1: you could also get for-loops too and possibly set notation awr1: though it would be different from set[T] shashlick: yep, can use in set if == and $ are defined for the distinct int shashlick: ```https://play.nim-lang.org/#ix=2fan``` awr1: set[T] is different from hashSet awr1: i will meditate on this but maybe we will have to end up working on 'better distinct int' instead of using nim enums shashlick: okay, Error: set is too large shashlick: happy with any feedback on this shashlick: and any other aspects of ast2 awr1: sure! dumjyl: One thing you lose with distinct int that is difficult to regain is case coverage. shashlick: yes that's true as well shashlick: i'm just wondering how applicable these concerns are when talking about C enums - are they really used in these ways? awr1: as an alternative to set[T] you can use Flag[T] by @mratsim PMunch: Hmm, I'm getting an "unhandled exception: zlib version mismatch!" when trying to use the zip module.. leorize: shashlick: are you trying the enum thing? Spy653: What do you guys think of nim v rust for OS or general development Recruit_main707: i have as much experience with OS than with rust Spy653: Fair awr1: what do you mean OS development awr1: like kernels? awr1: or just general systems programming Spy653: I'm thinking of using rust as my OS language and nim for applications Spy653: OS Dev as in full systems not just kernels Recruit_main707: nim can do OS if that helps, and with gc:arc it could be a really good option krux02: awr1: I din't write an os yet. Though I wrote once a scheduler. krux02: task switching on a microcontroller. krux02: This stuff is generally very low level. awr1: interesting leorize: currently rust will be in a better shape, though Zevv is working on --os:any to help with writing standalone code Recruit_main707: well, with OS i meant kernels and chips yeah krux02: You need assembly for it. Spy653: I'm going to steal the Linux kernel lol can't be fucked to do kernel Dev, so much more effort Spy653: It's free for a reason leorize: lol then write everything with nim krux02: Most parts of an operating system can be written in a high level language, but there are always bits and pieces here and there that need low level stuff that isn't covered by high level languages such as C. krux02: but apart from these low level stuff, most of an operating system is just fluff around the low level features. THat can be written in any language. It is generally like application development. I though you could even write it in python if you want to. It would just such to have a kernel written in python. krux02: "I think" not "I though" Rika: what's the best crossplatform gui lib again? leorize: define best Rika: uh, easiest Rika: sorry leorize: !repo nigui Rika: nigui? okay leorize: disbot: are you here? Rika: dead leorize: there's also karax if you wanna do electron :P Rika: F Rika: OH OH THATS GOOD Rika: wait but i need FS access Rika: hmm Spy653: How does fltk rank with you guys leorize: super low imo leorize: I like native ui Rika: it's C++ leorize: by native I mean "native toolkit" Rika: i also like native UI but i've seen how bad it looks in windows so im not sure anymore leorize: gives everything a better uniforming look Rika: i'd use Qt if there were good nim bindings or so Spy653: I like windows default, actually trying to look for one that emulates old school 2000s win UI Rika: and if Qt Creator werent absolutely massive leorize: the only complete Qt5 bindings for not-C++ that I've found are all backed by some corporate Rika: is that good or bad leorize: let's just say that people really don't want to wrap Qt leorize: because compiling qt code requires running their preprocessor on your code leorize: and obviously that preprocessor can only run on C++ code Rika: wow that sounds like a pain Rika: i guess i dont like Qt anymore shashlick: leorize: not yet - have many things to add that are higher priority shashlick: but open to PRs kodkuce: there is gtk thingy pmuch did i think i tryed it Araq: leorize, --os:any is in 1.2 and production ready IMO livcd: Rika: just find someone smart to write bindings for sciter :D Recruit_main707: --os:any HYPE Recruit_main707: btw Araq, i wanted to ask you something Recruit_main707: i saw an interview where you said you planned Nim to be directly compiled without the intermediate C/C++ code, how would that affect interoperability? (and i guess things like emit would be deprecated) awr1: you should look at nlvm awr1: https://github.com/arnetheduck/nlvm livcd: what is --os:any :O awr1: it already leverages the compiler for parsing purposes but produces LLVM bytecode instead Araq: Recruit_main707: I was refering to nlvm Araq: not sure how .emit can be supported but maybe we can extract it to a .c file and run clang over it Zevv: leorize: Im not working on anything. Araq: interop with C++'s templates is the biggest open question and that's why I'm getting quite some resistance Zevv: its done and finished afaik Araq: Zevv, you could work on SSO though or strings that support O(1) slicing Araq: ;-) Zevv: and I kind of dropped my nim work for now. I'm working my ass off so my customer can't decide to stop hiring me Araq: ah yeah Recruit_main707: Araq: very interesting solution, thank you and keep it up, one day if i get good enough ill try helping Araq: that's a good reason, Zevv, good luck Zevv: thanks! Zevv: I guess I'm fine for now since i'm at this time the one keeping the project afloat. But of course the project can always be canceled, and employees go first over freelancers, of courhse Zevv: (as they should) Araq: so ... it's streaming time leorize: stream! leorize: where is it? :P Recruit_main707: stream time :0 Araq: where is disruptek though... Zevv: !seen disruptek shashlick: !last disruptek Recruit_main707: he is gone?! leorize: disbot is dead Recruit_main707: ofc i meant disbot Araq: https://www.twitch.tv/araq4k alehander92: ouu liblq-dev: why is StringStream not available for the JS backend? alehander92: i guess no support for low level alehander92: not sure leorize: I thought we fixed streams? liblq-dev: maybe it's on devel, I'm referring to the stable doc alehander92: no idea alehander92: maybe its ok liblq-dev: nope, the doc still says that StringStream is unavailable for the JS backend http://nim-lang.github.io/Nim/streams.html#StringStream leorize: just try to use it liblq-dev: maybe it's because they operate on pointers? liblq-dev: I doubt they're supported under JS leorize: pointers are supported under js by nim btw :) Recruit_main707: dope! livcd: what is drnim ? I am late :/ livcd: and who besides Araq is talking ? kennymalac: okay, my nim mongo wrapper of mongo-c-driver works, but the interface is not so nice to use, lol https://github.com/ParadigmInteractive/libmongonim/blob/master/tests/tlibmongonim.nim liblq-dev: is there any way of checking if a process's outputStream has any more data? kennymalac: @shashlick ^ feel free to give any suggestions :) liblq-dev: p.outputStream.atEnd always returns false from me liblq-dev: s/from/for liblq-dev: which makes sense, since the stream is *not* at end kennymalac: I should probably replace all class name methods such as collection_insert_one with insert_one etc. shashlick: ya nim wrappers of C libraries don't have the most pleasant APIs shashlick: in theory, some pretty API could also be generated with the raw wrappers but i haven't spent any real time thinking about it shashlick: not sure if it is possible but it is a dream shashlick: see the nimarchive.nimble file for how to generate docs kennymalac: well, for a start, I noticed that it lets me pass nim strings into the procs, but I have to specify the length of the string kennymalac: any reason that's the case? I'd rather just do doc.bson_append_utf8(cstring("hello"), cstring("world")) Rika: ive heard that nim strings are just cstrings with a length field kennymalac: rather than doc.bson_append_utf8("hello", 5, "world", 5) kennymalac: or "hello".len, ofc Rika: you can always change the code of the wrapper cant you kennymalac: yeah I could, but it says like 120k lines of code were processed, it's a huge library leorize: Nim can't magically figure out how to pass the length Rika: i dont think theres another way unless you can macro it kennymalac: I'm sure the apis aren't going to be changing drastically though, so I could make a high level API on top I guess leorize: yea, make a high level api on top of it :) kennymalac: well the C api doesn't need the length, just a C string kennymalac: oh wait it does kennymalac: that's why the examples use BSON_APPEND_UTF8 which doesn't require it kennymalac: but that doesn't seem to be callable in nim kennymalac: hmmm kennymalac: I wonder how I should work around that. I guess bson has a lot of all caps functions which wrap the lowercase ones shashlick: https://nimterop.github.io/nimterop/docs.html for docs info shashlick: nimterop doesn't yet wrap #define func(x, y) ... shashlick: some day kennymalac: aw shucks kennymalac: does c2nim support #define ? Recruit_main707: i think it does shashlick: nope, it doesn't convert it into templates Recruit_main707: https://github.com/nim-lang/c2nim Recruit_main707: read the readme kennymalac: that's #define vars not functions kennymalac: good to know though Recruit_main707: click in here Recruit_main707: but its just what shashlick said, it converts them to templates kennymalac: he said it doesn't kennymalac: looks like it would have to be manual kennymalac: hrm shashlick: https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#id6 shashlick: but you will need to hand edit the h file liblq-dev: damn, I need to wait until a Process exits, but I also need to close its stdin pipe. I suppose that's not achievable since it would trigger an exception on myProcess.exit() leorize: close it with myProcess.close() leorize: it exits if not already, then close all handles :) liblq-dev: leorize: > WARNING: If the process has not finished executing, this will forcibly terminate the process. Doing so may result in zombie processes and pty leaks. liblq-dev: I don't want to terminate the process; just close the stdin handle leorize: then inputHandle.close? liblq-dev: yeah that worked, but I was afraid some exception would trigger on myProcess.close() leorize: actually inputStream.close is the crossplatform one liblq-dev: I don't need cross-platformness liblq-dev: it's just a script for my machine leorize: ah, don't worry, no weird exception will happen leorize: we need a more customizable api for osproc Araq: Zevv, https://github.com/zevv/nimz3/pull/2 liblq-dev: leorize: I agree leorize: well if you have time maybe you can work on one? :) liblq-dev: it's kinda annoying that we can't poll whether the process's stdout pipe has any data; I had to use posix for that leorize: we need asyncstreams to be a stable thing leorize: then we can have process with async stdin/out liblq-dev: that'd be useful IanIAnIAN: don't suppose the maker of ggplotnim lives here? Araq: sometimes he does iirc IanIAnIAN: I'll just leave a saucer of milk out for him then kaushalmodi: IanIAnIAN: You can summon him using @Vindaar Araq: https://github.com/nim-lang/Nim/pull/13743 it's alive krux02: Araq: Interesting ksandvik: Is this the Z3 Theorem Prover from Microsoft? Araq: yes ksandvik: Interestng. For cryptography work? Or just anything? Z3 is new for me.... Araq: for anything. Araq: crypto probably needs features guaranteeing "constant time" ksandvik: OK. Reading https://nikolajbjorner.github.io/slides/Z3_System.pdf ksandvik: Would Z3 help with writing more flexible unit tests? leorize: I'd be interested in having z3 optimize away certain checks because it can prove that they will be true :) rayman22201: only caught the end of the stream Araq, but that is super great work! I'm excited :-) ksandvik: I used to deal with huge unit test systems with pro apps and it was a pain to write more and more of them, wish there was a way to just define a set of APIs and a set of data and let the unit test engine loose, or let some unit tests define that there's no need to run another bunch of tests if one succeeded and covered it all. rayman22201: Z3 is more powerful than unit tests. It gives the type system superpowers. Dependent and Linear types, etc... The closest thing is Ada Spark. rayman22201: It proves things at compile time so that you don't need unit tests (for the things it proves.) ksandvik: Oh even better. Araq: leorize: yeah that would be good, quite easy to do too leorize: will z3 eventually make it into the main compiler or will it stay as a standalone tool? axion: Hey all. Simple question about type parameters. If I have 2 proc parameters that are both typed to be `a or b`, is there any way outside of the body to tell the compiler that they must be unique? That is if the first argument is `a` then the second must be `b`, and vice versa. Araq: axion: write 2 overloaded procs instead axion: Yeah that's what I'm currently doing for a bunch of operations. Just curious :) Araq: leorize: unlikely, the dependency is bad and proving stuff can take time, it's better as a separate tool Araq: good night zetashift: gnight Tristan: nevermind, just saw the `ord` keyword. Yardanico: @Tristan if you're actually translating it into proper Nim code, you would use something like a set of enum type Yardanico: (in C with ORing enum values people usually specify more than 1 enum value) leorize: yep, sets are the way to go when translating to Nim leorize: much simpler and more flexible disrupteq: sets my loins a quiverin'. Simula: is there a way to pass an empty seq to a proc that expects a `seq[string]`? Yardanico: myproc(@[]) Yardanico: ah sorry Simula: `Error: type mismatch: got ` Yardanico: either pass newSeq[string]() or create it like "var data: seq[string]" and pass that Yardanico: why not have a default value for that seq though? Simula: it's a seq of error strings. i'm overloading the proc for when there are errors and also no errors Yardanico: well, seq is a runtime thing, maybe you want arrays? Simula: this is a runtime thing :P Simula: it's validating html forms Simula: unless i misunderstand Yardanico: ah, then seqs are fine, I just mistunderstood your "overloading" thing :P Yardanico: I thought you're actually overloading the proc with different implementations Simula: nope. the overload just calls the original with an empty seq Yardanico: well I just meant that you can provide the default value for your proc to be an empty seq Yardanico: proc myproc(a: seq[string] = @[]) Yardanico: so when you call it like myproc() it uses an empty seq Simula: oh duh, just saw that lol krux02: Simula: myProc((seq[string])@[]) krux02: Simula: myProc(seq[string](@[])) Yardanico: too lispy :P Winton: https://mega.nz/#F!4xNjBCYK!ebtr4LFxe3Ilssh1Z-4mgQ!M4kXBCyC who is encouraged to create an emulator server Winton: transcribe this code from java to nim Bawbby: what is this zcore? Winton: > what is this zcore? Winton: @Bawbby is an emulator created in Java, for a 2D MMORPG game based on Flash Player Winton: really this emulator is version 2 there are other versions 3 created in C # and JS Winton: Winton: https://cdn.discordapp.com/attachments/371759389889003532/691495905207123979/79100511_104293074400117_1801959606415523840_n.png Bawbby: is there a project page for this somewhere? Winton: yes Winton: > is there a project page for this somewhere? Winton: @Bawbby https://www.facebook.com/EternityLandsPS Winton: https://github.com/thalysmarciobn/AQWorlds-Emulator Winton: this is a half-discontinued project since they migrated it to C# bgammill: hi all Winton: Hi 😄 awr1: hello gogolxdong: full stack Nim project has been launched http://cloudfastnet.com/ gogolxdong: [email protected] / test for testing gogolxdong: There is 21944 loc in HTML+ php for the original project, and 7357 loc in Nim for now. silvernode: How is everyone? silvernode: I am still working on my space game, I made some more progress yesterday with the help of a friend. leorize: gogolxdong: it looks nice, was it made with karax? gogolxdong: karax + prologue Guest67294: gogolxdong: Nim is reducing the loc for you? nice :-) euantor: leorize: perfect, thanks Benumbed: GDIT, the AMQP spec has as self-referential data structure which is making my life a living hell trying to map it out in Nim leorize: self referential? wdym? Benumbed: let me paste this crazy into something, sec Benumbed: https://play.nim-lang.org/#ix=2f1X Benumbed: Notice how `FieldTableValue` has a field named `tableVal` which has a type of `FieldTable` Benumbed: (near the bottom of `FieldTableValue` Benumbed: FieldTable is an OrderedTable whose keys are `FieldTableValue` type Benumbed: because AMQP specifies that field-tables can contain field-tables Benumbed: Maybe I have just overthought my way into a corner Benumbed: And I have tried to forward declare `FieldTableValue` but that doesn't work, I think because forward decls don't work with recursive structures in Nim Benumbed: (I read something like that in the manual I think?) sealmove: this is not a problem in general in nim sealmove: just use ref Benumbed: Sorry, it's late here and I'm tired, can you expand a bit on what you mean by use ref? sealmove: oh well, for starters use one type section sealmove: type sealmove: FieldTable* = ref OrderedTable[string, FieldTableValue] sealmove: FieldTableValue* = ref object sealmove: you need to use one type section when doing self-referential structures Benumbed: I completely forgot you can nest multiple typedefs under the type keyword... *facepalm* leorize: sealmove: use OrderedTableRef :P Benumbed: Thank you sealmove, I was losing my mind over here sealmove: np PMunch: Haha, someone opened a "Thank you" issue in my termstyle repo :) Vindaar: <3 alehander92: morning PMunch: Morning Lantos: morning dadada: should deepCopy work inside a macro? I'm not using it to copy a NimNode (where I would use copy()), but for something else and I get Error: cannot generate code for: mDeepCopy Araq: use copyTree() instead dadada: do you mean copyNimTree() there's no copyTree() showing up in the documentation's search, and may I remind you what I want to copy IS NOT a NimNode, but a custom ref object Araq: oh ok dadada: Araq: much like this: https://play.nim-lang.org/#ix=2f2l Araq: don't use 'ref object' then if you don't want ref semantics Araq: or use: var copy = newT(); copy[] = orig[] PMunch: What's the best RSA library for Nim atm? dadada: ok, I already had a manual copy proc as workaround in place, but then learned about deepCopy, so wanted to use the more idiomatic solution (which I thought deepCopy to be), now that I learned that deepCopy doesn't work in macros, I'm going back to my earlier solution... But still, I'm curious why it doesn't work Araq: deepCopy is for "Pass value over to different thread" Araq: since the VM doesn't support threads, it never supported deepCopy either krux02: Araq: regarding the the revert of my pr https://github.com/nim-lang/Nim/pull/13712 disbot: ➥ fix #13417 krux02: it would have been nicer if you would have complained about it in the review process that the copy isn't acceptable. After all I even marked it in a comment in the code that you saw. krux02: That is the comment I am talking about: # arrays will deep copy here (pretty bad). Araq: krux02, I regard as "not even bothering krux02" as nice Araq: I saw the comment but wasn't aware of its implications Araq: I thought only edge cases are affected krux02: well yes Araq: and today is release day so I'm rushing it krux02: the regression is a constructed edge case Araq: as I still know no other way of how to do a release Araq: :-P Araq: clyybber, your templates are the bomb krux02: well I can open you a performance regression that was introduced by reverting my PR. krux02: you want that? dadada: yeah, release day! :P thanks Araq for all the work you do Araq: no, I want a decent fix, krux02 but not for 1.2. krux02: what do you see as a decent fix. Araq: first class open array support for temporaries Araq: alternatively an optimization in the backend so that it takes address of arrays instead of copying them around Araq: would have helped for our base64 fixes too dadada: Araq: which clyybber templates are the bomb? krux02: Well, you can contract me to do it. I am offering you to do it. Not for free though. Araq: the one in injectdestructor.nim, dadada, can't replace them with a proc and get the same logic dadada: we need a curated list somewhere of the best nim modules/templates/macros, so that it's easier for people (especially those new to Nim) to find, learn and use them krux02: https://github.com/VPashkov/awesome-nim Araq: krux02, I lack the money, we can put bounties on it though krux02: first list I found krux02: After all I spok with zahary at fosdem, he said the payment just continued. krux02: so you should be able to pay me. clyybber: Araq: Which templates? PMunch: No one have any suggestions for RSA libraries? clyybber: Oh, seen the answer now clyybber: Thanks :) krux02: dadada, the curated list I just set you is probably outdated and not the best. But it is a start. sheerluck: a release day! a release day! krux02: I think nim-awesome should be forked to github.com/nim-lang to make it more official. dadada: krux02: thanks, there's also https://github.com/nim-lang/Nim/wiki/Curated-Packages Recruit_main707: hello, let me explain the situation, there is a community for creating rocket league bots, (as i have mentioned here before), and i made some python intermediate bridge to connect Nim (and any executable really) to the game, and i was wondering if it is worth it getting it into nimble, (because you need to have rocket league installed to use it) what do you think? Recruit_main707: (not only the python bridge, but the tiny framework i made in Nim for connecting to it and sending receiving data) PMunch: Sure, why not Recruit_main707: its just that if there is no one to use it (which is probably the situation) i can avoid having to do it :p jken: Anyone here good with opengl and willing to tell me where I am going wrong setting up glVertexAttribPointer for my vertex data? krux02: Recruit_main707: How does it work. Does rocket league have any robot interface? is it a hack to read values out of the running executable? Or is it hard screen reading with image recognition? Rika: i have a feeling its the middle one Recruit_main707: krux02, at first the community started with reading values, but we actually got psyonix to support us officially and now the framework comes with rocket league krux02: Could be fun to program a team of rocket league players. Recruit_main707: its only offline though Rika: oh wow so its both the 1st and middle Rika: why the python bridge though Recruit_main707: bc they only support certain languages officially and i have no experience with flatbuffers (nor any faster language to develop the bridge) krux02: you don't need to be online to let AI play against each other if you can download other people's AI from the internet. Rika: time to deconstruct the python library then 😛 Recruit_main707: ye, ofc, they have a cool gui with a bunch of bots by "default" krux02: I really thik AI programming is interesting. Recruit_main707: https://tenor.com/view/it-just-works-tod-todd-howard-%d1%82%d0%be%d0%b4%d0%b4%d0%b3%d0%be%d0%b2%d0%b0%d1%80%d0%b4-fallout-skyrim-gif-14803660 Recruit_main707: krux02: for now, most bots (and best ones) are hardcoded, but people are trying to use ML too sheerluck: Recruit_main707 there's russian chars in your url jken: This isn't runnable, but the important bits are here. Anyone see my flaw? https://play.nim-lang.org/#ix=2f2y krux02: yea I think hardcodod bots can always be defeated by finding a weakness/exploat in the strategy. jken: I think my stride and offset calculations for glVertexAttribArray are wrong but I can't figure out why krux02: jken, they are always wrong, because that is a very error prone process. krux02: That is why I wrote my project here: https://github.com/krux02/opengl-sandbox krux02: never ever write glVertexattribArray manually anymore. krux02: just feed it typed object and it will work. jken: I am not sure what you mean by that krux02, could you elaborate? krux02: I wrote a project because I didn't like the error prone-ness of glVertexAttribArray and other low level opengl functions. krux02: they are low level, but they also expect you to set a lot of parameters correctly. A job that could be done easily by a human. krux02: But I also didn't want to use a game engine. krux02: I thought game engines are too restrictive krux02: sorry I mean "A job that could be done easily by a computer. It is very error prone when a human does it. krux02: So I tried to figure out how these parameters could be automatically infered by the context and types. krux02: just rinse and repead and this is what I ended up with: https://github.com/krux02/opengl-sandbox/blob/master/examples/hello_shapes.nim krux02: here is an example of how I call a shader program: https://github.com/krux02/opengl-sandbox/blob/master/examples/hello_shapes.nim#L210 krux02: paremeters like vertexOffset and baseVertex are still set explicitly, since I wanted to experiment with a single buffer for all meshes. krux02: (that part might be automated at some point too) krux02: and if you look in the attributes block, where I set a_vertex a_normal a_color, this block enables all attributes, provides attribute input variables in the shader, passes the attributes to the shader and tells opengl how to treat the input data. krux02: like I said, never ever call glVertexattribArray manually again jken: looks like i have alot to learn krux02: this project is maximum metaprogramming in Nim. krux02: But I really have to reactivate it. I didn't touch it for quite some time, because I was too busy in working on the Nim compiler. krux02: this project is the reason I even started to learn Nim. It would simply not be possible in other programming languages. dadada: since you seem to be an expert in this domain krux02, why would you use OpenGL over Vulkan for new projects? Yardanico: well Vulkan seems to be much more verbose :P krux02: for me, OpenGL is just what I know better. krux02: but there are good reasons to take OpenGL over Vulkan. krux02: I can write you a hello triangle in basically 5 lines of code in OpenGL 1.0. krux02: The fixed function pipeline of OpenGL 1.0 is really great for individuals to get something to the screen without too much hassle in any direction. krux02: Yea, it is marked as "deprecated", but it is well specified, breadly implemented, and a lot of code relies on its existence. In other words, it won't go away. Yardanico: well yeah, there's already a OpenGL->Vulkan implementation being worked on in Mesa krux02: Not saying immediate mode is "fast", I am just saying you get things faster done. krux02: Yardanico, yes Yardanico: so even after vendors stop implementing OpenGL it'll be supported :P krux02: yes Araq: if OSX deprecates OpenGL they might remove it some day. Not saying that's a good thing krux02: it will probably the other way araoud Araq: but operating systems are not required to implement "standard X" at all, that's not how it works Yardanico: there's already MoltenVK for Metal->Vulkan, and MoltenGL too (but it's proprietary) Generic: I really dislike the opengl api with all of this binding stuff, it makes some many thing so cumbersome Yardanico: and MoltenGL is for OpenGL ES though krux02: on OSX your choice is OpenGL from 10 years ago, or proprietary Metal (not Vulkan). krux02: yea this binding in OpenGL is horrible. Yardanico: well MoltenVK works "quite well" so that you can even play Vulkan games :P or even play windows DX9/10/11 games with DXVK (DirectX) -> Vulkan -> Metal clyybber: vulkan is awesome krux02: as far as I know MoltenVK isn't a full Vulkan implementation, because Metal doesn't support it. clyybber: quite verbose but a much better debugging experience compared to opengl Recruit_main707: no nim vulkan yet right? Yardanico: there are libs for vulkan in nim Yardanico: but they're bindings mostly clyybber: Recruit_main707: I made bindings clyybber: And I'm making an engine jken: turns out all my troubles were because my Vertex type was a ref object krux02: bindings should not be a problem. Yardanico: @Recruit_main707 when you want to find something implemented in Nim, search for it like that: https://github.com/search?q=language%3Anim+vulkan Recruit_main707: cool, can i download them with nimble? Yardanico: well yeah, ofc Yardanico: most nim projects have a .nimble file, but not all :P Recruit_main707: nice Yardanico: clyybber's one doesn't, but you can just copy that single vulkan.nim file in your project Recruit_main707: thats enough Yardanico: NimGL seems to have Vulkan bindings too - https://github.com/nimgl/nimgl/blob/master/src/nimgl/vulkan.nim clyybber: Oh, yeah clyybber: Do you need nimble? clyybber: I should probably publish it.. Recruit_main707: me? i personally dont if its just one file, but it would be nice to have it in nimble nevertheless clyybber: yeah clyybber: Araq: Should we maybe mark byaddr and thinout as experimental? clyybber: So as to reserve the right to remove them Araq: thinout is opt-in via -d:nimThinout Araq: and byaddr is a separate 'std' import Araq: and 'std' is really 'experimental' Araq: :D Rika: so `monotimes` is experimental? PMunch: What is thinout? Araq: Rika: no. Araq: I wasn't entirely serious but new modules start in std/ so that you don't have to update your import paths as they ripe clyybber: Ok, cool Rika: i see Generic: does byaddr work with the js backend? Recruit_main707: i dont think so Rika: is there a reason the `do:` syntax is totally undocumented Yardanico: it is? lol Yardanico: didn't notice :P Rika: i tried searching everywhere lmao solitudesf: https://nim-lang.org/docs/manual_experimental.html#do-notation Yardanico: well, how it is experimental though? :P Rika: ah its in experimental lmao kaushalmodi: use the `=>` from sugar; it's nice kaushalmodi: https://scripter.co/notes/nim/#do-notation Rika: => doesnt allow me to do blocks of code 🙂 kaushalmodi: hmm clyybber: use do then Rika: the heck do you mean, i already amm Rika: am clyybber: kk awr1: nimterop AST2 looks interesting awr1: does set[T] work with cligen? awr1: or is it seqs only disruptek: cligen works with enums, if that's your question. i dunno if it knows how to constitute sets. Yardanico: i like that you can do stuff like fs.setPosition(ePhoff + (if eClass == 1: 0x20 else: 0x38) * i) :P disruptek: please no. disruptek: i guess my idOrSig pr misses some corners. disruptek: also, we should have it add the module name to tmpBase. disruptek: is 1.2 a thing? narimiran: disruptek: it will be soon ;) Yardanico: is there a way to force C compiler to keep an unused string constant (nim const) in binary in release mode? lqdev[m]: are `osproc.Process`es closed automatically when the program quits? Recruit_main707: can i create a pointer that points to an specific address? Rika: addr (the object) doesnt work? Yardanico: well, that would be a pointer to pointer, why not? Yardanico: ah, I understand what you mean Yardanico: Well, a pointer is basically a number which is an adress containing the thing pointer points to :P Recruit_main707: i want to do something like this https://play.nim-lang.org/#ix=2f3d solitudesf: just cast it Yardanico: @Recruit_main707 Addr is the address for which you want a pointer? Recruit_main707: cast[ptr int]([the_number])? Yardanico: yes Yardanico: but if you cast an incorrect address and then try to access it - probably you'll get a segfault :) Recruit_main707: risk it 4 the biscuit kennymalac: Hello all, trying to generate a cffi for mongo-c-driver, and I have this error when trying to generate for bson: kennymalac: Error: unhandled exception: getters.nim(103, 14) `name[0] != '_' and name[^1] != '_'` Identifier '_bson_context_t' (nskType) contains leading/trailing underscores '_' [AssertionError] [AssertionError] kennymalac: how do I handle this? nim doesn't allow leading underscores for type names... kennymalac: so *bson*context_t does not work Yardanico: well, why do you need underscores in types names in Nim? Yardanico: can't you just strip them or something like that? kennymalac: the cffi autogen is generating from the C type names in the header file kennymalac: proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = ⏎ ⏎ ```sym.name = sym.name.replace(re"_[_]+", "_").strip(chars = {'_'})``` ⏎ ⏎ seems like a workaround [https://gitter.im/nim-lang/Nim?at=5e78d441e2b4467c36f3f663] kennymalac: lol gitter.im removes the _ in the regex alehander92: use `` alehander92: for code snippets kennymalac: ` proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = ⏎ ⏎ ```sym.name = sym.name.replace(re"_[_]+", "_").strip(chars = {'_'})```` [https://gitter.im/nim-lang/Nim?at=5e78d4d1238b385efc9e43e9] Yardanico: is this a new regression in devel with arc? when trying to do "echo repr fileobj" with Yardanico: --gc:arc I get this: Yardanico: /home/dian/stuff/nim-cephei/cephei.nim(107, 13) Error: ambiguous call; both repr_v2.repr(x: ref T or ptr T) [declared in /home/dian/.nim/lib/system/repr_v2.nim(106, 6)] and repr_v2.repr(x: ptr T) [declared in /home/dian/.nim/lib/system/repr_v2.nim(102, 6)] match for: (File) shashlick: awr1: has been really challenging but a lot of fun Yardanico: https://github.com/nim-lang/Nim/issues/13731 disbot: ➥ A regression (?) with --gc:arc and repr ; snippet at 12https://play.nim-lang.org/#ix=2f3n disruptek: Yardanico: repr wasn't supported in arc and then maybe it was and now maybe it isn't again. Yardanico: well, still worth to make an issue :P disruptek: okay, but note that it's basically code smell to use it at runtime. Yardanico: well, repr is for debugging, isn't it? Yardanico: at runtime disruptek: debugging, yes. kennymalac: how come nimterop is telling me kennymalac: #Type '_bson_value_t' skipped ⏎ ⏎ # Type 'bson_type_t' skipped kennymalac: and then subsequently saying bson_type_t is not defined, lol Rika: underscore Rika: ah Rika: the 2nd one i see Rika: hm Rika: maybe bug lol shashlick: it has nested structs which nimterop doesn't support yet shashlick: https://github.com/mongodb/libbson/blob/master/src/bson/bson-types.h#L275 shashlick: ast2 will support it soon kennymalac: OK so what do I do about this kennymalac: as a workaround shashlick: use c2nim to convert it and then add it to a cOverride section before your cimport Deuns: euantor: same openbsd (-current), one can build nimble, the other can't open "std/options" :p Deuns: everything is fine... kennymalac: ah alright euantor: Deuns: Yeah, I'm not sure why at the minute euantor: I'm setting up a clean OpenBSD 6.6 VM at the moment so I can test ona clean system shashlick: kennymalac: https://github.com/nimterop/nimterop/issues/137 disbot: ➥ Issues with nested structs ; snippet at 12https://play.nim-lang.org/#ix=2f3q kennymalac: mkay is there an example that does this somewhere? or how to do this ? thanks kennymalac: my guess is I just run c2nim and then take the proc definitions and put it in a cOverride block? shashlick: copy/paste that struct into a.h, c2nim a.h - it might complain about some stuff, fix it in the a.h and rerun till you get it working shashlick: let nimterop do all the other stuff, only hand-wrap this one struct with c2nim axion: I think I'm about ready to give up on my first Nim project. Wrote a ton of code and can't figure out how to get rid of recursive module errors without shoving thousands of lines in 1 file. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: today i think i'll just talk about musical lyrics. disruptek: while i spelunk the compiler. leorize: lqdev[m]: no leorize: axion: well if you want recursive modules you gotta have a good reason to argue with Araq :P Araq: not really. recursive module deps are blocked by IC axion: I've been trying for 2 days now to structure the modules in this project in a way that will work. Nothing I try is working. I'm just not experienced enough to figure this out Araq: apart from that it's basically an accepted RFC disruptek: so put thousands of lines in a file. disruptek: there are worse problems to have in life. Araq: maybe we'll make the import with a {.cyclic.} so that's explicit leorize: axion: worst case scenario, use `include` to make a thousand lines file from multiple files shashlick: axiom: can you share your code, we can make suggestions axion: `include` may work, though it's all generics that would be duplicated. not sure if the compiler will warn/error leorize: ofc it will :) leorize: the idea is that you make your thousand line file with a ton of includes, like the compiler :P axion: I can share what I have so far, though far from complete. axion: Give me a moment please axion: https://github.com/mfiano/origin.nim kennymalac: @shashlick possible to reference types that will be later defined? for instance, using uint32_t which gets generated from cinterop kennymalac: oh nevermind those are C types kennymalac: hmmm kennymalac: found it https://github.com/CoryNull/nim-bgfx/blob/master/bgfx/types.nim#L7 :) leorize: axion: please inherit from either CatchableError or Defect :) axion: I don't know what that means yet. I'm a complete newbie and taking one step at a time. A lot about this project can be improved I'm sure, but my focus is on organization right now. leorize: so what's your problem rn? axion: It's a bit hard to explain but kennymalac: now I get a very unhelpful error, lol kennymalac: /home/kenster/.choosenim/toolchains/nim-1.0.2/lib/core/macros.nim(1765, 43) Error: string literal expected axion: The user is intended to import the main origin module only, which imports and exports the public API for them. One of those modules is common.nim which contains all the types and common operations for all the other modules. I don't want to export this module though, because it also contains internal stuff, like macros for internal use. I can't split them out into other files without recursive module axion: errors. Additionally, the types aren't even exported by the main origin.nim module because they are in common. kennymalac: trying out 1.0.6 Rika: you can `import module except` Rika: and `export module except` too afaik axion: I can't import common.nim from origin.nim because common.nim needs to be imported from each other file and a circularity arises when trying to compile them axion: It's all a big mess right now...been trying to find a way to fix it Rika: theres a way to strategically place imports to avoid circularity kennymalac: okay upgrading didn't help, lol kennymalac: but line 1765 in macros.nim doesn't exist it only seems to go up to line 1665 shashlick: kennymalac: that's not an error in nim shashlick: that's an error in the generated code alehander92: Araq thanks for `.emit` alehander92: works well axion: Rika: Probably. I feel like I'll get it in a few more weeks of trial and error. shashlick: kennymalac: can you post your wrapper somewhere, i can look at it Rika: axion theres a tutorial for how in the manual kennymalac: sure Rika: first section of the manual shashlick: also, cOverride will insert your override at the right location so it can refer to other stuff created by nimterop before this symbol shashlick: but you need to make sure your override works by itself shashlick: i.e. is valid Nim Rika: https://play.nim-lang.org/#ix=2f3u ok so this doesnt seem to agree with me, is there a reason why? i know this is bad design, but im not keen on adding `.int` to the middle of 170 lines Rika: because i have to do this manually, since all of these values are arbitrary Rika: (i'm conforming to game values) axion: "About this document"? Rika: i mean the first part of the manual Rika: there are 3 parts Rika: https://nim-lang.org/docs/manual.html#modules Rika: or am i mistaken Rika: i think im thinking of something else Rika: nonetheless ive sent the link axion: Yeah I have read that. My problem is more domain specific due to the dependencies and generics used. Rika: might need include then kennymalac: https://github.com/ParadigmInteractive/libmongonim @shashlick solitudesf: @Rika, https://play.nim-lang.org/#ix=2f3v solitudesf: a workaround solitudesf: your version doesnt work because there converter doesnt get used. solitudesf: wait, but should it?.. Rika: those are my thoughts disruptek: creepy. disruptek: what card am i holding up? solitudesf: no, its right, it shouldn't get used Rika: why not? solitudesf: youre calling this proc `proc `[]=`[I: Ordinal; T, S](a: T; i: I; x: S)` solitudesf: its fully generic so it obviously doesnt call converter axion: Rika: I can't do that because it's intended for things in different modules to have the same such as consts and types axion: same names* axion: I think I need a break. Hurting my brain. Going to watch tv or something. shashlick: kennymalac: trying kennymalac: cool Rika: solitudesf, darn, okay solitudesf: just use your custom []= if you want to do wacky shit Rika: okay shashlick: kennymalac: just change your cOverride uint32_t to just uint32 shashlick: no need to declare those kennymalac: oh okay shashlick: Why did you have to override the enum alehander92: axion alehander92: hm https://github.com/mfiano/origin.nim/blob/master/src/origin/mat4.nim#L406 kennymalac: it complained about bson_type_t not being defined shashlick alehander92: i dont know algebra much alehander92: but isnt there a way to somehow loop over a pattern here kennymalac: oh weird, it compiles without it alehander92: it seems very easy to make a mistake alehander92: and the "loop" can still generate the same code shashlick: Cool beans alehander92: might be closer to math defs otherwise tho so maybe i am wrong kennymalac: how would you debug the string literal expected? axion: alehander92: Sure there is, but the overhead in doing so is not ideal. It could be a macro, but I'm trying to write this in an educational form without magic hidden behind tons of macros axion: The only macro I will eventually have are matrix accessors, like M02 -> m[8], so it reads just like you'd read it in a math text. I'm actually going for verbosity here because math should be written as it would be on paper alehander92: hm, maybe alehander92: it's bit subjective thing but for educational purposes it makes sense shashlick: kennymalac: did you change bson_subtype to bson_subtype_t in your override shashlick: that's one failure shashlick: same with bson_oid_t euantor: so `nim dump` dumps a bunch of paths to stderr that look right, but they're unfortunately not full paths :( shashlick: okay i'm down to the string literal error now shashlick: here's how you debug that shashlick: first `nim c bson.nim > a.txt` shashlick: then open a.txt and see the nimterop/toast command line at the top shashlick: run that on the command line with the -k flag shashlick: basically you haven't declared your dynlib="bson" <= what is bson there shashlick: change dynlib="bson" -> dynlib = "bsonLPath" shashlick: and it works kennymalac: oh okay nice kennymalac: I did bson so I could get rid of this error from mongo: ERROR: bson/bson.h: No such file or directory shashlick: here's your final wrapper - http://ix.io/2f3M/nim kennymalac: looks like it still errors kennymalac: hmm that link doesn't load for me kennymalac: should I make the output dir go to build/bson ? would that fix it? shashlick: it isn't the output dir kennymalac: okay now the link works, it was my internet kennymalac: yeah nevermind shashlick: try https://pastebin.com/s8AXP9SN kennymalac: so how to get bson.h loading from bson/bson.h as required by mongoc.h? shashlick: Oh you are onto the next one shashlick: Use cIncludeDir shashlick: See the nimarchive/archive wrapper shashlick: How it refers to lzma, zlib, etc shashlick: If you include bson.nim then bsonPath will exist kennymalac: the reason I split them into two seprate files is having both getHeaders in the same file causes a compile time error kennymalac: probably a bug kennymalac: I think two headers from the same git repo fails kennymalac: so I don't think I can import it kennymalac: nvm, I can because it's not exported kennymalac: the conflicts that is kennymalac: ah this is confusing shashlick: What's up kennymalac: I see I have to override the cmake values for the bson lib dir shashlick: if required that is disruptek: !last zedeus disbot: zedeus joined 12#nim-offtopic 5 days ago and last spoke 75 days ago disruptek: where is he? disruptek: sick? zedeus: hello disruptek: are you on stream? disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek zedeus: nope, i'll have a look disruptek: just realized i hadn't seen you in awhile. zetashift: 75 days ago surely is wrong no? alehander92: irc=>gitter doesnt get the color codes zedeus: just been busy trying not to get infected :) alehander92: its probably 5 days disruptek: yeah. disruptek: get a real client. Yardanico: quassel :P dadada: let's say I want a sequence with many different types in it, where I don't know the composition at compile-time, Nim provides one way to do this through the Any type that can basically wrap any type you can use in Nim, but there's one complication here, when you eventually want to use the original object/type at runtime, you've to use the Any.kind field to determine the correct method (I mean proc) to do it dadada: (something like getString() or getInt()), this works best I assume for builtin types like int, but what if you're dealing with custom objects, or maybe objects that users of your library will later define, what I mean is there's no generalized way of casting the type that is wrapped inside the Any into its original form (that I can see), has someone done any work to simplify dealing with this? disruptek: yes, see the json module. Yardanico: yeah, json is the way :P dadada: I imagine there's some overhead involved with JSON, I'd prefer to find a way that works without it Yardanico: as long as you're not decoding/encoding, not really disruptek: let us know what you come up with. Yardanico: json just uses an object variant with different fields Yardanico: https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/json.nim#L156 dadada: I may be mistaken here, but json can't preserve reference/pointers to objects? This can be done with Any getPointer and manual casting. I'll definitely try to come up with something. disruptek: i think you're missing the point. alehander92: guys dadada: alehander92: hello alehander92: yea alehander92: i want to talk about error types alehander92: its fun to talk about them Yardanico: oh no alehander92: oh no disruptek: what did we decide about shadowing with new type names? it'd be better to have a warning? disruptek: ie. same name, new type alehander92: is this in the spec Recruit_main707: i am having an issue with passing pointers by value: https://play.nim-lang.org/#ix=2f4H (full error if you run the code) leorize: well I'm seeing a crash which makes sense? disruptek: weak symbol names? Recruit_main707: ?? leorize: so what's the problem? it's supposed to crash like that, at least with your snippet Recruit_main707: then what am i doing wrong? leorize: the value you hardcoded in there doesn't exists leorize: pointers point to a place in the program's memory Araq: how do you know that 0x8832205C is a valid address? Recruit_main707: how can i know if they are valid addresses? leorize: ... you can't leorize: what are you trying to do? Recruit_main707: here, making sure that variable is at a certain memory location leorize: I'm sorry, but that's not how it works Recruit_main707: this is just a demo leorize: the OS assigns you the memory, you don't get to do that Recruit_main707: in practice, i am trying to access a variable of another process Recruit_main707: by reference leorize: well but if what you mean is to convert an arbitary value into a pointer, then yes, that's how leorize: you still can't do it like that, sadly leorize: unless you have access to the program's address space Recruit_main707: my code is injected in the process leorize: sure, then that's how Recruit_main707: ok, so ill have to keep trying Recruit_main707: thank you rockcavera: Is there a proc to check if a string is a valid ipv4 or ipv6? leorize: no leorize: though there's this: leorize: !packages validateip disbot: https://github.com/Akito13/nim-validateip -- 9validateip: 11Checks if a provided string is actually a correct IP address. Supports detection of Class A to D of IPv4 addresses. rockcavera: thanks axion: What am I doing wrong here? I'm confused why it's returning -1: https://play.nim-lang.org/#ix=2f5t shashlick: -1 or 0 = axion: ? lqdev[m]: is there a way for sending data in to a process progressively? eg. I want to send some PNG files to the stdin of an ffmpeg Process, but I don't have them all at once. instead, they come in slowly, rendered from Blender disruptek: !repo asynctools disbot: https://github.com/cheatfate/asynctools -- 9asynctools: 11Various asynchronous tools for Nim language 15 53⭐ 12🍴 axion: Hmm. I was expecting `or` to short circuit and not evaluate later terms. I'll have to think of the proper way to do this. I'm too used to FP style it seems. kaushalmodi: axion: in your example, you are using a type name `char` as var name kaushalmodi: also `find` returns int and `or` would be to OR bools axion: gah, in lisp everything that isn't false is truthy kaushalmodi: this is a compiled lang axion: so is common lisp kaushalmodi: true != 1 Rika: this is a lang that doesnt have a concept of truthy leorize: axion: only true means true in Nim axion: I noticed. I'm fighting every step of the way trying to write as expressive and efficient code as I am used to. It's not easy to write Nim without lots of boilerplate, whether in the form of macros or runtime branching mratsim: WHat? leorize: instead of that, try this: `char in "xyzw"` axion: I think a blog post is in order, as other Lispers have been asking me how my progress has been. Rika: theres a balance between expressive and less error prone perhaps mratsim: in my experience, only very few language were more expressive than Nim (i.e. Haskell) but they had oother issues axion: If I wanted less error prone I'd use a dependently typed language or a static Lisp like Carp, which Nim is not. Rika: dependently typed language? Rika: maybe what you mean instead of expressive is terse mratsim: Nim can do dependent typing zetashift: I like the fact that only true means true in Nim and I don't find that it impairs it's expressiveness. Maybe your view of expressive code is different then what Nim thinks? mratsim: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/finite_fields.nim#L32-L38 mratsim: https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/bigints.nim#L58-L75 mratsim: mratsim: ^ this is using dependant typing mratsim: mratsim: And I'm also modeling algebraic concept of groups, fields and number theory: https://github.com/mratsim/constantine/blob/master/constantine/tower_field_extensions/abelian_groups.nim#L38-L44 Rika: is there dependent typing in functions? mratsim: This is an example: https://github.com/mratsim/Arraymancer/pull/413#issuecomment-586924873 disbot: ➥ WIP: Add dbscan clustering method ; snippet at 12https://play.nim-lang.org/#ix=2bWh mratsim: "Alternative 2 typedesc dispatch" mratsim: Nimcrypto is entirely based on typedesc dispatch: https://github.com/cheatfate/nimcrypto/blob/master/nimcrypto/hash.nim#L68 axion: dependent types can have the return type depend on information only known at runtime. axion: In order to typecheck the compiler has to verify that the types work out for every possible value though axion: (Which means dep-typed langs tend to be rather picky about the allowed values you can construct) mratsim: pretty sure Idris doesn't allow that Rika: `I`dris or `l`dris? mratsim: Is there runtime dependant type? Isn't that just an interface or polymorphism? mratsim: Idris with i Rika: i think you misunderstood them axion: Depends how dependent the types have gotten I suppose. axion: The entire point of curry-howard is that every program you write is a proof of something, it’s just without the rich specification of dependent types the particular properties you’re "proving" are more or less trivial. leorize: can I have some examples? leorize: this sounds interesting rayman22201: Of all the criticisms of Nim that I have heard, I never thought I would hear "Nim is not expressive enough"... only the most hard core lisp person could come up with with that lol Rika: lmaooo Rika: or maybe the haskeller axion: I would read "The Little Typer" or "Type-Driven Development in Idris". It's a pretty complex subject to say the least if you aren't familiar with proof assistants already Rika: sounds like something that would be nice tbh but sounds like a pain to implement mratsim: Coq is a bit too much for first contact 😛 mratsim: Z" would be a step in that direction mratsim: Z3 mratsim: F* is using Z3 for their dependent type system AFAIK mratsim: currently Nim is a collection of typedesc and static cobbled together, it kind of works but it's easy to trigger "Cannot instantiate T" Recruit_main707: leorize: got it to work, sleep() function was crashing my program, so i can only burn cpu mratsim: besides the cannot instantiate or the straight up crash I didn't see any type-level bug though. axion: rayman22201: "expressive" means that it's easy to write code that's intutitive, both for the compiler and a human. The addition of un-needed boilerplate code, not being able to share names between consts/procs for example, or wrongly choosing a reserved keyword because there's no context-sensitive shadowing (god, i can't count how many times i tried using `out` etc), that goes against it. axion: But you're right. I've been using Lisp for a couple decades so I am quite hardcore :) Rika: un-needed boilerplate code -> example? Rika: not being able to share names between consts/procs for example -> with UFCS, this is impossible i'm pretty sure Rika: actually, probably is possible Rika: i've just not thought of it that much Rika: wrongly choosing a reserved keyword because there's no context-sensitive shadowing -> this is prolly easy to implement mratsim: const and proc and modules can have the same name though? rayman22201: Reserved keyword sharing would be hard b/c of the way the Nim lexer works afaik. Nim is very much a classical lang and not a lisp in this regard. rayman22201: shadowing* mratsim: I think keyword are actually hard because they are parser level Rika: huh, i see mratsim: The "block" keyword is super annoying in particular Rika: why so? mratsim: In blockchain everything is a block ... mratsim: in our codebase it's blck or blk Rika: ooh Rika: ouch Rika: i've seen most people use blk shashlick: axiom: appreciate the struggle, i had similar challenges with python lists to nim, etc. but nim != lisp so some mental flexibility is warranted rayman22201: axion, it seems to me that you really want Nim to be a lisp. for better or worse it is not. Nim is a "classic" statically typed language that happens to have an expansive macro system. mratsim: oh yeah, the list comprehensions :/ Rika: oh i had no issues with list comprehensions Rika: just converted them to mapIt and filterIt axion: Yeah reserved keywords are by far the most annoying thing for me so far. In Lisp, we can annotate the parser to tell it to look in a different symbol table on a per module-basis, and fully qualify the originals if we want them back rayman22201: axion, slightly off topic, but I think I found your blog https://www.michaelfiano.com/. I'm curious how your transition to racket went? Since you came to our corner of the internet, I'm guessing you had some issues there too? leorize: axion: well you can use Nim's keywords as identifier Rika: axion, i mean you can use backticks to use them leorize: it's just not really pretty axion: rayman22201: That was years ago. I wrote about my transition back to Common Lisp a post or two later, mostly because it generates efficient machine code. Rika: just, 2 extra characters aint worth it rayman22201: ah. I saw the update about moving back to CL, but I didn't see the reasoning. axion: rayman22201: and no, I don't want Nim to be a Lisp. Infact the reason I'm learning Nim is because I've grown tired of the ecosystem, and the people surrounding it. I wrote about it a few days ago here, but in short, there is no collaboration and requires a very specific set of tools that only really work with Emacs, which I also dislike. I wanted to join the world of more traditional compiled axion: languages...just going through some growing pains. leorize: I'd say try not to focus too much on the efficient part rn leorize: write code that looks good leorize: then make it run got leorize: good* leorize: I'm certain that you know the basics, so whatever you designed will not be horrendously slow axion: Oh and I'm not. I'm trying to write code that expresses my ideas but having a hard time learning how to do trivial tasks. leorize: learn some Nim idioms :) disruptek: ^ leorize: instead of `find(string, char) >= 0`, use `contains(char, string)` or `char in string` :) axion: My only resources have been the manual and the tutorials and NIA. I read all them, and going back and forth between them every day, and some things still don't click with me. leorize: you forgot that you have #nim as a huge resource :) rayman22201: I understand. :-) You are definitely giving up some "cosmic superpowers" that only a lisp (or Haskell maybe) can provide. But I do hope you stick around. We always need more smart people. Rika: leorize, `contains(string, char)` leorize: ah, yea axion: leorize: Yeah and tbh it was the biggest help by far. The documentation is pretty hard to navigate with Ctrl+F as a single page, there is only one years-old published book, and the community is still quite small, but I'm hoping all of that will change sometime. Rika: other than the ecosystem, what's worse in Lisp vs Nim? leorize: we got the man power for writing code, we just lack the man power writing documentation :p leorize: @Rika: I'd say the parenthesis but Lisp users will kill me :) Rika: axi0n's gonna i bet axion: Rika: Aside the ecosystem/community? The tooling and editor lock-in. The language itself is fine in all respects if you ask me. Rika: huh interesting shashlick: What about the tooling axion: Well, CL is built for interactive compilation from the ground up, and so requires extensive introspection support. You basically run a server in CL, and a client in the editor listens and responds to events. The only editor worth using for this is Emacs. Rika: oh also for those who actually decide on nim functionality, what's the reason for declaring that there is no "truthiness" and everything that needs a bool must need a bool? axion: LSP is not good enough for Lisp. It doesn't cover everything that the language has to offer leorize: @Rika: because it's stupid rayman22201: lol, partially, but it's also about taste. some people prefer truthiness to be more strict. axion: leorize: You don't even see the parentheses or type them for that matter in Lisp with proper tooling. That's the biggest complaint to outsiders that never work with CL leorize: I'd say that it's an artifact of C's weak typing Rika: C's weakly typed? rayman22201: yes. very much so Rika: guess i havent worked with it enough leorize: axion: "proper tooling" :P leorize: you mean emacs :p axion: I mean the dozen or so plugins for it that aren't yet mature enough on other platforms leorize: though I'll admit that I've never written any lisp other than some for emacs to install plugins rayman22201: I like Nim's boolean behavior. I think it prevents bugs. I have seen plenty of C bugs from throwing incorrect things into a boolean expression... axion: leorize: regarding your `find` suggestion. I need to find the position of a character in one of 3 different strings, or false if not present in any of them. axion: not a simple boolean expression Rika: are they in a seq or array axion: static strings Rika: you'll still need find then Rika: also leorize: axion: for i in [ConstString1, ConstString2]: result = find(i, char); if result != -1: break Rika: maybe use an Option, then return none if not found then a some if found Rika: maybe i'm thinking too weirdly lmao 😛 axion: Also, I didn't mean to sound like I was so upset with Nim above if I came off to be. It's just frustrating learning a new language after decades of using a very unorthodox language _exclusively_ every day. I love Nim so far. rayman22201: not crazy, I would use an Option for this too Rika: you sounded very annoyed yeah but that's to be expected really leorize: I'd vote for Option[Natural] :) Rika: somehow i never experienced this phase, though i came from python leorize: python is nowhere near the weirdness of lisp :P rayman22201: axion, yay, good to hear we haven't lost you 🎉 Rika: exactly why i said `though` 😛 shashlick: axion I was asking about Nim tooling but guess I read your comment wrong leorize: he was complaining about lisp axion: Yeah, Nim's tooling is excellent. Particular props to leorize for his great vim support. But, `nim`, `nimsuggest`, `nimble`, etc are also great leorize: I'm glad I freed you from the emacs abomination axion: At face value, ignoring any subtle bugs that may exist, Nim's tooling is perfect. leorize: you'll find the situtation reversed here, emacs tooling for nim is kinda bad :P axion: I noticed. I tried to Nim in Emacs when I was deciding to switch to Nim and still in "lisp mode". I'm glad I didn't base my decision of of that :) axion: Though to be honest, I've read the manual 3 times in the last 2 years and been keeping an eye on it since back then. Only recently actually started writing code though. axion: My only real complaint with Nim is something that can't be fixed because it's not a Lisp. axion: So I'll just have to get used to it axion: In Lisp, writing macros is no different than writing any other code, because Lisp code is already in AST form. Code in a macro is the same as code outside of a macro. In Nim, it's much more tedious and forces me to switch contexts. But it is what it is. A lot of languages don't even have macros to this degree anyway. So no real complaint...just more work to get the same job done. Rika: argh! i keep on forgetting i cant use linenoise on windows treeform: Hey guys, is there a way to pin the main thread - the thread you start with to a CPU? `pinToCpu` takes a thread object, but how do it get for the main thread? treeform: I am starting a work q of threads, I would like to keep main thread on 0th core, while create work threads for the rest of the cores and pin all of the threads. Is doing that smart or stupid? leorize: that's stupid imo Varriount: Anyone know of a good tutorial/walkthrough for someone who wants to try NixOS? leorize: Varriount: their manual is pretty descriptive leorize: disruptek: I have to sub to look at the vids? :P disruptek: leorize: really? leorize: yea it said vid available only to subscribers disruptek: that makes zero sense. leorize: "This video is only available to subscribers. Sub now to watch and support disruptek." disruptek: try it now? disruptek: i just tried toggling a button but it toggled back. might be a ui error. Recruit_main707: Still there for me disruptek: idiotic. leorize: same disruptek: maybe it's not under "Only allow subscribers to watch your past broadcasts" but that would blow my mind. disruptek: https://www.twitch.tv/videos/572030955 Rika: collect is only nim 1.2 or devel? disruptek: yep. Rika: shit Rika: okay KingDarBoja: How I can check if some object 'x' is of type 'x' Rika: x is y KingDarBoja: Once again, like in Python uses `isinstance` KingDarBoja: Really? Rika: i think KingDarBoja: Let me check Rika: doesnt seem so Benumbed: I thought it was ‘of’ Rika: its of disruptek: when x is SomeType: disruptek: of is for inheritance checks. Benumbed: Ahhhh yep, mb Rika: eeee Rika: ok Benumbed: I've been working with the inheritence stuff a lot of late lol Rika: `Checks if T is of the same type as S.` this bamboozled me! KingDarBoja: so let x = type rika KingDarBoja: y = some_instance_x KingDarBoja: Check should be: `x is type(y)` ? Rika: i'm a type now it seems Rika: x is typeof y Benumbed: I was wondering if you were going to say something about that lol Rika: also afaik is works between 2 instances KingDarBoja: y should be of type `Rika` Rika: oh wow i really am a type now KingDarBoja: I got lazy hahaha Benumbed: imgur.com/a/SzQpWkN Benumbed: bad paste, bad paste! Benumbed: https://play.nim-lang.org/#ix=2eUT KingDarBoja: ``` KingDarBoja: type rika* = object KingDarBoja: coolness*: int KingDarBoja: sarcasm*: int KingDarBoja: KingDarBoja: let y = initRika(5, 10) KingDarBoja: y is typeof x KingDarBoja: ``` KingDarBoja: ```nim KingDarBoja: type rika* = object KingDarBoja: coolness*: int KingDarBoja: sarcasm*: int KingDarBoja: KingDarBoja: let y = initRika(5, 10) KingDarBoja: y is typeof x KingDarBoja: ``` Rika: RIP irc people Rika: a multiline paste Rika: which was also edited Rika: RIP indeed. Rika: initRika is not defined 😛 Rika: thats correct yes Rika: x is not defined :PPP KingDarBoja: arrr KingDarBoja: It was actually `y is typeof rika` Rika: ah KingDarBoja: Nope, doesnt work Rika: if x is not defined KingDarBoja: `Error: 'typedesc' metatype is not valid here; typed '=' instead of ':'` Rika: its just y is rika KingDarBoja: Ah Benumbed: @KingDarBoja Like so https://play.nim-lang.org/#ix=2eUT Benumbed: (I just used a Stream as an example type) Rika: you sure love your streams Benumbed: Well I'm using them a lot right now 😄 disruptek: https://play.nim-lang.org/#ix=2eUW KingDarBoja: And what if I want to check the type by extracting it from another instance? Benumbed: Writing a network client, so I grab a bunch of data from the socket, shhove it in a stream and that gives me some nice utility functions Rika: typeof theinstance Rika: sh hove KingDarBoja: Nope disruptek: `is` is often code smell, though. Benumbed: disruptek: Sheer curiosity, why add the when? disruptek: because it's a compile-time operation. KingDarBoja: Let x and y be of the same type, `Rika` KingDarBoja: How it should be? `x is typeof y` ? or `x is typeof(y)` Benumbed: vs something like `if a is Stream` which would be runtime evaluation? disruptek: it wouldn't be. that's the point. Rika: @KingDarBoja same thing Rika: remember, UFCS KingDarBoja: UFCS? Rika: https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax Benumbed: Okay I don't understand, but I'm not all here atm anyway disruptek: `is` is a compile-time test. Rika: f(a) == a.f() == a.f == f a Benumbed: okay but how does that releate to you adding `when`? Rika: when is a compile-time if disruptek: when is a compile-time version of `if`. Rika: you cannot if when you use is Benumbed: ahhah, thank you both 🙂 KingDarBoja: And now I got confused... Rika: where are you confused Rika: what are you confused by awr1: what is nimph? disruptek: !repo nimph disbot: https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 54⭐ 3🍴 7& 1 more... KingDarBoja: Check if two instances have the same type lol KingDarBoja: So `typeof(x) == typeof(y)` right? Rika: disruptek is pinged by the mere mention of nimp Rika: nimph Rika: i think that works, sure KingDarBoja: `Error: 'typedesc' metatype is not valid here; typed '=' instead of ':'` wtf? Rika: it doesnt work Rika: lmao Rika: use x is typeof y Rika: theres no == for typedesc Rika: it seems KingDarBoja: Nope doesn't work, same error disruptek: what is it you are trying to do? Rika: can you put your code in playground KingDarBoja: Hold on Rika: i feel like the error is from some other line disruptek: i feel like i need some ointment. Rika: get some then awr1: ah so nimph is an extended nimble? kind of? disruptek: it will be a nimble replacement eventually. i'm working on the compiler at the moment. disruptek: there's stuff you can do with nimph+nim that you cannot do with nimble+nim, basically. awr1: i see disruptek: local deps, lockfiles, nimblePaths, etc. KingDarBoja: https://play.nim-lang.org/#ix=2eV2 Rika: is it stable right now Rika: because that sounds like something id use disruptek: pretty stable, though the compiler may have broken it a little in 1.2. Rika: isnt check runtime Rika: is unittest.check runtime? Rika: ofc it is disruptek: yes. Rika: hmm i wonder what it's doing that's not allowing the code to compule Rika: compile disruptek: which code? KingDarBoja: https://play.nim-lang.org/#ix=2eV3 disruptek: https://play.nim-lang.org/#ix=2eV6 leorize: disruptek: for inheritance there's `as` which is a runtime check Rika: but the code should work too with typeof no? leorize: but what do you mean by Instance? KingDarBoja: So I have to export Location too? I expected it to work with typeof disruptek: yeah, they're trying to use `is`. KingDarBoja: Instance is source variable leorize: like "string" != "string" because they point to different addresses or something? KingDarBoja: Whatever object is created from the initX disruptek: Source.locationOffset, then. KingDarBoja: Yup disruptek: so use that. Note the capitalization. KingDarBoja: Wait what!? KingDarBoja: `Source` is the type, source is the instance in this case KingDarBoja: Maybe if I rename it, it would be clear disruptek: look dude, wtf are you trying to accomplish? Rika: whats wrong with disruptek's solution disruptek: it's pointless, but maybe that's the problem. Rika: and why are you checking the type on runtime KingDarBoja: I didn't wanted to export the Location type, that's what I mean Rika: theres no reason to Rika: the compiler will complain if theyre the wrong type anyway disruptek: what does the export have to do with anything? Rika: why do you need to make the check KingDarBoja: just curious about if there is some way to check if two instances have the same type, but maybe as you guys said, it is pointless KingDarBoja: two objects* Rika: there is a way, on compile time Rika: this isnt python KingDarBoja: I know, that's why I got confused while trying to ask Rika: you dont usually need to make checks like this Rika: - Rika: maybe in python you do but here you dont Benumbed: Where we're going Marty, we don't need type checks Benumbed: (I'm sorry I couldn't resist) Rika: lol KingDarBoja: I understood that reference lol Benumbed: I wish Discord would stop chewing CPU time on my laptop Rika: ikr Benumbed: it's making things all hot and noisy 😦 Rika: there's Ripcord Rika: then also the 3rd party cli i think Rika: dunno the name Rika: you can also always move to irc Benumbed: I put my time in, in the IRC trenches, I honestly like the Discord/Slack-style experience more Benumbed: I say lets bring back ICQ.... /s Rika: what are you 30 years old KingDarBoja: lol Benumbed: Worse Rika, worse Benumbed: Leading edge of Millienal time-frame :/ Rika: uh Rika: dunno that Benumbed: Millenials are the group that were graduating high-school and moving into the workforce around 2000 Rika: i know millenials i just dont know the time frame Rika: hmm Rika: i'm in gen z i think? Benumbed: If you're saying things like 'what are you 30 years old' yeah you're a Zed 😄 Rika: fuck ya KingDarBoja: Ok used the disruptek solution KingDarBoja: Once again, not used to think like that, I mean, I forget this language has compiler checks and runtime checks KingDarBoja: I forgot* disruptek: if you don't need it, the code will compile and run faster if there is less of it. remove it. Benumbed: @KingDarBoja Is Nim your first statically-typed language? KingDarBoja: Does TypeScript counts? Benumbed: Having never used it, I have no idea haha KingDarBoja: lol Rika: typescript semi counts Rika: not really KingDarBoja: The problem is that you can confuse the compiler by specifying the type as `any` and that's it, you have no idea if the property has the correct type Rika: no i dont think so Rika: you cannot give a variable an "Any" here afai Rika: afaik KingDarBoja: Yeah, that's why I got confused at first trying to check the type between instances but screw that Rika: no need to 😛 Benumbed: oy, `any` gives me flashbacks to boost::any 😦 KingDarBoja: Don't get mad at me 🙈 Rika: @Benumbed nim allows for `auto`, have fun with that Benumbed: I'm not mad... KingDarBoja: Just saying lol Benumbed: I'm ok with `auto`, just `any` gives me hives 😄 Rika: auto isnt AS bad as any, but i still think its horrible Rika: i came from python to stop guessing types, please no auto ;; KingDarBoja: By the way, I just created two tests files inside the tests folder and had to specify them at nimble task KingDarBoja: Looool Rika: tests must start with `t` disruptek: auto gives you a way to use a type that isn't exported. Rika: if not they wont run when `nimble test` Rika: disruptek that sounds uh, dangerous KingDarBoja: I named both `test_a` and `test_b` Benumbed: disruptek: will nimph support `test` like nimble does? And if so, will it recurse into directories under your test dir? KingDarBoja: (Got lucky It seems) Benumbed: Sounds like `auto` works the same way it does in C++ disruptek: if you want to run nimble's default test methodology, just run `nimble test`. nimph doesn't care. KingDarBoja: Hey hey that's my current question, it is possible (with nimble) to just discover all tests without having to specify each file? disruptek: else, use testament or testutils if you want to recurse. Benumbed: testament looked like something I didn't want to spend tons of time on Rika: ive never needed to specify a test file KingDarBoja: Currently doing: KingDarBoja: ```nim KingDarBoja: task test, "Runs the test suite": KingDarBoja: exec "nim c -r tests/dirA/test_x" KingDarBoja: exec "nim c -r tests/dirA/test_y" KingDarBoja: ``` Benumbed: like it was more for the Nim core devs Rika: run `nimble test` Benumbed: Yep King just demonstrated what I'm talking about Rika: ah its in a dir Benumbed: nimble does not support subdirs under your tests dir Rika: testament docs where KingDarBoja: and there are going to be several of them... KingDarBoja: WHAT? Rika: im asking disruptek: docs/contributing.rst disruptek: er, doc/ i think. Benumbed: Hmm testutils is from Status Benumbed: That's the third time they've come up KingDarBoja: Well well well I will stick into specifying all my tests inside subdirs Rika: i mean Status is the biggest company sponsoring Nim Benumbed: @KingDarBoja just use testutils, it looks like they recurse KingDarBoja: Searching, hold on... Benumbed: among other things, I shall be pulling this down Benumbed: https://github.com/status-im/nim-testutils disruptek: it does. i'm the dude that moved it from chronicles into its own project. Benumbed: disruptek: Do you work for Status? disruptek: i did a bounty for them. Benumbed: Ahh cool Rika: chronicles is great KingDarBoja: Okay just installed it, what now? Does nimble has a specific section on yourproject.nimble file for dev only dependencies? Or it should be added as `requires` disruptek: requires KingDarBoja: Ok Rika: does nimph have dev only deps? disruptek: it supports that via support for sub-packages, but no one can agree on how to do developmental deps. shashlick: is it possible to get the AST of some code after it is evaluated disruptek: you mean codegen'd? shashlick: yes - like I run a parseStmt("const A = 1") and get the AST of the const shashlick: basically looking at https://github.com/nimterop/nimterop/issues/127 disbot: ➥ [Feature] Option to dump debug in a file shashlick: and am thinking of a macro that lets all nimterop ops run and at the end, get the resulting code and dump that to a file disruptek: you could do that pretty easily, i think. disruptek: just expandMacros: somemacro: some normal code shashlick: there's getAst() but doesn't do what i want KingDarBoja: Btw @Benumbed the installed version of testutils is 0.1.1 but the latest on GitHub is 0.2.0 KingDarBoja: Also ran `testrunner tests` and got `no tests files found` 😢 disruptek: shashlick: what's the output you want? disruptek: king: it uses a .test format that's different. rtfm. KingDarBoja: Arrrgh shashlick: https://play.nim-lang.org/#ix=2eVi shashlick: running that and looking at the debug output, you just see the parseStmt() as is shashlick: instead, i want to get the const A = 1 disruptek: oh, as ast? shashlick: basically, I want to create a `cOutput(file: static[string], body: untyped): untyped =` macro that is called at the top of a nimterop file which will write the rendered wrapper to that file disruptek: what form does the rendered wrapper have? disruptek: this is still running outside of the vm, right? disruptek: it sounds like what i do with openapi, but i dunno -- you tend to make this much harder because it's outside the vm... shashlick: Still in the vm shashlick: Toast already can write to file shashlick: It's the cimport part that I want to render and write to file shashlick: Along with any other getHeader code disruptek: why is it in the form of a string? shashlick: Which part shashlick: cImport calls toast which returns the code as a string which is then loaded using parseStmt shashlick: I could always just save that but you also need the other stuff around the cimport KingDarBoja: Last question of the day: How do I check if a error is raised on unittest? disruptek: expect KingDarBoja: 👍 Winton: I want to develop a chat rmt: Hm.. I'm hoping this is simple, but I suspect I have some fundamental misunderstanding.. https://gist.github.com/rmt/ccaffc4e44fa52485c103756974fe16e .. that snippet results in a runtime error: invalid object assignment [ObjectAssignmentError] rmt: I suspect that I need to return a ref MidiMsg to instead return a subclass of MidiMsg, as memory was probably pre-allocated for the return time... that it compiles in the first place makes me wonder, though. Rika: `ref object of` usually works better than `object of` is all i know rmt: Indeed, s/object of/ref object of/g makes a difference. Is this a compiler bug (in 1.0.2) that it even compiles? leorize: rmt: it's a future leorize: feature* rmt: :) leorize: disruptek: I can't seem to find the part of the vid where there's a pragma alignment problem... leorize: disruptek: wait are you complaining about pragma aligning with the '('? leorize: that's always been a feature leorize: guess it finally works this time around :P leorize: disruptek: I just followed NEP-1 leorize: so what's your suggestion for this? Zevv: gm! flywind: When I use `jester` to serve static files bigger than 10MB, I got some errors: ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH flywind: https://github.com/xflywind/test_jester/tree/master dadada: has anyone used BOLT with Nim? dadada: https://github.com/facebookincubator/BOLT dadada: "Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries" Rika: how does that work dadada: it's all written about on that link Rika: what if i didnt wanna click the link HUH Rika: i kid dadada: to be useful the tool depends on the layout of the code in the binary, it does need to follow certain patterns, I've no idea how Nim relates to that dadada: https://www.phoronix.com/scan.php?page=news_item&px=Facebook-More-LLVM-Devs dadada: facebook is hiring compiler engineers, sadly they don't seem to have catched the Nim bug (yet) Benumbed: @Rika look what just appeared in my code.... `var value: auto` Benumbed: >:> Rika: how dare you Rika: thats so vague Benumbed: hahaha Rika: ive never ever ever EVER used auto Benumbed: In this case, it's actually really useful because that particular variable is polymorphic and there's no clean way around it Rika: hmm Rika: i guess that works Benumbed: actually NM, I can get rid of it with a variant type Benumbed: Just for you Rika: bless sealmove: does anyone have a tip for how to implement python's @property in Nim? sealmove: I've tried proc field + closure but it seems messy sealmove: also needs overloading of `.` operator which is experimental Rika: eh? is it not just a regular proc Rika: proc fieldName(self: Class):returnType = discard Rika: proc `fieldName=`(self: var Class, val: storeType) = discard Rika: sealmove ^ sealmove: the problem is the syntax `myObj.fieldName` doesn't work when `fieldName` is a proc sealmove: you can do `myObj.fieldName()`, yes, but I want to homogeneous syntax between value fields and proc fields sealmove: I could turn all fields into procs and always use `myObj.fieldName()` syntax, but that's meh... Rika: it works... Rika: ive never had it not work Rika: oh it wont work if field name is the same as proc name Rika: otherwise it will work sealmove: oh, wait. are you saying I should make a seperate proc? I was doing something like: sealmove: type myType = object sealmove: fieldName: proc(): int Rika: what Rika: no Rika: separate proc Rika: it will work then sealmove: ah I see, that should work yes, thanks! Rika: just make sure names are different Rika: because its not gonna be possible to distinguish if they werent sealmove: other question, in C when I want to make an identifier special, I begin its name with an "_". what's a similar practice for Nim? Rika: i use `pSmth` for private dadada: did you know there's a monkey lang implementation in Nim? https://github.com/Kashiwara0205/monkey-nim Rika: a what dadada: I don't know for what this would be useful though :-) dadada: it's basically a go interpreter with only a limited featureset dadada: there was a book on how to write a small interpreted language using go, and now everyone is copying that design Kenran: Varriount: yeah, I recommend just installing it somewhere (maybe a VM first). It was actually the most pleasant experience from all the distros I tried with getting a slim (that is, no desktop manager) UI with sound and everything to work. It's also extremely easy to play around with, as you can just roll back on any error. lqdev[m]: dadada: that's cool, but not really usable for anything since it uses a tree-walk interpreter lqdev[m]: and thus it's veeery slow dadada: lqdev[m]: maybe you could use it at compile time Kenran: I'm quite annoyed at it now, as it was basically an experiment for me but now diving into Nim and trying to do more low-level stuff, I fail at some steps. For instance what Yardanico mentioned. I need to do some "research" to even get what it all means 😄 lqdev[m]: dadada: yeah, but that defeats the purpose of a dynamic language altogether :p Kenran: let alone getting something to run afterwards. Kenran: maybe being inside a nix-shell for everything works, but there I still have some SSL problems when running nimble... quite a lot to tackle to just run a binary dadada: for what it's worth I've been happy with Fedora for years ... Kenran: dadada: I used Fedora for quite a while before NixOS 🙂 maybe I'll be going back to it, I really liked it. Lately I had to nixify a lot of projects at work and also use it as a server OS once, so I thought I might give it a try at home. dadada: Kenran: why did they choose nix at work? kenran: dadada: for one, we use Haskell in some projects where the nix integration is good (you get the benefits of `stack` without having to use it), plus reproducible builds even though some use macOS, others linux flavors kenran: dadada: it makes gitlab CI nicer to use as well (just use the nixos/nix base container and do `nix-build ..`) kenran: (our Haskell projects often have lots of non-Haskell dependencies which are managed by nix, I should mention) dadada: I've been interested in Haskell for a while, why did your company decide to use it? dadada: what are the things you can do in Haskell, but couldn't for example get done in Nim or something like it dadada: I'm looking for an answer specific to your company, I know I can google search this and get the generalized answers dadada: and I think I already did some time ago, but I've never found a project where I needed those specific strengths (yet) Araq: sealmove: instead of "special" identifiers use longer ones kenran: dadada: we are a little bit special in that we do FP (nearly) exclusively. Plus I'm an absolute beginner in Nim. I'm reasonably sure you can do everything we do in Nim as well, but there are some things we love Haskell for. Mainly it's great for parsing stuff like a breeze and also creating very expressive DSL's. dadada: kenran: what's the best learning resource/book for Haskell? kenran: dadada: probably Haskell Programming from First Principles kenran: dadada: it's not really necessary to get a book though. I have a love/hate relationship with Haskell btw. In most new projects we also choose Clojure. Haskell's great strength is its type system with which you can model your domain insanely well. But IMHO that's the hardest skill to learn and mostly stems from experience with both the topic and the language. dadada: kenran: I think FP is most likely a big part of programming's future, I definitely have already tried to use FP patterns as much as I can, was deeply impressed with a presentation on Haskell that I saw on YouTube a few years ago kenran: dadada: There are definitely great talks and great minds in the Haskell community. I have my problems with it, because I hate the ecosystem. It's still a research language, even though it's used in production, and a lot of the library authors jump on every new language feature and break their API all the time in the process. kenran: So trying to use a lib that hasn't been updated since the end of 2018, I have no real hopes of it being compatible with the other libraries in a project by default. kenran: And I'm with you on the FP part. I've been doing this for 1.5 years only now, but arrived at the same conclusions in my projects before that (Windows stuff with C#) by seeing where we always failed. kenran: That's why I really want to get into Nim! It enables me to use most of those concepts, still be very readable and expressive, and do stuff on a lower level as well. Similar to Rust in its appeal, but Nim just "clicks" more with me :) dadada: I definitely think there's room for Nim to adapt better to FP, I'm not sure if Nim has tail call optimizations, just to name one example kenran: I remember googling that before I downloaded nim. Shouldn't clang/gcc do it with the resulting C code? dadada: I read this book on using functional programming patterns in Go, the author made a huge point of criticizing Go for not supporting TCO, but it's definitely something that can get supported when there's enough demand dadada: kenran: I thought the same thing, but I never found a proper answer dadada: I'll probably have to do benchmarks on this sometime kenran: yeah, we should be able to figure it out :) Rika: nim has typeclasses btw 😛 kenran: maybe I'm calling my NixOS experiment quits today... I can't really figure this stuff out on my own as I'm not even remotely a systems programmer or familiar with the tooling needed to debug this :D Maybe it's time to go back to Arch or Fedora. dadada: can't you experiment with NixOS in a VM inside Arch/Fedora? kenran: yeah I could, but I had to re-partition anyway and so I went all the way this time. dadada: someone recently wrote a text editor in nim (presumably for the console) https://github.com/pseudo-random/editor kenran: perhaps that's the way to go next time :) gotta run dadada: it looks like a nice start by a very quick glance at the code, it definitely deserves some attention, hence I mention it here dadada: when I get an error like this: dadada: fatal.nim(39) sysFatal dadada: Error: unhandled exception: vmgen.nim(941, 10) `t != nil` [AssertionError] dadada: is this indicative of there possibly being something wrong with Nim? or should I still assume that my code is shit? Rika: what did you do? lqdev[m]: this should be a proper error, report it as a bug Rika: huh, nimprof does not like my code Rika: it crashes due to deeply nested calls Rika: albeit my code not crashing at all normally dadada: can't reproduce the bug on play.nim-lang.org yet axion: I need help with type parameters again :/ krux02: axion, what do you need to do with type parameters? axion: So I have 2-4 component vectors parameterized as Vec[N], and 2x2, 3x3, 4x4 square matrices as Mat[N] (Mat[3] is array[9; float32]. Some operations are only valid on Mat3 or Mat4, but with a vector size 1 less than the matrix parameter, so [N: static[int], M: Mat[N], V: Vec[N-1]]. The problem here is that Mat[2], Vec[1] is invalid in this context krux02: I need more context krux02: is this a proc or a type? axion: A bunch of procs krux02: ok krux02: I need something that I can execute axion: Sorry this is all on paper, no code yet. axion: I would have to read my math texts to figure out the implementation first krux02: ok krux02: well I can help you to punch things through the nim type system. axion: But this isn't a code problem. It's a signature specification problem krux02: But I don't really understand your type constraints that you want to enforce axion: Ok let me try to be more clear krux02: ok krux02: why do you need the vector to be size 1 less than the matrix parameter? axion: I have a pile of procs that will be the same code for either a Mat3 (9 element array), or Mat4 (16-element array). These must also take in a Vec2 if it's a Mat3, or a Vec3 if it's a Mat4, (so if Mat[N], then Vec[N-1]). THe problem I have is how to constrain the Mat to not accept Mat2 and thus Vec1 which these functions shouldnt exist for krux02: I remember I once had a similar problem. The solution to that was, to not use the constraint of N-1 anymore. krux02: not sure if it really was that problem axion: Because for example, the translation of a 3x3 transformation matrix is 2 components, and likewise 3 components for a 4x4 transformation matrix. krux02: well, you can start of just writing down all implementations (lots of redundancy) and then look afterwards on how to compress that. axion: Yeah, I see a lot of redundancy either way, because for example a 3x3 matrix can be both a 2D transformation matrix, or a 3D rotation matrix. krux02: well I stopped caring about that distinction. krux02: 3x3 matrix is just a 3x3 matrix krux02: that is the mathematical part. krux02: After all the `3x3` rotation matrix ended up to be much less useful that I thought. axion: I can assure you it is incredibly useful for a lot of code. It is a pretty big mathematical error to not have this distinction krux02: rotations are stored either in a quaternion, or in 4x4 matrix is part of a trotration/translation object transformation. krux02: axion: Well I am not in your code, and maybe you are right, but the solution for me was to not use 3x3 rotation matrices and it worked quite well for my code. axion: Fair enough krux02: what would be much more useful to me would be a coordinate system tag for my coordinates. krux02: So that I don't accidentally mix up wordspace cameraspace and objectspace coordinates. lqdev[m]: how do I explain to my C++ friend that `'a'.succ` makes more sense than `'a' + 1` lqdev[m]: I keep telling him that a char is a char, not a number lqdev[m]: so it doesn't make sense to add 1 to it lqdev[m]: but he keeps saying that a char is a number krux02: lqdev[m], well maybe you have to stop using his c++ terms. krux02: but yea it is hard to fix that. krux02: it is also hard to tell c programmers that an array is not a pointer because for many of them it is the same thing. krux02: It quacks like a duck it looks like a duck, so it is a duck. lqdev[m]: that's low level programming for ya. Zevv: but they *are* the same thing! Rika: tell them that if you remove the computer aspect from it it makes no sense to add a character with a number Recruit_main707: in c/c++ everything is an int or a pointer XD Zevv: almost true Zevv: but not quite axion: Hmm, and here I thought everything was a pointer or UB Zevv: haha krux02: lqdev[m], the only fix for that that I know works is to let him run into a problem because of this non-distinction of char/integer. Make it really painful. Then come with a solution. And he will understand. But he might stop being your friend. Zevv: and still it runs the world Rika: the more stars you add the better Rika: char \*\****niceVar krux02: Rika: you cannot tell people to remove hard wired stuff from their brain, and then think about another solution. You first have to break the hard wiring. That is the "let them run into a painful problem" I was talking about. lqdev[m]: krux02: lol that's so true Rika: tell them "but what if it wasnt programming" lqdev[m]: idk why he keeps on using C++ after encountering weird problems like having to initialize an std::string explicitly (`std::string a = "";` instead of `std::string a;`) krux02: Rika, that will disable his arguments, but it won't convince him. krux02: axion, what do you mean with UB? Rika: undefined behavior exelotl: Ultra Beast disruptek: leorize: your approach is probably the correct one; i dunno. the style i arrived at is to just indent two spaces for the pragma. clyybber: Well a char is a number clyybber: fite me clyybber: And arrays are pointers clyybber: But their specification doesnt say they must be clyybber: At least in nim Recruit_main707: type Matrix3* = object Recruit_main707: data*: array[3, Vector3] Recruit_main707: forward*, left*, up*: Vector3 Recruit_main707: Recruit_main707: inside a constructor... Recruit_main707: [result.forward, result.left, result.up] = result.data Recruit_main707: what am i doing wrong? this says it cannot be assigned to disruptek: you're pasting, for one thing. disruptek: the argument that you "forgot" just doesn't hold weight after the 5th "reminder." Recruit_main707: i didnt forget, im not that stupid, i just consider it small enough. disruptek: it doesn't bother me, but it bothers others and sets a poor example. Recruit_main707: ok, fine... here you have, much cleaner: https://play.nim-lang.org/#ix=2eXA Recruit_main707: ill just consider more than 1 line too much from now on Rika: and it is Recruit_main707: its all relative :p Rika: use parentheses not brackets Recruit_main707: oki, thanks lqdev[m]: i don't think you can deconstruct an array like that lqdev[m]: it only works for tuples Recruit_main707: it doesnt throw any errors in the editor Recruit_main707: ill see Rika: use `unwrap` module if you really want array deconstructing disruptek: obviously, it's for string summation. disruptek: what else? disruptek: the wallpaper is amazing today. what should i use it on? jken: I have a type defined, Vertex, which has position vec3[float], a normal vec3[float], and texCoord vec2[float] jken: How in nim do I get the total size of Vertex? jken: sizeof(Vertex) returns 8 lqdev[m]: huh. lqdev[m]: interesting lqdev[m]: can you show the definitions? jken: I am using vector types from glm disruptek: sizeof only measures the size of one type. jken: What does that mean? disruptek: if that type is a pointer, you'll get the size of a pointer. jken: Are types pointers? krux02: no jken: ie. sizeof(Vertex) vs sizeof(newVertex()) krux02: types are types krux02: types are for compile time evaluation only. krux02: compile time does not have pointers. jken: hmm okay disruptek: compile time is rude that way. krux02: sizeof returns the size in bytes of a type. Basically how much memory it costs to put them in a seq or on a stack. jken: sizeof(Vertex()) still give me 8 krux02: then your Vertex is either a ref type, or it is 8 bytes in size jken: ah, it is a ref type jken: ref types are pointers than disruptek: ie. a pointer. jken: that's what I was missing. krux02: yes ref types are pointers disruptek: they are sometimes called "managed pointers" in other languages. Kenran: why is it that if I compile a project that uses `sdl2` or `nim_sdl`, the binary doesn't have `libSDL2` in its `ldd` output? Is there a way to "get it in there"? jken: My type probably does not need to be a ref type, but out of curiousity, is there a way to get the size of a ref type? krux02: ref are basically a different kind of pointer, but technically identical to pointers. krux02: yes krux02: unref it with [] krux02: sizeof(Vertex()[]) disruptek: kenran: static link? jken: krux02: gotcha, thanks krux02: np disruptek: kenran: nim doesn't use the "normal" shared-lib style of linking by default; instead it has its own dynlib machinery that you get to fuck with. krux02: btw, you are probably used to ref types from other languages like python C# or Java. But in Nim you shuold used them sparsely. jken: krux02: is it possible to determine the size of a ref object type without an instance of it? jken: ie, no instance to unref krux02: Simply because the non ref variant of a type is often all you ware about. krux02: yes krux02: sizeof(typeof(default(Vertex())[])) krux02: but if you care about the size of a type, you probably shouldn't use a ref type. krux02: sorry krux02: sizeof(typeof(default(Vertex)[])) disruptek: that's still an instance. disruptek: 👍 krux02: no it is not an instance, because it is in a `typeof` argument. jken: right, so that creates an "instance" with default values and gets the size Kenran: disruptek: Atm it will compile and complain about libSDL2 missing when I start it. I found a post explaining how to static link against SDL2 but it's not really working yet. I'll have to see if I can get it to do that 🙂 krux02: ``default(Vertex)[]`` would create a nil pointer and unref it. That is basically a segfault. But the code is never executed, what matters in the type of the expression. disruptek: kenran: it's fun to try to guess where you need to copy the shared-lib to. usually, adjacent to the binary. krux02: Keran: so many people force to static link SDL2. And SDL2 really doesn't want to be statically linked. jken: kenran, I recently had this problem jken: {.passL: "-Xlinker -rpath .".} krux02: I think eventually SDL2 developers gave up on it and allowed static linking of SDL2. jken: That in config.nims in your project will make it look for the .so in that dir disruptek: the only experience i have with sdl/opengl is debugging this exact linking issue. jken: disruptek helped me solve that same issue but with imgui rather than sdl2 disruptek: oh yeah, that's what it was. krux02: disruptek, when you are working with opengl you can forget about static linking anyway, so why is it so important to have SDL2 statically linked? I really don't understand it. disruptek: i dunno. i didn't read too much into kenran's query, perhaps. disruptek: i think it's the normal shared-link issue, though. krux02: no he isn't the only one here on IRC who asked for help on static linking SDL2. Kenran: it's not important to me at all. I would have liked it to "just work" without static linking disruptek: i mean, i think the issue comes from the unexpected shared-linking behavior. disruptek: it's more like the way windows does it than the way unices do it. Kenran: It's probably a mix between that and me being on NixOS krux02: yea probably. Kenran: on my mac I get it to run just fine disruptek: the mac uses a similar approach. krux02: Keran: I read about the Nix package manager. I wonder if it can be used as a substitution for nimple. krux02: nimble I mean. disruptek: it's kinda heavyweight, unfortunately. krux02: It claims to be just a package manager, and NixOS is the os around that package manager. krux02: hmm krux02: ok disruptek: i was attracted to it, too. Kenran: is there a good chance this problem is going to just disappear once I switch to another linux distro again (because I'm about to do just that anyway sooner or later)? disruptek: nope. disruptek: jken nailed it. disruptek: but, i'd put your passL in a .cfg as `--passL:"some shit"` instead. krux02: I thought NixOS is one of the most light wight distros out there (never verifiend it though), and then I just expected `Nix` to be lightweiht as well. Yardanico: well it's not really :P Yardanico: it also doesn't follow FHS krux02: FHS? disruptek: i prefer guix because it's based upon a more mature language. Kenran: jken, disruptek: I'll need some time to try that out, thanks. So far I've only written < 100 lines of Nim code and I don't feel ready to deal with that 😄 Kenran: it's not lightweight at least in the sense that it uses tons of disk space when used with multiple languages, ecosystems, ... Kenran: and I don't like the nix language either. guix would be something to try soon 🙂 Kenran: phew, I can't get it to run, but I'm probably still not grasping your advice properly jken and disruptek. I'm doing this: https://pastebin.com/XLEyZ48a Yardanico: well you need dev files for SDL too Yardanico: and link with sdl Kenran: oh, it's just missing headers? Kenran: (the first part I mean) Yardanico: well, not headers Yardanico: static files .a Yardanico: why do you want to link statically with SDL though? Yardanico: I thought that most of the time people do dynamic linking and store these .so files in the game folder or use the system ones Kenran: oh, I don't want to if I don't have to. it's just that it doesn't run by default (because I probably don't know that I have to pass some options to `nimble build` or `nim c` by default) Kenran: Yardanico: any advice on how I can do it dynamically is greatly appreciated as well 🙂 I can ofc upload the source, even though there's not much of it there krux02: Yardanico, SDL2 in particular on Linux is usually not shipped. krux02: on windows however it is shipped. krux02: SDL2 is basically available on Linux. Many programs require it. Yardanico: krux02: well, games ship it anyway, but it can be overriden with LD_PRELOAD_PATH Yardanico: I mean proprietary games on linux krux02: well on steam games do actually ship SDL2. Yardanico: yeah krux02: also GOG games do ship SDL2 as far as I know. krux02: yea just checke it. Yes proprietary games do ship SDL2 Kenran: I checked two other linux systems (fedora and ubuntu) and could just `nimble build` and `./my-app` without problems when the appropriate `-dev` lib was installed. So it seems to be at least kind-of specific to NixOS. Kenran: Well, time to change - which I wanted to do anyway - and see if it just works there perhaps 😄 Kenran: But I want to take this opportunity to learn something more about this kind of thing first. zetashift: Can't you ask in a Nix related chat? zetashift: Maybe they have an IRC/forum you could ask some pointers about this Yardanico: they do have a lot of chats, yeah Yardanico: https://nixos.wiki/wiki/Get_In_Touch Kenran: oh, sorry if that came out wrong: that's what I plan to do before doing the switch. the freenode nix channel is full of helpful people zetashift: Oh nice leorize: disruptek: so... I guess no one realised that the feature exists because it've never worked for complex cases leorize: and I don't get bug reports because no one thought that's a bug :P leorize: disruptek: well if you wanna tweak that logic, it's not hard leorize: look for "lone opening curly" in indent/nim.vim leorize: then change result from `pcol - 1` to `indent(plnum) + shiftwidth()` deech: What's a good way of using `nimble` to package NImScript files? deech: You can get it to copy them to `nimbleDir` but how do I import them in a dependency? shashlick: Why does it have to be nims if you want to import deech: I'd like to import them into the `.nimble` file. deech: Essentially a build-time dependency. shashlick: When you talk of imports, they need to be Nim files don't they shashlick: But is it a config file shashlick: If you mean config.nims then Nim does not load config files from packages deech: No, I've found that if you do import "someFile.nims" in a "nims" file it will do it. shashlick: Ok but unless you call Nim directly on someFile as well, you can just name it as a regular Nim file shashlick: And importing into nimble file should just be relative imports as well deech: That's true but a lot of OS functions do not work with NimScript. deech: Oh I get it. You're saying don't use the `.nims` suffix? Yardanico: well yeah because OS functions require FFI and that's a very complicated story with NimScript (Nim VM) :P shashlick: Again, when you import a Nim file into nims, it is still running in the vm so the contents should be vm friendly deech: I think I understand. deech: I just tested it with `import httpclient; echo "hello world"` in a NimScript file and `nim e someFile.nims` fails on `nativesockets.nim`. KingDarBoja: it is possible to create a nim variable of type int with no value? Yardanico: var myNum: int Yardanico: but it'll have a default value of 0 anyway Yardanico: because that's how computers work :) KingDarBoja: Arrr Yardanico: if you want it to really have NO default value, use "ref" :P KingDarBoja: How to achieve `nil` value then? KingDarBoja: https://play.nim-lang.org/#ix=2eYV Yardanico: why not just have it at 0 ? KingDarBoja: I don't want to initialize it to zero because the check Yardanico: or -1, idk KingDarBoja: Oh, could be -1 🤔 Yardanico: or create an another bool variable leorize: KingDarBoja: I can see that 0 works just well for you here :p KingDarBoja: This is the issue while trying to translate python code to nim code at it uses `None` for variable declaration lol leorize: if you move the check a bit, ofc KingDarBoja: Yeah, was thinking the same Yardanico: well in nim you can replicate it with "ref int" but pls dont KingDarBoja: I will see how to change th check with the zero disruptek: use the options module. KingDarBoja: https://play.nim-lang.org/#ix=2eZ6 ugh, got closer to what I expected Yardanico: do you know that these functions exist in stdlib? Yardanico: unindent for dedentBlockStringValue Yardanico: ah nvm Kenran: Btw @deech: Due to your Nim-related tweets I tried Nim and am now hooked. Thanks I guess 🙂 Tristan: Hey y'all, excuse my ignorance but I'm playing around with c2nim for the first time, attempting to wrap lv2, and already running into problems lol. Any suggestions on how I ought to modify this header? Would this be a good use case for the '#pp' directive https://gist.github.com/TristanCrawford/5768abce2207122afd22d82fd82a2db0 leorize: looks like c2nim can't process C string constants Araq: yes Araq: (question about #pp directive: yes) axion: Will it ever be the case that a const will be able to have the same name as a proc? disruptek: wut Araq: axion, no. Araq: what's the use case? is the world yet again running out of meaningful identifiers? axion: I have to get all of Lisps great features out of my workflow disruptek: third time this month. disruptek: Araq: i assume i did something wrong; any idea what? error: invalid application of ‘sizeof’ to incomplete type ‘obs_service’ disruptek: trying to import a type... disruptek: trying to importc a type... Araq: use .incompleteStruct pragma disruptek: ... o.O okie, ty disruptek: perfect. Recruit_main707: What does —dynlibOverrideAll to the code? Recruit_main707: Leorize suggested me it could fix my issue with winim Recruit_main707: But it throws me an error Tristan: According to: https://nim-doc.readthedocs.io/en/latest/nimc.html "makes the dynlib pragma have no effect" Yardanico: why not use https://nim-lang.org/docs/nimc.html or https://nim-lang.github.io/Nim/nimc.html ? :P Tristan: Honestly just grabbed the first link I found on DDG lol Yardanico: xd Yardanico: nim-lang.org contains official docs for latest stable, nim-lang.github.io - for latest devel Tristan: Schweet, I'll keep that in mind. Tristan: So... the #pp directives worked out well, but now c2nim seems to not like: "__attribute__((visibility("default")))" above a couple const declarations... what do? Araq: #def __attribute__(x) Tristan: Legend, worked like a charm. kayabaNerve: I need some help with the asyncnet library. While creating a socket, the fcntl call is failing. The resulting OSError isn't catchable and crashes my entire program. kayabaNerve: I had it trigger after a few days of normal use, or after 100k sockets while rapid firing. I'm running it now through strace, yet under strace it isn't triggering (almost 400k in) kayabaNerve: I have a friend who suggested to use strace in the first place; his idea is the way strace is hooking fcntl is causing the bug to not exist (race condition?). kayabaNerve: Anyone have any idea here? kayabaNerve: Oh. I do have a traceback. It's in the future callback for the acceptAddr function. https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/asyncnet.nim#L462 kayabaNerve: https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/nativesockets.nim#L577 is the raising fcntl call. leorize: well what was the error message associated with the exception you got? Araq: disruptek, live stream today? kayabaNerve: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e77b69dfa6bd733c7b11256] disruptek: i dunno. i think i'm just sitting here mumbling most of the time. disruptek: pretty exhausting. disruptek: acceptAddr() looks less stupid than i expected. not sure why it would break. kayabaNerve: I'm not complaining the standard lib has this problem 0.001% of the time. I'm looking for a solution because I can't catch it and therefore can't run `continue` kayabaNerve: Happened after a few days of my server running on a VPS, as well as on my home laptop. I've triggered ulimit before and it looked very different. disruptek: i know, i gave up on async for these sorts of applications. kayabaNerve: Have a better suggestion? Because I'm about to wrap ASIO :/ leorize: kayabaNerve: what was the error message associtated with the OSError? kayabaNerve: "Bad file descriptor" kayabaNerve: I included the full traceback above disruptek: i would hack it to confirm that you are able to create the socket. kayabaNerve: I think you'd have to click a link to see it from IRC though disruptek: that's something you can catch. kayabaNerve: Yes and no? Maybe? leorize: kayabaNerve: try compiling with `--assertions:on` disruptek: yeah, make sure that assert is in the runtime. Araq: krux02, awesome work on the bugfixes, many thanks! kayabaNerve: ```code paste, see link``` ⏎ ⏎ Here's my loop. `.accept` is waiting for minutes before it gets a socket and crashes. I can't include a line before it, unless there's a tryAccept. [https://gitter.im/nim-lang/Nim?at=5e77b7bc7d676c4d617050bf] kayabaNerve: Removed my define release, enabled assertions. Killed the strace run after 622k sockets. Now at 90k without strace Araq: kayabaNerve: "catchable" assertions are a stdlib bug Araq: I mean Araq: the stdlib should raise a proper exception and not use 'assert' that you can catch kayabaNerve: That's not the comment Araq: if that's the case, please report it on github kayabaNerve: It's raising an OSError I can't catch because it's under an anonymous function in the async runtime kayabaNerve: The request was I enable assertions to see if one of those shed further light on the problem. disruptek: well, let's first see that the future is finished. Araq: ok, so who wants to hear yet-another exception handling related thought disruptek: oh dear. kayabaNerve: debug + explicitly enabled assertions returns nothing after 270k attempts. The initial crash was after 100k, but I'm not sure how representative that number is. For all I know, it was just extremely early and the strace one would've crashed if run long enough... disruptek: the strace is probably flushing stuff. kayabaNerve: I removed it for the debug + assertions run. Now trying release + assertions, still without strace. leorize: I guess you got a TOCTOU problem leorize: but it's weird that you can't catch it leorize: have you tried an empty `except` branch? kayabaNerve: Every call of mine to newAsyncSocket, accept, or even await is wrapped in try/except Exception. leorize: like `except` instead of `except Exception`? leorize: isn't Exception rooted from Defect and OSError rooted from CatchableError or am I mistaken? kayabaNerve: Haven't tried it, also can't generally. My macro forbids it. That said, I'll disable it for this nexthttps://play.nim-lang.org/#ix=2eZv kayabaNerve: *disable it for this next run. kayabaNerve: I was going to send that, but then i finished https://play.nim-lang.org/#ix=2eZv kayabaNerve: Which shows that except Exception works for OSError kayabaNerve: Crashed on release at 91k kayabaNerve: It doesn't crash with debug or strace kayabaNerve: Seems to be a race condition kayabaNerve: Assertions were on, none tripped disruptek: turn the assertion into an `if`. leorize: it's a TOCTOU kayabaNerve: I never wrote an assertion. No one told me to. All that was said was to compile wit assertions on. leorize: the socket might be closed after you got it Yardanico: @kayabaNerve try turning flags which release implies one-by-one, or try a different C compiler leorize: but not being able to catch is a bigger problem here kayabaNerve: leorize: Because it's an anon function under the runtime. I do wrap all my calls and traditionally call `continue` on error. kayabaNerve: But yes, if I could catch this, I wouldn't care that it happens. disruptek: there are uncachable exceptions all over async, though. kayabaNerve: Right. disruptek: work the problem. kayabaNerve: Right kayabaNerve: :P I understand my circumstance. I'm trying to work it. kayabaNerve: Yardanico: I can, yet it seems to be about speed in general. strace + release was fine. debug was fine. release wasn't fine. kayabaNerve: So I don't think it will help. I also don't believe I can compile this project with clang. It uses a lot of external C libraries. kayabaNerve: (with custom bindings and compile pragmas) Yardanico: well clang supports most of C out there :P kayabaNerve: Yeah, mainly worried about my compile pragmas. What's the Nim switch to use clang? Yardanico: --cc:clang leorize: clang supports 90% of GNU C leorize: I'd say that it will work, assuming that you got a recent enough version of clang kayabaNerve: It's recompiling all my files now. kayabaNerve: Done kayabaNerve: Great kayabaNerve: TIL I support clang kayabaNerve: Alrighty. Probably needs a minute or two to get to 95k sockets (one crashed at 99580, one crashed at 91 something) kayabaNerve: Same error at 22k sockets kayabaNerve: clang seems to be extremely unlucky kayabaNerve: Eh. I should really say clang generated even faster code, as it this bug is a race condition/TOCTOU/something. kayabaNerve: So the immediate fix is to use debug to stop a TOCTOU. The long term fix is... submit an issue to the Nim repository and wait it out? leorize: long term fix is to figure out why can't you catch it :P kayabaNerve: Async runtime kayabaNerve: The async runtime is full of errors which can't be caught because they're macro'd the hell away. At this point in time, I've called runForever. Even if I could try/except runForever, I wouldn't be able to recover the place in code. kayabaNerve: It would exit of everything. disruptek: async won't be fixed. kayabaNerve: I'm not asking to change async. I'm asking to change the newAsyncSocket call to avoid this race condition crashing programs. kayabaNerve: leorize: Oh. If I try/except runForever, I can catch it. Araq: yeah but then you lose everything in the event loop, I think kayabaNerve: Exactly. I'm debating now if I can reboot the networking code. kayabaNerve: At that point, it may be better just to ship a manager to reboot the entire app. kayabaNerve: Araq: Would you be cool if I created an error relating to the newAsyncSocket code as it has a potential TOCTOU? disruptek: just copy and fix the event loop. PRs won't be merged. kayabaNerve: I'm not sure how I can copy and fix every single async operation I have going on. kayabaNerve: I'm pretty sure I'd just want to restart the app. Araq: kayabaNerve: fine with me kayabaNerve: Will do if I get a MRE Araq: disruptek: PRs will get merged and I might revive your PR disruptek: surprise me. 😉 Araq: I reviewed async's code so many times now that I might as well maintain it a little Araq: :P disruptek: i think it's good money after bad what with an arc future. jmo. Araq: anyhow here is my idea regarding 'quirky' exceptions: when should you be forced to check for/ignore the error flag? when you call the next proc that might set it. because then you lose information. Consistent Araq: with Nim's 'discard' idea disruptek: is there a way to `SomeType[T]` inside a template, ie. strop a generic name composed of an untyped arg? disruptek: i like that idea. Araq: this also implies calling a proc that can raise inside a loop has to be annotated disruptek: there's only one flag, right? disruptek: so maybe it could be an error to not check it before risking a new call, but not to omit a check prior to same. disruptek: cfg can figure that out. Araq: yeah, task for the cfg disruptek: first design is probably better because it moves the test closer to the source. disruptek: scope-based exception handling probably a creepy if convenient approach. kayabaNerve: So I can't reproduce it with a minimal brute connect/close. My theory is that it's all the code running in between async calls which is screwing it up 0_o Which means I can't create a MRE. kayabaNerve: But honestly, no idea. As soon as await connect is called, and it trips, I thought everything after that was synchronous which means it shouldn't matter... kayabaNerve: Maybe LMDB/threads? 0_o Anyways. Looks like my solution is to ship in debug for now. disruptek: lmdb/threads? rayman22201: what maintenance doe async need? (other than the obvious arc issues?) kayabaNerve: disruptek: I have no idea what about my project could be tripping it up. If I had to pick something, my guess is the thread for my GUI OR LMDB which I believe spawns a threadpool. kayabaNerve: All I know is that my MRE doesn't work despite having a RE. disruptek: lmdb doesn't use threads by default, afaik. kayabaNerve: A RE with 20k lines of code... disruptek: it does support their use, though. kayabaNerve: Thanks for the heads up disruptek: i wonder if you need to tell lmdb it is being used in a threaded context? kayabaNerve: You shouldn't? I'm not even doing any writing here. Just reading, and all my reads may be RAM cached at this point in time... disruptek: i guess i will stream a couple more hours of obs/dbus. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek blackbeard420: nice Deuns: hello Yardanico: hi Deuns: euantor: do you have a solution for https://github.com/nim-lang/Nim/issues/12320 ? I have the same problem with multiple versions (1.0.2 and upper on openbsd 6.6) disbot: ➥ Koch tools fails on OpenBSD with the 1.0.0 package ; snippet at 12https://play.nim-lang.org/#ix=2f0k euantor: Deuns: afraid not. Unsure why the issue was closed as it still fails for me too Deuns: ok, thank you :) euantor: Running the CI tests also dumps hundreds of errors on OpenBSD, with lots of errors about unable to open file euantor: Not yet managed to find the cause, but I’m still trying. I’m trying to get OpenBSD CI working: https://github.com/nim-lang/Nim/pull/12105 disbot: ➥ #12103 - CI for OpenBSD Araq: euantor, I think it was closed because we now have sourcehut support and it's green euantor: Sourcehut only checks FreeBSD, not OpenBSD. The OpenBSD PR is still open as I have several issues to fix to get it to pass euantor: I need to rebase the PR, which I’ll do tonight and we’ll see how it runs now Araq: ok thanks euantor: rebased, CI running. Expecting failures, will create issues for those that warrant them euantor: Oops, hoped it might get further than that ha! `Error: cannot open file: std/macros` euantor: Is there any easy way to debug import errors like that - eg: to print the path(s) that the files were looked for within? leorize: euantor: use nim dump to get all the search paths Tristan: It's yer boi, back with more dumb questions. I'm trying to translate a C application to nim, there's an enum where a value is being 'OR'ed based on previous values in the enum. Trying to do the same in nim results in a type mismatch. Any ideas? dwdv: collect(for i in 1..3: i) is interesting, almost exactly matches ada's new aggregate expressions (for i in 1..3 => i) syntax. So, when are delta aggregates (mySeq with delta 1..2 => 42) coming to nim? :) leorize: when someone think that it's a good idea I guess :P leorize: it's purely coincidental that collect() matches ada syntax :) Rika: what do delta aggregates do dwdv: Hey, hey, they're even usable with record/objects and arrays. And they even infer their result type. leorize: welcome to macros :) dwdv: Similar to js triple dot operator or whatever it's called. Updating a structure/record/... dwdv: leorize: Well, the above isn't true for nim's collect sugar as of now, is it? dwdv: Or rather doable. leorize: dwdv: I don't quite follow leorize: what I meant was that you can implement all of these with macros :) ggibson: Any ideas why this line causes Illegal Storage Access segfault in a dumb one-line fn in a nim dll? "var server = newAsyncHttpServer()" leorize: have you called NimMain() from your dll? ggibson: leorize leorize: if you haven't, the GC will not be activated, and your code won't work ggibson: Yes. ggibson: NimMain(); dumbFn(); leorize: how did you call your dll? ggibson: It's a shared library, the header is included in an extern "C" block, and then I just call the function. A simple hello world nim fn works okay, but not the server declaration. ggibson: This is from c++. leorize: you should add {.cdecl.} to dumbFn() leorize: on windows the default calling convention is fastcall leorize: for Nim procs leorize: so changing it to {.cdecl.} first should help ggibson: ahh, good idea; I'll try that. ggibson: @leorize shoot, no luck with cdecl, stdcall, or noconv. ggibson: Know of any projects that have c/c++ calling code in a nim lib? I haven't found any actual projects that feature this. Rika: is there a defect for "not implemented" stuff? leorize: @Rika: no leorize: ggibson: shashlick is the expert on this front :P leorize: ggibson: I actually have a library too, though it's on linux and things are much simpler over here Rika: leorize, you know why there isnt any? or did no one think of it leorize: @Rika: because people actually implements their functions? :p Rika: smh ggibson: Hah, true. I'll try it on linux and at least get this working there if I can. Rika: what if i didnt wanna HMMMM leorize: Rika: the short answer is that people don't need it :P leorize: but if you do, you can make your own Defect by inheriting from Defect leorize: I think typically people just use doAssert false, "not implemented" leorize: !repo liblinux_sched disbot: https://github.com/alaviss/liblinux_sched -- 9liblinux_sched: 11A simple library that wraps the sched_* syscalls for musl libc to make schedtool work again. 15 0⭐ 0🍴 leorize: ggibson: ^ that's my library leorize: though I'm the only user :P ggibson: Thanks! Hah yeah I know how that goes. leorize: you can ignore some complicated stuff in there, since I ported most of the manual work I did to the compiler leorize: the entire codegenDecl part can be turned into dynlib now ggibson: @leorize What's the "extern __attribute__..." part for? ggibson: @leorize You were right - it works like a charm in linux. So it's some sort of fnCall pragma voodoo I probably need to make it work in windows. ggibson: That or gcc options to do with ffi. leorize[m]: ggibson: it's dynlib ggibson: oh, I see. wow. ggibson: Thanks for adding dynlib! leorize[m]: I and timotheecour fixed it :p it's always been there, just wasn't working correctly KingDarBoja: Quick question, is there any recommended text editor for Nim? Currently VSCode Nim extension has some issues shashlick: What kind of issues shashlick: Works well for me on windows and Linux as well as remote ssh KingDarBoja: Maybe as I am newbie on Nim but for example, declaring a type and importing on another module, while hitting ctrl + s (save) on moduleA, will cause syntax errors on ModuleB and viceversa KingDarBoja: And the error always shows on the other module as `This might be caused by a recursive module dependency:` Rika: huh? probably actual syntax errors Rika: you're probably actually doing circular imports KingDarBoja: Ummmmm Rika: try running your code Rika: can you post code snippets? KingDarBoja: I wanted to create a type on moduleA, let's call it `Foo` and define another type on ModuleB, let's call it Foo. KingDarBoja: Sure KingDarBoja: source.nim ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e75748abef4313854450232] KingDarBoja: location.nim ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e75749f672fdb1545b5bbf5] ggibson: And Visual Studio works okay. So I'm left trying to get mingw-gcc c++ calling the nim lib correctly. ggibson: (the worst place to be) KingDarBoja: Oh, there is a discord channel shashlick: Nim doesn't support circular dependencies Rika: move `from location import SourceLocation, newSourceLocation` below `type Source* ...` Rika: then it should work Rika: KingDarBoja ^ KingDarBoja: Okie Dokie, didn't know about that KingDarBoja: Ummm still moving the import below `type Source*` triggers some error after hitting save on `location.nim` KingDarBoja: But this time, saving `source.nim` doesn't trigger error on `location.nim` KingDarBoja: Better move all logic from Source `getLocation` proc into Location KingDarBoja: Hi KingDarBoja: Managed to found the discord, 😄 KingDarBoja: Anyway, moved the logic and now getting `undeclared field: 'body' for type source.Source` :/ Rika: i mean Rika: below the whole declaration KingDarBoja: `var lines: seq[string] = source.body[0..^position].splitLines` maybe this isn't the proper way to get the type prop KingDarBoja: The whole declaration? Rika: below `locationOffset: Location` Rika: the import below the whole type declaration Rika: so above newsource leorize: @KingDarBoja you should avoid circular dependency altogether... KingDarBoja: That's what I did and once again, when saving `location` , start showing syntax errors KingDarBoja: 🤔 ggibson: @leorize FYI I solved my issue - turned out I forgot I had installed ccache months ago, and the compile cache was dirty. yay no nim problems! leorize: ggibson: yay leorize: just don't use ccache :p ggibson: ...yeah seems to be the lesson (it doesn't really help anyway) Rika: body isnt public Rika: `body: string` -> `body*: string` Rika: yes, fields of an object need to publicized KingDarBoja: Ohhhhhhhhhh KingDarBoja: That's it! KingDarBoja: Thanks @Rika and leorize! Rika: i dont think you also publicized the getLocation procs? not sure KingDarBoja: No but better avoid the circular thing and declare public the `body` prop KingDarBoja: Now everything is okay 😄 KingDarBoja: Sorry for that, I am usually coding on Python, didn't expect everything is "private" by default KingDarBoja: The tutorial part I doesn't seem to mention that KingDarBoja: I am reading this -> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#self__init__ leorize: I think the wiki is free for all to edit :) leorize: feel free to add in any information that you deem missing Rika: `initX` for `object`s, `newX` for `ref object`s leorize: it's not too weird that we got people coming from python and they got confused with now Nim works leorize: Nim only looks like python in certain syntactic elements leorize: so if you got any questions, feel free to ask here :) KingDarBoja: So I do better use `initX` on my current code ugh? Rika: haha 😛 KingDarBoja: Was going to ask the difference between proc / func too lol Rika: func is proc with `noSideEffects` KingDarBoja: > `initX` for `object`s, `newX` for `ref object`s KingDarBoja: @Rika Tell me 😛 😆 Rika: proc is `def a(): print("nice")`, func cannot print normally Rika: because printing edits stdout Rika: and that is a side effect leorize: func is basically proc but you don't get to access states outside of your parameters Rika: that Rika: outside parameters and result KingDarBoja: Oh Rika: i recommend using func if needed KingDarBoja: Okie Dokie 😄 Btw anyone uses vscode-icons (icon theme) ? Rika: i tried it KingDarBoja: Well the nim icon is being updated soon, no more black-gold crown lol Rika: i assume thanks to some KDB KingDarBoja: 😍 Rika: oh also `decorator` is called `pragma` here leorize: nah leorize: we don't have any syntax similar to decorator :P Rika: no i mean the naming Rika: i mean more of functionality-similarity-wise leorize: but macros is superior leorize: it's not pragmas, they are macros Rika: i mean, theyre called pragmas here KingDarBoja: https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#decorators What Leorize said... Rika: we both know our shit, pragmas are basically macros which take a function Rika: but the syntax for using them is pragma syntax, not macro syntax Benumbed: Does anyone know where things stand in terms of stream procs gaining an understanding of endianness? I found the issue in Github but it's languishing 😦 Rika: i understood nothing of what you just said Benumbed: streams have procs to extract things like uint32s and such Benumbed: Those have no concept of endianness Benumbed: meaning if you're streaming something from a network, on a little-endian machine, well, you're going to have a bad time 😄 Benumbed: (at least if you're using those procs) Rika: well, how exactly do you tell something is little endian or big endian given only the data Rika: or do you mean as an argument? Benumbed: The latter Rika: i got no clue right now since im kinda loopy maybe someone else can help Benumbed: so someStream.readUint32 would have some way of hinting what ordering was in use so it can be converted to native endianness Benumbed: The issue in question (RFC) is https://github.com/nim-lang/RFCs/issues/27 disbot: ➥ [RFC] Option for endianness in streams Benumbed: More interested to see if there's any progress being made on it, or if I should just continue writing my own extractors for streams Benumbed: Oh and BTW, I meant to say this last night, but got distracted by stuff, this is probably the nicest language community I've been in, it's awesome, thank you 🙂 KingDarBoja: ❤️ KingDarBoja: Quick question, the tutorial shows how to raise an error, is there a quick way to do it inside a if statement or I must create the following: KingDarBoja: ```nim KingDarBoja: if some_check: KingDarBoja: var e: ref ValueError KingDarBoja: new(e) KingDarBoja: e.msg = "you failed this city" KingDarBoja: raise e KingDarBoja: ``` Rika: raise newException(ValueError, msg) Benumbed: You should be able to just do newException(ExceptionT.... yes that ^ haha Rika: heh 🙂 Rika: i may be sleepy and slow now but my typing is probably not inhibited enough to slow down significantly KingDarBoja: Ohhhh!! KingDarBoja: Thank you! Benumbed: I'm sitting at a weird angle at my desk and watching a detailing video for a Skyline R32 V-spec while reading chat... that's my excuse 😄 Rika: ooh, R32s are nice Rika: i'm undecided on which looks nicer, the R32 or the R34 KingDarBoja: I'm playing World of Tnaks Blitz while coding Benumbed: Aye... apparently this one had 100 hrs of detail time spent on it Rika: if only i had the money to buy something that expensive... Benumbed: It's cathartic, and given all the crazy shit going down in the world, I need stuff like that Rika: i'm doing absolutely nothing aside from reading chat Benumbed: Just this chat, or all your Discord chats? KingDarBoja: I'm playing World of Tanks Blitz while coding KingDarBoja: We can go to #offtopic :v Benumbed: Well that's really all I had to say 🙂 Rika: a lot of discord chats Benumbed: Ok, I was about to say you must be horribly bored KingDarBoja: COVID-19 intensifies* Rika: i am, i've been chipping away at some gigantic library in python im converting to nim but its hard Rika: because its math heavy Rika: and also parser heavy Benumbed: Ohhh, which lib (if it's public)? Rika: https://github.com/llllllllll/slider/ Benumbed: Ahhh, neat! KingDarBoja: I am doing my first steps on Nim, by converting GraphqlJS (or Graphql-python) into nim Rika: my port is https://github.com/de-odex/circa, i havent committed in a while but i've been working on it nonetheless Benumbed: I'm writing an AMQP client library in pure Nim from the spec... as my first project in Nim... lol Rika: sounds painful really KingDarBoja: I am doing my first steps on Nim, by converting GraphQL-JS (or Graphql-python) into nim Rika: this was my first project but its not my first project to finish KingDarBoja: 😄 disruptek: those are a couple great projects. KingDarBoja: I am contributing to graphql-python but wanted to try something new and found nim 😄 KingDarBoja: I am contributing to graphql-python but wanted to try something new and found Nim 😄 disruptek: we need a native graphql for github actions and packages. Rika: kinda wished my projects were as useful as you 2s Rika: lmao Benumbed: It's nice to have a systems language I like using. I know C++ pretty well, but its heavy, Go is ... well lets not talk about Go Benumbed: @Rika Hey, you're helping build the ecosystem around Nim, that's valuable Rika: Rust? KingDarBoja: > we need a native graphql for github actions and packages. KingDarBoja: @gitterirc What do you mean by native¡ KingDarBoja: > we need a native graphql for github actions and packages. KingDarBoja: @gitterirc What do you mean by native? Rika: native nim Benumbed: Haven't used Rust beyond an initial inspection KingDarBoja: @Rika every package can be useful Rika: recently ive been heavily self deprecative though i dont know why KingDarBoja: Have you seen npm packages? There are tons and several of them are very tiny stuff but still people love to publish them and are useful on its own niche Benumbed: Happens to me a lot Rika, my fixes aren't healthy though, shove it in a mental corner and try to find something that sparks my interest so I can continue to ignore it Rika: @KingDarBoja thats a whole nother story isnt it Benumbed: I write Node for work, right now... the microservices I work on have thousands of packages listed in their lock files... it's unnerving Rika: how's auditing : ) disruptek: yeah, i hate the js ecosystem. disruptek: so liberating to be free of that. KingDarBoja: xD Benumbed: Actually we're undergoing a huge audit right now, it's not pleasant Rika: js is the reason stdlibs need to be strong and useful KingDarBoja: I use TypeScript and Python at work Benumbed: Yeah I got yanked from a Python team to a Node team because I have an unusual set of skills Rika: i'm not working yet KingDarBoja: Thank god it isn't plain JS Rika: @Benumbed ??? what skills 😮 Benumbed: Node was not on my list of things to learn... ever lol Rika: i've tried typescript, its like a weaker and more confusing version of nim Rika: never gonna memorize the difference of for of and for in Benumbed: @Rika I'm a software engineer by trade, but I have 5 years of SRE experience as well, so I'm very familiar with how to build infrastructure, particularly in an automated way KingDarBoja: Ah... Rika: thats interesting KingDarBoja: SRE? disruptek: site reliability Benumbed: I'm on Disney's cloud team, our products manage the entire company's cloud presence across all 3 major vendors KingDarBoja: @Rika I have never understood the difference between call and bind so... zetashift: hopefully somebody can sneak in some Nim code into Disney's codebase Rika: i dont even know what call or bind do Benumbed: zetashift: Working on it! 😄 disruptek: call is what you do to get her over to your place, and bind is what you do to keep her there. zetashift: Ooooo Rika: you can use code to make node code 🙂 Rika: do it do it Rika: ok Rika: i didnt say nim somehow KingDarBoja: LOL Rika: you can use nim code to make node code Rika: im very sleepy zzz Benumbed: There's talk of converting our services to Go, which, having actually learned Go... I'm not entirely pleased about either haha KingDarBoja: Now think about JS community with those frameworks, libraries, etc Benumbed: Gp Rika: Gp? Benumbed: err Go's package ecosystem is a nightmare zetashift: Yeah I think Go is Nim's biggest contender in the space Nim wants to occupy Rika: yeah KingDarBoja: What about Rust? Rika: heard of Go's package system and hhhhh Rika: Rust is an okay package system from what i tried Benumbed: Rust is too high of a learning curve for what we do Benumbed: and also overkill zetashift: If they can live with a GC, I think you'd want to avoid rust KingDarBoja: Rust has Cargo, Go? Rika: go has uh Rika: forgot the name Benumbed: dammit I know this... Go modules or something zetashift: iirc they were working on it KingDarBoja: Oh yeah KingDarBoja: Go modules Rika: TBH Cargo sounds more like a Go package manager than a Rust one, because, uh, carGO Benumbed: I was using them right before I moved my efforts to Nim KingDarBoja: Go has several package managers as far as I know Benumbed: The Go modules are out of beta in 1.13 (latest) I think KingDarBoja: Then they went to only one trying to standarize it disruptek: !repo nimph disbot: https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 54⭐ 3🍴 7& 1 more... Rika: most people say that Go is too simplistic making it boilerplate heavy KingDarBoja: Wait what? Rika: yeah disruptek made another package manager KingDarBoja: Where is nimble lol Rika: never used it Benumbed: lol Benumbed: nimble drives me nuts when it comes to how it handles tests Rika: nimble is the one packaged with nim Rika: why so? Benumbed: I have an item in my list of TODOs to figure out how to make it better zetashift: Rika, I think you have to choose your projects for Go, for web services seems great KingDarBoja: Neither I but hopefully it doesn't become too many of them Benumbed: Nimble doesn't traverse directory structures to run tests Benumbed: it just looks in the root of the test directory Benumbed: also, it likes to write the executable next to the .nim KingDarBoja: As JS has npm, yarn, pnpm, etc Rika: maybe testament fixes what unittest lacks Benumbed: which makes .gitignores a nightmare trying to not check in executables zetashift: @Benumbed try to open an issue, iirc the people working on nimble are open for ideas Rika: i think theres a parameter for that Rika: --out was it? not sure Rika: outDir? dunno zetashift: yea Benumbed: zetashift: I was going to try and actually figure a better way out myself and then submit an MR zetashift: `nim c -o:path` KingDarBoja: 😮 zetashift: man I read that as submit an MRI Benumbed: Heavy stuff... O_o 😄 Rika: only reason i understood MR is because MR sounds like (mer)ge Benumbed: I use 'MR' because not everyone uses Github 🙂 zetashift: fair Benumbed: I do actually use -o all the time (I compile to a build/ directory so I can just gitignore it), but it only works for single files Benumbed: What would be helpful is a 'write all binaries to dir' argument zetashift: might be able to do it with nimscript Rika: anyone here who can help me out with my endeavor to translate this lib though (i mean, less of those who can read python and more of those who are knowledgeable on osu core functionality, as the library i'm translating has errors in the code) zetashift: I'm not sure though, most people here are EU so they can't weigh in cause they're sleeping :( Benumbed: I'll probably look into a 'fix' once I get to the point with the AMQP client where I have a bunch of tests that I want to build Benumbed: Not I unfortunately, the closest I get to osu is watching vids on YouTube zetashift: osu as in the rhythm game? Rika: yep zetashift: yea also youtube vids for me Rika: xdddd Rika: okay ill just ask this then, what's the best approach for me to parse a file that looks like a windows INI file but isnt exactly one? Benumbed: That is the sort of stuff that ends up irking me lol zetashift: Is there an existing implementation in another language maybe? Benumbed: Can you pre-process the file down to legit INI syntax, then use an INI parser? Benumbed: Can you pre-process the file down to actual INI syntax, then use an INI parser? Benumbed: Shit, forgot I'm not supposed to edit, sorry IRC folks KingDarBoja: OOOHHH it is that tap game! Benumbed: Discord and Slack habits are engrained in me Rika: THAT TAP GAME Rika: i guess ill just uh look elsewhere Benumbed: Hey, I made a suggestion! Sorta... 😄 KingDarBoja: I am very tired, gotta go 😄 see ya tomorrow! Benumbed: nn KingDarBoja: nn? Benumbed: nightnight KingDarBoja: Ah! ... _Buenas noches_ (good night in spanish) Benumbed: Oy it's 2021... I should probably eat something O_O Rika: it's 2020 Benumbed: Cute Rika: god please add colons to your times Rika: or a T suffix Rika: prefix rather Benumbed: Butbut... Rika: 2021 looks like a year Benumbed: *sigh* fiiiiine disruptek: benumbed: --outdir Benumbed: disruptek: Huh... I didn't even know that was a thing! disruptek: --fullhelp Rika: hey i called it Benumbed: Well gee, I feel like a double dumbass, thanks Benumbed: 😄 Rika: what exactly is a closure iterator Rika: and how do i distinguish a regular one from a closure one disruptek: like a python generator, an iterator that you can iterate on demand. Benumbed: Wouldn't that just be a closure that `yeild`s? Benumbed: yield dammit fingers Rika: well is it possible to convert a regular iterator to a closure iterator Rika: w/o editing the source of the regular iterator Rika: nvm Rika: lmao Rika: i'm very loopy today it seems zetashift: Everyone has those days rayman22201: @Benumbed re: endian the stuff. Status has a good package for it: https://github.com/status-im/nim-stew/blob/1c4293b3e754b5ea68a188b60b192801162cd44e/stew/endians2.nim Benumbed: rayman22201: Oh cool, thanks for the link 🙂 Rika: ah, converting python code that relies heavily on the dynamic typing is such a pain rayman22201: NP 👍 Also check out their stream impl https://github.com/status-im/nim-faststreams Benumbed: Neat Benumbed: Does anyone not use VSC to edit their Nim code? Benumbed: If so, what do you use? Rika: a lot of us use vscode Rika: many also use vim Rika: afaik vscode and vim are the most used Rika: theres another one but i forgot the name Rika: i havent slept since i last spoke her Rika: e Benumbed: You should really go get some sleep @Rika O_O Araq: the joys of build systems Araq: To build Z3, open a [Visual Studio x64 Command Prompt], then Araq: type 'cd C:\Users\rumpf\projects\z3\build && nmake' Araq: ... hours later ... Araq: shell\datalog_frontend.obj : fatal error LNK1112: Araq: now how do I tell this set of python scripts to build via GCC Araq: who knows... Araq: and why does it take 10_000 lines of Python code to produce a 5000 LOC makefile? Araq: it's a bunch of C++ files, you compile them, you link them together, just how hard can you make that... lqdev[m]: that's why I use meson. simple to configure, simple to compile with. don't know why anyone would want more than that. Araq: interestingly, the bug seems to be unreported timotheecour: @araq https://github.com/nim-lang/Nim/pull/13714 is ready for review disbot: ➥ [WIP] VM callbacks can now raise (and be caught, or show their stacktrace) ; snippet at 12https://play.nim-lang.org/#ix=2ePp Stuffe: is hot code reloading supposed to be working yet? Varriount: @Stuffe It should Stuffe: @Varriount I tried following https://nim-lang.org/docs/hcr.html but it complains that "libnimhcr.dylib" doesn't exist. Could it be that it only works on Windows or Linux and not macOS? Araq: tests are green on osx too Araq: but you need to do some bananaPATH dancing Araq: (forgot the correct terms) Guest84077: lqdev[m]: +1 for meson! Stuffe: Araq, hmm I am not wure what that means Araq: Stuffe: --passL:-rpath --passL:@loader_path Araq: I'm talking about this one Araq: and you might need to set your LD_LIBRARY_PATH Stuffe: @Araq I just searched my whole system for libnimhcr.dylib but it doesn't seem to exist. Where would I find it? Araq: --hotcodereloading:on is supposed to create it Stuffe: Im trying: nim c -r --hotcodereloading:on --passL:-rpath --passL:@loader_path mymain.nim Stuffe: And I'm getting: could not load: libnimhcr.dylib Stuffe: And I searched the whole system, libnimhcr.dylib doesn't seem to exist anywhere jken: Anyone have assimp running in modern nim project? The package in the nimble directory is pretty out of date https://github.com/barcharcraz/nim-assimp federico3: jken: there are no releases tagged on github Araq: Stuffe: all I can say that I personally used it on Windows and we test all major OSes Araq: and I need to go, can investigate on my OSX machine later Spy653: Hi, don't know if I asked the other day but would you guys mind if I asked you to fill out a survey (not now but in general)? I'm doing some research for a personal project of mine Spy653: tag on reply, if you can, as it's quiet geotre: @Spy653 sure, what's the project? Spy653: Rip guess the bot can't tag Spy653: It's a hardware/software IoT-like solution for people who want more than the currently available shit tier products Spy653: The current IoT market makes you pick between an iMac or a DIY kit, I want to give people something better mratsim: iMac = IoT? Spy653: Not literal iMac, figurative Spy653: Very expensive item that you have very limited control over and is considered a joke by most Spy653: Good at what it does sure, but still very restrictive Skaruts: how do you use the keyword `any`? Skaruts: seen this in python before, but I totally forgot how it works leorize: it's a generic typeclass in Nim leorize: basically: "match everything" Spy653: Does nim have anything regarding writing strings with wildcard characters or would you just concat a string with variables in it leorize: it depends what you passes the string to leorize: but strings don't care about what data is in it axion: if i do `a[4..7] = [1,2,3,4]` to populate a static array, are there any temporary sequences being allocated on the heap in this process? I'm not very familiar with ranges leorize: no axion: no even for [1..4] on the rhs? leorize: of course, you wanted to modify the array directly, why would we make a temporary buffer? leorize: https://github.com/nim-lang/Nim/blob/version-1-0/lib/system.nim#L4012 leorize: ^ that's the operator doing the copy leorize: oh I misread leorize: the rhs there will be a constant buffer in your program, on the stack axion: that's pretty nice. thanks axion: Only thing I wish for is a syntax for combined slices. like a[1..3,10..12] = [1..6]. maybe i'll have to write a macro for this some day leorize: axion: is this what you want? :P https://play.nim-lang.org/#ix=2eRW axion: syntactically, yes. Though, I'd have to check the assembly to see if that's doing what i'd expect axion: I'm not very familiar with Nim yet to know if that function call overhead will get folded away disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: more obs plugin hacking to add dbus support. axion: leorize: actually, no, because it's not symmetrical, but that should be an easy fix. leorize: axion: yea I can see what you meant, so here's a tip when you implement that: use toOpenArray for copy-less slicing :) disruptek: everyone check this amazing package out: disruptek: !repo juancarlospaco/nimbug disbot: https://github.com/juancarlospaco/nimbug -- 9nimbug: 11Nim Semi-Auto Bug Report Tool 15 1⭐ 0🍴 leorize: nice disruptek: yeah, i love it. dadada: is juan also in IRC? disruptek: he's on the stream. disruptek: i think we came up with this idea yesterday and he already built the tool. dadada: nifty dadada: sufficiently loud dadada: disruptek: nice music shashlick: where can i find examples of forward declarations in C headers for types kristianmandrup: @alehander92 I fixed the react code so it can now compile and be used. Still some way to go to make it "fully functional" in a real app though KingDarBoja: Wow, Latin American power! KingDarBoja: I got another Python related question KingDarBoja: Anyone has used Enums on Python like assigning a string value instead of a integer one KingDarBoja: Can I do the same in Nim? so far looks like no 🤔 disruptek: type MyEnum = enum Value1 = "firstValue", Value2 = "2ndValue" KingDarBoja: Oh! KingDarBoja: From the tutorial part I: KingDarBoja: > _A variable of an enumeration type can only be assigned one of the enumeration's specified values. These values are a set of ordered symbols. Each symbol is mapped to an integer value internally._ KingDarBoja: I got confused by the mapping part disruptek: yes. but what you're doing here is syntactically providing a string constant for the enum. disruptek: such that $Value1 == "firstValue" disruptek: it is otherwise an integer. disruptek: ^ordinal, rather. KingDarBoja: Thanks once again! KingDarBoja: Do you have a GitHub so I can follow u? D: disruptek: yep. disruptek: or you can watch me code right now. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek KingDarBoja: Awesome! _Mr. Robot intensifies_ KingDarBoja: Another question but related to Nim, how to do a test suite? Like python has pytest (or unittest) zetashift: Nim has unittest zetashift: and you can run your tests with nimble test zetashift: If that is what you mean KingDarBoja: https://nim-lang.org/docs/unittest.html this one u mean? dadada: KingDarBoja: yes, I'm using it right now, it's simple Recruit_main707: how can i compile my program so that its 32bit instead of 64? KingDarBoja: Gonna try it, if any question, I will return, thanks 😄 kaushalmodi: Recruit_main707: `nim c --cpu:i386 --passC:-m32 --passL:-m32 foo.nim` kaushalmodi: https://scripter.co/notes/nim/#compiling-in-32-bit-mode PMunch: Doesn't --cpu:i386 set the m flags? leorize: nope leorize: though we can certainly make it do so PMunch: Is there a reason why it doesn't? KingDarBoja: Ummm having problems to import some module KingDarBoja: If my dir structure is like: KingDarBoja: - src KingDarBoja: -- dirA KingDarBoja: --- moduleA.nim KingDarBoja: --- moduleB.nim KingDarBoja: - test KingDarBoja: -- some_file.nim KingDarBoja: I want to import moduleA stuff on some_file inside my test dir leorize: import dirA / moduleA KingDarBoja: Without the src part? KingDarBoja: https://github.com/nim-lang/nimble#tests I added this but without success KingDarBoja: Nevermind, looks like it is VSCode once again showing errors on save after switching files KingDarBoja: `Error: invalid module name: .nim` wut? After running nimble test KingDarBoja: Had to provide whole path to the nim file including the test file name KingDarBoja: It is possible to run all tests inside the `tests` folder? Or I have to specify each one on my test task? Recruit_main707: compilation failed, it could be that i call kernel.dll? axion: How would I construct a large array of all zeros in a let binding without specifying all the values? leorize: @KingDarBoja: import without the .nim part :P leorize: axion: use default(T) axion: hmm axion: I'm not familiar with how to use that leorize: !eval let array = default(array[100, int]); echo array NimBot: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] axion: I see. and if I wanted non-zero I'd have to use algorithm.fill? KingDarBoja: Arhhh have no idea how to compare a Enum value with a string KingDarBoja: Like `x = south` (from the tutorial example), want to do `check(x == "south")` KingDarBoja: But doesn't work (error on the console) leorize: axion: yea leorize: though it'll look like this instead: disruptek: $someEnum == "some string" KingDarBoja: `Error: type mismatch: got but expected one of:proc ==[Enum: enum](x, y: Enum): bool` leorize: import algorithm, sugar; let array = default(array[100, int]).dup(fill(10)); echo array KingDarBoja: 🤦‍♂️ Ah... leorize: axion: that snippet requires devel though axion: ah i have to look up dup KingDarBoja: What about: KingDarBoja: > It is possible to run all tests inside the tests folder? Or I have to specify each one on my test task? leorize: axion: https://nim-lang.github.io/Nim/sugar.html#dup.m%2CT%2Cvarargs%5Buntyped%5D axion: why copy? leorize: axion: you want to do it all in a let leorize: then that's the best solution :P leorize: or this: let array = (var a: array[100, int]; a.fill(10); a) leorize: works the same leorize: side effects is that it might confuse beginners KingDarBoja: ugh, running `nim c -r tests/somepath/somemodule` generates a .exe file KingDarBoja: The docs on nimble website are outdated, they still showing `--path` inside`nim.cfg` but it should be `switch("path", "$projectDir/../src")` on `config.nims` leorize: nim.cfg is still supported KingDarBoja: I mean, the readme points to some `config.nims` as it was changed 8 days ago... leorize: oh lol, then you should PR in an edit to change that KingDarBoja: Errr I got worng, it was changed at Nov 2019 lol KingDarBoja: https://github.com/nim-lang/nimble/commit/16ba5db44e0a9132f966a2082012cc3520bfec06 federico3: koch attempts to git pull / git clone a lot of stuff without asking permission. This should not happen Recruit_main707: i get this error when trying to compile to 32bits `cannot find -lmsvcrt` PMunch: So you're missing the msvcrt library PMunch: Probably a library that you have the 64-bit version of, but not the 32-bit one PMunch: Recruit_main707 ^ Recruit_main707: hmmm Rika: ms visual c runtime Rika: well, visual c++ Recruit_main707: i guess ill stick to 64bit, thanks both though! disruptek: leorize! this new pragma positioning! argggh! Rika: what new pragma positioning disruptek: in the nvim.nim nim.nvim w/e leorize[m]: disruptek: sounds like a bug, do you have a clip about it? disruptek: it's on stream if you want. Rika: what if he doesnt huhhh leorize[m]: I'm not watching atm, sorry disruptek: kk disruptek: there's some kind of bug with pathsubs now. disruptek: i don't understand these changes to the default config file handling. Kenran: I'm trying to do something with the `sdl2` library. While copying the example code, I got "type mismatch: got but expected 'bool'" in `while pollEvent(evt):`. `pollEvent` does indeed return `Bool32`. How can I get out of that? Kenran: Oh, nevermind, I could get rid of the error by changing my `from sdl2 import nil` to `import sdl2` on a hunch. I still don't understand why that fixes it, though. Any hint? Yardanico: Probably because sdl2 module contains a converter which converts Bool32 to bool automatically Yardanico: https://github.com/nim-lang/sdl2/blob/master/src/sdl2.nim#L351 Yardanico: also I'd recommend to use https://github.com/Vladar4/sdl2_nim for sdl2 in nim :) Kenran: thanks, and noted 🙂 I'll try that one tomorrow Kenran: I have a small problem with not being able to start my executable (can't find `libSDL2.so`), but I'm pretty sure that's coming from NixOS zetashift: does nixos have the sdl2-dev library? Yardanico: @Kenran it's probably due to NixOS not following the FHS Yardanico: you might need to use patchelf on NixOS to run your compiled binaries Rika: ?? what does it mean when i get an ObjectAssignmentError kaushalmodi: axion: Thanks. Glad you found my blog useful. dumjyl: slicing probably, upcasting an object without a pointer indirection. leorize: Rika: it means you messed up :P leorize: so what did you do? Rika: uh Rika: `object of` then using `ObjectName(x: x...)` apparently doesnt work Rika: has to be `ref object of` Rika: its old code, and im still suspecting that its wrong since ref objects dont use the `ObjectName()` thing Rika: or do they now? dumjyl: old nim was more lenient about object slicing. disruptek: `when false` works better than branches? yeesh. silvernode: Good morning silvernode: How is everyone doing today? rmt: I've got this pain in all the diodes down my left side, a sore throat, a dry cough, and a small castle made out of an excessive number of of toilet paper rolls. Muhaha. rmt: Thanks for asking. silvernode: rmt: That's crazy, those are the apparent symptoms of COVID-19 rmt: Also the dry cough, or just the castle building? silvernode: rmt: both rmt: Wow. I should go tell someone the news. Maybe my grandma. She always knows what to do. bbk soon. silvernode: Man I am so bad at using arrays, seqs and tables. Every time I try to build a basic text game I also get stuck on the inventory system. I know it's not hard to iterate over something and print the results but I am bad at design and logic so I always end up getting so stuck that I give up. silvernode: also --> always rmt: Text game, MUD style? silvernode: rmt: sort of but not "type until you bleed" style rmt: I'm pretty sure MUDs is what got me typing over 120 words-per-minute. ;-) silvernode: People here have been trying to help me with example code. Tables seem to be the way to go but I already have a custom type with a seq that is to be the inventory or cargo of a space ship. rmt: I wrote a MudOS based MUD once .. borrowed a lot of good code to do it. Good exercise - especially tying into the inter-mud messaging service.. learning about IP networking, security models, defensive coding.. if there was a way to abuse the system, some user would find it. Wish I still had the code. :-/ silvernode: https://play.nim-lang.org/#ix=2eJU silvernode: I almost had it working with the add() proc but the problem was that an Item was being added but not the way I wanted. silvernode: I want items to stack instead of the cargo saying [Fuel, Fuel, Fuel], I want it to say [Fuel[20]] (or however many the player has. Varriount: silvernode: Hm, does the inventory have a visual representation? Varriount: And will it allow the user to rearrange things? Varriount: will the user be able to arrange the same kind of item in multiple stacks? silvernode: It will eventually, think of how you'd expect a RPG to play where you press I and a screen shows you what is in your backpack. That's how I eventually want it to be. silvernode: No need to rearrange anything silvernode: only adding and subtracting an item by a given amount Varriount: If the inventory space is small, you can probably get away with just doing a linear search. Varriount: `seq[Item]` Varriount: Otherwise, you might employ a hash table to enable `O(n)` lookup for which slot a particular item is located at. silvernode: Someone sent me an example of how I could do things with tables which appears to work, but as I said I am working with seqs but I could change everything to tables I suppose. silvernode: *sigh* I have to clock in to work Varriount: 😛 silvernode: I will leave you with my project page and maybe you can get some ideas silvernode: https://github.com/silvernode/space-nim/tree/experimental silvernode: Ok, have a good day everyone. Thank you Varriount: Hm, I wonder if I should emulate disruptek, and start my own Nim programming stream fluxinator2000: I'm trying to build an emulator and want to construct a big table of functions with some meta data for each function, but I can't seem to have procs in a tuple? This doesn't compile 🤔 fluxinator2000: ```type TupleWithProc = tuple[p: proc()] fluxinator2000: proc myProc() = discard fluxinator2000: var x:TupleWithProc = (myProc)``` Varriount: @fluxinator2000 Please use a paste service for code snippets, as pasting code doesn't show up well across the IRC bridge Varriount: Preferably https://play.nim-lang.org/ Varriount: @fluxinator2000 Ah, this is one of the tricky parts about function types - the type of the function is not only specified by the parameters and return type, but also the calling convention Varriount: https://nim-lang.org/docs/manual.html#types-procedural-type Varriount: See the 2nd paragraph, after the code blocks: Varriount: > A subtle issue with procedural types is that the calling convention of the procedure influences the type compatibility: procedural types are only compatible if they have the same calling convention. Varriount: @fluxinator2000 https://play.nim-lang.org/#ix=2eJV Varriount: Also, to make a tuple with one element, you need to add a comma at the end, to distinguish between using parenthesis as a grouping technique fluxinator2000: @Varriount This is still confusing to me so I have some reading and experimenting to do. I have stumbled on this problem before but never really understood it. With this Corona isolation I have no reason not to learn this stuff for real. Thanks! 😁 Varriount: @fluxinator2000 What programming languages do you have experience with? fluxinator2000: @Varriount Mostly Javascript. Before that I wrote alot of 32-bit assembly in windows 🙂 I'm a UX designer but programming has been my hobby for close to 20 years. I have also written quite a lot of code in Pascal, C#, Java. Past two years I did Advent of Code in Nim. Varriount: Ah, ok. So you know what calling convention is? fluxinator2000: yeah, but I guess on an intuitive level. Never really had to think about it. Varriount: With Nim, you have 2 main calling conventions (with more if you're interfacing with languages like C) Varriount: nimcall, and closure fluxinator2000: javascript has closures I guess fluxinator2000: so they capture the scope of the caller in some way Varriount: Yeah Varriount: From https://docs.microsoft.com/en-us/cpp/build/x64-software-conventions?view=vs-2019 : Varriount: The __fastcall convention uses registers for the first four arguments and the stack frame to pass additional arguments. Varriount: `nimcall` is usually (always?) equivalent to fastcall Varriount: The fastcall convention uses registers for the first four arguments and the stack frame to pass additional arguments. fluxinator2000: ah, I think I have used this before. I wrote assemlber code in Delphi many years ago and I remember it's using registers and stack together like this. Varriount: The `closure` calling convention is what you might call a "synthetic" calling convention Varriount: Procedures with the `closure` calling convention are passed around as (what is essentially) a tuple containing the closure's "environment", and the actual function pointer. Varriount: A closure's environment contains all the data from parent scopes that it needs to access. fluxinator2000: Right. I can see problems with keeping closures in tuples so maybe that is not possible. Varriount: It's not that closure's can't be kept in tuples, it's that you can't mix `nimcall` and `closure` procedures. Varriount: When the compiler calls a `closure` procedure, it needs to know to pass in the environment as a hidden parameter fluxinator2000: sounds reasonable fluxinator2000: I think I need to study the documentation. Thanks for your time 🙂 Benumbed: Question... I have a situation where I'd like to type cast/convert a parent class up to a child class (basically copy the values in the incoming parent object to the same fields in the child object), however ChildType(parentObject) throws an ObjectConversionError... am I going about this wrong? Benumbed: Maybe I'm tired and I'm thinking about casting an inhertance backasswards... Benumbed: Maybe I'm tired andd I'm thinking about casting an inhertance backasswards... Benumbed: Maybe I'm tired and I'm thinking about casting an inhertance backasswards... Benumbed: Maybe I'm tired and I'm thinking about casting and inhertance backasswards... PMunch: Haha, please don't edit your discord messages :P They come through as a complete copy Benumbed: oh goddammit Benumbed: *Facepalm* so sorry PMunch: No worries :) Varriount: @fluxinator2000 https://play.nim-lang.org/#ix=2eJZ Benumbed: Spamming the people on IRC is such a _greaaaat_ way to get to know people 😛 PMunch: To be fair it's partially our own fault for net getting a better Discord bot set up :P Varriount: PMunch: Sorry, I didn't know that Varriount: I'm used to the gitter bot, which (I think?) just ignores edits Varriount: Benumbed: Is this an object type? Varriount: @Benumbed ^ Varriount: Or a reference type Benumbed: Oh someone changed my username on here to non-unicode, that's good 🙂 Benumbed: It's inherited objects so they're refs PMunch: Oh right, you were the one with the crazy nick :P Varriount: Hm, I think `fields` might work Benumbed: Yeah, my actual Discord username is unicord cursive 😄 PMunch: Hmm, I just get an undefined routine: https://play.nim-lang.org/#ix=2eK0 Benumbed: PMunch: Parent and Child should be `ref object`s should they not? Benumbed: (At least that's what I've read in the manual) PMunch: Don't have to be PMunch: Ah, but now I get the same error. I was instantiating the Parent object wrong PMunch: You could always write your own copy method: https://play.nim-lang.org/#ix=2eK1 PMunch: I mean there are more low-level ways of doing that as well Guest4842: sometimes Nim is driving me nuts Benumbed: That's the direction I was heading (copy method), I was hoping type conversion would make life easy for me PMunch: Haha Guest4842, what's the issue? PMunch: dadada " dadada: PMunch: I do something in a scratch.nim it works, I do the same thing inside a macro that writes a macro inside a quote do, and it doesn't work ... ... admittedly it might not be the same thing because I might have missed something, but so far I don't see any differences PMunch: Ah, double nested macros and quote do indeed tend to be a bit quirky to work with PMunch: Do you have an example? dadada: the macro creates a new ref object type containing a ref to a table dadada: in a macro generated proc I want to check that ref to the table for being nil or not dadada: compiler tells me something about iterators/pairs that makes no sense in that whole context PMunch: Are you iterating anywhere? dadada: no dadada: just a simple if object.refTable == nil PMunch: Are you creating this ref object on compile-time? Or do you generate code to create it on runtime? PMunch: Ah, you should use isNil dadada: PMunch: that seems to help somewhat, but why does it == nil work in my scratch.nim? Varriount: Hm, would `ParentType(childValue) = parentValue` work? Benumbed: That creates a new object of ParentType though, I need an object of ChildType PMunch: dadada, dunno. Maybe you're not importing something that provides a `==` procedure for that type Varriount: Benumbed: https://play.nim-lang.org/#ix=2eK3 Varriount: Behold, the horrors of references narimiran: dadada: how about `if object.refTable.isNil`? dadada: narimiran: yes, PMunch told me that, it does help indeed, thank you both Varriount: Benumbed: If you want to do a merge operation, you might be able to use fields/fieldPairs Benumbed: That's ... I'm not even sure what to say about that, but I'll give it a shot Benumbed: I'm so new to Nim that I keep trying to think of it like Python about 1/2 the time, and that trips me up a lot Benumbed: (the syntax pushes my brain into Python mode, which I've been writing for over 10 years haha) PMunch: Haha, yeah just using object hierarchies is considered a bit "out-there" in Nim land PMunch: It has its usecases, but I find I run into them fairly seldom Benumbed: Yeah I got that feeling... and I keep wondering if I'm doing it wrong Benumbed: I'm trying to write a Nim AMQP library from the actual AMQP spec Benumbed: (since no one appears to have written one yet) Varriount: Benumbed: `Parent(child)` converts the variable to a `Parent` type. Since we are working with references, this doesn't result in a loss of data. Benumbed: Yeah that part I got Benumbed: it's where you used `[]` Varriount: `[]` dereferences both sides, so we are assigning to the underlying object value, rather than the reference value Benumbed: and I was like "uhhh is that basically magic for field setting?" Varriount: Nim usually dereferences things for you, but not in this instance. Benumbed: ok, that makes sense, the `[]` feels weird, but that's my newbness in Nim talking Benumbed: Maybe I need to stop trying to use objects for this, but unfortunately most of my recent experience is all in OOP-style languages Benumbed: So I think like that Benumbed: well, nested/inherited objects Benumbed: objects/structs are still needed 🙂 Benumbed: I also chose a hell of a first project in Nim, but I generally get bored and give up if I don't throw myself into the deep end... 😛 Benumbed: @Varriount Well that magic worked Benumbed: Test passed Varriount: Araq: I still think assignment precedence should just be changed from left-to-right to right-to-left. From what I can tell, Python, Java, C#, etc all special-case assignment Varriount: *special-case assigment evaluation Araq: cool, do you know what these languages all lack? overloading of assignment. Recruit_main707: Could you write functions like: proc CreateThread(Arg1, arg2...) = Recruit_main707: {.emit:”CretateThread(“ $ Arg1 $ “, “ $ Arg2 $ “)”.} Recruit_main707: To avoid writting wrappers for example? Varriount: Araq: C++ has overloading of assigment (or at least aspects of it) doesn't it? Araq: C++ left the order of evaluation undefined for decaded, maybe C++2020 changed it, not sure Araq: *decades Recruit_main707: can i get the arguments passed to the c compiler without making it error on purpose? dadada: has anyone here done any work with Svelte? It seems interesting. Something like that using Nim instead might be a good idea. PMunch: I had a look at it, but haven't done anything with it Recruit_main707: good and bad news, i got CreateThread to work, i had to copy the c code, put it inside an emit and change the weird function name nim chose for it and manually write CreateThread Recruit_main707: this is the problem with wrappers i guess Araq: Recruit_main707: how come? threads.nim wraps CreateThread for you Recruit_main707: i am using winim's one Recruit_main707: (since i will also be calling those functions if i get it to work Araq: why not use system's createThread? PMunch: There probably is a better way to do that.. alehander92: i heard about svelte alehander92: it might be a good fit but i havent really used it i think Recruit_main707: Araq: i guess ill have to try, but then if i want to, lets say, call MessageBox() i will have the same issue Recruit_main707: PMunch: I hope there is lol, this is ugly af Araq: what "same issue"? Varriount: @Recruit_main707 you still shouldn't need to use emit Recruit_main707: it will not the actual function, but the function that wraps it and i dont know why but it wont work Recruit_main707: @Varriount but still its the only way it has worked properly Varriount: Can you post a link to your sample code? Araq: use .stdcall for your imports etc Recruit_main707: Araq: i already do it. Recruit_main707: its very dirty, sorry for that https://play.nim-lang.org/#ix=2eKm Recruit_main707: compiled with--NoMain --app:lib and arc Varriount: What error do you get if you call Create thread directly, rather than emitting a call to it? Recruit_main707: it will compile, but wont work at runtime Recruit_main707: no error Varriount: Can you post a version of that code? Kvothe87: is there a way to change the extension of a file? i thought of using changeFileExt but it is only returning the string Varriount: Kvotje87: Rename the file? Kvothe87: otherwise i saw the moveFile but it makes a copy if I understood correctly Varriount: What gives you that idea? Varriount: > Moves a file from source to dest. [...] Can be used to rename files. Kvothe87: i read now Recruit_main707: i was making sure i replicated the error: https://play.nim-lang.org/#ix=2eKp Kvothe87: thanks Araq: Recruit_main707: that code is ... unbelievable :-) Kvothe87: I was confused by the name and the parameters Araq: try --tslEmulation:off, it's known to cause problems Recruit_main707: Araq: in what aspect XD Araq: look if you want to create a DLL, use --app:lib Araq: and then Nim will generate the DllMain for you Recruit_main707: i already do it lol, but since i am injecting it, i need to do this manually Araq: are you writing a virus? Recruit_main707: no, its educational purposes Recruit_main707: not my plan at all Recruit_main707: (note there is no sarcasm although it looks like) Varriount: I'm surprised your first code works, as Nim needs to use it's own dllmain Recruit_main707: i compile with --nomain Varriount: I'll take a look at this later. Now I need to sleep Recruit_main707: goodnight, ask someone in discord to @ me if you answer me back, thank you both! Varriount: @Recruit_main707 one last question - what is the goal here? This looks like you're just creating a standard DLL that has it's own thread running in the background of the host process Recruit_main707: intention for now is being able to display a messagebox from the MyThread function Varriount: How is the DLL loaded? Through a random program? Recruit_main707: i made myself an injector, and i also have a random program, sorry for late response Recruit_main707: they both work PMunch: Note that when using --nomain you have to call some Nim setup procedures yourself IIRC Recruit_main707: which ones? Recruit_main707: i mean, my program does work until CreateThread Recruit_main707: aka, it print INJECTION SUCCESFUL PMunch: Possible you need setupForeignThreadGC Araq: uh oh this is a showstopper bug https://github.com/nim-lang/Nim/issues/13698 disbot: ➥ Exception when converting csize to clong ; snippet at 12https://play.nim-lang.org/#ix=2eKB dadada: how do I define a static variable globally, that I can later use in macros and compile time procs? I put a table into a var, that I put inside a static block, but in a macro the compiler says that var is undefined dadada: s/use/use it dadada: s/later/then Araq: use var x {.compileTime.}: T JustASlacker: the nimlang/nim:alpine makes crazy binaries JustASlacker: > ./nginx_vhost JustASlacker: Failed to execute process './nginx_vhost'. Reason: JustASlacker: The file './nginx_vhost' does not exist or could not be executed. JustASlacker: (⊙_☉) krux02_: Araq: just FU krux02_: https://github.com/nim-lang/Nim/pull/13687 disbot: ➥ refactoring and yak shaving. krux02_: closed because of: "I'm happier without this PR." krux02_: WTF? JustASlacker: why would you shave a yak Araq: krux02, we discussed it Araq: I don't want it, I told you Araq: it mixes bugfixes with refactorings and new features, the new features are not backed up by an RFC Araq: it introduces regressions Araq: what's in there to like? Araq: who asked for "oh I am gonna remove usages of system.compiles from the stdlib"? Araq: I certainly didn't krux02: hmm: krux02: Should I quote you on that krux02: Araq: Your words > system.compiles [...] is under-specified in Nim, very tied to the current implementation, and finally, slow. krux02: here: https://github.com/nim-lang/RFCs/issues/168 disbot: ➥ Concepts and type-checking generics ; snippet at 12https://play.nim-lang.org/#ix=23U8 Araq: yeah. Did I say "remove it from the stdlib"? Araq: esp Araq: did I say Araq: "remove it from the stdlib without any provided alternative"? krux02: what? krux02: I did code refactorings Araq: I want typeSupportsOperation instead of 'compiles' krux02: simplified the implementation krux02: and fixed bugs that were required for the refactorings krux02: basically I remove bug workarounds krux02: So you don't want ``$`` to work generically on all types? Araq: you also removed a nice optimization in toSeq krux02: no I din't Goel: Hello, may I ask for help in setting up VS Code? krux02: it wasn't nice krux02: I commented on it krux02: But instead of a review process you used it as a reason to quickly close my PR without further discussions. Araq: "further discussions" krux02: If you can give me objective reasons why this PR is bad, ok. Araq: we discussed it online krux02: But it is "yea I don't feel it" Araq: in disruptek's stream krux02: tell me what is bad about it. krux02: I know we discussed it krux02: you could keep it open like the other 150 open PRs Araq: that's the only reason why I thought I can be harsh krux02: but no JustASlacker: FromDiscord: you did not pick an opportune moment JustASlacker: we are having a nerd standoff krux02: you are specifically against refactorings in the compiler krux02: you are against fixing the bugs in the compiler krux02: or you are specifically against me fixing bugs in the compiler krux02: I don't know krux02: but you are not working professionally here. Araq: yeah right krux02: right Araq: so back to professionalism: how about bugfixes that don't add features? krux02: How about: Do it on your own. krux02: if you only care about a small portion of my PR. Extract it yourself. krux02: I don't care anyomer. krux02: Alternatively, pay me to extract it. I don't need my changes to be upstream. krux02: BTW: if that optimization you are talking about is "so important" how come that it isn't tested? Araq: it's rather hard to test krux02: I know. krux02: still is that an excuse to not build testing infrastructure for optimizations? krux02: Otherwise you never know if optimizations are really applied. krux02: BTW: did you read what I was saying about that optimization? Araq: no I'm looking for it Araq: ok, read it krux02: and? Araq: I don't understand it, it uses the 'len' to safe all the reallocations that 'add' needs to do Araq: *save krux02: yes krux02: but for that to work it first has to copy the argument into `s2` krux02: deep copy. krux02: deep copy can be arbitrarily expensive. reallocations costs of `add` are arguably there, but capped. Araq: that only means that 'evalOnceAs' could be improved Araq: but the real problem is that your solution cannot test for 'is len avaiable' by construction Araq: and that your solution 'let's have $ for every type T' doesn't generalize to 'let's have len for every type T' Araq: system.compiles is a very useful thing Araq: and to be replaced by system.typeSupportsOperation Araq: not by simply nuking it and hope for the best krux02: yes system.compiles is useful, that is why it is everywhere. krux02: I don't want to improve `evalOnceAs` I wanted to get rid of it. krux02: The primary reason for ``evalOnceAs`` is to avoid multiple evaluations of the argument. Araq: sorry this read likes a madman's PR, you take words from me out of context to justify some feature removal that feels totally random to outsiders krux02: Again, I didn't remove any feature. krux02: Pleas stop saying that krux02: I just refactored the code to use a specific feature less. Araq: and evalOnceAs is useful too, except that the implementation must work around Nim's missing borrow checking krux02: And you said it several times. You don't like system.compiles, same as me. You don't like when a PR contains ``system.copiles``. You complain about it in the PR's. Yet when I make a PR that reduces the calls to `system.compiles` you don't like it either. krux02: `evalOnceAs` is crap. Araq: because you didn't replace it with system.typeSupportsOp krux02: there is no `typeSupportsOp`. Araq: exactly Araq: you need to add it first krux02: ok Araq: then you can patch the stdlib to use it Araq: and then we can discuss $ for cyclic refs krux02: but I bet if I actually add it and use it in this PR, you will still not be happy. krux02: You will still complain. Araq: but less so and only because we have no RFC for typeSupportsOp Araq: :-) krux02: Pleas put your review process, requested changes into the PR. Araq: but let me apologize, I was too rude and I'm sorry. I've reopened your PR. krux02: ok krux02: thanks for the apology. Araq: but in the end it should be a couple of PRs. Araq: and there is one more thing krux02: that is? Araq: what happens when we figure out that the implementation of 'typeSupportsOp' in the compiler looks almost the same to the existing system.compiles krux02: that is totally fine. krux02: `typeSupportsOp` can be constrained to only support a specific subset of expressions. krux02: That means it can be specified krux02: it should probably be called `valueSupportsOp` to not conflic with procedures that actually work on types. Araq: or maybe just supportsOp krux02: yea Araq: but the implementation will be messy I think, you might need to instantiate a generic krux02: Btw I found another bug through this PR. Araq: only to throw it away later on Araq: just like compiles currently does Araq: in fact, I know two use cases for 'compiles' Araq: 1) supports operation Araq: 2) "can import" krux02: did you ever realize: ``when compiles(arg.foo): arg.foo`` krux02: instantiate arg.foo, throw it away, instantiate it again. krux02: were you ever bothered by it: krux02: How about this: tryCompile: arg.len else: 0 krux02: then no throwaway takes place. clyybber: Can't we simply make compiles smarter? clyybber: As in cache generic instantiations when it successfully compiles? krux02: clyybber: no the idea is to make things more dumb, so it is easier to use them and know about correct and incorrect behaivor. clyybber: compiles is dumb krux02: it is too smart Araq: krux02, yes, I realized that clyybber: the thing is, ppl don't care that much about generic instantiations so as to use tryCompile instead of compiles clyybber: And afaict it shouldn't break anything to do what I wrote Araq: and now we're getting somewhere and this is turning into a fruitful discussion, thanks! krux02: well I got you to apologize for closing my PR and opening it up again. That is fruitful as well. clyybber: I don't think compiles is too smart if it works as expected clyybber: the compile-time impact is whats bad I guess Araq: clyybber, it used to cache the instantations but that's wrong Araq: I mean, this is not a simple thing and some mechanisms in the compiler only exist so that we could implement system.compiles clyybber: Huh, interesting. Where did it cause issues? Araq: well at least if it fails you must purge the generic instantiation cache clyybber: Yeah clyybber: THat makes sense Araq: but then what does it mean "it fails"? it returns a bool Araq: and that's where krux02's idea comes in Araq: only with 'tryCompiles' we have enough context to do it in a smarter way clyybber: Yeah, just cache it when it returns true Araq: but look, when compiles(a): a else b <=> when not compiles(a): b else: a Araq: it is not all that obvious to me that you can really keep the generic instantiations if returns 'true' Araq: in fact Araq: I'm sure it's wrong for subtle cases where you only check for 'compiles' for a warning message clyybber: Hmm, I don't entirely get it clyybber: I can't imagine a case where it would be broken Araq: I can construct a case but it relies on the fact that generic instantation caching is currently unsound Araq: :P clyybber: Heh clyybber: I see :p clyybber: So we make it sound and then we have a smart and working compiles clyybber: Although probably much harder, it seems like a better option in the long run than expose implementation details and add cruft to system Araq: well it remains true that 'compiles' is underspecified and quirky Araq: and 'canImport' has nothing to do with supportsOp Araq: in fact, I'm sure few people know 'canImport' can be written in today's Nim clyybber: it doesn't seem to me that its "too" underspecified, as its used pretty commonly dadada: interesting discussion dadada: Araq: hey, thanks for the help! now it's working nicely dadada: simple yes/no question: will arc help to catch more bugs at compile time? clyybber: gc:arc by itself no clyybber: in its current state at least Araq: dadada, no but I finally merged my PR that is required for the planned Z3 tool clyybber: The static boundchecking? Araq: yeah clyybber: Nice Araq: instead of our custom "guards.nim" proof engine, replace it by Z3 Araq: and there you go. Araq: https://gist.github.com/Araq/69355d41f1c2d3dae461bade4e8d0591 if you want to tinker with it Araq: it's much fun krux02: Araq: I have a prototype implementation for `tryCompiles` krux02: http://ix.io/2eL3 krux02: it is implemented with macros now. krux02: could be lifted to compiler internal. dadada: what else could you be doing with Z3 inside Nim? clyybber: krux02: Ok thats kinda cool ngl :D krux02: yea it is a first proof of concept. Araq: dadada, I thought about adding precondition, postcondition, invariant pragmas dadada: Araq: something like ada/spark is doing? Araq: yeah Varriount: krux02: Since when do objects have a length? dadada: that would make Nim attractive to billion dollar industries, so it's a splendid idea krux02: they don't dadada: people building machines that fly in the air, or medical devices want such stuff krux02: Varriount: in generic code you often don't know if you can call `len`, so you do something with ``when compiles``, this is a pattern that works without ``when compiles``. clyybber: Araq: Hey, its really smart! Araq: clyybber, yeah I agree Varriount: krux02: How does that macro work? I can see that it creates a template.. and then calls it? How does that test whether a procedure can be called on a variable? Araq: bbl guys krux02: Varriount: it works via overload resolution. krux02: it creates the template with the same name as the call in the argument, and then hopes that it isn't picked in overload resolution krux02: the template should not be picked, because it's argument is `untyped` krux02: it should be lowest priority. krux02: But by puttin the template there it ensures that every call can be resolved krux02: there won't be a compilation error Varriount: Huh, I would have thought the template would always be chosen, since it's in the same scope as the call krux02: well, no clyybber: But the most specific overload will be chosen krux02: yes clyybber: So untyped will only be chosen as a last resort krux02: that is the idea here clyybber: thats how it works krux02: ^^ thanks Araq: don't you care to critic C++ ever again, krux02 :P it taught you so many things krux02: well I will critic C++, but not for that part. Araq: clyybber, you can iterate over two arrays in parallel via 'for i in 0..min(a.high, b.high)' Araq: at least you should be able to... this thing needs tests clyybber: Araq: Did you hardcode that for `min` ? clyybber: Looks like it axion: Is there a style convention for max number of columns? 80 seems like it might be too little for type parameters and annotations narimiran: axion: show us the code you think you cannot keep inside 80 characters axion: If only because the compiler does not like the parameter list on a different line than the type parameters' closing bracket delimiter axion: Well for example, this barely fits, and it isn't nearly the most complicated signature I have: proc init*[N: static[int], T: Vec[N]](t: typedesc[T], v: Vec): T {.inline.} = clyybber: just ignore the style convention :p clyybber: I find 80 to be pretty tight too axion: Some may argue that that convention is only the norm because of ancient terminals, but these days we have virtual terminals (our editors split windows to maximize code visible), and it just so happens 80 allows me to fit 4 files side by side at a comfortable font size matrixbot: `alehander42` yes it makes sense disruptek: 80 please. axion: 100 for me until the compiler is more lenient on where line breaks in a signature can occur Rika: i use a mix of 80, 100, and 120 Rika: 90% should fit within 80, 95% in 100, and none past 120 narimiran: btw, @Rika, do you know about 90-9-1 rule? Rika: what ._. narimiran: you could have used it here ;0 narimiran: https://en.wikipedia.org/wiki/1%25_rule_(Internet_culture) Rika: that works too narimiran: 90% under 80 columns, 99% under 100 columns Rika: maybe ill switch to that, maybe also write a vscode extension for showing % data too on the bottom' Rika: AH NO im piling up projects again ;; Recruit_main707: is there something opposite to gcsafe pragma? Rika: removing it lol Yardanico: @Recruit_main707 not that I know of, but why would you ever need one? :P Recruit_main707: i am not using it (explicitly) but either exportc, dynlib or stdcall adds it Recruit_main707: i know it bc of the new wrapping meta XD (this works btw) Recruit_main707: {.emit:"#include ".} Recruit_main707: proc CreateThread*(arg1: (proc(x: pointer): int32 {.stdcall, gcsafe, locks: 0.})) = Recruit_main707: {.emit:"""CreateThread(NULL, 0, arg1, NULL, ((NI32) 0), NULL);""".} Yardanico: why do that? Yardanico: nim wraps OS-specific APIs for thread creating Recruit_main707: {.stdcall, gcsafe, locks: 0.} this pragmas appear of {.exportc, dynlib, stdcall.} Yardanico: well gcsafe is automaticallly added to all procedures which the compiler considers to be gcsafe Yardanico: or maybe not, lemme check Recruit_main707: Yaradinco: i will be using a lot more functions of windows, and using it this way i know exactly what it is doing Yardanico: why make your program win-only :( Recruit_main707: its dll injection :p if i develop serious apps ofc they will be universal <3 Recruit_main707: well, if anyone knows if i can disable that gcsafe pragma, pls let me know kelly: https://nimble.directory/ is down Yardanico: federico3 ^ zetashift: yep down for me too axion: If I have a file that is only intended to be `include`d in another file, should I still import stuff required for that file? Not doing so causes my `nim check` on file save to yell at me of course. What's the common thing to do here? Yardanico: it's not required federico3: :-/ disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: yet more hilarious hijinks with backend caching. dadada: can proc/template/func/macro definitions be revoked? ie. use a custom overload for add() in this one part of a source file (for example for debugging), but then revoke it's existance from a certain line on, so its not overloading anything anymore? Rika: why? Rika: scope it Recruit_main707: i actually like how wrapping with emit works. <- as a side note. how can i convert "w" into `char` and is it possible to convert an string like "adssfs" into char? zacharycarter: disruptek: yeahhhhhhh tribe zacharycarter: I dig it silvernode: Can I put a table inside of a sequence? krux02: why not? silvernode: krux02: I figure I can but not sure how to write it. narimiran: silvernode: show us your current code krux02: silvernode, what you you mean, not shur how to write it? krux02: write the seq to disk, or write into the table in the seq? silvernode: I don't really have current code attempting this yet silvernode: I have a seq inside of a type, and I want the seq to contain a table silvernode: but the sy7ntax is what I am trying to find silvernode: syntax* Recruit_main707: {.inline.} cannot force the compiler if it doesnt want to right? narimiran: `seq[Table[Key, Val]]` Rika: ^ dont forget to `import tables` silvernode: Is table a type itself similar to other types like int, string...etc? narimiran: silvernode: similar? yes. disruptek: disbot: you alive? disbot: yep. 😊 disruptek: is disbot taking a vacation day? silvernode: narimiran: That's what I was trying to figure out basically. I tried typing 'table' but it did not appear to be a type so I started searching the internet and failed to find what I was looking for. narimiran: Table. with a capital T. narimiran: silvernode: start here: https://nim-lang.github.io/Nim/tables.html silvernode: yep, I see that now. I was not exapecting that syntax since I think that means it is a custom type. silvernode: wow I read that and missed the part I was looking for. Rika: tables are a "custom type" Rika: you mean "non-primitive" Rika: some languages dont have a primitive table/dictionary/hashmap type, eg. Nim and JavaScript narimiran: **ANOUNCEMENT** beta-version of Nim v1.2 is ready, you can currently build it from https://github.com/nim-lang/Nim/tree/version-1-2 (pre-built nightlies will follow later today) Rika: WOAH Rika: earlier than i expected... narimiran: @Rika when did you expect it? :) Rika: may Rika: or april idk it just feels early narimiran: it is 6 months since 1.0.0 Rika: wtf Rika: no way Kvothe87: stable is still 1.06 right? narimiran: @Kvothe87, yeah, until 1.2.0 is publicly officially released (next week). PMunch: (note: we skip odd numbers for releases in Nim, so 1.2.0 is the next step after 1.0) kelly: is there a changelog? PMunch: Shouldn't we also have started on 2.0 for consistency though? narimiran: for now: see changelog.md Rika: i think it only applies for the minor version level narimiran: minor and patch Kvothe87: by the way, another question i just checked my nim -v and got 1.0.4. Run choosenim update stable and it says Already up to date at version 1.0.6 narimiran: are you sure you're using choosenim's nim, and not some other? narimiran: what does `which nim` say? Kvothe87: i get an error Kvothe87: i'm running it from vscode on windows Kvothe87: in case it makes a difference narimiran: i don't use neither, so somebody else might help you more kristianmandrup: How do I convert an emit into a node tree for use in a macro? kristianmandrup: I think there was a helper, sth like `quote` ?? kristianmandrup: https://nim-lang.org/docs/macros.html#quote%2Ctyped%2Cstring kristianmandrup: var importNode = quote do: ⏎ ⏎ ```{.emit: esImportImpl(name, nameOrPath).}``` ⏎ ⏎ result.add(importNode) [https://gitter.im/nim-lang/Nim?at=5e74ffea1856e0543a9828ad] kristianmandrup: `Error: cannot add to node kind: nnkEmpty` kristianmandrup: https://play.nim-lang.org/#ix=2eM9 kristianmandrup: Getting: ` invalid pragma: var x: string` dumjyl: You can't just add a NimNode to emit. It expects a string, or an array of strings and symbols. dumjyl: Oh, you probably just wanted to make result a stmt list first. kristianmandrup: result.add(body) krux02: that emit looks fine to me kristianmandrup: Aha, stmtlist first then add as children. Makes sense :) kristianmandrup: so create newStmtList and add to result krux02: kristianmandrup in the past your code used to work krux02: quote do always returned a stmtList krux02: then the stmtList got "optimized away" because why not, and my code stopped to work. kristianmandrup: hmm, krux, I think I need to use a factory function to create empty stmtList, then add each node as stmt, right? kristianmandrup: https://nim-lang.org/docs/macros.html#newStmtList%2Cvarargs%5BNimNode%5D krux02: well you can also use, nnkStmtList.newTree(args ...) krux02: but yes shashlick: @kristianmandrup: run choosenim 1.0.6 kristianmandrup: aha shashlick: or choosenim stable for that matter kristianmandrup: ```var stmts = newStmtList([ importNode,body, assignNode]) ⏎ result = stmts``` [https://gitter.im/nim-lang/Nim?at=5e75046cb1a349586b94fabc] krux02: result = newStmtList(importNode, body, assignNode) kristianmandrup: ok, will try krux02: or result = nnkStmtList.newTree(importNode, body, assignNode) krux02: I really do like `newTree` because it just works kristianmandrup: Thanks krux, works like a charm :) kristianmandrup: except now I get kristianmandrup: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e7505d411acde77423a9b29] Kvothe87: how can i check if the nim compiler i have is version 1.0.6 or 1.0.4? nim says 1.0.4 while choosenim says 1.0.6. is there any file that i can directly check? kristianmandrup: `$x` ? Yardanico: echo NimVersion kristianmandrup: https://play.nim-lang.org/#ix=2eMh Yardanico: @Kvothe87 ^ krux02: kristinmandrup: that one I don't know Kvothe87: @Yardanico thanks. I confirm that i have 1.0.4 don 't know why choosenim says differently Rika: are you sure you're only using choosenim Rika: and not choosenim + a local/packagemanager installed version kristianmandrup: simplifying it to dynvar: https://play.nim-lang.org/#ix=2eMj Kvothe87: could be but i cannot find any other nim on the computer Araq: krux02, no, not "because why not", but because this way we fixed some other different bug Araq: usually stuff is changed in order to fix bugs Araq: as we have more important things to do than random changes / "refactorings" ;-) kristianmandrup: how do I set the output file, such as `test.mjs` kristianmandrup: I think there was an `--outfile` option? kristianmandrup: I kind of got nim to work with ES modules: https://github.com/kristianmandrup/esmodule_nim kristianmandrup: `arguments can only be given if the '--run' option is selected` when I try to use `--outfile` option kristianmandrup: but I want to use it for compile only Varriount: KristianMandrup: Put outfile before the target file to compile, not after Varriount: `--outfile:someFile. mjs mainFile.nim` Varriount: *someFile.mjs rayleyva: Hi all. I'm trying to script out a few things that are currently done via shell scripts. ⏎ It uses various tools to control cloud images, and then uses ansible for provisioning. ⏎ Is this possible within execShellCmd, or using osproc? rayleyva: Sample: https://play.nim-lang.org/#ix=2eMo Varriount: It should be. Are you encountering any specific kind of problem? rayleyva: Mostly unable to activate the conda enabled Python environment that holds all the Ansible tools. rayleyva: I'm not understanding the internals of how it shells out to execute the cmd. Recruit_main707: can i force the compiler to not ignore {.inline.}? leorize: nope leorize: it's not always good to inline leorize: sometimes that's not even possible leorize: axion, narimiran, disruptek: I've pushed a new branch called indent-rewrite, please switch over and test :) Recruit_main707: its for debugging purposes, i guess it doesnt affect the program, but with emit it would be way easier leorize: and for you, disruptek, just look for 'case' inside that file until you find the tweak I left there for you leorize: you can read this for a brief: https://github.com/alaviss/nim.nvim/commit/4930fb88c2032bf17991d85145ae3fc7a26f3205 leorize: Recruit_main707: wow, you're the first to say that it's easier :P leorize: oh, if all the nimFrame annoys you too much, build with --stacktrace:off Recruit_main707: oki krux02: Araq: I am not doing these refactoring because I don't have anything better to do. I am doing those refactoring in order to fix things. Araq: krux02, never meant to imply this Araq: you said "because why not" and I said "that's never the real reason" krux02: Araq: Well ok, "why not" is not the real reason. The real reason is ugly code is often workaround code for bugs. My mantra is, remove the workaround and address the bugs. krux02: That is why in my PRs refactorings always conflate with bugfixes. The bugfixes are directly related to the refactorings. krux02: Araq: gdb can go back in time Recruit_main707: noob question (i am still getting used to pointers) i have var f: ptr File how should i close(f) Rika: f[].close() maybe Rika: wait ptr Rika: dunno~ leorize: why do you have a ptr File? leorize: :P Recruit_main707: ask the C function leorize: just close(f[]) leorize: oh then it's just File leorize: File itself is a ptr :P leorize: unless it said `FILE**`, then use `File` Recruit_main707: i know, but for some reason the creator of reoen_s decided passing a pointer of a pointer of a file was great leorize: can't you just use system.reopen? :P Recruit_main707: idk, but now it works, also since i am messing with very low level stuff, using emit and playig it safe is the option i consider the best leorize: well, you can start replacing those things with higher level operation once you found the things you make start biting you leorize: {.emit.} is always a bad idea imo Recruit_main707: i am wrapping things with it and if inline actually worked it would end up being pretty clean leorize: inline doesn't do what you think it does... leorize: and emit is a terrible way to wrap things Recruit_main707: why terrible Rika: merely it being emit is enough to make it pretty bad 😛 there are other better ways of wrapping isnt there? Recruit_main707: to be fair, emit is the only thing it has worked for me + keeping things pretty simple (not wrapping types) shashlick: Recruit_main707 what are you wrapping Recruit_main707: kernel32 functions shashlick: Have you tried c2nim and nimterop already? leorize: shashlick: you can't wrap kernel32 functions with those tools Recruit_main707: its a dll Recruit_main707: well... leorize: it's a microsoft thing :) you don't get the header, but microsoft expects everyone to be able to use them :P Recruit_main707: there is windows.h shashlick: Isn't all that already wrapped in winim leorize: they said that doesn't work leorize: oh... I think I know why now Recruit_main707: i tried winim (for a few days tried to make it work) leorize: winim uses {.dynlib.} leorize: which will try to load "kernel32.dll" into the process (again?) leorize: though that's just a theory :P Recruit_main707: hmmm, its a bit weird but maybe leorize: well --dynlibOverrideAll can be used to disable that shashlick: What was the original issue shashlick: I've used a lot of winim in feud krux02: cast[pointer](value) == nil Recruit_main707: shashlick, functions wont work as expected Recruit_main707: i am not getting actual errors back shashlick: might be a repeat performance but can you share something I can look at shashlick: i found winim to work wonderfully Recruit_main707: winim works well, but not with injection shashlick: what do you mean by injection Recruit_main707: dll injection shashlick: you mean loading a nim dll into a nim main program? shashlick: you need to use --gc:boehm - that's the only way today to get it working Recruit_main707: i amusing an injector, allocate memory in a program (not nim necesarily) and run my DllMain shashlick: in feud, i have a main Nim exe which loads a Nim dll which has all the windows calls shashlick: so where does wrapping windows procs come into the picture and how does it interact with this dll krux02: Varriount: https://github.com/nim-lang/Nim/pull/13277 narimiran: v1.2-beta nightlies are now also available: https://github.com/nim-lang/nightlies/releases/tag/2020-03-20-version-1-2-579e34e sheerluck: I tried Nim Compiler Version 1.2.0 [Linux: amd64] Compiled at 2020-03-20 and it just worked. sheerluck: Then I added --gc:arc -d:useMalloc to nim.cfg sheerluck: ... and got `Error: type mismatch: got but expected 'seq[byte]'` sheerluck: oh wait, it's `nimble install [email protected]#head --verbose` sheerluck: it has nothing to do with nim-1.2.0 disruptek: good, thanks for testing. disruptek: it's a gorgeous day here. breezy, 70-something degrees, and sunny. the town so quiet that all your can hear is the plague spreaders. disruptek: playing. disruptek: imagine how many thousands of people we will be finding dead in their homes in just a few weeks. sheerluck: ok it's too soon for me to use `--gc:arc` bc when it's on my `stream.close()` in my `finally:` leads to `SIGSEGV (Attempt to read from nil?)` disruptek: it's a stdlib stream, right? disruptek: can you create a playground repo? sheerluck: disruptek it's https://github.com/sheerluck/Toy-Nim-Project-with-Kaitai disruptek: you know about sealmove's work, right? sheerluck: yes disruptek: but what does it do? disruptek: ls for mkv? sheerluck: kinda Rika: Anyone made a vs code extension with just nim? disruptek: i think the extensions are made against lsp. leorize: lsp won't solve everything disruptek: very unsure about that. disruptek: i just mean, that's what the vscode ones are made against so far. leorize: the vscode one uses nimsuggest directly leorize: the vscode plugin predates nimlsp :P disruptek: oh, cool. Rika: ? I mean using Nim instead of ts and js leorize: well lsp don't give you any indentation hints and things like that leorize: @Rika: it predates the js backend so I'm pretty sure no one tried :P Rika: Ah shit, time for a compatibility library? leorize: yep Rika: I'm lazy, someone else do it LOL Rika: I have too many projects to manage basically disruptek: leorize, how do i search for uses of a symbol? that's what i wanted to ask you days ago. 😁 leorize: :NimReferences leorize: if that doesn't work then `*` is a way to look for it in the current file leorize: @Rika now you know why it's not done :P disruptek: that one makes me have to hit enter. disruptek: what's up with that? leorize: the star thing? disruptek: yeah Rika: Semantic highlighting on Nim when leorize: use nim.nvim disruptek: should i expect :NimReferences to work? Rika: On vscode ;; though I was learning vim a while back Rika: I liked most of the vim things it's just that skill slope tho leorize: disruptek: sorta, the compiler is janky when it comes to complex sources disruptek: i forgot what it was like to work without people watching me. leorize: disruptek: can you try editing ftplugin/nim.vim:112-113 leorize: change :execute -> :silent execute leorize: I only get the enter thingy once everywhile, so I'm not sure what caused it disruptek: i'm not supposed to be on the new branch, right? leorize: it's fine there leorize: or did you found a bug? disruptek: no, i wasn't on there. just wanted to pull and make sure i'm up to date. leorize: ah ok :) disruptek: why is my outline window so tiny? leorize: it just uses the location list leorize: I think it depends on your settings ggibson: What's the trick to using a nim shared lib from C? nim proc has {.exportc.}, the c code includes the generated header and calls NimMain() okay, but it can't find my actual fn definition. leorize: ggibson: add {.dynlib.} too leorize: disruptek: are you on the new branch? disruptek: leorize: i'm on master. leorize: if you have time, can you try the new branch? disruptek: i merged in the case: change; i've been carrying it. disruptek: sure. ggibson: What the new branch? I just DL the nightly for Windows a few hours ago. leorize: disruptek: the new branch have the case change, just /case for it leorize: I disabled it by default :P disruptek: what's it called? ggibson: ah not talking to me :p @leorize that was it :facepalm: leorize: disruptek: indent-rewrite leorize: ggibson: :P we are talking about nim.nvim, the neovim plugin :P disruptek: doesn't seem any different yet. leorize: it's just a rewrite of the indent module with one new feature built in leorize: let me know if there's any bug leorize: the new structure makes it easier to add features to the plugin ggibson: @leorize Thanks. Fastest help ever (sub 1 second!). Gold star. leorize: you're welcome :) Varriount: One day I will improve the nimlime plugin... one day IanIAnIAN: whoever made nimjson, thank you for saving me from dotnet Varriount: nimjson? Is that different from the built-in json module? Yardanico: maybe https://github.com/jiro4989/nimjson ? Yardanico: yeah, not the best naming but its ok :P enthus1ast: hey i was bored during this corona crisis, i've hacked some html post hack thing: http://hackrshit.chickenkiller.com/ Rika: better name would be probably "jsonscheme" or so Rika: enthus1ast, why tho? What's it do? Varriount: Or json2nim enthus1ast: it allowes to push html (including css and js) to me and distribute it IanIAnIAN: it does enthus1ast: bad idea i know but lets see :) awr1: hello, is there a variant of `quote do:` for macros but untyped? dumjyl: multiple but none merged into the stdlib. dwdv: What's the difference between --panics:on and -d:danger? leorize: --panics:on crashes your program when someone raises a Defect leorize: -d:danger disable runtime checks for that ultimate performance dwdv: Ehm, I might be especially dense, but doesn't that lead to the same result? leorize: no leorize: -d:danger make things like overflow or out of bounds becoming unchecked dwdv: Oh, I see. dwdv: Thanks for clearing that up. leorize: np :) voltist: Is there a good source of documentation for Nim's locks module beyond https://nim-lang.org/docs/locks.html? rayman22201: the Nim in Action book: https://livebook.manning.com/book/nim-in-action/chapter-6/239 rayman22201: but what question do you have? leorize: related: https://nim-lang.org/docs/manual_experimental.html#guards-and-locks voltist: Thanks, ill have a look at those voltist: I'm basically just trying to understand how to use it rayman22201: @axion and @Rika, I got a mostly working version of the genComponentWise macro: https://play.nim-lang.org/#ix=2eDI rayman22201: bad news: it requires the experimental pragma. I don't see a way around that. Other bad news, I think Nim has a bug where it "loses" the default value to extra params. I'm trying to create a minimal repo so I can report that. voltist: Is there a way to make the compiler give more information as to why a proc is not GC safe? voltist: As in what variables it is trying to access leorize: there aren't any, I think leorize: one day --gc:arc will be the default and you won't have to deal with all this gcsafe thing voltist: What does --gc:arc do? leorize: ~arc disbot: arc: 11a new memory manager for Nim; see https://forum.nim-lang.org/t/5734 rayman22201: bug reported: https://github.com/nim-lang/Nim/issues/13688 disbot: ➥ Cannot retrieve the default paramater value of a proc from inside a macro ; snippet at 12https://play.nim-lang.org/#ix=2eDK voltist: So how could --gc:arc remove the need to deal with gcsafe stuff? leorize: because it uses a shared heap rayman22201: all threads share a heap with --gc:arc, voltist: Ah I see voltist: Would that mean that var parameters would work with threads as well? leorize: no, that's a different issue voltist: Fair enough. Is FlowVar still needed with --gc:arc? leorize: yes :P leorize: though the data passing can/will be made lighter as the "copy everything" restriction won't hold anymore voltist: Cool rayman22201: FlowVar is a way for threads to talk to each other and let each other know they are done. It's a signaling mechanism. voltist: Yeah got it, I just thought this new system might come with some convenience procs/templates/macros to make it all a bit more tidy voltist: I'm going to live life on the edge and switch to devel so I can try --gc:arc rayman22201: 🎉🎉🎉 voltist: Hmmm https://hastebin.com/mokimadore.makefile voltist: Idk why that came up as .makefile voltist: But it has Nim compiler output in it voltist: Any thoughts on the error? I was using --gc:arc slymilano: I install Nim using choosenim on windows, choosenim-0.6.0_windows_amd64.zip - when I run `nim -v` I get Nim Compiler Version 1.0.6 [Windows: i386] - so I can't compile because of the `error: size of array 'Nim_and_C_compiler_disagree_on_target_architecture' is negative` error. How can I install Nim 64 bits compiler so it works? leorize: !repo threadpools disbot: https://github.com/yglukhov/threadpools -- 9threadpools: 11 15 15⭐ 7🍴 leorize: voltist: I'd advise you to use this instead ^ leorize: it's the threadpool that actually works voltist: Huh ok, why is it off in a nondescript repo rather than the standard library? leorize: the author didn't want to merge this because they feel that they could do it better leorize: but as of now it's the best :P leorize: well the best that works with the gc leorize: !repo weave disbot: https://github.com/mratsim/weave -- 9weave: 11A state-of-the-art multithreading runtime: message-passing based, fast, scalable, ultra-low overhead 15 131⭐ 9🍴 leorize: ^ that one is the best voltist: Oooo ill try that out leorize: @mratsim wrote that it's not GC-tested (yet), though --gc:arc might change this voltist: I shouldn't have to worry too much for my application voltist: Does weave work with var parameters? leorize: var parameters can never be passed to thread leorize: this is by design, unfortunately leorize: since the parameter might went out of scope while your thread is executing voltist: Sure ok, but at least weave is easier on the eyes timotheecour: @leorize are you here? leorize: yep timotheecour: so i think your changes to .gitattributes in https://github.com/nim-lang/Nim/pull/13670 are causing complications for existing PR's disbot: ➥ Disable Github Actions CI leorize: well 4raq got rid of it leorize: but what was the problem? timotheecour: in latest devel: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e72da2453614f269bc8f8cd] leorize: that's weird leorize: I guess they should be put per directory timotheecour: here: https://github.com/nim-lang/Nim/issues/13690 disbot: ➥ changes to gitattributes cause weird errors ; snippet at 12https://play.nim-lang.org/#ix=2eDV timotheecour: this actually affects a lot of my PR’s after I rebase, and I don’t see simple way to fix them leorize: are you on windows? timotheecour: OSX leorize: hmm, git shouldn't mess with EOL on osx timotheecour: i think the problem is that these files had prexisting CRLF, and after your changes it surfaces those errors leorize: well just stash them and pop it after switching branch leorize: you'd have thought that in 2020 tools wouldn't pay too much attention to CRLF timotheecour: i’m not saying your change was bad, i’m saying we need to fix https://github.com/nim-lang/Nim/issues/13690 so it doesnt’ affect ppl w weird errors when they rebase or checkout a different branch disbot: ➥ changes to gitattributes cause weird errors ; snippet at 12https://play.nim-lang.org/#ix=2eDV timotheecour: maybe the fix is to commit changes to thos 2 files wo CRLF; let me try that leorize: so 4raq dropped the file because git on his PC was acting weird leorize: must be due to that voltist: "Error: cannot create a flowVar of type: Worm". What about an object would make it not work here? disruptek: worms are notoriously lazy. timotheecour: right might be due to a96842a timotheecour: @leorize git stash doesn’t help: ⏎ cat -ve tests/tools/second.nim ⏎ import tables^M$ ⏎ ^M$ ⏎ let dataEx* = {1: 2, 3: 4}.toTable^M$ [https://gitter.im/nim-lang/Nim?at=5e72e0da9b8c8a1ef3857134] timotheecour: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e72e0f6f7268f29190df0d7] leorize: so git stash is crlf aware, but not every other git command leorize: maybe you gotta ask the git experts :P shashlick: @slymilano: what's your version of gcc? leorize: shashlick: do you wanna look into moving nightlies onto github actions? leorize: comparable speed to azure, and a ton of concurrent jobs timotheecour: actually is there a reason nightlies can’t be run alongside nim CI, to avoid weird issues where nim CI passes but nightlies (later…) fail? timotheecour: Hi @genotrance I’m not sure I understand your comment here https://github.com/nim-lang/nimble/issues/783#issuecomment-600968134 ; https://github.com/nim-lang/nimble/issues/783 is currently an issue and I’m not sure what is your alternate fix instead of https://github.com/nim-lang/nimble/pull/781 disbot: ➥ show cmd used with --verbose (even on success); fix #783 ; snippet at 12https://play.nim-lang.org/#ix=2eE8 leorize: genotrance is shashlick timotheecour: right; @shashlick see above note shashlick: nightlies take a long time shashlick: but ya, it should be fine to move it shashlick: @timotheecour - let me play with the CI and get back to you, please remove that change though shashlick: I meant the travis.sh gist history shashlick: okay, please revert that change and let me know, i'll test that job and get back to you Knaque: Hey, quick question from someone who knows basically nothing about JS. Nim's JS compilation seems... really bulky. 133 lines for the equivalent of 4 console.log()s. Is this something I need to be worried about? (In terms of speed, mainly.) leorize: well there was a real world comparison somewhere on the forum leorize: https://forum.nim-lang.org/t/2991#18807 leorize: this was when the js backend was new leorize: so expect that things have improved since leorize: tl;dr: fast Knaque: Sounds good to me. timotheecour: @shashlick could you convert your gist to a repo, it’s just way more standard (eg could accept PR’s, issues etc), especially since it’s used by nimble; https://gist.github.com/genotrance/fb53504a4fba88bc5201d3783df5c522/revisions has a bunch of changes so I’m not sure which one you’re referring to timotheecour: > please remove that change though ⏎ ⏎ if I remove my change, https://github.com/nim-lang/nimble/pull/781 ’s CI will fail, but I’m guessing you just need to update your gist to my version https://gist.github.com/timotheecour/fff49b1102659eedcbc2762bc201b375 ; (in any case, this should be a real git repo instead of a gist) disbot: ➥ show cmd used with --verbose (even on success); fix #783 ; snippet at 12https://play.nim-lang.org/#ix=2eE8 shashlick: i want to verify that deleting the cache and running it again fixes the issue with the gist as it is shashlick: cannot do that without you removing that change shashlick: will take 30 minutes to confirm timotheecour: which change? shashlick: the same gist is used in many repos timotheecour: I didn’t change anything, all I have are PR's shashlick: the choosenim $BRANCH line in your PR timotheecour: you don’t need that to test the fix, see https://github.com/nim-lang/nimble/issues/783 ⏎ ⏎ > not sure about "always" but that's my best guess: ⏎ > see #782 which really should be a noop. [https://gitter.im/nim-lang/Nim?at=5e72f371f7268f29190e1509] disbot: ➥ [CI] travis always fails for nim=#hash after the 1st run ; snippet at 12https://play.nim-lang.org/#ix=2eEg timotheecour: deleting the cache seems like the wrong fix AFAIK. IMO the better approach is to fix the gist (especially if used in other repos) as I did here https://gist.github.com/timotheecour/fff49b1102659eedcbc2762bc201b375 ⏎ => all i did was add 1 line `choosenim $BRANCH` shashlick: I have no problem adding that to the gist but it didn't work in isolation shashlick: if that's all it takes, let's add it to the gist timotheecour: > it didn't work in isolation ⏎ ⏎ the 1st time will succeed for a new PR (because the cache won’t be used for a new PR), as I explained in https://github.com/nim-lang/nimble/issues/783 ⏎ ⏎ > if that's all it takes, let's add it to the gist ... [https://gitter.im/nim-lang/Nim?at=5e72f4718efb7417d7c971e1] disbot: ➥ [CI] travis always fails for nim=#hash after the 1st run ; snippet at 12https://play.nim-lang.org/#ix=2eEg timotheecour: trying it in https://github.com/nim-lang/nimble/pull/781/commits/8bec86039d8335af152acf238ab14d0268e003e5 to check if works disbot: ➥ show cmd used with --verbose (even on success); fix #783 ; snippet at 12https://play.nim-lang.org/#ix=2eE8 shashlick: cool let me know how it goes - prefer everything being in the sh script so that the yml files are minimal shashlick: I've updated the gist timotheecour: keeping yml files minimal is a good thing, that’s not my concern, my concern is using gists for that instead of standard practice which is a git repo, which enable the usual workflow (PRs, issues, etc) rayman22201: @axion, @Rika, learned a workaround and fixed the default param issue. Best version of this macro yet (still a beast though): https://play.nim-lang.org/#ix=2eEr rayman22201: bah: https://play.nim-lang.org/#ix=2eEt silvernode: Is there a "foreach" keyword in nim? narimiran: silvernode: `for x in xs:` silvernode: ok thanks, just checking gogolxdong: `undefined reference to '__builtin_saddll_overflow'` gogolxdong: `undefined reference to '__builtin_saddll_overflow'` isn't the falut of gcc, compile with 7.3.0 has the same problem. Araq: gogolxdong: https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html gogolxdong: Does 7.3.0 have these builtins? Araq: it should, GCC 5 introduced them gogolxdong: Have no idea how to fix this except to migrate OS to ubuntu18.04 or centos8. It's fine in ubuntu18.04 sheerluck: wait a month and migrate to ubuntu 20.04 gogolxdong: build gcc7.3.0 from source ,probably miss something. sheerluck: gcc-9.2 in ubuntu 20.04 Araq: gogolxdong: we can add a workaround sheerluck: http://cdimage.ubuntu.com/daily-live/current/ sheerluck: ((https://i.imgur.com/6B0ieyW.png)) gogolxdong: found a page says it's a known issue of centos default gcc. timotheecour: Link? gogolxdong: https://wiki.swoole.com/wiki/page/1013.html it's in Chinese. Araq: unfortunately we cannot use __has_builtin to detect the feature as __has_builtin is too new... gogolxdong: this solution doesn't work either. Araq: but if your GCC 7 lacks it we cannot use a version check either gogolxdong: then question becomes how to build gcc with these builtins? silvernode: Is there something like sleep() in nim? I am just trying to slowly step through a while loop, maybe I should just use a for loop sheerluck: silvernode https://nim-lang.org/docs/times.html silvernode: Ah there it is, thank you much sheerluck: @gogolxdong I reckon it's faster to migrate to ubuntu 20.04 then to build gcc in centos. And even more reliable. gogolxdong: building gcc takes three-four hours, sure migration is faster, just try fixing this. gogolxdong: yeah, my production enviroments are all in centos7. Araq: gogolxdong: I'm addinga workaround Araq: https://github.com/nim-lang/Nim/pull/13692 once this is merged use disbot: ➥ added a switch -d:nimEmulateOverflowChecks for broken or old GCC vers… Araq: -d:nimEmulateOverflowChecks to compile leorize: dom96: can I get your blessing for #13682? disbot: https://github.com/nim-lang/Nim/pull/13682 -- 3httpcore: deprecate `==`(string, HttpCode) Araq: leorize, merged it alehander92: Araq alehander92: i am trying to imagine how raises tags would look like for my app alehander92: can we combine 3 effects into one alehander92: e.g. each async function can raise A, B, C => just combine into AsyncError alehander92: so i dont have to annotate too much leorize: @timotheecour: the "better" way would be to set -text on every file leorize: that's the short hand for "don't touch their line endings" leorize: nim itself don't care about crlf, and files that needs to be lf-only would already be commited as lf into the repo leorize: so it's better to just take them verbatim and tell git not to mess with it PMunch: alehander92, you might be able to make a pragma pragma to combine them: https://nim-lang.org/docs/manual.html#pragmas-pragma-pragma PMunch: Or you could of course create an exception hierarchy with AsyncError on the bottom alehander92: love you alehander92: pragma pragma makes sense, ohhh timotheecour: @leorize are you referring to https://github.com/nim-lang/Nim/pull/13693 or to https://github.com/nim-lang/Nim/issues/13690 disbot: ➥ changes to gitattributes cause weird CRLF errors ; snippet at 12https://play.nim-lang.org/#ix=2eEG alehander92: hey alehander92: so async raises alehander92: Exception i guess because field error can be almost anything alehander92: await* sorry alehander92: hm, at least in the template impl, but i'd guess with rewriting as well alehander92: if we can just annotate generic Future[T] {.R.} alehander92: and somehow raise only R from each await for each futurre alehander92: but then we need to still add some effects for the async processing : e.g. i dont know what can happen, NonComplete , OsError ? etc alehander92: the problem is with return types alehander92: this seems a bit easier but still you cant catch the async errors as they happen when its yield-ed alehander92: so does anyone have an actual plan how async can be checked? or am i missing something? alehander92: in the javascript backend we can just add await to raise the call defects + a general JavascriptAsyncError or AsyncError i guess alehander92: so this might be easier there flywind: what does this mean? https://play.nim-lang.org/#ix=2eEP flywind: Error: system module needs: nimErrorFlag flywind: when i use 2020-03-17 nim devel and --gc:arc, I can't compile some programs which can run in old devel with --gc:arc flywind: find reasons.Because --gc:arc can't work with --threads:on. Araq: flywind: I fixed that yesterday Araq: but there is also as a workaround: --tlsEmulation:off Araq: which is a good idea anyway, tlsEmulation is slow flywind: Thanks.I'll try. Araq: alehander92: afaik Rust and Swift make the error part of the Future type just like Nim because Either[Future[T], Error] is much too annoying to work with Araq: so if it returns Future[T], well, the future can be in the "failed" state, deal with it Araq: and 'await' does deal with it for you alehander92: thanks alehander92: i'll have a look at rust/swift alehander92: but if I use {.raises: [..].} for async Araq: I dunno what happens with .raises: [] for async alehander92: but alehander92: ok, so afaik this is the preferred way to typecheck errors, and i dont understand how to use it with async alehander92: sorry if being unclear Araq: try: Araq: f() Araq: except: Araq: if getCurrentException() of Defect: quit(1) # fix the broken 'try except' Araq: else: handleError() Araq: there you go, robust error handling Araq: your way: proc foo() {.raises: [].} # gah, foo uses callbacks and stuff and not even the compiler can sort out the mess Araq: but that's just me, I don't like Nim's effect tracking Araq: and no, I don't like encoding the same information in the type system via Option/Either either Araq: in my world errors are so pervasive that it makes no sense to model them statically alehander92: in some cases that's true alehander92: but especially for libs / certain components alehander92: it might be useful to annotate them alehander92: "your way", i thought you recommend this way compared to Either/similar alehander92: i am not really using actively any of those ways in my project i think Araq: well maybe I keep changing my mind :P alehander92: what i wonder is if it is possible to do at all for async alehander92: maybe the other option is to just tag with myerror-like tags some component functions that i manually say "they lead to those errors" and track only those Araq: why though? what's really the point? think your 'proc print' that doesn't return anything CANNOT possibly fail? well, guess what, it can fail. Araq: so ok, print can only raise IOError and not ValueError Araq: still not clear how that really helps me Araq: it's not like 'except IOError' is easier to write than 'except:' alehander92: well, its useful to know just like types Araq: rarely, it'd rather have a single Error type with an enum inside instead of the current hierarchy alehander92: ok alehander92: what i mean is that its useful to know "ok here i can get only those classes of errors" alehander92: i am talking about more domain-specific things like "myDbError / WriteError / GDBError " etc alehander92: i agree some errors are ignore-able e.g. one might not care about some echo-s etc Araq: not my point :-) alehander92: well, what is your point? :D Araq: 1. once the type hierarchy is gone, there is only .raises vs .noraises alehander92: ah, this kind of check Araq: 2. raises is so pervasive that .noraises seems to be liability, what if the implementation changes and it needs to call a function that can raise Araq: 3. functions can raise. accept it. even in holy C functions can call _exit() Araq: 4. 'try except' continues to work well in Java, C#, Python and no, the systems written in these languages are not toys and no, C# programmers do not long for verbose Either monads everywhere. PMunch: I'm going to create a language that never crashes. If everything goes to shit it will just start calling random functions and try to edit all variables on the stack until it managed to get further alehander92: ok but PMunch: It might not do what you wanted it to, but god damn if it isn't trying! alehander92: look at my view alehander92: pervasive is nonlocal: ⏎ i imagine 4 kinds of handling: bug(quit or fail or something), recover(again, probably do it locally), raise, ignore: most of them are local (bug, recover, ignore) and only raise is nonlocal alehander92: ok, the last one is also "restart" : using a global/component-handler alehander92: so i imagine that if one handles more errors relatively "locally", more functions would have only "component-level" errors which are not a burden to follow alehander92: only the "restart" case where one just pushes error up and up until it gets to the main component handler seem to be a bit hard as they are mostly noise Araq: it depends on the problem domain how well you can handle errors "locally" Araq: I analysed it roughly and you would be surprised how often 'on error return' is the best option by far alehander92: hm, so raise is always some kind of "component-level" and restart mostly recover indeed so they remain 4 but recover might be non-local sometimes alehander92: ok, but this is similar to `ignore` alehander92: which is good: a gets an error and just swallows it and you dont need to annotate anything about `a` Araq: beware of the "local handler" that "logs it away" Araq: see Java and why everything depends on some logging framework alehander92: yeah and those views are just what i remembered for your guys quit vs handle discussions + some thinking Araq: here is a realistic example: alehander92: well, one should be able to cast/ignore those errors in the type system as well Araq: the Nim compiler reports an error and then dies. no exceptions required, ok. alehander92: yeah but if you use it as a lib? Araq: exactly. Araq: what if you want to use the Nim compiler on the playground? ok, you can run it as a process Araq: but now what you really have is quit() + process isolation + a way to recover from it Araq: in other words: An exception implementation. Araq: a rather good one too with process isolation. But still, sometimes you cannot afford processes alehander92: yeah, and it's a bit expensive alehander92: sometimes* alehander92: e.g. i use it as a plugin and i mostly parse stuff with it : i dont want to always invoke it as a process Araq: and there is more: every process has an exitcode, 0 for "success" Araq: there are no non-failing processes, it's simply assumed every process can fail. Araq: there always is an exitcode. alehander92: well .. ok, talking about components this might make sense alehander92: but again: its useful to know that you deal with this subcomponent errors locally: e.g. you invoke the nim compiler: it fails somehow, you do what you do or you just handle this in the parent level where you invoke all kinds of compilers? or even on an upper level Araq: well yeah, consider a REPL loop, it failed, you output the error message and read in the next line of input Araq: now lets say the compiler fails due to a bug Araq: can you continue in your repl? who knows :-) Araq: do you want the Nim playground to keep running? yep alehander92: yes thats a good question alehander92: i ask myself about a gdb lib alehander92: usually its good to let the user deal with it alehander92: and let him choose if he wants to recover somehow, just log/ignore it or try to restart/reset a whole component alehander92: i think with some "bugs" a useful thing is to offer a `reset` method: when you know your state got somehow broken, but you can "go back" in a relatively sensible way Araq: sure, could be useful alehander92: but yeah i guess often its useful to know also : component A has handled low level errors and generated a end user action(e.g. message) , so like turning many low level errors into just 2-3 kinds of high level errors (or simply restart/quit) alehander92: so there is this kind of "processing" of errors alehander92: which is still useful to be enforced alehander92: i mean the whole point is to think "this error should be handled this way, that kind of error not" , but to be able to do that alehander92: its useful to have something that calculates what kinds of errors are at a certain point alehander92: this works well with the enum idea: checking that one has handled all the kinds at a certain critical boundary/ Araq: I think at this point we can say 'errno' is really an enum and it really suffices for POSIX and thus for everybody Araq: and inheritance hierarchies are overkill alehander92: but errno is not a great enum imo alehander92: i mean ok yeah there are conventions about it alehander92: but nothing enforces a process to really quit in the correct way Araq: maybe not "great" but Python's hierarchy is not "great" either IMO alehander92: yea alehander92: i like the enum errors idea alehander92: but in a different way alehander92: hierarchy can be just set of enums alehander92: and this way one can easily tweak how errors are handled in his project alehander92: i might be just repeating some kind of `zig` example with this sentences which i saw tho, i think i've seen this kind of handler before Yardanico: well yeah, zig just has enums and exception catching is like in go Yardanico: (exceptions are values and can't be ignored) alehander92: but it has exactly sets of enums which look much more flexible imo alehander92: https://ziglang.org/documentation/master/#Errors alehander92: i am not saying i like the verbosity tho Araq: looks ok to me, not sure how 'try' and 'catch' and sugar for passing errors around is not an exception handling mechanism Araq: it was the first thing they added to Rust after 1.0 iirc, sugar for making the monads bearable alehander92: yeah i agree Araq: so yeah, sure, checked exceptions, they are awesome, see Java alehander92: but still you get annotations/inferrence for the errors even if you use try alehander92: which is good: as the inferrence kinda stops the checked exception problem alehander92: as sometimes you dont really need to annotate all the errors: just need to annotate they raise as you said with raises Araq: the real problem is composition in an evolving codebase. you start with 'returns T' Araq: and then it becomes T? Araq: and then it bubbles up everywhere Araq: have fun Araq: and yeah, the same problem happens in other cases when you use a static type system Araq: and it's already bad, but it doesn't happen as often Araq: same story with 'const' in C++ alehander92: yea i know alehander92: but this is not bad imho alehander92: something changes: its good to notice that alehander92: and function becoming for non-erroring to erroring is a big change Araq: is it though? so what do you do now that 'f' can fail? how about you let the error bubble up... alehander92: well thats the point Araq: yeah, you let it bubble up without having to patch thousands of lines of code... alehander92: now you can decide : i ignore it, i do something about it locally, i quit or i bubble it up alehander92: well why would you patch so many alehander92: often you would just patch several other signatures alehander92: or if it doesnt really matter, you'll ignore it alehander92: and think about it alehander92: usually 1-2 levels up you have a function which already deals with other error-ing calls alehander92: so you'll usually just bubble it up to there in the bad case alehander92: not changing your whole codebase Araq: doesn't match my experience but maybe it works alehander92: yeah maybe the problem here is ignoreable vs "important" errors alehander92: e.g. maybe sometimes people just want to bubble up the globally-ignoreable (not just return one-s) errors alehander92: and try to track the other ones more closely alehander92: then if one can use sets it seems easy to just an error set of Ignoreable which lets you do that alehander92: basically dont track those in the whole codebase and just put manually a `catch`/whatever on top Araq: I have yet to see many "Ignorable" errors Araq: no idea why you bring them up, it's like admitting that otherwise disruptive source code changes are necessary alehander92: not really alehander92: more that they are like noise sometimes alehander92: otherwise i still think people have many error-able calls alehander92: so it doesnt matter so much if a T changes to T? alehander92: because either you'll quickly deal with it locally or in a close parent call alehander92: or because most calls around are also without `?` so it is indeed important to notice it now errors and to do something more alehander92: but again most cool to me is the combo of error set + tracking somehow: one can actually immitate that with a Result, but no way to specify type A is just a "type B or type C" without being generic Araq: as I said elsewhere, I consider Java's checked exceptions a failure Araq: and they are a failure because they picked the wrong default Araq: so everytime you write an interface people who implement it are forced to handle the error locally Araq: as the methods inside the interface lack the 'throws Exception' annotation alehander92: but i see two problems with checked exceptions which seem to be solveable alehander92: first one is being annoying to write all the checked exception lists : one can indeed infer that Araq: whenever I write a stdlib proc just to make it future-proof it should be "yeah, can raise" Araq: so in the end so much can raise that 'try' annotations before function calls become pure noise alehander92: and yeah about interfaces i am not sure why alehander92: i mean you can have error-level-generic interfaces alehander92: which offer both non-errorable and errorable variants alehander92: depending on the caller alehander92: well that's where the "ignoreable" sets idea comes: you decide which errors do you want to actually track Araq: and in Java you can turn a checked exception into an unchecked one alehander92: i dont know why a stdlib proc have to be "future-proof" : if it errors, it errors if it doesnt, it doesnt: if this changes: let the caller either ignore* that ⏎ ⏎ which can be even just calling it in a "ignore any error with this call" way: no need for any big changes in the codebase , just the call lines ⏎ or even with this ignoreable set: just one change ⏎ ... [h FromGitter: ... ttps://gitter.im/nim-lang/Nim?at=5e735821a73c1910996c0b78] Kvothe87: hello again, I'm sorry to keep on asking for help, but as a beginner i thought this was the best place Yardanico: yeah, it's perfectly fine to ask beginner questions here Kvothe87: i want to create a zip of a folder Yardanico: https://github.com/nim-lang/zip Araq: alehander92: it needs to be future proof because otherwise nobody can rely on it and it keeps changing and clients keep adapting Yardanico: although you'll need a zlib dll if you're on windows (it's usually bundled with nim) Kvothe87: i installed the miniz library Kvothe87: that i thought was exactrly for that Kvothe87: but if i understood correctly it returns a string Kvothe87: instead of a file Yardanico: well string in nim is just bytes Yardanico: it can be a file Yardanico: (contents of a file) alehander92: Araq but how often does this change? Yardanico: and if you're a beginner I'd recommend you to use "zip" lib since it has more usage Kvothe87: so should i just write the string to file and set extension to zip? alehander92: i mean this seems useful: you now need to know you need to handle an error Araq: alehander92: often. recently I learned that even getCurrentDir() can fail Yardanico: well, honestly IDK how miniz works, maybe yes alehander92: how is this less reliable than "ok this just starts to fail" Yardanico: in nim zip library it's quite easy to create zip archives Yardanico: https://github.com/nim-lang/zip/blob/master/tests/ziptests.nim alehander92: well .. it makes sense that getCurrentDir can fail alehander92: and if it was annotated properly one wouldnt need to learn that by finding an obscure bug alehander92: one can still ignore it freely, but its just good to know what *can* happen alehander92: and yeah i think i had a similar error these days Kvothe87: @Yardanico i started from miniz since it seemed to be smaller and simpler, just two functions compress and uncompress, so ithough i had few options for error Kvothe87: but i will check zip library alehander92: my script rm-ed a dir (which appears to have been its current dir) and then started a git process there iirc alehander92: and it failed indeed Araq: in reality errors are pervasive and the sane default is .canraise, just imagine you change the implementation to use a helper string that allocates alehander92: so i guess this is an easy way to say "see: even git doesnt handle it, why track such a case" alehander92: (if i am not mistaken about git) alehander92: but thats my point Araq: so previously your precious "cannot raise muahaha" proc became "can raise OOM" alehander92: you can say in your app: ok, i just ignore MemoryError or AllocError alehander92: so now you dont need to change anything Araq: wtf man, you don't "ignore" them alehander92: why? ignoring means "just let them bubble and crash" Araq: you turn them into process terminations Araq: ah well alehander92: is this sarcasm :D Araq: that's not "ignoring" alehander92: well i meant "ignore them in type signatures through your codebase" alehander92: yeah, a bit confusing alehander92: NOTRACK = {MemoryError} alehander92: something like this Araq: yeah exactly, that's what I want to do. ignore them in the type signatures Araq: it's what I've been arguing for all day long Araq: :P alehander92: well ok and i am saying you canleave alehander92: the choice to the user of the lib alehander92: some users might find it useful to track X others Y alehander92: others to just ignore Araq: that causes trouble ;-) Araq: because then you cannot a library which does 'try .. except OverflowError' when you just turned overflow errors into quit()s alehander92: sorry i havent researched enough your guys discussions alehander92: yeah you're right alehander92: what i imagine is that alehander92: using a lib you just inherit its NOTRACK so you have to follow/combine that somehow Araq: can you see how this is all much more complex than simply using *unchecked* exceptions instead? Araq: you do 'try: optionalComponent() except:' to turn into a sandbox, problem solved alehander92: but yeah indeed if my library does this with OverflowError I just cant do that of course alehander92: but i know i cant, because the library cant raise OverflowError alehander92: so the compiler can tell me ok it doesnt make sense to do this Araq: be my guest and use the new --panics:on switch Araq: and now let me work please, I'm tired of this alehander92: yeah it is more complex yeah alehander92: but i still think user defineable checked sets vs unchecked sets changes the game a bit alehander92: no problem i have to continue as well sorry axion: I need help with linking to other procs with nim doc. The anchors it is generating do not make sense to me and seem ambiguous axion: https://play.nim-lang.org/#ix=2eFG Araq: [see also](...#sign%2CT%2CT) Araq: what's the problem? yeah the links can be ugly but they usually work axion: Ah I was following the syntax of the sequtils documentation that actually wrote the whole signature. I was expecting it to just do the right thing like it does there axion: Also it used `foo<#bar>`_ syntax or smth axion: So it looks like that is just [T] base64 encoded, and the other one is [T. What's to stop both from working if I add another similar proc? axion: That's why I was expecting it to generate a link for the signature...not the first few characters of it Araq: somebody put some though into this but it wasn't me and it's probably broken in all sort of subtle ways Araq: as name mangling usually is Araq: but we cannot change it easily, we would need to update all the URLs everywhere axion: Yeah name mangling causes issues, but this is name managling and truncation. Seems very fragile and tedious to check each link every time you add new generic procs axion: I am now questioning if it is worth the time to write nice docs :) Araq: nice docs doesn't mean "lost of silly anchors to jump around" axion: It does if it's crucial to understanding which ones to use in a given context. Araq: if you say so. we use long top level comments that explain how the different procs work together Araq: don't document type signatures and the arguments, they are formalized via Nim's type system axion: I just noticed sequtils links aren't name mangled...huh axion: they aren't even encoded. how? axion: oh some are axion: weird Rika: is there a naming scheme for procs that "clone an object for use in another thread" axion: Is there a way to run runnableExamples to unit test, without generating docs? kaushalmodi: axion: probably not kaushalmodi: for tests for which you don't need docs, put them in separate tests kaushalmodi: you can have a mix of runnableExamples and tests PMunch: Runnable tests are just meant to ensure that the examples in the documentation are actually valid PMunch: In case you change your code but forget to update the docs PMunch: I've seen documentation in the past where a function had been completely renamed. So the documentation told you to run functions that didn't exist at all any longer. PMunch: It would be cool if runnableTests could take a scope argument though.. PMunch: So you could do `testScope: import somepacke; var x = initSomething[int](100)` and then do `runnableExamples(testScope): ` axion: That just confused me :) PMunch: What confused you? axion: So if I change the code but forget to update the docs, the runnableExamples are never ran so the docs are wrong, right? PMunch: No PMunch: The runnableExamples will then not compile, or fail on a runtime assert, so you won't be able to generate the documentation PMunch: Until you fix the runnableExamples axion: Right, by forgetting to update the docs I was including the forgetting to run `nim doc` as well. PMunch: Ah, well yes then they won't run PMunch: But if you forget to run `nim doc` your docs are likely not correct anyways.. axion: So I'd want a git hook to call that probably or something. PMunch: Yeah that'd be a good way of doing it PMunch: Or like nimble.directory does it PMunch: When you try to access a package that hasn't been generated yet it tries to generate it PMunch: A git hook has the benefit of being able to deny you the push though if the docs don't generate properly :D axion: Yeah seems like a perfect fit. PMunch: Hmm, I guess I should set something like that up for my packages Recruit_main707: how can you print something without a garbage collector? PMunch: Would be cool to have a website with all my packages, with generated docs and such PMunch: Recruit_main707, what do you mean? axion: Set up a hook to deny push if an exported proc doesn't have docs too :) Recruit_main707: how can i print things with --gc:none PMunch: stdout.write I guess clyybber: Recruit_main707: Why are you using gc:none? Recruit_main707: gced memory might be messing things around and i want to check if there is luck without garbage collector clyybber: Yeah, but don't use gc:none clyybber: Instead use gc:arc clyybber: And os:any if you need to PMunch: I'd say that is quite unlikely.. Recruit_main707: PMunch, i am injecting a dll so not so much clyybber: Use gc:arc still Recruit_main707: ok PMunch: Ah okay, slightly more likely then :P axion: When I saw the ARC announcement I was super excited but haven't written any code that would notice a difference yet...can't wait to try it. Recruit_main707: chips and kernels is where arc is gonna be game changing imo lqdev[m]: don't forget multithreading Recruit_main707: will arc become default gc? lqdev[m]: that's the plan; to deprecate all GCs until we remain with arc and boehm kaushalmodi: axion: ⏎ ⏎ > So I'd want a git hook to call that probably or something. ⏎ ⏎ You would normally have your CI run `nim doc ..` [https://gitter.im/nim-lang/Nim?at=5e737d5c12ef9a435db2c090] kaushalmodi: e.g. CI services: Travis, Azure, sourcehut clyybber: lqdev[m]: Eh, not so much deprecate. But arc is certainly the future lqdev[m]: @clyybber: that's what I heard from ar4q sometime, but I can't find the quote. Rika: any of you getting 502s on nimble.directory? Rika: who owns that anyway PMunch: Rika, federico3 maintains it PMunch: I manage to browse the site Rika: odd federico3: Rika any broken package? PMunch: Hmm, is there a module that turns a series of string with tabs in them into a nicely formatted table? axion: It works here, although incredibly slow. PMunch: Yeah it's slow for me as well :( PMunch: federico3, https://nimble.directory/ci/badges/macroutils/nimdevel/output.html PMunch: Why was NimScript killed? Rika: no, refreshing fixed it kaushalmodi: PMunch: there's one CLI table generator package Rika: its just super slow Rika: also wtf, this is prolly my side but no avatars from github load PMunch: kaushalmodi, link? kaushalmodi: PMunch: https://github.com/xmonader/nim-terminaltables PMunch: Hmm, that takes rows though.. PMunch: And it's a whole system.. kaushalmodi: it has a `render` proc that returns a string: https://xmonader.github.io/nim-terminaltables/api/terminaltables.html kaushalmodi: may be that's what you want from there? PMunch: kaushalmodi this is what I wanted: https://play.nim-lang.org/#ix=2eGv kaushalmodi: PMunch: nice! kaushalmodi: btw I just happened to read your message Zevv: Hey ppl, I'm dropping of #nim for some time, I have too many apps and windows bipping for my attention these days. See you guys later! kaushalmodi: Gitter does not alert me unless you write @kaushalmodi with that @ alehander92: oh zevv alehander92: see ya disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: more compiler backend cache stuff. Yardanico: *secretly works on pulseaudio again* disruptek: nah, i finished last night. disruptek: !repo disruptek/pulseauto disbot: https://github.com/disruptek/pulseauto -- 9pulseauto: 11setup pulseaudio stream levels via app names or pids 15 0⭐ 0🍴 dadada: don't know if I'm late to post this dadada: but Nim is used with a code example on Arstechnica today dadada: https://arstechnica.com/information-technology/2020/03/the-windows-subsystem-for-linux-conference-was-a-virtual-success/ dadada: this is a big event IMO, for Nim dadada: topic is Windows Subsystem for Linux :-) Yardanico: well maybe there'll be a noticeable spike in traffic for nim-lang.org :P dadada: Arstechnica is one of the most frequented tech websites dadada: Yardanico: most certainly PMunch: Wow, that is actually really cool PMunch: Especially cool to see Nim just being used as a tool without spending half the article explaining what it is PMunch: And I like the line "We just used it here as a clean, quick, simple way to make a Hello World-style app without a lot of cruft to get in the way of seeing what's going on." PMunch: Nice selling point for Nim there :) dadada: yes, so we might have an ally in this Jim Salter guy, who authored that article, maybe he'll write about Nim again Yardanico: wow jesus though Yardanico: they installed nim 0.17.2 Yardanico: coz default ubuntu version in WSL has that nim Yardanico: its ubuntu 16.04 iirvc Yardanico: iirc* dadada: can we see the nim-lang.org statistics somewhere? Yardanico: ask narimiran, although idk if he has access to that :P Yardanico: but you can check stats for the repo Yardanico: (well, if you have push access to nim repo) narimiran: i don't have such info/access Varriount: What do you mean? Why would the github repo have visitor stats? Varriount: Varriount: https://cdn.discordapp.com/attachments/371759389889003532/690248923679424519/unknown.png Varriount: Green is views, blue is unique visitors Recruit_main707: Holy shit, wikipedia as blown up this february Varriount: What do you mean? Recruit_main707: Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/690249710958673930/unknown.png dadada: Recurit_main707: what does the number represent exactly? Recruit_main707: wikipedia views afaik Recruit_main707: we might pass D this month! Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/690250274644033603/unknown.png dadada: Recruit_main707: so you compare the visitor stats of nim lang's wikipedia page against rust lang's wikipedia page... okay Recruit_main707: want the pic? Recruit_main707: at least rust is stalling Recruit_main707: https://cdn.discordapp.com/attachments/371759389889003532/690251531484004371/unknown.png Recruit_main707: anyways, congrats for the all-time high! dadada: yeah, nice development overall! thanks Recruit_main707 for the stats Recruit_main707: here you have the page if somebody wants to check other stats: Recruit_main707: https://tools.wmflabs.org/pageviews/?project=en.wikipedia.org Kvothe87: hi all again Kvothe87: based on this morning suggestion i'm trying to use the zip library to zip a folder Kvothe87: i imported it like zip/zipfiles as seen on the forum Kvothe87: but when i compile the program i get an error Kvothe87: execution of an external program failed ....mingw32\bin\gcc.exe -o Kvothe87: i'm on windows Kvothe87: how should i fix it? Kvothe87: i saw on the forum that i'm not the first with this issue, but it seems the solution was for linux awr1: https://github.com/nim-lang/zip/blob/master/zip/libzip.nim#L50 awr1: are you linking with libzip awr1: oh it already imports libzip_all.c awr1: from the repo awr1: hm Kvothe87: this was the thread i mentioned https://forum.nim-lang.org/t/1857 Kvothe87: but honestly i don't understand how to fix it based on my situation shashlick: can you share some snippets of your error Kvothe87: https://play.nim-lang.org/#ix=2eHC rayman22201: !last axion disbot: axion spoke in 12#nim 4 hours ago rayman22201: @axion are you online atm? axion: I will be in about an hour...mobile right now rayman22201: idk if you saw my post last night. I got that "componentWiseLifting" macro working. rayman22201: https://gist.github.com/rayman22201/bfc4ce11fa15e57176130c4855407199 rayman22201: whenever you get a chance to take a look at it Yardanico: btw does async work with arc now or not yet? :) Yardanico: i mean no leaks, I know it compiles and runs fine Araq: disruptek, the C++ exception bugfix now merged disruptek: sweet. Araq: and will be in 1.2, nice disruptek: yeah, that's a nice feather. disruptek: Yardanico: nope. rayman22201: ughhhh. More hints that I should stop procrastinating and actually do something about async... probably not today... leorize: do it \o/ leorize: you're our async expert rn :P axion: @kaushalmodi: does your nim muscl still work these days? axion: rayman22201: wow. hehe i'll have to play with this. clyybber also wrote a macro for me that i've been using successfully rayman22201: I hope you get some use or educational value out of it lol. It was a fun little distraction for me either way. I love little macro puzzles like this :-) Kvothe87: @Yardanico Do you have any experience of zip library on windows? Yardanico: well, not really, but if you're having problems with .dll - you should get zlib dll from nim binary folder and copy it to your app's folder kaushalmodi: axion: Travis CI hasn't failed for that repo. So it should still be good kaushalmodi: yep, it still prints Hello World as of yesterday's Travis CI cron: https://travis-ci.org/github/kaushalmodi/hello_musl/jobs/664137510#L1362 :) axion: Nice. I found your blog a nice resource deech: Does `gc:destructors` mean that there should not be any reachable nodes after the program is done? leorize: no leorize: don't use gc:destructors leorize: it's not a working thing rn, use gc:arc deech: Ok, should I expect that with `gc:arc`? deech: `valgrind` is showing still reachable blocks. leorize: nope leorize: from what I can tell, the system assumes that the OS will do the cleaning of any open resource on exit leorize: also destroying global variables are a pain deech: That makes sense so to clarify, this is "still reachable blocks" is expected behavior. leorize: yep Recruit_main707: how can i have a type, lets say: Recruit_main707: type Vector3* = object Recruit_main707: x, y, z: float #and be able to initialise it as Vector3(10, 10, 10) Araq: leorize, we do destroy global variabbles Yardanico: you can't do that @Recruit_main707 Yardanico: either create a proc initVector or specify fields Yardanico: like Vector3(x: 10, y: 10, z: 10) Recruit_main707: thats a pitty Yardanico: or proc initVector3(x, y, z: float): Vector3 = Vector3(x: x, y: y, z: z) Recruit_main707: no plans on changing that right? Recruit_main707: at least making fields be filled in order of declaration Recruit_main707: ? Yardanico: i didn't hear of any Yardanico: it's not that bad actually, it seems fine for me Recruit_main707: how it is? or changing it? Yardanico: the current way seems fine for me Araq: you can write a macro to automate it axion: I'm not sure why I am getting an ambiguous call conflicting with system.min ONLY in runnableExamples...the same test outside of it works. Any ideas? axion: I know I can just qualify the module prefix, but I'm not sure why it works outside of the runnable example Recruit_main707: Araq: i just have no clue where to start with macros, i look at the examples, dont understand, and keep working with functions Rika: @Recruit_main707 well its just reading the `macros` module, using `treeRepr` or `lispRepr` a lot, and using `newTree` for generation or so leorize: Araq: so the cycle breaker got merged? does it magically save me from cycle with ARC now? :P Araq: no, I merged it because I have too many rotting PRs Araq: in the end 'when false' works better than git branches Skaruts: yea I didn't know about insert until a moment ago... Skaruts: there's also `del` if you don't care about the item order -- O(1) according to docs axion: What should I use instead of newIdentNode? The compiler is telling me it's deprecated, but jumping to the definition doesn't have any documentation telling me what to use instead. leorize: axion: ident"ident here" axion: How do I create an ident node from an untyped argument? axion: i'm struggling here, even with the deprecated way rayman22201: an ident is just a nimNode with the type "nnkIdent", so you could construct it directly leorize: axion: untyped argument are ident by default :P leorize: you have two ways to force it to be nnkIndent: either with expectIdent axion: Yeah I tried that... leorize: or with the less documented feature of `arg: untyped{nkIdent}` axion: i can't even make an ident node from a string type axion: i have a bit to learn it seems rayman22201: static[string]? rayman22201: what are you trying to do? leorize: I'd say be absolutely careful when using static[T] with macros axion: one sec axion: https://play.nim-lang.org/#ix=2exA axion: trying to get rid of the hard-coded "<" infix op rayman22201: https://play.nim-lang.org/#ix=2exD rayman22201: static string works in this case axion: I actually want to pass it in as an identifier and not a string rayman22201: Nim tries to parse the the expression passed to the macro before it sends to the macro, so just doing `foo(<, v1, v2)` errors. :-/ rayman22201: hrmmmm. not sure how to get around that Yardanico: for < you need backticks Yardanico: `<` rayman22201: ah, duh rayman22201: https://play.nim-lang.org/#ix=2exH axion: Ah thanks! rayman22201: operators must have backticks, I always forget. one of those silly things zetashift: So I'm not familiar with CI's, but last days everytime I browse Nim on GitHub I see some comment on CI blocking stuff, is that normal? Knaque: Hey, out of curiosity, is `--d:release` basically the equivalent of 02 in C? Yardanico: well kinda yeah, but Nim itself uses -O3 for compiled C (I mean when it passes C code to the C compiler). Yardanico: -d:danger is like C's -O3 Yardanico: all checks disabled Knaque: But it's still stable even though its O3? Yardanico: yes Knaque: Nice. Rika: ive been whining about this for months now but Rika: im still irked by the fact that space indentation is enforced in nim leorize: zetashift: no, the CI service we are using was broken then leorize: I managed to push a walkaround so things work again leorize: and now we have a fallback pipeline so if the main ever die again we won't get blocked dadada__: is the linenoise package from nimble working for anybody? just installed and imported it dadada__: and it doesn't find the symbols dadada: Error: undeclared identifier: 'linenoisePrompt' dadada: nimble install linenoise dadada: import linenoise in a nim file dadada: and put a call linenoisePrompt("test") there Rika: linenoise is stdlib Rika: what package are you talking about? Rika: dadada ^ dadada: the one that I found on nimble dadada: https://nimble.directory/pkg/linenoise shashlick: Someone ported it recently wholesale Rika: you can just use `std/linenoise` and then it's `readLine` instead of `linenoisePrompt` dadada: Rika: did they also port the original linenoise code to nim? Rika: no, its just a wrapper Rika: the stdlib one dadada: ok, I'm missing a way to timeout the readLine proc Rika: dont think you can dadada: yeah, I noticed it from googling around :-( Rika: i ported linenoise to pure-ish-not-really nim Rika: https://github.com/de-odex/linenoise-nim if you want to adapt it, i'm pretty sure there are still some bugs in the code but it mostly works Rika: i estimate around like 70% of it works but oh well it was just an experiment dadada: please take this experiment to something useful :D dadada: if you add a way to timeout the readline, I'm for sure going to use that! Rika: i dont know of any bugs right now, afaik hints and completion work, history works (not the same as linenoise, but similar) Rika: oh yeah btw the stdlib doesnt have hints or mask mode Rika: which is interesting, maybe that linenoise needs a bit of updating dadada: the linenoise c library has regular activity on github, I just saw it Rika: anyway, timing out the readline sounds maybe doable? i dont know how i'd implement Rika: *it, maybe you can dadada Rika: it's almost idiomatic nim, aka not like raw C-converted nim Rika: so yeah maybe you can do it Rika: i have to sleep Rika: ill consider doing it if you cant Rika: anyway see you dadada: good night! dadada: thanks for the chat dadada: Rika: did you see this? https://github.com/jangko/nim-noise silvernode: so I think if I want to create an inventory system, I probably want to use tables and hashes instead of seqs but I am not sure. I just found out there were tables in Nim. Elegant Beef: Well sequences dont give you the a -> b logic that tables do, indicies dont indicate exactly what the value represents gogolxdong: build Nim got error `undefined reference to `__builtin_saddll_overflow'` gogolxdong: with gcc-4.8.5 gogolxdong: (https://files.gitter.im/nim-lang/Nim/jDui/image.png) gogolxdong: Does this mean gcc 6.56 is needed at least? timotheecour: that was my suspicion, that we need to detect whether `builtin_saddll_overflow’` is available timotheecour: @gogolxdong see https://github.com/nim-lang/Nim/issues/13645 disbot: ➥ Generate c code cannot compile with recent devel version ; snippet at 12https://play.nim-lang.org/#ix=2ecR Araq: GCC is at version 9 now Araq: I think we're fine with requiring at least GCC version 6 kristianmandrup: Trying to make a React 16 minimal sample app. Getting `Error: undeclared identifier: 'document'` even though I `import dom`. What am I missing? Varriount: Hi Araq PMunch: Hmm, is there a way to ignore overflow errors? PMunch: mratsim, your video is now up at the FOSDEM site: https://fosdem.org/2020/schedule/event/nimultralowoverheadruntime/ PMunch: Apparently the guy in charge of putting the links up got married and was busy with that :P PMunch: kristianmandrup, that does indeed sound strange, do you have any example code? dadada: isn't when false: supposed to be effectively like commented out code? dadada: I've something in there that generated a syntax error dadada: PMunch: thanks, I'm watching mratsim's presentation now kristianmandrup: I solved it by importing `document` directly kristianmandrup: Still having loads of issues simply operating on the dom kristianmandrup: https://github.com/kristianmandrup/react-16.nim/issues/1#issuecomment-600497229 disbot: ➥ [Error] rtype.nim errors dadada: first thing I learned is that I need a nim shirt PMunch: dadada, yes `when false` is like commented out code to the compiler, a syntax checker should still look at it as it's still code. PMunch: dadada, have you seen the other talks as well? PMunch: kristianmandrup, how did you import document directly? PMunch: You probably ended up only importing document.. PMunch: But I still think you're doing something weird, it should just work with import dom kristianmandrup: `from dom import document, Element, Document` PMunch: Yeah, no wonder that doesn't work. You haven't imported the `getElementById` procedure. kristianmandrup: Got it working no with `import dom` like you said. Not sure why I had issues before kristianmandrup: I have this weird problem now PMunch: Nim doesn't have classes in the same way that most OO languages have. So when you import `Document` you don't import a class with all it's procedures, you're just importing the `Document` type itself. kristianmandrup: var ⏎ React*{.importc, nodecl.}: ReactGlobal ⏎ ReactDOM*{.importc, nodecl.}: ReactDOMGlobal kristianmandrup: proc render*(reactDom: ReactDOMGlobal, node: Document, el: Element) kristianmandrup: using `ReactDOM.render(makeTopLevel(), content)` it complains kristianmandrup: type mismatch: got ⏎ but expected one of: ⏎ macro `.()`(obj: JsObject; field: untyped; args: varargs[JsObject, jsFromAst]): JsObject ⏎ first type mismatch at position: 1 ⏎ required type for obj: JsObject ... [https://gitter.im/nim-lang/Nim?at=5e71e49eb720913bec9e04bd] PMunch: You seem to be missing the render procedure. Those errors are generated by a macro `.()` that rewrites itself whenever you have a unknown procedure call PMunch: And please don't paste code into Gitter, it comes through to IRC as completely unreadable and fills up the channel. PMunch: Use a paste site instead PMunch: Like ix or hastebin kristianmandrup: ok PMunch: If you don't need it you can probably do import jsffi except `.()` to avoid having that error. PMunch: It still won't work, but at least you might get a better error message kristianmandrup: solved it now. Helped a lot to know that was the cause of the error, a missing import kristianmandrup: Tanks PMunch PMunch: No problem :) Araq: dadada, 'when false' still requires syntactically valid Nim code Araq: that's kind of its point PMunch: Hmm "Error: illegal capture 'ipAddr_str' because ':anonymous' has the calling convention: " is this a new error? Araq: not really but it makes sense, right? PMunch: Well, this project used to build, and has been running in production for a while now. So why did it use to work? Araq: the compiler was less picky in previous versions PMunch: But it worked, that's what I'm curious about PMunch: Was that procedure just never inlined because it couldn't be? Araq: yup Araq: the compiler turned it into a .closure under your hood PMunch: Ah okay, so it's just the compiler now telling you that you're doing something dumb :P xace: does `nim c` have an option for running `strip -s` on the resulting binary? Araq: nah clyybber: Araq: AFAICT the first snippet here: http://ix.io/2ezf does the same thing (effectively) as the second one clyybber: Do we not analyze closure captures like in the second case or are we overly pessimistic in the first? Araq: these snippets are not comparable livcd: Araq can you help Ward with arc ? :-) Araq: link? livcd: https://forum.nim-lang.org/t/6072 Araq: fixed on devel PMunch: macroutils package now available on the playground: https://play.nim-lang.org/#ix=2ezy kaushalmodi: PMunch: Can playground nimble install all the "popular" nimble packages, at least the ones in nim test suite? PMunch: kaushalmodi, you mean like these ones? https://play.nim-lang.org/#ix=2ezF PMunch: PRs welcome to this list to add new packages: https://github.com/PMunch/nim-playground/blob/master/docker/packages.nimble PMunch: That list was seeded with the important_packages list, but some things were dropped (like some GUI stuff that didn't make sense to run on the playground). kaushalmodi: PMunch: Awesome! I didn't know that. Thanks! PMunch: :D demotomohiro: There is /playground/nimble/nimcuda. That means Nim playground server has nvidia GPU? PMunch: Hehe, no PMunch: It's just a package that hasn't been pruned yet demotomohiro: iirc, you cannot use CUDA without nvidia GPU. Araq: true alehander92: @kristianmandrup alehander92: did you fix your react code clyybber: PMunch: Is superQuote a replacement for quote? clyybber: Without quote's issues? PMunch: Well, it rewrites to a quote statement. But the idea is for it to fix the issues with quote, yes Araq: ha, many have tried Araq: many have failed :P PMunch: The only one it does now though is to lift the contents of the quotes out as variables so you're able to put more than simple identifiers in there. PMunch: Araq, I already managed to fix the "result" in quote issue ;) And that could've been done in a macro like this instead of my PR to the Nim repo. PMunch: So I'm optimistic that I'll be able to apply various fixes and workarounds this way Araq: Cloning into 'Nim'... Araq: + cd Nim Araq: + git checkout -q 670735e4436976eb82c121d47d4617dcd303ba89 Araq: error: Your local changes to the following files would be overwritten by checkout: Araq: tests/tools/second.nim Araq: Please commit your changes or stash them before you switch branches. Araq: what up with this shit? PMunch: Yeah I got that on the playground as well Araq: I only changed the newlines in there to LF Araq: probably because Araq: # tests expects the text files associated with them have LF only as EOL Araq: **/test*/**/* text eol=lf PMunch: git clone https://github.com/nim-lang/Nim; cd Nim; git checkout v1.0.6 PMunch: Caused a similar issue Araq: in our new .gitattributes PMunch: I just changed it to "git checkout -f v1.0.6" though Araq: no idea how to do that with build.ht.rs clyybber: Araq: Hmm, is an infinite recursion with nimDestroyAndDispose a bug? clyybber: with --gc:arc that is Araq: clyybber, yeah but not the bug you think it is Araq: it's a corruption Araq: I'm about to merge my scope based destruction branch but will disable the logic Araq: in order to prevent it from bitrotting gogolxdong: centos7 ships gcc-4.8.5 or have to build from source leorize: Araq: is --staticBoundChecks array-only? leorize: or do we have plans to extend it to range[]? axion: Sigh. I think I need help fixing up my macro. Rika: sure Rika: what's it doing? axion: Well I have to extend it a little. Let me make a playground axion: @Rika: https://play.nim-lang.org/#ix=2eAH Rika: i can run it right now? Rika: i mean it runs in playground? axion: Yeah Rika: whats the issue exactly axion: the TODO russmack: Oh, I didn't know there was a nim playground :) Rika: one moment then ill think Yardanico: @russmack it's available for quite a while now :) axion: @Rika also should probably be a pragma macro but i couldnt figure that out russmack: Nice. I've only been Nimming for a month or two. russmack: What is an example of using an exception where the finally block executes without subsequent code running? ie this answer doesn't seem applicable to Nim: https://stackoverflow.com/questions/50618/what-is-the-point-of-the-finally-block Yardanico: "If there is a finally part, it is always executed after the exception handlers." Rika: axion, you want the same macro to handle both infix and prefix russmack: right, but so is the next bit of code Yardanico: so for example in try you open a socket, in "except" you catch an exception, and in "finally" you always close the socket Yardanico: @russmack but if an exception occurs code after exception won't be called Yardanico: but finally will Yardanico: "The exception is consumed in an except part. If an exception is not handled, it is propagated through the call stack. This means that often the rest of the procedure - that is not within a finally clause - is not executed (if an exception occurs)." from tutorial 2 Yardanico: https://nim-lang.org/docs/tut2.html#exceptions-try-statement axion: Rika: Yes, and I want to get rid of the duplication in the proc definition. It should be able to tell how to call the macro based on the proc signature...which is why I thought to use a pragma axion: Rika: I forgot to add the usage with echo's: https://play.nim-lang.org/#ix=2eAM Rika: one moment, i need to remember some macro stuff Rika: its been a week since i wrote macro nim code russmack: ah got it, thanks @Yardanico Yardanico: the link you gave also provides an answer like that Yardanico: "Depends on the language as there might be some slight semantic differences, but the idea is that it will execute (almost) always, even if the code in the try block threw an exception." russmack: yeah, my issue was that in my examples subsequent code was always executing too. But, fixed now. Thanks. Rika: ok axion, a few issues: 1) your macro only handles procs that return booleans Rika: is that intended? Rika: not a few, just one i think Rika: sorry axion: For the time being it's fine. I think I only have these 3 predicates Rika: give me a proc that's prefix and returns boolean (do you need a not for a vec??) Rika: OH i think i misunderstood Rika: okay okay okay axion: Rika the ~= in that code Rika: yeah yeah sorry i misunderstood HEAVILY axion: No prob. It's probably me. I'm not fully awake yet dadada: microsoft has started to support vt terminals, stuff like tmux and midnight commander now work under stock Windows, not a windows user here, however as a dev who was pissed of at MS for not supporting enough standards this is a welcome change dadada: it means that writing portable terminal apps has just become a lot easier, since you can basically develop and run them anywhere dadada: anywhere being, Windows, Mac and any Unixy system dadada: only question is, what took them so long :D Rika: windows not under 10 20smthsmth* dadada: who cares, this is just a question of time now, eventually everybody moves to a newer system dadada: supporting older systems only makes sense if you have paying customers who want that Rika: axion i have nonworking code but its almost there, i dont know how to solve this last problem Araq: ha! Rika: "how to get the size of the Vec being used" axion: Rika: Ok thanks! Rika: WAIT im dumb Rika: sorry that was very dumb axion: `len`? Araq: that's like saying "supporting 40 different Linux distros only makes sense if you have paying customers who want that" krux02: dadada, does the terminal replace all terminal activity on windows? Rika: ah no dadada: https://www.golem.de/news/microsoft-das-windows-terminal-bekommt-mauseingabe-2003-147335.html Rika: still not sure how to do this, you'd have to move the for loop from compiletime to runtime Araq: hint: often you have zero people on Linux who pay for anything whatsoever... *cough* axion: That would be surprising if you have to do that with Nim :) axion: My Lisp code does not Rika: its probably because of lack of knowledge disruptek: that's why i don't pay for anything: i'm too stupid. dadada: Araq: I think you're missing my point, I was distinguishing systems that are older, surely no linuxer would say it's reasonable to support fedora 26, when we'll soon have fedora 33, and upgrading is not only free, but dead easy Rika: https://play.nim-lang.org/#ix=2eAX what i got so far axion Rika: upgrading is not dead easy when you have software that frequently changes Yardanico: disruptek: I spend like $20 monthly on subscriptions/servers/internet :P Rika: you have to update all older software to work with the new version (esp. if the upgrade is between major versions) and this can take a lot of time if the older software was large Yardanico: hetzner 3 euro, youtube premium ~$2.5, nim donation $5, home internet + mobile plan ~$7.5 Rika: companies are not willing to spend resources for what they think are "minor improvements" dadada: Rika: okay, well I'm upgrading my system every half year when there's a new fedora release, in my experience its dead easy and software problems, if any, are minor, most of the time there aren't any, that's my experience, sorry if yours differs Rika: its noy my experience, mine is fine Rika: i upgrade literally every few weeks Rika: (rolling release operating systems) Yardanico: I run xbps-install -Su almost daily Yardanico: rolling too disruptek: i've run emerge @world twice since this convo started. Rika: but companies dont like updating Yardanico: what beastly CPU do you have Rika: because that potentially means money loss Yardanico: two EPYC 7742 ? disruptek: just teasing you knuckleheads. krux02: Windows 10 is a rolling release, too. At least that is what I understood. Yardanico: well I wouldn't really say so, it's still separated in releases Yardanico: it has versions axion: I do a rolling upgrade every day and been running the same install (on some PC's) since 2000. Issues are rare, but they are time consuming to solve, often requiring coding patches yourself or waiting for upstream. krux02: what distro are you using since 2000? axion: Arch, since beta days. krux02: In 2000 I din't even know Linux is a thing dadada: axion: the trick is to always upgrade to a stable branch, that's basically what a Fedora release is, and an upgrade cycle of every half a year, while not as great as Arch, is still decent Yardanico: In 2000 I didn't even know what knowing is :P axion: Before that Slackware for many years krux02: interesting. axion: I guess I'm old dadada: started with Linux in roughly 2000, I think krux02: probably. I am too young for Linux in the 90s, I used Windows 3.11 and 95 krux02: it was buggy and had a lot of blue screens. But Windows back then wasn't slow. Rika: i wasnt alive in 2000 Yardanico: you mean wasnt born* disruptek: linux in the 90s was more of a mindfuck because the potential was just so explosive. Rika: still works Yardanico: i was born in 2000 :P krux02: I really wonder what people did in the 90s with Linux, as for what I've known so far it was a slow and incomplete experience. Rika: yardanico-nii-san axion: krux02: It was faster. Yardanico: :insert_bruh_emote_here: disruptek: did a lot of programming, email, the early web browsers, etc. whatever you do now. krux02: yea probably. disruptek: it was more hardware-sensitive then, but i wouldn't say it was slow. krux02: emacs and vim already were a thing back then. axion: We didn't have the bloat problem. A complete graphical system ran in under 50MB of ram on my PC's in the late 90's. Araq: great but I had 8MB of RAM... after an upgrade dadada: krux02: depends, Mandrake had a pretty nice GUI for setting up things, as did SuSe, then there were very barebones distributions as well, I started with Mandrake/SuSe, so it was a manageable experience, then I setup my own Linux From Scratch and that was when I knew that I had gone too deep down the rabbit hole :D disruptek: built kernels with 4mb of memory. sure, it grew to take all day, but it was the only way. Araq: hmm I remember booting Linux in the 90ies. we were like "yeah, take that M$! we are running Linux now" krux02: yay what an experience. krux02: lol Araq: we did that for an afternoon Araq: after that afternoon we knew what "operating system" meant. Hint: it's for running *other* software disruptek: we ran MUDs and email, so we were locked in. dadada: well, in the 90s I was a Windows user I must admit, but that's also the reason why I'm not anymore, because my experience with Windows back then was terrible krux02: I think I had a happier life for not knowing about Linux in the 90s. krux02: All I cared about back then was playing Games. dadada: to be fair, there were also a few nice games and applications on Windows, but the limitations of the system were very apparent, and crashes :D Araq: the crashes of KDE were very apparent too fwiw Lantos: lol krud disruptek: linux crashed back then, too. admittedly, not as often. Lantos: krux Lantos: I was also happier not knowing about linux Rika: krud dadada: Araq: I used IceWM for a long time, it was extremely stable, and later I used the stable OpenBox dadada: OpenBox is extremely configurable btw, great underestimated little thing disruptek: pulseaudio is pretty mature yet i triggered crash bugs in it yesterday. also a nim compiler bug, fwiw. disruptek: everyone writes bugs. shashlick: did you still need a wrapper? got some time now disruptek: i mean, i would use it, but i would never impose upon you. 😉 shashlick: okay lets see how easy it is disruptek: i am using dbus and i got it lookin' pretty cute. disruptek: i dunno, may delete later. disruptek: !repo disruptek/pulseauto disbot: https://github.com/disruptek/pulseauto -- 9pulseauto: 11setup pulseaudio stream levels via app names or pids 15 0⭐ 0🍴 krux02: disruptek, That reasoning is why `rust` became a thing and popular. disruptek: well, it's not wrong. disruptek: now if we could just get everyone writing /comments/ too... krux02: disruptek, have you ever written elisp with flycheck enabled? disruptek: nope. krux02: It tells you to write comments and how to write them. disruptek: i haven't written lisp in like 15 years now, i'm ashamed to admit. krux02: well at least you did write lisp 15 years ago Rika: dadada hows the port disruptek: also i left tech for more than a decade, so... dadada: Rika: what do you mean? Lantos: 15 years ago.. Lantos: how old where you when you started coding? disruptek: i have to look into this flycheck thing. Rika: you were the one who needed the timeout thing on linenoise right? did you figure out how to add it? disruptek: i started with basic when i was 8. krux02: The linter for elisp (flycheck) will tell you how to write the comments and it will ensure that you include all arguments in the first in the correct formatting. It will ensure that you start with a capital letter and that you end the sentence with a full stop. krux02: I can't remember if it also has some grammar checking in there. krux02: but it really pushes you to write comments in a consistent style. krux02: Nim could do the same thing. dadada: Rika: no, I moved on to a few other things... I'm thinking it would probably be nice to have generalized extremely easy way (perhaps with a macro) to define a timeout for any function call. disruptek: we could have an editor command that adds a comment block to the current proc and sets up a line each for arguments and formats them in rst. Rika: i dont think thats trivial Yardanico: maybe there's some vscode extension for this? :P disruptek: flycheck supports rust, python, haskell, c++, D... hmmph. disruptek: i'm looking for an animated demo of comments. disruptek: i've been programming for a long time, but i'm a terrible programming. disruptek: programmer, too. disruptek: i just enjoy it. Lantos: all that matters is you enjoy it disruptek: yep. dadada: right krux02: Well, I don't enjoy fixing other people's bugs. disruptek: yep, this is why we have so many. krux02: But when I live in my own bubble where I am surrounded by code that is just my code, I am a happy programmer. krux02: well actually I am currentliy trying to fix bugs in Nim. krux02: It is just when I fix sometheng here, something somewhere else completely unrelated breaks. disruptek: it's maddening that the stream manager lets you edit the title of your stream but doesn't give you a way to /save/ the edit. disruptek: i jut don't understand... does no one test this shit? Yardanico: in twitch? Yardanico: I think it should save automatically disruptek: it doesn't. Yardanico: ah nvm, where are you editing it? Yardanico: there should be a pencil button under your stream (on your twitch page) on twitch.tv/disruptek disruptek: yep, that's the only place you can edit it. Yardanico: under the buttons in the video on the right Yardanico: well, there's a "Done" button disruptek: yes. Yardanico: press it :P disruptek: but not in the Stream Manager. disruptek: ya feel? disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: i'll show you if you really want... krux02: disruptek: alwas this music disruptek: what? krux02: In your stream disruptek: we almost never hear badu. krux02: you always have music disruptek: what do you want to hear? Yardanico: krux02: music is good :P krux02: yea not complaining krux02: it is just something I realized krux02: but isn't music a problem with licensing and stuff? disruptek: i need music because no one is on live audio chat. disruptek: they just mute my videos. disruptek: i don't give a shit. krux02: I don't have mumble Lantos: I'm not sure why more people don't use discord over mumble/irc Lantos: is irc just easier ? dadada: Lantos: IRC is oldschool as f*** and irssi is a client that is perfection in my view Yardanico: @Lantos Electron Yardanico: and using it in a web browser is meh vegai: discord is an incredible pain to use dadada: Lantos: I used IRC for almost two decades, saying that I should use something else is making my roll my eyes, this is a time tested protocol, at best I'll use something additionally, but never to replace IRC vegai: that's my reason anyway :) Yardanico: also IRC is entirely open :P Yardanico: I mostly use IRC and Telegram axion: dadada: +1 dadada: irc.freenode.org is one of the nicest places on the internet, if not the best one ... so many fond memories vegai: Matrix is capable of replacing IRC for me, if a decent client comes by and people actually start using it axion: IRC is older than the web. I cannot stand all those GUI chat services. All you need is a TUI to communicate effectively, and arguably moreso. THE SNR is very low with all those emojis, avatars, and the like vegai: gomuks is almost there already Yardanico: axion: 🙂 shashlick: disruptek: here's a quick and dirty wrapper - http://ix.io/2eBl/nim Lantos: ah, the open part is a plus shashlick: not a full-fledged rapper that downloads and builds since i presume you will use this on linux only and use the package manager to install it axion: Matrix is horrible. One of our dev channels has a bridge and messages are constantly arriving/received minutes, sometimes hours later. shashlick: pulseaudio wrapper ^^ krux02: Araq, Simon the Sorceror is great disruptek: shashlick: thanks! Araq: lol disruptek: this is the whole wrapper? disruptek: just this one file and the nimterop import? shashlick: the output yes disruptek: is this the new codepath? shashlick: the wrapper is http://ix.io/2eBn/nim shashlick: generator shashlick: if you have pulseaudio installed, you can use getHeader() with -d:pulseaudioStd axion: What's the most idiomatic way to write a for loop that iterates over every N indices of an array? Like if I had an array of length 16, i'd like to do something on indices 0,5,10,15, where N is 4 in this case shashlick: new codepath is around 80% done compared to current functionality axion: or well 5 i suppose :) shashlick: not counting bugs of course axion: That is it post-increments (starts at 0) krux02: disruptek, still struggling with mumble, first time usage. dadada: axion: I'd write an iterator probably Yardanico: disruptek: im here as well axion: dadada: For a one off usage of a large array? Seems like overkill Yardanico: disruptek: for showing IRC/twitch messages on your stream Yardanico: is it an OBS plugin? dadada: axion: why not a while loop? PMunch: axion, the most idiomatic would be to use countup axion: This is one thing I miss from lisp: (loop :for x :by 5 ...) Yardanico: there's countup though axion: I'll check it out, thanks PMunch: https://play.nim-lang.org/#ix=2eBt Yardanico: yeah, countup has an optional step argument Yardanico: so does countdown Kiloneie: You guys tell me i shouldn't make too many videos per week, but the analytics say otherwise D: Yardanico: wdym? Kiloneie: the bigger the gap between my videos, the less views i get, it doesn't grow, it declines. Then a jump when a new video is uploaded which raises the views for the following days, but it decays with every day. Rika: thats natural narimiran: you're too obsessed with views and potential financial gains from it Rika: were not saying youll get more views by slowing down stefantalpalaru: They could be radioactive. Just saying... disruptek: you make the videos once. make them as well as you can. you reap the dividends indefinitely. Rika: we're saying that its healthier to slow down Kiloneie: I know, i sadly cant get the mic setup atm, so i will have to do quite some fixing on quite a few videos once i do narimiran: btw, how many view did you get when you had a long break because you had a burnout? :P Kiloneie: ummm still a lot... Kiloneie: first video was about 400-500 views Kiloneie: now it's 2400 Kiloneie: subs ? i think about 65, now it's 153 ? Kiloneie: it kept growing... narimiran: so, you don't have a relevant information about the newest videos, right? because it is much much newer than that one Kiloneie: what do you mean ? narimiran: newest video = 3 days old; oldest video = 90 days old (i just invented those numbers) Kiloneie: well the newest are getting more views than i did back then Kiloneie: 100 in a week, then it slows down a ton Kiloneie: but, when i first started, average views and watch duration went up with every video. I am making the too slow atm Kiloneie: i did take time to think trough how i want to go on with this Kiloneie: and i know why the views are what they are atm, we don't really have many beginners to programming at all Kiloneie: that's what the surveys say Kiloneie: Also on the potential financial part, well im broke D:, fcking corona crap. narimiran: broke or not, don't count on the idea that your videos will make you significant amount of money Yardanico: well yeah, actual programming videos won't earn you money :P Kiloneie: i know they won't, not until years from now Rika: i dont think they ever do Yardanico: i wouldn't like a programming video showing ads :P patreon or something like that will be better Kiloneie: i know, i wouldn't do that Kiloneie: i would only do maybe at the end, and some easy ones you get at the bottom of the screen most people do Kiloneie: patreon is the way to go Kiloneie: but till any of that, i need hundreds of videos that not only cover the beginner spectrum but also intermediate, and more advanced Kiloneie: something maybe any of you could find useful Rika: does nim have a counterpart to python's `string.decode()` Yardanico: no, since nim strings are just bytes Rika: i mean Rika: in nimble perhaps Kvothe87: Hi guys i'm trying to run a program that leorize helped yesterday, but i get the following error: Error: unhandled exception: Error: cannot open: (kind: pcFile, path: "C:\\Users\\**\\**\\**\\**\\**\\**\\***.csv") [CsvError] Rika: thats one hell of a path Yardanico: @Rika for what? Kiloneie: im gonna start making videos on nim's standard library now, been planning that for a while Yardanico: I mean why you need .decode Yardanico: There's https://nim-lang.org/docs/encodings.html if you need to encode/decode stuff Yardanico: with different encodings Kvothe87: where in the error i receive all the slashes are doubled Yardanico: that's okay Rika: im converting a python library Yardanico: well most of the time you wouldn't need stuff like that in nim Yardanico: and it was probably written for python 2 Yardanico: in Python 3 strings are UTF-8 by default too, so you need encode/decode only when actually dealing with different encodings Kvothe87: is this a problem of opening the file or is it of passing a wrong type ? Rika: it says it deals with 'utf-8-sig' Yardanico: is that lib open source? Rika: ill just Rika: hu Rika: uh* Rika: remove the code Rika: i dont think its significamnt Rika: im pretty sure its not significant the decode part leorize: Kvothe87: can we see the code? shashlick: question - how do you default initialize a ref object param to nil in a proc signature? disruptek: foo: Something = nil leorize: or foo = Something(nil) shashlick: thanks rayman22201: @axion, if you are still around. Here is the fix to your macro: https://play.nim-lang.org/#ix=2eC6 rayman22201: you can treat infix operators as prefix. They are just normal function calls. rayman22201: very lisp like rayman22201: just remember the backticks :-P rayman22201: !last axion disbot: axion spoke in 12#nim 2 hours ago Rika: rayman22201, uh, i think they want the macro to generate a proc that allows for 3 parameters if the given proc has 3 parameters Rika: and if only 2, use infix, if more, use prefix rayman22201: I'm not sure if that is what they are asking. But it's also unnecessary rayman22201: the Nim compiler allows you to treat all operators as function calls, and does the right thing in the backend anyway Rika: he wants to be able to use the extra "tolerance" parameter when needed Rika: and use the regular infix version if not needed axion: rayman22201: Inspecting, thanks clyybber: PMunch: With which version did you build your macroutils docs? clyybber: Did you use that RST script? clyybber: Because its missing dark-mode PMunch: Which docs? rayman22201: ok, that's just a matter of passing an optional arg to a function. pretty easy to do in a macro if it's just generating a function call. Rika: its generating the function body Rika: consisting of function calls Rika: eh i think my solution was overkill yeah rayman22201: I see what you are saying though. axion: Yeah I need to be able to pass the tolerance arg in too, and work for any predicate with arbitrary number of args rayman22201: I see. That will get a bit more complicated. The macro will have to look up the proc definition of `op` and pull are the arguments, then add maching parameters to the output ast. rayman22201: *all the arguments axion: I see Rika: w-was my solution even looked at axion: I didn't expect this to be so hard. I suppose I'm just too used to there being no difference between code and AST as with Lisp. The macro in Lisp is just a couple lines axion: Oh well, not a big deal. Rika: ;; Rika: i guess it wasnt looked at lmao clyybber: PMunch: https://uploads.peterme.net/macroutils.html <- these ones axion: Yeah it was PMunch: Oh those, that was just meant as a teaser of the real thing :P PMunch: But they should've been made with 1.0.6 or devel rayman22201: Rika, I didn't see it. sorry, just skimmed the irc history. You have the right idea. clyybber: oh ok, wheres the real thing? Rika: it relies on the assumption that the signature on the pragma'd proc is the same as the scalar proc axion: I didn't get a chance to try it yet, because I've been in the middle of refactoring 3000 lines all day trying to get back to working status :) Recruit_main707: ok, id need some help, when i compile with --NoMain to a dll (having a DllMain function), using a tool, the only function i can call is NimMain, why? Recruit_main707: (id post this in off topic but bridge is down Rika: its ***nonworking*** but the last hurdle is figuring out the length of the Vec being used on compile time (which afaik is the wrong approach i think) PMunch: clyybber, well I was hoping it would've been built by the directory. But alas: https://nimble.directory/docs/macroutils PMunch: federico3, am I doing something wrong with my packages? federico3: https://nimble.directory/pkg/macroutils --> install test axion: PMunch: I'll need these for matrices too: Mat[R,C: static[int]] = array[R*C, float32] axion: But I'd just use the N or R*C type parameters to get the length PMunch: federico3, wait, you're not building with 1.0.6? axion: PMunch: err sorry, Rika I meant PMunch: Haha, I was confused there for a second federico3: no, 1.0.4 but I'll backport .6 Rika: i really have no idea what to do for the macro vector length issue, maybe pmunch can actually help there PMunch: Uhm, what is the issue? Rika: https://play.nim-lang.org/#ix=2eAX <-- has an issue regards getting "N" Rika: which is the length of the vec being worked on rayman22201: Rika, oohhhhh. I see what you mean now. won't work Rika: i dont know of any solutions for that issue axion: We can hold off on thinking about it until I make a first commit and anyone interested can help me simplify the final API with a macro :) rayman22201: It works in the original because of the generic param Rika: yeah rayman22201: you need this: https://nim-lang.org/docs/macros.html#bindSym%2C%2CBindSymRule rayman22201: experimental feature axion: Because this macro should be able to be called with 2 vectors, or 2 matrices, which have different type signatures Rika: i dont know if you want to add an experimental feature to your lib rayman22201: Problem is, you want to do things with the types (formal proc args in this case) but macros run before type checking axion: Probably not. I just want to write this and be done with it, rather than rewrite a good portion of the library if that feature doesn't make it to a release rayman22201: Rika, your solution pulls out the ast, and "guesses" the params will be the same. But you loose the generic N (which comes from the type checking) Recruit_main707: is the creator of winim in here? axion: I see rayman22201: You need to bind the symbol, so that you can find the type, so you can actually look up the correct args rayman22201: I think this can be solved, it's just a PITS rayman22201: PITA even axion: Well for another time when I can better specify what I want with actual code commited :) Rika: it really is a PITA i think axion: That playground code is just a subset of what I need, so probably not worth trying to solve it now if it's a PITA Rika: rayman, i did say that it relies on the assumption that ... (see log) rayman22201: yeah, I saw, I'm just telling you why the N doesn't work rayman22201: we need a higher level macro wizard like mratsim to help lol axion: I appreciate all the help though! Hopefully I'll have an initial revision of my first Nim library pushed soon, and we can go from there. rayman22201: Macros can write macros, so I wonder if you can do it in stages rayman22201: It's a fun problem :-) Rika: rayman, i know N doesnt work, i just copied the code from the old macro rayman22201: but you said you didn't know why Rika: i dont know how Rika: i mean how to get N Rika: i know why N doesnt work i just dont know how to get it rayman22201: the only way to get that N is through the type pass. A.K.A you need the `[N: static[int]]` part shashlick: are regular comments not stored in the AST? shashlick: i don't see any node type for it shashlick: only documentation comments rayman22201: long standing debate. no they are not :-P shashlick: ugh, nimterop will lose the comment feature then Rika: F dumjyl: axion: Haven't really been following, but you might need the template swizzle trick: https://play.nim-lang.org/#ix=2eCl rayman22201: axion, you want to pass the extra "tolerance" down to the generated proc right? rayman22201: "tolerance" argument axion: Yeah, optionally since it is a named parameter. axion: or one with a default value, rather axion: But, not limited to 1 argument. If I write another predicate that has 2 extra arguments, it should be possible to use them both. rayman22201: right. you want it generic. You basically want to "lift" the types of the first two args into some higher collection type while keeping the rest. Araq: rayman22201, how is your async going? I'm looking forward to it rayman22201: lol. How goes the arc fixes for the current async? axion: Where in the nim source tree is the sequtils module stored? Rika: huh? Rika: `import sequtils` axion: That wasn't my question :) kaushalmodi: axion: You can go to https://github.com/nim-lang/Nim, hit `t` and type `sequtils` axion: I'm trying to find the actual source files on github Rika: ah Rika: its in pure Rika: im pretty sure kaushalmodi: axion: You will find it in `lib/pure/collections/sequtils.nim` axion: Thanks PMunch: axion, the official docs have a "source" button below each procedure that takes you to the GitHub sources :) kaushalmodi: axion: If you are using Emacs/projectile or similar packages in other editors, you don't need to remember the path axion: Oh good to know axion: I ask because sequtils is a good example of good documentation, and I haven't written any markup languages in a while so I'd like to see the documentation comments :) axion: What is the difference between `foo` and ``foo``? Not seeing any difference in rendering, but seeing the latter used a lot. Rika: they look identical to me axion: Indeed. My question is why sequtils uses a mixture of both. I don't know the rules of this markup language. Rika: how do you know theyre different? axion: I do not. I'm asking if and how they are. axion: and why sequtils comments use both if they are not. Rika: im not sure i'm understanding what you mean, let me take a look Rika: i dont see what you mean after reading both the docs and the code kaushalmodi: axion: you mean difference between single backquoting and double-backquoting? axion: For example, line 166 uses single backticks for `n`. Line 180 uses double backticks for ``isSorted`` and ``true``. kaushalmodi: the docs were originally strictly rst format which requiring double-backquoting kaushalmodi: later on, changes were made in the nim docgen, so now we have a hybrid format support: markdown + rst kaushalmodi: so now single-backquoting works too kaushalmodi: in rst, single-backquoting is italics Rika: discord doesnt show the double and single backticks kaushalmodi: in rst, wrapping in single stars is also italics axion: I see kaushalmodi: so I would use the single star wrapping for italics and markdown style single backquoting for code markup axion: What is double backquote in RST? kaushalmodi: code markup axion: So then I should probably use single star for italics, and double backquote (rather than single as you said) for code, so it renders in both as intended? kaushalmodi: in the latest nim docgen both both single and double backquoting does code markup kaushalmodi: axion: you can.. it's my bias towards more markdown like doc syntax that makes me say that axion: Thanks kaushalmodi: for the rst syntax that nim doc gen understands, see https://forum.nim-lang.org/about/rst axion: I'm really not familiar with RST at all. Just gfmd kaushalmodi: then use markdown! kaushalmodi: and it will still Just Work :) axion: Got it kaushalmodi: and it's easy to test your edits.. kaushalmodi: edit foo.nim and run `nim doc foo.nim` and see the generated HTML in a browser axion: Yup been doing that lqdev[m]: yeah rst is really picky when it comes to syntax mistakes lqdev[m]: but one upside is that your documents are still readable as ASCII axion: what is this runnableExamples thingy? PMunch: I find markdown just as readable.. lqdev[m]: axion: it's for automated testing when you generate documentation kaushalmodi: `nim doc` will fail if the code under `runnableExamples:` fails Demos[m]: I like markdown more because it works better with flexable width fonts PMunch: axion, runnableExamples is examples that end up in your documentation that is also compiled and executed during documentation generation lqdev[m]: you can write examples and they will be semchecked on `nim doc` kaushalmodi: that allows the doc examples to stay current axion: do i have to import that from somewhere? PMunch: So it makes sure that your examples can actually run lqdev[m]: no, it's in system axion: awesome PMunch: I like markdown better because it's actually possible to write on the first try axion: Nim is becoming more awesome by the minute kaushalmodi: axion: you might like the doc examples here too: https://github.com/kaushalmodi/elnim/blob/master/src/elnim.nim kaushalmodi: (as I believe that you have somewhat fondness for lisp) axion: ha cool axion: So with runnableExamples, I might even be able to remove all my nimble unit tests kaushalmodi: yes axion: They took me days to write...time to port them to the actual documentation :) kaushalmodi: then you just have Travis or your favorite CI run nim doc and you have testing+doc generation happen in one go axion: kaushalmodi: what is the difference between doAssert and assert? I just saw you using doAssert for the first time Demos[m]: doAssert always runs kaushalmodi: yep axion: when does assert not? kaushalmodi: they can be disabled using a nim switch axion: Ah ok kaushalmodi: ```> nim --fullhelp | rg assert ⏎ -a, --assertions:on|off turn assertions on|off``` [https://gitter.im/nim-lang/Nim?at=5e728899190ad049722ac02b] kaushalmodi: axion: Also, if you haven't already, bookmark https://nim-lang.github.io/Nim/theindex.html kaushalmodi: you can Ctrl+F any stdlib proc/macro/etc on that page.. e.g. Ctrl+F doAssert axion: Nice axion: Hmm. I cant get runnableExamples to work Rika: what's wrong lqdev[m]: axion: keep in mind that you must import any other modules you use in all runnableExamples sections too axion: even those I import the module that has the Vec4 type, I get this: https://gist.github.com/mfiano/b1533071f15cba9027b09b2acc18789c narimiran: Vec vs Vec4? Rika: Vec: for any size lqdev[m]: is Vec4 in the same module? axion: I can use Vec4.init anywhere else besides runnableExamples kaushalmodi: axion: save this to a foo.nim file and run `nim doc foo.nim` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e728a418efb7417d7c89006] kaushalmodi: now flip one of those doAsserts and run `nim doc foo.nim` and you will see it fail axion: I understand. I just can't get it to see my types kaushalmodi: can you share a snippet? narimiran: axion: see lqdev[m]'s question above kaushalmodi: axion: nevermind I saw the lqdev is already helping you based off your snippet kaushalmodi: s/the/that Rika: "the lqdev" kaushalmodi: may be he is *the* lqdev around here :) axion: sec lqdev[m]: gotta make a new game and call it "i wanna be the lqdev" clyybber: like no one ever was axion: https://play.nim-lang.org/#ix=2eCV clyybber: axion: Does it work when you import the file yourself in the runnableExamples? Araq: clyybber, I merged my PR axion: clyybber: Yep Araq: but it's disabled (scope based destruction) axion: That is rather unfortuante I have to do that for every example narimiran: axion: it works for me locally disruptek: miran: you still sick? narimiran: disruptek: i'm feeling fine currently disruptek: 👍 axion: My type definition is in another file from the init proc, and at the top of the file I do import types.nim. So my examples don't see it because apparantly runnableExamples doesn't import the same module axion: So is there a way around that apart from importing in every single example? kaushalmodi: axion: I confirm that your example works for me on devel fb641483f0e2ed974b89d629ea5ec28e5e6145ce as well axion: Right but did you put the type definition in another file that is imported? lqdev[m]: axion: no, each runnableExamples has to import your module axion: I fixed it by putting `export types` after I import it. narimiran: (`include` might do the trick) axion: `include` is wrong here because the generated documentation will duplicate what is included. clyybber: Araq: Ah, nice. I'll have a go at it once I figure out this corruption Spy653: Does nim have anything in the works regarding on metal development disruptek: well, it works. disruptek: --os:any --gc:none etc. disruptek: or it's --os:ansi_c ... i cannot remember. Zevv: https://nim-lang.github.io/Nim/nimc.html#nim-for-embedded-systems exelotl: It's generally good for it. You will need to generate C code if you want to store data in ROM though (besides a few trivial cases, like numeric LUTs) clyybber: Zevv: ping clyybber: Zevv: It looks like --threads:on --gc:arc --d:useMalloc doesn't work Recruit_main707: i am pretty sure there is a big issue with winim Recruit_main707: are there any other wrappers for kernel32? Recruit_main707: how can i install this? Recruit_main707: https://nim-lang.org/0.11.0/windows.html leorize: Recruit_main707: what's you problem with winim? leorize: I think it works kinda well Recruit_main707: u see, hModule is just a typedef of LPVOID Recruit_main707: but if i try to pass hModule to something expecting LPVOID, i cant, (which its what i see being done in c++) leorize: what's the error message? leorize: what's your code? Araq: clyybber, https://github.com/nim-lang/Nim/pull/13685 disbot: ➥ enable --tlsEmulation:on for --gc:arc Recruit_main707: leorize: https://play.nim-lang.org/#ix=2eD7 leorize: if you believe that they are interchangable just convert it? leorize: I'm pretty sure HMODULE is distinct from LPVOID is to prevent you from mixing it up leorize: HMODULE is typed and LPVOID is not leorize: welcome to the superior type system leorize: :P leorize: note that for pointers, you don't really have to cast leorize: just LPVOID() is enough disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: leorize: come explain ryu. Araq: leorize, where is the PR? leorize: ? Recruit_main707: LPVOID(hModule) doesnt work :/ leorize: cast then? Recruit_main707: but even if it worked that way, c++ doesnt do all of this disruptek: leorize: for ryu. Recruit_main707: leorize: which doesnt work bc i tried :p leorize: that sounds wrong, what's the error when you tried Recruit_main707: well, first of all, that i do need an hModule in my function Spy653: Sorry boys and girls got busy after sending the last one Recruit_main707: and also errors at runtime if i dont use it Spy653: I'm an entry level OS developer and currently use rust as my main language but am wondering which is realistically better or if they compliment each other well Rika: what do you mean metal, metal as in baremetal or metal as in OSX's lib Rika: oh Rika: baremetal Recruit_main707: anyway, how would i install this module windows thing? Recruit_main707: https://nim-lang.org/0.11.0/windows.html leorize: it's not there anymore leorize: !packages windows disbot: https://github.com/ba0f3/subhook.nim -- 9subhook: 11subhook wrapper disbot: https://github.com/trustable-code/NiGui -- 9nigui: 11NiGui is a cross-platform, desktop GUI toolkit using native widgets. disbot: https://github.com/ba0f3/uibuilder.nim -- 9uibuilder: 11UI building with Gnome's Glade 7& 10 more... leorize: yea it's dead Recruit_main707: u gotta be kidding D: Rika: get it from the master branch, it MIGHT be there lmao Recruit_main707: where is it though Rika: theres a search in github leorize: Recruit_main707: HMODULE is not LPVOID btw leorize: it's an int Recruit_main707: its typedef of LPVOID Recruit_main707: ? leorize: what's the C code that you base your code from? Recruit_main707: cpp (i know its a bit shady, but i am not using it with malicius purposes) Recruit_main707: https://pastebin.com/ywA9qzCg leorize: https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types leorize: no they aren't the same leorize: HMODULE is not LPVOID leorize: it's based on HANDLE and HANDLE is an int Recruit_main707: they do use it as so Recruit_main707: `CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)HackThread, hModule, 0, nullptr));` leorize: if it works that's luck :P leorize: try passing the addr to hmodule leorize: does that C code actually runs? Recruit_main707: not only it runs, everyone uses it like that leorize: you can read on this here: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread leorize: lpParameter should be a pointer to the argument leorize: you can `cast` if you insist Recruit_main707: i know leorize: if you're uncertain just check the C code Recruit_main707: it seems ill have to clyybber: oh oh :/ leorize: oh yea this part is really really crucial clyybber: I think I might ruin the release date leorize: have you called NimMain? leorize: if you don't call that the GC won't be initialized Recruit_main707: yep, manually in fact, its the only one i can call leorize: clyybber: what? :P Recruit_main707: with an injector Recruit_main707: oh, nvm leorize: what does your winapi pragma resolves into? leorize: looks like I get what they are doing now leorize: this is pure luck leorize: hModule has the same size as a pointer Recruit_main707: i see leorize: and it will be passed verbatim to your thread proc leorize: which is why it worked out for them leorize: this is why I hate C Recruit_main707: hmm, can i stick to this bad way of doing it in Nim? clyybber: Araq: Thanks! Recruit_main707: to keep things simple? leorize: just cast and it should work leorize: your bigger problem is why doesn't it work leorize: what does your {.winapi.} pragma resolves into? Recruit_main707: and then cast it back inside my function? leorize: you don't have to, luckily leorize: the part that matters would be why won't your function run Recruit_main707: ok, then related to it not running... leorize: ah... you're playing with fire here leorize: GC-ed memory inside a thread not spawned by the stdlib Recruit_main707: using echo could be the issue then? leorize: yep, try --gc:arc instead Recruit_main707: no devel :( leorize: if you're in an older version of nim, then call setupForeignThreadGc() leorize: in the thread before anything else leorize: remember to compile with --threads:on leorize: note that you don't have to exportc your MyThread, but make sure that it's stdcall Recruit_main707: where should i put that line? leorize: first thing in the thread leorize: in MyThread Recruit_main707: and compile with gc:none? leorize: you may use the GC after you call that leorize: but remember, no passing GC-ed data between threads Araq: just use --gc:arc Recruit_main707: is there a little guide on how to install in windows? Recruit_main707: i definetely will leorize: https://github.com/nim-lang/nightlies/releases leorize: there you go, or you can compile it yourself Recruit_main707: fingers crossed Recruit_main707: (that didnt work btw) leorize: what didn't work :P Recruit_main707: setupForeignThreadGc()... thing leorize: what does your {.winapi.} pragma resolves into? Recruit_main707: idk, i just use it wherever its used in cpp Recruit_main707: it doesnt seem to do much leorize: ofc it did nothing Recruit_main707: code fails the same way if i dont use it leorize: you didn't give it a meaning leorize: WINAPI means `{.stdcall.}` in Nim leorize: if you wanna keep `{.winapi.}`, then create a custom pragma with: `{.pragma: winapi, stdcall.}` leorize: we need error messages for using a pragma that is not declared Recruit_main707: winapi is a winim macro leorize: ah ok then leorize: phew leorize: well add {.stdcall.} just to be sure leorize: https://github.com/khchen/winim/blob/d300192c588f73dddef26e3c317f148aa23465c3/winim/inc/winimbase.nim#L21 Recruit_main707: have it just in case ;) leorize: because winapi doesn't mean stdcall in winim :) leorize: with stdcall in place you might see less errors leorize: looks like the winapi macro was an internal thing for winim :P Recruit_main707: it didnt really even do nothing, ill get it out leorize: maybe you can make a pr to winim to add stdcall into it so that it resembles the real thing: https://stackoverflow.com/questions/2348442/what-does-winapi-in-main-function-mean Recruit_main707: o_0 Error: expression cannot Recruit_main707: be cast to pointer leorize: well the full message would be nicer Recruit_main707: thats it XD leorize: with line info and where is it lol Recruit_main707: seems to be a problem with winim leorize: I don't think so Recruit_main707: winim-3.2.4\winim\winstr.nim(319, 14) leorize: ah ok now it is :P leorize: well just keep looking to see what go wrong :P Recruit_main707: i might have done something wrong in installation Recruit_main707: will run koch also Recruit_main707: ok, now it worked Recruit_main707: compiled* Recruit_main707: no luck Recruit_main707: well, at least now i have nim 1.1.1 leorize: :P what's the problem now? Recruit_main707: same as b4 Recruit_main707: gimme a sec and i copy the message Recruit_main707: `Force load module failed:failed finding address of msvcrt!__dllonexit` Recruit_main707: from injector clyybber: aaaaargh, I'm so stupid leorize: Recruit_main707: that doesn't sound like your problem... leorize: does it work with other dlls on your machine? clyybber: put a manual `=destroy` in a wrong location and spent hours searching for the bug Recruit_main707: leorize, i do get it to run until CloseHandle(CreateThread(...)) Recruit_main707: so essentially, yes, injector works fine, and code runs leorize[m]: have you tried googling that error message? leorize[m]: you can try to compare the generated C code too Recruit_main707: only injector related issues, will look into the cache, is it impossible to trick the compiler and just run it without casting and all that? leorize[m]: cast looks like an operation to you, but it literally means nothing leorize[m]: it just tell the compiler to shut up because you know better leorize[m]: besides, the passed hmodule is just a parameter, you aren't even touching it in your thread leorize[m]: so it's not related to it Recruit_main707: if i dont create a thread and just call the function it works leorize[m]: how does your code look like atm? leorize[m]: and have you compared the C code? leorize[m]: use the --nimcache parameter to specify where should the compiler generates it Recruit_main707: sorry, was trying things leorize[m]: I don't know if you can just use the stdlib facilities to spawn a thread instead of doing all this by yourself :p Recruit_main707: in the cache, every time HMODULE should appear, `NI` appears, is that alright? leorize[m]: yep, it's the same type Recruit_main707: can i modify the cache code and then compile it? Recruit_main707: c++ NULL = nil, Recruit_main707: c++ nullptr = nil? Recruit_main707: ptr nil? Recruit_main707: ill do the only reasonable thing to do in this situation, individually wrap every function i use and make sure it does what i want axion: krux02: tbh i don't like your approach axion: In Common Lisp, I have a compiler for GLSL to CL such that I can define GLSL functions indistinguishable from the host language that are reusable across shader programs and can be individually live-recompiled to transitively update any programs using them, rather than dumping GLSL into a string and doing minor parsing/string replacement to inject nim variables. axion: I'd like to do something for Nim some day, but that was an incredible amount of work axion: don't get me wrong, your thing is cool and all, but a decent bit of macrology will allow you to have a reusability of gpu functions across many shader programs without code duplication, and the ability to transitively update parts of the dependency graph that changed at runtime axion: i just don't see any value in the disconnect of writing GLSL when we have macros, with the added benefit of granular function/var code reuse Generic: tbh I don't really see the point of writing shaders in Nim Generic: you could reuse some code Generic: but then you somehow have to make sure that the cpu code uses the same vector/matrix types Generic: though what do think would be useful, is using macros to get rid of all of the boiler plate interface code krux02_: axion, can you elaborate? krux02_: I generally have a hard time elaborating the benefits of my shaderDsl macro to other people. Usually people don't understand it. axion: It's pretty amazing what you can do, and the point is you gain all the benefits of Nim if you model it as such. For example, in CL I brought higher-order functions to GLSL which never had them; I can call shader functions that accept other shader functions as arguments. It's incredibly more useful for the gpu than one might think krux02_: Btw I have basically two project in opengl-sandbox. axion: krux02_: Considering you are at least somewhat familiar with emacs-lisp, I can show you my library of reusable gpu functions written in lisp krux02_: The first on (the older one) does only shader integration. It does variable lifing for explicit variables only and there are sections for vertex and fragment shader and geometry shader. The second project, in the experiment folder, has a nim to glsl compiler written as a macro. This does allow you to do full shader development in Nim only. No glsl necessary anyomer. axion: It's CL, but it should make some sense to you krux02_: yea axion: https://github.com/mfiano/umbra krux02_: I thought about writing my library in lisp as well, but for my project I need to know the types. krux02_: I am looking at umbra cod enow, I see type annotations like ``:vec3``, but this is a symbol to lisp, not a type am I right? Or is it actually a type annotation that I don't know? axion: This is a dialect of Lisp I wrote in CL, so no, it's just a symbol that semantically means a GLSL type annotation axion: It's a dialect specifically for writing shader functions krux02_: ok krux02_: so you can write shader functions in glsl. krux02_: sorry I mean lisp krux02_: but how do you specify vertex attributes? krux02_: and how do you access them from lisp? axion: Ah, well the way it works is axion: sec lemme find the link axion: here is a program definition https://github.com/mfiano/umbra/blob/master/src/sprite.lisp#L48 axion: that specifies a program with a vertex and fragment stage, using the respective functions named by those symbols... axion: now for vertex stages, the input arguments to the function are vertex attributes, and since lisp can return multiple values from a function, the first value represents the gl_Position, and all subsequent return values are passed as input arguments to the next stage axion: For fragment stages, multiple return values are used to specify framebuffers for multiple render targets axion: so there is none of that i/o block nonsense anywhere krux02_: and what is this: https://github.com/mfiano/umbra/blob/8bfcc30642537319965324236967c8c066b665c3/src/sprite.lisp#L21 krux02_: looks like an i/o block to me Elegant Beef: You guys are talking about using nim for shader programming and im just like "i'd like a game engine to use with it" krux02_: :P axion: that's an input argument to the function annotated to let it know it's an SSBO data using the layout of the spritesheet-data gpu struct krux02_: yea, and that part is what is completely automated in my Nim macro. krux02_: here is where I write a shader in nim: https://github.com/krux02/opengl-sandbox/blob/master/experiment/noiseSphere.nim#L272 krux02_: I call `simplex` wich is imported from a module krux02_: so very similir to what you are doing there. krux02_: in lisp axion: where this syste really shines is it's completely interactive. hitting C-c C-c in emacs on any gpu function will compute the affected shader programs from anything in the graph that was modified and send a recompile signal to them to see the changes update in real time axion: that is, functions act like normal CL functions in that it is fully live-recompilable in the same ways krux02_: the difference is here: https://github.com/krux02/opengl-sandbox/blob/master/experiment/noiseSphere.nim#L286 axion: and everything is modeled in a way to look exactly like the host language, so you use the same operators and idioms for the most part krux02_: modelview comes from the outer scope here: https://github.com/krux02/opengl-sandbox/blob/e076f29efde28a440470dd8fec24a061819d9014/experiment/noiseSphere.nim#L266 krux02_: it is a normal varable. The macro analyzes what variables are used and all used variables are packed into a single uniform buffer object. axion: this codebase i linked is just my gpu stdlib. just small utilities i call from my real game's shaders krux02_: but yea the disadvantage is that when you change the shader, you have to recompiler the entire project. You can't just hotswap the shader only. krux02_: at least not with the nim to glsl compiler. axion: cool krux02_: btw did you already decide on a vectormath library? axion: a friend and i grew frustrated with Unity and Unreal (we worked with them extensively in a game studio) about a decade ago and have been writing a fully interactive game engine ever since. it actually has a couple games written for it already, but still a ways to go before a public release. we can live recompile every aspect and see the changes instantly, not just shaders. texture definitions, mesh axion: specifications, prefabs, materials, etc. all just a keybind away from seeing the whole game change. That is the nice thing about macros axion: Yes I have. I am porting our own CL math library that has all sorts of things you don't find in many math FOSS libraries krux02_: ok krux02_: I always try to convince people to use the glm port that I worked on :P krux02_: https://github.com/stavenko/nim-glm krux02_: It is basically written entirely by me by now, even though I don't host it. krux02_: "host" krux02_: the requirement was to have a precise glsl functionality in Nim, so that I can simply translate Nim to glsl. krux02_: So a lot of work went into making the behavior precisely like glsl. But yea if you are looking for awesome feauters, no it just has what glsl has as well. krux02_: but yea I guess you have your own library that you want to port ¯\_(ツ)_/¯ axion: cool axion: Yes I very much do. What we have is like nothing else and I'd like to bring it to the world of Nim krux02_: ok krux02_: At some point I tried using SIMD for that glm port. But lack of time prevented that I can implement it. krux02_: btw nim-glm has full swizzle support. axion: Yeah that's very easy with macros. That was the first thing I did. krux02_: for me as well, but you also need language support for some operations. axion: Another reason I want to port this math library over to Nim apart from the fact that it's just great, is because I've poured MANY years into the CL version and it's something I'm familiar enough with to know how to do it correctly and efficiently. It turns out, a lot of the math can be simplified or made more correct than what GLM and other libraries provide. I figured my knowledge here would be a axion: good way to learn Nim trying to reconstruct that krux02_: well, glm isn't perfect that I found out. axion: anyway, cool talk, but bed time for me. loving Nim :) krux02_: yea, I should go, too cndkhuong: hello cndkhuong: 👑️ disruptek: sup dawg silvernode: disruptek: yo, how's it going? disruptek: aight, you? silvernode: Making progress on the game. At least 1 commit a day. I have issues staying motivated. silvernode: Decided to make it a turn based game disruptek: then aim for two commits. 😉 silvernode: Hah, I have actually been doing more than that already silvernode: I might need some ideas for the next part I want to write. disruptek: what's that? silvernode: In a nutshell, functions for different tasks like mining. The main game loop counts the turns and the player chooses how many turns they want and then the mining function gets ran that many times, adding ore to your cargo hold. silvernode: I am having trouble adding things to the cargo which is a seq that takes an object instead of a string silvernode: I tried using the add() proc but it wants a string disruptek: when you define the seq, define it like `seq[SomeObject]` instead of `seq[string]`. disruptek: !repos pulseaudio disbot: https://github.com/pulseaudio/pulseaudio -- 9pulseaudio: 11Mirror of the PulseAudio sound server (for bug reports and pull requests go to the website!) 15 197⭐ 140🍴 disbot: https://github.com/masmu/pulseaudio-dlna -- 9pulseaudio-dlna: 11A lightweight streaming server which brings DLNA / UPNP and Chromecast support to PulseAudio and Linux 15 1023⭐ 124🍴 disbot: https://github.com/EHfive/pulseaudio-modules-bt -- 9pulseaudio-modules-bt: 11Adds Sony LDAC, aptX, aptX HD, AAC codecs (A2DP Audio) support to PulseAudio on Linux 15 905⭐ 38🍴 7& 27 more... disruptek: ugh. silvernode: disruptek: I already have seqs that take an object but I want to push new objects but that add() proc doesn't like that. disruptek: use variant objects so all the objects are effectively of the same type. silvernode: hmm, varient objects silvernode: I will search the web for that disruptek: aka case objects because you define them using a case statement syntax in the typedef. Elegant Beef: I might be daft cause i still have 0 idea how to pass inputs into the started process 😄 silvernode: I will have to learn more about that. I am still using common if statement structures in pretty much everything I write. I tend to understand those a bit more. silvernode: although I do use case statements to take command arguments in my shell scripts. disruptek: silvernode: i always write the simplest code i can. disruptek: beef: inputs? disruptek: beef: you can write the proc's stdin. silvernode: disruptek: I try to do the same but could learn more in order to do that better. Elegant Beef: I've tried that, but doesnt work for nano or vim Elegant Beef: Since they dont use the stdin, so i imagine i need to change the entire terminal disruptek: why guess? find a tiny emulator and see how it does it. Elegant Beef: Well i was looking at xterm/vim to see where they get their inputs Elegant Beef: but i couldnt find it on xterm Elegant Beef: rather how it sends inputs in xterm disruptek: look at the suckless term. Elegant Beef: Im thinking i need to make use of pty, so this is pretty much all for naught atm disruptek: yep. Elegant Beef: How dare you agree Elegant Beef: > Man spends more time then needed designing a shitty terminal that doesnt work properly Elegant Beef: This is where i just give in and use st as a base and intercept the output to render specialties disruptek: i mean, it's not nuts. Elegant Beef: what isnt? slymilano: My first package! https://github.com/nim-lang/packages/pull/1402 - Hope it passes muster and helps out some dudes disbot: ➥ Add filesize package Elegant Beef: Does it support to from bibytes? slymilano: no Elegant Beef: Well time to add it 😛 disruptek: ahh, i can do polls now on stream. disruptek: i guess that's worthwhile. disruptek: tomorrow we will do some kind of pulseaudio shit on stream. disruptek: i need some way to setup this stuff smoothly and programmatically. silvernode: how would I simply check if an item exists in a sequence so I can do something in the event that it does exist or something else if it does not exist? Elegant Beef: the contains proc https://play.nim-lang.org/#ix=2esY Elegant Beef: Also worlds bestest grammar by me silvernode: this is on the right track however I would like to reach into the sequence and look to see if an object is there by name. In my code I add ore to the player inventory but instead of adding duplicate ore, I want to check for it and if it exists, then change an attribute of the ore object instead. Elegant Beef: sounds like you want a table instead of a sequence Elegant Beef: Tables store int or string to a value type silvernode: I didn't know we had tables in Nim silvernode: I used to use tables in Lua for this kind of stuff Elegant Beef: So you could do `inventory["ironOre"] = 10` Elegant Beef: Yep Elegant Beef: they dont autohash types which is sorta disapointing silvernode: I would like to send you to some of my code, hang on. silvernode: https://github.com/silvernode/space-nim/blob/experimental/src/space_nimpkg/items.nim Elegant Beef: ok so your inventory could be a table and you could use the name as a key to the table silvernode: So I have an Item type which goes into the cargo attribute of the Ship type. silvernode: the cargo is a seq silvernode: ah I think I know what you mean Elegant Beef: so in this case you could do `if(cargo.containsKey(item.name)): #do something here` silvernode: the name of the table is player.cargo.ore.name (or something like that) Elegant Beef: Something like this Elegant Beef: https://play.nim-lang.org/#ix=2et2 silvernode: I like that, however the cargo happens to be a seq that is part of the ship object so it probably complicates matters silvernode: https://github.com/silvernode/space-nim/blob/experimental/src/space_nimpkg/ships.nim Elegant Beef: how does it complicate it Elegant Beef: It's just a different collection type silvernode: right, I think I am the one complicating things here silvernode: I need to go afk for a bit, are you going to be on irc for awhile? Elegant Beef: Well im in discord so yes 😄 silvernode: It is 22:40 here and I need to stay awake all night to keep my work schedule Elegant Beef: "Work schedule" with corona that shouldnt matter ;P silvernode: barely anyone is online when I have a night off. \ silvernode: Safeway doesn't care about corona, they are making loads of cash right now. I stock for the night crew there. It's crazy right now! silvernode: anyway bbl Elegant Beef: A more safe method is to use enums over strings though Elegant Beef: https://play.nim-lang.org/#ix=2et4 leorize: Araq: https://github.com/nim-lang/Nim/pull/13670 disbot: ➥ Disable Github Actions CI leorize: shashlick: I figured that you might be interested in moving our release pipeline away from travis leorize: github actions got unlimited jobs for open source projects, so we should not be bottlenecked by travis limitations silvernode: leorize: That is actually huge that they are offering that silvernode: travis is so slow leorize: yep kodkuce: does nim have any Android UI lib? djazz: What is the difference between using asyncfile and openFileStream from the streams module? When I read data into a buffer, which is blocking the thread more? For a web server, which should I use to send files to the client? Rn I use the streams module, a buffer and socket.send() which is async djazz: I don't want it to affect other connections to the asynchttpserver PMunch: Isn't there an asyncstreams module? Zevv: there is djazz: How do you do file IO with asyncstreams? djazz: found readToStream, but that uses asyncfile anyway Varriount: Azure pipes are still down? Zevv: async file I/O is a lie Araq: Varriount: no, they are up Varriount: Zevv: The truth is it's all done by tiny people carrying messages back and forth in hidden pipes JustASlacker: so JustASlacker: any recommendation for a editor with nim support? JustASlacker: the syntax highliting in vim doesnt work sometimes exelotl: vs code is probably your best bet federico3: Vim PMunch: JustASlacker, what is your problem with the syntax highlighting in Vim? I've used Vim exclusively for years now.. JustASlacker: well, same here, I use vim for everything JustASlacker: and I wish I knew how to debug it JustASlacker: I have some .nim files for which it wont highlight anything Recruit_main707: how developed is multithreading in Nim? PMunch: JustASlacker, what do you use for highlighting? PMunch: Recruit_main707, it works well, but it might be a bit hard to get right if you don't know what you're doing due to a lack of documentation JustASlacker: zah/nim.vim as vundle plugin does the highliting I think PMunch: Hmm, same one that I use PMunch: Do you have an example file? lqdev[m]: I wish there was better documentation for locks. I already asked like, 3 times before but nobody was kind enough to answer lqdev[m]: I get the idea of a lock, it's basically like a memory semaphore, but how does it know what memory to actually lock? C++ has std::lock which takes the locked objects as arguments, but I don't see anything like that in Nim's stdlib kaushalmodi: lqdev: I have not idea what locks are but is this similar? https://nim-lang.github.io/Nim/locks.html lqdev[m]: that's what I'm talking about, I'm just asking if somebody could explain to me how they work. kaushalmodi: I agree though that that locks module needs some prefacing documentation and then doc examples for all procs PMunch: Ah PMunch: Okay, so a lock isn't actually attached to anything PMunch: By default anyways alehander92: it seems it allocates the memory itself alehander92: initSysLock calls L = castSysLock (c_malloc(sizeof(SysLockObj))) alehander92: and then `pthread_mutex_init` alehander92: on posix(??) alehander92: you can take a look at syslocks.nim alehander92: i am not an expert as well PMunch: There is however this experimental feature: https://nim-lang.org/docs/manual_experimental.html#guards-and-locks PMunch: Where you can tell Nim that a variable is guarded by a lock, and use a pragma to aquire said lock alehander92: interesting! PMunch: I really should finish my article on multitasking in Nim.. PMunch: So much to do! JustASlacker: PMunch: https://termbin.com/hwkr PMunch: But to answer your question a bit more structured lqdev[m]: A lock is not anything special, you can just treat it as an object that you can call acquire and release on. The special property of a lock is that once one thread calls acquire, no other thread will be able to acquire the lock until the first thread calls release on the lock (simplifying a bit here, there are RW locks as well). Whatever you do in this so called "critical section" is up PMunch: to you, but should include any reading/writing of shared resources that can't be interleaved with other access to the same resource. This takes a bit of careful thinking to figure out what actually needs to be locked and not for optimal performance, but that's a much wider topic. By default a lock is not attached to anything, so what you do in the critical section is completely up to you. But if you use the experimental guard feature I linked to PMunch: Nim will guarantee that a {.locks.} statement occurs around access to a {.guard.}-ed variable. As the documentation explains it doesn't actually lock anything, so you should do that with a template as it shows. Hope that helps to make it at least a bit clearer.. axion: Can someone help me with a template? I'm not sure if a template or macro is needed for this, and I'm really clueless how to approach the problem PMunch: JustASlacker, that site is blocked by our work-network that I'm VPN-ed into atm.. Could you use ix instead? PMunch: Or pastebin or whatever PMunch: axion, hit me JustASlacker: ix ? axion: https://gist.github.com/mfiano/d5ed8f41697c0e468e42d4af8231e363 PMunch: JustASlacker, ix.io JustASlacker: https://pastebin.com/zmbGDYYM JustASlacker: too late -_- PMunch: It's what the playground uses for its pastes :) JustASlacker: ah, good to know JustASlacker: hmm, pastebin isnt showing any highliting either PMunch: Highlights fine for me: https://uploads.peterme.net/2020-03-17-135111_1229x951_scrot.png JustASlacker: http://ix.io/2eur PMunch: ix also highlights it properly: http://ix.io/2eur/nim PMunch: Err, well up to a point.. JustASlacker: :P PMunch: It doesn't seem to understand the """ quotes JustASlacker: well, I dont really need a python mulitline thingy JustASlacker: is that actually a valid nim construct ? alehander92: have to tell that sublime works fine JustASlacker: or was I just lucky to get that compiled alehander92: but its not free software so yeah alehander92: but its an option PMunch: axion, oh you want one that works with Vec[N] basically? JustASlacker: guess I have to ask #vim axion: PMunch: yeah axion: PMunch: Oh forgot to mention, it should generate `<` too, so I get `>` and `>=` automatically PMunch: axion, something like this? https://play.nim-lang.org/#ix=2euv axion: Interesting...inspecting. Btw, it suddenly became useful to make this macro more generic, so I can just give it an operator to generate any component-wise boolean check PMunch: https://github.com/nim-lang/packages/pull/1403 < as soon as this is merged I will add macroutils to the playground :) disbot: ➥ Add macroutils package Recruit_main707: c++ `uintptr_t` is `ptr uint` in Nim? Yardanico: cuint? Yardanico: ah nvm Yardanico: maybe just "pointer" ? alehander92: PMunch https://github.com/PMunch/macroutils alehander92: where are the examples? Yardanico: in the docs Yardanico: https://uploads.peterme.net/macroutils.html alehander92: like, i dont see them rendered alehander92: no, they are in the rst source alehander92: so they should be in github as well PMunch: Yeah I know.. For some reason GitHub doesn't seem to support code-block.. PMunch: So I need to convert my docs to use ``` instead alehander92: yeah i recall correctly nope alehander92: https://raw.githubusercontent.com/alehander92/RFCs/master/RFCs/nilcheck.rst alehander92: i think i managed to fix it for my rfc alehander92: with using one empty line (?) alehander92: so you can use rst PMunch: Oh an empty line after .. code-block:: nim as well? PMunch: Damn it, why is RST so fiddly! alehander92: yep it seems as maybe more proper syntax alehander92: couldnt find a good source alehander92: but yeah alehander92: no it's good if you get used it PMunch: No, it's not.. PMunch: Hmm, new line didn't work.. alehander92: well it does work: the source i send gets rendered ok PMunch: Yet when I updated my file it didn't PMunch: Found the issue PMunch: You need both a newline and a space between :: and nim axion: Has anyone ever gotten an unused import warning, but the code actually does work, and removing the import line is a semantic error with nim check? alehander92: oh yes alehander92: to PMunch* alehander92: axion what are you using from that import? a macro/variable/function? PMunch: There! finally! PMunch: If RST was good it wouldn't take me two days to get code blocks to show up on GitHub.. PMunch: A semantic error? axion: PMunch: https://gist.github.com/mfiano/d5ed8f41697c0e468e42d4af8231e363 PMunch: I still think something like this should be part of Nim by the way: https://github.com/PMunch/macroutils/blob/master/nimtorst axion: Can anyone explain that? I have never seen it do this PMunch: Huh, that is indeed strange alehander92: huh seems like a bug PMunch: Nim doesn't appear to consider using a const as using a module axion: Huh alehander92: probably a bug alehander92: best to report it on github axion: I'm reporting it now alehander92: thanks! axion: Issue #13673 is my first :D disbot: https://github.com/nim-lang/Nim/issues/13673 -- 3Nim doesn't appear to consider using a const as using a module ; snippet at 12https://play.nim-lang.org/#ix=2euB alehander92: :) alehander92: iirc nim maybe does turn const-s into values very early alehander92: because i think i remember some compile-time errors which used the "calculated" values instead of the const names alehander92: so if that's true maybe it just doesnt see a const node with original module info anymore when it checks for usage alehander92: but this might be a wrong hypothesis axion: I hope a resolution can be found if that's the case. I typically write whole modules with nothing but constants in other languages. PMunch: Is there a top-level {.using.} pragma? alehander92: for now as a workaround you can use the used alehander92: https://nim-lang.org/docs/manual.html#pragmas-used-pragma PMunch: Ah, meant used alehander92: but eventually it should be fixed hopefully alehander92: <3 alehander92: axion i looked through your blog and other stuff and you seem as a big lisp fan alehander92: how do you find nim for now axion: Oh my blog is ancient. I don't think I updated it in years lol. alehander92: yeah i am just a curious guy sorry axion: I find Nim...nice so far. Not Lisp by any means, for better or worse, but nice so far (only been using it a couple weeks or so) alehander92: i also liked lisp a lot before, not so much but moderately axion: I have a lot of problems with Lisp after 2 decades of exclusive use. kaushalmodi: axion: (e)lisp + nim fan here alehander92: wow a lot axion: I could list all the issues I have with it, and why Nim is better if you don't mind a huge rant kaushalmodi: You can blog about it :) alehander92: i dont mind axion: 1) Software distribution is a huge pain with Lisp. There are no versioned dependencies. Instead we rely on a central repository which pulls tracked github repositories and http tarballs once per month at a time unbeknownst to developers, and they are not included if there are build failures. So in this respect, every user of some tool is always up to a month (sometimes longer) behind, and as a axion: developer, trying to fix bugs for the next release is a losing battle because you never know when a release will occur. The fact that there is no possible way for a project to depend on different versions, and always uses the latest in the central repository is a huge point of failure. Kiloneie: Why is Nim's survey vastly different than last year's ? federico3: just like go axion: 2) Editor support and tooling. For Common Lisp, since it is probably the most interactive programming language in that you have access to the parser, evaluator, compiler and printer during parsing, evaluating, compiling or printing recursively, allows a lot of powerful introspection support, but absolutely requires using Emacs with a specific plugin. There are other editors with similar tools, but axion: you're throwing away a decent chunk of the language by using them, because Common Lisp is just built with interactivity in mind from the ground up. Kiloneie: I think these yearly surveys could cover more topics. federico3: axion: taking regular snapshots is a very good design, but not from a random commit obviously axion: 3) Documentation. Common Lisp software is rarely ever documented. 4) Software quality. Apart from documentation, software is usually incomplete and broken in lots of ways, due to the fact that there is no collaboration. Every piece of software is developed by a single developer for their particular use case. CL developers do not like to work together. axion: 5) The standard was published in 1994 to bring the features of Lisp since the 1960's into a standard document...an eternity in the software world, and won't ever be updated. This is nice in that software from the 60's still runs today on conforming implementations of the language, but it also means that the language is stuck in the past, and you pretty much have to write everything extra yourself (see axion: #4 above on why this is bad). axion: I could go on, but that's enough for now :) Rika: nim takes on semver which is nice Rika: it gives the benefit of 5 without the disadvantage alehander92: axion i see alehander92: interesting observations alehander92: so why did you decide to stop with clojure which i saw in your blog which seems as a more modern lips alehander92: lisp axion: That said, it does have a lot of benefits that other languages haven't come close to, particularly the interactivity and the power provided by its macro system. Yes, even Nim unfortunately. axion: I don't like Clojure at all. axion: It sort of forces you down a particular paradigm of immutable-style FP, and it runs on the JVM where you don't really have control over memory or code generation. axion: For real time applications and low memory footprint, Clojure is just impractical. Araq: for me dynamic typing remains a showstopper Araq: DT simply ain't for me alehander92: :) axion: I have stayed with Common Lisp for so long because I'm a game developer, and I can generate efficient machine code with the right CL implementation, while being able to control every aspect of the compiler at runtime. For example, I could recompile a DSL that defines a texture to point to a new image on disk, and every entity in the game will get updated immediately, without stopping the game, axion: compiling and waiting, starting the game, and getting back to the point where you were. For subtle changes, you have to screenshot to even notice any effect. axion: That last bit was with most other languages of course. axion: Well CL moreso has a gradual typing system. Araq: when I looked at it its type system was mostly "assume type X here for optimization" Araq: it didn't check anything axion: Type annotations are implementation-specific, so if you're talking about the language then yes you're correct. Some implementations will allow you to annotate and turn aggressive checking up so that they are compile time errors. Araq: fair enough but I doubt it works well in practice where one tends to work with underspecified junk code :-) axion: Hence why everyone writes their own stuff axion: I am sick of all that to be honest, but I have about 100k lines of a game engine that I will probably still work on in my off time, because it's pretty much my life's work. Araq: well in C++ game engines everything is written from scratch often too Araq: (STL is bad!) axion: :) axion: @alehander92: {.used.} on a const doesn't seem to remove the warning for me alehander92: no no alehander92: {.used.} on the whole module axion: Ah I saw the toplevel declaration in the manual, but I don't understand what `defined(numHasUsed)` is actually doing. alehander92: axion yeah alehander92: sorry, the first thing is still useful info : obviously {.used.} doesnt work for consts itself alehander92: otherwise i suspect this is for backward compat alehander92: if you happen to have a lib targetting older nim where {.used.} didnt exist? alehander92: but normally you would just do `{.used.}` axion: I kinda feel dirty for treating the whole module as used though. I kinda want the warnings to appear for non-consts in that module to catch mistakes alehander92: yes, you're correct, that's why the bug is there alehander92: oh man i finally realized i am stopping a parent process of the one i wanted to stop.. axion: If I have a type parameter T that is an "or" typeclass for a few different array container types, is there a way to get the containing type of that array as another parameter? qqtop: ((https://camo.githubusercontent.com/6aba6c848ec3c87a75eb8ec63f734ab70f609c88/687474703a2f2f7171746f702e6769746875622e696f2f6e696d2e6769663f7261773d74727565)) clyybber: sick clyybber: axion: You mean like [T: int or uint](a: array[T]) ? axion: Maybe, lemme try in a few when I'm done with lunch. Thanks lqdev[m]: axion: if you have sth like [T: array | seq](a: T) you'll need to write a macro that extracts generic types lqdev[m]: something similar to https://github.com/liquid600pgm/euwren/blob/9148e9d439ae091ccca72a71e91c466f3a0ef0e4/src/euwren.nim#L224 clyybber: lqdev[m]: You should be able to do [D, T: array[D] | seq[D]](a: T) clyybber: ignore the array only having one generic param :p disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: time to write a pulseaudio controller. disruptek: name suggestions? disruptek: it just has to let me automatically adjust levels and connect sinks/sources by app name. clyybber: disruptek: Nice, pulsecontrol? disruptek: seems like this has been done so many times but i cannot find the right solution for me. disruptek: i think i can just use dbus. clyybber: pulsemixer? clyybber: have you heard of that one? clyybber: thats what I use clyybber: dunno, if it can connect sinks/sources by app name tho disruptek: yeah, that's the problem. clyybber: sounds like you are looking for jack :p clyybber: or pipewire disruptek: yeah, i'm just not ready to take the plunge into jack. disruptek: this'll be a stream hack. like 2-3hrs. clyybber: pipewire is jack + pulseaudio clyybber: ah clyybber: ok disruptek: start-to-finish cli tool. disruptek: pulsemixer is kinda what i want, but there's no way to automate it. disruptek: pavucontrol is the same thing, basically. shashlick: does it have a wrapper disruptek: not yet. disruptek: i thought about that, but i'm not the right guy to stream it. 😘 disruptek: pulseauto alehander92: oh ok so pgrep -P alehander92: is what i need kristianmandrup: I'm getting `undeclared field: 'kind' for type system.NimNode` kristianmandrup: macro defineComponent*(body: untyped): auto = ⏎ if body.kind == nnkStmtList: kristianmandrup: defineComponent: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e70eacc11701c039554d32d] kristianmandrup: I took this directly from `react.nim` so wondering if sth in the nim internals changed? kristianmandrup: https://github.com/andreaferretti/react.nim/blob/master/example/app.nim#L42 kristianmandrup: NimNode* {.magic: "PNimrodNode".} = ref NimNodeObj ⏎ ⏎ ```## Represents a Nim AST node. Macros operate on this type.``` [https://gitter.im/nim-lang/Nim?at=5e70eb33ebcea00e68fd00c4] kristianmandrup: Hi @alehander92 , I'm finally back alehander92: hey alehander92: welcome :) alehander92: yeah the definition is a builtin alehander92: so `kind` is defined internally afaik kristianmandrup: so what could I be missing. I literally copied the macro and using the same way of calling it as in `react.nim` example alehander92: but i have no idea why would you get missing field kristianmandrup: https://github.com/andreaferretti/react.nim/blob/master/react.nim#L155 kristianmandrup: https://github.com/kristianmandrup/react-16.nim/blob/master/react16.nim#L9 kristianmandrup: https://github.com/kristianmandrup/react-16.nim/blob/master/example/sandbox.nim#L8 kristianmandrup: Been trying to upgrade the original `react.nim` to work with latest nim and React 16.x kristianmandrup: How can I best debug this issue? axion: I'm probably overthinking slices here, but how would i write the contents of 2 smaller arrays into a larger one? a = [0, 1]; b = [2,3]; c = [0,1,2,3]? alehander92: well you can try echo body.repr alehander92: then echo body.treerepr axion: trying to do it concisely without multiple result slices kristianmandrup: If I look into the nim compiler, it always seems to reference `PNode` kristianmandrup: proc makeStmtList*(n: PNode): PNode = ⏎ if n.kind == nkStmtList: alehander92: in the beginning of the macro alehander92: yeah NimNode is used for macros, PNode is just a compiler detail alehander92: i guess NimNode basically is a PNode actually but that's the user facing api yeah alehander92: mostly the difference practically is to use nk for PNodes and nnk for NimNodes iirc kristianmandrup: macro defineComponent*(body: untyped): auto = ⏎ echo body.repr ⏎ echo body.treerepr ⏎ if body.kind == nnkStmtList: [https://gitter.im/nim-lang/Nim?at=5e70edd9e72d577020a0d846] kristianmandrup: Nothing is being printed alehander92: well, that's strange alehander92: can you just call it with a very simple argument next to the macro def alehander92: try a minimal repro example which works and go on from there axion: proc foo(c: var array[4, int], a, b: array[2, int]): # is there anyway to write the values of A and B into C in a single line without two `c[N..M] = ...` lines? kristianmandrup: yeah, so I'm calling macro with a proc node kristianmandrup: I tried kristianmandrup: defineComponent: ⏎ ⏎ ```var x = 2``` [https://gitter.im/nim-lang/Nim?at=5e70ee5711701c039554e142] kristianmandrup: With kristianmandrup: macro defineComponent*(body: untyped): auto = ⏎ echo body.repr ⏎ echo body.treerepr kristianmandrup: still the same error and nothing being printed kristianmandrup: nim --version ⏎ Nim Compiler Version 1.1.1 [MacOSX: amd64] ⏎ Compiled at 2020-03-17 kristianmandrup: react16.nim(11, 12) Error: undeclared field: 'treerepr' for type system.NimNode alehander92: you need to import macros alehander92: maybe react is exporting them but not completely alehander92: https://play.nim-lang.org/#ix=2ev8 alehander92: (click on showing output and then on Run) alehander92: and on showing output again, i mean whenever you need to see debug/compiler info alehander92: PMunch maybe we can one day show both alehander92: on a side by side view alehander92: i know tho , PR-s welcome clyybber: PMunch: How do you know I want a string literal and not an ident? clyybber: In you Command example PMunch: Huh? PMunch: clyybber, ^ clyybber: PMunch ? PMunch: You asked how I know if you want as string literal clyybber: yeah clyybber: Did I miss your answer? PMunch: You mean how I know to convert the first string to an ident and the second to a tring literal? clyybber: Yeah clyybber: Do you only implicitly convert to ident? PMunch: Ah, Command has the signature "proc Command(name: string | NimNode; arguments: varargs[NimNode]): NimNode" PMunch: And string literals are auto-converted to NimNodes of a string literal axion: if i do [N, M: static[int]] is it enforced that both must be different values, and if not, is it possible to do this? clyybber: axion: Yeah, but you gotta use when inside the proc/template clyybber: PMunch: I see PMunch: But if Command is given a string as the first argument it is converted to an Ident leorize: axion: when N == M: {.error: "Your error message here.".} axion: I see, thanks. Kvothe87: hi, can i ask for some simple help? Kvothe87: i want read a csv and convert to a json format but i have some issues Kvothe87: https://play.nim-lang.org/#ix=2evu Kvothe87: example of what i'm trying and what i am trying to obtain alehander92: why dont we detect alehander92: exportc for same names with different signatures alehander92: probably the c compiler error is good enough? leorize: well when you `{.exportc.}` you basically tell the compiler: I know what I'm doing leorize: Kvothe87: here you go: https://play.nim-lang.org/#ix=2evF leorize: I swapped to stringstreams because your version wouldn't run on the playground disruptek: #13065 disbot: https://github.com/nim-lang/Nim/pull/13065 -- 3Better C++ based exception handling disruptek: any eta? Araq: disruptek, found more failing tests with it Araq: however Araq: --exceptions:goto does work with 'nim cpp' disruptek: ah, nice! Araq: and should be a good workaround disruptek: it's not default, though, right? Araq: nope Araq: speaking of which Araq: https://github.com/nim-lang/Nim/issues/13668 is a worst case disbot: ➥ goto exceptions bug: an error cannot catch by except. ; snippet at 12https://play.nim-lang.org/#ix=2evQ Araq: I'm rewriting the implementation yet again, rather unsuccessfully Araq: turns out that 'getCurrentException' is hard to support :-( disruptek: oh dear. disruptek: why does that break? Araq: conflicting code generation requirements Araq: for the simple case I have workarounds... disruptek: i hate that i require defer. dumjyl: can https://github.com/nim-lang/Nim/pull/13567 be merged or should I make another PR without the unrelated changes? disbot: ➥ Add nnkMacroDef to RoutineNodes in macros.nim. Araq: please create a fresh PR that only touches macros.nim Yardanico: there's a guy in telegram asking if nim has something in stdlib to truncate a float to some decimal points, like -0.0980000 to -0.09 Kvothe87: @leorize thank you Yardanico: right now he uses formatFloat with parseFloat Yardanico: parseFloat(num.formatFloat...) disruptek: strformat Araq: strformat can also do it iirc Yardanico: well, he doesn't want to print it out Yardanico: he wants to truncate it as a "float" type :P disruptek: that's not a thing. leorize: yep that's not a thing Araq: exactly Araq: there is round() though and friends leorize: tell him that if he want precision, floating point isn't the right thing to use dom96: !eval echo(("0.0980000")[0 .. 4]) NimBot: 0.098 dom96: :P Yardanico: yeah he does something like that Yardanico: return parseFloat(i.formatFloat(ffDecimal, dec_acc+1)[0..^dec_acc]) Araq: tell him it's fine leorize: I'm scared :P Araq: hmm Araq: oh well clyybber: floats are overused and misunderstood matrixbot: `BarrOff` Could someone please take a look at https://github.com/nim-lang/Nim/issues/13675 ? I would really appreciate opinions and guess it is low hanging fruit. disbot: ➥ nimcall not passable to closure parameter ; snippet at 12https://play.nim-lang.org/#ix=2ew1 leorize: BarrOff: you can join our irc channel at #freenode_#nim:matrix.org Araq: type conversions are not lifted to typeclasses Araq: no bug here and you should use overloading, Nim is not a shitty version of Go Araq: hmm this version is close to working... matrixbot: `BarrOff` Sure, overloading with two procs solves the problem, but why doesn't it work as I had hoped for? Araq: because type conversions are not lifted to "or types" Araq: I'm not sure it would be sound :P Araq: wooohhooo! got it Araq: man this was a hard one... matrixbot: `BarrOff` oh, ok. Will look that one up in the documentation. Thank you for the help Araq: probably not covered by the spec :-( clyybber: hehe, --threads:on is broke with --gc:arc and -d:useMalloc Araq: how come? clyybber: /home/clyybber/builds/nim/lib/system/mm/malloc.nim(79, 23) Error: pragmas are only allowed in the header of a proc; redefinition of 'deallocOsPages' from /home/clyybber/builds/nim/lib/system/threads.nim(111, 8) clyybber: Because of this error ^ Araq: so ... I think I got it Araq: the code is also simpler than before clyybber: Araq: What did you solve? clyybber: The exceptions thing? Araq: issue #13668 disbot: https://github.com/nim-lang/Nim/issues/13668 -- 3goto exceptions bug: an error cannot catch by except. ; snippet at 12https://play.nim-lang.org/#ix=2evQ clyybber: Nice Araq: only had to rewrite the implementation once again clyybber: hehe Araq: but now it makes plenty of sense and the code is faster Araq: less junk generated PMunch: Kvothe87, not sure if you're still around: http://ix.io/2ewa Araq: and the optimization is not required anymore either, nice leorize: ~matrix is the #nim channel on Matrix can be found at #freenode_#nim:matrix.org disbot: matrix: 11the #nim channel on Matrix can be found at #freenode_#nim:matrix.org clyybber: Araq: That diff is a beauty: 7 adds, 23 dels :D clyybber: Araq: But it can't handle currentException? Araq: yeah I think so as it's part of the intensive tests Araq: getting them all to pass is an art... clyybber: Nice clyybber: Araq: Btw, regarding the threads:on issue, when is the stub in malloc.nim required? Araq: I dunno, aks Zevv clyybber: Zevv: ping Simula: does nim have a well-documented easy-to-use gui library? PMunch: Define well-documented PMunch: Same for wxWidgets Simula: i can write code without having to dig through apis and poorly documented examples PMunch: You might want to check this out: https://matthiashager.com/gui-options-for-nim Simula: i checked that out, nothing fits what i need Simula: ah well, i'll try and contribute when i can PMunch: I have been saying for years now that I should write a UI toolkit for Nim.. PMunch: So maybe if you wait a couple more years I'll get around to it :P Simula: I like what exists now, I just can't figure out how to get it to work for me :/. Simula: I like what exists now, I just can't figure out how to get it to work for me :/ PMunch: What is it that you can't figure out? Simula: e v e r y t h i n g Simula: i'm trying to make an image previewer of sorts. i want to display some image previews in a grid that scrolls along the y axis PMunch: Haha, well everything is a bit hard to explain :P Simula: i'm already farther in Qt haha Rika: good qt lib when Simula: the only good qt lib is for c++ Recruit_main707: python? Rika: that sucks simula axion: Probably good to contribute to existing efforts, because GUI is one of the most time consuming things you can work on - ask any game developer. axion: THis floated by me recently, a decent start it looks like: https://github.com/johnnovak/koi Elegant Beef: i liked nigui but it was a pain Elegant Beef: i liked nigui but it is a pain Yardanico: axion: did you usee gintro? Rika: but i dont need immediate mode tho Yardanico: IMO it's the only viable option for easy desktop apps in Nim rn :P Yardanico: well, also nimx, but idk :D axion: I'm not really one to "use" any toolkits. I don't even use GUIs really. I use my browser when I have to, and not with the mouse. PMunch: I wrote the genui macros for wxWidgets and Gtk which works pretty well. But I never really used them all that much axion: What are some good projects that exemplify writing great documentation, preferably with rich Nim DocGen output? PMunch: I try to give my projects as good documentation as I can, not sure if that counts.. alehander92: i think all kinds of projects alehander92: but especially ones which can be educational alehander92: or which can have many edge cases/gotchas alehander92: in their implementation axion: Ok thanks. Another question axion: How should you split up newlines when you have a real long type parameter section, and thus parameter list, and you want to stay within 80 columns? axion: The compiler doesn't like the parameter list on a new line after the type parameters disruptek: i split on the pragma and in the parameter list, what else? PMunch: You mean like this? https://github.com/PMunch/macroutils/blob/master/src/macroutils.nim#L990-L994 axion: That's fine and all, but if the type parameters doesn't leave room for the parameters that are expected to be on the same line as the last type parameter line, what to do? PMunch: I don't understand what you mean.. axion: proc foo*[some really\nlong\ntype\parameters](parameters) = discard. Here (parameters) must be next to the ], but there isn't room in 80 columns to do that axion: if i i mean i could do it but the shape of the code looks very bad and painful to read axion: s/if i// PMunch: Do you have a concrete example? axion: Sure, something like: https://gist.github.com/mfiano/d5ed8f41697c0e468e42d4af8231e363 axion: It reads poorly with the parameter list required to be next to the ] and not easily scanned PMunch: I'd probably end up doing something like this: https://play.nim-lang.org/#ix=2ewT disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: finishing this pulseaudio tool PMunch: You're writing a pa tool? axion: I was considering something like that or https://play.nim-lang.org/#ix=2ewU but both just equally bad to me. I guess I'll have to get used to it :/ Simula: axion: that hurt to read PMunch: Yeah I guess that's another option axion: is nimsuggest what is responsible for reformatting on file save in nim.nvim? PMunch: That might be nim --stylecheck or something like that axion: PMunch: because with your suggestion, it is reformated to make it look like the parameter list is part of the body...even more difficult to read: https://play.nim-lang.org/#ix=2ewX PMunch: Haha, yeah that isn't great.. PMunch: I really wish Nim was a bit more lenient on where it allowed newlines sometimes.. dumjyl: @Vindaar Your recent changes to ginger are causing CI failures, infinite recursion here: https://github.com/Vindaar/ginger/blob/master/src/ginger.nim#L1779. axion: Yeah I don't know much about the compiler but it would seem to be trivial to allow newlines after a closing delimiter axion: Must be a good reason for not allowing such though...who knows Vindaar: @dumjyl oh crap. I didn't think about the fact that it'd already use the new version for `ggplotnim` Vindaar: I'll fix it! Thanks for notifying me! krux02: axion: what do you want to pass to init? krux02: to me it looks like you want to pass a type and a static parameter. Vindaar: @dumjyl ok, updated. The next time CI runs it should be fine again. Sorry everyone :) axion: krux02: That was just a contrived example to demonstrate the identation issue. clyybber: I guess the issue would be that [] is also used for indexing krux02: ah, ok clyybber: And the `(` in the next line could be parsed as the beginning of a tuple assignment krux02: well you have a very unusual combination of arguments there dumjyl: @Vindaar thanks for the quick response. leorize: axion: nim.nvim have no such feature.... axion: leorize: Hmm, could be vim-polyglot then or something that reformats code into Nim style on save then krux02: axion, just a question though. As a (former) lisp programmer, do you use emacs for Nim? axion: I would have expected mentioning nim.nvim and vim-polyglot to answer that Rika: lol krux02: ok then axion: I fucking hate Emacs. krux02: interesting. axion: I used it because I had to, but no more. axion: Always loved vim krux02: well I used both, and I hated both krux02: now I can use both. krux02: I started with vim, hated it. Changed to emacs, hated it. Stopped complaining, internally resigned, and then just got along with it. krux02: Now I like it. axion: I do most of my work remotely, and neovim has true-color support on the terminal and is fast, so shrug krux02: well, neovim is certainly good. But I am hoping that someday sombody comes to me on my lonely emacs nim island. leorize: kaushalmodi is a fellow emacs user :P axion: I use Linux for my OS, but thanks anyway krux02: I like `vim` as an editor, but I really don't like vimscript. But I do like elisp somehow. That is the most important reason for emacs. axion: Well vimscript is a DSL, it a GP language suitable for writing the OS that is Emacs. It's designed to be concise and to conform to Vim's data structures. krux02: I hope that someday an experienced emacs guy comes to the Nim world and starts to fix the problems that nim-mode has and that are too hard for mee to fix. disruptek: designing dbus api on-stream axion: it's not a GP language* disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek voltist: Could anyone explain to me what TArg is for the Thread object? PMunch: Yes PMunch: TArg is what the thread takes as its startup argument krux02: What I don't like about vimscript is that I don't understand the anatomy (syntax tree) of vimscript. Everything is just unclear to me, where does a token end? What is a function etc. PMunch: It's only one argument, so if you need to pass more than one thing, use a tuple or an object krux02: My knowlegde of programming languages does not map to vim. leorize: krux02: it uses a function-endfunction style of syntax axion: I prefer fun-endfun myself, but yeah leorize: everything in vimscript is a vim command voltist: PMunch: So the type accepted by the proc that the Thread executes? krux02: What I mean was, I once made something into a comment via " voltist: *thread PMunch: voltist, yes. Pretty much krux02: but then it wasn't really a comment but leaked into a package and then errors occured. leorize: voltist: TArg is a generic type, just like (ie. `T`) krux02: really weird, I didn't understand PMunch: Normally you define a thread by attaching the {.thread.} pragma to a procedure with one argument. And then you can start that thread by calling "createThread" on a variable that is a Thread with that same argument as it's TArg. PMunch: Like they do in the example krux02: then there are things that you just copy over from other init script that do things for example, nobody explained to be why I had to put ``call plug#begin('~/.vim/bundle')`` in there leorize: that's because you're using vim-plug :P krux02: and is the # like accessing a namespace? or is it just a single identifier containing # krux02: yea I know that it is for vim-plug :P I mean I don't understand what is going on. axion: I suggest reading the book a friend of mine wrote "Learn Vimscript the Hard Way" available for free online leorize: and yea `#` is kinda a namespace voltist: "Error: no generic parameters allowed for Thread". Interesting... krux02: I just have a simple time to understand emacs lisp, even though that can be tough to understand as well. leorize[m]: axion: that's the book I used to learn vimscript for writing nim.nvim :) axion: Ah yeah I'm friends with the author who is also a Common Lisper. Good book! PMunch: voltist, you seem to be doing something wrong.. rayman22201: I've been a vim guy for a long time, but just started emacs to check out the "other side". I also do a lot of remote dev, and I'm actually really enjoying it. TRAMPS is pretty F*&king amazing. PMunch: I really want to give kakoune another go leorize[m]: I used emacs for awhile but I don't like how bloated it is leorize[m]: kakoune is a fun editor voltist: PMunch: Indeed krux02: leorize[m], yea emacs is bloated, but still it starts quickly and that is what matters. leorize[m]: they still don't have proper tab-as-space expansion the last time I checked krux02: It just doesn't start quickly if you add a lot of bloat on top krux02: but that is true for emacs as well krux02: I mean true for vim as well leorize[m]: took me 30s to have it booted up on a brand new setup :P krux02: and by now I used too many emacs featurs that I would want to switch back to Vim. rayman22201: A big reason is, I use windows for work reasons, and I want a sane OS abstraction on top if it. Emacs works pretty good for that purpose. Also, emacs server mode works really well in windows as well. So the startup issue isn't that big of a deal for me. :-P axion: leorize[m]: that's builtin rayman22201: Emacs still takes up less memory than the freaking slack client I have to keep open on windows lol Demos[m]: IMHO the correct sane OS to use on windows is NT krux02: lol rayman22201: lol Demos[m]: NT is sane, very sane, windows not so much voltist: PMunch: I'm using an Object 'ObjectX' as TArg when creating an array of Thread objects krux02: windows NT doesn't run games. krux02: :P voltist: var thr: array[0..49, Thread[ObjectX]] Demos[m]: emacs suffers from the "I'm a linux app and I expect CreateProcess to be fast" problem :( clyybber: kakoune is great rayman22201: Demos[m]. Biggest disadvantage to using emacs on windows. I can live with it for now though :-P krux02: Demos: that is better than th "I'a a windows app and I expect that you tell me where you installed the c++ compiler is for every project" Araq: what's up with ggplot? broken? Rika: more like "i expect this compiler to have specific features the compiler you have doesnt" PMunch: clyybber, yeah I tried it for a while just as I was getting into Vim properly. But it missed some things I had configured my Vim to do, which I no longer use. PMunch: And what is ObjectX, do you have a code snippet? Demos[m]: wait does nim have a ggplot impl? Araq: sure clyybber: and its really great voltist: PMunch: Here is the object https://pastebin.com/q7ZYjEKG federico3: is treeform around? PMunch: Oh wow, that opened in a different browser from the one I normally use. Is pastebin really that full of adds? clyybber: hastebin is a good bin leorize: I refuse to browse the internet without an adblocker for this exact reason Yardanico: ublock origin blocked google tracking and some shady aj2073.online website for pastebin :P Yardanico: leorize: I have uBlock Origin + AdGuard Home (a blocking dns server similar to pihole but easier to set up) voltist: Yeah I don't notice thanks to my ad blocker leorize: simple-adblock + unbound solves it for me on my router PMunch: voltist, don't know what you were doing but this works fine: http://ix.io/2exd PMunch: leorize, yeah my normal browser obviously has an ad blocker PMunch: clyybber, ix.io is the best one IMO leorize: and 0x0.st for sharing pictures PMunch: I just use my own server for that.. leorize: that's quite a luxury to me PMunch: Everyone should have their own server :( leorize: too expensive :( Vindaar: @Araq I broke something by updating ginger (backend) and introducing a bug. It should be fixed now PMunch: leorize, yeah I know it can be expensive.. PMunch: I guess I'm lucky, I even have a static IP at home so worst case scenario I could set up my server here voltist: PMunch: Ah, it's because my proc has "var Worm". Would there be a thread-safe way to modify the object? PMunch: Uhm, probably not.. PMunch: Well, I mean you could add a Lock to the object voltist: Ok, I'll have a look into that PMunch: Oh well, time for bed Araq: Vindaar: do you use --gc:arc ? Vindaar: @Araq: nope, not yet. PMunch's persvector doesn't yet support it, afair Araq: ok so I can merge https://github.com/nim-lang/Nim/pull/13677 then disbot: ➥ rewritten goto based exception handling; much cleaner implementation;… Vindaar: yeah, if `ggplotnim` was the only failing package, it should be safe. Was a stupid bug on my part Araq: yeah the others were green Vindaar: ah good. I'll be off to bed now. Good night everyone! zetashift: gnight axion: If I define a constant locally in a proc, is that okay? Will it really not have global scope, and is it idiomatic to do this? leorize: axion: yes, it won't have global scope, and it's an idiomatic thing axion: great thanks Yardanico: damn our discord server has 781 members :P most of them are inactive though Yardanico: What does mean in the source code? https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/collections/lists.nim#L102 Yardanico: https://nim-lang.org/docs/lists.html#SinglyLinkedList one of the types has parens and the other doesn't, but they're the same type dumjyl: It is the `owned` operator for `--newruntime`. It was supposed to be removed but idk what happened: https://github.com/nim-lang/Nim/pull/11145 disbot: ➥ introduce temporary for 'owned' to get this compile with 0.19 luis_: Hi everyone, hope you all safe and healty... is there a quick way to check whether a website is on using nim? luis_: I have been using something like: https://i.imgur.com/Y60yVp0.png luis_: Or is there a quicker way? Rika: send a head request maybe idk jjido: Mmh. Looking at my chan log. It is 2020, and the Vim-Emacs argument is *still* not settled. LOL exelotl: *laughs in normie text editors* jjido: exelotl what do you use for nim? exelotl: I use vs code but I've also been trying textadept for some things jjido: vs code is capable Skaruts: how do I move an item in a seq to another position in the seq? exelotl: I don't like how bloated vscode can be, but it's comfortable and well designed, I can always get stuff done in it leorize: Nim-wise, vscode and neovim provides the best integration :P Rika: huh when was vscode bloated leorize: when it was born :) exelotl: when you have a lot of extensions and several windows open exelotl: it uses a lot of ram exelotl: as is the nature of most electron apps exelotl: @Skaruts huh i don't see anything for it in the standard library. Simple solution would be s.delete(i) s.insert(item, j) exelotl: but I guess if you wanted the most efficient solution you'd have to write your own procedure Simula: is there a way to define a symbol from a nimble file? I want a task that defines debug Simula: wait i'm dumb Varriount: Hm, anyone know if Rust has runtime interfaces like Go, or anything equivalent? leorize: wrong channel :P slymilano: There's still a bug where I have to pass threads:on to the compiler, but running through nimble doesn't pass in the options properly leorize: use a project.nim.cfg to do that slymilano: do you have an example? awr1: https://github.com/nim-lang/Nim/issues/2457 disbot: ➥ Iterate items in reversed order awr1: kinda wish a reverse iterator was in the stdlib, but w/e awr1: is there something in strutils for like... a getting from the beginning of a string to a certain substring (and excluding it?) awr1: like a `"foobarbaz".upTo("bar") == "foo"` flywind: you can use `parseUntil` in parseutils awr1: thanks sekao: i'm trying to get a "view" into a seq that doesn't require any copying (like slices do). i think someone here said it was possible with iterators...is that right? i've never found an example that does this sekao: it would be ideal to just get a ref seq that pointed to a part of a seq disrupteq: iterate over indices. sekao: i think i can write the iterator but i am not sure how to "apply" that to my seq to produce the view into it disruptek: the same way you apply a single index to view a member of the seq... sekao: i would get a single index via `mySeq[0]`, so you mean pass the iterator where the 0 is? sealmove: https://github.com/sealmove/testify is finished slymilano: having issues using params in my db_sqlite query: https://pastebin.com/1tQvw7S6 slymilano: I'm having some issues using a simple LIKE param in my query. If I hardcode the value between the `%VALUE%` symbol it works fine. https://pastebin.com/wbGwQ3bJ leorize: ah you can't really do it like that leorize: since the string will be properly quoted and escaped, it'd result in something like this: `'%'your string here'%'` which will expose your string as sql leorize: fun times :) leorize: to do it correctly, simply do a concatenation leorize: I think for sqlite you do it like this: '%' || ? || '%' slymilano: thank you, i'll do a string concat leorize: https://play.nim-lang.org/#ix=2emW slymilano: awesome thank you! Guest12859: hi dadada: I've another testcase similar to the bug I recently found dadada: https://play.nim-lang.org/#ix=2emZ dadada: mratsim helped me to find a workaround, maybe there's one here too dadada: it says 'teststring[0 .. 1]' cannot be assigned to , though it works with manually written code dadada: but when I macro writes the left part of the assignment op it doesn't work dadada: it works when you change the slice to an intlit dadada: s/I macro/a macro awr1: is genotrance in here? narimiran: @awr1 he goes by the name shashlick when here awr1: ah i forgot Araq: dadada, you need to generate a call to '..', I think dadada: Araq: I'll try, did you see the other similar issue I raised here a day or so ago? PMunch: Speaking of bugs raised here a day ago. Should I report this Araq, or is it known? https://play.nim-lang.org/#ix=2enf dadada: mratsim provided a workaround for it, but the issues are probably related Araq: report bug on github Araq: I don't read everything on IRC anymore Araq: when I'm around it's likely I've read it but I don't read the logs, no time Araq: mratsim: the priorities are yours to set but remember that only 'showstopper' means "to be fixed for the upcoming release" dadada: Araq: I tried it with a call to .. and now I get 'teststring[`..`(0, 1)]' cannot be assigned to ... did you mean something else? Araq: no, that's what I meant Araq: so now you need to show me your macro I guess dadada: well, just as I'm clicking on the share button on playground, the thing crashed :-( I have to write it again dadada: 2nd writing of the macro done: https://play.nim-lang.org/#ix=2enh Araq: well Araq: na[0..1] = "da" is really `[]=` Araq: and not "assignment to []" dadada: Araq: ok, I'm probably really annoying you know, (knowing that you are the guru of nim), but in my understanding my macro t ignores the argument na (which I just put there for making the macro work), and everything (meaning: t na) gets expanded to teststring[`..`(0,1)] which is confirmed by the compilers "'teststring[`..`(0, 1)]' cannot be assigned to" message, since it can only know that it can't be assigned dadada: to, if it has first expanded to it dadada: s/you know/you now ... dadada: btw. I meant guru as a compliment, hopefully it came across PMunch: The problem is that what you're doing is basically the second case here: https://play.nim-lang.org/#ix=2enq PMunch: So Nim will extract the substring first, then try to assign to that substring, which doesn't work dadada: ah, so is there any way to get around this...? dadada: the macro does work when returning an index instead of a slice/substring JustASlacker: so JustASlacker: I have a strange problem JustASlacker: Error: cannot open 'strformat' PMunch: dadada, hmm, not sure TBH PMunch: JustASlacker, nim --version? JustASlacker: Nim Compiler Version 0.17.2 (2018-02-05) [Linux: amd64] narimiran: JustASlacker: you're 4 versions behind JustASlacker: oh noes dadada: JustASlacker: I'm curious, why would you use such an old version of nim? JustASlacker: I did curl https://nim-lang.org/choosenim/init.sh -sSf | sh PMunch: 4 versions? He's 11 versions behind :P PMunch: JustASlacker, when? JustASlacker: mhh PMunch: What does `choosenim update stable` do? JustASlacker: there seems to be a conflict, the ouput of chooesenim is Switched to Nim 1.0.4 Araq: JustASlacker, please install Nim via the other documented means if choosenim causes trouble JustASlacker: It looks like /usr/bin/nim is old JustASlacker: .nimble/bin/nim is recent dadada: JustASlacker: just rm -f /usr/bin/nim dadada: /usr/bin is probably first in your PATH and when you call nim that takes priority JustASlacker: yeah, did apt remove nim JustASlacker: not sure when I installed that via apt ... JustASlacker: must have been drunk or something JustASlacker: anyway, thanks for the helps PMunch: No problem JustASlacker: loving nim so far PMunch: Great :) JustASlacker: gotta get used to the fact I cant edit the compiled files, tho. JustASlacker: years of python ruined me PMunch: What do you mean? JustASlacker: had a problem with a nim script but couldnt access source repository PMunch: Ah JustASlacker: because I wasnt in the VPN JustASlacker: that was kinda awkward PMunch: Maybe nimcr would help a bit PMunch: I use it for Nim scripts that I have created for simple tasks on my linux machine, similar to what I would do in Python JustASlacker: oh, funky JustASlacker: thx, that looks good. JustASlacker: gonna try that PMunch: For simple scripts it's pretty neat dadada: maybe there could be a special wrapper that wraps a nimcompiler with the source files and the compiled binary into a special executable file, it could contain an image or archive of the sources that could be mounted to a directory with a fuse filesystem and be edited there as usual, then there could be a special command line argument for that wrapper/binary like --recompile that compiles from the edited dadada: sources and changes the wrapped binary dadada: nimcr is good! PMunch: dadada, that sounds complicated.. dadada: PMunch: it can be done with standard linux command line tools, I believe, the biggest downside would be the resulting file size JustASlacker: probably still less than go builds PMunch: To be fair though you could probably achieve world domination with standard linux command line tools, doesn't mean it's easy :P dadada: PMunch: not easy, but not that hard either, it's pretty amazing what you can do with some shell skills alone :P dadada: it all depends on your knowledge PMunch: Oh trust me, I know PMunch: Spend most of my day in a Linux shell :P dadada: so do I :-) PMunch: Hmm, is there a way to make a code-block in docs use Nim syntax highlighting? Araq: ..code-block:: nim PMunch: Doesn't work.. Araq: it works for me lqdev[m]: wasn't it `.. code-block:: nim`? lqdev[m]: like, with the space after `..` PMunch: https://uploads.peterme.net/2020-03-16-105419_661x247_scrot.png lqdev[m]: also Nim's RST parser supports markdown code blocks PMunch: Same result.. PMunch: Wowzer, wind is picking up here.. I can barely see the house across the street for all the snow PMunch: https://uploads.peterme.net/2020-03-16-105650_829x208_scrot.png PMunch: That's the code PMunch: (not sure why I screenshot that instead of pasting it..) PMunch: With markdown syntax it worked Araq: PMunch, not enough indentation, you need at least 3 spaces after ::nim\n Araq: it's an RST gotcha Araq: no wonder markdown is winning :-) PMunch: What, that is three spaces.. Araq: then maybe 4, who knows lqdev[m]: afaik, that's 2 spaces. PMunch: Tried up to 5.. Araq: and you also need a newline more Araq: :: nim\n\n Araq: and one to end the block PMunch: It needed one before the block.. lqdev[m]: damn lqdev[m]: Araq: why is Nim using RST instead of Markdown? PMunch: And a space after the .. lqdev[m]: PMunch: told ya about the space PMunch: http://ix.io/2enA/nim PMunch: This works PMunch: Yeah, but only that didn't work.. PMunch: I had already tried with a space before asking dadada: does markdown support all features of rst? lqdev[m]: no, it has a different syntax lqdev[m]: but overall I don't think the feature set differs that much dom96: This is IMO one great example why markdown is superior PMunch: Links are the big one for me PMunch: [this](peterme.net) is so much better than `this`_ (and yes I had to google how to do that in RST, I always do..) dom96: you also need a space before the < in rst IIRC PMunch: Damn it! I was wondering about that :P PMunch: The docs I found had a line-break there because of page-reflow.. Araq: anyhow we DO SUPPORT RST Araq: out of the box Araq: er Araq: anyhow we DO SUPPORT markdown! Araq: so use it and stop complaining PMunch: Oh yeah, I'm not complaining about Nim. I'm just complaining about RST :P dadada: do you support one of the markdown flavors? or just the original markdown? dom96: do we support markdown in the docs? PMunch: Some markdown works axion: Can the sequtils procedures be used on arrays too or just sequences? I'm looking for a way to efficiently map over the elements of an array var and modifying the values in-place lqdev[m]: some of them can be lqdev[m]: check ones that accept `openArray` as arguments lqdev[m]: most of them can axion: Cool, thanks. Araq: dom96, yeah we do dom96: nice PMunch: Not sure if it's documented anywhere though.. axion: is there anything built in that will replace the contents of an array starting at some index, with the contents of another small array? dadada: axion: something like this https://play.nim-lang.org/#ix=2enM dadada: ? axion: AH I didn't realize you could use slices like that. Thanks again dadada: as long as you don't use a macro to create the slice, then it fails :-) as I recently found out PMunch: Well you can use it to create the slice dadada: PMunch: I think I tried that and it failed, but let me try again axion: i suppose there isn't anything like available for sparse writing, like a[1,4-6,9] = [1,2,3,4,5] ? PMunch: dadada, I mean this works: https://play.nim-lang.org/#ix=2enP dadada: PMunch: yeah, you're right I also tried that now, and it does work PMunch: axion, no for that you would need some kind of macro PMunch: To split it up into pieces alehander92: its possible in theory dadada: so let me correct my statement into: as long as you don't use a macro to create the code that tries to access a slice of an identifier by a macro, it works dadada: s/of an identifier/of an array Araq: slices have nothing to do with it really, it's simply []= vs [] dadada: then why does quote do: array[0] work while quote do: array[0..2] does not? Araq: because a[0] uses the builtin [] which returns a 'var T' Araq: and a[0..2] uses a custom []= instead Araq: well Araq: a[0..2] = value uses the custom []= Araq: and a[0..2] uses a custom [] dadada: well, hopefully support for what I need can be added to the custom [] PMunch: Well there is no string slice type that [] could return Araq: sure it could return var openArray[char] PMunch: Wait, could it? Araq: and it probably should but we're waiting for the RFC dealing with better checking for openarrays PMunch: I didn't think openArray could be returned Araq: Nim evolves :P Araq: but yeah, currently you can't unless you're in system.nim iirc PMunch: Ah.. PMunch: Yeah because this doesn't work: https://play.nim-lang.org/#ix=2enU PMunch: Wait.. That proc was never called.. dadada: well, then I'm putting my programs into system.nim , great that there's finally a workaround :-) alehander92: what happened with custom system.nim btw alehander92: a bit offtopic :P PMunch: dadada, include system.nim :P dadada: PMunch: if only it was this easy PMunch: What are you trying to do anyways? dadada: it's a secret project right now, I can't tell you much besides, that I'll probably release it as FOSS when done :D alehander92: oh no that's the new bio manhatan project right dadada: seriously though I'm developing a bunch of convenience tools for nim dadada: and as you know I'm a noob here, so I'm only making slow but steady progress in this dadada: let's just say that I want nim to be even easier to use than it already is alehander92: but then we need to add features alehander92: to make it hard again alehander92: :) no, seriously sounds good, ok dadada: alehander92: more features doesn't equal being harder to use, it depends, but I know what you mean, actually I'm also adding features :D dadada: I've one subproject of this project, that is really promising, but needs a lot of thought to get it right, it will do no good to write the code in a few days, it's really a specification that I'm writing currently dadada: does disruptek stream today? alehander92: yeah, it depends how well they interact alehander92: i guess alehander92: disruptek is in the usa, it should be still early Araq: narimiran, my fix works and the tests remain green, can you believe it? axion: Can someone help me with type parameters? I've been trying for days to understand them, and I'm not sure what I'm doing wrong. dadada: I'll try, do you have a testcase? axion: In this code, I would like to learn how to constrain the types for the `z` and `w` procs, such that line 32 is a static error rather than a runtime error. https://play.nim-lang.org/#ix=2eoa dadada: sry, I feel someone else will have to help you, and they wilL! PMunch: Hmm, I have some annoying bug with converters PMunch: It tries to apply a `converter toNimNode(x: NimNode): NimNode`, why would that ever happen? axion: dadada: Thanks anyway. dawkot: axion: https://play.nim-lang.org/#ix=2eoa dawkot: whoops dawkot: https://play.nim-lang.org/#ix=2eob axion: Ah so you';re unioning a type class right in the parameter section. Interesting. Is there any other way to do this apart from defining all combinations as separate types? This is a contrived example, and I actually have many types, but each function takes a specific configuration. dawkot: Also it was never a runtime error axion: Well nim check didn't catch it. Only when I executed it did it give me an OOB error PMunch: Can also be done like this if you want to check for any Vec[I]: https://play.nim-lang.org/#ix=2eoe PMunch: Not only those you have defined aliases for PMunch: Might be a prettier way to do that though.. axion: I see PMunch: You can at least put it in a template: https://play.nim-lang.org/#ix=2eog dadada: those are nice examples of Nim code IMO PMunch: And you don't have to specify the static[int] part as that is defined for the type: https://play.nim-lang.org/#ix=2eoh PMunch: And you can throw in a touch of error checking: https://play.nim-lang.org/#ix=2eoi axion: The only thing I don't like is it produces a stack trace from the template, rather than the echo line. I would rather than line stand out in the stack rather than implementation details PMunch: Well it starts on the echo line.. PMunch: The shows the call to z, then the call to minimalCardinality axion: Is there even a way to make this be caught with nim check? let x = [1,2,3]; echo x[42] ? I get no warnings or errors until I actually run the binary PMunch: Run the binary? PMunch: You should get an error when you compile it axion: compilation produces no warnings/errors. running the resulting binary is when the error occurs axion: oh hmm, maybe my setup is messed up PMunch: Not the code that I shared.. That stops during compilation PMunch: Vim with nimlsp even highlights that there is an error on the echo line axion: ah i'm using nim.nvim and i guess it only shows warnings/errors from `nim check`. axion: and nim check doesn't catch this error PMunch: It does when I run it.. PMunch: http://ix.io/2eol axion: as mentioned, just the 2 lines above PMunch: Oooh, sorry PMunch: Yeah that stops on compilation for me, but nim check doesn't detect it axion: Is there any way to get nim check to be more aggressive for cases like this? alehander92: axion yeah i think i've wondered about this case alehander92: not sure, it can't be that complicated to catch cases for [index=> const] lqdev[m]: axion: the problem with nim check is that it doesn't generate any code, only checks it semantically. because of that, many checks are simply not made okcc: i think i'm quitting axion: Ah ok makes sense dadada: okcc: quitting what? okcc: i have stuck in that for a couple of days, i'm being killing, T_T .. okcc: https://paste.ofcode.org/mEjtLxLFXJKt5zymnuJ9Kb Recruit_main70007: whats the issue? PMunch: What is it supposed to do? okcc: i can get it work (sniffing on xevents), but it'll stuck at "cleanupAndQuit" proc, and i found it's actually blocking at line 20 -> XCloseDisplay(display), that's ridiculous, https://tronche.com/gui/x/xlib/display/XCloseDisplay.html PMunch: Why are you trying to catch a SIGTERM? PMunch: and a SIGINT for that matter okcc: for cleaning up x related things, which is suggest in their official docs okcc: there's a mistake in comment at line 49, it's not in a thread now lqdev[m]: I suggest that you use signal trapping mechanisms such as `sigwait`, they're much better than signal callbacks. mainly because you don't need to resort to global state lqdev[m]: example: https://github.com/liquid600pgm/pomod/blob/master/src/pomod.nim#L197 okcc: lqdev: okay, truely grateful for your advises, but that's not the thing that drives me crazy lqdev[m]: idk if there's a `sigpoll`, `man sigpoll` doesn't exist :( PMunch: okcc, by the way this won't work with "nim c -r" proxyexe gets the signal and does weird things lqdev[m]: PMunch: that's why you have to use `sighold` to prevent it from catching the signal lqdev[m]: works with SIGUSR1 and SIGUSR2 okcc: i can just manually call XCloseDisplay(display) before quit, but it'll blocking forever so that the process cannot quit, meanwhile it starts eating a single core of my cpu okcc: guys i'm appreciate for all of your comments, but the true problem is the XCloseDisplay T_T lqdev[m]: I can't see anything about XCloseDisplay being able to block in the X11 docs lqdev[m]: so this is weird okcc: yes, it's abnormal PMunch: I'm seeing the same issue okcc okcc: it'll have no problem in pure C code i guess alehander92: you should look at the resulting C code from nim imho alehander92: it's probably not that different from the equivalent pure invocation of the function okcc: that's a way to debug this code, thanks, alehander92 PMunch: Hmm, maybe it throws a SIGINT and it goes into a loop? PMunch: Nope, that wasn't it.. PMunch: Tried to change it to onSignal SIGUSR2 and sent that to the process. It started the close but it never completed.. Araq: okcc: use --stackTrace:off Araq: and also -d:noSignalHandler PMunch: xlib is always such a joy.. okcc: okay, thanks you all and Araq, i'll try and give the results back here, and our nim community it so enthusiastic, i cannot keep myself of not being a part of it PMunch: What is it that you're trying to do with this by the way? okcc: it's all about goldendict and emacs PMunch: I've been playing around with xlib quite a bit myself as I'm making my own WM okcc: awesome, it' cool okcc: let me tell you the story dadada: PMunch: what WM? is the project still active? Nim? okcc: i like the ctrl+c following ctrl+c global hotkey in goldendict for translating the word currently in clipboard, however, it's conflict with emacs (EX: in nim-mode, ctrl+c -- ctrl+c will compile and run cuurent nim file), so i decide to sniff the xevents for capturingthe hotkey and do the right thing according to the current focus window, so i can use emacs shortcut freely dadada: disruptek comments on comments, and some nice words about Araq https://www.twitch.tv/disruptek/clip/MushyCourageousMomTakeNRG?filter=clips&range=all&sort=timehttps://www.twitch.tv/disruptek/clip/MushyCourageousMomTakeNRG?filter=clips&range=all&sort=time Araq: yeah I heard it. it's a valid point of view but in the end the problem is that comments are ignored by the compiler so you can never be sure it's up to date dadada: "nice words about Araq" , I think I need to clarify that I was joking there, I don't endorse his words, but I know he was also joking Araq: sure, no worries, I know disruptek, we're friends PMunch: dadada, it's called PiMo, but it isn't done yet so the source is closed for now. It's still active in the sense that I still tinker with it from time to time and have ideas I want to implement. And yes, it's all written in Nim :) dadada: PMunch: what else is special about this WM? alehander92: yes, i still think a reasonable amount of comments is good to have into more mature codebases alehander92: especially inline comments are kinda obvious to change or not when one changes the code around them alehander92: and its not hard to imagine tooling for it, e.g. commit hook which asks you "are those comments related to those changed in diff lines still valid" alehander92: if they're not touched or something dadada: a favor more comments ... they should be put next to the code they conern and be updated when the code is updated ... dadada: concern PMunch: Hmm, dadada, mind if we take this in #nim-offtopic? I started typing things out and it became pretty long :P PMunch: Or a PM for that matter PMunch: But just in case anyone else wa wondering dadada: I never mind a PM disruptek: if the comments are out of date, update the comments. disruptek: that's almost verbatim from my, uh, comments. disruptek: so you maintain two pieces of "code." disruptek: big deal. only one set of code can have bugs. the other set serves to provide a bug-free statement of intent. disruptek: otherwise, when you detect a bug with your eyes, you have to decrypt intent by grasping the entire surface. disruptek: we already know that bugs exist and more are made with every commit. Araq: hey... disruptek: so comments are a cheap reusable contribution against bugs. disruptek: write once, read many. disruptek: so i hit 50 followers and i cannot find a single thing in the twitch ui that has changed. disruptek: the latency mode is still set to "low latency". alehander92: disruptek remember me when you become president disruptek: pass. alehander92: maybe for the better with the size of this army disruptek: this was a pointless goal. 😠 disruptek: i'm not giving twitch money and no one else should, either. disruptek: buy emotes? give me a break. disruptek: lol you "buy" emotes and then for every $0.02 you waste, twitch takes >$0.01. what the hell are we doing here, people? disruptek: why would anyone want to provide charity when a for-profit company owned by amazon will take >50% in "administrative costs"? disruptek: the world has gone mad. disruptek: please don't be stupid. Kiloneie: That is dumb. Kiloneie: Anyone got a clue on what happened on friday ? I swear the graph had more than 0 there. Kiloneie: https://cdn.discordapp.com/attachments/371759389889003532/689109060045373479/anomaly.PNG disruptek: channel points could be interesting, though. it rewards investment and doesn't cost anyone anything. disruptek: what does that mean? Kiloneie: If you mean me and my graph, it says 0 views on my channel on friday 13th, last friday... Kiloneie: Did something happen ? It's weird... disruptek: i have streamed for 135hrs and have 35k mins watched. Araq: Corona happened Kiloneie: xD okay Kiloneie: My last 2 videos have finally climbed my chart. Im still here D:... disruptek: maybe i should go back to focusing on simpler content. i feel like people that join the channel do so to ask about my wallpaper and not nim. Kiloneie: If anyone got any ideas how to make a patreon page good, do @ me please :). It's as basic as it can be right now. disruptek: i dunno what that means. alehander92: disruptek i thought you just stream about life, coding and random stuff alehander92: i didnt know there is a goal, man Araq: disruptek for president is the goal, what else dadada: hate that you can't remove the top bar in vscode, generally I like this IDE Zevv: dadada: http://zevv.nl/div/tape.jpg lqdev[m]: dadada: which top bar? dadada: Zevv: heh dadada: lqdev[m]: the one with the filename in it and the x button on the upper right narimiran: dadada: fullscreen mode? narimiran: zen mode? dadada: narimiran: I'm in fullscreen mode, and I also tried zen mode, the top bar doesn't go away, I want the whole window to be used by the editor dadada: whole screen lqdev[m]: huh, I don't have the titlebar o.O lqdev[m]: ah right, I disabled them in i3 lqdev[m]: dadada: check the "Title Bar Style" setting lqdev[m]: you can save at least a few pixels by setting it to `custom` dadada: tried it, looks almost identical, maybe my eyes aren't tuned for seeing minor pixel changes dadada: thanks for the hint though silvernode: time to work on space_nim again silvernode: I don't have to go to work this time. I have all day to work on it JustASlacker: https://www.mobygames.com/game/space-nim axion: What is wrong here? https://play.nim-lang.org/#ix=2eoS disruptek: i stream wallpaper. narimiran: axion: do `o: var (Vec[N] or Mat[N])` narimiran: btw, why does everybody roll their own matrices and vectors? :) PMunch: That's what the cool kids do nowadays I guess axion: ecause the existing ones are either mathematically incorrect in subtle ways, or inefficient for my use case narimiran: axion: which ones are those? narimiran: and what is incorrect with them? their authors should be notified, IMO! axion: vmath, linalg, and a few others i've looked at. i work for a game studio and it took us 10 years to write one in another language suitable for us, so i'm porting it :) dadada: agree with narimiran here narimiran: axion: try `neo` or `arraymancer` narimiran: `neo` was great for my usecase disruptek: mitems dadada: disruptek: I crave your music, please stream :-) disruptek: i stream music. axion: plus, i really need DQ support in a non-consing fashion, and it ties in heavily our existing V4 and Q codes disruptek: mmm Dairy Queen. axion: I'm not sure why indie game developers neglect dual quaternions so much. They are incredibly useful for more than just IK/skinning, since they take half the storage and cheaper to compute transformations than a matrix, whenever you don't need non-uniform scale disruptek: !last leorize disbot: leorize left 12#disruptek 40 hours ago and last spoke 740 hours ago disruptek: back to streaming wallpaper and tunes. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek PMunch: Documentation for my macroutils module done, now just to write some tests dadada: PMunch: what's that module doing` dadada: ? PMunch: Magic dadada: I was expecting that PMunch: https://uploads.peterme.net/macroutils.html dadada: PMunch: that's very useful, thanks PMunch: I certainly hope it will be alehander92: i think the extract thing is most important alehander92: it really brings a missing piece in nim's macros iirc dadada: sameTree is a nice too alehander92: that's it, after the oil field norway now invests into macro infrastructure dadada: PMunch: why is the example for Building trees written with a proc and not a macro in the doc? dadada: or is that an error in the doc? PMunch: Because I don goofed PMunch: Yeah it's an error PMunch: Thanks for spotting it PMunch: That snippet was ripped from a longer macro I used for testing dadada: dude, you're doing great work, keep it going dadada: PMunch: it's fantastic, you're the hero of the day PMunch: Haha, don't over hype it now :P dadada: seriously it's wickedly good dadada: should be standard part of Nim, and superQuote maybe should simply be the new quote dadada: it can't be overhyped, because it's sick Mortir: Hey Mortir: Are there any plans on allowing tabs? Yardanico: no PMunch: You can use tabs with a source filter PMunch: But please don't Yardanico: well yeah, but pls don't :P PMunch: Couldn't be arsed to write all that many tests atm, and I'm heading out now so here you go! https://github.com/PMunch/macroutils PMunch: Here is my test file if you want to see more about how to use it: http://ix.io/2epg PMunch: PRs welcome Mortir: Ok. dadada: Mortir: you can set your editor to write spaces when you hit tab axion: Why is `if` --> `iff` typo'd in the manual and stdlib about 1,000 times? :) Yardanico: it's not a typo Yardanico: https://en.wikipedia.org/wiki/If_and_only_if Yardanico: it's been discussed in at least 2-3 PRs to nim stdlib axion: I would strognly suggest a terminology legend in the manual since this is not so well known, and often computing terms are so overloaded anyway Yardanico: https://github.com/nim-lang/Nim/pull/10935 https://github.com/nim-lang/Nim/pull/5732 https://github.com/nim-lang/Nim/pull/1482 disbot: ➥ Typo fix in strutils. narimiran: didn't we already "fix" those, just to prevent future questions? alehander92: axion its a math term alehander92: but otherwise i agree with legend and i dont agree with 'fix" alehander92: iff != if alehander92: and people ask about it anyway, so it's all good axion: Yeah, even mathematical texts and papers you have to carefully read the terminology legend, since especially in math, operators and terms are overloaded like crazy alehander92: yeah, but `iff` isn't really overloaded imho, it's basically `<=>` alehander92: but a legend is useful for many terms: compilation(not transpilation), side effects, and all kinds of others terms with alehander92: different interpretations axion: Who am I to know it is what you say and not a typo without formal documentation? disruptek: you are a programmer, that's who. alehander92: what is "formal documentation" axion: A programmer would question everything, because other programmers wrote it :) narimiran: @alehander92 so why is IFF necessary in the docs? narimiran: can you show me one example when IFF is correct and IF is incorrect? alehander92: well it gives you additional information narimiran: no it does not narimiran: in theory it does, in practice no narimiran: we're not robots alehander92: a >= b if a > b is true ⏎ a >= b iff a > b is false narimiran: example from our docs, please alehander92: well, they mean different things man narimiran: yeah, i know the difference alehander92: a happens if b and ⏎ a happens if b and only then PMunch: Hmm, ..code-blocks apparently doesn't work on GitHub.. alehander92: it seems obvious to me the second one is more useful alehander92: in both theory and practical sense narimiran: i'm telling you that all instances i've found in the docs were the "wrong usages" of IFF alehander92: well incorrect usages have to be fixed Araq: enough people do not understand 'iff' so we shouldn't fight it and replace it by 'if' alehander92: but that's like saying why use `>` if we have `>=` alehander92: imho PMunch: I just used iff in the documentation I wrote for macroutils.. alehander92: but you maintain the docs, so you guys know better, just wanted to point out that a bit of pedancy is nothing strange for a docs full with very precise type/effect signatures axion: I think there's quite a difference between a symbol that cannot be disambiguated with natural language typographical errors, and a string of text that can. axion: Without a legend of course PMunch: But oh my, when I was writing my beginners guide to programming in Nim (don't think I actually ever released that) I had to work so hard not to call anything but vars for variables. PMunch: Just speaking of overloaded terms alehander92: axion well yeah, a legend is ok alehander92: and again, not only for that: most docs assume their particular definitions of many terms/names narimiran: https://nim-lang.github.io/Nim/os.html#cmpPaths%2Cstring%2Cstring what does a regular nim user lose if we replace this IFF with IF? narimiran: does they suddenly don't understand how 'cmp' works and what it does? narimiran: "oh, it returns 0 for same, negative for smaller, positive for larger. but, what if somebody is hiding from me?" Araq: narimiran, agreed and now let's move on, we have plenty of things to do alehander92: but if you look at the line in isolation, each line brings more meaning alehander92: `0 iff pathA == pathB` : i dont even need to look at the others, thats the only case it returns 0 narimiran: yeah, i can be as pedantic as the next guy (and i sometimes/often am, to the joy of my girlfriend and others), but also there are times when you need to be pragmatic alehander92: but not in a language spec/manual alehander92: i mean let's have `proc existsDir(dir: string): bool {.gcsafe, extern: "nos$1", tags: [ReadDirEffect], ⏎ ⏎ ``` raises: [].}` and then wondef if `iff` is too much :D``` [https://gitter.im/nim-lang/Nim?at=5e6fa0b0ebf3c06f30525130] alehander92: of course, its not a big deal if you change it, i just dont think its a big deal to leave it as well narimiran: how about `iff x <= z or y <= z`? what if i stopped reading before `or`? alehander92: i agree, this argument wasnt great, but it's not really padentry too alehander92: which reminds me of a new RFC guys alehander92: `iff a > b:` in functions alehander92: which ensures that no other paths in the branch tree result in the same value alehander92: oh yeah alehander92: must write donald knuth to collect my turing award Yardanico: lol treeform: Hey can you guys help me out with a simple macro? So I am in side a macro I want to see if the expression I have will compile with $(expression) has a string function, otherwise do my own thing. I tried it with `if compiles($(n[i])):` but that checks the $ of the node, how can I check if $ of what node is compiles. Araq: easiest way is to not check it inside your macro Yardanico: well the easiest would be probably parseStmt, but it's not really the clean one Araq: but make your macro emit the 'when compiles' check Yardanico: ah, wait, im wrong treeform: Araq, neat, ill try that. Araq: hmm plus 1111 cases, that can't be good shashlick: !last awr1 disbot: awr1 never seen. leorize: disruptek: am I summoned? :p disruptek: can't remember. sorry! 🤣 disruptek: i got a clash between an enum Injection and, probably another enum Injection defined elsewhere. the compiler reported it as `undefined`. shashlick: disruptek: last doesn't work on gitter users? disruptek: !last alehander92 disbot: alehander92 spoke in 12#nim 31 minutes ago shashlick: !last awr1 disbot: awr1 never seen. leorize: !last treeform disbot: treeform spoke in 12#nim 26 minutes ago Recruit_main70007: can we use it from discord? leorize: it seems to work? disruptek: sure. Recruit_main70007: !last Albus70007 shashlick: https://irclogs.nim-lang.org/16-03-2020.html#06:55:44 disbot: Albus70007 never seen. Albus70007: whats my name in gitter? Recruit_main70007: hmmm leorize: !last Albus70007 disbot: Albus70007 spoke in 12#nim 11 seconds ago Recruit_main70007: makes sense, last time i spoke in gitter was very long ago disruptek: !last slymilano disbot: slymilano never seen. disruptek: !last Guest12859 disbot: Guest12859 never seen. disruptek: it looks like maybe it crashed and lost a few minutes of data. disruptek: !last sealmove disbot: sealmove joined 12#nim 18 minutes ago and last spoke 72 days ago disruptek: i don't bother to rewrite the data on every change, so... disruptek: !last Simula disbot: Simula never seen. disruptek: strange. disruptek: i dunno what's going on. alehander92: in gitter we all see 7 disruptek: that's a lucky number. alehander92: instead of color code i guess (i remember somebody else said that) Recruit_main70007: not for nothing in my name leorize: the gitter bot can't deal with irc colors leorize: same as with NimBot axion: How do i type a parameter to be a slice of a specific ordinal type and have a default range value? leorize: HSlice[T] leorize: Slice[T] to be precise axion: Yeah I tried that, but even though my parameter is [T: float32] it requires the caller to specify the correct type suffix. Is there a way around that? leorize: what's your function prototype? leorize: oh and Nim can't infer param that precise yet axion: proc foo*[T: float32](o: var MArray, range: Slice[T]) = leorize: use Slice[float32] axion: Well that'd be the same thing, but I agree. I'd like to be able to call it as o.foo(1..5) and have it treat that as a float range if possible shashlick: @leorize - please comment on https://github.com/nimterop/nimterop/issues/99 disbot: ➥ a better proposal for mapping C enums ; snippet at 12https://play.nim-lang.org/#ix=2eq4 Araq: does Nimble support --nimExe? leorize: shashlick: it'd not be too deterministic leorize: for example if you handle repeats by: const ResourceLimitWarning = ExceptionType.WarningException leorize: then when someone tries to $ResourceLimitWarning, they get "WarningException" leorize: that's not something anyone would expects shashlick: Araq: nope, it just uses findExe("nim") leorize: then if you go all const for enums with duplicates, then $ResourceLimitWarning will print an int instead leorize: while some other enum will print a string shashlick: leorize: well, the current implementation is the latter, so going to the former is an improvement leorize: I'd say that C enums just don't fit Nim's model leorize: I'd prefer how enum are represented in nim with nimterop to be upfront leorize: either you go: everything mapped to nim enum, or you go everything mapped to distinct cint leorize: you can give people the option, though I'm not sure if that's the best shashlick: hmm shashlick: I'm not sure if the current distinct int method is really so bad leorize: if you found duplicates in "mapped to nim enum" mode, just abort, using a const to walkaround is just confusing to people shashlick: mapping to Nim enum mainly gives readability if an enum is printed shashlick: what else does it buy us? leorize: use as array index if enum don't have holes? leorize: it basically gives us nothing more shashlick: i don't think it is too much work but it will require spawning another nim process to get this cleaned up shashlick: plus the distraction from all the other things nimterop still needs to get done leorize: imo this doesn't worth the time leorize: maybe you can outline how should it be implemented and just leave it there as PR welcome leorize: or just abandon the idea because it's kinda useless shashlick: okay will link to this discussion shashlick: thanks for your thoughts dumjyl: duplicate enum values in c are often used to make up for lack of `low` and `high` and map just fine to nim enums once those are stripped. llvm/clang for example. shashlick: how would an automated tool know which one(s) to strip awr1: hello shashlick: hey @awr1, good timing leorize: then there are also people who use enums as a way to specify flags that should be or-ed toghether awr1: yeah it might be preferable to keep it as an option, to do the enum transformation shashlick: we also lose the formula but i don't think that's really a problem awr1: how do you think you might relay which values belong to which enums to the macro? awr1: attach pragmas to the consts? leorize: the consts have names shashlick: might have to collate all enum consts into blocks by enum and have multiple calls to the macro for each enum shashlick: the macro would have to print out the results in a way to be easily parsable by toast leorize: or, you can have a nim macro that generates all of this leorize: like cenum EnumName: leorize: then call nim with --expandMacro:cenum shashlick: but toast is runtime leorize: bam you got the file without depending on cenum :) awr1: i was thinking that you could peform the macro after `toast` is done shashlick: we still need to spawn nim shashlick: toast needs to be standalone as well, some users prefer that to the compile time API leorize: that's what --expandMacro is for leorize: you use it and get the expanded stuff, then you can just remove the imports shashlick: expandMacro gives you code that can be compiled into toast and run at runtime? awr1: in regard to using bitor'd C enums as sets: there is a weird idea i'm thinking of awr1: the enum types could be all a part of a certain typeclass, and then you could have a special func that gives you set-like syntax but returns a `cint` or w/e awr1: (this func would be constrained to that typeclass) leorize[m]: shashlick: as long as you don't use gensym, then yes shashlick: Do you have some example code? awr1: @shashlick something like this? https://play.nim-lang.org/#ix=2eqj awr1: (idk how you get procs to work with `{}` syntax, like how it's used for sets and `toTable`) shashlick: @awr1: what is this to solve? https://github.com/nimterop/nimterop/issues/159? disbot: ➥ Enums that refer to other enum values fail ; snippet at 12https://play.nim-lang.org/#ix=2eqn shashlick: @leorize: do you have an example of using --expandMacro awr1: as a way to allow people to use bitor'd enums for libraries. i guess it doesn't have to be set syntax, and i suppose one can also just implement `or`, `and`, `xor` etc. mratsim: I use a Flag shashlick: we could add it to https://github.com/nimterop/nimterop/blob/master/nimterop/types.nim#L29 mratsim: see: https://github.com/numforge/laser/blob/master/laser/photon_jit/photon_osalloc.nim#L52-L61 shashlick: but will need to setup combos of every enum with every other enum, so makes no sense mratsim: I'm pretty sure you already saw that code shashlick: @mratsim: what's your opinion on https://github.com/nimterop/nimterop/issues/99 disbot: ➥ a better proposal for mapping C enums ; snippet at 12https://play.nim-lang.org/#ix=2eq4 awr1: well wouldn't that be a use for using the type class? mratsim: I don't see how to automate the `or` enums so that they use a separate Flag type federico3: https://github.com/cheatfate/asyncpg is this project dead? Lantos: wow nimx is actually sick Lantos: Just ran the hello world on ubuntu & android brentp: with jester, I want to match `/a/a/a/` , `/a/b/c/`, `/a/x/y/z/2`, etc. do I need a regexp for this?http://github.com/nim-lang/Nim/wiki/Tutorial:-Creating-a-(micro)-service-flask dom96: try `get "/a/@path"` dom96: might work, but also might not :) brentp: that doesn't work, unfortunately dom96: then yes, you need a regex brentp: that only works for `/a/b/` brentp: regex works. thanks disruptek: !last narimiran disbot: narimiran joined 12#nim 105 minutes ago and last spoke 73 hours ago Yardanico: !last yardanico disbot: Yardanico spoke in 12#nim-offtopic 2 hours ago Yardanico: huh disruptek: ... disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek Kenran: is twitch slow today? it isn't really loading anything for me right now axion: How do i get at one of the bounds of a slice? kaushalmodi: use the .high or .low alehander92: dont be a sad fella axion: there doesn't seem to be an generic for those on Slice axion: Maybe I'm doing something wrong? I get this: https://gist.github.com/mfiano/f17eb5ee0bea4a0af1c53d1418eb2e9c solitudesf: its a and b fields for slice bounds shashlick: Araq: what proc in the compiler reduces an expression into a value for a const? https://github.com/nimterop/nimterop/issues/99#issuecomment-599687131 disbot: ➥ a better proposal for mapping C enums ; snippet at 12https://play.nim-lang.org/#ix=2eq4 Araq: shashlick: semfold or vm.nim shashlick: nifty - awesome having the full compiler available within toast axion: is there an idiom for iterating over the indices rather than elements of a container? I feel this can be written better if I knew the language well: for i in 0..obj.len-1: ... kaushalmodi: there are pair iterators available axion: right, but that seemed wrong to me, since i only need the first part of the pair, and can't do just the first part, so i'd have an unused identifier axion: maybe that's more idiomatic even though it introduces an unused thing? kaushalmodi: axion: https://play.nim-lang.org/#ix=2er8 kaushalmodi: use the _ for the unused axion: ah ok, thanks kaushalmodi: if you wish, you can wrap that in your custom iterator to that you don't need the `, _` piece Araq: dunno, use for i in low(x)..high(x) axion: Yeah I probably will. Just trying to sketch out the user API first and learning bits of the language in the process (my first project here) axion: I don't know if I ever thanked you Araq, but thank you for your incredible devotion to the project (and all the other contributors too). I've tried about 2 dozen languages over the years, and everything has brought me back to my 2 decades of Lisp, except this one is making me not want to go back :) kaushalmodi: axion: https://play.nim-lang.org/#ix=2era (indices iterator) kaushalmodi: > I don't know if I ever thanked you Araq, but thank you for your incredible devotion to the project ⏎ ⏎ +1! Araq: ah thanks :-) shashlick: Araq: what should I set PSym to in proc getConstExpr(m: PSym, n: PNode; g: ModuleGraph): PNode shashlick: i constructed a const ast and have a newModuleGraph but am wondering what the m: PSym should refer to awr1: ah so you're just going to leverage the compiler const folding mechanism directly Araq: shashlick: it's the module you're compiling Skaruts: is there some way to turn an instance of an object to a unique string that can serve as an ID? awr1: @Skaruts like a hash? Araq: you can cast a ref object to an id via cast[int](myref) Skaruts: yea, I guess Araq: but objects themselves have no identity Skaruts: gonna try that Araq: do NOT use addr/unsafeAddr, it never works for that awr1: if you want to do a hash instead of a int'd ref, you will have to implement the hash proc https://nim-lang.org/docs/hashes.html Skaruts: I stay away from pointers anyway :) Skaruts: seems to work nicely shashlick: @awr1: yep Skaruts: is the result of casting the ref always gonna be unique though? PMunch: Hmm, should we add a toOption proc (or maybe even a converter?) from ptr/ref types to options? They can be cast as they are now as the underlying Option[ptr T] is just a nil check on the type. But it would be cool to formalise this. Araq: Skaruts: no, the refs can be collected and re-used Skaruts: hmm... I guess that won't be a problem, but gonna keep it in mind dumjyl: https://nim-lang.org/docs/options.html#option%2CT already does that I think. PMunch: Oh cool PMunch: Nice federico3: why is monotime in a dedicated module and not in times? federico3: how can I convert a varargs to a seq? krux02: federico3, probably with toSeq krux02: but it does copy all elements axion: is there a reason clamp takes separate parameters for its bounds, unlike say rand which uses a slice? krux02: axion: probably not a very good one. krux02: maybe because it is a port of a `clamp` function from a different programming language that does not have slices. krux02: I also don't have very good experience with slices on floating point numbers. axion: i see. noticing some inconsistencies learning the stdlib and just curious krux02: yea there are quite a few inconsistentcies in the stdlib. krux02: sorry for that. krux02: It just happens when a lot of people contribute. krux02: for me personally I prefer to not work with slices, as my brain internal representation gets confused weather ``0..10`` is a type or a value. krux02: but that is just me. krux02: I don't really have a strong opinion here. krux02: axion: what is your use case for Nim? What made you learn about it? krux02: I am just curious why people are using Nim, and for what they are using it. axion: Oh, a ton of reasons. zacharycarter told me about it a couple years ago, and had my eye on it since, but only been using it for about a month now. I really value a language that is both expressive and concise, because at the end of the day, the only thing that matters, is getting ideas working quickly. with Nim, there isn't the 2-language problem in doing that. axion: arguably, where i came from didn't have the problem either. However, I have a lot of bad to say about nearly 2 decades of using Common Lisp I'd rather not flood off-topic nonsense with :) axion: As for what I plan on using it for, well I'm mostly aa game developer, so we'll see after I finish porting my huge stack over :) axion: The one thing about Nim that I think is a little rough around the edges, is the tedium involved in writing what would be 30 seconds and 2 lines of a Lisp macro, turning into an hour and 100 lines of nodes to represent Nim's AST for the same concept. There isn't much to be done with that, since it isn't homiconic, but I do believe macro writing could be a lot less painful. shashlick: Do you have examples axion: Not off hand. Clyybber was helping me port a 3 line Lisp macro the other day and he came up with about 50 lines of a node tree that was still incomplete by the time we gave up. I haven't written many macros yet out of fear I'll get too dissuaded and stop using Nim in my early stages of learning :) Rika: Macros become very large very quickly shashlick: I'm pretty lazy and use quote and parseStmt rayman22201: there have been some good helper libraries to help writing macros that have come about through the life of nim. Also tricks like shashlick mentioned :-) rayman22201: Nim macros will never be as concise as lisp of course, but I agree, there is always room for improvement. axion: It might be worthwhile to aggregate that list of libraries and tricks online somewhere, because I really do think this is one area that needs to get a little more closer to the expressiveness of Lisp shashlick: i prefer nim code looking like nim rather than some crazy data structure axion: Any help would go a long way shashlick: but no doubt, it is working great to use the AST in nimterop since i'm doing an ast -> ast translation krux02: axion, I agree macros could be improved in Nim. Still there is nothing like typed macros in other languages. axion: Yeah I like that a lot. rayman22201: yeah, nothing comes close to Nim here krux02: I can only compare Nim macros to emacs-lisp macros. Never used common lisp. krux02: I think it is not too different though. shashlick: folks, would really appreciate some help with testing the new backend for nimterop - anyone interested please ping krux02: axion: Btw I also use nim for game development krux02: or better said, I used to, currently I am fixing bugs in Nim. krux02: if you care about the two language problem, I fixed that for game development. krux02: write your shaders in Nim krux02: import nim modules and use it in a shader krux02: and most importantly, access variables from the outer scope in a shader, as if the shader was a lambda expression with closure. krux02: https://github.com/krux02/opengl-sandbox krux02: I didn't update the project for quite some time now though. krux02: It is still alive though, as I don't know anything better to quickly write small efficient custom renderers quickly in. federico3: krux02: it does not seems so awr1: what are rust's macros even like? i looked their documentation in comparison and i don't quite get what is going on rayman22201: Krux02, your work on fixing bugs in Nim is greatly appreciated btw <3 awr1: nim's is actually pretty straightforward if you're familiar with the concept of an AST awr1: RE: shaders: what i have kinda sorta wanted to do for a while is create a compiler for a Nim DSL that produces SPIRV/DXIR awr1: but meh sealmove: can I execute a process within Nim and redirect stdout in a non-shell dependent way? disrupteq: see asynctools or asyncproc disrupteq: !repo asynctools disbot: https://github.com/cheatfate/asynctools -- 9asynctools: 11Various asynchronous tools for Nim language 15 51⭐ 11🍴 disrupteq: or just use startProcess for sync sealmove: how do I do it with startProcess? PMunch: disrupteq, leorize, anything in particular you had in mind for the playground? leorize: !last PMunch disbot: PMunch quit 719 minutes ago and last spoke 24 minutes ago leorize: lol you can't ask that and quit :P timotheecour: @araq I think this explains azure outage https://developercommunity.visualstudio.com/content/problem/948822/azure-pipelines-ci-is-not-running-for-pushes-to-ht.html watzon: There were list comprehensions at one point right? But they were replaced with something? leorize: the collect macro in devel watzon: That's right, thanks :) awr1: hello all shashlick: what's up awr1: nm, it's been a few months since i've been in here/done anything with nim awr1: got demotivated what with IRL issues (like my university telling me "yeah sorry, you can't graduate because you need these two science labs we never told you about") plus my laptop is falling apart awr1: i see there is a new GC :O leorize: not really a gc :) leorize: ~arc disbot: arc: 11a new memory manager for Nim; see https://forum.nim-lang.org/t/5734 leorize: here's what you need to get up to speed leorize: araq also added the new --exceptions:goto that's much more lightweight than normal exceptions awr1: hmm interesting! silvernode: Good morning silvernode: time to work on space-nim again silvernode: I am trying to decide what a good simple way to determine and construct a merket price rate for each space station in my game. People here recommended the getMonoTime() proc which will determine when prices change at each station. silvernode: Other than "when" I need to figure out "how" I am going to populate each item at each station with a different price. I am thinking that I will generate a random number but the issue is mostly how to distribute a different number for each station. silvernode: also how to distribute a different price number for each item in a given station. axion: can a proc parameter be typed to be a specific field of an enum type? Lantos: !repo automation disbot: https://github.com/miere43/autome -- 9autome: 11Dumb GUI automation library for Nim 15 15⭐ 1🍴 7& 3 more... Lantos: !repo open cv disbot: https://github.com/jayrambhia/Install-OpenCV -- 9Install-OpenCV: 11shell scripts to install different version of OpenCV in different distributions of Linux 15 949⭐ 944🍴 7& 29 more... Lantos: !repo opencv disbot: https://github.com/dom96/nim-opencv -- 9nim-opencv: 11Nim OpenCV wrapper 15 20⭐ 4🍴 7& 1 more... Araq: axion: param: range[enumValue..enumValue] Araq: if you can pass only a single value though, why pass it at all axion: Alright, just trying to think of ways to clean this code up. axion: do closures have any runtime overhead? mratsim: they are heap allocated mratsim: @Araq, is it fine if I raise this to high priority? https://github.com/nim-lang/Nim/issues/9679 I don't not about timotheecour's solution but finding workaround for this is quite tedious disbot: ➥ Generic types as static parameters: type mismatch axion: is there a macro like Common Lisp's `rotatef` somewhere in the stdlib? mratsim: what does rotatef do? axion: like if i had 2 vars x = 1, and y = 2, calling rotatef(x, y) and the vars' values would be swapped, and done so with gensym'ing. Should also work with object member, like rotatef(foo.x, bar.x) Varriount: axion: the swap procedure, I think axion: Thanks mratsim: yes, use swap mratsim: it works on NimNode as well mratsim: I've discovered that 3 days ago and it seems like a neat way to optimize register usage when doing intrinsics (i.e. this https://github.com/mratsim/finite-fields/blob/master/montgomery_mul.nim#L365 instead of playing with indices: https://github.com/mratsim/weave/blob/master/benchmarks/matmul_gemm_blas/gemm_pure_nim/common/gemm_ukernel_generator.nim#L217-L230 dadada: hey dadada: hello dadada: hit on this bug: https://play.nim-lang.org/#ix=2ehK dadada: the code is made specifically made for showing the bug dadada: a testcase dadada: in my understanding the code should expand to dadada: thestring[BackwardsIndex(1)] = 'z' dadada: and work dadada: however the compiler says thestring[BackwardsIndex(1)] can't be assigned to mratsim: let me have a look dadada: thanks dude mratsim: this works: https://play.nim-lang.org/#ix=2ehL mratsim: let me see with quote do mratsim: this as well: https://play.nim-lang.org/#ix=2ehM dadada: mratsim: when you add BackwardsIndex to the mix, it fails mratsim: The error message is probably wrong but in the macro "thestring[BackwardsIndex(1)]" this part may not capture the existing "thestring" and try to create/bind to a symbol that doesn't exist mratsim: ah mratsim: then it's distinct type that is buggy mratsim: indeed "result = nnkBracketExpr.newTree(s, newCall("BackwardsIndex", bIdx))" mratsim: mmm mratsim: I think Nim is missing proc `[]`[N, T](a: var array[N, T], idx: BackwardsIndex): var T mratsim: or not array but string mratsim: this works now: https://play.nim-lang.org/#ix=2ehM dadada: why does it work with manually written code though? mratsim: raise a bug, in the past ^1 was magic, and it changed to use distinct to ease usage in macros mratsim: it seems like there are leftovers dadada: just a note: it works when on the right side of an assignment dadada: so when not writing to it mratsim: if you look on the signature of my proc, I return "var T" mratsim: I thin the one that returns T is working mratsim: the one that returns var T is still magic dadada: mratsim: did you send the wrong link, I don#t see any var T okcc: can i add a proc as an element of a tuple which is passed as a paramater of a Thread function? okcc: here's the code which gives me a type mismatch: got error, https://play.nim-lang.org/#ix=2ei8 okcc: i'll be grateful if anyone can help :), here is the error detail: https://carbon.now.sh/?bg=rgba(171%2C%20184%2C%20195%2C%201)&t=seti&wt=none&l=auto&ds=true&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=56px&ph=56px&ln=false&fl=1&fm=Hack&fs=14px&lh=133%25&si=false&es=2x&wm=false&code=%252Fhome%252Fokcy%252Ftmp%252Ftest_x11.nim(34%252C%25209)%2520Error%253A%2520type%2520mismatch%253A%2520got%2520%253CXRecordThreadData%253E%250Abut%2520expected%2520one%2520of%253A%2520 okcc: %2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%25 okcc: 20%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250Aproc%2520xRecordEventCallback(p%253A%2520TXPointer%253B%2520pdata%253A%2520PXRecordInterceptData)%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252 okcc: 0%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520first%2520type%2520mismatch%2520at%2520position%253A%25201%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%252 okcc: 0%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520required%2520type%2520 okcc: for%2520p%253A%2520TXPointer%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520 okcc: %2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520but%2520expression%2520'data'%2520is%2520of%2520type%253A%2520XRecordThreadData okcc: oh, i' so sorry okcc: i'm not excepting that okcc: this url is so long, i feel so bad about that, please ignore dadada: okcc: :-) don't worry ... it's a slow day in this channel okcc: :) ,but, can i store a callback proc in tuple? PMunch: Yes Rika: what the hell isthat url lmao PMunch: leorize, haha sorry for quitting right after asking a question yesterday :P okcc: sry,haha PMunch: Haha, okcc, just looked at the log after Rika mentioned a URL. Happens to the best of us :P PMunch: Any reason why you want to keep XRecordThreadData as a tuple and not an object by the way? okcc: i learned it from Nim in action: Part 2 Nim in practice -> 6 Parallelism -> 6.2 Using threads in Nim, so it's dom96 told me to do that xD okcc: i have no experenice so i follow someone better okcc: my code will thought a error like this: https://paste.ofcode.org/rid6ACLFdMQcA4EyFpF4kS okcc: i just changed a code snippet provider, no more long url include :D okcc: i update some code: https://paste.ofcode.org/hbXEWFyMUCEEerXbApZDGd okcc: in this code, i want to listen to ctrl+c keypress input event using xlib okcc: i'm trying to use obejct as thread data PMunch: Ah, not actually sure why he's using a tuple there PMunch: I think it might just be because he preferred the syntax of them okcc: i just use data[2] instead of data.xRecordEventCallback to access the proc in the tuple, and now it works! PMunch: Uhm, that's weird.. okcc: i think the compiler here is translate data.xRecordEventCallback to xRecordEvenetCallback(data) okcc: maybe because xRecordEventCallback is callable PMunch: Yes, that's the UFCS okcc: what's UFCS? PMunch: Universal function call syntax okcc: i get it okcc: i have another error now, 'xRecordEnable' is not GC-safe as it performs an indirect call here PMunch: echo isn't GC-safe I don't think okcc: no, not the xRecordEventCallback proc, is xRecordEnable okcc: i think compiler is saying the data[2] indirect call PMunch: Hmm, I tried to implement the TOTP algorithm that Google Authenticator uses http://ix.io/2eiN PMunch: But it doesn't give me the same values as the Google Authenticator app.. PMunch: I verified everything after the hash against the RFC, so I'm not entirely sure what's wrong here.. mratsim: @dadada, there is a var T but indeed I sent the wrong link mratsim: here you go: https://play.nim-lang.org/#ix=2eiS PMunch: Ahh, I was treating the timestamp incorrectly, this works: http://ix.io/2eiU/nim PMunch: Hmm, now I've spent a lot of time on something I have absolutely no use for... Back to doing something actually useful dadada: mratsim: thank you very much, can you explain if this proc `[]` you wrote is the idiomatic solution to this, and if it should be in the official stdlib, or would there need there to be a different more general solution/fix needed to fix this in the compiler? dadada: minus one there dadada: since it is working one might think this could be the official bugfix PMunch: Hmm, where is this error from, and what does it mean? "Error: wrong number of variables" PMunch: Oh, it was from calling "for i, _ in 0..1" leorize: ~playground disbot: playground: 11an online in-the-browser IDE for simple Nim experiments at http://argentina-ni.ml/ leorize: PMunch: ^ see that leorize: it has lots of features :P leorize: the ui there is terrible tho PMunch: Oh wow, that is a lot of features! Recruit_main70007: whats the Nim equivalent of: Recruit_main70007: (LPTHREAD_START_ROUTINE)GetProcAddress(...) PMunch: cast[LPTHREAD_START_ROUTINE](symAddr(...)) Recruit_main70007: thx PMunch: Crap.. My simple fix won't work for `extract` I need to write some helper procs into the DSL.. Recruit_main70007: leorize: how do i declare an APIENTRY in Nim? shashlick: https://github.com/dom96/choosenim/issues/183#issuecomment-599230880 disbot: ➥ choosenim binary builds for macOS need 10.13 ; snippet at 12https://play.nim-lang.org/#ix=2ejS PMunch: Hmm, is there a way to check if there exists a variable in the current scope? PMunch: I know about `declared` but that also picks up procs of the same name leorize: bindSym then look into the symbol? lqdev[m]: PMunch: declaredInScope? PMunch: Wouldn't that also take closure procs? leorize: bindSym then look seems to be a better idea imo PMunch: Hmm, I tried to create this: `macro isVariable(x: typed): bool = newLit(x.symKind() == nskVar)` and then do `when not declared(test) or not isVariable(test)` but that didn't work for some reason.. sealmove: what code does a segfault process return? Zevv: it doesnt sealmove: hum.. but if you do like `let c = execCmd(&"nim c file.nim")` then c will be what? leorize: os-dependant :) sealmove: wow, this sucks disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek mratsim: @dadada, yes it should be the official implementation, it should be in system.nim along the other BackwardsIndex proc, the way to proceed is open an issue with your bug, and the example fix and then open a PR to fix it mratsim: The thing is, I'm not too sure how to find and remove the "magic" that makes it working when not inside a macro PMunch: Okay wtf.. This doesn't work: http://ix.io/2ekn but this does http://ix.io/2eko PMunch: BTW I get an undeclared error PMunch: Sweet, now it works: http://ix.io/2eks which outputs: http://ix.io/2ekt Recruit_main70007: leorize, u there? leorize: o/ leorize: ah, I don't know much about windows api, sorry :P Recruit_main70007: ok :/ Recruit_main70007: thanks anyway leorize: if you can show me how to do it in C, then I can show you how to in Nim :) Recruit_main70007: cpp? leorize: that works too I guess Recruit_main70007: #include Recruit_main70007: BOOL APIENTRY DllMain(...) Recruit_main70007: That apientry thing, it seems to not exist in winlean nor winim PMunch: This module also passed it's 1000th line of code with the addition of the extract macro PMunch: https://stackoverflow.com/questions/2081409/what-does-apientry-do PMunch: It's basically just an alias for stdcall PMunch: Just to tell the C++ code to generate the correct calling convention so that it can be loaded by e.g. a C library leorize: tag your function with {.stdcall.} leorize: that's APIENTRY Recruit_main70007: thanks both, now i have to find why its not working PMunch: I've done a bit of work on dynamic libraries in Nim (even have one in production at work), so just ask if you need any help :) PMunch: Well, two actually, one for Linux and one for Windows, sharing parts of their codebase :) leorize: oh yea, make sure you exportc your DllMain :) Recruit_main70007: i am trying to inject a dll (educational purposes at least for now :p ) Recruit_main70007: leorize, yeah, i already had that PMunch: Man, this macroutils module is coming along nicely :) PMunch: I think I'm actually done with the stuff I wanted to create to begin with.. PMunch: Now just do document the whole thing properly so that you guys can actually use it :D Recruit_main70007: Nice sealmove: guys, I had this idea !repo testify sealmove: https://github.com/sealmove/testify sealmove: no actual code yet, but it's very simple to implement federico3: sealmove: https://github.com/FedericoCeratto/nim-testrunner does that afaict sealmove: does it produce a single unified JUnit report? sealmove: also the last time I tried running it it was broken :/ federico3: if it doesn't open a bug sealmove: nim-testrunner/testrunner.nim(377, 36) Error: undeclared identifier: 'Created' sealmove: I think I will write this one, nim-testrunner seems a little complex for the task and also seems unmaintained... federico3: I'll chase it leorize: !repo testutils ? disbot: no results 😢 leorize: !repo testutils disbot: https://github.com/status-im/nim-testutils -- 9nim-testutils: 11testrunner et al 15 5⭐ 2🍴 sealmove: Oh this looks reallt nice, didn't know about it. disruptek: you may as well consider testament. sealmove: seems new disruptek: it's a thing i pulled out of chronicles for general use. sealmove: disruptek, I never figured out how to use testament. there are no docs leorize: read specs.nim leorize: it's sad but that's the only way :P disruptek: they are in doc/contributing.rst or w/e. leorize: ah that too sealmove: I don't know, testament is also complex and is meant for Nim project. I want something simple, and ideally JUnit output. sealmove: nim-testutils seems cool fluxinator2000: `var mem:seq[byte] fluxinator2000: fluxinator2000: proc init(): fluxinator2000: mem = newSeq[byte](0x10000) fluxinator2000: fluxinator2000: init()` fluxinator2000: this doesn't compile fluxinator2000: what am I missing? leorize: s/:/=/ Recruit_main70007: bridge doesnt like multiline nor code messages sealmove: `proc init() = ` fluxinator2000: I'm an idiot Recruit_main70007: happens to the best of us Elegant Beef: Do people not read compilation errors? Elegant Beef: `(4, 5) Error: type expected` fluxinator2000: yeah that error message didn't help me leorize: I mean how are you supposed to figure it out from that leorize: even I got stuck on that message once Elegant Beef: it's expecting a type Recruit_main70007: true XD Elegant Beef: meaning you have something declaring a type, albiet that's on the wrong line Recruit_main70007: its obvius if you have experience with the language fluxinator2000: thanks guys! Elegant Beef: No problem, i can be a dick whenever 😛 leorize: we really need some Hint to help spot errors like this Elegant Beef: well it'd be more helpful if it was on the proper line leorize: it's on the proper line :P Elegant Beef: alternatively a simple "proc defining type but did not declare type" leorize: it expected the following expression to result in a typedesc Elegant Beef: Sure it's on the properline, totally not off by one Elegant Beef: Get outta here with that multiline declaration Lantos: @dom96 with your nim-opencv what opencv were you using? I Lantos: @dom96 with your nim-opencv what opencv were you using? Lantos: 249 Kenran: Sorry for the absolute beginner question, but I'm just trying to find stuff in Nim to start writing code: I'm looking for the `openpty` procedure, or, alternatively, `posix_openpt`. I checked the module `posix` but not finding it there, so I'm guessing there's no standard binding for those? Kenran: (I found `asyncpty` when googling, which seems to import some procedures from C; I could probably use that library, but since I'm totally new to nim, I wanted to stay away from asynchronous stuff for a while) leorize: yea, but it shouldn't be too hard to bind it yourself leorize: PR welcome :) dom96: @Lantos: cannot remember I'm afraid Winton: a small gift for the community, so they can continue having their coffee Winton: https://cdn.discordapp.com/attachments/371759389889003532/688855068115861615/descargar.jpg Winton: jajaja Winton: Winton: https://cdn.discordapp.com/attachments/371759389889003532/688855103951601684/unknown.png Recruit_main70007: why the movistar thingy though Winton: it was just there i didn't delete it :p Recruit_main70007: ah XD Recruit_main70007: its really cool still Winton: Winton: https://cdn.discordapp.com/attachments/371759389889003532/688856318203002906/descargar.jpg Winton: 😄 disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek sealmove: --stdout:off doesn't work... sealmove: how to supress compiler output? Rika: --hints:off? not sure i dont actually know sealmove: I want to supress everything sealmove: for some reason not even `nim c myprogram >/dev/null` works leorize: sealmove: 2>&1 >/dev/null sealmove: is this shell agnostic though? bottle: https://gist.github.com/astronotter/b5ae1f59ff4a48796a480aa55122eafd this fails to compile if i have a negative value... works if i remove the negative sign leorize: sealmove: posix-compatible bottle: want to confirm this is a bug before i post an issue, if someone can take a look thanks in advance leorize: it's both a bug and not leorize: use a space as a walkaround: https://play.nim-lang.org/#ix=2elX leorize: in Nim, if your code don't look nice, it won't compile :p bottle: yeah i noticed if i wrap with parenthesis it also works bottle: so this is intended? leorize: yea, what happened is that `:-` was resolved to be one symbol bottle: ahh Recruit_main70007: what does the dynlib pragma? Yardanico: https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-import Yardanico: and https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export Yardanico: basically to export/import procedures to/from dynamic libraries (dll on windows, .so on linux and .dylib on macos) Recruit_main70007: but not using it doesnt seem to affect the program Yardanico: what does your program do? Yardanico: and why did you try to add dynlib pragma? Recruit_main70007: i thought it was neccesary Yardanico: It's only needed when you're either creating a dynamic lib or interfacing with one, it's not needed if you interface with C code Recruit_main70007: the dll is being injected leorize: then `{.dynlib.}` is required leorize: how are you building your dll? Recruit_main70007: nim c --app:lib --NoMain name.nim Recruit_main70007: works without dynlib leorize: well you will need it for nim >= 1.1 Recruit_main70007: ok, kind of strange its not needed, exportc seems to be enough leorize: yea that's why I fixed that in the next release :P Recruit_main70007: ah ok :), anyway gn all Yardanico: good night :) djazz: stream ended djazz: started working on a router for the web framework djazz: thanks for the help @exelotl ! exelotl: no problem ^^ Varriount: mratsim: That's one thing I dislike about Python. Exceptions are actually quite expensive to raise (because of the stack trace) and yet they're used all over for iterators and such silvernode: Time to work on space nim again Elegant Beef: Anyone know the commands for ansi characters `d,l,h,t,r`? silvernode: Not me silvernode: I forget what the repl command is for nim. Is it nimsecret? flywind: nim secret silvernode: Thank you flywind: No problem Rika: @Elegant Beef as in `\t` `\r` and stuff? alexander92: morning/ Elegant Beef: no Elegant Beef: talking about things like `\e[23d` alexander92: oh man visual basic stops Rika: okay those are escape sequences not ansi characters Elegant Beef: well ansi terminal escape codes Rika: http://www.termsys.demon.co.uk/vtansi.htm partial list Elegant Beef: yea it doesnt list the ones i mentioned Elegant Beef: well not all Elegant Beef: it has r Elegant Beef: and l Rika: then it might be non-vt100 Rika: https://vt100.net/docs/vt220-rm/chapter4.html might be vt220 Zevv: argh nimble publish barfs on me again Zevv: ah yes the public_repo permissions Varriount: Zevv: What are you working on? Zevv: Oh I made a native MQTT some time ago on a rainy sunday afternoon an put that on github and forgot about it Zevv: no someone picked it up and asked me to publish Zevv: https://github.com/zevv/nmqtt/ Araq: azure testing is down? rmt: Cloudy BSOD? rmt: Better said, BCOD :) PMunch: Araq, well it doesn't appear to test anything at least.. PMunch: Zevv, ooh nice I'm going to be adding a lot more smarts to my house over the coming days, that might come in handy Zevv: PMunch: bah, I hate smarts in my house Zevv: have fun with that :) PMunch: This is the good kind of smarts PMunch: No cloud, basic units tied together with an rPi kodkuce: does nim have some wasm working lib? PMunch: Anyone knows why `extract` here can get a NilLit? http://ix.io/2ebe PMunch: Like this works fine: https://play.nim-lang.org/#ix=2ebf Araq: 'echo red'? PMunch: Nope PMunch: Tried to remove that PMunch: It seems like it's dependent on what I put after the echo ast.treeRepr in the extract procedure.. Araq: you call a macro from inside a macro, are you aware? PMunch: Yup PMunch: That's on purpose Araq: it makes my head explode :P PMunch: It's a macro to make it easier to work with macros :P PMunch: Essentially the `extract` macro takes a NimNode tree of the same structure as the `input` with the exception of nnkAccQuoted nodes. Then the nodes in the `input` that match a nnkAccQuoted node will be assigned to whatever is inside the nnkAccQuoted. PMunch: So in the `test` macro there it would result in something like "let procname = input[0][0]" PMunch: Okay, found the bug. This is definitely a VM bug: https://play.nim-lang.org/#ix=2ebp PMunch: Can be worked around like this: https://play.nim-lang.org/#ix=2ebq PMunch: Is this known, or should I report it? PMunch: Aaah, beautiful! Got this working now: http://ix.io/2ebt Zevv: argh Zevv: sure you will understand this two months from now? :) axion: How would I unparse an AST into Nim source string for debugging a macro's generated code? alexander92: mm alexander92: node.repr alexander92: => source-like representation alexander92: node.treerepr => tree indented node repr alexander92: node.lisprepr => lisp s-exprlike repr alexander92: PMunch that's actually .. useful .. and very good alexander92: maybe the best innovation in nim macros i've seen lately axion: Thanks. It was repr i wanted. Was using lispRepr PMunch: alexander92, yeah it's a thing I've been wanting for a while now while writing macros :) alexander92: like, it makes sense to combine pattern matching directly with quoting PMunch: Yeah, this entire module is basically all the stuff I've wanted when working with macros over the past couple of years dwdv: Scheme-like declarative macros essentially? PMunch: No idea :P Never wrote a schema macro.. dwdv: What rust is doing with macro_rules! https://doc.rust-lang.org/1.7.0/book/macros.html alexander92: dwdv well kinda alexander92: but on the other hand sometimes you need alexander92: custom code alexander92: for extraction/validation/analysis/generation alexander92: so this declarative approach is always up to a point i guess in nim/rust alexander92: the big difference i know about is that rust macros work on tokens iirc? alexander92: and nim's on ast which might be relevant as well alexander92: because you might be able to express more stuff with just valid token sequence but it might look too foreign: so its a tradeoff alexander92: maybe dwdv: Both rust and the various scheme have declarative (macro-rules!) and procedural macros (ast tokens), don't they? alexander92: it seems so yeah, so in this case `extract` is indeed kinda similar to them PMunch: Hmm, is there a way to create a NimNode literal? alexander92: macro_rules! is good! mratsim: @axion: toStrLit mratsim: I feal like Rust's macros don't go far enough mratsim: feel* axion: Macro systems don't go far enough until they allow writing pandoric macros PMunch: axion, pandoric? alexander92: they do mratsim you should look at the typed html jsx thing axion: PMunch: they're called pandoric because they allow opening up the box that should not be opened, closures can be accessed from the outside, opening up all sorts of interesting possibilities PMunch: Crap.. FormalParams is proving difficult for extract PMunch: For example with this: proc name(`arguments`) PMunch: `arguments` there get lifted up to cover the entire FormalParams, including the return type PMunch: And this: proc name(`arguments`): `ret` PMunch: `arguments` will only grab the first argument.. PMunch: Good thing I have all the nodes already in a DSL, so I could generate a matcher for them that would convert things properly based on vararg arguments.. PMunch: Not sure how useful putting in all that work would be though.. PMunch: Since this is mostly meant to parse your own DSLs Skaruts: I'm getting this error when using sfml events with `==` or `in` or `notin` : `Error: parallel 'fields' iterator does not work for 'case' objects` Skaruts: This is the Event type: https://github.com/oprypin/nim-csfml/blob/bef490338d8b31265cc47159310c2a02896b0ccb/src/csfml/private/union_event.nim#L22 Skaruts: I repreduced the error in a small test: https://play.nim-lang.org/#ix=2ebX Skaruts: How do I get around this? I need to check if the event is in a sequence of handled events Skaruts: This is the Event type: Yardanico: https://forum.nim-lang.org/t/2774 Yardanico: I'm not sure if it still applies now, but you probably need to write your own `==` Yardanico: for that object Skaruts: I see Skaruts: not sure how I can check for equality on those objects though Skaruts: or rather, how I can check that they're the same object PMunch: Like so: https://play.nim-lang.org/#ix=2ebY Skaruts: should I worry that multiple input events might contain the exact same values? PMunch: I don't know, I have no idea what you're actually trying to achieve Skaruts: trying to add option to mark an event as handled Skaruts: actually I don't think I should worry about that, no matter how many keys or buttons the user presses, I don't think they can press the same key twice in one frame, but then even if they did, the same key is still the same event Skaruts: thanks PMunch: No problem alexander92: what should i do today? PMunch: Ugh, I'm looking at this problem and it would be doable to implement. Just a PITA to actually do it.. PMunch: All because the Nim AST has some nodes with variable amounts of nodes in them PMunch: Instead of having one "variable amount of nodes" node that could be there instead.. alexander92: but why is this a problem PMunch: Well, imagine nnkCall for example alexander92: `a(b, c*)` ? PMunch: So if I want to do "myProc(`arguments`)" I would expect that to extract all the arguments given to myProc alexander92: a pattern matching thing should probably have a way to express mutlitple alexander92: i think alexander92: i'd expect to have alexander92: `a(b)` => one , `a(*b)` => seq of many in b alexander92: `a(b*)` * alexander92: because the second one is valid nim i think PMunch: Hmm PMunch: I still need to check if the argument is in the `varargs` portion of a node or not though PMunch: Hmm, or maybe not.. PMunch: It might work.. disruptek: hearts and minds, people! hearts and minds! Zevv: ♥ ♥ & 🧠 🧠 disruptek: 💋 Zevv: especially for you. I only see green squares :) disruptek: !last zevv disbot: Zevv spoke in 12#nim 2 seconds ago disruptek: is this the feature you wanted, btw? Zevv: yesss sir Zevv: thank you very much disruptek: sure. i couldn't understand my notes so i had to guess. Recruit_main70007: it even works in discord Zevv: !last Recruit_main70007 disbot: Recruit_main70007 spoke in 12#nim 39 seconds ago Zevv: woohoo disruptek: !last federico3 disbot: federico3 quit 711 hours ago and last spoke 16 hours ago federico3: ? disruptek: i guess i should strip _ automagically. disruptek: trailing... from nicks... for the purposes of equality. PMunch: Well, you should parse "X is now known as Y" messages PMunch: Or whatever they actually are disruptek: i do, but only in one direction. that's why i need to perform the identity test without respect to trailing _. goats32: !last disruptek disbot: disruptek spoke in 12#nim 23 seconds ago PMunch: Damn it.. I had gotten an e-mail at 2PM that my smart stuff had arrived, but I didn't see it until 3:30PM and the post office closes at 3PM. So now I have to wait until monday to get it.. disruptek: !last disruptek disbot: disruptek spoke in 12#nim 32 seconds ago disruptek: not so smart, now. disruptek: i guess the irc lib isn't passing nick events correctly. alexander92: !last disbot disbot: disbot joined 12#nimsec 12 hours ago and last spoke 73 days ago alexander92: WHAT IS HAPPENING lqdev[m]: how do I cross-compile from 64-bit to 32-bit? normally you use the `-m32` flag in gcc but using `--passC:-m32` gives me that `Nim_and_C_compiler_disagree_on_target_architecture` error disruptek: ~news disbot: news: 11the #nim-news channel has a Nim news feed of updates to pull requests, issues, and packages. -- disruptek alehander92: дok Skaruts: why don't sequences have `clear()`? Araq: lqdev[m], I set my PATH to mingw32 (it is usually mingw64) and compile with --cpu:i386 disruptek: there probably should be a couple extensions to the api to pre-alloc by size and to clear without de/re/alloc. Zevv: setlen does #1 Araq: s.setLen 0 # clear disruptek: yes, but it needs a convenience name that is portable to other types. alexander92: well inc is +1 but we have inc alexander92: on the other hand i wonder how often do people actually shrink a sequence to >0 Zevv: I used that to unwind the stack of my VM, but then I threw it out and just update my 'top' index because setLen is expensie Zevv: expensive Araq: I thought about doing proc setLen(s; newLength = 0) Araq: but it's code obfuscation Araq: write .setLen(0) and live with it lqdev[m]: @mratsim is there a way of making weave not eat all of my 12 threads when idle? Zevv: haha Zevv: lqdev[m]: https://github.com/mratsim/weave/issues/103 disbot: ➥ Backoff not kicking in, 100% usage on all CPUs ; snippet at 12https://play.nim-lang.org/#ix=2edQ alexander92: but inc is code obfuscation alexander92: for +1 alexander92: .clear imo might make sense in generic context, similarly to .high .low etc disruptek: exactly. Zevv: create a PR and prepare for 150 responses on that Araq: so which generic operation uses seqs OR tables? disruptek: clear? lqdev[m]: mratsim: do I have to sync somewhere when I use parallelFor? lqdev[m]: I'm trying to fill a ptr UncheckedArray[Color] with a single Color, but it segfaults for some reason lqdev[m]: I have this operation in a single procedure, and I'd like to sync after that proc is complete. Kiloneie: Why is my constants video so dreadfully low on views ? noone cares about constants D: ?(i mean it was a pretty short video but...) kodkuce: lets go buff his views https://www.youtube.com/watch?v=BakkfzsDulM Kiloneie: <.< okay Kiloneie: (Patreon ahem D:...) Kiloneie: also how do you like these thumbnails ? leorize: Kiloneie: welcome to yt watch time :) Kiloneie: 😮 leorize: if you video ctr is not high enough (and that thing is computed with watch time somehow), it won't show up on the subscriber feed leorize: there's a reason why ytbers tell people to click the bell alexander92: гпп alexander92: liked it* alexander92: no idea if it helps with watch algorithms alexander92: i'd say that constants seem a bit obvious alexander92: i mean its probable that there are edge cases etc alexander92: but an average viewer might skip it to see something more unclear Kiloneie: oh well Kiloneie: my first one keeps getting views like crazy... alexander92: is it "introduction.." Kiloneie: #1 and #2 are top of the chart ALL the time Kiloneie: yeah xD D: alexander92: well alexander92: i guess its very easy to start like this for viewers alexander92: and intro sounds important Kiloneie: Right now i get about 100 views on a new video in a week, can't wait for 1000... Kiloneie: eta 6-12 months D: Lantos: Nice interview Araq. Really informative, good to see a video that explains the direction of nim. Ps don Lantos: Nice interview Araq. Really informative, good to see a video that explains the direction of nim. Ps don't for get to smile Araq 🙂 lqdev[m]: @mratsim I'm getting a crash in Weave, something related to load balancing: http://ix.io/2eet Kiloneie: you got a l ink to that interview ? im curious lqdev[m]: idk is this a race condition? it happens when I try to use parallelFor Lantos: https://www.youtube.com/watch?v=-9SGIB946lw&feature=emb_title lqdev[m]: in a continuous render loop treeform: Hey, is there like an mget but for seq? disruptek: mitems treeform: but I just want 1 thing disruptek: [] should be var. treeform: but its a value type disruptek: then assign it to a var and mutate it? treeform: yes disruptek: then assign it to a var and mutate it. Kiloneie: wait, wouldn't the setup in the interview be better than what i use in my videos oO ? treeform: it does not work? disruptek: code? treeform: `positionAccessor = scene.accessors[primative.attributes.position]` treeform: I mute positionAccessor it does not work disruptek: it's a value type. disruptek: mutate it, assign it again. treeform: yeah I think you are right treeform: hmm nope treeform: this is a minimal example: treeform: https://play.nim-lang.org/#ix=2eey treeform: I think the issues is b = a[0] does a copy... treeform: hmm treeform: is there a way to not get a copy treeform: like treeform: b = a.mget[0] ? disruptek: you never assigned it. disruptek: a[0] = b disruptek: if you don't want copies, use references. treeform: but what if I don't want to? disruptek: use a pointer? disruptek: addr Kiloneie: Does Nim forum have a dark mode ? treeform: yeah If I do `var b = addr a[0]` it works disruptek: shouldn't getOrDefault on a CountTableRef yield 0.... by default? matrixbot: `watzon` Is there a pragma that checks if params passed to a proc meet a certain criteria? Something like vala's `requires` statement? Araq: use 'assert' Kiloneie: Informative interview @Araq Araq: thanks leorize: @watzon: join us here on irc at #freenode_#nim:matrix.org leorize: welcome :) Lantos: Araq, I don't think he asked you. How did you find motivation over the years to keep developing nim? watzon: Good to be back here haha. I didn't even realize I was in the matrix room. leorize: lol nixfreak: !cryptography nixfreak: !help Zevv: Don't panic, we are here for you! nixfreak: are there any libs like cryptography or crypto for python that i can use for nim ? leorize: !repo crypto disbot: https://github.com/ba0f3/libssh2.nim -- 9libssh2.nim: 11Nim wrapper for libssh2 15 16⭐ 4🍴 7& 4 more... leorize: !repo nim-crypto disbot: https://github.com/HarperProjects/Pixie -- 9Pixie: 11Some crypto implementations in nim 15 0⭐ 0🍴 7& 1 more... leorize: !repo nimcrypto disbot: https://github.com/cheatfate/nimcrypto -- 9nimcrypto: 11Nim cryptographic library 15 50⭐ 9🍴 leorize: !repo libsodium disbot: https://github.com/FedericoCeratto/nim-libsodium -- 9nim-libsodium: 11Nim wrapper for the libsodium library 15 25⭐ 5🍴 7& 1 more... leorize: nixfreak: have fun :) nixfreak: can't use libsodium right now I wish ): nixfreak: thanks nixfreak: !repo pkcs11 nixfreak: !repo pkcs11 disbot: https://github.com/miekg/pkcs11 -- 9pkcs11: 11pkcs11 wrapper for Go 15 189⭐ 94🍴 7& 29 more... leorize: !package pkcs disbot: no packages match 😢 nixfreak: xit leorize: !package p11-kit disbot: no packages match 😢 Zevv: nixfreak: crypto is a bit fragmented in nimland I'm afraid watzon: Is there some kind of `assert unreachable`? leorize: assert false, "unreachable!"? :P watzon: Lmao I mean that would work disruptek: ~& disbot: &: 11unreachable leorize: if you want it to be more explicit, just put it in a template :P Araq: Lantos: good question, I think one reason is that Nim is a very *big* project that covers/touches many different aspects of computing Araq: type systems, optimizations, stdlib design, DSLs, an effect system, async, safe multi-threading, it never gets boring Araq: bbl Kiloneie: I wish my head worked that way, i keep slamming into the same door till i break xD... mratsim: @lqdev, seems like alerts that work well across IRC/Discord :/ mratsim: just saw your msg mratsim: do you have the code that leads to ix.io (evalSplit), I think the crash you reported is due to something being an int that my error routine trries to display as an uint Lantos: thanks for the answer Araq. @Kiloneie same although I can burry away and forget time doing somethings. Machining/Coding for me. I guess system level design for araq mratsim: @watzon, I use this for unreachable: https://github.com/mratsim/Synthesis/blob/a3054253fa7ff1a66189d0bb02487e399a910b69/synthesis/factory.nim#L324 watzon: Hmm interesting. Thanks :) mratsim: for syncing after a parallel for you can use "awaitable" like here: https://github.com/mratsim/weave/blob/master/weave/parallel_for.nim#L387-L392 mratsim: it's mentioned in the README: https://github.com/mratsim/weave#awaitable-loop él liquido: @mratsim I was unable to track down *where* exactly in my code it was él liquido: I think it was somewhere near a parallelFor, but I honestly have no idea él liquido: I know that calling `Weave.syncRoot` freezes the whole program él liquido: And… that's about all I know Varriount: Hey, I remember some mention of libbacktrace in Nim issues/PRs/RFCs - anyone know where it was originally mentioned? disruptek: !rfc libbacktrace disbot: no results 😢 disruptek: !rfc stacktrace disbot: https://github.com/nim-lang/RFCs/issues/198 -- 3[RFC] [performance] {.inline.} guarantees, `--stacktrace:inline`, and `--ignoreInline` 7& 3 more... mratsim: for the split bug that's OK mratsim: I should be able to investigate with the stack trace mratsim: for syncRoot, do you have blocking proc? mratsim: that wa your github right? https://github.com/liquid600pgm disruptek: http://argentina-ni.ml/959393 disruptek: ~playground disbot: playground: 11an online in-the-browser IDE for simple Nim experiments at https://play.nim-lang.org/ -- disruptek disruptek: ~playground is an online in-the-browser IDE for simple Nim experiments at http://argentina-ni.ml/ disbot: playground: 11an online in-the-browser IDE for simple Nim experiments at http://argentina-ni.ml/ leorize: disruptek: shouldn't we advertise the official playground, then ask PMunch to implement everything from competing solutions? :) disruptek: sure? Varriount: The Go playground is pretty bare-bones Varriount: What would be really neat is running the compiler in the browser Varriount: Though, then the executable would have to be js-compatible Recruit_main70007: how can i do this in Nim? Recruit_main70007: https://github.com/Zer0Mem0ry/StandardInjection/blob/master/testlib/dllmain.cpp Recruit_main70007: possibly without using emit Varriount: Create a DLL? leorize: long story short, you can't because Nim claimed that already :P leorize: the compiler uses dllmain to run code put in modules top-level leorize: so if you just wanna run code, then that'd work, but if you wanna check the "reason", you can't Recruit_main70007: so... Recruit_main70007: no? Recruit_main70007: i cant? Recruit_main70007: if i compile with --noMain? leorize: good news, --noMain does work :) Recruit_main70007: so... i just transpile that function Recruit_main70007: and compile with nomain, lin, etc.. Recruit_main70007: and it will work? leorize: yea Recruit_main70007: Cool leorize: you can import winlean for everything you'd need to write that function Recruit_main70007: ye, ok, i love Nim, its just the best, i can live with simple OOP krux02: Recruit_main70007: how did you get to know about Nim? Recruit_main70007: u see, (this is a long story) ive always liked python, but it is SO F*CKING SLOWW, ive had 3 main language crisis (looking for a new language, but they were either ugly or slow), the first one, i just dealt with it, and kept using python, the second time i looked for python like languages i found Boolang (.NET), it was really good, better then c# for sure, but it was pretty dead in development terms (not completely, but its been a Recruit_main70007: im really comfortable with it, and have no plan in changing it leorize: does the irc bridge even capable of dealing with long messages lol Recruit_main70007: idk leorize: https://irclogs.nim-lang.org/14-03-2020.html#21:45:32 Recruit_main70007: i could write a short book if i get into details XD Recruit_main70007: to sum up, thew third time i looked, in a quora thread deech: Should the 'option' type work with C structs? eg. an object like 'type O {.importc.} = object i: cint ...' leorize: I'm not sure what you mean watzon: Is it possible to get a from a pointer at a specific index like you can in C? `myPointer[i]` isn't working. leorize: cast the pointer to `ptr UncheckedArray[T]` watzon: Thanks! watzon: I figured it probably required a cast Araq: !!!Note: as long as azure doesn't check PRs, no PRs can be merged!!!! disruptek: noted! sealmove: where can I find junit spec? watzon: Does DocGen format doc comments with markdown? leorize: watzon: docgen format doc comments with ReStructuredText (RST) Araq: with markdown extensions. Araq: it's a hybrid and it's not as bad as it sounds as RST and markdown are very similar Araq: in pratice you need to run 'nim doc' and look at the produced HTML anyway for all sorts of reasons watzon: Ahh ok. So do standard markdown links work? Or should I use the `_text https://link.site` syntax? watzon: Looks like markdown links work, nvm haha Varriount: Hm, this is interesting: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1364r0.pdf Varriount: https://devblogs.microsoft.com/oldnewthing/20191011-00/?p=102989 Varriount: Wasn't Ruby moving towards using fibers? mratsim: wow andreaferretti book looks mind-blowing (literally) (https://github.com/andreaferretti/commutative-algebra) mratsim: I'm skeptical @Varriount mratsim: in the report: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1364r0.pdf it says no blocking allowed mratsim: AFAIk fibers are used to handle blocking and are an alternative or complement to the event API provided by the kernel mratsim: and threads are the same mratsim: stackful and thread-local-storage: use heap memory and a GC mratsim: Split stacks/segmented stacks: that's a hard problem. I solved it by using a thread-safe memory pool and another layer of caching on top disruptek: did ioselects get brox0red? disruptek: selectors? disruptek: i cannot make them work right now. Winton: Hello, a friend was building a browser in Vala but he found it a bit cumbersome since the syntax is similar to Java or C #, I told him about nim and well he has his plans with the renderizago gecko engine Winton: any recommendation and library for the user interface ? flywind: Some libraries like `nimx` `nigui` or `wnim` flywind: you can find much more libraries in https://github.com/nim-lang/Nim/wiki/Curated-Packages#gui Winton: Windowx? flywind: don't need cross-platform? Winton: Windows at the moment is for learning purposes for the flywind: `nimx` ,`nigui` and `wnim` can work in windows. Winton: thanx silvernode: Well I got all the basic items added to the prototype code for my space game silvernode: Just pushed a commit silvernode: https://github.com/silvernode/space-nim silvernode: All the new code is in the experimental branch silvernode: I decided to use all of the custom types such as 'Item' in procs so I can pass information and change attributes when needed. Any feedback on that method of doing things would be appreciated. silvernode: I might add a parameter to all the items that allows me to change the worth of an item based on station prices alexander92: wow andreaferretti alexander92: such a book alexander92: nice Araq: bye bye Marathon, cancelled Araq: unsurprisingly Rika: oh hello silvernode Rika: ah Rika: shit Rika: i'm hours late PMunch: Araq, yeah everything is cancelled here PMunch: And all gyms, cinemas, etc. are closed Araq: PMunch, oh really? I didn't know Araq: how many cases do you have? PMunch: 819 total PMunch: 1 dead PMunch: Might not sound like much, but we're only 5mil people in total PMunch: So we have one of the highest per-capita number.. PMunch: Bars and restaurants are also closing, although it's not 100% certain if they are required to PMunch: Pretty much only stores are left open.. Araq: schools? PMunch: High schools are closed PMunch: Primary and middle schools are closed in some parts of the country Rika: ah yes the younger the child the less prone they are to sickness Araq: yeah and they don't have parents or great parents and they never interact with them PMunch: Yeah it's dumb, but it has to do with how it's organised. High schools are organised by a different layer of the government Rika: then the govt layer the lower schools are in are dumb PMunch: Pretty much, those are the local government Araq: school is still open here and I am furious about it Rika: whole city is lockdown here for one month PMunch: High schools across the country closed yesterday PMunch: I'm working for home and have enough food here to probably last me comfortably for a week or two, months if I want to eat different kinds of flavoured rice PMunch: People have of course started hoarding food.. PMunch: So the stores are running out, which are going to cause more people to hoard.. PMunch: It's a mess Zevv: people like you :) PMunch: Oh no, I just always have plenty of food in the pantry :P PMunch: Went to the store yesterday and got some ingredients to make pizza, but not more than I would've normally bought PMunch: Now that I think about it I also have a large stash of freeze-dried hiking meals PMunch: That's at least a weeks worth of food :P PMunch: Hahaha, they just announced on the news that a lot of the students who were going to have e-classes couldn't because the e-classes solution they use is down across all of Europe flywind: It's strange.My package name is basicregex, when I import ../../src/core/basicRegex, it's ok in windows devel but fails in 1.06 and it fails in linux both devel and 1.06.😄 PMunch: imports are not case-insensitive PMunch: But on Windows they are, because Windows file-names are case-insensitive PMunch: And it looks like 1.0.6 added an extra check to ensure that people wouldn't write packages on Windows that wouldn't work on Linux because of the underlying file system flywind: sorry, it works in windows 1.06. PMunch: Ah, so no extra check was added.. flywind: Thanks for help. flywind: looks like macos behaves like windows flywind: flywind: https://cdn.discordapp.com/attachments/371759389889003532/687972008184512522/unknown.png Kiloneie: Let's not talk about this crap, because if you can't tell, it's insanely over exagerated on how serious it is, just google how bad the previous ones were, many of which came from China as well. PMunch: flywind, yes MacOS is also case-insensitive PMunch: Or rather HFS+ (the file system MacOS most commonly uses) is case-insensitive PMunch: Kiloneie, I think the problem with this one is how aggressively it spread PMunch: I mean H1N1 had an R0 of about 1.3 I think, Covid is at about 2.4 Kiloneie: it's only a danger to older people with pre existing conditions PMunch: Older people and/or people with pre-existing conditions Kiloneie: Sure it spreads fast based on data we don't really have access to, but seriously people are panicking way too freaking much Kiloneie: if this was a really dangerous one, we would all be dead already as the preventives countries have made are absolute crap. Kiloneie: Also it doesn't help that some people are already running around in shorts with this wacky weather. mratsim: That's not the main issue mratsim: At this rate it will become a seasonal disease like H1N1 from 2009, so we will have outbreak every year but 20x more fatality rates PMunch: Yeah I'm not afraid of doing from it myself.. Kiloneie: Well hopefully China will learn not to have those crapy stands of meat from oh so many animals all mixed together in open air PMunch: More worried about my grandparents and such. And if everyone gets it at the same time the health system is just absolutely going to break down, which isn't great.. mratsim: Culture and traditions are very hard to change PMunch: Didn't they actually pass some new laws about that like this week? PMunch: https://edition.cnn.com/2020/03/05/asia/china-coronavirus-wildlife-consumption-ban-intl-hnk/index.html alexander92: oh alexander92: in bulgaria we just got into alexander92: uh no idea how is it called in english Araq: it's not from meat, it's a bio-weapon that escaped the lab alexander92: emergent state? alexander92: state of emergency* mratsim: The Yunnan region proverb is going the way of the dodo "You can eat anything that has four legs other than a table, anything that flies other than an airplane, and anything that swims other than a submarine." PMunch: I mean you can, but possibly only once alexander92: Kiloneie it doesnt matter at all if mostly old people are dying, because younger people can still be carriers of disease and infect them/overwhelm ICU-s PMunch: alexander92, oh wow. I don't think that has been officially declared here PMunch: Araq <_< Araq: (I'm not entirely serious but how knows) mratsim: France was in a state of emergency between 1995 and 2005 after a terrorist attack, it was hard to see what was the difference after 2 years Araq: *who Araq: lol alexander92: praise God we dont have any cases in Plovdiv actually PMunch: I mean it would be a weird weapon to push, like who would benefit from it? alexander92: we have mostly 23 at all, so its a bit surprising PMunch: I guess the fact that it takes mostly old/sick people might be positive for the pensions system.. alexander92: mratsim wow 10 years alexander92: but its mostly because we're not very disciplined about quarantine PMunch: alexander92, better safe than sorry I guess.. alexander92: PMunch yeah i was a bit surprised, i hope the north is cold enough for it to not spread alexander92: like i cant imagine an epidemic in such cold places for some reason alexander92: Araq yeah i also doubt it: its almost impossible to control such a thing, and there have been many outbreaks from China before and in history anyway alexander92: its the simplest explanation and it fits vegai: I thought cold was good for this virus vegai: and a warmer weather will make transmissions less likely Recruit_main70007: it is Recruit_main70007: im with Araq, they had the corona in a lab, and they fucked it up, in fact i think it could be a cross between the flu and HIV, since the people that die are usually old with other diseases before PMunch: But why alexander92: but there have been so many outbreaks through history, what is so different about this one to require a lab: it just feels forced Recruit_main70007: as a bio weapon PMunch: With all conspiracies it's important to follow the money, who would benefit from that alexander92: but how can you control such a bio weapon: you need to somehow vaccinate *all of your citizens* without getting anyone to be suspicious and without leaking it PMunch: But it's completely indiscriminate.. alexander92: or yeah to just attack certain kinds of people, but why would you attack old people PMunch: I mean a vaccine could just be part of your vaccination program for a long time. But no country seems to be particularly immune to it so far.. Recruit_main70007: i think it wasnt on purpose, although the chineese goverment could know that in the case of a pandemy, they could manage the situation with their regime, and other countries would not be able to. alexander92: if this was true, this would leak 100 times and other countries would literally wage war for stuff like this alexander92: i really doubt such an operation is achievable Recruit_main70007: communism can hide things from the rest of the world, they ve done it before alexander92: i can imagine something leaking from a lab as a result of simply experimenting, as they do some very weird stuff in china sadly, but i really doubt it and i dont think it would be intended Recruit_main70007: i also doubt it alexander92: Recruit meh, not really alexander92: people generally knew about the stuff communists do around here alexander92: even with some delay Recruit_main70007: a lot of them, yes, but im sure they still hide a lot of things Recruit_main70007: gotta work :p Recruit_main70007: bye alexander92: bye bye alexander92: btw the gitter bridge doesnt work PMunch: Kiloneie, if you're around I made a little recording using my $0.63 lapel mic: https://uploads.peterme.net/lapeltest.mp3 PMunch: I mean this keyboard isn't super noisy to begin with. But the only clicks you can really hear in that recording is when I'm slapping the spacebar PMunch: Just remembered that I have a switch tester with MX switches, this is what they sound like when clicked at about the same distance as where I keep my keyboard: https://uploads.peterme.net/lapeltest_switches.mp3 Kiloneie: it's weird how good the voice quality is on something that cheap oO Kiloneie: gotta see if i can find it as cheap here PMunch: Yeah, I was very surprised :P PMunch: It does have a slight hiss to it, but nothing that the PulseAudio echo-filter can't handle PMunch: Kiloneie, I think this is pretty much the one I have: https://www.aliexpress.com/item/4000592902319.html?spm=a2g0o.productlist.0.0.25c32021t7Xk3l&algo_pvid=63fc5c48-4dd3-4b35-b9f3-86ed0fa3108a&algo_expid=63fc5c48-4dd3-4b35-b9f3-86ed0fa3108a-2&btsid=0ab6f82315841022619814158e666c&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_ Kiloneie: If i only knew the name of this in my language, all im getting are every other kind of microphone D:... PMunch: Which language? Kiloneie: Slovenian Kiloneie: this seems to be the best i can get with a quick search on website that tries to find cheapest prices for a product, and it seems very popular: https://www.mimovrste.com/pc-mikrofoni/tracer-mikrofon-studio-pro-set Kiloneie: not seeing any lapel ones... PMunch: https://www.heureka.sk/?h[fraze]=lavalier+mikrofon PMunch: There's plenty, but not any really cheap ones.. Kiloneie: https://www.ceneje.si/L3/432/avdio-video/glasbena-oprema/mikrofoni?sort=3 Kiloneie: same here, put on cheapest to highest filter, and... Kiloneie: across many stores this is it... PMunch: https://www.ceneje.si/Izdelek/1436089/avdio-video/glasbena-oprema/mikrofoni/proel-mikrofon-kravatni-lcm1 PMunch: €10, not too bad PMunch: Oh wait, that was a head-mounted thing PMunch: I guess that would work too though Kiloneie: yeah but for 33.7€ more € - 5€ on delivery cause i got VIP there as in free delivery, it's a much better deal PMunch: https://www.ceneje.si/Iskanje/Izdelki?q=kravatni+mikrofon PMunch: Kravatni mikrofon seems to be the word you're looking for Kiloneie: which translates to tie mic Kiloneie: as in tuxido tie... alexander92: guys this exception handling thing starts to look very wild alexander92: i am afraid if we get several kinds of error + flags for it this will be just a combinatorial explosion of edge cases/lib signatures alexander92: is it easy to make all this orhtogonal PMunch: Makes sense, they are commonly attached to your tie, or lapel (the thing either side as an extension to your collar in a suit jacket) alexander92: all those * Kiloneie: https://www.mimovrste.com/pc-mikrofoni/tracer-mikrofon-studio-pro-set?tab=reviews 43.70€ + 2€ for home delivery take over, this seems like a really good deal, great opinions on it too from 20 people, hopefully it lasts thougfh the arm and everything Kiloneie: no 50 cent replacement for me here xD... Kiloneie: still really cheap though, my current mic with boom filter cost me like 120€ about 10 years ago, i guess everything got much cheaper now PMunch: Haha, can't you order from AliExpress? Or do you just not want to wait for shipping? Kiloneie: idk about quality there... PMunch: Yeah I think microphones and such have gotten quite a bit cheaper Kiloneie: i ordered a VGA to digital... or vice versa converter once, and it never delivered PMunch: Typical chinese quality :P But the one I linked looks exactly like the one I have, and it sounds very good for 40.63 Kiloneie: till then i bought my new pc setup PMunch: $0.63* Kiloneie: where did you get it ? 63 cents what PMunch: The one I linked you: https://www.aliexpress.com/item/4000592902319.html PMunch: Apparently they're down to $0.53 now :P PMunch: With free worldwide shipping PMunch: I got mine from AliExpress Kiloneie: this will arrive in like 2 months due to corona crap though D: Kiloneie: also if i buy the mic with the arm i linked, i can for sure get at least 20€ for my current mic and boom filter since boom filters can't just drop in price Kiloneie: so that's about 15-20€ for the setup i need Kiloneie: occasionally i find some sets at extremely good prices Kiloneie: Like this is a really good deal: https://www.mimovrste.com/miske-in-tipkovnices/redragon-gaming-komplet-4-v-1-s101-ba Kiloneie: Kiloneie: Im planning a lan party system for the future, 5 computers and this is like amazing good price. disruptek: !last livcd disbot: livcd never seen. disruptek: 🙁 Araq: ok, so now schools are closing here too Kiloneie: same here disruptek: good. disruptek: !last rika disbot: Rika spoke in 12#nim 22 hours ago disruptek: !last aeverr disbot: aeverr quit 764 minutes ago and last spoke 22 hours ago Rika: hello? disruptek: how are you feeling? Rika: better regards sickness, more annoyed regards the lockdown, even more annoyed regards the code i've been trying to improve the speed of disruptek: good. disruptek: 😉 Rika: wtf do you mean good ;~; disruptek: could be worse. livcd was in quarantine and we haven't heard from him in days. PMunch: Uhoh PMunch: I mean, he could just be sick and not on IRC :P PMunch: But he's probably dead alexander92: huh really alexander92: how do you know he was in quarantine Rika: perhaps he said so Araq: I think you have internet in quarantine Rika: oh my god Rika: its not the requests making my process lag Rika: oh my god PMunch: Araq, but what about computer viruses. One can never be too careful! PMunch: Rika, did you find your bottleneck? Kiloneie: that is so 2000... Kiloneie: viruses in these days ? lmao D: alexander92: rika oh did you find it alexander92: Araq btw what about effects in async code alexander92: is there any difference in how are they handled currently Rika: pmunch, i have a hunch on what it is alexander92: wow this is almost poetry :) alexander92: if one imagines munch being pronounced like hunch PMunch: Haha :P Rika: O_O internal error Rika: when using defer in a block that returns last expression Araq: alexander92: I dunno, it's all non-sense Rika: yield in expr not lowered Rika: interesting Araq: Rika: report it please PMunch: Unfortunately it isn't, Munch is pronounced more like punk than hunch. But with the u pronounced more like the u in university. Rika: like "myunk"? or something? Rika: ill try making a reproducible first PMunch: Fuck it, since I had my mic set up: https://uploads.peterme.net/name.mp3 alexander92: Araq dont be a nichilist! alexander92: PMunch i know alexander92: hmm no i pronounce it like munich but without i Rika: huh, i cant seem to replicate the issue Rika: so "myunkh" PMunch: Where do you get the y from? :P disruptek: somewhere between moonk and monk. americans pronounce it `monk`. Rika: english pronunciation of munich PMunch: Our Brazilian relatives actually changed their names to "Munk" in order to have people pronounce the name closer to how it's intended alexander92: yeah in bulgarian its like m strong-german-u n k PMunch: alexander92, yeah that's pretty much exactly it Rika: i have no idea how european pronunciation works Rika: all i know are american pronunciations and asian ones disruptek: my family name is actually kimmich; german. but no one pronounces it with a hard k correctly in the states. PMunch: Wait what, how do they pronounce it? disruptek: they get the first k right but it should be `kimmick`. PMunch: Aah PMunch: So same as my -ch disruptek: yep. PMunch: I thought they somehow messed up the first one :P disruptek: wherever there is stupid, there is an american. disruptek: we will find a way. PMunch: Argh, back to my issue from yesterday, how can I pass one node tree through an identifier, and one through a block to a macro.. Rika: THERE IT IS Rika: god it took me so long Araq: alexander92, I personally still think "quirky exceptions" are best, all things considered. The only reason I'm not pushing for them is that it's mostly unexplored territory Rika: ok wtf xd its not just that wtfffff Rika: ill go insane before i realize that im an idiot PMunch: https://play.nim-lang.org/#ix=2e72 PMunch: Weird error, why is the argument to a macro not possible to evaluate on compiletime? PMunch: Rika, haha :P PMunch: Same error without the template: https://play.nim-lang.org/#ix=2e75 mratsim: because in the VM context there is no compile-time, everything is at runtime for the VM mratsim: i.e. use let instead of const and use if instead of when mratsim: and no "static" block PMunch: That is all well and good PMunch: But I still can't figure out how to do this alexander92: Araq i have to try them, however i like radical methods :P alexander92: rika what was the error flywind: sink can't work with varargs? okcc: how i can get value of a ptr like *(some_ptr) in C? disruptek: someptr[] disruptek: quirky /is/ best, but how can we support progressive use of quirky so i can use it in libs? disruptek: this is the problem afaik. okcc: disrupttek: it's that the default way? okcc: also thank you :) disruptek: yep. PMunch: Hmm, is there seriously no way to pass a NimNode tree to a macro? mratsim: okcc: use ptr UncheckedArray[T] mratsim: ah misread you wanted to dereference Zevv: PMunch: why would you do that? PMunch: Because I'm trying to do magical things with macros :P PMunch: But I think I've found a way to do it PMunch: Or rather to do what I wanted to do disruptek: just have the macro call a compile-time proc. use the proc to do the work. Zevv: right Zevv: The first thing I always do from a macro is go into procs Zevv: so that I do understand what is happening mratsim: Magical things with macros: Summon poney PMunch: disruptek, that doesn't work, because I want to pass one node tree by an identifier disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek PMunch: Uhm, wut: Error: type mismatch: got but expected 'NimNode = ref NimNodeObj' mratsim: are you passing a NimNode to a template? disruptek: !last leorize disbot: leorize spoke in 12#nim 24 hours ago disruptek: nimsuggest not working. my life is broken. leorize: disruptek: o/ disruptek: hey, i don't get it. it works fine until i change branches. disruptek: i think that's the problem, anyway. exits with code 1. leorize: try calling it yourself then? disruptek: how? leorize: nimsuggest --find /path/to/file.nim disruptek: /home/adavidoff/git/Nim/lib/system/assertions.nim(29, 7) Error: type mismatch: got but expected 'Hide = proc (msg: string){.noinline, noSideEffect.}' disruptek: .raise effects differ livcd: if anyone is wondering i might be infected so yeah disruptek: oh hey disruptek: are you sick? livcd: i was released from quarantine just a few days ago and there were 3 people infected in our office :D disruptek: dude, get away from me. leorize: lol leorize: livcd: stay safe :) livcd: :F what can I do i am gonna die livcd: i have asthma and weak lungs disruptek: is he gone? livcd: dont get too stressed :-) mratsim: you have an excuse to work on Nim all day shashlick: I've implemented https://github.com/nimterop/nimterop/issues/169 in a branch for nimterop - do folks have any concerns with the change? disbot: ➥ Skip `{.header.}` generation disruptek: leorize: any ideas? just a quirk of the devel compiler? leorize: yea leorize: iirc 4raq pushed a change that disallow hiding {.raises.} via casting disruptek: that punk. leorize: which assert and friends do leorize: so you gotta update your nimsuggest to deal with that disruptek: thank $deity for tests. disruptek: oh wait. shashlick: disruptek: does gittyup have tests? disruptek: i think a couple. shashlick: i need to verify that wrappers are still working correctly with that change shashlick: does nimph have tests?? disruptek: a couple. disruptek: nimble doesn't work in devel, though. disruptek: same problem as nimsuggest. shashlick: what's the issue disruptek: http://ix.io/2e7E alexander92: ok they are closing our gyms disruptek: NO alexander92: it's actually very radical disruptek: it's due to a0eca7518223a18f3633150de2c8d3c1c9e71560 alexander92: they're closing everything except grocery stores, apothekes and drogeries alexander92: livcd is alive Rika: apothekes? Rika: drogeries? drug stores? disruptek: yep. disruptek: i'm trying a build all just before the sink inference. shashlick: disruptek: http://ix.io/2e7H disruptek: known failure. unrelated. shashlick: okay disruptek: i wonder why no one else has this issue i'm having, though. disruptek: pre-sink-inference works. disruptek: shashlick: segv for me testing nimph, sadly. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: gittyup is fine, though. shashlick: do you mean with the test nimterop or nim alexander92: rika yeah sorry, not sure what are the english words disruptek: since i ran the gittyup tests, now it seems that nimph is working. alexander92: pharmacies* and drug stories alexander92: stores* disruptek: it's so weird the way that happens with nimterop. shashlick: are you talking about my {.header.} change disruptek: i have no idea. Araq: hi livcd, I'm glad you're around disruptek: nimph is back to dumping extra hintConf again. disruptek: why did that change in the compiler? Araq: what do you mean? Araq: what change? disruptek: i'm getting extra nimConf. more than i'm used to. leorize: gah, some nimsuggest features are just painful to use leorize: it offloads too much work to the user disruptek: anyway, different problem... nimsuggest is crashing on my edited files, but not when i revert my changes. Araq: just fix the crash and don't fuck around with git history Araq: there is a debug mode somewhere, enable it, look at the stack trace, done disruptek: kk Araq: usually 'nim check' replicates the bug Araq: so that you don't even have to start nimsuggest disruptek: not this time. disruptek: i can't even build nimsuggest now. Araq: that's covered by our CIs though disruptek: our CIs don't have my edited source in them. bad data. PMunch: Hmm, why did this only run one check? https://github.com/nim-lang/Nim/pull/13620 disbot: ➥ Improve deque, tables, and set modules disruptek: my nimsuggest crash is due to `Something {.deprecated.} = object` 🙁 disruptek: well, the one that isn't due to the assertion issue with sink inference, i mean. Araq: now ... instead of fixing bugs I'm gonna make another exception handling proposal... Araq: :-) disruptek: luckily, i can gdb this segv. i'm amazed. it's threaded. disruptek: even with color syntax hi-lighting. what a world. alexander92: Araq oh yeah alexander92: exception handling is like solving the korea conflict alexander92: it's not, ok alexander92: disruptek why are you debugging nimsuggest disruptek: i seem to have a parse issue, incredibly. disruptek: no ast for deprecated object nodes. disruptek: i don't need deprecated object nodes as much as i need nimsuggest, but perhaps others would like their compilers to not crash when such an animal is encountered. alexander92: computers crashing no bug splashing flashing in our mood alexander92: animals are not computers, computers are not bugs disruptek: at least we have an application for our nim-powered id-tags for fosdem2021. disruptek: an alarm goes off when two id-tags get within 7' of each other. disruptek: prevents infection. alexander92: the face thing right alexander92: i just thought about this today! alexander92: i am probably only the 829392-st alexander92: but imagine how hard would it be to eat disruptek: you don't eat your id-tag. alexander92: you'll have to throw stuff to your mouth alexander92: i dont like it disruptek: wait, what? alexander92: well if the first id tag is on your hands alexander92: and the other one on your face disruptek: every person wears a single tag. alexander92: but no, you shouldnt touch your face disruptek: as long as your burger doesn't wear a tag, too, you should be okay. alexander92: i am not sure why tho alexander92: but what if my burger wears a tie disruptek: if you had ever seen my face, you'd know. disruptek: mostly teeth. alexander92: your dentist must feel like a facelifter! Araq: alexander92: anyhow here is the idea alexander92: i hope we ca nhandle it Araq: there are 3 ways to deal with an error: 1) on error die, 2) on error propagate, 3) on error continue until X Araq: we support 1 and 2 well, quirky does (3) mratsim: 4) on error reboot Araq: mratsim: same as 'die' for me, but maybe you're right Araq: (3) is almost always what I want in a destructor alexander92: we can ignore an error right Araq: and if enable-able for a section of code it's generally useful Zevv: araq: practical example? Araq: Zevv: for x in fields(obj): =destroy(x) # destroy all the field, remember the first error for later alexander92: but how hard is for one to write such code disruptek: you are iterating and adding to a result; you would like to get whatever work you have done in the loop despite raising at some point. alexander92: that independently on what error strategy/flags are used alexander92: it kinda works as expected Zevv: Araq: right, that makes sense indeed Zevv: but what about consequent errors? Araq: you can stack them but it quickly can take up lots of memory Zevv: exactly Zevv: but not stacking them is throwing them away, which is also not right Araq: IMO the first error is almost the most important one and the rest can be ignored Zevv: pfew that makes it hard to reason about things Araq: it's what the Nim compiler does by default, nobody complained Zevv: how so? it does not "complete until X" now, does it? Zevv: you are referring to exceptions leading to more execptions disruptek: it does with quirky. Zevv: no one uses quirky Araq: the 'X' is to be determined Araq: I suggest it means "until the current function returns" Zevv: hm does that hold? In your example =destroy(x) might throw Zevv: so *that* is the throwing function, not the one doing the for loop disruptek: no disruptek: i mean, yes, this is the problem. but the original exception was presumably in the loop func. Zevv: hmm Araq: 1. destroy calls 'dealloc'. no error possible, easy. Araq: 2. destroy calls 'close', 'close' errors because it triggers an IO op Zevv: 3. destroy does stupid things because people are stupid Zevv: but let's go for 2 Araq: other 'close' calls still run but we remember the error Araq: sounds ok, it's pretty much what I would code by hand Zevv: and how would you tell the compiler to handle like this instead of proagating down the call chain right away? Zevv: wrong worded, let me retry: Araq: yet-another-pragma or yet-another runtime hook Zevv: is that the default behaviour or can you choose somehow Zevv: pragma makes sense disruptek: is this currently impl as a transform? Araq: it's not implemented at all disruptek: i mean quirky. Araq: quirky is in the C backend disruptek: ahh. kaushalmodi: Araq: Is there isn't way to expose all export marker procs in a .so, right? kaushalmodi: ..as is I manually annotated each with `{.exportc, dynlib.}` Araq: no. kaushalmodi: trying to figure out how to debug a crash kaushalmodi: because it happens only in a regression suite that runs like 1000 simulations kaushalmodi: and when I run just that one seed manually, the crash does not happen kaushalmodi: as each symbol is not exposed, the stacktrace is not very helpful: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ even when g++ compiled with -O0 [https://gitter.im/nim-lang/Nim?at=5e6bd38e1f0d285eb278f046] kaushalmodi: .. I need to figure out what those "don't know"'s are Araq: huh? Araq: you don't need to expose symbols, you need a debug build kaushalmodi: above is with debug build kaushalmodi: with --debugger:native kaushalmodi: I cannot invoke gdb because I cannot reproduce this crash interactively kaushalmodi: the crash happens 1/1000 times in a regression suite kicked off on a CI machine farm kaushalmodi: so the only info I get back is that stack trace Araq: you can attach the debugger to a running process kaushalmodi: but that process is running on a remote machine that I cannot access kaushalmodi: this is how I generate the debug builds: ⏎ ⏎ > nim cpp --out:libdpi_64.dbg.so --app:lib --nimcache:./.nimcache -f --opt:none --debugger:native --listCmd --gcc.cpp.options.debug="-O0 -g3 -ggdb3" --gc:none libdpi.nim kaushalmodi: btw I pasted the wrong part of the stack trace but this shows the same issue: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e6bd5259f25f2238b7dc010] kaushalmodi: libdpi_64.dbg.so is what I built using above command kaushalmodi: cffg_psd_from_arrays has exportc, dynlib so that's visible in the stacktrace kaushalmodi: it then calls stuff from the ggplotnim and ginger nimber packages.. but I cannot see what all it is calling disruptek: leorize[m]: how do i run nimsuggest tests? sekao: has anyone written a treesitter parser for nim yet? i know there's a nim wrapper for the library itself, but i haven't found any parser yet shashlick: Not to my knowledge shashlick: I use it in nimterop sekao: cool i might give it a try at some point. maybe it would help to start with the python grammer. not sure how any of it works yet mratsim: @alehander92 lol, what’s my signature on HN? shashlick: @mratsim - do you have any wrappers based on nimterop in production? Recruit_main70007: @mratsim ^ disruptek: status is pretty anti-nimterop afaik. shashlick: they've been pretty supportive in terms of feedback, cept for stefan who thinks it is a bad idea in principal disruptek: it's amazing how many bad ideas have working implementations compared to good ideas. Kiloneie: because bad ideas are usually easier to implement ? mratsim: @shashlick, our wrappers predate nimterop mratsim: nim-blscurve and nim-secp256k1 mratsim: for my own project I'm still using nimgen for clblast dwdv: Interesting discussion on the safety mode RFC. Is this yet another step towards pony- or parasail-like error handling where runtime-exception simply aren't a thing? Wonderful! ;) mratsim: https://nim-lang.org/araq/destructors.html mratsim: first language cited is parasail 😉 Araq: dwdv: actually I revived my branch for it Araq: "araq-static-bound-checks" Araq: when you use .defects: [] you have to write code so simple that Nim's proof engine can handle it mratsim: "parallel" has issue with simble bound checks though :/ Araq: in my branch it's a tiny bit smarter :P Araq: but explain to me what "simple" means for you mratsim: it failed with a[i], a[i+1], a[i+2] a[i+3] when unrolling a loop iirc, but maybe I was also in global context and not in a function, it was a long-time ago mratsim: I was trying to implement parallel reduction Araq: these are supposed to work Araq: but tbh I sometimes wonder if arnetheduck simply wants a .correct pragma Araq: you write .correct to your proc. and the compiler says "nope". Araq: and it always says that because it never is correct. Araq: problem solved, the compiler catches all of your bugs at compile-time mratsim: "nope nope nope" mratsim: That said I'm really interested in the Z3 work shashlick: Ok thanks mratsim: People are using Coq to generate C, Go and Rust code now: https://github.com/mit-plv/fiat-crypto dwdv: " 'araq-static-bound-checks'" -- interesting. Were there similar experiments done along the way of pony's not-so-clever forced approach? `try arr(idx)? else foo end` mratsim: that's like Python's "exceptions are control flow" disruptek: no, thank you. disruptek: maybe .correct just implements the proc n*m ways and throws out any that aren't viable. so you get undefined behavior, but at least it's "correct". dwdv: Well, when used as an expression then the above isn't much different from rust's unwrap_or(foo). djazz: late stream again... did some nice progress on my web framework https://www.twitch.tv/daniel_hede Spy653: yo anyone with experience with gui's know what the difference between FLTK and IUP is? Spy653: is there ever a right gui lib to use or is it always just preference exelotl: IUP doesn't have good mac support, but I've used it and it's quite nice and simple yet full featured exelotl: but FLTK has a rather impressive showcase of things that are actually made in it Spy653: the only thing thats ever really been important to me personally is visuals as I've never built anything to be sed by other Spy653: I'm really loving the Internet explorer/VBS UI style at the moment don't know if that kind of thing is controlled by the OS or not though federico3: a static "table" at compile time would be nice disruptek: we can do that. leorize[m]: disruptek: you compile the tester in nimsuggest/tests and run jt leorize[m]: * disruptek: you compile the tester in nimsuggest/tests and run it leorize[m]: make sure that the new nimsuggest is in your PATH, it won't work otherwise timotheecour: IIRC i did measure and yes, it was, but I can include benchmark showing this in PR Araq: I'm sceptical, the threadlocal access is more expensive than storing the frame on the stack kaushalmodi: Wow, that was my quickest issue opening to PR to merge cycle! Thanks @Araq. Kiloneie: that Rune split issue is now fixed in devel. Kiloneie: Nice Winton: browser in nim kaushalmodi: there's a very recent regression when building NIm devel on my machine kaushalmodi: it's while building koch kaushalmodi: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e6996f602dbe022a17f8802] kaushalmodi: that nim.json is invalid: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e69972a85f81e18a8fe6fc9] kaushalmodi: doing bisect now .. kaushalmodi: @Clyybber Can you see my above error? It started happening after https://github.com/nim-lang/Nim/commit/6b3098c378430e3387854ffc413ce96bd94a3d2c kaushalmodi: .. and it's something in my config.nims that's breaking my build Winton: what is the purpose of nim? and for its use? kaushalmodi: to make super cool applications very fast Winton: mm ok Winton: thx timotheecour: @kaushalmodi hi I PM’d you leorize: disruptek, Zevv, lqdev[m]: how has your experiences been with nim.nvim perf-opt branch? leorize: are there any new bugs? nick34348: Is there anywhere I can download a PDF of the nim reference? Guest10224: in a template foo[T]() = ... is there a way to retrieve the string value of T at compile time, I want to pass it to a macro there leorize: disruptek, Zevv, lqdev[m], narimiran: perf-opt has been merged to master, please switch and pull leorize: for nim.nvim narimiran: done silvernode: Good morning Rika: good morning to you Rika: oh yeah that reminds me to check your repo out haha silvernode: updating discord so I can reply there Rika: why though Rika: you can just message here cant you or what silvernode: I don't think direct replies work do they? Rika: direct replies meaning silvernode: if I orint your username it won't notify you Rika: ah that Rika: i see mollusk: silvernode here Elegant Beef: Hello clone mollusk: ha Rika: ok mollusk mollusk: so I am in the parking lot at work in the car with my laptop. Time to work a little bit on my space game. I pushed some prototype code earlier today Rika: in the car?? why tho mollusk: because I can be alone in the car mollusk: learning how to work with seqs mollusk: Made some types that take seqs and a items file that defines some procs which use the types Rika: you gonna stream mollusk: @Rika Na I have to clock in to work in 30 minutes Rika: oof mollusk: I get here an hour early and work on the game a little bit every night. mollusk: I'm learning Nim in the process so commits are slow mollusk: I am figuring out a good way to create items and use them. I decide to create some types and use them in procs which I can call to print out the atributes of the types. mollusk: The Item type has a worth attribute which is how much credits the Item will cost although I eventually want different stations to have different prices than others so I need to figure out how to incorporate that with the static price set on each item mollusk: Maybe I should make a currency system Rika: then the item type wont be the one that holds the "credits" amout Rika: but it needs a "worth" amount nonetheless Rika: then you base the credits on that Rika: multiplied by probably the "richness" amount of a location mollusk: So just set the price at that station and plug that into the item worth? Rika: no no Rika: item has worth; place has richness; credits = some function f(worth, richness) returning credits value mollusk: @Rika interesting way to do it mollusk: So a proc that handles rates of credits basically. mollusk: with some math in it Rika: yeah Rika: can be simply multiplication Rika: can be weighted multiplication Rika: can be some mish mash of trig and log functions Rika: depends on what you want reall Rika: and then you can also add more factors in if you want mollusk: @Rika I was thinking of having the prices change slightly when ever you dock at a station Rika: you can add a time factor then Rika: or random() if you like that more Rika: but i think a stabler factor is more realistic 😛 mollusk: A time based approach seems interesting mollusk: although when dealing with time, that can have its own rabbit hole Rika: it can be like whenever you move x times to a different station you increment the day Rika: but this is trading, no? maybe something more granular is nice Rika: you think you can do real time? haha mollusk: Some counter that counts the number of times you have been to a station maybe, after a few visits, the prices change. Rika: wonder if there's an async stdin.readLine() if that's even possible mollusk: not sure if I can do real time Rika: yeah real time sounds hard for a beginner Rika: maybe you can also assign distances to stations, but that adds graph theory to your game mollusk: I suppose I could find a function that can use the time of the OS Rika: ah, there's the `times` module or the `std/monotimes` module mollusk: and then say "if 10 minutes have passed, do something Rika: times for exact now times, monotimes for durations (relative times) Elegant Beef: Guess my tldr doesnt work well :D Elegant Beef: https://streamable.com/5pzu7 mollusk: I am thinking, if the OS says it is 23:46, once you dock at a station then a time check happens. If the time is then 23:56 then the fucntion counts that time has incremented by 10 and therefore changing the prices. leorize: you should account for clock running backwards too :) mollusk: I didn't even consider that Rika: which is why i suggest just using the monotimes module 😮 Rika: :P* Elegant Beef: yea using the pre written modules are probably better, i'd probably just use ingame time, but im a numpty Rika: ~~honestly have no idea how monotonic clocks are programmed~~ mollusk: I am looking at the monotimes module trying to figure out which proc I should consider using. without seeing examples it is a bit difficult. Rika: getMonoTime() to get time leorize: they usually uses cpu internal clock Rika: then newtime - oldtime to get duration leorize: the clock only counts up, not down leorize: but only valid for that one session Rika: uses 64bit i assume Rika: in nanoseconds? leorize: it's platform dependant Rika: oh okay so its not the same even across intel cpus? Rika: hmm Rika: good info mollusk: Since I am not planning on checking the time difference between when the game was last opened, I can limit my scope to the current session. leorize: sounds good mollusk: eventually I do want to somehow be able to save a game Rika: you're taking notes of these suggestions right mollusk: nope lol but I can always go through history mollusk: anyway, time to clock in. ttyl Rika: F Zevv: leorize: I don't know, no "experiences" as such. I never thought about it Zevv: that's good, right? leorize: if you don't get bug, that means it works :P PMunch: !eval let (a) = (100) NimBot: Compile failed: /usercode/in.nim(1, 5) Error: 'tuple' expected PMunch: Well that's annoying.. flywind: !eval let (a) = (100,) NimBot: PMunch: Aah, nice PMunch: So in my macro just swap nnkPar for nnkTupleConstr Clyybber: @kaushalmodi Hi, hmm this is very wierd. I'm not sure how my changes caused this. Clyybber: Does cleaning your nimcache resolve it? nothratal: is there a way to update all dependencies downloaded via nimble? flywind: no, but you can try https://github.com/disruptek/nimph Clyybber: Hmm, I think I have a fix. clyybber: git is really fucking with me today.. clyybber: is it possible to make `git branch XXX` automatically do `git checkout XXX` afterwards? PMunch: git checkout -b PMunch: clyybber ^ clyybber: Thanks mate! PMunch: No problem :) nothratal: @xflywind thanks and sorry I was afk Araq: want to see me stream about my cycle breaker? clyybber: yeah! Araq: caught exception:nd:\a\1\s\nimcache\r_windows_amd64\nim.json(2, 384) Error: ] expected Araq: wtf nothratal: @xflywind, by the way, your package xlsx works like a charm! Araq: clyybber, any ideas? timotheecour: @araq https://github.com/nim-lang/Nim/pull/13635 disbot: ➥ fix #13633 fix koch boot crashing regression ; snippet at 12https://play.nim-lang.org/#ix=2e1M alexander92: hey guys timotheecour: but @Clyybber just beat me to the punch, however this uncovers another accidental(or not accidental) bugfix in HCR code, please read clyybber: Araq: Yeah, I fucked up. I pushed a fix clyybber: I forgot to do a git checkout after a git branch :/ clyybber: That bugfix wasn't really accidental :p Araq: fix is on devel? clyybber: Araq: Yeah clyybber: timotheecour: I reopened your pr timotheecour: thx will rebase clyybber: Its the \n typo right? Araq: I hope I can merge this soon, I get bootstrap problems otherwise Araq: due to the massive changes :-/ clyybber: Yeah, unfortunately the regression my PR introduced causes ./koch boot to fail clyybber: but only on the second run xflywind: @nothratal Thanks.But I'm busy in writting web framework and don't have much time to maintain `xlsx`. clyybber: and after its infected your bin/nim you can't do ./koch boot anymore clyybber: so I had to rm bin/nim and build_all clyybber: Its really bad, thats why I pushed the fix as fast as possible clyybber: So no-one else has to deal with this Araq: yeah thanks timotheecour: > ** so I had to rm bin/nim and build_all ⏎ ⏎ not needed; all that’s needed is `rm -rf nimcache` Araq: yeah but you never know where 'nimcache' is clyybber: timotheecour: Yeah, except for in a very ugly special case. clyybber: I pushed fast enough so no-one noticed timotheecour: actually it’s hardcoded, which seems like a bug: ⏎ `./koch boot —nimcache:/tmp/foo` will override with ./nimcache because it comes AFTER instead of BEFORE clyybber: except me :p clyybber: timotheecour: That seems expected, isn't it? clyybber: I think ./koch boot just forwards the arguments Araq: yeah timotheecour: Why? it should honor what I’m passing via cmdline, but does not; clyybber: Oh, so maybe it doesn't forward them as in appending timotheecour: right, the order is wrong; seems like easy to fix (maybe) Araq: how else would koch boot -d:release work? timotheecour: postpend user provided options instead of prepend clyybber: timotheecour: Yeah, that makes sense clyybber: I'm gonna make a PR timotheecour: ok. also, ur bug wouldn’t have happened if we simply used std/json API’s instead of rolling our own json inside extcomp.nim , WDYT Araq: why? Araq: our own json is superior though Araq: fewer allocs clyybber: timotheecour: Yeah, I think the parser is fine clyybber: The issue was purely my error Araq: also the stdlib's json grew like cancer Araq: with the 'to' macro and who knows what else timotheecour: not the parser, the manual writing `lit "{\"compile\":[\L”` etc… we should trust our API’s, they’re tested timotheecour: (eat ur own dogfood, etc) Araq: I trust my 'lit' skills clyybber: lol Araq: we can extract it into std / jsongen.nim though Rika: "ar_q's lit af yo" Rika: sorry Araq: an API to generate JSON is fine, but why does the API have to create a JSON tree for that? clyybber: Araq: Did you have to retract the try.. finally optimization? Araq: nah I fixed it clyybber: Nice Araq: it's as good as before clyybber: Cool Araq: we should infer the new sfAlwaysReturn for destructors/procs clyybber: Is it manual for now? Araq: to produce better code for ARC Araq: it's not exposed, there is no pragma because there is an unresolved conflict between trusting vs ensuring the annotation clyybber: Yeah clyybber: With better code you mean doing try: finally: without checking for exceptions? Araq: yes clyybber: sfAlwaysReturn is the same as "sfCantRaise" right? Araq: right timotheecour: isnt’ `sfAlwaysReturn` a misnomer, eg for `quit` which really can’t return (calls C exit!) => shouldn’t that be called sfCantRaise ? clyybber: Since quit terminates the whole program it doesn't matter Araq: it's a good point though timotheecour: it also reads better clyybber: But I also kinda prefer sfCantRaise Araq: problem is that 'raise' is ambiguous but ok Araq: sfNoRaiseNoPanic clyybber: Araq: But when we don't have catchable panics enabled then sfNoRaise will also get applied to those, won't it? clyybber: to those procs who can panic clyybber: If that is so, then I think sfNoRaise is a better name timotheecour: right clyybber: timotheecour: Made a PR; https://github.com/nim-lang/Nim/pull/13637 disbot: ➥ Change order of forwarded koch boot command line options Araq: does anybody have rayman22201's async snippets ready? clyybber: rayman22201: ping clyybber: Araq: Btw, is `except:` now equivalent to `except: CatchableError` or still to `except: Exception`? clyybber: s/CatchableError/WhateverIsTheSuperclassForNonDefects Araq: still not 'except CatchableError' clyybber: ok timotheecour: that’s this: https://github.com/nim-lang/RFCs/issues/89 disbot: ➥ `except:` should map to the more conservative`except CatchableError:` instead of `except Exception:` ; snippet at 12https://play.nim-lang.org/#ix=2e20 clyybber: Yeah clyybber: Araq: Whoo, your branch is getting green \o/ Araq: hardly, travis only checks for the docs these days Araq: CI is stuck, yay djazz: if i want to have a proc that returns a DateTime or nil, is it possible? I don't want to return unix time 0 Araq: Option[DateTime] djazz: hmm, not very pretty clyybber: what? djazz: template/generic instantiation of `some` from here djazz: options.nim(117, 5) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. Araq: yeah, known issue Araq: kinda hard to fix though djazz: alright... djazz: when should I use DateTime and when should I use Time? To handle a http Last-Modified timestamp Araq: timestamps are better with a date djazz: there is a toTime function, but no toDateTime? djazz: and toUnix only works on Time djazz: hmm lqdev[m]: leorize: apart from the usual nimsuggest crashes, experience was much better PMunch: Just use Time djazz PMunch: And why do you think Option[Time] isn't pretty? PMunch: That is exactly what you're trying to express djazz: having to use import options in user code, isNone/isSome and get() clyybber: djazz: If you really want to avoid options you can use ptr DateTime PMunch: djazz, use the optionsutils module PMunch: Some examples of what it can do with options: https://play.nim-lang.org/#ix=2e2w PMunch: Updated with another example of the existensial operator: https://play.nim-lang.org/#ix=2e2x kaushalmodi: PMunch: Looking at https://nimble.directory/docs/optionsutils/optionsutils.html kaushalmodi: minor note.. do you want to add a link in there that links to your GitHub repo and then also add a one liner installation instruction? PMunch: Is that really neccessary? Installation instructions is the same as every other package `nimble install optionsutils` and the GitHub repo is named the same, and linked to from nimble.directory.. kaushalmodi: I needed to google "optionutils nim" to get a link to your repo.. the docs don't link to it kaushalmodi: I was curious to see what you had in README on its repo PMunch: If you hit "Doc files for optionsutils" and then "Project website" you'll be linked to the repo PMunch: The README in the repo is really bare-bones.. djazz: hmm, the docs are autogenerated? no source links like nim's doscs? kaushalmodi: djazz: those docs seem to be generated using nimble.directory kaushalmodi: I believe generating source links needs an extra option in the nim doc command flywind: you can generate docs links with github account flywind: # docs PMunch: Yeah, it requires a URL to add the path segments to. flywind: task docs, "Generate docs": flywind: flywind: exec "nim doc2 " & flywind: "--git.commit:master " & flywind: "--index:on " & flywind: "--git.devel:master " & flywind: "--git.url:https://github.com/yourgithub/example " & flywind: "-o:docs/example.html " & flywind: "src/xlsx/example.nim" PMunch: flywind, please don't paste code into Discord.. PMunch: federico3, could this be added to the directory? kaushalmodi: PMunch: Another minor note .. your README links to https://nimble.directory/docs/optionsutils//optionsutils.html (see that extra slash) disruptek: !last livcd PMunch: Oh, that's right disbot: livcd never seen. disruptek: livcd: you okay, buddy? alexander92: !last disruptek disbot: disruptek spoke in 12#nim 4 minutes ago alexander92: wow is that an irc thing PMunch: !last PMunch disbot: PMunch spoke in 12#nim 4 minutes ago alexander92: ok not , its disbot alexander92: !last disbot disbot: disbot joined 12#nimsec 47 minutes ago and last spoke 733 hours ago PMunch: Haha, still not 100% alexander92: oh man whats this channel disruptek: disbot will never monitor disbot. alexander92: !last alexander92 disbot: alexander92 left 12#nimsec 27 seconds ago and last spoke 730 seconds ago disruptek: livcd was quarantined. disruptek: !last rika disbot: Rika spoke in 12#nim 2 hours ago alexander92: !last disbot: Try `!last SomeHandle`". disruptek: just checking on my fam. 😘 PMunch: Hmm, how do I pass two trees of NimNodes, one by a variable, and one as a block to a macro? kaushalmodi: !last kaushalmodi disbot: kaushalmodi spoke in 12#nim 30 minutes ago kaushalmodi: doesn't look right disruptek: how do you figure? kaushalmodi: the reported times are all 7xx disruptek: get a real irc client. 🤣 PMunch: Haha kaushalmodi: ah! that's that color encoding number? disruptek: yep. kaushalmodi: may be not encode numbers? kaushalmodi: :) disruptek: this isn't the web. kaushalmodi: I literally see " 9kaushalmodi spoke in #nim 730 minutes ago" disruptek: i don't support "progressive enhancement". kaushalmodi: no worries, there are better Nim things to work on :) disruptek: it's a philosophical problem, since i had to write color support myself, obviously. PMunch: The gitter bot is really to blame IMO disruptek: a bridge should bridge such features. mratsim: Discord doesn’t display anything disruptek: if it cannot support it, the bridge should set its mode to strip color/style. PMunch: Hmm, how can I pass anything to the `op` parameter of `quote`? alexander92: can i alexander92: return a future which is like completed alexander92: like i just want to immitate something returns Future alexander92: but keeping it sync alexander92: nvm i just putted an await and another call in when else alexander92: dont discard your cbackend futures guys Rika: xd disruptek: you okay, rika? PMunch: Hmm, no one can answer either of my two previous questions? disruptek: i dunno anything about quote. i am off to find coffee. Rika: i've never figured out how to pass anything to op in quote kaushalmodi: PMunch: You can ping krux02 for quote/macro questions kaushalmodi: Also @Vindaar federico3: PMunch: what exactly? PMunch: "Source" links PMunch: Like the official docs have PMunch: Ugh, is there seriously no way to pass a NimNode tree to a macro? rohitpaulk: If I wanted to run `chroot`/`pivot_root` using Nim, how would I go about that? I checked the `posix` module and couldn't find any functions by those names.. disruptek: expose it use the same mechanisms you see there. disruptek: then submit a PR to posix with your changes. 😉 rohitpaulk: Thanks disruptex, will try! disruptek: sweet. Araq: PMunch: you can do that via getAst iirc disruptek: !last pmunch disbot: PMunch quit 710 minutes ago and last spoke 12 minutes ago clyybber: Araq: Can I merge #13637 ? The testfailure on freebsd is the flaky async test disbot: https://github.com/nim-lang/Nim/pull/13637 -- 3Change order of forwarded koch boot command line options clyybber: Araq: Hmm, one way to try to debug the stuck CI would be to ssh into the CI, this is possible on sr.ht clyybber: which is the one that didn't cancel itself yet, but instead keeps running still rayman22201: Araq: pong. Just waking up. What do you need? Araq: rayman22201, your async snippets that replicate the closure setup rayman22201: ah. ok. await while I find it again :-P Araq: we have a new weapon Araq: I called it 'thinout' Araq: it could work with async without destroying deterministic destruction rayman22201: sounds like a fad diet lol. clyybber: It makes you less cyclic clyybber: so it fits kaushalmodi: I am debugging a crash that happens when the systemverilog simulator is calling an exported proc in Nim compiled .so.. I have built the .so with --debugger:native, but still I don't see a proper stacktrace. All I see is: http://ix.io/2e3e/text kaushalmodi: Is there a way for me to see those "don't know"s? kaushalmodi: In that stacktrace, libprj_64.so is what I have built using Nim leorize: well don't strip the .so :P dumjyl: PMunch: custom quote ops work, it is just a doc bug. op is the first parameter. kaushalmodi: leorize: I am not.. kaushalmodi: hmm, I just check the nim command my makefile generates: `nim cpp --out:libprj.so --app:lib --nimcache:./.nimcache -d:release --styleCheck:off --hint[Processing]:off --opt:none --debugger:native --gcc.options.debug="-O0 -g3 -ggdb3" --gc:none libprj.nim` kaushalmodi: may be the -d:release supercedes --debugger:native? kaushalmodi: leorize: Do you think there's anything else wrong in the command that can strip off the symbols? disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek rayman22201: I can't find the original snippet :-/ I have the version that uses my "Disposable Future" fork... rayman22201: this is what I get for not making a gist rayman22201: I reconstructed this version, which is bare bones, but it has the segv when reading the closure: https://play.nim-lang.org/#ix=2e3m rayman22201: @disruptek, would happen to have any version of the async minimal repo we were working on? disruptek: i was using the test from nim i think. disruptek: do you know a date that i could search for? rayman22201: I thought I convinced you to switch to my garbage :-P rayman22201: January 18 - 20 approx. ? Vindaar: @kaushalmodi ah sorry, didn't see the ping, cause my gitter tab was dead :) disruptek: rayman22201: http://ix.io/27RJ/nim rayman22201: close but no cigar. I want the one with the async macro already expanded. kaushalmodi: @Vindaar No worries, that ping was for PMunch, but looks like he figured out the macro issue Vindaar: :) disruptek: rayman22201: http://ix.io/2e3o/nim leorize[m]: @kaushalmodi: maybe try to add `-f` and `--listCmds` to the compiler flags to see how gcc was called? kaushalmodi: leorize: you mean add those to the nim cmd.. trying it out kaushalmodi: hmm.. ⏎ ⏎ > g++ -c -w -w -fpermissive -DDPI_COMPATIBILITY_VERSION_1800v2012 -g3 -Og -fPIC -I/prjroot/tools/apps/nim/1.0.2/lib -I/prjroot/dv/scripts/nim/libdpi -o /prjroot/dv/scripts/nim/libdpi/.nimcache/stdlib_strformat.nim.cpp.o /prjroot/dv/scripts/nim/libdpi/.nimcache/stdlib_strformat.nim.cpp kaushalmodi: gcc.options. apparently don't work for g++ ? rayman22201: disruptek: That looks close. let me check it rayman22201: yup. Thanks @disruptek. Here it is cleaned up (got rid of all the comments): http://ix.io/2e3p/nim rayman22201: @araq ^ kaushalmodi: leorize: huh.. it should `--gcc.cpp.options.debug="-O0 -g3 -ggdb3"` for g++ kaushalmodi: thanks for that listCmd hint kaushalmodi: leorize: now I get `g++ -c -w -w -fpermissive -DDPI_COMPATIBILITY_VERSION_1800v2012 -O0 -g3 -ggdb3 -fPIC ..` kaushalmodi: just that something is adding `-w` twice Araq: rayman22201, can I get that without the line numbers somehow? kaushalmodi: leorize: btw still no luck even with -O0 pass to g++.. stack trace still has "don't know" rayman22201: Araq remove /Nim from the url rayman22201: http://ix.io/2e3p Araq: rayman22201, so what's the state of your work? Araq: how to apply 'dispose'? rayman22201: Does that mean 'thinout' is not working? rayman22201: We added .cursor annotations and the closureRef pointer to the Future. It leaked less, but still leaks. Araq: yeah and now I know why Araq: .cursor doesn't break up the correct cycle Araq: rayman22201, I dunno yet if thinout works, I'm unfornately fighting with the CIs disruptek: you're missing the dancing on stream. disruptek: Araq: your side-effects in this codegen are killing me. clyybber: What sideeffects? clyybber: Oh, you mean in the backends? disruptek: yeah. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: a simple proc defines nimFrame which means that later procs that load that proc from cache necessarily define it, too. disruptek: should i just rewrite this? Araq: yeah nimFrame is buggy thelarry: Hi! thelarry: in the tutorial part II, what das the thelarry: method collide(a, b: Thing) {.inline.} = quit "to override!" thelarry: what does the {.inline.} o? thelarry: do? thelarry: does it make the compiler inline the method? so the inlining by compiler optimization? axion: it's an annotation that the compiler backend is free to make use of to inline the function directly at the call site rather than the overhead of a call. it's just an annotation and may be ignored by the backend though thelarry: ok thanks! mratsim: in practice, I never met a case where nim {.inline.} was not respected by the C compiler mratsim: also @narimiran, tut2 might have to be revisited if there is a collide example since we are removing multimethods Araq: https://github.com/nim-lang/Nim/pull/13626 disbot: ➥ catchable defects disruptek: !last clyybber disbot: clyybber quit 725 minutes ago and last spoke 85 minutes ago disruptek: anyone else know how to ssh into sourcehut? kaushalmodi: Araq: In layman terms, does catchable defects now fail on bound checks even with -d:release? Varriount: kaushalmodi: Yes kaushalmodi: yay! Varriount: kaushalmodi: currently the default is that defects (IndexError, etc) can be caught. This has been the case. kaushalmodi: I vaguely remember that indexerror etc caused crash when run with -d:release Varriount: The "new" feature is introducing panics, where such errors cannot be caught and cause the program to abort kaushalmodi: I am hoping that panics:on will make this happen a bit more gracefully Varriount: Release mode used to turn bounds checks off. I don't believe this is the case anymore kaushalmodi: Ah ok.. I missed reading about that update then Varriount: Obviously if bounds checks are turned off, panicking on bounds checks can't occur kaushalmodi: I can correlate the panic mode with "fatal" category of error in systemverilog kaushalmodi: "errors" throw.. errors, but "fatals" end the program right then and there alexander92: mratsim again, i am reading a comment on HN and i think alexander92: it sounds like mamy .. and of course its you alexander92: very easy to recognize :P alexander92: so now btw what about catching some cases of index errors on compile time, e.g. letting one use [i] only after checks for length / as part of a for loop / range Araq: that's a job for the Z3 integration exelotl: hey I was asked to build the compiler with --stacktrace:on exelotl: how would I go about doing that? disruptek: --stacktrace:on disruptek: ./koch boot --stacktrace:on -d:release disruptek: i don't think -d:release will impinge upon stacktraces. exelotl: ah ok thanks, I wasn't sure of koch boot was the appropriate thing exelotl: *if Recruit_main70007: how did you generate documentation of your code? Elegant Beef: nim has a html gen for docs Elegant Beef: nim html ./module Recruit_main70007: cool, im gonna try leorize[m]: it's nim doc leorize[m]: not nim html Elegant Beef: ah mb Recruit_main70007: hmm, it would be nice if it showed the body of functions but its very cool rayman22201: @disruptek found a video that does a good job of explaining the async model I want to steal from Rust: https://youtu.be/NNwK5ZPAJCk?t=1324 disruptek: that's not so different from what we have. shashlick: arnetheduck: you here? rayman22201: watch until around 25:41, he describes the state machine rayman22201: we don't do that rayman22201: we do the naive thing, aka make closures everywhere shashlick: i'm testing `nim cpp` and importing a proc from a c file disruptek: what do you think our closures are? shashlick: it doesn't work if I just do `{.importc.}` but works if I include `{.header.}` as well shashlick: the proc is missing at link time disruptek: shashlick: i'm getting that nimterop bug in golden now. :-/ rayman22201: obviously they are equivalent. Rust, computes the states at compile time, so the allocation and ownership is all known up front. rayman22201: as opposed to our closures which is dynamic and full of cycles disruptek: i think you should build a new async on arc. disruptek: nothing else is really worth pursuit. rayman22201: yeah. I agree federico3: recommended postgresql library? Araq: shashlick, you need the compiler to produce 'extern "C" ' Araq: federico3, the stdlib's one is ok but sync federico3: oh there's one in stdlib? TIL shashlick: Araq: so if header is specified, it does it automatically? federico3: thanks Araq sekao: is there a programmatic way to get the install path of a nimble library? i want to make a library that loads a prebuilt dynamic lib (.dll, .so, etc) which is installed with it, but to load it the library must know its own install path disruptek: `nimble path` disruptek: but, running nimble from within nimble is a terrible idea. sekao: yeah i was thinking of shelling out with that command but that seems icky disruptek: it's a constant source of irritation with nimterop, unfortunately. sekao: maybe i could just copy whatever code nimble uses to execute that command? i'm guessing it just reads the json config file to find the current install version, and then builds the path disruptek: lol shashlick: sekao: you can use currentSourcePath.parentDir() / .. / xyz sekao: nice i havent come across that, ill check it out Araq: shashlick, no, what really happens is that .header uses the header and the header seems to have extern "C" shashlick: well, actually the header was a test.hpp and it didn't have the extern "C" shashlick: but it worked if you did {.header.} shashlick: i added that extern "C" and it started working shashlick: i'm basically working on https://github.com/nimterop/nimterop/issues/169 for arnetheduck disbot: ➥ Skip `{.header.}` generation shashlick: no matter how much time I spend on c wrappers, I feel like a noob disruptek: you look like adonis, though. disruptek: so, there's that. Araq: disruptek, still streaming? disruptek: yeah. disruptek: y'know, i couldn't make peek work. disruptek: i told you. 😉 disruptek: !repo disruptek/asyncproc disbot: https://github.com/disruptek/asyncproc -- 9asyncproc: 11an async process monitor 15 0⭐ 0🍴 Araq: what do you mean "I couldn't get it to work"? disruptek: it blocks or excepts. Araq: all you had to do is to add an integer counter disruptek: to count exceptions? Araq: never mind, I think I misread the code disruptek: you're going to waste a core spinning? disruptek: i mean, we /can/ do that... Varriount: Hm, sometimes I wish we could do a big reorganization of the standard library Varriount: Put all the system-binding modules (like Windows) under a dedicated folder. Kiloneie: https://youtu.be/vfWxJH8Futo Kiloneie: Kiloneie: I have been using a noise gate since probably #1 video and it hasn't been a problem... in #19 it cut off slightly at very few places but in this video it's a bit much, i did my best when editing to make it clearer... D: disruptek: Araq: it's an infinite loop in the compiler that we have to catch, anyway, right? Varriount: @Kiloneie nice work! Kiloneie: Thank you Araq: disruptek, right Araq: Varriount: instead of the current way were we have both windows AND posix? Varriount: Araq: No, just, more organization. Varriount: Instead of lib/windows and lib/posix, do lib/platform/windows and lib/platform/posix Varriount: Currently there's platform specific modules for genode, nintendoswitch, windows, posix, and js Varriount: (although, I guess it might be possible to use js with the other modules if the nim program is running on node) Varriount: I know that you dislike nesting folders, but I find it helps discoverability (in addition to the standard library documentation) Varriount: Plus, if we wanted to, we could leverage Github's ability to display README files, and put a readme in each directory, describing the modules there. disruptek: c'mon the stream and explain this madness. clyybber: me? disruptek: and varriount clyybber: disbot you are broken clyybber: !last clyybber disbot: clyybber spoke in 12#nim 33 seconds ago clyybber: disruptek: can't talk here, what madness is it? disruptek: something about paths. disruptek: nesting folders? disruptek: what does the path do for us? clyybber: aight, imma head out disruptek: it sounds like you want docs in README.md instead of index.html. disruptek: aight. clyybber: disruptek: Are you working on md docs? disruptek: no. disruptek: i'm responding to varriount. clyybber: I can't discern the stream disruptek: oh, this is testament. disruptek: trying to work around possible compiler infinite loops. disruptek: and those of tests, i guess. clyybber: testament works around compiler infinite loops? disruptek: yeah, like the one that locked up the whole evening today. disruptek: ie. CI clyybber: wheres the workaround clyybber: ? disruptek: !repo disruptek/asyncproc disbot: https://github.com/disruptek/asyncproc -- 9asyncproc: 11an async process monitor 15 0⭐ 0🍴 clyybber: I think I'm in the wrong movie disruptek: i think this doesn't work. disruptek: not sure when it could have broken, though. clyybber: show me those testament workarounds disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: i'm not going to upload them. clyybber: oh, so they aren't actually in testament yet disruptek: not yet. clyybber: thats what I wanted to know disruptek: i'm trying to make them work. clyybber: k Elegant Beef: How would i fetch the stdout of a process without freezing because no EOF? disruptek: beef: i have an example in golden; see the invocation file. disruptek: !repo golden disbot: https://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim 🏆 15 16⭐ 0🍴 disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: bot features for Z3vv DeathPoison: ährm, could anyone give me a hint how to solve my error? ⏎ ⏎ i've wrote some code without -d:release, all worked fine, ⏎ but later i turned this swtich on and got the following error in runtime: ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e683ccc80cc7b7924b80f23] DeathPoison: does it mean that i try to request the repo attribute without knowing that it have the correct type? disruptek: ~paste disbot: paste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead. -- disruptek disruptek: yes, it does. disruptek: it has the wrong variant. DeathPoison: but it does not... ⏎ https://play.nim-lang.org/#ix=2dVt DeathPoison: if have a case of around it checking the kind DeathPoison: the debug line above the critical line showing correct data disruptek: entry.repo.gitPull ... DeathPoison: badly not, GitRepo is the type oof the gitapi lib; GitRepository is mine, where the path comes from DeathPoison: little bit confusing sry disruptek: can i see the types? disruptek: de-indent LBEntry, for one thing. the case within, i mean. disruptek: looks okay otherwise. disruptek: you don't need a trailing else if your case is exhaustive. disruptek: (ie. it's best not to have it) DeathPoison: i have added the else just because i've deleted the lbetDirectory case DeathPoison: deindent the case? disruptek: yes. DeathPoison: i try DeathPoison: you mean the whitespace, right? disruptek: i do. DeathPoison: so the case should be in line with types name? disruptek: no, but use a consistent indent of either 2 (ideally) or 4 spaces. disruptek: not 2, 4, 5, or 3. disruptek: just pick one. DeathPoison: ive using 2; the copied from gitapi uses 4... disruptek: which gitapi? DeathPoison: thats not really what i want to discuss here :P DeathPoison: sry, no offense, thanks for helping me disruptek: maybe not, but it's hard to debug code that might be broken because of whitespace in a whitespace-sensitive language. DeathPoison: https://nimble.directory/pkg/gitapi disruptek: so do us a favor and try to write working nim. DeathPoison: sry, the whitespace thing, yeah you are right, but my problem is not, that the code does not compile ⏎ ⏎ i have a problem at runtime, so the code is formerly valid i think disruptek: what do you think the problem is? Elegant Beef: Yea disruptek that's not working for me it just locks my system cause the second process is still running disruptek: second process? DeathPoison: iam not sure, that what i try to figure out Elegant Beef: The stdout question disruptek: did you use my code? Elegant Beef: yes the while not at read a char disruptek: the what? Elegant Beef: not at end* Elegant Beef: you do mean drainStreamInto right? disruptek: you probably need /all/ the machinery in there. disruptek: not just one proc. disruptek: it's more complex than that. disruptek: deathpoison: i just cannot help without seeing more code. disruptek: i don't see a problem here. disruptek: can you reduce it to a minimal example that doesn't work? xflywind: Hello, I want to install `nimph`,but I can't install `nimterop` in Nim version 1.0x in Ubuntu. ⏎ ⏎ nimble install nimterop -y ⏎ ⏎ Get error: ... [https://gitter.im/nim-lang/Nim?at=5e6841eea2ccef3232e63929] disruptek: !repo gittyup disbot: https://github.com/disruptek/gittyup -- 9gittyup: 11higher-level git bindings that build upon nimgit2 15 1⭐ 0🍴 disruptek: !repo github shashlick: Can you remove the nimterop directory in cache and try again disbot: https://github.com/disruptek/github -- 9github: 11github api v3 for nim 15 6⭐ 0🍴 7& 29 more... shashlick: And share a paste of the full error DeathPoison: sadly that was the full error message ⏎ ⏎ sysfatal.nim:39 ⏎ Error: unhandled exception: 'repo' is not accessible using discriminant 'kind' of type 'LBEntry' [FieldError] [https://gitter.im/nim-lang/Nim?at=5e684290ff8bf14a544b4ffd] DeathPoison: but i try another tomorrow, and try to encapsulate the whole thing disruptek: it's probably an error in the api. disruptek: without seeing more of the stacktrace, i really cannot tell. disruptek: i can't even tell if it's an error pointing at your code; ya feel me? DeathPoison: sure but the whole output is this: ⏎ ⏎ DEBUG Checking for project: test ⏎ DEBUG located at: /home/poisonweed/git/test ⏎ DEBUG aready exists: /home/poisonweed/git/test ... [https://gitter.im/nim-lang/Nim?at=5e68432d8e423969577ed086] DeathPoison: so the is sadly no stack trace available DeathPoison: but yeah i feel you :P DeathPoison: i already fixed some other issues with this library, probably another will do it, if not i will try my best to encapsulate all this stuff DeathPoison: gn8 folks, its enough ;) disruptek: aight, good luck. DeathPoison: in worst case, a execCmd will do the trick anyway :D DeathPoison: but feels bad not getting around this error xflywind: Now, It stucks here.But it maybe owe to my internet[for me it's slow to pull repo from github]. ⏎ Installing [email protected] ⏎ Building nimterop/nimterop/toast using c backend leorize: probably it's just slow disruptek: if it's nimph, it's probably downloading and building libgit. maybe. leorize: if it's stuck at building toast, then it's not there yet :P disruptek: true. disruptek: github seems dead. disruptek: maybe it's just slow. xflywind: If I use ctrl+c to exit.Next I will fail to install nimterop at once because of cache. ⏎ Build failed for '[email protected]', would you like to try installing '[email protected]#head' (latest unstable)? [y/N] shashlick: Ya just wait it out alaviss: test leorize: the gitter official irc bridge doesn't seem to support edits :P xflywind: Thanks.Now I have installed nimterop successfully. @shashlick Elegant Beef: When you commit using your terminal and push the changes using it Elegant Beef: I still have to parse so many ansicodes Elegant Beef: Probably have to remake the drawing/parsing for a third time disruptek: testes disruptek: a feature for zevv: disruptek: !last disruptek disbot: disruptek did something unexpected in 12#nim 9 seconds ago and last spoke 79 seconds ago disruptek: !last beef disbot: beef never seen. disruptek: i guess i won't be able to support people with spaces in their nicks unless... disruptek: !last elegant beef disbot: elegant beef never seen. Elegant Beef: !last "Elegant Beef" disbot: "Elegant Beef" never seen. Elegant Beef: 😄 disruptek: !last elegant beef disbot: Elegant Beef did something unexpected in 12#nim 19 seconds ago and last spoke 719 seconds ago disruptek: nice try, sport. Elegant Beef: no you leorize: !last leorize disbot: leorize never seen. leorize: !last leorize disbot: leorize spoke in 12#nim 5 seconds ago and last spoke 75 seconds ago disruptek: for some reason, the datetimes are unequal. disruptek: although i copy the first to the second. disruptek: !last leorize disbot: leorize spoke in 12#nim 76 seconds ago disruptek: fixed. disruptek: !last leorize disbot: leorize spoke in 12#nim 2 minutes ago leorize: !last disruptek disbot: disruptek spoke in 12#nim 9 seconds ago disruptek: someone needs to leave and come back in. disruptek: !last disruptek disbot: disruptek spoke in 12#nim 5 seconds ago disruptek: !last okcy disbot: okcy never seen. disruptek: !last axion disbot: axion never seen. disruptek: take 3. axion: !seen axion disbot: axion never seen. leorize: !help leorize: disruptek: are you streaming? disruptek: yeah? disruptek: !last axion disbot: axion spoke in 12#nim 45 seconds ago disruptek: !axion disruptek: !last axion disbot: axion spoke in 12#nim 2 minutes ago disruptek: !last thomasross disbot: thomasross quit from 12 115 seconds ago Elegant Beef: disruptek spammed the bot 1 second ago disruptek: !last leorize disbot: leorize joined 12#nim 42 seconds ago and last spoke 749 seconds ago axion: !seen axion disbot: axion joined 12#nim 4 seconds ago and last spoke 75 seconds ago axion: !seen axion disbot: axion joined 12#nim 4 seconds ago and last spoke 773 seconds ago disruptek: !last leorize disbot: leorize never seen. disruptek: !last axion disbot: axion spoke in 12#nim 90 seconds ago disruptek: !last krux02 disbot: krux02 quit 79 minutes ago disruptek: maybe it should mangle the username if they are on irc, so they don't get pinged. shashlick: why not shashlick: gets tagged in the command anyway disruptek: oh, good point. disruptek: people can query the bot privately to avoid a ping. Rika: Is this the classic testing in production I see axion: Does Nim have anything like CL keywords? Self-referential symbols to use instead of strings, for example to dispatch on within a case statement Rika: what do you mean axion: I mean exactly self-referential symbols/identifiers that can be resolved at runtime. Not sure how I should describe it in terms of Nim. Zevv: !last disruptek disbot: disruptek never seen. Zevv: ha leorize: axion: if you can write some mock nim code to describe it then that'd be great rmt: Something like Ruby's :symbols, I imagine? rmt: I imagine that Enums are a typical approach,.. probably better than open-ended non-contextual symbols, anyway. axion: https://gist.github.com/mfiano/f04eb97e3e665f3b242206f30f3eacc5 axion: Enums are fine and all, but assume a finite set. axion: I guess a case statement was a bad example leorize: so basically you want a way to not have to write string quotes? axion: I realize now my question was pointless and Nim doesn't allow evaluation control of arbitrary expressions outside of meta-programming like Lisp does. axion: Well, yes, but not specific to strings. axion: Don't worry :) Mister_Magister: Hi people, i need to extract something (text) from website (curl tha html). Any tips/libs on how to do that? PMunch: https://nim-lang.org/docs/httpclient.html PMunch: That would be a good place to start Elegant Beef: use the http client to get, then use the xml tree or html parser libs Mister_Magister: i know that much :P i'm using it for http server PMunch PMunch: For a server? Mister_Magister: @Elegant Beef ye i'm more interested in those PMunch: There is this in the stdlib: https://nim-lang.org/docs/htmlparser.html Mister_Magister: PMunch: thanks Elegant Beef: funnily because of the source code the html parser doesnt work on this https://nim-lang.org/docs/theindex.html PMunch: This if you want a bit easier way of finding the node you're looking for: https://github.com/GULPF/nimquery Elegant Beef:

doesnt work with the parser PMunch: Hmm, well that's a shame.. Mister_Magister: and since we are at it, do you have some async tutorial? i'm awaiting everything and that's bad :( PMunch: Hmm, I was about to write one PMunch: But then life happened and I actually forgot about it until now.. PMunch: If you've got Nim in action I think there's some good info in there Mister_Magister: like i'm using telegram bot library and get requests as async, and i'm downloading video from message (async but await) and then running ffmpeg on it (again async but await) and then sending it back (again await) and i would like to do it totally async PMunch: Well, you need to do those things one after the other anyways Mister_Magister: otherwise i'm blocking other requests PMunch: So you need to await the results Mister_Magister: mhm PMunch: The benfit comes from handling multiple requests Mister_Magister: can i await without blocking other requests? Mister_Magister: >inb4 threads Mister_Magister: i'm not sure what is async for PMunch: Every time you `await` Nim will hand control over to something else (for example the thing you awaited, or the handler of new requests) Mister_Magister: PMunch: that doesn't happen tho or i broke something :< when i await getting requests is freezed Rika: i feel like youre getting the same issue as i am PMunch: Well if any of the tasks stay busy for a long time without allowing other tasks to run you will still block. Rika: though i cant easily explain the issue Mister_Magister: yeah… i don't get the idea of async at all Rika: well async works if you're waiting for stuff a lot Rika: aka an IO issue leorize: the idea of async is to dispatch the control flow to something else while your request is being fulfilled Rika: if you're PROCESSING a lot that probably needs threading PMunch: Async/await still only does one thing at a time, and it is what's called co-operative multitasking. So every time you await something that single thing you're doing can now be something else. The benefit comes when doing IO, which is when the OS does things for you. For example when reading a file or getting a network request you ask the OS to put something into memory for you. While you wait for it to do that you are free to do other things instead of just PMunch: sitting idly by waiting. Mister_Magister: leorize: well that doesn't happen :C Rika: ok so what libraries are you using exactly Mister_Magister: telebot Rika: is it async PMunch: It can also give the impression of multiple things happening at once since simply because you're switching back and forth between things quickly, think about how single processor machines could still run multiple programs "at the same time" leorize: !repo telebot disbot: https://github.com/ba0f3/telebot.nim -- 9telebot.nim: 11Async client for Telegram Bot API in pure Nim [Bot API 4.6] 15 61⭐ 7🍴 7& 1 more... Mister_Magister: hmm wait Mister_Magister: execShellCmd isn't async :C Rika: ah youre gonna want the one that returns immediately Mister_Magister: what do you mean? leorize: Mister_Magister: well that's your bottleneck :P Mister_Magister: leorize: ye i just realised leorize: I thought you're using asynctools leorize: !repo asynctools disbot: https://github.com/cheatfate/asynctools -- 9asynctools: 11Various asynchronous tools for Nim language 15 51⭐ 11🍴 Mister_Magister: no unfortunately leorize: which does have async processes :) leorize: so use it :P Rika: i was thinking of https://nim-lang.org/docs/osproc.html#startProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D but thats okay too Rika: wow, 11 cutleries PMunch: Haha, I'm guessing that's forks Mister_Magister: leorize: okay Mister_Magister: oh one more question, do you have any code style guides? I'm comming form oop and without oop i'm like child with toys, i make huge mess Rika: PMunch, it's a joke some of us make in reference to the original joke, which was a while back leorize: Mister_Magister: https://nim-lang.org/docs/nep1.html leorize: also give your data structures a lot of care PMunch: Oh, must've missed that joke :( PMunch: The NEP1 is more about syntactic style, not so much about writing code without objects PMunch: Anything in particular you feel is "messy"? Rika: nepu Mister_Magister: PMunch: long file without any structure really, wait here is my bot https://github.com/Michal-Szczepaniak/lenislaw/blob/master/bot.nim Mister_Magister: you will see right away leorize: well try this: leorize: if you wanna make a class, then split it to another module Mister_Magister: in oop i would split it into objects and files and shit Mister_Magister: leorize: another module aka new file? leorize: yep Mister_Magister: okay makes sense (what i wanted to do tbh) Mister_Magister: i like nim and it feels like it has potential for making small lightweight programs (fsck python :D) Mister_Magister: just gotta understand it more… PMunch: Yeah, I'd split all the DB stuff into it's own file. Then possibly the downloader procedures into one file PMunch: And I'd look into a template or something to do the handler, seems like a lot of repetition is going on there leorize: also... asynchttpserver is **not** threaded leorize: please don't spawn a thread for it Mister_Magister: PMunch: same Mister_Magister: leorize: what do you mean leorize: https://github.com/Michal-Szczepaniak/lenislaw/blob/master/bot.nim#L774-L777 leorize: that's pure evil :P Mister_Magister: also i have like downloadDocument downloadImage but the Document and Image objects are made from same base object and i was wondering if i could cast them into one function Mister_Magister: leorize: but it works! and i thought that if i run waitFor server.serve(Port(2137), cb) before bot.poll(timeout=300) the bot thing won't run leorize: it works for now Mister_Magister: leorize: i can't wait for both of them at the same time leorize: the idea of asyncdispatch is that you don't have to Mister_Magister: but the waitFor leorize: the poll() wait for the event leorize: then you can act on it Mister_Magister: what do you mean leorize: so here's a brief on how async works: leorize: you register your event handlers -> the async stuff you use register themselves with the dispatcher -> on poll() the dispatcher runs and activate the callbacks as events are received leorize: waitFor is: poll(), if not future.isFinished: do it again Mister_Magister: aaaaand? PMunch: Hmm @Elegant Beef, the htmlparser seems to work fine on theindex.html leorize: it's useful for just waiting for one Future in your partially async program leorize: when it's fully async-powered, you don't have to leorize: instead you use runForever() :) Mister_Magister: i don't follow… leorize: I'm not really the best at explaining things :P Mister_Magister: leorize: what i can't get is how to wait for both of them at the same time leorize: telebot api is weird... leorize: why does it have it's own poll() if it's integrated with asyncdispatch Mister_Magister: huh leorize: so let's make it simple leorize: async give you Futures leorize: if you want the stuff that's gonna be the Future to run, you call poll() leorize: waitFor is basically just polling until the Future is complete leorize: but in this case you don't really care Mister_Magister: aaaaand? PMunch: poll is a wrapper that calls `waitFor loop(b, timeout, offset, limit)` leorize: so what you do is that you capture the Future from asynchttpserver.serve() and telebot.pollAsync() PMunch: In telebot leorize: then you call runForever() leorize: which will run `poll()` forever leorize: so the you get both telebot and asynchttpserver to run since you got their Futures leorize: is that simple enough? :P Mister_Magister: b…but how do i do that PMunch: Yeah, so instead of the whole thread thing do `asyncCheck server.serve(Port(2137), cb)` and `asyncCheck bot.pollAsync(timeout = 300)` then instead of `thread.joinThread()` do `runForever()` leorize: ah yea, asyncCheck works too Mister_Magister: PMunch: whoa thanks PMunch: A little something like this: https://play.nim-lang.org/#ix=2dWd Mister_Magister: sadly there is no nice IDE for nim :C leorize: I'm not the best at explaining these things :P IIRC Zevv wrote something related to this, and might be able to give you a better ELI5 PMunch: leorize, yeah neither serve nor poll returns anything in their Futures. So just asyncCheck them to attach an exception handler callback to them :) PMunch: Mister_Magister, what do you mean, there are many nice IDEs for Nim :) Mister_Magister: leorize: you are great thank you for even trying to help me! Mister_Magister: PMunch: like? PMunch: Well I use Vim :P But I think most people use VSCode Mister_Magister: i dun like vscode cas m$ Mister_Magister: cause* Mister_Magister: :< Rika: then just use Code Zevv: ELI5? leorize: you gotta admit one thing: MS knows how to please developers :p Rika: the nonbranded version of vscode leorize: Zevv: explain like I'm 5 PMunch: Rika, wait, there's an unbranded version? PMunch: What's the difference? Zevv: haha Mister_Magister: @Rika what? link? leorize: Zevv: I tried to give Mister_Magister a brief on how async work, and it's not simple enough :P Mister_Magister: leorize: i get it i get it Zevv: oh I never made that writeup. I started it and stalled, and I think PMunch gave it another shot also PMunch: With nimlsp you can basically use Nim with any editor that supports LSP, but you might want to find a plug-in that does syntax highlighting if the editor doesn't have that by default PMunch: Zevv, yeah I have a series of articles on multi-tasking in Nim in the pipeline PMunch: But someone needs a bit more fiber in their diet, 'cause the whole line is clogged! leorize: PMunch: well if you insist on not using nimsuggest directly, my nim.nvim does provide barebones indent & syntax highlighting leorize: just need a quick tweak to disable the nimsuggest integration PMunch: My projects unfortunately tend to be in a FILO queue.. Mister_Magister: ye so there is no nice IDE :C leorize: Mister_Magister: well if you know your way with neovim you can use my nim.nvim leorize: !repo nim.nvim disbot: https://github.com/baabelfish/nvim-nim -- 9nvim-nim: 11Vim support for nim. 15 53⭐ 17🍴 7& 3 more... leorize: !repo alaviss/nim.nvim disbot: https://github.com/alaviss/nim.nvim -- 9nim.nvim: 11Nim plugin for NeoVim 15 69⭐ 9🍴 PMunch: Hmm, I should really check out neovim.. Mister_Magister: leorize: i know vim only unfortunately leorize: neovim is vim with extra features leorize: if you know vim you know neovim PMunch: I should also check out kakoune again Rika: i cant remember where the thing is Rika: give me a few minutes PMunch: @Rika, was it this thing? https://vscodium.com Rika: no Rika: it was Code - OSS Rika: but it seems like it just redirects to the vscode repo now Varriount: Isn't VSCode open source? PMunch: https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code Rika: yup that PMunch: Aha, so VSCode the repository is Code without any MS stuff. Then when they go to build "Visual Studio Code" they add in their MS specific stuff. PMunch: So VSCodium is just a pre-built version of the VSCode repo without the addition of the MS stuff Rika: yeah probably an internal repo Rika: no i think vscodium is even more stripped out Rika: probably stuff like telemetry or something Elegant Beef: yea Rika: though i dont know why they'd leave that in the repo Elegant Beef: vscodium is the telemetry free version of vscode PMunch: "The VSCodium project exists so that you don’t have to download+build from source. This project includes special build scripts that clone Microsoft’s vscode repo, run the build commands, and upload the resulting binaries for you to GitHub releases. These binaries are licensed under the MIT license. Telemetry is disabled." leorize: PMunch: you might like this feature in nim.nvim: https://asciinema.org/a/RXbwCTJXGRKEhMRiHIUEoDGd7 PMunch: From the VSCodium site PMunch: leorize, which feature? Rika: indent stuff PMunch: That should at least three or four :P leorize: well the "smart" indent :P Rika: ~~slow typing i see~~ PMunch: Ah, that could be nice. But I find that "smart" indent often gets in the way unless it's done really well Rika: i should continue practicing actual touch typing should i lmao Rika: because i use hybrid lmao leorize: PMunch: it's done well :) Elegant Beef: My left hand touch types but i use mostly my index and ring finger on my right Mister_Magister: PMunch: if i make second file should i import or include it PMunch: Want a type-off? https://typing-speed-test.aoeu.eu/?lang=en Rika: oh no Rika: i can only do like 60 PMunch: Mister_Magister, import Rika: i aint a quick typer PMunch: And mark things you want to export to other modules with * Mister_Magister: so * the shit out of every function… got it PMunch: Haha, I mean you can include as well. But normally you'd do import and * Rika: Mister_Magister, it depends on what the file's gonna be imported/included for Varriount: @Rika I can type sentences quickly... But I still have to glance at the keyboard for numbers and special symbols Rika: oh i glance to reposition myself but after that i'm good leorize: PMunch: I only get 71 wpm on my crappy laptop keyboard :P Elegant Beef: i use the homing to reposition and average 70-80wpms PMunch: Rika, leorize, slow morning: Your score: 413 CPM (that is 83 WPM) PMunch: 0 mistakes ofc Elegant Beef: im pretty much fucked without home row nibs 😄 PMunch: Elegant Beef, I'd like to have a Dvorak keyboard with the nibs. Never really got used to typing with them and I wonder how much of a difference it would make for me leorize: gah I should get on a table :P Rika: i did 280 on a weird typing angle Elegant Beef: Soo anyone wanna explain the basis of reading from a stdout of process started in code? Rika: 4 mistakes because my type of typing is prone to mistakes Elegant Beef: Disruptek did suggest looking at his library, but i just wanna know the premise of what i should be doing PMunch: Mine would be where you have C and U, not the most optimal position for those.. Rika: i hone my left to wasd and i dont actually know where my right hand hones to Rika: home Rika: wrong word PMunch: @Elegant Beef, well what do you want to know? PMunch: You start a Process with startProcess, then you read from the outputStream by using anything in the streams module. leorize: ok I give up: 370 CPM (that is 74 WPM) Elegant Beef: Yes but since EOF isnt reached it freezes Elegant Beef: I just got 417cpm or 83wpm PMunch: Just be sure to actually read output if it has any, otherwise I think it might fill up a buffer and stall the process on a write. leorize: zero mistakes Elegant Beef: Yea it's stalling my program as is PMunch: What kind of read are you trying to do? PMunch: And what kind of process are you reading from+ Elegant Beef: reading from a ncurses based cli application Elegant Beef: Probably doing something wrong for my terminal 😄 Mister_Magister: guys i want to return this from a function but i'm failiing to do so :C https://nim-lang.org/docs/db_sqlite.html#fastRows.i%2CDbConn%2CSqlQuery%2Cvarargs%5Bstring%2C%5D PMunch: Hmm, yeah that might be hard to consume.. leorize: Mister_Magister: return what? leorize: the Row or? leorize: the list of Row? Elegant Beef: I tried multiple methods of reading and they tend to freeze it Elegant Beef: Been testing with cmus Mister_Magister: leorize: like put it inside function and then use function in for x in function instead of calling it directly leorize: you'd want an iterator leorize: not a function :p Mister_Magister: ye funciton returning iterator Mister_Magister: or am i mistaking something leorize: how are you expecting to call it? PMunch: Hmm, "Your score: 448 CPM (that is 90 WPM)", but that was with 2 mistakes.. leorize: let iter = function(); for x in iter: Mister_Magister: oh okay leorize: or for x in function()? leorize: if the second, then you'd want to make an iterator PMunch: For the first you'd need a closure iterator Elegant Beef: But yea i've tried using the stream.atEnd with a readLine, but that locks up cause it continues expanding the output i imagine Mister_Magister: leorize: PMunch: i'm confused now PMunch: atEnd checks for EOF or stream.close I think Mister_Magister: can't i just return iterator that fastRows returns? PMunch: Sure PMunch: Should work Mister_Magister: but how alexande192: heyy okcc_: i want to catch SIGTERM in order to do clean stuffs before terminating, but i got some errors with the following code alexande192: guyss alexande192: morning PMunch: Morning alexande192 :) okcc_: hey okcc_: import posix okcc_: proc closeDisplay() = okcc_: echo "sig detected" okcc_: when isMainModule: okcc_: signal(SIGINT, closeDisplay) PMunch: Please don't paste code into IRC.. leorize: Mister_Magister: it's better if you tell us your use case... okcc_: Sorry Mister_Magister: PMunch: i made proc function*(): iterator = and assigned fastRows to result okcc_: i'll not do that PMunch: Oh, fastRows is an iterator leorize: okcc_: https://nim-lang.org/docs/posix.html#onSignal.t%2Cvarargs%5Bcint%5D%2Cuntyped PMunch: Then you'd probably need to wrap that in a closure iterator to return it Mister_Magister: o…oh… PMunch: I don't really have a DB to try with.. leorize: PMunch: since Mister_Magister is not fluent with Nim, I don't think we should recommend that until we know the actual use case Mister_Magister: i don't really follow okcc_: leorize, thanks, so the signal function is not meant to be used by users? leorize: okcc_: you can use it, it's just not *that* simple leorize: Mister_Magister: well how are you gonna use this function? leorize: like an use case for it? okcc_: it needs a Sighandler at position 2, meanwhile the Sighandler is not exported in posix Mister_Magister: leorize: i want to get all rows from database and then use/display them all okcc_: anyway, thank you Mister_Magister: leorize: i wanna move getting rows from here to separate file https://github.com/Michal-Szczepaniak/lenislaw/blob/master/bot.nim#L648 leorize: okcc_: that's probably a bug Mister_Magister: should explain leorize: you should file it on the issue tracker PMunch: Mister_Magister, returning iterators: https://play.nim-lang.org/#ix=2dWh Mister_Magister: leorize: cause if i'm moving db to db module then i wanna move everything db related there okcc_: leorize: maybe, lol leorize: Mister_Magister: so you want something like: for cmd in db.articles()? Mister_Magister: leorize: yes kinda Araq: will stream soon Mister_Magister: instead of for cmd in db.fastRows(sql… Araq: topic: improvements for "goto based" exception handling alexande192: o.O strange my nick leorize[m]: Mister_Magister: https://play.nim-lang.org/#ix=2dWi alexande192: not sure what happened PMuch PMunch: Mister_Magister, then you can just write your own iterator around fastRows: https://play.nim-lang.org/#ix=2dWj Mister_Magister: leorize[m]: oh thank you! PMunch: Haha, yeah, that Mister_Magister: PMunch: thanks but leorize[m] has cleaner solution :) PMunch: Haha, it's the same solution :P Mister_Magister: except it doesn't compile :P Mister_Magister: neither of those solutions PMunch: Unless you're referring to my first one where I return a closure iterator Mister_Magister: PMunch: yeah PMunch: Mine compiles on the playground. Not sure what you did to put it into your code.. alexande192: is this the same speed Mister_Magister: leorize[m]: Error: 'yield' only allowed in an iterator PMunch: alexande192, yeah how did you end up with replacing the r with a 1 Mister_Magister: same applies for PMunch then :P leorize[m]: Mister_Magister: well... did you change iterator to proc? Mister_Magister: oooooooh didn't see that one! PMunch: Haha :P Mister_Magister: sorry :D leorize[m]: read this to understand iterators :P https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement Mister_Magister: thank you guys! Mister_Magister: PMunch: leorize[m]: putting your teachings into use https://github.com/Michal-Szczepaniak/lenislaw/commit/1c351e5e700512cb0fd067abd3dfec3d2f5ddf27 Mister_Magister: now gotta fix heresy leorize: now that's a good first step Mister_Magister: :) leorize: I also notice a lot of try-except-discard leorize: there's tryExec() for that :P Mister_Magister: leorize: link? leorize: https://nim-lang.github.io/Nim/db_sqlite#tryExec%2CDbConn%2CSqlQuery%2Cvarargs%5Bstring%2C%5D Mister_Magister: can't find it Mister_Magister: leorize: but that's only for db and i find only one case where i could use it leorize: wait except IOError? leorize: that doesn't sound right Mister_Magister: ye but that's not db leorize: well I would be concerned if you're discarding IOError :P Mister_Magister: shhhh :D leorize: the IOError might have come from your threaded-async attempt :P leorize: asyncdispatch is not designed for it Mister_Magister: leorize: it's because if i try to delete message without having permissions to do so it throws io error even tho i checked for permissoins ealier :C leorize: wait they actually throw IOError? leorize: yep https://github.com/ba0f3/telebot.nim/blob/2da3f0d8e9821b3aa6626251ee6edba0bd9ef78a/telebot/utils.nim#L185 Mister_Magister: ye leorize: I don't think that's the kind of error meant for IOError, but gotta deal with whatever cards you're dealt with I guess Mister_Magister: yeah Mister_Magister: so nim stable is 0.20 and i need 1.0.4 leorize: nim stable is 1.0.6 btw Mister_Magister: hmm choosenim you liar lqdev[m]: ah yes, choosenim downloads the old version again! Mister_Magister: i need to update nim package for opensuse again Mister_Magister: i actually helped fixing it ldlework: I always forget you can use italics in IRC. Mister_Magister: and colors (idk how tho) ldlework: and colors! Mister_Magister: and unicode 👌👌👌👌👌 ldlework: but no gifs :( Mister_Magister: or images :( Mister_Magister: latest nim in repo is… 0.19.6 Mister_Magister: tho latest on obs is 1.0.2 https://build.opensuse.org/package/show/devel:languages:misc/nim Araq: https://www.twitch.tv/araq4k Mister_Magister: https://paste.opensuse.org/74652436 hecc those latest libs! Mister_Magister: they never work :C Mister_Magister: poll async is only in newer telebot but i can't compile it fml lqdev[m]: Idlework: nice to know that the bridge converts formatting from matrix to mIRC codes or whatever they were called Mister_Magister: any idea anyone? leorize: lqdev[m]: that's a new feature djazz: audio echo on the stream Araq Mister_Magister: holy shit PMunch leorize the asyncCheck stuff works! Rika: congrats Mister_Magister: thanks Mister_Magister: https://github.com/Michal-Szczepaniak/lenislaw/commit/75b33f5d867b2e8e4117a9cccc8b72134882e1cf dwdv: Ada related question: There's the strutils.HexDigits constant for manual inclusion checks, but does nim also support type decls like the following? dwdv: subtype hex is character with static_predicate => hex in '0'..'9' | 'a'..'f' | 'A'..'F'; PMunch: Hooray! (sorry, had to go to the dentist for a bit there) PMunch: dwdv, kinda Mister_Magister: leorize: https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim can i make callback so that when process finishes my callback gets called and it sends video using telebot? alexande192: oh i hope the dentist went well alexande192: kinda scared of dentists PMunch: Me too, but it went well. They had sent me an appointment by accident :P So I just came in, said hi, and left again Mister_Magister: dentists are pure evil, the more you go to them the less you need to go to them but the less you go to them the more you need to go to them PMunch: I hadn't been to the regular dentist for 6 year, but I had no holes or anything PMunch: This is actually the orthodontist (sp?) because I had braces when I was younger (still have them on the back of my teeth) and we're discussing actually fixing it Rika: i dont know why the fuck everyone hates going to the dentist Rika: the only thing i hate about going to the dentist is the sound the scratchy thing they use to clean off plaque has PMunch: Well, when you've been tortured as much as I have at the dentist it tends to leave a bad taste in your mouth (pun intended) lqdev[m]: *laughs in exceptionally durable teeth* PMunch: I didn't mind going to the dentist as a kid PMunch: And I'm getting over it slowly PMunch: lqdev[m], my teeth are just fine, it's my jaw that's messed up.. lqdev[m]: oof Rika: whats the issue with your jaw PMunch: Basically I have a clinical underbite Rika: i had that as a kid, gone by teen years PMunch: So my front teeth meet instead of the lower ones going behind the top ones lqdev[m]: yeah mine's a little crooked lqdev[m]: but nothing too serious dwdv: PMunch: what should I be looking for in the stdlib/manual regarding the type declaration? Skimmed over the manual, any keywords I could look up? PMunch: So they started pulling teeth and putting on various braces and expandors to try and fix it Rika: mine're fine except for some insane cavities i somehow/mysteriously got Rika: read the whole thing 😄 PMunch: But through a series of unfortunate events they messed it up and it didn't help at all.. So now I'm stuck with a slight fear of dentists and no improvement (yay) PMunch: dwdv, well Nim doesn't support declaring that as a type. What you could do is declare a distinct char and write a `converter` to it that throws an error if it isn't in the set {'0'..'9', 'a'..'f', 'A'..'F'}. dwdv: Ah, I see. Okay, thank you. PMunch: Alternatively you could declare an enum (potentially with size: 1 to make them byte-compatible) and accept that PMunch: This could of course be written as a macro PMunch: dwdv, example of the converter method: https://play.nim-lang.org/#ix=2dWD dwdv: Sure, but I would still have to manually check all over the place, right? Will look into operator overloading. PMunch: Nope, the converter will try and convert any character to a HexDigit if you pass them PMunch: A converter is essentially a way to make Nim able to automatically convert between types dwdv: But ada explodes on foo := 'z'. dwdv: Would like to replicate that. PMunch: So does my example: https://play.nim-lang.org/#ix=2dWE PMunch: On runtime though Mister_Magister: !eval echo "test" NimBot: test Mister_Magister: !eval import httpclient, htmlparser; let client = newHttpClient(); loadHtml(client.getContent("https://nim-lang.org/docs/htmlparser.html")) NimBot: Compile failed: /usercode/in.nim(1, 70) Error: expression 'loadHtml(getContent(client, "https://nim-lang.org/docs/htmlparser.html"))' is of type 'XmlNode' and has to be discarded Mister_Magister: !eval import httpclient, htmlparser; let client = newHttpClient(); discard loadHtml(client.getContent("https://nim-lang.org/docs/htmlparser.html")) NimBot: /usercode/in.nim(1) in↵/playground/nim/lib/pure/httpclient.nim(961) getContent↵/playground/nim/lib/pure/httpclient.nim(956) get↵/playground/nim/lib/pure/httpclient.nim(932) request↵/playground/nim/lib/pure/httpclient.nim(907) request↵/playground/nim/lib/pure/httpclient.nim(876) requestAux↵/playground/nim/lib/pure/httpclient.nim(791) newConnection↵Error: unhandled exception: SSL support is not available. Cannot connect over SSL. ... PMunch: The playground where that code is running don't have internet Mister_Magister: geez Mister_Magister: anyway Mister_Magister: this code isn't working Mister_Magister: spits ioerror on me :< dwdv: PMunch: Oh sweet, "unhandled exception: Character 'z' must be a hexadecimal digit [ValueError]". That should do, thanks again! Completely overlooked converters. muffindrake: How would I write a wrapper for echo? Even something as simple as printing a timestamp before passing the actual arguments to echo? Mister_Magister: PMunch: could you help? Mister_Magister: it loads html just fine but loadHtml throws ioerror PMunch: muffindrake, write a proc that takes varargs[string, `$`] and pass the arguments to echo. PMunch: Mister_Magister, isn't loadHtml expecting a file? I think what you want is parseHtml Mister_Magister: ohhhh Mister_Magister: makes sense Mister_Magister: ye works now muffindrake: Hm, I see. By 'arguments', did you mean 'argument', since that proc (and echo itself in the definition) has technically only one argument? muffindrake: proc echo*(x: varargs[typed, `$`]) Mister_Magister: SIGSEGV: Illegal storage access. (Attempt to read from nil?) oh me oh my Rika: wtf Rika: so i just discovered why my code was taking time even when async was used, the lib i was using wasnt fully async PMunch: muffindrake, yeah argument is right. It takes in something which behaves pretty much like a sequence. PMunch: Mister_Magister, ouch.. PMunch: Was that without -d:release? PMunch: Or I guess -d:danger nowadays Rika: okay, i was wrong Rika: how do you determine what's bottlenecking my async code ;; Rika: how do you determine what's bottlenecking / async code ;; Rika: ah forgot discord doesnt send s/// code Rika: damn it sorry Mister_Magister: PMunch: i think attrs is nil and example isn't checking that Mister_Magister: yep i'm right Mister_Magister: PMunch: instead of a.attrs.hasKey in example https://nim-lang.org/docs/htmlparser.html#examplecolon-transforming-hyperlinks i used https://nim-lang.org/docs/xmltree.html#attr%2CXmlNode%2Cstring Mister_Magister: saved me one if even Mister_Magister: PMunch: i'm now wondering how to extract text from node… PMunch: rawText or innerText I'd assume PMunch: Isn't the output an XMLNode? https://nim-lang.org/docs/xmltree.html Mister_Magister: thanks! innerText works PMunch: Rika, well by instrumenting your code somehow.. PMunch: brb, lunch Mister_Magister: couldn't find it Mister_Magister: can i hae some array i can append stuff to? Rika: PMunch, ah man... Rika: my asynccheck-called procs are running immediately Rika: i still dont know why Rika: (theyre invoked within an async proc so poll is being called too) PMunch: Mister_Magister, a seq? PMunch: Rika, well yes why wouldn't your async procedures run immediately? Mister_Magister: PMunch ye i already got it Rika: PMunch because it's doing a network request, and i thought asyncCheck shouldnt context switch? PMunch: asyncCheck will probably run your code until the first await statement Rika: and then? PMunch: And then? PMunch: Then the asyncdispatcher will get control back and hand it over to anything else that's registered Rika: AH Rika: it clicked Rika: okay PMunch: Async really isn't that hard once you realise how it works :P Rika: well i get how async await works just asynccheck doesnt work as i though PMunch: Ah, IIRC it just works by attaching a callback that checks for errors Rika: i thought asynccheck returns immediately? alexande192: guys Rika: ? alexande192: i generated a type with integer and CallCountKind field where CallCountKind*: Eq, GtOrEq, LsOrEq, Gt, Ls alexande192: do you think this is a good idea in general alexande192: to represent int more generally in cases where one might need to show approximate values Mister_Magister: Since now i have runForever, can i make timer that will run every 5 minutes and call callback async? Rika: i dont see why not alexande192: e.g. a = Int64(>= 10) alexande192: something like that Rika: prolly an async proc with a while true loop that has `await sleepAsync 5*60` then the callback Rika: that might work ^ mister_magister Mister_Magister: while true loop? doesn't look sane to me Rika: what do you mean sane lmao Mister_Magister: i already have waitForever and it calls my async callbacks… Mister_Magister: leorize: PMunch: ideas? PMunch: Well, the addTimer feature seems like a perfect match: https://nim-lang.org/docs/asyncdispatch.html#addTimer%2Cint%2Cbool%2CCallback Rika: okay so after some thinking PMunch: alexande192, not really sure what you're talking about there.. Mister_Magister: PMunch: and it will connect to my runForever? Rika: it doesnt make sense for asyncCheck to return immediately because "maybe people want this to run in the correct order" or something i dont know Rika: im still somewhat baffled by this PMunch: Yup, it is a feature of the asyncdispatch PMunch: Well that's how co-operative multitasking works. You run when you get told to, and control only switches when you tell it to. Rika: okay so how do i "queue" something Rika: instead of it running immediately, it runs after the function already running finishes PMunch: Attach a callback to it Rika: uh Rika: 😅 Rika: how? PMunch: Basically the first example in the asyncdispatch module documentation Rika: okay thanks Rika: wait, what's the difference of me doing that and asyncCheck then? Rika: asyncCheck's code is literally just that isnt it? PMunch: What do you mean? Rika: asyncCheck attaches a callback to the future right? PMunch: Mhm Rika: then why would me doing it manually have different behavior to asyncCheck PMunch: It wouldn't, if you use the same callback Rika: i mean regards it running immediately and running after the calling proc finishes PMunch: asyncCheck is just a convenience so you don't `discard` void futures :P PMunch: Oh, there's no difference to that PMunch: Ah, I misunderstood what you meant Rika: ah PMunch: I guess maybe callSoon could help PMunch: That would run it on the next dispatch alexande192: i think asyncCheck should also do something about errors alexande192: so its not just the same as discarding alexande192: we were supposed to forbid direct discarding eventually PMunch: Yeah, it raises exceptions raised by the future Rika: uh so how do i 😅 Rika: how do i use callSoon Rika: with a Future[T alexande192: and also forbid waitFor in {.async.} Rika: > forbid waitFor in {.async.} Rika: you'd make the discordnim developer mad LOL /s PMunch: callSoon takes a proc alexande192: Rika well i used waitFor in one of my async modules for a long time as well alexande192: and i think it wasnt a good idea Rika: it definitely isnt, i'm just saying that the discordnim module has a lot of waitFor despite it being "async" Rika: had to change it a lot to fix it up alexande192: well, thats kinda fault of our stdlib indeed alexande192: if we dont make it a hard error, people will use it PMunch: Well waitFor certainly has its uses PMunch: Mostly to turn async into non-async though PMunch: I think what async/await really needs is more tutorials and such alexande192: no PMunch that's not what i mean alexande192: waitFor is ok *outside* of async alexande192: but not inside alexande192: https://github.com/nim-lang/Nim/issues/11911 disbot: ➥ Make usage of waitFor in {.async.} compile time error alexande192: basically i need to fix my port of yglukhov's await-as-a-template PMunch: Aren't there any reason to use it? alexande192: and then do the waitFor error on top i guess alexande192: PMunch well, why would you use it inside PMunch: Rika, what is it actually you're trying to do? PMunch: alexande192, I dunno, but I guess there is some usecase for it Rika: maybe i'm thinking of this wrongly PMunch: Probably :P Rika: maybe i do need threading now Rika: argh! threading! what a pain PMunch: Again, what are you doing? Rika: so i have an event loop watching for events alexande192: PMunch i think somewhere in the docs they were forbidden alexande192: also https://forum.nim-lang.org/t/3920 Rika: when an event is emitted, i do some stuff (irrelevant) and conditions and when something meets that condition, i make a network request alexande192: it seems they are forbidden in the nim book Rika: i want to make that network request not interfere with the event loop alexande192: basically if you can think of a good contra-argument, i'd love it of course Rika: but i do not know how to determine whether its being interfered with PMunch: I mean, it will interfere some PMunch: That's just the nature of async Rika: i mean that's fine, as long as it aint 100 fuckin milliseconds alexande192: is the network request slow? Rika: no clue alexande192: i mean, why is it slowing your whole event loop down? Rika: no clue (2) PMunch: It seems like you're trying to optimise something without really knowing what is actually slow alexande192: what i mean is how you profile it Rika: to be totally fuckin honest i have no clue if my code is correct alexande192: to make sure where is the time spent Rika: PMunch, yes Rika: i dont know if it's slow so i'm just assuming it is alexande192: well, i guess it might be possible to measure it Rika: but i'd really like to know how to determine it being slow PMunch: Yeah, before trying to optimise something you should first figure out if there is something to optimise, and what is actually worth optimising Rika: i mean i dont know how i have no clue on how to determine that PMunch: Well, the easiest is to throw in some timing statements and echo them out PMunch: Or use a profiler, but I'm not sure how well they work with Nims async.. alexande192: well you can always just profile the raw event loop calls PMunch: Since it essentially rewrites everything :P Rika: yeah the loop does stop for a few hundred milliseconds alexande192: you can figure out whats happening its mostly something like poll (? or something else i forgot) => series of funAsync, funIter etc alexande192: so you have to see where exactly its stopping Rika: this is gonna drive me insane i swear ;; alexande192: its possible that you invoke e.g. a blocking syscall alexande192: which still blocks your async call alexande192: i wanted to make that detectable somehow as well PMunch: Rika, what do you mean stop the loop? The loop stops every time something gets executed.. PMunch: Wait, what Nim version do you use? alexande192: but its much harder: maybe user-defienable "block cost/functions" primitive annotations Rika: 1.0.6 and i know it stops the loop Rika: really Rika: im pretty confused now Rika: i dont know what the hell im saying really alexande192: do you have a repor alexande192: repro* alexande192: it would be easiest to just look at it Rika: no i dont Rika: ill ask another time maybe PMunch: Of course it stops the loop, again that's how async works.. Rika: i know it does i know Rika: what im saying i think is that it does it for too long PMunch: Rika, by the way if you want a sneak peak at my article: http://ix.io/1Xyc/ PMunch: Err, remove the last slash there to get a readable version.. alexande192: rika well you just have to find out what call happens when it stops PMunch: Yeah, add some carefully positioned echos, and possibly some time measurements around in your calls PMunch: Would be nice if asyncdispatch had a debug mode for this kind of stuff actually Rika: dat formatting tho Rika: PMunch, alexande192, i shall Rika: still being driven insane though PMunch: Rika, what do you mean? PMunch: As I said, remove the last / from that link in order to actually get sane formatting Rika: yeah i didnt read that Rika: i did Rika: and i shall take a look Rika: actually the "formatted" version is still hard to read, ill read this some other time when im not sick perhaps alexande192: take some rest man PMunch: Best way to fix bugs when you are sick, rest and wait until you're healthy :) PMunch: Who wrote => in sugar? mratsim: it's old mratsim: older than me mratsim: also now it's quite picky, you now often need to explicitly put the type (since 0.18 iirc) PMunch: Oh really? That's what I was wondering, how on earth it worked so well :P Rika: `git blame` PMunch: The module had been renamed PMunch: But yeah, it turns out that Dominik wrote it back in 2014 disruptek: !last zevv disbot: Zevv spoke in 12#nim 7 hours ago PMunch: Oh cool, neat feature! Rika: how many hours ago though PMunch: Uhm, doesn't that come through Rika? PMunch: On IRC it says: Zevv spoke in #nim 7 hours ago disruptek: people on discord or gitter don't get irc color/style formatting because dumb. PMunch: disruptek, is there a list of features somewhere? PMunch: Yeah but I thought it just stripped the colours, not removed the whole thing Rika: it shows nothin o'er here Rika: ` Zevv spoke in #nim hours ago` disruptek: the only ones not documented in !help are !tune and !last. disruptek: that's a simple bridge defect, then. kaushalmodi: !help aeverr: !help Rika: help does nothing? Rika: didnt get a PM either disruptek: yeah, discord/gitter users cannot receive PMs. kaushalmodi: I see this on Gitter: "** 9Zevv spoke in #nim 77 hours ago" disruptek: ~notes disbot: notes: 11https://gist.github.com/disruptek/41100bf20978de9a3cff55b23fcfe44e -- disruptek disruptek: some docs in there. disruptek: i guess i will put the help in a footnote. aeverr: disruptek, i just sent here though (i'm Rika) Rika: aeverr's me disruptek: !help disruptek: works for me. aeverr: !help aeverr: worked on the second try disruptek: i guess we should fix the bridges. disruptek: !last shashlick disbot: shashlick spoke in 12#nim 9 hours ago Rika: what do you think yardanico's doing hahaha disruptek: ol' shashlick has some pretty advanced bridging. PMunch: aeverr, you had a space before your ! on the first try :) PMunch: !last PMunch disbot: PMunch joined 12#nim 6 hours ago PMunch: Huh, so if you are here it says when you joined PMunch: Neat PMunch: Although a spoke as well would be better PMunch: !araq PMunch: !last Araq disbot: Araq never seen. PMunch: Uhm.. PMunch: !last dom96 disbot: dom96 never seen. PMunch: !last disbot disbot: disbot joined 12#nimsec 10 hours ago and last spoke 710 hours ago PMunch: (sorry by the way if that pinged you guys..) disruptek: !last PMunch disbot: PMunch joined 12#nim 6 hours ago disruptek: that's a bug. disruptek: i don't bother tracking people that have no events. but, ar4q should have events. disruptek: and obviously, you spoke. disruptek: !last Rika disbot: Rika spoke in 12#nim 9 hours ago disruptek: wtf disruptek: !last disruptek disbot: disruptek spoke in 12#nim 35 seconds ago disruptek: !last nimbot disbot: NimBot spoke in 12#nim 3 hours ago disruptek: !last Elegant beef disbot: Elegant Beef spoke in 12#nim 6 hours ago PMunch: Hmm, does Nim have some similar convention to how Ruby uses ! for procedures that mutate their input? disruptek: not afaik. disruptek: i guess i will debug this in the morning stream. disruptek: it's not identifying existing users correctly, which is bizarre. Araq: PMunch, don't return a value and assume people read the docs disruptek: i'm an idiot. PMunch: Araq, yeah I wanted to have two versions of a proc, one that returned a new version, and one that modified in place PMunch: Which in ruby would typically be named "replace" and "replace!" Araq: only provide the inplace version and use 'dup' PMunch: Dup? Araq: new in 1.2 PMunch: Ah.. disruptek: !last nimbot disbot: NimBot joined 12mail.nim-lang.org 12 minutes ago disruptek: !last pmunch disbot: PMunch spoke in 12vpn.dualog.com 11 minutes ago disruptek: lol PMunch: Haha, wrong field? disruptek: parser snafu. disruptek: gah, such a simple feature. so buggy. disruptek: !last pmunch disbot: PMunch spoke in 12#nim 13 minutes ago disruptek: !last nimbot disbot: NimBot joined 12#nim 13 minutes ago disruptek: !last s4mu3lbk disbot: s4mu3lbk quit 7102 minutes ago and last spoke 7 hours ago disruptek: i only write this shit late at night, so it's pretty terrible. PMunch: Haha, an entire project written while half asleep. Don't see how that could ever go wrong :P disruptek: oh the bot is a mess. but i realized before i implemented this feature that i could use it to demonstrate generics. disruptek: so i wrote it just like radio and i will refactor them on-stream to explain how that works. disruptek: radio == tune PMunch: Aah, I see disruptek: ~news is the #nim-news channel has a Nim news feed of updates to pull requests, issues, and packages. disbot: news: 11the #nim-news channel has a Nim news feed of updates to pull requests, issues, and packages. PMunch: Araq, is there a dup alternative in 1.0? PMunch: deepCopy? PMunch: Ah, for me copyNimTree does the trick Araq: join #nim-news Araq: PMunch, I'll probably write an compat nimble package so that you can use 'dup' with 1.0 Mister_Magister: !eval import parseutils; parseInt("123") NimBot: Compile failed: /usercode/in.nim(1, 28) Error: type mismatch: got Araq: import strutils instead Mister_Magister: !eval import strutils; parseInt("123") NimBot: Compile failed: /usercode/in.nim(1, 26) Error: expression 'parseInt("123")' is of type 'int' and has to be discarded Araq: jeezzz, how hard is to follow tutorials or browse our docs Mister_Magister: Araq: i was! Mister_Magister: https://nim-lang.org/docs/parseutils.html#parseInt%2Cstring%2Cint%2Cint Mister_Magister: !eval import strutils; discard replace("123,123", ",", "").parseInt() NimBot: Mister_Magister: hmpf Araq: the examples all call this proc with more than one argument Mister_Magister: why is it not working :C Araq: !eval import strutils; echo replace("123,123", ",", "").parseInt() NimBot: 123123 Mister_Magister: no that's not what i mean Mister_Magister: !eval import strutils; discard replace("121,738", ",", "").parseInt() NimBot: Mister_Magister: ugh Mister_Magister: https://paste.opensuse.org/c4c3aa41 it just won't work :C Mister_Magister: !eval import strutils; discard replace(" 121,738 ", ",", "").parseInt() NimBot: /usercode/in.nim(1) in↵/playground/nim/lib/pure/strutils.nim(1100) parseInt↵Error: unhandled exception: invalid integer: 121738 [ValueError] Mister_Magister: ah yes .strip Araq: use strscans instead alexande192: hm strange alexande192: do you try to parse? alexande192: Araq, good work on `panics` Mister_Magister: Araq: what do you mean? alexande192: why not a user defined set of panics though: i think there such an idea: dont remember by whom(disruptek?) Araq: implementation complexity Araq: I thought about exposing sysFatal as system.panic and then you can handle these via "recover" but it doesn't really solve the problem Araq: as in the "recover" you want to use a "raise" and so the backend must assume that every bug can be caught Araq: the only benfit that we have 'try except' vs 'recover' in the language Araq: but we can already filter inside 'except' so it's pure sophistry in my book disruptek: agreed. disruptek: what about simpifying the implementation thusly: disruptek: one can add a define to cause the named exception to abort. Araq: we used to have a "raise hook" for that Araq: but nobody ever used it and it introduces composition problems Araq: say you say "die on ValueError" and then you use a library that uses strutils.`%` and catches the ValueError... disruptek: i consider that a feature. disruptek: isn't that the exact semantic that we want? Araq: in no version of Nim is a ValueError a "Defect" disruptek: then don't "die on ValueError", silly. Araq: so it's not the semantic that I want. I only care about Overflows and out-of-memory really Araq: as they are prevalent disruptek: then you define what those are and then allow the hook only on that class of exception. Araq: we already have an outOfMemHook Araq: but again, inside this hook you might want to raise an exception. disruptek: okay, so you want to tell status to pound sand. Araq: --panics:on is a good compromise for me Araq: I'll see what the others have to say disruptek: !rfc panic disbot: https://github.com/nim-lang/RFCs/issues/180 -- 3Introduce safety modes disruptek: ahh Araq: what we should probably do though is to make 'except:' mean 'except (not Defect)' Araq: and if you want to catch defects you shall write 'except Defect' Araq: and we can produce a warning for 'except Defect' in combination with --panics:on Araq: as it's meaningless disruptek: a warning sounds right. disruptek: is there a scenario where code won't compile with panics:on? Araq: no. disruptek: cool. disruptek: does the exception hierarchy change? Araq: no. disruptek: isn't it broken? Araq: I'll add a warning though for Foo* = object of Exception disruptek: i guess that works. disruptek: so `except Exception` magically crashes on Defects. disruptek: with panics. Araq: yup disruptek: sounds great to me. Araq: I still wonder if panic/recover APIs are not slightly better because more explicit Araq: but then they wouldn't fix empty 'except' clauses disruptek: the problem is that different users want different semantics for the same code. Araq: if I do use 'raise' inside 'recover' then I need to be able to use 'except' disruptek: that's why i suggested the compiler opts. Araq: I still want .quirky as a pragma though disruptek: then someone can just put themselves in a state where they are recovering to have open exception access. okcc: if i want to select x11 events, what type should i use in newSelector[T], any help? thks okcc: i have a x11 display file descriptor which is cint okcc: all in one, i just want this c code (https://stackoverflow.com/questions/8592292/how-to-quit-the-blocking-of-xlibs-xnextevent) achieve in Nim shashlick: i use matterbridge for my bridging - what's needed? disruptek: the type you use is that of your monitor. disruptek: it's the payload that you pass around. okcc: now i can only get empty seq from select() https://nim-lang.org/docs/selectors.html#select%2CSelector%5BT%5D%2Cint disruptek: there's an example in golden. disruptek: !repo golden disbot: https://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim 🏆 15 16⭐ 0🍴 disruptek: see the src/golden/invoke.nim mratsim: btw you should probably add your inputs here @disruptek: https://github.com/nim-lang/Nim/pull/13617 disbot: ➥ new std/timers module for high performance / low overhead timers and benchmarking (formerly system/timers include) ; snippet at 12https://play.nim-lang.org/#ix=2dY3 disruptek: i don't know anything about benchmarking. mratsim: yeah just like Araq doesn't know anything about compiler or GC 😉 disruptek: seriously, golden is crude as fuck. disruptek: it just happens that a lot of people want to do async process i/o in the stdlib and that's the definitive example afaik. okcc: thanks, disruptek, i'm checking it out disruptek: i really want to finish it, though. Araq: when the optimizer has to assume every proc can fail at least we can use the mechanism to handle OOM without further overheads disruptek: okcc: you can ignore the benchmarking crap, but obviously you can't really ignore the selectors stuff. also note that there's a fd leak in the signalling. iirc two workarounds are documented in the code (toggled with a define). disruptek: but i don't think you have to worry about that with x11 fd. alexande192: mratsim :) alexande192: whats happening with your compiler alexande192: i want to start working on one of my ideas eventually disruptek: great; that's coincidentally when mratsim's compiler will be ready. Araq: or mine... :P alexande192: disruptek :)) mratsim: my compiler has been delayed by cryptography and fighting the absolutely horrible GCC codegen for bigints mratsim: I think I can have a nice elliptic curve crypto lib in Nim in about 3 months, and there is big desire for such. mratsim: when I say big desire, people are working full-time on template metaprogramming/generics in Go (LOL): https://github.com/ConsenSys/goff/blob/master/cmd/internal/template/element/mul.go Recruit_main70007: just use Nim lmao mratsim: I'm using Nim, but somehow, the go compiler is better than GCC for big integer implementation Yardanico: I wonder why people use AGPL https://github.com/Ethosa/yukiko https://github.com/Ethosa/shizuka :( Yardanico: AGPL basically makes it impossible to use these libs in the projects which are not open-source (even if they're web apps) Varriount: AGPL is good for actual pieces of software. Not so much for libraries Yardanico: that's my point as well mratsim: define "actual" 😛 lqdev[m]: @mratsim programs mratsim: all my programs are libraries lqdev[m]: apps lqdev[m]: I meant Yardanico: well I don't really see why would anyone use AGPL for libs unless they're an open-source libre fanatic Yardanico: it's stricter than GPL disruptek: i was attracted to it. lqdev[m]: I can't even think of using the regular GPL for libraries alexande192: well it makes sense if you really want to .. not let it be used for commercial purpose Yardanico: well I talked with Ethosa and told why AGPL is not that good for oss libs :P alexande192: otherwise i usually use MIT i think, but i can imagine gpl-like stuff being useful mratsim: GPL makes sense if you want to monetize but still be open-source mratsim: even for libraries, it takes time to maintain good libraries mratsim: (thinking of FFMPEG for example) disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek Araq: ok, new overflow handling is almost done mratsim: do you use __builtin_add_overflow and __builtin_sadd_overflow? mratsim: or rather __builtin_add_overflow_p / __builtin_sub_overflow_p / __builtin_mul_overflow_p mratsim: https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html Araq: yup Araq: but I don't use inline asm anymore, too much trouble Araq: VCC doesn't really support it and the others have builtins I can use Kiloneie: I've seen a good example on using a procedure while having imported 2 modules that both contain that procedure, does anyone have a link or something, i need a good example, i am trying to show this naming conflict and how to fix it, but what i've done the compiler fixes it by itself... Yardanico: modulename.procname() Yardanico: if you import module a and module b which both have the same proc "c" with same arguments, you can call it like a.c() or b.c() Kiloneie: i know that, but i am trying to recreate an error while having both imported Yardanico: if you want to recreate an error, you need to have two procs with the same name AND arguments Yardanico: from two modules Kiloneie: Is there any example of when having multiple modules imported, it will simply crash trying to use a same named procedure ? Otherwise i have to explain this by forcing a crash like you said. disruptek: do so. Yardanico: @Kiloneie if you mean stdlib - these conflicts are pretty rare, even strutils/unicode was fixed (by adding Ascii to strutils variants) Yardanico: ah actually Yardanico: split from strutils/unicode Kiloneie: i tried strutils and seutils and compiler does the work Yardanico: I mean this https://play.nim-lang.org/#ix=2dYo Yardanico: split with no arguments Varriount: Araq: I like the new defects feature Kiloneie: Perfect thanks. I assume this will be fixed in the future right ? Yardanico: no, why? Yardanico: you just have to specify either or exlude split from one of the modules when importing Kiloneie: i know, i am just asking so i explain this right, so the video holds up. Yardanico: well I think this is correct behaviour Varriount: Araq: panics:on still works with range checks, right? Araq: range checks are turned into panics then Kiloneie: Say the ones that have been fixed, wouldn't be fixed when my video aired, and then they would be, which would nullify the explanation if i didn't mention that it could be fixed in the future. Yardanico: well you're creating videos for nim 1.x right? Yardanico: even if the proc names will change these version will still be kept in 1.x for backwards compat Yardanico: so don't worry Varriount: Araq: But the panic will always occur? There won't be the chance to read garbage data? Kiloneie: right now i am still on 1.0.0 Araq: Varriount: that depends on --rangeChecks:on/off Yardanico: code you write for nim 1.0.0 is supposed to work on any future nim 1.x release Varriount: Araq: Assuming range checks are on Kiloneie: Okay good,(i did read some of the debate that came after 1.0, so i wasn't sure) Yardanico: well I'm not sure i'm 100% correct but I think it works like that :P Kiloneie: Yeah well it should hold up for a while, and if some X day someone tells me on a video that it's not working, then i will just do a quick edit on that video, or MAYBE even redo it. I have planned redos of several videos anyways once i do get some money to buy better audio gear. #1 will get a big redo, and 2-6 need font changes, which requires a whole redo. Araq: Varriount: well then the panic will occur, yes Araq: Kiloneie: mention that Nim version X can emulate version 1.0 via --useVersion:1.0 Kiloneie: Hmm okay, will do. Kiloneie: Btw looking at the unicode module, are runes special characters of different languages ? Yardanico: they're unicode characters Rika: just a unicode character Rika: any character Yardanico: nim strings are bytes, if you do stringvar[0] you get first byte in the string Rika: be it another language character or ascii Yardanico: if you want to operate on unicode characters (runes) you need unicode module Kiloneie: Huh okay, not norse mythology then xD... Yardanico: lol Rika: lol federico3: Yardanico: a lot of components around the activitypub are under AGPL treeform: Does any one know why --d:release in nim.cfg seems to have no effect? Yardanico: what effect? Yardanico: when compiling it should say "release build" in the end treeform: same as it does on the command line Yardanico: if it's applied leorize: it depends on where you put it leorize: the code that handle -d:release is in the global system config leorize: user configs are read later in the process leorize: so by the time it reads user configs, whatever -d:release resolves to have already been decided treeform: leorize, oh that explain it. Do you know how I make it do what I want? Araq: inline what the default nim.cfg does for -d:release treeform: So my issue, I am making a game, but it runs to slow without -d:release, I don't think it's nim's stuff thats making it slow. Maybe all I need to do os make the C compiler optimize more. Yardanico: well you just put -d:release in your project's nim.cfg lqdev[m]: @treeform --opt:speed? leorize: Yardanico: that won't work Yardanico: it should work the same as -d:release in cmdline if you're compiling the same file and that nim.cfg is in the same folder with the code file Yardanico: leorize: why? lqdev[m]: because the nim.cfg in the distribution is processed first lqdev[m]: then the project's nim.cfg lqdev[m]: so it won't have any effect lqdev[m]: because -d:release is a thing from the distribution's nim.cfg Yardanico: ah right I remember it now Yardanico: sorry lqdev[m]: @treeform I found that --opt:speed increases speed dramatically, --stacktrace:off even further, but you probably want stacktraces on during development Yardanico: https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L72 for -d:release treeform: Thank you Yardanico, leorize, lqdev[m], Araq for helping me with this. I'll try out --opt:speed, I actually do want the nim's development features. I now understand how the config works. alexande192: guys alexande192: ops* sorry wrong room Kiloneie: Why can't i do the commented out part https://play.nim-lang.org/#ix=2dZ4 , do you need to have the imported module when using the except keyword on it's own line ? Araq: because except takes a comma separated list of identifiers for itself Araq: import strutils except split, toLowerAscii # see? Kiloneie: ah okay clyybber: Araq: Was there a time where nim had no echo? clyybber: Because I'm seeing `when declared(echo):` in extccomp.nim Araq: it's a workaround for a NimScript config bug Araq: where it ended up not having echo, or something. clyybber: does that bug still exist? Araq: I doubt it Araq: if it does, the CI will notice clyybber: Ok clyybber: Araq: Another thing, should an explicit --hint:CC:on for example override --verbosity:0 ? Araq: oh who cares clyybber: I dunno, I just wonder what is intended clyybber: so I can write the code accordingly :p shashlick: Yay nimterop newalgo is now in head so I can develop in parallel! shashlick: Feature flags ftw silvernode: just added a bunch of prototype code to space nim, those of you who are part of the project, I will be online around 0600 UTC for around an hour to work on it some more if anyone will be awake then. silvernode: Until then goodnight Kiloneie: I can't figure this out: https://play.nim-lang.org/#ix=2dZJ kaushalmodi: Kiloneie: A char is only 8 bits kaushalmodi: so ž probably fit in a char. It probably needs to be a string Yardanico: @Kiloneie as kaushalmodi said, nim "char" type is only for ASCII characters (because one ascii character = 1 byte) Kiloneie: i commented out the string version though... Kiloneie: also errors.. Yardanico: @Kiloneie the one with echo is erroring because unicode split accepts a Rune or sequence of runes, not a string kaushalmodi: Kiloneie: https://play.nim-lang.org/#ix=2dZN timotheecour: @Clyybber are you here? just PM’d you Kiloneie: huh, thanks, i didn't know how to make a rune, didn't think there was a proc for that Kiloneie: should of looked better D: Kiloneie: this video is getting split into 2 parts... i didn't expect this much complexity kaushalmodi: now what's confusing me is that `echo "Hello Worldž!".split("ž".toRunes)` works.. but kaushalmodi: this doesn't: `echo "Hello Worldž!".split("ž".runeAt(0))` kaushalmodi: ^^ see https://play.nim-lang.org/#ix=2dZP Kiloneie: yeah... no idea either, it works and then it doesn't kaushalmodi: use Rune splitter doesn't work.. but using seq[Rune] splitter works dwdv: Curious about another niche feature: do we have something similar to dlang's opDispatch which get's called with the function name as a template string when it can't find any valid dispatch? This allows glsl-like swizzling for example: https://github.com/d-gamedev-team/gfm/blob/master/math/gfm/math/vector.d#L240 dwdv: gets* Yardanico: there's `.` operator which is a bit similar Yardanico: https://nim-lang.org/docs/manual_experimental.html#special-operators-dot-operators Kiloneie: no it works Araq: yeah, but don't use it, it's bad. so is opDispatch btw dwdv: Fite me on opDispatch! Kiloneie: @kaushalmodi echo "Hello Worldž!".split("ž".runeAt(0)) works, try to comment it out Clyybber: @timotheecour answered dwdv: Thanks for the link, Yardanico! kaushalmodi: Kiloneie: This fails for me, on devel too: https://play.nim-lang.org/#ix=2dZT kaushalmodi: Kiloneie: https://github.com/nim-lang/Nim/issues/13628 disbot: ➥ unicode.split does not work when using a Rune separator ; snippet at 12https://play.nim-lang.org/#ix=2dZU Kiloneie: yeah it fails Kiloneie: if you use runeAt(1) is weird Kiloneie: both ž and ! is gone disruptek: Araq: aws api signing broken again on devel. Araq: with ARC? disruptek: yeah. disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek disruptek: https://travis-ci.org/github/disruptek/sigv4/jobs/661254990 disruptek: aws signing ^ Varriount: Has anyone implemented this: https://github.com/lemire/fast_double_parser Varriount: ? clyybber: Araq: I rebased https://github.com/nim-lang/Nim/pull/13606, it should be ready to merge once its green disbot: ➥ Make listCmd honor hint:cc:off Araq: so C++ decided to tell my 255 cannot fit into a 'char' Araq: how many centuries do we have to wait for C to understand what a byte is? and how on earth is this a "portable assembler". Araq: every assembler I ever used understands what a byte is Araq: and before you say "yeah well use 'unsigned char' " Araq: how do I create string literals of unsigned chars conveniently? is (unsigned char*)"hello\0" guaranteed to compile? exelotl: is there a way to do superscript/subscript in restructuredtext? Araq: yes, `text`:sup: iirc exelotl: oh cool that works, thanks timotheecour: @araq is there anything else blocking https://github.com/nim-lang/Nim/pull/13351 ? disbot: ➥ stacktraces can now show custom runtime msgs per frame ; snippet at 12https://play.nim-lang.org/#ix=2e0u Araq: I don't know but I also don't like the feature timotheecour: Why ? Araq: more code we have to maintain, yet another feature, unclear how it can work for an LLVM backend timotheecour: 1) it’s super useful for debugging a program, making stacktraces a whole lot more useful and user-customizable (without compiler/stdlib support needed once this PR is merged); whether debugging compiler or debugging a user program; ⏎ 2) it’s in particular incredibly useful when your program parses another source (eg for parsers, compilers, etc) as it shows where you are both in parser as well as what’s FromGitter: ... being parsed ⏎ 3) other use cases are showing more user-customizable context when an exception is thrown ⏎ 4) llvm backend: not sure why this would introduce any complication, i’m not relying on OS-specific stacktrace mechanisms here; in any case, the feature is entirely opt-in [https://gitter.im/nim-lang/Nim?at=5e69663a47b42479253f82f5] Araq: how is 'var frameMsgBuf* {.threadvar.}: string' entirely opt-in? Araq: instead why not set the existing 'procname' to something else Araq: extra points if it can stay a 'cstring' timotheecour: I can add a `—stacktracemsgs:on/off` timotheecour: > instead why not set the existing 'procname' to something else ⏎ ⏎ I have follow up work after this PR that makes `—stacktrace:on` faster for everyone and removes all these; it works; I can show the WIP if needed. Araq: how does it work? Araq: (and now don't say "it works well" :P ) timotheecour: let me open that WIP PR (it’s entirely compatible with nim-lang/Nim#13351 ) timotheecour: I’ve opened the WIP here https://github.com/nim-lang/Nim/pull/13630 but *I recommend only looking at it if you’re curious how it works, it’s not cleaned up*; and yes it does work (at least at some intermediate commits); there are 2 parts (that could be split in 2 PRS): ⏎ ⏎ 1) 1st speedup: get rid of `TFrame` stack allocated data at beginning of each function, and get rid of linked list of PFrames; FromGitter: ... instead I simply use a single threadvar “index” into a UncheckedArray of TFrame that’s re-alloc’d as needed; it gives a nice 2X speedup in many cases ⏎ 2) 2nd speedup on top of it (still WIP but works): replace file/line/col/procname by a single index; this has implications for other uses cases (eg nimprof) making exception handl ... [https://gitter.im/nim-lang/Nim?at=5e696a5195b8ff0bbfad1c84] disbot: ➥ Faster --stacktrace:on timotheecour: > anyhow, can you make it a 'cstring'? constants are fine and with a little care you can ensure the string is from a buffer that is not freed to early ⏎ ⏎ let me try and get back to you; r u ok if i use `c_realloc`? Araq: depends, the memory management shouldn't be done in system.nim Araq: but instead the user of the API should do it Araq: I think it's an acceptable tradeoff, special apis need special care Clyybber: @timotheecour How does replacing file/line/col/procname by a single index? Clyybber: Do you mean to store file/line/col/procname in an array? timotheecour: in final version of that PR, i will encode in a single `int` what’s sufficient to reconstruct (file/line/col/procname / optional other data) in a compact way; ⏎ `Index: int = (fileIndex bits + procIndex bits + remaining bits for line/col)` (skipping some details) timotheecour: so that throwing exceptions (or collecting tons of stacktraces, eg in nimprof) incurs zero symbolization cost; the symbolization can be deferred to when it’s actually needed unlike what’s currently done in nim Araq: sounds good. now if only I could draw your attention to ARC or IC or Z3 ;-) Araq: Clyybber: are you aware of my branch? Araq: I implemented it but the regressions are *hard* clyybber: Yeah, I'm looking at it rn Araq: anyhow, https://github.com/nim-lang/Nim/pull/13626 is really getting good disbot: ➥ catchable defects clyybber: nice Araq: faster overflow handling and goto-based exception handling can deal with AssertError clyybber: Araq: How did you improve the overflow handling? Araq: read the PR clyybber: k clyybber: oh so we use builtins clyybber: nice! Araq: disruptek, https://github.com/nim-lang/Nim/pull/13626/files#diff-e2da3621d8e2ee26a311f04b51a21322R11 lying comment! disbot: ➥ catchable defects clyybber: heh clyybber: good night Araq: timotheecour: are you sure the growable array is better than our linked list? Araq: maybe the speedup comes from the fewer stores entirely Araq: (you turn the (cstring, int) store into an (int) store afaict) Spy653: Anyways it's been good talking to you all but I'm off to bed :) exelotl: cya Elegant Beef: my terminal now terminals Elegant Beef: https://streamable.com/347l8 disruptek: QUIT TOUCHING YOUR FACE Elegant Beef: But that's not fun Elegant Beef: Lick the bathroom clean is the only way to live Rika: but can it ansi code Elegant Beef: I mean it's parsing colour codes there leorize: I hate to say it, but your colorscheme is terrible Elegant Beef: Thats imgui's theme Elegant Beef: Dont blame me Elegant Beef: Unless you mean the ansi parsed stuff Elegant Beef: That's pretty atrocious Elegant Beef: i did just go blue = 0,0,.5 and light = 0,0,1 Elegant Beef: i have/had no regard to the actual colour Rika: support all VT100 sequences then your terminal is terminaling right 😛 Rika: www.termsys.demon.co.uk/vtansi.htm Rika: not the whole list but eh idk where the whole lists are Elegant Beef: Well i mean im using imgui so it's going to be a pain to get things working Rika: twas your choice to use that Elegant Beef: Well the reason im using it is so i can make a terminal that isnt just text based dadada: -f rebuilds everything, is there a way to only force the reexpansion of macros? leorize: no Rika: you need to recompile to re-expand leorize: are you having problems with your macros? leorize: as long as you change something nim should pick up and recompile only what changed dadada: nothing I couldn't solve, but I'm feeding random data into my macros to test them dadada: so each time the program runs the result can be different dadada: but I don't see the debug output of the macro unless I change something about the macros dadada: expandMacros macro should IMO predictably output the expanded macros, but it only does when the macro is compiled dadada: expandMacros macro should IMO predictably output the expanded macros, but it only does when the macro is compiled dadada: sry, wrong window Rika: lmao Rika: did you arrowup enter? flywind: \ blackbeard420: can you await a flowvar from spawn? leorize: not yet leorize: rayman22201 is working on that blackbeard420: whats the best way to spawn off a task and have it notify the eventloop when its done, until awaiting a flowvar is possible? rayman22201: @blackbeard420: you need to use future and asyncevent manually. See here for an example: https://github.com/nim-lang/Nim/issues/11564#issuecomment-539317277 disbot: ➥ asyncfile.readline blocks (and behaves differently between Linux and MacOS) ; snippet at 12https://play.nim-lang.org/#ix=2dRf Varriount: Reading from the console is always tricky (asynchronously moreso). Especially if you want to support Windows, since Windows represents the console as its own set of APIs dadada: what is this good for? the README lacks details... it's debugging macro written in nim, has anyone used it here? https://github.com/jyapayne/butterfly leorize: seems old leorize: probably no one used it silvernode: Someone told me there was one main Lisp book that I should read and I can't remember what it was called. silvernode: I think it was called "practical common lisp" vegai: http://www.gigamonkeys.com/book/ yep vegai: it's convenient since it's freely available vegai: and also pretty good lain: new to nim, pls be gentle. trying to do a quick test of crossbuild: aarch64 target, x86_64 host. using 'nim cc --cpu=arm64 --os:standalone test.nim' produces an x86_64 elf. creating a nim.cfg that sets arm64.standalone.gcc.exe and arm64.standalone.linkerexe to "aarch64-elf-gcc" calls the correct compiler, but passes '-march=x86_64'. what am I doing wrong? lain: related: is the nim.cfg file documented anywhere? I wasn't able to find anything Elegant Beef: https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files Elegant Beef: From my understanding it's just all your compile parameters in a neat package lain: thanks, unfortunately that doesn't explain the contents of .cfg files :o lain: taking a hint from the Nintendo Switch section of the global nim.cfg, I tried setting gcc.options.linker to "-g -march=armv8-a -mtune=cortex-a53", and this does indeed get passed to aarch64-elf-gcc .... along with -march=x86_64 >.< lain: I wasn't able to easily find what is generating that -march=x86_64 in the linker command line Varriount: Lain: I believe that there's a compiler switch used for the architecture Varriount: Is there anything in the full help output from the compiler mentioning targets? lain: Varriount: all I see is --cpu, which I am setting to --cpu:arm64 Varriount: Hm Varriount: Lain: How are you discovering what arguments Nim is passing to the compiler? lain: Varriount: --listCmd Varriount: Huh, nowhere in the repository can I find a reference for march (aside from the configuration file) or x86_64 lain: likewise lain: Varriount: here is the output of 'nim cc -f --cpu:arm64 --os:standalone --listCmd test.nim': https://termbin.com/ao2s lain: that's without a custom nim.cfg for the project, so it's using gcc instead of aarch64-elf-gcc, but, the same problem applies: I'm telling it --cpu:arm64 and it's passing -march=x86-64 lain: ah, I lain: oops. ah, I just noticed I had been typing x86_64, but the argument it passes is in fact x86-64 (dash, not underscore, whoops!) Varriount: Can you post the custom config? Varriount: lain: ^ lain: Varriount: sorry about that. sure, here's the basic one I've been testing with: https://termbin.com/2khk lain: running the build with that file present, here is the output: https://termbin.com/6fjz Varriount: Lain: is it possible those arguments are being added by the C compiler somehow? I don't see any references in the compiler to D_FORTIFY_SOURCE either lain: Varriount: good question. I doubt it since it's aarch64-elf-gcc ? not sure how to verify though Varriount: Hm, I'd be interested to know where listcmd is being checked for Varriount: Like, where in the compiler source commands are printed lain: looks like compiler/commands.nim sets optListCmd if --listCmd is present, and that is checked in compiler/extccomp.nim Varriount: Thanks I'm currently on my phone, so searching the compiler code is not quite straightforward lain: :3 Varriount: My best guess is that either the C compiler is adding arguments, or the Nim compiler is pulling them from somewhere (environment variables?) lain: ok it looks like compiler/extccomp.nim defines compiler gcc, in that it sets compileTmpl to "-c $options $include -o $objfile $file" lain: and it sets $options to the contents of an 'options' variable... which is... var options = cFileSpecificOptions(conf, cfile.nimname, cfile.cname.changeFileExt("").string) PMunch: Hmm, I noticed some old wording in the deques module and starting poking around in it a bit (mostly to see if I could make it not require initialisation). And it has some weird stuff in it PMunch: Like this for example: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/deques.nim#L73-L76 PMunch: `when compiles(defaultInitialSize)`, default initial size is a const set to 4, why would that not compile? PMunch: Ooh, someone has already been poking at this in devel PMunch: Aaah, Zevv just copied parts of the implementation from `tableimpl`. But `tableimpl` doesn't have a `defaultInitialSize` constant, it is defined in `tables` which include `tableimpl`. So that check in `tableimpl` is to see if the constant exists (should this be `when declared(defaultInitialSize)` instead?), but for `deques` it doesn't really make much sense since it's declared in the same file. PMunch: And should it possibly warn if it isn't declared? Zevv: dont blame me. I proposed something completely diffeent but that got vetoed and I was told to do it like this Zevv: "git dontblameme" PMunch: Haha, yeah I looked at the issue Zevv: that said; Im not sure if my original idea was any better, though :) Zevv: but it is indeed a bit funny Zevv: I think I ran into that again my self later but didnt realize. I tried to run tables stuff on the atmel thingy but that failed becauqse tables get initialized with 64 element or so PMunch: Since you forced pushed your branch (shame!) I can't see what your original implementation was Zevv: which blew up my heap lain: ah, figured it out. at the end of the global nim.cfg it does 'gcc.options.always %= "-march=x86-64 ..."', and that seems to apply even if my project config sets gcc.options.always to something else Zevv: PMunch: I always force push people shame me about. essential part of keeping ones reputation high PMunch: Haha, yeah it should really be an `intdefine` so it could be passed as a compiler option Zevv: commit+normal push for good, amend+force push for bad PMunch: But now I can't go back to look at your implementation to see if it was better or not? Zevv: I even got my whole company to do a hard resync once by making up some lame excuse about a new git version or something, just to get rid of emberrasing history PMunch: s/?/! PMunch: Hahaha :P Zevv: did you never notice how there are no bugs reported ever in npeg? Zevv: but about the tables, is there still a problem now in the current implementation? PMunch: "We've always been at war with Eurasia!" Zevv: *always* PMunch: Oh no, I was just looking at the deques module documentation online (the one that's released for 1.0.6) and noticed that it mentioned that -d:release disabled boundschecks. Which haven't been the case for a while, so I tested to see if deques would auto-initialise, and they don't in 1.0.6. So I decided to have a peek at the code to see if anything could be done to improve it. PMunch: Then I noticed that it had been updated from 1.0.6 to devel and the auto-initialise thing was fixed, but the docs are still bad. So I'm fixing up the docs now Zevv: ah good! Zevv: yeah afaik all of the stdlib should auto init by now PMunch: "Should" as in everything is implemented to do this, or "should" as in we should try to implement everything to do this? Varriount: The latter PMunch: Ah PMunch: Hmm, how do I run the tests for a module again? Varriount: PMunch: Compile the module and run it? Varriount: Testament might have an option too Varriount: Hm, is it actually possible to make a data type containing references act like a sequence/string with regards to copy-on-assignment? PMunch: Hmm, not very extensive testing of this module :P leorize: Varriount: deepCopy()? PMunch: Hmm, why isn't Nim able to cast this int over to a Natural? https://play.nim-lang.org/#ix=2dRO Araq: Varriount: yeah via overloading of '=' PMunch: Even stranger, in this case it isn't able to convert the other int literal to an int: https://play.nim-lang.org/#ix=2dRP Araq: https://www.twitch.tv/araq4k we're about to stream Araq: today's topic: ARC bugfixing PMunch: Uhm, this is completely broken: https://play.nim-lang.org/#ix=2dRQ PMunch: Am I doing something wrong there? That should work right? PMunch: Hmm, the deque module also have these: proc `[]`*[T](deq: var Deque[T], i: Natural): var T {.inline.} does that make any sense? PMunch: I mean it doesn't really work.. https://play.nim-lang.org/#ix=2dRS PMunch: https://github.com/nim-lang/Nim/issues/13618 disbot: ➥ Range types don't work with `BackwardsIndex` (and possibly others) ; snippet at 12https://play.nim-lang.org/#ix=2dRW PMunch: What does mean in Nim? I see a lot of them in tables.nim before the return types.. narimiran: `owned` PMunch: Ah.. Rika: ar_q said it's a relic of older nim versions PMunch: Yeah I gathered as much dadada: how can I execute external commands at compile time? it says it can't importc, maybe it's not possible PMunch: staticExec? PMunch: Or are you thinking of something else? dadada: PMunch: I want to run it in a maro dadada: macro PMunch: Run what? dadada: an external program PMunch: Yeah, then staticExec is what you want PMunch: Example: https://play.nim-lang.org/#ix=2dSi dadada: ty PMunch ... dadada: ! Araq: dadada, you can also try the distros.nim stdlib module PMunch: Zevv, brushed up the deque module a bit, and made the various initialSize fields into intdefines: https://github.com/nim-lang/Nim/pull/13620 disbot: ➥ Improve deque, tables, and set modules Rika: deque has high but not low? sealmove: @federico3 federico3: huh? blackbeard420: oh cool thanks rayman22201 for the example! sealmove: you are FedericoCeratto right? sealmove: what does it take to implement "Allow running multiple test files and merging the outputs in one report and junit file" for unittest? Can you give me some pointers in the code? federico3: sealmove: an external test runner, I would guess, and right now there's an overlap between unittest, testament and https://github.com/FedericoCeratto/nim-testrunner sealmove: still haven't figure out how to use testament outside of nim compiler project (if even possible) sealmove: anyway, I really need this feature... what do you think is the best place to focus and implement it? Zevv: oi sealmove, did you enjoy my dump? :) sealmove: Zevv, I didn't see, did you send a mail? federico3: sealmove: good question. testament is not a drop-in replacement for unittest. Unittest is not being developed. My testrunner might do what you need but it's not part of stdlib sealmove: federico3: great then, testrunner seems good to me sealmove: wow Zevv, what did you do? Zevv: sealmove: yes, sunday evening sealmove: :D Zevv: I did http://ix.io/2dKZ to make ttp://ix.io/2dKY Zevv: and I wish you the best of luck with all of that from here :) sealmove: but the arrow is wrong, it should be "<-" right? sealmove: you forgot your own syntax? :) sealmove: awesome work! i was ready to abandon the CT idea and go back to the Scala implementation... Zevv: I hate my own syntax with the power of a thousand suns Zevv: my advise from this excersise is to forget all about this and go on with your life Zevv: yaml is even a bigger mess then I expected it to be sealmove: yeah, I think I am done. will just go to Scala where the parsing is implementing and my job is to just generate Nim code (with Scala strings, but whatever) sealmove: implemented* Araq: you could port your parser written in Scala to Nim sealmove: it's not my parser :D Rika: you could port *the parser written in Scala to Nim Rika: 😄 sealmove: but we have one, NimYAML federico3: Zevv: stay away from yaml PMunch: Rika well low is just always going to be 0 Zevv: federico3: that is what I have been saying from day 1 Zevv: just look at that mess. They start doing something EBNFish, and then they start to make up their own syntax along the way and then filling things not in and using custom operators and other fuzzy stuff Recruit_main70007: https://www.youtube.com/watch?v=-9SGIB946lw Recruit_main70007: Someone showed me this interview, really liked it Araq. Recruit_main70007: (I paste it just in case someone else wants to watch it) sealmove: Zevv I am sure you are enjoying their ideas sealmove: :DDD Rika: PMunch: i always thought that both procs should always be implemented together, i mean, seq has a low too and afaik seqs cant have non-0 start indexing Rika: is unicode much harder (in terms of cpu time) to calculate the "visual length" of vs ascii? PMunch: Hmm, fair point Araq: Rika: yes Zevv: technically, *unicode* is not Rika: but utf is? hm Rika: is it not negligibly harder Zevv: utf is a family of encodings. Utf32 is fixed length, every glyph is 32 bits so your number of characters is bytes / 4 Zevv: utf8 is variable length so you have to iterate over all bytes to know how much glyphs are in there Zevv: ow well I'm wrong, unicode is harder then ascii. Even with unicode a glyph is not always a position Zevv: unicode can compose things like accents on a character PMunch: Yeah, getting visual length of unicode is hard Rika: uuuuuu PMunch: I mean even Apple had a bug that crashes phones because of unicode stuff Rika: they still get bugs hahaha PMunch: However that was a division by zero in the code that tried to figure out where in a string you pressed in order to do highlighting Rika: i should release the linenoise port now should i Rika: is it "nim-(ported name)" or "(ported name)-nim" lol Araq: Zevv, I'm pretty sure UTF-32 is as flawed Araq: unicode is always variable length with its combinators and stuff kaushalmodi: Rika: Not a strict convention, but while I have seen "nim" in project names, their nimble project names don't have that "nim" string in the names (because everything on nimble will be in Nim :P) kaushalmodi: so may be have the repo name "foo_nim", but have the project as just "foo" on nimble Rika: project is just linenoise in nimble but i was asking for repo name yes Zevv: araq: sure,that is what I said. PMunch: Hmm, are you not able to use `using` with generics? Araq: PMunch, I think it's covered by a test though Araq: but 'using' is so under-used :-) Araq: time to fix and use it or to deprecate it Rika: fix and use pls djazz: hi, is it possible to get the name of a proc? My module accepts function callbacks, and since they might be named it would be useful to log what callback is fired depending on their name. Yardanico: https://github.com/nim-lang/Nim/issues/8212 disbot: ➥ we need a standard way to get name of procedure ; snippet at 12https://play.nim-lang.org/#ix=25Yt djazz: something that can be used like repr(), not current function Yardanico: oh right, it's easy then Yardanico: or hmm Yardanico: I think there's a way but I forgot it :( PMunch: Hmm, with an ordered table is there a way to go through the keys bacwards? Yardanico: well in projects I just iterated over the table (the normal one though) to find that key (i know it's not the best but i don't know any other easy way) Rika: prolly something to do with a macro regarding getting function name PMunch: Something like this works: https://play.nim-lang.org/#ix=2dT6 PMunch: For compile-time though Yardanico: I think that's what @djazz needs Yardanico: since you can't change function names at runtime anyway :P PMunch: Could need a touch more checking and such though PMunch: Well he might've wanted to get the name of a registered callback for example PMunch: But in that case you would have to store the string name along with the callback, so you would still need a macro like that djazz: hmm, while that works when passing the proc directly, it does not work in my proc that recieves it callback proc: Error: cannot get child of node kind: nnkNilLit djazz: the repr looks like this for it: [Field0 = 0x55b16b31ccf8, Field1 = nil] Yardanico: I'll try to fix it now Rika: use treerepr for macros 😛 PMunch: Wait, what are you trying to pass? djazz? PMunch: That looks like a tuple djazz: I'll see if I can make an example djazz: PMunch: https://play.nim-lang.org/#ix=2dT8 PMunch: Yes, as I said you would need to do something like this: https://play.nim-lang.org/#ix=2dTa djazz: ah, I see PMunch: Procedures don't really have the same names at runtime PMunch: It would theoretically be possible to use the function pointer and look in the symbol table of the binary to get those names PMunch: But you probably don't want to do that :P djazz: thanks, it works ^^ now i just need to make unnamed procs empty strings axion: How can I print the real time of executing a body of code N times? PMunch: Possibly by using something like this? https://github.com/winksaville/nim-benchmark Yardanico: PMunch: it's very old though PMunch: I mean you can also just use the `times` module and a for loop.. PMunch: Oh, didn't realise that was 5 years old.. djazz: there https://play.nim-lang.org/#ix=2dTi thanks again PMunch! PMunch: No problem :) PMunch: This is the kind of stuff that's fairly simple once you've done it once or twice, but is almost impossible to google :P PMunch: Anyone going miss any of these node kinds if I don't include them in my macroutils package? nnkNone, nnkType, nnkComesFrom, nnkDotCall, nnkHiddenCallConv, nnkVarTuple, nnkObjConstr, nnkCurlyExpr, nnkPragmaExpr, nnkCheckedFieldExpr, nnkLambda, nnkDo, nnkBind, nnkClosedSymChoice, nnkOpenSymChoice, nnkHiddenStdConv, nnkHiddenSubConv, nnkConv, nnkStaticExpr, nnkHiddenAddr, nnkHiddenDeref, nnkObjDownConv, nnkObjUpConv, nnkChckRangeF, nnkChckRange64, nnkChckRange, PMunch: nnkStringToCString, nnkCStringToString, nnkFastAsgn, nnkImportAs, nnkPragmaBlock, nnkParForStmt, nnkStmtListExpr, nnkBlockExpr, nnkStmtListType, nnkBlockType, nnkWith, nnkWithout, nnkTupleClassTy, nnkPattern, nnkHiddenTryStmt, nnkClosure, nnkGotoState, nnkState, nnkBreakState, nnkTupleConstr disruptek: uh, what? PMunch: Huh? Araq: nnkObjConstr is important disruptek: what does your package do? disruptek: all nodes are important to writing nim. that's why they are there. PMunch: disruptek, so far it allows you to create NimNodes and access their fields more intuitively. disruptek: well, maybe you can get away without a few... but, certainly imports. PMunch: Well, those are the ones I haven't been able to figure out what are, or what fields they have disruptek: curlies, pragmas, ... disruptek: dot call is pretty critical, i think. disruptek: lambda and do and blocks could facilitate some really interesting use. PMunch: Araq, ah ObjConstr definitely needs to be added PMunch: disruptek, well I have DotExpr, not sure what the difference is.. PMunch: Doubt anyone would be creating this: https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim#L69-L71 disruptek: yeah, i confused the two. PMunch: Can't really create a do either PMunch: dumpTree just reports it as a call with two StmtList parameterers PMunch: Parameters* PMunch: Just to be clear, I've done most of the nodes: http://ix.io/2dTn/ disruptek: i kinda like how the vscode blame line is in the editor's statusbar. Araq: stupid question ahead, how do I create PRs again? Araq: I forked the repo, pushed my change, now what? disruptek: push to your branch. disruptek: git will give you a github link, or visit your fork on the web. Yardanico: Araq: https://github.com/status-im/nim-chronos/compare/master...Araq:master Yardanico: that link is on "https://github.com/Araq/nim-chronos" under green clone button Araq: thank you! disruptek: what do i do with ptr types that have no sons? Araq: these can only be typeclasses Araq: in other words it's either a bug or "yet more generics" disruptek: okay, i will figure them out. Kiloneie: Does anyone have a better way of doing this ? Kiloneie: https://ibb.co/99KdsVz Kiloneie: Seems fine for now idk, just looking for any suggestions Araq: seems ok, in general I would focus more on stdlib operations and then explain the language features as you go along Araq: but it's a different approach Kiloneie: im making this so i don't get into the hassle i am right now where i don't really know what all i have covered by just glancing at the titles i have my my OneNote and video titles Kiloneie: I can't afford to start teaching something when one of the components for that video is missing djazz: If I don't want to type the full type description everywhere I want to use it, like a static string of the type, what should I do? I tried to set it as a type: MyType = proc(...)... but then it won't accept input with same signature Yardanico: it should work, how did you specify the type? Yardanico: also don't forget {.closure.} djazz: `Middleware* = proc (ctx: Context, next: Next = nil): Future[void] {.closure, gcsafe.}` flywind: use {.nimcall.} djazz: nimcall? djazz: anyway, i get this error: `required type for callback: Middleware but expression 'logger' is of type: proc (ctx: Context, next: Next): Future[system.void]{.gcsafe, locks: .}` djazz: also, = nil does nothing djazz: so i have to use two types >_> Kiloneie: Also @Araq yeah my goal is to cover the entire language with minimal stdlib usage and then make videos with heavy stdlib usage, something like that. PMunch: djazz, might be because it's not a closure? Araq: Kiloneie: what software did you use to produce the table? Araq: I like it Kiloneie: Xmind Zen Kiloneie: Xmind 8 is a ton more feature full, but my god is it slow Kiloneie: it's trial version, but i think the trial lasts like 2 years, i see 322 days left on the top and it's been on my computer for like a year, and you can easily renew that. alexander92: so guys djazz: removed closure, same error alexander92: asserts in libs alexander92: what do you think Zevv: never alexander92: i am putting many "this shouldnt happend => quit 1" checks in one of mine alexander92: but i am not sure where is the boundary xflywind: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e67ad5fd17593652b757d5e] alexander92: zevv but if there is a bug? just return/raise a good error ? disruptek: wut? disruptek: assertions in libs? why not? Kiloneie: This is Xmind 8 ancient mind map i made back in highschool, like 6 years ago Kiloneie: https://ibb.co/NZrN6MJ disruptek: an assertion isn't an error. it's an error on the part of the original developer. alexander92: my assertions are not exactly similar, as they are just a template bug(message: ..) which works the same way in release as in debug xflywind: Default proc Type is {.closure.} in Nim @djazz alexander92: disruptek i mean yeah stuff like "gdb action => here we didnt finish this op at all, so we're in a random place => somethings very wrong" PMunch: Why is :tmp undeclared here: https://play.nim-lang.org/#ix=2dTG alexander92: i guess one can recover from many of those though alexander92: if given context disruptek: i say use assert. alexander92: or a "reset" one PMunch: Oh damn it.. djazz: huh, got it working now, sorta djazz: i had to duplicate a template, so instead of using callback: Middleware|MiddlewareSimple, i had to make one that does each djazz: one for each* PMunch: Yay, got it working. Another teaser for what will now be possible: http://ix.io/2dTK/nim PMunch: That would generate code that prints out "someproc" and "hello world". alexander92: nice Lantos: Nice djazz: I want the `next` parameter to be optional, here are my types: https://github.com/daniel-j/koan/blob/master/src/koan/types.nim#L35-L36 and here are is where incoming middleware callbacks arrive, and get converted from simple to normal if needed. https://github.com/daniel-j/koan/blob/master/src/koan.nim#L11-L21 djazz: use() gets called here https://github.com/daniel-j/koan/blob/master/example.nim#L9-L15 Rika: whats the issue? djazz: code duplication (: alexander92: web framework! nice. Kiloneie: I said imma do 4-6 minute videos now(looks at all the stuff i gotta cover on Modules... D:) djazz: thanks for the star! djazz: stars* alexander92: no problem, interesting to look! alexander92: we need more framework stuff like crystal disruptek: ~stream disbot: stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek krux02: disruptek, visually very appealing. I can't listen though. I am currently in a library. krux02: and no headphones reversem3: does it matter what paste we use ? krux02: you mean like pastebin or ix.io? nothratal: what exactly should this return? ⏎ ⏎ ```x[pos ..< ^1]``` [https://gitter.im/nim-lang/Nim?at=5e67bcda47b42479253b0902] krux02: reversem3, nobody here tries to push you towards a spacific code pasting service, uslike the python channel :P reversem3: kk krux02: nothratal: Currently that returns a copy of that slice of the string/seq reversem3: indentation error http://pastebin.ws/36z85z nothratal: @krux02 but how is the range of the slice? I dont get what '..< ^1' means krux02: it means until the end krux02: ^1 basically means `x.len-1` Rika: https://github.com/de-odex/linenoise-nim its here now, still dont know what the potential use for this is krux02: ^2 means `x.len-2` etc. nothratal: ...and what does ..< mean? Rika: why use ..< then also ^1??? krux02: but ..< is an exclusive upper bound range Rika: n..

Hello world on it disruptek: maybe i'm the idiot, though. Elegant Beef: disruptek earlier you said import the type, how does one do that? Or was that you compressing your cheak with your tongue? Elegant Beef: cheek* disruptek: pick the smallest possible set of units. put them in a file. disruptek: create a new file that imports the first. disruptek: goto 1. treeform: disruptek, IE might be using some OS features not counted in the thing. I never used IE so I don't know how bloated it is. IE11 was a full rewrite though. treeform: Mabye IE 11 did not have time to accumulate cruft. disruptek: i mean, you might be right. disruptek: i could be showing my age. Araq: I have 23 tabs open and 40 Chrome processes Araq: taking up 3GB Araq: maybe

Hello world

isn't the best benchmark for its overhead treeform: But the tabs have Images and text. treeform: Images are huge when unpacked for the GPU to use. disruptek: i run a -march=native build of chromium and all its dependencies, from scratch, according to my hardware and available software. treeform: I don't know if 23 Fidget programs full of images and text could beat that? disruptek: it's wickedly fast and still takes a few gigs of memory. kaushalmodi: leorize[m]: I'll need to change a lot of code for that Araq: 3 tabs of my VSCode take up 300MB kaushalmodi: so I need to replace `{.exportc.}` with `{.dynlib.}`? kaushalmodi: or `{.exportc.}` with `{.exportc, dynlib.}`? Araq: the latter if you build an .so kaushalmodi: ok.. trying that out disruptek: just shared memory is 150meg for chromium. leorize[m]: @kaushalmodi: perks is that it will work on windows kaushalmodi: leorize: Thanks! That worked! leorize[m]: no, exportc and dynlib kaushalmodi: ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e471c90d56ddb68a4a6befe] leorize[m]: yea, the no dynlib but things are exported was a bug leorize[m]: the spec said you need dynlib, but didn't enforce that on *nix leorize[m]: though probably I should PR in a changelog too, given how users might not notice this kaushalmodi: > though probably I should PR in a changelog too ⏎ ⏎ +1 ⏎ ⏎ I was going to suggest that [https://gitter.im/nim-lang/Nim?at=5e471d0925f1d250fed8f021] kaushalmodi: it will be a pretty serious breaking change kaushalmodi: It should be in bold or something Araq: agreed Araq: and leorize[m] is right, now it works as it was supposed to work :-) disruptek: nice. treeform: I think I can lower the memory use by not using openGL. But using platform native CPU only drawing commands. Elegant Beef: hey i now have adding and removing Elegant Beef: 😄 Elegant Beef: Well 0 clue how performant this is Araq: treeform: fwiw my NimEdit had comparable overhead with "Aporia" (a GTK application) too kaushalmodi: Araq, leorize[m]: Thanks. Thankfully this change is backward compatible too Araq: around 20MB kaushalmodi: now I need to `sed` few dozen files .. Araq: and I blamed SDL2 Elegant Beef: apparently writing roughly 4,000,000 strings to the console takes some time Araq: kaushalmodi: use nimgrep instead Elegant Beef: Well with 400k it takes a second roughly per tick leorize[m]: @Elegant Beef: that's pretty much expected Elegant Beef: That was more of a joke then anything kaushalmodi: Araq: I never used nimgrep because I am comfortable with sed and rg Elegant Beef: Not like i have a very viable test of this ecs considering i lack something to run it in kaushalmodi: will have a look at that soon Elegant Beef: So for the components, i think using a macro to make them makes more sense but idk disruptek: probably, yeah. treeform: Araq, wow GTK + SDL + your app is only 20MB? kaushalmodi: leorize: So when would one use just `.exportc.`? kaushalmodi: If the symbol doesn't get exported when just that pragma is used, when what's the point? kaushalmodi: s/when/then leorize[m]: I do know an use case for the compiler codegen kaushalmodi: ok (that's out of my reach then :) ) leorize[m]: compiler procs are exportc-ed then called via codegen by inlining the exported name treeform: Araq, Nimx is also 35mb... treeform: I need to figure out how to get it to only 20mb. treeform: get my thing* disruptek: treeform: how does this 35mb compare to other nim guis? kaushalmodi: leorize[m]: I couldn't help think.. shouldn't exportc implicitly do dynlib too? kaushalmodi: for the few cases where that should not happen, that's where you require a second pragma kaushalmodi: now I have a huge diff of 200+ changes that changes `{.exportc.}` to `{.exportc, dynlib.}` disruptek: argh. 🙁 leorize[m]: @kaushalmodi: that doesn't sound too bad, though adding yet another pragma might not be too appealing clyybber: disruptek: (lol)[https://github.com/ulfjack/ryu/blob/master/third_party/double-conversion/test/cctest/gay-shortest-single.h] kaushalmodi: leorize[m]: from my perspective, it looks like: ⏎ ⏎ 1) most of exportc's use requires dynlib too, so may be exportc should automatically behave as if dynlib was used ⏎ 2) dynlib can then be deprecated ⏎ 3) a new pragma.. `.local.`? would then export the symbols locally instead of globally [https://gitter.im/nim-lang/Nim?at=5e47233246e99d431f790227] kaushalmodi: essentially default exportc to do global exports as before and introduce a new pragma to specify local exports disruptek: what am i looking at? disruptek: a crappy c header? clyybber: a funny file name clyybber: at least when you are 10-yo disruptek: ah disruptek: gay is the author of another algo. disruptek: isn't he? clyybber: yeah, think so disruptek: you think he's gay? kaushalmodi: leorize[m]: I need to sign off, but we can continue our discussion on https://github.com/nim-lang/Nim/issues/13416#issuecomment-586505903 disbot: ➥ [devel regression] {.exportc.} tagged procs no longer export to compiled .so objects ; snippet at 12https://play.nim-lang.org/#ix=2bJM clyybber: disruptek: Fo ssure clyybber: disruptek: Btw, I'm porting ryus table generation code to nim clyybber: so we can generate the tables at compile time disruptek: this is the generic version, right? Araq: btw my concern for code size was serious clyybber: disruptek: Nope clyybber: Araq: Ok, I'm still doing this. Maybe I get it managable Araq: would be a shame to add 4kb for $myfloat clyybber: Yeah clyybber: I agree disruptek: that's why the one that goes in has to be the nim one. clyybber: hmm clyybber: maybe its best we port a non-microoptimized to hell algorithm clyybber: that accomplishes the same task disruptek: that's what leorize is doing. clyybber: no? disruptek: afaik, yes. clyybber: or is he disruptek: i've tried to explain this. clyybber: I thought he was trying to reimplement ryu from scratch disruptek: he is. disruptek: he's trying to create the idiomatic implementation. clyybber: glhd :p clyybber: *glhf Elegant Beef: good luck have dumb is nicer disruptek: well; because it has to slot into the compiler. clyybber: get low high dumb clyybber: disruptek: I know. I'm working on nimifying it too clyybber: And I can remove the tables in this version too clyybber: and replace them by runtime calculations disruptek: okay. sorry if i gave you the wrong idea. clyybber: its still gonna be faster than what we have I think clyybber: disruptek: ? What wrong idea? disruptek: i mean about what we were trying to do with the ports. clyybber: Ah sure clyybber: I think its just easier working from messy but working to clean and working clyybber: I'm a cleanup guy clyybber: it makes me feel all cozy clyybber: maybe I should be janitor Elegant Beef: You be the janitor and ill be the guy that dumps the cola on the ground clyybber: haha Elegant Beef: My shitty ECS for instance 😄 Elegant Beef: Go add macros and make it clean disruptek: i think that just means you optimize the expression of an algorithm that makes less sense than a reformation of same with all-new semantics, etc. Elegant Beef: Ill be here with more cola clyybber: disruptek: Why do you think we can beat ulfjack? disruptek: that's not the point. disruptek: the point is an idiomatic impl that meets the needs of the compiler and runtime. clyybber: yeah disruptek: no one wants to have to touch this code for a long time. clyybber: its not like you can't arrive at an idiomatic implementation with my approach disruptek: so let's make it so dead stupid nim that it never needs fixing. clyybber: in fact that *is* what I am trying to do disruptek: okay; but you have to admit that you're starting from the wrong end of the field. clyybber: no clyybber: I'll show you :p disruptek: you're on. clyybber: better than hacking at it just to overfit to the tests clyybber: its also more fun clyybber: detecting complicated patterns clyybber: and simplifying them disruptek: yes, those patterns may not be a means to the idiomatic ends. disruptek: you could be optimizing a quirk of the c impl that doesn't exist in nim. disruptek: so you're wasting your time, or misvaluing it at least. clyybber: we'll see disruptek: in any event, you're thinking about the problem with the wrong abstractions. disruptek: ie. the ones we care about are the nim ones. disruptek: but you're mired in c. clyybber: C vs Nim semantics don't change a single thing about maths disruptek: no, but the point is not math. clyybber: but thats whats behind the curtains disruptek: the point is to paint a picture using the same palette. clyybber: everything else is just fluff clyybber: disruptek: No you change the palette clyybber: then you notice with the new palette some faces are now the same color disruptek: i hate that. clyybber: then you join them clyybber: in the end clyybber: you are left with the bare minimum differently colored faces required to get the idea across disruptek: you're assuming that their solution is part of the same graph of ours. clyybber: well clyybber: they wrote a paper disruptek: that's just immediately, obviously, wrong. clyybber: they proved it correct disruptek: yes, but how we arrive at the same "correct" result is our problem. clyybber: they proved the implementation correct disruptek: we might benefit from writing more nim as if it's an advertisement for the language. clyybber: not the specification disruptek: it doesn't really matter because for the purposes of this argument, we're assuming that we're implementing whatever contract their implementation suggests. clyybber: how do you verify that contract? clyybber: through tests disruptek: fine. disruptek: so what? clyybber: and I do not want to change the underlying math disruptek: look, when you practice animal taxidermy and the animals are still alive and sway their legs and shit... clyybber: ok so your point clyybber: is clyybber: start with a broken implementation clyybber: lol disruptek: you learn pretty quick that it helps to sew the leg on wear a previous leg was already pre-existing. disruptek: these bits mate up nice. clyybber: eh disruptek: we need hot nim-on-nim action here. clyybber: we need nim based on existing working code and maths clyybber: and algorithms clyybber: which are proven to be correct disruptek: which just means passing tests. clyybber: not nim based on overfitting tests clyybber: disruptek: No, because the tests don't test everything clyybber: also I think its easier to arrive at the desired outcome by going top-down clyybber: rather than bottom-up disruptek: i think i can take my chances on this one. disruptek: you forget that i've seen the code, maybe. leorize[m]: well it's certainly possible to create idiomatic ryu from c-ryu leorize[m]: my nim-ryu is a sort of personal research project so I could grasp the inner workings of floats better leorize[m]: a nice looking and documented implementation is just a side effect disruptek: i think i finally understand convertors. disruptek: they give you a way to grandfather an interface used by an earlier type. disruptek: so you can evolve your types without losing functionality. disruptek: is type versioning a good idea? Araq: it has "type" in it, so yeah gogolxdong: How to make nlvm targeting x86? Araq: no idea dom96: Araq, have you ever looked into any emscripten segfaults? clyybber: yeah clyybber: disruptek: This is getting ridiculus: https://www.diffchecker.com/GsWkt8au clyybber: right side fails clyybber: left side workds clyybber: wtf clyybber: ah damnit clyybber: a stupid fucking precedence error clyybber: I knew it dom96: ahh, how fun. Emscripten doesn't seem to like the @ in the .c files that Nim now generates disrupteq: clyybber: i thought it was working? clyybber: now it works clyybber: disruptek: It was working when I manually patched the C clyybber: now it works everywhere disrupteq: yay clyybber: I accidentally translated (uint64_t)some * other to uint64_t(some * other) clyybber: which should be uint64_t(some) * other disrupteq: ah yep. clyybber: now I'm gonna try d2s clyybber: did you already do it? disrupteq: i dunno. probably. clyybber: does it work? disrupteq: i haven't tested it since krux's fix. clyybber: krux' fix is live disrupteq: but there are only a couple tests broken by it. i think it's likely fixed. disrupteq: i'm watching a car accident victim right now. cannot be bothered. clyybber: oh shit what happened? disrupteq: kinda cute in a puppy-with-a-crushed-head way. clyybber: aww no clyybber: disruptek: Pet him from me will ya? disrupteq: it's a journalist on telly. disrupteq: i'll wave at her for you. disrupteq: actually, i think it wasn't a car. clyybber: oh Hippo: Does the stdlib still work if you turn off the nim gc? Rika: Some, not all dom96: It's 1am, but I'm so close to getting my game to compile with emscripten Hippo: So I guess I need the soft realtime gc to make sure everything is working? Is that faster than go? Rika: From old benchmarks it is Rika: But it's best if you test it yourself Rika: My experience says yes Rika: And also ar(a)q is developing a move based gc or smth Rika: Which should be even quicker Rika: I think. Hippo: gotcha Hippo: would do you think of using nim for game dev specifically mobile clyybber: @Hippo You can use --gc:arc Hippo: my plan was to compile to c and then use some c toolchain to generate mobile binaries clyybber: Its no GC clyybber: its more like RAII clyybber: plus pure refcounting Hippo: ooh cool clyybber: its what we are currently working on a lot clyybber: so when you intend to use it you should use #devel Rika: It's the one I mentioned Rika: Just vaguely Hippo: so what about game dev, is nim suited for this? Varriount: Undefined behavior? Elegant Beef: Nim doesnt include interfaces, which i tend to use a lot for gamedev, but it seems like it's good for gamedev to me Elegant Beef: just need an engine 😄 Tanger: There's bindinggs for the godot engine: https://github.com/pragmagic/godot-nim Elegant Beef: I mean a good engine Tanger: Haha XD Hippo: yea i dont mind not having a game engine just hoping there are more success stories. I saw one blog post that shipped a game to ios/android Hippo: also nim can probably interop with c/c++ im guessing just dont know if there is a performance hit Elegant Beef: I've been sitting on making a nim engine Elegant Beef: Using bgfx for graphics, sdl for window making, and then an ECS backend system with a relatively minimalistic UI engine 😄 Elegant Beef: Using bgfx for graphics, sdl for window making, and then an ECS backend system with a relatively minimalistic UI editor 😄 Hippo: I found a nice c lib called sokol recently that does most of that Hippo: its pretty lit Hippo: has a bunch of target backends Elegant Beef: i mean bgfx is probably good enough Elegant Beef: It's more a matter of me getting around to making this clyybber: @Hippo Yeah, its good Elegant Beef: Someone already has bindings for it clyybber: There is no performance hit for c/c++ interop Elegant Beef: cllybber arent you working on a nim engine? clyybber: @Elegant Beef godot isn't bad clyybber: @Elegant Beef Yeah Elegant Beef: look at gles then say that again 😛 clyybber: well clyybber: its getting a vulkan renderer Elegant Beef: still gles based shader language clyybber: but yeah, I don't like some of their decisions Elegant Beef: Im an hlsl/CG man because of unity 😄 clyybber: or directions clyybber: @Elegant Beef I'm an do what you want, if you can compiler it to SPIR-V :p clyybber: guy Elegant Beef: ah a man of wisdom aswell i see Elegant Beef: VK or broke in 220 Elegant Beef: VK or broke in 2020 clyybber: but in theory I prefer hlsl over glsl too clyybber: in practice I want to use nim tho clyybber: which is possible btw Elegant Beef: For shaders? clyybber: Yeah clyybber: https://github.com/yglukhov/nimsl Elegant Beef: I mean just convert it to GLSL or HLSL Elegant Beef: it's not difficult i guess clyybber: Yeah clyybber: thats what the above does clyybber: https://github.com/krux02/opengl-sandbox clyybber: is for everything around opengl Elegant Beef: There are bgfx bindings but they seem semi old clyybber: @Elegant Beef Use these: https://github.com/zacharycarter/bgfx.nim Elegant Beef: Hey i said i was contemplating Elegant Beef: *Let's make it together* 😄 clyybber: An engine? Elegant Beef: yea clyybber: sure clyybber: I'm using vulkan tho Elegant Beef: I was mostly kidding clyybber: he clyybber: @Elegant Beef zachary is working on his own game/engine: https://github.com/zacharycarter/zeal clyybber: I think hes not pushed his recent changes tho clyybber: hes around sometimes disruptek: oh, i was wondering if it was published. clyybber: disruptek: Yeah he seemed to have some pretty cool progress disruptek: yeah, it's awesome to see it evolving. disruptek: i would love to get into game programming. disruptek: so i don't see krux's patch in the commits. Elegant Beef: I've primarly done game programming so i barely know how to do anything outside it clyybber: disruptek: I meant live as in PRed disruptek: yeah, i get #nim delivered straight into my brain. krux and i spoke of it. disruptek: i'm thinking about a tiny app that works kinda like my irc window, actually. disruptek: the bot emotes notifications to wayland, i summon irc with a key and cast it away with another. disruptek: this other app would watch kitty windows and then i could summon them with a code-grep. disruptek: like skim or ripgrep or fzf or whatever. disruptek: i think either i watch vim or i watch kitty; shouldn't be a problem to use either as input. or even both. disruptek: maybe i just want that for all windows. fzf'ing their memory would be neat, too. clyybber: wait clyybber: you do not have vim inside kitty? clyybber: you use gvim???? disruptek: nope. clyybber: aight disruptek: scrollback is easy to get, so i'll start with that. but i think i want vim buffer data too. clyybber: kitty seems very cool to me clyybber: but the combination of python and C just screams for nitty silvernode: when specifying a type and trying to assign a variable of type array or seq I get a context error disruptek: honestly, i've been waiting a long time for software that doesn't piss me right the fuck off. clyybber: silvernode: Hmm, can you make a snippet to repro? disruptek: kitty has been among the worst of the software i use. but, that said, it's pretty great compared to software i've used in the past. clyybber: oh clyybber: I never used it clyybber: but it *seems* cool clyybber: alacritty is fine for me rn tho clyybber: but kitty seems a bit cooler clyybber: except for the fact that its written in python + c disruptek: i think alacritty will win, and should win, but a year ago it was kitty's game. clyybber: alacritty is pretty dead clyybber: it has no real active development disruptek: really? i thought there was a recent release. clyybber: yeah clyybber: but its mostly bugfixes disruptek: what's bad about that? clyybber: nothing silvernode: working on a gist clyybber: I mean its in maintenance mode disruptek: maybe a 1.0 release is expected. clyybber: but some work on the pinned issues would be nice clyybber: I should do it sometimes disruptek: man, they only have 355 tickets. disruptek: this project has 20,000 stars. disruptek: !repo alacritty disbot: https://github.com/alacritty/alacritty -- 9alacritty: 11A cross-platform, GPU-accelerated terminal emulator 15 20545⭐ 973🍴 7& 29 more... disruptek: and quite a bit of cutlery. madprops: would nim having something built-in to "substring" a seq or string, like (0, 100) would work in something with 8 items, would be too high level and thus not included clyybber: Huh? disruptek: lol clyybber: You can do [0..100] Kingherring: please defend nim from this "influencer" https://www.youtube.com/watch?v=DCfDLWfPqiA clyybber: oh god clyybber: influencer is a virus clyybber: this whole influencer thing should just die clyybber: not to mention the article on medium is complete bullshit clyybber: so sad silvernode: https://gist.github.com/silvernode/003571ac561211212fecd35208762f72 madprops: clyyber: https://play.nim-lang.org/#ix=2bAZ clyybber: madprops: Well of course it does?? clyybber: Its out of bounds silvernode: I am really new to types and seqs madprops: yeah, im wondering if there's something that would just use the lower index number if the second arugment is too big madprops: like how js uses substring madprops: also this video is a python tutorial clyybber: madprops: Ah clyybber: You can make your own clyybber: you mean wrap around right? madprops: is something like this not standard because it's too slow? silvernode: invalid type: 'T' in this context: 'Ship' for var silvernode: that's what I get in that gist clyybber: silvernode: Your cargo has to be seq[SomeType] silvernode: ah ok that makes a lot of sense silvernode: I am just missing the type there Rika: People be like “eh?? Nim? What the fuck is that?” until 2 years from now where either Nim flourishes or dies out Rika: Honestly think we just need more people to know of Nim disruptek: this guy is an idiot. clyybber: no clyybber: Nim doesn't flourish or die clyybber: thats not how this works clyybber: how would it "die"? disruptek: there are too many new programmers being minted every day. clyybber: yeah Rika: Well, if somehow everyone just loses interest, but of course that’s practically impossible Rika: It’s not an impossibility though is what I’m saying clyybber: tbh, I fear some people madprops: nim gets mentioned ocasionally on 4chan Rika: I don’t like saying something that concrete about the future clyybber: madprops: ha, prolly cuz of solitude clyybber: @Rika Yeah, but in the same way C or C++ dieing is a "possibility" clyybber: if humanity dies Rika: That’s what I did say yes Kingherring: click that dislike button 😄 Rika: I don’t know, I have an odd thought process clyybber: heh madprops: look at D, it has been barely existing for years clyybber: good night peeps clyybber: madprops: It exists pretty persistent tho disruptek: this guy has 150,000 subscribers and this video only has 4000 views. clyybber: even gcc Rika: Still, I think the dude in the video forgot that basically all programming languages started out small too clyybber: eh, these people. They don't create anything Rika: Not basically all, literally all, sorry clyybber: they are busy influencing Kingherring: make pro nim comments Kingherring: nim gang uprising Rika: Ugh the comment section is also annoying to read in that video disruptek: is this really what us old guys look like? blueberrypie: most nim references on 4chan is from one very persistent shill (yeah I know who it is). not a good metric silvernode: What would I use if I wanted to print out the contents of a seq from index 0 to the end? I just want to format the cargo on the ship so it prints out nice in an echo statement leorize: for i in seq_goes_here: gogolxdong: nlvm `Error: internal error: compiler proc not found: nlvmRaise` disruptek: but seriously. we need some more software that could only have been built in nim. leorize: anyone wanna make function multi versioning in Nim? leorize: basically it's that the function can dispatch on runtime to a version optimized for the current processor leorize: (ie. you wrote sse code, but you only want that to be used when the code is running on an sse-capable processor) disruptek: ugh. disruptek: that's a neat feature but irrelevant to my oss world. silvernode: leorize: I tried a for loop but I don't want my formatting to be in that scope. leorize: the biggest use case would be to let us easily write optimized code in our stdlib for example leorize: silvernode: well I'm not sure what you're trying to do then leorize: the olde index < seq.len while loop still exists for the more complicated cases silvernode: leorize: basically have the echo lines outside of the scope of the for loop and still be able to access the interation silvernode: or just not use a for loop at all silvernode: I can print out just index 1 which works fine but I want to print out the whole list without a loop leorize: that's impossible silvernode: just wanted to make sure it is impossible disruptek: why is it impossible? silvernode: figured as much leorize: disruptek: how can you print a seq of arbitary size without looping through the elements? silvernode: I thought there was a function that can print from the beginning to the end of the index leorize: !eval echo @["like", "this?"] NimBot: @["like", "this?"] silvernode: I just don't want the symbols to be printed out with the contents of the seq leorize: !eval for i in @["like", "this?"]: stdout.write i, " " NimBot: like this? silvernode: yeah disruptek: how many ships do you know with arbitrary cargo size? silvernode: echo(fmt"{player.name} has the following items in cargo: {ship1.cargo}) which will print all the symbols in the cargo which I just want the names of the items in cargo printed. silvernode: disruptek: so far just one ship is created leorize: silvernode: make your own `$`? leorize: or whatever it is that's used for strformat silvernode: Not sure I understand exactly leorize: or just: ship1.cargo.join(", ") leorize: assuming all strings silvernode: yeah all strings in the cargo silvernode: at least for now leorize: !eval import strutils; echo @["item1", "item2"].join(", ") NimBot: item1, item2 silvernode: I am eventually going to try figuring out how to have a proper inventory of items where I can have a stack of fuel or something. silvernode: I figure a small text game will help me learn since I can't hold my attention span just reading the book and learn from that shashlick: @leorize - https://github.com/nim-lang/Nim/issues/9419#issuecomment-585527016 disbot: ➥ httpclient -d:ssl and db_postgres incompatible and cause SIGSEGV! (MacOSX) ; snippet at 12https://play.nim-lang.org/#ix=2bwr leorize: shashlick: do you have libssl.so in /usr/lib? shashlick: yes libssl.dylib shashlick: get this though - Undefined symbols for architecture x86_64 shashlick: wondering if those dylib are 32bit or something leorize: maybe, do you have those in /usr/lib64? shashlick: there's no such dir on the mac leorize: then I'm not so sure, maybe try searching online? leorize: I've never worked with a mac leorize: my knowledge is pretty theoretical there shashlick: ya people struggle with openssl on it shashlick: cmake cannot find it shashlick: anyway, i have a fix for choosenim so gogolxdong: nlvm `Error: internal error: compiler proc not found: nlvmRaise` leorize: gogolxdong: you'd need to ping nlvm author for this, I believe they are on gitter leorize: so I spent 2 days reading ryu paper + a lot of wikipedia pages leorize: it results in only 13 lines of code leorize: and I still haven't finish implementing the basic converter in that paper leorize: I don't know what to expect when I actually implements ryu disruptek: leorize: i have a pretty good idea of what to expect. leorize: you finally cracked the c-ryu? :P disruptek: no, i got to the point where it failed and so did clyybber. disruptek: you have a pretty good shot at failure. disruptek: 13 lines sounds good so far, though. leorize: !repo alaviss/nim-ryu disbot: https://github.com/alaviss/nim-ryu -- 9nim-ryu: 11An implementation of the ryū float-to-string conversion algorithm. This version is written from scratch based on the paper. 15 0⭐ 0🍴 leorize: it's basically empty atm leorize: but at least you can see my progress of deciphering that paper :P leorize: I'm also learning how float works as it goes too disruptek: leorize: i think we should support sign more naturally. leorize: disruptek: not sure how you'd do that though disruptek: for example, why are -inf and inf peers of -0 and 0? shashlick: disruptek: https://github.com/nim-lang/nimble/issues/760 disbot: ➥ Nimble ignores nim.cfg? leorize: disruptek: I still don't know what you mean :P disruptek: i'd rather have a set of {inf, negative} than negInf. leorize: ah, I thought about that leorize: but then there's {inf, nan} leorize: not a fan leorize: or I can just use isNegative and remove all Neg variants disruptek: why would that be something you'd want to use? disruptek: x.isNegative can be a template for `neg in x.flags`. disruptek: the point isn't to compose a float as {inf, nan}; that can be denied if it's important. the point is to actually use the values naturally. leorize: or I can just overload `< 0` :P leorize: do I even have to actually :P disruptek: there's obviously value in not throwing away the type, so i'd say yes. disruptek: looks good so far, even if it's > 13 lines. 😉 disruptek: shashlick: i dunno anything about that nimble issue. shashlick: disruptek: it was a conversation between you and dom96 shashlick: Regardless, I could nimble install nimph with zero issues Elegant Beef: You can override any operator in nim right? krux02: you can declare arbitrary oparator names krux02: something like +-+ is possible krux02: or ^-^ Elegant Beef: oh, that's awesome krux02: just call your proc `+-+` and you are ready to go krux02: I go back to bed Elegant Beef: buh bye Elegant Beef: Is anyone using nim in a professional setting? Since it's relatively new im interested in seeing it's current applications professionally Elegant Beef: Is anyone using nim in a professional setting? Since it's relatively newly released im interested in seeing it's current applications professionally shashlick: Status is the default answer Elegant Beef: huh? shashlick: https://status.im/ Varriount: Araq: "naming is one of the hardest things in programming" Araq: only if you care about quality. You can also simply use 'kill/man/cp' instead and turn it into a religious cult, it's been proven to work. livcd: anyone managed to compile nimpcre on windows? clyybber: disruptek: Hey, I got to the point where it works clyybber: @Elegant Beef There is also a company from mainland china using it clyybber: I think they make something like a raspberry pi clyybber: @timotheecour In you PoEval PR use cmd? clyybber: Depending on sh on windows is just stupid dadada: is nim's documentation available in the form of man pages? clyybber: I dont think so livcd: https://ybin.me/p/80cc4728a773b61e#ud8jwjn25NxbkwECcFo0nNoPxP+f5M3vyJmQAcmpp9M= clyybber: livcd: looks like space in path bug livcd: dont know where the bin/sh is coming from...i am on windows clyybber: Wth clyybber: does make try to execute bin/sh ? clyybber: or is it a nim bug livcd: more like the Makefile for nimpcre and some env settings Zevv: Did something recently change regarding detection of unused declarations? Zevv: I have a .XDeclaredButNotUsed. that used to work but now I still get warnings dadada: what was the reason for creating unsigned operators like +% and /% dadada: and against using something like unsigned(a) + unsigned(b) or unsigned(a + b) or unsigned(a) / unsigned(b) stefantalpalaru: Why is this invalid in a config.nims? `switch("warning[CaseTransition]", "off")` Rika: For when you have `lenientops` imported I'm guessing (dadada) stefantalpalaru: config.nims(1, 2) Error: invalid command line option: '--warning[CaseTransition]' alehander92: hmm alehander92: does it make sense to make `$` func-s alehander92: hm, not func-s but functions with `{.raises: [].}` alehander92: because like now you would expect an error from each &"" and $ alehander92: which is just not really useful alehander92: and imho `$` should be written in a way that it doesnt raise (except i guess in "defect" cases like no memory left etc) clyybber: dadada: Legacy dadada: alehander92: I agree Zevv: that makes sense Zevv: but that should enforce *any* implementation of $ to adhere to that I guess, since now I cna still write one that does throw alehander92: yep, but on the other hand thats probably not a big deal, or is it Zevv: '$' is nothing special from the languages perspective alehander92: like, if `raises` happens after overloads are resolved lqdev[m]: how can a ref object change its address? is it even possible? alehander92: it would only fail the check for such custom overloaded `$`-s Zevv: lqdev[m]: why do you ask? alehander92: so if that happens like i would i imagine, it should require mostly annotation to default `$`-s alehander92: without compiler hardcoding then Zevv: alehandr92: right clyybber: lqdev[m]: If you point it to another object Zevv: clyybber: that's cheating :) lqdev[m]: I'm figuring out a veeeery strange quirk with ref objects and sequences. for some reason, when I allocate an object in one proc, it's copied into a new object for some reason and does not preserve its old properties clyybber: other than that there is no way tho lqdev[m]: I might have to upload the code into a new repo clyybber: lqdev[m]: Yeah lqdev[m]: because it's hard to explain Zevv: you know the drill. Minimize your problem to a small sharable example Zevv: and while minmimizng, realize what you did wrong Zevv: so you don't need to share after all lqdev[m]: in this case, it's not so simple Zevv: *there* is your problem :) lqdev[m]: so I tried but this is how far I got https://play.nim-lang.org/#ix=2bD5 livcd: arrrgh i cant compile nimpcre lqdev[m]: and it does not reproduce the issue lqdev[m]: all right, so I have these Views: https://github.com/liquid600pgm/nadio/blob/master/src/gui.nim#L47 and later in the file you can see I'm assigning some keybinds to them lqdev[m]: however, later in the code when I actually need to reference these keybinds, the address of a given View changes and it does not have the assigned keybinds https://github.com/liquid600pgm/nadio/blob/master/src/gui/view.nim#L36 lqdev[m]: and I can't pinpoint to where the issue lies lqdev[m]: the address is fine in the main module, but it's changed in method onEvent lqdev[m]: I know that the event handler does not run on a separate thread or anything lqdev[m]: unless GLFW is playing tricks on me stefantalpalaru: I found a workaround, after reading commits pointing to https://github.com/nim-lang/Nim/issues/8739: `switch("warning", "CaseTransition:off")` disbot: ➥ [cmdline] [minor] `--hint.foo:on` as alias for `--hint[foo]:on`: avoids edge cases with `[` that needs to be escaped on cmd line + other places ; snippet at 12https://play.nim-lang.org/#ix=2bD6 dadada: https://nim-lang.org/docs/manual.html#types-array-and-sequence-types ... why is @[ needed for assigning to y, shouldn't the compiler be able to figure out that y was declared as a sequence and hence deal with the details implicitly? lqdev[m]: dadada: no, because `[]` is an array, and `@` turns a thing into a sequence. that's how types work. lqdev[m]: from my understanding, an operation like this https://github.com/liquid600pgm/rdgui/blob/master/src/rdgui/windows.nim#L38 should not deep copy the ref object, right? dadada: lqdev[m]: I know what types are, but there's also implicit type conversion, it's a design decision lqdev[m]: dadada: Nim prefers explicit type conversion where two types are incompatible with each other lqdev[m]: array and seq are not the same dadada: lqdev[m]: I know they're not the same ... Int16 and Int64 are also not the same clyybber: dadada: Yeah, you could make yourself a converter clyybber: And then there would be no need for `@` dadada: clyybber: that's good lqdev[m]: I'm such an idiot lqdev[m]: I just found the problem lqdev[m]: the events were getting received by the statusBar instead of the songView clyybber: lol lqdev[m]: and I didn't override onEvent for bars lqdev[m]: because Bars inherit from Views Zevv: and while minmimizng, realize what you did wrong Zevv: so you don't need to share after all Zevv: story of my life Zevv: congrats though, on finding the culprit! :) dadada: https://nim-lang.org/docs/manual.html#types-varargs dadada: for s in items(a): # wouldn't for s in a: be nicer? clyybber: Yeah clyybber: And it is done clyybber: items is inserted automatically when you do `for s in a:` dadada: great livcd: shashlick: can anyone kind try to install nimpcre on windows ?: D livcd: oops did not want to highlight him livcd: works fine on linux :F as expected livcd: ok so the /bin/sh problem was caused by Git in the path clyybber: hmm, but is the issue stemming from nim? shashlick: Hey livcd clyybber: if so please report it shashlick: Is it not working? livcd: clybber: i dont think so (well dont know yet) livcd: shashlick: i cant install nimpcre on Windows livcd: sec livcd: https://paste.ubuntu.com/p/dqgy2WVxmY/ livcd: i have the pcretest.exe in C:/Users/mscasny/nimcache/nimterop/nimpcre and also in the path shashlick: Are you cross compiling? livcd: nope livcd: i am just on windows shashlick: CI is working fine shashlick: https://travis-ci.org/genotrance/nimpcre/builds/649004790 shashlick: Do you have git in path? shashlick: It should have a working bash livcd: that was causing me some other issues livcd: https://ybin.me/p/80cc4728a773b61e#ud8jwjn25NxbkwECcFo0nNoPxP+f5M3vyJmQAcmpp9M= livcd: so i removed it shashlick: Yes that's a cmake issue shashlick: Cannot have spaces in the path shashlick: Which is why I reinstall git in another location shashlick: Just have bash in another location without spaces in the full path livcd: ah ok roger that shashlick: https://gist.github.com/genotrance/fb53504a4fba88bc5201d3783df5c522 shashlick: See travis.sh shashlick: I'll probably need to document this somewhere in nimpcre disruptek: nah, keep it as an easter egg. disruptek: it'll be fun to figure it out again every few months. livcd: /usr/bin/bash: ./libtool: No such file or directory what the heck xflywind: Hi, Whether exists a *cryptographic* random generator in Nim Std like Python? ⏎ ⏎ ```$ python -c 'import os; print(os.urandom(16))' ⏎ b'_5#y2L"F4Q8z\n\xec]/'``` [https://gitter.im/nim-lang/Nim?at=5e4561a2c900d747ab01be7c] clyybber: xflywind: Sure https://nimble.directory/search?query=random and https://nimble.directory/search?query=crypto clyybber: Also checkout https://github.com/cheatfate/nimcrypto clyybber: It is used at status for their ethereum client xflywind: @Clyybber Thanks.I will look at them later. clyybber: np Rika: @clyybber but technically they asked for something in the stdlib clyybber: oh clyybber: well, the answer is no then shashlick: livcd: still doesn't work? disruptek: no is a lovely answer. disruptek: today we make something ar4q doesn't want. Varriount: clubber: I used nimcrypto in my AWS signing code. It's nice mratsim: clubber xD disruptek: ~motd disbot: motd: 11Who wants to try JSON parsing modes via set[JMode] for a couple years? -- disruptek disruptek: ~motd is Opinions on the utility of a meowhash port? https://mollyrocket.com/meowhash disbot: motd: 11Opinions on the utility of a meowhash port? https://mollyrocket.com/meowhash clyybber: Varriount: Ah, cool clyybber: I'll club you tho if you call me that again :p clyybber: disruptek: I say do it! disruptek: i started to decided it would be too platform-centric. now i'm not so sure. disruptek: s/to /to, but / disruptek: ie. i think it's only worth it if we can use it for tables. disruptek: not sure it won't be a liability for js. Varriount: clyybber: I blame autocorrect and the fact that you have 2 y's in your nickname Zevv: Why do I still get a "declared but not used" warning here? https://play.nim-lang.org/#ix=2bDF Araq: because you should use .used Zevv: well, they are *not* used, technically disruptek: a random finally: block parses okay among other statements input to a macro, but a random else: does not. disruptek: is this a feature? Zevv: yeah disruptek: else is part of if but finally is not part of try? disruptek: finally, or except not. there is no try? Zevv: I say it's a bug, it should not parse indeed Zevv: grammar says nooo clyybber: disruptek: HHHAHAHAHAHHAAA clyybber: d2s finished clyybber: all tests pass clyybber: first try clyybber: Varriount: Fair enough 😄 disruptek: afaict, there's no way to add for/else or while/else without modifying the compiler. 😢 disruptek: i mean, to add them "properly." disruptek: you win this time, araqlogic. disruptek: clyybber: you spent too much time on that. disruptek: merge krux's pr please. clyybber: disruptek: eh, it was pretty easy clyybber: after I fixed the two dumb precedence errors clyybber: disruptek: Tell Araq, hes the merger. disruptek: > I ... cannot ... /dies/ clyybber: lol disruptek: who cares about a const in a test? clyybber: thats the blocker? clyybber: I could fix it real quick disruptek: i dunno. i suffered a parse error on line 1 of ar4q's comment. clyybber: semantic error here clyybber: Araq show us the *meaning* clyybber: (he's a busy god) Varriount: I*could* merge it in disruptek: no one was ever fired for fixing arithmetic errors. Varriount: But compiler code is usually under the this disruptek: oh wait Varriount: under the aegis of Araq disruptek: maybe araq died while reading the commit. disruptek: "the grail is in the tower of ... aaahrhrhrgggguhrggg" treeform: lqdev, are you still having issue with Cairo? Your error almost sounds like you have another cairo.nim somewhere on your path? treeform: Oh looks like you figured it out, some with with old version of cairo. Anyways if you have issues feel free to ping. shashlick: @treeform can you please review the updates in https://github.com/nim-lang/Nim/issues/9419 disbot: ➥ httpclient -d:ssl and db_postgres incompatible and cause SIGSEGV! (MacOSX) ; snippet at 12https://play.nim-lang.org/#ix=2bwr Araq: I died because there is yet another bug in int128 Zevv: you type well for a dead man Zevv: clyybber: where your ryu code at? disruptek: what's the other bug? disruptek: and is there a good reason not to merge this fix? treeform: shashlick, yeah I saw the updates. I don't have much to add. treeform: I added a thing `-d:sslVersion=x.x.x` I though I closed the issue as well... treeform: openSSL just sucks Varriount: Araq: Bikeshedding over naming aside, I really like your proposal for the chaining/outplace macros Varriount: As in, I can't remember when I was this interested in a new feature/addition Araq: woa livcd: shashlick: need to find the libtool shashlick: do you have cmake shashlick: if not you will end up having to install all autoconf tools on windows shashlick: nimble install cmake treeform: shashlick: I have added my thoughts: https://github.com/nim-lang/Nim/issues/9419#issuecomment-585902219 disbot: ➥ httpclient -d:ssl and db_postgres incompatible and cause SIGSEGV! (MacOSX) ; snippet at 12https://play.nim-lang.org/#ix=2bwr shashlick: thanks treeform disruptek: is cpp --gc:arc expected to worth without regard to exceptions? disruptek: s/worth/work/ Zevv: I believe it is Zevv: you have problems I assume? disruptek: yeah, gittyup ci failing on cpp. Zevv: Ar4q has been doing work on that lately disruptek: i know; i saw a couple prs in the pipeline and it's a little confusing on what to expect. clyybber: Zevv: Its up clyybber: https://github.com/Clyybber/nimryu clyybber: I gotta commit the nim translation of the tests Zevv: Yeah I thought you and disruptek were working in the same repo Zevv: so i was looking at the wrong one Zevv: I was just looking through your code clyybber: I only translated stuff necessary for d2s and f2 clyybber: s clyybber: the other stuff is still C clyybber: also, its very raw clyybber: as in not nimified yet at all clyybber: but at least it works :p Zevv: It seems to be almost twice as fast as printf, is that right? Zevv: on linux/glibc clyybber: think so yeah clyybber: almost 4 times I think Zevv: sweet clyybber: not sure how my port fares in that regard tho clyybber: probably a bit slower, since I use a strip clyybber: but without it it should be just as fast livcd: shashlick: still having an issue with libtool shashlick: Use cmake shashlick: Did you see that message? livcd: hmm nope shashlick: nimble install cmake livcd: ok let me try disruptek: clyybber: if you want a fun ast bug just ask. livcd: shashlick: the cmake did run but when i want to compile a program that imports nimpcre it is trying to run make clyybber: disruptek: Yes please clyybber: gimme disruptek: are you sure? disruptek: you might not like it once you get it. Araq: disruptek: it doesn't work (nim cpp --gc:arc exceptions) Araq: I might merge my improvements though and deal with the failing test later shashlick: livcd: it will build pcre the first time disruptek: Araq: be that as it may, i don't have any exceptions in my codebase and i still get a codegen failure in ci. livcd: shashlick: i cant proceed livcd: btw i get it...i've got the libtool but it's a sh script livcd: the makefile calls it like this /usr/bin/bash: ./libtool: No such file or directory which is wrong Nickiel12: Hi, is there a way to read and write mp3 file metadata (album, artist, etc) I have been looking for 30 mins through the os module and google, and can't find anything shashlick: Unless you install msys and the whole shebang, no idea on that disruptek: clyybber: https://github.com/disruptek/criterion.nim/issues/1 disbot: ➥ it does not bench fib5 from tfib example shashlick: Plus I've not ever tested that Elegant Beef: @clyybber you mispelled west taiwan 😛 clyybber: lol disruptek: a pragma with no arguments is completely missing from the macro input. give it an arg like `pragmaMacro: []` and it works. livcd: shashlick: wait i am symlinking in nimpcre libtool clyybber: disruptek: You mean it doesn't pop up in customPragmas? clyybber: or do you mean it doesn't get called? disruptek: the procdef ast is completely absent from the ast passed to the macro. disruptek: elided. gone. vanished. mia. disruptek: awol; you feel me? Nickiel12: shashlick, were you talking to me when you mentioned mysys? disruptek: i think maybe it's replaced with Empty. 😁 shashlick: Sorry Nickiel12, was talking to livcd Nickiel12: ok, it confused me shashlick: livcd: why is it still using libtool if you have cmake livcd: no idea..you detect that automatically? livcd: I try with -f shashlick: Yes, delete the nimpcre cache and try again ya livcd: that seems to work ..at least for picking the cmake disruptek: clyybber: fun, right? livcd: excuse my colorful language livcd: but f...ing finally clyybber: disruptek: Umm clyybber: lol? clyybber: livcd: -f...ing -finally clyybber: Zevv: Lol, I fucked up the license clyybber: replaced the `//` with `#` clyybber: haha livcd: clybber: i was not able to make the nimpcre compile on windows :F livcd: shashlick: thanks a lot! clyybber: : ? clyybber: livcd: That is sad clyybber: But it ships with nim? clyybber: I though clyybber: t livcd: no shashlick: so it worked for you finally? shashlick: I'm adding some text to the nimpcre site livcd: yes it worked with cmake livcd: and when i used -f it picked up cmake finally clyybber: so it worked? clyybber: I thought you werent able to compile it? clyybber: or did you build it in a unix environment? livcd: I was not able to compile it first with just make livcd: then it finally worked with cmake clyybber: ah clyybber: Zevv: Tests are up now Araq: scope based destruction is a beast :-( Araq: at least I made your 'handleNested' much simpler dadada: are there hooks to inject custom C code into the generated C? disruptek: sure. Yardanico: emit pragma? Yardanico: also you can do some really strange magic with importcpp (that's for C++ though) dadada: okay Yardanico: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma dadada: well I just learned about https://github.com/google/tcmalloc dadada: which is google's highly optimized malloc/new implementation dadada: and then I wondered how you would integrate this with a Nim application, hence my question dadada: I've no need for tcmalloc (yet) though :D clyybber: Araq: Nice! shashlick: livcd thanks for persisting, will update the site clyybber: Araq: Do you have it on a public branch? clyybber: dadada: Very easy clyybber: compile with --os:any clyybber: dadada: https://nim-lang.github.io/Nim/nimc#nim-for-embedded-systems clyybber: dadada: Btw, you ought to make something in nim clyybber: : ) dadada: clyybber: I most definitely will clyybber: nice! dadada: I've multiple project ideas, but first I need to learn as much as possible dadada: also I'm waiting for C++ library integration to get a little more comfortable dadada: I want to port a Qt application over to nim Yardanico: well AFAIK Qt does some really weird stuff when compiling itself, etc, so pure Qt bindings would probably be quite hard to do Yardanico: like they have their use a meta compiler and stuff like that dadada: Yardanico: while you're right a number of languages have overcome this hurdle dadada: Yardanico: dadada: https://wiki.qt.io/Language_Bindings livcd: shashlick: <3 thanks for making it dadada: among them Rust, Go, Java, Python and D Yardanico: well yeah, although if you look at rust link, that org also has a "ritual" repo in it, so they had to create a whole lib to wrap Qt :P Yardanico: also is QML not enough for you? :( dadada: most definitely NOT dadada: Yardanico: what are these empty messages? :D livcd: I am right now looking on github for applications written in Go+QT disruptek: wut livcd: https://raw.githubusercontent.com/rashwell/neochessqt/master/screenshots/EarlyProtoType.png Rika: i thought you were showcasing a nim app dadada: Yardanico: the regular non-QML Qt is what I'm used to using, and last time I checked in on QML there was all sorts of functionality missing that I needed, and I want to port a Qt application, not a QML application livcd: Rika: sorry :X shashlick: dadada: as much as I agree, qt will be a full time job demotomohiro: Qt is large library and includes qstring or qvector. demotomohiro: It looks like Qt is trying to replace standard C++ library. dom96: All GUIs suck in one way or another. Better focus on implementing something like Electron IMO clyybber: dom96: hahaha what? clyybber: electron sucks the most Yardanico: yes i'd have to agree on electron dom96: Seriously. If you want a native GUI then just use the native toolkits dom96: Qt/Gtk both suck dadada: demotomohiro: when Qt started the C++ standard library had a lot to be desired, they made programming in C++ a lot easier, recently sdtc++ got somewhat better, and you can use both the standard c++ types and the Qt types with their libraries dadada: s/had a lot/had a lot left Yardanico: what about nim types? :P lqdev[m]: how does `slurp` work? does it create a .h file with an array containing a file's bytes, insert the file into an executable's .data section, or what? clyybber: no clyybber: it simply makes a constant clyybber: it will be a literaly in the generated C code clyybber: so basically yeah. But not in a seperate .h file lqdev[m]: so it's not really viable for large files, right? lqdev[m]: because gcc shits your memory when it deals with really big arrays dadada: dom96: Qt didn't suck in my experience, many big companies using Qt disagree with you clyybber: lqdev[m]: I think its fine clyybber: I slurp images clyybber: And shaders clyybber: like binary clyybber: SPIR-V dadada: I wouldn't be against having something like electron for nim either, having options is good lqdev[m]: yeah, but they don't weigh 500 MB ;P Yardanico: there's https://github.com/jangko/nimCEF :P Yardanico: also fidget wip lqdev[m]: my friend recently tried to embed a 500 MB file using this method into an executable, and it literally filled his memory within seconds shashlick: lqdev - you trying something like nimdeps? shashlick: !repo nimdeps disbot: https://github.com/genotrance/nimdeps -- 9nimdeps: 11Nim library to bundle dependency files into executable 15 14⭐ 2🍴 lqdev[m]: nimdeps isn't bad, but it still has to unpack these files somewhere and load them into memory. that effectively loads the dependencies twice, once for the actual executable, and then another time when they're unpacked into a temp dir shashlick: agreed, only thing is nimdeps only extracts once, after that it doesn't have to every time shashlick: but it's still not a sensible way to distribute files clyybber: dadada: Theres https://github.com/treeform/fidget which is better than electron clyybber: and is not a frickin embedded web browser dom96: dadada, sure, but the point is in relation to Nim dom96: Wrapping Qt for Nim would be a PITA dom96: you're much better spending that effort implementing a nice Electron-like library lqdev[m]: I'm also working on https://github.com/liquid600pgm/rdgui, but it's nowhere near complete and it's better suited for games lqdev[m]: i.e. it doesn't have auto-layout tools (yet) lqdev[m]: I might need to implement them because I'm working on an app right now clyybber: lqdev[m]: I wanted to build a daw with keyboard focussed interface too clyybber: Nice that you do it tho clyybber: because I've recently gone very attracted to touchscreens dadada: dom96: we need a automagical way to port regular C++ libraries first, and then build on that for Qt later krux02_: alehander92: generally `$` should not raise dadada: s/port/bind to krux02_: sorry out of context post again lqdev[m]: @clyybber not sure how I'm going to implement the node-based instruments I'm going for, but yeah I'll figure it out somehow krux02_: sometimes when I enter the chat I am totally in a weird position and post somthing that was relevant half a day ago Yardanico: well yeah, that's a bad thing about real-time chats :P Elegant Beef: think it's the bad thing about 3 different chat clients communicating together, no universal way to say "look here for context" dom96: krux02: sounds like your IRC client is bad at presenting info :) superbia: I'm trying to make a "typeracer" game, and I'm wondering how does one generally detect what are the heights and widths of each letter in font, because I'd like to dynamically highlight every character you pressed correctly (and wrongly) Yardanico: maybe https://github.com/treeform/typography can help? superbia: Yardanico: https://raw.githubusercontent.com/treeform/typography/master/tests/layoutNoText.png exactly this am I looking to explain ! Yardanico: well you can check the docs - https://treeform.github.io/typography/index.html every Glyph has quite a few parameters Yardanico: although you'd have to use a .svg font (or convert an existing font to .svg) lqdev[m]: typography supports ttf tho Yardanico: oh lqdev[m]: superbia: you'd probably want getGlyphSize here dom96: Check out https://github.com/treeform/typography/pull/9. Some discussion about this exact thing :) disbot: ➥ Implements ability to specify a color for getGlyphImage. superbia: Now I know the terminology superbia: so I got my anwsers, I can google out the details ! superbia: thanks y'all !!!!! lqdev[m]: if you're using a library that supports tinting textures with a color, it should be relatively easy to implement even without knowing the glyph's bounds lqdev[m]: eg. in rapid you'd just set `ctx.color = rgb(255, 255, 0)` before drawing a rectangle but I don't know what you're using lqdev[m]: man, it would be so cool to let the user alter text rendering character by character in rapid. lqdev[m]: guess I know what I'm gonna implement next. superbia: well.. i guess i didn't really know how fonts work disruptek: if i want to render some text on a surface in wayland... what's an easy way to do that? something an idiot with one hand could code? disruptek: no, think a 7 year old with one hand. lqdev[m]: superbia: every font family specifies a set of fonts. every font specifies a set of glyphs. a single glyph is a character like `a`, `.`, or `π` superbia: yup, I wanted to get it's bounding box lqdev[m]: disruptek: open a transparent window and render the text there? don't really know what do you wanna do disruptek: yeah, that works. disruptek: what do i use? clyybber: lqdev[m]: You mean something like modular synthesis? lqdev[m]: disruptek: ik shameless self plug, but rapid supports windows with alpha clyybber: lqdev[m]: Do you know VCVRack? disruptek: okay, i'll try it; thanks. lqdev[m]: @clyybber: kind of, basically a hybrid between Reason's rack and Blender/DaVinci Resolve's node editor lqdev[m]: (referring to my idea here, I don't know VCVRack) clyybber: lqdev[m]: Ha, I started implementing something like that too clyybber: lqdev[m]: Something like this: https://warmplace.ru/soft/sunvox/#vid lqdev[m]: yeah, something akin to that dom96: Love it when libraries `quit` my app https://github.com/CORDEA/oauth/pull/18 disbot: ➥ Fixes this package quitting my program when SSL not available. clyybber: lqdev[m]: You gotta try VCVRack. Its really amazing disruptek: yeah, it's pretty cool. lqdev[m]: @clyybber I'm looking at VCVRack right now, looks really interesting. I wonder how do they generate these simulated analog waveforms clyybber: Reason for making my own is that I would love to press a key or something and then look "into the module" clyybber: like circuit bending kungtotte: dom96: I think you're being overly picky here. I think it's a cool feature, libraries should also be liberally sprinkled with echo statements with terminal escape sequences in them, because why not? clyybber: lqdev[m]: Whats also kinda cool about VCVRack is that many of these modules get made as hardware when they are successfull lqdev[m]: dang it, it needs JACK :( clyybber: Nope clyybber: It doesn't lqdev[m]: I only have PulseAudio clyybber: It works with pulseaudio clyybber: or alsa clyybber: or anything clyybber: I think it uses RTaudio behind the scenes or something like that lqdev[m]: how does it not, it gives me a "jack server is not running" error clyybber: lqdev[m]: Huh dom96: kungtotte, makes me wonder whether I can trust this dependency at all :( clyybber: lqdev[m]: Thats not an error tho clyybber: it just tells you that clyybber: but it should run fine clyybber: does it not? lqdev[m]: aw god the stuttering lqdev[m]: just found the alsa thing on the rack clyybber: lqdev[m]: argh clyybber: I had that stuttering too clyybber: after switching to void Elegant Beef: Do like all the linux users in the nim chat 😄 clyybber: somehow not on arch clyybber: and I fixed it somehow clyybber: lqdev[m]: Try setting your sample rate clyybber: in Engine clyybber: Or maybe the framerate is set really low clyybber: in View lqdev[m]: @clyybber no, my sample rate is 48kHz and the buffer size seems to affect the stuttering frequency clyybber: lqdev[m]: I discovered it through this dude: https://www.youtube.com/channel/UCuWKHSHTHMV_nVSeNH4gYAg/videos clyybber: lqdev[m]: Ah yeah clyybber: Make it bigger timotheecour: hi @Clyybber I’m here (i PM’d you) clyybber: is probably what you want clyybber: timotheecour: Hi! clyybber: I didn't check gitter so I didn't read your PM dom96: https://i.imgur.com/Zg9QmeN.png dom96: It lives, sorta :) lqdev[m]: @clyybber it only makes the stuttering less frequent lqdev[m]: it constantly reports underruns in the terminal clyybber: lqdev[m]: Weird. clyybber: What audio driver do you have selected? dom96: 5.1MB WASM file :D lqdev[m]: ALSA clyybber: Hmm dom96: lqdev[m], clyybber: is this discussion more appropriate for #nim-offtopic? :) clyybber: the offtopic bridge died one-side only : ( lqdev[m]: @Yardanico you're the discord↔irc bridge maintainer, right? could you look into this? Clyybber: I think he did, but it was tricky Elegant Beef: Quick insult everyone! clyybber: ? Elegant Beef: `the offtopic bridge died one-side only : (` clyybber: lqdev[m]: Not sure if you are on offtopic but when you press F3 it shows the CPU usage per module clyybber: @Elegant Beef fuck everyone clyybber: there you go clyybber: :p lqdev[m]: @clyybber the CPU usage is p low except on the output module Elegant Beef: I'd like to report an admin clyybber: @Elegant Beef Please file a report and send it to an admin. Elegant Beef: @clyybber, @clyybber said and i quote "Fuck everyone" clyybber: What a dumbass.. clyybber: I think this deserves a ban [banned]: this is so sad exelotl: /ban clyybber [banned]: 😦 exelotl: wow it worked iffy: How soon after calling AsyncSocket.close() is the socket closed? I'm running into "Address already in use" errors when trying to listen on a port I just closed. I'm using `socket.setSockOpt(OptReuseAddr, true)` dom96: iffy: that's up to the OS, but if you've set OptReuseAddr then it should be immediate IIRC dom96: maybe you have a socket that didn't have that set still alive iffy: that's what I would have guessed iffy: I only make sockets with OptReuseAddr (in this code) iffy: I'll do more testing to see if I can repro in a simpler setup -- thank you for validating my assumptions clyybber: lqdev[m]: Try if it still happens when nothing else is running clyybber: unfortunately I really can't remember how I fixed it 😦 Varriount: Hm, anyone know how expensive calling a (non-closure) function via global is, compared to a regular function call? disruptek: via global? lqdev[m]: @clyybber I set the buffer size to 64, and then something clicked into place and it magically started working lqdev[m]: quite cool to play around with, but not quite the thing I want lqdev[m]: maybe it's because I'm not into audio, or something Varriount: disruptek: Yeah disruptek: what does that mean? Varriount: A global variable? disruptek: oh, you mean passing a global to a function? lqdev[m]: disruptek: calling a function stored in a variable clyybber: lqdev[m]: You want more modular right? clyybber: At least thats what I want disruptek: deref'ing a pointer is not an expensing operation. disruptek: expensive, either. Varriount: No, Varriount: https://play.nim-lang.org/#ix=2bF2 disruptek: why would that be slow? lqdev[m]: @clyybber: you'll see what I want once I get nadio to a usable state :) clyybber: lqdev[m]: I'll check it out then : ) clyybber: Maybe by the time I also got something half working .. clyybber: unlikely disruptek: !repo disruptek/criterion disbot: no results 😢 disruptek: 😁 clyybber: heh clyybber: because its a fork prolly disruptek: of course. disruptek: ah, that reminds me. i need to switch to tr33form's jwt. disruptek: sorry, yuri. dadada: too bad the partiql code under the apache license dom96: disruptek: how come? clyybber: disruptek: What you do, kills us both disruptek: nope. dadada: I've considered porting the kotlin code to nim, but then it won't be possible to fit with the liberally licensed MIT code of the nim world disruptek: because yuri's now pulling in bearssl and i don't really want that weight in gcplat. disruptek: the source alone is 73mb and the repo is 185mb. disruptek: bearssl is like 200mb, i'm told. deepend: is there a way to use the math exponent operator ^ with a negative integer exponent? disruptek: great question. deepend: it works fine if i cast ints to float and use math.pow deepend: just tedious disruptek: we need ^- 😁 disruptek: you should pr it. deepend: ok let me take a look at the math source lqdev[m]: damn, ever since I tried doing something in Rust I find myself using Options more disruptek: awesome, let us know if any questions. disruptek: options are great and results are better. i'm about to rename my results lib. dom96: disruptek, true, it does build a lot of .c files from bearssl disruptek: badaskes is the same as the status results but it relaxes some requirements. clyybber: disruptek: What do you define as the difference between results and options? clyybber: that results store an error code? disruptek: results is two values and options is one. clyybber: where one value is the error? clyybber: or "result" code disruptek: two types, i should say. disruptek: you get one type on success, another on failure. clyybber: techincally clyybber: ahhh lqdev[m]: too bad Nim's stdlib doesn't have results clyybber: you mean like at runtime? disruptek: but it's a union, of course. so, only one at a time. clyybber: so how do you know what it is? clyybber: case object? disruptek: i guess you could technically cheat if you wanted to be crazy. disruptek: that's the kinda shit that i love you can do in nim. disruptek: yes, case object. clyybber: nice disruptek: see gittyup for how i use them. deepend: howcome Natural isn't covered in the language manual? lqdev[m]: deepend: because Natural is an stdlib type lqdev[m]: we shouldn't pollute the language manual with things from the standard library deepend: hmmmm lqdev[m]: and range types are covered here: https://nim-lang.org/docs/manual.html#types-subrange-types deepend: so you don't consider system to be part of the language? disruptek: ~motd is Join a non-Nim project with the goal of exposing that community to Nim. Do it now! disbot: motd: 11Join a non-Nim project with the goal of exposing that community to Nim. Do it now! lqdev[m]: deepend: maybe I phrased that wrong, I meant core language lqdev[m]: ie. syntax, semantics deepend: it's just a bit confusing disruptek: you know what i'm realizing? deepend: and makes grepping for answers more difficult as a noob disruptek: we need to birth these projects and cut the fucking cord. disruptek: you get the thing to 1.0, or whatever that is, and you just walk away. disruptek: if others pick it up, it lives. else, it's only weighing you down. disruptek: no point in supporting tons of software that only one person uses. disruptek: i really think that would improve the rate of innovation. disruptek: what we want is rapid prototyping and shedding of bad patterns. disruptek: we should be iterating like crazy on this stuff. Elegant Beef: @clyybber got any vulkan tutorials? 😄 clyybber: @Elegant Beef made by me? clyybber: nah Elegant Beef: nah i just mean in general clyybber: SashaWillems Elegant Beef: im looking at one right now that is 100% written english with 0 code clyybber: lol clyybber: theres also vulkan-tutorial.com clyybber: I think its called that Elegant Beef: That's the one i was talking about clyybber: ah, it has code clyybber: its at the bottom clyybber: what is kinda hard to grok with vulkan is how the components really related clyybber: *relate clyybber: so I suggest googling vulkan API diagram clyybber: or something like that Elegant Beef: oh it's on another page 😄 clyybber: and hanging it on your wall while looking at tutorials Elegant Beef: Well i mean i know a majority of the shader stuff already Elegant Beef: Well probably all of the principle of shaders Elegant Beef: The big issue is nim to C++ calls i think clyybber: yeah, I'm not really talking about shaders Elegant Beef: i know clyybber: @Elegant Beef Not at all clyybber: vulkan has a C api clyybber: and I made a wrapper Elegant Beef: same shit for me 😄 clyybber: https://github.com/Clyybber/vulkanim clyybber: no need to touch C Elegant Beef: i meant the names dont align always Elegant Beef: Or types dont make sense Elegant Beef: Atleast when i was using opengl clyybber: Yeah, its just delete underscore Elegant Beef: OGL has some weird shit Elegant Beef: like colour3B using signed bytes Elegant Beef: like tf 😄 clyybber: yeah clyybber: good thing it dies Elegant Beef: indeed disruptek: yay, krux02 fixed me. Elegant Beef: Oh no distuptek jrs.? Elegant Beef: Nice Elegant Beef: 😛 Elegant Beef: @clyybber how dare you not make that a nimble package Elegant Beef: 0/10 clyybber: ah disruptek: hah, i still beat you. clyybber: prolly cauze I don't use nimble heh clyybber: disruptek: Nope Elegant Beef: what you just wget everything? clyybber: git submodules clyybber: the past is the future Elegant Beef: ah disruptek: everything old will be new again. Elegant Beef: idk man packages are cleaner clyybber: I think exactly the other way around clyybber: lol disruptek: elegant: you use nimph? clyybber: but yeah I should probably publish it on nimble Elegant Beef: Nope i dont Elegant Beef: i dont even know what nimph is clyybber: disrupteks pkg manager for nim disruptek: hmm, it's like the radio ads aren't working. disruptek: might need to go back to paper mailers. Elegant Beef: what's a radio? clyybber: disbot enable ad broadcast clyybber: what are frogs? Elegant Beef: Is that something you old people used? clyybber: HEY! clyybber: no no no you cannot joke about that disruptek: it was popularized by the phonograph. clyybber: its still amazing what you discover with RTLSDR Elegant Beef: Yea im too small brain to setup vulkan Elegant Beef: Reading is tedious Elegant Beef: I prefer ramming my head against the wall until something sticks disruptek: to the wall? Elegant Beef: Or to my now mishapened head clyybber: bgfx calls for you I guess Elegant Beef: Probably clyybber: or rapid clyybber: which is a game engine clyybber: by lqdev Elegant Beef: Eh rapid only has ogl lqdev[m]: I don't plan on supporting anything else lqdev[m]: for the time being Elegant Beef: Lies i see webgl! lqdev[m]: ah, webgl lqdev[m]: that might come at some point. I'd need to create a robust high-level OpenGL wrapper first, though Elegant Beef: The big issue with me not using vk or ogl directory is im not going to learn graphics programming, but im very uninterested in reading these walls of text, so im not going to learn graphics programming 😄 Elegant Beef: directly* disruptek: what? Elegant Beef: That's about as nonsensical as it was written disruptek: in that case, it's clear as mud. exelotl: I've been using three.js at work and it's nice, would be cool if Nim had something like that Elegant Beef: couldnt you use nim to talk to the threejs library?> Elegant Beef: couldnt you use nim to talk to the threejs library? exelotl: oh yeah but you'd have to write a full set of bindings and keep them up to date Elegant Beef: Easier then making a threejs duplicate 😄 exelotl: maybe there could be something like c2nim but for typescript definitions exelotl: that would make JS bindings a breeze exelotl: but also I was thinking something for the desktop primarily clyybber: disruptek: Did you port generic_128? disruptek: no, and i'm not sure i even finished it, honestly. disruptek: dealing with a nigel thing. clyybber: disruptek: agressive approval lol clyybber: lemme join you just for funzies disruptek: wut clyybber: the int128 pr disruptek: yeah, well, i'm not sure what we're waiting for. disruptek: the producers would like to announce that the persons doing the debugging have been sacked. clyybber: lol clyybber: the C tests really suck disruptek: the producers would also like to announce that the persons joking about those persons have been sacked. clyybber: it swallows the output disruptek: just pipe it, i guess. disruptek: i dunno. i've been using a scroll buffer in my terminals and i find it really handy. disruptek: only for the last 30 years or so, though. kinda new for me. clyybber: nah clyybber: I mean I don't see it disruptek: are you on my branch? clyybber: whats weird is, that when I insert some printf myself clyybber: I see it clyybber: disruptek: I'm talking ulfjack ryu disruptek: i will come over there, so help me. disruptek: i'm not interested in debugging his code. clyybber: wait disruptek: i wanna know why our result is superior to his. clyybber: I got it clyybber: I'm too dumb to add a -D to a fucking makefile clyybber: help clyybber: AAGH disruptek: oh i just added a define. i don't give a fuck. clyybber: nvrmind clyybber: I'm just stupid clyybber: I compiled the tests clyybber: with the flag disruptek: so i get this: clyybber: but not the thing itself disruptek: VP+=34366719 disruptek: VR =34366717 disruptek: VM-=34366715 clyybber: yeah, thats what I'm trying to get it to do too disruptek: but he gets V+=34366720 disruptek: so we're actually a little tighter. disruptek: but then we cannot agree on the result and one of us is clearly wrong. Elegant Beef: So if you have nimfileA importing nimfileB, how can you use functions in A from B Elegant Beef: ? disruptek: we say 3.4366718E10 and he says 3.436672E10 disruptek: beef: you cannot. disruptek: or, you shan't, i dare say. clyybber: hmm hmm hmm Elegant Beef: I mean i assigned a proc var in B to the func in A Elegant Beef: so i guess that's how clyybber: @Elegant Beef simple, you import it? Elegant Beef: I assume the issue is the imperative part of nim disruptek: the issue is that circular imports are not a thing. Elegant Beef: Yes you import B, but in B you can access A Elegant Beef: cant* Elegant Beef: since it's recurrsive Elegant Beef: recursive* clyybber: ah clyybber: yeah Elegant Beef: I was thinking of imports more like namespaces from C#, but that's clearly not the case, and having recursive imports is nice 😄 clyybber: @Elegant Beef Actually you can clyybber: you gotta import B a bit later clyybber: after the stuff you want B to be able to access Elegant Beef: Not possible Elegant Beef: the function in A relies on objects from B Elegant Beef: My cheese method of assigning the proc for B from A is the best clyybber: and the objects rely on the function? Elegant Beef: `command.addCommand = addCommand` disruptek: i think he's using two files so he can develop the code in two windows at once... or something. Elegant Beef: Well im adding an object to a table clyybber: future is now baby Elegant Beef: Im using two files to keep logic sperate from data krux02: Elegant Beef, recursive imports are not nice. disruptek: maybe he has no pager so he cannot scroll in his editor. clyybber: logic is data :p clyybber: data is logic :p clyybber: join us clyybber: we are l i s p Elegant Beef: I swear im getting mocked for following a good paradigm 😄 disruptek: he's storing his programs on cards and he doesn't want to reorder them. clyybber: relatable Elegant Beef: Elegant Beef: Tear it apart then you schmucks 😄 disruptek: i swear you're overthinking it. clyybber: @Elegant Beef ha, I looked at that before disruptek: look, just color within the lines. disruptek: it's not hard. disruptek: it make your world more beautiful. clyybber: nothing to tear apart there : ) Elegant Beef: Do i do a flood fill? disruptek: you like. krux02: (car (cdr (cadr '(a (b (c)))))) disruptek: yum yum yum clyybber: just add the types to the top of the file :p disruptek: ack lisp attack clyybber: no "good practice" required Elegant Beef: Maybe i use the lines as a mask and just paint it all one colour disruptek: beef: take a look at golden or nimph to see some larger project import shenanigans. disruptek: !repo nimph disbot: https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 52⭐ 3🍴 7& 1 more... Elegant Beef: I mean.. not really a problem of imports, was just making sure there wasnt a different way disruptek: it's no big deal, truly. krux02: yea, I've certainly wasted enough of my life of "good practice" that turned out to be nothing more than a waste of time. disruptek: exactly. clyybber: good practice is not coding at all Elegant Beef: Who said anything about good practices? disruptek: these are problems we'd be lucky to have. clyybber: no good is best code Elegant Beef: I like easily expandable code krux02: just make sure you program works and do what is necessary to make it work. Elegant Beef: Oh god, the "if it aint broke dont fix it" party has joined the chat clyybber: haha krux02: If you stay to a minimum of mork, it magically becomes maintainable, because it doesn't bloat. disruptek: basically, it's efforts at organization that have created the problem in the first place. clyybber: more files => more expandable clyybber: if you can't write between lines for some reason clyybber: like coding on a tape clyybber: :p krux02: Elegant Beef, you need to get rid of the need for recursive imports. Elegant Beef: I mean seperated logic from data means less bloat in files Elegant Beef: I got rid of it Elegant Beef: By not using it krux02: that is mostly a head thing. krux02: normal programs don't need recursive imports. Elegant Beef: I mean it's mostly a me thinking imports are like C# namespaces clyybber: @Elegant Beef storing a the proc has runtime overhead tho Elegant Beef: oh noes Elegant Beef: For a small script clyybber: like if you store it in the object Elegant Beef: This script stays alive for all of 10 seconds krux02: only if you have mutual recursion across modules clyybber: why is it so expandable then :PPP clyybber: (just messing with ya) Elegant Beef: Well i wanted to play with interfaces in nim so that's partly it krux02: what type of interfaces? disruptek: you can still use directories, of course. Elegant Beef: Simple interfaces for commands krux02: go like interfaces or java like interfaces or the abstract meaning of interface Elegant Beef: go like is what the library says Elegant Beef: The library didnt have a license, so dont question the copyright krux02: hehe, if feel I caused that library Elegant Beef: *Shudders in projects on github having no license* Elegant Beef: Yea the proper interfaced is outdated and borked 😄 Elegant Beef: Tried it before this one Elegant Beef: Then protocoled exists but is more like inheritance krux02: writing a macro for go like interfaces in Nim was basically the first thing I did in this community (in the forum) Elegant Beef: Yea good job, i like interfaces cause of the ease Elegant Beef: But i could've used inheritance here krux02: here is the origial forum post: https://forum.nim-lang.org/t/2422 clyybber: krux02: The library literally mentions you Elegant Beef: Im clearly a nim noob, but atleast most of general CS knowledge applies krux02: yea that helped me learn the language as well disruptek: you're doing fine, but i would definitly ditch the cards for some proper tape recording of your software. krux02: if you know c++ and python, you will instantly feel at home. disruptek: i feel like cards are gonna hinder you with nim. krux02: if you know one, you will feel at home half way Elegant Beef: disruptek you really disrupt this chat 😄 disruptek: i know, i'm a terrible person. Elegant Beef: I really know neither, i've written some python and some C++, but i spend most of my time in the Unity engine writing C# clyybber: disruptek: I dunno, I like cards clyybber: I always get tangled up in tapes Elegant Beef: *I want to use nim for game dev, but there isnt a good enough engine, so i've been think about making my own* Elegant Beef: Which is one reason i wanted interfaces clyybber: he he he clyybber: this is one thing I'm currently attempting krux02: Elegant Beef, I've written my own 3D world renderer using OpenGL in C++ Scala Go and Nim clyybber: I just made a framegraph skeleton thingy Elegant Beef: I was going to use bgfx for graphics, and attempt to encourage an ECS system disruptek: zacharycarter is using bgfx. clyybber: @Elegant Beef @Zachary Carter is another gamedev clyybber: disruptek: *was* afaik disruptek: oh, hmm. krux02: What is really shooking to me is, in Unity you have these people who have absolutely no clue what they are doing, they are just copying scripts from the internet together and then make tutorials about it on youtube semi explaining what they are doing. clyybber: ah nevermind disruptek: is zeal public? disruptek: !repo zeal disbot: https://github.com/zealdocs/zeal -- 9zeal: 11Offline documentation browser inspired by Dash 15 7561⭐ 581🍴 7& 29 more... krux02: it is easy to get wrong advice, but that is probably possible everywhere. clyybber: krux02: this applies to the whole internet disruptek: i think he's saying i have a special talent for wrong advice. clyybber: I mean the fact that ppl who have no clue shout the loudest Elegant Beef: Unity being so popular encourages that, also people fall in the dunning krueger effect disruptek: sounds pretty deep. Elegant