<< 14-01-2019 >>

00:03:34FromGitter<tweenietomatoes> zachary carter im your biggest fan
00:14:38*Ven`` joined #nim
00:19:12FromGitter<kayabaNerve> @tweenietomatoes Fight me, I definitely weigh more than you /s
00:21:17FromGitter<tweenietomatoes> you mean 125 kg?
00:21:42FromGitter<kayabaNerve> I'm lbs so I win
00:21:58FromGitter<tweenietomatoes> 275 lbs?
00:22:30FromGitter<tweenietomatoes> pls someone teach me how to make extremely good tcp listener
00:22:41FromGitter<kayabaNerve> lbs > kg and you're kg so I win /s
00:22:59FromGitter<tweenietomatoes> 1) 2 lbs is 1 kg
00:23:09FromGitter<kayabaNerve> Nahhhh
00:23:29FromGitter<tweenietomatoes> ok open a repository
00:23:36FromGitter<tweenietomatoes> and write a comparasion script
00:23:38FromGitter<tweenietomatoes> with Nim
00:23:51FromGitter<tweenietomatoes> Nim LukeParker Fighter SuperbApp
00:25:05FromGitter<tweenietomatoes> last quarter of 2018 we started ember cryptocurrency
00:42:08FromGitter<zacharycarter> lol @tweenietomatoes - why is that? I didn't realize I had any fans :P
00:42:22FromGitter<zacharycarter> I appreciate it though! hahaha
00:42:27FromGitter<kayabaNerve> What about Ember? I started that in Q2 IIRC
00:57:26*steve1 joined #nim
00:59:56*vlad1777d joined #nim
01:00:25*wildlander_ joined #nim
01:01:11*wildlander quit (Ping timeout: 258 seconds)
01:01:52*steve1 quit (Ping timeout: 246 seconds)
01:04:39*shpx quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:05:14*Ven`` quit (Ping timeout: 246 seconds)
01:05:27FromGitter<zetashift> @zacharycarter quick question concerning that composition question: if my `Fighter` object also has a property like `hp` or `damage` how would I initiate it? e.g. whenever I make a new monster on the map I pass in it's maxHP, damage and power but I don't know how to pass those things along in my `newEntity` proc as it expects an `entityType` which is an enum
01:06:24FromGitter<zacharycarter> you'd check to see the kind property on it
01:06:30FromGitter<zacharycarter> let me expand the example - one moment
01:06:38*shpx joined #nim
01:07:40FromGitter<zetashift> so `newEntity` gets in an `entityType` based on that it sets the properties of an `Fighter` object I also supply?
01:10:05*shpx quit (Client Quit)
01:10:21FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3be17d39596c372bd92b80]
01:10:48FromGitter<zacharycarter> this isn't very flexible though... you could handle it in a number of ways
01:11:25FromGitter<zacharycarter> generics might be a better way to solve this
01:11:57*ng0 quit (Quit: Alexa, when is the end of world?)
01:12:20FromGitter<zacharycarter> with inheritance
01:13:14FromGitter<zacharycarter> you don't need multiple dispatch - you can probably model this with single dispatch and generics + inheritance
01:18:49*wildlander_ quit (Quit: Konversation terminated!)
01:19:04*rockcavera joined #nim
01:24:46FromGitter<zetashift> the thing is before this I was making a Fighter type outside of a `newEntity` proc and then passing it to the entity
01:24:59FromGitter<zetashift> so hp/mana etc where set outside of it
01:25:23FromGitter<zetashift> I could do it with inheritance with that approach I guess
01:50:35*dcefram joined #nim
01:50:50*dcefram is now known as dcefram_
01:50:51*dcefram_ is now known as dcefram__
01:50:52*dcefram__ is now known as dcefram
01:51:21*dcefram quit (Client Quit)
02:08:06*skellock joined #nim
02:11:52*theelous3 quit (Ping timeout: 246 seconds)
02:21:48FromGitter<zetashift> @zacharycarter whatchu think about this? https://hastebin.com/ulitijunuv.cs
02:23:40FromGitter<zetashift> and then I just make `newMob` and `newItem` procs
02:25:45*dddddd quit (Remote host closed the connection)
02:26:53FromGitter<zacharycarter> yeah - you can do `newMobT (...): T = ...`
02:27:12FromGitter<zacharycarter> looks workable to me
02:30:23FromGitter<zetashift> Huh I was thinking more along the lines that `newMob` get's an entity frame and than a fighter parameter and returns a `Mob`
02:31:27*Tyresc quit (Quit: WeeChat 2.4-dev)
02:34:57FromGitter<zacharycarter> it's one way - but I generally like to try to follow - https://nim-lang.org/docs/tut2.html#generics
02:35:03FromGitter<zacharycarter> when possible anyway
02:37:29FromGitter<zetashift> I'm not sure how I would implement newMob like this based on the [T] it get's it spawns a new mob, e.g. if T = Orc it would spawn an orc with all the correct hp/attack values?
02:46:16FromGitter<zacharycarter> @zetashift -
02:46:20FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3bf7fcc45b986d11585097]
02:46:32FromGitter<zacharycarter> not sure if that pattern will work for you or not...
02:47:38FromGitter<zacharycarter> and if you need more specific new procedures - you can create them
02:48:12FromGitter<zacharycarter> so you could still have - ⏎ `proc newOrc(): Orc = ...` if you wanted
02:55:47FromGitter<zetashift> Thanks alot! this is much better
02:58:06*rockcavera quit (Remote host closed the connection)
03:00:35*banc quit (Quit: Bye)
03:07:03FromGitter<timotheecour> is there an environment variable to override `~/.nimble` ? it causes otherwise major pain when user has multiple concurrent Nim folders
03:07:36FromGitter<timotheecour> @dom96 if you’re seeing this ^
03:08:29leorizeNIMBLE_DIR
03:09:58*vlad1777d quit (Ping timeout: 246 seconds)
03:12:25FromGitter<timotheecour> thanks! shd definitely be mentioned in `https://github.com/nim-lang/nimble` readme and in `nimble —help`; it in neither :(
03:15:54*banc joined #nim
03:24:53shashlick@timotheecour: nimble has a --nimbleDir flag (so does choosenim) so you can have a custom path for
03:25:07shashlicki plan on leveraging that internally to allow local package dir
03:27:18shashlicklooks like there's https://github.com/nim-lang/nimble#compile-with-nim-after-changing-the-nimble-directory as well
03:34:56FromGitter<timotheecour> ya unfortunately ` —nimbleDir` doesn’t help unless u’re directly calling nimble ; eg: u can’t pass it to `./koch tests` so if you’re working on 2 nim repos (and have a compiler pkg in ~/.nimble/pkgs) then tests will use the wrong repo
03:38:38shashlickyou can set it in nim.cfg so nim will know where to look
03:39:46FromGitter<timotheecour> ya except it’s at the root, which bad as including `—path:pathto/Nim` puts everything in scope
03:40:08FromGitter<timotheecour> Instead we shd do this: `mv compiler lib/compiler` in Nim repo
03:41:43FromGitter<timotheecour> that way we can add: `—path:lib` and it would prevent any module clash (eg wouldn’t bring koch.nim in scope just bc u did `—path:pathto/Nim/lib`
03:42:07FromGitter<m4d3bug> ``
03:42:32FromGitter<m4d3bug> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3c052835350772cf298dd4]
03:43:10FromGitter<m4d3bug> Looks like the database connection error?
03:43:16FromGitter<timotheecour> @sha also, note that simply adding `—path:pathto/Nim/lib` is stil lnot ideal
03:43:58*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
03:44:37FromGitter<m4d3bug> But I tried mysql -u [email protected] -p
03:44:50FromGitter<timotheecour> because it still brings existing `~/.nimble/pkgs/compiler#head/foo/bar.nim` in scope in case it’s not in ur 2ndary Nim repo under `Nim_secondary/compiler/foo/bar.nim` ; do u see what i mean @shashlick ?
03:45:00FromGitter<m4d3bug> the connect is ok
03:45:36FromGitter<m4d3bug> Is there any problem with the method I verified?
03:46:04FromGitter<m4d3bug> Is there any problem with the method I verified?
03:50:24*lritter quit (Ping timeout: 250 seconds)
03:51:06*lritter joined #nim
03:52:06leorizetimotheecour: I think you would want `--noNimblePath`?
03:52:20leorizeto pass it to koch tests, just pass it as the last argument
03:53:49FromGitter<timotheecour> so that shd probably be added to `Nim/tests/nim.cfg`
03:55:08FromGitter<timotheecour> other comment i wrote above still holds though; it brings every path in scope including things that aren’t intended to be added in scope; but that’s an issue we can deal w independently
03:56:42FromGitter<timotheecour> we’have:Nim/tests/nim.cfg ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3c087a39596c372bda08da]
04:04:10*nsf joined #nim
04:08:20FromGitter<matrixbot> `curioussav` When I run nimble build does it build with the release flag by default? Readme for nimble didn’t seem to say last I checked.
04:08:47FromGitter<timotheecour> use ` —verbose`
04:14:30*itschin joined #nim
04:28:00Tangerm4d3bug: How are you connecting to the db in your code?
04:48:30FromGitter<matrixbot> `curioussav` With nimble 0.9.0 I get “git hash: couldn’t determine git hash” tried nimble build —verbose it only includes two lines in the output about the stdlib prefix and path.
04:56:10shashlicksorry @timotheecour - not sure i get it, don't have the full context
04:59:20*steve1 joined #nim
05:02:45*shpx joined #nim
05:03:27*steve1 quit (Ping timeout: 240 seconds)
05:24:05*shpx quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
05:24:37*shpx joined #nim
05:40:33*BigEpsilon joined #nim
05:41:13*sheerluck joined #nim
05:43:51*shpx quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
05:45:01*shpx joined #nim
05:53:11*shpx quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
05:56:01*narimiran joined #nim
05:56:02FromGitter<adrianperreault> Question: how can I export a proc that was generated by a macro?
05:56:41FromGitter<timotheecour> The `*` can be generated by the macro itself (infix/post fix i forgot)
05:56:53FromGitter<timotheecour> or, `export foo` shd work too
06:02:08*skellock quit (Ping timeout: 250 seconds)
06:04:09FromGitter<adrianperreault> Beauty! Thanks @timotheecour !
06:04:28FromGitter<timotheecour> Np :)
06:15:08*skellock joined #nim
06:42:00*BigEpsilon quit (Ping timeout: 250 seconds)
07:00:57*krux02 joined #nim
07:08:35krux02good morning people
07:12:11*Vladar joined #nim
07:13:44skellockgood mornin
07:14:55*Vladar quit (Remote host closed the connection)
07:15:17*Vladar joined #nim
07:30:27*skellock quit (Quit: WeeChat 2.3)
07:34:24*BigEpsilon joined #nim
07:47:11Araqhttps://www.twitch.tv/araq4k daily scrum
07:51:08*absolutejam_phon joined #nim
08:09:27*absolutejam_phon quit (Ping timeout: 240 seconds)
08:13:43*absolutejam_phon joined #nim
08:14:52*absolutejam joined #nim
08:15:22ZevvIn a tempate I'd like to add a prefix to an identifier. I can convert the identifier to a string with astToStr(), concat my prefix, but can I change this back into an identifier?
08:18:24*absolutejam_phon quit (Ping timeout: 252 seconds)
08:20:37leorizeno, but there's a simpler way to do that
08:20:58Zevvtell me about it :)
08:21:13leorizesee https://nim-lang.org/docs/manual.html#templates-identifier-construction
08:21:45Zevvbackticks to the rescue. *so* much in the manual that I once read, and just forgot about
08:22:32Zevvreading stuff usually makes much more sense when you actually need it at the moment you read the docs. I read the whole manual twice, but some things just don't stick around
08:22:36Zevvthanks
08:23:29leorizesame here, whenever I need any features I just look it up in the manual first :)
08:23:50ZevvYeah, I checked for 'stringification', 'concatenation', but not for 'identifier construction'
08:24:09Zevveverybody loves noise on the irc channel, right?
08:27:59leorizeyep, it's usually empty at this time :)
08:35:58AraqI know what to do with 'ref' for --gc:none :P
08:38:46*kapil____ joined #nim
08:53:18*lritter quit (Ping timeout: 250 seconds)
08:57:21absolutejamIs there a convention for importing modules in a folder? In python i would have a foo/ folder and then an __init__.py which contained imports to filed and allowed me to import foo
08:57:42absolutejamAlso, what an god awful system
08:57:58leorize`import foo/bar`?
08:58:22leorizeyou just need bar.nim in foo/
08:58:46leorizeAraq: what do you have in mind? :P
08:58:58absolutejamI mean without naming each file
08:59:26absolutejamEg. Import foo/_ and foo/_.nim contains imports to other files
09:00:34absolutejamOr would that affect the namespacing?
09:00:44leorizeyes, it would
09:00:52leorizemake a foo.nim
09:01:08leorizeimport foo, bar, foobar
09:01:13leorizeexport foo, bar, foobar
09:01:27leorizewith that two lines it should work
09:01:32absolutejamThere's an export?
09:01:32*steve1 joined #nim
09:01:49absolutejamI did search for it but couldnt find reference of it
09:02:08leorizehttps://nim-lang.org/docs/manual.html#modules-export-statement
09:04:24absolutejamThanks
09:05:44Araqleorize, I won't spoil it, should write an article instead
09:05:47*steve1 quit (Ping timeout: 246 seconds)
09:06:23leorize;)
09:06:41leorizeyour quirky exceptions article doesn't seem to be shared anywhere however :P
09:08:26Araqthat's ok, it only was a holiday project
09:08:57narimiranleorize, Araq: i was planning on doing that today :)
09:09:34narimiranwell, Araq should do it on our forum (as he's the author), and i plan on doing it on reddit and HN
09:12:50Araqhmm I thought about changing its conclusions :P
09:14:10Araqoh well, these were my conclusions when I worked on it
09:14:47*floppydh joined #nim
09:16:03narimirani can wait :)
09:29:29*stefanos82 joined #nim
09:31:01*enow joined #nim
09:31:35enowHi, guys!
09:32:29enowI want to create artificial keystrokes and send into the OS, from JSON based commands sent from a websocket connection
09:33:26enowI'm thinking low level so I want to do the systems stuff with C, but to do the json handling in C is just to error prone
09:33:36enowthat'd make nim the language for me right?
09:36:47Araqenow, right except that you can be as low level as C with minimal effort (maybe c2nim the required declarations)
09:42:12enowAraq: I have a winapi program in C that I can use, how do I go about to interface it to nim.
09:42:19enowAraq: do I convert the code to nim
09:42:29absolutejamIs there a fast and dirty way to turn an iterator into a seq/list?
09:42:40FromGitter<timotheecour> toSeq
09:42:48absolutejamIterators are only usable in for loops right?
09:42:52absolutejamOh
09:43:13FromGitter<timotheecour> 1st class iters, ya, only in for loops
09:43:25FromGitter<timotheecour> 2nd class iters can be forwarded
09:43:43enowAraq: do you know if there are any readily available Winapi / xlib bindings for nim
09:43:46FromGitter<timotheecour> (Well u can also use `finished(myiter)`)
09:44:34narimiranenow: https://github.com/nim-lang/oldwinapi ?
09:45:14Araq'nimble search windows' brings up winim among others
09:45:16enownarimiran: nice do you have any experience with it
09:45:42Araqnimble search x11
09:45:53Araqturns up our official x11.
09:45:55Araqwrapper.
09:46:28Araqsadly, "official" doesn't mean well supported, but at least it's not dead ;-)
09:46:29enowAraq: would you know if it has support for the XTest extension of the bat?
09:47:01Araqno idea what XTest is
09:47:12Araqif it's old, we probably have wrapped it
09:47:27narimiranenow: no experience with it. btw, you can use https://nimble.directory/ for searching for packages
09:47:31enowAraq: it's used to create fake keypresses mouse presses
09:48:18leorizeare you trying to create a copy of xdotool?
09:48:40enowleorize: hehe I'm trying to figure out a way to code from my couch with a playstation controller
09:49:43*itschin quit (Read error: Connection reset by peer)
09:50:05enowor sort of investigating input methods in general
09:50:10leorizefound this for X11: https://nimble.directory/pkg/xdo
09:50:59enowleorize: might do the trick, t.y
09:51:24leorizeand this for windows :) https://nimble.directory/pkg/autome
09:51:51enowleorize: ah so maybe I don't need the basic winapi
09:52:22enowokay so I have two options
09:52:39enowbear in mind that as this is a keyboard I can't be very wasteful with resources right
09:53:16enowA) I rip out the C interface code that I already have and create a nim interface somehow
09:53:41enowB) I test the other libraries
09:53:59AraqA) is what you will end up with
09:54:04leorizexdo requires an external program :P
09:54:20enowleorize: ah a no go
09:54:21Araquse .compile: "myfoo.c" and c2nim on the header file
09:54:41enowAraq: ah that simple and it figures it out from the header file
09:54:56leorizeautome seems to be winapi-based
09:55:07Araqand only c2nim what you really need, nobody needs typedef unsigned int maAwesomeOwnIntBecauseIts1970;
09:55:46enowbare minimum right
09:55:57enowoh such good advice guys!
09:56:23enowOn the other side of my project I started out prototyping with HTML5 + js + canvas stuff
09:57:02enowThis I would like to port to nim so that I can compile it either for A) html5 canvas for demos B) C + low level API for local usage
09:58:02enowI know from experience that picking the wrong graphics library early in the project and then having to switch mess around with it takes forever
09:58:19enowagain I have quite high requirements on window management here.
09:58:41enowFor example being able to have the keyboard on top, transparent and to be able to move it is crucial
09:59:13enowmiss one detail and the user experience is totally wrecked
09:59:22Araqyou're in a world of fun
09:59:31enowAraq: tell me about it :D
09:59:39enowAraq: been possesed by this for years now
10:02:24enowhttps://www.youtube.com/watch?v=QlrzNmeh650
10:02:43enowTo give you an idea of what it looks like graphically and what kind of things I might need
10:10:17AraqI'd probably only develop the windows version and use Wine on Linux :P
10:13:18enowAraq: hm really I'm sorta doing the opposite
10:13:41enowAraq: namely running in linux and developing the windows version via wine
10:14:11enowfigured that if it works in wine I'm not doing anything to exotic when it comes to support
10:14:51enowseriously though need a new SSD but broke as fuck, well well that's what you get from doing OS software full time
10:15:47enowoh syntax higligting for vim what's the best approach
10:17:33Zevv//github.com/baabelfish/nvim-nim
10:19:04Zevv"best": ymmv
10:19:24Zevvautoindenting is a bit flakey when you do stuff with colons
10:19:33Zevvthings tend to go all over the place
10:20:15leorizeyou can write your own indent script :)
10:20:56ZevvThere's always this tradeoff between accepting the annoyance of something, or having to spend the time to fix it yourself :)
10:21:31leorizeI actually wrote one :P
10:22:08leorizean entire neovim plugin, that is
10:22:21leorizenow I just have to figure out the "project file" logic for it :P
10:26:11enowZevv: thank you!
10:26:17enowleorize: care to share?
10:26:55leorizeit's unfinished, the other plugins currently have better syntax highlighting
10:27:07leorizeI've to figure out how to properly hook up nimsuggest
10:27:19enowleorize: fair enough
10:27:55enowhm I've decided on taking my own websocket implementation and interfacing it with nim instead of the ready made libraries
10:27:58enowsee what happens
10:28:08enowit's only the subset that I need
10:28:56enowbut perhaps someone else might have an interest in a minimal websocket C implementation at some point
10:35:58absolutejamIm getting a random 'invalid indentation' error on a line with no issue
10:36:11absolutejamCan i dig depeer as to why tbis is happening?
10:36:22absolutejamMore verbose output
10:44:35FromGitter<alehander42> make sure you use an editor where you can see whitespace/set it up to use only spaces
10:44:51FromGitter<alehander42> e.g. in sublime, if you select the line, you can see spaces/tabs
10:45:13FromGitter<timotheecour> could be previous line is missing a `=`
10:45:28FromGitter<alehander42> or `:`
10:45:49absolutejamSedm
10:45:50FromGitter<alehander42> hm, no, the error for `:` is better
10:45:51FromGitter<timotheecour> see https://github.com/nim-lang/Nim/issues/10229 ; and yes we shd fix that issue; it shouldn’t be hard
10:46:01livcdis there anything wrong with flycheck-nimsuggest ?
10:46:16livcdMy emacs chokes on opening a nim file
10:46:29absolutejamSeems to have been resolved but no idea how. Like you said, maybe a syntax error earlier
10:56:06*PMunch joined #nim
11:19:49*ng0 joined #nim
11:19:59*rockcavera joined #nim
11:31:55*dddddd_ joined #nim
11:32:34*dddddd_ is now known as dddddd
11:50:43*theelous3 joined #nim
11:51:02*theelous3 quit (Remote host closed the connection)
12:00:27*ghost64 quit (Quit: See you!)
12:05:44*ghost64 joined #nim
12:07:47*kapil____ quit (Quit: Connection closed for inactivity)
12:18:42enowhm I don't get this c2nim stuff. I manage to generate a nim file from the header but how do i link against the C file?
12:19:00enowdo I just pass it along like nim c -r main.nim test.nim test.c or what
12:19:16leorizeadd {.compile: "file.c".} to your nim file
12:19:29leorizeto the test.nim file, that is
12:21:58enowleorize: ah!!
12:22:54enowleorize: is it possible to make this happen automatically?
12:25:37leorizeno, sadly
12:25:50leorizebut {.compile.} can take wildcards :)
12:26:14*Cthalupa quit (Ping timeout: 268 seconds)
12:26:55*Cthalupa joined #nim
12:28:17enowleorize: hm I probably can script something together
12:28:36enowthat's bindings for you I suspect
12:28:48enowdo I pass along the test.nim to nim or does import take care of it
12:35:53*Ven`` joined #nim
12:40:31*Snircle joined #nim
12:43:38shashlickCheck out nimgen
12:44:15shashlickImport will take care of it - just compile your top level Nim file
12:46:19enowshashlick: thx
12:47:26enowI'm feeling a bit stupid as of now why can't I make it work
12:47:29enowI do
12:47:31enowc2nim test.h
12:47:48enowadd {.compile "test.c".} at the start of test.nim
12:48:45enowand when I run nim c -r nimlisten.c I still gety
12:48:47enowtest.nim(4, 6) Error: implementation of 'test.close()[declared in test.nim(4, 5)]' expected
12:55:15*aguspiza joined #nim
12:58:18FromGitter<alehander42> Araq
12:58:26FromGitter<alehander42> why does `cast` produce a nimCopy ?
12:58:28FromGitter<alehander42> in js backend
12:58:54FromGitter<Clyybber> enow How does test.close in test.nim look?
12:59:21FromGitter<Clyybber> I have a feeling its missing a `{.cdecl.}`
12:59:52enowshashlick: ok nimgen was a good tip but I run into troubles wirth that one as well
13:00:14enowshashlick: first of all it refers to a path for the header file (.h) without a . and / so that gcc crashes
13:02:07*ng0 quit (Remote host closed the connection)
13:03:08*ng0 joined #nim
13:03:36*steve1 joined #nim
13:03:37enowIs it stupid for me to interface a single C file at a time, would it make more sense to generate .so / .dll files and work against those instead?
13:04:42FromGitter<Clyybber> enow I think your proc declarations are missing cdecl or importc
13:05:40enowFromGitter: oh didn't see you hm wait a second
13:05:41FromGitterenow, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim
13:06:30enowwhich one do you want from c2nim or nimgen
13:06:52FromGitter<Clyybber> c2nim
13:06:54enowpersonally I feel nimgen would be overkill at this point, since we're only taking a subset of the API implemented
13:06:57enowsec
13:07:00FromGitter<Clyybber> Nimgen uses c2nim internally AKAIK
13:07:25*aguspiza quit (Ping timeout: 246 seconds)
13:08:15*steve1 quit (Ping timeout: 252 seconds)
13:09:05enow{.compile: "test.c".}
13:09:05enowproc init*(a1: cint)
13:09:05enowproc close*()
13:10:04enowinit() and close is basically hello world functions
13:10:12enowusing printf might that be the issue?
13:10:27FromGitter<Clyybber> Hmm, is that thw whole test.nim file?
13:10:46enowjup
13:10:54FromGitter<Clyybber> There are no {.cdecl.} or importc statements there
13:11:04enowit's what c2nim gave me
13:11:13FromGitter<Clyybber> Huh, thats weird
13:11:17enowthe header file is just two functions
13:11:20FromGitter<Clyybber> How does test.c look?
13:11:24FromGitter<Clyybber> Ah ok
13:11:40enowI just started out with this
13:12:09FromGitter<Clyybber> Try changing `proc close*()` to `proc close*() {.cdecl.}` and see if it works
13:12:28enowhm maybe I should have the header
13:13:29enownope
13:13:37FromGitter<Clyybber> Sry forgot something `proc close*() {.cdecl, importc.}`
13:13:43FromGitter<Clyybber> this is how it should work
13:14:26enowfound it !
13:14:32*seni joined #nim
13:14:34enowproc close*() {.stdcall, importc: "close" }
13:14:37enowdid the trick
13:14:58FromGitter<Clyybber> Ah yes cdecl is only needed if you want to use it as a callback somehow
13:15:21FromGitter<Clyybber> @enow Does it not work without stdcall?
13:16:27enowyeah I need stdcall
13:16:31enowand header
13:16:36enowwhich leads me to the next problem
13:18:31enowhow to tell it where the test.h file is
13:18:32leorizeenow: you can try {.noconv.} if the header doesn't specify a specific convention
13:21:03enowhow do I send -I options to gcc?
13:21:55enowhm I
13:23:37*shpx joined #nim
13:23:53FromGitter<Clyybber> --passL
13:24:42shashlickYes for one file nimgen is excessive but good to know for wrapper folk
13:24:56shashlickIn fact nimterop merges nimgen and c2nim
13:25:12enowyeah I'd use it for sure had I needed to bind something bigger
13:25:15leorizeenow: "--passC:"
13:25:22enowhm I feel that I'm quite closer
13:25:31leorizethere's also the {.passC.} pragma
13:26:00enowI think the issue is that when the test.nim file is compiled it doesn't now where the C .h header file is
13:28:13enowjust to be sure the test.c code isn't translated into nim code by doing this
13:31:22*Cthalupa quit (Ping timeout: 258 seconds)
13:31:45*Cthalupa joined #nim
13:38:39*Vladar quit (Remote host closed the connection)
13:41:32shashlickNo it is compiled in by gcc
13:42:00shashlickYou need to provide a relative path
13:44:18leorizeenow: put {.passC: "-Isomething".} to your nim file
13:44:37leorizesomething here is obviously the include path :p
13:45:10enowleorize: yes but I tried adding that one with header
13:45:31Araqdon't use -I and don't use .header, use .compile
13:46:00Araqproc foo() {.cdecl, importc: "foo".} is the best way to do it
13:46:27enowAraq: aha I'll try that out!
13:46:29Araq.header crap will never work with the LLVM backend
13:49:26enow{.compile: "test.c".}
13:49:26enowproc init*(port: cint) {.cdecl, importc: "init".}
13:49:36enowso this is where I am at
13:52:17enowha
13:52:19enowI made it!!
13:53:16enowI did a manual gcc -c on test.c to provide for a test.o file, then I changed the .compile directive in test.nim to {.link: "/absolute/path/test.o"}
13:55:53enowAnd I have a bugreport I think !?!
13:55:53leorizeyou should use .compile actually :P
13:55:58enowleorize: now I do
13:56:04leorizebugreport?
13:56:14enowbut it only works after I change the name of the test.nim to testi.nim
13:56:42enowif the test.nim file has the same name as the test.c file the gcc command argument contains two test.c.o
13:56:52leorizethat deserves a bug report then
13:57:11enowleorize: where and how?
13:57:22leorizegithub.com/nim-lang/Nim/issues
13:57:45*vlad1777d joined #nim
13:57:54leorizeplease provide a reproducible sample as well
13:58:33enowleorize: yeah I'll put it on github with one working commit and one broken
13:58:35enowseems ok?
13:58:54enowwhat is the {.compile } thingy refereed to as in nim lingo?
13:59:06leorize"compile" pragma
13:59:21*Cthalupa quit (Ping timeout: 258 seconds)
14:00:25shashlickYou can generate a unique o file with compile
14:00:49enowshashlick: how?
14:01:12shashlickhttps://github.com/genotrance/nimgen/blob/master/src/nimgen/gencore.nim
14:01:17shashlickSee the compile proc
14:01:42*Ven`` quit (Ping timeout: 252 seconds)
14:02:05*Cthalupa joined #nim
14:03:09shashlickAn issue will be nice though - if Nim knows the o file will overwrite then it should adjust automatically
14:03:43shashlickAraq can decide if it is warranted or if this compile syntax is sufficient
14:04:00shashlickAt least a warning is worthwhile
14:04:05enowshashlick: it's one it's way
14:05:51Araqseems to me you should have a .nimble file
14:06:06Araqbut sure, we can fix it, cannot be hard...
14:06:45enowAraq: yes! I think I saw someone else with the same problem
14:06:54enowenow: ah yeah a nimble file is on it's way
14:10:09enowAraq: https://github.com/richard-jansson/nimlisten/commit/cc12c5c48dc79f50bcf444b2370efe8c89501e12
14:10:14enowAraq: the broken code
14:10:44Araqstop poking me
14:12:12shashlickAlternative is to not use the same name
14:12:32shashlickBut that's harder when working on wrapping C libraries written by others
14:12:32enowhttps://github.com/nim-lang/Nim/issues/10299
14:13:30shashlickIt also breaks when you have the same file name but in different directories since nimcache is a flat directory
14:16:21enowwoops sorry for interrupting you I'm sure you're busy!
14:16:27enows
14:17:58enowmight be https://github.com/nim-lang/Nim/issues/3072 a duplicate
14:18:00enownot sure
14:18:19enowthought it be helpful to have it for the record
14:18:53*Ven`` joined #nim
14:19:41FromGitter<alehander42> enow: thanks: I agree this is not perfect, but I think the workaround to use different filenames might be ok at least to unblock you on this
14:21:16*Vladar joined #nim
14:21:49enowah sure for me it's not a problem
14:21:54shashlickLooks like the same issue to me
14:22:40enowyou could argue that it's a conceptual issue, as the nim file is compiled to a c file as well it sorta makes sense when you think of it
14:23:22enowinstead of thinking of the test.nim as a meta header file, if my wording makes any sense to you. It should be thought of as an equivalent to the C file
14:23:52enowso it's nitpicking really
14:27:07absolutejamCan i use typeinfo to access object/enum fields programatically, eg with a string value?
14:29:18shashlickhttps://nim-lang.org/docs/strutils.html#parseEnum%2Cstring
14:31:07shashlickhttps://forum.nim-lang.org/t/2017 helps with objects
14:33:08FromGitter<alehander42> absolutejam, doesnt `[]` with Any arg work
14:35:05*shpx quit (Quit: Textual IRC Client: www.textualapp.com)
14:35:55FromGitter<alehander42> e.g. if A has int field; var a = A(); echo a.toAny["a"].getInt
14:39:20absolutejamOooh
14:46:33*nsf quit (Quit: WeeChat 2.3)
14:47:09absolutejamIll play with that ty alehandler
14:47:17absolutejamAnd ty shashlik
14:55:30*steve1 joined #nim
14:55:32FromGitter<zacharycarter> every time I look at gitter these days, I'm seeing a new name
14:55:43FromGitter<zacharycarter> good stuff
14:55:50shashlickalehander42: do we already have a lib that implements the python dict style data structure?
14:55:59shashlicklooks like that can be offered with Any
14:56:13shashlickor seq even
14:56:50shashlickwas thinking that will be useful to transition folks who don't care about performance as much but want to do Python style stuff
14:57:43leorizeit's called json :p
14:58:21*steve1 is now known as skellock
15:03:27FromGitter<alehander42> shashlick: yeah, it's better to let them use jsonnodes or similar variant-based "dynamic" value
15:03:28shashlicksounds fair
15:03:33FromGitter<alehander42> Any is very unsafe
15:03:39FromGitter<alehander42> it shouldn't be used in normal code
15:04:16FromGitter<alehander42> and it's good for them to embrace variant objects/more static guarantees sooner or later after all
15:04:20FromGitter<alehander42> imo
15:04:21shashlickjust not the first thing that would come to a Python guy's mind but makes sense
15:04:42FromGitter<alehander42> well, after all each language has its own patterns
15:04:56shashlicki agree - it's lazy and quick though so I appreciate it for quick and dirty work
15:05:20FromGitter<alehander42> maybe it would be a good idea to add more examples / gotchas / patterns to a Nim for Python programmers tutorial
15:05:27shashlicki agree
15:07:52livcdanyone else has an issue with flycheck-nimsuggest ?
15:09:06shashlicklivcd: most folks using emacs disable nimsuggest since it doesn't work
15:09:08FromGitter<alehander42> hm, I can directly change the wiki
15:09:17FromGitter<alehander42> it would be good to have some kind of review
15:10:24shashlicksure - i can check once you are done
15:12:36FromGitter<alehander42> @narimiran, do you have any plans for the nim for <lang> programmers tutorials? i'd add some stuff to the python one(i can also do a ruby one), do we want them to remain in the wiki, or to be linked in the tutorial?
15:12:47FromGitter<alehander42> hm, they're linked in `learn`
15:13:48narimiran@alehander42 at first i would like (if somebody else can ;)) update and enrich the existing ...C and ...python versions
15:14:13FromGitter<alehander42> yes, that's what I meant about the python version
15:14:24narimiranafter that, if there's an interested to make similar stuff for other languages — be my guest, i would gladly share that on the `learn` page
15:15:04narimiranor more broadly: wiki needs some love
15:15:37narimiranevery contribution which makes wiki better, more useful, updated, etc. is very welcome
15:15:40FromGitter<alehander42> well, a ruby one would be relatively similar to the python one, but still very useful
15:16:23FromGitter<alehander42> i think even a `go` one would make sense, as nim is an ok fit for some stuff that people use it for
15:16:32narimirango for it :)
15:16:35narimiran(pun intended)
15:16:43FromGitter<alehander42> haha
15:17:08narimiran2019 is the year of nim documentation
15:17:15FromGitter<alehander42> i hope to see more nim-related talks/stuff in python/ruby confs in the next years
15:17:26FromGitter<alehander42> elixir , rust , crystal have those
15:17:39FromGitter<alehander42> and it's an easy way to get some mindshare
15:18:09narimirani had nice success with https://narimiran.github.io/2018/05/10/python-numpy-nim.html on r/python
15:18:44narimiranand stuff like this (in various fields) should be easy to do, and we should encourage it
15:19:19narimiranif you look at HN, every few day there is a new (and popular) post "how i rewrote X in Rust"
15:20:02narimiranor "show HN: XYZ, new library for Foo, written completely in Rust"
15:21:02FromGitter<alehander42> yes, libs/rewrites result in maybe the biggest source of interest
15:21:35FromGitter<alehander42> language changes/news dont happen so often, and `project in X` is more relevant to most readers
15:25:47narimiranbut back to the original question:
15:26:08narimiran* should there be "nim for rust/go/ruby/etc. programmers"? yes
15:26:25narimiran* should our wiki be generally updated and populated? yes
15:30:44FromGitter<alehander42> i dont like wiki-s too much, people don't generally update it when something changes
15:31:11FromGitter<alehander42> but its useful to have one i guess
15:35:22*Ven`` quit (Ping timeout: 272 seconds)
15:39:17*absolutejam quit (Remote host closed the connection)
15:41:40*absolutejam joined #nim
15:47:45*stefanos82 quit (Ping timeout: 252 seconds)
15:56:09*absolutejam_phon joined #nim
15:56:09*absolutejam quit (Read error: Connection reset by peer)
16:00:08*absolutejam_phon quit (Read error: Connection reset by peer)
16:00:25*absolutejam_phon joined #nim
16:01:57FromGitter<mratsim> ArchWiki is well maintained
16:01:57*absolutejam_phon quit (Read error: Connection reset by peer)
16:02:13FromGitter<mratsim> but you need to kickstart it
16:11:48*Vladar quit (Remote host closed the connection)
16:12:48*absolutejam_phon joined #nim
16:29:13*BigEpsilon quit (Ping timeout: 245 seconds)
16:32:16enowhm perhaps not the best way of starting to know nim, but I want to make callback functions to nim functions from C code, is this doable in any sane way?
16:37:15*absolutejam_phon quit (Ping timeout: 252 seconds)
16:38:24leorizethe typical way is to have a {.cdecl.} proc in Nim that calls your nim proc with the necessary parameters
16:38:26FromGitter<alehander42> nim functions do compile to c functions after all
16:42:20FromDiscord_<dias.nurbergen> Best Casino Online > http://gambldiscord.bestoffersx.com
16:43:44enowleorize: aha so I inline C code into nim?
16:44:29leorizeno, you write nim code, just that it'd be compatible w C calling convention
16:45:12leorizeproc callback(data: ptr Data) {.cdecl.} = myProc(data.arg1, data.arg2)
16:45:21leorize^ something like that
16:46:05enowleorize: pweh sounds much more reasonable
16:52:51*nsf joined #nim
16:54:52*BigEpsilon joined #nim
16:57:35narimirannim trivia: we have just passed 14,500 commits
17:02:21*Trustable joined #nim
17:02:38skellock\o/
17:08:48*absolutejam_phon joined #nim
17:09:08*aguspiza joined #nim
17:10:42enowleorize: so what happens if the callback is called from a thread
17:12:58enowgarbage collectors is not my strongest suite to be honest but I have a feeling that something might get messed up
17:14:26Araqthe callback NEEDS to be annotated with .gcsafe
17:14:46Araqand then it's pretty much ok, I think.
17:14:48leorizehow about calling setupForeignGcThread() at the start of the callback then tearDownForeignThreadGc() at the end :P
17:15:06*zyklon quit (Ping timeout: 250 seconds)
17:15:40enowaha I expected to need to use setupForeign and tearDownForeign but perhaps .gcsafe is enough
17:16:35enowbut perhaps I should just play it safe and do setupForeinGcThread
17:17:38enowhm I got a hint from nim somehow <proc (){.cdecl, gcsafe, locks: 0.}> that this would be the expected format
17:17:51enowso this is basically how I define the callback function I suppose
17:18:01enowwhat about locks is it useful for anything?
17:23:24shashlickdom96: why does choosenim still load 0.19.0 for stable
17:32:16*floppydh quit (Quit: WeeChat 2.3)
17:35:03FromGitter<Clyybber> @nc-x Hi, are you here rn?
17:36:50leorizeenow: I think it's about how many locks does your proc holds
17:36:57leorizeyou shouldn't have to care about it
17:37:14leorizejust {.cdecl, gcsafe.} should be fine
17:44:08*absolutejam_phon quit (Ping timeout: 246 seconds)
17:44:44*Trustable quit (Remote host closed the connection)
17:47:19*absolutejam_phon joined #nim
17:47:51enowneat I hate threads
17:48:02enowwhich is why I am a bit interested in channels
17:48:09enowshould I go for that or a more traditional approach
18:00:48shashlickis unxz available by default on osx?
18:08:52*absolutejam_phon quit (Read error: Connection reset by peer)
18:09:42*BigEpsilon quit (Ping timeout: 250 seconds)
18:15:25*salewski joined #nim
18:17:37salewskiClyybber, Araq, so does this mean that we should put variables as global inside the macros now? like
18:17:41salewskimacro idleAdd*(): untyped =
18:17:53salewski var IdleID {.global.} : int
18:18:55Araqno
18:19:01Araqyou should have used
18:19:14Araqvar idleId {.compileTime.}: int
18:19:18Araqto begin with, afaict
18:21:28salewskiOK, then I will try that. But my current impression is that global pragma still works,
18:21:51salewskiand 14 days ago it was working fine without compile time pragma as well.
18:22:05*BigEpsilon joined #nim
18:23:18FromGitter<Clyybber> @Araq Is it supposed to work without var being a compile time var?
18:23:59FromGitter<Clyybber> Is inc(IdleID) evaluated at runtime then, or is IdleID implicitly made a compile time value?
18:24:24salewskiAraq you seems to be rigth, global var with compileTime pragma seems to work and That makes sense :-)
18:25:20Araqit never was supposed to work afaict, macros access .compileTime vars and consts, nothing else
18:25:37salewskiOK thanks, bye.
18:25:49Araqand only some patterns work with incremental compilation, check out my RFC :P
18:25:59Araq(yours is fine)
18:26:34*salewski quit (Quit: WeeChat 2.3)
18:37:07*BigEpsilon quit (Ping timeout: 246 seconds)
18:59:04FromGitter<iffy> Can I make a proc accept nil as an argument? I'm taking a user-supplied value (from JSON) which could be a string, int, float or null and I want to call `myProc` on it. I have `myProc(x:string)`, `myProc(x:int)` etc... but how do I make a `myProc(x:nil)`?
18:59:32FromGitter<iffy> JSON input is just an example -- it might not always be JSON
19:00:20FromGitter<Clyybber> does `myProc(x: int | nil)` work?
19:01:27FromGitter<iffy> @Clyybber no `Error: type expected`
19:01:44FromGitter<iffy> I'm on 0.19.1 if that matters
19:01:57FromGitter<Clyybber> and `myProc(x: int | type(nil))` ?
19:02:15FromGitter<Clyybber> @iffy Don't think it matters
19:03:41FromGitter<iffy> that didn't work (probably the body of my proc in that case) but `myProc(x: type(nil))` seems to work
19:03:42FromGitter<iffy> Thank you!
19:04:19FromGitter<iffy> yes `type(nil)` works!
19:04:25FromGitter<Clyybber> huh, I wonder if you will still be able to pass an int to it then...
19:05:01FromGitter<Clyybber> maybe you should rather use `Any`, but don't quote me on that since thats kind of unsafe
19:07:49*sheerluck quit (Quit: Leaving)
19:08:37AraqJSOn has JNull
19:08:57FromGitter<iffy> K, this works great: https://gist.github.com/iffy/762c6ab90e73702c48192286316f2483
19:11:03Araqhmm yeah, we allowed type(nil) for this reason
19:11:16Araqnote that this is new with 0.19, I think
19:12:23FromGitter<iffy> Maybe I should explain what I'm actually doing. The stdlib sqlite library doesn't let you bind named parameters, so I've written my own stuff to allow for named parameters using SQLite's binding functions. But the binding function to call depends on the parameter type. I made a Param type which I use to decide how to bind. Having done all that I can then do:
19:12:57FromGitter<iffy> `db.fetchAll(sql"SELECT $first, $second, $third", @[P("first"), P(23), P(nil)])`
19:13:29FromGitter<iffy> Before this `type(nil)` help, I had a special `Pnull` const.
19:14:19FromGitter<iffy> I imagine I can probably even use an openArray to shorten that to `..., "first", 23, nil)` eh?
19:15:20*kungtotte joined #nim
19:16:00FromGitter<iffy> err... varargs, not openArray
19:25:19*dom96_w joined #nim
19:25:36FromGitter<zetashift> @zacharycarter any idea how to make the newEntity nicer: https://hastebin.com/ufedopewux.cs
19:30:56*absolutejam_phon joined #nim
19:33:14FromGitter<zacharycarter> looks good so far to me @zetashift
19:33:20Araqiffy, bah please improve Ormin instead (selfish, I know)
19:33:32FromGitter<iffy> What's Ormin?
19:34:01FromGitter<iffy> Oh, I see
19:34:54FromGitter<iffy> Araq: You'd prefer patches to Ormin than the stdlib sqlite?
19:35:22Araqwell ideally both, but stdlib is more important
19:35:33Araqdidn't understand that you intend to patch the stdlib
19:35:36FromGitter<zetashift> Well I'm actually getting an error: `entity.nim(39, 20) Error: attempting to call undeclared routine: 'fighter=' `
19:35:52FromGitter<iffy> Araq: I'm building up confidence to attempt it once I'm sure the interface I've made works
19:38:32FromGitter<iffy> Wow, Ormin looks neat
19:40:23*absolutejam_phon quit (Read error: Connection reset by peer)
19:40:43*absolutejam_phon joined #nim
19:40:59AraqOrmin is in search for a maintainer
19:41:56FromGitter<iffy> I'm not sure I've got that much in me :)
19:41:59shashlicki'm looking for sizeof(time_t) at runtime for nimterop - need to translate correctly
19:42:09shashlickthere's CTime in times package but it is not exposedf
19:42:30FromGitter<zacharycarter> @zetashift - I think you'll need to coerce it into a `Player` object
19:42:55*aguspiza quit (Ping timeout: 246 seconds)
19:42:56FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c3ce640cb47ec300042d2d2]
19:43:32shashlickfurther, on my linux box, sizeof(time_t) comes to 8 bytes but its defined as clong in https://github.com/nim-lang/Nim/blob/master/lib/posix/posix_linux_amd64.nim#L41
19:50:45*NimBot joined #nim
19:56:24FromGitter<zetashift> @zacharycarter that fixed that error but now I'm getting: ` entity.nim(38, 11) Error: type mismatch: got <Orc> but expected 'Player = ref Player:ObjectType' `yikes
19:59:46rayman22201@shashlick why wouldn't it be 8 bytes? it's on a 64bit machine.
20:00:28shashlickya i'm saying it is wrong in the nim file - defined to clong = 4
20:00:45*nsf quit (Quit: WeeChat 2.3)
20:01:16Araqclong is 8 bytes
20:03:22shashlickok then i'm getting mixed up in nim vs c
20:03:42shashlickso can we expose CTime in times.nim
20:04:49*aguspiza joined #nim
20:07:57*gmpreussner quit (Quit: kthxbye)
20:08:09Araqwe can but why?
20:08:28shashlickwell I need it when wrapping
20:08:39shashlickif a C lib has time_t, i can just rename it to CTime
20:13:19Araqmeh ok, better than rolling your own I guess
20:13:26Araqtime_t is a mess
20:14:11shashlickok thanks
20:14:26shashlickhave just pushed a csize fix
20:16:42*gmpreussner joined #nim
20:19:16enowMy god it works! My first nim program
20:37:32Zevvcongrats :)
20:37:40FromGitter<timotheecour> urgent: https://github.com/nim-lang/Nim/issues/10302 the build broke for all PR's
20:38:41*ng0 quit (Quit: Alexa, when is the end of world?)
20:39:23*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:40:26krux02timotheecour: tried to verify that
20:40:38krux02can't reproduce it localld
20:49:08krux02timotheecour: what I do see is that current test suit is spammed with lots of messages like: (msg: "execCmdEx2 failed", command: "tests/stdlib/tunittestexceptiontype", options: {poStdErrToStdOut})
20:49:20krux02and the line of code creating this spam is from your code.
20:49:22FromDiscord_<moerm> Hello
20:50:00FromDiscord_<j$> sup
20:50:01*sillibird joined #nim
20:50:42FromDiscord_<j$> yo so is anyone able to help with with this macro
20:50:54FromDiscord_<j$> https://pastebin.com/raw/6D2tHRkg
20:51:11sillibirdHow should I deal with a type that can be different things? Like the equivelant of a Golang interface?
20:51:58FromGitter<Varriount> j$: I don't quite see what the problem is. Could you explain it a bit more/
20:52:47FromGitter<Varriount> sillibird: Either use a ref+inheritance+multimethods, a structure containing procedural types (see the streams module) or object variants.
20:52:55FromDiscord_<j$> so if I pass in an enum Id like to access its ordinal value
20:54:11krux02sillibird: if ord(c) <= ord(yellow)
20:55:12krux02@timotheecour are you there?
20:56:33*Tyresc joined #nim
20:56:40*narimiran quit (Quit: Leaving)
20:56:55FromDiscord_<j$> the parameter of macros are of NimNode type so I cant just use them as ords as I'd like
20:58:15FromGitter<timotheecour> @krux02 just got back but have to go somewhere very soon; ya the spam is from me, but shd be unrelated to the CI failure; I’ll look into improving that spam (or disabling it) later, but the urgent stuff is the CI failure
20:58:52FromDiscord_<j$> @sillibird https://nim-lang.org/docs/tut2.html#generics
20:58:59FromDiscord_<j$> is this what you mean?
20:59:48sillibirdSo basically, Im writing a wrapper for a API, and I have a type that gets unmarshalled from an endpoint. One of the values will either end up being nil, or another type
20:59:50FromGitter<timotheecour> if all PR’s were merged after green, the only thing i can think of is if 2 PRs were merged consecutively wo CI running in between; this has happened recently
21:01:19FromDiscord_<j$> @sillibird sounds like generics to me
21:03:32FromDiscord_<j$> @krux02 so any idea?
21:04:17sillibirdHow does the generic param work, in the example its [T]
21:04:32*enigmeta_ joined #nim
21:05:03*noonien_ joined #nim
21:10:37FromDiscord_<j$> T is the type and any occurrence of T is that type, it can be any letter
21:10:41FromDiscord_<j$> not sure on the case
21:11:07FromDiscord_<j$> you can have multiple separated by a comma
21:11:16FromDiscord_<j$> [A, B]
21:11:38*noonien quit (Ping timeout: 268 seconds)
21:11:39*Shoozza quit (Ping timeout: 268 seconds)
21:11:41*toofly[m] quit (Ping timeout: 268 seconds)
21:11:41*zielmicha[m] quit (Ping timeout: 268 seconds)
21:11:41*spymasterd[m] quit (Ping timeout: 268 seconds)
21:11:43*enigmeta quit (Ping timeout: 268 seconds)
21:11:43*vqrs quit (Ping timeout: 268 seconds)
21:11:44*TheKing[m] quit (Ping timeout: 268 seconds)
21:11:45*noonien_ is now known as noonien
21:11:45*enigmeta_ is now known as enigmeta
21:11:45*Shoozza_ joined #nim
21:11:46FromDiscord_<j$> that's p much all I know
21:11:56*vqrs_ joined #nim
21:12:41*spymasterd[m] joined #nim
21:12:44*zielmicha[m] joined #nim
21:12:49*toofly[m] joined #nim
21:13:39*TheKing[m] joined #nim
21:15:37Araqkrux02: the build is green now, right?
21:16:38FromGitter<alehander42> sillibird: if it's either nil or a value, you can just use a nilable type or an Option
21:17:40FromDiscord_<j$> yo alehander42 you know how to macro?
21:17:55FromGitter<alehander42> if you're looking for something more general, you can use a variant object(similar to algebraic types) or e.g. OOP with inheritance & methods
21:18:54FromGitter<alehander42> `j$` how do you want to use color_test
21:19:30FromGitter<alehander42> @krux02 helped you with intVal: intVal is only for json, for enums you can use `ord` or `int`
21:19:35FromGitter<alehander42> e.g. `Color.int`
21:19:49FromGitter<alehander42> `c.int` *
21:19:50FromGitter<alehander42> sorry
21:20:10Araqcomparable to Go's empty interface would be 'system.RootRef'
21:20:23FromGitter<alehander42> also, i guess you want the return type to be `untyped`
21:20:35FromGitter<alehander42> not really sure when does one actually need `typed` return
21:24:34krux02Araq: according to my local tests, the build is green, yes
21:25:35FromGitter<timotheecour> can we re-trigger the build for devel? it’s green currently but somehow all/most recent PRs fail w similar/same error
21:26:16*aguspiza quit (Ping timeout: 244 seconds)
21:27:08FromDiscord_<moerm> hello Araq
21:28:49krux02@timotheecour: can you create a PR that removes the spam in execCmdEx2?
21:42:21Araqtimetheecour: rebase the PRs
21:42:37Araqmoerm: hi
21:47:29*sillibird quit (Ping timeout: 256 seconds)
21:54:16FromGitter<iffy> I'm getting sporadic `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` errors in my (way-too-complicated) program. This is an electron app -> node module -> c code produced by nim -> sqlite3 C library. If I see that SIGSEGV, can I be sure that Nim is the one that generated the error?
21:55:44Araqnever but -d:useSysAssert -d:useGcAssert helps in debugging
21:56:19Zevv"never", hehe
21:56:40FromGitter<iffy> but Nim is the one that printed out the message and quit, right?
21:56:47Araqsure
21:56:50FromGitter<iffy> I'll try those flags
21:57:23FromGitter<alehander42> @iffy how do you communicate between electron and the c backend-based code? they are running in different processses, it should be possible to at least
21:57:24FromGitter<alehander42> hm, nvm
21:57:27FromGitter<alehander42> :D
21:57:56FromGitter<iffy> @alehander42 I compile the Cpp code into a Node Native Add-on
21:58:00FromGitter<alehander42> you can also run it under a debugger, if it's easily reproducable
21:58:06FromGitter<alehander42> ahh, i haven't done that
21:58:30FromGitter<iffy> Any good recommendation for a debugger for macos? Haven't been this low level since university :)
21:59:13FromGitter<iffy> bbl
22:00:29FromGitter<alehander42> no idea, i think people use lldb under macos? :D gdb-based stuff works well on linux, but it seems it has problems on mac
22:01:15krux02iffy: when I wrote the gdb integration I din't know that macos broke compatibility with gdb, and gdb seems to be the default debugger on Linux so I went for that.
22:02:14krux02Unfortunately, you need a new gdb version for that integration, and afaik a modern version of basically anything open source linux related is not available on macos, so you should install Linux on a VM
22:02:35krux02sorry that for the moment there is no better solution.
22:03:25*lritter joined #nim
22:11:42FromGitter<iffy> krux02: no apology necessary -- I can get a Linux box
22:12:17krux02maybe you can get gdb running as well, but timothee has problems with it
22:17:56FromDiscord_<j$> @alehander42 the problem is that parameters of macros are nimnodes not enums
22:18:11FromDiscord_<j$> I found a work around
22:18:21FromGitter<alehander42> you can accept `static[Color]`
22:18:35FromGitter<alehander42> this way ypu should get the enum value
22:19:15FromGitter<iffy> Hrm... so where can I read more about useGcAssert and useSysAssert? I'm getting this: ```[GCASSERT] decRef ⏎ No stack traceback available```
22:19:33FromDiscord_<j$> Color being the parameter?
22:19:49FromGitter<alehander42> color: static[Color]
22:20:03FromGitter<alehander42> ye
22:20:56*enow quit (Read error: Connection reset by peer)
22:21:15FromDiscord_<j$> okay so this works for inside the macro but now I cant pass in a value
22:21:55FromGitter<alehander42> ah, so you need to pass variable values
22:22:24FromDiscord_<j$> yessir
22:22:28FromGitter<alehander42> then you just need to do that in the resulting code
22:22:38FromDiscord_<j$> let color = parseEnum[Color]($nnc.getImpl)
22:22:41FromGitter<alehander42> e.g. result = quote: ⏎ if `color`.int .. : ⏎ ..
22:24:05*Jesin quit (Quit: Leaving)
22:24:08FromDiscord_<j$> I dont want to generate the if statement I want to generate code based on the condition
22:25:02FromGitter<alehander42> well, if its a runtime value
22:25:10FromGitter<alehander42> you have to generate a runtime condition
22:25:16FromDiscord_<j$> ah I see
22:25:19FromDiscord_<j$> im dumb
22:25:24FromGitter<alehander42> there is no way to know it beforehand
22:25:35FromGitter<alehander42> no , this happens a lot, its hard to get acustomed in the beginning
22:26:08*dom96_w joined #nim
22:27:55FromGitter<iffy> How should I return a cstring to C code from a nim proc? I think I'm running into GC problems because I'm returning strings. Although I don't know why SIGSEGV would be sporadic rather than deterministic in this case...
22:29:56*shpx joined #nim
22:31:51AlexMaxkrux02: brew has gcc and friends
22:32:06AlexMaxCan't speak as to how updated they are or how friendly they are with clang-compiled binaries
22:35:51dom96_wiffy: you need to use gc_ref(yourString) to ensure the GC doesn't deallocate it
22:36:21FromGitter<iffy> dom96_w: and then how do I later deallocate it?
22:36:27dom96_wgc_unref :)
22:37:11FromGitter<iffy> :) I'll have to think a little about what's doing what, I guess
22:39:02krux02AlexMax: According to timothee brew has problems with gdb with newest version of macos
22:40:13FromGitter<iffy> hrm... looks like GC_ref works for strings but not cstrings: https://nim-lang.org/docs/system.html#GC_ref%2Cref.T
22:40:34krux02cstring isn't a ref
22:40:50krux02cstring is basically just a pointer
22:40:56FromGitter<iffy> oh
22:41:02FromGitter<iffy> I thought pointer == ref
22:41:33dom96_whow did you get the cstring?
22:41:56FromGitter<iffy> result = $ %* { "some": "json" }
22:42:03FromGitter<iffy> GC_ref(result)
22:42:18FromGitter<iffy> but the return type of the proc is cstring
22:42:49dom96_wokay, so do: var res = ...; gc_ref(res); result = addr res[0]
22:43:11dom96_w(result = res might work too)
22:45:03*Jesin joined #nim
22:52:05*zachcart1r joined #nim
22:54:48PMunchHmm, why aren't inline objects considered var..
22:54:57AlexMaxkrux02: noted
22:55:37PMunchIf I do someproc(MyObject(field: 100)) and someproc takes a var MyObject
22:55:56PMunchI obviously don't care what happens to the object I made there as I'm only passing it in to someproc
22:57:26Araqnothing obvious here, MyObject() is not a materialization
22:57:46Araqmight as well argue that takesVar(3) should work
22:57:57PMunchSure
22:58:02PMunchWhy wouldn't it?
22:58:59PMunchvar is used to signify to the programmer that this argument can be changed by the procedure, so if you care about what was there you need to keep a copy. I obviously don't care what happens to the 3 or MyObject, so it should just work..
23:00:50AraqI know of no language where you can pass non-locations to byref parameters.
23:01:44Araqthere is nothing obvious about "not caring" about a computation's result. Enforced 'discard' comes to mind.
23:02:38AraqSound more to me that your 'someproc' is misdesigned.
23:02:45PMunchYeah..
23:10:30Araqtemplate varof(x): untyped = (var v = x; v)
23:10:38Araqwould be a workaround
23:15:35*skellock quit (Quit: WeeChat 2.3)
23:16:39*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:18:24*absolutejam_phon quit (Ping timeout: 246 seconds)
23:37:44*shpx quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:41:01PMunchHuh, this is the strangest bug..
23:41:32PMunchI have declared a simple proc, if the declaration is there my program just echoes something in an endless loop. Otherwise it works fine..
23:41:39PMunchIt's never called though..
23:42:16PMunchAnd it doesn't matter what I put in the proc or what I name it..
23:43:01PMunchIt does matter where in the main scope I declare it though..
23:47:35*PMunch quit (Remote host closed the connection)
23:47:55*shpx joined #nim
23:49:11*krux02 quit (Remote host closed the connection)
23:52:18*sillibird joined #nim
23:52:58sillibirdHow can I make a type nillable?
23:55:26*leorize quit (Ping timeout: 258 seconds)
23:57:57FromGitter<timotheecour> @ krux02 regarding PR removing spam: ya will send it today