<< 21-12-2017 >>

00:00:08radagastInstead of methods, is it wise to use a lot of overloaded (friend functions/) procedures ?
00:07:18FromGitter<zacharycarter> it's best not to do OOP with Nim
00:09:44FromGitter<mratsim> Is there a way to require that a field must be initialized in the constructor and cannot be left to its default value (here 0) ⏎ ⏎ ```type ⏎ Gate*[TT] = ref object {.inheritable.} ⏎ arity*: int``` [https://gitter.im/nim-lang/Nim?at=5a3afbc80163b028105fc30a]
00:09:46FromGitter<zacharycarter> I mostly avoid dynamic dispatch when writing Nim
00:10:35FromGitter<Varriount> @mratsim The only way I can think of is to make the type private, and only return it from a constructor.
00:10:47FromGitter<Varriount> But then you run into issues with variable declaration.
00:11:28FromGitter<zacharycarter> what's the difference between
00:11:44FromGitter<zacharycarter> `````` [https://gitter.im/nim-lang/Nim?at=5a3afc3f5355812e57fdb2a3]
00:11:47*yglukhov quit (Remote host closed the connection)
00:12:13FromGitter<mratsim> mmmh I see, well maybe a `int not default` in the future :P
00:13:27FromGitter<mratsim> @zacharycarter to be honest I don’t know if that makes a difference in practice. I just don’t see why I would inherit from a global RootObj while I ha a very specific use case
00:13:45FromGitter<mratsim> and I guess there is one less layer of indirection
00:16:07FromGitter<zacharycarter> gotcha
00:23:58radagastDamn
00:24:06radagastI'm so used to the abstractions of OOP
00:24:16radagastEspecially coming from C++
00:32:25FromGitter<Varriount> radagast: Better than coming from Java
00:32:50radagastAt least you are used to RootObj
00:35:58GitDisc<treeform> radagast, i found this video useful to get a way from OOP: https://www.youtube.com/watch?v=QM1iUe6IofM
00:38:46FromGitter<zacharycarter> Just spend a few weeks / months writing C
00:38:52FromGitter<zacharycarter> you won't miss OOP
00:41:38*radagast quit (Quit: radagast)
00:48:25*SenasOzys quit (Remote host closed the connection)
00:55:56FromGitter<ephja> nah just other language features invented after 1980 :p
01:00:09FromGitter<data-man> Macros can do anything. Well, almost everything. :-)
01:02:38FromGitter<mratsim> Java OOP is not abstraction it's overabstraction full of Visitors of Factories
01:06:10FromGitter<mratsim> By the way is there a progress bar package for Nim, something like Python tqdm for iterators: https://github.com/tqdm/tqdm
01:07:11FromGitter<mratsim> Ah found one
01:12:38FromGitter<zacharycarter> Godot has a major flaw in its design / approach to popularizing itself
01:12:52FromGitter<zacharycarter> I've come to conclude anyway
01:14:51FromGitter<zacharycarter> it attempts to appeal to the lowest common denominator of "game developers" so basically people without any programming background
01:16:43FromGitter<zacharycarter> and it allows for this to influence design decisions, for instance : ```Implementing a job system in Godot was too challenging, unfortunately. While for high-end game engines this makes sense, usability would end up severely affected. As Godot aims to be an easy to use engine, users would have too many challenges with a system like this```
01:16:59FromGitter<zacharycarter> and they don't offer any real substantiation behind these types of claims
01:18:40FromGitter<zacharycarter> most of the potential crowd godot attracts first ask the question - what successful games have been built with the engine? and the answer is none really
01:20:27FromGitter<zacharycarter> so you're building a piece of technology to cater to novices, but you expect / hope to popularize your technology by showcasing advanced applications of said technology
01:20:31FromGitter<zacharycarter> doesn't really make a lot of sense to me
01:21:16FromGitter<zacharycarter> GMS would be the most popular choice for engines if this expectation was realistic
01:22:16FromGitter<tulayang> OOP is useful for GUI programming, bug only GUI programming. OOP is clumsy to deal with data processing.
01:22:33FromGitter<tulayang> OOP is useful for GUI programming, but only GUI programming. OOP is clumsy to deal with data processing.
01:27:16FromGitter<data-man> @zacharycarter: Is OGRE not popular? For example, Rigs of Rods uses OGRE.
01:28:13FromGitter<zacharycarter> @data-man I think OGRE lost a lot of steam when Urho3D came out, and then I think Urho3D lost steam when Atomic was forked
01:28:53FromGitter<zacharycarter> and everything seems to be losing steam to godot, but not for any logical reason I can conclude
01:31:02*vivus quit (Quit: Leaving)
01:32:56drswe did GUI programming before OOP too. The best examples, while possibly considered "legacy" would be Win32 and/or Motif.
01:34:43FromGitter<data-man> @zacharycarter: Oh, thanks! I did not know about Atomic. And which is the best in your opinion?
01:35:46FromGitter<zacharycarter> @data-man UE4 / Unity
01:37:01FromGitter<zacharycarter> if you want to leverage an FOSS engine maybe look at https://github.com/BearishSun/BansheeEngine or https://github.com/nem0/LumixEngine
01:37:17FromGitter<zacharycarter> I doubt either are as full featured as godot atm, but I also question many of godot's design decisions
01:43:18*MJCaley joined #nim
01:46:58FromGitter<tulayang> OOP gives me the feeling that you can associate a bunch of objects and then handle all the window events in the same place by a mediator. Of course, it is also can be done to use a structure to save the pointers of all the event functions instead of using OOP.
01:59:55*sz0 quit (Quit: Connection closed for inactivity)
02:04:44*geocar_ joined #nim
02:04:51*LyndsySimon_ joined #nim
02:05:59*chemist69 quit (Ping timeout: 265 seconds)
02:06:59*arecacea1 joined #nim
02:07:14*geocar quit (*.net *.split)
02:07:15*arecaceae quit (*.net *.split)
02:07:15*kunev quit (*.net *.split)
02:07:16*dyce[m] quit (*.net *.split)
02:07:16*m712 quit (*.net *.split)
02:07:16*d10n quit (*.net *.split)
02:07:16*nathanj quit (*.net *.split)
02:07:16*LyndsySimon quit (*.net *.split)
02:07:17*geocar_ is now known as geocar
02:07:31*LyndsySimon_ is now known as LyndsySimon
02:08:18*d10n joined #nim
02:08:18*d10n quit (Changing host)
02:08:19*d10n joined #nim
02:08:19*m712 joined #nim
02:08:27*kunev joined #nim
02:08:30*dyce[m] joined #nim
02:08:44*nathanj joined #nim
02:09:41*craigger quit (Ping timeout: 260 seconds)
02:11:13*yglukhov joined #nim
02:12:14*craigger joined #nim
02:15:49*yglukhov quit (Ping timeout: 268 seconds)
02:18:21shashlickis it possible to read from stdin in a non-blocking fashion? wondering how to read info optionally piped into process, where data is not always expected
02:19:25*chemist69 joined #nim
02:25:04FromGitter<RedBeard0531> @shashlick its a bit of a hack, but `0.AsyncFD.newAsyncFile` should do the trick. Just don't cross the streams and mix async and sync handling of stdin
02:25:18FromGitter<RedBeard0531> assuming you are on posix
02:25:23FromGitter<RedBeard0531> no idea about windows
02:25:55FromGitter<RedBeard0531> There is probably a named constant that you can use instead of 0, but 0 is what I remember :)
02:27:44FromGitter<RedBeard0531> Does anyone know if finalizers are allowed to be closures? I *think* that is what this error message is telling me, but it's not the pinnacle of clarity.
02:45:23FromGitter<Varriount> @RedBeard0531 What's the error message?
02:47:48FromGitter<RedBeard0531> ifaddrs.nim(50, 19) Error: type expected ⏎ ifaddrs.nim(50, 15) Error: 'typedesc' metatype is not valid here; typed '=' instead of ':'? ⏎ ifaddrs.nim(51, 9) Error: type mismatch: got (ref seq[ifaddrs], proc (_: ref seq[ifaddrs]){.closure, noSideEffect ⏎ , gcsafe, locks: 0.}) ⏎ but expected one of: ... [https://gitter.im/nim-lang/Nim?at=5a3b20d4a2be466828c8663e]
02:48:36FromGitter<RedBeard0531> the actual exression was `(_: ref seq[ifaddrs]) => freeifaddrs(addrs)` where addrs was a closure capture
02:51:10FromGitter<data-man> @zacharycarter : Thanks! Banshee & Lumix are already in my bookmarks :-)
02:54:10FromGitter<RedBeard0531> I decided it'll be easier to just write an iterator than to try to return a seq, so that solved my problem for now
03:09:46*vlad1777d_ quit (Ping timeout: 260 seconds)
03:10:10*MJCaley quit (Quit: MJCaley)
03:13:36*SenasOzys joined #nim
03:33:50shashlick@RedBeard0531: I'll try thanks, though this is windows so wish me luck!
03:35:27FromGitter<RedBeard0531> It may work anyway, but I can't promise it wont do something bad. linux only has one type of file handle, but windows seems to have tons.
03:38:53*marenz_ joined #nim
03:42:39*marenz__ quit (Ping timeout: 265 seconds)
03:48:17shashlickHold, async isn't really equivalent to non blocking right? It may come back in the future, but I only care now, not in the future
03:53:53FromGitter<tekjar> Hi. Just curious. Is 1.0 happening this month?
04:03:16*sz0 joined #nim
04:09:27*dddddd quit (Quit: Hasta otra..)
04:21:00*nim|83243 joined #nim
04:23:10*nim|83243 quit (Client Quit)
04:23:16*nim|83243 joined #nim
04:25:53*nim|83243 quit (Client Quit)
04:50:35FromGitter<nitely> @shashlick if you are doing async stuff, you could have a thread blocking on reading the stdin then feeding the input into a queue that the main thread (doing async) is awaiting on. However I dunno if that's even possible coz I haven't done anything with async in Nim :P
04:54:12FromGitter<nitely> 1) is awaiting on, while it does other stuff without blocking the main thread
04:59:51FromGitter<nitely> or you would have to check if there is something in the queue from time to time (not awaiting). Not sure. Depends on what you are doing
05:00:43shashlickI think I pulled it off quite simply, testing to verify it really works :)
05:00:45FromGitter<nitely> if the latter then there's no need for async really
05:06:00FromGitter<nitely> for each question someone asks there's almost always an easier answer hidden in the missing context :D
05:13:57FromGitter<nitely> @shashlick let us kown how you solved it
05:15:16*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
05:57:19*marenz_ quit (Ping timeout: 248 seconds)
06:04:05*yglukhov joined #nim
06:05:48*sz0 quit (Quit: Connection closed for inactivity)
06:07:37shashlicknever mind, it doesn't really work yet
06:08:31*yglukhov quit (Ping timeout: 256 seconds)
06:19:05*nsf joined #nim
06:26:09*LyndsySimon quit (*.net *.split)
06:26:09*geocar quit (*.net *.split)
06:26:10*xkapastel quit (*.net *.split)
06:26:11*surma quit (*.net *.split)
06:26:11*Nikky quit (*.net *.split)
06:31:43shashlick@RedBeard0531, @nitely, no luck on windows with the stdin.getFileHandle().AsyncFD.newAsyncFile() method, just says handle is invalid
06:31:49*LyndsySimon joined #nim
06:31:49*geocar joined #nim
06:31:49*xkapastel joined #nim
06:31:49*surma joined #nim
06:31:49*Nikky joined #nim
06:33:20*BitPuffin|osx joined #nim
06:48:29*LyndsySimon quit (*.net *.split)
06:48:29*geocar quit (*.net *.split)
06:48:29*xkapastel quit (*.net *.split)
06:48:30*surma quit (*.net *.split)
06:48:30*Nikky quit (*.net *.split)
07:08:32*skrylar joined #nim
07:13:39FromGitter<mratsim> @shashlick there is a chapter in dom96 book about that, check his repo with non-blocking messaging example for the book.
07:20:17*solitudesf joined #nim
07:24:48*surma joined #nim
07:24:53*Nikky joined #nim
07:25:05*geocar joined #nim
07:25:30*xkapastel joined #nim
07:26:37*LyndsySimon joined #nim
07:26:48*SenasOzys_ joined #nim
07:27:12*SenasOzys quit (Read error: Connection reset by peer)
07:29:51*marenz_ joined #nim
07:34:35*marenz_ quit (Ping timeout: 252 seconds)
07:58:57*skrylar scratches head. Now why did nim build another 20 seconds slower just because of a js backend fix
08:10:46skrylarseems like using a piece table would lead to some strangeness
08:10:59skrylarsince you have to apply a whole chain of diffs just to render the document
08:13:51*SenasOzys_ quit (Ping timeout: 248 seconds)
08:21:32*claudiuinberlin joined #nim
08:30:33*SenasOzys_ joined #nim
08:32:18*vlad1777d_ joined #nim
08:33:57*floppydh joined #nim
08:33:57FromGitter<mratsim> @andreaferretti @skrylar I got convolutional neuralnet working end to end on MNIST! (but only on 0.17.2, the new Nim allocator chokes when passing a Tensor of 10000x28x28) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a3b71f40163b0281061983c]
08:34:15FromGitter<mratsim> (https://files.gitter.im/nim-lang/Nim/6xtN/2017-12-21_09-31-30.png)
08:34:33FromGitter<mratsim> 61% accuracy after 1 epoch! yeah =)
08:40:43FromGitter<mratsim> (for everyone else, MNIST is a database of 70k handwritten digits, you train on 60k and are tested on 10k, 1 epoch is one round of training on the 60k example).
08:41:19skrylari still need to actually finish my GRU port and do something with convents
08:50:40*xkapastel quit (Quit: Connection closed for inactivity)
09:04:05*gmpreussner quit (Ping timeout: 252 seconds)
09:05:25*gmpreussner joined #nim
09:09:16FromGitter<alehander42> great stuff, @mratsim !
09:11:43*PMunch joined #nim
09:15:08*yglukhov joined #nim
09:15:09*yglukhov quit (Read error: Connection reset by peer)
09:15:43*yglukhov joined #nim
09:17:03*yglukhov quit (Read error: Connection reset by peer)
09:17:16*yglukhov joined #nim
09:18:21*radagast joined #nim
09:18:37ftsfhmm cannot evaluate `sizeof(ObjectVariantType)`
09:19:25FromGitter<andreaferretti> @mratsim very cool!
09:19:42FromGitter<andreaferretti> I see you are more or less following the approach of pytorch, I like it!
09:20:34FromGitter<andreaferretti> The only thing I don't like very much is having to pass all optimizable parameters to newSGD
09:21:18FromGitter<andreaferretti> maybe it would make more sense to make models some kind of object which know what trainable parameters they have
09:22:08FromGitter<andreaferretti> like in pytorch you have a model `m` where you can call `m.forward(...)` (which is akin to your `model` function)
09:22:21FromGitter<mratsim> It's just the low-level SGD API, I wanted a quick win.
09:22:25FromGitter<andreaferretti> but also `m.parameters()` to get something you can pass to an optimizer
09:22:50FromGitter<andreaferretti> yeah, I agree, nicer interfaces can be done later with some metaprogramming
09:22:53FromGitter<mratsim> I will use a high level similar to PyTorch for the optimizer as well
09:22:59FromGitter<andreaferretti> in any case, great work!
09:23:44FromGitter<mratsim> And for the model* settings weights right now is a bit strange
09:24:21FromGitter<mratsim> Now the critical things is debugging my issue with the new Nim allocator.
09:28:52*skrylar quit (Remote host closed the connection)
09:35:19*Arrrr joined #nim
09:35:19*Arrrr quit (Changing host)
09:35:20*Arrrr joined #nim
09:35:35*solitudesf quit (Ping timeout: 252 seconds)
10:09:25*vlad1777d_ quit (Ping timeout: 268 seconds)
10:32:41*SenasOzys__ joined #nim
10:33:42*SenasOzys_ quit (Read error: Connection reset by peer)
10:52:58*solitudesf joined #nim
10:55:43*mostly-harmless quit (Read error: Connection reset by peer)
11:02:45*nc-x joined #nim
11:10:11*Arrrr quit (Read error: Connection reset by peer)
11:10:17nc-xIs this code expected to work? https://gist.github.com/anonymous/53dd1d63928e1ade3a7938e3834fc996
11:11:41nc-xbecause it doesn't. It crashes the compiler itself. `koch temp c file.nim` gives `Stack overflow FAILURE` as the last two lines of error.
11:12:23nc-x(Replacing `echo x` with `echo x.repr` doesn't crash the compiler)
11:16:19Araqold, known, important bug
11:16:31Araqwill work eventually
11:17:51nc-xOkay
11:18:03nc-xSo no need to open an issue?
11:18:05Araqdom96, 'nimble develop websocket' gives me a git clone that cannot be teached about any existing branches
11:18:17Araqnc-x, no it's been reported twice at least already
11:18:35nc-xAraq: Okay, thanks!
11:20:39*arecacea1 quit (Remote host closed the connection)
11:20:58*arecacea1 joined #nim
11:23:07*dddddd joined #nim
11:23:26*Arrrr joined #nim
11:25:26*Yardanico joined #nim
11:26:34*nc-x quit (Quit: Page closed)
11:26:55Araqwebsocket\websocket\client.nim(26, 63) Error: cannot open 'securehash'
11:26:57Araqoh ffs
11:27:41AraqI'm moving it back into the stdlib
11:31:32Yardanicolol
11:35:31Araqit's only a name anyway, "securehash"
11:35:38Araqdoesn't have to be secure
11:35:52Araqthere are operating systems out there that don't "operate" either.
11:37:05*SenasOzys__ quit (Ping timeout: 248 seconds)
11:37:33FromGitter<mratsim> There are Rust and Crystal programing language that don't rust or crystallize as well ;)
11:40:17AraqVSCode now doesn't know about some files in my project like ospaths.nim
11:40:22Araqany ideas?
11:40:44Yardanicomake an issue on their github an rollback to older version? :P
11:44:49Yardanicoor maybe they've changed something in extensions API so nim extension doesn't work properly?
11:45:02*SenasOzys__ joined #nim
11:45:39FromGitter<mratsim> or you gitignored them :?
11:46:23Araqcontrol+P is not affected by the Nim extension
11:51:55*nsf quit (Ping timeout: 256 seconds)
12:00:34abeaumontit'd make more sense to have other variants of SecureHash there though (sha2, sha3), wouldn't it?
12:03:31dom96Araq: A git clone that cannot be teached about any existing branches?
12:04:10dom96I think I already have that in my issues
12:04:15dom96(https://github.com/nim-lang/nimble/issues/436)
12:05:22Araqsure but how hard is it to exec "git clone packageUrl"
12:05:49*NimBot joined #nim
12:05:59Araqdom96, because it needs a deprecation path
12:06:29dom96I reused the same cloning functionality that 'install' uses.
12:07:32Araqidea: make nimble packages declare their versioning system: semver/none
12:07:59Araqif 'none' nimble uses HEAD
12:09:05dom96Too many options
12:09:25Araqnimble install websocket.nim doesn't work btw
12:09:35Araqit's 'nimble install websocket'
12:09:56Araqand it installs a version that doesn't compile with Nim devel :-)
12:10:53dom96I'm pretty sure you cannot have dots in package names
12:12:04Araqyes but that git url sucks
12:12:30dom96okay, that's not my problem
12:18:21Araqdo we want a check that checks the URL matches the package name?
12:23:36GitDisc<Yardanico> Discord bridge may now be offline for a bit of time (I'll link #nim-offtopic with discord offtopic)
12:23:40yglukhovhaha, why securehash is back after i've switched 4 packages away from it? =)
12:23:55*GitDisc quit (Remote host closed the connection)
12:24:13*nsf joined #nim
12:24:32*GitDisc joined #nim
12:24:40*GitDisc quit (Remote host closed the connection)
12:24:51*GitDisc joined #nim
12:25:01Araqyglukhov, my bad, wasn't aware it's widely used
12:26:31yglukhovfyi, there's sha1 nimble package which is almost a drop in replacement
12:26:54FromGitter<alehander42> btw does nimble collect some kind of stats how many downloads packages have etc?
12:27:24dom96nope
12:27:51yglukhovhuh. it would be an interesting feature to automatically star downloaded packages
12:27:51*Snircle joined #nim
12:27:53*Vladar joined #nim
12:28:19yglukhovwould also popularize nim on gihub
12:28:32dom96We need to integrate more with http://nimble.directory/
12:30:19PMunchyglukhov, that would require people to be logged into GitHub though..
12:30:26FromGitter<mratsim> @yglukhov nimble would need the github token
12:30:27FromGitter<alehander42> I meant statistics, not stars, but that's an interesting idea :D (but not really applicable I think, except from a "nimblebot" account, which wouldnt make sense)
12:30:47FromGitter<alehander42> and I wouldnt want a package manager to start stuff for me, never
12:33:55FromGitter<mratsim> In archlinux there is an optional package called “aurvote” that allows autovoting of non-official libraries (AUR for Arch User Repository) that you install.
12:34:58FromGitter<mratsim> Is there a documentation page for the new “rand” library that replaces random?
12:36:11Araqit's still random.nim with new procs
12:36:50fvsgiven nim's interop with c, is static linking against c lib.a files a possiblity?
12:37:27FromGitter<alehander42> I often search for new nim libs in github trending nim, but it seems very broken (often I dont see actual libs I saw eg on forum, e.g. this week yglukhov's Python has 19 stars but its missing)
12:38:06FromGitter<mratsim> @fvs, yes it is. I could static link with Intel MKL in Arraymancer for example.
12:39:37fvsmratsim, build scripts on your github?
12:40:07FromGitter<mratsim> @fvs here: https://github.com/mratsim/Arraymancer/blob/99be4a5766778f3e05af052396dc2cfbe688fe65/nim.cfg#L71-L80
12:44:13dom96Maybe I'll add the same thing that I added to choosenim
12:44:17dom96Google Analytics
12:45:31FromGitter<alehander42> is it opt-in or opt-out in choosenim ?
12:45:55Yardanicoopt-in AFAIK
12:46:03Yardanicowell it asks you on installation
12:46:10FromGitter<alehander42> good
12:46:20Yardanicohttps://github.com/dom96/choosenim/blob/master/analytics.md
12:46:48FromGitter<alehander42> :D I've seen too many drama threads last year of people afraid of analytic tools enabled by default
12:47:20Yardanicothat's why there's this document :)
12:49:20FromGitter<mratsim> So Travis OSX build is broken again *sigh* ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a3badd00163b0281062e74f]
13:07:52FromGitter<alehander42> some kind of chainable assert would be cool for some variant cases ⏎ eg ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a3bb228ffa3e37919648b48]
13:08:44FromGitter<alehander42> (eg you *know* in this object, this chain is valid, and you don't want to litter with `if a.kind == / assert a.kind == ` on several lines)
13:12:41*yglukhov quit (Remote host closed the connection)
13:16:43*yglukhov joined #nim
13:26:09*jjido joined #nim
13:32:50FromGitter<mratsim> That's the Rust unwrap hell all over again.
13:35:12FromGitter<mratsim> I don't think there is a nim library to print images in CLI right? (Or an approximation using ASCII art). I'd like to have rough image display in Arraymancer for debugging without having to go through saving to jpg/png.
13:36:44PMunchmratsim, there is drawille-nim
13:40:08Arrrryou could use sdl
13:44:10FromGitter<mratsim> I don't want to depend on a shared lib.
13:45:28FromGitter<mratsim> @pmunch thanks for drawille, I checked their xkcd example it seems a bit rough, (set pixel to black if value < 128 or white >=128.
13:45:50FromGitter<mratsim> For curve though it seems pretty good.
13:47:28PMunchThe Nim version works a bit differently
13:47:36PMunchFor better or worse :P
13:48:15*gokr quit (Remote host closed the connection)
13:48:32FromGitter<mratsim> Or @Arrrr if a shared library an ubiquitous one (libjpeg, libpng) but for my use case I think only ffmpeg compiled with libcaca would be considered "ubiquitous"
13:49:24FromGitter<mratsim> And even then that requires framebuffer support I think.
13:54:25PMunchmratsim, you could always add colours to drawille-nim :)
13:54:37*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:55:10PMunchIt would be per 2x8 "pixel" block but depending on your scenario it might work
13:55:38PMunchThen you could do something like this: https://raw.githubusercontent.com/yaronn/blessed-contrib/HEAD/docs/images/truload.png
13:56:25FromGitter<mratsim> =}. Basically my images are a seq[uint8] either grayscale or RGB with 3x uint8 per pixel.
13:58:02FromGitter<mratsim> That's nice!
13:59:30*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
14:14:37Arrrri think you can compile glfw statically
14:16:05FromGitter<andreaferretti> I used this (https://github.com/unicredit/neurotic/blob/master/neurotic/viz.nim) in neurotic
14:16:15FromGitter<andreaferretti> with nim png
14:17:30*Vladar quit (Quit: Leaving)
14:24:02*nsf quit (Quit: WeeChat 1.9.1)
14:28:39*Vladar joined #nim
14:29:16*MJCaley joined #nim
14:35:09*sendell joined #nim
14:42:49*nc-x joined #nim
14:43:06nc-xWhat is the equivalent of rust's match guards https://rustbyexample.com/flow_control/match/guard.html in nim?
14:44:17*fvs joined #nim
14:48:10*nc-x quit (Quit: Page closed)
14:48:15FromGitter<mratsim> @nc-x nothing though patty can do some.
14:48:53fvshow can i generate a unique reference for a variable - here it doesn't change:
14:49:26fvsfor i in 0 .. 10:
14:49:26fvs var a = i; echo repr a.addr
14:49:26fvs
14:50:38FromGitter<mratsim> iirc there is a pragma to make sure the mangled name of a variable (and so it's memory reference) is unique.
14:51:17FromGitter<zacharycarter> http://libdill.org/index.html
14:51:24FromGitter<mratsim> But it's expected for the compiler to reuse a memory location that is valid only inside a loop.
14:52:49FromGitter<mratsim> What you can do otherwise is an unrolling macro.
14:53:23*happycoder joined #nim
14:53:48*happycoder quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org)
14:54:23*happycoder joined #nim
14:54:35FromGitter<mratsim> Or even simpler use an array and assign each value to a different cell of the array.
14:56:27fvswon't all array repr a[i] = i have the same pointer as well?
15:04:59*marenz_ joined #nim
15:11:50*MJCaley quit (Quit: MJCaley)
15:13:52*arecacea1 quit (Remote host closed the connection)
15:14:15*arecacea1 joined #nim
15:21:19*Senketsu quit (Remote host closed the connection)
15:23:10*couven92 joined #nim
15:29:13*Senketsu joined #nim
15:30:41*happycoder quit (Ping timeout: 248 seconds)
15:36:29*SenasOzys__ quit (Read error: Connection reset by peer)
15:42:40GitDisc<NopeDK> What does the "incompleteStruct" do exactly? It mentions "sizeof" but there is no clear explanation for what it actually does behind the scenes. I have seen several libraries with and without it...
15:47:04*MJCaley joined #nim
15:52:54*SenasOzys joined #nim
15:54:58Araqit's rarely required
15:55:26Araqit means that the C library uses typedef struct s s; and then only pointers to s
15:55:42Araqthat's an "incomplete" struct, sizeof() fails on it
16:08:02*xkapastel joined #nim
16:11:09*nyeaa joined #nim
16:12:44GitDisc<NopeDK> I see, thanks.
16:13:17FromGitter<mratsim> @fvs no, `assert addr a[i] != addr a[i+1]`
16:15:34*jxy joined #nim
16:16:31*sz0 joined #nim
16:16:50*jxy left #nim (#nim)
16:20:22*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
16:34:05*jxy joined #nim
16:36:25*yglukhov quit (Remote host closed the connection)
16:37:05*PMunch quit (Ping timeout: 240 seconds)
16:38:17*jjido joined #nim
16:41:51*vivus joined #nim
16:56:45*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:58:09*jxy quit (Quit: Changing server)
17:00:06*floppydh quit (Quit: WeeChat 2.0)
17:00:18Arrrrwow, compiler now gives error context, how cool
17:00:19*jjido joined #nim
17:00:36Arrrrit should print the lines on the left
17:00:41Arrrr*too
17:04:44*jjido quit (Client Quit)
17:05:30Arrrr 'expression: one(two)' -> 'L100: one(two)'
17:07:33*jxy joined #nim
17:12:18YardanicoArrrr, what?!
17:12:23Yardanicoyou mean with exceptions?
17:12:27Yardanicoah
17:12:41YardanicoI saw that Araq improved stack traces for macros/templates recently
17:18:14*Trustable joined #nim
17:21:55FromGitter<alehander42> o.O really, I didn't notice. on `devel`?
17:22:34*yglukhov_ joined #nim
17:25:32ArrrrFor example https://pastebin.com/YmQfQ0Cv
17:25:55Arrrrsometimes it spans through several lines
17:26:11*Jesin joined #nim
17:32:37*Serenitor joined #nim
17:34:51*jjido joined #nim
17:35:20*solitudesf quit (Quit: solitudesf)
17:38:08*jjido quit (Client Quit)
17:41:02SerenitorI am getting a compiler error from the generated C code when calling an object's variable "far"...
17:41:02Serenitornimcache\sdl_gpu.c:1022:44: error: expected identifier before ')' token
17:41:02Serenitor TM_dAik9b2yZPusK9c5ut8ZHLhg_0[65].offset = offsetof(tyObject_Camera_u4yS1OvANkfX5LEExWHpeA, far);
17:41:02Serenitor ^
17:41:15Serenitorhas anyone an idea what might be going on there?
17:43:02Arrrrwithout context, impossible
17:43:25FromGitter<mratsim> do you perhaps have a `far.nim`file in your project?
17:44:31*sendell quit (Remote host closed the connection)
17:45:20FromGitter<RedBeard0531> `far` is a keyword in some c dialects
17:45:33FromGitter<RedBeard0531> `near` as well
17:46:43FromGitter<RedBeard0531> Based on that error I assume far is a member of the Camera object. Try renaming that var, and file a ticket on github that nim's c codegen should mangle the names `near` and `far`.
17:47:15FromGitter<RedBeard0531> @Serenitor ^
17:52:20Serenitor@Arrrr can only provide my context by linking the file https://github.com/Serenitor/sdl2_nim/blob/master/sdl2/sdl_gpu.nim#L437
17:52:20Serenitor@mratsim nope, no far.nim
17:52:20Serenitor@RedBeard053 sadly it's a variable from a C lib's wrapped object so can't really choose, but I'll try asking for mangling thing, thanks
17:54:02AraqSerenitor: iirc Nim knows 'far' and 'near' are keywords but if you importc it the compiler has no choice and must obey
17:54:07*MJCaley quit (Quit: MJCaley)
17:57:34FromGitter<RedBeard0531> Maybe I'm missing something, but I don't see an importc pragma on that type. Is there supposed to be one? I'd be somewhat surprised if a widely used c lib used far as a member name.
17:59:46Serenitorright, just realised that I lied actually, I'm using importc only for the functions, the types are recreated in nim.
17:59:52Serenitorhere's original: https://github.com/grimfang4/sdl-gpu/blob/master/include/SDL_gpu.h#L308
18:00:17Serenitormaybe I should suggest to the maintainer to change it
18:06:02FromGitter<mratsim> @Araq, I think I’ve found the culprit in the Nim allocator issue. Managed to get the issue in a different context. Find the common point: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a3bf80a5355812e570299d5]
18:07:10FromGitter<mratsim> argh actually removing my `data=` proc only delayed the issue :/
18:07:51FromGitter<mratsim> I could load, unload, reload tensor then crash, instead of load, unload then crash.
18:08:08Araqjust give me something I can run
18:08:16AraqI probably already know the bug
18:08:41Araqyou don't disable the cycle collector, do you?
18:08:49FromGitter<mratsim> no I don't
18:09:15Araqdisable it and the bug will disappear if my hypothesis is correct
18:10:07AraqSerenitor: if you import the header, the full header is processed by the C compiler
18:25:39FromGitter<mratsim> @Araq GC_disableMarkAndSweep() helped for one case (big seq of size 10000x28x28x4 (float32)), for the other, I had to remove all usage of this `proc data =` anyway to use direct assignation instead as my memory was inflating 160MB by 160MB. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ So there might be 2 bugs, one with the cycle collector that you know of, and another one with `setter= ` proc that I will try to
18:25:39FromGitter... provide a test case for. [https://gitter.im/nim-lang/Nim?at=5a3bfca3232e79134d799ee6]
18:28:23*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
18:32:54*SenasOzys quit (Remote host closed the connection)
18:37:29GitDisc<treeform> Araq, would you be against of adding some thing like this to the json module? https://gist.github.com/treeform/d0e0c53aa107657241fa2fbcc74ee54a
18:41:27FromGitter<RedBeard0531> Why did unary < get deprecated? It actually seems really nice, especially with strided-countup like countup(0, <x.len, 2). x.len-1 and x.len.pred just don't feel as natural after getting used to 0..<x.len
18:41:52*yglukhov_ quit (Remote host closed the connection)
18:51:02FromGitter<mratsim> too many unwanted bugs.
18:51:09FromGitter<mratsim> there is a forum thread about it
18:51:35FromGitter<mratsim> you can use x.high instead
18:54:10*obadz quit (Quit: WeeChat 1.9.1)
19:02:33*derlafff quit (Remote host closed the connection)
19:02:49*derlafff joined #nim
19:02:58*natrys joined #nim
19:16:56*Arrrr quit (Ping timeout: 252 seconds)
19:21:14Araqwell "too many", it was 2 in 10 years or something
19:21:31Araqbut *shrug* the customer is always right ... or something like that
19:22:21Araqtreeform, I don't like it, use data["count"] = %12 instead
19:24:28Araqso ... my DFA pass is starting to work :-)
19:31:27*Leeky_ joined #nim
19:36:04Leeky_hello, here to ask a question about js output: is there a (not emiting code) way of checking if a value (or function) is undefined?
19:36:31*yglukhov joined #nim
19:37:22Araqproc isundef[T](x: T): bool {.importcpp: "(# === undefined)".}
19:37:53Araqor whatever JS's syntax is for that, it's not a Nim concept, I never needed it
19:41:00Leeky_thank you very much! my question was more a "is there a already existent function in a default package/import" but I guess that solved it in an ideal way
19:42:10dom96A more elegant way might be to wrap `undefined` somehow
19:44:47Leeky_hmm.. can I somehow unquote a string within the importcpp? something like isundef("obj.value")
19:45:15Leeky_ah nvm wouldn't work for nim variables I guess
19:54:56*jjido joined #nim
19:56:48Leeky_proc isundef[T](x: T,s: cstring): bool {.importcpp: "#[@] === undefined".} worked for me
19:56:54Leeky_thank you very much everyone! :D
19:59:19FromGitter<cooldome> Hi Araq, I have a question regarding https://github.com/nim-lang/Nim/pull/6954. Do you think it makes sense to skip calls to no return functions as wekk? It is not a problem to check for call kinds and symbols sfNoReturn flag, but it bothers that compiler does not enforce noreturn on procs declared noreturn
20:00:12Araqit's a good idea anyway, I think
20:00:24FromGitter<cooldome> ok, will do
20:00:27Araqone can always add noReturn for important stdlib things
20:02:02*claudiuinberlin joined #nim
20:02:29*Vladar quit (Quit: Leaving)
20:03:16*solitudesf joined #nim
20:07:03*couven92 quit (Quit: Disconnecting)
20:17:51*yglukhov quit (Remote host closed the connection)
20:18:23*yglukhov joined #nim
20:19:21*yglukhov quit (Remote host closed the connection)
20:19:33*yglukhov joined #nim
20:19:40*nsf joined #nim
20:21:20FromGitter<alehander42> yeah `isUndefined` and `isDefined` are useful for js code sometimes
20:23:16FromGitter<RedBeard0531> re noreturn: yes please! I often use `quit "some message"` in similar cases
20:23:55*yglukhov quit (Read error: Connection reset by peer)
20:24:31*yglukhov joined #nim
20:33:15GitDisc<NopeDK> No matter what I do, all my importc structs with fields that are pointers, are "nil". Minimal code: https://pastebin.com/wb2MQCL3 . Anyone knows what might be happening?
20:36:18GitDisc<NopeDK> The code is compiled as a shared library import by uwsgi at runtime.
20:39:46Leeky_Next question: How do I escape the $ in this statement? . importcpp: "$(#)[0]" .
20:40:33GitDisc<NopeDK> It is like accessing "uwsgi" accesses a new variable instead of the extern one though the resulting c code does indeed show it as "extern struct uwsgi_server uwsgi". All fields are essentially nil or 0.
20:45:36*BitPuffin|osx quit (Ping timeout: 272 seconds)
20:48:25Leeky_ah ok so escaping $ works with $$, is there a documentation for that?
20:50:40GitDisc<NopeDK> Not documented under the "importcpp" pragma but it is documented under the "importc" pragma: https://nim-lang.org/docs/manual.html#foreign-function-interface-importc-pragma
20:52:29Leeky_thank you!
20:53:40*vlad1777d_ joined #nim
21:14:48*Yardanico quit (Read error: Connection reset by peer)
21:16:01*nsf quit (Quit: WeeChat 1.9.1)
21:35:31*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:36:04FromGitter<RedBeard0531> Is there a helper to convert from a uint32 bitfield to set[FlagEnum] or vice-versa?
21:39:52*yglukhov quit (Read error: Connection reset by peer)
21:40:24*yglukhov joined #nim
21:47:06FromGitter<RedBeard0531> Is there a better way to embed newlines in a fmt-string: `echo fmt"""Host: {msg.hostId}{"\n"}{msg.msg}{"\n"}"""`
21:58:44FromGitter<Yardanico> I don't think so
21:58:59FromGitter<Yardanico> It's the same in Python :)
21:59:19Araqfmt("Host: {msg.hostId}\n")
21:59:40Araqnothing special about 'fmt' just learn Nim's string literals, there are three of them
21:59:51Araq"ordinary with \hookers"
21:59:59FromGitter<Yardanico> Ah I didn't see his triple quotes
22:00:02Araqr"raw string"
22:00:17Araq(that extends to identifier"raw string")
22:00:26Araqand """triple quoted strings"""
22:01:29Araq"""{"\n"}""" is cute though, never thought of it
22:02:05FromGitter<RedBeard0531> I added triple quotes to make it easy to embed the " since '\n' isn't valid. While I knew it in the back of my head, I somehow forgot that fmt("blah\n") was valid
22:04:35FromGitter<Varriount> Araq: What state machine?
22:06:32AraqI mean "data flow analysis" not "deterministic finite automaton"
22:07:56GitDisc<treeform> I was looking at your data flow analysis patch. I want to learn more.
22:13:32FromGitter<RedBeard0531> How would you feel about making fmt parse escape sequences in the "string" parts (not in the {expr} parts obviously) and having rawfmt"..." or fmtr"..." for the cases where you don't want expansion? Then the mental model is that `fmt"a {b} c"` === `"a " & format(b) & " c` and `fmtr"a {b} c"` === `r"a " & format(b) & r" c"`
22:16:47FromGitter<RedBeard0531> In fact, I just reread the docs and the example implies that the former is how it works since it doesn't put the r prefix on the transformed strings
22:17:49Araqhuh? what do you mean? the last thing we need is another syntax for string literals
22:18:23Araqtreeform, what do you want to know? I'm still tinkering with these algorithms myself
22:19:57GitDisc<treeform> It looks like it only used to find non initialized vars and initialize them?
22:20:14GitDisc<treeform> Past algo used graphs and phi but this is a linear apprach?
22:20:26GitDisc<treeform> https://github.com/nim-lang/Nim/blob/c2d91771bc1593fc8432392a75223dc1106bcfa3/compiler/dfa.nim#L296
22:20:50GitDisc<treeform> ^ it does not look like there is enough case of statements to do the whole language, but it looks like its enough?
22:21:20GitDisc<treeform> https://github.com/nim-lang/Nim/blob/c2d91771bc1593fc8432392a75223dc1106bcfa3/compiler/dfa.nim#L37
22:21:45FromGitter<RedBeard0531> It wouldn't be a separate syntax. The docs say: an expression like `fmt"{key} is {value:arg} {{z}}"` is transformed into ... `format(" is ", temp)` ...
22:22:06GitDisc<treeform> ^ i have never seen this case of in a type object declaration before... is there only 7 nodes types in your dfa array?
22:23:00GitDisc<treeform> Does that make like a C union?
22:23:49FromGitter<RedBeard0531> I'm proposing that `fmt"a\nb"` is transformed to `format("a\nb", temp)` where the '\n' would be interpreted. You could use an almost identical fmtr macro if you want it to generate `format(r"a\nb")`
22:24:48AraqRedBeard0531 but then the fmt macro would interpret \, currently it is only concerned with {}
22:25:01Araqtreeform: well it's a "case object"
22:25:14FromGitter<RedBeard0531> That is how the python f-strings that strformat is based on works: https://www.python.org/dev/peps/pep-0498/#raw-f-strings
22:25:26Araqit is implemented as a union but that's more an implementation detail
22:26:45AraqRedBeard0531, how about we add const nl* = "\n" to strformat, then you can write "{nl}"
22:27:36GitDisc<treeform> Never seen case objects before. Thats pretty cool.
22:27:37Araqtreeform, I doubt I got the semantics of exceptions right but the pass deals with full Nim, not with a subset
22:27:57FromGitter<RedBeard0531> Couldn't that be done by having fmt emit nnkStrLit and fmtr emit nnkRStrLit? I assume that they would both be thin wrappers around a common impl that just takes a param for which lit type to use.
22:29:00GitDisc<NopeDK> After adding another cross compilation option to the nim.cfg and trying to use it with the --cpu and --os I get errors with "unknown os" and "unknown cpu". What am I doing wrong? Added two lines, "arm.raspbian.gcc.exe = " and "arm.raspbiab.gcc.linkerexe = ".
22:29:12Araqthe IR only captures the important aspects though, that's why I only have 5 different instructions
22:29:29Araq'raspbian' is not an OS Nim knows about
22:29:34FromGitter<RedBeard0531> If you do that, you'd need to do that for all the escapes which seems annoying. Especially if they have slightly different names like \n vs nl
22:29:57dom96Regarding raw string literals, IMO we should change it to the same way that Python handles it.
22:29:57AraqRedBeard0531, meh ok, go for it
22:30:11GitDisc<treeform> neat. So it transforms everything its a simple 5 instruction code, that only interested in finding uninitalized state.
22:30:13GitDisc<NopeDK> How would you add a custom cross compilation target then? The example I found just required adding the two lines to Nim.cfg.
22:30:17dom96The current rule of `blahblah"this is a raw string"` literal captures too much
22:30:24GitDisc<treeform> Araq, can you do go style escape analysis with it too?
22:30:35*solitudesf quit (Ping timeout: 240 seconds)
22:30:37GitDisc<treeform> for memory management?
22:31:02Araqtreeform, no. :-)
22:31:14Araqfor that we need more or different instructions
22:31:30dom96fmt"" shouldn't be a raw string literal
22:31:39*yglukhov quit (Read error: Connection reset by peer)
22:32:03Araqdom96: Redbeard0531 already found a solution that doesn't butcher the language
22:32:11*yglukhov joined #nim
22:32:23dom96what's the solution? using fmt()?
22:33:08Araqfmtr vs fmt
22:35:39dom96Isn't that a bit ... inconsistent? :P
22:36:53GitDisc<treeform> Araq, after playing around the the SQL parser, I wrote my own parser for thirft at work: https://gist.github.com/treeform/15b34df51794e0dd8f57d286f1b369bb I wanted to have good error messages so I cart file name and line number and offset with every token. Is there a better way to do it? It makes my tokens huge! Then when I create nodes out of tokens i copy that info which makes nodes huge... How <message clipped>
22:37:08GitDisc<treeform> .thrift*
22:37:12Araqyou just suggested to hack another special rule into the lexer
22:37:36Araqand then you dare using the word "consistency"
22:38:50GitDisc<treeform> I tried to base my parser on how the SQL parser works, loop and create tokens, loop again and create nodes, then profit!
22:39:08dom96yeah, meh. Never mind what I'm saying.
22:39:19dom96if it's inconsistent people will complain
22:39:45dom96"Message clipped"
22:39:53dom96The discord bridge needs improvement
22:40:09GitDisc<treeform> which message?
22:40:30dom96https://irclogs.nim-lang.org/21-12-2017.html#22:36:53
22:40:57GitDisc<treeform> ... would you do it?
22:41:12GitDisc<treeform>
22:41:13GitDisc<treeform> https://cdn.discordapp.com/attachments/371759389889003532/393533393360650261/image.png
22:42:21Araqtreeform: in the compiler I use line, col: int16; fileIndex: int32 to cut the size
22:43:25FromGitter<RedBeard0531> but what if the line is more than 32k bytes ;)
22:43:40GitDisc<treeform> fileIndex indexes into a file array? But its still the same idea?
22:44:01GitDisc<treeform> I was thinking of there is some way not to store that info, like you inferring the line numbers by iterating the tokens or some thing?
22:44:16GitDisc<treeform> You only need line numbers if there is an error...
22:45:14GitDisc<treeform> but it only works if you use pointers to tokens or some thing
22:45:33*natrys quit (Quit: natrys)
22:46:05Araqyou don't want to be clever in your line information handling, trust me
22:46:25GitDisc<treeform> ok ill trust you! Creating a file name array is a good idea. I will use that.
22:46:35FromGitter<alehander42> a.k.a. you dont want errors in the way you show errors
22:47:01Araqmy way is "Only" 64 bits, it's acceptable
22:47:19GitDisc<treeform> do you need to use packed pragma for that?
22:47:23Araqno
22:48:04GitDisc<treeform> I remember (but not very well) C compilers are really bad at packing things, and will blow your 16 bit numbers to full 32 bits, nim handles that?
22:48:33Araqcompilers use "natural" alignment an 16bit type is aligned at a 2 byte boundary, etc
22:49:00AraqC compilers are ok at packing things it's just that C programmers are bad at programming
22:49:49GitDisc<treeform> another thrift question, so normally thrift generate code that you then include, but in nim case it should be all macros right?
22:50:24GitDisc<treeform> you should not need to generate thrift bindings? or do you think it still should be done thrift way?
22:50:43Araqright. carefully crafted macros keep the input line information, ordinary code generation doesn't
22:50:54GitDisc<NopeDK> Finally... Found the reason why nothing was working for me... Too much abstraction hid multiple flags necessary for proper interfacing. Had to slightly modify the helper program to output the needed info... (zacharycarter)
22:51:12*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
22:52:27*Trustable quit (Remote host closed the connection)
22:53:33*MJCaley joined #nim
22:54:02GitDisc<treeform> Araq, do you recommend copying the file, line and offset into to the nodes as well?
22:54:20Araqyes
22:54:42GitDisc<treeform> One other though I had is to keep the tokens inside nodes, but that seemed harder.
22:54:47Araqyou can be a bit more clever and use your Node type for Token too
22:55:04GitDisc<treeform> Would you recommend doing that?
22:55:28Araqnever tried it but it should be fine if your lexer allocates a new node for every token
22:55:45Araqor at least for every token that will end up in the AST
22:56:22GitDisc<treeform> I have tokens as non-ref objects, means they are copied all the time.
22:56:38GitDisc<treeform> But I could not do Nodes are non-ref objects because they can contain each other?
22:56:47GitDisc<treeform> Is that the right way to do this or I am missing some thing?
22:57:13Araqactually you can have Node = object kids: seq[Node] since the 'seq' uses a hidden pointer for you
22:57:45Araqbut then you need to be careful to move objects via shallowCopy to get good performance
22:57:58GitDisc<treeform> hmm would that be better?
22:57:59Araqsomething which you already seem bad at :P
22:58:14GitDisc<treeform> how would I get better at this?
22:59:54GitDisc<treeform> Can I tell the compiler to only allow shallowCopy? Then use some sort of copy keyword to get around it? So that I know what is going on?
23:00:32GitDisc<treeform> The pointer inside seq[Node] is not ref counting right? Because seq copy there is no need to ref count it?
23:00:43GitDisc<treeform> Its a ptr not a ref?
23:01:54dom96Be careful, things become dangerous when using shallowCopy/ptr
23:02:10GitDisc<treeform> in what way? how?
23:02:52Araqyou can do that via {.shallow.} ...
23:03:01AraqPegs uses it
23:03:07dom96You are then managing memory yourself.
23:03:39Araqoriginally I used it for my ASTs but it became cumbersome
23:03:50GitDisc<treeform> Oh and Pegs is another one of these case objects neat
23:04:09GitDisc<treeform> Araq, do you use ref Nodes now?
23:04:25Araqin the compiler they are everywhere
23:05:00Araqnowadays I would probably try and not use an AST at all...
23:05:15GitDisc<treeform> Really? How would you do it now?
23:05:39Araqas a seq of abstract tokens
23:05:48Araqbut I have never done that before :P
23:06:10Araqwell I would lay an API on top of it
23:06:14Araqemulating a tree
23:06:19Araqbut stored sequentially
23:06:23GitDisc<treeform> So back to your packed JSON idea?
23:06:29GitDisc<treeform> but packed AST instead?
23:06:40Araqyes, wow you remember
23:07:44GitDisc<treeform> At pushbullet we had our own datatype, called string-only json where only [] {} and "" was allowed.
23:07:56Araqbut for SQL'ish things it would be overkill, how big do you think the programs are?
23:08:15GitDisc<treeform> I was thinking maybe writing a json like parser for this subset of json.
23:09:11GitDisc<treeform> You are right, parsing for any language like SQL or Thrift it does not matter. Its so fast and so small anyways.
23:09:39GitDisc<treeform> The only place you need high performance parsing is JSON or XML. Because those files can be terabytes.
23:09:45AraqI would start with 'case ref object's and then try to remove the 'ref' and add .shallow if you need more speed (though it could easily be slower too)
23:10:14Araqand only after that I would attempt my "packed" trees.
23:10:33GitDisc<treeform> Interesting.
23:11:10GitDisc<treeform> Right now the slower parts in nim compilation are the C compilers and the C linker right?
23:11:34Araqbut note that the versions without 'ref' have the big benefit that you get trees by construction
23:11:50Araqthere is no way they turn into cyclic monsters accidentically
23:12:46GitDisc<treeform> yeah I can return ref's objects, and they are quick to return. If I used shallow, then they would copy the whole tree right?
23:12:54GitDisc<treeform> All the seqs inside?
23:13:04Araqwell no, it would be a shallow copy
23:13:25GitDisc<treeform> Yeah sorry I think I had that confused.
23:13:38GitDisc<treeform> shallow copy shares ptr's in in the seq?
23:13:50Araqyes
23:14:12GitDisc<treeform> So if you are not careful you can end up with two shallow copies and do a free, then double free etc...
23:14:30Araqyou don't free them, they are still GC'ed
23:15:08GitDisc<NopeDK> There is a note on the Compiler's docs that compiling as a shared library requires you to use "-d:useNimRTL", is that still the case? What happens if you don't use the RTL?
23:15:36Araqin Nim v2 shallowCopy will be *move* and eliminate the harmful aliasing
23:15:47GitDisc<treeform> I think I need to go play with shallowCopy a bit more.
23:15:51GitDisc<treeform> To get it.
23:16:40AraqNopeDK: still the case. it is required so that every Nim DLL shares the nim GC wich resides in nimrtl.dll
23:16:56Araqif you only have one DLL you can avoid it
23:17:19Araqbut that's not tested properly so there be dragons
23:18:17Araqtreeform: usually Nim compilation speed is the bottleneck for me
23:18:52AraqC results are cached and incrementally updated
23:19:02GitDisc<treeform> Do you use a debugger to step through the code or print statements?
23:19:28GitDisc<treeform> If so which one? gdb?
23:20:07GitDisc<NopeDK> And if I go hunting dragons, does the GC survive forks? Basically one master program loading the dll then summons multiple workers based on the dll.
23:20:50GitDisc<treeform> Do people still use the old BSD fork mechanism? I though everyone did some thing else now?
23:23:17GitDisc<NopeDK> It might be doing something else but the quality of the documentation is severely lacking so I am learning by crash and burn until success.
23:26:14FromGitter<RedBeard0531> @Araq: Microsoft tried the "we don't need an AST, a stream of tokens is enough for anybody!" approach and the result was MSVC++. You don't want nim to become MSVC++ do you?
23:27:10Araqtreefrom; I don't write code lines that are not covered so my code "works" unless it doesn't and then I need an 'if cond: debug(x)'
23:27:39Araqand debuggers are very bad at conditional breakpoints IME so I don't miss them
23:29:24GitDisc<treeform> what does debug(x) do? Is there a doc for that?
23:30:01GitDisc<treeform> so you use test coverage mostly?
23:32:01Araqno, I write code that is executed thousands of times since there is system.nim and the hole stdlib I can import in my test program :P
23:32:39Araqdebug(x) is compiler specific
23:33:24AraqNopeDK: I think everything works with 'fork' except OSX's Cocoa
23:36:31GitDisc<NopeDK> Awesome, thanks Araq
23:37:13Miguelngel[m]is readAll suitable to read a whole binary file and then transform the string to a seq of bytes or similar, or is there is something that might be wrong due passing through a string?
23:37:50Araqtreeform: People love 'fork' and memory overcommitment, reliability is for whiners
23:39:27AraqMiguelngel[m]: it's fine when you never make me read your code
23:43:30Miguelngel[m]That's a really good point then. One of the things that surprised me is that I found a lot of procs in the standard library implemented for strings that it would also make sense to me for binary streams. For example the base64 module, and the "readAll", "readFile", etc. I was thinking if the lack of seq[u8] or similar versions was because string was meant to handle binary data or some other thing.
23:44:43Araqhey, string handles binary data just fine and most protocols are ascii/utf-8/byte hybrids
23:45:16Araqor underspecified (what's an environment var, utf-8?)
23:46:56*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
23:54:13*MJCaley quit (Quit: MJCaley)