<< 20-04-2018 >>

00:00:25FromGitter<honewatson> https://gist.github.com/honewatson/583135c1b191119a3b3be3fdbfe8607b#file-concepts3-nim
00:00:49Vantage_nice
00:02:32FromGitter<honewatson> @Vantage_ also an example of object variants with pattern matching from patty library
00:02:32FromGitter<honewatson> https://gist.github.com/honewatson/6631a96a10996ec9aea72de0fd881729
00:03:33Vantage_you use these often?
00:06:27FromGitter<honewatson> I was using a manual approach to Object variants but the Patty stuff means less code
00:06:48*smt_ quit (Read error: Connection reset by peer)
00:07:18*smt joined #nim
00:08:10FromGitter<honewatson> I think these libraries are my favourites so far
00:08:15FromGitter<honewatson> https://github.com/andreaferretti/patty
00:08:27FromGitter<honewatson> https://github.com/alehander42/zero-functional
00:08:35FromGitter<honewatson> https://github.com/5paceToast/pipe
00:08:41FromGitter<honewatson> https://github.com/onionhammer/nim-templates
00:12:33FromGitter<Bennyelg> Creating a macro which result a nimNode?
00:17:10FromGitter<krux02> @Bennyelg a macro always returns a nimNode.
00:22:55FromGitter<Bennyelg> yea I wanted to split my parsing into multiiple macros while iterating a file
00:27:17*enthus1ast quit (Remote host closed the connection)
00:39:10*Vantage_ quit (Quit: Leaving)
00:43:28*Lord_Nightmare2 joined #nim
00:45:53*Lord_Nightmare quit (Ping timeout: 248 seconds)
00:46:15*Lord_Nightmare2 is now known as Lord_Nightmare
00:48:34*yglukhov joined #nim
00:53:09*yglukhov quit (Ping timeout: 264 seconds)
01:04:33*SenasOzys__ quit (Ping timeout: 264 seconds)
01:13:33*Lord_Nightmare quit (Ping timeout: 264 seconds)
01:22:33*Lord_Nightmare joined #nim
01:42:28*athenot quit (Read error: Connection reset by peer)
01:44:09*athenot joined #nim
01:47:54FromGitter<Varriount> @honewatson "So I decided to write my own, with blackjack and hookers."
01:51:15FromGitter<ephja> @honewatson oooh, |> !
01:51:47FromGitter<ephja> and `>>`? ;)
01:56:25FromGitter<ephja> lambda parameters don't seem to have the ability to shadow variables
02:13:12FromGitter<ephja> the code outline extension for vscode actually does show nim symbols; they're just not indented
03:02:51*endragor joined #nim
03:32:23*Sembei joined #nim
03:33:09*Pisuke quit (Ping timeout: 256 seconds)
04:00:39*dddddd quit (Remote host closed the connection)
04:01:36*vantage quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org)
05:19:13*nsf joined #nim
05:49:55*nigredo-tori joined #nim
06:34:32FromGitter<narimiran> @ephja @honewatson is pipe (`|>`) really needed in nim, when we can simply have `a.multi(b).add(c).div(d)`?
06:44:37*yglukhov joined #nim
06:49:29*yglukhov quit (Ping timeout: 268 seconds)
06:53:42*PMunch joined #nim
07:06:36*Ven`` joined #nim
07:18:16*jjido joined #nim
07:19:04*yglukhov joined #nim
07:31:40*xkapastel quit (Quit: Connection closed for inactivity)
07:32:28FromGitter<honewatson> Well its personal preference. None of what I listed is really needed
07:34:38*rokups joined #nim
07:35:49*Ven` joined #nim
07:36:05*Ven`` quit (Ping timeout: 240 seconds)
07:53:30*sendell joined #nim
07:54:26*Ven` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:57:33*Ven`` joined #nim
08:02:35*SenasOzys__ joined #nim
08:12:17*SenasOzys__ quit (Ping timeout: 248 seconds)
08:15:23*vlad1777d quit (Remote host closed the connection)
08:15:48*yglukhov quit (Read error: Connection reset by peer)
08:16:30*yglukhov joined #nim
08:30:12*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:39:23*jjido joined #nim
08:39:55*nigredo-tori quit (Quit: Page closed)
08:44:49*floppydh joined #nim
08:49:23*max3 quit (Quit: Connection closed for inactivity)
09:16:15*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:29:44*brainproxy quit (Ping timeout: 260 seconds)
09:34:20*brainproxy joined #nim
09:42:50*yglukhov quit (Read error: Connection reset by peer)
09:42:57*brainproxy quit (Ping timeout: 248 seconds)
09:43:26*yglukhov joined #nim
09:46:24*Vladar joined #nim
10:04:03*SenasOzys__ joined #nim
10:16:34*xet7 joined #nim
10:17:41FromGitter<mratsim> Yeah nothing is needed, let’s go back to assembly :P
10:52:40*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:58:55*brainproxy joined #nim
11:06:47*Tanger quit (Disconnected by services)
11:07:14*Tanger joined #nim
11:09:20*Ven`` joined #nim
11:22:07*hohlerde joined #nim
11:23:02hohlerdewith the latest devel, passing a var parameter and returning the same parameter as a var from the procedure gives a compile error
11:23:33Araqhohlerde: interesting, gist/report it please
11:23:38hohlerdeproc test2(s: string, data: var seq[cuchar]): var seq[cuchar] =
11:23:47hohlerdethat doesn't work
11:23:53Araqyeah, that's expected
11:23:58hohlerdeproc test1(data: var seq[cuchar]): var seq[cuchar] =
11:24:03Araqworks
11:24:04hohlerdethat works
11:24:23Araqthat's the fix for the 'var T' loophole
11:24:25Araq:-)
11:27:25*vantage joined #nim
11:28:05hohlerdeso, I need to use ptr if I want to return the same address for convenience reasons?
11:31:24*xet7 quit (Read error: Connection timed out)
11:31:38*brainproxy quit (Ping timeout: 276 seconds)
11:31:45*xet7 joined #nim
11:31:51Araqmake 'data' the first parameter
11:31:58Araqand then it will compile
11:32:07hohlerdeyea, tried that aswell, works
11:33:28Araqbtw chaining is better done via a chaining macro
11:33:45Araqnot by butchering every proc you write to return things you should already know
11:33:54Araqjust to save some typing.
11:34:08AraqNim is not C++.
11:34:54hohlerdeyea, I know. I am not blaming anyone :-)
11:35:51*rockcavera quit (Ping timeout: 240 seconds)
11:38:09FromGitter<narimiran> chaining macro?
11:40:24Araqchain(x, foo(), bar()) --> foo(x); bar(x) for example.
11:41:29Araqor any other syntax you like to use.
11:42:16FromGitter<narimiran> god damn, i should really start to learn nim macros :)
11:42:37FromGitter<narimiran> but i get the idea, and i know what syntax would i like to have :)
11:49:09*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:01:37*SenasOzys__ quit (Ping timeout: 248 seconds)
12:03:33*Ven`` joined #nim
12:05:31*SenasOzys__ joined #nim
12:06:20shashlickWe can now auto create and verify test cases from GitHub issue snippets, including error message detection, next step is to auto commit and PR - that code is already in nimble so should be very quick
12:13:28FromGitter<Bennyelg> Can I call macro from another macro?
12:17:02PMunchBennyelg, sure
12:17:38FromGitter<Bennyelg> Can some one give me a piace of example code?
12:25:54*yglukhov quit (Read error: Connection reset by peer)
12:26:30*yglukhov joined #nim
12:26:57PMunchBennyelg, it's just to call it like normal
12:27:08PMunchOr do you want to call it and get the AST to add to your output result
12:27:22PMunchLike result.add <output of my macro>
12:31:45shashlickaraq: https://github.com/nim-lang/Nim/issues/2383 no longer crashes but is it fixed and can I create an error test case
12:36:06Araqshashlick: not that important
12:36:27Araqthese tests we add are regresssion preventions
12:36:48shashlickit's almost all automated so I just have to run a command
12:36:50Araqthe regression for this is unlikely, it will continue to fail with this error message until perhaps the VM supports deepCopy
12:37:09Araqeverything is a tradeoff.
12:37:11shashlickok then we can close the issue as is
12:37:15Araqyeah.
12:38:11shashlickok please close then, i'll find another one to look into to implement the github automation
12:38:15*yglukhov quit (Remote host closed the connection)
12:38:19Araqlol ok
12:38:25*smt` joined #nim
12:38:47*yglukhov joined #nim
12:42:21*smt quit (Ping timeout: 264 seconds)
12:43:13*yglukhov quit (Ping timeout: 248 seconds)
12:52:26*vivus joined #nim
12:55:30*SenasOzys__ quit (Remote host closed the connection)
12:56:38*SenasOzys joined #nim
13:00:42*yglukhov joined #nim
13:01:08*athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:03:53*xkapastel joined #nim
13:12:10FromGitter<alehander42> @krux02 I documented my idea for how gen code should look for general value matching
13:12:41FromGitter<alehander42> I think it should be quite compatible with the current approach
13:13:11FromGitter<krux02> ok let me have a look
13:13:19*yglukhov quit (Read error: Connection reset by peer)
13:13:57*yglukhov joined #nim
13:13:57*brainproxy joined #nim
13:19:58*simonsolnes quit (Ping timeout: 256 seconds)
13:30:31*user1101 joined #nim
13:33:16*Vladar quit (Quit: Leaving)
13:33:41FromGitter<krux02> @alehander42 well now it is abuto to extend the matching error type. because that type can tell you only about NimNode matching problems.
13:35:46FromGitter<krux02> And I would like to see how that generalized matching can be extended to mach something that was not designed for this pattern matching to work. For example some glue code that machs SDL2 events matchable (use SDL2 from here https://github.com/Vladar4/sdl2_nim, that is the superior wrapper.
13:42:41FromGitter<alehander42> yeah, the errors should be generic probably
13:42:45FromGitter<alehander42> can you give me an example or such a SDL2 event value?
13:42:48FromGitter<alehander42> i'll take a look
13:43:44FromGitter<krux02> well you can look in the exmales that are on Vladar4's sdl2 wrapper
13:43:56FromGitter<krux02> all of them match on events somewhere
13:44:26*simonsolnes joined #nim
13:44:47FromGitter<krux02> I know it's a lot of work to actually write software that is generally usable, in comparison to just barely working proof of concept.
13:45:37FromGitter<krux02> but if this works for general pattern matching, then it will improve the Nim language by a lot.
13:46:59*brainproxy quit (Ping timeout: 260 seconds)
13:48:17FromGitter<mratsim> Oooohh, awesome: https://github.com/nim-lang/Nim/commit/6667362c2f1cd0fc1fdb1dacb486528b928470d5
13:48:34FromGitter<alehander42> that's exactly why I wanted to discuss this kind of changes, to make it generally usable, you don't need to remind me :D
13:48:43*dddddd_ joined #nim
13:48:43FromGitter<alehander42> i'll take a look a bit later at the examples
13:49:03FromGitter<alehander42> (I also have a lot of usecases for it in my own code)
13:49:34FromGitter<krux02> that is good.
14:04:02*endragor quit (Remote host closed the connection)
14:09:09FromGitter<alehander42> well sdl events look like ordinary `{.union.}` objects
14:09:42FromGitter<alehander42> so if the lib has support for `{.union.}` objects one should be able to match on any of the sdl types normally
14:10:41*xet7 quit (Read error: Connection timed out)
14:11:15*xet7 joined #nim
14:11:27*fvs joined #nim
14:13:28FromGitter<alehander42> btw `$` (unionobject) is broken
14:14:14FromGitter<alehander42> I am not sure it can have a good default impl anyway, but it shouldn't crash
14:14:15FromGitter<krux02> how would you define `$` on a unionobject?
14:14:22FromGitter<alehander42> ^
14:14:47FromGitter<krux02> You are right it should not crash.
14:14:52FromGitter<alehander42> either something like "NameOfType (union)" or I wouldn't define it
14:15:00FromGitter<alehander42> still I think the first one makes sense
14:15:13FromGitter<krux02> I think it should produce nothing
14:15:25FromGitter<alehander42> well that would just be confusing
14:15:40FromGitter<krux02> the type name?
14:15:44FromGitter<krux02> or ...
14:15:45FromGitter<alehander42> one can echo debugging something somewhere and not realize it's actually outputing stuff
14:15:45*zahary_ joined #nim
14:16:08FromGitter<alehander42> type name and maybe some indication it's a union (so the user can say "aha, that's why it cant tell me more")
14:16:22FromGitter<krux02> well the language can't know what is allowed to access in a union and what is nod allowed
14:16:33FromGitter<alehander42> exactly
14:17:01vantagewhat do you guys think of this macro? https://github.com/jyapayne/nim-extensions/blob/master/oop_macro.nim
14:17:51FromGitter<mratsim> I suppose it’s not possible to define a compiler flag within a library right? I would like to define the noUndefinedBitOpts from: https://nim-lang.org/docs/bitops.html
14:18:12FromGitter<mratsim> I would have to ship a nim.cfg
14:18:28dom96mratsim: I think the usual way to handle this is to give an error if a define isn't specified
14:19:32FromGitter<mratsim> I see
14:20:40FromGitter<mratsim> @Vantage, remind me when you learned Nim, wasn’t it like this week? wow awesome
14:21:44FromGitter<mratsim> it reminds of of Patty in terms of usage: https://github.com/andreaferretti/patty
14:22:48*endragor joined #nim
14:23:00FromGitter<mratsim> there is also interfaced that might be relevant: https://github.com/andreaferretti/interfaced/blob/master/test.nim
14:24:45FromGitter<alehander42> yeah, the variants definitions of patty is something that I would love to see in combo with krux02's pattern matching haha
14:26:32FromGitter<matrixbot> `ehmry` is there a performance tradeoff between passing an `array[N,X]` and `var array[N,X]` for large arrays?
14:26:53FromGitter<krux02> no
14:27:03FromGitter<krux02> but for lange arrays, you should better use `seq`
14:27:05*endragor quit (Ping timeout: 240 seconds)
14:27:10FromGitter<mratsim> beyon 3x word size, Nim pass by const ref
14:27:13FromGitter<krux02> and pass openarray
14:28:00FromGitter<alehander42> actually @krux02 unions could print their fields, just not their field values(obvs), if just there was a way to check if a type is an union
14:28:32FromGitter<krux02> @alehander42 what point is it to print field names, when you don't even know if such a filed exists?
14:28:45FromGitter<matrixbot> `ehmry` I am using large arrays, but I don't want to do any dynamic allocation
14:29:01FromGitter<matrixbot> `ehmry` and so far I haven't
14:29:22FromGitter<krux02> @matrixbot yea but arrays are stack allocated, and stack size is very limited, I think 2MB on windows
14:29:25FromGitter<matrixbot> `ehmry` but large for me is less than 1KIB
14:29:46FromGitter<krux02> well then it can be ok
14:29:52FromGitter<mratsim> I pass 256~512 bit arrays just fine for crypto.
14:29:57FromGitter<alehander42> @krux02 I am just surprised :D , otherwise not very good in this case
14:30:02FromGitter<krux02> the argument can still be `openarray`
14:30:13FromGitter<krux02> that doesn't do any dynamic allocation
14:30:25FromGitter<krux02> it is a pointer size pair
14:30:52FromGitter<matrixbot> `ehmry` right
14:30:53FromGitter<matrixbot> `ehmry` I do like openarray
14:30:56FromGitter<alehander42> one could get more info from typetratis
14:33:19FromDiscord<claude> i just realized nim's converters are like scala's implicit functions, do you guys think there'll be any other new features like scala's implicits in the future
14:35:08FromGitter<krux02> claude: no new features for now. The lanugage focuses on cleanung up mess and heading for 1.0
14:36:08FromGitter<krux02> claude: the only "features" that is being worked on are concepts.
14:36:21FromDiscord<claude> yeah thats why i said future
14:36:40FromGitter<krux02> not really
14:42:43*xet7 quit (Read error: Connection timed out)
14:43:15*xet7 joined #nim
14:45:05*rokups quit ()
14:45:27*rokups joined #nim
14:49:43FromGitter<krux02> I wonder how I can find of if an object is a union or not
14:51:14FromGitter<krux02> Araq: how do I know if an object is a union object?
14:53:09*PMunch quit (Quit: Leaving)
14:57:29*SenasOzys__ joined #nim
14:57:38*SenasOzys quit (Remote host closed the connection)
14:57:55*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:59:35*Ven`` joined #nim
15:00:19*miran joined #nim
15:03:28*endragor joined #nim
15:03:57FromGitter<alehander42> if there is a way to somehow `type.hasPragma` with typetraits on runtime that would work
15:04:14*endragor quit (Remote host closed the connection)
15:12:07*xkapastel quit (Quit: Connection closed for inactivity)
15:14:05*xkapastel joined #nim
15:17:10*brainproxy joined #nim
15:20:27*Vladar joined #nim
15:20:29*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:23:40*r3d9u11 joined #nim
15:26:59*Vantage_ joined #nim
15:28:41*dddddd_ is now known as dddddd
15:39:42*xet7 quit (Read error: Connection timed out)
15:40:14*xet7 joined #nim
15:41:35*xet7 quit (Max SendQ exceeded)
15:41:57*xet7 joined #nim
15:43:19*xet7 quit (Max SendQ exceeded)
15:43:42*xet7 joined #nim
15:45:19*xet7 quit (Max SendQ exceeded)
15:45:41*xet7 joined #nim
15:47:26*leorize joined #nim
15:49:53*brainproxy quit (Ping timeout: 248 seconds)
15:49:58*sendell quit (Remote host closed the connection)
15:53:46*arecaceae quit (Remote host closed the connection)
15:54:05*arecaceae joined #nim
16:05:46Araqkrux02: by some tfUnion type flag internally, it's not (yet) exposed
16:07:11FromGitter<krux02> Araq: I am thinking if union should have been top level, so that overload resolution can be used
16:07:52FromGitter<krux02> for example ``proc fooT: union (arg: T)``
16:07:58FromGitter<krux02> but I guess it is too late for that
16:08:14Araq.union is just a hack
16:08:57FromGitter<krux02> yea that might be, but it is quite important for C interop
16:09:09FromGitter<krux02> I don't recommend it for actualy software design
16:09:45AraqC interop doesn't require overloading since C lacks overloading too
16:09:55FromGitter<krux02> that is true
16:10:09FromGitter<krux02> I am not sure if it is a good idea
16:10:22Araqobviously it's very useful which is why it was added
16:10:37Araqbut I don't want to make it an offical type or something like that
16:11:09Araqand arguably it should just have been a macro that produces accessors
16:11:23Araqwhich do 'cast' under the hood
16:11:27FromGitter<krux02> What is on my mind is just that instead of doing garbage for union types, there would be an error in the overload resolution.
16:11:37FromGitter<krux02> And that is much nicer to deal with
16:11:52Araqremove it and replace it by a macro.
16:12:24Araqwhenever we deviated from Nim's core philosophy
16:12:32Araqthe result has been bad.
16:12:40*athenot joined #nim
16:13:03AraqNim is a simple, but not overly simplistic, language core plus a macro system.
16:13:25FromGitter<krux02> I think the union macro could work
16:13:36FromGitter<alehander42> @krux02 I thought about it and pattern matching shouldn't threat union objects specially, so just normal object matching should work well for most e.g. sdl types
16:13:53Araqand we add/change stuff it's for this goal.
16:14:07Araqfor example, a more powerful macro system can slim down the core.
16:14:37FromGitter<krux02> Araq: yes the macro system is really important for Nim.
16:14:38FromGitter<alehander42> I am really not sure what do you imagine as "work with something not designed for this pattern matching"
16:14:55FromGitter<krux02> I don't know any other language that has macros that good as Nim has them
16:15:16Araqand as I keep saying, the best is yet to come.
16:15:22Araq:-)
16:15:24FromGitter<alehander42> as most usual type "shapes" should be flexible to be matched with support for objects/ref objects/variants/enums/seq/array
16:15:40FromGitter<krux02> today I made a few changes in the macros section of the Nim manual, because I think that part is a bit old.
16:15:50Araqindeed.
16:16:06FromGitter<krux02> I am not surce is two sections like statement macros and expression macros are a good idea
16:16:17FromGitter<krux02> but that part is not what I have changed so far.
16:16:35Araqyeah, it's basically outdated, describing how Nim used to work.
16:16:49Araqthe expr/stmt split still exists but is relatively minor
16:17:00*smt` quit (Read error: Connection reset by peer)
16:17:05FromGitter<krux02> yes
16:17:33FromGitter<krux02> it should be noted somewher that you can do `foo(arg)` and `foo:\n\targ`
16:18:02FromGitter<krux02> and I would like to explain better how the types of the macro arguments work
16:18:29Araqwe need the manual to start with Nim's syntax "harmony" idea.
16:18:41FromGitter<krux02> the types in the arguments are mostly for overload resolution, while in the macro, they are just `NimNodo`, and `static[T]` will be `T`
16:18:50FromGitter<Bennyelg> Can someone explain to me how come i can pass `nimNode` to a proc if the concept is the working on the AST before compile-time ? ⏎ I am pretty mixing concepts right now but I would like to get my hands on some explanation
16:19:12FromGitter<Bennyelg> *on compile time
16:19:19FromGitter<krux02> @Bennyelg you can have a proc that works on compile time
16:19:26Araqkrux02: and typeDesc will be something special too and that's a design bug IMO.
16:20:31FromGitter<krux02> Araq: I think typeDesc, is a bit weird, too. For the most part I try to avoid using any typeDesc, directly.
16:21:03FromGitter<Bennyelg> so what is the diff between macro prefix and proc prefix
16:21:06FromGitter<krux02> I just use ``proc fooT (_ : typedesc[T]): void`` and then I use only `T` for the type
16:21:09AraqtypeDesc is actually quite simple but I didn't understand it when I wrote it
16:21:09*BitPuffin joined #nim
16:21:46FromGitter<krux02> @Bennyelg: A macro transforms it's arguments into an abstract syntax tree
16:22:13FromGitter<krux02> Araq: interesting
16:22:19AraqI don't mind typeDesc, I understand it. I loathe static[T] fwiw
16:22:37FromGitter<krux02> fwiw?
16:22:50Araqfor what it's worth
16:26:23*xet7 quit (Read error: Connection timed out)
16:26:44*xet7 joined #nim
16:28:36FromGitter<krux02> Araq: I don't know where the union pragma is defined
16:29:10Araqgg wUnion compiler
16:29:20Araqcompiler/pragmas.nim
16:29:20Araq 58: wInheritable, wGensym, wInject, wRequiresInit, wUnchecked, wUnion, wPacked,
16:29:20Araq 940: of wUnion:
16:29:49FromGitter<krux02> ok, I'll do git grep :P
16:30:30Araqyour loss.
16:32:44FromGitter<krux02> well yea it is
16:33:03FromGitter<krux02> hmm, but replacing {.union.} with a macro seems harder than I thought.
16:33:26Araqunion Foo:
16:33:31Araq field: int
16:33:35Araq other: cstring
16:34:07Araq-->
16:34:33Araqtemplate field(x: Foo): int = cast[ptr int](unsafeAddr(x)[]
16:34:51FromGitter<krux02> I mean the macro can't replace {.union.} pragame
16:35:03Araqwho cares :-)
16:35:16Araqthe hard part is how to declare the Foo object type
16:35:27Araqit needs max(sizeofs)
16:35:39Araqand that's mostly guessing.
16:35:49Araqalso the alignment must be correct
16:36:03Araqarray[8, byte] is different from 'float'
16:36:13FromGitter<krux02> I know
16:36:28Araqeasy way out:
16:36:32FromGitter<krux02> you rememebr I tried (and failed) at implementing alignof and sizeof in the compiler
16:36:43Araqdeclare the 'real' field first.
16:36:53Araqlet the programmer solve this problem.
16:36:56FromGitter<krux02> there are some weird configurations where float64 has 4 byte alignment
16:36:58Araq(yes, I do remember)
16:37:27Araqc2nim knows about .union though
16:37:36Araqargh.
16:38:00FromGitter<krux02> It wouldn't be hard if float64 had always 4 byte alignment, or always 8 byte alignment. Or on one system 4 byte alignement and on another system 8 byte alignment. But to find out, you have to know soo much
16:38:37Araq4 byte alignment for float64 is bonkers
16:38:40FromGitter<krux02> it is the operationg system, it is C compiler flags, it is the CPU architecture
16:38:40FromGitter<mratsim> I think I read somewhere that it was 16 bit aligned at the very least
16:39:02FromGitter<mratsim> I want 8 bytes aligned floats for AVX2.
16:39:14FromGitter<mratsim> in an array/seq*
16:39:38FromGitter<krux02> @mratsim all basic types should be self aligned
16:40:22FromGitter<krux02> @Araq: well we can compile with a C flag for gcc that ensures self alignment
16:40:42FromGitter<mratsim> float32 should be 8 bytes aligned too, so that AVX2 intrinsics work properly
16:40:45FromGitter<krux02> I think other compilers have that flag too, because as you said, 4 byte alignment is bonkers.
16:40:47*r3d9u11 quit (Remote host closed the connection)
16:41:25Araqeven better would be to do without alignment at all. it's outdated IMO. so you need 3 cycles for a Mul instead of 1 cycle for a shift, who cares -- a cache miss is 100 cycles and so packed data wins easily.
16:41:27FromGitter<krux02> but that would break C interop, when you want to communicate via a C struct that has this weird alignment.
16:42:00FromGitter<mratsim> @Araq, AVX2 cares ;)
16:42:12AraqI know but it's stupid.
16:42:14FromGitter<krux02> ^^
16:42:22FromGitter<krux02> and no I don't think it's stupid
16:42:47*smt joined #nim
16:42:52FromGitter<krux02> for it is is like the byte size got bigger, but without breaking backwards compatibility
16:43:34Araqit's an understandable design, yes.
16:43:42FromGitter<krux02> I think with 64 bit systems we could easiliy make addresses into bit addresses and remove the concept of a byte entirely
16:43:47Araqbut it's not required.
16:43:55FromGitter<krux02> but then keep alignment
16:44:23FromGitter<krux02> and then an array of booleans is just an array of bits
16:44:30AraqI'd rather use the 64bit pointers to to bit addressing
16:44:36Araq*to do
16:44:47Araqlet me have my int18
16:45:12FromGitter<krux02> with 18 bits?
16:45:12Araqthe memory bus has been the bottleneck for over a decade now, might as well adapt to it
16:45:43Araqok, maybe not a decade, but you get the point.
16:45:47Araq(yes, with 18 bits)
16:46:46FromGitter<krux02> Araq: maybe the concept of putting things into main memory and back should have an abstraction
16:47:01FromDiscord<claude> zig has int29
16:47:43FromGitter<krux02> so that you can design a struct that get alignment when in cache, but as long as it's in main memory it is packed.
16:48:26FromGitter<krux02> in vhdl you have int18 if you want (I think)
16:48:39FromGitter<krux02> too long ago since I mad stuff in that.
16:50:49*vivus quit (Quit: Leaving)
16:51:16Araqhttps://i.stack.imgur.com/4Z1nU.png
16:52:36*max3 joined #nim
16:53:51FromGitter<mratsim> LLVM allows you to have int18 or uint200 if you want
16:54:02FromGitter<krux02> Araq: what do you think to enforce in Nim that all small datatypes are self aligned by default. No matter what a C struct would be by default. screw this 4 byte alignment of float64.
16:54:33FromGitter<krux02> and then when someone actually has to interact with such a weird type, this person has to use the packed pragma and insert the padding manually.
16:56:23*xet7 quit (Read error: Connection timed out)
16:56:44*xet7 joined #nim
16:57:26*rockcavera joined #nim
16:57:36*Trustable joined #nim
17:00:40*vantage quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org)
17:00:49*SenasOzys__ quit (Ping timeout: 248 seconds)
17:03:50*SenasOzys joined #nim
17:04:15Araqkrux02: fine with me but let's see what arnetheduck says
17:08:25FromDiscord<treeform> Araq, I would like to fix this issue: https://github.com/nim-lang/Nim/issues/7499 But I would like some guidance on how to do that. I don't understand why repr/jsrepr is platform dependent. It should just turn types into strings? Why C does not appear to have a special $ for uints but js seems to require one? There appears to be a ton of magic in the repr module? I have a two line fix in the issue, but I don't think its a good one but it d
17:08:26FromDiscord<treeform> k for me.
17:08:51miranhow do i install updated version of nimble package?
17:10:03miranjust `nimble install foo` once again? but now i have two versions installed?
17:10:32dom96yes
17:12:16mirando i need to uninstall the previous version? or will the newest version be automatically used?
17:13:03Araqtreeform: it's hard to say.
17:13:33Araqthe fix works for you but JS lacks unsigned integers (or integers for that matter)
17:13:52AraqI'm not a fan of emulating a real CPU on top of JS
17:14:11Araqfor me "ugh, doesn't compile on JS" is a fair thing to do.
17:14:31Araqas long as we lack a real number emulation solution.
17:14:52dom96miran: it will be used
17:14:55Araqpeople have complained about this but as long as nobody works on it, it's not gonna improve
17:15:00miranthanks dom96
17:16:06Araqrepr.nim is *old*, omg it's so bad lol
17:16:11Araqit uses RTTI.
17:17:02FromGitter<krux02> Araq: well in my opinion `repr` should be kept around for `NimNodes`, but nothing else
17:17:17FromGitter<krux02> but for that it can be renamed
17:20:25FromGitter<mratsim> btw what is the convention, putting the var parameter first or last?
17:21:17mirani guess it is because of nim case/style insensitivity, but i just figured out i cannot name my variables `foo_`
17:21:26miranyeah yeah, i know, use a better name....
17:21:44FromGitter<mratsim> In python there are a lot of variables that begin or end with an underscore ;)
17:22:07*xkapastel quit (Quit: Connection closed for inactivity)
17:22:19miranmratsim: yeah, that's why i wanted to use them in this case :)
17:22:40miranbeginning underscores have special meanings
17:22:57FromDiscord<treeform> Araq, for int64 and uint* do you think some thing like this is a good way? https://github.com/skilchen/jsInt64
17:24:48Araqtreeform: It's a start. it looks slow
17:26:22Araqyou need to turn these operations into .compilerProcs and make the JS codegen emit them
17:28:39Araqdo you know how to do this?
17:34:11*brainproxy joined #nim
17:37:28Araqhttps://blogs.msdn.microsoft.com/dotnet/2018/04/18/performance-improvements-in-net-core-2-1/
17:37:47Araqso OpenArray[T] should be named Span[T] ?
17:38:40FromGitter<krux02> Araq: Warning: if you use the -malign-double switch, ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ada25a062316e0505e0d81a]
17:39:36FromGitter<krux02> I would like to mention that those ABI that rely on the fact that a double is aligned by 4 byes are broken by design.
17:40:38FromDiscord<treeform> Araq, so they are some thing like inline? Will inline work?
17:40:40FromGitter<krux02> So I would like to add "-malign-double" to the default flags of gcc
17:41:00FromGitter<krux02> treeform: inline is just forwarded to C inline (AFAIK)
17:41:05Araqtreeform, no .compilerProc
17:41:50FromDiscord<treeform> Just add {.compilerproc.} to functions?
17:42:00Araqproc addInt64(...) {.compilerproc.}
17:42:07Araqin the JS codegen
17:42:08FromDiscord<treeform> yeah
17:42:15Araq "#addInt64(...)"
17:42:25FromGitter<krux02> span sounds like a good name to be.
17:42:26FromGitter<krux02> me
17:43:15Araqthere are already examples in the JS codegen and it's got easier to read since somebody removed the PHP backend code
17:47:59FromDiscord<treeform> So like `toJSStr` is a `{.asmNoStackFrame, compilerproc.}`, but I don't see `#toJSStr` I see `useMagic(p, "toJSStr")`?
17:48:25FromDiscord<treeform> I don't see some thing like "#***(...)" in js code?
17:49:55Araqmy bad, it's useMagic() then
17:50:08Araqwhich is wrongly named, you might want to correct that too.
17:50:17Araqit's useCompilerProc()
17:53:56FromGitter<krux02> Araq: I agree on the name ``span`` that is also the name of the _OpenArray
17:54:00FromGitter<krux02> in C++
17:54:58FromGitter<krux02> Just that you people know it, I do like c++ for a lot of reasons, and C++ got a lot of things right, but it also fails at so many levels
17:58:15AraqStroustrup is underrated. if that's even possible. :-)
17:58:52FromGitter<krux02> I am not sure if the good features of c++ came from stroustrup
18:00:23Araqafaik he invented destructors.
18:01:25FromGitter<krux02> destructors are a good thing in c++, but there are far too many ways you can get them wrong in combination with exceptions
18:03:11FromGitter<krux02> I was listening to cppcon talks and when they talk about exception safety you just think, how is anybody supposed to get that right on the first try? It's designed to introduce bugs.
18:07:34*brainproxy quit (Ping timeout: 264 seconds)
18:07:37*endragor joined #nim
18:11:07*endragor quit (Remote host closed the connection)
18:14:58*nsf quit (Quit: WeeChat 2.0.1)
18:17:19*DarkArctic joined #nim
18:21:57*xet7 quit (Read error: Connection timed out)
18:22:44*xet7 joined #nim
18:25:38Araqyeah well, I have an alternative exception design...
18:26:22FromGitter<krux02> since I basically avoid using exceptions everywhere, what is the core difference?
18:27:01Araqwell Nim doesn't have it, but my newer idea is like this.
18:27:54Araqthere is an implicit 'error: var Error' parameter that is passed around. it's implicit in calls, but not in parameter lists
18:28:52Araqif you are within a proc that has this parameter, it's passed implicitly.
18:29:08Araqto the procs you call that also have it
18:29:46FromGitter<krux02> ok
18:30:03Araqif your proc lacks it, you need to do the calls that have it via a macro
18:30:14Araqthat can do something like:
18:30:34Araq(var err; foo(parameters; err); if err: quit err)
18:31:16Araqthis implies that destructors can do error handling too
18:31:28*endragor joined #nim
18:31:42*endragor quit (Remote host closed the connection)
18:31:47Araqgive the destructor this 'error' parameter and off you go, the destructor injections work with this implicit parameter
18:32:14Araqthis turns the 'raises' effect into an ordinary parameter.
18:33:04FromGitter<krux02> but isn't it more of an additional result than a parameter?
18:33:17Araqwell it's a 'var T' thingie :P
18:33:47FromGitter<krux02> yea a result passed as var parameter
18:33:52FromGitter<krux02> so it's a result
18:34:01FromDiscord<claude> so syntactic sugar for go's `if err != nil`?
18:34:33Araqer, no?
18:35:33FromGitter<krux02> When I wrote my go code, I wished I had some error sentinl that would panic whenever I assigned it something else than nil
18:35:48Araqit's one use case for implicit parameters.
18:35:57Araqthese can be generalized.
18:36:01FromGitter<krux02> then I could have spared my if err != nil: panic everywhere
18:36:11*nsf joined #nim
18:36:45FromGitter<krux02> Araq before you add implicit parameters, I heared that Scala is so slow in compilation because of them.
18:37:08AraqI'm not adding anything.
18:37:19FromGitter<krux02> ok
18:38:28Araqbut it surely is a cool design :P
18:39:04Araqslow compiles are dealt with by having symbol files btw.
18:40:15FromGitter<krux02> I wish someday the nim compiler is good enough that it can inrementally compile the nim compile in just a few seconds.
18:40:38FromGitter<krux02> nim compiler
18:40:47FromGitter<krux02> but it already got a lot better
18:44:35*floppydh quit (Quit: WeeChat 2.1)
18:53:29Araqtreeform: please watch out that you don't use overloading for .compilerProcs, the code will be subtly buggy
18:53:45Araqshould probably add a check for that in the compiler
18:54:11*Vantage_ quit (Quit: Leaving)
18:59:52*xkapastel joined #nim
19:05:27FromGitter<krux02> compilerProcs are procs that are callable from the VM but implemented in the compiler?
19:11:39Araqno, the VM most likely cannot even call them.
19:11:48AraqcompilerProcs are helpers for the codegen.
19:12:13Araqthe codegen says "too complex for me, I give up and let a Nim proc handle it"
19:12:46Araqlike GCC can emulate floating point math by producing calls into some math runtime library.
19:13:00Araqif the CPU lacks an FPU.
19:13:07Araqsame principle.
19:13:29Araqa compilerProc is a proc for the compiler, not for the programmer. :-)
19:14:20FromGitter<krux02> that is the exact reason why I think that WebAssembly will be very important in the future: It will be decited what instructions will be generated, after it is fully know which instructions do exist.
19:15:12FromGitter<krux02> simd and stuff like that can just be used and WASM will generate a fallback on platforms that doen't support it. I don't need to implement it twice.
19:15:36Araqit's not a new idea.
19:16:09AraqwxWidgets does the same, it emulates widgets that don't exist for the chosen target.
19:16:43FromGitter<krux02> yea but wxWidgets is not so low level as CPU instructions.
19:17:17Araqlowest-common-denominator vs emulate-what-is-missing
19:17:31FromGitter<krux02> with wxWidgets generating runtime branches is actually reasonable, with cpu instructions generating branches for each instruction not so much
19:18:25AraqI'm not convinced we shouldn't just have an x86 emulator in the browser :P
19:18:40FromGitter<krux02> yea
19:19:06FromGitter<krux02> I looked at x86 assembler, just trying to understand parameter passing
19:19:41Araqit's not hard, you're free to do it in any way that makes sense to you. :P
19:19:42FromGitter<krux02> parameters are put into registers with random names and no pattern behind it. And magically the called function does know in which registers the parameters are.
19:19:57Araqno, it's a calling convention.
19:20:07Araqthere is no magic involved.
19:20:19FromGitter<krux02> Araq: and native client for chrome basically was x86 emulation
19:20:33FromGitter<krux02> it was binary code with some safety belts to not do shit.
19:20:37Araqit's arbitrary that's why it's so simple to understand :P
19:20:48FromGitter<krux02> it worked, but it did only do x86 and chrome
19:21:12FromGitter<krux02> the idea and people behind it are working on WASM now btw
19:21:18*brainproxy joined #nim
19:21:35Araqfirst parameter goes into EAX, then EDX, then ECX and then passed via the stack :P
19:22:04FromGitter<krux02> yea, I hate those register names
19:22:23Araqthat's Borland's __fastcall which differs from MS's __fastcall, watch out :P
19:22:25FromGitter<krux02> because I have no idea what their names mean
19:22:55Araqextended-accumulator-register, destination-register, count-register
19:23:45FromGitter<krux02> yea still doesn't make any sense to me
19:23:58Araqextended is for 32bits
19:24:17Araqoriginally it was AX, DX, CX
19:24:21FromGitter<krux02> R0, R1, R2, R3, ... would have made sense to me. But I understand it, it has a lot of historical baggage.
19:24:31Araqyep.
19:24:49Araqfor 64bits it's RAX, RDX, RCX btw
19:25:11Araqthe R stands for "really extended now". nah, just kidding.
19:25:37FromGitter<krux02> it almost like c types: long double
19:25:45Araqyeah
19:26:09Araqwas so hard to port my 16bit asm code to 32bit
19:26:20FromGitter<krux02> but in c++ I can do this: bool dozer;
19:26:26FromGitter<krux02> int eger;
19:26:33FromGitter<krux02> float ing;
19:27:01Araqonly to realize it wouldn't work because the OS was not DOS anymore and stuff was protected in ring-1
19:27:04FromGitter<krux02> double whopper;
19:27:08Araqlol
19:27:13Araqlong double whopper;
19:28:31FromGitter<krux02> names for these things never realley stood the test of time
19:28:42FromGitter<krux02> just call them by the spec works best.
19:29:29FromGitter<krux02> it like calling something HD instead of 1920x1080
19:30:09FromGitter<krux02> it's probably because marketing likes fancy names
19:30:15*brainproxy quit (Ping timeout: 256 seconds)
19:30:29AraqI like DOS names; executable, dynamic-link library, batch file.
19:31:04Araqcontrast that with Unix: file (no, it's a stream), lib*.so (wtf), binary (as opposed to what? everything is in binary, it's a computer)
19:31:54FromGitter<krux02> yea I also like DOS names
19:32:17FromGitter<krux02> but I am ok with sh files
19:32:29FromGitter<krux02> it's a shell file, and shell is defined
19:32:37FromGitter<krux02> and it is replacable
19:33:24FromGitter<krux02> it can have an arbitrary interpreter, and it doesn't have the baggage to be called by something it isn't anymore
19:33:51FromGitter<krux02> script.sh script.zsh script.fish script.py, everything works
19:34:28Araqwell when you a slogan like "everything is a file" and even that one is wrong, I begin to wonder about the clarity in their thinking.
19:35:01FromGitter<krux02> Well it was an idea to make everything a file
19:35:10FromGitter<krux02> It just didn't work out
19:35:13Araqno, a stream. :P
19:35:34FromGitter<krux02> yea a stream
19:35:47FromGitter<krux02> nowadays you should better avoid the stream object when you can.
19:35:53FromGitter<krux02> Memory map the file
19:35:58*noonien joined #nim
19:36:12FromGitter<krux02> almost every system is 64 bit. Mamory mapping large files is absolutely no problem.
19:36:36FromGitter<krux02> I would really like to memory map the Database.
19:36:45FromGitter<krux02> I mean the database on the server.
19:37:11Araqyou can't use the cache effectively when you mmap().
19:37:24FromGitter<krux02> No I want to do it, is a bit wrong. I would like to experiment with it, is more correct.
19:37:34FromGitter<krux02> why not?
19:37:52FromGitter<krux02> just because you mmap doesn't mean do don't cache.
19:39:34FromGitter<krux02> well maybe a cache miss on data that is on the sever on the other side of the earth is really killing all performane.
19:39:44Araqnot what I mean.
19:40:00Araqbut it's hard to describe and I should work on Nim instead.
19:40:22FromDiscord<geckojsc> Ok the thing I wish is that there was some accessible guide or something that would explain some of the basics of x86 x86_64 assembly in the same clear and friendly way that Araq just did
19:40:24FromGitter<krux02> One problem in C/C++ programming is already that it doesn't tell you anything about cach misses. I mean that is also one of it's strengths that you do not need to manually fetch data, but people who are now think that memory is all flat
19:41:05FromGitter<krux02> they get a wrong idea of how memory is acutally pushed thought the system.
19:42:43FromGitter<krux02> geckojsc: people say assembly is hard. But they don't say what is hard about it. Understanding Assembly and every assembly instruction is quite easy. The problem is, actually writing usable software in assembly is hard, and undersdanding assembly code written by someone else is even harder.
19:43:05FromGitter<krux02> but apart from that there is a way of programming in ASM that is very close to C programming.
19:43:30FromGitter<krux02> just that in ASM you can basically just generate yourself some instructions in a buffer and jump into it.
19:43:43AraqC has more traps than asm, but ymmv
19:44:12FromGitter<krux02> ymmv?
19:44:49Araqyour mileage may vary.
19:46:40AraqC vs asm is an interesting topic, many asm programmers claim(ed) that the C compiler does a better job at translating C code to asm than they are able to. But on the other hand, when they write ASM they don't translate from C to begin with and produce much more efficient designs.
19:49:16Araqnowadays I should probably have said "transpiling C to ASM" :P it's claimed C is close to ASM, right? nobody uses a "C transpiler" though, they are all called "C compiler"
19:49:57FromGitter<krux02> you only say "transpiling" if you want to be a hip web developer
19:50:08Araqha ha ha.
19:50:16Araqso true.
19:54:06FromGitter<krux02> poor web developers. People always make fun of them.
19:55:18AraqMitleid gibt's umsonst, Neid muss man sich verdienen.
19:58:00*brainproxy joined #nim
20:13:57*r3d9u11 joined #nim
20:14:27FromGitter<krux02> I wonder if at some point the web will be just: "hey browser I rendered some text here, don't render it for me I already did that, but know that it is here and his this content"
20:15:11*rokups quit (Quit: Connection closed for inactivity)
20:16:25FromGitter<krux02> and all this artificial complexity around the DOM and stuff will be a relict from the past. That will work, but it won't change anymore and people will wonder how people where abe in the past to do things on the web with the tools we have today.
20:17:39FromGitter<krux02> maybe for static websites (hypertext, the original idea behind html) will still continue to exist.
20:21:45*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
20:24:08Araqisn't that what X11 does?
20:24:38*xet7 quit (Read error: Connection timed out)
20:25:00Araqthe DOM is stateful and that causes lots of friction with react/Karax
20:25:14*xet7 joined #nim
20:25:21shashlickaraq: is this fixed and ready to add test case? https://github.com/nim-lang/Nim/issues/2760
20:25:46Araqso hopefully it will replaced by something better
20:26:11*jjido joined #nim
20:26:36*xet7 quit (Max SendQ exceeded)
20:26:58*xet7 joined #nim
20:27:05Araqshashlick: sadly I think this code should compile
20:29:03shashlickok I'll comment on the thread stating that
20:30:35Araqdoesn't look too hard to fix
20:30:45Araqthough your tool can't do it :-)
20:31:16shashlick:D
20:31:50shashlickhey if it's repetitive, it's automatable
20:32:33*Vladar quit (Quit: Leaving)
20:33:43FromGitter<krux02> Araq: I try to work on my sizeof alignof now again
20:34:01FromGitter<krux02> args, why did you recommend me to put that sizeof alignof into a different file
20:34:10FromGitter<krux02> that is crap now to merge
20:34:20Araqbecause it now causes no merge conflicts?
20:38:01*SenasOzys quit (Ping timeout: 265 seconds)
20:39:53FromGitter<krux02> well, I prefer merge conflicts over lost updates
20:40:25*nsf quit (Quit: WeeChat 2.0.1)
20:40:40FromGitter<krux02> I will try to rewrite the history of my branch as if I never put stuff into another file and then merge with the deve branch
20:41:02*jrbrt joined #nim
20:41:20Araqlost updates? what do you mean
20:42:40FromGitter<krux02> the function got changed in the development brach of Nim
20:42:55shashlickdom96: https://github.com/nim-lang/Nim/issues/2650 <= seems fixed?
20:47:12*miran quit (Ping timeout: 265 seconds)
20:47:50FromDiscord<treeform> I think I am using templates more and more. At this rate I will not be writing nim code, just the templates I wrote...
20:48:39FromGitter<krux02> treeform: what are you talking about, `template` is a Nim keyword
20:48:58FromDiscord<treeform> I am taking about that my code does not look like nim code any more
20:49:06FromDiscord<treeform> because I use so many template
20:49:08FromDiscord<treeform> because I use so many templates
20:49:24FromGitter<krux02> what are you talking about?
20:49:32*SenasOzys joined #nim
20:49:38FromGitter<krux02> I use `template` a lot. Still I think it is Nim code
20:50:00FromDiscord<treeform> example: https://gist.github.com/treeform/4326879f11c809c7a13b886f4524b028
20:50:45FromGitter<krux02> bq?
20:50:50FromGitter<krux02> that looks in fact weird
20:50:53FromDiscord<treeform> template
20:50:58FromGitter<krux02> why don't you use `quote`?
20:51:16FromDiscord<treeform> how would quote help?
20:52:11FromGitter<krux02> this really looks weird, and not how I would write code
20:52:17FromGitter<krux02> what are you generating?
20:52:41FromDiscord<treeform> SQL
20:52:51FromDiscord<treeform> there is what more nim like version looks like: https://gist.github.com/treeform/4326879f11c809c7a13b886f4524b028
20:53:27FromGitter<krux02> no thanks, these integrated gists really crap up the performance of gitter
20:53:32FromGitter<krux02> barely usable now
20:54:11FromDiscord<treeform> Sorry man, I just sent a link. I am on discord not gitter.
20:55:20FromDiscord<treeform> Its actually amazing this bridge to bridge works at all.
20:55:26Araqtreeform: for SQL construction, check out Ormin
20:55:41FromDiscord<treeform> I did, I don't think it can do what I want it to do.
20:56:19FromDiscord<treeform> It seems to be more of an ORM.
20:57:34*xet7 quit (Read error: Connection timed out)
20:58:15*xet7 joined #nim
20:58:32*Lord_Nightmare2 joined #nim
20:59:13*Lord_Nightmare quit (Ping timeout: 248 seconds)
20:59:25*Lord_Nightmare2 is now known as Lord_Nightmare
20:59:37*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:01:55*jjido joined #nim
21:02:23Araqyes
21:02:28Araqit cannot do what you need
21:02:36Araqbut you can copy its DSL
21:03:05Araqbecause it's easier to work with than your raw AST stuff
21:06:10FromDiscord<treeform> that is probably true
21:06:27FromDiscord<treeform> Now that I leveled up my template stuff, maybe I can figure out the DSL code now.
21:06:40FromGitter<krux02> I know scala has some views on the database that let you do queries like they were basic scala code
21:06:49FromGitter<krux02> the code is then translated into sql
21:06:57FromGitter<krux02> pretty cool I think
21:07:04FromGitter<krux02> but it can't do everything
21:07:33*Lord_Nightmare2 joined #nim
21:08:32FromGitter<krux02> I think you can map NimNodes to sql constructs
21:08:49*Lord_Nightmare quit (Ping timeout: 248 seconds)
21:09:05*Lord_Nightmare2 is now known as Lord_Nightmare
21:11:18*r3d9u11 quit (Remote host closed the connection)
21:15:18*Jesin joined #nim
21:20:44*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:25:02*xet7 quit (Remote host closed the connection)
21:25:50*jjido joined #nim
21:55:45*Vantage joined #nim
21:58:01*DarkArctic quit (Disconnected by services)
21:58:17*juanfra joined #nim
21:58:26*DarkArctic_ joined #nim
21:59:59*Jesin quit (Quit: Leaving)
22:07:46*nsf joined #nim
22:12:32*Vantage quit (Quit: Leaving)
22:14:25shashlickaraq: I think you might want to check out tissue for debugging nim issues - run `tissue -e issueid` and it will download the snippet from the issue and run it locally in the foreground. You can edit the snippet or nim code and rerun easily
22:14:33shashlickcurious if it helps your workflow
22:19:02*athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:21:15*nsf quit (Quit: WeeChat 2.0.1)
22:22:44Araqshashlick: is it a nimble package or what?
22:39:04*Trustable quit (Remote host closed the connection)
22:48:45*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:51:10shashlickNot yet, I'll make it one
22:52:02shashlickhttps://github.com/genotrance/tissue
22:52:59*simonsolnes quit (Ping timeout: 260 seconds)
23:00:57*DarkArctic joined #nim
23:05:37FromGitter<zacharycarter> haha awesome name
23:06:10dom96shashlick: Nice. Any reason you're not following code conventions though? :)
23:06:25dom96tconfig should be Config
23:06:30dom96and CONFIG should be config
23:07:43FromGitter<zacharycarter> dom96: playground should be ready tomorrow
23:07:50dom96great
23:08:02FromGitter<zacharycarter> also - I think I've been given the greenlight to use Nim at work
23:08:14FromGitter<zacharycarter> in some capacities
23:08:22FromGitter<krux02> great
23:08:37Demos[m]yayayayay!
23:08:50FromGitter<zacharycarter> I threw a huge fuss yesterday in front of some team members and basically said - I'm not going to be around long
23:08:57FromGitter<zacharycarter> because of poor engineering standards
23:09:22FromGitter<zacharycarter> and then the directory of my business unit and my manager met with me yesterday afternoon and today and talked about all my issues and I said we need a native language and a language like go or nim
23:09:42FromGitter<zacharycarter> and I said go would be useful for certain things and nim could help us use high performant c code without managing memory
23:10:15FromGitter<krux02> well to be honest, the C interop from Go isn't bad at all.
23:10:24FromGitter<krux02> They made a very clean intarface.
23:10:27FromGitter<zacharycarter> so the feedback I got was that these things are very possible - they're not going to happen right away - but in the near future I think we may be writing CLI tools, some SEO tooling, etc... with Nim
23:10:34FromGitter<zacharycarter> well I know - we're going to use Go too
23:10:43FromGitter<zacharycarter> I wrote Go all day today
23:10:49FromGitter<zacharycarter> instead of Java / Groovy for once
23:10:53FromGitter<zacharycarter> it was glorious!
23:11:05FromGitter<krux02> Go is great when the altearnative is that
23:11:10FromGitter<zacharycarter> right!
23:11:12FromGitter<mratsim> I heard that Go interop has some overhead though (probably only relevant for numerical code)
23:11:29FromGitter<krux02> I don't know about the overhead I never measured it.
23:11:46FromGitter<krux02> But the way you interface C is so clean that I just have to like it.
23:11:51FromGitter<zacharycarter> I need to help @Varriount with the aws stuff - but I've had so much going on in my personal life
23:12:21FromGitter<zacharycarter> @mratsim - are you at all interested in cloud providers and Nim for work?
23:12:51dom96The advantage Nim brings is that you can interface to C++. No other language can do it as well as Nim (except C++ :))
23:12:54FromGitter<krux02> it's not that it is super trivial and everything, you still need to write wrappers, but it still has this clearly defined boundary between Go and C code
23:12:55FromGitter<zacharycarter> I know our BDFL has been working on some stuff - I don't want to spill any details but
23:13:12FromGitter<krux02> bdfl?
23:13:13dom96How clean is Go's C interop compared to Nim's?
23:13:18FromGitter<mratsim> @Araq, naming openarray span would be an improvement, OpenArray is so strange if you don’t come from Pascal Modulo ...
23:13:23FromGitter<zacharycarter> benevolent dictator for life
23:13:28dom96mratsim: span?
23:13:32Demos[m]@dom96: Actually .... I think D wins over nim for c++, just because of Calypso
23:13:42dom96mratsim: that's an HTML element :P
23:13:46FromGitter<mratsim> @dom96 span like C++17 ;)
23:13:47FromGitter<krux02> dom96: very clean, first of all, C interop types are not defined in system, they have their own namespace
23:13:51FromGitter<krux02> called C
23:13:51dom96Demos[m]: How?
23:13:57FromGitter<krux02> C.int, C.float, etc
23:13:57FromGitter<zacharycarter> dom96: well - we might be using C++ in the future too who knows
23:14:06FromGitter<mratsim> @dom96 I believe D has better C++ inter, well marketing wise at least
23:14:12FromGitter<mratsim> interop
23:14:16FromGitter<zacharycarter> but D is dead
23:14:20FromGitter<zacharycarter> deader than dead
23:14:21FromGitter<krux02> D can link to c++
23:14:23Araqlol
23:14:24Demos[m]Calypso extends the llvm d compiler to actually merge the C++ and D ast
23:14:29dom96mratsim: lol, you're saying D's marketing makes you think that? :P
23:14:40FromGitter<mratsim> :P
23:14:42FromGitter<zacharycarter> I'm not typing Araq anymore
23:14:47FromGitter<zacharycarter> besides that one last time
23:14:52FromGitter<krux02> I know I played a game from the creator of the D language
23:14:58Araqhey
23:15:02FromGitter<krux02> Empire: Wargame of the Century.
23:15:10FromGitter<mratsim> @dom96: Here you go about span - https://github.com/nim-lang/Nim/issues/7337#issuecomment-373580383
23:15:13Demos[m]but like Calypso is a massive project
23:15:21FromGitter<zacharycarter> wut's Calypso?
23:15:38FromGitter<mratsim> Rust call that “Slice”: https://github.com/nim-lang/Nim/issues/7337#issuecomment-373758177
23:15:53Demos[m]https://wiki.dlang.org/Calypso
23:15:58FromGitter<mratsim> @zacharycarter cloud providers, like AWS?
23:15:59dom96krux02: Sure, that's cleaner, but in practice does that really make anything easier/better?
23:16:08FromGitter<krux02> @mratsim yea but that name is taken.
23:16:17FromGitter<krux02> dom96: I never said that
23:16:31FromGitter<krux02> and yes I want the c types to be gone from systeam
23:16:36FromGitter<mratsim> Ranges is taken as well, so only Span is left :P
23:16:39FromGitter<zacharycarter> @mratsim yes
23:16:48FromGitter<krux02> I want them, but they should be required to be imported
23:16:49AraqI want system.nim to be gone
23:16:57FromGitter<krux02> cint should not be available right away.
23:17:07Araqyeah because reasons.
23:17:27FromGitter<krux02> Araq: I want a pony.
23:17:38FromGitter<mratsim> @zacharycarter At one point yes, I would love to have easy Arraymancer deployment on AWS GPU instances.
23:17:41FromGitter<krux02> No honestly I don't want a pony.
23:17:56FromGitter<krux02> A pony just poops in the garden
23:18:09FromGitter<mratsim> @krux02 here you go: https://pjreddie.com/static/Redmon%20Resume.pdf
23:18:10dom96Demos[m]: That's pretty cool. Nim's approach is surely the best first-party interop though ;)
23:18:34FromGitter<zacharycarter> @mratsim - well I know you're always busy, but if you get time maybe you, @Varriount and myself can work on this AWS library - @Varriount has already done a ton of work and I've just been lazy
23:18:40FromGitter<mratsim> Note that this guy is a star in the deep learning world, his repo has 7k+ stars: https://github.com/pjreddie/darknet
23:19:30Demos[m]yeah probably, although C++/CIL is pretty good as well
23:19:47FromGitter<mratsim> @zacharycarter can’t promise anything yet, but give me the link I’ll check it out :)
23:20:11Araqyou know what's best for C++ interop? when you have a working destructor system. :P
23:20:31Araqwhich D ... has? hasn't? not sure.
23:20:35Demos[m]:D
23:20:43FromGitter<zacharycarter> yo wait - is this guy really like one of those MLP lovers?
23:20:47AraqRust has it. we are still getting it.
23:20:49dom96mratsim: favourite languages: C, Python. Sounds like somebody needs to be introduced to Nim :P
23:20:50FromGitter<zacharycarter> bronies
23:20:53FromGitter<zacharycarter> I forgot the name
23:20:53dom96I love bronies
23:20:56FromGitter<zacharycarter> lol
23:21:04FromGitter<zacharycarter> okay sorry I'm derailing- I'll shut up
23:21:37Demos[m]imo you really want a good finalizer system as well. There's lots of resources that you really don't need cleaned up immediately
23:22:26FromGitter<mratsim> “The heap is a lie"
23:22:40dom96In any case, I was able to interface with clang's C++ codebase fairly easily
23:22:57FromGitter<zacharycarter> you know the #1 feature I would love for Nim - a way to do more performant multi-threading without having to resort to channels or locks / mutexes / etc - while still leveraging some sort of managed memory
23:22:59dom96It all works beautifully
23:23:17dom96zacharycarter: what's your use case?
23:23:25FromGitter<zacharycarter> I want to leverage things like fibers
23:23:27FromGitter<krux02> @zacharycarter what do you mean?
23:23:31FromGitter<krux02> fibers?
23:23:33FromGitter<krux02> what is that
23:23:34FromGitter<mratsim> regarding that, WHy was the actor library deprecated? I was looking into that to implement multithreading for my go playing bot
23:23:49FromGitter<mratsim> @krux02 fibers are fancy coroutines / green threads
23:23:52FromGitter<zacharycarter> https://en.wikipedia.org/wiki/Fiber_(computer_science)
23:23:55Araqmratsim: threadpool.nim is just better, that's why.
23:23:57*krux02 joined #nim
23:24:08dom96We don't need fibers. We've got async.
23:24:26Araqyeah I told him but he isn't convinced.
23:25:03FromGitter<krux02> @mratsim well that doesn't reall answer what that is
23:25:10FromGitter<mratsim> @zacharycarter I use OpenMP for performant multithreading without channels or lock :P but that’s for data parallel algos
23:25:20FromGitter<zacharycarter> I get that - but when you start writing a game engine with a job scheduler it's hard to fit all the functionality needed into a single thread
23:25:52FromGitter<zacharycarter> you want something to schedule tasks
23:25:59FromGitter<krux02> Once use OpenMP for multithreading and then took it out, because when you have 16ms for a frams, you don't do OpenMP
23:26:21FromGitter<zacharycarter> you generally want wokers that are executing tasks
23:26:24Araqsystem.nim, 4000 lines of code but boy that 10 lines full of c* types must be erased...
23:26:32FromGitter<krux02> @zacharycarter what do you really need to do is so many threads?
23:26:48FromGitter<mratsim> @zacharycarter I asked about multi threading yesterday you might want to check the logs, I got the following links: https://github.com/yglukhov/nimx/blob/master/nimx/private/worker_queue.nim, https://github.com/dom96/nim-in-action-code/blob/b63d8111b65ea4dcb1321a4c4f64807ee0ea62b5/Chapter3/ChatApp/src/client.nim#L42, https://rosettacode.org/wiki/Dining_philosophers#Nim
23:26:56FromGitter<zacharycarter> alright I'll read these
23:26:58FromGitter<zacharycarter> thank you
23:27:29FromGitter<krux02> really people, a single thread has already crazy amounts of computational power, you just need to use it.
23:27:45FromGitter<zacharycarter> it's not about spreading computational power
23:27:48Araqkrux02 but it does not SCALE
23:27:50FromGitter<krux02> write efficient code then you don't need crazy amount of processorts
23:28:29FromGitter<krux02> Araq: a game never scales
23:29:03FromGitter<zacharycarter> http://etodd.io/2016/01/12/poor-mans-threading-architecture/
23:29:27AraqEve online scales. because it uses Erlang servers.
23:29:38FromGitter<zacharycarter> they used to use stackless python
23:29:46FromGitter<zacharycarter> also they do time dilation or whatever
23:29:56AraqI wasn't serious.
23:29:58shashlickMissing the action, in the grocery store
23:30:00FromGitter<zacharycarter> oh
23:30:18shashlickdom96 I'll make the changes
23:30:32FromGitter<zacharycarter> I dunno - I think the BEAM VM has some nice use cases
23:30:38FromGitter<zacharycarter> especially in enterprise software dev
23:30:59FromGitter<mratsim> Scotty BEAM me up
23:31:06FromGitter<mratsim> (sorry couldn’t resist)
23:32:30FromGitter<zacharycarter> like - if fault tolerance, resiliency, redundancy, etc... are all goals of your architecture
23:32:40FromGitter<zacharycarter> why not leverage a design that has those goals in mind?
23:36:34FromGitter<krux02> @zacharycarter well most importantly is that you actually have something that you need parallelization for. When you code runs slow, before you do any multithreading or stuff in that diriction make sure your to know where you spent most of your time. Then do proper layouts in memory and make sure it runs fast. When you did all of that, check if you still need multithreading.
23:36:53FromGitter<krux02> the only thing where I see multithreading to be really an improvement is in resource loading.
23:37:35dom96I know nothing about game engines. But I was able to parallelise httpbeast and it seems to be scaling very well
23:38:31FromGitter<krux02> dom96: you mean the Nim website can now handle 1000000 calls ber second?
23:39:04dom96You can totally implement Google using Nim now
23:39:08dom96:D
23:39:46FromGitter<krux02> I really think 99.9% of all cases where people want to throw threads at solving their problem it just doesn't do it.
23:41:00FromGitter<mratsim> Araq mentionned that he would like to reimplement Parasail in Nim
23:41:12FromGitter<krux02> what is parasail?
23:41:51FromGitter<mratsim> A parallel first programming language: https://parasail-programming-language.blogspot.fr/
23:42:14FromGitter<mratsim> by the author of Oberon?
23:42:17FromGitter<krux02> Well I am a "parallel last" guy
23:42:19FromGitter<mratsim> I don’t remember
23:43:32FromGitter<krux02> well when you really want to use "parallel" hardware, you need to program the GPU.
23:44:26FromGitter<krux02> The GPU has a lot of advantages compared ot the CPU so that it can increase it's porformance much faster than any CPU can.
23:45:18FromGitter<krux02> I see the CPU only has a controller or manager unit that does not do the heavy lifting of the calculatoins, it just puts the DATA on the CPU and puts in the the right format
23:45:29FromGitter<krux02> but the actual computation is done on the GPU.
23:46:02FromGitter<krux02> I have a project where I want to compile Nim code down to the GPU.
23:46:13FromGitter<krux02> don't expect general Nim code to work on the GPU.
23:48:01FromGitter<mratsim> GPU (and OpenMP) are good for data parallel cases but it’s harder for task based parallelism
23:48:43FromGitter<mratsim> jcosborn cudanim can compile to Nim code to Cuda: https://github.com/jcosborn/cudanim
23:48:59Araqhttp://etodd.io/2017/03/29/thirteen-years-of-bad-game-code/
23:50:28Araqhe was one of the authors of the newer Ada standards.
23:51:54*user1101 quit (Quit: user1101)
23:53:38AraqI ran into tons of problems. I created binding cycles that caused infinite loops. I found out that initialization order is often important, and initialization is a nightmare with data binding, with some properties getting initialized multiple times as bindings are added."
23:54:04Araq^ my vue.js experience
23:54:18Araqthis reactive stuff simply never works. :P
23:54:44FromGitter<mratsim> Vue like angular has executable code in html comment ...
23:54:58FromGitter<krux02> yea, I just prefer to order stull and initialize imperatively
23:55:03FromGitter<krux02> stuff
23:55:08FromGitter<krux02> i can't type
23:56:16FromGitter<krux02> Araq: but there are some lazy initialized things in the Nim compiler, too
23:56:32FromGitter<krux02> just an example, the size of types
23:56:50Araqdon't do what I do, do what I tell you.
23:57:16Araqalso: reactiveness is not at all about laziness.
23:57:40Araqit's about building a dependency graph that then does things in a semi-smart way
23:58:14FromGitter<krux02> "semi-smart"
23:58:18FromGitter<krux02> nice words
23:59:55FromGitter<krux02> I am reading the article: "GetCenter(); // Gets the center of the mesh"