<< 05-05-2019 >>

00:27:21*xet7 quit (Remote host closed the connection)
00:43:56*rnrwashere joined #nim
00:46:28*rnrwashere quit (Remote host closed the connection)
00:50:53*rnrwashere joined #nim
00:50:59*abm quit (Read error: Connection reset by peer)
00:57:20*rnrwashere quit (Remote host closed the connection)
01:06:29*ricardo_ is now known as ricardo
01:08:41*ricardo quit (Quit: ricardo)
01:24:46FromGitter<Varriount> פ ח ו ף: How does one type your nickname?
01:28:12*Tyresc quit (Quit: WeeChat 2.5-dev)
01:30:02FromGitter<kayabaNerve> פ ח ו ף <- Like that
01:37:14*Hexeratops joined #nim
01:45:45FromGitter<kayabaNerve> What's the fastest way to turn a string of size X into an array[X, uint8]? Just a copyMem?
01:48:20leorizeunless you study their internals and play with cast
01:48:49leorizebut usually that wouldn't work so, yea, copyMem
01:49:38FromGitter<kayabaNerve> I don't think that helps unless I move from a raw array to a ptr
02:00:16*banc quit (Quit: Bye)
02:13:06*rnrwashere joined #nim
02:17:44*rnrwashere quit (Remote host closed the connection)
02:19:23*rnrwashere joined #nim
02:20:11FromGitter<jrfondren> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cce485bb4700e023d233ee7]
02:23:15*banc joined #nim
02:25:58*rnrwashere quit (Remote host closed the connection)
02:27:48FromGitter<kayabaNerve> So that's moving to a pointer :P
02:28:56FromGitter<jrfondren> aye. use a pointer and don't copy, or copy and use whatever you like
02:29:10*deech quit (Ping timeout: 252 seconds)
02:29:16*rnrwashere joined #nim
02:31:02FromGitter<kayabaNerve> I ended up using a var and then an in-the-moment `addr`.
02:31:23FromGitter<kayabaNerve> I was asking because I knew copyMem existed but was curious if there's a faster way that's GC compliant.
02:38:42*theelous3_ quit (Ping timeout: 252 seconds)
02:44:12*rnrwashere quit (Remote host closed the connection)
02:44:28*rnrwashere joined #nim
02:53:21*[rg] joined #nim
02:54:33*nsf joined #nim
03:01:59*rnrwashere quit (Remote host closed the connection)
03:12:20*rescartes joined #nim
03:12:25rescartesHi
03:24:25*rnrwashere joined #nim
03:26:56cy1great, now I have 126 fields on various objects, and I have to write boilerplate accessors for all of them. Is that really how you have to do it?
03:27:36cy1I could probably write a macro that just created accessors for every field in an object.
03:28:55leorizecy1: you want read-only accessors?
03:28:59rescartesWhat fields
03:29:45leorizeif r/w then just add a bunch of `*` to the fields :p
03:30:03leorizeif r/o then... well macros is the way to go
03:30:09cy1I did that, and it still said it was looking for a username= function...
03:30:20cy1that * thing I mean
03:30:23*rnrwashere quit (Remote host closed the connection)
03:30:47leorizecan you make a sample?
03:31:03*rnrwashere joined #nim
03:31:07leorizealso, have you exported the type itself?
03:40:00*Hexeratops quit (Remote host closed the connection)
03:42:12*rescartes quit (Remote host closed the connection)
04:08:04*rnrwashere quit (Remote host closed the connection)
04:08:55*rnrwashere joined #nim
04:33:02cy1leorize: no, I'm doing something wrong, I'm sure of it. My sample worked perfectly with no errors.
04:35:31*[rg] quit (Quit: Konversation terminated!)
04:38:15*rnrwashere quit (Remote host closed the connection)
04:39:46*dddddd quit (Remote host closed the connection)
05:02:49*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
05:04:33*rnrwashere joined #nim
05:34:55*[rg] joined #nim
06:02:32*solitudesf joined #nim
06:03:02*traviss joined #nim
06:10:04*rnrwashere quit (Remote host closed the connection)
06:19:02*ng0 quit (Quit: Alexa, when is the end of world?)
06:20:02travisshow can I tell nim to always use make a local nimcache in the directory where its run rather than use ~/nimcache?
06:20:25leorize--nimcache:/path/to/nimcache
06:20:27*narimiran joined #nim
06:20:43leorizein your case it should be --nimcache:nimcache
06:20:53leorizeyou can put this in a config file
06:21:02travissthank you, sorry i should have said: without specifying every time from command line
06:21:31travissyes, do you know where the config file is?
06:21:45leorizedepends on what os and how you install Nim
06:21:58travissi built from source on windows
06:22:43leorizego to the source -> config -> config.nims
06:22:52leorizethen add --nimcache:nimcache there
06:23:12leorize--nimcache:"nimcache", sorry
06:23:21travissok thanks a bunch. will give it a try :)
06:23:49*slugm joined #nim
06:25:42travissthat worked, except i had to omit the quotes. when i tried with quotes i got: cannot create directory: F:\Users\...\"nimcache"
06:26:58leorizenice, glad it worked
06:28:26travissthanks again. i'm a new user. have been exploring lots of languages lately and I really like nim a lot. very powerful and elegant language with lots of support for functional features that I like using
06:29:49travissit seems to almost have algebraic data types... i'm planning to explore this further. been watching lots of Araq's vods today.
06:48:43*slugm_ joined #nim
06:48:46*slugm quit (Ping timeout: 252 seconds)
06:52:56FromGitter<mratsim> It has ADT
06:54:07FromGitter<mratsim> They are called variants
06:55:12travissthank you i haven't heard of variants yet. i'll check it out.
06:56:50travissnim doesn't have higher kinded types does it?
07:00:00*gmpreussner quit (Quit: kthxbye)
07:00:57FromGitter<mratsim> In practice you can do everything you can do with higher kinded types with generics
07:01:08FromGitter<mratsim> but some times it's a bit annoying
07:01:36FromGitter<mratsim> you can have proc fooT (a: T, b: T): T for example
07:01:52FromGitter<mratsim> argh the code was eaten by Gitter
07:02:27FromGitter<mratsim> `proc fooT (a: T, b: T): T`, and T can also be a generic
07:02:58FromGitter<mratsim> see this RFC: https://github.com/nim-lang/RFCs/issues/5
07:03:38travisshaha, i am already reading it :)
07:04:37travissok, i see you can use concepts
07:04:45*gmpreussner joined #nim
07:05:28FromGitter<mratsim> An advanced example of concept use for Monad-like construcs is here: https://github.com/unicredit/emmy
07:06:22FromGitter<mratsim> for FP data structures I like this one: https://github.com/vegansk/nimfp, and for FP-like composition on Nim sequences: https://github.com/zero-functional/zero-functional
07:06:58travisscool!
07:07:54FromGitter<mratsim> And for Haskell-like type classes: https://github.com/nigredo-tori/classy
07:10:35travissthanks a bunch. these are exactly what i was looking for.
07:11:17FromGitter<mratsim> @narimiran maybe you should write a piece of Nim (ecosystem) for the Haskell dev ;)
07:11:27FromGitter<mratsim> on*
07:11:31narimiran:)
07:11:33*jjido joined #nim
07:12:01narimirani've only played with haskell for a bit, until i discovered (and fell in love with) F#
07:15:17travissi went from haskell toward ocaml recently. really like that its easier to do mutations and imperative style in ocaml. thats what i like about nim, but the syntax and flexibility with nim is just amazing.
07:16:23travissocaml syntax suffers from lack of function/operator overloading i think.
07:16:50travissbut its almost the same as F#.
07:19:46FromGitter<mratsim> Haskell was my first language (not counting bash and Excel)
07:20:30FromGitter<mratsim> but I was spending a lot of time trying to optimize stuff like prime number generation and fighting the GC.
07:21:05FromGitter<mratsim> the repl was really nice though
07:21:29travissyes same in ocaml. nice repl... does nim have a repl?
07:21:42FromGitter<mratsim> weeeeeellll
07:21:54FromGitter<mratsim> you can do "nim secret" :P and you will get a repl
07:22:23FromGitter<mratsim> you can also try inim: https://github.com/AndreiRegiani/INim
07:23:27FromGitter<mratsim> and there was a recent merge of Nim hot code reloading branch at the beginning of April but AFAIK no one used it to create a proper REPL yet: https://github.com/nim-lang/Nim/issues/8927
07:24:22travissnim secret looks good... i may have heard about it in a youtube video that described the hot reloading as a bit hacky.
07:25:02*slugm__ joined #nim
07:25:11travissmaybe not supporting when you redefine types or function parameters
07:25:29FromGitter<mratsim> before April, it was possible to do hot code reloading with hacks, but the HCR branch brings hot code reloading at suport at the language level
07:26:12travissso no gotchas in the repl then?
07:26:14FromGitter<mratsim> yes, because Nim is statically typed and you cannot change the size in memory as they those locations are fixed and already loeaded by the OS
07:27:15FromGitter<mratsim> nim secret doesn't allow any kind of FFI. so you cannot call any C library for example or use the standard lib that uses C libraries (like math for floating point math or regexp)
07:27:16*slugm_ quit (Ping timeout: 250 seconds)
07:28:09FromGitter<mratsim> @dom96 I think the redis package suddenly needs some love :P https://forum.nim-lang.org/t/4824
07:28:21travissoh thats fine. thanks. one more question: is there an llvm backend for nim or just the c/cpp/objc/js backends?
07:32:10FromGitter<mratsim> Not official but it's working: https://github.com/arnetheduck/nlvm
07:32:44travissah yes, i found this project but just wondered if this was being pursued from within nim
07:32:50FromGitter<mratsim> You can even write your own Nim compiler. You can just do "import compiler" and you have access to Nim internals, nlvm is written using that.
07:33:37FromGitter<mratsim> @arnetheduck is working with me at Status, we're the biggest backer of Nim development at the moment as we use it for blockchain.
07:36:38FromGitter<mratsim> @shashlick, how do you deal with projects that uses configure.sh in nimterop/nimgen? staticExec?
07:37:13travissyes i'm very curious about the nim compiler. do you know if the current compiler is written in an idiomatic nim style or is it more of a port from delphi and pascal?
07:38:04leorizea translation from pascal
07:38:19travissi heard araq mention that's where nim started out
07:38:28FromGitter<mratsim> I don't think there is any pascal remaining besides the P and T type prefixes
07:38:41leorizeyea, the current compiler is a translation from pascal :P
07:38:43FromGitter<mratsim> but it started as such yes, now it's pure Nim
07:39:01leorizethere's a pascal to nim transpiler iirc
07:39:06FromGitter<mratsim> yeah
07:39:19FromGitter<mratsim> pas2nim, py2nim, c2nim, and apparently rb2nim :P
07:39:36FromGitter<mratsim> to translate pascal, python, C/C++ and ruby to Nim :P
07:40:31travisswow. yeah i saw that nllvm used c2nim to generate their llvm bindings.
07:44:31FromGitter<mratsim> for bindings nimgen and nimterop are the new shiny things: https://github.com/nimterop/nimterop
07:46:08*slugm__ quit (Read error: Connection reset by peer)
07:47:00*slugm__ joined #nim
07:50:44travissany ideas how to move the nimble repo? i want to use a secondary drive..
07:54:12FromGitter<mratsim> no idea :/
07:54:17FromGitter<mratsim> symlink?
07:54:52travissthats a good idea.. will try. was looking for a nimble config file but can't find one.
07:55:18FromGitter<mratsim> ah yes there is: https://github.com/nim-lang/nimble#configuration
07:56:14travissi see there is an option --nimbleDir:dirname but not sure if that saves the config or not
07:56:21traviss*setting or not
08:05:59FromGitter<mratsim> just save the nimble.ini as in the link I gave you
08:07:46leorizenote that you'd also need to add --nimbleDir:dirname to the compiler configuration
08:08:20travissthanks again. i got it working. yes, i followed the link and saved a nimble.ini with nimbleDir = r"F:\...\.nimble"
08:09:00travissi had to create the nimble.ini in C:\Users\<YourUser>\AppData\Roaming\nimble\nimble.ini
08:10:16travissoh thanks leorize. will add that too.
08:16:38travisswhen i added --nimbleDir: F:\...\.nimble to config.nims, i got a compiler error: Error: invalid command line option: '--nimbleDir'. i tried enclosing the path with quotes but same error. I don't think the option is supported
08:25:07FromGitter<dom96> Traviss: put it in Nim's nim.cfg file
08:25:28FromGitter<dom96> Also it's nimblePath iirc
08:31:32travissok, after adding the line: --nimblePath: "F:\\...\\.nimble\\pkgs" to the end of my nim.cfg, i was able to build and run while importing a package i installed with nimble.
08:33:34*natrys joined #nim
08:36:22travissi took a while as i had to surround path with quotes, escape slashes, and add pkgs to the path before it would work. error messages were pretty helpful except for just guessing i needed to add pkgs to the path.
08:39:39travissbut overall i think nim is really easy to work with compared to other things i've been using lately. it seems like it just works!
08:43:02*cyberjpn joined #nim
08:44:24leorizefor nim.cfg there's a simpler syntax :P
08:44:31leorizenimblepath=r"F:\...\nimble\pkgs"
08:44:48leorizejust like nimble.ini (they use the same parser iirc)
08:46:01narimiranleorize: is this a placebo or does the `indentexp` branch of nim.nvim work faster/smoother than master?
08:46:41leorizeplacebo :p it should be slower, now that I actually (kinda) parse the code for indent
08:46:54leorizealtho I cap it at 3ms timeout
08:47:43leorizeor maybe I did some optimization and forgot about it :p
08:48:00narimiraneh, i feel like there is a less lag between my typing and showing the change on the screen.
08:48:11travissmuch better.
08:48:22narimiranmaybe an update of some other plugin is responsible :)
08:51:57travissany other twitch streamers or youtubers for nim? so far i found araq4k and d0m96.
08:55:06*Vladar joined #nim
09:07:56*hzx joined #nim
09:16:22*stefanos82 joined #nim
09:33:09*luis__ joined #nim
09:34:37*cyberjpn quit (Ping timeout: 245 seconds)
09:45:34*NimBot joined #nim
09:48:07*deech joined #nim
09:48:23*nsf quit (Quit: WeeChat 2.4)
09:52:53*luis__ quit (Remote host closed the connection)
09:57:38*slugm__ quit (Remote host closed the connection)
09:58:10*slugm joined #nim
09:59:24*cyberjpn joined #nim
10:06:19FromGitter<mratsim> I think it's only them. But they are a couple of youtube videos from conferences
10:07:44*cyberjpn quit (Quit: WeeChat 2.4)
10:08:30FromGitter<mratsim> @Araq, if I use Nim compiler as a plugin, does that mean that people will need to compile their own Nim compiler and call it if they want to use that plugin?
10:09:47FromGitter<mratsim> or can I just register extra passes that I can tag with a pragma for example
10:10:50*rnrwashere joined #nim
10:13:04*cyberjpn joined #nim
10:15:09*rnrwashere quit (Ping timeout: 258 seconds)
10:16:29*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:20:50*jjido joined #nim
10:22:19*[rg] quit (Quit: Konversation terminated!)
10:48:22*narimiran quit (Ping timeout: 245 seconds)
10:49:31*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:50:39*xet7 joined #nim
11:03:14*dddddd joined #nim
11:09:15*slugm quit (Ping timeout: 248 seconds)
11:11:24*slugm joined #nim
11:20:24*slugm quit (Read error: Connection reset by peer)
11:20:50*slugm joined #nim
11:29:45*Gertm joined #nim
11:30:03*Gertm left #nim ("Leaving")
11:30:49*Snircle joined #nim
11:32:46noonienis there a better way of doing this? `(getTime() + 10.days).utc().toTime().toUnix().uint32`?
11:38:42noonieni want the unix timestamp of utc() + 10days
11:46:32*jjido joined #nim
11:48:50*slugm_ joined #nim
11:49:22*slugm quit (Read error: Connection reset by peer)
11:58:13*cyberjpn quit (Ping timeout: 246 seconds)
11:59:02FromGitter<GULPF> you don't need the call to `utc()`, just `(getTime() + 10.days).toUnix` should work
12:00:28noonieni find no indication that getTime() returns a UTC date
12:00:29*slugm_ quit (Read error: Connection reset by peer)
12:00:54*slugm joined #nim
12:00:55FromGitter<GULPF> getTime returns a Time which doesn't have a timezone
12:01:02noonienwell, yes.
12:01:05noonienit returns local time
12:01:11noonieni need a utc timestamp
12:01:20FromGitter<GULPF> no, Time is not local time
12:01:22nooniennot a current system timestamp
12:02:05nooniengetTime() on your system might return a different time than mine.
12:02:19FromGitter<GULPF> it will not
12:02:46FromGitter<GULPF> time is implemented as a unix timestamp + nanoseconds
12:03:12*lritter joined #nim
12:03:54noonienyes, and the unix timestamp has no timezone associated, it's the current system's time, which is usually in user local time
12:04:16noonienfor example, echo getTime().toUnix on my system, returns `1557057851`
12:04:50noonienbecause, where i live, it's 13:04, where you live, it might not be
12:06:31FromGitter<GULPF> When I'm saying that Time doesn't have a timezone, I'm saying that it represents an unambiguous point in time without any concept of timezones associated with it. I don't mean that it's implicitly in local time
12:06:57FromGitter<GULPF> The unix timestamp stored in Time is always treated as a unix timestamp starting at 1970-01-01T00:00:00 UTC
12:07:58noonienhmm, i seemed to have missed this, i was never aware that the unix epoch is in UTC, my bad
12:09:51noonienthanks for the clarification!
12:10:46FromGitter<GULPF> No problem, the docs might need improvement. Also, beware that when using `TimeInterval` (for example `10.days` creates a `TimeInterval`) the result can depend on the local timezone. If you want to work in UTC, it's better to use the `Duration` type (e.g `initDuration(days = 10)`).
12:11:16FromGitter<GULPF> so `(getTime() + initDuration(days = 10)).toUnix`
12:13:00*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:13:45noonieni'm guessing this is functionally equivalent to `(now() + 10.days).utc().toTime().toUnix()`
12:13:51noonienwell, without .utc(), yes
12:17:26FromGitter<GULPF> Almost. Due to the way that `TimeInterval` works, `now() + 10.days` can give a different result than `now() + initDuration(days = 10)`. There's a good explanation in the devel docs: https://nim-lang.github.io/Nim/times.html#duration-vs-timeinterval
12:18:43leorizeis there any sugar for initDuration?
12:19:50FromGitter<GULPF> No. `TimeInterval` is older than `Duration` which is why it has the nice sugar
12:20:44FromGitter<GULPF> I would have preferred if `TimeInterval` didn't exist, but it's been around for to long
12:25:52*solitudesf quit (Ping timeout: 246 seconds)
12:26:11FromGitter<mratsim> we can deprecate it and slowly phase it out
12:26:35leorizewell, sugars for the newer interface first :p
12:33:26*cyberjpn joined #nim
12:34:30*luis_ joined #nim
12:38:14FromGitter<liquid600pgm> what does this mean? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cced93697dcb371d8693639]
12:38:33leorizeit means: you found a nim bug
12:38:40FromGitter<liquid600pgm> yay
12:39:16FromGitter<liquid600pgm> all I'm trying to do is to cast a pointer into an UncheckedArray[uint8]
12:39:38*slugm quit (Remote host closed the connection)
12:39:42leorizeplease make a small reproducible sample then open an issue on github :)
12:40:00*slugm joined #nim
12:40:19FromGitter<liquid600pgm> that'll be difficult to do since I don't know what's the problem and I have a rather large amount of code
12:40:52leorizewell, if it's just caused by casting a pointer to UA, then try to do that? :p
12:41:08FromGitter<liquid600pgm> I'm trying to cast a FreeType glyph slot's bitmap into an UncheckedArray[uint8], to be exact
12:41:13FromGitter<liquid600pgm> I'll try to reproduce this
12:41:39FromGitter<liquid600pgm> I'm using Nim 0.19.4 for this, btw, so it may have been fixed in devel
12:41:52FromGitter<liquid600pgm> oh wait, actually not
12:42:07FromGitter<liquid600pgm> I'm on devel
12:42:10leorizerelated: https://github.com/nim-lang/Nim/issues/9403
12:42:23leorizealso, you'd want to cast to `ptr UA` instead
12:42:37FromGitter<liquid600pgm> aaaah of course
12:42:43FromGitter<liquid600pgm> forgot about that
12:43:10FromGitter<liquid600pgm> yeah, that's the exact issue, thank you
12:43:25leorizebut still, please report the bug :p
12:53:48noonienis there something akin to printf in nim?
12:54:13FromDiscord_<פ ח ו ף> fmt?
12:54:13leorizeyou can always import `printf` from C :p
12:54:23leorizewell there's strformat and strutils.format
12:54:23FromDiscord_<פ ח ו ף> https://nim-lang.org/docs/strformat.html
12:55:12noonienawesome, thanks!
12:57:15*nsf joined #nim
13:08:58*hzx quit (Quit: Going offline, see ya! (www.adiirc.com))
13:23:49shashlick@mratsim: I've hard coded configure results so far instead of running configure
13:26:16shashlickSome examples
13:26:20shashlickhttps://github.com/nimterop/nimterop/blob/master/tests/tsoloud.nim#L24
13:26:56shashlickhttps://github.com/genotrance/nimarchive/blob/master/nimarchive.cfg#L43
13:27:07shashlickIs not pretty but portable
13:27:39shashlickMight be smarter to run configure on posix and hack up windows when msys is available
13:29:06shashlickSaw your issue as well - am planning on focusing on nimterop for the next few days and round up some features and issues
13:30:00shashlickOnce I finish porting nimarchive to nimterop
13:32:06*luis_ quit (Ping timeout: 252 seconds)
13:37:15*theelous3_ joined #nim
13:42:56FromDiscord_<פ ח ו ף> can i just import sdl2 and start using it right away?
13:45:13*luis_ joined #nim
13:53:34Araqsure
13:56:12FromDiscord_<פ ח ו ף> nothing special required to use C libs?
13:57:03Araqnah
13:57:09FromGitter<liquid600pgm> I think you just need the DLL, possibly the development headers too
13:59:50*Trustable joined #nim
14:07:17*bobito joined #nim
14:07:29bobitoi have something like
14:07:30bobitotype vec2 = object x, y: int
14:07:40bobitowhat would the difference be if i made it ref object
14:07:47bobitoone thing i found i can no longer echo it
14:07:54FromGitter<liquid600pgm> the object would be reference-counted
14:08:04leorizeappend `[]` and you can echo again
14:08:09bobitohow is that different to a non reference counted one?
14:08:14leorize`ref` means that it's allocated on the heap
14:08:20leorizenon-ref means stack
14:08:53FromGitter<liquid600pgm> `ref` also makes the object nil-able
14:08:55*narimiran joined #nim
14:09:00bobitowait why is the object itself the place to choose if its stack or heap instead of like using a static array or vector
14:09:16Araqit's not "reference counted", it's garbage collected. how the GC works is up to the implementation and we have 4 different GCs available
14:09:47leorizebobito: well, you can do `ref int` as well
14:09:57leorizeeven though it's rather pointless
14:10:20FromGitter<liquid600pgm> another thing: you should prefer ref objects over regular objects when doing inheritance
14:10:31bobitoso if i have a vec2 thats just a normal object i can go like let v = ref vec2(.....)
14:10:38leorizenope
14:10:44FromGitter<liquid600pgm> no, you have to do `new(vec2)`
14:10:52FromGitter<liquid600pgm> in order to create a `ref vec2`
14:11:25bobitothis model of heap or stack being tied to the object confuses me :/
14:11:46FromGitter<liquid600pgm> do you have experience with C?
14:12:06bobitoyeah some
14:12:21bobitoyou wouldnt put it in a struct if its stack or heap
14:12:27bobitoyou would malloc one of i you need heap
14:12:49leorizeas I said, `ref` can be applied to all types
14:12:49FromGitter<liquid600pgm> ref acts like a garbage collected malloc
14:13:08bobitoi know that
14:13:16bobitobut why should i make the object ref instead of using new()
14:13:33FromGitter<liquid600pgm> it depends whether you want to allocate it on the heap or the stack
14:13:49Araqthere is no "instead" here, they go together, 'ref' is a type constructor, new() is a malloc()-like primitive
14:13:54bobitoi know but if the object is ref it will always be on heap no?
14:14:08leorizeyea
14:14:17*cyberjpn quit (Ping timeout: 258 seconds)
14:14:30bobitoso if there is no instead what if i want the choice for both
14:14:31leorizeit's just boils down to the semantics
14:14:36Araqyeah, we have many people coming form Python who only understand 'ref object's *semantics*
14:15:05bobitoive never used python before so maybe its confusing for me
14:15:12leorizeyou can have both
14:15:27leorizenew() can be used to create ref anything
14:15:40leorizethe `[]` is Nim's dereference operator
14:15:48bobito`there is no "instead" here, they go together, 'ref' is a type constructor, new() is a malloc()-like primitive` no?
14:16:18FromGitter<liquid600pgm> `new(T)`creates a new `ref T`
14:16:42bobitooh ok
14:16:55bobitoso i should make everything non ref except for inheritance and then use new?
14:17:17leorizeif you found yourself typing new rapidly, go for a ref object
14:17:30leorizeif you want "choice", use this pattern:
14:17:38leorizetype SomethingObj = object
14:17:45leorizetype Something = ref SomethingObj
14:17:52FromGitter<liquid600pgm> I always use ref objects for large objects or ones that use inheritance, and normal objects for everything else
14:17:57Araqbobito, it's a very good rule of thumb.
14:18:56bobitook
14:19:20Araqand if you need to mutate the vec2, use 'myparam: var vec2'
14:19:33Araqdo not use 'ref' just to fight the immutability
14:19:45FromGitter<liquid600pgm> also, remember that `ref object`s are always mutable no matter what
14:21:52leorizehow to crash nimsuggest: `include karax / prelude` :P
14:22:16leorizeah, it survived
14:22:22leorizeat least until I use buildHtml
14:22:45FromGitter<liquid600pgm> how to crash nimsuggest: use concepts
14:24:08leorizeAraq: is there anyway to reset a form created by karax?
14:24:41leorizeI want to reset the form after the user click "Submit" (it's a simple login form)
14:25:04Araqleorize, setInputText("") on the widgets?
14:26:37leorizeI'm doing this from an `onSubmit` handler however :/
14:27:24leorizeguess I'm just gonna create the input before the handler
14:28:14FromGitter<mratsim> @lqde, unfinished macro as well, but concepts used to make nimsuggest use GB of memory in the past :p
14:29:36*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
14:32:54*abm joined #nim
14:33:19*Vladar quit (Read error: Connection reset by peer)
14:37:12*jjido joined #nim
14:41:20*PMunch joined #nim
14:47:34*marcazar joined #nim
14:48:27*luis_ quit (Ping timeout: 248 seconds)
14:48:30*bobito quit (Quit: Page closed)
14:54:17marcazarhello, I'm trying to create a new distinct type while using {.borrow.} pragma. I followed the manual and tried to compile the code in https://nim-lang.org/docs/manual.html#types-distinct-type . I'm using nim v 0.19.4 and I get an error for the multiplicative template saying: template multiplicative(typ, base: type) \n first type mismatch at position: 2 \n required type: type \n but expression 'int' is of type: type int
14:54:39marcazarany help with what might that error mean is appreciated :)
14:56:14Araqmarcazar, it's a known regression in the manual, use 'typ, base: typedesc' instead
14:57:24marcazaraha okay will do, thank you
15:21:19leorizeAraq: looks like you can't redraw a child component in karax :/
15:27:39*deech quit (Remote host closed the connection)
15:29:41shashlick@liquid600pgm - am looking at that nimterop branch again
15:33:03*PMunch quit (Remote host closed the connection)
15:48:38*clyybber joined #nim
15:57:09shashlickI don't know man, a lot of stuff breaks with -d:mingw - DirSep is wrong, creating dirs, files, everything doesn't work
15:59:35FromGitter<mratsim> +1 on DirSep
16:04:04shashlicki can work around in nimterop but it still sucks
16:04:21shashlickstuff you do at compile time using when defined(OS) is all delicate
16:04:41shashlickyou want to target the OS most of the time, but there's also crazy stuff you can do on the buildOS
16:07:55shashlickgetTempDir doesn't work
16:09:57FromGitter<arnetheduck> the longer term method to remain sane when dealing with paths is to have an internal canonical representation (so algorithms are simple / sane), and serialize/deserialize when interacting with os.. typically, libraries tend to favor `/` for this internal representation
16:10:42shashlickya and i've had zero issues with paths in nim
16:11:02shashlickonly now that os = windows when -d:mingw throws off all assumptions
16:11:24shashlickhome dir, temp dir, probably calls to read, write, etc
16:11:27shashlickeverything will break
16:11:28*rnrwashere joined #nim
16:11:42shashlickso setting os = windows is wrong
16:11:57shashlickat least as far as compile time is concerned
16:12:00shashlickbut it is correct for run time
16:12:07*fredrik92 quit (Read error: Connection reset by peer)
16:13:07shashlickthing is that so called run time is also evaluated at compile time so you need two different checks
16:13:22shashlickif readFile is called at compile time, when defined(windows) should check if buildOS = windows
16:13:39shashlickbut if same readFile is called at run time, it should use nim.cfg's os definition
16:14:12shashlickor we need when nimvm calls everywhere
16:14:19shashlickcc @Araq for any opinions on this
16:19:39*rnrwashere quit (Ping timeout: 248 seconds)
16:20:22*druonysus quit (Ping timeout: 246 seconds)
16:21:35disruptekwow, that's a mess.
16:21:57FromGitter<mratsim> @arnetheduck I had this DirSep problem in nim-beacon-chain when debugging the windows build a month ago iirc
16:28:38*rockcavera joined #nim
16:31:55*theelous3_ quit (Ping timeout: 248 seconds)
16:32:25*theelous3 joined #nim
16:40:08*slugm quit (Remote host closed the connection)
16:40:29*slugm joined #nim
16:49:27*cval joined #nim
16:49:33cvalhi
16:49:52FromGitter<liquid600pgm> hello!
16:49:52cvalim new on nim, come from python
16:50:06cvaljust install nim on windows 10
16:50:47cvaland i installed nimPDF for some practice
16:51:15cvalbut when i run nim compile get this error
16:51:41livcdWhat kind of error do you see ?
16:52:04cvalerror: cannot open file nimPDF
16:52:21FromGitter<liquid600pgm> are you sure you installed the package using nimble?
16:52:28cvalrun nimble path nimPDF
16:53:23cvaland get this: c:\Users\XXX\.nimble\pkgs\nimPDF-0.4.2
16:54:05cvalcheck the nim-0.19.4\config\nim.cfg to see the nimblepath and it is
16:54:17cvalnimblepath="$home/.nimble/pkgs/"
16:54:54cvali have the feeling that is a path configutarion but i don't know how to solve it
16:55:29*[rg] joined #nim
16:58:01leorizecval: try passing `--verbosity:3` to the compiler
16:58:12noonienhmmm, why does `3.uint16 > 0` not work?
16:58:32narimirannoonien: because 0 != 0.uint16?
16:58:58FromGitter<liquid600pgm> noonien: protip: you don't have to do 3.uint16 explicitly, you can do 3'u16
16:59:10leorize3u16 also works :)
16:59:16FromDiscord_<demotomohiro> !eval echo(3.uint16 > 0)
16:59:17NimBotCompile failed: in.nim(1, 15) Error: type mismatch: got <int literal(0), uint16>
16:59:23Zevvimport lenienttypes
16:59:28noonien!eval echo(3.int16 > 0)
16:59:30NimBottrue
16:59:31noonienthis works though
16:59:53Zevvyou can't compare int and unsigned int
17:00:16Zevvyou can't compare int and unsigned int
17:01:09Zevvno, its lenientops
17:01:26leorizehowever, for this trivial sample the compiler should have inferred the types IMO
17:01:35noonieni see, so, by default, number literals are signed
17:01:45leorizewell, unsigned is never a first class citizen in Nim :p
17:01:50FromGitter<arnetheduck> no, number literals are *sometimes* inferred
17:01:58*al_ joined #nim
17:02:19leorize!eval echo 3u16 > 0u
17:02:21NimBottrue
17:02:30Zevvbut why does lenientops not help? I'd expect it to define `<` for two SomeIntegers
17:02:46leorizeecho uint is SomeInteger
17:02:52leorize!eval echo uint is SomeInteger
17:02:54NimBottrue
17:03:08FromGitter<arnetheduck> when they're inferred depend on how and in what order the templates are expanded
17:03:24leorize!eval import lenientops; echo 3u16 > 0
17:03:25NimBotCompile failed: in.nim(1, 30) Error: type mismatch: got <int literal(0), uint16>
17:03:46Zevvleorize: no, lenientops simply doesnt define for two SomeIntegers, only for int/float combos
17:04:51*luis__ joined #nim
17:04:52FromGitter<arnetheduck> for example, `>=` is defined in terms of `<` and thus will not behave the same as `<` on its own.. there's not a lot of consistency or soundness in nim with regards to `uint`
17:05:14*Lexy joined #nim
17:06:16FromGitter<arnetheduck> then there's half of the code that uses the operator based approach where integers are integers with no sign implied and the operator determines the sign (`+%` vs `+`) so there are now two incomplete ways of dealing with this issue :)
17:06:18cvalHint: used config file 'C:\Users\Carlos\Downloads\nim-0.19.4\config\nim.cfg' [Conf] Hint: system [Processing] Hint: test [Processing] test.nim(1, 8) Error: cannot open file: nimPDF C:\Users\Carlos\Documents>nim compile --verbosity:3 test.nim ..\Downloads\nim-0.19.4\config\nim.cfg(47, 3) Hint: added path: 'C:\Users\Carlos\.nimble\pkgs\nimSHA2-0.1.1' [Path] nimblepath="$home/.nimble/pkgs/" ^ ..\Downloads\nim-0.19.4\config\nim.cfg(47
17:06:25leorizeI guess unsigned should be inferred automatically
17:06:57narimirancval: how did you install nimPDF?
17:06:59FromGitter<arnetheduck> to infer, you need an anchor to infer it to - not always so easy
17:10:37*cval quit (Ping timeout: 256 seconds)
17:14:58*cval joined #nim
17:15:15cvali'm installed nimpdf with nimble
17:15:20cvalnimble install nimPDF
17:18:18*nsf quit (Quit: WeeChat 2.4)
17:27:08*rnrwashere joined #nim
17:28:28narimirancval: just tried it myself
17:29:21narimiran`nimble install` reports success, but when i do `impor nimPDF` i get the same error as you (Error: cannot open file: nimPDF), this is on linux and Nim 0.19.9
17:29:49narimirancval: i think you should report it
17:30:47cvalok, thanks for your fast answer!
17:32:14*rnrwashere quit (Remote host closed the connection)
17:38:12*Trustable quit (Remote host closed the connection)
17:46:14*solitudesf joined #nim
17:46:25*al_ quit (Quit: al_)
17:47:24*cval quit (Quit: Page closed)
17:55:51disruptek!import json; echo %* "foo"
17:56:29narimirandisruptek: the command is `!eval` and then code
17:56:38disruptekoh yeah
17:56:42disruptek!eval import json; echo %* "foo"
17:56:44NimBotCompile failed: in.nim(1, 19) Error: type mismatch: got <proc (x: varargs[typed]){.gcsafe, locks: 0.}, string>
17:56:47disruptek!eval import json; echo %*("foo")
17:56:49NimBot"foo"
17:56:52disruptekthanks.
18:04:04shashlick@liquid600pgm - as you can see from my messages, no clean fix right now for mingw
18:07:40shashlick@mratsim - am looking at your nimterop issue now
18:08:06nooniengiven i have the string: "00005678" in a var, and the string "1234", can i copy the second string into the first one, replacing the zeros, without additional allocations?
18:08:33narimiranfirst[0..3] = second ?
18:09:05marcazar#quit
18:09:10*marcazar quit (Remote host closed the connection)
18:09:25FromGitter<mratsim> @shashlick, this is the kind of dump I need: https://github.com/mratsim/nim-isl/blob/master/debug_generated_wrapper.log.nim notice that I've anonymized the paths
18:09:30FromGitter<liquid600pgm> shashlick: which messages?
18:10:02*Perkol joined #nim
18:10:06shashlick@liquid600pgm: https://irclogs.nim-lang.org/05-05-2019.html#16:04:04
18:10:36shashlick@mratsim: doesn't nim c a.nim > aout.nim work?
18:10:46shashlickof course you need cDebug()
18:11:11FromGitter<mratsim> yes that's what I did + search/replace for anonymization
18:11:16shashlickyou already have cDebug
18:12:00FromGitter<mratsim> one implementation would be for cDebug to accept a file path and dump here is not empty
18:12:04shashlickya - @arnetheduck already asked for something similar - https://github.com/nimterop/nimterop/issues/125
18:12:29FromGitter<liquid600pgm> shashlick: can't we just check for `defined(mingw)`? I don't think it's set under Windows
18:12:39FromGitter<liquid600pgm> only when you pass `-d:mingw`
18:13:11shashlick@liquid600pgm - problem is that -d:mingw changes os = windows which breaks all built-in stuff like readFile, writeFile and so forth
18:13:21FromGitter<mratsim> also how do you deal with ./configure project in general? staticExec?
18:13:29FromGitter<liquid600pgm> oh that sucks
18:14:06shashlickthat is - you want different behavior for compile time vs run time but the stdlib procs only know runtime state
18:14:46shashlick@mratsim - i replied here - https://irclogs.nim-lang.org/05-05-2019.html#13:23:49
18:15:06FromGitter<mratsim> ah I see
18:16:12FromGitter<mratsim> well in my case the "make" command also generates header with types which is quite annoying
18:16:12shashlickbut i'm still not clear what you need from your issue - why is > output.nim not good enough?
18:16:53shashlickya i've seen stuff like that - its a pain to make those portable wrappers
18:17:41FromGitter<mratsim> mostly the absolute paths in the output, and secondly I think it will be better as a debug argument instead of potentially mixing it with other outputs
18:17:50FromGitter<mratsim> I don't mind if it's low-priority though
18:17:52shashlickmy graphql lib is still delicate that way
18:17:53shashlickhttps://github.com/genotrance/nimgraphql/blob/master/nimgraphql.cfg
18:18:10FromGitter<liquid600pgm> shashlick: how can I compile for Windows, then?
18:18:18FromGitter<mratsim> I'm mostly experimenting with that library to reimplement part of it in pure Nim
18:18:41shashlick@mratsim - so > output.nim will only give the nim output and a few comments - all the nim output goes to stderr so won't be in the output
18:18:46shashlickthe file should still compile
18:19:55shashlick@liquid600pgm - i can hack around nimterop to make it work but problem is that in general, cross compilation will be a mess for people
18:20:03shashlickso that's a general nim problem
18:20:18shashlickif you use readFile in a wrapper to edit a file, it might not work
18:20:33FromGitter<liquid600pgm> I'll figure out a way to do it on my local machine, at least
18:20:44shashlicki can make you a build on windows if you need
18:20:51shashlickor you can use travis
18:21:08FromGitter<liquid600pgm> sounds like an idea, I really need to get into CI at some point
18:21:21FromGitter<liquid600pgm> I'm still stuck testing manually lmao
18:21:47FromGitter<mratsim> well, Nim is much better than C/C++ in that regards ... I spent too much of my weekend tinkering other people broken CMake due to LD_LIBRARY_PATH (yeah QT), GCC 8, C++14 or other issues ...
18:23:10shashlickok so removing absolute paths is a challenge for multiple reasons
18:23:28shashlickwhen recursing header files in gcc -E output, i need exact paths or output gets missed
18:23:45shashlicksecond, i don't have typical os procs available at compile time
18:24:00shashlickso relativePath kind of procs aren't available to fix things
18:24:34shashlickgetting exact path to the wrapper deps (h/c files) has to be based on currentSourcePath which is absolute from the beginning
18:25:34*rnrwashere joined #nim
18:26:45*PMunch joined #nim
18:27:53shashlick@mratsim - so are you good with the > output.nim method? the other absolute path requirement is already in arne's issue
18:28:48shashlickan option is to remove {.header.} pragmas altogether as arne suggests but not sure if it will work for all cases
18:29:05FromGitter<mratsim> my relative path requirement is only w.r.t. to debug output when dumped
18:29:32FromGitter<mratsim> I still think a "outputFile" param for cDebug would be good
18:30:01FromGitter<mratsim> for now I don't have a pressing need though so it can be low prio to see if others wants it or not
18:30:36shashlicksounds fair
18:31:50*vlad1777d_ quit (Ping timeout: 246 seconds)
18:32:00*JappleAck joined #nim
18:34:47*Jesin quit (Quit: Leaving)
18:36:09shashlick@mratsim - any other big concerns with nimterop? i am looking into what i should fix
18:36:24shashlickfeedback from others also appreciated - @liquid600pgm @arnetheduck @leorize
18:37:14FromGitter<mratsim> No, it's easy enough that I probably won't do things like that anymore: https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim
18:37:58FromGitter<mratsim> one thing but more for nimsuggest, I get spammed by *nimterop** files
18:39:08FromGitter<mratsim> (https://files.gitter.im/nim-lang/Nim/rKcv/DeepinScreenshot_select-area_20190505203847.png)
18:40:34shashlickso are you saying you won't use nimterop anymore?
18:40:45shashlickthose files should go into temp, why are they in your local dir
18:41:56*nsf joined #nim
18:46:24leorizemratsim: something must have gone really wrong with your editor :p
18:51:15*Hexeratops joined #nim
18:53:15*luis__ quit (Ping timeout: 248 seconds)
18:55:11*a_b_m joined #nim
18:56:26*a__b__m joined #nim
18:56:30dom96Good evening everyone
18:58:23*abm quit (Ping timeout: 245 seconds)
18:58:24PMunchEvening
18:59:33*rnrwashere quit (Remote host closed the connection)
19:00:11*a_b_m quit (Ping timeout: 248 seconds)
19:01:03*rnrwashere joined #nim
19:02:37shashlickHey how's it going
19:02:41*Jesin joined #nim
19:02:58dom96Good good. Happy there is a Bank Holiday tomorrow
19:04:06shashlick@dom96 did you have an opinion on this - https://irclogs.nim-lang.org/05-05-2019.html#16:04:04
19:04:44dom96Hrm, chance DirSep for when `mingw` is defined?
19:05:22shashlickwell, everything that has a when defined(os) block will do the wrong thing at compile time
19:06:22shashlick@mratsim @leorize - that's because of nimterop - cCompile has to disambiguate files with same names in diffrent source dirs since they get compiled to the same .o file
19:06:27shashlickhttps://github.com/nimterop/nimterop/blob/master/nimterop/cimport.nim#L417
19:07:39dom96`mingw` is effectively an OS
19:08:10dom96wait, what even is it?
19:08:13dom96Why does DirSep change?
19:08:16shashlickI agree for runtime, but for compile time you are still sitting in linux
19:08:26shashlickcause nim.cfg defines os = windows when -d:mingw
19:08:55shashlickyou can use the -d:mingw flag to cross compile to windows
19:09:28*rnrwashere quit (Remote host closed the connection)
19:10:31FromGitter<liquid600pgm> shashlick: I really like nimterop, it's the thing I was looking for when getting into Nim FFI. something that's easy to use, has good documentation, and doesn't require a ton of code to use
19:11:38FromGitter<kayabaNerve> dom96 Does that apply to TDM GCC too? I assume not but have no idea.
19:12:02dom96No idea what TDM is
19:13:18shashlickwell, anytime you set --os:xyz in nim, all your when defined(os) statements get affected - which is what should happen at runtime but it shouldn't affect compile time where you are still on the build OS
19:13:46FromGitter<liquid600pgm> the thing is, `when` *is* a compile-time feature
19:14:02shashlickagreed so it's not as simple
19:14:59noonien`var x, y: string; x = "foo"; y = x;` do x and y point to the same string?
19:15:14noonieni'm guessing not
19:15:31noonienjust wanted to make sure
19:16:25FromGitter<liquid600pgm> afaik yes, strings are mutable in Nim
19:16:27*a_b_m joined #nim
19:16:51dom96!eval var x = "foo"; var y = x; echo(repr(x));echo(repr(y))
19:16:53NimBot0x7fe9857d4058"foo"↵0x7fe9857d4080"foo"
19:16:59noonienyes, they are, but i'm unsure of copy conventions
19:17:11dom96strings are copied
19:17:24FromGitter<liquid600pgm> good to know
19:17:26nooniencan i get a "reference"?
19:17:42FromGitter<liquid600pgm> perhaps `addr` can help?
19:17:58dom96noonien, what are you trying to do?
19:18:34clyybbermratsim: What are your opinions on https://github.com/nim-lang/Nim/issues/11178#issuecomment-489452673 ?
19:18:35noonienhmm, i guess i just want an alias
19:18:45dom96liquid600pgm: that's unsafe. I'd suggest not using it unless you're dealing with FFI
19:19:12dom96noonien, template alias: string = otherString
19:19:44dom96maybe someone will eventually make an `alias` macro that does this and put it in the stdlib... :)
19:20:04*a__b__m quit (Ping timeout: 252 seconds)
19:20:04noonienah, ok
19:20:27*Jesin quit (Quit: Leaving)
19:20:40noonienhopefully accessing the same field multiple times on an object gets optimized
19:20:45narimiran!eval var x = "foo"; let y = x; echo(repr(x));echo(repr(y))
19:20:46NimBot0x7f5f1349f058"foo"↵0x7f5f1349f080"foo"
19:21:24*slugm quit (Ping timeout: 250 seconds)
19:21:40*tefter quit (Remote host closed the connection)
19:22:10clyybbershashlick: Do you propose differentiating for hostOs and buildOs ?
19:22:41shashlickthey are different already
19:22:48shashlickbuildOs = linux even if -d:mingw
19:23:07shashlickbut getTempFile() checks for when defined(windows) and does something different, compared to posix
19:23:21shashlickif you call getTempFile() at runtime, it should be windows %TEMP%
19:23:30shashlickbut if in a static block, it should be /tmp
19:23:43clyybberah, I see.
19:23:44*slugm joined #nim
19:23:52*stefanos82 quit (Remote host closed the connection)
19:24:34dom96shashlick, I don't understand the problem. You're cross compiling to Windows, so os == windows sounds right?
19:25:13shashlickya but if i do a getTempDir() at compile time to write something there like i have to for nimterop, it runs getEnv("TEMP") which doesn't work
19:25:22shashlickand that's just one example
19:25:57shashlickeverything in os.nim that has different code by OS that somehow works in the VM will do this
19:26:53clyybberso we gotta `when nimvm` all of 'em
19:27:50shashlickbut that also isn't clean cause then you still got to run the os specific code there
19:28:24shashlickso in some sense, all the procs are written correctly but if the code is running in the VM, it should check buildOS for that when condition and not hostOS
19:28:49clyybberyeah, so we should patch the vm
19:29:50clyybberthe vm caring about the target os doesn't make sense anyways, so it shouldn't cause problems
19:30:40FromGitter<mratsim> @shashlick, no I will try nimterop first when wrapping that's what I meant
19:31:28FromGitter<mratsim> well it really depends because for ISL I tried to wrap I think it's better if I only import select proc because it's just oo overwhelming :/
19:31:53*rnrwashere joined #nim
19:32:10shashlickmaybe a whitelist would be cool - only import these 5 things
19:32:42shashlickyou could also add a cPlugin to exclude by some pattern
19:33:03FromGitter<mratsim> @clybber sounds good, except I prefer static let then the assignment statement to the tiny difference between static and static:
19:33:06shashlickbut there's really no harm since it only has to run once, after that the results are cached
19:38:34*rnrwashere quit (Remote host closed the connection)
19:41:15dom96oh, I understand the problem now.
19:41:26*jjido quit (Quit: Textual IRC Client: www.textualapp.com)
19:42:25*narimiran quit (Ping timeout: 258 seconds)
19:42:54*deech joined #nim
19:43:00dom96So what was the problem with changing when nimterop generates wrappers?
19:43:11dom96Doing it at installation time seems like it's proving to be just a massive pain
19:43:29dom96Why not just let people generate their wrappers by running `nimterop` manually before commiting their generated wrappers?
19:43:39shashlickwell, nimterop does various tasks at compile time - pulling code from git, writing/reading files, running commands etc
19:44:06shashlickeven if you do it one off like you say, it breaks down for cross compile scenarios
19:44:24shashlickbasically i'm having to tell @liquid600pgm not to use -d:mingw on linux and use a real windows system
19:44:46*Lexy quit (Quit: � Www.Kelebek.Org Mutlaka Download Edin! Kelebek Final irc.kelebek.org �y wToprak �)
19:44:54clyybberHi deech
19:44:58dom96Why does it break down?
19:45:05FromGitter<liquid600pgm> I don't want to use windows D:
19:45:19dom96And it seems that nimterop as it is right now has already broken down for cross-compilation?
19:45:48deechHi
19:45:55dom96I guess nimterop generates wrappers that are specific to the architecture the installation occurs on?
19:46:20dom96Would it be hard to make it generate appropriate `when`s to ensure the wrappers work across all os/archs?
19:46:31shashlickit isn't specific to nimterop really
19:46:33clyybberdeech: mratsim is supportive of the unification of compiletime and static, so we are 3 ppl now \o/
19:46:54shashlickif you want to do anything at compile time and set --os:xyz, all stuff will not work anymore
19:47:01shashlicksimple example = getTempDir
19:47:11deechclyybber, haha!
19:47:59FromGitter<liquid600pgm> clyybber: I support your initiative, too
19:48:06shashlickrun static: getTempDir() and it won't work as expected
19:48:49deechI would be happy to see `{.compileTime.}` go away. :) You can get into confusing situations like, `let (a,b {.compileTime.}, c) = ...`.
19:51:05deechI'd also love to see variants supported at compile time. Currently they're explicitly disallowed for reasons I don't fully understand.
20:04:14*[rg] quit (Ping timeout: 246 seconds)
20:15:23*rnrwashere joined #nim
20:17:56*Jesin joined #nim
20:25:23*Sencatsu joined #nim
20:26:24*[rg] joined #nim
20:28:22*Senketsu_ quit (Ping timeout: 245 seconds)
20:30:37*[rg] quit (Ping timeout: 246 seconds)
20:35:47*jjido joined #nim
20:40:47*slugm quit (Read error: Connection reset by peer)
20:41:00*slugm joined #nim
20:42:43*a_b_m quit (Quit: Leaving)
20:42:46FromGitter<akavel> Hi! I'm trying to compile a .nim file to get a .c file, but I don't seem to be getting any output; I'm confused why is that so (o_O)
20:42:52FromGitter<akavel> My command is: `nim c --app:lib -d:noSignalHandler --compileOnly hello.nim`
20:43:33FromGitter<akavel> but even with a simple `nim c --compileOnly hello.nim`, I don't see any .c file :(
20:43:43clyybberdeech: I agree, I think its because variants are implemented with some pointer stuff, but don't quote me on that
20:43:46FromGitter<akavel> what am I doing wrong? :/
20:43:52clyybberliquid600pgm: Nice \o/
20:44:09PMunchakavel, looking in the wrong place
20:44:45FromGitter<akavel> PMunch: oh, then where are the files put?
20:44:48clyybberakavel: The c file should be in ~/.cache/nim/a_d
20:44:50PMunchTry setting --nimcache or looking in the default location for your platform
20:45:09FromGitter<akavel> Oh, ok, thanks!
20:45:47FromGitter<akavel> Hm, if I tried to use -o option, would I get the file in the current dir? Or also not?
20:46:23*vlad1777d_ joined #nim
20:47:04*nsf quit (Quit: WeeChat 2.4)
20:47:29*PMunch quit (Remote host closed the connection)
20:47:34FromGitter<akavel> tried -o, didn't change. Wil read about --nimcache, thanks
20:48:02*PMunch joined #nim
20:48:27PMunchakavel, -o is only for the binary IIRC
20:48:49PMunch--nimcache:. should put it in your current directory I think
20:50:29*Perkol quit (Quit: Leaving)
20:52:23FromGitter<akavel> PMunch: yep, tried --nimcache:./cache, just in case it'd clobber it with much stuff, and I did well, as all the .c files for the imported libraries seem to get saved there too.
20:53:08*lritter quit (Quit: Leaving)
20:53:19FromGitter<akavel> Do you know how I can instruct nim to use a particular C compiler for the current project?
20:53:28FromGitter<akavel> and CFLAGS?
20:53:29*PMunch quit (Remote host closed the connection)
20:53:48FromGitter<akavel> I should probably read more about nimble, is that correct?
20:54:06*PMunch joined #nim
20:54:09FromGitter<akavel> I'm trying to cross-compile for an Android device
20:54:33FromGitter<akavel> I have Android NDK installed
20:54:58FromGitter<akavel> I managed to cross-compile a simple hello-world in C, and verify it works OK on the device
20:55:01*PMunch quit (Remote host closed the connection)
20:55:21FromGitter<akavel> Now I'm trying to do a similar one from Nim...
20:56:50FromGitter<akavel> Does nim look in some .cfg files or something? I seem to recall I've seen something like that, but can't remember enough detail to know where to look in the manual/docs/... :/
20:59:50FromGitter<akavel> Ok, I think it's https://nim-lang.org/docs/nimc.html, which suggests a `nim.cfg` file is consulted
21:01:01*slugm quit (Remote host closed the connection)
21:03:39shashlickUse $CC
21:04:11shashlickAlso check nightlies dx.sh to see how Nim itself gets compiled for Android
21:04:19shashlickThere's android binaries posted
21:11:56FromGitter<akavel> there's some build.sh mentioned in dx.sh, but I don't seem to see it neither in nightlies/ nor in nim/ ? (there's nim/build_all.sh, but don't see build.sh)
21:18:58*rnrwashere quit (Remote host closed the connection)
21:28:00FromGitter<akavel> Ok, managed to get some .so to build, with --hint[CC]:on to see what compiler is called. Thanks guys again! Now "only" to see if it works on the device ;)
21:35:56shashlickBuild.sh comes from csources
21:36:04shashlickIt is packaged as part of the build
21:36:18shashlickBut basically just set CC to your compiler
21:39:46FromGitter<akavel> I did: `nim c --app:lib --os:android --cpu=arm -d:noSignalHandler --hint[CC]:on hello.nim`
21:39:58FromGitter<akavel> somehow it auto-detected that clang must be used
21:40:06FromGitter<akavel> I also added the following in nim.cfg:
21:40:21FromGitter<akavel> --clang.path:r"c:\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin\" ⏎ --clang.exe:"armv7a-linux-androideabi16-clang.cmd" ⏎ --clang.linkerexe:"armv7a-linux-androideabi16-clang.cmd"
21:41:12FromGitter<akavel> And the result works, woohoo! :D \^u^/
21:41:43*rnrwashere joined #nim
21:41:47FromGitter<akavel> I expect to do a writeup and post it on the Nim forum
21:42:04clyybbergood night
21:42:14*clyybber quit (Quit: WeeChat 2.4)
21:42:14FromGitter<akavel> but probably not today; hopefully before end of the week
21:42:48FromGitter<akavel> The achievement is building an .apk for Android without Android SDK
21:43:02FromGitter<akavel> though I still needed Android NDK for now
21:43:26FromGitter<akavel> But I wrote a (MVP) .dex assembler in Nim, + some helper tools, one in Nim, one in Go
21:44:47FromGitter<akavel> Thanks again for help, and hope you'll like the writeup.
21:45:50shashlickOh you are the one who posted on lobsters
21:46:33shashlickI was going to try building an so later
21:50:59FromDiscord_<פ ח ו ף> should i enable check for release versions
21:52:01FromGitter<akavel> shashlick: yep. What do you mean by "an so"?
21:53:30xaceakavel: he might be referring to *.so files. Where will you publish your findings?
21:54:02FromGitter<akavel> xace: Ah, right. Probably on the Nim forum.
21:54:29xaceAlright :)
21:54:55FromGitter<akavel> Hopefully with a Show Lobste.rs & Show HN linking to the to-be article on the forum.
21:55:31dom96akavel: ooh, super excited for the write up!
21:55:32FromGitter<akavel> Note however that's a very MVP grade stuff, with an emphasis on M ;)
21:55:56FromGitter<akavel> dom96: happy to hear :D
21:56:51dom96I actually have a project that might make use of this. Writing a game that I would like to eventually get running on Android :)
21:57:44FromGitter<akavel> @dom96: Actually, with games it might be even easier than with "regular" full-blown GUI stuff
21:58:04FromGitter<akavel> (which is what I'd be interested in)
21:59:43FromGitter<akavel> OTOH, there may be some divergence between the two use cases. Haven't really explored the game-like one.
21:59:49shashlickOn the move now but happy to help with this
21:59:59shashlickAre you running in termux?
22:00:14FromGitter<akavel> @shashlick: help with what in particular?
22:00:22FromGitter<akavel> @shashlick: no, not in termux
22:02:07xacehe seems to be crosscompiling from windows... Yeah I'm also interested in full-blown GUI for android using nim... atm I know of nimx and wiish, which seems to be viable candidates
22:02:14FromGitter<akavel> By the way, as a teaser, if you have an ARM-based phone, and are not afraid of installing random APKs from a semi-random guy on the Internet, you can try downloading: https://github.com/akavel/tests/releases/download/foobar/hello-jni.apk
22:02:55xaceakavel im paranoid as f*ck, but what happens when you run that apk? what does it look like?
22:04:23FromGitter<akavel> just a "boring" (actually, super exciting to me ;P) "Hello from Nim" message in a simplest possible TextView
22:05:00FromGitter<akavel> And no Java was hurt in making this .apk ;)
22:05:26FromGitter<akavel> Or, actually, no PC was hurt by Java.
22:06:30xaceactually no cpu was hurt by java
22:07:01FromGitter<akavel> hm, the phone CPU was kinda involved
22:07:37FromGitter<akavel> and the .apk verifier there was bashed quite some...
22:07:37xacewell... we do our best trying to nim the world
22:08:11FromGitter<akavel> In case you are not afraid of seeing some gory details pre-writeup,
22:08:48FromGitter<akavel> the TextView creation and Nim call via JNI is at: https://github.com/akavel/dali/blob/master/jni_hello.nim#L79-L88
22:09:05xacenah i wouldnt mind. infact i'd offer a non-sexual kiss to whoever makes it easy for nim to make proper API usage and UI for OSX and android...
22:09:50*lritter joined #nim
22:10:18FromGitter<akavel> whereas the source of the JNI .so in Nim is at: https://github.com/akavel/hellomello/blob/master/hello.nim#L20
22:10:46FromGitter<akavel> Now, "easy" is in the eye of the beholder ;)
22:11:24FromGitter<akavel> I'm definitely not promising "easy" at this point ;) but "not requiring Android Studio" it is.
22:11:29xacehaha dw, this information itself is helpful to get started, might aswell add you to the "nim+android" list im stashing
22:14:05FromGitter<akavel> yw
22:19:39*solitudesf quit (Ping timeout: 248 seconds)
22:20:53FromGitter<akavel> Bye guys, must go to sleep now.
22:21:42*natrys quit (Ping timeout: 245 seconds)
22:25:42*mal`` quit (Quit: Leaving)
22:30:35*mal`` joined #nim
22:54:34*lritter quit (Quit: Leaving)
23:01:52*rnrwashere quit (Remote host closed the connection)
23:06:35*jjido quit (Ping timeout: 248 seconds)
23:07:39*vlad1777d_ quit (Ping timeout: 248 seconds)
23:15:23*rnrwashere joined #nim
23:19:55*rnrwashere quit (Ping timeout: 248 seconds)
23:46:29nooniengiven `let foo = Foo()`, why can i `foo.fieldPairs` but not `Foo.fieldPairs`?
23:46:46noonienhmm, err, `.fields`
23:50:08FromGitter<jrfondren> what would you want Foo.fields to do?
23:50:47*[rg] joined #nim
23:51:40noonienhmm, return an iterator that provides each field name as a string, or as a descriptor which i can extract a string from
23:58:40FromGitter<JasperJenkins> It expects a object not a typedesc[object]. Just declare a temp of typ Foo and call fieldPairs over that. see: http://ix.io/1I9Q/nim