00:00:04 | FromGitter | <ZarsBranchkin> Oops yeah, nim-mode |
00:01:17 | FromGitter | <ZarsBranchkin> https://i.imgur.com/sqUF8Bq.png |
00:01:30 | FromGitter | <krux02> yes I just tested it |
00:01:35 | * | elrood quit (Quit: Leaving) |
00:01:35 | FromGitter | <krux02> yes that keyword is missing |
00:01:37 | Temperance[m] | how do I define a function pointer with void return? |
00:01:51 | FromGitter | <krux02> I found out I can actually use func to define functions |
00:02:12 | FromGitter | <krux02> either I never tried it or last time I did it didn't work |
00:02:29 | FromGitter | <ZarsBranchkin> I remember seeing it somewhere it in docs, apparently deprecated |
00:02:32 | FromGitter | <krux02> it's just emacs that has problems highlighting and indenting the line when I use func |
00:02:49 | FromGitter | <krux02> yea min should release a few keywords |
00:03:47 | FromGitter | <ZarsBranchkin> Oooh, it seems like some keyword for future use https://nim-lang.org/docs/manual.html#pragmas-nosideeffect-pragma |
00:05:31 | Temperance[m] | I think I understand, nim uses 2 spaces for indentation, doesn't it? |
00:06:59 | FromGitter | <ZarsBranchkin> I think that's the official convention, but should work with different amount of spaces too. Haven't tested myself |
00:09:08 | Temperance[m] | does it work with tabulations? |
00:09:53 | Temperance[m] | NICE |
00:10:11 | Temperance[m] | took an example with glfw and nuklear |
00:10:15 | Temperance[m] | and managed to wrap some initialization code inside a proc and expose it with* |
00:10:15 | Temperance[m] | I'm liking this stuff a lot. |
00:10:23 | FromGitter | <ZarsBranchkin> No, tabs aren't allowed, only spaces |
00:10:34 | FromGitter | <ZarsBranchkin> Yeah, I find it real fun interfacing with C functions |
00:11:02 | Temperance[m] | I'm having many problems understanding why this kind of mechanisms aren't there for plain C |
00:11:34 | Temperance[m] | >No, tabs aren't allowed, only spaces |
00:11:48 | Temperance[m] | is this something that can be configured? |
00:11:55 | Temperance[m] | or is it kinda, enforced |
00:12:35 | FromGitter | <ZarsBranchkin> I think it's enforced |
00:12:39 | FromGitter | <ZarsBranchkin> Yeah, here https://nim-lang.org/docs/nep1.html#introduction-spacing-and-whitespace-conventions |
00:19:23 | * | MJCaley joined #nim |
00:25:28 | * | dddddd joined #nim |
00:32:59 | * | xet7 quit (Quit: Leaving) |
00:38:58 | * | xet7 joined #nim |
00:45:27 | Temperance[m] | I'm having a little bit of a problem understanding what's happening here |
00:45:28 | Temperance[m] | type fptr = (proc(x: int):int) |
00:47:22 | Temperance[m] | does this declare a type called "fptr" that is a proc that receives a parameter x which is an int, and should return an int? |
00:47:22 | Temperance[m] | am I getting this correctly? |
00:47:52 | FromGitter | <ZarsBranchkin> Yeah, something like that. Here is more information on that https://nim-lang.org/docs/manual.html#types-procedural-type |
00:49:59 | * | geocar joined #nim |
00:56:37 | * | rbrt quit (Quit: Oíche mhaith) |
00:58:08 | * | rbrt joined #nim |
00:58:38 | * | rbrt quit (Client Quit) |
01:00:42 | * | vlad1777d joined #nim |
01:05:01 | Temperance[m] | well, insofar I'm kinda liking nim a lot |
01:06:35 | Temperance[m] | The fact I was able to import some package and have a window opened by glfw in one day seems like a whole success for a day |
01:45:46 | * | rockcavera quit (Remote host closed the connection) |
01:47:19 | * | rockcavera joined #nim |
01:48:22 | * | zarthur joined #nim |
01:49:36 | * | rockcavera quit (Remote host closed the connection) |
01:51:44 | * | arthurz quit (Ping timeout: 255 seconds) |
01:56:51 | * | rockcavera joined #nim |
02:07:34 | * | S1t1Schu joined #nim |
02:11:05 | * | S1tiSchu quit (Ping timeout: 240 seconds) |
02:12:42 | * | rockcavera quit (Ping timeout: 245 seconds) |
02:19:33 | * | rockcavera joined #nim |
02:48:06 | * | MJCaley quit (Quit: MJCaley) |
02:59:31 | * | geocar quit (Quit: Connection closed for inactivity) |
03:18:45 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:35:50 | FromGitter | <zacharycarter> is there a way to create multiple modules for the VM in memory? |
03:36:14 | FromGitter | <zacharycarter> or should I just register everything in the globalCtx? |
03:36:29 | FromGitter | <zacharycarter> I was hoping I could make several modules and compose them into a modulegraph and use that when compiling my nimscript |
03:36:43 | FromGitter | <zacharycarter> but I'm not seeing how to do that clearly - I've created several modules, but don't see a way to make them depend on one another |
03:46:50 | * | SenasOzys quit (Ping timeout: 268 seconds) |
04:09:07 | * | triple_a joined #nim |
04:10:17 | * | triple_a left #nim (#nim) |
04:19:13 | FromGitter | <krux02> to be honest i dont know what you mean with modules in memory. |
04:40:10 | * | dbatbold joined #nim |
05:03:38 | * | yglukhov joined #nim |
05:14:04 | * | yglukhov quit (Remote host closed the connection) |
05:27:55 | * | sz0 joined #nim |
05:35:02 | * | yglukhov joined #nim |
05:36:42 | * | nsf joined #nim |
05:39:13 | * | yglukhov quit (Ping timeout: 240 seconds) |
05:55:39 | * | yglukhov joined #nim |
06:00:27 | * | yglukhov quit (Ping timeout: 265 seconds) |
06:02:59 | * | smt` joined #nim |
06:06:43 | * | smt quit (Ping timeout: 252 seconds) |
06:29:14 | * | craigger quit (Quit: bye) |
06:31:08 | * | craigger joined #nim |
06:36:54 | * | yglukhov joined #nim |
06:41:30 | * | yglukhov quit (Ping timeout: 256 seconds) |
06:58:27 | * | yglukhov joined #nim |
07:18:28 | * | Yardanico joined #nim |
07:23:43 | * | nohusuro joined #nim |
07:27:02 | * | dddddd quit (Remote host closed the connection) |
07:33:57 | * | zama quit (Ping timeout: 245 seconds) |
07:37:03 | * | couven92 joined #nim |
07:40:34 | * | zama joined #nim |
07:46:26 | * | rokups joined #nim |
07:49:39 | * | yglukhov quit (Remote host closed the connection) |
07:51:57 | * | yglukhov joined #nim |
08:01:27 | * | yglukhov quit (Remote host closed the connection) |
08:06:57 | * | sz0 quit (Quit: Connection closed for inactivity) |
08:07:52 | FromGitter | <narimiran> wait what? nim has REPL?! (cc @krux02) |
08:10:08 | * | yglukhov joined #nim |
08:15:11 | * | yglukhov quit (Remote host closed the connection) |
08:18:42 | * | yglukhov joined #nim |
08:20:05 | FromGitter | <andreaferretti> yes, just one that does not really work well with the C FFI |
08:20:18 | FromGitter | <andreaferretti> hence with a not small part of the stdlib |
08:20:26 | FromGitter | <andreaferretti> so it's hidden by default |
08:26:34 | * | PMunch joined #nim |
08:36:46 | * | sendell joined #nim |
08:36:50 | * | dbatbold quit (Ping timeout: 260 seconds) |
08:49:08 | FromGitter | <jaco60> Hi, i need to reverse a string. Is there already a `reverse` or `reversed` proc for strings in the std library (i’ve no found…) or conversions methods from string to seq allowing to use the ones from `algorithm`), or should i write my own proc (not a big deal, though) ? |
08:49:43 | * | Arrrr joined #nim |
08:52:27 | PMunch | jaco60, https://rosettacode.org/wiki/Reverse_a_string#Nim |
08:52:50 | FromGitter | <jaco60> Arf |
08:53:26 | PMunch | Seeing the complexity of the unicode variants I really feel like this should be put into a library. Possibly strutils |
08:55:46 | * | floppydh joined #nim |
08:58:15 | FromGitter | <jaco60> +1 |
08:58:52 | euantor | you mean like `unicode.reversed`? https://nim-lang.org/docs/unicode.html#reversed,string |
08:58:54 | euantor | ;) |
08:59:37 | PMunch | Haha, yeah I guess like that |
09:00:12 | FromGitter | <jaco60> Arf (bis repetita) |
09:00:18 | euantor | It is quite well hidden, and it doesn't seem like there's a version that doesn't handle UTF8 |
09:01:07 | PMunch | Maybe rosettacode should be updated to just show this instead? |
09:01:33 | PMunch | euantor, well UTF-8 first is generally a good approach |
09:01:55 | PMunch | If you put another reverse in strutils everyone would just use that and mess up with unicode stuff |
09:02:16 | euantor | true. It would definitely make sense to update rosettacode. Do they accept contributions like that - I've never looked |
09:02:26 | PMunch | I think so |
09:02:54 | PMunch | And besides, writing a proper ASCII string reverser is a lot easier than writing a UTF-8 one |
09:03:14 | PMunch | So if you need for for just ASCII, then it's not too hard to write it |
09:04:17 | euantor | `algorithms.reversed` also works: https://nim-lang.org/docs/algorithm.html#reversed,openArray[T] |
09:04:35 | euantor | THough you get a `seq[char]` out of it |
09:05:04 | FromGitter | <jaco60> I have an account on Rosetta, i may add the unicode.reversed solution |
09:05:23 | euantor | awesome, that would be helpful :) |
09:06:36 | PMunch | Maybe we should go through some of these as well: http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_Nim |
09:06:47 | PMunch | Might be a good idea for a live-stream :) |
09:07:17 | FromGitter | <jaco60> i don’t understand why the existing solution import unicode and rewrite reversed |
09:07:28 | euantor | yeah, there are probably a lot that could be improved a bunch |
09:08:34 | PMunch | jaco60, if you look at the example it's the exact same as the one in the manual. I wouldn't be suprised if the same person who wrote that rosettacode snippet was also the one who added it to the unicode module |
09:09:36 | euantor | This one is super easy: http://rosettacode.org/wiki/DNS_query |
09:09:51 | euantor | https://nim-lang.org/docs/nativesockets.html#getHostByName,string |
09:10:20 | Araq | PMunch: that is exactly what happened |
09:10:36 | Araq | first it was on rosettacode and then it was added to the stdlib |
09:11:42 | PMunch | euantor, well it says both IPv4 and IPv6. Not sure if you can do that with getHostByName |
09:11:51 | euantor | it looks like it |
09:11:57 | euantor | https://github.com/nim-lang/Nim/blob/master/lib/pure/nativesockets.nim#L413 |
09:12:20 | PMunch | That is either |
09:12:31 | PMunch | Depends on what you got from the lower procs |
09:12:48 | PMunch | You can't specify "I want this as IPv6" |
09:12:52 | euantor | Still might be worth having it there though |
09:13:37 | euantor | This is also an easy one: http://rosettacode.org/wiki/URL_parser |
09:19:07 | * | Vladar joined #nim |
09:20:31 | PMunch | Does Nim have a URL parser built in somewhere? |
09:20:42 | euantor | yep, in the `uri` module |
09:20:48 | PMunch | Nice |
09:24:04 | FromGitter | <jaco60> Added the unicode.reversed in Rosetta |
09:25:05 | FromGitter | <jaco60> I could be better to know the nim version where this proc was added |
09:28:41 | FromGitter | <jaco60> s/I/It |
09:36:28 | * | Arrrr quit (Ping timeout: 256 seconds) |
09:38:45 | Araq | probably exists since at least 0.16 |
09:39:19 | FromGitter | <jaco60> Ok, i’ll add this |
09:44:40 | * | Arrrr joined #nim |
09:44:41 | * | Arrrr quit (Changing host) |
09:44:41 | * | Arrrr joined #nim |
09:50:48 | * | yglukhov quit (Remote host closed the connection) |
10:00:28 | PMunch | You could always check the git commit that introduced it as well jaco60 |
10:01:18 | FromGitter | <jaco60> Wow… https://forum.nim-lang.org/t/3540 : that’s what we have to do to extract a readable IP Address from a Hostent ? |
10:05:43 | Araq | that code only deals with IP v4 |
10:06:16 | PMunch | jaco60, Araq, apparently reversed in the unicode module was added for 0.11.0 |
10:11:14 | * | yglukhov joined #nim |
10:15:55 | * | couven92 quit (Read error: Connection reset by peer) |
10:16:47 | PMunch | Hmm, is there a way to borrow all for a distinct type? |
10:18:54 | * | Arrrr quit (Quit: Leaving.) |
10:19:53 | Araq | no and if you need that, why do you have a distinct type? |
10:35:05 | * | smt` quit (Ping timeout: 256 seconds) |
10:44:43 | * | yglukhov quit (Remote host closed the connection) |
10:46:09 | * | smt joined #nim |
10:50:10 | PMunch | Overloading |
10:50:41 | PMunch | I want to have two types, which are both ints, behave exactly like ints, but serialize differently when written to a stream |
10:51:29 | PMunch | Currently I have them as distinct ints and have an overloaded write proc for each of them |
10:51:52 | PMunch | But that means you have to convert back and fro between them, which is annoying |
10:56:50 | PMunch | Hmm, with a X to seq converter it won't use high as it techincally wants an openarray, is this a bug? |
10:57:21 | * | yglukhov joined #nim |
10:58:10 | PMunch | Hmm, same for []= |
10:58:16 | PMunch | Well that's annoying |
10:59:41 | PMunch | Especially since I can't return an openArray from a converter.. |
11:03:00 | * | Ahmedkh joined #nim |
11:03:11 | * | Ahmedkh left #nim ("ERC (IRC client for Emacs 25.3.1)") |
11:05:31 | Araq | "I want to have two types, which are both ints, behave exactly like ints, but serialize differently when written to a stream" seems confusing |
11:08:42 | PMunch | Well, that's how protobuf works.. You can have an int64, a sint64, a fixed64, or a sfixed64. All of those are 64bit integers, fixed64 is unsigned. The two fixed variants serialize as a regular 64bit int. The normal int64 serializes as a Varint, but always uses 10 bytes to store a negative number. sint64 uses zig-zag encoding which is more efficient for negative numbers. |
11:09:13 | PMunch | So I want to have a protoWrite procedure, which takes either of these and writes them as per the spec |
11:10:10 | PMunch | But internally in your program it doesn't really make sense to differentiate between them |
11:12:53 | dom96 | hrm, couldn't you use a converter? |
11:13:24 | dom96 | to implicitly convert back to the int but still able to write procs on the distinct type |
11:16:54 | Araq | you should use the new pragma annotations |
11:17:08 | Araq | field* {.sfixed64.}: int64 |
11:17:23 | Araq | it's a property of the field, not of the type |
11:17:49 | FromGitter | <andreaferretti> +1 |
11:17:57 | FromGitter | <andreaferretti> it is a perfect use case |
11:19:03 | Araq | dom96: did we move fsmonitor to a nimble package? https://forum.nim-lang.org/t/3617 |
11:20:07 | dom96 | apparently it's here? https://github.com/nim-lang/Nim/blob/devel/lib/packages/fsmonitor.nim |
11:20:40 | PMunch | dom96, yeah I have converters now. But that doesn't work for seq |
11:20:45 | PMunch | Not that that's a huge issue |
11:21:06 | PMunch | Hmm, how does that work Araq? |
11:21:10 | PMunch | The properties I mean |
11:21:20 | * | xkapastel quit (Quit: Connection closed for inactivity) |
11:21:31 | Araq | read the manual |
11:21:56 | * | yglukhov quit (Remote host closed the connection) |
11:26:44 | PMunch | Hmm, yes I remember vagualy someone talked about this when it was introduced |
11:27:08 | * | regtools quit (Quit: leaving) |
11:27:39 | FromGitter | <jaco60> Any advice before publish it in Rosetta ? (i don’t know if it’s idiomatic nim as i’m a beginner) https://gist.github.com/jaco60/bb2fbc4d79b2f64adaa6f8a0d9d7a679 |
11:27:54 | PMunch | So convert my writer procs to a single macro, then annotate the fields and have the macro read the custom pragma to decide serialization? |
11:29:37 | PMunch | jaco60, looks good to me. Could use an array instead of a seq since you're not changing the length but that's a minor thing |
11:35:41 | dom96 | jaco60: why not just echo(url)? |
11:36:46 | FromGitter | <jaco60> Because i wanted to follow other solutions, like Go |
11:37:15 | FromGitter | <jaco60> echo url would be rather « raw », compared to the other solutions |
11:37:32 | dom96 | You'll get the same output, but with much less code |
11:39:04 | FromGitter | <jaco60> i don’t get the same output at all |
11:39:08 | dom96 | well, similar output |
11:39:28 | FromGitter | <jaco60> No… I just get the original url |
11:39:39 | dom96 | echo(parseUri(url)) |
11:39:42 | dom96 | that's what I meant |
11:39:51 | * | yglukhov joined #nim |
11:40:08 | FromGitter | <jaco60> yes, but no… Try `echo res`, you’ll see |
11:40:13 | * | yglukhov quit (Remote host closed the connection) |
11:41:11 | dom96 | oh right |
11:41:17 | dom96 | echo system.`$`(parseUri(url)) |
11:41:20 | PMunch | echo res just outputs the same URI that you passed in |
11:43:51 | PMunch | Hmm, same info. But the formatting isn't as nice |
11:44:24 | FromGitter | <ZarsBranchkin> Uhm, why is the std/ part nescessary? I can't import the modules when it's there |
11:44:41 | FromGitter | <ZarsBranchkin> Error: cannot open 'std/uri' |
11:45:10 | dom96 | Are you using Nim 0.17.2? |
11:45:15 | PMunch | jaco60, speaking of formatting: https://gist.github.com/3352f266c96db3cef74627feedf7cba6 |
11:45:25 | FromGitter | <ZarsBranchkin> Ah, probably still have 0.17 on this computer |
11:45:43 | dom96 | but actually it's more idiomatic not to use that |
11:45:52 | dom96 | 'std/' is only necessary for disambiguation |
11:46:25 | FromGitter | <ZarsBranchkin> Also backwards compatible if that is left out, so probably should remove that |
11:47:28 | dom96 | yeah, and that's another reason to just write `echo system.`$`(parseUri(url))` ;) |
11:48:03 | * | regtools joined #nim |
11:49:20 | FromGitter | <ZarsBranchkin> System is necessary because uri overrides default $? |
11:49:48 | dom96 | yep |
11:50:11 | dom96 | system has a generic `$` for all objects |
11:51:38 | Araq | well the idioms still evolve |
11:51:46 | Araq | I like 'std' |
11:52:22 | Araq | speaking of which, can we do without 'pkg' please :P |
11:53:06 | Araq | ah let me read the RFC again, forgot the problems already |
11:53:17 | dom96 | no, we can't |
11:54:09 | * | SenasOzys joined #nim |
11:58:07 | Araq | import random # uses std lib random |
11:58:07 | Araq | import random/random # uses nimble's random |
11:58:42 | Araq | still is the best solution. fix the nimble packages that don't play nice |
11:59:01 | PMunch | That looks super confusing :P |
11:59:25 | Araq | package management is all about enforcing a style/directory layout anyway |
11:59:38 | FromGitter | <jaco60> Posted... |
12:01:09 | * | yglukhov joined #nim |
12:02:30 | * | Snircle joined #nim |
12:05:21 | * | yglukhov quit (Ping timeout: 248 seconds) |
12:08:26 | Araq | what if we make 'pkg' mean "not in std" but make it use the --path/nimblepath ? |
12:08:41 | Araq | then it would just work with today's nimble, right? |
12:16:48 | GitDisc | <mraxilus> hey can anyone here provide some help with reassigning pointers in nim |
12:17:35 | GitDisc | <mraxilus> I'm trying to implement a stack to learn about pointer/memory mangement in nim -> https://pastebin.com/zk4BtZtd |
12:18:14 | GitDisc | <mraxilus> and on line 43 I get an error about not being able to assign a new address to one of my ptrs |
12:21:49 | * | yglukhov joined #nim |
12:22:59 | * | vlad1777d quit (Ping timeout: 268 seconds) |
12:25:33 | PMunch | mraxilus, try changing your input type to a "var Stack[T] |
12:25:49 | GitDisc | <mraxilus> what's the difference? |
12:25:57 | * | yglukhov quit (Ping timeout: 240 seconds) |
12:26:14 | PMunch | Normally you can't modify your input parameters in Nim |
12:26:24 | FromGitter | <ZarsBranchkin> Oh true, that solves it. It tells compiler that argument may get modified by the procedure |
12:26:37 | PMunch | So you must specify that your input parameter is var so it can be modified |
12:26:42 | PMunch | Correct |
12:26:47 | GitDisc | <mraxilus> Ah, I understand now, thanks |
12:27:16 | PMunch | That way you won't be able to pass it e.g. a stack that's declared with let (not that it makes much sense in this case) |
12:42:10 | FromGitter | <dom96> mraxilus: PMunch: A better idea would be to use a 'ref' type in that case |
12:42:19 | FromGitter | <dom96> You won't have to write 'var Stack' everywhere then |
12:45:04 | Araq | that's not better, just different |
12:45:19 | FromGitter | <andreaferretti> I prefer var stack |
12:45:26 | FromGitter | <andreaferretti> Stack stays a value type |
12:45:37 | FromGitter | <andreaferretti> and functions that mutate the stack say so in their signature |
12:46:07 | GitDisc | <mraxilus> yeah, I'm usually a fan of explicitly stating where mutations happen |
12:46:22 | GitDisc | <mraxilus> think I'll stick with ptr |
12:46:56 | Yardanico | why ptr? |
12:46:57 | * | floppydh quit (Remote host closed the connection) |
12:47:25 | PMunch | Isn't that the opposite of what you just said? |
12:47:31 | PMunch | Or did you mean var instead of ptr? |
12:47:45 | * | floppydh joined #nim |
12:47:50 | GitDisc | <mraxilus> var yeah my bad |
12:49:43 | PMunch | dom96, I tried to compile a local version of Nim after I made some changes. But to avoid having to build from C sources I just used the nim version I had from choosenim, but I get this error: http://ix.io/U34/ |
12:49:46 | PMunch | Is that normal? |
12:50:50 | Yardanico | PMunch, https://github.com/dom96/choosenim/issues/45 |
12:52:45 | PMunch | Aha |
12:52:50 | PMunch | What even is nim0? |
12:53:21 | Yardanico | probably executable koch creates while bootstrapping |
12:53:25 | Yardanico | I don't really know |
12:53:42 | Araq | nim0 is the 0th step in the bootstrapping process |
12:54:01 | Araq | which is just a copy of nim iirc |
12:55:23 | PMunch | Hmm, building from csources didn't get me much farther either.. |
12:55:25 | PMunch | http://ix.io/U3c/ |
12:55:46 | Yardanico | PMunch, ugh, are these csources 0.18.0? |
12:55:54 | PMunch | Yup |
12:56:01 | PMunch | According to bin/nim --version at least |
12:57:28 | PMunch | Oh wait |
13:03:03 | * | yglukhov joined #nim |
13:07:38 | * | yglukhov quit (Ping timeout: 276 seconds) |
13:23:42 | * | yglukhov joined #nim |
13:25:37 | FromGitter | <narimiran> @dom96 "A better idea would be to use a 'ref' type in that case" - did i understand this correctly: if you have 'ref object' there's no need to have 'var ' parameter in your proc, you can still modify it? |
13:26:50 | FromGitter | <narimiran> i thought using 'var' is a must if you wanted to modify something, didn't know about this other possibility (if i didn't misunderstand what you just said). any pros/cons of each method? |
13:28:21 | * | yglukhov quit (Ping timeout: 268 seconds) |
13:29:13 | euantor | yeah, you don't need `var` for a `ref` object |
13:31:23 | PMunch | What you are passing in with a ref object is not the object, it's the ref. So you're not allowed to change the ref, but you can change what it references (that is just treated as memory). If you used var with a ref object that would imply that you changed the reference, similar to double pointers in C. |
13:32:06 | Yardanico | ptr var ref object :D |
13:32:22 | Yardanico | this is valid 0_0 |
13:32:38 | PMunch | Hmm, what would that be |
13:32:47 | PMunch | I guess var implicitly makes a ref |
13:32:55 | PMunch | So it would be a pointer to a ref to a ref object? |
13:33:23 | FromGitter | <narimiran> thanks guys for the clarification! |
13:37:07 | FromGitter | <narimiran> btw, yesterday i had a situation where i had a seq consisting of arrays. and i want to send one array to another proc without copying it (`let a = seq[index]` would have copied it, from what i understand). i did is this way, tell me if there is a better way: |
13:40:11 | FromGitter | <narimiran> `let a = addr seq[index]`, and then in that proc, i had a parameter which said: `p: ptr array[length, type]` |
13:44:21 | * | yglukhov joined #nim |
13:46:30 | PMunch | narimiran, you should probably use var in that case as well: https://play.nim-lang.org/?gist=8dd766c0da08dbb5115dba9426cc3a90 |
13:46:51 | PMunch | That means you are not copying the data you are sending in |
13:48:32 | * | yglukhov quit (Ping timeout: 245 seconds) |
13:49:05 | * | SenasOzys quit (Ping timeout: 240 seconds) |
13:49:10 | FromGitter | <narimiran> @PMunch: here's that part of the code (it won't work, just to show what i'm doing): https://play.nim-lang.org/?gist=ceed5afa714abc90ad7bee280ed42680 |
13:50:55 | FromGitter | <narimiran> i thought if on line 8 i don't use `addr` that would copy Ts[t], no? |
13:51:18 | PMunch | Not if T is marked as var as well in the 'f' proc |
13:55:13 | FromGitter | <narimiran> @PMunch: here's your example modified: https://play.nim-lang.org/?gist=43d821c97ef03c2afd6343dc45e7b53b to include new `var z = x[1]` - the values in `x` haven't changed! (in contrast to when you have called `test(x[1])`) |
13:56:07 | PMunch | Ah yes, the "var z = x[1]" copies the array I think |
13:56:43 | PMunch | So in your case addr is the way to go |
13:56:48 | * | SenasOzys joined #nim |
13:57:55 | FromGitter | <narimiran> ok, so here is the wanted version: https://play.nim-lang.org/?gist=c2c11da40fc0c032dfa11dcd922910b7 using `addr` and `ptr` |
13:58:44 | PMunch | Yes |
13:58:59 | PMunch | Note that you could also have z declared using a let statement here |
13:59:14 | PMunch | As it is the reference, not the data |
13:59:16 | FromGitter | <narimiran> indeed! |
14:00:15 | FromGitter | <narimiran> ok, this was the first time i have used `addr` and `ptr` so i wanted to check if that's the way to go, or there is some better/idiomatic way to achieve the same thing. |
14:00:38 | PMunch | For performance reasons (which I guess is what you are going for here) you might also want to throw on a {.inline.} pragma |
14:00:46 | PMunch | Or even just declare the whole thing as a template |
14:04:49 | FromGitter | <narimiran> you have guessed correctly about performance :) {.inline.} goes in the definition of my `f` proc, right? what would be advantages of using template here? |
14:04:57 | * | yglukhov joined #nim |
14:05:48 | PMunch | Yes |
14:06:05 | PMunch | Well, maybe not that great of a benefit |
14:06:20 | * | vlad1777d joined #nim |
14:06:24 | PMunch | template and {.inline.} would probably have similar performance benefits |
14:07:09 | PMunch | {.inline.} is just a flag to the compiler to make it inline the body of the procedure. templates does more or less the same but in Nim |
14:09:29 | * | yglukhov quit (Ping timeout: 260 seconds) |
14:11:08 | FromGitter | <narimiran> just tried both versions (inline and template) and there is no noticeable difference in the end regarding running times |
14:12:21 | PMunch | Did you notice a speedup between not using them? |
14:12:26 | Araq | template currently has the edge because the compiler's handling of .inline is rather stupid |
14:12:48 | Araq | the compiler delegates .inline to the C compiler |
14:13:19 | Araq | template performs the inlining in the frontend, this can elide more copies, for example |
14:15:10 | PMunch | Yeah, and .inline. is just a hint |
14:15:18 | PMunch | The compiler might ignore it completely |
14:16:33 | FromGitter | <narimiran> PMunch: haven't noticed a significant difference (it is smaller than difference between two consecutive runs) |
14:17:34 | Araq | PMunch: that's usually not a problem. |
14:17:44 | FromGitter | <narimiran> Araq: so you would recommend to use templates in cases like this one? its performance will be at least as good as proc, and it might be better? |
14:18:05 | Araq | no, our guidelines say to prefer inline procs |
14:18:32 | Araq | as they are easier to reason about (no control flow effects) |
14:19:29 | Araq | that they are currently slower in some circumstance is just an unfortunate implementation detail. you can always optimize and use 'template' later |
14:23:31 | FromGitter | <narimiran> i have run every version five times, and these are average times: |
14:23:52 | FromGitter | <narimiran> proc: 3.65 sec; inline proc: 3.65 sec; template: 3.80 sec |
14:25:34 | * | yglukhov joined #nim |
14:29:17 | FromGitter | <narimiran> and all these are very good times for such a huge domain i'm calculating. (for comparison, julia runs this in 4.74 seconds, python+numpy+numba in ~13 sec) |
14:29:35 | * | yglukhov quit (Ping timeout: 240 seconds) |
14:30:01 | FromGitter | <jaco60> Well, iI give up trying to figure out how to use `nativesockets.getHostByName` to get IP addresses. It’s beyond my skills :(. If someone is able to explain me how to get *readable* strings from the `Hostent.addrList` field, i’ll be grateful. |
14:33:27 | * | smt quit (Ping timeout: 252 seconds) |
14:35:44 | dom96 | http://sogrady-media.redmonk.com/sogrady/files/2018/03/lang.rank_.118.png |
14:35:54 | dom96 | Time to create more projects guys! |
14:38:35 | dom96 | (From https://redmonk.com/sogrady/2018/03/07/language-rankings-1-18/) |
14:39:03 | federico3 | we need better dissemination |
14:39:39 | zarthur | Indeed @dom96, and my 2 cents, if #nim could get as good Webframework as Rails it could take it much higher |
14:40:04 | * | PMunch shudders while thinking about Ruby on Rails |
14:41:21 | dom96 | zarthur: Perhaps you could that web framework :) |
14:41:24 | dom96 | *could write |
14:42:01 | federico3 | zarthur: the web "development" world is already really saturated with languages and frameworks |
14:42:12 | zarthur | @PMunch it is all about how you want to position #nim. Ruby is high because of Rails, C# is for all/everything summed up, R for the wide adoption by para-programmers in application to data science, CSS, well not a language per-se but drives quite a bit of websites |
14:43:25 | zarthur | yeah writing a successful Web Framework is not a trivial undertaking, but today the World needs better web experience. Ruby is slow and illogical, rip it apart with #nim :-) |
14:45:18 | * | douglascorrea joined #nim |
14:45:28 | zarthur | Well, @pmunch, with all the fairness, but when a Web Dev (not me) reading "Nim in Action" needs Nginx reverse proxy mapped to Jester 0.0.1 to power a website one sets oneself on fire |
14:45:52 | federico3 | zarthur: want to write detailed requirement on https://github.com/nim-lang/needed-libraries/issues ? |
14:47:05 | federico3 | zarthur: what's the issue? 0.0.1? |
14:47:40 | PMunch | zarthur, well that's fair. But Jester really isn't that hard to set up and it's super easy to use. At least for simple sites which is all I have really used it for |
14:47:46 | FromGitter | <andreaferretti> rosencrantz is versio 0.3.3 - clearly more advanced :-P |
14:48:37 | dom96 | https://www.reddit.com/r/programming/comments/82wpiw/the_redmonk_programming_language_rankings_january/dvdks2l/ |
14:48:54 | zarthur | Exactly, aim, high @pmunch, nim needs a pro web framework with ORM (database objects mapper) |
14:49:39 | dom96 | zarthur: yeah, strange how most of the web runs on PHP behind nginx, apache, lightttpd huh? |
14:49:42 | federico3 | zarthur: again, want to write detailed requirement on https://github.com/nim-lang/needed-libraries/issues ? |
14:50:17 | dom96 | I bet most web frameworks recommend you run them behind nginx or another http server |
14:50:21 | zarthur | @dom96 PHP has good web frameworks |
14:50:36 | PMunch | zarthur, yeah I was using MySQL for my simple site. But now we have Ormin: https://github.com/Araq/ormin |
14:50:57 | zarthur | All the web servers are Web Framework agnostic |
14:52:58 | FromGitter | <krux02> zarthur: then built a web framework. |
14:53:07 | FromGitter | <andreaferretti> zarthur: not exactly true |
14:53:20 | FromGitter | <andreaferretti> many web frameworks are meant to be exposed directly |
14:53:29 | FromGitter | <andreaferretti> without a reverse proxy |
14:53:39 | FromGitter | <andreaferretti> hence they are frameworks and servers in one |
14:53:47 | federico3 | that's usually not a good idea |
14:54:38 | zarthur | Does ormin natively integrate into Jester? |
14:54:44 | livcd | zarthur: Ruby is loosing its momentum because its "usefulness/popularity" is driven mainly by an opinionated web framework. |
14:55:20 | zarthur | @andreaferretti exactly my point, but in the book... ^ |
14:55:43 | federico3 | yep - it's better not to force ORMs and other stuff on users |
14:56:08 | PMunch | zarthur, what do you mean by natively integrate into Jester? |
14:56:23 | zarthur | @livcd, this is why I said above rip it apart with #nim |
14:56:53 | dom96 | Does the book say you "need" it? |
14:56:58 | zarthur | @federico3 that's what I am conveying in reference to the book |
14:58:15 | PMunch | Hmm, I should really do that documentation server. If for nothing else than to show how to combine Jester+Ormin+Karax to create a simple website |
14:58:22 | federico3 | I'd rather have a tool to create a skeleton for web apps and pull in only the libraries you really need and generate the glue code |
14:58:42 | livcd | federico3: like with js projects and npm ? :D |
14:58:45 | PMunch | Or Jester+Ormin+<Some templating engine (ideas?)> |
14:58:49 | federico3 | [spam] PMunch: and httpauth |
14:59:03 | federico3 | livcd: no, like turbogears was doing |
14:59:23 | PMunch | Oooh nice federico3, didn't know about that |
15:00:23 | federico3 | PMunch: Nim already has templating albeit it does not integrate well in jester |
15:00:32 | Temperance[m] | I suppose that given that nim compiles to C, using nim with emscripten must not be too hard, right? |
15:00:49 | FromGitter | <andreaferretti> for templates there is https://nim-lang.org/docs/filters.html |
15:01:04 | FromGitter | <andreaferretti> I cannot see why it would not integrate nicely in jester |
15:01:09 | FromGitter | <andreaferretti> or anything else really |
15:01:15 | FromGitter | <andreaferretti> they are just functions |
15:01:25 | federico3 | andreaferretti: that's why |
15:01:57 | PMunch | Oh yeah, those strange things. Haven't really tried them |
15:02:00 | PMunch | But I like the idea |
15:02:08 | dom96 | IMO those filters just need a nicer syntax |
15:02:17 | dom96 | and a way to inline them into procedures |
15:02:37 | Yardanico | Temperance[m], it's already possible |
15:03:04 | federico3 | andreaferretti: many frameworks discover automatically the template location and "apply" them to the routes you want |
15:03:06 | Yardanico | Temperance[m], for example see https://github.com/Jipok/Nim-SDL2-and-Emscripten |
15:03:10 | dom96 | Temperance[m]: It's already used in production |
15:03:21 | Yardanico | dom96, really? |
15:04:03 | dom96 | Reel Valley uses emscripten IIRC |
15:04:20 | Yardanico | dom96, I think it doesn't, hmm |
15:04:44 | Yardanico | dom96, ah, yes, it does |
15:05:00 | PMunch | federico3, I guess one could do something like that with a macro |
15:05:06 | FromGitter | <andreaferretti> @federico3 I don't like autodiscovery, I think that explicitly using the functions you want is preferable |
15:05:15 | PMunch | Search through a folder and include whatever is in there and create routes for it |
15:05:17 | Yardanico | Temperance[m], check out Reel Valley on facebook (it's a game), it uses nim+emscripten |
15:05:26 | Yardanico | it's also available on mobile platforms, but it uses native code there |
15:05:50 | federico3 | PMunch: the routing has to be explicit because you might want to apply the same template to many routes |
15:05:58 | * | r3d9u11 joined #nim |
15:07:06 | livcd | so then an opinionated game framework in Nim ? :-X modeled after Reel Valley ? |
15:07:23 | Yardanico | livcd, Reel valley uses NimX |
15:07:34 | Yardanico | for gui :) |
15:07:45 | livcd | oh |
15:08:05 | Yardanico | livcd, a lot of parts of Reel Valley are open-sources |
15:08:07 | * | sendell quit (Remote host closed the connection) |
15:08:07 | Yardanico | open-sourced* |
15:08:13 | PMunch | federico3, wait. What did you want it to do then? |
15:08:34 | Yardanico | livcd, check "Technical Insights of the Game" here - https://yglukhov.github.io/Making-ReelValley-Overview/ |
15:09:01 | Yardanico | livcd, and yeah, their game engine is rod - https://github.com/yglukhov/rod |
15:10:23 | zarthur | @livcd, I am not a proponent of Ruby on Rails, but "loosing momentum" feels like fake news, and it does not mean much sorry if assaulting but how much momentum, it is very high on the chart |
15:11:08 | zarthur | in m view the Ruby on Rails community just wanted to whine a bit to entice the maintainers to keep going delivering good stuff |
15:11:50 | * | yglukhov joined #nim |
15:12:11 | FromGitter | <Vindaar> So I recompiled a small program, which just extracts some time information from some data on the current 0.18.1 devel branch. Previously compiled on a few months ago on the then devel branch. I noticed that the duration I output suddenly shows 0 days, 0 hours and 0 minutes. Well, code boils down to this example from the docs: ⏎ https://play.nim-lang.org/?gist=ebc0c0a8f45eb2a31e61ce54262afb9a ⏎ I know there were |
15:12:11 | FromGitter | ... quite a few changes to the times module, but is that expected behavior now? Meaning initInterval only adds the given field (in this case seconds) to the TimeInterval instead of correctly populating the different fields. |
15:12:43 | federico3 | PMunch: you "apply" a template to a route with a simple syntax and the framework will scan ./templates for it and give a meaningful error if there's any issue. Currently templates are imported globally and you have to type the tpl name in 3 places |
15:12:55 | FromGitter | <Vindaar> Looking at the implementation of initInterval shows that indeed, the div and carrying to populate all fields is gone |
15:15:30 | PMunch | federico3, I would love to see a mock up of how this would work in Jester. Not runnable of course |
15:16:34 | * | yglukhov quit (Ping timeout: 260 seconds) |
15:18:32 | dom96 | Vindaar: yeah, there was quite a few changes to this. Do open an issue if the behaviour is odd now. |
15:18:46 | federico3 | PMunch: will do |
15:18:57 | FromGitter | <Vindaar> @dom96 ok, will do |
15:33:21 | * | rinzai joined #nim |
15:38:06 | * | yglukhov joined #nim |
15:40:24 | * | douglascorrea quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:41:13 | * | dddddd joined #nim |
15:43:07 | FromGitter | <Vindaar> done: https://github.com/nim-lang/Nim/issues/7315 |
15:44:35 | * | miran joined #nim |
15:47:34 | Temperance[m] | if I end up liking nim I might try to do a toy game engine for fun, specially since I'll want to be able to test glsl and stuff with it. |
16:03:26 | * | floppydh quit (Quit: WeeChat 2.0.1) |
16:05:29 | * | PMunch quit (Quit: Leaving) |
16:06:12 | * | douglascorrea joined #nim |
16:09:55 | FromGitter | <krux02> :D I have there something for you |
16:10:11 | FromGitter | <krux02> but only if you are not on a mac |
16:10:37 | FromGitter | <krux02> @Temperance githib.com/krux02/fancygl |
16:11:10 | FromGitter | <krux02> but if you try it out, tell me about it, it's not in a final state it is more a research project |
16:11:32 | miran | krux02: you have (at least) one typo in your link ;) |
16:11:43 | FromGitter | <krux02> I actually write a master thesis about it and it will have eventually shaders that are written in it |
16:11:46 | FromGitter | <krux02> ah sorry |
16:11:53 | FromGitter | <krux02> github.com/krux02/opengl-sandbox |
16:12:23 | * | noonien joined #nim |
16:12:27 | noonien | hello folks! |
16:13:07 | miran | hello noonien! |
16:13:08 | FromGitter | <Vindaar> hey! |
16:15:45 | FromGitter | <krux02> @Temperance: the video is also linked on the github page, but it is a good introduction: https://www.youtube.com/watch?v=JO0iqGDgFqA |
16:16:08 | noonien | i'm trying to see if i can compile a simple blinky program using nim, for a cortex m0 mcu. from what i understand, this should be as easy as compiling with `nim c --cpu:arm --gc:none --os:standalone`, correct? |
16:20:11 | * | r3d9u11 quit (Ping timeout: 256 seconds) |
16:28:00 | Temperance[m] | can't open fancy gl github |
16:28:25 | miran | Temperance[m]: see the other link few messages below |
16:28:27 | dom96 | noonien: hrm, maybe federico3 can help out here |
16:28:38 | noonien | cool |
16:29:03 | noonien | is there any way of passing default build flags using nimble? |
16:29:24 | noonien | or should i just create build-debug and build-release tasks in the .nimble file? |
16:29:34 | Temperance[m] | will look into it tonight |
16:30:15 | dom96 | noonien: create a .nim.cfg file and add your flags there |
16:30:30 | dom96 | name it module.nim.cfg |
16:30:45 | dom96 | or just nim.cfg to apply to your whole project IIRC |
16:30:59 | noonien | i've got a nimble package created with "nim init" |
16:31:10 | noonien | should i put that file in the src folder? |
16:31:25 | dom96 | yeah |
16:31:31 | noonien | cool |
16:50:10 | noonien | does nim have a runtime? |
16:52:10 | noonien | can i compile nim without the stdlib, or, can i choose which functions from the stdlib i use, and not compile the ones i don't use? |
16:55:40 | FromGitter | <zacharycarter> is it possible to compile multiple modules for the VM at runtime? |
16:55:44 | FromGitter | <zacharycarter> using a modulegraph or something? |
16:55:59 | FromGitter | <zacharycarter> or should I just register all my vm callbacks in the main context? |
17:01:02 | Araq | hmm, not sure |
17:01:47 | Araq | noonien: with --deadCodeElim:on only what you use ends up in the binary |
17:03:06 | noonien | i see, i'm already using that, i'm trying to create an empty program and am getting: `/build/newlib-OTNHfJ/newlib-2.4.0.20160527/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'` |
17:03:14 | noonien | i guess exit is a special requirement |
17:05:26 | Araq | exit.c is not produced by Nim |
17:07:09 | FromGitter | <zacharycarter> Araq: any idea who might know more about the VM stuff? I've written a macro which stores callbacks I want to register with a VM module context in a table. At runtime I register these callbacks with the VM context - but it'd be neat if I could build a module dependency hierarchy and separate all my callbacks into separate modules, instead of just dumping them all into the main module. |
17:07:14 | Yardanico | noonien, arm-none-eabi means what you're compiling for barebones? |
17:07:28 | Yardanico | I mean not for an OS? |
17:07:52 | noonien | Yardanico: yes |
17:08:05 | Yardanico | well then you can't use some modules from stdlib |
17:08:12 | Yardanico | and GC |
17:08:14 | noonien | that's not a problem |
17:08:34 | Yardanico | (well you can port GC, but I don't know how :D) |
17:11:45 | FromGitter | <tim-st> Not directly nim related, but mayber someone knows if there's a better way to use a sequence of uint as strKey than like `0|1|2|4|1`? |
17:12:04 | FromGitter | <tim-st> (enums) |
17:15:41 | Araq | https://hal.inria.fr/hal-01724997/document |
17:15:53 | Araq | zacharycarter: I think you're doing it wrong ;-) |
17:16:08 | Araq | check out how putEnv was added to Nim |
17:17:36 | FromGitter | <zacharycarter> okay thanks I will |
17:19:54 | FromGitter | <zacharycarter> ah I think I get it now :) thanks Araq! |
17:20:36 | * | xkapastel joined #nim |
17:27:46 | noonien | Yardanico: I'm trying to compile an empty program |
17:27:54 | noonien | just an empty main function |
17:28:28 | Yardanico | noonien, you still need to disable gc, maybe it will help |
17:28:29 | Yardanico | but IDK |
17:29:36 | * | MJCaley joined #nim |
17:31:07 | * | rbrt joined #nim |
17:39:42 | dom96 | noonien: looking at nimkernel might help out too: https://github.com/dom96/nimkernel |
17:40:28 | noonien | awesome, i'll give it a look, thanks! |
17:42:57 | * | yglukhov quit (Remote host closed the connection) |
17:46:05 | federico3 | noonien: an example of nim.cfg for avr in query |
17:46:31 | noonien | just a second, i'll put up a gist of what i've got so far |
17:54:08 | noonien | this is what i've got so far: https://github.com/noonien/nrf51288_blinky_nim |
17:54:16 | noonien | and the error i'm getting: http://vpaste.net/FlOf9 |
17:55:04 | noonien | i don't know how hard it'll be to initialize the hardware in nim, as a temporary workaround i was thinking of compiling the nim code as a library and initializing the hardware in C code |
17:55:31 | noonien | the problem with nimkernel is that it calls the linker manually |
17:55:33 | * | Chiel joined #nim |
17:55:48 | noonien | and one of the reasons i'm trying to move to nim is so i can simplify the build process |
17:56:53 | Chiel | Hello Nim people. We are considering using Nim on an embedded linux system with pretty tight memory constraints. Would it be possbile to compile (part of) the Nim standard libs as shared libraries to reduce the size of the individual binaries? |
17:57:32 | Chiel | I can only get this to work using the C api, but I'm not sure how to call pure nim code from an Nim lib compiled with --app:lib |
17:58:01 | * | SenasOzys quit (Remote host closed the connection) |
17:58:18 | * | SenasOzys joined #nim |
18:03:04 | federico3 | Chiel: like in https://forum.nim-lang.org/t/2051 ? --app:lib gives you a C api |
18:04:07 | federico3 | (besides: Nim includes only the the needed code in a binary, not the whole stdlib: are you sure this optimization would be useful?( |
18:04:13 | federico3 | )) |
18:04:31 | Chiel | Probably, I have a number of tools all doing asynchronous networking, which adds up |
18:04:39 | Chiel | Just considering the options |
18:05:45 | federico3 | can you share some numbers? |
18:07:47 | Chiel | I have a single binary which is now approx 500K, of which only 40K is main application symbols, the rest all comes out the stdlib |
18:08:22 | Chiel | Adding one and one, I suppose I should be able to have two of such programs runninng at a total of (40+40+460) = 540K |
18:08:46 | Chiel | The other option would be to make one single binary and fork() early |
18:09:24 | Chiel | or one binary which multiple apps built in, and simply choose an other path to run at startup |
18:09:33 | Chiel | basically, just linking it all into a single blob |
18:11:20 | federico3 | like https://en.wikipedia.org/wiki/BusyBox |
18:11:25 | Chiel | just like that |
18:12:03 | Chiel | busybox originally solved it like that to be able to run small on uclinux, which has no MMU, and no shared libs |
18:12:29 | federico3 | do you also want to do execute-in-place? |
18:12:43 | Chiel | No, we run from cramfs, so that is not an option at this time |
18:13:07 | Chiel | I have approx 4mb of flash, but loads of RAM available |
18:19:08 | federico3 | Chiel: assuming you are using -d:release --opt:size --deadCodeElim=on , have you tried compressing the binaries? |
18:19:28 | Chiel | Well, in the end they are compressed by the cramfs, which does a lot |
18:19:37 | federico3 | (i mean apart from cramfs) |
18:20:35 | Chiel | No, not yet. That does not really help in the end because it will end up in the cramfs anyway |
18:20:53 | federico3 | cramfs uses zlib - perhaps xz does better |
18:20:59 | Chiel | Cramfs does as well |
18:21:26 | Chiel | squashfs that is |
18:21:27 | Chiel | I'm sorry |
18:22:15 | Chiel | anyway, I'm still fine for now, just looking for options |
18:24:09 | noonien | Oops, my mistake, nim was not at fault, i just had to pass --specs=nosys-specs to the linker |
18:24:19 | noonien | According to: https://stackoverflow.com/questions/19419782/exit-c-text0x18-undefined-reference-to-exit-when-using-arm-none-eabi-gcc |
18:24:49 | noonien | And https://launchpadlibrarian.net/170926122/readme.txt |
18:25:00 | noonien | Perhaps nimc should do that by itself? |
18:25:18 | Araq | noonien: there is a subset of Nim that maps to C 1 to 1, there is nothing you need to use C for |
18:25:53 | Araq | Chiel: the library can be built as a DLL but it's usually not done because it's inconvenient |
18:26:22 | Chiel | How does one import and export from a shared lib with mangling intact? |
18:27:25 | Araq | by telling the compiler how to mangle |
18:31:20 | Araq | proc foo*(x, y: int) {.exportc: "prefix_$1_intint".} |
18:32:24 | Chiel | Ah, that makes sense, thank you |
18:36:25 | Araq | noonien: Nim can't guess your configuration. the embedded stuff is full of special cases and setups |
18:37:10 | noonien | That makes sense, i just figured arm-none might be a common setup in the embedded world |
18:38:11 | dom96 | it might make sense if this option works for all arm-none projects |
18:38:23 | dom96 | and if Nim can easily know that that is what you're using |
18:40:09 | * | Trustable joined #nim |
18:41:48 | * | jxy quit (Quit: leaving) |
18:45:50 | * | jxy joined #nim |
18:59:23 | FromGitter | <samdmarshall> heya, I had a quick question while trying to work on a small project. I have some sequences that i'm filtering down. the resulting sequences should have a single elements, how would I go about pulling an element from the sequence without hard-coding it directly to a specific index? I thought there was an `any` or similar operator that would return an element (doesn't necessarily have to be the first element) from |
18:59:23 | FromGitter | ... the sequence, but I cannot seem to find anything when I checked the docs |
19:01:50 | FromGitter | <Vindaar> Not quite sure if that's helping you, but you're aware of the sequtils module, right? https://nim-lang.org/docs/sequtils.html |
19:02:56 | Araq | I think we only have https://nim-lang.org/docs/sequtils.html#any,openArray%5BT%5D,proc%28T%29 and siblings returning 'bool' not the element that matched |
19:03:04 | FromGitter | <samdmarshall> yeah I looked at that but didn't see anything that would return a singular element from the sequence for me |
19:04:47 | FromGitter | <tim-st> Is there a way to ensure my enum type has every ord in range 0..255 ? |
19:05:24 | FromGitter | <samdmarshall> normally i'd be fine with just using an iterator for such results, but i'm doing this in a `cmp` method so I need to unbox the element from the seq |
19:09:17 | * | athenot_ quit (Remote host closed the connection) |
19:09:28 | FromGitter | <cabhishek> Hi folks, I am getting `ProtocolError: Connection was closed before full request has been made` error when trying to load test my server. Any ideas how I should I handle this run time error? I am using `AsyncHttpClient`. |
19:09:58 | * | athenot joined #nim |
19:16:59 | * | SenasOzys quit (Ping timeout: 256 seconds) |
19:21:21 | FromGitter | <nitely> @samdmarshall you are lookig for a `reduce` function |
19:22:48 | FromGitter | <nitely> I does not seem Nim has one, at least not one with that name in the stdlib |
19:23:12 | FromGitter | <jaco60> there is a foldr proc, right? |
19:24:37 | FromGitter | <ZarsBranchkin> Yeah, seems you're right https://nim-lang.org/docs/sequtils.html#foldr.t,untyped,untyped |
19:29:28 | FromGitter | <nitely> ah, right. That one should work |
19:30:07 | FromGitter | <samdmarshall> how would I use that to return a singular element of the sequence? |
19:30:52 | miran | samdmarshall: can you be more detailed about what exactly you're trying to do? |
19:31:49 | FromGitter | <nitely> @samdmarshall you want the first one that matches your cmp? |
19:32:27 | FromGitter | <samdmarshall> i'm not sure how more detailed I can be: I have a seq that has probably one, but maybe more, element in it. I don't care which element of the sequence I am given, I just want one of them |
19:33:25 | * | SenasOzys joined #nim |
19:34:06 | miran | so basically you want a random element from that seq? |
19:34:17 | FromGitter | <samdmarshall> yes |
19:34:27 | FromGitter | <data-man> LLVM/Clang 6.0.0 released. http://releases.llvm.org/6.0.0/docs/ReleaseNotes.html |
19:35:09 | miran | https://nim-lang.org/docs/random.html#rand,int |
19:35:24 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
19:35:38 | miran | seq[rand(seq.len-1)] ? |
19:35:46 | FromGitter | <samdmarshall> that would look something like `my_seq[rand(len(my_seq)]` yes? |
19:36:30 | FromGitter | <samdmarshall> yeah that is kinda horrible and was hoping for a simple operator, I might as well just hardcode the first element if that is the case |
19:36:54 | FromGitter | <ZarsBranchkin> Can always write a template for that, haha |
19:37:35 | FromGitter | <samdmarshall> returning the first element isn't that big of a deal, I was hoping there was a language construct for this |
19:37:49 | miran | take a note that max in `rand` proc is included in the range, so your example would sometimes fail. but you can use seq.high instead of seq.len-1 |
19:38:24 | FromGitter | <ZarsBranchkin> Language construct is kind of a sketchy statement in Nim, since the standard libraries are just pure Nim as well. There is no difference if they implement it, or you write a template/procedure for that |
19:38:59 | FromGitter | <ZarsBranchkin> So if you would write `any` template, that picks random element like that, you could as well call it a new sequence construct |
19:39:02 | FromGitter | <samdmarshall> ok, let me rephrase, I was hoping there was something in the stdlib that already did this |
19:39:20 | * | Snircle joined #nim |
19:39:45 | FromGitter | <samdmarshall> randomizing the element selection is going to over-complicate this if I have to implement that myself |
19:40:05 | dom96 | what's wrong with: seq[rand(seq.len-1)]? |
19:40:47 | FromGitter | <ZarsBranchkin> ```template any[T](list: OpenArray[T]): T = ⏎ list[rand(list.high)]``` ⏎ ⏎ And that's about as legit as what stdlib could provide you [https://gitter.im/nim-lang/Nim?at=5aa191bf888332ee3a1567e7] |
19:40:53 | FromGitter | <samdmarshall> it is just adding complexity to the code for the sake of it when I already know it will have at least one element |
19:41:22 | FromGitter | <ZarsBranchkin> Now with that you can just do: ⏎ ⏎ ```var someElement = mySeq.any``` [https://gitter.im/nim-lang/Nim?at=5aa191e1458cbde557102355] |
19:42:02 | FromGitter | <ZarsBranchkin> Which would be as efficient/fast as just writing out `mySeq[rand(mySeq.high)]` |
19:42:06 | dom96 | Not that I want to bikeshed, but `pick` is a better name for this function |
19:42:24 | FromGitter | <samdmarshall> @ZarsBranchkin yeah, i'm aware I can do that; my question was about existing functionality and if I was missing something because I was trying to look it up using the wrong terminology -- not a question of "can I actually do this" |
19:43:01 | FromGitter | <samdmarshall> @dom96 yeah, I agree, I gave `any` in my example as that is what it has been called in other languages I know |
19:43:08 | FromGitter | <ZarsBranchkin> Now that you were interested in it, why not make a pull request and suggest such addition to sequtils? Now it will be part of stdlib |
19:43:12 | miran | samdmarshall: well, in python you would have `choice`, but it is not that much simpler than the nim code presented before |
19:43:47 | FromGitter | <ZarsBranchkin> The language grows from such additions anyway, that's why I was slightly confused about what's the problem here |
19:44:04 | FromGitter | <samdmarshall> ¯\_(ツ)_/¯ all I was trying to figure out if there was a convenience method that exists or not, if not then i'll just hardcode and move on in my work |
19:44:39 | miran | hardcode means you will have `seq[0]`? |
19:45:12 | FromGitter | <ZarsBranchkin> what about `seq.pop`, if you don't care about which element you get? |
19:45:21 | FromGitter | <ZarsBranchkin> That's part of stdlib already |
19:45:54 | FromGitter | <ZarsBranchkin> https://nim-lang.org/docs/system.html#pop,seq[T] |
19:46:33 | * | Chiel quit (Quit: Lost terminal) |
19:47:17 | * | Ven`` joined #nim |
19:51:04 | FromGitter | <samdmarshall> @ZarsBranchkin because that requires adding more mutability to my code |
19:51:58 | FromGitter | <samdmarshall> @miran if it means I don't have to write the implementation and is documented as part of the language then the complexity it has doesn't matter, as I don't have to maintain it |
19:52:07 | FromGitter | <ZarsBranchkin> Then probably index would be as simple as it gets |
19:52:13 | FromGitter | <samdmarshall> whereas, I do need to maintain my own code |
19:53:44 | miran | well, i still don't see the problem with `seq[rand(seq.high)]`, because it is quite self-explanatory in what it does, but that's just me.... :) |
19:54:14 | FromGitter | <samdmarshall> it takes infinitely longer to parse and comprehend than seq[0] does, so |
19:54:56 | miran | that kind of thinking won't get us much further than some addition of integers :D |
19:55:07 | * | douglascorrea quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:55:56 | FromGitter | <ZarsBranchkin> Not sure if you should be worrying about parsing time, Nim expects you to meta-program it, that's what it was made for |
19:57:04 | * | douglascorrea joined #nim |
19:57:11 | * | rbrt quit (Quit: Oíche mhaith) |
19:58:24 | FromGitter | <samdmarshall> i'm talking about humans |
20:01:12 | FromGitter | <ZarsBranchkin> If I were you, I'd just write that template and forget about it. Don't see how it's any different from chunking up your code via funtions, except here you abstract away tougher to read code, to deal with what you just mentioned |
20:01:41 | FromGitter | <ZarsBranchkin> Remember that templates are compile time thing and are there for exactly that - make code more readable to human |
20:03:38 | FromGitter | <nitely> well, I mentioned `reduce/fold` cuz it can be use as an `any` that returns a seq value instead of boolean, which came up at some point in the conversation. But it does looks like you would better off just doing `my_seq[0]` to get the first element or `my_seq[my_seq.high]` to get the last one |
20:05:35 | shashlick | dom96: looks like nimble runs "before install" before installing dependencies so I cannot use dependencies in the before install section |
20:06:06 | FromGitter | <ZarsBranchkin> Yeah, fastest performing and prettiest looking would be template `first` that simply equals to `my_seq[my_seq.low |
20:06:12 | dom96 | shashlick: what are you planning to use? |
20:07:34 | shashlick | for my nimgen dependent packages, nimgen needs to be installed before you can generate the nim files |
20:07:45 | shashlick | so steps are 1. install nimgen, c2nim dependencies 2. before install, generate nimgen artifacts 3. install to pkgs dir |
20:08:08 | shashlick | alternative is to run nimgen in the "after install" step but I need to be in the right pkgs directory and not quite sure how to do thata |
20:09:21 | shashlick | i can find the install path with "nimble path packagename" but then how do I "cd" into that in a .nimble script |
20:11:01 | FromGitter | <nitely> @ZarsBranchkin I believe ruby is one of the few languages that has stuff like `myseq.first` and `myseq.last`, but seriously, anyone who has program before knows what `my_seq[0]` means |
20:12:34 | FromGitter | <jaco60> To mimic a lot of FP languages, we could have myseq.head and myseq.tail (or myseq.car and myseq.cdr for lispians) :) |
20:13:19 | miran | b-but why? what's wrong with s[0]? |
20:13:45 | miran | well ok, s[1..^1] is not as pretty as pythons s[1:] |
20:14:17 | * | PMunch joined #nim |
20:16:14 | FromGitter | <samdmarshall> my 2-cents: index by zero as a concept is silly |
20:16:20 | FromGitter | <samdmarshall> so I prefer `.first()` |
20:16:47 | miran | let us not go there. also no vim vs emacs, and no spaces vs tabs :D :D |
20:17:11 | FromGitter | <ZarsBranchkin> Yeah, that's why i'd use seq.low or seq.high as indices, when implementing first and last |
20:17:47 | FromGitter | <ZarsBranchkin> And now i'm feeling like just making a PR with this for system.nim |
20:17:58 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:28:28 | FromGitter | <krux02> @samdmarshall what is so bad with index by zero |
20:29:38 | FromGitter | <samdmarshall> I don't like hardcoding values if I can avoid it |
20:29:42 | FromGitter | <krux02> miran: I could imagin that nim would automatically apply the this pragma in `[]` |
20:30:12 | FromGitter | <krux02> meaning `a[0 .. len-1]` would work, because it can resolve len as `a.len`. |
20:30:23 | FromGitter | <krux02> and then all other symbols would work, too |
20:30:30 | FromGitter | <krux02> a[low .. high] |
20:30:40 | PMunch | Oooh, that would be fancy |
20:30:59 | FromGitter | <krux02> and if you define them also your own symbols `a[low .. middle]` |
20:31:12 | PMunch | Man, that would be really neat |
20:31:21 | PMunch | But I'm not sure if the this pragma would work |
20:31:32 | PMunch | Or wait, would it? |
20:31:37 | PMunch | For let's say a seq |
20:31:54 | FromGitter | <krux02> I can try a prototype with macros |
20:31:57 | FromGitter | <krux02> maybe |
20:32:24 | FromGitter | <krux02> I'll be back until then you get some waiting music: https://danieldeluxe.bandcamp.com/track/soul-siphon |
20:32:43 | PMunch | Would these be procs though, and not fields |
20:32:48 | PMunch | I don't think this works with procs |
20:34:05 | FromGitter | <ZarsBranchkin> Seems neat, but how would it react to variables named that way? I guess use those, if there sre none, assume a.low etc |
20:41:35 | * | rokups quit (Quit: Connection closed for inactivity) |
20:42:01 | dom96 | shashlick: You can probably use this: https://nim-lang.org/docs/nimscript.html#cd,string |
20:42:21 | dom96 | shashlick: Also, this might be a valid alternative to executing `nimble path ...`: https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptapi.nim#L44 |
20:42:32 | shashlick | dom96: looks like my fix for #280 is wrong - https://github.com/nim-lang/nimble/pull/448/commits/4770556939a7dfd53c608926a6ccf0320dd5e77f |
20:42:33 | dom96 | Definitely plan to expand this API in the future :) |
20:43:19 | FromGitter | <krux02> @ZarsBranchkin yes, but unfortunately I don't see an easy way to just prototype that functionality right now. |
20:43:23 | shashlick | the pre-install hook needs to be moved here: https://github.com/nim-lang/nimble/blob/master/src/nimble.nim#L349 |
20:43:37 | dom96 | shashlick: :/ |
20:43:51 | dom96 | It's time to add a test for this |
20:44:57 | FromGitter | <krux02> as far as I know macros don't allow to control the rules for symbol resolution |
20:47:05 | shashlick | getPkgDir() returns blank |
20:51:19 | dom96 | hm, odd |
20:54:06 | * | rbrt joined #nim |
20:56:12 | * | nsf quit (Quit: WeeChat 2.0.1) |
21:00:11 | miran | https://www.tiobe.com/tiobe-index/ nim is not even in the first 100 languages? or it isn't even included? |
21:00:28 | miran | (yeah yeah, i know, tiobe index is shit, but just saw a link on HN) |
21:02:25 | * | miran quit (Quit: Konversation terminated!) |
21:02:46 | FromGitter | <ZarsBranchkin> miran: Apparently they do track Nim https://www.tiobe.com/tiobe-index/programming-languages-definition/#instances |
21:03:01 | FromGitter | <krux02> tiobe index is not shit, but it is just a metric they use, nobody can tell you how popular a language really is |
21:03:26 | FromGitter | <krux02> but to be honest how big can a language be when the entire community of that language shares a single chat room? |
21:03:55 | FromGitter | <jaco60> and we don’t need Tiobe to know that nim is not a mainstream programming language… yet |
21:04:46 | PMunch | krux02, what do you mean. We have plenty of chat rooms! |
21:04:55 | PMunch | They're all linked together though.. |
21:05:09 | PMunch | Except from #nim-nologs and #nim-offtopic I guess |
21:05:14 | PMunch | And the Telegram channel |
21:05:52 | Araq | number of github projects seems to me a pretty reasonable indicator |
21:06:14 | dom96 | Not everybody uses GitHub :) |
21:06:23 | Araq | no need for Tiobe's weirdness. do they still think Delphi and Pascal are different languages? |
21:06:37 | dom96 | They are different languages though :P |
21:06:55 | FromGitter | <krux02> PMunch that is what I mean. All chat rooms are linked together, and it is still not overcrowded |
21:07:16 | PMunch | krux02, yeah I was just making a joke :P |
21:07:58 | FromGitter | <krux02> dom96: that is true, but it is just meant as a metric |
21:08:35 | dom96 | I think measuring user count and message frequencies might be a good way to measure popularity |
21:08:58 | FromGitter | <krux02> I never programed in Delphi or Pascal, but I though Delphi to Pascal is like C++ to C. |
21:09:05 | dom96 | or at least it gives you another metric to look at |
21:09:08 | FromGitter | <krux02> But it is just a complete random guess |
21:09:38 | dom96 | Creating something that measures this is on my todo list in fact |
21:09:44 | FromGitter | <krux02> dom96: message frequency is good, but then you can only compare nim to nim, not to other languages |
21:10:07 | FromGitter | <krux02> dom96: at least there is still the chat log |
21:10:12 | FromGitter | <ZarsBranchkin> Heh, recently had to start using pascal(or delphi, not even sure). Was pleased to see some similarities to Nim, like variable type declerations at least |
21:10:12 | Araq | oh they fixed it. now only Delphi/Object Pascal is listed |
21:10:22 | FromGitter | <krux02> so you are able to track back to when the first chat was logged |
21:10:26 | * | rbrt quit (Quit: Slán agat) |
21:10:37 | PMunch | Yeah I was thinking about parsing the irclogs for new nicks and such to get some cool metrics |
21:11:14 | FromGitter | <krux02> yes, but then you need to parse the user from the bridges as well correctly |
21:11:33 | FromGitter | <krux02> some regular expressions to the win |
21:11:57 | dom96 | krux02: Why only Nim to Nim? |
21:12:09 | Araq | krux02: "Delphi to Pascal is like C++ to C" that is correct but everybody made the switch |
21:12:19 | dom96 | I could join channels dedicated to other languages and start collecting metrics |
21:12:46 | FromGitter | <krux02> yes that is true, but not all other languages have "official" channels |
21:13:13 | FromGitter | <krux02> the imporance of the channel in other languagas is just much different |
21:13:44 | FromGitter | <krux02> so I don't think you can compare it |
21:14:24 | Araq | the truth is: our docs and the search feature are so good that most don't use google or stack overflow nor #nim. and they all develop commercial closed source products |
21:14:52 | FromGitter | <jaco60> :) |
21:15:06 | Araq | so we think nobody uses it when in reality entire civilizations now depend on it ... |
21:15:15 | GitDisc | <treeform> Araq, is that true? |
21:15:20 | dom96 | krux02: I think there is plenty of official channels to compare to: #rust on Mozilla's IRC network and #crystal-lang as an example. |
21:15:36 | GitDisc | <treeform> because that is what I am doing... |
21:15:37 | dom96 | #d seems pretty official too |
21:15:55 | FromGitter | <jaco60> just compare SO channels, too |
21:15:56 | Araq | treeform: nah, I think I live in my own universe |
21:16:04 | PMunch | We should create a IRC -> Stack Overflow bot to get some more traffic going :P |
21:16:33 | PMunch | Any message by a new user followed by a question mark automatically gets added to Stack Overflow with the #nim tag |
21:16:34 | GitDisc | <treeform> I think stackoverflow as a good place before, now its too full of crap. |
21:16:48 | * | athenot quit (Ping timeout: 255 seconds) |
21:16:54 | PMunch | I still use it when I google for things. Lot's of good answers on there |
21:17:04 | PMunch | But I almost never ask questions there |
21:17:10 | GitDisc | <treeform> I end up there less and less. |
21:17:15 | * | PMunch quit (Quit: leaving) |
21:17:29 | GitDisc | <treeform> and when I do end up its not very useful anymore. |
21:17:42 | FromGitter | <ZarsBranchkin> Same, I have never asked question on stack overflow yet, but it has given me answers most of the time |
21:18:09 | * | athenot joined #nim |
21:20:26 | FromGitter | <jaco60> (https://files.gitter.im/nim-lang/Nim/Ryao/b_1_q_0_p_0.jpg) |
21:20:41 | FromGitter | <jaco60> The new bible of IT students |
21:21:17 | GitDisc | <treeform> Araq, do you think nimscript can be used as a scripting language sort of like lua or more like AngelScript? I did not find a way to included as a library or eval strings or files? Or expose compiled things to it? |
21:22:03 | dom96 | treeform: nimble does this, and there is even a package that exposes a nice API for it IIRC |
21:22:28 | GitDisc | <treeform> I did not find it, I was poking around vm.nim it looks like thats where it lives. |
21:23:16 | GitDisc | <treeform> is this it? https://github.com/Serenitor/embeddedNimScript |
21:23:26 | GitDisc | <treeform> I guess I was looking for some thing inside the compiler or stdlib. |
21:23:30 | GitDisc | <treeform> but if this works it works |
21:23:48 | dom96 | yeah, I think this is it |
21:25:06 | FromGitter | <krux02> I recently got over 500 points on stack overflow for a single answer I gave. |
21:25:10 | Araq | https://github.com/Araq/nimedit/blob/master/api.nim#L131 |
21:25:18 | Araq | ^ treeform |
21:25:24 | FromGitter | <krux02> But I too think stack overflow became worse |
21:26:03 | FromGitter | <krux02> it was a nice place to get answers, and often it still is, but when you ask a question, be warned it will be closed down in no time and tagged as not constructive. |
21:26:23 | FromGitter | <krux02> and the people who tag you are also pround and get achievements for doing that |
21:27:04 | Araq | btw somebody could work on NimEdit... ;-) |
21:27:20 | FromGitter | <krux02> Worst thing I had was, I was writing an answer to someone and while I wrote it the question was closed because it is "not constructive" and I was not able to give this person the answer. |
21:27:52 | FromGitter | <krux02> Araq: well I like nim, but to be honest, not everything needs to be written in Nim |
21:27:57 | GitDisc | <treeform> Araq, I written my own editor about 4 years ago, I don't need another one. |
21:28:20 | Araq | krux02, blasphemy :P |
21:28:22 | GitDisc | <treeform> Araq, it looks like that will get me started on embedding it. |
21:28:24 | FromGitter | <krux02> treeform: what does it do? |
21:28:58 | GitDisc | <treeform> krux02, the only really good property it has, is I know how it works. I don't recommend it. |
21:29:00 | dom96 | I wrote my own editor too :P |
21:29:04 | Araq | well I'll extract some useful libraries from NimEdit, maybe. |
21:29:12 | dom96 | Araq: Yeah, you should. |
21:29:21 | dom96 | or improve embeddedNimScript |
21:29:30 | dom96 | treeform: do try out embeddedNimScript if you can |
21:29:47 | dom96 | It's good to use these libraries instead of copying and pasting custom code all the time |
21:30:42 | FromGitter | <krux02> is embeddedNimScript like python? |
21:30:54 | GitDisc | <treeform> All I really want is: load scripts, run scripts, expose compiled code to them, have a repl, and maybe break on errors and set breakpoints. |
21:31:17 | GitDisc | <treeform> embeddedNimScript does not do break on errors and set breakpoints, but maybe that can be hacked in. |
21:31:41 | Araq | needs some VM additions |
21:31:46 | Araq | but can't be hard |
21:33:14 | GitDisc | <treeform> I like the AngelScript model where you write what kind of looks like C++, so if you decided to port it to compiled code it is easy. |
21:33:26 | GitDisc | <treeform> Another idea is just to ship the game with a nim+c compiler as well? |
21:33:31 | shashlick | dom96: is it possible to get the output of an exec command in nimscript |
21:34:12 | FromGitter | <krux02> isn't that the return value? |
21:34:21 | dom96 | Doesn't look like it https://nim-lang.org/docs/nimscript.html#exec,string |
21:34:43 | Araq | treeform: let make this clear: NimScript is Nim. modulo the VM's restrictions. it uses the same syntax, the same static type system, the same macro system, etc etc |
21:34:46 | dom96 | I'm still a proponent of removing this nimscript thing and making the ordinary procedures work in nimscript |
21:34:56 | dom96 | s/nimscript thing/nimscript module/ |
21:35:09 | Araq | hmm? |
21:35:51 | dom96 | just define osproc.execCmdEx for the VM |
21:37:40 | Araq | yeah, another thing we should have done for 0.18 :P |
21:37:47 | Araq | oh wait |
21:37:53 | Araq | we have staticExec() |
21:38:19 | dom96 | huh? So you agree now that we shouldn't have a specific module dedicated to nimscript? |
21:38:27 | Araq | no. |
21:38:40 | Araq | I agree we need something like execCmdEx |
21:38:50 | Araq | but it turns out we already have. |
21:39:18 | shashlick | does staticExec work in nimscript |
21:40:38 | Araq | try it :-) |
21:42:07 | Araq | "If you are reading this you are missing nimblepkglist.js or have javascript disabled in your browser." |
21:42:12 | Araq | nope... |
21:43:26 | dom96 | It's time to just remove this and link to https://nimble.directory |
21:43:37 | shashlick | how do you get the package name within nimble |
21:44:01 | dom96 | `packageName` |
21:44:04 | dom96 | possibly |
21:44:06 | Araq | packages?callback=gotPackageList:1 Uncaught ReferenceError: gotPackageList is not defined |
21:44:06 | Araq | at packages?callback=gotPackageList:1 |
21:44:23 | Araq | why not fix that "callback"? |
21:44:33 | Araq | why is it broken anyway? |
21:44:44 | dom96 | because it has been freezing my browser since forever |
21:44:47 | dom96 | and many other's too |
21:45:11 | shashlick | dom96: packageName is blank in the after install |
21:45:51 | dom96 | shashlick: :/ |
21:46:03 | shashlick | i'm installing from local dir, not sure if that matters |
21:47:20 | dom96 | No idea |
21:47:38 | * | Vladar quit (Quit: Leaving) |
21:50:46 | Araq | dom96: so ... you intentionally disabled it? |
21:50:56 | dom96 | Araq: no? |
21:51:01 | dom96 | No idea why it's broken |
21:52:26 | dom96 | Does c2nim support objective C? |
21:54:16 | shashlick | got it working - staticExec() works thankfully, but have to hardcode packageName in .nimble file |
21:55:47 | dom96 | oh cool, Nim is #2 on this: https://www.slant.co/topics/6032/~systems-programming-languages |
21:57:09 | shashlick | ugh, but now I am upsetting nimble - Cannot completely remove C:\Users\gt.nimble\pkgs\nimkerberos-0.1.0. Files not installed by nimble are present. |
21:57:28 | Araq | dom96: no to Objective C. |
21:58:10 | dom96 | Araq: :'( |
21:58:24 | shashlick | so I have to use before install, which means nimble needs to be fixed |
22:20:24 | dom96 | Maybe it's time to add libclang support to c2nim? :) |
22:23:04 | * | Ven`` joined #nim |
22:25:44 | shashlick | dom96: so if I push a fix to nimble, does it get pulled by koch tools? |
22:32:01 | * | smt joined #nim |
22:44:00 | FromGitter | <cabhishek> Hi everyone, I think this is a bug in `AsyncHttpClient`: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Running above code results in `Exception message: Connection was closed before full request has been made` error. Just to compare, equivalent async python code runs fine. [https://gitter.im/nim-lang/Nim?at=5aa1bcaf6f8b4b9946059324] |
22:52:39 | * | douglascorrea quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:56:57 | shashlick | dom96: running nimble test doesn't do anything - I have a tests\testkb.nim and it doesn't run anything |
23:02:32 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:04:51 | FromGitter | <zacharycarter> dom96, araq: I see why you guys use nimscript as configuration now :D I'm re-writing FRAG and going to write an editor this time - I'm using nimscript as configuration for things like shaders etc |
23:10:03 | FromGitter | <zacharycarter> With the macro I can write code like - ⏎ ⏎ ```add("bar")``` ⏎ ⏎ :D [https://gitter.im/nim-lang/Nim?at=5aa1c2cbf3f6d24c6852a9a7] |
23:11:41 | Araq | cabhishek report it on github please |
23:12:09 | * | Trustable quit (Remote host closed the connection) |
23:12:17 | Araq | shashlick: koch tools uses the latest nimble if you have a .git dir, aka have a Nim from git |
23:12:43 | * | MJCaley quit (Quit: MJCaley) |
23:15:49 | * | douglascorrea joined #nim |
23:28:05 | noonien | how can i see the called compiler/linker commands using nimble? |
23:30:07 | noonien | also, does nim have a proc main? |
23:30:08 | FromGitter | <zacharycarter> not sure that you can |
23:30:25 | FromGitter | <zacharycarter> no |
23:30:45 | FromGitter | <zacharycarter> isMainModule will be set to true when the module being invoked is the main module |
23:31:04 | FromGitter | <zacharycarter> so you can write |
23:31:29 | FromGitter | <zacharycarter> ```proc main() = ⏎ echo "foo" ⏎ ⏎ when isMainModule: ⏎ main()``` [https://gitter.im/nim-lang/Nim?at=5aa1c7d1c3c5f8b90d4d62b6] |
23:31:46 | FromGitter | <zacharycarter> or just call `main()` without the check if you don't care about it |
23:32:22 | FromGitter | <zacharycarter> regarding the nimble question - ask dom96 |
23:32:38 | noonien | i'm just wondering if there's a reason to create a main proc in nim |
23:32:42 | dom96 | noonien: try --verbose or --debug |
23:32:55 | FromGitter | <zacharycarter> yes there is - there's a performance benefit apparently |
23:33:00 | FromGitter | <zacharycarter> to having a main function |
23:33:18 | FromGitter | <zacharycarter> there's also a performance benefit to using the inbuilt result variable, rather than declaring and returning your own |
23:33:34 | noonien | dom96: i tried both, none output the compiler/linker command |
23:34:33 | noonien | i'm guessing not declaring a main function makes all declared variables global |
23:34:47 | * | littleli joined #nim |
23:34:51 | dom96 | noonien: hrm, try `nimble c --verbosity:3 file.nim` |
23:34:55 | FromGitter | <zacharycarter> dom96: I'm thinking that knowledge about the VM needs to more prominent - game devs love this kind of stuff |
23:35:15 | FromGitter | <zacharycarter> the fact that I can execute code inside a configuration file is huge |
23:35:41 | noonien | dom96: nimble or nim? |
23:36:11 | noonien | nim shows me calls to gcc, so that appears to work |
23:36:48 | dom96 | noonien: both should work |
23:37:08 | noonien | oh, my bad, nimble c works as well |
23:37:32 | Temperance[m] | I've been trying with a friend, to write a game engine in c++, the guy is relatively good with shaders but he isn't in c++ |
23:37:56 | FromGitter | <zacharycarter> using what rendering API? |
23:38:06 | Temperance[m] | I expected him to design the shaders and all the stuff, and I told him I would provide him the rest for wathever visuals he dreamed to make. |
23:38:21 | FromGitter | <zacharycarter> I've written a couple of game libraries in Nim - but I'm re-writing the first one now. |
23:38:44 | FromGitter | <zacharycarter> http://fragworks.io/ and https://github.com/zacharycarter/zengine |
23:38:55 | Temperance[m] | But we have had lots of problems, he has problem with c++ |
23:38:56 | Temperance[m] | I wanted to go with opengl |
23:39:01 | Temperance[m] | Vulkan is still too green and too difficult for me to consider it. |
23:39:16 | noonien | dom96: hmm, from what i can tell, only the linker call is shown |
23:39:20 | Temperance[m] | I'm thinking that with how easy is to build nim projects, It might be a good idea to do the c++ parts on separate files and just use nim as glue. |
23:39:28 | FromGitter | <zacharycarter> that's why I'm going to be using bgfx again |
23:39:38 | FromGitter | <zacharycarter> why do you need C++? |
23:39:38 | dom96 | noonien: try removing nimcache :) |
23:39:41 | Temperance[m] | I have to study nim more, but if I can take out cmake out from the equation It will be a definitive win. |
23:39:49 | noonien | i did, no change |
23:40:04 | noonien | the cache and the binary |
23:40:28 | FromGitter | <zacharycarter> Temperance[m]: you don't need c++ :D just bind to it |
23:40:59 | dom96 | noonien: in that case I'm out of ideas, Araq? |
23:41:18 | Temperance[m] | Knowing how to be efficient is something that is learned. You have to have powerful tools, you have to be able to relate asm to code easily, you have to be able to use intrinsics. |
23:41:25 | Temperance[m] | even if nim provided all that stuff, (and I have some problems debuggining yesterday) those are things that would probably take me a little bit of too much time relearning to do in nim. |
23:41:28 | noonien | from what i can tell, the commands are comments in the generated .c files |
23:42:02 | FromGitter | <zacharycarter> ah I see what you mean by glue code now - yeah I mean most frameworks I've written have leveraged several C/C++ libraries |
23:42:29 | FromGitter | <zacharycarter> for instance - http://fragworks.io/ - uses https://github.com/bkaradzic/bgfx for the rendering API |
23:42:36 | FromGitter | <zacharycarter> and the new iteration of frag will too |
23:43:45 | Temperance[m] | Still, several things in nim seemed really attractive, and the fact that the garbage collector can be deactivated, and yes, several c++ libraries could be reused, makes me think nim unlike other modern languages, has a little bit of tought probably put into making people like me not so unhappy. |
23:43:48 | noonien | Temperance[m]: hehe, sucky build systems is one of the reason i'm trying to switch to nim as well |
23:44:08 | noonien | that and the '70s preprocessor |
23:44:43 | Temperance[m] | It took me half a year to learn cmake, and I still am not sure I fully grasped it. I can't pretend to work with other people in c++ if they don't know how to deal with a tool that is HARDER to use than the language it is supposed to build. |
23:45:01 | FromGitter | <zacharycarter> I prefer premake |
23:45:14 | noonien | yeah, all build systems seem to invent a new DSL |
23:45:23 | noonien | when the real problem, imho, is within the language |
23:45:24 | Temperance[m] | I tried it, seemed simpler, but didn't like it. |
23:45:26 | FromGitter | <zacharycarter> and generally use - https://github.com/bkaradzic/GENie - if I"m using C++ |
23:46:36 | FromGitter | <zacharycarter> https://github.com/bkaradzic - has kind of tamed the C++ world for me, via studying his code |
23:47:06 | FromGitter | <zacharycarter> at least in terms of producing portable and easy-to-read C++ code |
23:47:35 | Temperance[m] | -> this was written by him, and it kinda is my bible https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b |
23:47:48 | FromGitter | <zacharycarter> yeah! that is a great read :D |
23:47:54 | noonien | sure, the problem isn't that you can't write good code. the problem is that c/c++ preprocessors are so bad it's really hard to trust anyone not to take "shortcuts" |
23:48:27 | Temperance[m] | To be honest, I only use c++ for 3 or for features. However, Most likely nim already covers said problems. |
23:49:01 | noonien | a good module system would probably not cause c/c++ to need such convuluted build setups |
23:49:19 | Temperance[m] | I would code plain C if it weren't for how hard is to search for "plain C" results, thanks to c++ having the same name, and for namespaces. I really don't like endless names you get in C |
23:50:23 | Temperance[m] | that being said. I think .h files have extra uses, It's nice to have already done a list of the functions in some part of your code. |
23:50:36 | Temperance[m] | The last part I mean it about modules and stuff. |
23:54:19 | noonien | do you think they're worth all the hassle you have to put up with to setup a complex enough build system to build your, and others' code? |
23:58:20 | * | MJCaley joined #nim |
23:58:33 | Temperance[m] | I don't think at all they're worth the hassle we have to put with. That being said I'm not sure headers had to be completely related to all those hassles either. C/C++ compilation workflow is a complete mess, and while yes, headers feel redundant, even if you didn't need headers, C/C++ would still be a pia to compile. |