00:03:53 | * | maksima joined #nim |
00:04:10 | * | Jesin joined #nim |
00:04:26 | FromGitter | <zacharycarter> whoa cool |
00:04:44 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=599f699cba0f0f6e38ddb58a] |
00:04:47 | FromGitter | <zacharycarter> graphql with Nim |
00:05:02 | maksima | hello, can somebody tell me what is wrong with this program: https://pastebin.com/wpabbbhM |
00:08:09 | FromGitter | <zacharycarter> you're declaring an empty sequence |
00:08:13 | FromGitter | <zacharycarter> and then trying to assign a value to index 1 |
00:08:32 | FromGitter | <zacharycarter> https://play.nim-lang.org/?gist=8f10b9197fadf147855281eab13cbaec |
00:08:33 | FromGitter | <zacharycarter> try that |
00:11:03 | maksima | FromGitter: So what does .add method do ? it reserves a new slot within the sequence? |
00:11:04 | FromGitter | maksima, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim |
00:14:29 | FromGitter | <zacharycarter> https://nim-lang.org/docs/system.html#add,seq%5BT%5D,openArray%5BT%5D |
00:16:13 | * | maksima quit (Quit: Page closed) |
00:20:32 | FromGitter | <zacharycarter> wow nim jsffi is killer |
00:21:01 | * | Jesin quit (Quit: Leaving) |
00:25:54 | FromGitter | <zacharycarter> if I could just figure out the answer to my first question |
00:25:59 | FromGitter | <zacharycarter> about why I can't invoke that function |
00:26:29 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
00:26:56 | * | vivus joined #nim |
00:33:56 | * | yglukhov joined #nim |
00:34:22 | FromGitter | <zacharycarter> figured out a solution |
00:34:26 | FromGitter | <zacharycarter> now I need to figure out how to access this |
00:34:37 | * | itseris quit (Quit: Konversation terminated!) |
00:36:00 | * | gangstacat quit (Quit: Leaving) |
00:38:05 | * | yglukhov quit (Ping timeout: 240 seconds) |
00:45:36 | * | hobomatic quit (Quit: Leaving) |
00:53:04 | * | Jesin joined #nim |
00:55:10 | * | sleepyqt quit (Quit: WeeChat 1.9) |
00:57:26 | TheManiac | Would appreciate any pointers from you or Araq on how to do this properly... |
00:57:47 | TheManiac | dom96: Thanks for the pointer. I've made it work, but it took hacking `osproc` - see https://github.com/nim-lang/Nim/issues/6275 |
00:58:45 | TheManiac | sleep time now |
01:00:19 | * | rauss joined #nim |
01:03:35 | * | vlad1777d quit (Remote host closed the connection) |
01:13:41 | FromGitter | <zacharycarter> hrm is there any way to use async / await with JS and Nim? |
01:14:17 | * | demi- quit (Quit: Server shutdown in 3... 2... 1...) |
01:28:22 | * | ShalokShalom quit (Remote host closed the connection) |
01:35:00 | * | pilne joined #nim |
01:35:53 | * | yglukhov joined #nim |
01:40:21 | * | yglukhov quit (Ping timeout: 252 seconds) |
01:49:27 | * | dddddd quit (Remote host closed the connection) |
01:50:02 | Demos[m] | ahhhb the bug here is where the compiler's nimcache parameter can not contain a "short" filename |
01:58:00 | FromGitter | <zacharycarter> escape it? |
01:58:03 | FromGitter | <zacharycarter> `short` |
01:58:07 | FromGitter | <zacharycarter> ``short`` |
01:58:10 | FromGitter | <zacharycarter> damnit |
01:58:13 | FromGitter | <zacharycarter> use backticks lol |
01:58:30 | * | chemist69 quit (Ping timeout: 252 seconds) |
02:02:38 | * | vivus quit (Quit: Leaving) |
02:10:00 | * | big_num quit (Quit: WeeChat 1.7) |
02:12:19 | * | chemist69 joined #nim |
02:56:09 | * | skrylar joined #nim |
02:56:25 | * | skrylar appears for a ponderance: is making a macro for transform matrices worthwhile |
02:56:49 | skrylar | On one hand you don't *usually* make them by hand. On the other, when you do it reads a lot nicer if you can just say "pitch x, scale y" |
03:07:16 | * | endragor joined #nim |
03:08:47 | * | endragor quit (Remote host closed the connection) |
03:09:14 | FromGitter | <jrdlph> this is one of the reasons I am playing around with nim in the first place. Efficient graphics requires you to encode geometry in terms of linear algebra, but linear algebra isn't very intuitive (to me at least) |
03:18:50 | FromGitter | <jrdlph> like, I don't want to transform the coordinate space to rotate an object. You don't turn the whole damn room in order to face your coffee cup in a different direction. Yet capturing this inversion of control can lead to other weirdness if you are doing it at runtime in terms of encapsulation rather than at compile time in terms of a syntactic transformations |
03:37:53 | * | yglukhov joined #nim |
03:41:57 | * | yglukhov quit (Ping timeout: 240 seconds) |
03:44:42 | * | endragor joined #nim |
03:48:49 | * | rauss quit (Quit: WeeChat 1.9) |
03:49:46 | * | rauss joined #nim |
03:58:00 | * | endragor quit (Remote host closed the connection) |
04:02:36 | skrylar | jrdlph yea. macros are nice |
04:05:52 | skrylar | i'm mostly dodging C++. but meh |
04:05:56 | skrylar | hate those slow compile times. |
04:06:25 | skrylar | although ccache and nim seem to be getting along weirdly. it keeps trying to build a new stdlib_system for each module; but they all have the same compile flags, so it shouldn't be doing so |
04:08:17 | * | endragor joined #nim |
04:08:20 | * | mahmudov quit (Remote host closed the connection) |
04:12:49 | * | endragor quit (Ping timeout: 248 seconds) |
04:13:22 | skrylar | i saw the godot devs were recommending people use [quake maps] for prototypes. i thought that was amusing |
04:13:31 | skrylar | well they said constructive solid geometry, but that usually means quake maps |
04:17:24 | skrylar | now the saurbraten thing i would like to see happen more :( |
04:17:32 | skrylar | its basically a big octree with some edge deformation |
04:24:22 | * | PrimordialHelios joined #nim |
04:24:38 | PrimordialHelios | What's the difference between method and proc? |
04:27:46 | skrylar | PrimordialHelios, methods have dispatch procs dont |
04:29:00 | skrylar | methods are basically virtual calls but they aren't implemented like that |
04:31:26 | PrimordialHelios | Thanks! |
04:39:36 | * | PrimordialHelios quit (Quit: Leaving) |
04:48:29 | skrylar | meh. can't wait to be done with yak shaving and play around with bgfx2 |
04:59:29 | * | endragor joined #nim |
05:06:02 | * | haha_ joined #nim |
05:13:54 | skrylar | i always wonder if these sandbox worlds are inherently unoptimizable or if people simply don't try |
05:14:47 | skrylar | partly because Sauerbraten has an amazing map format/editor setup, and its "just" a shooter. But it has a built-in LOD strategy that works indoors and outdoors. But then I see these block games, and they aren't even doing basic instancing |
05:23:40 | * | pilne quit (Quit: Quitting!) |
05:40:08 | * | yglukhov joined #nim |
05:40:57 | * | haha_ quit (Quit: haha_) |
05:41:44 | * | endragor quit (Remote host closed the connection) |
05:44:21 | * | yglukhov quit (Ping timeout: 240 seconds) |
05:45:50 | * | skrylar wonders what the recommended way to deal with tls sockets on nim currently is |
06:01:01 | * | gangstacat joined #nim |
06:02:10 | * | endragor joined #nim |
06:06:48 | * | endragor quit (Ping timeout: 240 seconds) |
06:10:04 | * | Yardanico joined #nim |
06:11:07 | * | rauss quit (Quit: WeeChat 1.9) |
06:21:57 | * | arnaud2 quit (Quit: WeeChat 1.9) |
06:29:11 | * | haha_ joined #nim |
06:29:35 | * | jackv quit (Quit: WeeChat 1.8) |
06:32:05 | Yardanico | skrylar, probably https://nim-lang.org/docs/net.html#SslContext ? |
06:32:35 | * | haha_ quit (Client Quit) |
06:32:36 | FromGitter | <Yardanico> you can wrap your socket with ssl context |
06:33:15 | FromGitter | <Yardanico> https://nim-lang.org/docs/net.html#wrapSocket ⏎ ⏎ but it says there that it is untested |
06:33:34 | FromGitter | <Yardanico> ah |
06:33:36 | FromGitter | <Yardanico> they'wrong |
06:33:39 | FromGitter | <Yardanico> it's actually tested |
06:33:44 | FromGitter | <Yardanico> https://github.com/nim-lang/Nim/blob/5f685bb0e6b2d68b9796e6a7d29469ce3f3b38ec/tests/async/tasyncssl.nim |
06:34:08 | FromGitter | <Yardanico> well yeah, no one tested it for security vulnerabilities |
06:36:25 | * | nsf joined #nim |
06:38:38 | * | endragor joined #nim |
06:43:24 | * | endragor quit (Ping timeout: 252 seconds) |
06:46:56 | FromGitter | <jrdlph> regarding nimble, is there a way to specify dependencies not published in a local/remote repository? |
06:48:48 | FromGitter | <jrdlph> *is thinking maybe a project-local repository/registry in which he associates package names with urls* |
06:51:27 | skrylar | tbh i don't use nimble to manage my packages. i use it to find them and then use git submodules |
06:51:29 | Yardanico | yes there is |
06:51:35 | skrylar | which in turn don't help with private packages tho :( |
06:51:41 | Yardanico | you can specify git repositories IIRC |
06:51:59 | FromGitter | <jrdlph> where at? directly in the 'requires' directive? |
06:52:22 | * | Sembei joined #nim |
06:52:57 | FromGitter | <jrdlph> i know you can make your own user-level package lists with .config/nimble/nimble.ini , just not sure how to do something similar at the package level |
06:54:01 | * | Pisuke quit (Ping timeout: 240 seconds) |
06:58:19 | FromGitter | <zacharycarter> yes @jrdlph |
06:58:36 | FromGitter | <zacharycarter> right in the requires directive |
06:58:38 | * | haha_ joined #nim |
06:58:39 | FromGitter | <jrdlph> alright |
06:58:42 | FromGitter | <zacharycarter> requires "giturlhere" |
06:58:49 | FromGitter | <jrdlph> excellent |
06:59:11 | Yardanico | and probably mercurial url will work too |
06:59:33 | FromGitter | <zacharycarter> I think for mercurial it tries to use some h2git |
06:59:39 | Yardanico | nah |
06:59:42 | skrylar | mercurial is ok |
06:59:46 | Yardanico | it uses your hg client :) |
06:59:50 | FromGitter | <zacharycarter> oh |
06:59:57 | skrylar | i liked the patch queues |
07:00:02 | * | MyMind joined #nim |
07:00:10 | * | Sembei quit (Ping timeout: 240 seconds) |
07:00:18 | * | FromGitter * jrdlph wonders if he could get it to use darcs |
07:00:19 | FromGitter | <zacharycarter> does anyone know if it's possible to make a js proc async in Nim? |
07:01:20 | skrylar | javascript doesn't have asynchronicity though |
07:01:31 | FromGitter | <zacharycarter> I mean for the node backend sorry |
07:02:00 | skrylar | yea, but node doesn't have it either. it just has some clever juggling |
07:02:12 | Yardanico | python range in nim: https://play.nim-lang.org/?gist=2fdd06608f53a11a867943dfed9e0b1b I consider it a bit hacky (probably because of dummy = false), but it's the only way to distinguish templates vs iterators |
07:02:15 | Yardanico | but I'm amazed |
07:02:28 | Yardanico | that you can port a function from dynamically typed language to statically typed one |
07:02:39 | skrylar | that's always been true, Yardanico |
07:02:43 | Yardanico | it works even with range(0, -10, -2) |
07:02:50 | skrylar | it just requires more punches to the face in the form of syntax boilerplate |
07:03:19 | * | Arrrr joined #nim |
07:03:33 | skrylar | pondering if it would be worth using a macro to do this vector code :\ |
07:04:07 | skrylar | it's a toss-up because macros and nim doc tend to react stupid with each other, though hand-writing versions of vector math procs has no value |
07:06:18 | * | PMunch joined #nim |
07:06:29 | skrylar | also the person who requested the native toml4 reader *might* get their wish |
07:06:37 | skrylar | the bson thing i was working on is almost done |
07:15:17 | * | yglukhov joined #nim |
07:16:48 | * | yglukhov quit (Remote host closed the connection) |
07:17:00 | * | yglukhov joined #nim |
07:34:20 | skrylar | i'll admit i barely understand most of this math |
07:34:40 | skrylar | this book shows a wall of calculus as 'proof' for ray/plane intersection and its just like. ok |
07:37:21 | * | couven92 joined #nim |
07:41:19 | * | gangstacat quit (Quit: Leaving) |
07:43:10 | * | gangstacat joined #nim |
07:44:53 | * | gangstacat quit (Client Quit) |
07:50:22 | * | endragor joined #nim |
07:55:01 | * | endragor quit (Ping timeout: 240 seconds) |
07:57:43 | * | BitPuffin|osx joined #nim |
07:57:58 | Yardanico | lol |
07:59:25 | Yardanico | https://gist.github.com/Yardanico/200b607b790a7b79c1d2d95c7f56bca3 with using pylib and without specifying specific int types it's only 180 msec |
07:59:31 | Yardanico | and pure nim version is 120 msec |
08:00:02 | Yardanico | (also you can see other than "var", @[] instead of @, and some types it looks like python version :D |
08:01:02 | Yardanico | but some things in pylib are VERY hacky |
08:01:35 | Yardanico | for example I needed to add pythons version of "int" to str conversion, and it shadows system's int, so I created another template |
08:02:13 | * | nhywyll joined #nim |
08:03:54 | Yardanico | https://github.com/Yardanico/nimpylib but I know that my code here is very hackish |
08:04:02 | Yardanico | VERY hackish |
08:05:03 | * | endragor joined #nim |
08:05:28 | * | vlad1777d joined #nim |
08:05:56 | Yardanico | but honestly I'm amazed it's so fast |
08:06:07 | Yardanico | I didn't optimize procedures at all |
08:06:34 | skrylar | c code can be |
08:06:59 | Yardanico | skrylar, well did you look at this gist? it looks almost like python yet it's much faster |
08:09:35 | Yardanico | I get 1.3 seconds with Python 3.6, 0.18 with pylib version, and 0.12 with pure version |
08:09:54 | * | yglukhov quit (Remote host closed the connection) |
08:10:58 | * | yglukhov joined #nim |
08:11:08 | skrylar | Yardanico, try -d:release :p |
08:11:15 | Yardanico | skrylar, it's with -d:release :P |
08:11:18 | skrylar | ah |
08:11:29 | skrylar | yea looks mean nothing. as far as machine code is concerned |
08:11:33 | Yardanico | skrylar, pure version is as fast as C and C++ |
08:11:42 | skrylar | the thing with nim is you can easily make sugar for stuff but that doesn't really exist in c |
08:11:50 | Yardanico | it's from here https://blog.famzah.net/2016/09/10/cpp-vs-python-vs-php-vs-java-vs-others-performance-benchmark-2016-q3/ |
08:12:05 | Yardanico | def- helped me to optimize my first version of this microbenchmark |
08:12:59 | Yardanico | https://gist.github.com/def-/fd6f528e51683f7b1baa60518b426d74 |
08:15:10 | * | yglukhov quit (Ping timeout: 240 seconds) |
08:16:30 | * | vlad1777d quit (Ping timeout: 240 seconds) |
08:20:41 | FromGitter | <jrdlph> the difference between ref and ptr is garbage collection? Or is it something else? |
08:20:51 | Yardanico | yeah |
08:21:02 | Yardanico | AFAIK ref is a traced reference |
08:21:08 | Yardanico | ptr is an untraced reference |
08:21:20 | Yardanico | but I may be wrong because I don't use ptr |
08:21:24 | Yardanico | (only for C FFI) |
08:21:41 | FromGitter | <jrdlph> yes, the manual says 'traced' but i wasn't entirely sure that that had anything to do with garbage collection. Sounded very garbage-collectionie though |
08:29:43 | * | vlad1777d joined #nim |
08:57:08 | * | Vladar joined #nim |
08:59:27 | PMunch | Traced references(ref) point to objects of a garbage collected heap, untraced references(ptr) point to manually allocated objects or to objects somewhere else in memory. Thus untraced references(ptr) are unsafe. However for certain low-level operations (accessing the hardware) untraced references(ptr) are unavoidable. |
08:59:41 | PMunch | From the manual, italics mine for clarity |
09:00:35 | PMunch | Typically you will use ptr when dealing with C code wrappers as they allocate and deallocate their own memory and you only need the pointer to pass between functions |
09:04:33 | FromGitter | <zacharycarter> I'm about to play with nim cuda |
09:04:42 | FromGitter | <zacharycarter> see if I can get an example running before my presentation |
09:08:19 | * | jinshil quit (Quit: Good-bye!) |
09:12:57 | * | haha_ quit (Quit: haha_) |
09:12:58 | * | chemist69 quit (Ping timeout: 276 seconds) |
09:15:38 | * | xet7 joined #nim |
09:17:26 | * | haha_ joined #nim |
09:21:27 | * | MyMind quit (Ping timeout: 240 seconds) |
09:23:30 | FromGitter | <zacharycarter> damn I wish I understood how to run this |
09:24:06 | * | MyMind joined #nim |
09:25:57 | * | yglukhov joined #nim |
09:26:15 | * | chemist69 joined #nim |
09:26:39 | * | yglukhov quit (Read error: Connection reset by peer) |
09:27:07 | * | yglukhov joined #nim |
09:31:18 | * | yglukhov quit (Ping timeout: 240 seconds) |
09:34:55 | * | vlad1777d quit (Ping timeout: 248 seconds) |
09:37:03 | * | skrylar quit (Remote host closed the connection) |
09:41:52 | * | yglukhov joined #nim |
09:43:12 | PMunch | zacharycarter, how to run CUDA code? |
09:44:34 | Yardanico | is there something wrong with this code? |
09:44:34 | Yardanico | https://gist.github.com/Yardanico/371ccbc984c07f0de7b52f643e060a64 |
09:44:38 | Yardanico | it crashes the compiler |
09:44:49 | Yardanico | I'll make an issue, but maybe I'm misusing concepts? |
09:46:43 | PMunch | Running it on the playground it throws a compiler error, but doesnt' crash |
09:46:43 | Yardanico | https://github.com/nim-lang/Nim/issues/6277 |
09:46:52 | PMunch | Says it's got a type mismatch |
09:47:02 | Yardanico | maybe because there was concept improvemenents in 0.17.0? |
09:47:20 | PMunch | What does the playground run? |
09:47:24 | Yardanico | 0.16.0 |
09:47:30 | PMunch | Ah, that might be it then |
09:47:52 | PMunch | I unfortunately don't have Nim installed here so I can't check it out for you :( |
09:48:24 | Yardanico | hmm |
09:48:28 | Yardanico | it seems to be array-specific issue |
09:48:30 | Yardanico | works with sequence |
09:49:48 | PMunch | Well, arrays are a bit strange in Nim |
09:50:26 | FromGitter | <stisa> @zacharycarter did you see https://github.com/jcosborn/cudanim ? It was in the presentation linked here some days ago, it has some demos |
09:50:28 | PMunch | But I still don't see why the compiler should crash because of it |
09:51:17 | Yardanico | line 839 is var first = intLiteral(firstOrd(ty)) |
09:52:36 | Yardanico | so yeah it's indeed something to do with arrays |
09:52:40 | Yardanico | proc is called proc genArrayElem(p: BProc, x, y: PNode, d: var TLoc) = |
09:52:59 | FromGitter | <zacharycarter> @stisa yup! I'm trying to run said demos now |
09:53:20 | FromGitter | <zacharycarter> @PMunch yeah - trying to run the cuda examples from nimcuda |
09:53:50 | Yardanico | ah |
09:54:04 | Yardanico | this procedure somehow gets "Iterable[int, Iterable]" |
09:54:08 | Yardanico | as an array type? |
09:54:14 | FromGitter | <zacharycarter> oh wow it worked |
09:55:41 | PMunch | :) |
09:56:20 | PMunch | Yardanico, I think that is a type with two generics |
09:57:11 | PMunch | I think it struggles to determine what T is supposed to be |
09:57:22 | Yardanico | PMunch, so genBracketExpr creates ty variable, which is "array[0..4, int]", and accepts n nimnode, which is "iter[i]" |
09:57:33 | PMunch | Try to do something like "var s:int = sum([1, 2, 3, 4, 5]) |
09:57:54 | Yardanico | same error |
09:58:13 | Yardanico | basically it tries to get minimal value of tyUserTypeClassInst type |
09:58:36 | Yardanico | maybe this is a concept limitation currently? |
09:59:01 | Yardanico | hmm, no |
09:59:10 | Yardanico | if I change concept to "x.items() is T", error is the same |
09:59:38 | PMunch | Hmm, the items iterator for array is a bit different than the rest.. |
09:59:52 | PMunch | Maybe that's why array fails why sequence does not |
10:05:13 | FromGitter | <zacharycarter> still curious how I can produce async procs for the nodejs backend |
10:34:11 | * | dddddd joined #nim |
10:38:06 | FromGitter | <stisa> @zacharycarter You probably need to use emit or change the js backend to emit `async function` instead of `function` when the proc has the async pragma |
10:39:07 | FromGitter | <zacharycarter> @stisa yeah - I was playing around with wrapping graphql last night and I was getting reasonable results but I couldn't figure out how to create async callbacks for koa |
10:40:03 | FromGitter | <zacharycarter> an actual Nim graphql implementation would be killer |
10:40:10 | FromGitter | <zacharycarter> but it looks like a lot of work |
10:47:45 | * | haha_ quit (Quit: haha_) |
10:48:46 | * | haha_ joined #nim |
11:00:49 | * | Araq_ joined #nim |
11:01:06 | Yardanico | wow |
11:01:11 | Yardanico | that was fast |
11:01:24 | Yardanico | ah, auto-ban |
11:01:57 | FromGitter | <jrdlph> @Yardanico it works with a simpler sum function (that specifies the iterable is over ints), and if you use the right syntax for specifying that the argument is iterable. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59a003a4ba0f0f6e38e017d5] |
11:02:27 | Yardanico | jrdlph, ah, so it's probably my fault |
11:03:08 | FromGitter | <jrdlph> but if you, for instance, specify the argument type for sum like `sum(things: Iterable[int]):int` it barfs |
11:03:18 | FromGitter | <jrdlph> XD |
11:03:58 | Yardanico | well I know it would be easy with ints, I want it to work with any types |
11:04:16 | FromGitter | <jrdlph> well, the types would have to have + |
11:04:24 | FromGitter | <jrdlph> and T does not |
11:04:28 | FromGitter | <Yardanico> lol wait |
11:04:29 | FromGitter | <Yardanico> waaait |
11:05:02 | FromGitter | <Yardanico> ```code paste, see link``` ⏎ ⏎ Why this works? Lol [https://gitter.im/nim-lang/Nim?at=59a0045d76a757f808e05c99] |
11:05:12 | FromGitter | <jrdlph> i have no idea |
11:05:32 | FromGitter | <jrdlph> put in some tuples see what happens |
11:06:00 | FromGitter | <Yardanico> is nim compiler so smart that it can detect the type of iterable? |
11:06:44 | FromGitter | <jrdlph> it does not typecheck on my side |
11:07:14 | FromGitter | <Yardanico> what do you mean? |
11:07:19 | FromGitter | <Yardanico> it doesn't work for you? |
11:07:39 | FromGitter | <jrdlph> specifying sum like that for me leads to a type error in the invocation of sum() |
11:07:43 | FromGitter | <jrdlph> with a list of ints |
11:07:53 | FromGitter | <Yardanico> well I have nim devel |
11:07:56 | FromGitter | <Yardanico> not 0.17.0 |
11:07:57 | FromGitter | <jrdlph> oh |
11:08:09 | FromGitter | <jrdlph> i thought you were still in the playground |
11:08:12 | FromGitter | <Yardanico> ah |
11:08:14 | FromGitter | <Yardanico> 1) 16.0 is very old |
11:08:20 | FromGitter | <Yardanico> playground uses 0.16.0 atm |
11:08:36 | FromGitter | <jrdlph> it really should not be doing that though. I don't think its sound |
11:08:58 | FromGitter | <jrdlph> at least not for how this sort of thing should work in my head |
11:09:09 | FromGitter | <Yardanico> And in 0.17.0 a lot of improvements were done to concepts |
11:09:25 | FromGitter | <Yardanico> well I don't know how this works, maybe we can ask ⏎ @zah or Araq? |
11:10:01 | * | FromGitter * jrdlph now has to get devel and play around with this |
11:10:23 | Yardanico | well you can try 0.17.0 |
11:10:35 | FromGitter | <jrdlph> im on 0.17.0 release |
11:10:39 | Yardanico | hmm, ok then |
11:10:49 | Yardanico | maybe this is a bug |
11:11:07 | FromGitter | <jrdlph> did you try to call sum with something without addition? |
11:11:30 | FromGitter | <jrdlph> a distinct of anything should do |
11:11:34 | Yardanico | yes |
11:11:44 | Yardanico | it shows proper type mismatch |
11:11:47 | Yardanico | for echo sum(["x", "y"]) |
11:12:09 | Yardanico | since strings doesn't have "+" procedure |
11:12:50 | FromGitter | <jrdlph> Ok, yeah that is blowing my mind then. |
11:12:54 | FromGitter | <jrdlph> lol |
11:13:44 | Yardanico | ah |
11:13:45 | Yardanico | The concept types can be parametric just like the regular generic types: |
11:13:47 | * | vendethiel joined #nim |
11:13:48 | Yardanico | maybe because of this |
11:13:54 | Yardanico | https://nim-lang.org/docs/manual.html#generics-generic-concepts-and-type-binding-rules |
11:13:58 | * | vendethiel is now known as Ven`` |
11:14:06 | Yardanico | Unbound static params will be inferred from expressions involving the == operator and also when types dependent on them are being matched: |
11:16:01 | Yardanico | oh wait |
11:16:07 | Yardanico | we are noobs LOL |
11:16:17 | Yardanico | it was just calling built-in sum function :D |
11:16:41 | FromGitter | <jrdlph> oh. well that makes sense then, yeah i didn't have math imported haha |
11:17:31 | * | haha_ quit (Quit: haha_) |
11:17:35 | FromGitter | <jrdlph> yeah because T is still unbound in the body of sum there. To assume it has + doesn't seem like it would make sense, unless it was doing something like generating a specialization of it or something |
11:21:57 | Yardanico | I'll wait for some info on compiler crash then |
11:22:54 | Yardanico | the problem is - I can't even do something like "when T is array: error" |
11:23:29 | FromGitter | <jrdlph> But you could also make an 'Addable' that implements + |
11:23:48 | FromGitter | <jrdlph> and constrain T to Addable |
11:23:57 | FromGitter | <jrdlph> or Addible, idk |
11:25:33 | FromGitter | <jrdlph> well, it would need +, and also 0, or else empty lists couldnt work |
11:26:03 | FromGitter | <jrdlph> i think thats called a monoid |
11:29:03 | FromGitter | <jrdlph> so something like ⏎ ⏎ ```type CanPlusAndZero = category a,b, type T ⏎ 0 is T ⏎ a + b``` [https://gitter.im/nim-lang/Nim?at=59a009fe614889d47586434f] |
11:33:17 | * | haha_ joined #nim |
11:34:10 | * | sleepyqt joined #nim |
11:34:53 | Yardanico | jrdlph: it wouldn't help |
11:35:13 | Yardanico | there's no error with + proc |
11:35:26 | Yardanico | there's an error passing array which matches the concept to proc which accepts it |
11:35:44 | Yardanico | I'll show you |
11:35:47 | FromGitter | <jrdlph> ok |
11:35:58 | * | dom96|w joined #nim |
11:38:57 | dom96|w | zacharycarter: why are you trying to use Nim on node? |
11:39:37 | Yardanico | jrdlph: https://gist.github.com/Yardanico/4f9aa86bc4b3bff6254958cb3ca59aff |
11:44:21 | Yardanico | well it's probably that arrays are very special |
11:47:58 | FromGitter | <jrdlph> its partly to do with how the type arguments are introduced |
11:48:14 | dom96|w | also, why isn't the Nim playground running 0.17.0? |
11:48:23 | FromGitter | <jrdlph> here, I have something very similar, that comples fine, but then segfaults when it runs |
11:48:35 | Yardanico | hmm, maybe zacharycarter didn't have time to upgrade it, but I don't know |
11:48:52 | FromGitter | <Yardanico> @zacharycarter |
11:49:28 | FromGitter | <Yardanico> @jrdlph can you share it? |
11:49:31 | FromGitter | <jrdlph> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59a00ecbee5c9a4c5ffa718b] |
11:50:02 | FromGitter | <Yardanico> it does not crash for me |
11:50:12 | FromGitter | <jrdlph> when you run the program? |
11:50:17 | FromGitter | <Yardanico> yes |
11:50:20 | FromGitter | <Yardanico> it echoes 10 |
11:50:33 | FromGitter | <jrdlph> i get a segfault |
11:50:47 | FromGitter | <jrdlph> (on 0.17.0 release) |
11:51:20 | FromGitter | <Yardanico> well with this proc sum only works for arrays |
11:51:26 | FromGitter | <jrdlph> lol |
11:53:00 | FromGitter | <jrdlph> I think maybe this potato needs to go back into the oven to bake for a while |
11:53:11 | FromGitter | <jrdlph> not quite ready |
11:53:53 | Yardanico | well this seems to be an array-specific issue only |
11:53:59 | Yardanico | concepts can be very complex |
11:54:02 | Yardanico | and they work |
11:54:57 | FromGitter | <jrdlph> that any of it works is a wonder to me. its a very slick system |
11:56:40 | euantor | It would be neat if the playground could let you run you code on a choice of versions with a dropdown (similar to the rust playground where you can run on rust nightly or standard) |
11:57:04 | Yardanico | it would require a build system :) even simple one, but a build system :) |
11:57:18 | Yardanico | to build nightly at least once a day |
11:57:35 | Yardanico | but yeah, would be very nice |
11:58:49 | euantor | It's all ran in Docker containers, so could always have a nightly Docker image that gets rebuilt at 1AM every day or something |
11:59:34 | dom96|w | indeed :) |
11:59:46 | dom96|w | Make a PR :P |
12:00:25 | euantor | I'll need to find some free time first but I'll try |
12:00:33 | Yardanico | well currently playground is only 150 lines of nim |
12:10:09 | * | kunev quit (Ping timeout: 248 seconds) |
12:15:36 | * | endragor quit (Remote host closed the connection) |
12:18:18 | * | endragor joined #nim |
12:25:52 | * | kunev joined #nim |
12:29:23 | * | Snircle joined #nim |
12:32:48 | * | dddddd quit (*.net *.split) |
12:32:48 | * | Arrrr quit (*.net *.split) |
12:32:48 | * | Yardanico quit (*.net *.split) |
12:32:48 | * | Jesin quit (*.net *.split) |
12:32:48 | * | gmpreussner quit (*.net *.split) |
12:32:48 | * | niv quit (*.net *.split) |
12:33:09 | * | Jesin joined #nim |
12:33:13 | * | Arrrr joined #nim |
12:33:13 | * | Arrrr quit (Changing host) |
12:33:13 | * | Arrrr joined #nim |
12:33:14 | * | niv joined #nim |
12:33:17 | * | dddddd joined #nim |
12:33:18 | * | Yardanico joined #nim |
12:33:21 | * | gmpreussner joined #nim |
12:35:17 | * | yaiyan quit (Ping timeout: 260 seconds) |
12:36:57 | * | yaiyan joined #nim |
12:39:38 | * | nsf quit (Quit: WeeChat 1.9) |
12:42:02 | * | pilne joined #nim |
12:45:21 | * | endragor quit (Remote host closed the connection) |
12:49:15 | FromGitter | <zacharycarter> @dom96 I was trying to play around with using the node graphql api |
12:49:28 | FromGitter | <zacharycarter> @dom96 it's using whatever version docker is |
12:53:05 | FromGitter | <zacharycarter> if docker hub is up to date, I probably need to rebuild the image |
12:55:30 | Yardanico | it's 0.17.0 afaik |
12:55:51 | * | endragor joined #nim |
12:55:56 | FromGitter | <zacharycarter> hrm I'll try to rebuild the dockerhub image |
12:55:58 | Yardanico | latest-regular |
12:59:21 | FromGitter | <zacharycarter> I just rebuilt the docker image |
12:59:23 | FromGitter | <zacharycarter> so hopefully it's up to date now |
13:07:03 | * | arnetheduck joined #nim |
13:10:02 | Yardanico | yglukhov, it seems that everything apart from 64-bit gcc is affected |
13:10:05 | Yardanico | (on linux) |
13:10:54 | yglukhov | Yardanico: maybe you're just lucky enough? try run it in a while true in sh |
13:11:29 | * | ludocode quit (Ping timeout: 248 seconds) |
13:11:46 | Yardanico | yglukhov, running it now, no, it doesn't crash at all |
13:12:13 | yglukhov | thats strange... |
13:13:10 | yglukhov | on macos i cant get this code to work properly no matter gcc or clang, 64 or 32. |
13:13:18 | * | endragor quit (Remote host closed the connection) |
13:13:34 | yglukhov | the results are somewhat random but always wrong |
13:13:36 | Yardanico | yglukhov, what is your gcc? |
13:13:48 | Yardanico | yglukhov, I have 7.1.1 |
13:13:57 | Yardanico | and clang 4.0.1 |
13:14:19 | yglukhov | well... my gcc is kinda llvm... |
13:14:19 | yglukhov | =) |
13:14:24 | yglukhov | Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1 |
13:14:24 | yglukhov | Apple LLVM version 8.1.0 (clang-802.0.42) |
13:14:24 | yglukhov | Target: x86_64-apple-darwin16.7.0 |
13:14:26 | yglukhov | Thread model: posix |
13:14:28 | yglukhov | InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin |
13:14:31 | Yardanico | ah |
13:14:44 | Yardanico | isn't this a clang emulating gcc? |
13:15:16 | Yardanico | ok, doesn't matter |
13:15:26 | * | endragor joined #nim |
13:15:58 | yglukhov | dunno, its not a symlink or smth, but i recall apple used gcc frontend with llvm backend a while ago, maybe thats the case |
13:16:22 | * | ludocode joined #nim |
13:17:59 | Yardanico | I use clang on linux because it has faster compilation :) |
13:18:34 | yglukhov | there are rumors that gcc often produces faster binaries though ;) |
13:18:47 | Yardanico | yglukhov, well yeah I know about this |
13:18:53 | Yardanico | probably it's true considering how old GCC is |
13:19:11 | Yardanico | but clang is the future I would say |
13:19:23 | yglukhov | yup, just like nim is :D |
13:20:35 | * | endragor quit (Ping timeout: 240 seconds) |
13:21:55 | Yardanico | yglukhov, compiling a small file: with gcc - 1.6sec, with clang - 0.9 sec (in release mode) |
13:22:08 | Yardanico | and speed is identical |
13:22:28 | Yardanico | clang even produces smaller binary |
13:22:37 | Yardanico | 64kb vs 96kb |
13:23:17 | yglukhov | yeah, i think clang was initially designed with compilation speed in mind. while for gcc it was too late when the problem was realized =) |
13:25:44 | Yardanico | yglukhov, well yeah, clang is more modern and it can learn a lot from bad/good things in gcc |
13:26:33 | federico3 | yglukhov: "rumors"? |
13:27:18 | yglukhov | federico3: theres ';)' at the end |
13:39:01 | * | yglukhov quit (Remote host closed the connection) |
13:45:28 | * | yglukhov joined #nim |
13:46:17 | * | nattefrost joined #nim |
13:46:20 | * | yglukhov quit (Read error: Connection reset by peer) |
13:46:42 | * | yglukhov joined #nim |
13:48:48 | * | haha_ quit (Quit: haha_) |
13:51:22 | * | yglukhov quit (Ping timeout: 264 seconds) |
13:52:19 | * | rauss joined #nim |
14:02:30 | * | nhywyll quit (Quit: nhywyll) |
14:07:20 | * | PMunch quit (Quit: Leaving) |
14:10:34 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
14:13:48 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
14:16:03 | * | dom96|w joined #nim |
14:20:43 | * | relax joined #nim |
14:21:52 | * | endragor joined #nim |
14:25:13 | * | PMunch joined #nim |
14:25:13 | * | yglukhov joined #nim |
14:25:30 | * | Yardanico quit (Ping timeout: 240 seconds) |
14:28:18 | * | Yardanico joined #nim |
14:28:33 | * | relax quit (Remote host closed the connection) |
14:28:48 | Yardanico | wow |
14:28:48 | Yardanico | https://gist.github.com/anonymous/d0328affcae3be6ab6b734899bc70e25 |
14:29:20 | Yardanico | I just copy-pasted this simple class and only changed exception calling |
14:29:25 | Yardanico | and nim can successfully parse it with a macro |
14:31:02 | Yardanico | well nothing big here |
14:32:02 | FromGitter | <Varriount> Yardanico: Aiming for python to Nim translator? |
14:32:53 | Yardanico | well just playing around :) but honestly I want to have a starting point for someone (or me) to start implementing actual python-to-nim translator |
14:33:05 | Yardanico | I think nim is closer to python than Go, for example (grumpy) |
14:34:45 | * | nattefrost quit (Remote host closed the connection) |
14:34:53 | Yardanico | for example if you have isistance in Python, you can make a generic proc in nim with a couple of "when" |
14:35:07 | dom96|w | Yardanico Nice! |
14:35:11 | dom96|w | This is exactly what I envisioned |
14:35:56 | * | dom96|w had this idea as well :) |
14:36:03 | FromGitter | <Varriount> I wouldn't even mind something that does a partial translation |
14:36:11 | dom96|w | Awesome to see it working so well. |
14:36:36 | dom96|w | Also, exceptions will hopefully soon become: raise Exception(msg: "foobar") |
14:36:42 | Yardanico | hmm, nice |
14:36:47 | dom96|w | We just need to change all exceptions to be refs |
14:36:57 | Yardanico | Varriount: well yeah I'm trying to make something which would do at least a partial translation |
14:39:24 | dom96|w | Yardanico: Please write an article on nim-lang.org about this :D |
14:40:19 | Yardanico | dom96|w, there's nothing big here yet for an article :) everyone (experienced nim programmer) can port some simple python functions to nim and make a macro like this |
14:40:39 | dom96|w | I disagree, this is big enough for an article. |
14:42:45 | FromGitter | <zetashift> Seconded; also it be a nice comfy intro to macros? |
14:44:06 | Yardanico | lol |
14:44:25 | Yardanico | simplest one works: |
14:44:38 | Yardanico | https://gist.github.com/Yardanico/50dc03c2503a39ae9419e80f8a86d2d6 |
14:44:54 | Yardanico | but you have to specify object types yourself |
14:45:15 | Yardanico | hmm |
14:45:18 | Yardanico | maybe not fully |
14:45:31 | Yardanico | ah, I forgot to import my "pylib" file |
14:46:09 | Yardanico | ah no it actually works |
14:46:35 | Yardanico | updated the gist |
14:49:55 | * | vlad1777d joined #nim |
14:50:42 | * | Sentreen quit (Ping timeout: 252 seconds) |
14:59:12 | Yardanico | doing proper newClassName() proc generation |
14:59:22 | Yardanico | instead of calling init manually :) |
15:01:05 | * | francisl joined #nim |
15:03:04 | * | couven92 quit (Quit: Client disconnecting) |
15:03:34 | * | Sentreen joined #nim |
15:09:05 | * | Matthias247 joined #nim |
15:09:27 | * | relax joined #nim |
15:09:52 | * | vlad1777d quit (Ping timeout: 260 seconds) |
15:11:56 | Yardanico | ok it now works but macro became very hacky, so I need to split it into procs (for example - 1 proc generates code for constructor, 2 proc generates usual procedures) |
15:15:35 | * | Trustable joined #nim |
15:16:12 | * | endragor quit (Remote host closed the connection) |
15:22:26 | * | endragor joined #nim |
15:22:29 | * | vlad1777d joined #nim |
15:23:16 | * | linsword joined #nim |
15:24:05 | * | linsword quit (Client Quit) |
15:26:04 | * | miran joined #nim |
15:30:10 | Yardanico | I've updated my gist again :) https://gist.github.com/Yardanico/50dc03c2503a39ae9419e80f8a86d2d6 |
15:33:24 | federico3 | TIL https://github.com/goby-lang/goby |
15:34:27 | Yardanico | wow |
15:34:48 | Yardanico | domain-specific language? |
15:34:51 | Yardanico | it seems |
15:35:08 | miran | hi, it's me again with my beginner questions: |
15:35:45 | miran | how to create an array consisting for example of ints [1..1000]? |
15:36:18 | Yardanico | miran, var data: array[1..1000, int] |
15:36:23 | Yardanico | but you'll have to access it from 1 index |
15:36:32 | miran | i've found there's a list comprehension in `future` module. anything "non-futuristic"? |
15:36:42 | Yardanico | miran, not yet |
15:37:01 | Yardanico | maybe we'll have something when for becomes an expression |
15:37:21 | relax | oooo list comprehensions -- are they expected to make it out of future eventually? |
15:37:50 | Yardanico | relax, probably after making "for" an expression it would be possible to remove typing |
15:38:23 | Yardanico | or at least you'll write list comprehensions in more nice-looking syntax |
15:38:27 | relax | what's the upshot there, doesn't the => operator already kind of do that? |
15:38:51 | Yardanico | relax, you can't currently write [for x in data: x] |
15:39:24 | * | Arrrr quit (Quit: Leaving.) |
15:39:25 | Yardanico | even with a macro |
15:39:44 | relax | oh sorry, I'm mixing up anonymous functions and list comprehensions |
15:39:53 | miran | Yardanico: thanks for that `data: array` solution, it will do it for now |
15:40:03 | Yardanico | miran, what do you mean "for now"? |
15:41:16 | miran | i thought there might be a better way than iterating through indices (by creating an array with wanted values) |
15:41:55 | Yardanico | miran, type Customer = ref object |
15:41:55 | Yardanico | name: string |
15:41:55 | Yardanico | balance: float |
15:41:55 | Yardanico | class Customer(object): |
15:41:55 | Yardanico | """A customer of ABC Bank with a checking account. Customers have the |
15:41:56 | Yardanico | following properties: |
15:41:58 | Yardanico | Attributes: |
15:42:00 | Yardanico | name: A string representing the customer's name. |
15:42:02 | Yardanico | balance: A float tracking the current balance of the customer's account. |
15:42:06 | Yardanico | """ |
15:42:08 | Yardanico | def init(self, name, balance=0.0): |
15:42:10 | Yardanico | """Return a Customer object whose name is *name* and starting |
15:42:12 | Yardanico | balance is *balance*.""" |
15:42:14 | Yardanico | self.name = name |
15:42:16 | Yardanico | self.balance = balance |
15:42:18 | Yardanico | def withdraw(self, amount): |
15:42:20 | Yardanico | """Return the balance remaining after withdrawing *amount* |
15:42:22 | Yardanico | dollars.""" |
15:42:24 | Yardanico | if amount > self.balance: |
15:42:26 | Yardanico | raise newException(ValueError, "Amount greater than available balance.") |
15:42:28 | Yardanico | self.balance -= amount |
15:42:30 | Yardanico | return self.balance |
15:42:32 | Yardanico | def deposit(self, amount): |
15:42:36 | Yardanico | """Return the balance remaining after depositing *amount* |
15:42:38 | Yardanico | dollars.""" |
15:42:40 | Yardanico | self.balance += amount |
15:42:42 | Yardanico | return self.balance |
15:42:44 | Yardanico | let c = newCustomer("Tiberium", 500) |
15:42:46 | Yardanico | echo "new balance = ", c.withdraw(250.0) |
15:42:48 | Yardanico | echo "new balance = ", c.deposit(1337.0) |
15:42:50 | Yardanico | type Shape = ref object |
15:42:52 | Yardanico | x, y: float |
15:42:54 | Yardanico | description, author: string |
15:42:56 | Yardanico | #An example of a class |
15:42:58 | Yardanico | class Shape: |
15:43:00 | Yardanico | def init(self, x, y): |
15:43:02 | Yardanico | self.x = x |
15:43:06 | Yardanico | self.y = y |
15:43:08 | Yardanico | self.description = "This shape has not been described yet" |
15:43:10 | Yardanico | self.author = "Nobody has claimed to make this shape yet" |
15:43:12 | Yardanico | def area(self): |
15:43:14 | Yardanico | return self.x * self.y |
15:43:16 | Yardanico | def perimeter(self): |
15:43:18 | Yardanico | return 2 * self.x + 2 * self.y |
15:43:20 | Yardanico | def describe(self, text): |
15:43:22 | Yardanico | self.description = text |
15:43:24 | Yardanico | def authorName(self, text): |
15:43:26 | Yardanico | self.author = text |
15:43:28 | Yardanico | def scaleSize(self, scale): |
15:43:30 | Yardanico | self.x = self.x * scale |
15:43:32 | Yardanico | self.y = self.y * scale |
15:43:36 | Yardanico | let sh = newShape(5.0, 15.3) |
15:43:38 | Yardanico | echo sh.area() |
15:43:40 | Yardanico | omg |
15:43:42 | Yardanico | SORRY! |
15:43:44 | Yardanico | https://nim-lang.org/docs/algorithm.html |
15:43:46 | Yardanico | miran, ^ |
15:43:48 | Yardanico | there's "fill" proc |
15:44:17 | * | linsword13 joined #nim |
15:44:49 | miran | Yardanico: thanks, will look into that! |
15:45:23 | Yardanico | miran, e.g. you have "var data: array[0..100, int]" and then you just do "data.fill(42)" |
15:46:01 | * | linsword13 left #nim (#nim) |
15:46:10 | miran | "what do you mean "for now"?" -> indices work if i want consecutive numbers, but if i want for example just even numbers, than comprehensions might be the way to go.... |
15:46:38 | miran | "what do you mean "for now"?" -> indices work if i want consecutive numbers, but if i want for example just even numbers, then comprehensions might be the way to go.... |
15:46:45 | miran | (sorry for double post) |
15:46:51 | Yardanico | miran, yeah, list comprehension creates a sequence |
15:49:58 | miran | thanks! i'll continue with my learning/experimenting, and i'll be back with more questions for sure :) |
15:57:14 | FromGitter | <zacharycarter> Yardanico: I keep forgetting you're tiberium |
15:57:19 | FromGitter | <zacharycarter> also your py2nim thing doesn't compile for me |
15:57:35 | Yardanico | well py2nim isn't mine, it's created by Araq |
15:57:42 | Yardanico | and currently I use quote do which is fixed in devel |
15:57:49 | Yardanico | you mean py2nim.nim file? |
15:58:02 | FromGitter | <zacharycarter> I mean the gist you just shared with us |
15:58:23 | Yardanico | ah, it works only with devel right now |
15:58:24 | * | pilne quit (Quit: Quitting!) |
15:58:36 | Yardanico | I have a repository: https://github.com/Yardanico/nimpylib |
15:58:51 | FromGitter | <zacharycarter> gotcha |
15:59:00 | Yardanico | because why not share :) |
15:59:02 | FromGitter | <zacharycarter> pretteh cool! |
16:03:53 | relax | miran: if you don't need the syntactic sugar for comprehensions theres sequtils.map |
16:04:34 | miran | thanks relax, will try it |
16:05:51 | * | Matthias247 quit (Read error: Connection reset by peer) |
16:14:25 | * | MyMind quit (Ping timeout: 248 seconds) |
16:15:36 | PMunch | https://play.nim-lang.org/?gist=5745b74158aae6649b1bdf7fa1baf51b |
16:15:59 | PMunch | Drawing stuff in a terminal with braille Unicode characters :) |
16:16:32 | * | MyMind joined #nim |
16:16:49 | * | arnetheduck quit (Ping timeout: 246 seconds) |
16:17:07 | Yardanico | PMunch, veery cool |
16:17:31 | PMunch | The idea is from Drawille |
16:17:39 | PMunch | A Python library for doing the same thing |
16:20:02 | * | endragor quit (Remote host closed the connection) |
16:28:54 | * | nsf joined #nim |
16:34:27 | FromGitter | <BigEpsilon> Hi, I'm trying to wrap stl cpp vector into a safe wrapper, but I have some trouble with for wrapping the [] operator |
16:34:40 | FromGitter | <BigEpsilon> proc unsafeIndexT (this: var vector[T], i: csize): T {.importcpp: "operator[]", header: "vector".} ⏎ proc `[]`*T (this: var vector[T], i: csize): var T {.noinit, inline.} = ⏎ ⏎ ```if not defined release: ⏎ assert(0 <= i and i < this.size) ⏎ this.unsafeIndex(i)``` [https://gitter.im/nim-lang/Nim?at=59a051a0c101bc4e3a571c96] |
16:36:30 | FromGitter | <BigEpsilon> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59a0520e578b44a046e9cc32] |
16:37:00 | PMunch | Hmm, the playground really doesn't like live view.. |
16:37:10 | PMunch | ie. infinite loop with sleep and update |
16:38:04 | PMunch | http://ix.io/zpp |
16:38:13 | PMunch | Run that little snippet those who like :) |
16:38:27 | PMunch | A nice updating sine graph in your terminal with a tracking line |
16:38:34 | FromGitter | <BigEpsilon> the problem lies here in the generated code ⏎ ⏎ ```int* result = this_0.operator[](i);``` [https://gitter.im/nim-lang/Nim?at=59a0528a210ac26920bf5033] |
16:39:10 | FromGitter | <BigEpsilon> and sorry for interrupting in the middle of an ungoing conversation |
16:39:24 | PMunch | No, the fault is mine |
16:39:37 | PMunch | Didn't realise you were in the middle of saying something :) |
16:40:04 | FromGitter | <BigEpsilon> what would have been correct is : ⏎ ⏎ ```int& result = this_0.operator[](i);``` [https://gitter.im/nim-lang/Nim?at=59a052e3614889d47587aa61] |
16:40:09 | FromGitter | <BigEpsilon> I'm slow :) |
16:40:20 | * | Pisuke joined #nim |
16:42:23 | Yardanico | PMunch, oh my god it's so beautiful |
16:42:33 | PMunch | Haha |
16:42:37 | * | MyMind quit (Ping timeout: 260 seconds) |
16:42:52 | Yardanico | and you're doing it with ansi sequences? wow |
16:43:00 | PMunch | I hope you have a font that shows the braille characters correctly, otherwise it's probably pretty hideous :P |
16:43:18 | PMunch | Oh yeah, the clearing of the active drawing region is ANSI sequences |
16:43:32 | Yardanico | PMunch, well I do |
16:43:42 | PMunch | The dots are basically an abuse of UTF braille characters :P |
16:45:12 | FromGitter | <BigEpsilon> Yes indeed verry beautiful |
16:48:39 | * | linsword13 joined #nim |
16:51:35 | * | linsword13 left #nim (#nim) |
16:55:03 | dom96|w | lol, yeah, please don't paste so much code here :) |
16:56:24 | PMunch | The gitter bot should just turn the entire paste into one link and not bother with the excerpt |
16:59:31 | Yardanico | PMunch, well probably dom96|w said this to me :) |
16:59:57 | PMunch | Oh, haha was too busy working on this drawing stuff to notice you had spammed the channel :P |
17:00:26 | Yardanico | PMunch, well I wanted to give miran a link, but instead pasted my class macro examples |
17:01:32 | dom96|w | oh yeah, sorry, should have highlighted Yardanico |
17:05:42 | PMunch | Hmm, dom96|w what is the standard for example files in nimble packages? |
17:05:55 | PMunch | skipFile and let people grab them manually from GitHub? |
17:07:44 | * | Jesin quit (Quit: Leaving) |
17:09:22 | dom96|w | PMunch: For now, yes. |
17:09:31 | dom96|w | Put them in an `examples` dir |
17:09:37 | PMunch | For now? Anything cool in the pipe? |
17:09:38 | dom96|w | Nimble will support that in the future |
17:09:43 | dom96|w | and install them somewhere |
17:10:54 | Yardanico | also, about this class macro: I don't know how, but nimsuggest is still able to detect procedures which are unused and give a hint |
17:11:21 | PMunch | Hmm, I don't think most people really want to keep that stuff around. You run them once and then discard them. So maybe have a "nimble examples <package name>" which basically pulls all the example files from git and puts them in a directory in the current directory? |
17:11:36 | FromGitter | <Yardanico> (https://files.gitter.im/nim-lang/Nim/bp3D/image.png) |
17:12:17 | * | Jesin joined #nim |
17:12:56 | * | ofelas joined #nim |
17:20:31 | FromGitter | <jrdlph> yeah nimsuggest seems to be extremely clever about macros |
17:21:08 | FromGitter | <jrdlph> generally i break the compiler before nimsuggest XD |
17:21:19 | Yardanico | but rarely it can crash, or even take all your ram :( |
17:21:25 | Yardanico | I encountered this today |
17:21:43 | Yardanico | out of nothere all my ram was eaten by nimsuggest + it started swapping to disk - needed reboot |
17:22:03 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:22:11 | FromGitter | <jrdlph> the price for playing with such arcane magic |
17:22:16 | Yardanico | and sometimes it doesn't work on complicated files |
17:23:34 | * | haha_ joined #nim |
17:24:21 | FromGitter | <jrdlph> yeah I haven't actually pushed it too far. I just don't remember any other language's macro system interactive nicely with IDEs/IDE backends |
17:24:56 | FromGitter | <jrdlph> interacting* |
17:25:40 | FromGitter | <jrdlph> its generally about there that ide support even stop trying to work |
17:25:56 | Yardanico | hmm, does rust ides support macros? |
17:26:03 | Yardanico | and is there any rust ide's with smart auto-complete? |
17:26:35 | Yardanico | actually there are several nim tools for IDEs |
17:26:44 | Yardanico | "nim check" which reports errors in the file |
17:26:50 | Yardanico | and "nimsuggest" which gives suggestions |
17:31:42 | Zevv | talking about nimsuggest: what's the best way for Vim integration. I found several projects but all with no recent updates |
17:32:33 | Zevv | oh look https://github.com/nim-lang/Nim/wiki/Editor-Support |
17:33:12 | FromGitter | <jrdlph> yeah I have grown pretty fond of vscode recently, and fortunately the VScode experience for nim is pretty good |
17:35:01 | Yardanico | Zevv, it seems that this supports nimsuggest: https://github.com/baabelfish/nvim-nim |
17:35:16 | Yardanico | and this doesn't: https://github.com/zah/nim.vim/ |
17:35:27 | Yardanico | or I'm wrong :) |
17:35:31 | Zevv | yea, looking into nvim-vim |
17:35:44 | Zevv | but last updates are 2 years ago |
17:39:03 | miran | jrdlph: i'm just starting with nim, and i'm using vs code too - so far so good |
17:45:29 | Yardanico | yeah I'm using it for a while now |
17:45:45 | Yardanico | also I've installed vscode-icons extension to have nim icons :) |
17:46:06 | FromGitter | <zacharycarter> yikes! presentation in 15 mins |
17:46:08 | FromGitter | <zacharycarter> wish me luck! |
17:46:45 | Yardanico | good luck! :P |
17:47:52 | FromGitter | <zacharycarter> thanks :D |
17:48:49 | * | nhywyll joined #nim |
17:48:49 | * | Ven`` quit (Ping timeout: 248 seconds) |
18:35:38 | FromGitter | <jrdlph> i am having a hard time parsing the explanation of the 'mixin' keyword in the manual. Is it saying that it forces the compiler to look for a the symbol wherever some generic proc that uses it is instantiated? And where would that even be? Is it the module scope of the call site, the inner most scope of the call site? |
18:39:31 | FromGitter | <jrdlph> (not necessarily proc i guess, but in the context of generic proc's is how I am trying to understand it at the moment) |
18:45:35 | * | relax quit (Ping timeout: 240 seconds) |
18:49:38 | FromGitter | <jrdlph> at the moment, it seems obvious what 'where its instantiated' means for macros and templates, but not for generics. |
18:50:02 | dom96 | I think 'mixin init' means that 'init' will be looked up in the scope of the call to the generic. |
18:50:14 | dom96 | a generic is instantiated when the procedure is called |
18:50:19 | FromGitter | <jrdlph> ok |
18:52:11 | Yardanico | https://forum.nim-lang.org/t/3121/1 it seems that this already works |
18:52:31 | * | demi- joined #nim |
18:59:19 | FromGitter | <zacharycarter> presentation went well |
19:00:20 | Yardanico | really? nice |
19:00:31 | FromGitter | <zacharycarter> only about six people |
19:00:33 | FromGitter | <zacharycarter> lol |
19:00:34 | Yardanico | ehm |
19:00:36 | Yardanico | lol |
19:00:44 | FromGitter | <zacharycarter> hahaha |
19:07:47 | * | Jesin quit (Quit: Leaving) |
19:10:12 | FromGitter | <zacharycarter> one of my co-workers asked if you could target multiple backends |
19:10:23 | FromGitter | <zacharycarter> like wrap some JS code and wrap some C code and have them call each other |
19:10:37 | FromGitter | <zacharycarter> you figure out how to write that language and I think you win |
19:10:49 | * | sz0 quit (Quit: Connection closed for inactivity) |
19:12:32 | FromGitter | <jrdlph> you mean like actually call the c code from the js code? In what context would this execute? |
19:13:15 | * | FromGitter * jrdlph suspects he just didn't understand |
19:13:25 | * | gangstacat joined #nim |
19:14:44 | * | haha_ quit (Quit: haha_) |
19:16:20 | FromGitter | <zacharycarter> it wouldn't |
19:16:29 | FromGitter | <zacharycarter> I think you understood fine - he's asking about mixing contexts |
19:16:54 | FromGitter | <zacharycarter> something that's not possible |
19:18:48 | FromGitter | <jrdlph> maybe once webassembly lands and everybody is targeting it |
19:19:15 | PMunch | Is there a way using nim doc to generate an .md file? |
19:19:25 | PMunch | For GitHub README files |
19:22:08 | FromGitter | <zacharycarter> @jrdlph yeah true |
19:25:36 | FromGitter | <jrdlph> @zacharycarter its such a fantastic idea though (webassembly) that the pessimist in me thinks i will probably fall over dead before it ever happens |
19:27:39 | * | Yardanico quit (Remote host closed the connection) |
19:30:21 | FromGitter | <jrdlph> @PMunch i don't think so, but github markdown allows (a limited subset of) inline html, so you might be able to cut out everything but the body and rename it to .md and have it just work |
19:30:42 | PMunch | Hmm, I think I'll have to play around with it |
19:30:57 | PMunch | Maybe I'll create a pull request :) |
19:32:04 | PMunch | https://github.com/PMunch/drawille-nim |
19:36:55 | * | relax joined #nim |
19:38:16 | PMunch | There, now drawille is on GitHub: https://github.com/PMunch/drawille-nim |
19:38:31 | PMunch | And as soon as dom96 accepts the pull request it will be on nimble as well :) |
19:39:00 | FromGitter | <zacharycarter> bluenote10: around by any chance? |
19:39:29 | * | Vladar quit (Quit: Leaving) |
19:42:02 | dom96 | PMunch: reviewed |
19:51:10 | * | rauss quit (Quit: WeeChat 1.9) |
20:04:24 | * | francisl quit (Quit: francisl) |
20:04:47 | PMunch | dom96, fixed |
20:05:17 | * | francisl joined #nim |
20:06:00 | dom96 | PMunch: okay, cool. Next time please put it at the bottom though. |
20:09:18 | * | Arrrr joined #nim |
20:09:18 | * | Arrrr quit (Changing host) |
20:09:18 | * | Arrrr joined #nim |
20:13:41 | FromGitter | <zacharycarter> found a use for Nim at work maybe - using bluenote 10's data frame api |
20:13:52 | FromGitter | <zacharycarter> if it had outer joins I could really sell it |
20:14:18 | dom96 | zacharycarter: awesome that you did a presentation :) |
20:14:29 | dom96 | What were your colleagues thoughts? |
20:15:10 | FromGitter | <zacharycarter> I think overall they were impressed by the language, they had some good questions too |
20:15:31 | FromGitter | <zacharycarter> they really liked how I could wrap JS with Nim |
20:15:48 | FromGitter | <zacharycarter> I showed them an example of using an existing node package from nim with Nim |
20:15:59 | FromGitter | <zacharycarter> sorry from npm* |
20:16:10 | FromGitter | <zacharycarter> among other things |
20:16:20 | * | francisl quit (Quit: francisl) |
20:16:41 | * | francisl joined #nim |
20:17:08 | * | miran quit (Quit: Leaving) |
20:21:53 | * | relax quit (Ping timeout: 248 seconds) |
20:22:29 | * | vivus joined #nim |
20:24:19 | * | rauss joined #nim |
20:28:08 | FromGitter | <Yardanico> @dom96, yeah, I would release it as a nimble package |
20:30:31 | FromGitter | <Yardanico> It needs a readme which shows what is implemented |
20:34:44 | FromGitter | <Yardanico> And I'll need a LOT of tests |
20:36:58 | FromGitter | <jrdlph> @Yardanico your intuition about generics when we were messing with concepts were correct, and mine were wrong. It generally doesn't work like this in other languages, but nim does in fact sort of narrow some unbound type parameter T to 'some type T for which the assumptions made in the body of this proc are true'. I don't completely understand the implications, but I like it. It means there is no dependency between some |
20:36:58 | FromGitter | ... interface specification and the type that safisfied it. So like type safe ducktyping. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59a08a699acddb2407cbfa92] |
20:38:11 | * | sleepyqt quit (Quit: WeeChat 1.9) |
20:49:46 | * | gokr quit (Ping timeout: 276 seconds) |
20:57:20 | * | francisl quit (Quit: francisl) |
20:59:33 | * | gokr joined #nim |
21:02:27 | * | Snircle joined #nim |
21:03:24 | * | rauss quit (Quit: WeeChat 1.9) |
21:06:57 | * | sz0 joined #nim |
21:13:57 | * | gangstacat quit (Quit: Leaving) |
21:25:14 | * | francisl joined #nim |
21:25:59 | * | couven92 joined #nim |
21:27:39 | * | itseris joined #nim |
21:27:52 | * | itseris quit (Client Quit) |
21:43:44 | * | nhywyll quit (Quit: nhywyll) |
21:46:49 | * | Jesin joined #nim |
21:47:05 | * | ofelas quit (Quit: shutdown -h now) |
22:04:43 | FromGitter | <zacharycarter> def-pri-pub: I'll have some stuff for zengine tonight / over the weekend |
22:05:37 | * | francisl quit (Quit: francisl) |
22:10:02 | PMunch | dom96, ah sorry. I've just tried to keep my packages next to each other :P |
22:13:29 | PMunch | Hmm, I wonder if I can do something cool with drawille.. |
22:14:08 | PMunch | I mean you can do a lot of random fun stuff, but anything actually practical and cool |
22:18:04 | PMunch | https://raw.githubusercontent.com/yaronn/blessed-contrib/master/docs/images/line.gif |
22:18:11 | PMunch | Ooh graphs would be cool |
22:32:22 | PMunch | Hard to make the colours cross though since they are 2x4 characters .P |
22:32:50 | * | linsword13 joined #nim |
22:37:36 | * | Matthias247 joined #nim |
22:40:26 | * | linsword13 quit (Quit: WeeChat 1.9) |
22:41:27 | * | Trustable quit (Remote host closed the connection) |
22:41:50 | * | linsword13 joined #nim |
22:44:55 | * | nsf quit (Quit: WeeChat 1.9) |
22:52:28 | * | linsword13 quit (Quit: WeeChat 1.9) |
22:53:21 | * | yglukhov quit (Remote host closed the connection) |
22:55:22 | * | gokr quit (Quit: Leaving.) |
22:59:51 | * | Arrrr quit (Read error: Connection reset by peer) |
23:23:32 | * | gokr joined #nim |
23:27:48 | * | gokr quit (Ping timeout: 240 seconds) |
23:34:56 | * | vlad1777d quit (Ping timeout: 248 seconds) |
23:44:26 | FromGitter | <Varriount> Hm. Anyone know a term for a non-empty string? |
23:55:36 | FromGitter | <zacharycarter> initialized string |
23:55:41 | FromGitter | <zacharycarter> I dunno |