<< 09-04-2019 >>

00:03:39*rnrwashere quit (Remote host closed the connection)
00:04:49*noeontheend joined #nim
00:06:41*seni quit (Quit: Leaving)
00:10:37*rnrwashere joined #nim
00:11:39*rnrwashere quit (Read error: Connection reset by peer)
00:11:58*rnrwashere joined #nim
00:13:26*rnrwashe_ joined #nim
00:16:08*rnrwashere quit (Ping timeout: 246 seconds)
00:18:00*rnrwashe_ quit (Ping timeout: 255 seconds)
00:23:02*c3v0axz quit (Ping timeout: 250 seconds)
00:26:07*noeontheend quit (Ping timeout: 240 seconds)
00:32:32*rnrwashere joined #nim
00:35:13*rnrwashere quit (Remote host closed the connection)
00:35:18*rnrwashe_ joined #nim
00:35:24*rnrwashe_ quit (Remote host closed the connection)
00:39:49*vlad1777d quit (Remote host closed the connection)
00:40:51*vlad1777d joined #nim
00:50:55*rnrwashere joined #nim
01:02:39*rnrwashere quit (Remote host closed the connection)
01:03:56*rnrwashere joined #nim
01:04:58*sz0 joined #nim
01:12:48*rnrwashere quit (Remote host closed the connection)
01:32:31*rockcavera joined #nim
01:38:08*dddddd quit (Remote host closed the connection)
02:06:57*banc quit (Quit: Bye)
02:27:30*banc joined #nim
02:48:04*i_Right_i quit (Remote host closed the connection)
02:50:02FromGitter<deech> If I know an object's size will fit is there any way I can allocate it on the stack instead of the heap? This is assuming no GC option is enabled.
02:52:53FromGitter<mratsim> objects are on stack by default
02:53:13FromGitter<mratsim> type Foo = object means it's stack (unless it is used in a container)
02:54:04FromGitter<deech> Oh cool! I had no idea. Is this somewhere in the manual? In that case I also have a similar question about seq's.
02:55:31FromGitter<mratsim> seqs are on the heap but use value semantics
02:57:58FromGitter<mratsim> It's not in the manual. I suppose that's because the manua is supposed to specify what Nim should look like at a high level (value semantics/ref semantics) and that stack/heap alloc is a low-level detail. But better ask @Araq
02:58:37FromGitter<deech> So there's no way to tell the runtime to allocate a seq on the stack if I know it won't overflow?
02:59:14FromGitter<mratsim> Use an array
02:59:27FromGitter<deech> Awesome.
02:59:42FromGitter<mratsim> Alternatively feel free to use that: https://github.com/numforge/laser/blob/master/laser/dynamic_stack_arrays.nim
03:00:57FromGitter<deech> Precisely what I wanted. Thanks!
03:08:12FromGitter<kayabaNerve> Why can a func call raise, but not getCurrentException?
03:08:44leorizewhat do you mean?
03:08:49FromGitter<kayabaNerve> I mean, aren't raise and `raise (ref CurrentException)(getCurrentException())` the same?
03:09:15FromGitter<kayabaNerve> `raise`, with nothing else, raises the current exception, keeping the type and data.
03:09:35FromGitter<kayabaNerve> getCurrentException returns the current Exception, without its type, and must be casted.
03:10:02FromGitter<kayabaNerve> I'm trying to 'manually' raise so I don't have to deal with ReraiseError
03:10:43FromGitter<kayabaNerve> That said, you can't call gCE from a func. I'm trying to check if there's a reason for this. It seems... inconsistent6
03:11:38leorizeyou can call gCE from a func
03:12:07leorizehttp://ix.io/1FIj/nim
03:13:00leorizealso it seems like the exception handler can do dynamic dispatch, as the exception type is kept for the re-raise with `getCurrentException()`
03:16:48leorizeah, you mean from a `func`
03:17:27leorizeyea it looks like a bug
03:20:32*noeontheend joined #nim
03:24:51FromGitter<kayabaNerve> LOL
03:24:59FromGitter<kayabaNerve> Yeah, from a func :P
03:25:46FromGitter<kayabaNerve> I'll create an issue tomorrow
04:02:07*kapil____ joined #nim
04:04:15*noeontheend quit (Remote host closed the connection)
04:16:20*noeontheend joined #nim
04:32:02*uvegbot joined #nim
04:33:02*nsf joined #nim
04:43:06*sz0 quit (Quit: Connection closed for inactivity)
04:44:08*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
04:48:26*nif quit (Read error: Connection reset by peer)
04:49:01*nif joined #nim
05:08:58*narimiran joined #nim
05:13:50*solitudesf joined #nim
06:02:33*solitudesf quit (Ping timeout: 245 seconds)
06:20:25*kapil____ quit (Quit: Connection closed for inactivity)
06:23:52*krux02 joined #nim
06:24:15*noeontheend quit (Ping timeout: 252 seconds)
07:00:00*gmpreussner quit (Quit: kthxbye)
07:04:38*gmpreussner joined #nim
07:04:52*PMunch joined #nim
07:33:08livcdhow do I represent this in Nim ? https://glot.io/snippets/fb43trn74x
07:42:58PMunchfor i in 0..<srvCount: echo lpservice[i].lpDisplayName, "n"
07:43:02PMunchSomething like that?
07:43:52PMunchlivcd ^
07:43:59*absolutejam quit (Quit: WeeChat 1.9.1)
07:45:57livcdhttps://glot.io/snippets/fb4necjlnj
07:46:02livcdsorry I had to reboot
07:47:14*stefanos82 joined #nim
07:51:22*nc-x joined #nim
07:52:22*jxy_ quit (Quit: leaving)
07:52:40*jxy joined #nim
07:53:26PMunchlivcd, what is LPDWORD here?
07:53:32nc-xlivcd: according to microsoft docs, LPDWORD is a pointer. What are you expecting the loop to do? You will need to dereference srvcount
07:54:23PMunchAh, it's a pointer to a DWORD
07:54:35nc-xPMunch: LPDWORD = Pointer to DWORD (uint32)
07:55:07PMunchYeah
07:55:39PMunchBut what does that original code do? Doesn't seem right to have it loop from 0 to some random pointer
07:55:53PMunchI think we need a bigger snippet livcd, in order to tell what you're actually trying to do here
07:56:13livcdah ok
07:56:14livcdlet me
07:57:12livcdso basically i am trying to do this in Nim https://glot.io/snippets/fb4noxtvts I am using winim's library for types and winapi procs
07:57:23livcdbut i am sure i am not working with the types correctly :/
08:00:00*kapil____ joined #nim
08:02:11nc-xlivcd: In this code, srvCount is DWORD
08:02:34nc-xwhereas in Nim, you are using LPDWORD
08:05:45*floppydh joined #nim
08:10:31*nc-x quit (Quit: Page closed)
08:11:30livcdoh you are right
08:17:02livcdBut I am still struggling to translate this line: lpservice = new ENUM_SERVICE_STATUS [dwBytes]; and printf("%sn",lpservice[i].lpDisplayName);
08:28:11leorizethe printf can be translated to this: `echo lpservice[i].lpDisplayName, "n"`
08:29:23livcdyes but i need the first line first :X
08:54:11*Vladar joined #nim
08:59:01livcdno tips ? ^^
08:59:48Araqnew T[] is newSeq[T]()
09:04:12*disruptek quit (Ping timeout: 245 seconds)
09:14:41*shomodj joined #nim
09:17:19*shomodj quit (Client Quit)
09:41:27*shomodj joined #nim
09:57:49*PMunch_ joined #nim
09:58:04*PMunch quit (Ping timeout: 250 seconds)
10:03:18FromGitter<alehander42> how to copy a node
10:03:22FromGitter<alehander42> deepCopy ?
10:04:06FromGitter<alehander42> NimN ode
10:04:18*abm joined #nim
10:04:49FromGitter<alehander42> it seems `.copy`
10:08:31AraqcopyTree vs copyNode is in macros.nim
10:08:34Araqiirc
10:11:38*PMunch_ quit (Remote host closed the connection)
10:12:13*PMunch_ joined #nim
10:16:49FromGitter<alehander42> what is the difference between them and `.copy` o.O
10:17:04AraqI don't know .copy
10:17:23FromGitter<alehander42> copy is copyNimTree
10:17:35FromGitter<alehander42> i guess copyNimTree copies recursively
10:17:39FromGitter<alehander42> and copyNimNode shallowly
10:18:41Araqyup
10:23:41*c3v0axz joined #nim
10:24:19Araqlib\pure\os.nim(2465, 17) Hint: passing 'a' to a sink parameter introduces an implicit copy; use 'move(a)' to prevent it [Performance]
10:24:29Araqtrue ... bloody compiler is getting smart
10:24:54Araqlib\pure\parseopt.nim(384, 20) Error: internal error: '=destroy' operator not found for type seq[string]
10:25:04Araqdamn :-)
10:25:25Araqtime for lunch...
10:30:04FromGitter<alehander42> btw
10:30:10leorizeAraq: now the question is when can the compiler decide that it could just do the `move()` automatically :p
10:30:12FromGitter<alehander42> how is docstring moved in nimnodes
10:30:23FromGitter<alehander42> when it's after <call>:
10:30:28FromGitter<alehander42> macro call
10:30:49FromGitter<alehander42> can i force it to be after a certain node
10:30:52FromGitter<alehander42> @krux02 ?
10:33:40krux02currently you are lucky if you can access the docstring reliably.
10:34:00krux02many docstrings you cannot access from macros at all.
10:34:07FromGitter<alehander42> hm but what about
10:34:08FromGitter<alehander42> when i do
10:34:21FromGitter<alehander42> a arg: ⏎ ## docstring ⏎ other code
10:34:22krux02you can only access them when they are doc statemsts
10:34:24FromGitter<alehander42> ugh
10:34:33FromGitter<alehander42> i dont know if its visible in gitter
10:34:34FromGitter<alehander42> irc*
10:34:42krux02it's not
10:34:44FromGitter<alehander42> so `##` doesn't matter
10:35:08krux02the documentation comment needs to be it's own statement if you want to be able to acces it via macros.
10:35:27FromGitter<alehander42> the thing is , i see in repr that the macro result keeps the ## docstring somewhere, but i dont know why its after a certain node
10:35:45FromGitter<alehander42> so what is a document statement?
10:36:05krux02a doccomment that is not within an expressien
10:36:15FromGitter<alehander42> ok, that's the case
10:36:19krux02foo(); <newline> ## some doc
10:36:20krux02this is ok
10:36:27FromGitter<alehander42> yes
10:36:31FromGitter<alehander42> ah
10:36:34FromGitter<alehander42> not exactly
10:37:19dom96Araq: that's cool
10:37:25FromGitter<alehander42> https://paste.ofcode.org/U7mcZf6aa7d2hB2mWeGmjN
10:37:35FromGitter<alehander42> check is a macro
10:37:45krux02that is ok too
10:38:11krux02you have check with a stmtListExpr as argument and the first satement in the stmtListEXpr is the doc comment.
10:38:12FromGitter<alehander42> ahh
10:38:20FromGitter<alehander42> so it's just a direct child
10:38:24krux02no
10:38:25FromGitter<alehander42> not a field or something
10:38:26FromGitter<alehander42> i see
10:38:35krux02it is a direct child of the stmtListExpr
10:38:49FromGitter<alehander42> ok, some kind of a child
10:38:53krux02the stmtListEXpr has only one child if I see it correctly
10:39:02krux02but without the stmtListExpr it is invalid
10:39:29FromGitter<alehander42> is stmtListExpr used for anything else
10:40:00krux02with stmtListEXpr you can inject visible doc comments to anything expression
10:40:31krux02stmtListExpr is everywhere in nim
10:41:33FromGitter<alehander42> interesting, because dumpTree shows me just a CommentStmt
10:41:34krux02stmtList and stmtListExpr has the sematical difference that a stmtListExpr is an expression that can be used for example as a function argument, where a stmtList i just top level
10:41:44FromGitter<alehander42> is it swallowed or is it possible that i use an older nim
10:42:04krux02?
10:42:10krux02what do you want?
10:42:31krux02what is swallowed?
10:42:34FromGitter<alehander42> i expected that dumpTree will also show "StmtListExpr: .. CommentStmt"
10:42:43krux02it should
10:43:18FromGitter<alehander42> hm i use a month-old nim, i should update
10:43:48krux02well I tested it, dump tree emits a stmtList, not a stmtList expr
10:44:01FromGitter<alehander42> yeah
10:44:21krux02the difference betweenStmtList expr got lost somewhere in the development of Nim.
10:44:30FromGitter<alehander42> sorry
10:44:41FromGitter<alehander42> well i guess it doesnt make a big difference for me\
10:44:45FromGitter<alehander42> i am glad that i can access it
10:46:17krux02you can't acces any doccomments that are part of a let section or type section though
10:47:17FromGitter<alehander42> can i insert a docstring into a type section then
10:47:42FromGitter<alehander42> i generate a type section based on my args
10:47:44krux02you can insert it, yes, but you can't acces it from macros
10:47:47FromGitter<alehander42> and i want to insert the docstring there
10:47:49FromGitter<alehander42> ok
10:48:16FromGitter<alehander42> cool
10:48:17FromGitter<alehander42> thanks a lot
10:55:53narimiran@alehander42 while we're at documentation topic: any news about jsffi documentation? :)
10:57:22*stefanos82 quit (Remote host closed the connection)
11:04:17dom96where is the Nim evangelism? https://news.ycombinator.com/item?id=19610199 (narimiran?)
11:04:41narimirandom96: it is in reddit thread about it :P
11:05:09dom96HN has far more presence than Reddit
11:05:39narimiran...and far more of "oh, nim-fanboys strike again" ;)
11:06:53dom96There is a balance
11:07:09dom96And I don't even see any comments by any of you guys on that reddit thread
11:07:16dom96when someone is asking for a comparison
11:07:18livcduhm I lost all the replies
11:07:42livcdstill did not figure out how to do: lpservice = new ENUM_SERVICE_STATUS [dwBytes];
11:08:57*dddddd joined #nim
11:13:18leorize@livcd Araq said you should use newSeq
11:16:03livcdahmmm like this ? let lpServices = newSeq[ENUM_SERVICE_STATUS](dwBytes)
11:16:24narimiranlivcd: there is always https://irclogs.nim-lang.org/ to look what has been written ;)
11:17:28*solitudesf joined #nim
11:20:28*PMunch_ is now known as PMunch
11:21:30livcdty
11:22:10livcdhttps://glot.io/snippets/fb4tbllrsj
11:27:38FromGitter<alehander42> narimiran: sorry, i really have to take a look at it
11:35:36*kobi7 joined #nim
11:38:31*pwntus quit (Remote host closed the connection)
11:41:56*lritter joined #nim
11:48:46*pwntus joined #nim
11:48:46*pwntus quit (Changing host)
11:48:46*pwntus joined #nim
12:00:51*Etheco quit (Read error: Connection reset by peer)
12:01:13*Etheco joined #nim
12:08:57*kapil____ quit (Quit: Connection closed for inactivity)
12:25:27*uvegbot quit (Ping timeout: 240 seconds)
12:25:59*lritter quit (Read error: Connection reset by peer)
12:27:30*uvegbot joined #nim
12:28:28FromGitter<liquid600pgm> do converters take precedence over overloads?
12:28:37FromGitter<liquid600pgm> overloads and generics*, that is
12:29:12PMunchliquid600pgm, don't think so
12:46:10*Snircle joined #nim
13:12:12FromGitter<arnetheduck> ugh, write a nim wiki page on nim-vs-whatever so as to have somewhere to deflect zealots to, but why feed the trolls on a thread that's there to celebrate the release?
13:15:11*kobi7 quit (Quit: Leaving)
13:17:03*Vladar quit (Remote host closed the connection)
13:25:31*lritter joined #nim
13:30:52FromGitter<arnetheduck> is there any reason why unread globals are not dead-code-eliminated? I'm looking at the generated code, and there are some globals in there that pollute the generated code even though they're not used - trivial example is `nim_program_result`
13:33:16Araqthat one is marked with .exportc and thus cannot be removed
13:36:17FromGitter<arnetheduck> oh. ouch. but I tried it with a simple `var x: int` as well
13:37:05Araqmaybe it never was implemented for vars :-)
13:39:18FromGitter<arnetheduck> wdyt of removing nim_program_result? :) it's one of the things with pretty shaky semantics - ie creating a nim library means having multiple copies of it, it's a shared writable global, list goes on
13:44:41FromGitter<arnetheduck> in particular, I'm seeing it turn up with `--os:standalone` in a way that doesn't really make sense - when writing an without the `c` library, you end the process with the `exit` syscall, would be easier to get to a zero-cost / raw nim compile without it
13:46:27FromGitter<arnetheduck> but, this is a peculiarity of linux/unix - on other systems, it will be different
13:46:58FromGitter<arnetheduck> (think controllers, embedded, bioses, kernels etc)
13:54:41*nsf quit (Quit: WeeChat 2.4)
13:55:12*PMunch quit (Remote host closed the connection)
14:32:29Araqarnetheduck: it should never have been added
14:43:00livcdso this somehow works as GetLastError() returns at least some error codes but I am still not there yet for the commented lines :O https://glot.io/snippets/fb4yv2f2qo
14:44:20FromGitter<arnetheduck> I can do a `{.deprecated.}` pr :)
14:44:26Araq+1
14:44:35Araqunittest.nim uses it iirc
14:47:06*Trustable joined #nim
14:48:18FromGitter<arnetheduck> unittest can have it's own ugly global and deal with the semantic nuances as it sees fit
14:48:47FromGitter<arnetheduck> we've been close to forking off unittest several times as well, it has some fundamental flaws that will be hard to solve otherwise
14:48:58Araqexactly.
14:49:11AraqI want to make 'testament' Nim's general testing tool
14:49:32Araqas I believe a tool is better than a "framework" for this
14:50:00Araqfor instance, you can then easily write tests that the compiler/macro system produces nice error messages
14:50:32Araqand I enjoy the process isolation for running tests in parallel
14:51:04FromGitter<arnetheduck> eh, that I'm not sure about yet.. testament is a bit clunky for run-of-the-mill tests in applications - stdio is generally a bit coarse as far as granularity goes and requires non-trivial marshalling
14:51:58FromGitter<arnetheduck> I mean, it's good for the compiler that it's external, but not all things will be like this..
14:52:39Araqsure it's clunky but it's also battle-tested and has lots of features
14:53:18Araqand getting the logic right is often surprisingly tricky
14:54:21Araqbut hey, you don't have to agree with me ;-)
14:55:45FromGitter<arnetheduck> well, I could still use that exclude feature in it ;)
14:56:42FromGitter<arnetheduck> also, the megatest thing is a bit.. brittle. since you enjoy process isolation, you start using tests that subtly rely on it (ordering for example, like those pesky dll tests)
14:57:09Araqfor NLVM yes, but we also need a general 'testament <mydir>'
14:58:05FromGitter<arnetheduck> well, I a PR on that long ago, that split up test discovery and running into a two-stage pipeline, making such things much easier to implement
14:59:54FromGitter<arnetheduck> anyway, with `func`/nosideffect and a few other goodies, the test running could actually detect when it's safe to reorder tests, and thus combine them into a megatest
15:01:24*tiorock joined #nim
15:01:24*tiorock quit (Changing host)
15:01:24*tiorock joined #nim
15:01:24*rockcavera is now known as Guest56826
15:01:24*Guest56826 quit (Killed (tolkien.freenode.net (Nickname regained by services)))
15:01:24*tiorock is now known as rockcavera
15:12:55Araqarnetheduck: I know, I didn't like the PR because I don't want testament to use threading, regardless how stable/shitty Nim's threads are
15:14:59FromGitter<arnetheduck> that went away in a later commit to use processes (_also_ because the threads were broken even for the very simple usage 😛), but then there was something else as well, and I didn't have time to deal with it
15:15:18Araqit uses processes for concurrency and only because it has to ;-)
15:15:46Araqbtw we now have tests for testament itself
15:17:14Araqand they are a bit flawed iirc, if I change the logic to always return "green" then its tests are green too because testament is used for testing itself...
15:17:27FromGitter<arnetheduck> well, the biggest problem I remember was actually that there were interdependent tests that required serial running and an isolated environment, and that requirement was hard-coded inside testament itself.. to make it generic, you'd need to implement a language to let tests themselves specify such constraints
15:18:11FromGitter<arnetheduck> think stuff where one test creates a particular file in a particular (shared, global) location, and another that reads it, or similar.. same story as with globals in code :)
15:18:51Araqyeah, these tests are bad, we rewrote at least one of them
15:20:41Araqevery test that is now order dependent is in special category afaik
15:20:43FromGitter<arnetheduck> well, if someone is looking into it, I think that branch had a few good ideas.. by separating test discovery, it was also very easy to create test matrixes (so you can express running those combinations of gc, c/c++, etc easily)
15:21:11Araqwe have some support for that via 'targets' in the spec section
15:21:57FromGitter<arnetheduck> well, I know because I added that too earlier :) but that branch laid the groundwork to make it generic
15:22:35AraqI don't think it was you but it also was broken and I had to fix the logic
15:22:42Araqwas very annoying
15:22:59shashlick@narimiran: any idea why this is failing only on windows x64 - https://travis-ci.org/nim-lang/nightlies/jobs/517617808#L7978
15:23:04Araqsomebody used 'continue' in the loop and so it would skip the test counting and the numbers were off :P
15:23:09FromGitter<arnetheduck> ok, maybe not.. I remember doing something with it, because I needed to exclude c++ tests in nlvm :)
15:23:34CcxWrkAre negative indices allowed for strings/sequences? (Python-like indexing from end)
15:23:49FromGitter<alehander42> ^index
15:23:53FromGitter<arnetheduck> ah yeah, I might have added the command line option to exclude some targets
15:24:06FromGitter<alehander42> Instead of -index
15:24:09narimiranCcxWrk: you use `^1` for the last index, and so on
15:24:31Araqshashlick, gah are nightlies broken *again*?
15:25:15narimiranAraq: well, you broke devel yesterday evening ;)
15:25:49narimirantonight's nightlies should be fine if nothing breaks devel in the mean time
15:27:41Araqok...
15:28:19CcxWrkHmm, not sure if that's exactly what I want, but thanks. Can I use multiple iterators in lockstep? (for x, y in zip(...))
15:31:42*stefanos82 joined #nim
15:32:53shashlickfunny cause xmltree.nim hasn't changed since Feb 20 so looks like oserror is a random failure - let me restart that job to see if it passes now
15:44:01*rnrwashere joined #nim
15:55:17*floppydh quit (Quit: WeeChat 2.4)
15:55:40krux02CcxWrk, you can only do that with closure iterators right now. Currently the best way to zip is to use indices
15:57:05narimiranCcxWrk: yes, this works http://ix.io/1FKR/ on nim devel (v0.19.9), not in previous/stable versions
16:00:15CcxWrkThanks. FWIU zip() is a proc rather than iterator though, so it involves copying? Or was zip iterator added?
16:04:51CcxWrkI've solved it via computing indices here, but would definitely want this in the future on possibly lazy iterators.
16:05:53CcxWrkDoes nim-lang.org/docs point to stable or dev?
16:06:03FromGitter<liquid600pgm> stable
16:06:13FromGitter<liquid600pgm> for dev, look here: https://nim-lang.github.io/Nim/
16:07:30CcxWrkHmm, still no zip(It) iterator there. But thanks!
16:19:24*rnrwashere quit (Remote host closed the connection)
16:24:12federico3how can I do bitwise or between values of an enum?
16:25:15federico3is there a cleaner way to do it?
16:26:08federico3https://github.com/nim-lang/Nim/issues/4486
16:35:51*c3v0axz quit (Ping timeout: 255 seconds)
16:36:06*c3v0axz joined #nim
16:47:31*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:51:19FromGitter<dawkot> How can you check if type `A` is `distinct B`?
16:51:39FromGitter<dawkot> it returns false when I do it the most obvious way
16:51:43FromGitter<dawkot> even though it shouldn't
16:58:30FromGitter<disruptek> how hard would it be to implement `pydoc` for nim? `ndoc`? seems doable.
17:01:18narimirandisruptek: you mean `nim doc <filename>`?
17:03:58FromDiscord<exelotl> I want to define a list structure that lets you delete from it while looping over it
17:04:39shashlicknice to see nightlies binaries getting downloaded, onesies/twosies and mostly windows
17:05:10FromDiscord<exelotl> like, for i,v in mpairs(mylist): if foo: mylist.removeAt(i)
17:05:27FromDiscord<exelotl> and then `i` would be corrected for the next iteration of the loop
17:07:04narimiranshashlick: it seems that restarting that one test helped with nightlies :)
17:07:15shashlickyep random failure
17:09:53*NimBot joined #nim
17:10:28*disruptek joined #nim
17:14:27*nsf joined #nim
17:16:53*shomodj joined #nim
17:30:23*rockcavera quit (Remote host closed the connection)
17:34:13FromGitter<dawkot> ```code paste, see link``` ⏎ ⏎ why [https://gitter.im/nim-lang/Nim?at=5cacd794a0790b29c98b88be]
17:40:58*rockcavera joined #nim
17:41:06*neceve quit (Read error: Connection reset by peer)
18:02:04*narimiran quit (Read error: Connection reset by peer)
18:02:34*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:04:38*narimiran joined #nim
18:05:00*neceve joined #nim
18:09:32FromGitter<liquid600pgm> why would you use a macro here anyways?
18:10:07FromGitter<dawkot> it's just a minimal example
18:10:24*narimiran quit (Read error: Connection reset by peer)
18:10:41*narimiran joined #nim
18:14:56*Jesin quit (Quit: Leaving)
18:15:25FromGitter<dawkot> Also, any idea why the last line raises? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cace13d0aad63501956d4d6]
18:21:14*narimiran quit (Read error: Connection reset by peer)
18:25:40*narimiran joined #nim
18:26:06*theelous3__ joined #nim
18:33:10*drewr quit (Remote host closed the connection)
18:37:22*narimiran quit (Ping timeout: 246 seconds)
18:39:09*drewr joined #nim
18:42:38*narimiran joined #nim
18:44:48*Jesin joined #nim
18:45:26*neceve quit (Remote host closed the connection)
18:53:58AraqI doubt concepts work with hasPragma
18:54:11AraqhasPragma only works on NimNode, I guess?
19:00:31federico3Araq: any documentation of using sets of enums and converting them to/from int? e.g. https://github.com/nim-lang/Nim/issues/4486
19:00:55Araq'cast' works
19:02:49federico3I'll contribute some examples to the manual
19:06:25Araqok ty
19:09:27*shashlick quit (Remote host closed the connection)
19:10:41*rnrwashere joined #nim
19:13:20FromGitter<disruptek> narimiran: nah, `ndoc` would search for sources of documentation for the symbol supplied on the command-line. i think it's probably best implemented as a nimsuggest client. could probably be done in shell.
19:30:02*uvegbot quit (Quit: Konversation terminated!)
19:30:08*zyklon joined #nim
19:37:58FromGitter<liquid600pgm> gosh, OpenGL textures are driving me nuts
19:38:29FromGitter<liquid600pgm> why is my texture not being rendered at all? the sampler just returns black texels
19:41:08FromGitter<liquid600pgm> I've been debugging it this whole day and I just can't see it
19:41:23Zevv glEnable(GL_TEXTURE_2D) :)
19:41:34FromGitter<liquid600pgm> what!?
19:41:39FromGitter<liquid600pgm> that's the problem!?
19:41:45ZevvI don't know
19:41:51ZevvI always have problems with opengl
19:42:05Zevvand this was one that happened to me years ago
19:42:17FromGitter<liquid600pgm> nope, not the case
19:42:20FromGitter<liquid600pgm> still black
19:42:20Zevvnot sure if it even applies to modern GL, that was in the 1.0 time
19:42:34Zevvwhat was your repo url gain?
19:42:37Zevvs/gain/again/
19:42:41FromGitter<liquid600pgm> https://github.com/liquid600pgm/rapid
19:43:33Zevvmissing file 'glm'
19:43:49FromGitter<liquid600pgm> `nimble install glm`
19:43:58Zevvmakes sense :)
19:44:15*sz0 joined #nim
19:44:36FromGitter<liquid600pgm> nim-glm is a very nice library, I use it because there's no point in re-inventing the wheel
19:45:04FromGitter<liquid600pgm> I'm even thinking about making a simple GLFW for Nim, I mean, how hard can it be
19:45:22Zevvwhat is the expected output?
19:45:57FromGitter<liquid600pgm> a 64×64 rectangle with this texture https://github.com/liquid600pgm/rapid/blob/master/sampleData/logo-4x.png
19:46:21ZevvI get a diagonal gradient green to red only
19:46:35FromGitter<liquid600pgm> aah, forgot the commit
19:47:10FromGitter<liquid600pgm> try now
19:47:36Zevvblack :)
19:48:00*Trustable quit (Remote host closed the connection)
19:48:08FromGitter<liquid600pgm> yeah, and that's the problem
19:48:30FromGitter<liquid600pgm> there should be a textured rectangle in the top left corner
19:49:16FromGitter<liquid600pgm> I compared my old code with the new code in apitrace but I just can't see the problem
19:49:36FromGitter<liquid600pgm> and the old code worked perfectly
19:49:46FromGitter<dawkot> is there any reason you're not using more high-level libraries?
19:50:10FromGitter<liquid600pgm> yes, I want to learn OpenGL, finally
19:50:37FromGitter<liquid600pgm> I used so many high-level libraries for a long time now so I thought learning OpenGL might be a good next step
19:55:22FromGitter<dawkot> it seems to me that unless you already know what you're doing, it's better to start with something high level that's not too intrusive because you can always replace its rendering calls whenever you feel like it
19:55:28FromGitter<dawkot> if it really is not intrusive
19:58:10FromGitter<liquid600pgm> the problem is, I am already experienced in high-level libs and I wanted to make my own to create an API I like
19:58:11*rockcavera quit (Remote host closed the connection)
19:58:59Zevvso if you put hardcoded colors in your shader you get output, right
19:59:08FromGitter<liquid600pgm> yes
19:59:08*shashlick joined #nim
19:59:13*shashlick quit (Remote host closed the connection)
19:59:26FromGitter<liquid600pgm> it's the sampler that returns zeroes
19:59:38FromGitter<liquid600pgm> and makes everything black
19:59:38*shomodj joined #nim
20:00:06FromGitter<liquid600pgm> I'm sure the right data is sent to OpenGL, I checked that with apitrace
20:01:54*shashlick joined #nim
20:06:26Araqtoday I made koch.nim work with --newruntime, a significant milestone
20:07:00Zevv\o/ Congrats Araq!
20:07:52Araqthanks
20:08:09Araqtomorrow I'll test callbacks and .async
20:08:27Araqwhich is the most risky part in this experiment
20:09:17Araqthe changes so far are really just adding 'owned' where the compiler tells me to do so
20:09:23Zevvliquid600pgm: I got your logo
20:09:37Araqcrazy stuff :-)
20:10:27Zevvwow, lets get some stdlib working as well :)
20:11:36Araqkoch uses parseopt, strutils, osproc, os ...
20:11:51Araqthat is "some stdlib"
20:11:51Zevvwow
20:16:30Zevvliquid600pgm: your problem is in setting your rTexEnable uniform, somehow: http://paste.debian.net/1076893/
20:16:44ZevvAraq: so, is it already time to get our own code working with the newruntime?
20:17:14AraqI doubt it, the hard part is .async and callbacks
20:20:09*nsf quit (Quit: WeeChat 2.4)
20:20:26*jjido joined #nim
20:22:18*narimiran quit (Remote host closed the connection)
20:27:11FromGitter<liquid600pgm> Zevv: oh wow, I never thought of that. the strange part is, if I hardcode the colors in the true branch it works just fine
20:27:25*rockcavera joined #nim
20:28:22ZevvI guess you're settign the wrong uniform
20:28:26FromGitter<liquid600pgm> I think it's a problem with the GLSL compiler optimizing stuff away. I might have to create a texel function which will return white when the texture is disabled
20:29:17Zevvit doesn't matter if you set it to 0 or to 1, it breaks either way
20:29:23FromGitter<liquid600pgm> I'll leave that for tommorow, I'm tired and I gotta get some sleep
20:43:28Zevvliquid600pgm: in case you're still here: your with() template is wrong. It restores to an invalid state when you use it the first time.
20:43:56ZevvcurrentProgram vs ctx.program
20:44:05Zevv"don't use globals" :)
20:45:01Zevvadd `currentProgram = program.id` to `program=` is your fix
20:57:34*rnrwashere quit (Remote host closed the connection)
21:00:24*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:04:34*jjido joined #nim
21:09:50*solitudesf quit (Ping timeout: 246 seconds)
21:22:32*noeontheend joined #nim
21:28:53*noeontheend quit (Remote host closed the connection)
21:48:40*rnrwashere joined #nim
21:49:23*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:53:30*theelous3__ quit (Ping timeout: 250 seconds)
22:04:47*stefanos82 quit (Remote host closed the connection)
22:06:02*shomodj joined #nim
22:16:41*Etheco quit (Ping timeout: 246 seconds)
22:42:16*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:44:36*stefantalpalaru joined #nim
22:44:41*MightyJoe quit (Ping timeout: 246 seconds)
22:45:20*cyraxjoe joined #nim
22:45:26stefantalpalaruDoes anyone have a macro for importing constants from C headers, as described here: https://github.com/nim-lang/Nim/issues/4441#issuecomment-230441949 ?
23:01:38shashlickwhat are you trying to wrap
23:03:18stefantalpalaruIt doesn't matter. This is valid for all C header defines. I'm trying to avoid typing two lines per import instead of one.
23:04:18shashlickif i can see some code, i'll better understand what you are trying to do
23:04:42shashlickperhaps even add it to nimterop
23:05:47stefantalpalaruHave you seen the issue comment I linked to? Assume that the header "foo.h" used as an example contains "#define BAR 1".
23:07:06shashlickno, #define doesn't exist in the C binary, it's like a text replace
23:07:17stefantalpalaruRunning c2nim on it will result in "const BAR = (1)", but you want to do an {.importc.} instead of copying that value, in case upstream changes it at some point.
23:08:00stefantalpalaruWe're talking compile time header inclusion here, not runtime symbols.
23:08:06shashlickthat issue is talking of static constants, not preproc defs
23:08:21stefantalpalaruSame thing.
23:09:51shashlick#defs are used as constants, doesn't mean they actually exist in memory as is
23:09:56shashlicklet is pointing to memory
23:11:57stefantalpalaruYou're arguing the wrong thing. Try it and convince yourself that it works like I'm already seeing it working. Now, I've tried a quick and dirty "quote do" macro with no luck. I need manual AST construction and thought to ask if someone already wrote it since 2016.
23:12:33shashlickokay cannot do much if you don't show me any code
23:13:34*krux02_ joined #nim
23:13:48*krux02_ quit (Remote host closed the connection)
23:16:11stefantalpalaruSee line 89: https://gist.github.com/stefantalpalaru/b54bf0ee500d75d51fe6b35b3d82d0c5
23:16:15*krux02 quit (Ping timeout: 252 seconds)
23:18:00stefantalpalaruAnd line 14 here: https://github.com/miniupnp/miniupnp/blob/master/miniupnpc/upnpcommands.h
23:18:54stefantalpalaruIf I didn't make myself clear, the wrapper is fully working. I just don't like the verbosity of that scheme.
23:19:22shashlickokay I get what you are saying, just didn't expect nim to importc #defines as well
23:19:29shashlicknim's too smart for me
23:20:18shashlickhttp://nim-lang.github.io/Nim/manual.html#templates-identifier-construction <= this will help
23:21:59stefantalpalaruIt's easier to understand by thinking about the C output. As long as you don't try to get the address of a let symbol, Nim doesn't care what it points to, so when the corresponding header is included in the resulting C file, it's just replaced by the C preprocessor with a literal value.
23:22:33stefantalpalaruIdentifier construction doesn't seem to work inside the double quotes I need for the pragmas.
23:23:23shashlickokay, gotta run but will check in an hour
23:23:56shashlickhere's the two spots i've used inject in the past - https://github.com/genotrance/feud/blob/master/src/plugin.nim#L13
23:24:24shashlickhttps://github.com/genotrance/nimgen/blob/master/src/nimgen/file.nim#L99
23:24:29shashlickin case it helps, bbl
23:29:28*lritter quit (Quit: Leaving)
23:41:01*rnrwashere quit ()
23:45:13shashlickSo while you pursue that, the way I have done wrappers with nimgen and now nimterop is to generate them automatically rather than have a static copy checked in
23:45:29shashlickThat way, the wrappers stay up to date as upstream changes
23:45:51shashlickThen you don't care if it is a const or a let
23:55:23stefantalpalaruI don't trust automated wrapping done by external tools, in the long run. Something like this should be done by the compiler, with a thoroughly tested mechanism that doesn't bail on simple preprocessor defines like c2nim. I also don't like adding new build dependencies, even cool ones like these.