<< 13-05-2019 >>

00:00:11*cyberjpn2 joined #nim
00:10:37*rnrwashere quit (Remote host closed the connection)
00:18:21*rnrwashere joined #nim
00:18:28*rnrwashere quit (Client Quit)
00:19:21FromGitter<zetashift> @clybber it sort of is, it's just tangled into a lot of macro code which I know nothing about
00:21:42*rnrwashere joined #nim
00:23:47*cyberjpn2 quit (Ping timeout: 244 seconds)
00:32:56FromDiscord<Avatarfighter> is there a way to define a string in a struct with a specific length?
00:35:42FromDiscord<Avatarfighter> looks like the pragma `bitsize` is what i'm looking for
00:38:41FromDiscord<Avatarfighter> nope but that helps with something else haha
00:50:52*cyberjpn2 joined #nim
01:14:46*stefanos82 quit (Remote host closed the connection)
01:16:15*dddddd quit (Remote host closed the connection)
01:37:15*rnrwashere quit ()
01:40:35*NimBot joined #nim
01:44:13FromDiscord<treeform> There is not an easy way. I had to create a struct string before. I don't recommend it.
01:44:51*deech joined #nim
01:45:19FromDiscord<treeform> https://github.com/treeform/chrono/blob/0e61f62851a8917a26232c03a8b935e2552107cb/chrono/timezones.nim#L45
01:45:37FromDiscord<treeform> Here is what I have done in the past.
01:56:49*thomasross joined #nim
01:59:58FromDiscord<Avatarfighter> rip
02:00:09FromDiscord<Avatarfighter> I'll just stick to manually setting the lengths of stuff haha
02:01:10*banc quit (Quit: Bye)
02:04:42*theelous3 joined #nim
02:22:58*theelous3 quit (Ping timeout: 245 seconds)
02:23:59*banc joined #nim
02:27:58*a_chou joined #nim
02:31:20*a_chou quit (Client Quit)
02:31:44*laaron quit (Remote host closed the connection)
02:31:46*a_chou joined #nim
02:34:53*laaron joined #nim
02:41:33*a_chou quit (Quit: a_chou)
03:04:56*cyberjpn2 quit (Ping timeout: 246 seconds)
03:17:15*deech quit (Ping timeout: 258 seconds)
03:51:29*arecaceae quit (Remote host closed the connection)
03:52:50*arecaceae joined #nim
04:23:48*nsf joined #nim
04:26:37*leorize joined #nim
04:38:31*narimiran joined #nim
05:05:26*cyberjpn2 joined #nim
05:23:41*disruptek quit (Quit: Bye)
05:30:39*disruptek joined #nim
05:36:20*cyberjpn2 quit (Ping timeout: 258 seconds)
05:41:47*Fred_ joined #nim
05:42:10*Fred_ is now known as Guest43118
05:44:38*cyberjpn2 joined #nim
05:54:58*cyberjpn2 quit (Ping timeout: 244 seconds)
06:00:01*Guest43118 quit (Ping timeout: 256 seconds)
06:00:09*cyberjpn joined #nim
06:03:29*krux02 joined #nim
06:07:04*thomasross quit (Ping timeout: 246 seconds)
06:09:28*solitudesf joined #nim
06:21:25*rnrwashere joined #nim
06:26:09*rnrwashere quit (Ping timeout: 252 seconds)
06:27:21FromGitter<jrfondren> in normal troubleshooting, without rewriting my code, how do I see the exception that preceded a defer: that itself triggered an exception?
06:30:14*PMunch joined #nim
06:37:44*cyberjpn quit (Ping timeout: 246 seconds)
06:41:04*tdc joined #nim
06:41:35FromGitter<mratsim> @avatarfighter, there are nuklear bindings in Nim as well
06:50:47*laaron quit (Remote host closed the connection)
06:52:54*laaron joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:01:50*Vladar joined #nim
07:04:31*gmpreussner joined #nim
07:07:39*cyberjpn joined #nim
07:23:54*clyybber joined #nim
07:25:51*xet7 joined #nim
07:37:13FromGitter<gogolxdong> Is there any document describe owned, and the difference between var and owned
07:38:38livcdDoes anyone know how I can call a powershell script without showing the window ?
07:41:54FromGitter<jrfondren> @gogolxdong just https://github.com/nim-lang/Nim/wiki/Destructors
07:42:36FromGitter<jrfondren> and that's already deprecated, =sink is gone for =move
07:45:53clyybberAraq: Hey Araq, are you there?
07:47:22Araqclyybber, hi
07:47:31Araqbtw, community feedback desired, https://github.com/nim-lang/Nim/issues/11225
07:47:37Araqit's a complex problem :-)
07:48:07clyybberI just read it :D
07:48:50clyybberbut don't completely understand it
07:48:57*oculux quit (Quit: blah)
07:49:18Araqthe 'mixin' declaration doesn't compose well
07:50:20Araqthough I'm beginning to think it's better to instead introduce 2 dummy generic procs to create a mixin symbol... oh well
07:50:29*oculux joined #nim
07:50:30*neceve joined #nim
07:53:47*neceve quit (Client Quit)
07:53:56clyybberhmm, thats a very tricky issue..
07:54:12*neceve joined #nim
07:55:24clyybberAraq: Btw, WDYT about toplevel defer statements? I could implement them similarily to the global-destructor fix.
07:55:48Araqclyybber, I accepted your patch for now but I don't like this module graph extension
07:56:04Araqas you can clearly see, this breaks IC (incremental compilation)
07:56:22AraqI mean, it's nice that thanks to the compiler's design these things are now so easy to spot
07:56:31Araqbut it sucks anyway :-)
07:56:35clyybberyeah ;0
07:56:42clyybber* ; )
07:57:12AraqI would prefer if the backend would generate finit() procs
07:57:21Araqthat are accumulated like the init() procs
07:57:50Araqand after we have a cleaner solution we can apply it to 'defer'
07:57:55Araqfair?
07:58:24clyybbersounds good, I'm gonna try implementing it
07:59:08Araqyou're awesome :-)
07:59:34Araqhowever, turning =sink into =move might be more fun and more important
08:01:52clyybberfree time is awesome :)
08:05:09*stefanos82 joined #nim
08:13:00clyybberAraq: You mean, as an optimization? As in when it's the last assignment using b?
08:13:30Araqwhat seemed a smart idea turned out to be slightly wrong
08:13:59Araqproc `=sink`(a: var T; b: T) is paired with 'wasMoved(b)' internally
08:14:16Araq(as clearly visible in injectdestructors.nim)
08:14:40Araqthe idea was that usually 'b' is a temp location, the result of a function call
08:14:50Araqand then the wasMoved() part can be left out
08:15:19Araqso the move operation becomes both easier to write and more efficient
08:15:30Araqhowever, this doesn't work for self-assignments
08:15:41Araqyou must not call wasMoved() after a self-assignmnet
08:15:57Araqso the better design is the older:
08:16:09Araqproc `=move`(a, b: var T)
08:16:27Araqwhere you can reset 'b' if it's not a self-assign and otherwise leave it alone
08:20:02Araqclyybber, it is clear what needs to be done?
08:20:54*floppydh joined #nim
08:22:08*leorize quit (Quit: WeeChat 2.3)
08:23:43clyybberyep
08:24:06Araqit's quite a disruptive change but I'm hoping not much code out there uses =sink
08:31:18*cyberjpn quit (Ping timeout: 245 seconds)
08:31:33FromGitter<jrfondren> tip: to simultaneously build the same module with three different -d: arguments, give each build its own --nimcache directory
08:36:10Zevvpretty cool project on the Nim forum: compiling Nim straight to Dalvik without going through Java - no google tools requried for making android apps.
08:37:05FromGitter<mratsim> @Araq, "told you so" regarding mixins ;)
08:37:16narimiranhttps://forum.nim-lang.org/t/4840
08:37:52Araqmratsim: yes, but it's not a bug, I prefer it this way. And the problems it causes should be addressed differently
08:38:28Araqand the real issue here is that we don't type-check generics, I think I said it before
08:39:21FromGitter<mratsim> I'm not married to solutions, just unhappy about the current satus quo.
08:49:52Araqok, but that's not very helpful, how about you offer some unique, novel, creative solution? :P
08:50:48FromGitter<mratsim> You really expect someone to understand the mess of generics/static/typedesc semcheck and propose a tractable non-unicorn solution? :P
08:51:36Araqfree your mind of the mess. Tell me how it would work well for eg arraymancer
08:53:48FromGitter<mratsim> The 2 issues I had with arraymancer where: https://github.com/nim-lang/Nim/issues/6387 and https://github.com/nim-lang/Nim/issues/7385 (which requires me to declare const _ = ....)
08:54:01FromGitter<mratsim> The issues zah raised was what I found while working on Nimbus
08:56:17PMunchZevv, that is pretty cool
08:56:36FromGitter<mratsim> In short, I don't want to be able to solve all symbols issues within the library (with mixin if needed) but when a user is using my procs I don't want them to have to use mixins or have undeclared identifiers errors.
08:59:35PMunchLooked at "jnim" as well, it has the classic "The documentation is coming soon." in the 2 year old README :P
09:03:06FromGitter<jrfondren> what's the difference between `mixin mixedIn*, indirectlyMixedIn*` and `export mixedIn, indirectlyMixedIn` ?
09:03:15Araqmratsim: but maybe there is a design that doesn't use '_'
09:03:43FromGitter<mratsim> I need an equivalent to tensor[1, :]
09:03:44Araqor maybe everything is in a macro anyway so that you can replace the '_' with what you seem fit
09:03:58FromGitter<mratsim> yes it's replaced in a macro
09:04:07FromGitter<mratsim> but it only works in non-generic proc
09:04:30FromGitter<mratsim> in generic procs I get undeclared identifier because symbols are resolved earlier than macro replacement
09:04:35FromGitter<mratsim> even if untyped
09:04:41Araqthere is a special rule regarding 'untyped' contexts within generics so that no 'mixin' declaration is required...
09:05:51FromGitter<mratsim> most of my issues would be solved if untyped macro had precedence over generics symbol resolution, like it has precedence over non-generic procs
09:06:08Araqjrfondren: 'mixin' is for within generics, export is for symbol forwarding within Nim's module system. totally different things
09:06:30FromGitter<jrfondren> I'm talking the top-level mixin statement in that issue, not the normal mixin
09:06:42Araqit doesn't exist, it would be a language extension
09:08:24FromGitter<jrfondren> I get it, it's export + adding a `mixin mixedIn, indirectlyMixedIn` to that `libraryFunc`
09:09:52Araqmratsim: huh? are you saying that untyped should have prio 1 in overload resolution?
09:10:32FromGitter<mratsim> yes, so we can replace idents in macro first, we would also always get idents instead of sym in untyped macro
09:11:29FromGitter<mratsim> If I want to implement a DSL with a {.DSL.} pragma attached to a proc, I think it wouldn't work if the proc is generic as well.
09:12:02Araqin the macro you can check if it's a generic proc and then inject 'mixin _'
09:17:37FromGitter<jrfondren> `x=1` is an expression that depends on an `x` binding in scope when it's interpreted. You can pass expressions like this around, but we've found it's more convenient to use parameterized expressions--functions. which have lots of benefits: it's clear what bindings an expression needs, it's clear where they're provided, you don't have to care about the expression's own names vs. yours.
09:18:26FromGitter<jrfondren> etc. I'm sure that was pretty tedious to read.
09:19:33Araqare you saying that first-class functions are "better than" a macro system?
09:19:49FromGitter<jrfondren> but this mixin stuff sounds very similar, so maybe a similar solution would apply like some syntax to pass a generic procedure the extra parameters it needs.
09:20:36FromGitter<jrfondren> there's nothing first-class there -- that's about having functions vs. only having expressions. the novelty is that you've parameterized your expressions
09:21:22Araqwell 'mixin' serves at least two different purposes here in the discussion: to "declare" a generic constraints. you say 'mixin init' but what you really mean is 'T needs to have a proc init()'
09:21:36FromGitter<jrfondren> the module version of this is 'functor', at least in OCaml. parameterized modules
09:21:56Araqthe other purpose is in DSLs to say "look, there will be a _ symbol, trust me"
09:22:18Araqand it's good for neither purpose :-)
09:23:11FromGitter<jrfondren> yeah, so you could pass around `x+1` with the same constraints as a generic expression, and people could expect that `let x = 42` in scope is how they get that expression to work.
09:24:45Araqyou lost me.
09:25:00Araqwhat do you propose? do you propose anything?
09:25:27Araqhow can I "pass around a generic expression"?
09:27:56FromGitter<jrfondren> huh? you can do that right now with templates. `template addToX = x + 1`. but you wouldn't because you'd run into the same kinds of problems as with this issue. parameters prevent a lot of trouble.
09:28:46Araqok, I see
09:28:47FromGitter<jrfondren> my proposal is that you parameterize mixin symbols instead of having them looked up in scope
09:29:15Araqaha
09:29:37FromGitter<jrfondren> so `proc libraryFunc*T (x: T) =` would need some extra syntax to say that it needs `mixedIn` and then its callers would have to explicitly provide that. it's not as convenient as the current way but it's a cleaner alternative
09:30:04FromGitter<jrfondren> one way it's cleaner is that you can have type signatures in this syntax
09:30:22Araqwell T should be a concept that says "it has an init proc"
09:32:40Araqand we already have syntax for concepts
09:33:01Araqbut we don't typecheck concepts or even look into their "scope" to see what should be available
09:34:10FromGitter<jrfondren> https://caml.inria.fr/pub/docs/manual-ocaml-4.07/moduleexamples.html#sec21 is what I was thinking of. That `module ... end` syntax is what OCaml uses for the 'parameters'. and I guess it's similar to concepts yeah, in that you can write a bunch of code that depends on a stack-like thing and let a caller provide the actual stack your code uses.
09:35:32*couven92 joined #nim
09:38:40FromGitter<jrfondren> maybe Ada's a better example. It does the same thing with generics taking explicit parameters.
09:40:16FromGitter<jrfondren> it's an alternative that's probably easier to reason about (the reason for this issue) but there's the cost that generics are more tedious to use: you can't just call `libraryFunc`, you have to instantiate it with a step that provides the mixins it's looking for, and then call your instantiation.
09:40:51Araqyeah that's why C++ didn't adopt this approach either iirc
09:41:34Araqtime to write my 'concept' proposal I guess
09:41:51FromGitter<jrfondren> cool
09:42:02Araqthen we wouldn't require a 'mixin' declaration for it.
09:42:13Araqand then the issue remains what to do with DSLs
10:12:13clyybberAraq: The self-assignment check has to be done at runtime, right?
10:12:34clyybberJust checking if we don't have a super-smart compile time self-assign checker already
10:13:27Araqyes but you don't do it, =move does it internally
10:13:45clyybberyeah
10:13:49Araqthere is no general way of avoiding the runtime check :-(
10:14:19clyybberI guess there could be, with some heavy aliasing checks?
10:14:25clyybberbut I don't think its feasable
10:14:29clyybberor always decidable
10:15:37clyybbernah, you're right. its impossible for the general case :(
10:20:47Araqyeah but the good news is that the common case can be compiled into a copyMem() instead, sidestepping both '=move' and '='
10:21:18clyybberAraq: We could still leave out the check in `var s = g()` though, as long as we alias check that the rhs doesn't contain s as a parameter
10:21:26clyybberAraq: Yeah, thankfully
10:22:33Araqbe careful though that it's much harder to optimize it even further than it looks
10:23:21AraqI left some comments in the code describing the problems
10:30:33federico3https://lobste.rs/s/jrrpr3/zig_programming_language_for
10:42:03FromGitter<jrfondren> *shrug*, C compiler dev have pretty scary attitudes. I'd just say that it might be nice to write some form-validation code once, in Nim, and then have that same code operate on the (C++ compiled) backend and on the (JS compiled) frontend.
10:43:20PMunchHmm, anyone good with Karax here?
10:44:24PMunchI'm trying to create an alias for tdiv(class="row") to use in my HTML
10:46:52PMunchOh wait, think I figured it out
10:47:21PMunchI tried to take in the body as a parameter, but apparently the DSL get's rewritten to something where the body is added later
10:47:47*floppydh quit (Quit: WeeChat 2.4)
10:54:16*cyberjpn joined #nim
10:54:53dom96federico3: surprised that people are worried about UB due to compilation to C
10:55:12dom96It sounds like something we should rebuttal
10:55:26federico3dom96: yes, please do :)
10:57:30clyybberAraq: So for the runtime check self-assign check, we can either use a temporary variable to store wether a was b, or duplicate the assignment code into both branches, WDYT is better?
10:58:19clyybberI guess the temporary variable because it will get optimized to one register
10:58:29clyybber?
11:00:31Araqyou don't to write this check
11:00:36Araq*don't have to write
11:05:14*disruptek quit (Ping timeout: 258 seconds)
11:07:11Araqclyybber, ah I misunderstood
11:07:18Araqyou need to use a temporary variable
11:07:47Araqvar x = f() becomes var tmp = f(); =move(a, tmp)
11:07:50Araqsucks, I know
11:09:22*dddddd joined #nim
11:10:21dom96federico3 https://lobste.rs/s/jrrpr3/zig_programming_language_for#c_artfwk
11:13:20clyybberAraq: Ah, no. I meant the literal $1.p == $2.p check
11:16:52*hoijui joined #nim
11:16:59Araqclyybber, that check remains as it is (?)
11:17:18clyybberAraq: Oh, its already there? I must have overlooked it
11:17:30clyybberI'm looking at genMove rn
11:19:41*clyybber still can't find it
11:20:00Araqwhat are you looking for?
11:20:31clyybbernot really looking for, but I want to add the runtime check for self assignment, so checking a == b?
11:20:39AraqgenMove has the self assignment checks but it doesn't 'wasMoved()' the target
11:25:28clyybberAraq: Yeah, so to integrate wasMoved into genMove, I still have to do the runtime check?
11:25:39*floppydh joined #nim
11:26:21*Trustable joined #nim
11:26:54clyybberAnd that runtime check needs to happen before I overwrite a ?
11:27:11clyybberSo I have to store if a == b beforehand
11:31:11*disruptek joined #nim
11:31:45Araqyeah
11:32:01Araqwell
11:32:21*deech joined #nim
11:32:26Araqthe whole logic should be inside 'if ($1.p != $2.p) {...}'
11:35:01clyybberah, right. I overcomplicated stuff in my head and got confused
11:44:06*deech quit (Remote host closed the connection)
12:03:09clyybberAraq: Should the destructor of `a` be called if I do "var a; a = a"?
12:03:36clyybbersorry I meant "var a = something; a = a"
12:03:49*theelous3 joined #nim
12:09:55*Snircle joined #nim
12:23:49Araqno that's the whole point of this change
12:24:05Araqafter 'a = a' the 'a' is not empty
12:32:46*Trustable quit (Remote host closed the connection)
12:33:15clyybberright, as you can probably tell, I'm in dire need of lunch :)
12:33:16clyybberbbl
12:35:34FromGitter<alehander42> hm
12:36:36FromGitter<alehander42> how hard would be to have multi-process concurrency in nim
12:36:41FromGitter<alehander42> e.g. what would be the default approach
12:39:22*laaron quit (Remote host closed the connection)
12:39:36FromGitter<jrfondren> default? probably an event machine with async, with threadpool for actions that don't fit into that. You can wait on FlowVars in an addTimer callback.
12:41:35*laaron joined #nim
12:45:46*couven92 quit (Quit: Client disconnecting)
12:49:18BitPuffinis it specified anywhere when the compiler will add a type field on an object
12:49:26BitPuffinit seems like with at least a plain object you don't need a {.pure.}
12:58:33*odc quit (Ping timeout: 250 seconds)
12:58:40*rayman22201 quit (Ping timeout: 252 seconds)
12:58:53*rayman22201 joined #nim
13:00:17*euantor quit (Ping timeout: 250 seconds)
13:00:37*pwntus quit (Ping timeout: 258 seconds)
13:00:50shashlick_There's already an async osproc - https://github.com/cheatfate/asynctools
13:01:03*odc joined #nim
13:01:35*pwntus joined #nim
13:02:58*banc quit (Ping timeout: 255 seconds)
13:03:48*theelous3 quit (Remote host closed the connection)
13:04:08*theelous3 joined #nim
13:07:01*banc joined #nim
13:07:25*vivus joined #nim
13:08:41vivushello all. How can I write a sequence to a file with each item in the sequence spaced out with tab? I am currently trying the following: https://dpaste.de/aaFX
13:09:58narimirandoes `+` work there? i've never seen it used like that
13:10:08vivusyeah it throws an error, so it doesn't work
13:10:22narimiranthen just put the other f.write in a separate line
13:10:22vivusI checked the docs to see if I can add a special option for writeLine
13:10:23xacewell you could discard it i guess
13:10:44*couven92 joined #nim
13:10:52shashlick_Use strutils.join?
13:13:12narimiranvivus: i've just tried http://ix.io/1IVj and it works
13:13:59vivusnarimiran: yep, thanks worked for me too. now I am just going to wrangle the end of the sequence, cause that needs a newline char instead of a tab
13:14:02narimiranvivus: or you can do `stdout.write(word & '\t')`
13:15:47narimiranvivus: shashlick_'s idea might be even nicer: http://ix.io/1IVk
13:16:53*euantor joined #nim
13:30:52BitPuffintype T = object data: UncheckedArray[int] causes error in the C compiler , bug?
13:32:37BitPuffinNI Bla[SEQ_DECL_SIZE]; is the code that's generated
13:32:44BitPuffinbut it's supposed to just be NI Bla[]; I think
13:33:46*laaron quit (Remote host closed the connection)
13:33:47*laaron- joined #nim
13:38:43FromGitter<jrfondren> I think it should probably be a Nim error. what size is that object? how would you make an array of Ts? but yeah it's also bad C codegen.
13:39:30BitPuffinmy expectation was that it was gonna give be a struct that just has a pointer
13:39:59BitPuffinhttps://nim-lang.github.io/Nim/manual.html#types-unchecked-arrays
13:40:02FromGitter<jrfondren> I'd be upset if I got ptrs without asking for them.
13:40:28FromGitter<jrfondren> `ptr UncheckedArray[int]` works fine
13:40:44BitPuffinsounds like a pointer to a pointer though
13:41:03BitPuffinI mean UncheckedArrays are unsafe so I dunno why I'd be upset
13:41:12BitPuffinespecially if you look at the generated code in the manual
13:41:16BitPuffinNI data[];
13:41:19BitPuffinthat's just a pointer :P
13:41:41FromGitter<jrfondren> NI data[2] isn't a pointer. why would you think that NI data[] is?
13:41:55BitPuffinbecause arrays are pointers?
13:42:01FromGitter<jrfondren> No, they're really not.
13:42:32FromGitter<jrfondren> What you can do in C is allocate a 1GB chunk of memory and cast it to that MySeq struct and then index into data.
13:43:03FromGitter<jrfondren> Those indexes will not go through two indirections. There's just the single chunk.
13:43:49FromGitter<jrfondren> but cc's exact error and that example suggestion a solution
13:44:09BitPuffinyes and each one of those chunks would be two ints and a pointer to the array
13:44:17FromGitter<jrfondren> yeah it works if you add prior fields to the object.
13:44:22FromGitter<jrfondren> no, there's no pointer to the array
13:44:26BitPuffinin C X y[]; is the same as X* y;
13:44:41BitPuffinwell the array won't be set to anything
13:44:49FromGitter<jrfondren> you have a struct that has two fields and then however much other data is available. the other data is not behind a pointer. it's part of teh struct.
13:45:27BitPuffinok can you tell me sizeof(MySeq) in C
13:45:45BitPuffinbecause it's gonna be sizeof(int)*2 + sizeof(int*)
13:45:48FromGitter<jrfondren> if you want a pointer say 'ptr' in Nim. if you want a creepy who-knows-how-big-it-is struct, use this thing.
13:46:20BitPuffinyeah I understand that I should use a ptr if I want that intsead
13:46:34BitPuffinbut I'm not sure the codegen is right at least going by the manual
13:46:44BitPuffinespecially since it's erroring when compiling the C code, not in the nim compiler
13:46:50FromGitter<jrfondren> you can confirm what I've said with in a few minutes with writing some C. Arrays in structs, even empty arrays, are not secretly pointers.
13:47:10BitPuffinIf you specify the size of the array in a struct it's not a secret pointer
13:47:15BitPuffinif you just write [] it's a pointer
13:47:17FromGitter<jrfondren> it's a codegen error because Nim shouldn't generate it: Nim should error out
13:47:28FromGitter<jrfondren> no, it's not.
13:48:32*hoijui quit (Ping timeout: 252 seconds)
13:48:47dom96"how hard would be to have multi-process concurrency in nim" @alehander42: the default approach is to do what I did in httpbeast, check out its source code
13:50:58*ng0 joined #nim
13:51:35BitPuffinhuh yeah apparently it's not allowed unless you have other members
13:51:42BitPuffinsurprised
13:51:42BitPuffinMaybe it's that way in c++ or something
13:52:17FromGitter<jrfondren> https://gist.github.com/jrfondren/9cb9742c2ed22b52b278837739780106 <- outputs "hello", instead of garbage, because there's not a pointer there.
13:52:31BitPuffinor maybe someone just told me something wrong many years ago :P
13:53:15BitPuffinalright, good to have that cleared up
13:55:37BitPuffinthanks!
13:55:39FromGitter<jrfondren> good example of this stuff is the getdents syscall in linux, where the linux_direct struct's size depends on how long the corresponding filename is
13:59:29BitPuffinyeah looking at it now
13:59:48clyybberAraq: While at it should I rename =sink to =move ? Otherwise it's kind of a misnomer, no?
14:00:04Araqyes, it's =move
14:00:12Araqit should also be renamed internally
14:00:21clyybberyep
14:00:29Araqand in semstmts.nim you need to check for the a, b: var T prototype
14:02:00Araqand system.move must call =move
14:03:26*PMunch quit (Remote host closed the connection)
14:04:01clyybberAraq: I can remove wasMoved, reset is fine?
14:04:26Araqyes
14:04:33BitPuffinI wonder then if sizeof should error if you use it on a type that has uncheckedarray in it
14:05:16AraqBitPuffin: it should indeed
14:05:58FromGitter<jrfondren> nah, if you're going to allocate memory for these things, it's useful to get the size of the members without the flexible array, so that you can add on the space you want the array to occupy
14:06:09Araqthat too
14:06:27Araqespecially wrt alignment
14:06:41BitPuffinwould it be more correct then to have a special sizeof for that so it's clear that you intended to do that?
14:07:06Araqno, 'sizeof' is a "trust me" feature
14:08:40clyybberAraq: I can remove system.move's magic if I map it to =move and add magic: "Move" to it right?
14:09:05clyybberor does =move still have to have asgn magic?
14:11:24Araquh I don't know
14:11:39clyybberok, I'll just try
14:11:44Araqthe tests will tell us, I would start with changing as little as possible
14:13:18clyybberAraq: I can remove wasMoved internally too, right? Basically all optimizations are gone/
14:13:52clyybberor should we still try to elide destructors internally?
14:15:46Araqwe still try to elide them but I don't think we need a wasMoved for it
14:16:13Araqplease note that the rewrite rules as written in the spec/wiki page didn't change
14:18:21*couven92 quit (Quit: Client disconnecting)
14:21:51*leorize joined #nim
14:34:11*hoijui joined #nim
14:35:57*hoijui quit (Remote host closed the connection)
14:36:11*hoijui joined #nim
14:51:00FromGitter<alehander42> thanks @dom96
14:51:26FromGitter<alehander42> btw how to set resp to return e.g. text/javascript
14:52:11FromGitter<alehander42> application/javascript*
14:52:28leorizethere's a second/third param to resp
14:53:22FromGitter<alehander42> forgive me
14:53:25FromGitter<alehander42> yes indeed!
14:53:45FromGitter<alehander42> resp page, contentType="application/javascript"
14:53:54FromGitter<alehander42> vry cool
14:54:52FromGitter<alehander42> usually with ";charset=utf-8" *
15:09:54narimiranhm, how to have a collection of different typedescs? e.g. `{int8, int16, int32}`
15:10:23*cyberjpn quit (Ping timeout: 244 seconds)
15:11:53rayman22201Uh... Can we get a blog post or something about the change from "sink" to "move"? That seems like a big change for those of us following destructors and newruntime stuff from the outside, and there has been very little communication lately about it.
15:14:04Araqrayman22201: it's the last change before the wiki page shows up as a spec in the manual, fair enough?
15:15:38*vivus quit (Remote host closed the connection)
15:19:41clyybberbbl
15:19:44*clyybber quit (Quit: WeeChat 2.4)
15:22:18rayman22201@Araq: meh. Wiki is not great for marketing, but ok.
15:23:03Araqno, I mean the contents of the wiki page is copied into the manual
15:23:33Araqanyhow the change is not really disruptive, what used to be '=sink' becomes '=move'
15:24:11Araqand we use C++'s "rule of zero" design, so your ordinary code isn't affected
15:25:29shashlick_Araq: i know we discussed this earlier, but are you still open to bringing in more "os" module capabilities into the VM
15:26:27shashlick_nimterop does all sorts of stuff at compile time and it will help to get more of os specific capabilities in there
15:26:53Araqshashlick_: wouldn't it be wiser to make 'nim e stuff.nim' use 'nim c -r' with some caching?
15:27:22shashlick_i don't mean nimscript, i mean static: xyz
15:27:38shashlick_plus anything added to vmops gets inherited by nimscript as well
15:28:50Araqwhat do you need from os?
15:30:16shashlick_all file and dir actions like cp, rm, etc.
15:30:46shashlick_permissions, time, size, etc.
15:32:43Araqwhat? why?
15:33:13FromGitter<jrfondren> `static: removeFile("/etc/passwd")`
15:34:24shashlick_https://github.com/nimterop/nimterop/blob/master/nimterop/git.nim#L23
15:34:33shashlick_i've shown you that before too
15:35:15shashlick_i need mkDir at compile time since I can clone a git repo at compile time and it needs to create a dir
15:35:39shashlick_i sometimes need to edit source files, move them around, delete them, etc.
15:36:04Araqcan't you staticExec your nimterop tool/helper which does all these things you need to do?
15:36:36Araqat least then I only have to review the tool you use in staticExec instead of having to read every line of code you've written
15:37:26shashlick_the helper tool uses tree-sitter to parse source code and then renders nim code, that too because i couldn't do ffi at compile time
15:37:38shashlick_it is much faster and can be used standalone so it is a good thing no doubt
15:37:51shashlick_but having it do file operations is a little sad
15:38:48shashlick_if you can do these things are run time, why cannot you do it at compile time
15:39:32Araqexactly, you already have the helper tool
15:39:53Araqyou might as well exploit this fact. is that really so bad?
15:40:21shashlick_the point isn't that i'm blocked - I'm not, but it is a question on why nim should be limited in general
15:42:23shashlick_if you can staticExec anything then avoiding createDir() or removeFile() is an artificial limitation
15:45:22FromGitter<jrfondren> Emacs's email reader had the feature for a while of automatically executing Lisp signatures in emails sent to you. What do you think of that?
15:46:48FromGitter<jrfondren> You could always pre-read your email to make sure it's safe. You could have whitelists so that only trustworthy people send you email. It could have been a feature that people used without ever being harmed by it. In fact I doubt anyone was ever actually seriously harmed.
15:47:51FromGitter<jrfondren> But it's unsafe because people don't think of "open an email" as an operation that could potentially do lots of other stuff. People also don't think of "compile a file" as capable of anything.
15:48:31shashlick_That's not true already - you can do all sorts of things at compile time already
15:49:12Araqwell Araq in 2008 thought 'staticExec' was a good idea, Araq in 2019 is more cautious
15:49:21rayman22201Araq my point is about commicating the design. And marketing. Your destructors blog post got a lot of traction on HN, etc... Now suddenly people see "move" in the manual / wiki, with no explanation for why, or even a historical notice that it was changed.
15:50:06*nsf quit (Quit: WeeChat 2.4)
15:50:09Araqand staticExec is at least a single entry point which we can start to protect
15:50:31Araqlike --simulateStaticExec would write what it would execute but doesn't do anything
15:50:51shashlick_I am conservative too so I'm asking why compile time is seen as something special
15:51:06shashlick_Anything you execute on your system can do crazy things
15:51:54Araqrayman22201: well I will write a "design rationale", but I don't see the big picture here. for me it's a detail and all the basic ideas are untouched
15:52:26Araqer, 'unchanged'
15:52:46shashlick_No doubt you have to be cautious but Nim itself does a whole bunch of file and directory manipulations
15:53:20shashlick_If you are trusting Nim then the same would apply to any module you decide to download and compile
15:53:50zestyrmaybe a flag that prompts the user on staticExec calls?
15:54:05FromGitter<jrfondren> "your wordpress uses php. you already trust php. so what's wrong with installing this php shell that anyone can use to perform arbitrary commands on your server?"
15:54:24Araqnow you are talking about trust. trusting few people is easier than trusting everybody
15:55:00Araqand that's also why I want a "nim + batteries included" whereas many argue for "nim + web of nimble packages"
15:56:12Araqand yeah Nim does lots of directory manipulation crap and this code is fragile but at least decently debugged
15:56:21rayman22201People get attached to certain words. They need assurance that it is a design detail. For me sink had some fundamental assumptions about last read that move does not. I need someone to hold my hand and tell me that move will not break the design. HN crowd especially needs that hand holding.
15:57:07Araqplease notice that 'sink' parameters are as they were before, but the "optimized" assignment operator called '=sink' is now '=move'
15:57:52Araqeven more like C++ does it, sad but then maybe C++ is this misdesigned piece of junk that many think it is
15:58:05Araq*isn't
15:58:06Araqlol
15:59:13Araqzestyr: that would also be nice, yes
16:00:05Araqshashlick_: ultimately the real problem here is the lack of good "sandboxing" a good OS could provide
16:02:59FromGitter<jrfondren> Suppose you're working on some high-security project, like a tor competitor. A fun thing to think about is what a bad actor would look like, if one showed up. Someone suddenly saying, "hey, for convenience, shouldn't we fall back to cleartext?" One thing a bad actor would like is making things hard to follow, and making things violate expectations. This memory is normally read-only but how about adding a flag so it
16:02:59FromGitter... can be writable in this special case everyone will forget about.
16:04:00FromGitter<jrfondren> I'm not saying that you're bad, just that what you're saying is what bad people would say :) so that's why you might get some pushback
16:05:25shashlick_@jrfondren - i get all your examples and deal with security concerns routinely at work but the fact is that nim already does all sorts of stuff that goes beyond what a compiler would do doesn't help
16:05:34shashlick_by this logic, readFile and writeFile should also go away
16:05:54FromGitter<jrfondren> I'd want them to go away yes, with a flag.
16:06:16FromGitter<jrfondren> they might already be a problem for some online services, code competitions, compiler explorers
16:06:18shashlick_then even macros start to smell a bit
16:06:21rayman22201@Araq: ah. Ok. I missed the part about the assignment optimization and not parameters. That is less severe. Lol @ C++. C++ is half great design and half shit. The problem is that you can't separate the two halves. 😝
16:06:25FromGitter<jrfondren> no, macros really don't
16:06:33shashlick_nimble already has flags to simulate, i wonder how many actually have used it
16:06:42FromGitter<alehander42> macros have very good reasons to use readFile
16:07:34shashlick_the goal of my questions are not to force one way or the other, it is to have a consistent capability set
16:10:53*xet7 quit (Quit: Leaving)
16:30:18*shashlick_ quit (Remote host closed the connection)
16:30:37*Trustable joined #nim
16:30:40*shashlick joined #nim
16:35:15shashlickultimately it depends where you draw the line for Nim - if you equate it to gcc and co, ya i agree. if you think it takes over things that are typically handled by configure, cmake and friends, then it is a different story. if we defeature or become more conservative, people will go into using nimscript or bash or what have you
16:37:05shashlicknote that today you can add a variety of stuff into an appname.nims and it will do all these things for you so if security is the rationale for mkDir not being available, there's a variety of holes i can crawl through, and so will others
16:38:12*Jesin quit (Quit: Leaving)
16:38:25LyndsySimonI've been away from Nim for a while, but I think either it or another language I've toyed with has changed the way I think.
16:39:31LyndsySimonLet's say I have a string that represents a serial number. It should always be in the format `[A-Z]{3}[0-9]{5}`. Is there a way in Nim to accept a serial number as an argument to a function, and implicitly constrain values to that format?
16:43:04*PrimHelios quit (Ping timeout: 252 seconds)
16:45:33FromGitter<jrfondren> you can create a type thats a `distinct string` and only create that type after such a check. This can be pretty inconvenient, but it does give you the protection you want, and SqlQuery's a good example from the db modules
16:46:42*Jesin joined #nim
16:53:09*floppydh quit (Quit: WeeChat 2.4)
16:58:26*Jesin quit (Quit: Leaving)
17:09:06*Jesin joined #nim
17:10:46FromGitter<jrfondren> https://gist.github.com/jrfondren/d67c36d89d903f981f18181aeff61b0f <- and that works, although you wouldn't want to use that constructor syntax very much...
17:23:09*poopBot joined #nim
17:24:59*poopBot quit (Remote host closed the connection)
17:42:52FromGitter<mratsim> regarding staticExec is it triggered by nimsuggest?
17:43:36FromGitter<mratsim> all the OS proc actually, because if you are writing a wrong directory, you can easily delete your home (like the nimscript bug I raised half a year ago)
17:46:26ZevvLyndsySimon: you'd have to match that yourself
17:48:52*poopBot joined #nim
17:49:30poopBotis there some autocomplete for vim or emac or soemthing i want to start using some terminal editor :)
17:50:10FromGitter<jrfondren> neovim has pretty good autocomplete
17:50:35FromGitter<jrfondren> https://forum.nim-lang.org/t/4596
17:52:38poopBotnice it looks nice hope i can surive vim style :)
17:53:09poopBotwill try it now i go restart pc need to fix this font not showing thingy
17:53:46*poopBot quit (Remote host closed the connection)
17:54:01leorizepoopBot: if there's any problem, feel free to ping me on irc :p
18:23:19*neceve quit (Read error: Connection reset by peer)
18:23:31*disruptek quit (Quit: Bye)
18:24:54*disruptek joined #nim
18:41:02ZevvCan anyone explain to me how to properly switch between Nim versions in git? If I do a checkout to 19.4.0 coming from devel, I can not build and get "Error: undeclared identifier: 'is'"
18:41:21ZevvI usually resolve this by throwing away everything and doing a clean checkout/build, but that's cumbersome
18:41:32ZevvI often run into this trying to bisect things
18:41:47*kapilp joined #nim
18:43:43FromGitter<jrfondren> what are you running that gives you that error? I usually ./koch boot -d:release after making changes, but I haven't ever switched releases like that. I have the stable nim installed and try devel with path/to/Nim/bin/nim
18:44:37Zevvsame: ./koch boot -d:release
18:45:05ZevvMy normal setup is always dev, updating every few days. But switching back is always a pita
18:45:27shashlickYou are basically using the new Nim to build the old Nim
18:46:23Zevvindeed
18:46:40shashlickProbably should keep the csources repo and move that back and forth too
18:48:05Zevvhm ok
18:49:08*dddddd quit (Ping timeout: 268 seconds)
18:49:17shashlickSeems excessive, perhaps Araq has a better idea
18:49:37ZevvI always like to use git bisect to automatically find stuff, but that's not trivial here
18:51:03FromGitter<alehander42> Doesn't choosing
18:51:11FromGitter<alehander42> Choosenim
18:53:28ZevvNot finegrained enough for bisecting
18:57:38*Vladar quit (Remote host closed the connection)
18:57:57*Vladar joined #nim
19:00:51*dddddd joined #nim
19:31:00*sacredfrog joined #nim
19:37:23*nsf joined #nim
19:37:44narimiranZevv: you need csources and to run build_all.sh
19:38:01*Trustable quit (Remote host closed the connection)
19:38:24narimiranpro tip: once you manage to build old stable, rename it so you don't have to go through the agony again
19:46:39*jasper__ joined #nim
19:52:45*noonien quit (Quit: Connection closed for inactivity)
19:56:34*Vladar quit (Ping timeout: 246 seconds)
19:57:30shashlick@narimiran I see you posted 0.19.6
19:57:33*xet7 joined #nim
19:57:40shashlickDid you post the Linux binaries or just source
19:59:56narimiranshashlick: Arag did that part, and from what i can tell it is just source: https://nim-lang.org/install_unix.html
20:01:52narimiranbtw, there is a PR which aims to improve that page: https://github.com/nim-lang/website/pull/146
20:09:41*nsf quit (Quit: WeeChat 2.4)
20:14:42*stefantalpalaru joined #nim
20:18:55stefantalpalaruThe 0.19.6 test suite hangs for me, on Linux, in "tests/parallel/tflowvar.nim": https://gist.github.com/stefantalpalaru/6d83c40799f8de19b2cc5286f7624430
20:35:25*narimiran quit (Ping timeout: 246 seconds)
20:40:29*hoijui quit (Ping timeout: 250 seconds)
20:46:42Araqstefantalpalaru: run it again? I don't think it's a regression
20:51:22*ng0 quit (Quit: Alexa, when is the end of world?)
20:58:17stefantalpalaruIt passed the second time, so the deadlock is intermittent.
21:00:38*kapilp quit (Quit: Connection closed for inactivity)
21:05:03shashlickAraq: not posting the linux binaries officially? just source?
21:07:34shashlickif we can start posting those then choosenim can install binaries on linux as well
21:08:17Araqshashlick: we have no naming scheme for them
21:08:31Araqand no download links
21:09:38shashlickthey are already built on nightlies regularly
21:09:50shashlicknim-0.19.9-linux_x32.tar.xz and nim-0.19.9-linux_x64.tar.xz
21:09:58shashlickor 0.19.6 for that matter
21:14:41stefantalpalaruThis second test run had another failure in another parallel test: https://gist.github.com/stefantalpalaru/d732c0e65fe802cc07123ae1f583c2e6
21:16:39Araqyeah threadpool is beyond repair, I've had this one myself too
21:17:40*jjido joined #nim
21:21:58*jjido quit (Client Quit)
21:22:36*jjido joined #nim
21:30:05*sacredfrog quit (Ping timeout: 268 seconds)
21:33:10*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:40:45*krux02 quit (Remote host closed the connection)
21:48:24*Hexeratops joined #nim
21:49:41*jasper__ quit (Quit: Page closed)
21:54:56Araqbug #88 (!!!) fixed here, https://github.com/nim-lang/Nim/pull/11243
21:58:03shashlickNice work! 7 years
21:58:23FromGitter<kaushalmodi> I watched that zig video half way, and I'm like "meh, Nim already does that"
21:58:48FromGitter<kaushalmodi> Might finish the video later, but are there any real takeaways from that video?
22:00:23Araqthe talk I watched was like "how to deal out-of-memory is the most important problem out there for Zig and unfortunately we don't know C++"
22:02:17Araq"Or Ada. Or any systems programming language that is not C."
22:03:47*hecanjog quit (Quit: WeeChat 2.4)
22:11:28*solitudesf quit (Ping timeout: 258 seconds)
22:19:18*rockcavera quit (Remote host closed the connection)
22:19:41rayman22201congrats on #88 Araq
22:19:54rayman22201I haven't even seen the video and I already share both of those thoughts about Zig lol
22:24:07*rnrwashere joined #nim
22:29:00*rnrwashere quit (Read error: Connection reset by peer)
22:30:04*rnrwashere joined #nim
22:38:56*rnrwashe_ joined #nim
22:40:30*rnrwashe_ quit (Remote host closed the connection)
22:40:33*I_Right_I joined #nim
22:40:40*rnrwashere quit (Ping timeout: 258 seconds)
22:41:08*rnrwashere joined #nim
22:41:18*cyberjpn joined #nim
22:45:17*rnrwashere quit (Ping timeout: 250 seconds)
22:47:54*rnrwashere joined #nim
23:12:54*xet7 quit (Quit: Leaving)
23:14:52*thomasross joined #nim
23:29:40I_Right_IHow's the newruntime coming along?
23:30:07stefantalpalaruI got tflowvar to deadlock again, by running it in a loop. This time with debug info: https://gist.github.com/stefantalpalaru/d104153310ef42b17ead248a011c27c8
23:31:11AraqI_Right_I: https://github.com/nim-lang/Nim/issues/11217
23:31:22I_Right_Ithx
23:32:45Araqstefantalpalaru: doesn't help me, I would throw away the condition variables in threadpool.nim and replace them with good old polling
23:33:01Araqthe only thing that really scales :-)
23:39:05*I_Right_I quit (Remote host closed the connection)
23:39:49*cyberjpn quit (Ping timeout: 244 seconds)
23:57:07*rnrwashere quit (Remote host closed the connection)