<< 15-01-2019 >>

00:08:22*shpx quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
00:09:03*shpx joined #nim
00:09:13*shpx quit (Client Quit)
00:12:44FromGitter<zetashift> So I have a `Player` type that inherits from `Entity` and I'm passing a `seq[Entity]` to my render function to render them all on screen, however my Player type isn't accepted obviously. doing `@[Entity(player)]`works for now, what is smarter here, coercing into entity's or modify the render function to support player and entity?
00:16:45FromGitter<timotheecour> @krux02 done, see https://github.com/nim-lang/Nim/pull/10303
00:18:26*shpx joined #nim
00:20:30FromDiscord_<j$> is there a way to import a nim module to all files ?
00:23:20*shpx quit (Ping timeout: 268 seconds)
00:25:42sillibirdI uploaded a pastebin of more details of exactly what I am trying to accomplish, and an example of what I mean, if anyone had any ideas https://pastebin.com/WuKLAKqf
00:32:48sillibirdActually I kind of just got it, using Option[]
00:33:00FromDiscord_<moerm> see you
00:37:03sillibirdIs it possible to make the direct result of a Option nil instead of (val: ...has: ...)
00:37:37FromGitter<zetashift> set it to none?
00:38:48sillibirdHow exactly do you set it?
00:40:53FromGitter<zetashift> say your proc returns an `Option[int]` you could set the initial value like `result = none(int)`
00:41:39FromGitter<zetashift> and along your proc you get the value you could do `result = some(3)` for example
00:42:00sillibirdIts in a type, the proc always returns the type, its just a types field value that changes
00:42:04*leorize joined #nim
00:42:37FromGitter<zetashift> so from your pastebin example `userId` may or may not exist
00:43:05sillibirdNo, it's the `broadcast`
00:43:17sillibirdIf it exists, its equal to the type above it, otherwise its nil
00:43:33FromGitter<zetashift> oh yea
00:44:09FromGitter<zetashift> just do `broadcast: Option[Broadcast]` and it's initial state should be `none(Broadcast)`
00:44:58FromGitter<zetashift> so if it's `isSome` you'd get a broadcast or else you'd get none
00:45:21sillibirdHow do you set an initial state?
00:47:24FromGitter<zetashift> it's already implicitly set to none(Broadcast) or you could write a proc that sets it
00:47:44FromGitter<zetashift> the default is empty
00:49:57sillibirdAlso can I use Option to work where I'll have one that's either a `string` or `int` or similar?
00:51:02FromGitter<zetashift> no, option works really well when you have something or a nil, for your `string` or `int` you might be better of with a variant
00:51:20FromGitter<zetashift> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
00:52:25sillibirdAh, thats what I was afraid of, it makes it slightly messier
00:52:51FromGitter<zetashift> you could also do https://github.com/vegansk/nimfp/blob/master/src/fp/either.nim
01:00:23sillibirdThe `Option[]` behavior seems weird, if I run repr() on the result, I get a empty Broadcast, but if I try to print out a direct item it doesnt exist
01:04:27*Sentreen quit (Ping timeout: 240 seconds)
01:11:09*Sentreen joined #nim
01:24:32sillibirdHow should I handle having two types with the same name, if they need to be unmarshalled I can't just rename one
01:24:52*sillibird quit (Quit: Page closed)
01:27:08*dddddd quit (Remote host closed the connection)
01:30:28*Tanger quit (Remote host closed the connection)
01:49:51*zachk joined #nim
01:55:08*Tyresc quit (Quit: WeeChat 2.4-dev)
01:58:17*Tanger joined #nim
02:02:42*zachk quit (Changing host)
02:02:42*zachk joined #nim
02:37:56*zachcarter joined #nim
02:40:22*zachcart1r quit (Ping timeout: 272 seconds)
02:52:40*seni quit (Quit: Leaving)
03:00:35*banc quit (Quit: Bye)
03:00:37*rockcavera quit (Read error: Connection reset by peer)
03:01:20*rockcavera joined #nim
03:01:20*rockcavera quit (Changing host)
03:01:20*rockcavera joined #nim
03:17:44*banc joined #nim
03:35:03*zachk quit (Quit: Leaving)
03:42:44*sillibird joined #nim
03:43:18sillibirdHow exactly is Option[] supposed to work, I'm expecting it to print `nil` but it returns a `(val: ...has: ...)`
03:47:08leorizeyou check it with isSome/isNone then get() your result
03:47:41leorizethere's also getOrDefault()
03:48:07sillibirdoh, i think i might be using the wrong thing in my case
03:48:43sillibirdI wanted to have it set to a types field can be multiple things
03:49:08*Mennnnnnnnnnche is now known as Elronnd
03:49:18*lritter quit (Ping timeout: 268 seconds)
03:49:24*lritter_ joined #nim
03:50:29leorizesillibird: you would need a variant object
03:50:38leorizeyou can read more about them in the manual
03:53:52sillibirdI tried it already, but not entirely sure how to use it. It seems like it only works if you want to have different fields based on a different type in. I wanted to have the same field, that can switch to being an int or a different type or whatever
03:55:17*skellock joined #nim
03:56:59leorizethat's not possible currently, but you can make a getter proc that detects the current field
03:59:13sillibirdlike having separate types for each different combination, and then using a proc to determine which to use?
04:03:31*nsf joined #nim
04:24:31leorizesillibird: here's a quick PoC http://ix.io/1yn4
04:26:05sillibirdThe problem is that I'm using unmarshalled json responses, so the types field names have to remain the same
04:26:23*vlad1777d quit (Ping timeout: 268 seconds)
04:27:06leorizehave you looked at JsonNode of the json module?
04:28:33sillibirdYeah, I suppose I can leave it in node form but it seems more natural in types
04:35:22leorizeyou can nest the variant object into your real object
04:38:20leorizesomething like this: http://ix.io/1yn5
04:48:07sillibirdthe possible solutions are getting more and more complex, I really wish there was a more straightforward way of achieving it
04:49:12leorizeJsonNode is likely your best bet
04:49:37leorizeit's not complex, which is great
04:53:30sillibirdYeah, I guess thats the route I will take
05:13:42*leorize quit (Quit: WeeChat 2.3)
05:13:51TangerHey folks, I'm looking for iscntrl() from ctypes.h. Does anybody know if it's part of the standard library, but just named differently?
05:14:43TangerOr can I maybe call `not isAlphaNumeric`?
05:23:53*troido quit (Quit: WeeChat 2.3)
05:30:54*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
05:36:31sillibirdIs there anyway to get more details on a Error? I have an AssertionError that isnt exactly clear
05:45:10*BigEpsilon joined #nim
05:48:44*sillibird quit (Quit: Page closed)
05:57:56FromGitter<Varriount> sillibird: Usually you should be a line number that the exception originated from
06:01:15*narimiran joined #nim
06:15:41*leorize joined #nim
06:38:58*BigEpsilon quit (Ping timeout: 268 seconds)
06:53:14*skellock quit (Ping timeout: 250 seconds)
06:58:58FromGitter<gogolxdong> How to achieve realtime stream data using websocket?
07:00:48*krux02 joined #nim
07:12:16*cspar quit (Ping timeout: 268 seconds)
07:20:11*skellock joined #nim
07:24:44*skellock quit (Ping timeout: 272 seconds)
07:25:36*kapil____ joined #nim
07:25:56*cspar joined #nim
07:30:38*Perkol joined #nim
07:34:44*BigEpsilon joined #nim
08:00:00*gmpreussner quit (Quit: kthxbye)
08:00:54*Perkol quit (Remote host closed the connection)
08:02:40*vlad1777d joined #nim
08:05:05*gmpreussner joined #nim
08:23:57*lritter_ quit (Remote host closed the connection)
08:30:18*absolutejam joined #nim
08:42:50absolutejammornin'
08:47:59FromGitter<mratsim> hey there
08:48:59FromGitter<timotheecour> does anyone know how to exportc a symbol with ‘extern C’ when using `nim cpp`?
08:49:24leorizejust {.exportc.}
08:49:38leorizeyou can't export cpp symbols last time I tried
08:49:38FromGitter<timotheecour> no, it’ll use C++ mangling
08:50:39FromGitter<timotheecour> i want to export a particular symbol with C mangling, not C++ mangling, when in `nim cpp`; i also tried `extern:”foo”; that still mangles using C++ mangling
08:51:30leorize{.emit: """extern "C" { <retval> <name>(<params>); }""".}
08:51:33leorize^ have you tried that?
08:52:11FromGitter<timotheecour> well i was hoping to avoid using `emit` as it’s overkill/ugly/error prone for this task but i’ll try
08:52:36leorizesometimes you just don't have a choice :P
08:53:07FromGitter<timotheecour> well then it’s a bug in Nim that shd be easy to fix if it’s unsupported
08:53:18FromGitter<timotheecour> all codegen has to do is insert NIM_EXTERNC
08:53:51leorizegiven that we can't importcpp procs either, I think it's fair to just make exportc, well exportc :)
08:54:13FromGitter<timotheecour> FWIW it’s root cause of 1-before-last remaining failure that prevents us from running `nim cpp` in non-disabled mode in CI
08:54:24*floppydh joined #nim
08:55:10FromGitter<timotheecour> (i just fixed 3 out of 5 here https://github.com/nim-lang/Nim/pull/10310; with that exportc thing, there’ll be just 1 left!)
08:56:27leorizeouch -ffast-math
08:56:55FromGitter<timotheecour> ouch meaning
08:57:09leorizeit bites :P
08:57:22leorizeI wonder what was it doing there
08:57:47FromGitter<timotheecour> Well, it was painful to track down that bug and the resolution
08:58:34*vegai joined #nim
08:58:58FromGitter<timotheecour> > given that we can't importcpp procs either ⏎ ⏎ what do u mean? `importcpp` exists and is used in Nim repo; that being said, there’s another bug with it, but different from what i mentioned above
08:59:15leorizeyou can't import a C++ proc without headers
09:00:09FromGitter<timotheecour> ya the bug i noticed was related to that; but what about this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3da1190721b912a581e276]
09:00:15FromGitter<mratsim> I don't have issue to export C with C++ code :?
09:01:09leorizetimotheecour: see the module name lol
09:01:12FromGitter<timotheecour> @mratsim r u sure? i’m specifically searching for a way to have `extern “C”` for a exportc proc (when in `nim cpp`)
09:01:30FromGitter<mratsim> ah indeed I don't use exportc and use defautl C++ mangling when building my dll
09:01:39FromGitter<mratsim> https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim
09:02:22FromGitter<timotheecour> @leorize well there r other examples eg: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3da19e1cb70a372adfacf3]
09:03:04leorizeimportcpp by default rewrite to firstparam.proc(theest)
09:03:11leorizeimportcpp by default rewrite to firstparam.proc(theRest)
09:05:59FromGitter<timotheecour> ok; so `proc prtemp1(){.importcpp.}` should be rejected by nim instead of silently doing nothing (it doesn’t generate a declaration in generated c++ sources)
09:09:58FromGitter<timotheecour> also, we shd come up w a good syntax for making an `exportc` proc be `extern “C”`; how about: ⏎ `proc foo() {.exportc:”bar”, externc}`
09:11:51FromGitter<timotheecour> likewise, we need the converse of that for `importc` (which currently defaults to `extern “C”` regardless of using `nim c` or `nim cpp` ; so we could also introduce: ⏎ `proc foo() {.importc:”bar”, externcpp}`
09:13:17FromGitter<timotheecour> Or probably even better: `mangling:c`. `mangling:cpp`, `mangling:<whatever>` which could be extended in future to : D, objc etc)
09:13:44leorizewell, how about keeping exportc to what it name implies?
09:13:48leorizeexport to C
09:14:19FromGitter<timotheecour> ok so change existing semantics ?
09:14:35FromGitter<timotheecour> right now exportc mangles to nim’s mode
09:15:19FromGitter<timotheecour> that’d require adding `exportcpp`
09:15:55leorizethere's also the RFC about renaming importc and importcpp
09:16:00leorizemaybe you should check that first?
09:17:07Araqtimotheecour: why does tfloatmod fail in NIM_COMPILE_TO_CPP mode, but not in the normal mode where the targets are targets: "c c++ js"
09:17:17Araqwhich ALSO tests for C++?
09:17:25*Vladar joined #nim
09:17:30Araqthat's a complete mystery to me
09:17:43Araq(and on my local machines it works)
09:19:01*naiveai joined #nim
09:22:12ZevvIf travis failed on my PR because a problem in the devel version I rebased on, is there something I should do to rerun the tests?
09:22:34Araqrebase it and blame me
09:23:23ZevvIf anyone, it is eventually always you who should be blamed for all of this, I guess
09:23:26Zevvwill do :)
09:25:11FromGitter<alehander42> sillibird: is `data` itself always a different type?
09:25:56FromGitter<alehander42> one can also model it using `variants` without the `[]` typedesc stuff etc, just `case`-ing on `kind` each time he uses it
09:26:02FromGitter<alehander42> but really depends on the usecase
09:26:21*naiveai left #nim ("WeeChat 2.3")
09:35:29*ng0 joined #nim
09:51:10*stefanos82 joined #nim
09:54:23FromGitter<timotheecour> > *<Araq>* that's a complete mystery to me ⏎ ⏎ @araq ya that’s why it was painful to find the fix for that bug; I’ve just added a commit that should answer your question, see latest commit in https://github.com/nim-lang/Nim/pull/10310
09:54:35*dddddd joined #nim
09:54:37*enow joined #nim
09:55:30FromGitter<timotheecour> (that’s why i had to use `volatile` in my minimal C++ example in https://github.com/nim-lang/Nim/pull/10310#issue-244694867)
10:00:12Araqstill doesn't explain it to me, we don't use -d:release for NIM_COMPILE_TO_CPP
10:02:06FromGitter<timotheecour> ```kochExec "boot -d:release”``` ⏎ ⏎ is executed before the tests, so looks like we do use -d:release [https://gitter.im/nim-lang/Nim?at=5c3daf9e8318994524f15ad1]
10:03:24*oculux quit (Ping timeout: 258 seconds)
10:04:53Araqah so the Nim compiled as C++ produces the difference?
10:06:18FromGitter<timotheecour> 1) nim compiled as c with fail with `nim cpp -r -d:relase ` on `fun2(i)` example ⏎ 2) nim compiled as cpp with fail with `nim cpp -r -d:release ` on `fun()` example at CT
10:07:44FromGitter<timotheecour> i think it all makes sense; the code that implements `system.==` will cgen to C++ `==` which is wrong when fastmath+O3 is used; that fact explains everything else
10:08:55FromGitter<timotheecour> (taking into account that some nan bugs will be hidden by fact that some const folding takes place; hence the modified volatile in C++ sample code; or the modification from fun to fun2 to expose that bug)
10:09:39*PMunch joined #nim
10:19:09FromGitter<timotheecour> why do we have: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ => ok to change to `kochExec “boot”` ? [https://gitter.im/nim-lang/Nim?at=5c3db39d20b78635b627b473]
10:33:15FromGitter<timotheecour> => PR https://github.com/nim-lang/Nim/pull/10312
10:35:38Araqwhy would I know? you wrote the code
10:37:03FromGitter<timotheecour> as i mentioned in PR it was pre-existing : that thing originated from travis, see https://github.com/nim-lang/Nim/pull/10183/files#diff-354f30a63fb0907d4ad57269548329e3L45
10:37:34FromGitter<timotheecour> `- env NIM_COMPILE_TO_CPP=false ./koch boot` ; anyway, that PR shd fix it cause i can’t think of any reason for that behavior
10:45:57*oculux joined #nim
10:49:27Araqstill can't reproduce it, I use clang 7.0
10:50:28Araqnim cpp -d:release -r tests/float/tfloatmod is green
10:52:11FromGitter<timotheecour> are you on osx , and compiled nim using devel (not that PR) ?
10:53:48FromGitter<timotheecour> and are u using devel version of ` tests/float/tfloatmod` or the one from PR where I added a test that makes existing nim fail
10:55:14FromGitter<timotheecour> for reference, for me: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ but I doubt it matters; can u at least reproduce the C++ example i gave here: https://github.com/nim-lang/Nim/pull/10310#issue-244694867 [https://gitter.im/nim-lang/Nim?at=5c3dbc128318994524f1b019]
11:04:29FromGitter<timotheecour> @araq i want to tackle the other 2 remaining c++ failing tests so we can finally have non-disabled c++ target; for $nimc_D/tests/parallel/twrong_refcounts.nim I’m running into a blocker; which is that it’s impossible to have `importc` with `extern C` ; can we add syntax: `proc foo() {.exportc, mangling:c .}` which will add `NIM_EXTERNC` if run via `nim cpp` (or noop if run via `nim c`)
11:04:41AraqI'm on OSX
11:05:22FromGitter<timotheecour> ok, what’s ur output for `clang++ -o /tmp/D20181107T193702 -ffast-math -O3 $timn_D/tests/nim/all/t0103.cpp`
11:05:26Araqtwrong_refcounts: just use target: "C"
11:05:50FromGitter<timotheecour> (see example in https://github.com/nim-lang/Nim/pull/10310#issue-244694867)
11:07:26FromGitter<timotheecour> `target: “C”` will work, fine with doing it as workaround, but doesn’t address root problem which is that it’s impossible (AFAIK) to have nim code create `export C` in `nim c` mode
11:07:40FromGitter<timotheecour> 1) in nim cpp mode
11:08:03Araqyeah whatever
11:08:45FromGitter<timotheecour> so r u ok w `proc foo() {.exportc, mangling:c .}` which naturally extends to otehr mangling now or in future (objc, D etc)
11:08:55Araqfixes are more important than features and making NIM_COMPILE_TO_CPP green is important too
11:09:56Araq'mangling: "C"' is 'exportc' and 'mangling: "C++"' is 'exportcpp', but that feature seems overly complex.
11:10:29Araqfor example 'mangling: C++' does NOT mean Nim mangles it to the C++'s name, instead it does NOT use 'extern C' for it.
11:10:44Araqand nlvm might have a really hard time supporting anything of this.
11:12:54FromGitter<timotheecour> well we could first support `mangling:c` and not other manglings in the meantime; note that exportcpp doesn’t exist ; IMO `mangling` makes features more orthogonal; since `exports:”foo” mangling:c` would become meaningful; and so would `{push: mangling:c .}`
11:13:33Araqwe don't have "mangling: C" either
11:13:46Araqthat feature would be a lie
11:14:18Araqon some platforms mangling: C means "compiler prepended an underscore"
11:14:37Araqnot to mention that mangling is usually combined with the calling convention
11:15:17Araq'exportcpp' doesn't exist but if added, it wouldn't lie about what it is about.
11:16:02FromGitter<timotheecour> => PR https://github.com/nim-lang/Nim/pull/10313 for workaround for twrong_refcounts
11:17:33FromGitter<timotheecour> well `exportc` is currently a lie; because it uses extern “cpp” in `nim cpp` mode; whereas `importc` uses un-conditionally `export C`
11:17:56Araqyeah, so let's have exportcpp and exportc
11:19:26*kapil____ quit (Quit: Connection closed for inactivity)
11:20:58*skellock joined #nim
11:21:03FromGitter<timotheecour> will that allow push to make a bunch of declarations extern C/cpp, as mangling did: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3dc21f32a8370605d514fa]
11:21:50FromGitter<timotheecour> `mangling` would allow for exactly that, since it’s an orthogonal concept to the base name
11:23:49FromGitter<timotheecour> basically, `{.mangling: c|cpp|native|d|objc.}` where native means same as nim’s mode (c/cpp)
11:24:34absolutejamyou can do `foo = case bar: ... ` right?
11:24:44absolutejamassign the result of a case statement to a var?
11:24:55FromGitter<timotheecour> > on some platforms mangling: C means "compiler prepended an underscore” ⏎ ⏎ That doesn’t matter; codegen would just use NIM_EXTERNC aka `extern “C”` and it shoud "just work"
11:25:22*skellock quit (Ping timeout: 250 seconds)
11:26:54FromGitter<timotheecour> @absolutejam ya, why don’t u just try before asking ;-) ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ works [https://gitter.im/nim-lang/Nim?at=5c3dc37d8318994524f1e349]
11:26:58absolutejamI did
11:27:01absolutejamit isn't working
11:27:12FromGitter<timotheecour> ^
11:27:32FromGitter<timotheecour> works for me, see code i posted
11:27:40absolutejamoh, worked for my result = but not my seq
11:28:05FromGitter<timotheecour> i don’t understand.
11:29:48absolutejamuh, it's working now
11:29:56absolutejamnot sure if it's because I messed up the else statement before
11:30:12absolutejamAlthough, it looks no different :facepalm:
11:30:49absolutejambut thanks for confirmed
11:31:21FromGitter<timotheecour> np
11:34:06*rect0x51_l joined #nim
11:35:33rect0x51_lLike other languages Nim has these {.magic.} "compiler built-ins". Can someone explain why the code is hidden? It must be somewhere, right?
11:42:51FromGitter<timotheecour> `magic: “Foo”` => search for `mFoo`; but i agree that Nim shd be smarter about this, maybe `nimgrep` and `theindex.html` should become magic-aware
11:43:09FromGitter<timotheecour> *everyone* hits this at some point
11:45:45FromGitter<alehander42> well, they're kinda an impl detail
11:47:53FromGitter<timotheecour> arguably less important than having good docs for stdlib, but sitll important to help whoever needs to dig in `compiler/` code
11:49:14FromGitter<alehander42> probably
11:50:39FromGitter<alehander42> if every contributor who works on the compiler, adds some gotchas/xp to the wiki, it would be probably easier to dive in
11:53:53FromGitter<timotheecour> (actually maybe `nimsuggest`/`nimfind` shd understand `magic` instead of nimgrep)
11:56:07FromGitter<timotheecour> one feature that could really improve docs is smarter CI that would skip what’s skippable (ie make CI complete much faster) when only docs (or even doc comments) change ; that has been proposed in past and reject because of implementation was based on bash instead of nim; but now that CI runs in nim it coudl be revisited
11:58:03rect0x51_lMmm, so all the "magic" is somewhere in the codebase?
11:58:23FromGitter<timotheecour> of course; just search for `mFoo` for a magic `Foo`
11:58:32leorizeyea, they're mostly used to implement language features or as a type system escape hatch
11:59:17rect0x51_lThanks. I am trying to take a look at the implementation of sets.
12:01:21FromGitter<alehander42> look at lib/system/<stuff>
12:01:28FromGitter<alehander42> in the compiler source
12:01:40FromGitter<alehander42> 1) the mFoo search there
12:02:27FromGitter<alehander42> 1) the mFoo search in all the compiler**
12:02:38FromGitter<alehander42> ah gitter's formatting is weird
12:02:50FromGitter<alehander42> this should be `+`
12:03:11FromGitter<alehander42> sorry for the confusin
12:05:27*Snircle joined #nim
12:13:07*rect0x51_l quit (Ping timeout: 268 seconds)
12:21:49absolutejamHow do I allow a proc type for a type field?
12:23:45FromGitter<timotheecour> the obvious way, ⏎ ⏎ ```type Foo = object ⏎ x: proc (): int``` ⏎ ⏎ (note: `echo type(myproc)` is ur friend) [https://gitter.im/nim-lang/Nim?at=5c3dd0d11cb70a372ae0ee43]
12:28:05*rect0x51_l joined #nim
12:44:12absolutejamI thought just Proc or proc would do it, my bad
12:44:15absolutejamI'll keep type() in mind
12:44:18absolutejamthanks
12:45:31absolutejamHaving to specify the return variable makes it a little more complicated haha
12:53:13FromGitter<timotheecour> well it would break the type system otherwise, there’s just no way without it in a static language
12:53:32absolutejamoh yeah, just a new thing for me
12:53:53absolutejamneed to figure out this generics thing a little
12:54:19FromGitter<timotheecour> > *<Araq>* fixes are more important than features and making NIM_COMPILE_TO_CPP green is important too ⏎ ⏎ @araq done, all the PR’s that accomplish that are in your hands now
13:18:29*zachcarter quit (Ping timeout: 268 seconds)
13:46:15Araqtimotheecour: btw the refcount is deprecated anyway
13:46:35*Vladar quit (Remote host closed the connection)
14:02:31*Yardanico joined #nim
14:06:40narimiranfor those of you who have missed Araq's blogpost from last week: here is the link to HN discussion so feel free to comment and participate in the discussion: https://news.ycombinator.com/item?id=18911153
14:13:09absolutejamso, if I wanted to work with an iterator as a seq, do I have to first add each item to a seq in a for loop?
14:13:41absolutejamugh - nevermind
14:14:57*skellock joined #nim
14:17:56FromGitter<alehander42> @narimiran afaik, it's better to give link to new & name of the discussion
14:18:08FromGitter<alehander42> otherwise it weights votes/comments less
14:18:19FromGitter<alehander42> but this might be just internet-rumours, not sure
14:18:55narimiranhmmm, so i should give an indirect link and "when you find it, upvote it"? :D
14:18:57FromGitter<alehander42> absolutejam: did you manage with toSeq
14:19:05FromGitter<alehander42> @narimiran, that's what i've seen people do
14:19:16FromGitter<alehander42> but no idea if it's correct
14:19:34narimiranyou can still upvote it this way, upvote button is to the left of the title
14:21:07FromGitter<alehander42> the idea is, that sometimes upvotes are not counted as points
14:21:18FromGitter<alehander42> but iirc the actual voting algorithm is not public
14:21:23FromGitter<alehander42> so people just guess
14:22:23FromGitter<alehander42> that's the only link i could find: https://wiredcraft.com/blog/how-to-post-on-hacker-news
14:29:16narimiranoh, i didn't know that
14:29:49FromGitter<alehander42> again: maybe not true: it's all based on people guesses
14:37:12*aguspiza joined #nim
14:39:48*salewski joined #nim
14:49:11salewskiAttention, a question (11 additional lines):
14:49:18salewskiAre compiler warnings for package code supressed when we import a nimble package like
14:49:27salewskiimport oldgtk3/[glib, gobject, gtk]
14:49:35salewskiIf I import in that way, I see no warnings. But when I copy the files from package into working
14:49:42salewskidirectory and import all of them with
14:49:50salewskiimport glib
14:49:58salewskiimport gobject
14:50:05salewskiimport gtk
14:50:11salewskithen I get warnings like
14:50:19salewskiglib.nim(606, 23) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated]
14:50:29salewskiIndeed I want to see the warnings, because I will fix them.
14:50:40salewskiSupressed warnings may make sense for packages, but can I turn on displaying of warnings again?
14:51:12leorizetry --hints:on
14:52:28sendell[m]about var return type: is there a way to store the returned l-value in order to do several operations on it? or should I use a ptr for that?
14:54:17leorizevar smt: var int = procThatReturnsVarInt()
14:54:31leorizeI don't know if it works without the explicit `var int` however
14:54:56salewskialready tested of course, compiler switches --warnings:on --hints:on have no effect for the package files
14:55:34leorizethen I think that might be a bug?
14:55:51Araqsalewski, it's a feature. Workaround, maybe: rename the .nimble files so that Nim thinks it's all in a single Nimble package
14:56:13Araqleorize, 'var x: var int' is not a feature of today's Nim.
14:56:20Araqit may compile but it shouldn't.
14:56:39salewskiAraq, OK, good to know that.
14:56:50Araqyou're supposed to use ptr and addr instead or you use some other code style. I never need it fwiw.
14:58:55sendell[m]ok I see, thx for confirmation :)
15:00:31*salewski quit (Quit: WeeChat 2.3)
15:10:14*cspar quit (Ping timeout: 272 seconds)
15:11:17*cspar joined #nim
15:13:48*absolutejam quit (Ping timeout: 268 seconds)
15:20:23*absolutejam joined #nim
15:31:32*aguspiza quit (Ping timeout: 258 seconds)
15:37:57*rect0x51_l quit (Quit: WeeChat 2.3)
15:42:47*absolutejam quit (Ping timeout: 268 seconds)
15:44:40*nsf quit (Quit: WeeChat 2.3)
15:52:51*absolutejam joined #nim
16:07:17shashlick@kaushalmodi: looks like windows devel nightly builds are timing out
16:07:31shashlickso we have no nightlies posted for x32 and x64
16:07:58sendell[m]is there a tool somewhere to indent repr output for printing ? :)
16:08:00FromGitter<kaushalmodi> shashlick: yes, I have noticed, but haven't got time to investigate further
16:08:19FromGitter<kaushalmodi> may be we need to go the route of staged builds that you suggested
16:09:04shashlickfor the koch testinstall?
16:09:45FromGitter<kaushalmodi> yes
16:11:14shashlickso if that's the case, we need to upload the generated assets to an intermediate location and once actual test passes, then upload to github
16:11:32shashlickor we can upload directly after generation and do testinstall after that
16:11:47shashlickwill have to download the assets though - https://api.github.com/repos/nim-lang/nightlies/releases should help
16:11:54*Trustable joined #nim
16:12:17shashlickbut then will need github tokens to access the api
16:14:35FromGitter<kaushalmodi> but if the test fails, we shoudn't upload the assets, which is the whole point for adding that test
16:14:50FromGitter<kaushalmodi> it's a different issue that right now we are seeing a false failure, a timeout
16:15:14*absolutejam quit (Ping timeout: 258 seconds)
16:15:38shashlickis it possible to extend the timeout on travis?
16:16:05FromGitter<kaushalmodi> I have googled, but haven't found an answer
16:16:09*kapil____ joined #nim
16:16:13FromGitter<kaushalmodi> there's a way to extend the idle timeout
16:16:43FromGitter<kaushalmodi> but I don't think we are seeing any idling .. it just hard-times-out at 50 mins
16:20:01shashlicki guess one option is to upload assets and then delete them if test fails
16:20:12shashlickthough that's ugly
16:20:14narimiranfor all of you who are waiting for better documentation, here are some screenshots of my work in last couple of days: https://imgur.com/a/7pRwzfr :)
16:21:22FromGitter<kaushalmodi> narimiran: Awesome job! 👍
16:21:29shashlickwow
16:21:57shashlickdo we have an account with any of these services? https://docs.travis-ci.com/user/deployment/
16:22:04shashlickto park assets while we test them
16:22:17narimiranthanks @kaushalmodi
16:22:44PMunchLooking good
16:22:53PMunchReally like the "See also" stuff
16:23:05narimiranyeah, me too :)
16:25:20*PMunch quit (Remote host closed the connection)
16:26:06*BigEpsilon quit (Ping timeout: 250 seconds)
16:30:51FromGitter<kaushalmodi> shashlick: But we aren't running testinstall for Windows, right?
16:32:43shashlickgood question
16:33:10FromGitter<kaushalmodi> seems like just the Nim compilation + docs generation on Windows is slow
16:33:43FromGitter<kaushalmodi> the whole windows build is very monolithic https://github.com/nim-lang/nightlies/blob/master/.travis.yml#L122-L126
16:33:47FromGitter<kaushalmodi> and not broken down to phases
16:33:54FromGitter<kaushalmodi> so difficult to find the bottleneck
16:34:24*Vladar joined #nim
16:34:57FromGitter<kaushalmodi> Araq, shashlick: here's a log of Nim nightlies build on Windows that's timing out at 50 mins: https://api.travis-ci.org/v3/job/477664314/log.txt
16:35:06*powerbit quit (Ping timeout: 272 seconds)
16:35:44shashlickunfortunately travis is useless to measure time taken
16:36:10FromGitter<kaushalmodi> I am just scrolling through that log
16:36:24FromGitter<kaushalmodi> why do we see `nim compile -f --symbolfiles:off --compileonly --gen_mapping --cc:gcc --skipUserCfg --os:macosx --cpu:i386 -d:release compiler/nim.nim`in windows build
16:37:57shashlicklooks like we are compiling for --os:linux, --cpu:mips64, etc.
16:38:07FromGitter<kaushalmodi> yeah.. why?
16:41:41FromGitter<kaushalmodi> shashlick: An interesting thing is notice is that Windows builds take 30mins on 0-19 branch, but time out at 50mins on devel
16:42:49shashlicki noticed that too
16:43:38shashlicklooks like this is doing the csources compilation across all platforms
16:43:39shashlickpart of niminst
16:45:05FromGitter<kaushalmodi> looks like some regression; https://travis-ci.org/nim-lang/nightlies/builds/476679274 passed
16:45:22FromGitter<kaushalmodi> so need to see what changed in those 24 hrs
16:55:13FromGitter<kaushalmodi> Araq, shashlick: https://github.com/nim-lang/nightlies/issues/17
17:05:53*nsf joined #nim
17:07:56*BigEpsilon joined #nim
17:10:00Araqkaushalmodi: I don't know. Caused by our koch changes?
17:15:59shashlickdon't think so yet - looking at logs
17:15:59FromGitter<kaushalmodi> was just going through the diff
17:16:09FromGitter<kaushalmodi> (https://files.gitter.im/nim-lang/Nim/uLYx/image.png)
17:16:27FromGitter<kaushalmodi> left is good, right is bad; diff of logs
17:16:44FromGitter<kaushalmodi> good is using compiler/nim0.exe, bad is using bin/nim.exe
17:17:34FromGitter<kaushalmodi> this is just one point of diff, as I scroll lower, I see that the bad log is compiling on all OSes, while the good log is compiling only on windows as expected
17:17:43*tefter joined #nim
17:18:20FromGitter<kaushalmodi> I also see the compilation of posix, etc in bad log
17:19:17FromGitter<kaushalmodi> good log: https://ptpb.pw/x_dw ⏎ bad log: https://ptpb.pw/XuJU ⏎ ⏎ You can diff those away to find the culprit [https://gitter.im/nim-lang/Nim?at=5c3e1615f780a1521f155cb7]
17:19:44shashlicki see --os:linux on good log too
17:20:29FromGitter<kaushalmodi> hmm, you're right
17:23:00FromGitter<kaushalmodi> alright, here it goes ..
17:23:19FromGitter<kaushalmodi> I filtered the log files to just the compilation commands and the bad log is compiling on a lot more platforms
17:23:25FromGitter<kaushalmodi> good filtered: https://ptpb.pw/CdYa
17:23:34FromGitter<kaushalmodi> bad filtered: https://ptpb.pw/bXg7
17:24:15shashlicklog diverges here - https://imgur.com/a/ElGz6h9
17:25:47FromGitter<kaushalmodi> Or wait, is the bad log showing those set of compiles going on in infinite loop?
17:30:47shashlickyes it is happening a 3rd time on the failing log before it dies
17:31:06FromGitter<kaushalmodi> yep
17:32:10FromGitter<kaushalmodi> this portion with `nim compile -f ..` is running in inf loop it seems. Hopefully it's easier to debug to the root cause now, Araq
17:32:37shashlickniminst is being called in a loop
17:44:16*nsf quit (Quit: WeeChat 2.3)
17:45:21*PMunch joined #nim
17:45:31*absolutejamPhone joined #nim
17:51:12*floppydh quit (Quit: WeeChat 2.3)
18:08:58FromGitter<nepeckman> I have a question for a core dev. I'd like to add support for --genDeps on the js backend. I cloned Nim and wrote the 3 lines needed to make this work. Can I raise a PR for this?
18:09:21shashlick@kaushalmodi - I figured it out - @timotheecour's change indeed broke this
18:09:37Araqkaushalmodi: it's not an inf loop, it just takes really long
18:09:50Araqit runs over all supported OS, CPU combinations
18:09:51shashlickno it is a loop
18:10:10Araqin the past it never was a loop.
18:10:24Araqnepeckman: of course.
18:10:47*BigEpsilon quit (Ping timeout: 268 seconds)
18:11:07narimiran@nepeckman why not? ;)
18:11:40shashlickyes but it broke due to this change - https://github.com/nim-lang/Nim/commit/c60916a2aff121fc0220f9452803a7bcfb6300d0#diff-cdc1b5c3c94ae8670cc9a495b8647ba8L53
18:11:51*synthmeat quit (Quit: WeeChat 2.3)
18:11:52FromGitter<alehander42> i didnt even know we have genDeps
18:11:54*salewski joined #nim
18:11:57shashlickkochExe is defined as os.getAppFilename()
18:12:03FromGitter<nepeckman> Great, thanks! I haven't contributed before and just wanted to make sure something like that would be okay :)
18:12:03*absolutejamPhone quit (Read error: Connection reset by peer)
18:12:04shashlickwhich works fine if you run koch as koch
18:12:16shashlickbut winrelease leverages koch so winrelease calls itself instead of koch
18:13:43*absolutejamPhone joined #nim
18:13:47Araqyay
18:13:52Araqplease fix it
18:14:23salewskiIt is a bit strange that a compileTime pragma written after a variable name extends to the whole var section:
18:14:27salewskihttps://github.com/nim-lang/Nim/issues/10296#issuecomment-454492880
18:14:45*aguspiza joined #nim
18:15:58salewskiWell maybe that can be usefull, but was very surprising for me.
18:16:01FromGitter<kaushalmodi> shashlick: awesome! I'd never have figured that out :)
18:16:38Araqsalewski: I think something else is going on.
18:16:49Araqwill investigate. Eventually.
18:17:03salewskiShall I close that issue?
18:17:45*BigEpsilon joined #nim
18:21:06*absolutejamPhone quit (Ping timeout: 252 seconds)
18:21:24Araqnah
18:22:51salewskiOK, then I will let it open for now. For me it works, but others may have similar issues with latest Nim devel.
18:22:55salewskiBye.
18:23:31*salewski quit (Quit: WeeChat 2.3)
18:24:16shashlick@kaushalmodi: that was a brain teaser man
18:24:37narimirannice work there, shashlick!
18:34:21shashlickAraq, @kaushalmodi, @timotheecour: https://github.com/nim-lang/Nim/pull/10321
18:37:01*BigEpsilon quit (Ping timeout: 246 seconds)
18:40:03*onionhammer quit (Quit: WeeChat 1.9.1)
18:41:13*Trustable quit (Remote host closed the connection)
18:42:08*onionhammer joined #nim
18:43:09Araqshashlick, I think this reintroduces the problems getAppFilename() was supposed to solve
18:43:21Araq(which is foolish to begin with but whatever)
18:43:42Araqoh well, Timothee can clean it up later
18:43:51FromGitter<kaushalmodi> .. or make winrelease use `"koch"` instead of `kochExe`?
18:44:06Araqyep
18:45:44*Tyresc joined #nim
18:47:35shashlickwhat was the issue?
18:48:03*nsf joined #nim
18:48:22Araqsome bullshit about koch not being in PATH or the "wrong" one
18:48:22shashlickwere we having issues finding koch?
18:48:54Araqtypical Unix mess, first assume nonsense and then fix it and then fix the fix
18:49:32Araq(Hint: Koch is tool for developers, developers are in control over their PATH)
18:50:04shashlickdo we have an issue number?
18:50:05*salewski joined #nim
18:51:01narimiranshashlick: if you found the commit introducing it, it is probably connected to timothee's PR which usually has plenty of links :)
18:52:00narimiranyep. https://github.com/nim-lang/Nim/issues/10041
18:53:22*absolutejam joined #nim
18:54:46salewskiFor this line I get a warning:
18:54:51salewskihttps://github.com/StefanSalewski/gintro/blob/master/gintro/gimpl.nim#L88
18:55:11salewskigimpl.nim(88, 24) Warning: symbol is deprecated [Deprecated]
18:55:29salewskigimpl.nim(88, 31) Warning: use `getImpl: NimNode -> NimNode` instead; getImpl is deprecated [Deprecated]
18:55:43salewskiI have not really an idea how to fix it.
18:56:01shashlicknarimiran: no clear explanation of what the actual issue was as far as exec "koch" was concerned
18:56:24shashlickwill just wait for @timotheecour to look at it then
18:56:37*seni joined #nim
18:57:07Araqsalewski, ... use getImpl instead?
18:57:11Araq:D
18:57:21*seni left #nim (#nim)
18:58:08salewskiThe actual line code is
18:58:11salewskilet ipronode = p.symbol.getImpl().params[ipos + 1][1]
18:58:34salewskiso replace text sumbol by one more getImpl ?
18:59:26*zachcarter joined #nim
18:59:47absolutejamis it more idiomatic to declare all vars at the top of a function?
18:59:55absolutejamgenerally speaking
19:01:58salewskiabsolutejam, C++ and other text books recommend defining vars where they are used, not at top of proc header.
19:02:32*dom96_w joined #nim
19:02:59Araqlet ipronode = p.getImpl().params[ipos + 1][1]
19:03:04absolutejamI find myself only doing it in the when isMainModule block
19:03:05Araq^ salewski
19:03:08absolutejamand thanks salewski
19:03:20salewskiThanks Araq.
19:03:26narimiranabsolutejam: i guess it is up to personal preferences. i have my "style" (which i tweaked a bit as the times go by), but i don't think there is something which is preferred
19:03:59absolutejamI'd like a more complete style guide. I know working code > readable trash, but I like to stick to the guidelines
19:04:19narimirane.g. i prefer to declare my *types* at the top of the file
19:04:22Araquse the innermost scope possible for your vars
19:04:26*zachcarter quit (Ping timeout: 268 seconds)
19:05:09*kapil____ quit (Quit: Connection closed for inactivity)
19:05:12*synthmeat joined #nim
19:05:12absolutejamyeah, I've generally been doing imports (stdlib, then modules, then relative), then declare types, then procs, and some tests in isMainModule (For now)
19:05:38Araqthat's fine
19:05:46narimiranabsolutejam: just don't use 4 spaces for indentation, and you'll be fine :)
19:05:56absolutejamBeen trying to get out that habbit haha
19:06:11absolutejamSet the workspace default in vscode and need to reformat some
19:06:23narimiranso, should i also mention snake_case? ;)
19:06:49absolutejamI thought I'd be all over snake case coming from Python
19:07:01narimiranabsolutejam: put this in your vscode settings:
19:07:02absolutejambut I've happily adapted to camel case
19:07:24narimiran"[nim]": {"editor.tabSize": 2}
19:07:35absolutejamoh, you can do it per lang? cool.
19:07:50narimiranso you can have 4 spaces for python and other languages, and 2 spaces for nim
19:07:54absolutejamoh yeah, 'configure language specific settings'
19:08:31absolutejamsweet, thanks.
19:09:13narimiran...and now you can back to worrying about these small style tweaks :P
19:11:01absolutejamMight see how well nimpretty works
19:11:04absolutejamhold my beer
19:12:56*zachcarter joined #nim
19:17:24salewskiOne general remark, I think the fact that compiler WARNINGS are supressed by default for nimble packages
19:17:52Araqit was a requested feature.
19:17:57salewskican lead to bad package quality. For example for gintro I have never seen
19:18:15Araqyeah, I agree, we should change that
19:18:18salewskithe warnings during nimble install and thought that all is fine.
19:18:53salewskiWe should have a switch to enable that warnings for package maintainers and
19:18:58narimirandom96_w, dom96: are you here maybe? new website commits are eagerly waiting to be put on the server :)
19:19:06salewskiother carefully watchers.
19:19:18dom96_wyes, but as usual I don't have access to my laptop :)
19:19:33dom96_wi'll push later on though
19:19:51salewskiOK, fine, Bye.
19:19:56*salewski quit (Quit: WeeChat 2.3)
19:20:29narimirandom96_w: ok, no rush, whenever you do it will be good
19:20:53ZevvI have a tiny laptop always in my pocket, and it runs Nim: https://planetcom.squarespace.com/device/ :)
19:23:04narimiranZevv: it looks tiny. how do you see anything on its monitor?
19:23:18*abm joined #nim
19:23:59Zevvit isn't that bad actually. basically its just a phone with a keyboard attached. Runs android and linux dual boot. The keyboard is a bit crappy, but it serves me well while on the road.
19:30:11*stefanos82 quit (Remote host closed the connection)
19:36:02absolutejamcan't wait for the day wher a phone can function as a full desktop
19:36:13absolutejamwith something like usb c and a dock
19:37:01*nsf quit (Quit: WeeChat 2.3)
19:39:14Zevvthis thing has usb and hdmi
19:39:49Zevvbut i dont think I'd like to use it as my main machine though, with sd storage and all
19:44:38rayman22201I kickstarted this thing, but it's crap: https://www.sentio.com/
19:45:06*Snircle quit (Ping timeout: 272 seconds)
19:46:23rayman22201just curious. Why is the website not hooked up to an automated deployment setup @dom96_w @narimiran?
19:47:31enowZevv: looks cool
19:48:28enowZevv: are you happy with it
19:48:31*FromGitter quit (Read error: Connection reset by peer)
19:49:33*junland quit (Quit: Disconnected.)
19:49:53enowso, I have a burning desire to use some jpeg with my project
19:50:11enowI'm trying to keep as light as can be and therefore I'd like to go with libjpeg
19:50:12*Snircle joined #nim
19:50:23narimiranrayman22201: i don't know, but i guess dom will give you/us the answer
19:50:43enowwhich means I have to write a wrapper for nim, but how do I deal with distribution do I include the libjpeg source in the package or how does it work
19:50:50*junland joined #nim
19:51:19shashlickenow: see nimgen wrappers for an option
19:52:16*abm quit (Quit: Leaving)
19:52:29enowshashlick: still there'll be some manual work involed I suppose
19:53:00rayman22201or https://github.com/genotrance/nimterop if you want to try the cutting edge :-)
19:54:18enowrayman22201: pweh I just started nim (at the deep end) a few days ago, might be to much adventure for me to handle
19:56:23rayman22201well, in theory nimterop will supersede nimgen. It is actually easier to use than nimgen, but much less mature. It deserves more beta testers though.
19:57:20rayman22201as for distribution though, it's the same as a C program. You either include a shared library, or link statically.
20:00:08shashlickwell i'd use nimterop but there's still some ways to go to make it seamless
20:00:19shashlickbut i can help make the libjpeg wrapper if you want
20:01:22shashlickAraq: build failed with the ./ nonsense - https://travis-ci.org/nim-lang/Nim/jobs/480025906 cc @kaushalmodi @timotheecour
20:01:53enowshashlick: ah lets get to it
20:02:19enowmy starting point is https://github.com/genotrance/nimbass
20:02:36enowI saw that he had a great write up that helped me a lot yesterday
20:02:47shashlickneat
20:02:52enowhttps://ijg.org/
20:02:54shashlickhttps://github.com/libjpeg-turbo is this the repo?
20:02:57enowand this is the libjpeg
20:03:13absolutejamsay I've just instantiated an object from a custom type, how can I see if a field is nil?
20:03:14enowhm well I guess that's the simd optimized version
20:03:20absolutejamor should I use option[]?
20:03:37absolutejamlike, I would have to use option[] for it to be able to be nil right?
20:03:57shashlickgithub / git repo helps cause it is easy to pull in stuff
20:04:25enowmm makes sense but http is still possible isn't it
20:04:35shashlickyep
20:04:39enowsuppose jpeg isn't updated that often though
20:04:45enowlet's check what ubuntu is using
20:05:51narimiranabsolutejam: if field.isNil?
20:05:58*druonysus quit (Quit: druonysus)
20:06:09enowhm what it boils down to for me is how few dependencies it adds
20:06:15*druonysus joined #nim
20:06:15*druonysus quit (Changing host)
20:06:15*druonysus joined #nim
20:06:29enowbecause basically I could go for some other library that has multi format support as well
20:07:44shashlickdo you know how this lib works? what's the starting point - main header file
20:08:15absolutejambut the field itself is another type narimiran
20:08:27absolutejamand that won't be nil, right?
20:08:31absolutejamit'll always be that type
20:08:33absolutejamI forgot that part
20:09:02rayman22201code sample plz @absolutejam?
20:09:20dom96_wrayman22201: There is nothing stopping us except time
20:10:07rayman22201@dom96_w that's the answer I was hoping for. I'm glad it's not paranoia :-P
20:10:29dom96_wA bit of that too ;)
20:10:36rayman22201lol
20:10:51dom96_wDoing this securely takes a lot of time and effort which I just didn't bother investing
20:10:59dom96_wIt's not like website updates are all that critical anyway
20:11:02rayman22201that's true.
20:11:40rayman22201But with @narimiran doing more frequent updates, it might be nice to start considering it again.
20:11:55narimirani can always do less :D
20:12:02rayman22201lol
20:12:19rayman22201the empty set is always trivially the best solution :-P
20:12:26narimiran:)
20:12:36shashlickdom96_w any luck with those choosenim PRs?
20:13:23dom96_wrayman22201: I'll just give narimiran the ability to push updates :)
20:13:43rayman22201that will work too lol
20:15:01dom96_wshashlick sorry, didn't get a chance today
20:17:13shashlickno problem
20:19:23enowshashlick: yeah I've used it for some time ago
20:19:45enowshashlick: jpeg-turbo has a lot of alternatives but I rather skip the cmake and assembly dependency
20:19:51shashlicki need a jconfig.h for mingw
20:20:35enowshashlick: I manage to download the zip file but how to extract it I'm looking at https://github.com/genotrance/nimbass/blob/master/nimbass.cfg which manages to extract a zip file but I don't get how
20:21:08shashlicknimgen knows it is a zip so just extracts it for you
20:21:34enowshashlick: but not if it's a tar.gz?
20:21:46enowit's a zip for windows and tar.gz for linux
20:21:56enowalso can I tell nimgen to crosscompile somehow
20:22:17shashlickit is just a package difference for convenience usually
20:22:21shashlickbet both have the same contents
20:22:36enowah I bet you're right
20:23:25shashlickhere's what it it looks like through nimterop - http://ix.io/1yq1/Nim
20:24:47enowlooks rather nice
20:25:19shashlickfails nim check though - some missing stuff
20:25:36enowshashlick: how did you go about to generate the interop table
20:26:24shashlicknot sure I get the question - are you asking about nimterop?
20:27:30enownimterop is supposed to be automatic, perhaps I got that wrong, so that you don't have to do any manual gluing
20:28:12shashlickyes that's the goal
20:28:42shashlicki still need to port some of the nimgen functionality over, but its debatable since you are already in nim and can do the download/edit yourself as well
20:28:58shashlickwith cimport that is
20:29:53enowI'd love that
20:30:29enowbut at this point realistically would it be possible to go the interop route without needing to generate or curate proc defintions
20:31:01*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:31:19*PMunch quit (Remote host closed the connection)
20:33:56shashlickwell if you can wait for a couple days, I can try to get this working
20:35:33*elrood joined #nim
20:35:37enowI'm gunning for having jpeg support tonight, but as for a complete API there's no rush
20:35:59enowlibjpeg is a good test case though, fairly well used, but they do some interesting edge case stuff
20:36:19*zachk joined #nim
20:36:43absolutejamDoes nim have a stack sequence, or do I just have to push/pop a seq?
20:36:59*zachk quit (Read error: Connection reset by peer)
20:37:19*zachk joined #nim
20:37:31shashlickenow: well here's an updated wrapper http://ix.io/1yq7/Nim
20:37:43shashlickthere's some minor issues in nim check that you could hand edit for now
20:37:56*zachk quit (Changing host)
20:37:56*zachk joined #nim
20:37:59shashlickadd the required {.compile.} directives and you should be able to proceed
20:38:13shashlickuntil then I can get some of the bugs fixed
20:40:42enowI see how did you generate that one?
20:41:18shashlickusing nimterop
20:42:07shashlicktoast -n -p -DINCOMPLETE_TYPES_BROKEN -r jpeglib.h
20:42:14enowoh nice
20:42:29shashlickno tricks 😄
20:42:35*narimiran quit (Remote host closed the connection)
20:42:59enowsweet so nimterop uses AST instead of whatever c2nim uses
20:44:39enowhm shoot nimterop compilation fails for me
20:49:30*absolutejam quit (Quit: WeeChat 1.9.1)
20:52:31*absolutejam joined #nim
20:55:51enowshashlick: check jconfig.txt for details on the jconfig.h
21:00:25Araqc2nim uses its own C(++) parser
21:01:34*aguspiza quit (Ping timeout: 246 seconds)
21:02:15shashlickNote that I used a jconfig.h generated by configure on mingw
21:02:35enowmhm
21:02:41shashlickAlso there are some missing symbols which will need to be fixed
21:02:45enowshould work
21:03:11shashlickSo you can hand wrap those
21:03:32shashlickJust 3 or 4 were reported by Nim check
21:05:16*Snircle_ joined #nim
21:05:47*Snircle quit (Ping timeout: 240 seconds)
21:06:45enowhm JBLOCK it seems
21:06:58enowmaybe I'm approaching this in a silly way though
21:08:06enowI wonder if jpeglib doesn't have some exotic error handling thing going on
21:08:17enowsomething about setjmp that looks scary
21:13:11FromDiscord_<moerm> Hello all
21:13:30enowhi
21:19:28shashlickenow: ok so what exactly do you want to accomplish?
21:26:13enowhehe so I'm doing my server that takes json commands over websocket to controll a computer right
21:26:35enowI sorta got sidetracked but I quickly realized that I "simply" could make a html remote controll
21:26:40enowVNC sorta kinda deal
21:27:06enowso I figured why not grab frames from GDI, compress them as jpeg and push them out as a mjpeg stream
21:27:44shashlickfun project
21:27:54enowyeah it's quite cool
21:27:57shashlickand this is on windows?
21:28:14enowI'm in linux but I'm targeting windows for now
21:28:38enownim is there for platform support so it's planned
21:29:15shashlickcool
21:29:19enowthinking if I can hook ffmpeg into some video stream I could make it really slick
21:29:39shashlickso are you planning on making a libjpeg library or just maintain it in your repo
21:29:41enowit'd be helpful to have control over I/P frames for compression and so forth while streaming
21:30:18enowI thought I'd see how far I come and push it to githu
21:30:56enowif there's interest in it I can put some time on it to polish it
21:31:09enowbasically what I am doing now is I only want to encode images for exampel
21:31:31enowman does it show that libjpeg is old, they're really careful with not exhausting memory it seems
21:31:54enowmakes the API a bit weird, nowadays most libraries would force you to allocate the whole image at once
21:33:09enowit's almost as old as I am
21:34:35enownobody would ask you to feed an image line by line in this day and age
21:39:00*stefantalpalaru joined #nim
21:40:13stefantalpalaruresetAttributes() from the "terminal" module is not GC-safe on Windows: https://github.com/nim-lang/Nim/issues/8294#issuecomment-454556051
21:43:58*dom96_w joined #nim
21:44:27Araqconsider it fixed
21:45:23stefantalpalaruThanks!
21:48:32*ng0 quit (Quit: Alexa, when is the end of world?)
21:57:35*Snircle_ quit (Quit: Textual IRC Client: www.textualapp.com)
21:57:56*Snircle joined #nim
21:59:19*shpx joined #nim
22:00:40AraqTimothee: I have to praise you. This tag "merge_when_passes_CI" is super helpful. :-)
22:00:50Araq(no irony here)
22:02:01shashlickstill broken araq
22:04:32shashlickhttps://github.com/nim-lang/Nim/pull/10321/files
22:05:24Araqwhy?
22:05:29Araqstupid space?
22:05:43Araqwell it should have been "koch".exe too
22:06:38Araqshashlick, well?
22:06:57shashlickkoch worked on windows in the past
22:07:06shashlickdidn't need the exe
22:07:16*stefantalpalaru quit (Quit: stefantalpalaru)
22:07:16Araqbut it makes more sense
22:07:37Araqso ... it's the space or what?
22:07:42*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:07:45shashlickyes just the space
22:07:57shashlicksince quoteShell puts quotes with the space
22:08:30shashlickdidn't have my linux machine to test before i pushed, sorry
22:09:07Araqno worries
22:28:35AraqLemonBoy is back, https://github.com/nim-lang/Nim/pull/10322/files
22:28:37Araq:D
22:31:07shashlickAraq: its still broken 😞
22:31:17shashlick"koch.exe", not "koch".exe
22:31:31Araqwhat's the difference?
22:31:46shashlickexe is outside the quote
22:32:12shashlickand it will break on posix won't it? but will work since winrelease is only for windows right now
22:32:49Araqproc exe*(f: string): string is in kochdocs.nim
22:33:07Araqit's an idiom in koch.nim to turn stuff into exe, but only on Windows
22:33:17Araqand I checked tools/winrelease.nim compiles
22:33:24Araqso isMainModule is false then
22:33:30Araqmust be some other problem?
22:37:15*Vladar quit (Remote host closed the connection)
22:39:33*Tyresc quit (Quit: WeeChat 2.4-dev)
22:39:41shashlicknift
22:40:00shashlickno i just read it as a problem
22:40:10shashlickthat proc should be in the stdlib 🙂
22:40:54enow 70 /* Data structures for images (arrays of samples and of DCT coefficients).
22:40:54enow 71 * On 80x86 machines, the image arrays are too big for near pointers,
22:40:54enow 72 * but the pointer arrays can fit in near memory.
22:40:54enow 73 */
22:41:01enowthings like this just make me too happy
22:41:30shashlickwhat does this mean => int (*coef_bits)[64];
22:41:35shashlickin a typedef struct
22:41:51shashlicki know int x, int *x, what's an int (*x)[]
22:41:56enowwords can't describe how glad it makes me that they've taken 16 bit CPUs into account when I just wanted to have a quick and dirty jpeg output ready tonight
22:42:04Araqa pointer to an array
22:42:11Araqmaybe, not sure.
22:42:27enowjup something along those lines
22:42:29shashlickso ptr array[64, int]
22:42:40Araqc2nim should know
22:42:45shashlick🙂
22:43:46shashlickwell c2nim translates that to coef_bits*: array[64, cint]
22:43:52enowhm yeah I wrote a test in C for reference first, which is suprisingly difficult if you are used to gd or whatever
22:44:06Araqshashlick, that sounds wrong lol
22:44:29shashlickshould i open an issue?
22:44:32Araqsure
22:52:00*shpx quit (Quit: shpx)
22:53:35*shpx joined #nim
23:11:25enowgot a noob question
23:11:33enow JSAMPLE pixbuf[W*H*3];
23:11:59enowwhy can't I write it as
23:12:00enowvar pixbuf=array[0..W*H,JSAMPLE]
23:13:25Araqtypes are not values.
23:14:41enowhm so how should I write it
23:15:00enowJSAMPLE ought to be a uchar
23:15:16Araqvar pixbuf: array[W*H*3, byte]
23:16:42enowah I get it thanks a bunch!!
23:18:15enow typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */
23:18:21enowc2nim goes crazy on that one
23:18:53enowSome crazy 90s magic to facilitate for jpeg compression on 16 bit processors I take it
23:19:08enowso i can't blame it, because it drives me mad as well
23:34:23*shpx quit (Quit: shpx)
23:35:33*shpx joined #nim
23:37:40*elrood quit (Remote host closed the connection)
23:38:36Araq#def FAR
23:38:43Araqjezz learn some c2nim
23:41:06*darithorn joined #nim
23:42:31enowif FAR is definied in a fiel included from the file I'm running c2nim on would it find it
23:46:04*skellock quit (Ping timeout: 246 seconds)
23:47:22Araqhttps://nim-lang.org/docs/c2nim.html#preprocessor-support-def-directive
23:47:30Araqhttps://nim-lang.org/docs/c2nim.html#preprocessor-support-pp-directive
23:47:40Araqhttps://nim-lang.org/docs/c2nim.html#preprocessor-support
23:51:26*leorize quit (Quit: WeeChat 2.3)
23:51:54zestyrenow: regarding that remote control thing, you basically descriped jsmpeg-vnc :) doesn't support linux though
23:53:00zestyrI'd like to make an alternative some day in Nim that supports Linux, but I'd need a wrapper for ffmpeg which might take some time
23:53:28enowzestyr: ah there we go :D I didn't figure I was inventing the wheel or anything
23:53:55*lritter joined #nim
23:54:04shashlickenow: only two errors left in nimterop
23:54:06enowI'm really doing this as a part of something else and realize that I could quite simply do a quick detour and have myself a silly VNC client
23:54:15enowamazing I'm impressed!!
23:56:31enowoh that def part really helps out a lot!
23:57:09*vlad1777d quit (Ping timeout: 258 seconds)
23:58:13shashlickwhy have they put a #define in the middle of a struct definition
23:58:41shashlickhttps://github.com/kornelski/libjpeg/blob/master/jpeglib.h#L652
23:58:41enowshashlick: where?
23:58:48enowthx
23:59:37enowwow that's just nasty