<< 20-07-2017 >>

00:07:36*user0 joined #nim
00:10:10*chemist69 quit (Ping timeout: 255 seconds)
00:10:29*dankrad quit (Ping timeout: 240 seconds)
00:11:46*rauss quit (Quit: WeeChat 1.9)
00:16:45*dankrad joined #nim
00:19:18FromGitter<watzon> Damn, someone needs to write a book just on macros
00:20:24FromGitter<watzon> ```code paste, see link``` ⏎ ⏎ I have it working for one, now I just have to figure out how to dynamically get the fields/properties based on `n` [https://gitter.im/nim-lang/Nim?at=596ff7481c8697534a3f8e0d]
00:23:53*chemist69 joined #nim
00:38:47*smt_ is now known as smt
00:48:02FromGitter<krux02> I would like to get some feedback on this issue I just created for nimsuggest: https://github.com/nim-lang/nimsuggest/issues/66
00:48:13FromGitter<krux02> especially if you share my opinion
00:48:37FromGitter<krux02> @watzon well I have written a lot of macros
00:48:50FromGitter<krux02> quote do is your friend
00:49:13FromGitter<watzon> @krux02 what do you mean? :D
00:52:14FromGitter<krux02> @watzon you can always instanciate nim code blocks with quote do
00:52:25FromGitter<krux02> let xxx = quote do:
00:52:34FromGitter<krux02> and then you just write code
00:55:00FromGitter<krux02> http://ix.io/yAv
00:55:17FromGitter<krux02> @watzon that snippet does the same, as you do
00:55:37FromGitter<watzon> Oh awesome
00:56:00FromGitter<krux02> with the backticks `` you can insert nodes
00:56:45FromGitter<watzon> Ok, so here's the big question: how would I make that process dynamic? I want to be able to pass an Object in and have it create an initialization proc for that object
00:57:06FromGitter<krux02> only problem is, for some reason when you use result in the quote block, it will bind to a symbol from the result variable of the macro
00:57:16FromGitter<krux02> that doesn't make a lot of sense at all
00:57:29FromGitter<krux02> therefore I put a workaround in with the ident node
00:57:50FromGitter<krux02> ident"foobar" is the same as newIdentNode("foobar")
00:58:31FromGitter<krux02> well when it is just to iterate the fields of an object, you don't even need macros for that
01:00:53*yingjun_ joined #nim
01:01:27FromGitter<krux02> http://ix.io/yAw
01:02:31FromGitter<krux02> with getImpl you can jump to an implementation of a type and then iterate the fields if you want to ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59700127bf7e6af22cf612c8]
01:03:19*v17d quit (Remote host closed the connection)
01:03:36*rauss joined #nim
01:08:41FromGitter<watzon> @krux02 what if I wanted to pass in a type and a variant of that type and get the fields?
01:09:05FromGitter<watzon> For instance: ⏎ ⏎ ```NodeKind = enum ⏎ nkValue, ⏎ nkLiteral``` [https://gitter.im/nim-lang/Nim?at=597002b02723db8d5e2a5cef]
01:10:10FromGitter<krux02> well that works
01:10:31FromGitter<krux02> the parameters of the macro need to be "typed"
01:10:47FromGitter<krux02> typed means that the typechecker run and resolves symbols
01:11:13FromGitter<krux02> in the macro all parameters no matter if type or untyped will be of type NimNode
01:11:52FromGitter<krux02> but in a typed argument you will never find identifier nodes you will always find symbols
01:13:18FromGitter<krux02> @watzon can you write me what your createNodeInitProc should genereate for those arguments?
01:16:42FromGitter<watzon> I would like to be able to iterate over all of the props and create a proc like this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Where the name of the proc is the name of the variant and it's parameters are all of the parameters that the variant would accept, which in the case of `nkValue` would be line, column, and value. (we can forget about `nodeId` for now) [https://gitter.i
01:16:42FromGitter... m/nim-lang/Nim?at=5970047abf7e6af22cf61fa8]
01:26:04*arnetheduck joined #nim
01:26:39FromGitter<krux02> @watzon
01:26:42FromGitter<krux02> ``````
01:26:54FromGitter<krux02> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=597006ddc101bc4e3aa0da15]
01:30:13*chemist69 quit (Ping timeout: 255 seconds)
01:43:59*chemist69 joined #nim
01:47:41*def-pri-pub joined #nim
01:51:30FromGitter<watzon> @krux02 Thanks for that! Think I'm starting to get it now
01:52:32FromGitter<watzon> ```code paste, see link``` ⏎ ⏎ How can I check if two NimNode`s are equal? [https://gitter.im/nim-lang/Nim?at=59700ce0bc46472974084cd8]
02:01:05*arnetheduck quit (Ping timeout: 240 seconds)
02:36:43FromGitter<Alan-FGR> @zacharycarter thank you :). Looking at it again after a day it really doesn't look too bad :P... maybe could be iterated into an alternative logo, I certainly would be happy to display it in a product using nim, maybe a splash screen or something
03:01:23*endragor joined #nim
03:21:23*onionhammer1 joined #nim
03:21:37*onionhammer quit (Ping timeout: 248 seconds)
03:32:31*pilne quit (Quit: Quitting!)
03:36:03*onionhammer1 quit (Ping timeout: 260 seconds)
03:40:58*def-pri-pub quit (Quit: leaving)
03:46:46*krux02 quit (Remote host closed the connection)
03:56:01*ShalokShalom quit (Ping timeout: 255 seconds)
03:56:51*onionhammer1 joined #nim
04:23:57*andrzejku joined #nim
04:39:23*yingjun_ quit (Remote host closed the connection)
04:39:34*SusWombat quit (Quit: Leaving)
04:41:59*yingjun_ joined #nim
04:46:21*yingjun_ quit (Remote host closed the connection)
04:48:23*Lord_Nightmare quit (Ping timeout: 260 seconds)
04:50:16*Lord_Nightmare joined #nim
04:56:46*bahtiyar joined #nim
05:03:23*yingjun_ joined #nim
05:05:57*andrzejku quit (Quit: My iMac has gone to sleep. ZZZzzz…)
05:14:44*andrzejku joined #nim
05:33:33*rauss quit (Quit: WeeChat 1.9)
05:35:37*skrylar joined #nim
05:36:48*dankrad quit (Ping timeout: 260 seconds)
05:39:28*bahtiyar quit (Remote host closed the connection)
06:21:40*yingjun_ quit (Remote host closed the connection)
06:28:54*yingjun_ joined #nim
06:36:16*nsf joined #nim
06:49:57*big_num joined #nim
06:55:02*skrylar quit (Quit: My iMac has gone to sleep. ZZZzzz…)
07:30:52*wHATEver joined #nim
07:31:10*Snircle quit (Ping timeout: 240 seconds)
07:31:16*wHATEver is now known as Guest15762
07:31:45*myp quit (Ping timeout: 248 seconds)
07:46:02*yingjun_ quit (Remote host closed the connection)
07:50:07*ShalokShalom joined #nim
07:51:31*yingjun_ joined #nim
07:52:43*yglukhov joined #nim
07:54:53*ShalokShalom quit (Remote host closed the connection)
07:56:46*yglukhov quit (Ping timeout: 246 seconds)
08:08:40*adeohluwa joined #nim
08:15:01dave24will `someFunc(if getSomeBool(): "YES" else: "NO")` generate the strings as constant literals, or are they garbage collected?
08:15:47dave24`someFunc` is a C function that stores a pointer to the given string and uses it later.
08:16:21*andrzejku quit (Quit: Textual IRC Client: www.textualapp.com)
08:18:51*yglukhov joined #nim
08:22:59*big_num quit (Quit: Bye.)
08:33:46*Vladar joined #nim
08:36:18*Arrrr joined #nim
08:40:20*dom96|w joined #nim
08:43:59Araqconstant literals but is seems funky to rely on that, instead write
08:44:13AraqsomeFunc(if getSomeBool(): cstring"YES" else: cstring"NO")
08:47:43dave24ah ok, thx. One followup question, if I pass a string directly to the function(no `if: else:`) and the function expects a cstring, will it always be a constant literal? It looks like that in the generated code but I'm not sure.
08:51:32Araqyes
08:51:51dave24Nice, Thank you!
09:01:25*couven92 joined #nim
09:11:00cremWhere does nim store the generated c code? I'm curious to take a look at it.
09:11:19cremOr there's some command line to keep it.. Or something.
09:11:30FromGitter<andreaferretti> nimcache
09:11:55cremindeed! thanks
09:11:57FromGitter<andreaferretti> you should see this directory whenever you compile nim code
09:12:18cremYes, I just compiled something from root directory, so didn't see the newly created one. :)
09:12:38*v17d joined #nim
09:12:39*Arrrr quit (Read error: Connection reset by peer)
09:16:02Araqcrem: 1. use -d:release before looking at the code
09:16:12Araq2. look at the produced assembler code instead
09:18:26cremThanks. Indeed with -d:release it's more readable. Well, I didn't actually want to read the code, just was curious to look at.
09:20:18AraqI'm tired of people who point out redundant temporaries being generated that are optimized away by a simple copy propagation pass :P
09:21:19*arnetheduck joined #nim
09:22:05cremIt may happen that C compiler would take care about them anyway.
09:22:42cremDo you know if there is a nim syntax highlight for sublimetext?
09:23:47Araqyes there is
09:24:25Araqhttps://github.com/Varriount/NimLime
09:26:22cremThanks. I had it, just sublime somehow didn't recognize the format from extension.
09:33:00couven92Araq, why is the release code more readable?
09:33:25couven92(Isn't it normally the Debug code that is more readable? :O)
09:35:45cremDo you know where to report website bugs to? The "discard" link in the "comments" section of the tutorial leads to non-existing #discard-statement, should be #procedures-discard-statement.
09:36:21couven92crem, http://github.com/nim-lang/Nim/issues
09:37:21couven92The Nim manual and tutorial sites are part of the Nim repo (in the `doc` folder)
09:38:02couven92otherwise the actual http://nim-lang.org/ landing page lives in the https://github.com/nim-lang/website repo
09:40:24cremThanks. Sorry for asking basics.
09:40:52couven92crem we've all been there and done that! no worries :)
09:42:06Araqcouven92: mostly because line tracking statements bloat the code
09:42:19couven92ah... okay that makes sense
09:54:12cremHere: https://nim-lang.org/docs/tut1.html#control-flow-statements-for-statement there's something about "built-in $ operator", yet there's no $ operator in the example code snippets. Do I miss something? For integer i, both "echo i" and "echo $i" compile fine for me.
09:57:06Araqcrem: please report it, too much editing turned into an incoherent mess :D
09:57:32Araqthe examples used to read 'echo $i' but then people wrote $ in echos which is not required
10:05:46*planhths joined #nim
10:09:25cremIs there a code formatting tool for nim?
10:13:50cremIs it expected for this code https://pastebin.com/Eyk4UV4P to sigsegv?
10:17:52*yingjun_ quit (Remote host closed the connection)
10:18:03*yingjun joined #nim
10:18:59*yingjun quit (Remote host closed the connection)
10:19:22Araqcrem: why would it segfault? o.O compiler crash?
10:20:25Araqthere is no formatting tool and I have no fucking clue why people want one. indentation based syntax implies there is little left to format, for better or worse
10:20:38cremIndeed, it's compiler who says sigsegv.
10:21:33cremI use autoformat for both C++ and python (and go, but i hate go). Those are great! Quickly type, format, and get a beautiful code.
10:22:34cremSo, is it expected for compiler to say "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" when it attempts to compile that?
10:22:37*yingjun joined #nim
10:23:22Araqof course not a compiler should never crash :-)
10:23:47AraqI just quickly type, what's there to format?
10:24:14Araqdo you type foo=3 and then it becomes foo = 3 or what?
10:25:59FromGitter<ChristianWitts> Something akin to gofmt would be nice, to have 1 canonical style
10:26:13cremYes. Or if it's an array/map declaration, everything becomes neatly formatted. Or long lines are split at 80 characters. Or two empty lines between functions.
10:26:58cremEven without canonical style, it actually increases productivity a lot.
10:28:14*Vladar quit (Remote host closed the connection)
10:32:19Araqif you say so. I don't spend my time writing code, I'm mostly reading, thinking and swearing
10:33:37Araqand before you ask, indentation for me is about not having a series of pointless } } } taking up valuable screen space
10:33:50yglukhovAraq, dom96: there's a flaw in nimble getInstallFiles. it is not memory friendly at all, and causes out of mem in memory-tight environment.
10:34:15Araqyglukhov: what is getInstallFiles?
10:34:32dom96|wAhh, nice. So that's what was causing the OOMs
10:34:39yglukhovit's a function in nimble, used to get the list of files that are going to be installed
10:35:04Araqwhy does it cause OOM in release builds then and not in debug builds?
10:35:28dom96|wthis shouldn't be a problem unless you've got a hell of a lot of files
10:35:38dom96|wso perhaps there are two different issues
10:37:30yglukhovdom96: well in my case i've got a "build" folder in the root of the proj, that wasn't added to skipDirs, so in my case adding "build" to skipDirs fixed it
10:44:52*yingjun quit (Remote host closed the connection)
10:57:59*vendethiel quit (Ping timeout: 240 seconds)
10:59:40*vendethiel joined #nim
11:15:14*arnetheduck quit (Remote host closed the connection)
11:18:32dom96|wyglukhov: please document this in one of the related issues (or create a new one) if you haven't already :)
11:24:56*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
11:29:08*v17d quit (Ping timeout: 260 seconds)
11:45:24*yingjun joined #nim
11:49:30*yingjun quit (Ping timeout: 240 seconds)
12:00:33*dom96|w joined #nim
12:08:38cremThat's weird that I happened to have g++ on my windows machine. :-\
12:09:01cremHmm strawberry perl has it included.
12:15:13Zevvdo i understand well the both re and nre depend on the prce lib?
12:15:30Zevvis there any built in (simple) pattern matching available in Nim?
12:15:41couven92crem, you can also use the Visual Studio C/C++ compiler if you want to... I wrote the vccexe tool for that ;)
12:16:13*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
12:19:43*dom96|w joined #nim
12:19:45cremI do have it installed, and actually thought for some time that it was used.
12:21:52*dom96|w quit (Read error: Connection reset by peer)
12:25:08cremit seems that nim took from pascal white a lot (or possibbly pascal and nim took a lot from some common predecessor). Bit-backed sets, non-0-based arrays, and/or as a bitwise operators, and types and vars declaration also resemble pascal a lot.
12:27:14*Vladar joined #nim
12:28:07*chemist69 quit (Ping timeout: 255 seconds)
12:28:30cremWhy card() for sets and not some universal len().. Also not sure that * and + for sets is better than say 'and' and 'or'.
12:28:30*chemist69 joined #nim
12:36:46cremIn nim, are local variables initialized to default value if no initializer is specified?
12:42:59FromGitter<ChristianWitts> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5970a553329651f46ea6e3c6]
12:44:03FromGitter<ChristianWitts> `by default integers will be 0 and strings will be nil. nil is a special value which signifies the lack of a value for any reference type, you will learn more about this later.`
12:45:01cremOk thanks. I also tried that and got 0, but that doesn't mean anything. :)
12:46:11*Snircle joined #nim
12:48:27*adeohluwa quit (Quit: Connection closed for inactivity)
12:51:13cremYou cannot pass an interator (or the result of calling an interator) into a procedure, can you?
12:53:13FromGitter<TiberiumN> dom96: will you release results of nim community survey in this month, or in the next?
12:55:19Araqcrem: well card() is not exactly O(1) while 'len' usually is but I never use card anyway
12:56:57*krux02 joined #nim
12:59:52FromGitter<Varriount> crem: Feel free to post issues for the sublime text plugin. I can't promise I'll get to them quickly, but at least I'll know about them.
13:01:35Araqkrux02: http://en.cppreference.com/w/cpp/language/copy_elision worth taking a look at
13:04:37krux02Araq: yes I think I read that once
13:05:20krux02nim normally compiles to C and C does not have constructor/destructors that can be optimized away from the C compiler
13:06:55krux02I had once the idea that in Nim, a function that returns a complex object could be compiled to a C function that passes result as an argument
13:08:24Araqwe can optimize them away in the Nim compiler, I don't understand your remark
13:10:46*couven92 quit (Ping timeout: 276 seconds)
13:15:12krux02http://ix.io/yAW
13:15:19krux02Araq, that is what I mean
13:16:35krux02There is no copying going on anymore the type is directly constructed at the right address
13:21:57Araqyes? I fail to see the connection
13:22:24FromGitter<andreaferretti> in fact I ad mistakenly assumed that the whole point of the result variable is that it would be allocated on the previous stack frame
13:22:38FromGitter<andreaferretti> so no need to move the returned value
13:22:49FromGitter<andreaferretti> but now I think this does not (always?) happen
13:24:28FromGitter<krux02> Well the connection is that a result variable compiled to a functing with the result variable as an argument is to me copy/move elision
13:24:38FromGitter<krux02> there is no copy/move anymore
13:28:38Araqandreaferretti: it happens if more efficient iirc
13:31:27*tdc joined #nim
13:34:13FromGitter<krux02> I remember I once had a case where I could improve the performance my making the result explicitly an argument. I still did not do it because it was not significant enough and I prefer nice code.
13:34:24*adeohluwa joined #nim
13:36:38cremThere's no multilevel namespaces / module packages in nim, are there?
13:42:14krux02you are right. Nim does not provide a java package nesting hell
13:44:03cremWell, in python it's totally fine. And in C++. In any reasonably large project name collisions will be likely.
13:44:59krux02well, super deep package nesting is not something to prevent name collisions, it is just annoying
13:46:00cremThere is something in between "super deep nesting" and "no nesting". But yes, top level package naming in python is actually an issue too.
13:46:32*nsf quit (Quit: WeeChat 1.9)
13:46:46krux02and nim fails on name collision and you can do something about it. Unlike c++ that secretly discards on random thing on name collision and really lets you want to cry
13:47:22cremWell, in C++ there are namespaces, and they help.
13:47:30krux02just use a unique package name and make sure within that package you don't have collisions
13:47:42krux02and there are not so many possible collisions
13:47:48*yingjun joined #nim
13:48:06krux02nim has a package that also works as a namespace
13:48:16krux02helps for disambiguation on name collision
13:48:33krux02when the function foo collides from two packages a and b
13:48:41krux02then you can still call it with a.foo or b.foo
13:50:33krux02name collision is something that has been taken care of. If you are afraid, try to find an example that you think might cause a problem. Compile it, and see if you are happy with what happens.
13:50:54krux02when you really see a problem then you can create an issue, but you need to have a concrete example.
13:52:16*yingjun quit (Ping timeout: 260 seconds)
13:53:55cremFor small and medium projects it's probably fine, but for a large company that keeps all projects in a single code repository (and they can reuse libraries from each other), that just wouldn't work.
13:55:34yglukhovcrem: which language are you coming from?
13:55:52cremC++ and python mostly.
13:56:33krux02then you should feel home in nim
13:57:04cremI do! I really like it. Especially after I tried go. :)
13:57:18krux02I tried go before nim, too.
13:57:34Araqall projects in a single repo or not is completely irrelevant for namespacing
13:57:49yglukhovok, so as someone whos working on a pretty big project, with around 50 transitive dependencies, i have to assure you that name collision is really unlikely. specifically, in all of our code we have 3 places, where action is explicitly taken regarding name collision.
13:58:23yglukhovcrem: nim is somewhat better namespaced than c++, because every module gets its own namespace
13:58:43*user0 left #nim (#nim)
13:59:05Araqthat one thing that doesn't scale at all is --nimblePath ;-)
13:59:08*user0 joined #nim
13:59:09cremBut then you have collisions of module names pretty soon I guess. Or i'm missing something.
13:59:15krux02c++ has argument dependent namespace lookup, nim has lookup in any namespace :P
13:59:32yglukhovand importing module is like using namespace in c++. still, you can import without "polluting", and fully-qualify, but there's just no reason to do it.
13:59:51yglukhovcrem: also note, that unlike #include, imports do not propagate
13:59:52krux02well there is
14:00:03krux02when there a a bunch on untyped temlates with short names
14:00:15krux02see html package
14:00:19yglukhovs/no reason/rarely ;)
14:00:24Araqthen you have disambiguate, krux02
14:00:50Araqdisambiguation works, heck you can do 'import "foo/module" as m; import "bar/module" as m2'
14:01:05krux02yes that, but even when you don't need to disambiguate, namespace pollution can pollute autocompletion
14:01:30yglukhovcrem all in all, nim gives you exhaustive control over disambiguating, just 99.999% it works automatically.
14:01:54cremAh so there are path imports! Ok, that improves things a lot.
14:02:25*user0 left #nim (#nim)
14:02:29cremSo, then it's like #includes. In terms of module names collision.
14:02:41*user0 joined #nim
14:02:48krux02yes thare are path imports and there are includes as well
14:03:06yglukhovcrem: are you talking about module names disambiguation or symbol disambiguation?
14:03:07cremThere are path imports!
14:03:52cremmodule names mostly, for symbol there are the same mechanisms as in python, as far as I understand.
14:04:15cremThat's what confused me: 15:42 < krux02> you are right. Nim does not provide a java package nesting hell
14:04:33krux02sorry
14:04:37yglukhovah ok, i misunderstood that initially.
14:04:56cremBut krux02 actually meant not that they are not possible, just not customary.
14:05:29yglukhovtrue
14:05:35krux02well I ment that there is no hell
14:05:56krux02:P
14:06:32FromGitter<andreaferretti> they are not possible in the sense that there are no subpackages
14:06:42FromGitter<andreaferretti> just packages inside folders
14:06:56FromGitter<andreaferretti> there is no relation between foo and foo/bar
14:07:38Araqspeaking of which ... can we deprecate --path and --nimblePath? :P
14:08:09yglukhovAraq: i'm using path...
14:08:20yglukhovjust don't remember why
14:08:22yglukhov=)
14:08:22Araqyeah me too
14:11:13Araqbut now that we have import x / [a, b, c] we can move away from --path
14:12:43Araqor rather instead of --path which is package agnostic we could have package specific location hints
14:13:23yglukhovAraq: so here's the case. let's say you're doing a project that is both a library and executable. let's call it nimx, for example. it is not installed in nimble packages, and in its code, you import something, like "import nimx.something"
14:13:32yglukhovhow would that work?
14:14:09Araqso I can do import p1 / [bar, baz]; import p2 / [x, y, z] and then in my config I can have p1 = "../deps/p1"
14:14:46yglukhov"and then in my config I can have..." - does config support that?
14:14:56Araqno, it's a proposal
14:15:11yglukhovoh ok
14:15:19*chemist69 quit (Disconnected by services)
14:15:24*chemist69_ joined #nim
14:17:51yglukhovAraq: sounds like my nimbleoverride thing (which i abandoned already). but the point is. when you compile main file, nim looks recursively upwards for nimbleoverride files, to add such mappings you're speaking of.
14:18:11yglukhovs/but//g
14:18:25Araqwhy did you abandon it?
14:20:19yglukhovbecause nimsuggest knows nothing about it. so for now, i just keep a bunch of 'path="$home/projects/something"' entries in nim.cfg of the compiler. works great, except it is in nim's repo =)
14:21:01yglukhovso you have to stash it occasionally and not forget to restore, because otherwise stupid things happen =)
14:29:09*rauss joined #nim
14:39:47FromGitter<andreaferretti> I assume nimble would then populate this config automatically, is this what you mean?
14:39:53FromGitter<andreaferretti> just as now it handles path
14:51:50*v17d joined #nim
15:12:22*planhths quit (Ping timeout: 255 seconds)
15:16:40Araqmaybe ;-)
15:20:05FromGitter<zacharycarter> I'm working on aws lambda for nim right now
15:20:15FromGitter<zacharycarter> hopefully will have something before I leave for the weekend
15:26:22*Trustable joined #nim
15:27:03LyndsySimonI'd like to use Nim in a functional way, using immutables exclusively. Is that even a sane approach?
15:28:24Araqit's never a sane approach anywhere :P
15:28:35FromGitter<andreaferretti> it can be done
15:28:49FromGitter<andreaferretti> but many libraries have mutable data types
15:28:54FromGitter<andreaferretti> (starting from seq)
15:29:11FromGitter<andreaferretti> that said, there is support for many things you would want to do in a functional language
15:29:18FromGitter<andreaferretti> including an effect system
15:29:28LyndsySimonandreaferetti: I'm seeing that sequences are used pretty extensively in the stdlin
15:29:31LyndsySimonstdlib*
15:29:35FromGitter<andreaferretti> yep
15:29:41*nsf joined #nim
15:29:49FromGitter<andreaferretti> notice that sequences declared with `let` are in fact immutable
15:29:58LyndsySimonooooh. That's a good point.
15:30:13FromGitter<andreaferretti> and you can transform them with the usual `map`, `filter` and so on
15:30:16FromGitter<andreaferretti> see sequtils
15:30:19FromGitter<andreaferretti> you can write more
15:30:29*enthus1ast__ joined #nim
15:30:54FromGitter<andreaferretti> still, I am not sure being strict about mutation will be productive
15:31:27FromGitter<andreaferretti> it would be nice if someone wrote an efficient library for immutable, persistent collections
15:31:40FromGitter<andreaferretti> there isn't one afaik
15:31:57LyndsySimonandreaferetti: I'll add it to my list, but I don't know that I have the skill to do that :(
15:32:57LyndsySimonMy background is mostly Python, but I write Ruby these days at work. I've dabbled in Clojure and *loved* it, but didn't like how often I had to drop back into using mutables to interface with Java, and hated the JVM stack.
15:33:30LyndsySimonI'd use Common Lisp, but I've not found a decent way to compile it to a portable binary that's anywhere near as nice as Nim's.
15:33:50cremWhen both object field and property (with the same name) is accessible, how is it determined what of those will be used? i.e. will it be direct assignment/reading of the value or through the property?
15:34:01LyndsySimonSo I'm in this weird spot where I really like the idea of Nim, but I want to use it in a very lispy way.
15:34:28*v17d quit (Ping timeout: 255 seconds)
15:35:59Araqcrem: field access is preferred unless visibility forbids it
15:36:18LyndsySimonI keep running up against the language itself when trying to write lispy code, which tells me it isn't really designed for the way I want to do it.
15:36:56cremAraq: then first example here: https://nim-lang.org/docs/tut2.html#object-oriented-programming-properties is wrong. (it doesn't say that last three lines are from different module)
15:37:32Araqcrem: yes. another case of editing until things make no sense anymore ...
15:38:54AraqLyndsySimon: just mutate your stuff, nobody cares that the full history of 1..6 is 1,2,3,4,5,6
15:42:38Araqand the real quicksort mutates the array, the Haskell 3 liner is a caricature of the algorithm
15:42:40Araq;-)
15:42:43*PMunch joined #nim
15:51:43*PMunch quit (Ping timeout: 246 seconds)
16:02:21*v17d joined #nim
16:05:16*kunev quit (Ping timeout: 260 seconds)
16:07:01*kunev joined #nim
16:13:54cremThere are no constructors/desctructors, only defer like in go, are there? That's not that nice, C++'s RAII is good.
16:14:35*PMunch joined #nim
16:14:50yglukhovcrem: exactly what i said 2 years ago. now look at me. still here :D
16:15:52*PMunch quit (Client Quit)
16:16:04*PMunch joined #nim
16:16:16PMunchThat's weird
16:16:51PMunchMy client seemed to be connected but wasn't..
16:17:08PMunchhttps://github.com/ngtk3/nim-gtk3 why isn't this in Nimble?
16:19:55cremyglukhov: that's exactly what those who write in go say. :)
16:20:42*gangstacat quit (Quit: Ĝis!)
16:22:17cremAnd that topic is not covered in tutorial at all. :-\
16:23:27yglukhovcrem: nim is a bit different story imo. it gives you nice metaprogramming stuff to do things-that-would-have-required-raii differently.
16:24:21yglukhovit may be unusual when you're used to raii, the paradigm is kinda shifted
16:25:03yglukhovalso note that raii has performance drawbacks
16:25:48cremWell, I just want not to forget to close resources. If only there was some magical operator/function which is called when a variable goes out of scope..
16:26:32yglukhovwithLock myLock: doMyStuff()
16:26:40yglukhovor just defer: release(myLock)
16:26:41yglukhov=)
16:26:59yglukhovor a finalizer
16:27:13yglukhovthat will fire eventually
16:27:28cremhm, what is withLock..
16:28:44yglukhovthats a template. you can write your own. it's just to demonstrate that there are ways to write api that is impossible to misuse (by forgetting to dispose smth, for example)
16:28:55*gangstacat joined #nim
16:29:05yglukhovi think there's actual withLock template in locks.nim std lib or smth
16:30:22yglukhovgotta go, later
16:30:44*yglukhov quit (Remote host closed the connection)
16:31:17PMunchHmm, I'm implementing the slice operation for a custom collection type. Is there any documentation for what a slice actually is?
16:32:14*yglukhov joined #nim
16:33:31cremHow can I take an address of a variable?
16:33:31*yglukhov quit (Read error: Connection reset by peer)
16:33:45*yglukhov joined #nim
16:34:27ehmry``addr``, but only variables actually declared with ``var``
16:35:09ehmryyou probably don't actually want the address of a variables, it makes for unportable code
16:35:35PMunchcrem are you asking how to do something like the pointer to a pointer thing in C to be able to update memory passed in?
16:35:41cremProbably not, but just wondering. Will it return pointer of that type or just some numerical address?
16:36:34ehmryyes, a typed pointer
16:37:05cremOk, thanks. I understand that I probably won't need that ever, just asking for better understanding.
16:37:07PMunchIf so then either consider returning a tuple of some sort, or do something like "proc change(x: var int)" and then you can change x for the original scope
16:37:57*yglukhov quit (Ping timeout: 240 seconds)
16:38:54cremThis https://pastebin.com/Eyk4UV4P is expected to return false, right?
16:39:52cremThere is no "goto" in nim! Surely noone hopes that someone will use nim as a target language for compilation. :)
16:40:35FromGitter<Varriount> crem: You can use the `emit` pramgma
16:40:52FromGitter<Varriount> Emit the goto in C code...
16:42:06PMunchAnd you have blocks, so you can define a block with "block hello:" and then drop out of it by doing "break hello"
16:42:42PMunchIt's not as flexible as a goto but it covers one of the most used cases for the goto statement.
16:44:24cremI just wanted to check if I could goto into "statements expression" and realized that I cannot. In g++ the same thing ({ ... }) didn't always work correct.
16:44:54cremBut without RAII, you usually write all those defer mutex.unlock, right?
16:48:44*dom96|w joined #nim
16:51:48*couven92 joined #nim
16:57:29*krux02 quit (Remote host closed the connection)
16:59:48*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
17:01:46ehmrymeh, if its not c++, raii just isn't how you do things
17:03:13*dankrad joined #nim
17:04:02ehmryif I really need to closely manage something I pass a proc to a proc that bookends the proc with acquire and release
17:06:15*dankrad quit (Read error: Connection reset by peer)
17:08:30*dankrad joined #nim
17:09:38*endragor quit (Remote host closed the connection)
17:11:45*endragor joined #nim
17:11:45*dankrad quit (Read error: Connection reset by peer)
17:13:23PMunchHmm, with slices is a always lower than b?
17:16:12*endragor quit (Ping timeout: 260 seconds)
17:16:48*dankrad joined #nim
17:18:27*adeohluwa quit (Quit: Connection closed for inactivity)
17:22:31*yglukhov joined #nim
17:26:49*itseris quit (Ping timeout: 268 seconds)
17:27:18*yglukhov quit (Ping timeout: 260 seconds)
17:27:55*handlex joined #nim
17:33:28FromGitter<Varriount> PMunch: Depends on what the container supports.
17:33:57FromGitter<Varriount> Actual slice objects `1..4` just contain two integers. The object doesn't put any constraint on it.
17:34:14PMunchAh, okay
17:34:28*handlex quit (Ping timeout: 240 seconds)
17:43:16*dom96|w joined #nim
17:46:28*dankrad quit (Ping timeout: 240 seconds)
17:46:51cremIn https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality, does toLower also lowers unicode characters? But only first byte is checked for equality, so two unicode identifiers, one capitalied and one not, are the same, right? Unless ascii identifiers.
17:48:35Araqonly A-Z is lowercased really
17:50:53*yingjun joined #nim
17:51:18FromGitter<ephja> I use --path, but I guess I never thought of referencing the parent directory explicitly
17:55:05*yingjun quit (Ping timeout: 240 seconds)
17:57:59*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:03:06FromGitter<zacharycarter> AWS
18:03:08FromGitter<zacharycarter> lambda
18:03:10FromGitter<zacharycarter> say hello to Nim!
18:03:24FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/uMSc/Screen-Shot-2017-07-20-at-2.02.52-PM.png)
18:03:27FromGitter<zacharycarter> sorry meant to put that on one line :P hit enter too many times
18:03:45*enthus1ast__ quit (Ping timeout: 248 seconds)
18:04:37*dankrad joined #nim
18:11:01*vlad1777d joined #nim
18:11:50*v17d quit (Ping timeout: 240 seconds)
18:12:26*yglukhov joined #nim
18:16:13*Matthias247 joined #nim
18:21:00*jsgrant joined #nim
18:23:53federico3what happens if I use emit in a template? Is the C code injected in the wrong place?
18:28:05*Sentreen quit (Ping timeout: 240 seconds)
18:32:44*Vladar quit (Quit: Leaving)
18:35:27Araqfederico3: it works
18:40:22*dddddd joined #nim
18:40:32*Sentreen joined #nim
18:41:33subsetparkzacharycarter - what are you doing? Compiling to js?
18:42:49FromGitter<zacharycarter> nope
18:43:05FromGitter<zacharycarter> running a binary via python and cross compiling to linux
18:43:09FromGitter<zacharycarter> doing this all with docker
18:43:23FromGitter<zacharycarter> I'm basically taking the same route golang does but I still have some work to do
18:44:19PMunchHmm, I've got a custom data structure and I'm currently implementing slice operations and such. Should I do bounds checking?
18:44:56subsetparkok, that's fair
18:45:12subsetparkwhy not just compile the nim to a dll and use ctypes, in that case?
18:45:26cremFrom manual: Whether an operator is used a prefix operator is also affected by preceding whitespace (introduced in 0.13.0) (with example that "echo $foo" is parsed as "echo($foo)"). Can anyone elaborate? How was it parsed before 0.13.0?
18:46:09*PMunch quit (Quit: leaving)
18:46:49FromGitter<zacharycarter> subsetpark that's the plan
18:47:06FromGitter<zacharycarter> basically compile to a so and then dlopen / dlclose
18:47:12FromGitter<zacharycarter> with python like go does
18:47:23FromGitter<zacharycarter> but the quickest approach was just to get a binary and execute that from python
18:47:31FromGitter<zacharycarter> so I did that as a poc
18:52:27cremSublime syntax highlighter isn't aware of nim's case insensivity it seems.
18:55:30cremis uint32 ordinal?
18:57:05Araqcrem: it was parsed as (echo) $ (foo)
18:57:13Araqaka a binary operator
18:58:23cremI'm actually not sure what echo is. I thought it's a reserved word which couldn't be a part of expression anyway.
18:58:53Araqecho is a built-in proc but you could write your own, it doesn't use compiler magic
18:59:08cremSo, now echo$foo is still parsed as (echo)$(foo), and echo $ foo is echo ($foo), right?
18:59:30Araqno, echo $foo is unary
18:59:37Araqecho $ foo is binary
18:59:48cremI can write a proc which doesn't need parentheses for params? Interesting.
18:59:48Araqecho$foo too is binary
19:00:20Araqyou don't need to do anything for this to work really, it's called the "command syntax"
19:00:45cremSo "is also affected by preceding whitespace" is not totally precise then. Should be "whitespace around".
19:00:58cremOk, reading further. :)
19:02:13Araqit works as you think it should work :P
19:03:06cremoh, that v_A_r ў: b_oO_l; e_c_ho ў compiles..
19:04:38FromGitter<zacharycarter> Araq: I plan on creating something similar to : https://github.com/eawsy/aws-lambda-go-shim
19:05:15FromGitter<zacharycarter> it might make sense to get in touch with the maintainers of that project
19:05:38FromGitter<zacharycarter> see if they'd be willing to adopt it
19:06:03FromGitter<zacharycarter> either way I think AWS lambda support could / would bring some more eyes to Nim
19:06:43cremThere's no signed modulo operator, is there?
19:06:59FromGitter<Varriount> mod?
19:08:02cremmod! like in pascal. Indeed, works.
19:08:16cremAnd there's no default meaning of % operator, right?
19:08:18Araqzacharycarter: not sure what it's about
19:08:41Araqcrem: it's a string format operator like Python's
19:08:53FromGitter<zacharycarter> Araq: AWS lambda = serverless computing basically run a function of code in amazon's infrastructure and pay for the compute time
19:09:03FromGitter<zacharycarter> there are no instances, etc to manage
19:09:05Araqin strutils.nim, but it's also used for JSON construction
19:09:27FromGitter<zacharycarter> currently it only supports Java, C#, Python, NodeJS and Golang through a Shim
19:09:51FromGitter<zacharycarter> it's quite a popular service amongst the amazon web services community / userbase
19:11:05cremAh! and div for integer division! :) That's actually good that / is float, although after lots of C++ I often make mistakes of using / as integer division also in python3.
19:12:16subsetparkzacharycarter - i'd love to see how it goes for you with the .so!
19:12:41FromGitter<zacharycarter> subsetpark: I'm going camping this weekend but I will give the shared library a go next week and report back
19:12:52FromGitter<zacharycarter> I desperately need a blog at this point and to start writing articles on this stuff
19:13:49subsetparkYeah, I've been meaning to do a whole thing about the same topic
19:14:11subsetparkI've also been meaning to write a utility library that just gives you the ctypes for nim types
19:14:27FromGitter<zacharycarter> could def be handy
19:15:35*w-p joined #nim
19:15:40Araqcrem: you can't really make a mistake here, Nim's type system prevents that
19:16:08*nhywyll joined #nim
19:16:29w-pnoob help request. i'm reading this page: https://nim-lang.org/docs/asynchttpserver.html, and i cannot for the life of me find documentation that explains the use of %*
19:16:37w-pcan anyone point me in the right direction?
19:16:39def-w-p: json module
19:17:20def-https://nim-lang.org/docs/json.html#creating-json
19:17:31w-pright... which says 'This module can also be used to comfortably create JSON using the %* operator:'
19:17:56w-psorry if i'm dense, i'm just trying to understand what it means.
19:18:11def-https://nim-lang.org/docs/json.html#%*.m,untyped
19:18:16Araqhttps://nim-lang.org/docs/theindex.html#%60%25%2A%60
19:18:19def-> Convert an expression to a JsonNode directly, without having to specify % for every element.
19:19:18w-pright. macro. ok. thanks. like i said, noob. - but trying.
19:19:25FromGitter<ephja> the lexim match syntax is not valid anymore apparently
19:21:43FromGitter<ephja> ```foo: ⏎ of 1: discard ⏎ of 2: discard``` [https://gitter.im/nim-lang/Nim?at=597102c7c101bc4e3aa5397f]
19:23:31*w-p quit (Quit: Leaving)
19:30:15Araqephja: yeah I need to update lexim -.-
19:42:38*Nimbecile joined #nim
19:44:06*arnetheduck joined #nim
19:44:52cremopenarray is a bit cumbersome name for that useful concept, and it's not that precise.. why is it "open"? array_view or slice would be nicer.
19:46:03cremI guess all those range, slice, etc were already taken for something else.
19:47:37FromGitter<ephja> it's a neat lib. I'm guessing the json error is caused by the marshal module
19:53:46*nsf quit (Quit: WeeChat 1.9)
19:54:41*yglukhov quit (Remote host closed the connection)
19:55:42NimbecileHi Araq...just a reminder that "Unofficial packages" are not showing on website. I'm using Wayback machine to view when needed, so no hurry.
20:02:22FromGitter<stisa> Nimbecile: you can also search with `nimble search <keyword>` or with something like http://nimism.co
20:05:40AraqNimbecile: thanks for the reminder
20:05:45Araqlet me look into it now
20:06:12FromGitter<Varriount> @Araq Here's a chance to test out your immutable string type: https://forum.nim-lang.org/t/3062
20:06:23*rauss quit (Quit: WeeChat 1.9)
20:18:32Araqtried a similar program, no difference
20:22:02*yglukhov joined #nim
20:22:25*dankrad quit (Ping timeout: 248 seconds)
20:22:27*PMunch joined #nim
20:24:10*dankrad joined #nim
20:24:58*itseris joined #nim
20:29:58*vlad1777d quit (Ping timeout: 268 seconds)
20:32:32*Nimbecile left #nim (#nim)
20:37:58*itseris quit (Ping timeout: 276 seconds)
20:40:48*itseris joined #nim
20:42:57*itseris quit (Client Quit)
20:43:22*vlad1777d joined #nim
20:44:38PMunchHmm, is there a way to document constants with docgen?
20:50:40*jenkins joined #nim
20:51:35FromGitter<ephja> I'll check the source
20:54:57PMunchOh the irony, I can't find any good documentation of how docgen works..
20:56:11*nsf joined #nim
21:04:41*Trustable quit (Remote host closed the connection)
21:10:26Araqhttps://nim-lang.org/docs/tools.html
21:10:34Araqhttps://nim-lang.org/docs/docgen.html
21:11:33Araqour "search" input field is too stupid to understand "docgen" though ....
21:12:52FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/QI4h/Screen-Shot-2017-07-20-at-5.12.28-PM.png)
21:15:21PMunchYeah I've seen those Araq. But it's a bit lacking in what happens with for example a const block
21:15:49Araqah I missed the "good" word
21:16:03Araqwell we have docs and you're free to improve them
21:16:16Araqnot sure what to say about consts
21:16:19Araqconst
21:16:29Araq foo* = "string" ## this is super helpful
21:27:03PMunchAah okay, that helps :P
21:27:32PMunchWhat does "Error: Invalid argument for 'high'" mean?
21:27:58PMunchI have a high proc which works just fine within my module. But apparently not when I import it..
21:28:50PMunchIt is defined as "proc high*[T](vec: PersistentVector[T]): int"
21:30:42Araqyou must not overload 'high'
21:31:03Araqthat's in the spec :P
21:31:20Araqbut detecting it is as much work as fixing it, so *shrug*
21:34:46*Nimbecile joined #nim
21:37:09*Nimbecile left #nim (#nim)
21:37:26*Nimbecile joined #nim
21:53:12PMunchAah
21:53:58*yingjun joined #nim
21:54:57*dankrad quit (Ping timeout: 240 seconds)
21:55:11PMunchHmm, removing the high proc makes the main module throw the same error..
21:56:20PMunchAnd in the importing module..
21:56:24*dankrad joined #nim
21:56:35*vlad1777d quit (Ping timeout: 240 seconds)
21:57:03PMunchix.io/yBl
21:57:11PMunchThat's my code
21:57:37PMunchI'm off to take a shower. I'll be back later
21:58:08*yingjun quit (Ping timeout: 240 seconds)
21:58:16*vlad1777d joined #nim
22:03:27*dankrad quit (Ping timeout: 240 seconds)
22:03:45*vlad1777d quit (Ping timeout: 248 seconds)
22:04:56*Matthias247 quit (Read error: Connection reset by peer)
22:10:50*vlad1777d joined #nim
22:15:22*jenkins quit (Quit: WeeChat 1.9)
22:16:46*Nimbecile left #nim (#nim)
22:21:22PMunchOh wow. 1_000_000 inserts into the persistent data structure (all million lists accessible and immutable) 4.5s about 400MB of RAM. Allocating 15_000 sequences for the same goal took 4.5s as well but used almost twice the RAM.
22:21:51PMunchAnd that's with two orders of magnitude less data
22:22:24PMunchFirst list is one element, next is two, then three etc. All the way to 1_000_000/15_000 elements
22:22:34*aziz joined #nim
22:22:41*PMunch quit (Quit: leaving)
22:23:13*aziz quit (Client Quit)
22:29:00*nhywyll quit (Quit: nhywyll)
22:34:00*dankrad joined #nim
22:34:58*tdc quit (Ping timeout: 240 seconds)
22:52:58*vlad1777d quit (Ping timeout: 240 seconds)
22:54:22*vlad1777d joined #nim
22:58:36couven92where would I install Nim on Ubuntu when running install.sh?
22:58:42*nsf quit (Quit: WeeChat 1.9)
22:59:30couven92/usr/bin or /usr/local/bin?
23:00:09couven92(I don't usually do Linux, I literally have no clue what the difference would be :P)
23:08:54*Nikky quit (Quit: WeeChat 1.8)
23:09:06*Nikky joined #nim
23:15:20FromGitter<Varriount> Probably /usr/local/bin
23:15:28FromGitter<Varriount> /usr/bin is for system stuff, I think
23:16:02FromGitter<Varriount> Anyone got a better version of the Nim program at https://forum.nim-lang.org/t/3062
23:16:13FromGitter<Varriount> I still don't know why the python version is so fast
23:17:02FromGitter<Varriount> PMunch: Is that good or bad?
23:29:31*yglukhov quit (Remote host closed the connection)
23:30:32*yglukhov joined #nim
23:35:23*yglukhov quit (Ping timeout: 260 seconds)
23:44:10*couven92 quit (Quit: Client Disconnecting)
23:54:35*pilne joined #nim
23:55:55*yingjun joined #nim
23:59:58*yingjun quit (Ping timeout: 240 seconds)