<< 14-07-2016 >>

00:07:21*Jesin quit (Quit: Leaving)
00:10:32*Jesin joined #nim
00:28:49*ob_ joined #nim
00:30:51*icebattle quit (Quit: Leaving)
00:31:10*ofelas quit ()
00:40:02*mcc joined #nim
00:42:13*brson quit (Quit: leaving)
00:47:13*ftsf_ joined #nim
01:19:41*chemist69_ joined #nim
01:22:51*chemist69 quit (Ping timeout: 258 seconds)
01:33:17*ob_ quit (Remote host closed the connection)
01:51:33*GangstaCat quit (Quit: Leaving)
01:52:24*ephja quit (Read error: Connection reset by peer)
02:16:44ftsf_o/ good morning
02:41:58*vendethiel joined #nim
02:42:27*vendethiel- quit (Ping timeout: 246 seconds)
03:34:54*kssreeram joined #nim
03:51:00*Demon_Fox joined #nim
03:53:43*kssreeram quit (Read error: Connection reset by peer)
04:00:04*vendethiel- joined #nim
04:00:37*vendethiel quit (Read error: Connection reset by peer)
04:08:08*kssreeram joined #nim
04:12:04*kssreeram quit (Read error: Connection reset by peer)
04:18:03*kssreeram joined #nim
04:19:39*brechtm quit (Read error: Connection reset by peer)
04:19:47*brechtm_ joined #nim
04:36:21*endragor joined #nim
04:37:35*kingofoz quit (Ping timeout: 258 seconds)
04:38:00*kingofoz joined #nim
04:54:52*kssreeram quit (Ping timeout: 260 seconds)
05:00:24*kssreeram joined #nim
05:25:11*kssreeram quit (Read error: Connection reset by peer)
05:59:29*kssreeram joined #nim
06:16:55*mcc quit (Quit: Connection closed for inactivity)
06:17:52*endragor_ joined #nim
06:20:51*endragor quit (Ping timeout: 264 seconds)
06:31:16*endragor_ quit (Remote host closed the connection)
06:31:44*endragor joined #nim
06:32:25*kssreeram quit (Read error: Connection reset by peer)
06:37:17*ndh joined #nim
06:38:21ndhis there a canonical/idiomatic way to tell the compiler that the else branch in a when statement is an error/not supported? provoke a compiler error, maybe with a message?
06:41:37endragorndh: use error pragma
06:41:54endragorndh: http://nim-lang.org/docs/manual.html#pragmas-error-pragma
06:43:14ndhah! fatal is the one i think
06:43:48ndhwait. how do you use the error pragma with a message?
06:43:57ndhwhy is there no example
06:45:22flyx{. fatal: "your error message" .}
06:45:56ndhok, fatal works, thank you guys!
06:48:32endragorerror can be used the same way. and I'm not actually sure what the difference is in the current version. I'd guess you should normally use .error, so that all the compilation errors can be seen (even the ones that go after this particular error). But Nim aborts on the first error anyway.
06:51:33ndhendragor: when i use the error pragma it says `Error: invalid pragma: error: "not implemented"`
06:51:54ndhwhen i use fatal it says `Error: not allowed`
06:52:41endragorndh: do you use it the same way? {.error: "An error has occurred".} works well for me.
06:53:33ndhyes, i just replace fatal with error
06:54:11ndhhuh
06:54:22ndhi use it in a proc
06:54:35ndhthere's a difference when i use it top level
06:56:43ndhwhen i use {.error: "".} in a proc it says `invalid pragma`
06:57:12endragorndh: indeed. Looks like a bug to me. .warning pragma works as intended both inside and outside procs.
06:57:28ndhanyways. is there a way to compile a file or string as nim and then access the AST?
06:57:45ndhendragor: yea seems like it
06:58:52endragorndh: compile-time or run-time?
06:59:00ndhrun-time
07:00:54endragoruse could use `compiler` package to do that. it's not documented afaik, but you could take a look at how nimsuggest or c2nim do that
07:02:23ndhok, thank you
07:12:45*kssreeram joined #nim
07:27:29*endragor quit (Remote host closed the connection)
07:31:16*yglukhov quit (Remote host closed the connection)
07:31:16*yglukhov1 is now known as yglukhov
07:33:13*Arrrr joined #nim
07:33:13*Arrrr quit (Changing host)
07:33:13*Arrrr joined #nim
07:35:33*yglukhov quit (Ping timeout: 240 seconds)
07:41:26*kssreeram quit (Read error: Connection reset by peer)
07:43:18*chrisheller quit (Remote host closed the connection)
07:46:45ndhwhy does this work: `jtest.add("test", JsonNode(kind: JFloat, fnum: 1.3))` but this doesn't: `jtest.add("test", newJFloat(1.3))`? it says `Error: unhandled exception: obj.kind == JObject [AssertionError]`
07:48:33*Demon_Fox quit (Remote host closed the connection)
07:48:47*Demon_Fox joined #nim
07:51:05*irrequietus joined #nim
07:51:53ndhnvm ._.
07:57:00ndhstill weird though. my mistake was that `jtest` was a newJArray() when it should have been a newJObject(). so the assert is fine and helpful and all. but why didn't it trigger in the first call? seems like a bug to me.
08:03:30*endragor joined #nim
08:04:32*kssreeram joined #nim
08:04:50flyxit sure seems strange, the first call should lead to the same error.
08:05:29flyxare you sure you had the "test" in the first call?
08:08:39ndhyes i'm sure
08:09:30ndhit even produced the output i was expecting, as if jtest was a JObject
08:09:54ndhi'll open a bug
08:14:26*ftsf_ quit (Quit: :q!)
08:18:10*Trustable joined #nim
08:22:57*ndh quit (Quit: Page closed)
08:30:40*yglukhov joined #nim
08:31:32*yglukhov1 joined #nim
08:36:28*rok joined #nim
08:36:47*irrequietus quit (Ping timeout: 258 seconds)
08:36:47*irrequietus_ joined #nim
08:38:08*irrequietus_ quit (Client Quit)
08:41:15*der-landgraf quit (Ping timeout: 264 seconds)
08:41:21*kssreeram quit (Ping timeout: 244 seconds)
08:52:37*hendi__ joined #nim
08:56:42*yglukhov_ joined #nim
08:57:58*irrequietus joined #nim
08:59:03*yglukhov quit (Ping timeout: 240 seconds)
08:59:03*yglukhov1 quit (Ping timeout: 250 seconds)
08:59:54*yglukhov joined #nim
08:59:58*der-landgraf joined #nim
09:06:43*kssreeram joined #nim
09:09:34*rok quit (Quit: rok)
09:13:03*kingofoz quit (Ping timeout: 264 seconds)
09:13:29*kingofoz joined #nim
09:19:17*ephja joined #nim
09:22:00*ofelas joined #nim
09:35:25*endragor quit (Remote host closed the connection)
09:35:49ftsfhmm how do you initialise an array tuples? var foo: array[3, MyColorTuple] = [ (0,0,0), (255,255,255), (123,123,123) ]
09:35:56*kssreeram quit (Read error: Connection reset by peer)
09:37:02*Demon_Fox quit (Quit: Leaving)
09:37:52ArrrrIt isn't working ?
09:40:51ftsf(sorry that's weird, I just wrote that as a simplified version and it works), i'll figure out why the one i'm actually using doesn't
09:42:11ftsfgfx.nim(59, 35) Error: type mismatch: got (Array constructor[0..2, (int, int, int)]) but expected 'array[0..2, MyColorTuple]'
09:42:20ftsftype MyColorTuple* = tuple[r,g,b: uint8]
09:42:32ftsfit works if i use int as the type instead of uint8
09:43:30cheatfateftsf, mark your first item in tuple as 0'u8
09:43:45cheatfateso if you have 255 make it 255'u8
09:44:39ftsfhmm looks like i need to do them all
09:45:31ArrrrYou could write a converter too
09:47:33ftsfoh i see
09:47:39ftsffor the tuple with int to tuple with uint8
09:48:20*kssreeram joined #nim
09:53:42*ldleworker quit (Ping timeout: 250 seconds)
09:54:16AraqArrrr: indeed there have been changes improving C code generation, affecting compile times
10:05:01*filcuc joined #nim
10:07:39*kssreeram quit (Ping timeout: 264 seconds)
10:07:43ArrrrAh, nice, so i was right.
10:13:16*Arrrr quit (Ping timeout: 272 seconds)
10:18:32*endragor joined #nim
10:20:29*kssreeram joined #nim
10:24:33*Arrrr joined #nim
10:24:33*Arrrr quit (Changing host)
10:24:33*Arrrr joined #nim
10:44:49*kssreeram quit (Ping timeout: 258 seconds)
10:45:38*elrood joined #nim
10:49:41*pafmaf joined #nim
10:50:11yglukhov_Can i get total allocated memory size?
10:54:22*kssreeram joined #nim
10:55:14ephjayglukhov: I know there's this http://nim-lang.org/docs/system.html#GC_getStatistics,
11:03:31ephjastatistics gathering for untraced allocations via custom allocators would be neat
11:04:24cheatfateephja, `custom allocators` its alloc, alloc0, allocShared, allocShared0?
11:10:49*nsf quit (Quit: WeeChat 1.5)
11:19:07ephjacheatfate: as in user-defined
11:19:32cheatfateuser-defined must be tracked by user-defined :)
11:20:10ephja?
11:22:14ephjaas in tracking references?
11:24:18*kssreeram quit (Ping timeout: 258 seconds)
11:25:56ephjaone simple approach would be to just log the allocation and then call 'new' for example
11:27:17ephjaadditional information could be passed in order to gather information about different subsystems
11:28:24Araqsystem.getOccupiedMem, getFreeMem, getTotalMem
11:30:18ephjaoh, right
11:32:08ephjahttp://www.ogre3d.org/docs/api/1.8/group___memory.html#ga3211e4a6a806aa789b38dce2432ef472 like this, but a little less retro ;)
11:32:14ephjathere are those macros again
11:37:47*wuehlmaus quit (Quit: Lost terminal)
11:43:34*desophos quit (Read error: Connection reset by peer)
11:57:19*Dall joined #nim
11:58:03Dalldom96: Why did you named the web framework "Jester"?, Are you a bitch or something?
11:58:19DallIt is very clear that the framework is just a joke
11:58:24Dallthe name tells us
11:59:02Arrrrlol, jokes on you
11:59:12dom96I must admit, he did make me laugh.
11:59:17*endragor quit (Read error: Connection reset by peer)
11:59:47*endragor joined #nim
11:59:48AraqRamadan is over and yet the troll remains
12:03:24cheatfatedom96, do you have haters in your university? :)
12:04:02dom96no.
12:04:12*yglukhov_ quit (Ping timeout: 260 seconds)
12:04:27*yglukhov quit (Ping timeout: 276 seconds)
12:04:40cheatfatelooks like you know him in real life, because he is still trying...
12:05:34ArrrrThe think line between love and hate
12:05:44*filcuc quit (Ping timeout: 260 seconds)
12:05:44elroodnah, he's just trolling universially, it's not targetted at dom or anybody in particular
12:06:16elroodi'd take it as a challenge to improve nimbot to handle the nuisance automatically
12:08:00cheatfateelrood, he tries for over the month now, every day...
12:08:06cheatfateits not normal for normal people
12:08:51*wuehlmaus joined #nim
12:08:53cheatfateuntil he is hate somebody, or works for money for some reason, or he is totally mad and somebody needs to turn off internet in his clinic
12:09:17ArrrrMaybe he or she is underaged
12:09:24elrooddon't take it too seriously, he's just a bored spoiled kid
12:10:53cheatfatebored for week or two, but not for 4-5 weeks...
12:13:10elroodit's going to last as long as he gets any attention. the more you talk about him, feed him or let him spam the channel, the longer he's going to stay motivated
12:26:30*filcuc joined #nim
12:30:47*Arrrr quit (Quit: WeeChat 1.4)
12:31:28*irrequietus quit (Ping timeout: 252 seconds)
12:50:36*mtj_ quit (Remote host closed the connection)
13:02:06*yglukhov joined #nim
13:03:20*irrequietus joined #nim
13:07:00*chrisheller joined #nim
13:31:11*Ven joined #nim
13:40:38*mtj_ joined #nim
13:47:20*fvs joined #nim
13:48:33fvshi, what's the nim equivalent of python's string[3:] i.e. to end of string
13:49:48fvsstring[3..string.len()]?
13:52:37kierfvs: string[3..string.len()-1], since indices are always inclusive in Nim
13:52:45kierstring[3..^string.len()] might do the same as well
13:54:13kierwhoops, that should be string[3..<string.len()]
13:54:45ephjastring[3..^1]?
13:54:48ephjashortcut
13:54:57*vendethiel- quit (Ping timeout: 276 seconds)
13:55:03ephjaI think I got it right
13:55:53fvsthanks kier, tut1 shows an example using ^, but with no explanation. How about string[3..^0]?
13:56:35fvs^ = backwards from end of string?
13:56:53kierhuh, didn't know about ^ until today
13:56:56kierhttp://nim-lang.org/docs/system.html#^,int
13:57:13kierlooks like you want ^1, as that'll be rewritten to string.len()-1
13:58:07ephjaok so 0 works too
14:00:46ephjaand arbitrarily long negative numbers
14:01:09elroodas long as you enclose them in parens
14:01:22ephjaor add a space
14:01:58elroodor, just for fun and to be different, simply use the correct ^1 ;)
14:02:37elroodneither of those feels as nice as python's syntax, or D's, for that matter, though
14:04:42ephjait's very lenient. maybe it's a good default
14:08:47ephjait's not like branchless slicing will often be required
14:10:36*BitPuffin|osx joined #nim
14:44:14*fvs left #nim ("ERC (IRC client for Emacs 24.5.1)")
14:50:55*xet7b joined #nim
14:51:21*nd_ quit (Read error: Connection reset by peer)
14:51:50*brson joined #nim
14:52:19*xet7_ quit (Ping timeout: 244 seconds)
14:55:42*hendi__ quit (Ping timeout: 260 seconds)
15:16:03*namnguyen quit (Ping timeout: 250 seconds)
15:21:03*kingofoz quit (Ping timeout: 240 seconds)
15:21:50*kingofoz joined #nim
15:23:09*fastrom joined #nim
15:28:28*namnguyen joined #nim
15:41:50*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:44:18*vendethiel joined #nim
15:49:13*filcuc quit (Read error: Connection reset by peer)
15:55:56*hendi__ joined #nim
16:04:40*Ven joined #nim
16:04:42*Ven quit (Client Quit)
16:44:51*yglukhov quit (Ping timeout: 264 seconds)
16:52:54*endragor quit (Ping timeout: 272 seconds)
16:54:27*brechtm_ quit (Ping timeout: 264 seconds)
17:01:39*_stowa joined #nim
17:02:00*vendethiel quit (Quit: q+)
17:09:42*_stowa quit (K-Lined)
17:10:39*fredrik92 joined #nim
17:22:15*yglukhov joined #nim
17:28:15*fredrik92 quit (Read error: Connection reset by peer)
17:28:44*fredrik92 joined #nim
17:28:51*ofelas quit (Ping timeout: 258 seconds)
17:30:17*hendi__ quit (Ping timeout: 260 seconds)
17:41:25*ofelas joined #nim
18:02:03*ivan2kh joined #nim
18:08:10*chrisheller quit (Remote host closed the connection)
18:10:03*chemist69_ quit (Ping timeout: 264 seconds)
18:11:12ivan2khHi guyz. I have a question. Digging through the macro@
18:12:38ivan2khmacro someMacro(): stmt = template asIs(z:expr) {.immediate.} = var g = z var z1 = getAst(asIs(1+2)) result = result.add(z1).add(z1)
18:13:39ivan2khhttp://pastebin.com/puqxtaDb
18:14:08*TheLemonMan joined #nim
18:14:33ivan2khWhy in macros they construct AST manually? Why can't we use parsed AST like this?
18:23:42TrustableHi all, can someone explain this unexpected execution order? https://gist.github.com/trustable-code/745564faeedd08ffdbaaf5493a7c9934
18:25:07Araqivan2kh: what's the question?
18:25:17Araqyes, you can build ASTs via the API.
18:25:28Araqyou can also template+getAst instead
18:25:30*kssreeram joined #nim
18:26:13AraqTrustable: 'import' is statically resolved so it doesn't matter that it comes after the 'echo'
18:26:54*chemist69_ joined #nim
18:28:02TrustableAraq: how can I force a different execution order?
18:28:35Araqa module's dependencies run before the module, but you can use include instead of import
18:33:50*kssreeram quit (Read error: Connection reset by peer)
18:37:27TrustableAraq: ty, I found a good solution for me: https://gist.github.com/trustable-code/e12c5ccdc5fdbc07d672eb9cd976b120
18:38:24minushey, i was looking for a opengl engine skeleton project (opengl 3+ and preferrably using SDL2), does anyone know if there's something like that? i'd like to avoid bootstrapping my own
18:39:23Araqminus: check Nim's opengl and SDL2 wrappers for examples
18:39:41Araqnote that there are at least 2 different SDL2 wrappers :-)
18:40:38minusokay
18:40:40flyxivan2kh: stuff like this works: https://gist.github.com/flyx/0de2b85e66e47f9588fd4a4bc722d95e
18:41:00flyxno need for template + genAst
18:41:01minusfound one so far, https://github.com/nim-lang/sdl2
18:42:20ephjaflyx: didn't know that
18:44:05Araqephja: as long as quote do doesn't support .dirty vs clean like templates do, I don't advocate 'quote do'
18:44:47ephjayeah it's not that much more concise
18:44:53ephjatemplate expressions would be neat though
18:45:23*nsf joined #nim
18:46:31ephjamore low priority luxuries
18:47:20Araqyup
18:48:36Araqspeaking of luxury
18:48:44Araqdo we want this in system.nim:
18:48:47Araqtemplate `.?`(x: typed; y: untyped): untyped = x[astToStr(y)]
18:49:21Araqpretty sweet for handling json
18:51:59minuswhat does that do?
18:52:19ephjafoo.?bar -> foo["bar"]?
18:52:39ephjahm, is it even binary?
18:53:49minushm, yeah, that'd make sense. what's the 'untyped =' part? also for .? i'd expect nullsafe field access instead
18:53:50*Jesin quit (Quit: Leaving)
18:54:23ephjayep just tested it
18:55:14ephjaminus: that means it can take unresolved expressions
18:56:27ephjawhich 'bar' would be if such a symbol had not been accessible in that scope
18:57:49minusmakes sense
18:58:13ephjaso, what will `` do?
18:58:37minusurxvt doesn't even render that :(
18:59:26ephjaeither find a more complete font or use a fallback that has the Nim crown
18:59:45minusnah, it's not the font, urxvt just sucks
19:00:16ephjaits use should be groundbreaking, and we could produce a keyboard that has such a key
19:00:29ephjaminus: but it's rxvt-unicode, right? oh well :p
19:00:40minusyes
19:00:46kierthe big question is, whereabout on the keyboard would the crown key be placed?
19:00:47minusit doesn't render a lot of code points
19:01:10minusreplace spacebar?
19:01:24kiergood idea
19:01:40kierthough we should also update the language spec to require indentation to be done with crowns rather than spacces
19:01:51minushow many crowns?
19:02:23kierpersonally I think two crowns per indentation level should be sufficient for anyone, but I know some editors default to four
19:02:40minusi was thinking more of like 3
19:02:45minusit's a good compromise
19:03:19kierI'll get started on the pull request to the parser
19:03:34ephjaI knew this would get out of hand
19:03:38minuswhile you're at it, also make it accept tabs
19:03:48kiertabs? do you mean thrones?
19:04:24minusyou know what would be fun for indention? zero-width spaces
19:04:39*kssreeram joined #nim
19:06:17minuswhat's the closest thing to python's decorator syntax and functionality in nim? a custom pragma?
19:07:09*Jesin joined #nim
19:07:31ephjado any languages rely on unicode operators? I've never seen an editor that provides easy access to essential glyphs, and that seems like a necessary prerequisite
19:08:00ephjabut we already have the option of combining several ASCII characters into one operator
19:08:22ldleworkminus: yeah macro pragmas probably
19:18:05minusseems like noone did non-legacy OpenGL in nim yet :(
19:19:24kierephja: APL uses almost entirely non-ASCII characters
19:20:56ldleworkminus: is that your plan? I would love a shadertoy like thing for Nim
19:21:31minusis iq's shadertoy not good enough?
19:21:54minusi wanted to write a particle system for the lulz
19:23:25*Jesin quit (Quit: Leaving)
19:24:13ldleworkminus: the website is cool, but it would be nice to build a nim shader application
19:24:21ldleworkI want to build a cellular automata explorer for example
19:24:59*Jesin joined #nim
19:25:00minuscellular automata, is that something like the game of life?
19:25:12ldleworkyes
19:31:18*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:31:18def-minus: yep, game of life is a CA, but you can do much cooler stuff with CA, including solving the sorting problem in sqrt(n) time
19:31:46minuscrazy
19:32:07ldleworkhere is a continuous automata I wrote in shadertoy last weekend, https://www.shadertoy.com/view/lldGzH
19:32:16minusbut first i need to get vim to load the proper indentation settings for nim files
19:32:38*ivan2kh quit (Ping timeout: 250 seconds)
19:32:39def-minus: like this? https://github.com/zah/nim.vim/
19:33:00minusi have that, but vim still indents using tabs
19:33:54def-oh yeah, nim.vim should override and set noexpandtab
19:34:07minus*expandtab
19:34:11def-yeah^^
19:34:36minusoh nvm, i don't have nim.vim
19:34:45minusconfused it with rust.vim
19:37:23*Mat4 joined #nim
19:37:31Mat4hello
19:37:43minusinstalling alone didn't help, overruling with the filetype thingie did
19:38:38minushello Mat4
19:38:48Mat4hi minus
19:39:02*kssreeram joined #nim
19:42:05*desophos joined #nim
19:44:08minusdef-: there doesn't happen to be some sort of autocompleter? i'd /love/ to have some suggestion and parameter docs on those opengl functions
19:45:33*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:46:24*kssreeram joined #nim
19:49:49def-minus: there is a way to use ctags, but I haven't tried it yet. an alternative is basing it on the compiler's nimsuggest directly, which also was a WIP last I checked
19:50:08def-https://bitbucket.org/nimcontrib/ntags
19:50:19def-https://github.com/baabelfish/nvim-nim
19:52:06ephjacan all the available symbols be retrieved?
19:52:32minushooking into the compiler seems like the right way
19:52:33*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:56:21*kingofoz quit (Ping timeout: 276 seconds)
19:57:21*kingofoz joined #nim
19:57:40*kssreeram joined #nim
19:57:57*Matthias247 joined #nim
20:02:48*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:07:20*kssreeram joined #nim
20:13:28*kssreeram quit (Ping timeout: 252 seconds)
20:18:27minuswow, a call to glGetError after every API call, great
20:18:43minusmaking it do that is basically impossible in C(++)
20:28:02*kssreeram joined #nim
20:28:52*kssreeram quit (Client Quit)
20:31:28*kssreeram joined #nim
20:34:48*cheatfate quit (Read error: Connection reset by peer)
20:46:38*kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…)
20:48:32*tinAndi joined #nim
20:51:59*cheatfate joined #nim
20:54:21*cheatfate_ joined #nim
20:54:22*cheatfate quit (Read error: Connection reset by peer)
20:55:02minushttps://sr.ht/1LLZ.txt how do i do this correctly in nim, specifically glShaderSource's third argument and glGetShaderInfoLog
20:55:19*cheatfate_ quit (Read error: Connection reset by peer)
20:55:39*cheatfate_ joined #nim
20:55:43def-minus: are you writing a wrapper or using one? (which one?)
20:55:53minususing one
20:57:33minusthe opengl wrapper, there's just one (at least by that name)
20:58:20def-it seems to take a cstringArray as 3rd param for glShaderSource, so you could use system.allocCStringArray
20:58:31minusurgh
20:58:40def-or some cast
20:58:43minusand allocCString for the other call
20:58:54def-because allocating something all the time is probably not what you want
20:59:00ldlework:)
20:59:06*ldlework remembers his biome generator
20:59:13ldleworkand the like 3000% speedup
21:00:18minuswell, this happens once when the shaders are loaded, so allocing doesn't dent performance
21:00:36def-cast[cstringArray](addr cstring(myString)) or something
21:01:01*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
21:01:27minusthanks
21:02:21def-glGetShaderInfoLog(vertex_shader, buf.len, nil, buf), maybe with some explicit int type conversions to GLsizei
21:02:22*fastrom quit (Read error: Connection reset by peer)
21:02:49def-would of course all be nicer if it was a high level library using regular nim types instead of C stuff
21:03:12minuswell, it's autogenerated, would be a lot of work otherwise
21:03:26minushow do i allocate buf?
21:03:51Araqquick, what's the better error message
21:04:00Araq"1st argument is immutable"
21:04:03Araqor
21:04:13Araq"for a 'var' type a variable needs to be passed"?
21:04:14def-on the stack like in your example: var buf: array[4096, char]
21:04:52minusthanks
21:05:04def-Araq: I prefer the 2nd
21:05:18def-because it doesn't just tell you what's wrong, but also what you should change to make it right
21:05:24Araqhmm maybe combine them?
21:05:30minus"first argument must not be immutable"?
21:06:03Araq"for a 'var' type a variable needs to be passed, but first argument is immutable" ?
21:06:10def-and great that we're getting a new error message for this, stumbled upon it a few times
21:07:01Araqyeah but in my defense: the error used to be good and then we got overloading by 'var T' ;-)
21:07:23Araqand more general solutions usually imply worse error messages
21:07:29def-yep
21:07:50Mat4Araq: The second error message
21:07:53def-the combination sounds fine to me
21:09:47ephja*the first argument?
21:19:42minushow do i print this array[4096, char]; i guess i should first interpret it as c string?
21:20:15def-or define `$` for array[N, char]
21:20:24def-but you can also cast it, yeah
21:20:32minusoh, casting works?
21:20:46def-actually, can't you just print it?
21:20:54def-"echo buf" works for me
21:21:22minus echo "Shader compilation error: " & buf
21:21:24minusdoesn't
21:21:33def-, instead of &
21:21:50def-or: echo("foo" & buf)
21:21:59def-but echo already concatenates all parameters automatically
21:22:12minusah, , works
21:23:24minusdef- │ or: echo("foo" & buf) ← doesn't work because & doesn't work for those types: Error: type mismatch: got (string, array[0..4095, char])
21:23:47def-$buf helps
21:24:05minusoh, there's that too
21:24:05def-but with & you have to do it manually, while echo applies $ on every parameter already
21:25:26ephjadef-: YES, `$` for arrays
21:25:39ephjano more unnecessary errors :p
21:26:36*tinAndi quit (Quit: ChatZilla 0.9.92 [Firefox 47.0/20160604131506])
21:28:39minuswoot, it compiles… and segfaults
21:30:32def-derefencing null pointer?
21:30:43def-there should be an error if you compile without -d:release
21:30:52*fastrom joined #nim
21:31:16dom96'not nil' should be default instead
21:31:18minusgdb isn't helpful :/
21:31:28def-you need --debugger:native for gdb
21:32:29dom96Anybody looking for something quick to write (port from another language) in Nim?
21:34:27cheatfate_dom96, why you are asking? just show us whole list please
21:34:34minus shader.glShaderSource(1, cast[cstringArray](cstring(source)), nil)
21:34:49def-minus: yep, you're derefencing badly with the cast
21:34:52minusseems like that cast doesn't create a char**
21:35:03def-minus: cast[cstringArray](addr cstring(source))
21:35:08dom96cheatfate_: I don't have a "list", I have a specific project in mind: porting this to Nim https://github.com/crystal-lang/crystal-website/blob/master/scripts/bountysource.cr
21:35:10minusdoesn't compile that way
21:35:17minusError: expression has no address
21:35:46*fredrik92 quit (Quit: Shutting down . . .)
21:36:20*cheatfate_ is now known as cheatfate
21:36:28dom96minus: 'source' isn't defined as 'var'?
21:36:39def-dom96: cstring returns a non-var I belive
21:36:46minusit is: var source = source_file.readFile
21:36:46ephjavar sourceArr = allocCStringArray([source]) # glShaderSource result, 1, sourceArr, nil # deallocCStringArray(sourceArr)
21:36:50ephjathat's what I did
21:37:08minusyeah, i need memory to store a pointer in
21:37:16cheatfatedom96, i think this is 15 minutes of work for your httpclient
21:37:30def-minus: yup, so var x = addr source[0], and then pass cast[cstringArray](addr x)
21:37:35dom96cheatfate: are you volunteering?
21:37:44cheatfatenope
21:38:08cheatfatei think i'm already volunteering...
21:38:17minusallocCStringArray needs to be manually freed?
21:38:35dom96minus: yep
21:38:49def-oh, a cstring array should probably end with a '\0'
21:40:01dom96You might be able to just write: cast[cstringArray](addr source[0])
21:40:17def-dom96: nope, need one addr more
21:40:46ephjause unsafeAddr if it's not a var
21:41:18ephjaand no mutations should occur, of course
21:42:11def-var x = [addr source[0], nil]; cast[cstringArray](addr x)
21:42:15dom96def-: ahh, you're right.
21:42:27minus var sourcePtr = addr source[0]
21:42:30minus shader.glShaderSource(1, cast[cstringArray](addr sourcePtr), nil)
21:42:31minusworks like that fwiw
21:43:02def-minus: it might work out of luck. if it's a cstring array it might read params from it until null pointer is encountered
21:43:04minusif i readFile i get a string, right? is that already null terminated?
21:43:13def-yes
21:43:17minusokay
21:43:27def-strings in nim have a length field and are null-terminated for c interop
21:43:33*Mat4 left #nim (#nim)
21:43:36minusexcellent
21:44:16minusactually there is no null pointer required to terminate the list; the count is the argument before
21:44:29def-ok
21:47:32minusshaders compile now, no more crash :)
21:48:30*ephja quit ()
21:51:33dom96I'm afraid that it looks like Chapter 10 (Direct Hardware Control) won't make it into Nim in Action :\
21:52:00dom96But I will write an article about it instead :)
21:55:53*pafmaf quit (Read error: Connection reset by peer)
21:55:56cheatfatedom96, and what you calling Direct Hardware Control?
21:56:41dom96cheatfate: embedded hardware, for example Nim on Arduino.
22:11:18minusunfortunately nim doesn't help with setting metric fuckloads of registers
22:12:03def-minus: want to share the code?
22:13:20minusdef-: it's not complete yet, still misses linking the shader program, binding of the shader vars, loading geometry and rendering it
22:13:30minusOpenGL is hard ._.
22:14:01def-maybe I can think of a way to help with setting registers, just not sure what you mean exactly by it
22:18:58minusoh, i was referring to nim on arduino
22:19:29cheatfateAraq, closure's environment variable created at first call to parent function?
22:19:40def-ok, I thought so at first
22:19:40*Ven joined #nim
22:20:20cheatfatei mean newObj()
22:20:39*fastrom quit (Ping timeout: 276 seconds)
22:23:02*icebattle joined #nim
22:26:13Araqcheatfate: yes
22:26:37Araqkind of. I think you mean the correct thing.
22:31:38*chrisheller joined #nim
22:33:58cheatfateAraq, i'm just think if i pass pointer to function which has closure inside to other thread... and other thread will call it, then environment will be allocated in thread's memory
22:34:32cheatfateso if i have N threads and all threads will have their own environment
22:34:42cheatfatefor this function
22:35:23Araqshouldn't the compiler prevent this?
22:36:04*Ven quit (Read error: Connection reset by peer)
22:36:32*Ven joined #nim
22:36:39cheatfatehow?
22:37:12cheatfatei'm just thinking how my middlewares will be distributed between threads and do i need protect/dispose
22:37:19cheatfateor not
22:39:13*Ven quit (Client Quit)
22:41:04Araqyou do.
22:41:13minusdef-: nim-lang/sdl2 has no license fyi
22:42:02def-I dislike licenses, but thanks, will add. should be MIT
22:42:30def-actually, do other nim-lang repos have licenses?
22:43:19minusif you don't want companies to work with it then don't add one. because not having one is a huge legal threat
22:43:54minusnimble has one
22:44:07Araqmost have, I hope
22:44:12def-i know, I checked a few, seems to be missing in quite some
22:44:51*elrood quit (Quit: Leaving)
22:52:13minusdef-: pushed what i have so far: https://git.mnus.de/minus/nim-sdl2-opengl3
22:55:32*Trustable quit (Remote host closed the connection)
22:55:35def-minus: the 0 at the end of build_shader_program is useless btw
22:55:44def-the result is auto-initialized to binary zero
22:55:47*Matthias247 quit (Read error: Connection reset by peer)
22:55:53minusoh, i know
22:56:08minusi copy copypastad those shaders from an old project
22:59:41*fastrom joined #nim
23:02:14*fastrom quit (Client Quit)
23:04:55Xedom96: https://github.com/Xe/PonyAPI/commit/a020f0cede3ed1ecdc0f14178dd96f84d7688bfe find the bug
23:05:02Xex.x
23:05:48dom96yep, didn't I link you to that? How did this happen?
23:07:01Araqproper typing would have caught it, as always
23:07:15Araq"application/json" should be instead an enum
23:07:37Xedom96: it used to be a table of headers
23:07:51Xe/that/ worked
23:08:27Araqofc some smartass will come along and say "you cannot cover all file types"
23:09:17dom96Xe: huh, so what broke it?
23:09:48Xedom96: https://github.com/Xe/PonyAPI/commit/a669ee201826e1b8075a90c44224f0dc4210199c
23:11:12dom96Good, so it's not really my fault :P
23:13:31Xedom96: the api works normally now
23:13:55Xes
23:18:27*RushPL quit (Ping timeout: 264 seconds)
23:19:55dyce_would be cool if we can get Nim on here: http://benchmarksgame.alioth.debian.org
23:25:22*RushPL joined #nim
23:33:40*irrequietus quit ()
23:38:27dom96dyce_: http://benchmarksgame.alioth.debian.org/play.html#languagex
23:41:10dyce_oops
23:42:25dom96we just need to make Nim more popular :)