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:44 | FromGitter | <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:45 | FromGitter | <timotheecour> @krux02 done, see https://github.com/nim-lang/Nim/pull/10303 |
00:18:26 | * | shpx joined #nim |
00:20:30 | FromDiscord_ | <j$> is there a way to import a nim module to all files ? |
00:23:20 | * | shpx quit (Ping timeout: 268 seconds) |
00:25:42 | sillibird | I 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:48 | sillibird | Actually I kind of just got it, using Option[] |
00:33:00 | FromDiscord_ | <moerm> see you |
00:37:03 | sillibird | Is it possible to make the direct result of a Option nil instead of (val: ...has: ...) |
00:37:37 | FromGitter | <zetashift> set it to none? |
00:38:48 | sillibird | How exactly do you set it? |
00:40:53 | FromGitter | <zetashift> say your proc returns an `Option[int]` you could set the initial value like `result = none(int)` |
00:41:39 | FromGitter | <zetashift> and along your proc you get the value you could do `result = some(3)` for example |
00:42:00 | sillibird | Its 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:37 | FromGitter | <zetashift> so from your pastebin example `userId` may or may not exist |
00:43:05 | sillibird | No, it's the `broadcast` |
00:43:17 | sillibird | If it exists, its equal to the type above it, otherwise its nil |
00:43:33 | FromGitter | <zetashift> oh yea |
00:44:09 | FromGitter | <zetashift> just do `broadcast: Option[Broadcast]` and it's initial state should be `none(Broadcast)` |
00:44:58 | FromGitter | <zetashift> so if it's `isSome` you'd get a broadcast or else you'd get none |
00:45:21 | sillibird | How do you set an initial state? |
00:47:24 | FromGitter | <zetashift> it's already implicitly set to none(Broadcast) or you could write a proc that sets it |
00:47:44 | FromGitter | <zetashift> the default is empty |
00:49:57 | sillibird | Also can I use Option to work where I'll have one that's either a `string` or `int` or similar? |
00:51:02 | FromGitter | <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:20 | FromGitter | <zetashift> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
00:52:25 | sillibird | Ah, thats what I was afraid of, it makes it slightly messier |
00:52:51 | FromGitter | <zetashift> you could also do https://github.com/vegansk/nimfp/blob/master/src/fp/either.nim |
01:00:23 | sillibird | The `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:32 | sillibird | How 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:18 | sillibird | How exactly is Option[] supposed to work, I'm expecting it to print `nil` but it returns a `(val: ...has: ...)` |
03:47:08 | leorize | you check it with isSome/isNone then get() your result |
03:47:41 | leorize | there's also getOrDefault() |
03:48:07 | sillibird | oh, i think i might be using the wrong thing in my case |
03:48:43 | sillibird | I 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:29 | leorize | sillibird: you would need a variant object |
03:50:38 | leorize | you can read more about them in the manual |
03:53:52 | sillibird | I 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:59 | leorize | that's not possible currently, but you can make a getter proc that detects the current field |
03:59:13 | sillibird | like 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:31 | leorize | sillibird: here's a quick PoC http://ix.io/1yn4 |
04:26:05 | sillibird | The 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:06 | leorize | have you looked at JsonNode of the json module? |
04:28:33 | sillibird | Yeah, I suppose I can leave it in node form but it seems more natural in types |
04:35:22 | leorize | you can nest the variant object into your real object |
04:38:20 | leorize | something like this: http://ix.io/1yn5 |
04:48:07 | sillibird | the possible solutions are getting more and more complex, I really wish there was a more straightforward way of achieving it |
04:49:12 | leorize | JsonNode is likely your best bet |
04:49:37 | leorize | it's not complex, which is great |
04:53:30 | sillibird | Yeah, I guess thats the route I will take |
05:13:42 | * | leorize quit (Quit: WeeChat 2.3) |
05:13:51 | Tanger | Hey 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:43 | Tanger | Or 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:31 | sillibird | Is 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:56 | FromGitter | <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:58 | FromGitter | <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:50 | absolutejam | mornin' |
08:47:59 | FromGitter | <mratsim> hey there |
08:48:59 | FromGitter | <timotheecour> does anyone know how to exportc a symbol with ‘extern C’ when using `nim cpp`? |
08:49:24 | leorize | just {.exportc.} |
08:49:38 | leorize | you can't export cpp symbols last time I tried |
08:49:38 | FromGitter | <timotheecour> no, it’ll use C++ mangling |
08:50:39 | FromGitter | <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:30 | leorize | {.emit: """extern "C" { <retval> <name>(<params>); }""".} |
08:51:33 | leorize | ^ have you tried that? |
08:52:11 | FromGitter | <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:36 | leorize | sometimes you just don't have a choice :P |
08:53:07 | FromGitter | <timotheecour> well then it’s a bug in Nim that shd be easy to fix if it’s unsupported |
08:53:18 | FromGitter | <timotheecour> all codegen has to do is insert NIM_EXTERNC |
08:53:51 | leorize | given that we can't importcpp procs either, I think it's fair to just make exportc, well exportc :) |
08:54:13 | FromGitter | <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:10 | FromGitter | <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:27 | leorize | ouch -ffast-math |
08:56:55 | FromGitter | <timotheecour> ouch meaning |
08:57:09 | leorize | it bites :P |
08:57:22 | leorize | I wonder what was it doing there |
08:57:47 | FromGitter | <timotheecour> Well, it was painful to track down that bug and the resolution |
08:58:34 | * | vegai joined #nim |
08:58:58 | FromGitter | <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:15 | leorize | you can't import a C++ proc without headers |
09:00:09 | FromGitter | <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:15 | FromGitter | <mratsim> I don't have issue to export C with C++ code :? |
09:01:09 | leorize | timotheecour: see the module name lol |
09:01:12 | FromGitter | <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:30 | FromGitter | <mratsim> ah indeed I don't use exportc and use defautl C++ mangling when building my dll |
09:01:39 | FromGitter | <mratsim> https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim |
09:02:22 | FromGitter | <timotheecour> @leorize well there r other examples eg: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3da19e1cb70a372adfacf3] |
09:03:04 | leorize | importcpp by default rewrite to firstparam.proc(theest) |
09:03:11 | leorize | importcpp by default rewrite to firstparam.proc(theRest) |
09:05:59 | FromGitter | <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:58 | FromGitter | <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:51 | FromGitter | <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:17 | FromGitter | <timotheecour> Or probably even better: `mangling:c`. `mangling:cpp`, `mangling:<whatever>` which could be extended in future to : D, objc etc) |
09:13:44 | leorize | well, how about keeping exportc to what it name implies? |
09:13:48 | leorize | export to C |
09:14:19 | FromGitter | <timotheecour> ok so change existing semantics ? |
09:14:35 | FromGitter | <timotheecour> right now exportc mangles to nim’s mode |
09:15:19 | FromGitter | <timotheecour> that’d require adding `exportcpp` |
09:15:55 | leorize | there's also the RFC about renaming importc and importcpp |
09:16:00 | leorize | maybe you should check that first? |
09:17:07 | Araq | timotheecour: 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:17 | Araq | which ALSO tests for C++? |
09:17:25 | * | Vladar joined #nim |
09:17:30 | Araq | that's a complete mystery to me |
09:17:43 | Araq | (and on my local machines it works) |
09:19:01 | * | naiveai joined #nim |
09:22:12 | Zevv | If 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:34 | Araq | rebase it and blame me |
09:23:23 | Zevv | If anyone, it is eventually always you who should be blamed for all of this, I guess |
09:23:26 | Zevv | will do :) |
09:25:11 | FromGitter | <alehander42> sillibird: is `data` itself always a different type? |
09:25:56 | FromGitter | <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:02 | FromGitter | <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:23 | FromGitter | <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:30 | FromGitter | <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:12 | Araq | still doesn't explain it to me, we don't use -d:release for NIM_COMPILE_TO_CPP |
10:02:06 | FromGitter | <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:53 | Araq | ah so the Nim compiled as C++ produces the difference? |
10:06:18 | FromGitter | <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:44 | FromGitter | <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:55 | FromGitter | <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:09 | FromGitter | <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:15 | FromGitter | <timotheecour> => PR https://github.com/nim-lang/Nim/pull/10312 |
10:35:38 | Araq | why would I know? you wrote the code |
10:37:03 | FromGitter | <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:34 | FromGitter | <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:27 | Araq | still can't reproduce it, I use clang 7.0 |
10:50:28 | Araq | nim cpp -d:release -r tests/float/tfloatmod is green |
10:52:11 | FromGitter | <timotheecour> are you on osx , and compiled nim using devel (not that PR) ? |
10:53:48 | FromGitter | <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:14 | FromGitter | <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:29 | FromGitter | <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:41 | Araq | I'm on OSX |
11:05:22 | FromGitter | <timotheecour> ok, what’s ur output for `clang++ -o /tmp/D20181107T193702 -ffast-math -O3 $timn_D/tests/nim/all/t0103.cpp` |
11:05:26 | Araq | twrong_refcounts: just use target: "C" |
11:05:50 | FromGitter | <timotheecour> (see example in https://github.com/nim-lang/Nim/pull/10310#issue-244694867) |
11:07:26 | FromGitter | <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:40 | FromGitter | <timotheecour> 1) in nim cpp mode |
11:08:03 | Araq | yeah whatever |
11:08:45 | FromGitter | <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:55 | Araq | fixes are more important than features and making NIM_COMPILE_TO_CPP green is important too |
11:09:56 | Araq | 'mangling: "C"' is 'exportc' and 'mangling: "C++"' is 'exportcpp', but that feature seems overly complex. |
11:10:29 | Araq | for 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:44 | Araq | and nlvm might have a really hard time supporting anything of this. |
11:12:54 | FromGitter | <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:33 | Araq | we don't have "mangling: C" either |
11:13:46 | Araq | that feature would be a lie |
11:14:18 | Araq | on some platforms mangling: C means "compiler prepended an underscore" |
11:14:37 | Araq | not to mention that mangling is usually combined with the calling convention |
11:15:17 | Araq | 'exportcpp' doesn't exist but if added, it wouldn't lie about what it is about. |
11:16:02 | FromGitter | <timotheecour> => PR https://github.com/nim-lang/Nim/pull/10313 for workaround for twrong_refcounts |
11:17:33 | FromGitter | <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:56 | Araq | yeah, 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:03 | FromGitter | <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:50 | FromGitter | <timotheecour> `mangling` would allow for exactly that, since it’s an orthogonal concept to the base name |
11:23:49 | FromGitter | <timotheecour> basically, `{.mangling: c|cpp|native|d|objc.}` where native means same as nim’s mode (c/cpp) |
11:24:34 | absolutejam | you can do `foo = case bar: ... ` right? |
11:24:44 | absolutejam | assign the result of a case statement to a var? |
11:24:55 | FromGitter | <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:54 | FromGitter | <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:58 | absolutejam | I did |
11:27:01 | absolutejam | it isn't working |
11:27:12 | FromGitter | <timotheecour> ^ |
11:27:32 | FromGitter | <timotheecour> works for me, see code i posted |
11:27:40 | absolutejam | oh, worked for my result = but not my seq |
11:28:05 | FromGitter | <timotheecour> i don’t understand. |
11:29:48 | absolutejam | uh, it's working now |
11:29:56 | absolutejam | not sure if it's because I messed up the else statement before |
11:30:12 | absolutejam | Although, it looks no different :facepalm: |
11:30:49 | absolutejam | but thanks for confirmed |
11:31:21 | FromGitter | <timotheecour> np |
11:34:06 | * | rect0x51_l joined #nim |
11:35:33 | rect0x51_l | Like other languages Nim has these {.magic.} "compiler built-ins". Can someone explain why the code is hidden? It must be somewhere, right? |
11:42:51 | FromGitter | <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:09 | FromGitter | <timotheecour> *everyone* hits this at some point |
11:45:45 | FromGitter | <alehander42> well, they're kinda an impl detail |
11:47:53 | FromGitter | <timotheecour> arguably less important than having good docs for stdlib, but sitll important to help whoever needs to dig in `compiler/` code |
11:49:14 | FromGitter | <alehander42> probably |
11:50:39 | FromGitter | <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:53 | FromGitter | <timotheecour> (actually maybe `nimsuggest`/`nimfind` shd understand `magic` instead of nimgrep) |
11:56:07 | FromGitter | <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:03 | rect0x51_l | Mmm, so all the "magic" is somewhere in the codebase? |
11:58:23 | FromGitter | <timotheecour> of course; just search for `mFoo` for a magic `Foo` |
11:58:32 | leorize | yea, they're mostly used to implement language features or as a type system escape hatch |
11:59:17 | rect0x51_l | Thanks. I am trying to take a look at the implementation of sets. |
12:01:21 | FromGitter | <alehander42> look at lib/system/<stuff> |
12:01:28 | FromGitter | <alehander42> in the compiler source |
12:01:40 | FromGitter | <alehander42> 1) the mFoo search there |
12:02:27 | FromGitter | <alehander42> 1) the mFoo search in all the compiler** |
12:02:38 | FromGitter | <alehander42> ah gitter's formatting is weird |
12:02:50 | FromGitter | <alehander42> this should be `+` |
12:03:11 | FromGitter | <alehander42> sorry for the confusin |
12:05:27 | * | Snircle joined #nim |
12:13:07 | * | rect0x51_l quit (Ping timeout: 268 seconds) |
12:21:49 | absolutejam | How do I allow a proc type for a type field? |
12:23:45 | FromGitter | <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:12 | absolutejam | I thought just Proc or proc would do it, my bad |
12:44:15 | absolutejam | I'll keep type() in mind |
12:44:18 | absolutejam | thanks |
12:45:31 | absolutejam | Having to specify the return variable makes it a little more complicated haha |
12:53:13 | FromGitter | <timotheecour> well it would break the type system otherwise, there’s just no way without it in a static language |
12:53:32 | absolutejam | oh yeah, just a new thing for me |
12:53:53 | absolutejam | need to figure out this generics thing a little |
12:54:19 | FromGitter | <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:15 | Araq | timotheecour: btw the refcount is deprecated anyway |
13:46:35 | * | Vladar quit (Remote host closed the connection) |
14:02:31 | * | Yardanico joined #nim |
14:06:40 | narimiran | for 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:09 | absolutejam | so, 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:41 | absolutejam | ugh - nevermind |
14:14:57 | * | skellock joined #nim |
14:17:56 | FromGitter | <alehander42> @narimiran afaik, it's better to give link to new & name of the discussion |
14:18:08 | FromGitter | <alehander42> otherwise it weights votes/comments less |
14:18:19 | FromGitter | <alehander42> but this might be just internet-rumours, not sure |
14:18:55 | narimiran | hmmm, so i should give an indirect link and "when you find it, upvote it"? :D |
14:18:57 | FromGitter | <alehander42> absolutejam: did you manage with toSeq |
14:19:05 | FromGitter | <alehander42> @narimiran, that's what i've seen people do |
14:19:16 | FromGitter | <alehander42> but no idea if it's correct |
14:19:34 | narimiran | you can still upvote it this way, upvote button is to the left of the title |
14:21:07 | FromGitter | <alehander42> the idea is, that sometimes upvotes are not counted as points |
14:21:18 | FromGitter | <alehander42> but iirc the actual voting algorithm is not public |
14:21:23 | FromGitter | <alehander42> so people just guess |
14:22:23 | FromGitter | <alehander42> that's the only link i could find: https://wiredcraft.com/blog/how-to-post-on-hacker-news |
14:29:16 | narimiran | oh, i didn't know that |
14:29:49 | FromGitter | <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:11 | salewski | Attention, a question (11 additional lines): |
14:49:18 | salewski | Are compiler warnings for package code supressed when we import a nimble package like |
14:49:27 | salewski | import oldgtk3/[glib, gobject, gtk] |
14:49:35 | salewski | If I import in that way, I see no warnings. But when I copy the files from package into working |
14:49:42 | salewski | directory and import all of them with |
14:49:50 | salewski | import glib |
14:49:58 | salewski | import gobject |
14:50:05 | salewski | import gtk |
14:50:11 | salewski | then I get warnings like |
14:50:19 | salewski | glib.nim(606, 23) Warning: type pragmas follow the type name; this form of writing pragmas is deprecated [Deprecated] |
14:50:29 | salewski | Indeed I want to see the warnings, because I will fix them. |
14:50:40 | salewski | Supressed warnings may make sense for packages, but can I turn on displaying of warnings again? |
14:51:12 | leorize | try --hints:on |
14:52:28 | sendell[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:17 | leorize | var smt: var int = procThatReturnsVarInt() |
14:54:31 | leorize | I don't know if it works without the explicit `var int` however |
14:54:56 | salewski | already tested of course, compiler switches --warnings:on --hints:on have no effect for the package files |
14:55:34 | leorize | then I think that might be a bug? |
14:55:51 | Araq | salewski, it's a feature. Workaround, maybe: rename the .nimble files so that Nim thinks it's all in a single Nimble package |
14:56:13 | Araq | leorize, 'var x: var int' is not a feature of today's Nim. |
14:56:20 | Araq | it may compile but it shouldn't. |
14:56:39 | salewski | Araq, OK, good to know that. |
14:56:50 | Araq | you're supposed to use ptr and addr instead or you use some other code style. I never need it fwiw. |
14:58:55 | sendell[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:17 | shashlick | @kaushalmodi: looks like windows devel nightly builds are timing out |
16:07:31 | shashlick | so we have no nightlies posted for x32 and x64 |
16:07:58 | sendell[m] | is there a tool somewhere to indent repr output for printing ? :) |
16:08:00 | FromGitter | <kaushalmodi> shashlick: yes, I have noticed, but haven't got time to investigate further |
16:08:19 | FromGitter | <kaushalmodi> may be we need to go the route of staged builds that you suggested |
16:09:04 | shashlick | for the koch testinstall? |
16:09:45 | FromGitter | <kaushalmodi> yes |
16:11:14 | shashlick | so 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:32 | shashlick | or we can upload directly after generation and do testinstall after that |
16:11:47 | shashlick | will 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:17 | shashlick | but then will need github tokens to access the api |
16:14:35 | FromGitter | <kaushalmodi> but if the test fails, we shoudn't upload the assets, which is the whole point for adding that test |
16:14:50 | FromGitter | <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:38 | shashlick | is it possible to extend the timeout on travis? |
16:16:05 | FromGitter | <kaushalmodi> I have googled, but haven't found an answer |
16:16:09 | * | kapil____ joined #nim |
16:16:13 | FromGitter | <kaushalmodi> there's a way to extend the idle timeout |
16:16:43 | FromGitter | <kaushalmodi> but I don't think we are seeing any idling .. it just hard-times-out at 50 mins |
16:20:01 | shashlick | i guess one option is to upload assets and then delete them if test fails |
16:20:12 | shashlick | though that's ugly |
16:20:14 | narimiran | for 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:22 | FromGitter | <kaushalmodi> narimiran: Awesome job! 👍 |
16:21:29 | shashlick | wow |
16:21:57 | shashlick | do we have an account with any of these services? https://docs.travis-ci.com/user/deployment/ |
16:22:04 | shashlick | to park assets while we test them |
16:22:17 | narimiran | thanks @kaushalmodi |
16:22:44 | PMunch | Looking good |
16:22:53 | PMunch | Really like the "See also" stuff |
16:23:05 | narimiran | yeah, me too :) |
16:25:20 | * | PMunch quit (Remote host closed the connection) |
16:26:06 | * | BigEpsilon quit (Ping timeout: 250 seconds) |
16:30:51 | FromGitter | <kaushalmodi> shashlick: But we aren't running testinstall for Windows, right? |
16:32:43 | shashlick | good question |
16:33:10 | FromGitter | <kaushalmodi> seems like just the Nim compilation + docs generation on Windows is slow |
16:33:43 | FromGitter | <kaushalmodi> the whole windows build is very monolithic https://github.com/nim-lang/nightlies/blob/master/.travis.yml#L122-L126 |
16:33:47 | FromGitter | <kaushalmodi> and not broken down to phases |
16:33:54 | FromGitter | <kaushalmodi> so difficult to find the bottleneck |
16:34:24 | * | Vladar joined #nim |
16:34:57 | FromGitter | <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:44 | shashlick | unfortunately travis is useless to measure time taken |
16:36:10 | FromGitter | <kaushalmodi> I am just scrolling through that log |
16:36:24 | FromGitter | <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:57 | shashlick | looks like we are compiling for --os:linux, --cpu:mips64, etc. |
16:38:07 | FromGitter | <kaushalmodi> yeah.. why? |
16:41:41 | FromGitter | <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:49 | shashlick | i noticed that too |
16:43:38 | shashlick | looks like this is doing the csources compilation across all platforms |
16:43:39 | shashlick | part of niminst |
16:45:05 | FromGitter | <kaushalmodi> looks like some regression; https://travis-ci.org/nim-lang/nightlies/builds/476679274 passed |
16:45:22 | FromGitter | <kaushalmodi> so need to see what changed in those 24 hrs |
16:55:13 | FromGitter | <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:00 | Araq | kaushalmodi: I don't know. Caused by our koch changes? |
17:15:59 | shashlick | don't think so yet - looking at logs |
17:15:59 | FromGitter | <kaushalmodi> was just going through the diff |
17:16:09 | FromGitter | <kaushalmodi> (https://files.gitter.im/nim-lang/Nim/uLYx/image.png) |
17:16:27 | FromGitter | <kaushalmodi> left is good, right is bad; diff of logs |
17:16:44 | FromGitter | <kaushalmodi> good is using compiler/nim0.exe, bad is using bin/nim.exe |
17:17:34 | FromGitter | <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:20 | FromGitter | <kaushalmodi> I also see the compilation of posix, etc in bad log |
17:19:17 | FromGitter | <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:44 | shashlick | i see --os:linux on good log too |
17:20:29 | FromGitter | <kaushalmodi> hmm, you're right |
17:23:00 | FromGitter | <kaushalmodi> alright, here it goes .. |
17:23:19 | FromGitter | <kaushalmodi> I filtered the log files to just the compilation commands and the bad log is compiling on a lot more platforms |
17:23:25 | FromGitter | <kaushalmodi> good filtered: https://ptpb.pw/CdYa |
17:23:34 | FromGitter | <kaushalmodi> bad filtered: https://ptpb.pw/bXg7 |
17:24:15 | shashlick | log diverges here - https://imgur.com/a/ElGz6h9 |
17:25:47 | FromGitter | <kaushalmodi> Or wait, is the bad log showing those set of compiles going on in infinite loop? |
17:30:47 | shashlick | yes it is happening a 3rd time on the failing log before it dies |
17:31:06 | FromGitter | <kaushalmodi> yep |
17:32:10 | FromGitter | <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:37 | shashlick | niminst 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:58 | FromGitter | <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:21 | shashlick | @kaushalmodi - I figured it out - @timotheecour's change indeed broke this |
18:09:37 | Araq | kaushalmodi: it's not an inf loop, it just takes really long |
18:09:50 | Araq | it runs over all supported OS, CPU combinations |
18:09:51 | shashlick | no it is a loop |
18:10:10 | Araq | in the past it never was a loop. |
18:10:24 | Araq | nepeckman: of course. |
18:10:47 | * | BigEpsilon quit (Ping timeout: 268 seconds) |
18:11:07 | narimiran | @nepeckman why not? ;) |
18:11:40 | shashlick | yes 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:52 | FromGitter | <alehander42> i didnt even know we have genDeps |
18:11:54 | * | salewski joined #nim |
18:11:57 | shashlick | kochExe is defined as os.getAppFilename() |
18:12:03 | FromGitter | <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:04 | shashlick | which works fine if you run koch as koch |
18:12:16 | shashlick | but winrelease leverages koch so winrelease calls itself instead of koch |
18:13:43 | * | absolutejamPhone joined #nim |
18:13:47 | Araq | yay |
18:13:52 | Araq | please fix it |
18:14:23 | salewski | It is a bit strange that a compileTime pragma written after a variable name extends to the whole var section: |
18:14:27 | salewski | https://github.com/nim-lang/Nim/issues/10296#issuecomment-454492880 |
18:14:45 | * | aguspiza joined #nim |
18:15:58 | salewski | Well maybe that can be usefull, but was very surprising for me. |
18:16:01 | FromGitter | <kaushalmodi> shashlick: awesome! I'd never have figured that out :) |
18:16:38 | Araq | salewski: I think something else is going on. |
18:16:49 | Araq | will investigate. Eventually. |
18:17:03 | salewski | Shall I close that issue? |
18:17:45 | * | BigEpsilon joined #nim |
18:21:06 | * | absolutejamPhone quit (Ping timeout: 252 seconds) |
18:21:24 | Araq | nah |
18:22:51 | salewski | OK, then I will let it open for now. For me it works, but others may have similar issues with latest Nim devel. |
18:22:55 | salewski | Bye. |
18:23:31 | * | salewski quit (Quit: WeeChat 2.3) |
18:24:16 | shashlick | @kaushalmodi: that was a brain teaser man |
18:24:37 | narimiran | nice work there, shashlick! |
18:34:21 | shashlick | Araq, @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:09 | Araq | shashlick, I think this reintroduces the problems getAppFilename() was supposed to solve |
18:43:21 | Araq | (which is foolish to begin with but whatever) |
18:43:42 | Araq | oh well, Timothee can clean it up later |
18:43:51 | FromGitter | <kaushalmodi> .. or make winrelease use `"koch"` instead of `kochExe`? |
18:44:06 | Araq | yep |
18:45:44 | * | Tyresc joined #nim |
18:47:35 | shashlick | what was the issue? |
18:48:03 | * | nsf joined #nim |
18:48:22 | Araq | some bullshit about koch not being in PATH or the "wrong" one |
18:48:22 | shashlick | were we having issues finding koch? |
18:48:54 | Araq | typical Unix mess, first assume nonsense and then fix it and then fix the fix |
18:49:32 | Araq | (Hint: Koch is tool for developers, developers are in control over their PATH) |
18:50:04 | shashlick | do we have an issue number? |
18:50:05 | * | salewski joined #nim |
18:51:01 | narimiran | shashlick: if you found the commit introducing it, it is probably connected to timothee's PR which usually has plenty of links :) |
18:52:00 | narimiran | yep. https://github.com/nim-lang/Nim/issues/10041 |
18:53:22 | * | absolutejam joined #nim |
18:54:46 | salewski | For this line I get a warning: |
18:54:51 | salewski | https://github.com/StefanSalewski/gintro/blob/master/gintro/gimpl.nim#L88 |
18:55:11 | salewski | gimpl.nim(88, 24) Warning: symbol is deprecated [Deprecated] |
18:55:29 | salewski | gimpl.nim(88, 31) Warning: use `getImpl: NimNode -> NimNode` instead; getImpl is deprecated [Deprecated] |
18:55:43 | salewski | I have not really an idea how to fix it. |
18:56:01 | shashlick | narimiran: no clear explanation of what the actual issue was as far as exec "koch" was concerned |
18:56:24 | shashlick | will just wait for @timotheecour to look at it then |
18:56:37 | * | seni joined #nim |
18:57:07 | Araq | salewski, ... use getImpl instead? |
18:57:11 | Araq | :D |
18:57:21 | * | seni left #nim (#nim) |
18:58:08 | salewski | The actual line code is |
18:58:11 | salewski | let ipronode = p.symbol.getImpl().params[ipos + 1][1] |
18:58:34 | salewski | so replace text sumbol by one more getImpl ? |
18:59:26 | * | zachcarter joined #nim |
18:59:47 | absolutejam | is it more idiomatic to declare all vars at the top of a function? |
18:59:55 | absolutejam | generally speaking |
19:01:58 | salewski | absolutejam, 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:59 | Araq | let ipronode = p.getImpl().params[ipos + 1][1] |
19:03:04 | absolutejam | I find myself only doing it in the when isMainModule block |
19:03:05 | Araq | ^ salewski |
19:03:08 | absolutejam | and thanks salewski |
19:03:20 | salewski | Thanks Araq. |
19:03:26 | narimiran | absolutejam: 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:59 | absolutejam | I'd like a more complete style guide. I know working code > readable trash, but I like to stick to the guidelines |
19:04:19 | narimiran | e.g. i prefer to declare my *types* at the top of the file |
19:04:22 | Araq | use 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:12 | absolutejam | yeah, 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:38 | Araq | that's fine |
19:05:46 | narimiran | absolutejam: just don't use 4 spaces for indentation, and you'll be fine :) |
19:05:56 | absolutejam | Been trying to get out that habbit haha |
19:06:11 | absolutejam | Set the workspace default in vscode and need to reformat some |
19:06:23 | narimiran | so, should i also mention snake_case? ;) |
19:06:49 | absolutejam | I thought I'd be all over snake case coming from Python |
19:07:01 | narimiran | absolutejam: put this in your vscode settings: |
19:07:02 | absolutejam | but I've happily adapted to camel case |
19:07:24 | narimiran | "[nim]": {"editor.tabSize": 2} |
19:07:35 | absolutejam | oh, you can do it per lang? cool. |
19:07:50 | narimiran | so you can have 4 spaces for python and other languages, and 2 spaces for nim |
19:07:54 | absolutejam | oh yeah, 'configure language specific settings' |
19:08:31 | absolutejam | sweet, thanks. |
19:09:13 | narimiran | ...and now you can back to worrying about these small style tweaks :P |
19:11:01 | absolutejam | Might see how well nimpretty works |
19:11:04 | absolutejam | hold my beer |
19:12:56 | * | zachcarter joined #nim |
19:17:24 | salewski | One general remark, I think the fact that compiler WARNINGS are supressed by default for nimble packages |
19:17:52 | Araq | it was a requested feature. |
19:17:57 | salewski | can lead to bad package quality. For example for gintro I have never seen |
19:18:15 | Araq | yeah, I agree, we should change that |
19:18:18 | salewski | the warnings during nimble install and thought that all is fine. |
19:18:53 | salewski | We should have a switch to enable that warnings for package maintainers and |
19:18:58 | narimiran | dom96_w, dom96: are you here maybe? new website commits are eagerly waiting to be put on the server :) |
19:19:06 | salewski | other carefully watchers. |
19:19:18 | dom96_w | yes, but as usual I don't have access to my laptop :) |
19:19:33 | dom96_w | i'll push later on though |
19:19:51 | salewski | OK, fine, Bye. |
19:19:56 | * | salewski quit (Quit: WeeChat 2.3) |
19:20:29 | narimiran | dom96_w: ok, no rush, whenever you do it will be good |
19:20:53 | Zevv | I have a tiny laptop always in my pocket, and it runs Nim: https://planetcom.squarespace.com/device/ :) |
19:23:04 | narimiran | Zevv: it looks tiny. how do you see anything on its monitor? |
19:23:18 | * | abm joined #nim |
19:23:59 | Zevv | it 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:02 | absolutejam | can't wait for the day wher a phone can function as a full desktop |
19:36:13 | absolutejam | with something like usb c and a dock |
19:37:01 | * | nsf quit (Quit: WeeChat 2.3) |
19:39:14 | Zevv | this thing has usb and hdmi |
19:39:49 | Zevv | but i dont think I'd like to use it as my main machine though, with sd storage and all |
19:44:38 | rayman22201 | I kickstarted this thing, but it's crap: https://www.sentio.com/ |
19:45:06 | * | Snircle quit (Ping timeout: 272 seconds) |
19:46:23 | rayman22201 | just curious. Why is the website not hooked up to an automated deployment setup @dom96_w @narimiran? |
19:47:31 | enow | Zevv: looks cool |
19:48:28 | enow | Zevv: 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:53 | enow | so, I have a burning desire to use some jpeg with my project |
19:50:11 | enow | I'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:23 | narimiran | rayman22201: i don't know, but i guess dom will give you/us the answer |
19:50:43 | enow | which 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:19 | shashlick | enow: see nimgen wrappers for an option |
19:52:16 | * | abm quit (Quit: Leaving) |
19:52:29 | enow | shashlick: still there'll be some manual work involed I suppose |
19:53:00 | rayman22201 | or https://github.com/genotrance/nimterop if you want to try the cutting edge :-) |
19:54:18 | enow | rayman22201: pweh I just started nim (at the deep end) a few days ago, might be to much adventure for me to handle |
19:56:23 | rayman22201 | well, 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:20 | rayman22201 | as for distribution though, it's the same as a C program. You either include a shared library, or link statically. |
20:00:08 | shashlick | well i'd use nimterop but there's still some ways to go to make it seamless |
20:00:19 | shashlick | but i can help make the libjpeg wrapper if you want |
20:01:22 | shashlick | Araq: build failed with the ./ nonsense - https://travis-ci.org/nim-lang/Nim/jobs/480025906 cc @kaushalmodi @timotheecour |
20:01:53 | enow | shashlick: ah lets get to it |
20:02:19 | enow | my starting point is https://github.com/genotrance/nimbass |
20:02:36 | enow | I saw that he had a great write up that helped me a lot yesterday |
20:02:47 | shashlick | neat |
20:02:52 | enow | https://ijg.org/ |
20:02:54 | shashlick | https://github.com/libjpeg-turbo is this the repo? |
20:02:57 | enow | and this is the libjpeg |
20:03:13 | absolutejam | say I've just instantiated an object from a custom type, how can I see if a field is nil? |
20:03:14 | enow | hm well I guess that's the simd optimized version |
20:03:20 | absolutejam | or should I use option[]? |
20:03:37 | absolutejam | like, I would have to use option[] for it to be able to be nil right? |
20:03:57 | shashlick | github / git repo helps cause it is easy to pull in stuff |
20:04:25 | enow | mm makes sense but http is still possible isn't it |
20:04:35 | shashlick | yep |
20:04:39 | enow | suppose jpeg isn't updated that often though |
20:04:45 | enow | let's check what ubuntu is using |
20:05:51 | narimiran | absolutejam: if field.isNil? |
20:05:58 | * | druonysus quit (Quit: druonysus) |
20:06:09 | enow | hm 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:29 | enow | because basically I could go for some other library that has multi format support as well |
20:07:44 | shashlick | do you know how this lib works? what's the starting point - main header file |
20:08:15 | absolutejam | but the field itself is another type narimiran |
20:08:27 | absolutejam | and that won't be nil, right? |
20:08:31 | absolutejam | it'll always be that type |
20:08:33 | absolutejam | I forgot that part |
20:09:02 | rayman22201 | code sample plz @absolutejam? |
20:09:20 | dom96_w | rayman22201: There is nothing stopping us except time |
20:10:07 | rayman22201 | @dom96_w that's the answer I was hoping for. I'm glad it's not paranoia :-P |
20:10:29 | dom96_w | A bit of that too ;) |
20:10:36 | rayman22201 | lol |
20:10:51 | dom96_w | Doing this securely takes a lot of time and effort which I just didn't bother investing |
20:10:59 | dom96_w | It's not like website updates are all that critical anyway |
20:11:02 | rayman22201 | that's true. |
20:11:40 | rayman22201 | But with @narimiran doing more frequent updates, it might be nice to start considering it again. |
20:11:55 | narimiran | i can always do less :D |
20:12:02 | rayman22201 | lol |
20:12:19 | rayman22201 | the empty set is always trivially the best solution :-P |
20:12:26 | narimiran | :) |
20:12:36 | shashlick | dom96_w any luck with those choosenim PRs? |
20:13:23 | dom96_w | rayman22201: I'll just give narimiran the ability to push updates :) |
20:13:43 | rayman22201 | that will work too lol |
20:15:01 | dom96_w | shashlick sorry, didn't get a chance today |
20:17:13 | shashlick | no problem |
20:19:23 | enow | shashlick: yeah I've used it for some time ago |
20:19:45 | enow | shashlick: jpeg-turbo has a lot of alternatives but I rather skip the cmake and assembly dependency |
20:19:51 | shashlick | i need a jconfig.h for mingw |
20:20:35 | enow | shashlick: 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:08 | shashlick | nimgen knows it is a zip so just extracts it for you |
20:21:34 | enow | shashlick: but not if it's a tar.gz? |
20:21:46 | enow | it's a zip for windows and tar.gz for linux |
20:21:56 | enow | also can I tell nimgen to crosscompile somehow |
20:22:17 | shashlick | it is just a package difference for convenience usually |
20:22:21 | shashlick | bet both have the same contents |
20:22:36 | enow | ah I bet you're right |
20:23:25 | shashlick | here's what it it looks like through nimterop - http://ix.io/1yq1/Nim |
20:24:47 | enow | looks rather nice |
20:25:19 | shashlick | fails nim check though - some missing stuff |
20:25:36 | enow | shashlick: how did you go about to generate the interop table |
20:26:24 | shashlick | not sure I get the question - are you asking about nimterop? |
20:27:30 | enow | nimterop is supposed to be automatic, perhaps I got that wrong, so that you don't have to do any manual gluing |
20:28:12 | shashlick | yes that's the goal |
20:28:42 | shashlick | i 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:58 | shashlick | with cimport that is |
20:29:53 | enow | I'd love that |
20:30:29 | enow | but 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:56 | shashlick | well if you can wait for a couple days, I can try to get this working |
20:35:33 | * | elrood joined #nim |
20:35:37 | enow | I'm gunning for having jpeg support tonight, but as for a complete API there's no rush |
20:35:59 | enow | libjpeg 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:43 | absolutejam | Does 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:31 | shashlick | enow: well here's an updated wrapper http://ix.io/1yq7/Nim |
20:37:43 | shashlick | there'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:59 | shashlick | add the required {.compile.} directives and you should be able to proceed |
20:38:13 | shashlick | until then I can get some of the bugs fixed |
20:40:42 | enow | I see how did you generate that one? |
20:41:18 | shashlick | using nimterop |
20:42:07 | shashlick | toast -n -p -DINCOMPLETE_TYPES_BROKEN -r jpeglib.h |
20:42:14 | enow | oh nice |
20:42:29 | shashlick | no tricks 😄 |
20:42:35 | * | narimiran quit (Remote host closed the connection) |
20:42:59 | enow | sweet so nimterop uses AST instead of whatever c2nim uses |
20:44:39 | enow | hm shoot nimterop compilation fails for me |
20:49:30 | * | absolutejam quit (Quit: WeeChat 1.9.1) |
20:52:31 | * | absolutejam joined #nim |
20:55:51 | enow | shashlick: check jconfig.txt for details on the jconfig.h |
21:00:25 | Araq | c2nim uses its own C(++) parser |
21:01:34 | * | aguspiza quit (Ping timeout: 246 seconds) |
21:02:15 | shashlick | Note that I used a jconfig.h generated by configure on mingw |
21:02:35 | enow | mhm |
21:02:41 | shashlick | Also there are some missing symbols which will need to be fixed |
21:02:45 | enow | should work |
21:03:11 | shashlick | So you can hand wrap those |
21:03:32 | shashlick | Just 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:45 | enow | hm JBLOCK it seems |
21:06:58 | enow | maybe I'm approaching this in a silly way though |
21:08:06 | enow | I wonder if jpeglib doesn't have some exotic error handling thing going on |
21:08:17 | enow | something about setjmp that looks scary |
21:13:11 | FromDiscord_ | <moerm> Hello all |
21:13:30 | enow | hi |
21:19:28 | shashlick | enow: ok so what exactly do you want to accomplish? |
21:26:13 | enow | hehe so I'm doing my server that takes json commands over websocket to controll a computer right |
21:26:35 | enow | I sorta got sidetracked but I quickly realized that I "simply" could make a html remote controll |
21:26:40 | enow | VNC sorta kinda deal |
21:27:06 | enow | so I figured why not grab frames from GDI, compress them as jpeg and push them out as a mjpeg stream |
21:27:44 | shashlick | fun project |
21:27:54 | enow | yeah it's quite cool |
21:27:57 | shashlick | and this is on windows? |
21:28:14 | enow | I'm in linux but I'm targeting windows for now |
21:28:38 | enow | nim is there for platform support so it's planned |
21:29:15 | shashlick | cool |
21:29:19 | enow | thinking if I can hook ffmpeg into some video stream I could make it really slick |
21:29:39 | shashlick | so are you planning on making a libjpeg library or just maintain it in your repo |
21:29:41 | enow | it'd be helpful to have control over I/P frames for compression and so forth while streaming |
21:30:18 | enow | I thought I'd see how far I come and push it to githu |
21:30:56 | enow | if there's interest in it I can put some time on it to polish it |
21:31:09 | enow | basically what I am doing now is I only want to encode images for exampel |
21:31:31 | enow | man does it show that libjpeg is old, they're really careful with not exhausting memory it seems |
21:31:54 | enow | makes the API a bit weird, nowadays most libraries would force you to allocate the whole image at once |
21:33:09 | enow | it's almost as old as I am |
21:34:35 | enow | nobody would ask you to feed an image line by line in this day and age |
21:39:00 | * | stefantalpalaru joined #nim |
21:40:13 | stefantalpalaru | resetAttributes() 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:27 | Araq | consider it fixed |
21:45:23 | stefantalpalaru | Thanks! |
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:40 | Araq | Timothee: I have to praise you. This tag "merge_when_passes_CI" is super helpful. :-) |
22:00:50 | Araq | (no irony here) |
22:02:01 | shashlick | still broken araq |
22:04:32 | shashlick | https://github.com/nim-lang/Nim/pull/10321/files |
22:05:24 | Araq | why? |
22:05:29 | Araq | stupid space? |
22:05:43 | Araq | well it should have been "koch".exe too |
22:06:38 | Araq | shashlick, well? |
22:06:57 | shashlick | koch worked on windows in the past |
22:07:06 | shashlick | didn't need the exe |
22:07:16 | * | stefantalpalaru quit (Quit: stefantalpalaru) |
22:07:16 | Araq | but it makes more sense |
22:07:37 | Araq | so ... it's the space or what? |
22:07:42 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:07:45 | shashlick | yes just the space |
22:07:57 | shashlick | since quoteShell puts quotes with the space |
22:08:30 | shashlick | didn't have my linux machine to test before i pushed, sorry |
22:09:07 | Araq | no worries |
22:28:35 | Araq | LemonBoy is back, https://github.com/nim-lang/Nim/pull/10322/files |
22:28:37 | Araq | :D |
22:31:07 | shashlick | Araq: its still broken 😞 |
22:31:17 | shashlick | "koch.exe", not "koch".exe |
22:31:31 | Araq | what's the difference? |
22:31:46 | shashlick | exe is outside the quote |
22:32:12 | shashlick | and it will break on posix won't it? but will work since winrelease is only for windows right now |
22:32:49 | Araq | proc exe*(f: string): string is in kochdocs.nim |
22:33:07 | Araq | it's an idiom in koch.nim to turn stuff into exe, but only on Windows |
22:33:17 | Araq | and I checked tools/winrelease.nim compiles |
22:33:24 | Araq | so isMainModule is false then |
22:33:30 | Araq | must 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:41 | shashlick | nift |
22:40:00 | shashlick | no i just read it as a problem |
22:40:10 | shashlick | that proc should be in the stdlib 🙂 |
22:40:54 | enow | 70 /* Data structures for images (arrays of samples and of DCT coefficients). |
22:40:54 | enow | 71 * On 80x86 machines, the image arrays are too big for near pointers, |
22:40:54 | enow | 72 * but the pointer arrays can fit in near memory. |
22:40:54 | enow | 73 */ |
22:41:01 | enow | things like this just make me too happy |
22:41:30 | shashlick | what does this mean => int (*coef_bits)[64]; |
22:41:35 | shashlick | in a typedef struct |
22:41:51 | shashlick | i know int x, int *x, what's an int (*x)[] |
22:41:56 | enow | words 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:04 | Araq | a pointer to an array |
22:42:11 | Araq | maybe, not sure. |
22:42:27 | enow | jup something along those lines |
22:42:29 | shashlick | so ptr array[64, int] |
22:42:40 | Araq | c2nim should know |
22:42:45 | shashlick | 🙂 |
22:43:46 | shashlick | well c2nim translates that to coef_bits*: array[64, cint] |
22:43:52 | enow | hm yeah I wrote a test in C for reference first, which is suprisingly difficult if you are used to gd or whatever |
22:44:06 | Araq | shashlick, that sounds wrong lol |
22:44:29 | shashlick | should i open an issue? |
22:44:32 | Araq | sure |
22:52:00 | * | shpx quit (Quit: shpx) |
22:53:35 | * | shpx joined #nim |
23:11:25 | enow | got a noob question |
23:11:33 | enow | JSAMPLE pixbuf[W*H*3]; |
23:11:59 | enow | why can't I write it as |
23:12:00 | enow | var pixbuf=array[0..W*H,JSAMPLE] |
23:13:25 | Araq | types are not values. |
23:14:41 | enow | hm so how should I write it |
23:15:00 | enow | JSAMPLE ought to be a uchar |
23:15:16 | Araq | var pixbuf: array[W*H*3, byte] |
23:16:42 | enow | ah I get it thanks a bunch!! |
23:18:15 | enow | typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ |
23:18:21 | enow | c2nim goes crazy on that one |
23:18:53 | enow | Some crazy 90s magic to facilitate for jpeg compression on 16 bit processors I take it |
23:19:08 | enow | so 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:36 | Araq | #def FAR |
23:38:43 | Araq | jezz learn some c2nim |
23:41:06 | * | darithorn joined #nim |
23:42:31 | enow | if 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:22 | Araq | https://nim-lang.org/docs/c2nim.html#preprocessor-support-def-directive |
23:47:30 | Araq | https://nim-lang.org/docs/c2nim.html#preprocessor-support-pp-directive |
23:47:40 | Araq | https://nim-lang.org/docs/c2nim.html#preprocessor-support |
23:51:26 | * | leorize quit (Quit: WeeChat 2.3) |
23:51:54 | zestyr | enow: regarding that remote control thing, you basically descriped jsmpeg-vnc :) doesn't support linux though |
23:53:00 | zestyr | I'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:28 | enow | zestyr: ah there we go :D I didn't figure I was inventing the wheel or anything |
23:53:55 | * | lritter joined #nim |
23:54:04 | shashlick | enow: only two errors left in nimterop |
23:54:06 | enow | I'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:15 | enow | amazing I'm impressed!! |
23:56:31 | enow | oh that def part really helps out a lot! |
23:57:09 | * | vlad1777d quit (Ping timeout: 258 seconds) |
23:58:13 | shashlick | why have they put a #define in the middle of a struct definition |
23:58:41 | shashlick | https://github.com/kornelski/libjpeg/blob/master/jpeglib.h#L652 |
23:58:41 | enow | shashlick: where? |
23:58:48 | enow | thx |
23:59:37 | enow | wow that's just nasty |