<< 25-04-2019 >>

00:16:46*gangstacat joined #nim
01:05:02*beatmox quit (Ping timeout: 268 seconds)
01:05:39*beatmox joined #nim
01:18:36FromGitter<arnetheduck> switch to https://github.com/arnetheduck/nim-result and you wont need any of that crap :)
01:32:08*rnrwashere joined #nim
01:32:11*rnrwashere quit (Remote host closed the connection)
01:33:14*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
02:08:12*banc quit (Quit: Bye)
02:14:06*[rg] joined #nim
02:17:32*dddddd quit (Remote host closed the connection)
02:29:01*banc joined #nim
02:32:28*cyraxjoe joined #nim
02:48:20*rockcavera joined #nim
03:26:03*rnrwashere joined #nim
03:32:16*rnrwashere quit (Remote host closed the connection)
03:51:53*rnrwashere joined #nim
03:56:59*leorize joined #nim
04:03:02*rnrwashere quit (Remote host closed the connection)
04:11:48*rnrwashere joined #nim
04:36:51*nsf joined #nim
05:04:00*rnrwashere quit (Remote host closed the connection)
05:20:20*narimiran joined #nim
05:24:35*leorize quit (Quit: WeeChat 2.3)
05:47:06*solitudesf- joined #nim
05:52:33*leorize joined #nim
06:02:04*[rg] quit (Quit: Leaving)
06:03:41FromGitter<kayabaNerve> Exceptions are zero cost, and that doesn't tell me by the proc def the absolute list of what the function can raise.
06:04:42Araqhint: it doesn't fucking matter.
06:04:59Araqyes it can raise any kind of exception. you handle it. the end.
06:05:11FromGitter<mratsim> what? exceptions are zero cost?
06:06:31Araqthey are "negative cost" compared to excessive ifs
06:06:51Araqthey have non-zero cost compared to 'on error abort'
06:07:05Araq(assuming 'nim cpp')
06:07:17Araqmany many people do not understand this...
06:08:38*krux02 joined #nim
06:12:53FromGitter<alehander42> well if you can't differentiate between exceptions in your effect system, there is not much point in using anything which is not Exception
06:13:04FromGitter<alehander42> (maybe i am reading the discussion wrong)
06:13:21FromGitter<alehander42> otherwise i agree, exceptions are becoming underrated these days
06:16:25FromGitter<kayabaNerve> @mratsim Nim exceptions, when using the C++ backend, are C++ exceptions, and C++ exceptions are zero cost.
06:16:37FromGitter<kayabaNerve> Sorry, I always use C++. I forgot C is default.
06:16:48FromGitter<mratsim> I'm curious how C++ exceptions are implemented in assembly
06:19:04FromGitter<kayabaNerve> Exceptions are very useful, and forcing myself to handle them has me write cleaner code which is less likely to be disrupted. I force myself because I suck at error handling when it's not forced.
06:19:29FromGitter<kayabaNerve> The raises pragma cleanly identifies what errors I need to handle. Nim-Result doesn't have that feature.
06:20:27FromGitter<kayabaNerve> I've never had a case where I can't differentiate exceptions. Just a case where I'm forced to include Exception, and since Exceptions are hierarchical...
06:26:06FromGitter<kayabaNerve> As a quick question, what are the odds of `await asyncProc()` throwing Exception, assuming the proc itself doesn't throw anything pre-async macro?
06:26:30FromGitter<kayabaNerve> I'm guessing it's only even possible if someone steps into the async inner workings but wanted to check
06:43:22*PMunch joined #nim
06:48:31FromGitter<gogolxdong> How to parse `"["a","b"]"` to array or seq?
06:49:37*solitudesf- quit (Ping timeout: 245 seconds)
06:49:40FromGitter<gogolxdong> assuming it's a varchar stored in mysql as ["a","b"]
06:50:54leorizeI'd say it's not trivial
06:51:18leorizeshouldn't you use a table for that?
06:51:25Zevvdo you care about properly handling quotes in your string?
06:53:07Zevvif no, http://paste.debian.net/plain/1079244
06:53:10Zevvif yes, let me know :)
06:55:31FromGitter<gogolxdong> asked this before, like parseStmt or something to parse the symbol to array or seq directly.
06:56:09*leorize quit (Ping timeout: 256 seconds)
06:56:22ZevvI assume you want to do this at run time, not at compile time, right?
06:56:51FromGitter<gogolxdong> sure
06:57:37*leorize joined #nim
06:59:18ZevvI guess there's no Nim there to interpret Nim code for you, so you'd have to parse it yourself
06:59:47Zevvsee the above paste for one possible solution
07:00:00*gmpreussner quit (Quit: kthxbye)
07:01:36Zevvhttp://p.zevv.nl/?92ff also handles \\ and \"
07:04:51*gmpreussner joined #nim
07:06:42ZevvCould you not parse as json?
07:06:46Zevvwould be more robust
07:07:17Zevvhttp://p.zevv.nl/?0559: much simpler
07:15:35FromGitter<gogolxdong> json is a good approach.
07:18:54FromGitter<alehander42> hmm i love how easy is to work with nim parser runtime
07:19:08FromGitter<alehander42> it's basically almost the same as macros, but you use PNode instead Node
07:21:22Araqalehander42: my point is mostly that exceptions are not understood by many and most arguments against them are terrible.
07:21:31narimiran@alehander42 https://github.com/nim-lang/Nim/pull/11094 is ready for some testing if you want....
07:21:57FromGitter<mratsim> rawGetKnownHCImpl :?
07:22:00FromGitter<alehander42> parsing nim on runtime might be an overkill tho, have to benchmark
07:22:39leorizeafaik the only way to have multi-line statement in Nim is to use a trailing binary operator right?
07:22:45FromGitter<alehander42> ah Araq yeah kinda, still i'd argue it's subjective, one can always prefer a more explicit style of error handling, nothing wrong with that
07:23:03leorizeI'm gonna look into implementing NEP1 and some context awareness for nim.nvim's indent script
07:23:08FromGitter<mratsim> any operator works @leorize
07:23:19Araqas does ';', leorize
07:23:21*jjido joined #nim
07:23:26FromGitter<alehander42> narimiran, thanks, i'll try to rebase languist on this branch on my next succesful build
07:23:52narimiran@mratsim "rawGetKnownHCImpl" was there before, 98% of the diff is just moving some code around
07:24:48Araqalehander42: there is plenty of "wrong" with that, it's so bad that nobody seriously does it and languages weasel out.
07:25:44Araqany time Go's + does an integer wrap around "for you" it's because of language design hubris.
07:25:48*xet7 joined #nim
07:26:35Araqif Option[T] would be the answer why does Rust's '+' not produce one?
07:26:38FromGitter<alehander42> well i mean more like Result-based stuff (most fun langs, rust etc)
07:26:47FromGitter<alehander42> well what does rust do for overflows
07:27:05Araqit dies in debug mode, it wraps around in release mode
07:28:00FromGitter<alehander42> is there an option to disable wrapping around in release?
07:28:17Araqprobably but here is the problem:
07:28:46FromGitter<alehander42> well, "test in debug mode, do one of those other things in release" rings a bell to me ..
07:28:47FromGitter<alehander42> :D
07:28:51Araqif your code does do(); stuff(); undo() because either the language "has no exceptions" or 'stuff cannot raise'
07:29:07Araqthen stuff can still die and your code is still wrong
07:29:29Araqnot to mention that later on 'stuff' could start to raise/die
07:29:31FromGitter<mratsim> integer wraps around because of x86 :p
07:29:38FromGitter<alehander42> how can stuff `die` ?
07:29:40jjidoAre you talking about exceptions for arithmetic operations?
07:29:50FromGitter<alehander42> if it's statically proved that it should not
07:30:12Araqreally? you prove every integer operation to never overflow?
07:30:24Araqnot even Ada can do that.
07:30:38FromGitter<alehander42> overflowing is not dying
07:30:54FromGitter<alehander42> and this approach sounds exactly like the nim owned ref approach
07:30:57Araqit is in Rust
07:31:02jjidoI am working on a language where the solution is to error out if there is an error handler, or just return (wrong) result otherwise
07:31:05Zevvunless it's in your morphine pump
07:31:34Araqwhen you don't die on overflow it's even worse...
07:31:49Araqwhen you don't die/raise on overflow it's even worse...
07:32:00FromGitter<alehander42> that's why you test
07:32:17FromGitter<alehander42> i can say the same about memory segfaults/corruption and owned refs
07:32:36Araqyes you can do that but
07:32:48Araq(a) I never claimed it's THE solution for everything
07:33:02FromGitter<alehander42> and integer overflow doesn't just happen all the time, you can't say "X error handling" doesnt make sense because it doesnt work perfectly for one edge case
07:33:12Araq(b) owned refs are easier to test extensively. Integer arithmetic is harder.
07:33:46FromGitter<alehander42> you can fuzz the shit out of it i guess
07:34:12FromGitter<alehander42> or even quickcheck-test your important functions/entrypoints
07:34:17Araqok, so you fuzz it and
07:34:33Araqtada. the result is that "yeah, really it can overflow, surprise"
07:34:39Araqwhat do you do?
07:34:54FromGitter<mratsim> Sacrifice a lamb to the Nim gods
07:34:59FromGitter<alehander42> no
07:35:02FromGitter<alehander42> you debug
07:35:20FromGitter<alehander42> i mean, what do you do when you find out you have a memory corruption problem
07:35:37FromGitter<alehander42> you reproduce and you decide on a fix
07:36:10Araqthere is no fix. You die with an error message.
07:36:18Araqlike you do for out-of-memory.
07:36:29Araqand then your undo() is not called.
07:36:41jjidoChange the variable type?
07:37:29leorizeAraq: does the "error when rc count > 0" of newruntime works?
07:37:58Araqleorize, it's implemented and sometimes triggers. I'm testing it for more complex examples
07:39:13FromGitter<alehander42> well maybe the overflow is unintended
07:39:26FromGitter<alehander42> but yeah, that's the point: you can decide what to do in this situation
07:39:40FromGitter<alehander42> ok added miran as remote
07:39:49FromGitter<alehander42> that would be easier for me to test other branches
07:39:58FromGitter<alehander42> not really sure if that's how people test pr-slocally
07:40:20Araqalehander42: well without exceptions you "can't decide what to do" as the language decided for you, the program dies
07:40:38PMunchHmm, why doesn't this work? http://ix.io/1H9J/Nim seems like overloading the macro confuses things..
07:41:11FromGitter<alehander42> but isn't the point that with exceptions you can't find out when it can overflow statically
07:41:12FromGitter<alehander42> anyway
07:41:16FromGitter<alehander42> so you still need to test it
07:41:29FromGitter<alehander42> and in other langs if you decide you want to do something else
07:41:42FromGitter<alehander42> you can e.g. use different operators/functions
07:41:46FromGitter<alehander42> custom*
07:41:54FromGitter<alehander42> other error handling systems*
07:41:56Araqno the point is you *must* wrap your 'undo' in a 'finally' or maybe an 'atexit' handler
07:42:08Araqand you cannot blame exceptions for this need.
07:42:45FromGitter<alehander42> ah
07:42:49Araqthe point is that not having exceptions does not make the problems disappear, they are only even more cumbersome to solve
07:43:41FromGitter<alehander42> well, i have to think about the overflowing problem
07:45:17Araqoverflow is much more like out-of-memory, you have too few bits available
07:45:38Araqit's not a "bug" like a dangling pointer
07:45:45Araqor an array index out of bounds
07:49:50leorizeAraq: `discard new RootObj` SIGSEGV on newruntime
07:49:59leorizeon the latest commit rn
07:52:08FromGitter<alehander42> sometimes it's a bug: sometimes it just shows you don't process your data correctly and unusually big / small numbers appear somewhere
07:52:20FromGitter<alehander42> narimiran, it seems to work for me , your branch
07:52:33narimirannice to hear, thanks for testing it!
07:52:33FromGitter<alehander42> the weird thing is my older nim seems to also not need initTable in some cases
07:52:38leorizeAraq: the following didn't crash on newruntime, is that a bug? http://ix.io/1H9M/nim
07:52:42FromGitter<alehander42> not very sure if i am not doing something wrong
07:54:17FromGitter<alehander42> anyway i stop using initTable for now, awesome, just need to do the same with JsAssoc if it seems possible
07:55:26Araqleorize, not sure yet
07:56:07leorizeif I add `discard r`, it will crash, but `echo r[]` wouldn't
07:57:13Araqwell the 'discard new RootObj' surely is a bug
07:57:22Araqwhy would it fail?
07:57:53leorizesystem.nim(1637) new
07:58:00Araqalso the ref testing doesn't produce a SIGSEGV but a decent error message
07:58:29leorizeI'm on Linux if that makes any difference
07:58:54livcdPMunch: did you already make your web+file whatever that was?
08:05:01*floppydh joined #nim
08:07:47PMunchlivcd, web+file?
08:08:47livcdPMunch: you did some frontend with file processing for some payments file did not you?
08:10:08PMunchOh right, yes that's done
08:10:32PMunchBut I just went with using Jester and made the site with Javascript, didn't create the little framework I was talking about
08:17:24PMunchHmm, reordering the two macros seems to work..
08:17:27PMunchIs that a bug?
08:17:38Araqprobably :-)
08:18:02*slugm joined #nim
08:18:48PMunchHmm, so depending on the order it will match one or the other. While the other creates an error
08:33:33*floppydh quit (Quit: WeeChat 2.4)
08:33:43*floppydh joined #nim
08:34:13*floppydh quit (Client Quit)
08:34:40*floppydh joined #nim
08:35:52*floppydh quit (Client Quit)
08:36:06*floppydh joined #nim
08:36:22*floppydh quit (Client Quit)
08:36:34*floppydh joined #nim
08:36:44*Vladar joined #nim
08:44:50*Minimisthupper joined #nim
08:48:33*slugm quit (Remote host closed the connection)
08:56:07*Minimisthupper97 joined #nim
08:57:05*Minimisthupper97 quit (Remote host closed the connection)
09:03:49*iLiquid joined #nim
09:07:57*dddddd joined #nim
09:16:37*i7sDream joined #nim
09:26:17couven92@shashlick, you looked for me yesterday?
09:26:18*jasper__ quit (Remote host closed the connection)
09:32:13PMunchYes, I told him that you might've tried to compile nimble for Android
09:32:32PMunchI remember you compiling Nim for Android, so I figured you might've tried that as well
09:32:47*tdc joined #nim
09:35:05PMunchHmm, is there a way to detect if Nim is creating documentation? I want to hide some symbols when that happens
09:35:43leorize`when defined(nimdoc)`
09:36:16*iLiquid_ joined #nim
09:36:17*iLiquid quit (Read error: Connection reset by peer)
09:36:30*iLiquid_ is now known as iLiquid
09:41:47couven92PMunch, huh... yeah, I remember there being some issues with nimble on android, which is basically why I troduced the android architecture to nim...
09:42:04couven92But I do also remember that I got it working in the end... Hmmm
09:50:00*pwntus joined #nim
09:50:00*pwntus quit (Changing host)
09:50:00*pwntus joined #nim
09:56:15leorizenew indent feature https://asciinema.org/a/Xe46stggKpPmAPP7yYSrmlxGh for nim.nvim :)
09:57:26leorizeanyone wants a test drive?
09:57:47narimiranof course :)
09:59:03FromGitter<alehander42> oh that's good for aligning field types etc
09:59:34FromGitter<alehander42> i'd love if there was a lint check for it
10:01:04leorizethere are plenty of linter plugins for nvim already, so I didn't add that feature
10:02:43leorizenarimiran: pushed to master :)
10:03:20leorizeI wish vimscript was typed :p I stumble into more type-related bugs while making this than logic bugs
10:04:46leorizea lot of fuzzing and tests would be needed :P
10:04:59leorizeI've only tested this on short sources
10:07:47*i7sDream quit (Ping timeout: 246 seconds)
10:12:13leorizeagh this broke autoindent :/
10:22:39*jjido quit (Quit: Connection closed for inactivity)
10:23:59PMunchleorize, thanks :)
10:24:31*leorize quit (Quit: WeeChat 2.3)
10:27:54*avanderneut quit (Remote host closed the connection)
10:29:10*lritter joined #nim
10:36:17*avanderneut joined #nim
10:44:06*seni joined #nim
10:52:14*Minimisthupper quit (Remote host closed the connection)
10:53:55PMunchHmm, is there a way to output just an rst version of the documentation?
10:54:01PMunchFor a specific module
10:54:31*stefanos82 joined #nim
11:04:51*Snircle joined #nim
11:22:12PMunchhttps://github.com/PMunch/explanations
11:22:16PMunchMode a new little module
11:23:14*tdc quit (Remote host closed the connection)
11:23:36*tdc joined #nim
11:31:27*Cthalupa quit (Ping timeout: 258 seconds)
11:31:54*Cthalupa joined #nim
11:32:07FromGitter<alehander42> btw why doesnt table define `contains` <=> hasKey
11:32:11FromGitter<alehander42> so in can work
11:32:27FromGitter<alehander42> currently it's strange because `in` doesnt lead to type error
11:32:36FromGitter<alehander42> but it just doesnt do the same which leads to logical errors which is bad
11:32:47FromGitter<alehander42> so i think it should either be a type error, or be supported
11:34:35FromGitter<alehander42> hm it seems it does the same
11:34:42FromGitter<alehander42> then i shuld stop using hasKey all the time nvm
11:34:52*tdc quit (Remote host closed the connection)
11:35:17*tdc joined #nim
11:36:48FromGitter<alehander42> hmm maybe i found a remaining todo @narimiran
11:38:13*sz0 joined #nim
11:39:05FromGitter<alehander42> https://paste.ofcode.org/BgTeDBcMPSRtrrGSjACE55
11:39:20FromGitter<alehander42> hasKey returns false instead of true for the first one
11:47:01narimiranouch. can you paste that in a comment under PR?
11:49:22FromGitter<alehander42> done
12:07:14livcdwhat the heck
12:07:28livcdI just watched a video about Haxe where they say there is a Nim target in development
12:15:23FromGitter<alehander42> nim is a pretty flexible target language, not surprising
12:15:30FromGitter<alehander42> do you have a link?
12:17:24*neceve joined #nim
12:20:17FromGitter<arnetheduck> @mratsim https://monoinfinito.wordpress.com/series/exception-handling-in-c/ - how exceptions are implemented.. it's pretty good
12:23:49FromGitter<arnetheduck> Araq, rust has https://doc.rust-lang.org/std/primitive.i32.html#method.checked_add if you want the `Option` variant of add
12:24:19FromGitter<arnetheduck> (and wrapped_add, and saturated_add etc)
12:27:40*nc-x joined #nim
12:27:55nc-x@alehander42 https://github.com/RapidFingers/Craxe
12:28:28nc-xIt is not official haxe backend
12:28:42nc-xbut uses haxe macros instead
12:29:22nc-xI don't think anybody is working on a "proper" nim target for haxe
12:29:57*nc-x quit (Client Quit)
12:30:15livcdi do not know if he meant craxe
12:30:17livcdjust a sec
12:30:36livcdhe just mentions it like by the way
12:31:12FromGitter<alehander42> "RapidFingers/ (location Mother Russia)"
12:31:16FromGitter<alehander42> oh mother russia..
12:32:32FromGitter<arnetheduck> > the weird thing is my older nim seems to also not need initTable in some cases ⏎ ⏎ for a while the behavior was that you could add things into the table but not get (it would not find them) if you didn't call initTable..
12:32:52FromGitter<arnetheduck> I think 0.19 might be like this
12:34:10livcdhttps://youtu.be/TbhkHrcslrE?t=2129
12:34:42FromGitter<alehander42> @arnetheduck yeah, that's the bug i experienced as well
12:35:59FromGitter<arnetheduck> and zero-cost exceptions (in c++) have a cost, generally - code bloat, missed optimizations etc. they just don't have a direct cycles-cost on try entry, like setjmp (no need to save jump point for alternative control flow etc)
12:40:12FromGitter<arnetheduck> but regardless of their cost, what an async transformation does is basically catch the exception, stash it away in a variable then retrow in the "handler". that's certainly not zero-cost - the future object is larger, becomes ref / can't be non-ref etc etc..
12:41:21FromGitter<arnetheduck> and that's a cost everyone has to pay, even those that don't need the exceptions
12:48:42narimiran"the behavior was that you could add things into the table but not get (it would not find them)" -- something like that is what happens in my PR
13:01:05narimiran@alehander42 i think i have a fix. let me test it a bit more first....
13:04:38FromGitter<gogolxdong> Production database is attacked by hacker, asking for 0.1bitcoin.
13:37:36*leorize joined #nim
13:46:59*drewr quit (Remote host closed the connection)
13:48:15Zevvthat's a fair price
13:55:22FromDiscord_<Zireael> the examples from documentation aren't quite true when it comes to properties: https://nim-lang.org/docs/manual.html#procedures-properties . I followed it when it came to getting, and it ignored the getter in favor of just getting the variable - I had to rename the function to something else for it to start working
13:58:54leorizethen wouldn't that be a bug?
13:59:39FromDiscord_<Zireael> probably, I was just checking that I hadn't misunderstood something...
13:59:41leorizeZevv: IIRC you're using nim.nvim indent script, right?
14:00:32ZevvI never got to switch to nvim, sorry
14:00:36Zevvtoo many machines
14:00:50leorizewell, but you're using the indent script, right? :p
14:00:53Zevvoh wait, I do use the ident I believe, let me check
14:00:59FromGitter<gogolxdong> Not much ,neither we have. I think He picked the wrong one, exactly the wrong country , bitcoin is sealed in China.
14:01:21Zevvleorize: ack
14:01:47leorizeI've made quite a lot of updates to the script, so please test the latest one :)
14:02:00leorizenow featuring NEP #1 indentation :)
14:02:04Zevvwhat are the changes? I never ran into any issues?
14:02:53leorizehttps://asciinema.org/a/Xe46stggKpPmAPP7yYSrmlxGh
14:03:01leorizemore of a feature update actually :p
14:03:41FromGitter<gogolxdong> Database is always backuped.This trick is out of date.
14:03:42Zevvah that's sweet
14:04:01ZevvTell him he has to send you 0.1 bitcoin or you'll tell his mom
14:04:37FromGitter<gogolxdong> lmao
14:04:47ZevvYesterday I was looking for an exim log to do a performance test, I ran into a open rootfs from a hosting provider. I've been trying to get them to understand they have a security issue for the last 24 hours, but I can't get past first line customer support because I do not have a password
14:04:55ZevvNow I'm cracking the passwords so I can tell my password to support
14:05:14Zevveuh, *their* password
14:05:37Zevvooh look, I just found one. 'test123'
14:07:02FromGitter<gogolxdong> image a world has no password.
14:07:16FromGitter<gogolxdong> imagine
14:08:16FromGitter<gogolxdong> like a house without door
14:10:01Araq> and zero-cost exceptions (in c++) have a cost, generally - code bloat, missed optimizations etc.
14:10:25Araqthat's a cost that you have to compare against excessive if-statements
14:10:33Araqnot against "on error die"
14:10:50Araqobviously "on error die" wins for code size and optimizations
14:11:29Araqand as I said, it can be fine for applications and so -fno-exceptions is widely used.
14:13:14FromGitter<arnetheduck> sure, and that bloat is probably less than explicit error handling - also because you end up ignoring more errors that you didn't know could happen :)
14:15:11Araqthe hard part is library development, you easily end up playing a human compiler passing errors up your callstack because the library user might want to handle it in some form that is not 'die'
14:17:51*i7sDream joined #nim
14:18:37*noonien joined #nim
14:18:50noonienhello
14:18:59noonienhow can i get the highest number of an int type?
14:19:01FromGitter<arnetheduck> yeah. I tend to think that libraries should very rarely die, better offer that choice to the user of the api. but I think the same about exceptions - core libraries can be exception-free and then offer an exception layer on top - it's easy to turn one into the other, but not the other way around.
14:19:23couven92noonien, `high(int)`?
14:19:28noonieni tried high(varName) and high(uint6), both resulting in an ambigous call when compiling
14:19:37FromGitter<arnetheduck> specially core libraries, to maximize their usefulness (at the expense of implementation cost in the library of course, but that's fair that libraries have a higher quality bar)
14:20:57noonien`Error: ambiguous call; both system...(a: uint64, b: uint64)[declared in ../../../../../../nix/store/0ig4fx5vnndrg2qqbr2yfhxcmz3lj7jr-nim-0.19.4/lib/system.nim(2118, 13)] and system...(a: uint32, b: uint32)[declared in ../../../../../../nix/store/0ig4fx5vnndrg2qqbr2yfhxcmz3lj7jr-nim-0.19.4/lib/system.nim(2118, 13)] match for: (int literal(3), uint16)`
14:22:13Araqso get your types right, 3'u16..high(uint16)
14:22:18*i7sDream quit (Ping timeout: 250 seconds)
14:22:55*solitudesf- joined #nim
14:25:29noonienAraq: this is the code that causes the issue: http://vpaste.net/raGDY
14:25:44noonienOH, the for is the issue, not the high()
14:25:57*floppydh quit (Read error: Connection reset by peer)
14:27:14noonienis there a way to cause an error at compile time if a constant condition is met?
14:28:26FromGitter<liquid600pgm> yes, use the `{.error.}` pragma: https://nim-lang.github.io/Nim/manual.html#pragmas-error-pragma
14:30:00noonienthank you!
14:36:37*PMunch quit (Remote host closed the connection)
14:39:35*fanta1 joined #nim
14:49:19*floppydh joined #nim
14:54:35FromGitter<mratsim> high for unsigned? no way :p
15:06:33*flaviu quit (Remote host closed the connection)
15:07:29federico3how can I detect the "main" .nim file in a project to run nim doc --project ... ?
15:11:10WilhelmVonWeinerpublic announcement, please stop abbreviating "string" to "strng" kthxbai
15:12:58*rnrwashere joined #nim
15:13:32xacedoes anyone know if you can use nim with nginx as a cgi?
15:14:15Zevvyou can do CGI with virtually all languages; nginx is the problem here
15:14:23FromGitter<jrfondren> nginx doesn't support cgi as a rule.
15:14:26Zevvas it does not do cgi
15:14:55xaceZevv: i shouldve reformatted the quesiton, is there a existable setup for using nim as a cgi for website related projects?
15:15:09FromGitter<jrfondren> there's a cgi module packaged with nim.
15:15:22xacewell doesn't have to be cgi, just a decent interface would suffice
15:15:43FromGitter<jrfondren> echo "Content-type: text"; echo(); echo "Hello, CGI"
15:15:58xaceoh shit, i didn't expect it to be included
15:16:27xacenvm, ill google it, it seems like someone else thought of this already :)
15:16:42livcdDo you guys think the era of Electron apps will end soon ?
15:17:18xacelivcd: unfortunately not. but that also depends on how long you are willing to stretch your definition of soon ;)
15:17:42FromGitter<jrfondren> the new Google Chat uses electron and it's bad enough to justify total war... but somehow there's no war. Google HQ remains unattacked. This doesn't inspire a lot of hope for the future in me.
15:18:56livcdi guess that means flutter is not ready? or the chat team decided on electron hmm
15:19:03FromGitter<jrfondren> the "I don't care about past activity, stop highlighting these channels" step takes half a minute in Google Chat. seconds+ in response time to clicks. clicks going through UI elements to open URLs.
15:19:19FromGitter<mratsim> Well, the choice is: Electron, QT, GTK+, Imgui/Nuklear, libui, Nigui, ....
15:19:43livcdmratsim: there are proprietary libraries as well
15:19:45*stefanos82 quit (Remote host closed the connection)
15:19:50FromGitter<jrfondren> maybe it's flutter. VS Code isn't anywhere near as bad.
15:19:58FromGitter<mratsim> finding a frontend dev and a designer familiar with HTML/JS/CSS is much easier
15:20:19livcdjrfondren: opening a larger log file in VS Code is terrible
15:20:25livcdlarger like -> 50mb
15:20:31FromGitter<mratsim> you didn't try Atom
15:20:55*rnrwashere quit (Remote host closed the connection)
15:20:56FromGitter<mratsim> Atom freezes for minutes, at least vscode opens them
15:21:38*rnrwashere joined #nim
15:26:23*rnrwashere quit (Remote host closed the connection)
15:26:36livcdI really want to explore sciter seems to always go under the radar
15:27:12FromGitter<mratsim> I have a plan to use the webview that is underneath sciter since a year ago :p
15:27:30FromGitter<mratsim> This one: https://github.com/oskca/webview
15:27:53*Vladar quit (Remote host closed the connection)
15:28:04livcdit looks really capable
15:28:15*Vladar joined #nim
15:28:20*[rg] joined #nim
15:28:20*Vladar quit (Read error: Connection reset by peer)
15:28:43*Vladar joined #nim
15:31:12*Vladar quit (Read error: Connection reset by peer)
15:31:34*Vladar joined #nim
15:31:36livcdmratsim: what are you going to create ?
15:31:59FromGitter<mratsim> https://github.com/numforge/monocle
15:32:33FromGitter<mratsim> transform that proof of concept into a full fledge data-viz and charting library
15:32:39FromGitter<mratsim> fledged*
15:32:56disruptekbetter than vega because...?
15:33:13Zevvmratsim: what's vega?
15:33:18FromGitter<mratsim> it uses vega
15:33:25Zevvh
15:33:41FromGitter<mratsim> http://vega.github.io @Zevv
15:33:54Zevvsweet
15:33:55disruptekso what's the win?
15:33:57FromGitter<mratsim> Vega and Vega-lite are a json format for dataviz
15:34:14FromGitter<mratsim> the win is that it works in Nim and would be integrated with Arraymancer
15:34:34FromGitter<mratsim> i.e. it would be similar to Altair not Vega: https://github.com/altair-viz/altair
15:34:35disruptekjson works in nim?!
15:35:29disruptekwhat's good about altair versus the vega suite?
15:36:00FromGitter<mratsim> Vega/Vega-lite is just grammar a description of what you want to plot
15:36:10FromGitter<mratsim> you have to convert your data into those descriptions
15:36:32disruptekwhen i say vega, i mean the whole ecosystem of vega-consuming viz apps.
15:36:34FromGitter<mratsim> Altair is that converter, it convert arrays into plottable json in the vega/vega-lite grammar
15:36:51FromGitter<mratsim> you can't feed a Numpy array to vega
15:37:41disruptekso the win is that it's not interative like voyager or the other one i can't remmeber...
15:37:47disrupteklyra
15:38:35FromGitter<mratsim> The win is that I can use display the tensors I have
15:39:04disrupteki see, it's just for your arrays.
15:39:18disruptekit's altair-which-eats-arrays, but for nim.
15:39:26FromGitter<mratsim> yes
15:39:32disruptekcool. :-)
15:40:35disrupteki got interested in nim because i needed faster ai for stock trading, but i still haven't messed with arraymancer. it was the first project that drew me into the language, though. looks so promising.
15:41:28FromGitter<mratsim> qqtop is using Nim for trading but it might be only to monitor the ticker on the HK exchange
15:41:33FromGitter<mratsim> tickers*
15:41:49FromGitter<mratsim> and cooldome is using it as well
15:41:54FromDiscord_<Zireael> my 2 cents: Electron is really big and heavy, and I pretty much replaced it with the webview that someone already linked for mratsim
15:42:10disrupteki was working with LEAN and just got disgusted with the python<->c# interop.
15:42:38FromDiscord_<Zireael> I work every day with Python and Python's great until the moment that you need to ship it to consumers/players
15:42:55FromGitter<mratsim> That's Arraymancer readme :p
15:43:38*floppydh quit (Quit: WeeChat 2.4)
15:43:48FromDiscord_<Zireael> at work, Python's just the backend to a web frontend, so it doesn't have that hurdle, but for hobby stuff, well, I don't think there's anything that lets you ship Python apps without hassle
15:43:50disruptekthat's why there are so many make-your-model-in-python-and-then-compile-it-to-a-real-language projects now.
15:44:07*floppydh joined #nim
15:45:01FromDiscord_<Zireael> yep, and that's how I found Nim in the first place - at first I was wading through a sea of transpilers, most of them to or via JS, so I started thinking, why not use something that compiles to JS natively in the first place....?
15:45:01FromGitter<mratsim> The whole scientific community had this issue with Matlab and now Julia as well.
15:45:39FromDiscord_<Zireael> actually at first I was looking at targeting C, but then I thought, I do frontend at work more and more, time to learn, so I went with targeting JS instead
15:46:01FromGitter<Vindaar> @mratsim reg. monocle, you never commented on that PR of mine :P
15:46:13FromGitter<mratsim> I never saw it :p
15:46:19FromGitter<Vindaar> haha
15:46:32*rnrwashere joined #nim
15:46:50disruptekhttps://github.com/BayesWitnesses/m2cgen
15:47:11FromGitter<mratsim> merged @Vindaar
15:47:41disrupteki am targeting IR. i want zero-cost inter-vm interop between janusgraph and other code running under graal.
15:47:58FromGitter<Vindaar> thanks! then I guess the same is true for the loop fusion one: https://github.com/numforge/loop-fusion/pull/8
15:48:27disruptekbeing able to run the same code in my server and on mobile or web is just icing at this point.
15:48:36FromGitter<mratsim> Well, for ML IR if deep learning you have a lot of choice, if classic ML you have nothing :p
15:49:39disruptekit's ai winter for classic, ai summer for nn.
15:51:21FromGitter<mratsim> I've listed all the IRs I came across here: https://github.com/mratsim/Arraymancer/issues/347#issuecomment-459351890 and there is the new Tensorflow MLIR spearheaded by Chris Lattner (original author of LLVM and Swift and headhunted by Google)
15:51:32FromGitter<mratsim> in "related projects"
15:51:46*rnrwashere quit (Ping timeout: 276 seconds)
15:52:38disrupteknice work, thanks for the link.
15:52:58FromGitter<mratsim> I'm writing my own ML compiler ;)
15:57:27FromGitter<mratsim> If you need some stuff for finance feel free to request them btw. I'll probably implement them in Laser with a ptr+len low-level API (https://github.com/numforge/laser) and Arraymancer will be a high level APi on top.
15:57:35disruptekseems like a logical addition to your projects.
15:57:57disruptekwhat's the status of laser at the moment?
15:58:46FromGitter<mratsim> Main issue is that it's completely lacking regression tests, I was hoping to use arraymancer tests for that
15:59:07FromGitter<mratsim> I'm mostly trying to nail down the compiler here: https://github.com/mratsim/compute-graph-optim and what's that done I'll implement it in Laser
15:59:55disruptekwow this gives me some ideas. >:-)
16:00:22FromGitter<mratsim> what works is what is in those examples: https://github.com/numforge/laser/tree/master/examples
16:01:39disrupteki'm probably too inexpert to contribute much to this stuff, but i will try to build something with it, at least.
16:02:16FromGitter<mratsim> At the moment, laser is just low-level SIMD programming
16:02:36FromGitter<mratsim> and high level macros for "forEach" which works quite well
16:04:19FromGitter<mratsim> the JIT is also not too bad and should be easy to expand to new x86 opcodes
16:08:02disruptekit looks like building the compiler into laser might yield real state-of-the-art performance.
16:13:19livcdhmm just realized the sciter author was also behind evernote
16:16:14*rnrwashere joined #nim
16:16:46disruptekthis is really impressive work.
16:20:58FromGitter<mratsim> The compiler is mostly a way to fuse all loops and also autodetect the runtime SIMD architecture only once and not at every sin/cos/log/exp call at first
16:21:40FromGitter<mratsim> Later I might add some Halide like possibilities, mostly for optimizing convolutions but that's a stretch goal.
16:22:20FromGitter<mratsim> The tricky part is handling RNNs because the loop iteration is not known at compile-time but apparently the new MLIR by Google has some ideas for that
16:22:43disruptekseems like you can already fetch that from the pytorch cpuinfo thing. why do you need to check it more than once?
16:23:50FromGitter<mratsim> assume I implement sigmoid = 1/(1 + exp(-x))
16:24:29FromGitter<mratsim> I would need to check the SIMD for divide, add, exp and negate
16:25:22FromGitter<mratsim> or use Nim overloading, but that makes it cumbersome for custom functions(I would need sigmoid for SSE m128, sigmoid for AVX m256)
16:26:06disrupteki get it. so the compiler allows you to put everything into the scope as far as simd capabilities go; never needing to pollute that code with checks, flags, etc.
16:26:13FromGitter<mratsim> yes
16:26:27shashlick@couven92: was trying to run nimble on android, ran into ssl issues
16:26:47*jjido joined #nim
16:26:50FromGitter<mratsim> "forEach" macro already allows easy loop fusion but I couldn't expand it for SIMD beyond SIMD flags available at compile-time
16:27:10disruptekof course.
16:28:08disruptekso why not add more opcodes? no point as long as you cannot optimize them?
16:28:32FromGitter<mratsim> what kind of opcodes are you thinking about?
16:29:25disrupteki dunno. i'd be surprised if there wasn't something that could shave could shave cycles in some scenario or another.
16:29:34disrupteksave some, too.
16:29:56*rnrwashere quit (Remote host closed the connection)
16:30:22*rnrwashere joined #nim
16:30:26FromGitter<mratsim> The basic IR will have add/mul/div and also transcendental functions like sin/cos/exp/log ...
16:31:05disruptekoh, i meant x86_64 codes.
16:31:14FromGitter<mratsim> ah right
16:31:55*rnrwashere quit (Remote host closed the connection)
16:32:14FromGitter<mratsim> the JIT was a proof of concept because several ML backends (Intel MKL-DNN, Intel libxsmm and PyTorch Glow) and papers are jitting convolutions.
16:33:10FromGitter<mratsim> but the compiler will generate either Nim code at compiletime or LLVM bitcode at runtime.
16:33:12*rnrwashere joined #nim
16:33:17leorizeTo users of nim.nvim, I'd need some help in testing an upcoming feature. More details here: https://forum.nim-lang.org/t/4596#30114
16:33:19*rnrwashere quit (Remote host closed the connection)
16:33:26leorizenarimiran: in case you're interested ^
16:33:38disruptekleorize: if i ever enter my editor today, i'll be testing it. ;-)
16:34:09disruptekso if we implement more opcodes, can the graph optimizer optimize them?
16:34:18FromGitter<mratsim> The jit code that Intel is doing is just ugly: https://github.com/intel/mkl-dnn/blob/master/src/cpu/gemm/f32/jit_avx_gemm_f32.cpp
16:34:59disruptekyeah, that's insane.
16:34:59FromGitter<mratsim> so for now it's there but the main use for it will be emitting LLVM bitcode not x86
16:35:13disruptekthat would be awesome.
16:50:45*floppydh quit (Quit: WeeChat 2.4)
17:08:20*Trustable joined #nim
17:18:38*NimBot joined #nim
17:21:57*fanta1 quit (Quit: fanta1)
17:29:23Zevvleorize: indenting makes me happy
17:29:57shashlickDoes indenting belong in a per programming language module or globally
17:30:14Zevvyou mean vim? per language
17:30:50*i7sDream joined #nim
17:31:05shashlickIn general
17:31:24leorizeZevv: I've isolated the latest changes to a separate indentexp branch if you'd like to play with it :)
17:31:35Zevvlet me fetch that
17:31:36leorizeit's kinda buggy atm but I hope I've fixed them all
17:31:51Zevvoh then I don't :)
17:32:22leorizeshashlick: it's usually per language, because every language have a different rule
17:33:03leorizeZevv: you should give it a shot :P it won't burn your PC, trust me :)
17:33:16disrupteknerdcommenter was a good vim addition; i'm getting more automatic features while writing comments, which really makes a difference.
17:33:45shashlick@leorize: do you use nimsuggest or nimlsp?
17:33:51leorizenimsuggest
17:34:15shashlickokay don't mind me stealing your code for my editor
17:34:46leorizevimscript is a mess to write, but hopefully it's readable :p
17:34:49Zevvleorize: you should make a vimscript backend for nim, that'd make your indent scripts typesafe
17:35:22leorizelol :p
17:35:56shashlickwill port to nim
17:36:17shashlickdo you also face the same memory issues with nimsuggest?
17:36:28shashlickalso 1 proc per file or 1 globalproc
17:36:46leorize1 per project
17:37:18leorizesince nvim does not have any idea about project, so here's how I do it:
17:37:58leorizefor file '~/proj/main.nim'
17:38:31leorizeif there's an instance running for '~', use it
17:38:46leorizeif not, check for a '~/proj' instance
17:38:55leorizeif no instance is available, spawn a new one
17:39:08shashlicknice
17:39:16leorizeI actually check from the inner most to outer most :p
17:39:28shashlickwhy not use one global proc? cause nimsuggest looks at neighboring files?
17:39:43shashlickkind of like a .git search?
17:41:07leorizenimsuggest use a module graph for the main project and a disposable one for outside files (per speculation, I haven't read the code yet)
17:41:50leorizealso, on first run, nimsuggest will cache the modulegraph of the project file, speeding up subsequent ops on the same project
17:42:05leorizeit doesn't do the same when files are outside of the main project afaict
17:43:26shashlickokay, i am hoping to use nimlsp and implement an lsp client instead, let's see
17:43:33shashlickstill a long list of stuff to get done in feud
17:43:42shashlickbut it is more than functional already
17:44:44*i7sDream quit (Remote host closed the connection)
17:45:09*i7sDream joined #nim
17:46:25leorizemy method of project detection is not really precise, and I'm looking at using nimble to help, but then there are two main problems:
17:46:47leorizerecurse backwards until you find a nimble file is not really a nice thing to do
17:47:05leorizethere's no way to get the project file from .nimble file
17:48:49Calinourecursing doesn't sound too slow to me, it's probably going to iterate like 10 steps at most
17:50:04*i7sDream quit (Remote host closed the connection)
17:50:29*i7sDream joined #nim
17:51:20leorizeyea, the second point is the bigger problem
17:52:23*i7sDream quit (Remote host closed the connection)
17:52:47*i7sDream joined #nim
17:53:27*Trustable quit (Remote host closed the connection)
17:54:42*i7sDream quit (Remote host closed the connection)
17:55:07*i7sDream joined #nim
17:59:02*i7sDream quit (Remote host closed the connection)
17:59:27*i7sDream joined #nim
18:00:40Zevv17:07 #nim: < federico3> how can I detect the "main" .nim file in a project
18:01:03Zevvthat is a good question indeed.
18:02:47FromGitter<jrfondren> the file's called "foo.nimble" and the main .nim is called "src/foo.nim"
18:03:17FromGitter<jrfondren> but nimble even still supports .babel files so I don't know how many projects follow that
18:03:45FromGitter<jrfondren> and for a non-bin nimble project, maybe there's no foo.nim at all
18:04:08Zevvexactly
18:05:22*i7sDream quit (Remote host closed the connection)
18:05:28Zevvyou could go guess, open up all files and check if there is only one with top level statements
18:05:50*i7sDream joined #nim
18:07:36leorizewhat if all of them has top-level statements? :p
18:07:46leorizeI thought of doing the nimble file matching
18:07:55leorizethen I was working on the compiler at the time
18:08:11leorizeof which `nim.nim` is the main file, not `compiler.nim` :p
18:08:41Zevvyeah right :)
18:10:10leorizeI'll look into implementing the nimble feature
18:10:21disruptekif we get the playground working again, we should have code sections automatically run and output automatically included below the code. we can include hints to show details of when/how it was compiled, and maybe even let users specify options to the compile/invocation.
18:10:23leorize(tbh running nimble to parse is kinda unsafe)
18:10:37disrupteki mean, for the nim lang forum.
18:10:38FromGitter<arnetheduck> any chances that https://github.com/nim-lang/Nim/pull/8010 can be backported to a 0.19.6 release? @narimiran?
18:10:53leorizethen running nim itself is already unsafe
18:12:44*i7sDream quit (Remote host closed the connection)
18:13:10*i7sDream joined #nim
18:13:23*natrys joined #nim
18:13:24disruptekwater is unsafe.
18:17:05*i7sDream quit (Remote host closed the connection)
18:17:32*i7sDream joined #nim
18:19:27*i7sDream quit (Remote host closed the connection)
18:19:57*i7sDream joined #nim
18:21:03ZevvNim did good on HN yesterday, 105 comments makes for a nice thread, mostly positive, and *no* discussions about case insensitivity
18:24:27FromGitter<jrfondren> the reddit thread was 100% about the title though
18:27:57dom96Some more Nim mentions here https://news.ycombinator.com/item?id=19750507
18:28:32*neceve quit (Read error: Connection reset by peer)
18:29:50disruptekdefinitely noticed some new visitors to irc, so you gotta figure there are orders of magnitude more who don't visit irc but do check out the language.
18:32:05*drewr joined #nim
18:33:24dom96yep, visitors to nim-lang.org are up 65%
18:34:53*i7sDream quit (Remote host closed the connection)
18:35:21*i7sDream joined #nim
18:39:13*i7sDream quit (Remote host closed the connection)
18:39:25federico3Zevv: not having a way to detect the "main" file also impact the ability to extract the required .nim files from a source tree and/or flag the ones that are unneded
18:39:42*i7sDream joined #nim
18:42:37*i7sDream quit (Remote host closed the connection)
18:43:05*i7sDream joined #nim
18:44:39dom96choosenim 0.4.0 is here. I finally uploaded the binaries that shashlick produced
18:44:49dom96update via `choosenim update self`
18:45:01FromGitter<arnetheduck> any changelog?
18:45:09dom96https://github.com/dom96/choosenim/blob/master/changelog.markdown#040---18042019
18:47:00*i7sDream quit (Remote host closed the connection)
18:47:28*i7sDream joined #nim
18:56:23*i7sDream quit (Remote host closed the connection)
18:56:23narimirannice job shashlick!
18:56:36*sz0 quit (Quit: Connection closed for inactivity)
18:56:40FromGitter<arnetheduck> 👍
18:56:48*i7sDream joined #nim
19:00:42*i7sDream quit (Remote host closed the connection)
19:01:12*i7sDream joined #nim
19:03:07*i7sDream quit (Remote host closed the connection)
19:03:35*i7sDream joined #nim
19:07:30*i7sDream quit (Remote host closed the connection)
19:07:55*i7sDream joined #nim
19:09:50*i7sDream quit (Remote host closed the connection)
19:10:14*i7sDream joined #nim
19:14:09*i7sDream quit (Remote host closed the connection)
19:14:37*i7sDream joined #nim
19:15:00*SenasOzys joined #nim
19:16:32*i7sDream quit (Remote host closed the connection)
19:17:00*i7sDream joined #nim
19:19:55*i7sDream quit (Remote host closed the connection)
19:20:12*SenasOzys quit (Remote host closed the connection)
19:20:23*i7sDream joined #nim
19:20:44*SenasOzys joined #nim
19:22:18*i7sDream quit (Remote host closed the connection)
19:22:45*i7sDream joined #nim
19:25:04FromGitter<mratsim> @dom96, your HN thread is using Nim 0.14.2, :O
19:25:23FromGitter<mratsim> where did the author even find this prehistoric version
19:26:52*glassofethanol joined #nim
19:28:43disruptek0.14.2 is the cheapest available.
19:29:57*abm joined #nim
19:31:40*i7sDream quit (Remote host closed the connection)
19:32:08*i7sDream joined #nim
19:34:03*i7sDream quit (Remote host closed the connection)
19:34:26*i7sDream joined #nim
19:35:09*nsf quit (Quit: WeeChat 2.4)
19:37:21*i7sDream quit (Remote host closed the connection)
19:37:46*i7sDream joined #nim
19:41:20shashlickwow awesome!
19:42:08narimiran...yes you are ;)
19:43:18shashlicknow need to test that choosenim works in travis windows git bash
19:47:14noonienhow can i make a generic proc for numbers only?
19:48:41*i7sDream quit (Remote host closed the connection)
19:49:05*i7sDream joined #nim
19:49:48FromGitter<kaushalmodi> @mratsim That HN post leads indirectly to this 2016 post: https://eccentricdevelopments.com/programming-language-comparison-summary/
19:50:24FromGitter<kaushalmodi> noonien: `proc foo[T: SomeInteger | SomeFloat] ..` ?
19:50:25Zevvnoonien: use SomeNumber
19:50:34FromGitter<kaushalmodi> or that :)
19:50:36noonienoh, awesome!
19:50:46noonienwhat are these called? how can i look them up in the manual?
19:50:53noonienor, are these concepts?
19:50:56FromGitter<kaushalmodi> generics\
19:50:56Zevvhttps://nim-lang.github.io/Nim/system.html#SomeNumber
19:51:12ZevvThese are just types. Somenumber is defined as SomeInteger | SomeFloat
19:51:24noonienno, i mean the `T: SomeNumber | Somefloat part`
19:51:24Zevvand these boil down to even more types or'ed
19:51:59noonienoh, ok
19:52:09noonienso basically T: int | int8, etc..
19:52:18noonienawesome, thanks!
19:52:37ZevvI think you'd have to gather the specifics from the manual and the system lib
19:52:56noonienyup, https://nim-lang.org/docs/system.html#SomeSignedInt
19:53:27Zevvyou found it :)
19:53:29FromGitter<kaushalmodi> noonien: https://nim-lang.github.io/Nim/manual.html#generics-type-classes
19:53:46narimirannoonien: pro tip - use devel docs at https://nim-lang.github.io/Nim/
19:54:00FromGitter<kaushalmodi> noonien: scroll down to find: ⏎ ⏎ > Nim also allows for type classes and regular types to be specified as type constraints of the generic type parameter:
19:54:12*SenasOzys quit (Remote host closed the connection)
19:54:37noonieninteresting
19:54:58*SenasOzys joined #nim
19:55:02Zevvthat's advanced stuff. I never needed that ever, but that might be my own fault
19:55:55FromGitter<kaushalmodi> Zevv: I happened to need type constraints in real work just last week
19:56:18Zevvhehe. One day, one day I will :)
19:56:24FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc210e88790b0307eff811b]
19:57:25Zevvthat's not constraints, right? Thats just a list of types (where you should have used SomeNumber :) )
19:57:28*narimiran_ joined #nim
19:58:04FromGitter<kaushalmodi> the manual seems to call them "type constraints"
19:59:06Zevvyeah, you're right. But only three occurences in the manual, not sure if that is intentional then
19:59:16disruptekthey are constraints in that they represent a selection mask of possible types.
19:59:31disruptekie. they constrain the acceptable types.
19:59:35Zevvwell, I use *that* all the time :)
19:59:41*narimiran quit (Ping timeout: 255 seconds)
20:00:15disruptekyes, it may not be mentioned much in the manual because the phrase does not convey any particular special meaning beyond the literal.
20:00:49Zevvoh, what I was thinking of are type *classes* - those I never needed yet
20:02:56FromGitter<kaushalmodi> yeah, I have never those either
20:03:20FromGitter<kaushalmodi> duh, oh well
20:03:40noonienhm, how would one implement this? `proc foo*[T : SomeInteger](max: T = high(T)): T =`?
20:04:52*narimiran_ is now known as narimiran
20:05:10Zevvelaborate
20:05:44noonieni'm getting this error: http://vpaste.net/tgjY5
20:06:09narimirani'm guessing this has to do with uint64
20:06:27narimirantry your example with SomeSignedInteger
20:06:46noonienwell, i need unsinged as well
20:06:52FromGitter<kaushalmodi> `got <type type(high(T))>` doesn't look right
20:06:55ZevvI'm not even sure what has to happen here - I'd expect 'max' to get the max value for the passed type, but I get zero
20:07:02FromGitter<kaushalmodi> somehow looks like that type vs typedesc issue
20:07:05Zevvit compiles for me, but I'm using latest devel
20:07:32noonieni'm using Nim Compiler Version 0.19.4 [Linux: amd64]
20:07:46Zevvnarimiran: http://p.zevv.nl/?1b53, is that a bug?
20:07:55Zevvor should that not even compile
20:08:07Zevvit returns 0
20:08:07narimirannoonien: it works for me too
20:08:19Zevvyeah, but max(int32) is not 0
20:08:28Zevvsorry, high(int32)
20:08:52noonienZevv: you're passing it 0
20:09:13noonienhigh(t) should be the default value
20:09:17Zevvthe default value of max is high(int32)
20:09:20Zevvoh darn
20:09:22Zevvam I stupid
20:09:26Zevvsorry about that :)
20:09:36ZevvI was up at 05.00, is that a good excuse
20:09:52noonienhehe, no worries
20:10:14narimirannoonien: and if you don't pass anything, how can compiler resolve which integer you want?
20:10:23noonienpassing it a number works for me too
20:10:35nooniennarimiran: T is the interger type
20:10:42noonienvar x: int32 = foo()
20:10:49narimiranT is *some* integer
20:10:53noonienshuld that not resolve T to int32?
20:11:27Zevvno, instantition does not work for results - althoug I sometimes wish it would
20:11:32FromGitter<mratsim> there is no return value type deduction
20:11:51ZevvI guess there is a good reason for that, otherwise it would already be available
20:11:58FromGitter<kaushalmodi> unsigned ints don't work there
20:12:02FromGitter<kaushalmodi> (https://files.gitter.im/nim-lang/Nim/YpUk/image.png)
20:12:26FromGitter<mratsim> uint64 does not have a high(uint64) defined
20:12:29FromGitter<arnetheduck> @mratsim you can return `auto`: `proc x(): auto = 42` works afair
20:12:55FromGitter<kaushalmodi> @mratsim so that's a bug?
20:13:03FromGitter<mratsim> feature request
20:13:36FromGitter<mratsim> @arnetheduck the example would be var x: int32 = x() and x() would return int32 instead of int
20:14:01FromGitter<arnetheduck> oh in that direction. hm.
20:14:30Zevvthat would be super-duper-cool and handy
20:15:00narimirankaushalmodi has the solution ;)
20:15:56narimiran`foo[int32]()` does the trick
20:16:12FromGitter<mratsim> lol
20:16:19Zevvtrue, true
20:16:44narimiranand unsigned work, unless you use uint|uint64 (as already stated earlier)
20:17:23FromGitter<mratsim> I wonder why high(uint64) PR is still pending
20:17:40FromGitter<mratsim> we can have an overload that says not defined at CT
20:18:09Zevvwhy is it cauing troubles at ct?
20:18:22FromGitter<mratsim> because the VM uses int64
20:18:33FromGitter<mratsim> and high(uint64) would be -1 in the VM
20:18:38Zevvhmm, nasty
20:18:42Zevvbaaad vm
20:18:55noonienwait, VM?
20:19:02*clyybber joined #nim
20:19:04Zevvthe solution is to have it use int128 of course :)
20:19:18Zevvyeah, Nim is just an interpreted language, did noone tell you?
20:19:18FromGitter<mratsim> Nim VM @noonien
20:19:32ZevvAll the talk about compilation is just gossip
20:19:37noonienhehe
20:19:54ZevvNim runs nim at compile time, by running it in the vm
20:20:03noonienoh!
20:20:08noonienthat makes sense
20:20:25FromGitter<mratsim> I'm surprised you are not confused :p
20:20:30Zevvso if you do for example `proc twice(a: int) = a * a` and then `const v = twice(3)`, the vm does the work and you have a const getting `6`
20:20:59Zevvbut the same VM also runs your macros, or can read and parse files or whatever.
20:21:29ZevvSo getting assets in your binary is just a matter of `const foo = readFile("somefile")`, and you have the contents of the file available in your code - at compile time
20:21:53Zevvit is so cool and intuititive that you barely have to thin about it
20:21:59noonienmratsim: i'm only new to nim
20:22:29noonieni should have thought about it being the compile-time VM, idk if VM is what i'd call it though
20:23:02Zevvwell, the VM is just the implementation - it might have been interpreting without a VM
20:23:06FromGitter<mratsim> it has registers and a stack
20:23:39Zevvwhich are only int64
20:23:53ZevvI just learned
20:23:54noonieni'm actually working on implementing a language not to dissimillar with nim in features, running things at compile time is a big plus, i do take inspiration fro other languages though
20:24:37ZevvI never got beyond a Forth and a Basic :(
20:24:49Zevvalthough I'm actually quite proud about the forth, ghehe
20:34:00*i7sDream quit (Remote host closed the connection)
20:34:23*i7sDream joined #nim
20:36:17*i7sDream quit (Remote host closed the connection)
20:36:44*i7sDream joined #nim
20:38:38*i7sDream quit (Remote host closed the connection)
20:39:04*i7sDream joined #nim
20:43:59*i7sDream quit (Remote host closed the connection)
20:44:26*i7sDream joined #nim
20:45:55shashlick@dom96 - i got the nocompiler branch working with import nimscript but have to except every single nimble var from system
20:46:54*narimiran quit (Ping timeout: 258 seconds)
20:47:19*iLiquid quit (Quit: iLiquid)
20:48:21*i7sDream quit (Remote host closed the connection)
20:48:48*i7sDream joined #nim
20:49:19shashlickimport system except getCommand, setCommand, switch, `--`, packageName, version, author, description, license, srcDir, binDir, backend, skipDirs, skipFiles, skipExt, installDirs, installFiles, installExt, bin, foreignDeps, requires, task, packageName
20:49:22shashlickmakes no sense
20:49:38*sentreen quit (Ping timeout: 255 seconds)
20:50:43*i7sDream quit (Remote host closed the connection)
20:51:08*i7sDream joined #nim
20:53:02*i7sDream quit (Remote host closed the connection)
20:53:28*i7sDream joined #nim
20:56:38*Etheco- quit (Ping timeout: 250 seconds)
20:58:48*krux02 quit (Remote host closed the connection)
21:00:42*glassofethanol quit (Ping timeout: 258 seconds)
21:03:22*i7sDream quit (Remote host closed the connection)
21:03:47*i7sDream joined #nim
21:05:41*fredrik92 joined #nim
21:07:07*couven92 quit (Disconnected by services)
21:07:12*fredrik92 is now known as couven92
21:07:33*fredrik92 joined #nim
21:08:42*i7sDream quit (Remote host closed the connection)
21:09:07*i7sDream joined #nim
21:10:34*i7sDream quit (Remote host closed the connection)
21:12:50*sentreen joined #nim
21:20:37*SenasOzys quit (Ping timeout: 246 seconds)
21:46:22*clyybber quit (Quit: WeeChat 2.4)
21:55:58*solitudesf- quit (Ping timeout: 246 seconds)
22:06:17*lritter quit (Quit: Leaving)
22:13:53*Vladar quit (Remote host closed the connection)
22:36:31*luis_ joined #nim
22:45:28*Jesin quit (Quit: Leaving)
22:47:16*luis_ quit (Ping timeout: 258 seconds)
22:51:42*natrys quit (Quit: natrys)
22:56:53*xet7 quit (Quit: Leaving)
22:59:42*luis_ joined #nim
23:03:38*luis_ is now known as lf-araujo
23:05:03*lf-araujo quit (Quit: lf-araujo)
23:05:55*lf-araujo joined #nim
23:06:20*jjido quit (Quit: Connection closed for inactivity)
23:08:22*abm quit (Ping timeout: 250 seconds)
23:10:48*Jesin joined #nim
23:21:14*couven92 quit (Read error: Connection reset by peer)
23:28:43*lf-araujo quit (Ping timeout: 276 seconds)
23:34:34*lf-araujo joined #nim
23:40:16*lf-araujo quit (Ping timeout: 246 seconds)
23:48:50shashlick@dom96 - i've made all changes for nimble nocompiler, please review