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:44 | ftsf_ | 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:21 | ndh | is 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:37 | endragor | ndh: use error pragma |
06:41:54 | endragor | ndh: http://nim-lang.org/docs/manual.html#pragmas-error-pragma |
06:43:14 | ndh | ah! fatal is the one i think |
06:43:48 | ndh | wait. how do you use the error pragma with a message? |
06:43:57 | ndh | why is there no example |
06:45:22 | flyx | {. fatal: "your error message" .} |
06:45:56 | ndh | ok, fatal works, thank you guys! |
06:48:32 | endragor | error 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:33 | ndh | endragor: when i use the error pragma it says `Error: invalid pragma: error: "not implemented"` |
06:51:54 | ndh | when i use fatal it says `Error: not allowed` |
06:52:41 | endragor | ndh: do you use it the same way? {.error: "An error has occurred".} works well for me. |
06:53:33 | ndh | yes, i just replace fatal with error |
06:54:11 | ndh | huh |
06:54:22 | ndh | i use it in a proc |
06:54:35 | ndh | there's a difference when i use it top level |
06:56:43 | ndh | when i use {.error: "".} in a proc it says `invalid pragma` |
06:57:12 | endragor | ndh: indeed. Looks like a bug to me. .warning pragma works as intended both inside and outside procs. |
06:57:28 | ndh | anyways. is there a way to compile a file or string as nim and then access the AST? |
06:57:45 | ndh | endragor: yea seems like it |
06:58:52 | endragor | ndh: compile-time or run-time? |
06:59:00 | ndh | run-time |
07:00:54 | endragor | use 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:23 | ndh | ok, 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:45 | ndh | why 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:53 | ndh | nvm ._. |
07:57:00 | ndh | still 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:50 | flyx | it sure seems strange, the first call should lead to the same error. |
08:05:29 | flyx | are you sure you had the "test" in the first call? |
08:08:39 | ndh | yes i'm sure |
08:09:30 | ndh | it even produced the output i was expecting, as if jtest was a JObject |
08:09:54 | ndh | i'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:49 | ftsf | hmm 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:52 | Arrrr | It isn't working ? |
09:40:51 | ftsf | (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:11 | ftsf | gfx.nim(59, 35) Error: type mismatch: got (Array constructor[0..2, (int, int, int)]) but expected 'array[0..2, MyColorTuple]' |
09:42:20 | ftsf | type MyColorTuple* = tuple[r,g,b: uint8] |
09:42:32 | ftsf | it works if i use int as the type instead of uint8 |
09:43:30 | cheatfate | ftsf, mark your first item in tuple as 0'u8 |
09:43:45 | cheatfate | so if you have 255 make it 255'u8 |
09:44:39 | ftsf | hmm looks like i need to do them all |
09:45:31 | Arrrr | You could write a converter too |
09:47:33 | ftsf | oh i see |
09:47:39 | ftsf | for 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:16 | Araq | Arrrr: 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:43 | Arrrr | Ah, 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:11 | yglukhov_ | Can i get total allocated memory size? |
10:54:22 | * | kssreeram joined #nim |
10:55:14 | ephja | yglukhov: I know there's this http://nim-lang.org/docs/system.html#GC_getStatistics, |
11:03:31 | ephja | statistics gathering for untraced allocations via custom allocators would be neat |
11:04:24 | cheatfate | ephja, `custom allocators` its alloc, alloc0, allocShared, allocShared0? |
11:10:49 | * | nsf quit (Quit: WeeChat 1.5) |
11:19:07 | ephja | cheatfate: as in user-defined |
11:19:32 | cheatfate | user-defined must be tracked by user-defined :) |
11:20:10 | ephja | ? |
11:22:14 | ephja | as in tracking references? |
11:24:18 | * | kssreeram quit (Ping timeout: 258 seconds) |
11:25:56 | ephja | one simple approach would be to just log the allocation and then call 'new' for example |
11:27:17 | ephja | additional information could be passed in order to gather information about different subsystems |
11:28:24 | Araq | system.getOccupiedMem, getFreeMem, getTotalMem |
11:30:18 | ephja | oh, right |
11:32:08 | ephja | http://www.ogre3d.org/docs/api/1.8/group___memory.html#ga3211e4a6a806aa789b38dce2432ef472 like this, but a little less retro ;) |
11:32:14 | ephja | there 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:03 | Dall | dom96: Why did you named the web framework "Jester"?, Are you a bitch or something? |
11:58:19 | Dall | It is very clear that the framework is just a joke |
11:58:24 | Dall | the name tells us |
11:59:02 | Arrrr | lol, jokes on you |
11:59:12 | dom96 | I 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:48 | Araq | Ramadan is over and yet the troll remains |
12:03:24 | cheatfate | dom96, do you have haters in your university? :) |
12:04:02 | dom96 | no. |
12:04:12 | * | yglukhov_ quit (Ping timeout: 260 seconds) |
12:04:27 | * | yglukhov quit (Ping timeout: 276 seconds) |
12:04:40 | cheatfate | looks like you know him in real life, because he is still trying... |
12:05:34 | Arrrr | The think line between love and hate |
12:05:44 | * | filcuc quit (Ping timeout: 260 seconds) |
12:05:44 | elrood | nah, he's just trolling universially, it's not targetted at dom or anybody in particular |
12:06:16 | elrood | i'd take it as a challenge to improve nimbot to handle the nuisance automatically |
12:08:00 | cheatfate | elrood, he tries for over the month now, every day... |
12:08:06 | cheatfate | its not normal for normal people |
12:08:51 | * | wuehlmaus joined #nim |
12:08:53 | cheatfate | until 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:17 | Arrrr | Maybe he or she is underaged |
12:09:24 | elrood | don't take it too seriously, he's just a bored spoiled kid |
12:10:53 | cheatfate | bored for week or two, but not for 4-5 weeks... |
12:13:10 | elrood | it'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:33 | fvs | hi, what's the nim equivalent of python's string[3:] i.e. to end of string |
13:49:48 | fvs | string[3..string.len()]? |
13:52:37 | kier | fvs: string[3..string.len()-1], since indices are always inclusive in Nim |
13:52:45 | kier | string[3..^string.len()] might do the same as well |
13:54:13 | kier | whoops, that should be string[3..<string.len()] |
13:54:45 | ephja | string[3..^1]? |
13:54:48 | ephja | shortcut |
13:54:57 | * | vendethiel- quit (Ping timeout: 276 seconds) |
13:55:03 | ephja | I think I got it right |
13:55:53 | fvs | thanks kier, tut1 shows an example using ^, but with no explanation. How about string[3..^0]? |
13:56:35 | fvs | ^ = backwards from end of string? |
13:56:53 | kier | huh, didn't know about ^ until today |
13:56:56 | kier | http://nim-lang.org/docs/system.html#^,int |
13:57:13 | kier | looks like you want ^1, as that'll be rewritten to string.len()-1 |
13:58:07 | ephja | ok so 0 works too |
14:00:46 | ephja | and arbitrarily long negative numbers |
14:01:09 | elrood | as long as you enclose them in parens |
14:01:22 | ephja | or add a space |
14:01:58 | elrood | or, just for fun and to be different, simply use the correct ^1 ;) |
14:02:37 | elrood | neither of those feels as nice as python's syntax, or D's, for that matter, though |
14:04:42 | ephja | it's very lenient. maybe it's a good default |
14:08:47 | ephja | it'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:12 | ivan2kh | Hi guyz. I have a question. Digging through the macro@ |
18:12:38 | ivan2kh | macro someMacro(): stmt = template asIs(z:expr) {.immediate.} = var g = z var z1 = getAst(asIs(1+2)) result = result.add(z1).add(z1) |
18:13:39 | ivan2kh | http://pastebin.com/puqxtaDb |
18:14:08 | * | TheLemonMan joined #nim |
18:14:33 | ivan2kh | Why in macros they construct AST manually? Why can't we use parsed AST like this? |
18:23:42 | Trustable | Hi all, can someone explain this unexpected execution order? https://gist.github.com/trustable-code/745564faeedd08ffdbaaf5493a7c9934 |
18:25:07 | Araq | ivan2kh: what's the question? |
18:25:17 | Araq | yes, you can build ASTs via the API. |
18:25:28 | Araq | you can also template+getAst instead |
18:25:30 | * | kssreeram joined #nim |
18:26:13 | Araq | Trustable: 'import' is statically resolved so it doesn't matter that it comes after the 'echo' |
18:26:54 | * | chemist69_ joined #nim |
18:28:02 | Trustable | Araq: how can I force a different execution order? |
18:28:35 | Araq | a 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:27 | Trustable | Araq: ty, I found a good solution for me: https://gist.github.com/trustable-code/e12c5ccdc5fdbc07d672eb9cd976b120 |
18:38:24 | minus | hey, 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:23 | Araq | minus: check Nim's opengl and SDL2 wrappers for examples |
18:39:41 | Araq | note that there are at least 2 different SDL2 wrappers :-) |
18:40:38 | minus | okay |
18:40:40 | flyx | ivan2kh: stuff like this works: https://gist.github.com/flyx/0de2b85e66e47f9588fd4a4bc722d95e |
18:41:00 | flyx | no need for template + genAst |
18:41:01 | minus | found one so far, https://github.com/nim-lang/sdl2 |
18:42:20 | ephja | flyx: didn't know that |
18:44:05 | Araq | ephja: as long as quote do doesn't support .dirty vs clean like templates do, I don't advocate 'quote do' |
18:44:47 | ephja | yeah it's not that much more concise |
18:44:53 | ephja | template expressions would be neat though |
18:45:23 | * | nsf joined #nim |
18:46:31 | ephja | more low priority luxuries |
18:47:20 | Araq | yup |
18:48:36 | Araq | speaking of luxury |
18:48:44 | Araq | do we want this in system.nim: |
18:48:47 | Araq | template `.?`(x: typed; y: untyped): untyped = x[astToStr(y)] |
18:49:21 | Araq | pretty sweet for handling json |
18:51:59 | minus | what does that do? |
18:52:19 | ephja | foo.?bar -> foo["bar"]? |
18:52:39 | ephja | hm, is it even binary? |
18:53:49 | minus | hm, 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:23 | ephja | yep just tested it |
18:55:14 | ephja | minus: that means it can take unresolved expressions |
18:56:27 | ephja | which 'bar' would be if such a symbol had not been accessible in that scope |
18:57:49 | minus | makes sense |
18:58:13 | ephja | so, what will `` do? |
18:58:37 | minus | urxvt doesn't even render that :( |
18:59:26 | ephja | either find a more complete font or use a fallback that has the Nim crown |
18:59:45 | minus | nah, it's not the font, urxvt just sucks |
19:00:16 | ephja | its use should be groundbreaking, and we could produce a keyboard that has such a key |
19:00:29 | ephja | minus: but it's rxvt-unicode, right? oh well :p |
19:00:40 | minus | yes |
19:00:46 | kier | the big question is, whereabout on the keyboard would the crown key be placed? |
19:00:47 | minus | it doesn't render a lot of code points |
19:01:10 | minus | replace spacebar? |
19:01:24 | kier | good idea |
19:01:40 | kier | though we should also update the language spec to require indentation to be done with crowns rather than spacces |
19:01:51 | minus | how many crowns? |
19:02:23 | kier | personally I think two crowns per indentation level should be sufficient for anyone, but I know some editors default to four |
19:02:40 | minus | i was thinking more of like 3 |
19:02:45 | minus | it's a good compromise |
19:03:19 | kier | I'll get started on the pull request to the parser |
19:03:34 | ephja | I knew this would get out of hand |
19:03:38 | minus | while you're at it, also make it accept tabs |
19:03:48 | kier | tabs? do you mean thrones? |
19:04:24 | minus | you know what would be fun for indention? zero-width spaces |
19:04:39 | * | kssreeram joined #nim |
19:06:17 | minus | what's the closest thing to python's decorator syntax and functionality in nim? a custom pragma? |
19:07:09 | * | Jesin joined #nim |
19:07:31 | ephja | do 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:00 | ephja | but we already have the option of combining several ASCII characters into one operator |
19:08:22 | ldlework | minus: yeah macro pragmas probably |
19:18:05 | minus | seems like noone did non-legacy OpenGL in nim yet :( |
19:19:24 | kier | ephja: APL uses almost entirely non-ASCII characters |
19:20:56 | ldlework | minus: is that your plan? I would love a shadertoy like thing for Nim |
19:21:31 | minus | is iq's shadertoy not good enough? |
19:21:54 | minus | i wanted to write a particle system for the lulz |
19:23:25 | * | Jesin quit (Quit: Leaving) |
19:24:13 | ldlework | minus: the website is cool, but it would be nice to build a nim shader application |
19:24:21 | ldlework | I want to build a cellular automata explorer for example |
19:24:59 | * | Jesin joined #nim |
19:25:00 | minus | cellular automata, is that something like the game of life? |
19:25:12 | ldlework | yes |
19:31:18 | * | kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
19:31:18 | def- | 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:46 | minus | crazy |
19:32:07 | ldlework | here is a continuous automata I wrote in shadertoy last weekend, https://www.shadertoy.com/view/lldGzH |
19:32:16 | minus | but 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:39 | def- | minus: like this? https://github.com/zah/nim.vim/ |
19:33:00 | minus | i have that, but vim still indents using tabs |
19:33:54 | def- | oh yeah, nim.vim should override and set noexpandtab |
19:34:07 | minus | *expandtab |
19:34:11 | def- | yeah^^ |
19:34:36 | minus | oh nvm, i don't have nim.vim |
19:34:45 | minus | confused it with rust.vim |
19:37:23 | * | Mat4 joined #nim |
19:37:31 | Mat4 | hello |
19:37:43 | minus | installing alone didn't help, overruling with the filetype thingie did |
19:38:38 | minus | hello Mat4 |
19:38:48 | Mat4 | hi minus |
19:39:02 | * | kssreeram joined #nim |
19:42:05 | * | desophos joined #nim |
19:44:08 | minus | def-: 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:49 | def- | 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:08 | def- | https://bitbucket.org/nimcontrib/ntags |
19:50:19 | def- | https://github.com/baabelfish/nvim-nim |
19:52:06 | ephja | can all the available symbols be retrieved? |
19:52:32 | minus | hooking 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:27 | minus | wow, a call to glGetError after every API call, great |
20:18:43 | minus | making 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:02 | minus | https://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:43 | def- | minus: are you writing a wrapper or using one? (which one?) |
20:55:53 | minus | using one |
20:57:33 | minus | the opengl wrapper, there's just one (at least by that name) |
20:58:20 | def- | it seems to take a cstringArray as 3rd param for glShaderSource, so you could use system.allocCStringArray |
20:58:31 | minus | urgh |
20:58:40 | def- | or some cast |
20:58:43 | minus | and allocCString for the other call |
20:58:54 | def- | because allocating something all the time is probably not what you want |
20:59:00 | ldlework | :) |
20:59:06 | * | ldlework remembers his biome generator |
20:59:13 | ldlework | and the like 3000% speedup |
21:00:18 | minus | well, this happens once when the shaders are loaded, so allocing doesn't dent performance |
21:00:36 | def- | cast[cstringArray](addr cstring(myString)) or something |
21:01:01 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
21:01:27 | minus | thanks |
21:02:21 | def- | 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:49 | def- | would of course all be nicer if it was a high level library using regular nim types instead of C stuff |
21:03:12 | minus | well, it's autogenerated, would be a lot of work otherwise |
21:03:26 | minus | how do i allocate buf? |
21:03:51 | Araq | quick, what's the better error message |
21:04:00 | Araq | "1st argument is immutable" |
21:04:03 | Araq | or |
21:04:13 | Araq | "for a 'var' type a variable needs to be passed"? |
21:04:14 | def- | on the stack like in your example: var buf: array[4096, char] |
21:04:52 | minus | thanks |
21:05:04 | def- | Araq: I prefer the 2nd |
21:05:18 | def- | because it doesn't just tell you what's wrong, but also what you should change to make it right |
21:05:24 | Araq | hmm maybe combine them? |
21:05:30 | minus | "first argument must not be immutable"? |
21:06:03 | Araq | "for a 'var' type a variable needs to be passed, but first argument is immutable" ? |
21:06:10 | def- | and great that we're getting a new error message for this, stumbled upon it a few times |
21:07:01 | Araq | yeah but in my defense: the error used to be good and then we got overloading by 'var T' ;-) |
21:07:23 | Araq | and more general solutions usually imply worse error messages |
21:07:29 | def- | yep |
21:07:50 | Mat4 | Araq: The second error message |
21:07:53 | def- | the combination sounds fine to me |
21:09:47 | ephja | *the first argument? |
21:19:42 | minus | how do i print this array[4096, char]; i guess i should first interpret it as c string? |
21:20:15 | def- | or define `$` for array[N, char] |
21:20:24 | def- | but you can also cast it, yeah |
21:20:32 | minus | oh, casting works? |
21:20:46 | def- | actually, can't you just print it? |
21:20:54 | def- | "echo buf" works for me |
21:21:22 | minus | echo "Shader compilation error: " & buf |
21:21:24 | minus | doesn't |
21:21:33 | def- | , instead of & |
21:21:50 | def- | or: echo("foo" & buf) |
21:21:59 | def- | but echo already concatenates all parameters automatically |
21:22:12 | minus | ah, , works |
21:23:24 | minus | def- │ 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:47 | def- | $buf helps |
21:24:05 | minus | oh, there's that too |
21:24:05 | def- | but with & you have to do it manually, while echo applies $ on every parameter already |
21:25:26 | ephja | def-: YES, `$` for arrays |
21:25:39 | ephja | no more unnecessary errors :p |
21:26:36 | * | tinAndi quit (Quit: ChatZilla 0.9.92 [Firefox 47.0/20160604131506]) |
21:28:39 | minus | woot, it compiles… and segfaults |
21:30:32 | def- | derefencing null pointer? |
21:30:43 | def- | there should be an error if you compile without -d:release |
21:30:52 | * | fastrom joined #nim |
21:31:16 | dom96 | 'not nil' should be default instead |
21:31:18 | minus | gdb isn't helpful :/ |
21:31:28 | def- | you need --debugger:native for gdb |
21:32:29 | dom96 | Anybody looking for something quick to write (port from another language) in Nim? |
21:34:27 | cheatfate_ | dom96, why you are asking? just show us whole list please |
21:34:34 | minus | shader.glShaderSource(1, cast[cstringArray](cstring(source)), nil) |
21:34:49 | def- | minus: yep, you're derefencing badly with the cast |
21:34:52 | minus | seems like that cast doesn't create a char** |
21:35:03 | def- | minus: cast[cstringArray](addr cstring(source)) |
21:35:08 | dom96 | cheatfate_: 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:10 | minus | doesn't compile that way |
21:35:17 | minus | Error: expression has no address |
21:35:46 | * | fredrik92 quit (Quit: Shutting down . . .) |
21:36:20 | * | cheatfate_ is now known as cheatfate |
21:36:28 | dom96 | minus: 'source' isn't defined as 'var'? |
21:36:39 | def- | dom96: cstring returns a non-var I belive |
21:36:46 | minus | it is: var source = source_file.readFile |
21:36:46 | ephja | var sourceArr = allocCStringArray([source]) # glShaderSource result, 1, sourceArr, nil # deallocCStringArray(sourceArr) |
21:36:50 | ephja | that's what I did |
21:37:08 | minus | yeah, i need memory to store a pointer in |
21:37:16 | cheatfate | dom96, i think this is 15 minutes of work for your httpclient |
21:37:30 | def- | minus: yup, so var x = addr source[0], and then pass cast[cstringArray](addr x) |
21:37:35 | dom96 | cheatfate: are you volunteering? |
21:37:44 | cheatfate | nope |
21:38:08 | cheatfate | i think i'm already volunteering... |
21:38:17 | minus | allocCStringArray needs to be manually freed? |
21:38:35 | dom96 | minus: yep |
21:38:49 | def- | oh, a cstring array should probably end with a '\0' |
21:40:01 | dom96 | You might be able to just write: cast[cstringArray](addr source[0]) |
21:40:17 | def- | dom96: nope, need one addr more |
21:40:46 | ephja | use unsafeAddr if it's not a var |
21:41:18 | ephja | and no mutations should occur, of course |
21:42:11 | def- | var x = [addr source[0], nil]; cast[cstringArray](addr x) |
21:42:15 | dom96 | def-: ahh, you're right. |
21:42:27 | minus | var sourcePtr = addr source[0] |
21:42:30 | minus | shader.glShaderSource(1, cast[cstringArray](addr sourcePtr), nil) |
21:42:31 | minus | works like that fwiw |
21:43:02 | def- | 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:04 | minus | if i readFile i get a string, right? is that already null terminated? |
21:43:13 | def- | yes |
21:43:17 | minus | okay |
21:43:27 | def- | strings in nim have a length field and are null-terminated for c interop |
21:43:33 | * | Mat4 left #nim (#nim) |
21:43:36 | minus | excellent |
21:44:16 | minus | actually there is no null pointer required to terminate the list; the count is the argument before |
21:44:29 | def- | ok |
21:47:32 | minus | shaders compile now, no more crash :) |
21:48:30 | * | ephja quit () |
21:51:33 | dom96 | I'm afraid that it looks like Chapter 10 (Direct Hardware Control) won't make it into Nim in Action :\ |
21:52:00 | dom96 | But I will write an article about it instead :) |
21:55:53 | * | pafmaf quit (Read error: Connection reset by peer) |
21:55:56 | cheatfate | dom96, and what you calling Direct Hardware Control? |
21:56:41 | dom96 | cheatfate: embedded hardware, for example Nim on Arduino. |
22:11:18 | minus | unfortunately nim doesn't help with setting metric fuckloads of registers |
22:12:03 | def- | minus: want to share the code? |
22:13:20 | minus | def-: it's not complete yet, still misses linking the shader program, binding of the shader vars, loading geometry and rendering it |
22:13:30 | minus | OpenGL is hard ._. |
22:14:01 | def- | maybe I can think of a way to help with setting registers, just not sure what you mean exactly by it |
22:18:58 | minus | oh, i was referring to nim on arduino |
22:19:29 | cheatfate | Araq, closure's environment variable created at first call to parent function? |
22:19:40 | def- | ok, I thought so at first |
22:19:40 | * | Ven joined #nim |
22:20:20 | cheatfate | i mean newObj() |
22:20:39 | * | fastrom quit (Ping timeout: 276 seconds) |
22:23:02 | * | icebattle joined #nim |
22:26:13 | Araq | cheatfate: yes |
22:26:37 | Araq | kind of. I think you mean the correct thing. |
22:31:38 | * | chrisheller joined #nim |
22:33:58 | cheatfate | Araq, 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:32 | cheatfate | so if i have N threads and all threads will have their own environment |
22:34:42 | cheatfate | for this function |
22:35:23 | Araq | shouldn't the compiler prevent this? |
22:36:04 | * | Ven quit (Read error: Connection reset by peer) |
22:36:32 | * | Ven joined #nim |
22:36:39 | cheatfate | how? |
22:37:12 | cheatfate | i'm just thinking how my middlewares will be distributed between threads and do i need protect/dispose |
22:37:19 | cheatfate | or not |
22:39:13 | * | Ven quit (Client Quit) |
22:41:04 | Araq | you do. |
22:41:13 | minus | def-: nim-lang/sdl2 has no license fyi |
22:42:02 | def- | I dislike licenses, but thanks, will add. should be MIT |
22:42:30 | def- | actually, do other nim-lang repos have licenses? |
22:43:19 | minus | if 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:54 | minus | nimble has one |
22:44:07 | Araq | most have, I hope |
22:44:12 | def- | i know, I checked a few, seems to be missing in quite some |
22:44:51 | * | elrood quit (Quit: Leaving) |
22:52:13 | minus | def-: 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:35 | def- | minus: the 0 at the end of build_shader_program is useless btw |
22:55:44 | def- | the result is auto-initialized to binary zero |
22:55:47 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:55:53 | minus | oh, i know |
22:56:08 | minus | i copy copypastad those shaders from an old project |
22:59:41 | * | fastrom joined #nim |
23:02:14 | * | fastrom quit (Client Quit) |
23:04:55 | Xe | dom96: https://github.com/Xe/PonyAPI/commit/a020f0cede3ed1ecdc0f14178dd96f84d7688bfe find the bug |
23:05:02 | Xe | x.x |
23:05:48 | dom96 | yep, didn't I link you to that? How did this happen? |
23:07:01 | Araq | proper typing would have caught it, as always |
23:07:15 | Araq | "application/json" should be instead an enum |
23:07:37 | Xe | dom96: it used to be a table of headers |
23:07:51 | Xe | /that/ worked |
23:08:27 | Araq | ofc some smartass will come along and say "you cannot cover all file types" |
23:09:17 | dom96 | Xe: huh, so what broke it? |
23:09:48 | Xe | dom96: https://github.com/Xe/PonyAPI/commit/a669ee201826e1b8075a90c44224f0dc4210199c |
23:11:12 | dom96 | Good, so it's not really my fault :P |
23:13:31 | Xe | dom96: the api works normally now |
23:13:55 | Xe | s |
23:18:27 | * | RushPL quit (Ping timeout: 264 seconds) |
23:19:55 | dyce_ | 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:27 | dom96 | dyce_: http://benchmarksgame.alioth.debian.org/play.html#languagex |
23:41:10 | dyce_ | oops |
23:42:25 | dom96 | we just need to make Nim more popular :) |