<< 22-08-2017 >>

00:10:41*Jesin joined #nim
00:14:34*relax joined #nim
00:26:59*sz0 quit (Quit: Connection closed for inactivity)
00:31:59*relax quit (Ping timeout: 248 seconds)
00:38:48*def-pri-pub joined #nim
00:38:53*relax joined #nim
00:47:49*mahmudov joined #nim
00:50:07*relax quit (Ping timeout: 248 seconds)
00:52:13*pilne joined #nim
00:56:26def-pri-pubzacharycarter: 2 byte patch; https://github.com/zacharycarter/zengine/pull/27
01:22:00*vivus joined #nim
01:36:18*def-pri-pub quit (Quit: leaving)
01:38:30*chemist69 quit (Ping timeout: 240 seconds)
01:45:31*BitPuffin|osx quit (Ping timeout: 255 seconds)
01:52:34*chemist69 joined #nim
02:11:41*endragor joined #nim
02:16:05*endragor quit (Ping timeout: 240 seconds)
03:07:04*vlad1777d joined #nim
03:22:30*big_num quit (Quit: WeeChat 1.7)
03:27:09*endragor joined #nim
03:43:05*ShalokShalom quit (Ping timeout: 240 seconds)
03:48:07*vivus quit (Quit: Leaving)
03:59:49*dddddd quit (Remote host closed the connection)
04:07:03*ryu0 joined #nim
04:07:30*ryu0 left #nim (#nim)
04:13:28*ibash joined #nim
04:22:41*ibash left #nim ("Textual IRC Client: www.textualapp.com")
04:30:04*arnetheduck quit (Remote host closed the connection)
04:33:22*mahmudov quit (Ping timeout: 255 seconds)
04:33:49*mahsav quit (Ping timeout: 255 seconds)
04:36:55*Yardanico joined #nim
04:49:18*yglukhov joined #nim
04:50:09*arnaud2 quit (Ping timeout: 248 seconds)
04:53:22*yglukhov quit (Ping timeout: 240 seconds)
05:03:21*rauss quit (Quit: WeeChat 1.9)
05:05:25*mahmudov joined #nim
05:06:07*Yardanico quit (Ping timeout: 248 seconds)
05:06:59*Vladar joined #nim
05:10:28*ketralnis joined #nim
05:14:59*pilne quit (Quit: Quitting!)
05:55:40*mahmudov quit (Remote host closed the connection)
05:57:03*mahsav joined #nim
06:09:09*ShalokShalom joined #nim
06:12:34*Arrrr joined #nim
06:31:35*nsf joined #nim
06:49:23*yglukhov joined #nim
06:54:19*endragor quit (Remote host closed the connection)
07:00:43*endragor joined #nim
07:03:41*PMunch joined #nim
07:05:27*endragor quit (Ping timeout: 240 seconds)
07:10:46*pydsigner quit (Ping timeout: 246 seconds)
07:10:56*pydsigner joined #nim
07:21:27*endragor joined #nim
07:22:47*Yardanico joined #nim
07:35:49gokrdom96: Got the book yesterday ;)
07:39:45*Arrrr quit (Ping timeout: 248 seconds)
07:47:44*TheManiac quit (Ping timeout: 240 seconds)
07:47:52*TheManiac joined #nim
07:51:09*scriptum joined #nim
07:52:42euantorThe new UI on nimble.directory is a vast improvement, good work dom96 :)
07:59:16*couven92 joined #nim
08:37:39*Yardanico quit (Read error: Connection reset by peer)
08:37:55*Yardanico_ joined #nim
08:37:55*Yardanico_ quit (Client Quit)
08:38:20*Yardanico joined #nim
08:42:53PMunchdom96, on nim-lang.org it says: * Printed soft cover book hasn't been released yet. ETA 11 Aug 2017.
08:42:58PMunchMight want to update that?
08:44:14*Arrrr joined #nim
08:44:39Jipok[m]https://nim-lang.org/docs/backends.html
08:44:41Jipok[m]text is hard to see
08:45:15Jipok[m]https://i.imgur.com/4NoBPMo.png
08:45:32Jipok[m]https://i.imgur.com/OqBHT68.png
08:46:51PMunchJipok[m], I think that's a font option on your end. Looks fine here
08:47:19*jinshil quit (Quit: Good-bye!)
08:47:34Jipok[m]But all the other pages of documentation are seen well
08:47:49Jipok[m]https://i.imgur.com/mNCcbA5.png
08:48:30YardanicoJipok[m], I don't have this problem too
08:48:48Jipok[m]Maybe it's because of the outdated version of the document?
08:48:53PMunchThat's odd, they are defined with the same fonts
08:48:54Jipok[m]Version: 0.14.0
08:50:51PMunchIf you inspect element you can see which font is being used for both pages
08:53:19*pydsigner quit (Ping timeout: 246 seconds)
08:53:29*pydsigner joined #nim
08:55:20*Matthias247 joined #nim
08:56:05Yardanicocan I use "replace" from PEG on unicode words?
08:56:10Yardanico*strings
08:56:31*Matthias247 quit (Client Quit)
08:56:55Yardanicobecause seems not to work
08:56:58PMunchThe documentation says "UTF-8 is supported"
08:57:03Yardanicobut
08:57:06PMunchSo it should work in theory I think
08:57:17Jipok[m]So, I added this to the styles
08:57:22Jipok[m]https://pastebin.com/96309yjZ
08:57:28Yardanicoecho "приветhello".replace(peg"[^А-Яа-я]*") should print "привет" but it does print this: п�иве�
08:57:33Jipok[m]And now it looks normal
08:57:59crem:)
08:58:33PMunchAh yes Jipok[m] the backend page seems to have some issues loading the Raleway font, so if you don't have HelveticaNeue installed then it might look weird.
08:59:11AraqYardanico: unicode ranges are not supported and probably should trigger an error :-)
08:59:18YardanicoAraq, eh :(
08:59:41YardanicoI just thought it would work because "UTF-8 is supported"
08:59:45Araqecho "приветhello".replace(peg"[A-Za-z]*")
09:00:05Yardanicowell I need to remove all non-russian letters from string
09:00:22Yardanicobut it doesn't matter if resulting string would be slightly invalid
09:00:31YardanicoI just need to check for lenght if it would be 0
09:00:40Yardanico*length
09:01:53couven92Araq, would you like to review https://github.com/nim-lang/Nim/pull/6051 it's been a while now, I think euantor wanted leftAlign... :P
09:03:16FromGitter<ephja> Araq: what's missing? https://gist.github.com/ephja/dd0b62135de416bbd774a66b8d0ad679
09:04:53couven92hmmm, do we have a macro that can apply nep1 on all declared identifiers in a const, var or let block?
09:05:02Araqsystem/alloc.nim?
09:05:37Araqcouven92: but is 'alignLeft' what Python uses?
09:06:11Araqthink about the people who learn Nim by enumerating the differences to Python...
09:06:42couven92Araq, what do you mean? the name of the proc? I'd be happy to rename it, should we use the SAME name as in python?
09:06:50cremnim is much better python!
09:07:23Yardanicowell for tasks where speed and all compile checking is needed - yes
09:07:50Yardanicoit's very annoying to write python code, execute it, fix errors (many type errors), and re-run it again
09:07:57couven92Araq, it seems form my 3 second SO research that Python uses `ljust`
09:07:59Yardanicobut hopefully PyCharm can check all this errors
09:08:00FromGitter<ephja> Araq: it is in the same directory as mmdisp.nim is. is it looking elsewhere?
09:08:31euantorRegarding that PR, the change that I suggested with `result[0 .. (s.len - 1)] = s` won't work as expected if `s` contains any `NULL` bytes in the string (eg: not at the end) due to the way slicing works in Nim
09:08:54euantor(I tripped over this issue a coupel of weekends and came here wondering what on earth was happening)
09:09:27couven92I think `alignLeft` is better, more understandable for name
09:09:49couven92euantor, okay, so should I revert your suggestion?
09:09:58euantorI think it may be for the best, yes
09:10:27*nattefrost joined #nim
09:10:37Araqeuantor: that's not correct
09:10:52Araqbut 'echo' is broken when it comes to zero bytes
09:11:23Araqcouven92: thinking about it, this belongs to unicode.nim and needs to use runeLen
09:11:59couven92Araq, oh? okay... I'll give it a shot later today
09:12:35couven92what about a nep1 macro? do we have something like that (thinking that c2nim does that transformation?)
09:12:51FromGitter<ephja> I'm able to compile things with the nim exe
09:15:05euantorAraq: It was you who told me it was expected behaviour a while back
09:15:19AraqI doubt it.
09:15:39Araqephja: ah, the search path setup is missing then?
09:15:58Araqcouven92: we have no such macro and what would it do anyway?
09:16:40Araqmacros transform the AST, they don't render the program text back to your editor
09:17:39euantorHm, it does seem to work. I don't know what the problem I was having was then. Ignore me couven92!
09:18:32*euantor left #nim (#nim)
09:18:47*euantor joined #nim
09:24:28FromGitter<ephja> I'll see if I've missed anything from the usual initialization steps
09:27:17euantorFound my old question, I was confused slightly with this example code: https://glot.io/snippets/erjeacgl8y
09:27:38euantorI now understand what you were saying when answering me Araq - sorry if I was being dim at the time
09:38:27*endragor quit (Remote host closed the connection)
09:39:09couven92Araq, yeah, I realize that the AST is not rerendered into the editor, but wel... Windows SDK headers are not c2nim friendly, so I cannot use c2nim to automagically import stuff, so I am using regexp to transform defines to nim constants
09:39:37couven92I am fine with having an ugly.nim and importing that... because ast rewriting DOES work for nimsuggest
09:39:39Araqpatch c2nim then
09:40:04couven92Oh hell no! :O
09:40:05Araqit's not really a hard codebase
09:40:34*endragor joined #nim
09:40:39couven92it's more that Windows SDK headers are ugly in every meaning of the word ugly
09:40:40Araqyou can even give it yet another preprocessing step that takes regexes
09:41:17Araqyou don't have to touch c2nim's logic to improve it, just add another pass, I wanted to do that too multiple times
09:41:43couven92... okay... there goes my next weekend... :P
09:41:48FromGitter<ephja> there we go ⏎ ⏎ ```options.setDefaultLibpath() ⏎ searchPaths.add(options.libpath)``` [https://gitter.im/nim-lang/Nim?at=599bfc5c97cedeb04828397d]
09:42:10FromGitter<ephja> globals<3
09:45:03*endragor quit (Ping timeout: 248 seconds)
09:49:09couven92Araq, hmmm... being able to have a --define:<value> option for C preprocessing would certainly be a thought
09:49:22*endragor joined #nim
09:49:28Araqwasn't that added already?
09:49:38couven92recently?
09:50:22*endragor_ joined #nim
09:50:32FromGitter<ephja> graph.compileModule(gProjectMainIdx, cache, {sfMainModule}) -> "cannot open macros"
09:53:06couven92Araq, yeah my bad, was using c2nim that is in the distribution package... 0.9.13 does indeed have --assumedef:IDENT
09:53:25*endrago__ joined #nim
09:53:30*endragor quit (Ping timeout: 240 seconds)
09:54:10PMunchIs that to resolve #ifdef in C code?
09:54:40*endragor_ quit (Ping timeout: 255 seconds)
09:54:44couven92PMunch, yup
09:54:52PMunchWell that's practical
09:55:22PMunchWhich I had known about that when I sat and tried to get the newest version of wxWidgets working..
09:56:09PMunchI'm considering to join a GameJam here using Nim and my library by the way. It will be nice to have something to try it out on :)
09:56:46FromGitter<ephja> mmmm jam
09:57:52couven92PMunch, yes the --assumedef is nice, but I need to actually define a symbol so that c2nim stops complaining...
10:10:48Araqcouven92: use #def ?
10:10:57couven92Araq, AH!
10:11:18couven92it does not come up in `c2nim --help`
10:13:43Araqread its docs please
10:14:07Araqhttps://nim-lang.org/docs/c2nim.html
10:16:27couven92got it
10:16:49couven92but for some bizarre reason, it does not work even with `#def`
10:20:42couven92I get `C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared\winerror.h(27716, 7) Error: ';' expected` but line 27716 is the `#endif` of a preprocessorblock that c2nim should ignore because of `#ifdef __cplusplus`, I even put in `--assumendef:__cplusplus` for good measure
10:25:30*ShalokShalom_ joined #nim
10:27:39*gokr left #nim (#nim)
10:28:52*ShalokShalom quit (Ping timeout: 255 seconds)
10:30:18*haha_ joined #nim
10:31:27FromGitter<ephja> "loadConfigs(DefaultConfig, cfg)" this is not loading the system config for some reason I guess
10:34:07*sz0 joined #nim
10:43:26FromGitter<ephja> of course, it's all designed with the layout of the nim directory in mind, which makes it difficult to use the compiler package
10:53:53*zama quit (Ping timeout: 248 seconds)
10:54:05*yglukhov_ joined #nim
10:54:57*yglukhov quit (Ping timeout: 248 seconds)
10:55:44*zama joined #nim
10:58:50*PMunch_ joined #nim
11:00:47*haha_ quit (Ping timeout: 248 seconds)
11:01:18*Vindaar`` joined #nim
11:01:19*PMunch quit (Ping timeout: 248 seconds)
11:01:21*Vindaar` quit (Ping timeout: 248 seconds)
11:01:41*haha_ joined #nim
11:01:52*joshbaptiste_ quit (Ping timeout: 248 seconds)
11:01:53*kier quit (Ping timeout: 248 seconds)
11:03:52*abeaumont quit (Ping timeout: 240 seconds)
11:05:15*joshbaptiste_ joined #nim
11:05:53*kier joined #nim
11:29:50*Vindaar`` left #nim ("ERC (IRC client for Emacs 26.0.50.2)")
11:54:49*endrago__ quit (Remote host closed the connection)
12:15:19*endragor joined #nim
12:20:15*endragor quit (Ping timeout: 248 seconds)
12:21:26*vlad1777d quit (Remote host closed the connection)
12:22:09*BitPuffin|osx joined #nim
12:23:24*vlad1777d joined #nim
12:24:57*Amun_Ra quit (Ping timeout: 246 seconds)
12:25:31*endragor joined #nim
12:25:31*haha_ quit (Read error: Connection reset by peer)
12:26:02*haha_ joined #nim
12:30:42*Amun_Ra joined #nim
12:31:12*dddddd joined #nim
12:33:06FromGitter<ephja> Araq: "# Find out if $nim/../../lib/system.nim exists." isn't this outside the root directory?
12:34:04*gokr joined #nim
12:37:25*fraya joined #nim
12:44:06*ShalokShalom_ is now known as ShalokShalom
12:46:25*haha_ quit (Ping timeout: 246 seconds)
12:47:03*haha_ joined #nim
12:48:16*vlad1777d quit (Remote host closed the connection)
12:49:58*vlad1777d joined #nim
12:52:28*fraya quit (Quit: Leaving)
13:00:39*AndroUser2 joined #nim
13:01:25*haha_ quit (Ping timeout: 255 seconds)
13:03:12*abeaumont joined #nim
13:04:59*yeeve quit (Quit: Leaving)
13:09:06*haha_ joined #nim
13:11:27*BitPuffin|osx quit (Ping timeout: 248 seconds)
13:12:54*vlad1777d quit (Remote host closed the connection)
13:13:49*vlad1777d joined #nim
13:15:44*arnaud2 joined #nim
13:16:20*PMunch_ quit (Quit: Leaving)
13:16:31*PMunch joined #nim
13:16:35*vlad1777d quit (Remote host closed the connection)
13:17:08*vlad1777d joined #nim
13:23:00couven92is it acceptable to write a lonely discard statement to mark the end of a block (i.e. in cases where you have multiple block nested into each other)
13:28:45*dom96|w joined #nim
13:29:41*ludocode_ quit (Ping timeout: 240 seconds)
13:29:41*arnetheduck joined #nim
13:29:43*vlad1777d quit (Remote host closed the connection)
13:31:05*endragor quit (Remote host closed the connection)
13:32:48*vlad1777d joined #nim
13:33:17*vlad1777d quit (Remote host closed the connection)
13:33:19*gokr quit (Ping timeout: 248 seconds)
13:33:53*vlad1777d joined #nim
13:33:55*vlad1777d quit (Remote host closed the connection)
13:34:22Yardanicocouven92, why it's useful?
13:34:35Yardanicowell you can do it probably
13:34:49Yardanicobut i recommend to set up your editor so it will highlight different indentation levels
13:34:52couven92because I loose track of how many levels I have indented
13:34:59couven92still...
13:35:05*ludocode joined #nim
13:35:06*vlad1777d joined #nim
13:35:25Yardanicocouven92, well yes, you can use discard then (if you really want)
13:35:36Yardanicoin this case it would be similar to python's "pass"
13:35:58*Arrrr quit (Read error: Connection reset by peer)
13:37:22*rauss joined #nim
13:37:36dom96|wYou should fix your text editor not add noise to your code.
13:38:04dom96|wI'm afraid to say that I would stay away from code like that if I saw it.
13:40:13*relax joined #nim
13:40:19*arnetheduck quit (Ping timeout: 246 seconds)
13:47:17*BitPuffin|osx joined #nim
13:48:55couven92I was just thinking loudly
13:54:09*Vindaar joined #nim
13:59:13dom96|wcouven92: Sorry, hope what I said doesn't discourage you :)
14:00:03couven92dom96|w, nah :P I mean, you can always define a helper proc to reduce the number of indent levels anyways, right?
14:00:10Yardanicoyeah
14:00:27dom96|wyes, and in general you should aim to use as little indents levels as possible anyway.
14:01:31*AndroUser2 quit (Read error: Connection reset by peer)
14:06:47Yardanicoalso, what was the reason for using 2 spaces in most of them Nim code? just curious, I use 2 spaces myself
14:07:47cremThe optimal is e spaces, but it's not easy to type non-integer amount of spaces.
14:08:02*endragor joined #nim
14:08:35Yardanicowell I was just asking why not 4 :)
14:08:50YardanicoBut it's fine for me actualyl
14:08:54Yardanicoactually
14:09:38cremUsually when there is a limit of 80 chars for a width, indent is 2 to conserve horizontal space.
14:11:16*gangstacat joined #nim
14:12:49*endragor quit (Ping timeout: 248 seconds)
14:15:58*haha_ quit (Ping timeout: 276 seconds)
14:21:47*haha_ joined #nim
14:21:48PMunchPersonally I prefer a single tab per indent level. That way everyone can size their tabs as they wish, and one level = one character which just makes sense.
14:24:08cremhttps://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
14:24:31*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
14:25:05Yardanicojust a statistics thing)
14:25:07Yardanico:)
14:25:34PMunch_Uses_ tabs, or _prefers_ tabs?
14:25:41*dom96|w joined #nim
14:25:53PMunchI also use spaces at work since our style guide dictates it
14:25:53*gangstacat quit (Quit: Leaving)
14:26:09PMunchBut I _prefer_ tabs
14:26:33FromGitter<ephja> so that's why I suddenly got a raise after running every source file through tabs2spaces
14:28:15FromGitter<ephja> Araq: So, why do you think that debuggers aren't as necessary for Nim than they are for certain other languages?
14:29:15FromGitter<ephja> The ability to print arbitrary objects and retrieve the stack trace at arbitrary locations certainly allows one to get by without one sometimes
14:31:00*gangstacat joined #nim
14:31:12PMunchI've found that GDB actually works pretty well for Nim :)
14:31:25*sz0 quit (Quit: Connection closed for inactivity)
14:31:27PMunchI'm off now
14:31:28*PMunch quit (Quit: Leaving)
14:36:24Araqephja: I said debuggers are mostly worthless for debugging the Nim compiler because the bugs are manifestations of complex feature interactions. this means a section of code is run thousands of times before the interesting thing happens. This means conditional breakpoints and debuggers suck at these.
14:37:37AraqPMunch: sigh, tabs for indentation don't work, never have, never will.
14:37:51Araqyou cannot *prefer* something that objectively does not work...
14:38:11YardanicoAraq, he can use them with filters thought :D but I doubt this is a good thing
14:39:13*gangstacat quit (Quit: Leaving)
14:39:26AraqsomeLongCall(a,
14:39:38Araq b # under 'a' please
14:39:41Araq)
14:39:51Yardanicoyeah I do that :)
14:40:09Araqtabs for indentation, spaces for alignment, so in other words, mix tabs and spaces
14:41:27FromGitter<andreaferretti> well, just put a on its new line
14:41:31FromGitter<andreaferretti> problem solved :-)
14:41:56FromGitter<andreaferretti> or just do not align things vertically
14:42:18Araqok so tabs work with more restrictive layout rules.
14:42:40FromGitter<andreaferretti> yup, kind of
14:42:40Araqand these layout rules just so happen to describe a way that you can as easily automate with spaces only...
14:43:09FromGitter<andreaferretti> but you lose the ability to have each person set its preferred indent level
14:43:20Araqno, not at all.
14:43:35FromGitter<andreaferretti> but yeah, whatever, it's not something worth worrying about
14:43:37FromGitter<andreaferretti> :-)
14:43:51Araqan editor can easily detect the indentation and provide a "fake-tab width" switch
14:44:17FromGitter<andreaferretti> well, in theory yes
14:44:27relaxone day, science will solve the social problem of tabs vs spaces
14:44:30relax...one day
14:44:32FromGitter<andreaferretti> in practice this does not happen a lot
14:45:01Yardanicorelax, by introducing new symbol? :D
14:45:04*endragor joined #nim
14:45:30Araqa 10 line vim/emacs/vscode plugin is a very thin line between "theory" and "practice"
14:45:50Yardanicoyeah vscode is able to detect indentation levels very easily (from my and even from copy-pasted code)
14:47:22Araqbtw tabs are not for indentation, they have strange X characters modulo N (where N is usually 8) semantics
14:48:57Yardanicoalso it's funny that some people make an argument "tabs consume less space in bytes". maybe this was true like 15-20 years ago?
14:49:21*endragor quit (Ping timeout: 240 seconds)
14:50:06euantorIt's still true, just that it doesn't matter quite so much in practice as it used to
14:50:24Yardanicowell I know it's true
14:50:26Araqit never mattered.
14:50:45Yardanicobut no one looks at source code size in bytes :)
14:51:08Araqotherwise C would never have grown semicolons
14:51:14*BitPuffin joined #nim
14:53:13FromGitter<ephja> Araq: oh ok. got it
14:54:56*tankfeeder left #nim (#nim)
14:58:22*haha_ quit (Ping timeout: 246 seconds)
15:00:55*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
15:04:33federico3Yardanico: the space argument was a joke I hope
15:05:26Yardanicofederico3, it's not a joke
15:05:35Yardanicofederico3, example - https://softwareengineering.stackexchange.com/a/2037
15:05:41Yardanico"take less size than multiple spaces."
15:06:26*BitPuffin|osx quit (Ping timeout: 255 seconds)
15:06:44Yardanicoso yeah, it's a strange argument
15:07:02federico3Yardanico: sometimes people enforce a number of characters per line (e.g. 80 columns) and count a tab as 1
15:07:15Yardanicofederico3, lol
15:08:16federico3the "logic" is that the limit exists for readability and if you count a tab as more than 1 you are punishing people for indenting
15:10:08*BitPuffin quit (Read error: Connection reset by peer)
15:12:31*Trustable joined #nim
15:12:41*BitPuffin joined #nim
15:14:51*Vladar quit (Quit: Leaving)
15:15:01*sz0 joined #nim
15:21:09*endragor joined #nim
15:25:35*endragor quit (Ping timeout: 240 seconds)
15:30:03*gangstacat joined #nim
15:37:14*ldleworker is now known as ldlework
15:37:14*ldlework quit (Changing host)
15:37:14*ldlework joined #nim
15:37:50*dom96|w joined #nim
15:55:59*ofelas joined #nim
15:57:28*endragor joined #nim
16:00:24*couven92 quit (Read error: Connection reset by peer)
16:01:09*nhywyll joined #nim
16:01:57*endragor quit (Ping timeout: 240 seconds)
16:21:12FromGitter<ephja> let's encourage tabs by counting it as -1
16:28:23ldleworkDoes Nim have if assignment statements?
16:28:51ldleworklike Golang/C++17 where you can assign a variable inside the if expression and then have the conditional use that variable
16:32:04Yardanicoldlework, yes
16:32:17ldleworkCan I see an example of it
16:32:20Yardanicoone sec
16:32:22FromGitter<ephja> it's limited atm
16:32:33Yardanicobut it works
16:32:52Yardanicohttps://gist.github.com/Yardanico/dc9bf14004281adcf8171bd85014133e
16:33:33FromGitter<ephja> I was thinking of if expressions
16:33:44ldleworkcool
16:34:24Yardanicoit works with while too
16:34:31YardanicoIDK about for thought
16:36:38*yglukhov_ quit (Remote host closed the connection)
16:37:35*nsf quit (Quit: WeeChat 1.9)
16:39:49*couven92 joined #nim
16:39:51*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
16:40:29*yglukhov joined #nim
16:41:52*yglukhov_ joined #nim
16:42:44Yardanicoalso I learned that you can assign variables in if after reading some library code
16:43:04Yardanicoyou can learn a lot of tricks while reading libraries/apps written in nim
16:44:46*yglukhov quit (Ping timeout: 246 seconds)
16:46:10*yglukhov_ quit (Ping timeout: 246 seconds)
16:49:31federico3ephja: or indent using a backspace character
16:50:38*nattefrost quit (Remote host closed the connection)
16:52:51ldleworkWith Rust's compiler VM on the way, and its AST macros in the bag, I'm wondering what Nim has over Rust these days other than the lack of memory-saftey bondage
16:53:01ldleworkI don't mean to be inflammatory whatsoever
16:53:24federico3ldlework: the nicer syntax
16:53:32ldleworkSure that's the bondage bit
16:53:40ldleworkIs there anything else left?
16:54:46Yardanicoportability
16:54:53*haha_ joined #nim
16:55:51ldleworkIs Rust really not portable?
16:56:22Yardanicoldlework, maybe, but compare it to GCC
16:56:31YardanicoGCC supports far more platforms/OSes than LLVM
16:56:42Yardanicoyou can also use clang, which has LLVM :D
16:57:08ldleworkYeah but LLVM is basically everywhere you could want
16:57:33Yardanicowell you can compile nim with Visual Studio compiler for example
16:57:44federico3ldlework: not on most microcontrollers or less common hw
16:57:59ldleworkSure, hence the basically - leaving room for people who do that stuff
16:58:09ldleworkI'm just trying to update my language survivability estimations
16:58:59federico3ldlework: being community-driven help long-term survivability at the expense of popularity
16:59:42ldleworkYeah but differentiation is what explains the community in the first place.
17:04:52Yardanicowhat's the define for gc asserts?
17:06:08*oprypin quit (Quit: Bye)
17:06:24*oprypin joined #nim
17:07:20couven92in a macro, how do I get the type of a declared let/var/const variable?
17:08:00couven92say I pass `const x = 42` into the macro, how do I get the typedesc for `x`?
17:09:48couven92(which in this example should be the typedesc for `int`)
17:23:13*haha_ quit (Ping timeout: 248 seconds)
17:25:58YardanicoAraq, how can I trace make a more helpful error log for this GC error: "gc.nim(278) asgnRefNoCycle"?
17:26:32YardanicoI haven't yet tried to make a small program to reproduce it
17:27:27YardanicoAraq, https://gist.github.com/Yardanico/5b1c9000780db8c4d67e26d815fd83e0
17:27:39Yardanicosadly my application is async which is even worse for debugging
17:28:26*haha_ joined #nim
17:30:54*yglukhov joined #nim
17:31:58*yglukhov quit (Remote host closed the connection)
17:32:14*yglukhov joined #nim
17:32:58YardanicoAraq, well my app is open-source, but comments are all in russian
17:34:19*endragor joined #nim
17:35:03*Matthias247 joined #nim
17:38:41Yardanicooh wait!
17:38:49YardanicoI actually made a reproducable script
17:38:50Yardanicowait a sec
17:39:13*endragor quit (Ping timeout: 248 seconds)
17:40:42Yardanicoand it is async-only issue
17:42:01*itseris quit (Ping timeout: 276 seconds)
17:46:35Yardanicowait, it doesn't happen now 0_0
17:48:10AraqYardanico: used Nim devel?
17:48:24Yardanicoyeah
17:48:26Yardanico7c1ac5eff88e2c98d3803ed4a5367a62e862b63b
17:48:32FromGitter<ephja> I need to traverse only the 'when' nodes whose conditionals evaluate to true
17:48:32Yardanicobut GC error disappeared now
17:48:49Yardanicothis error was in code which is making requests for weather API
17:48:53Araqoften the stack trace is slightly wrong and it's just a nil deref bug
17:49:17Yardaniconow there's no GC error (maybe there was some issue on API side)
17:51:00FromGitter<ephja> I have a pass that runs after the semantic pass
17:52:46YardanicoAraq, should there be a SIGSEGV in gc if I "await" a future two times?
17:53:21*couven92 quit (Ping timeout: 240 seconds)
17:57:46FromGitter<ephja> nah I don't even need to do that
17:58:40YardanicoAraq, https://github.com/nim-lang/Nim/issues/6268
17:59:53Yardanicooh wait there's a GC error even if I comment first "await"
18:00:04YardanicoI don't know what's happening here
18:02:21*gangstacat quit (Quit: Leaving)
18:04:05YardanicoAraq, seems to be a JSON parsing error, but somehow it results in GC error
18:04:28Yardanicowith mark & sweep and first await commented code throws proper json parsing error (but still not clear one)
18:05:26*couven92 joined #nim
18:05:39Yardanicohmm
18:07:09FromGitter<Varriount> I wouldn't be surprised if it has to do with the unsafe features lexbase uses.
18:09:27Yardanicoalso json returnted from api seems to be correct
18:09:46YardanicoIf I replace this async http request with plain JSON - everything parses fine
18:11:16*endragor joined #nim
18:11:21*AndroUser2 joined #nim
18:15:29*endragor quit (Ping timeout: 248 seconds)
18:15:31*itseris joined #nim
18:20:26*Trustable quit (Remote host closed the connection)
18:26:34*Trustable joined #nim
18:39:02*endragor joined #nim
18:39:21*PMunch joined #nim
18:43:47*endragor quit (Ping timeout: 260 seconds)
18:43:58FromGitter<dandevelop> Hi there, I know that using this trick will make your file compile as .m file: template enableObjC*() = ⏎ ⏎ ```block: ⏎ proc dummyWithNoParticularMeaning() {.used, importobjc.}``` [https://gitter.im/nim-lang/Nim?at=599c7b6eba0f0f6e38d0cd78]
18:44:14FromGitter<dandevelop> This seems to work when nim compiles to c
18:45:11FromGitter<dandevelop> However, when nim compiles to c++, this does not work as expected. I thought it would convert my file to a .mm one but the generated file still has the .cpp extension. Did anyone else experience this?
18:45:12*AndroUser2 quit (Read error: Connection reset by peer)
18:47:13FromGitter<dandevelop> @yglukhov I know this enableObjC trick from your code. Do you have any experience with this?
18:50:51yglukhovdandevelop: sure, why?
18:51:28*relax quit (Ping timeout: 246 seconds)
18:51:45yglukhovdandevelop: oh, just read your first question
18:52:22yglukhovdandevelop: so no, i don't know how to help you with importobjc, but i've got something better, still very experimental ;)
18:52:38yglukhovand it should work in c++ mode
18:52:48FromGitter<dandevelop> @yglukhov I would love to know more about it :D
18:53:52yglukhovdandevelop: a picture worth a thousand words: https://github.com/yglukhov/darwin/blob/master/tests/tobjc_runtime.nim
18:54:50yglukhovthe benefit of this is that no objc compiler needed. c/c++ is enough. at the same time, the runtime cost is almost zero.
18:55:58yglukhovi'm trying to convince Araq to deprecate nim's objc support in favor of this. =)
18:56:23*oprypin quit (Quit: Bye)
18:56:39*oprypin joined #nim
19:00:40subsetparkBut what about ....
19:00:53*subsetpark struggles in vain to think of a non-Apple platform for ObjC...
19:00:58subsetpark... NeXT?
19:01:20Yardanicomaybe just let user choose?
19:01:24Yardanicobetween old and new
19:03:16Yardanicoalso I don't know what is NeXT :D
19:04:53FromGitter<dandevelop> @yglukhov that looks interesting. Do you think it will also work with cpp generated code? The reason is that I have a static C++ library that I need to link to my nim project.
19:07:21*endragor joined #nim
19:08:06yglukhovdandevelop: i can't see any reason why it should not work with cpp
19:08:48yglukhovmaybe it will require some extra casts somewhere under the hood, but from design perspective it is totally compatible
19:10:42FromGitter<dandevelop> @yglukhov I am now struggling with this, maybe you can help: I am trying to include AppKit.h while compiling my nim code as C++ by doing: {.emit: """ ⏎ ⏎ ===import <AppKit/AppKit.h>=== ⏎ ⏎ """} [https://gitter.im/nim-lang/Nim?at=599c81b1c101bc4e3a466711]
19:11:19yglukhovdandevelop: err, no. you don't want to do that.
19:11:33FromGitter<dandevelop> What would be a good way to do it?
19:11:46yglukhovwhat are you trying to bind to?
19:11:59*endragor quit (Ping timeout: 248 seconds)
19:13:01FromGitter<dandevelop> You mean the library?
19:13:27yglukhovdandevelop : what classes do you need from AppKit.h?
19:13:45FromGitter<dandevelop> I need it for this:
19:13:46FromGitter<dandevelop> template StartEventLoop():stmt = ⏎ {.emit: """ ⏎ [NSApp run]; ⏎ """} [https://gitter.im/nim-lang/Nim?at=599c826a578b44a046d9205d]
19:15:12yglukhovok. use smth like this: `type NSApplication = ptr object of NSObject`
19:15:28yglukhovvar NSApp {.importc.}: NSApplication
19:15:52yglukhovproc run(a: NSApplication) {.objc.}
19:15:58yglukhovNSApp.run()
19:16:11yglukhovthat's it
19:17:50FromGitter<dandevelop> how would I declare NSObject?
19:17:57subsetparkYardanico: https://en.wikipedia.org/wiki/NeXT
19:18:04Yardanicoyeah I've read that
19:18:07yglukhovit is declared in darwin.objc.runtime
19:18:12yglukhovin my lib
19:22:03FromGitter<dandevelop> So I would first need to import the lib, right?
19:22:22yglukhovyup. import darwin.objc.runtime
19:23:12FromGitter<dandevelop> Is it on nimble or I need to download the zip from github?
19:23:51yglukhovdandevelop: not in nimble yet. add `requires "https://github.com/yglukhov/darwin"` to your nimble file.
19:24:17yglukhovor nimble install https://github.com/yglukhov/darwin
19:25:43FromGitter<ephja> is it feasible to write canvas apps with nim yet? I want to avoid dynamic typing as always
19:26:06yglukhovephja: sure, just do the bindings! ;)
19:26:33yglukhovactually i think i've came across those a while ago...
19:26:55FromGitter<ephja> https://gitlab.com/define-private-public/HTML5-Canvas-Nim ?
19:27:07Yardanicoalso you can see dom96's snake game
19:27:08FromGitter<dandevelop> @yglukhov It fails on this line: proc run(a: NSApplication) {.objc.}
19:27:09Yardanicofor html5
19:27:22FromGitter<ephja> and the doms module should be less broken nowadays, so I'm going to give it a go
19:27:33FromGitter<ephja> Yardanico: didn't know it was for html5. I'll check it out
19:27:48yglukhovdandevelop: try `proc run(a: NSApplication) {.objc: "run".}` ?
19:28:44FromGitter<dandevelop> @yglukhov : Error: type mismatch: got (NSApplication, SEL) ⏎ but expected one of: ⏎ proc (self: NSObject, selector: SEL){.cdecl.}
19:29:05yglukhovdandevelop: hrm, ok, let me check it. 5min =)
19:29:45FromGitter<dandevelop> @yglukhov I think it worked. I had this line added before using your module: NSObject* = ptr object {.pure, inheritable.}
19:29:50FromGitter<dandevelop> I removed it and it works now
19:29:57FromGitter<dandevelop> At least it compiles
19:30:07yglukhovah, ok.
19:30:34yglukhovdoes it run properly? =)
19:31:35FromGitter<ephja> have any other third parties written compiler plugins or is it just me?
19:31:37FromGitter<dandevelop> @yglugh
19:31:52FromGitter<dandevelop> @yglukhov : here is the error
19:32:00FromGitter<dandevelop> macosxapp.cpp:1510:33: error: cannot initialize a variable of type 'tyProc_QjaYZ9bMjtLmC35Vjupak6A' (aka 'void (*)(NSObjectcolonObjectType__9auPgmgK5nknOFigSOsIkoQ *, void *)') with an lvalue of type 'void ()': different number of parameters (2 vs 0) ⏎ ⏎ ``` tyProc_QjaYZ9bMjtLmC35Vjupak6A performSend = objc_msgSend;``` [https://gitter.im/nim-lang/Nim?at=599c86b0bc46472974afcef4]
19:32:31FromGitter<dandevelop> Looks like it is related to this line: proc run(a: NSApplication) {.objc: "run".}
19:32:42yglukhovok, so a bunch of casts is missing probably... let me check it.
19:35:25*relax joined #nim
19:42:43yglukhovdandevelop: done. try again please.
19:43:38Jipok[m]http://www.luna-lang.org/
19:43:42Jipok[m]Nim seems there can also be added
19:43:56Jipok[m]I do not know why this is needed
19:44:03Jipok[m]but it looks beautiful
19:47:49FromGitter<dandevelop> @yglukhov seems to compile now but now I have another question: does Nim compile with libstdc++ when choosing c++ as a target?
19:48:58yglukhovdandevelop: not sure about that, don't use cpp mode
19:49:41FromGitter<dandevelop> the static library I am linking with is C++. Will this work?
19:50:09yglukhovthere should be a simple way to find out ;)
19:50:51FromGitter<dandevelop> Looks like it doesn't: Undefined symbols for architecture x86_64: ⏎ "std::__1::__shared_weak_count::__get_deleter(std::type_info const&) const", referenced from: ⏎ ⏎ ``` vtable for std::__1::__shared_ptr_emplace<std::__1::mutex,``` [https://gitter.im/nim-lang/Nim?at=599c8b1b9acddb2407bab246]
19:51:32yglukhovwell you can add a linker pragma to your wrapper, or add it via cmdline
19:51:59yglukhov{.passL:"-lstdc++".} or smth?
19:52:53yglukhovor cmdline option: --passL:-lstdc++
19:54:04yglukhovdunno if thats the canonical way though. maybe other c++ users will help here.
19:55:05*Sembei joined #nim
19:55:19yglukhovoh, since you're using AppKit, you'll have to link it as well: {.passL:"-framework AppKit".}
19:56:02*gokr joined #nim
19:57:05*Pisuke quit (Ping timeout: 240 seconds)
19:57:30FromGitter<dandevelop> @yglukhov Looks like I had to change the min sdk version from 10.7 to 10.9 and it worked
19:58:07yglukhovis that because your cpp static lib is built against that?
19:58:38yglukhovwell, congrats anyway ;)
20:01:36FromGitter<dandevelop> @yglukhov the library was build against 10.7
20:01:48FromGitter<dandevelop> @yglukhov but thanks for the help!
20:02:54FromGitter<dandevelop> @yglukhov by the way, your nimx project looks like a great way to learn Nim :D
20:03:11*Yardanico quit (Remote host closed the connection)
20:03:27yglukhovdandevelop: thats strange. the link error should say where those symbols are used from. what does it say?
20:03:41yglukhovdandevelop: thanks, glad to help =)
20:04:01FromGitter<dandevelop> Ok, I will set it back to 10.7 and see what it says
20:05:22yglukhovdandevelop: also note, that my objc bindings lib is not tested on ios. there might be some abi differences, so feel free to file a ticket in case you happen to test it on ios and it fails.
20:05:41FromGitter<dandevelop> @yglukhov so the library is built with libc++ but if I set the min sdk to 10.7 looks like nim will build it with libstdc++
20:05:52FromGitter<dandevelop> Here is the warning: clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
20:07:09yglukhovah ok. i suppose these options come somewhere from nim.cfg, you can try tinker with it and see if it works for you. probably a pr with nim.cfg patch would be welcome ;)
20:07:25*vlad1777d quit (Remote host closed the connection)
20:08:55*haha_ quit (Ping timeout: 255 seconds)
20:11:59FromGitter<dandevelop> @yglukhov yes, I will take a look at it tomorrow. Thanks again! I really appreciate it!
20:12:19yglukhovanytime :)
20:17:38*mahsav2 joined #nim
20:19:27*ipjk joined #nim
20:19:27*mahsav quit (Ping timeout: 240 seconds)
20:22:55*gangstacat joined #nim
20:31:42*rauss quit (Quit: WeeChat 1.9)
20:32:17*rauss joined #nim
20:33:02*PMunch quit (Quit: leaving)
20:33:22*Trustable quit (Remote host closed the connection)
20:35:50*rauss quit (Client Quit)
20:40:32*Yardanico joined #nim
20:51:46*nsf joined #nim
20:51:51*mahsav2 quit (Ping timeout: 240 seconds)
21:22:31*mahsav joined #nim
21:24:31*rauss joined #nim
21:26:21*relax quit (Ping timeout: 240 seconds)
21:39:21*mahsav quit (Ping timeout: 240 seconds)
21:51:19*xaxisx quit (Read error: Connection reset by peer)
21:51:45*xaxisx joined #nim
21:51:57TheManiacNewbie question: is there a reason why you can't raise an exception inside a case expression?
21:52:37TheManiac(Given that it works fine inside a case statement?)
21:59:16Araqit would require a bottom type in the type system and we like simplicity (yes, really, we do)
21:59:25*couven92 quit (Quit: Client Disconnecting)
22:00:55*Yardanico quit (Read error: Connection reset by peer)
22:05:20TheManiacYou mean there's no way to type check it if it raises an exception?
22:08:01*Jesin quit (Quit: Leaving)
22:10:16*Sembei quit (Ping timeout: 246 seconds)
22:14:05AraqI mean it makes everything more complex for little gain
22:19:19*nhywyll quit (Quit: nhywyll)
22:22:42*ipjk quit (Quit: Leaving)
22:25:24*ofelas quit (Quit: shutdown -h now)
22:33:44*mahsav joined #nim
22:37:21*yglukhov quit (Remote host closed the connection)
22:47:08*nsf quit (Quit: WeeChat 1.9)
23:31:09*Jesin joined #nim
23:39:12*jinshil joined #nim
23:43:25*sz0 quit (Quit: Connection closed for inactivity)
23:46:21*itseris quit (Ping timeout: 240 seconds)
23:47:36*gangstacat quit (Quit: Leaving)
23:48:44*Nobabs27 joined #nim
23:55:23*Sembei joined #nim