00:11:56 | * | kinkinkijkin joined #nim |
00:22:07 | * | xet7 quit (Quit: Leaving) |
00:40:55 | * | kinkinkijkin quit (Quit: Leaving) |
00:43:08 | * | Cthalupa joined #nim |
00:55:53 | * | tribly quit (Quit: WeeChat 2.1) |
00:57:20 | * | tribly joined #nim |
01:00:07 | * | skellock joined #nim |
01:01:33 | * | skellock quit (Client Quit) |
01:01:53 | * | skellock joined #nim |
01:02:17 | * | skellock quit (Client Quit) |
01:03:47 | * | cakesauce joined #nim |
01:16:08 | FromGitter | <honewatson> @sivakon Async Httpserver threaded on Linux actually has comparable performance to Golang fasthttp. Threaded Async Httpserver offers no performance gains on Mac which the app server repo uses to test. |
01:47:39 | * | gsingh93 joined #nim |
01:53:05 | * | SenasOzys quit (Ping timeout: 255 seconds) |
01:57:59 | FromDiscord | <2vg> @honewatson is that true? Did you measure the benchmark? |
02:02:06 | * | gsingh93 is now known as gsgx |
02:16:39 | * | cakesauce quit () |
02:23:40 | * | sz0 quit (Quit: Connection closed for inactivity) |
03:09:54 | * | Electrux joined #nim |
03:56:36 | * | endragor joined #nim |
03:58:41 | * | cspar joined #nim |
04:00:43 | * | tiorock joined #nim |
04:00:43 | * | tiorock quit (Changing host) |
04:00:43 | * | tiorock joined #nim |
04:00:43 | * | rockcavera is now known as Guest22777 |
04:00:43 | * | Guest22777 quit (Killed (niven.freenode.net (Nickname regained by services))) |
04:00:43 | * | tiorock is now known as rockcavera |
04:08:57 | * | Electrux quit (Quit: WeeChat 2.1) |
04:31:13 | * | xkapastel quit (Quit: Connection closed for inactivity) |
04:33:15 | FromGitter | <honewatson> I compared the difference between only fasthttp and no other framework |
04:33:31 | FromGitter | <honewatson> apart from Async Httpserver |
04:35:42 | FromGitter | <honewatson> I created a simple router for multithreaded Async Httpserver to test and implementation looks like this |
04:36:06 | FromGitter | <honewatson> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b28883659799e701728fc25] |
04:36:45 | FromGitter | <honewatson> Note mine did not check request method |
04:43:23 | FromGitter | <Varriount> Where are the threads? |
04:55:00 | FromGitter | <honewatson> in run |
04:56:12 | FromGitter | <honewatson> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b288cebd2abe466886fdf8f] |
04:57:51 | FromDiscord | <2vg> If it is a local benchmark it seems to be meaningless. |
05:01:28 | FromGitter | <honewatson> Sure, but they are all fairly meaningless IMO if they don't benchmark meaningful data access |
05:11:16 | * | Cthalupa quit (Remote host closed the connection) |
05:12:19 | * | Cthalupa joined #nim |
05:17:59 | * | miran joined #nim |
05:27:16 | * | SenasOzys joined #nim |
05:31:01 | * | Cthalupa quit (Quit: ZNC 1.6.6+deb1 - http://znc.in) |
05:34:45 | * | Cthalupa joined #nim |
05:35:39 | * | WA9ACE left #nim (#nim) |
05:37:42 | * | sakalli_ joined #nim |
05:38:28 | * | nsf joined #nim |
05:42:30 | * | sakalli_ quit (Client Quit) |
05:43:42 | * | sakalli_ joined #nim |
05:47:05 | * | sakalli_ quit (Client Quit) |
06:06:57 | * | miran quit (Ping timeout: 264 seconds) |
06:20:19 | * | livcd joined #nim |
06:44:07 | FromGitter | <alehander42> can I just add debugInfo in a nim.cfg |
06:44:16 | FromGitter | <alehander42> without : value |
06:46:39 | Araq | yes |
06:52:38 | * | SenasOzys quit (Remote host closed the connection) |
06:53:13 | * | SenasOzys joined #nim |
07:00:51 | * | SenasOzys quit (Ping timeout: 260 seconds) |
07:11:08 | * | PMunch joined #nim |
07:22:25 | * | dddddd joined #nim |
07:30:39 | * | jjido joined #nim |
07:35:33 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
07:47:43 | * | Cthalupa quit (Read error: Connection reset by peer) |
07:48:05 | * | Cthalupa joined #nim |
07:55:12 | * | Cthalupa quit (Ping timeout: 245 seconds) |
08:04:12 | * | floppydh joined #nim |
08:05:38 | * | Cthalupa joined #nim |
08:34:30 | * | d10n-work quit (Quit: Connection closed for inactivity) |
08:36:22 | * | yglukhov[i] joined #nim |
08:36:57 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
08:37:32 | * | yglukhov[i] joined #nim |
08:50:01 | FromGitter | <mratsim> @Vindaar, Are you working at CERN? I met some CERN people yesterday that organises this Machine Learning challenge: https://www.kaggle.com/c/trackml-particle-identification, I try to tell them stop using Python + C, try Nim ;) |
08:55:25 | FromGitter | <mratsim> By the way Araq, w.r.t. to packedJSON, besides representing JSON as a string, are there any other techniques that contributed significantly to parsing throughput and memory use? I have several GBs of go game files stored in this format: https://homepages.cwi.nl/~aeb/go/misc/sgfnotes.html#variations and I need a fast and memory efficient parser. |
09:11:12 | FromGitter | <Vindaar> @mratsim: Yes and no. I'm not working at CERN full time. But I'm a CERN user and part of an experiment at CERN (really small, not related to LHC). I'm down there once every 2 months or so. :) Most physicists unfortunately only program because they have to. And everyone involved at LHC is so invested in ROOT, they don't want to spend the time to learn anything else / reimplement stuff (to an extent that's |
09:11:12 | FromGitter | ... understandable, but ROOT really is quite horrible, imo...). But I had no idea there were machine learning challenges organized by CERN people. Maybe I need to take a look at that, hehe. The people organizing that stuff might be more open to stuff besides Python and C++. ⏎ Where did you meet them? |
09:13:13 | dom96 | I worked at CERN for 9 months and submitted a Nim talk to a little event organised by their IT team (can't remember the name). They rejected me :( |
09:13:45 | dom96 | Although to be fair, the topic of the talks was "UI" (lame) |
09:16:26 | FromGitter | <Vindaar> Oh, I had no idea. That's cool! When was that? ⏎ But then you know there's a lot of lame stuff going on there, haha. Stupid of them not to accept you, but well. Not unexpected. :/ |
09:19:09 | dom96 | 1.5 years ago |
09:21:25 | FromGitter | <mratsim> I met them in Paris: https://www.meetup.com/Paris-Machine-learning-applications-group/events/251281454/ |
09:21:28 | livcd | heard lots of cern people are cocky and full of themselves |
09:23:07 | * | cspar quit (Ping timeout: 245 seconds) |
09:24:32 | * | cspar joined #nim |
09:26:20 | FromGitter | <Vindaar> dom96: Maybe we ran past one another then :) ⏎ livcd: quite a few surely are! Lots of nice people down there too, though |
09:26:29 | * | elrood joined #nim |
09:27:30 | dom96 | Vindaar: perhaps :) |
09:29:16 | livcd | nice people are cocky and full of themselves as well |
09:29:25 | livcd | they are nice because they know you :D |
09:29:50 | FromGitter | <Vindaar> maybe I should have said humble then :P |
09:29:59 | livcd | (have 3 acquaintances of mine that work there) |
09:30:04 | FromGitter | <mratsim> @livcd I guess it’s not CERN people that go out, because in my experience most I met were super friendly. I went to Haskell meetup at CERN in the past, and when I worked in Geneva I had collegues who were working at CERN before working at my company of the time. |
09:50:32 | FromGitter | <tim-st> is there a package that allows importing packages from golang? this doesnt seem to support it: https://github.com/stefantalpalaru/golib-nim |
09:51:08 | Yardanico | how would it work? I don't think there is |
09:51:21 | Yardanico | you'll probably need to interface with Go via C FFI |
09:51:40 | FromGitter | <tim-st> via gccgo or dynlib in worst case |
09:51:45 | Yardanico | but I'm don't really know, I've never used Go :) |
09:52:33 | dom96 | tim-st: sounds like a fun project, do it :) |
09:53:34 | FromGitter | <tim-st> dont know think my skills are good enough, maybe I would directly implement a transpiler because nim should support most concepts from golang besides channels I think |
09:54:07 | FromGitter | <tim-st> btw is that allowed to just translate all source code from go^^ ? |
09:54:35 | livcd | would not it work by building a shared library of that go pkg ? |
09:54:49 | FromGitter | <tim-st> yes, that's what I called "worst case" |
09:55:22 | FromGitter | <tim-st> there is nimpy that allows super easy native python usage in nim, I hoped there was something for golang too |
09:56:01 | Yardanico | well, golang is a direct competitor to Nim :P |
09:56:22 | Yardanico | and Python is oftenly used as a scripting language for compiled languages (e.g. for games) |
09:56:24 | FromGitter | <tim-st> I know, but why not support these big ecosystem |
09:56:27 | FromGitter | <alehander42> I think a transpiler would be a lot of work |
09:56:57 | FromGitter | <alehander42> I mean, you can write a go 2 nim transpiler that kinda works for a lot of stuff very very quickly! |
09:57:27 | FromGitter | <alehander42> but the last 20% of the work would take 10x more time |
09:57:36 | Yardanico | but almost every big/medium library in go will probably use its' advanced features |
09:57:38 | Yardanico | like channels, etcv |
09:57:44 | FromGitter | <alehander42> but it's a fun project |
09:57:57 | Yardanico | @alehander42 do you have any plans about py2nim btw? |
09:58:03 | FromGitter | <alehander42> but interfacing with go seems better |
09:58:34 | FromGitter | <alehander42> @Yardanico well, not really having a usecase for it right now, and not a lot of time |
09:58:47 | Yardanico | ok, just asking :) |
09:58:50 | FromGitter | <alehander42> but it's a very fun project, I'd love to improve it one day |
09:58:56 | FromGitter | <alehander42> or get some contributors :( |
10:00:03 | Yardanico | @alehander42 lol |
10:00:03 | Yardanico | https://en.wikipedia.org/wiki/Nim_(programming_language)#py2nim |
10:00:10 | Yardanico | someone added it to nim's wikipedia page :) |
10:00:12 | FromGitter | <mratsim> btw, new runtime is now for v1? https://github.com/nim-lang/Nim/milestone/2 |
10:00:15 | FromGitter | <tim-st> btw anyone knows how gccgo works? do they transpile go to c on the fly and could these c files saved somehow? |
10:00:29 | Yardanico | well, it probably works like usual GCC |
10:00:32 | FromGitter | <alehander42> when zah started py2nim I was so hooked in, but just no time |
10:00:44 | FromGitter | <alehander42> @Yardanico hahaha yeah I saw it once, I was very suprised |
10:00:52 | FromGitter | <mratsim> https://github.com/yglukhov/nimpy should be added to wikipédia too ;) |
10:01:33 | FromGitter | <tim-st> If python support in nim like nimpy would be "officially" supported, I think that would directly pull quite a few people |
10:01:55 | Yardanico | but they would expect that it will work for any python libraries |
10:02:02 | Yardanico | because most of python projects use third-party libs |
10:02:08 | FromGitter | <tim-st> it does! |
10:02:36 | FromGitter | <tim-st> it calls python directly natively |
10:04:03 | Yardanico | oh, sorry, I thought you were talking about py2nim |
10:04:49 | FromGitter | <tim-st> this would be cool, too. But I cannot imagine 100% support, on `grumpy` they gave up it seems |
10:05:04 | * | noonien joined #nim |
10:05:17 | Yardanico | well, nim has one advantage for grumpy-like project: it's closer to python in syntax and some other stuff |
10:05:47 | FromGitter | <tim-st> I think they already had all this, but than faced big problem about cyclic imports or similar |
10:10:24 | livcd | uhm someone just reverse engineered diablo 1 :O |
10:12:30 | Yardanico | it's cool to see new people on nim forum :) |
10:12:56 | Yardanico | (and just generally new people coming to Nim) |
10:21:54 | * | floppydh quit (Quit: WeeChat 2.1) |
10:26:23 | Araq | mratsim: I don't know. |
10:26:49 | FromGitter | <mratsim> Regarding packedjson or newruntime? |
10:27:56 | * | cspar quit (Ping timeout: 260 seconds) |
10:40:57 | Araq | packedjson |
10:50:05 | * | devilox joined #nim |
10:53:42 | FromGitter | <bevo009> Could some one clarify concatenation in Nim for me? ⏎ I was following this here: https://scripter.co/notes/nim/#string-concatenation ⏎ "Either & or ,(comma) can be used to concatenate string in echo." ⏎ @Yardanico commented: "comma doesn't concat though, it's just that echo accepts any number of arguments." [https://gitter.im/nim-lang/Nim?at=5b28e0b6479ca26689684405] |
10:53:53 | Yardanico | yes, comma doesn't concat |
10:53:59 | Yardanico | echo 1, 2 is similar to echo(1, 2) |
10:54:06 | FromGitter | <bevo009> So...how would you precisely describe the examples below compared to each other, to a noob? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b28e0cd960fcd4eb90c55c9] |
10:54:28 | Yardanico | because echo takes "varargs" - variable number of arguments |
10:54:58 | FromGitter | <Yardanico> @bevo009 on your second line you call `echo` with two arguments - "Hello" and "World" |
10:55:24 | FromGitter | <Yardanico> and on your first line you concatenate "Hello" with "World" and call echo on result of the concatenation |
10:55:52 | Yardanico | !eval echo(1, 2); echo 1, 2 |
10:55:54 | NimBot | 12↵12 |
10:55:58 | FromGitter | <bevo009> Is the second line an output representation of a concatenated string? |
10:56:18 | FromGitter | <Yardanico> "echo" concats all arguments by itself |
10:56:28 | FromGitter | <Yardanico> well, it doesn't concat actually, but it writes them one-by-one to stdout |
10:57:10 | FromGitter | <bevo009> So line 1 and line 3 are both concatenation? |
10:57:29 | FromGitter | <Yardanico> yes, & is a concatenation operator for strings |
10:59:23 | FromGitter | <bevo009> cheers for clearing that up |
11:00:42 | FromGitter | <Yardanico> just a simple example" |
11:01:12 | FromGitter | <bevo009> @yardanico , what does !eval mean? |
11:01:21 | FromGitter | <Yardanico> ^custom echo for strings only |
11:01:33 | FromGitter | <Yardanico> @bevo009 it's a command for NimBot (IRC bot written in Nim) |
11:01:43 | FromGitter | <Yardanico> it asks NimBot to evaluate nim code through play.nim-lang.org |
11:01:48 | FromGitter | <Yardanico> https://play.nim-lang.org |
11:02:29 | FromGitter | <bevo009> The 'create gist' feature is broken on the playground |
11:02:42 | FromGitter | <bevo009> otherwise I'd use that |
11:02:51 | FromGitter | <Yardanico> you can AFAIK |
11:03:00 | FromGitter | <Yardanico> try to !eval echo "hello" |
11:03:16 | FromGitter | <bevo009> !eval echo "hello" |
11:03:18 | NimBot | hello |
11:03:30 | FromGitter | <bevo009> ahhh |
11:03:36 | FromGitter | <bevo009> only I can see that |
11:03:40 | FromGitter | <Yardanico> no |
11:03:45 | FromGitter | <Yardanico> everyone can see it :) |
11:03:59 | FromGitter | <alehander42> I SEE IT |
11:04:05 | FromGitter | <bevo009> haha |
11:04:19 | FromGitter | <bevo009> I get it no...cheers |
11:04:49 | FromGitter | <bevo009> that's awesome |
11:05:10 | * | cspar joined #nim |
11:05:17 | FromGitter | <Yardanico> https://scripter.co/notes/nim/#string-concatenation author talks here about concatenating strings *only* for an echo call, but yeah, that wording is not the best |
11:06:04 | FromGitter | <bevo009> not technically concatenation though, right? |
11:06:17 | FromGitter | <bevo009> printing one straight after another |
11:06:36 | * | floppydh joined #nim |
11:06:37 | FromGitter | <Yardanico> yeah, it's not technicall concatenation |
11:06:46 | * | SenasOzys joined #nim |
11:07:16 | FromGitter | <Yardanico> you can read about nim's invocation syntax here - https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
11:08:01 | FromGitter | <Vindaar> @kaushalmodi ping ^ |
11:09:15 | FromGitter | <bevo009> I searching the manual/tutorial for concatenation etc which yielded zero results, ⏎ but searching for the `&` operator led me to reading the associated procs: https://nim-lang.org/docs/system.html#%26,string,char |
11:09:45 | FromGitter | <bevo009> Although the word 'concatenation' is right there in the proc description |
11:09:58 | FromGitter | <kaushalmodi> @Yardanico Hey, I didn't use the word "only" :) |
11:10:06 | FromGitter | <bevo009> I think I need a doc, on how to read the docs :) |
11:10:25 | FromGitter | <kaushalmodi> I just wanted to note that users can use either & or , to concatenate strings in echoes. |
11:10:37 | FromGitter | <Yardanico> but , is not for concatenation, it just looks like it is |
11:10:41 | FromGitter | <kaushalmodi> You cannot use , in regular concats. Isn't that correct? |
11:10:48 | FromGitter | <Yardanico> , is not for concat at all |
11:10:59 | FromGitter | <Yardanico> echo 1, 2 is equivalent for echo(1, 2) |
11:11:04 | FromGitter | <Yardanico> which calls echo with two arguments |
11:12:13 | FromGitter | <Yardanico> @bevo009 there is a note for concat for strings in tutorial 1 |
11:12:28 | FromGitter | <Yardanico> https://nim-lang.org/docs/tut1.html search for "concat" |
11:13:16 | * | floppydh quit (Quit: WeeChat 2.1) |
11:13:23 | FromGitter | <bevo009> This is all I got searching that: https://nim-lang.org/docs/sequtils.html#concat,varargs%5Bseq%5BT%5D%5D |
11:14:07 | FromGitter | <Yardanico> well, search in docs only works for library documentation, not for other stuff like manual/tut1/tut2 |
11:14:30 | FromGitter | <kaushalmodi> I'll fix that , doesn't technically concat |
11:14:59 | FromGitter | <Yardanico> @kaushalmodi it's possible because of https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax and `varargs` |
11:15:36 | dom96 | Offtopic: Any of you guys work at Spotify or know someone that does? |
11:15:38 | FromGitter | <bevo009> @Kaushal Modi no offence bro, I just wanted a precise definition of what was happening there |
11:16:08 | FromGitter | <bevo009> I've learnt a few handy tips off your blog already |
11:16:58 | * | mostly-harmless quit (Ping timeout: 260 seconds) |
11:26:47 | FromGitter | <tim-st> I try to to see the intrnal difference between proc t(x: var T) and proc t(x: T); it seems the first is passed with two ** the second with one *; when I'm building a transpiler, I could always use the var type, but will this have influence on performance? |
11:27:07 | FromGitter | <tim-st> two asterisk, one asterisk |
11:30:23 | FromGitter | <tim-st> ok, found an anwer on stackoverflow, shoudnt be too much overhead, maybe nothing |
11:30:54 | FromGitter | <Yardanico> "var" is for pass-by-reference AFAIK |
11:31:07 | FromGitter | <Yardanico> you can just use "ref" type instead if you want (but you're not required to) |
11:32:22 | FromGitter | <tim-st> the problem in golang is, they pass also bei ref if they dont change the object, in nim I only pass by var if I change something, so in golang I would translate to alway var T where they use pointer |
11:32:33 | FromGitter | <tim-st> *by |
11:33:37 | FromGitter | <Yardanico> well, if you have a "ref" object in Nim you will always pass it by reference because it's ref :) |
11:34:07 | FromGitter | <mratsim> if copying a stack type is too heavy (more than 3 machine words) it’s passed by hidden pointer anyway in Nim |
11:34:33 | FromGitter | <tim-st> I took a look at the c source code; as I wrote above: one time it's one asterisk, by var type it's two asterisk |
11:34:43 | FromGitter | <mratsim> use var/ref/stack for intent. don’t try to optimize the fuction signature by passing a vr |
11:34:48 | FromGitter | <mratsim> var |
11:35:12 | FromGitter | <mratsim> if you want to optimize that use the {.inline.} or template |
11:35:24 | FromGitter | <tim-st> it's not an optimization, it's needed because I cannot prove that non var is sufficient |
11:35:36 | FromGitter | <tim-st> when transpiling from golang |
11:35:52 | FromGitter | <Yardanico> just use "ref" then? |
11:35:55 | FromGitter | <Yardanico> it will be much simpler |
11:36:26 | FromGitter | <mratsim> py2nim uses ref everywhere. (but in Python everything is a ref so …) |
11:36:34 | FromGitter | <tim-st> where is the difference in var and ref? |
11:36:56 | FromGitter | <Yardanico> @tim-st if you create a ref object, it's always passed by reference to all procs, etc |
11:37:01 | FromGitter | <Yardanico> yeah |
11:37:24 | FromGitter | <tim-st> so if I can use both, which one is prefered^^ |
11:37:45 | FromGitter | <tim-st> I mean var and ref |
11:38:15 | FromGitter | <Yardanico> maybe https://forum.nim-lang.org/t/1207 can help |
11:39:04 | FromGitter | <tim-st> I just ask, because I never used ref (besides on ref objects) |
11:39:16 | FromGitter | <Yardanico> well, you can use "ref" for any type |
11:39:33 | FromGitter | <mratsim> Go primitive types —> Nim types |
11:39:45 | FromGitter | <mratsim> deson’t go has a distinction for mutability? |
11:40:22 | PMunch | tim-st, maybe this'll help: https://peterme.net/nim-types-originally-a-reddit-reply.html |
11:41:01 | Yardanico | PMunch, for me font rendering is a bit broken |
11:41:12 | PMunch | Yeah I just noticed.. |
11:41:13 | FromGitter | <mratsim> (https://files.gitter.im/nim-lang/Nim/YsvS/2018-06-19_13-41-02.png) |
11:41:22 | FromGitter | <mratsim> the code tag are broken, this wasn’t like this before |
11:41:23 | PMunch | It's a bug in the CSS |
11:41:29 | PMunch | Yeah |
11:41:47 | FromGitter | <mratsim> if T is a ref type, it’s on heap |
11:41:54 | FromGitter | <mratsim> otherwise it is not |
11:41:58 | FromGitter | <tim-st> so, as I assumed above: if I can use var I should prefer var over ref? |
11:42:00 | PMunch | I added line numbers to longer code blocks, and it required modifying some styles. Messed up and added this to the code tag and not to some combination of code and pre.. |
11:42:26 | PMunch | tim-st, yes |
11:42:31 | FromGitter | <mratsim> @tim-st, does go has something similar to let vs var/let mut? |
11:42:42 | FromGitter | <Yardanico> @tim-st yes, but if you need "var" everythere - maybe it's better to use "ref" :) |
11:43:24 | PMunch | Yeah it really depends on the use-case |
11:43:27 | FromGitter | <tim-st> @mratsim yes they have var and declare using `:=` if I remember correct and additonally you can pass by `*` |
11:43:54 | FromGitter | <mratsim> what I mean is can go declare an immutable variable |
11:44:42 | FromGitter | <tim-st> using `:=` I think, but my last go code is longer ago^^ |
11:44:56 | FromGitter | <mratsim> if it can, it’s trivial, let maps to there immutable equivalent |
11:45:01 | FromGitter | <mratsim> their* |
11:45:16 | FromGitter | <mratsim> and var to everything else. |
11:45:20 | FromGitter | <tim-st> yes, but this complete thing was more about passing by `*` |
11:45:39 | FromGitter | <tim-st> @mratsim yes, `var` everywhere else was also my idea |
11:45:57 | FromGitter | <mratsim> primitive types (int, float) should be passed using a var |
11:46:10 | FromGitter | <mratsim> tuple as well |
11:46:21 | FromGitter | <mratsim> user defined types should be ref |
11:47:03 | FromGitter | <mratsim> start with that, see the problems, and refine, otherwise you will be chasing after rainbows/talking in conceptual issues) |
11:47:15 | FromGitter | <mratsim> in circle about conceptual issues* |
11:47:37 | FromGitter | <tim-st> ok, thanks for the help :) |
11:48:04 | FromGitter | <mratsim> to ease testing both, the transformation go ref —> Nim var, or go ref —> Nim ref should be parametrised. |
11:48:20 | FromGitter | <mratsim> by a const for example |
11:48:28 | FromGitter | <tim-st> ok |
11:50:02 | FromGitter | <mratsim> you can check c2nim pas2nim and py2nim and maybe nimborg as reference project (not sure if nimborg does conversion, I don’t remember) |
11:50:40 | FromGitter | <tim-st> ok, thanks |
11:52:42 | * | enthus1ast joined #nim |
11:59:51 | FromGitter | <kaushalmodi> @bevo009 Hey, no offense was taken in the first place. This is a prime example of how one could learn by sharing :). I am just sharing my notes that I update as I am learning Nim ( I am no Nim guru. So bring up your confusions and doubts over here. :)). One thing is for sure, that all the code in my notes *works* as the results are not copy/pasted by live evaluated before publishing to my blog. Glad you found it |
11:59:51 | FromGitter | ... useful. To others reading this, it would be great if they picked up one section from my notes that's their favorite, and proof-read it :) https://scripter.co/notes/nim/. |
12:02:11 | FromGitter | <kaushalmodi> And thanks to @Vindaar for the ping. @Yardanico Yes, I'll fix my notes and make them technically correct regarding echo and commas. |
12:07:21 | FromGitter | <kaushalmodi> PMunch: TIL that you had already converted that famous Reddit answer of yours to this blog post: https://peterme.net/nim-types-originally-a-reddit-reply.html. I had already added that golden answer to my notes :). I'll start following your blog now. |
12:07:39 | * | floppydh joined #nim |
12:18:22 | * | mostly-harmless joined #nim |
12:22:05 | * | xet7 joined #nim |
12:28:36 | bevo | @kaushalmodi most languages have 4 or 5 excellent books you can cross-reference, with Nim being young we're pretty limited, so we have to ask annoying questions to fill in the blanks |
12:29:05 | bevo | Appreciate you've been logging as you learn |
12:32:54 | * | mostly-harmless quit (Ping timeout: 268 seconds) |
12:36:59 | FromGitter | <ephja> PMunch: the code elements are inline and they have a margin so they appear on top of other text for me |
12:38:45 | FromGitter | <bevo009> Actually I do have one more question I couldn't find much info on ⏎ Is `func` an exact alias for `proc`? |
12:38:52 | Yardanico | no |
12:39:07 | Yardanico | (as far as I know) |
12:39:43 | FromGitter | <bevo009> what is the difference? |
12:41:12 | FromGitter | <Vindaar> it's an alias for a `proc` with the `.noSideEffects.` pragma |
12:41:31 | * | nsf quit (Quit: WeeChat 2.1) |
12:41:50 | FromGitter | <Vindaar> It was only an alias in the past. The change happened after v0.18.0 came out, which is probably why you didn't find anything on it :) |
12:42:01 | Yardanico | in the future `func` is supposed to do more than that |
12:42:21 | FromGitter | <bevo009> oh ok, I did see talk about that, but no final resolution |
12:50:54 | PMunch | ephja, yeah I know. I don't have the SSH key to my server on my work machine, so I'll have to fix it when I get home.. Basically the "code" element in the CSS is supposed to be "pre > code" |
12:51:44 | PMunch | kaushalmode, haha thanks :) I turned it into a post quite a while ago, and I think it's the post I've referred to the most |
12:52:32 | PMunch | I'm unfortunately so busy writing fun Nim projects that I forget to write about them, I should certainly get better at that :P |
12:54:24 | * | mostly-harmless joined #nim |
12:55:39 | * | devilox quit (Quit: Page closed) |
12:59:33 | * | xkapastel joined #nim |
13:01:18 | FromGitter | <mratsim> I’m plagued by the same. I’m so busy writing fun Nim stuff that I can’t even start rewriting my website/blog (I’m losing too much time in Wordpress/Medium formatting …) |
13:02:13 | dom96 | Set up some static blog generator :) |
13:03:05 | PMunch | I've been using CouchCMS |
13:03:49 | PMunch | Pretty neat in the way that you can define whatever HTML/CSS you want and then it will automatically generate a administration page where you can publish/unpublish/edit/track etc. your content |
13:03:52 | PMunch | Pretty neat |
13:04:12 | FromGitter | <mratsim> I have a Gatsby prototype running, The blocking point is the “Hero image” :P |
13:04:30 | PMunch | You just throw in some PHP tags telling it what's supposed to be editable, and it auto-generates the rest |
13:04:48 | FromGitter | <mratsim> posts are in markdown and pulled with GraphQL which is quite fancy |
13:05:24 | FromGitter | <mratsim> but it makes writing dual language blogs easier, I can tag with specific language. |
13:07:52 | * | SenasOzys quit (Remote host closed the connection) |
13:07:53 | FromGitter | <Vindaar> @mratsim @narimiran and possibly others: main reason I personally use Python is scipy's curve_fit. I want a non linear least squares solver in Nim (Levenberg Marquardt I suppose). I checked and found 3 C libraries, which should be easy to wrap: lmfit (http://apps.jcns.fz-juelich.de/doku/sc/lmfit), levmar (http://users.ics.forth.gr/~lourakis/levmar/) and mpfit (http://cow.physics.wisc.edu/~craigm/idl/cmpfit.html). ⏎ |
13:07:53 | FromGitter | ... Does anyone have experience with any of them? Or can tell me "stupid, do xy instead!" |
13:08:57 | * | endragor quit (Remote host closed the connection) |
13:09:02 | Araq | anybody who wants to take over nimpretty? I should work on more pressing things |
13:09:21 | Araq | it works solidly for anything I threw at it, which admittedly wasn't much |
13:09:24 | * | endragor joined #nim |
13:09:42 | FromGitter | <mratsim> @Vindaar, stupid, use Arraymancer’s Least Square Solver instead: https://github.com/mratsim/Arraymancer/blob/afc0c213316b4d98002fbb118551a4de9b67e217/src/linear_algebra/least_squares.nim#L37 |
13:09:57 | FromGitter | <mratsim> ah non-linear |
13:10:05 | FromGitter | <Vindaar> yep.. :/ |
13:11:45 | FromGitter | <mratsim> for non-linear stuff I just throw gradient boosted trees at a problem or neural networks, they can approximate everything in Machine Learning |
13:12:30 | PMunch | mratsim, well that's the beauty of CouchCMS, I wanted to add tags to easily sort on topic. Just created the HTML layout for the tags page, and added a PHP tag in the post saying there should be a link to that page. Then CouchCMS added a checkbox in my admin page allowing me to choose tags. |
13:13:06 | FromGitter | <Vindaar> @mratsim Well, they surely can. But how do I extract the optimized parameters + errors and a chi^2/dof from that? |
13:13:37 | * | endragor quit (Ping timeout: 248 seconds) |
13:14:07 | FromGitter | <mratsim> different concerns ;), we don’t use Chi2 in ML, and for errors we use cross-validation to make sure the model generalize well |
13:14:16 | FromGitter | <Vindaar> exactly :) |
13:14:24 | FromGitter | <kaushalmodi> This could be a trivial task for macros and Windows terminal users: https://github.com/nim-lang/Nim/issues/8070 |
13:16:13 | * | Vladar joined #nim |
13:17:34 | PMunch | Araq, do you have nimpretty working? |
13:17:41 | Yardanico | PMunch, it does work |
13:17:51 | Yardanico | you can already try it yourself |
13:19:33 | * | enthus1ast quit (Ping timeout: 264 seconds) |
13:20:22 | FromGitter | <mratsim> @PMunch this is what it looks like at the moment |
13:20:29 | FromGitter | <mratsim> (https://files.gitter.im/nim-lang/Nim/HRkr/2018-06-19_15-20-00.png) |
13:21:18 | * | enthus1ast joined #nim |
13:22:17 | PMunch | Hmm, interesting |
13:29:56 | * | qwertfisch is now known as gruenfisch |
13:32:43 | * | endragor joined #nim |
13:33:18 | * | gruenfisch is now known as qwertfisch |
13:36:23 | PMunch | Yardanico, is it a separate project, or a secret flag to the compiler? |
13:37:05 | * | endragor quit (Ping timeout: 248 seconds) |
13:37:12 | Yardanico | PMunch, it's a separate tool in tools dir |
13:37:20 | Yardanico | PMunch, you need to manually compile it |
13:38:03 | PMunch | Aah |
13:41:11 | FromGitter | <tim-st> here is again a silent crash, the first definition shouldnt compile, or? |
13:41:16 | FromGitter | <kaushalmodi> Yardanico: Maybe it should be added to `koch tools` in devel? |
13:41:32 | Yardanico | not yet probably |
13:43:52 | PMunch | Hmm, interesting |
13:44:19 | * | leru joined #nim |
13:44:51 | PMunch | What does it prettify so far? It seems to wrap lines that are too long, and it crated spaces around "<". But apart from that it didn't seem to do a whole lot |
13:44:52 | * | leru quit (Client Quit) |
13:45:01 | * | leru_ joined #nim |
13:45:16 | FromGitter | <kaushalmodi> @mratsim I don't know react, graphql, etc, else I would have tried Gatsby. Talking about multi-language posts, tagging/taxonomy, etc. Hugo (which I use) supports those natively. |
13:46:10 | PMunch | Oh wait, it actually does quite a bit |
13:46:12 | PMunch | Cool |
13:47:36 | PMunch | Hmm is ; preferred as the procedure argument divider? |
13:47:53 | FromGitter | <mratsim> Well I didn’t know about GraphQL before but it’s not that hard and Gatsby comes with a GraphQL query tester tool |
13:48:15 | Yardanico | PMunch, I don't really know about that, better ask dom96 or Araq :) |
13:48:22 | Yardanico | AFAIK Araq prefers ; |
13:48:26 | FromGitter | <mratsim> React, I try to use it a bit but I’m like a super beginner as well. The only way I learn is by doing. |
13:48:40 | FromGitter | <kaushalmodi> @mratsim The thing is that I haven't yet dipped my feet in JavaScript family of languages. So there's a steep learning curve for me.. |
13:48:47 | dom96 | `;` is unambiguous but I hate it |
13:49:07 | Araq | nimpretty uses ';'. You wanted opinionated, you got opinionated |
13:49:14 | FromGitter | <mratsim> ah I see. I’m pretty sure I don’t use Javascript like the rest of the planet anyway |
13:49:33 | Yardanico | time to replace all , with ; in my projects? :D |
13:49:35 | FromGitter | <kaushalmodi> `;` breaks the type propagation in parameters, so its preference between different types parameters makes sense. |
13:49:43 | dom96 | oh god, please change nimpretty |
13:49:49 | FromGitter | <kaushalmodi> Yardanico: No, Not all!! |
13:50:02 | Yardanico | well I like it :P different from other languages |
13:50:17 | PMunch | ; is inconvenient to type on many layouts though.. |
13:50:23 | PMunch | Or at least more inconvenient than , |
13:50:33 | dom96 | `;` only makes sense for implicit generics AFAIK |
13:50:34 | Yardanico | well, of course |
13:50:36 | dom96 | and aren't those now removed? |
13:50:43 | Yardanico | dom96, it also makes sense for "using" |
13:50:43 | FromGitter | <mratsim> what? |
13:51:17 | FromGitter | <mratsim> implicit generics are things like `proc foo(s: seq): auto`? |
13:51:25 | PMunch | Hmm, it seem to get confused around ` in quote do blocks |
13:51:33 | dom96 | no, things like `proc foo(s): auto` |
13:51:40 | Yardanico | these still exist |
13:51:47 | Yardanico | "auto" wasn't removed, was it? |
13:51:54 | Yardanico | ah, I get it |
13:51:57 | dom96 | It wasn't |
13:51:57 | FromGitter | <mratsim> the implicit type of s |
13:51:59 | Yardanico | yeah, typeless arguments were removed |
13:52:15 | Yardanico | but you can use "using" statement to not repeat type in arguments every time |
13:52:27 | Yardanico | so ; is required for it if you have more than 1 argument in your proc |
13:52:46 | PMunch | Yardanico, using statement? |
13:52:49 | Yardanico | PMunch, yes |
13:53:10 | Yardanico | https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement |
13:53:11 | PMunch | Isn't multiple types in the argument list just solved like this: "arg1, arg2, arg3: int, arg4: string" |
13:53:32 | Yardanico | PMunch, well, but what if you don't want to repeat argument type every time (if argument name is the same)? |
13:53:50 | PMunch | Oooh, that's fancy |
13:53:53 | PMunch | Never seen that before |
13:54:00 | dom96 | AFAIK there is absolutely no need for ';' now that typeless args are gone |
13:54:12 | Yardanico | dom96, how would you use https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement without ";" ? |
13:54:52 | dom96 | Huh? The example doesn't even use ';' |
13:55:00 | dom96 | The types are bound to the names |
13:55:04 | dom96 | You don't need ';' |
13:55:11 | FromGitter | <alehander42> no, you do need `;` |
13:55:12 | Yardanico | you do |
13:55:21 | FromGitter | <alehander42> when you have a(b, c: int) |
13:55:25 | Yardanico | "a, b: int" is ambiguos if you made "a" from "using" statement |
13:55:29 | FromGitter | <alehander42> yeah |
13:55:41 | FromGitter | <alehander42> I was suprised too when I found it |
13:56:05 | Yardanico | and btw, very few people even know about the existence of "using" statement :P |
13:56:42 | dom96 | Well, w/e |
13:56:49 | PMunch | For this you need it: http://ix.io/1dUL/ |
13:56:54 | PMunch | But not without arg3 |
13:56:54 | dom96 | We shouldn't be using `;` everywhere for the sake of this tiny feature |
13:56:58 | PMunch | a3, sorry |
13:57:12 | FromGitter | <narimiran> does nimpretty force only one empty line between procs? |
13:57:32 | PMunch | This works: http://ix.io/1dUM/ |
13:57:37 | FromGitter | <alehander42> yeah, nimpretty shouldn't use `;` if possible |
13:57:40 | Yardanico | well, no one said that nimpretty is ready-to-use :P |
13:58:03 | dom96 | There will be a lot of arguments about nimpretty style |
13:58:08 | Yardanico | it's ready-to-test |
13:58:12 | dom96 | Can't wait |
13:58:18 | dom96 | /s |
13:58:39 | FromGitter | <narimiran> great bikeshedding material! |
13:58:53 | Yardanico | dom96, yeah, same as with case insensitivity or space-only indentation |
13:58:54 | PMunch | narimiran, doesn't look like it |
13:59:15 | FromGitter | <ephja> I've started using ";", but "a, b, c: T, d: U" might not be less readable |
13:59:26 | FromGitter | <narimiran> great, then i might use it one day, because sometimes i really need two empty lines, readability-wise |
13:59:45 | dom96 | `type\n FooBar = object` vs. `type FooBar = object` is something that comes to mind |
13:59:48 | PMunch | Is it on purpose that it splits $ calls? e.g. "This is an int: " & $ myIntVariable |
13:59:58 | PMunch | Notice the space between $ and myIntVariable |
14:03:45 | FromGitter | <ephja> many of my procs have generic parameters so I don't have much use for 'using' atm |
14:04:39 | FromGitter | <ephja> btw, who said it was better to have one type for each matrix variation? madness :p |
14:10:55 | FromGitter | <mratsim> a go developer? |
14:11:41 | FromGitter | <ephja> Nim dev :p |
14:11:56 | Araq | PMunch, nah, that's a bug lol |
14:13:00 | FromGitter | <mratsim> When you say “type”, do you mean Matrix\[int32\] vs Matrix\[int64\] vs Matrix\[float32\] or Mat3x3 vs Mat4x4 vs ... |
14:13:12 | FromGitter | <mratsim> or both? |
14:18:34 | PMunch | Araq, ah okay good :P I was scared there for a second. It also seems to be struggling in quote do blocks around ``. It tries to merge things like "var `myVarSym`" into "var`myVarSym`" and split things like "`myVarSym`.coolProc" into "`myVarSym`. coolProc" |
14:20:14 | PMunch | And it turns "cast[pointer](cast[int](buffer) + size))" into "cast[pointer]( cast[int](buffer) + size)" which looks a bit strange |
14:21:35 | * | nc-x joined #nim |
14:22:01 | * | nc-x quit (Client Quit) |
14:24:11 | * | PMunch quit (Quit: Leaving) |
14:27:35 | * | yglukhov[i] quit (Remote host closed the connection) |
14:28:11 | * | yglukhov[i] joined #nim |
14:29:43 | FromGitter | <survivorm> Good thing is to make "sanity check" after such thing - compile and make tests (if any) |
14:30:14 | FromGitter | <survivorm> but for that, nimpretty must know a compilation entry point |
14:31:05 | * | yglukhov[i] quit (Remote host closed the connection) |
14:34:39 | FromGitter | <mratsim> the quasiquoting in quote do ignores dot expression and brackets, it just interpolates with the first found identifier :/ |
14:35:17 | FromGitter | <mratsim> https://github.com/nim-lang/Nim/issues/7726 |
14:36:49 | Yardanico | best way to test nimpretty - test it on the compiler itself and on top 50 nim projects (to ensure that nimpretty doesn't change any semantics) |
14:37:10 | Yardanico | because compiler and most popular nim projects have tests |
14:37:19 | Araq | Yardanico, yeah, that's when I said to myself "time for others to step in" :P |
14:37:27 | dom96 | mratsim: yep, I noticed that too. |
14:47:51 | * | nsf joined #nim |
14:57:39 | * | miran joined #nim |
15:01:53 | * | tax joined #nim |
15:08:56 | FromGitter | <kaushalmodi> @Yardanico @bevo009 How does this look? https://scripter.co/notes/nim/#echo-with-multiple-arguments |
15:09:02 | * | Trustable joined #nim |
15:09:31 | Yardanico | @kaushalmodi that's ok :) |
15:16:32 | * | Trustable quit (Remote host closed the connection) |
15:19:26 | * | Trustable joined #nim |
15:29:45 | * | PMunch joined #nim |
15:32:53 | * | btbytes joined #nim |
15:34:17 | * | yglukhov[i] joined #nim |
15:41:25 | shashlick | so do you have a volunteer for nimpretty already? |
15:43:26 | FromGitter | <ephja> I'll try it |
15:45:11 | * | cspar quit (Ping timeout: 276 seconds) |
15:46:26 | * | cryptocat1094 joined #nim |
15:59:39 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:00:40 | * | btbytes joined #nim |
16:01:38 | * | floppydh quit (Quit: WeeChat 2.1) |
16:13:50 | FromGitter | <mratsim> by the way, why was toOpenArray chosen to have “first + last” parameter instead of “first + len” parameter? @Araq. https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L4215 |
16:16:31 | Araq | because a[x..y] should be transformed into toOpenArray(a, x, y) by a TR macro |
16:16:48 | Araq | and the transformation is easier to get right when it's trivial |
16:21:06 | FromGitter | <mratsim> “[it] is easier to get right when it's trivial” ©Araq |
16:21:12 | FromGitter | <mratsim> =) |
16:25:30 | FromGitter | <Varriount> I <3 toOpenArray |
16:25:35 | FromGitter | <kaushalmodi> Anyone here using Emacs 25+ who can help me out with getting Nim to work with the Emacs Modules feature?: https://github.com/yuutayamada/nim-emacs-module/issues/2 |
16:26:54 | FromGitter | <kaushalmodi> Non-emacs users can also probably help here as this has to do with writing Nim wrappers for C headers. |
16:27:31 | FromGitter | <Vindaar> @kaushalmodi I'll take a look at it tomorrow evening :) |
16:27:46 | FromGitter | <kaushalmodi> @Vindaar Thanks! |
16:28:13 | FromGitter | <kaushalmodi> I'll see what I can learn about C headers and Nim wrappers in the mean time :) |
16:29:11 | FromGitter | <kaushalmodi> Related: I was able to get this tutorial on Emacs Module working: http://diobla.info/blog-archive/modules-tut.html. Now need to translate that to a Nim wrapper based flow. |
16:29:59 | FromGitter | <7sDream> does Nim has tail recursive optimization, or how can I enable it? |
16:30:19 | FromGitter | <kaushalmodi> For when you look at this later.. the no. 1 issue seems that `#include <emacs-module.h>` is not present in the Nim created .c file in the nimcache. |
16:30:50 | * | nsf quit (Quit: WeeChat 2.1) |
16:30:59 | * | cspar joined #nim |
16:43:00 | Yardanico | @7sDream C compiler has it |
16:43:05 | Yardanico | it's enabled in release mode |
16:43:10 | Yardanico | well, not all C compiler have it |
16:43:27 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:44:14 | FromGitter | <7sDream> let my try ... I use 7.2 |
16:45:22 | FromGitter | <7sDream> yes, confirm it |
16:45:52 | * | leru_ quit (Remote host closed the connection) |
16:46:00 | FromGitter | <7sDream> `-d:release` enable it in my condition |
16:46:17 | FromGitter | <ephja> what prevents range references from being implemented without compiler support? |
16:46:32 | FromGitter | <7sDream> So, I think I need to use -d:release everytime, otherwise my program will stack overflow....... |
16:47:47 | Yardanico | well, main rule - don't write recursive stuff, it's not very important |
16:47:59 | Yardanico | *it's not really needed |
16:48:21 | FromGitter | <Varriount> Plus, recursive algorithms are usually harder to understand. |
16:49:30 | * | tax quit (Quit: Leaving) |
16:49:45 | Araq | 7zsDream: --stackTrace:off also does the trick |
16:52:05 | FromGitter | <mratsim> I don’t agree that recursion is harder. |
16:52:22 | FromGitter | <mratsim> for/while hides the intent of the code |
16:52:35 | FromGitter | <mratsim> @7sDream - check this thread: https://forum.nim-lang.org/t/3931 |
16:52:39 | Araq | recursion is harder. |
16:52:49 | * | btbytes joined #nim |
16:53:01 | Araq | create a non-trival O(?) behaviour with for loops |
16:53:04 | FromGitter | <7sDream> I will look |
16:53:11 | Araq | and try the same with recursion. |
16:53:27 | Araq | with recursion it's easy to do. I doubt it can be done with for loops |
16:53:38 | FromGitter | <mratsim> I wasn’t talking about optimization, I was talking about understanding |
16:53:59 | FromGitter | <7sDream> am trying to use Nim to introduce some functional concepts, so temporary recursion is important to me. Although I usually use it rarely |
16:54:00 | Araq | what is harder to analyse can't be easier to understand |
16:54:24 | FromGitter | <mratsim> Maths disagree with you :p |
16:54:36 | FromGitter | <Vindaar> I agree with @mratsim. Some things are just nicer in a recursive fashion (e.g. Fibonacci) |
16:55:03 | FromGitter | <mratsim> some concepts are easy to grasp and hard to implement right |
16:55:06 | Araq | which branch of maths? the one that uses ∑ over recursion? :P |
16:56:26 | FromGitter | <mratsim> @7sDream - https://github.com/vegansk/nimfp or https://github.com/alehander42/zero-functional, I also did my nim project euler solutions using a functional approach: https://github.com/mratsim/nim-projecteuler though note that those were done in my first weeks of Nim so ... |
16:57:13 | FromGitter | <7sDream> Awesome, I will check them! |
16:57:34 | Araq | in the Nim compiler we have plenty of run-away recursions. these all need to be protected by internal counters |
16:57:55 | Yardanico | so am I correct that the most part of https://github.com/alehander42/zero-functional repo is benchmarks in C++ ? :P |
16:58:00 | Araq | problem is these cannot written iteratively. |
16:58:05 | Yardanico | (comparing C++ vs nim) |
16:58:20 | Araq | but recursion is pretty far from an "elegant" solution IMO. |
16:58:28 | FromGitter | <mratsim> well it’s just that C++ is taht verbose :p |
16:59:09 | * | cspar quit (Ping timeout: 264 seconds) |
17:00:50 | FromGitter | <mratsim> This is my latest recursive proc: https://github.com/status-im/nim-stint/blob/master/stint/private/as_words.nim#L15-L30, to work on a recursive type UintImpl of UintImpl of UintImpl … with lo, hi: uint64 at the very end. |
17:01:39 | FromGitter | <mratsim> basically a binary tree, an iterative proc would be harder to follow in my opinion |
17:03:05 | FromGitter | <mratsim> this is similar to “traverse all the leaves of a binary tree in order" |
17:03:15 | Araq | well there is some merit in using the call stack instead of an explicit stack. |
17:03:39 | Araq | the problem is that the implicit stack tends to break far more quickly in a production setting |
17:03:54 | Araq | as you have little to no control over it. |
17:04:02 | FromGitter | <mratsim> I don’t need 2000 stack limit ;) |
17:04:35 | FromGitter | <mratsim> but I agree |
17:24:00 | isene | nimcache is created in my home directory. Can I make nim create it in another location (permanently)? |
17:24:55 | FromGitter | <Varriount> @7sDream You can also enable just tail call optimization using `-foptimize-sibling-calls` I think. |
17:25:04 | dom96 | isene: https://forum.nim-lang.org/t/3897 |
17:26:51 | Yardanico | dom96, btw, about https://forum.nim-lang.org/t/3946 - isn't it possible to implement (maybe in future) separation of login and display name? So by default every user will have his display name = login, but he can change that |
17:27:11 | dom96 | Why wouldn't it be possible? |
17:27:28 | FromGitter | <ephja> SSDs seem to have been able to endure a huge amount of writes for many years now |
17:27:39 | dom96 | I guess what you're asking is whether it's something I would do |
17:27:46 | dom96 | Not in the foreseeable future |
17:28:28 | dom96 | The reason I don't allow nickname changes is because it breaks mentions |
17:28:34 | dom96 | a display name wouldn't solve this |
17:29:53 | FromGitter | <7sDream> @Varriount `-t:-foptimize-sibling-calls` add the opt arg to gcc |
17:30:37 | FromGitter | <7sDream> but when not in release mode, nim gen code for debug info, and the code can't be optimization |
17:30:46 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:31:03 | FromGitter | <7sDream> Just tried |
17:31:22 | * | btbytes joined #nim |
17:31:35 | * | btbytes quit (Client Quit) |
17:32:25 | FromGitter | <7sDream> (https://files.gitter.im/nim-lang/Nim/pWsG/image.png) |
17:32:26 | * | cspar joined #nim |
17:33:10 | Yardanico | @7sDream did you do "--stacktrace:off" as Araq told you? |
17:34:22 | FromGitter | <7sDream> No, let me try now |
17:35:25 | * | btbytes joined #nim |
17:35:52 | cryptocat1094 | How is `parallel' implemented? |
17:36:06 | FromGitter | <7sDream> stacktrace take me to a Segmentation fault :/ |
17:36:27 | FromGitter | <7sDream> will give you a online MWE, wait me |
17:36:34 | Yardanico | with -t:-foptimize-sibling-calls ? |
17:36:46 | FromGitter | <7sDream> even without it |
17:37:11 | FromGitter | <7sDream> but `-d:release ` works well |
17:37:58 | FromDiscord | <treeform> is there a doc on how to use nimpretty? |
17:38:20 | Yardanico | not yet because it's not yet complete. you can just compile it (it's in tools folder), and then run it on your file |
17:38:37 | FromDiscord | <treeform> ok |
17:39:25 | FromDiscord | <treeform> I really hope nimpretty is good, for the little go I did i really liked the idea of go's fmt, no more syntax bike shedding. |
17:39:39 | Yardanico | well, try it, it has bugs |
17:39:52 | Yardanico | and you can help by reporting them :P |
17:40:49 | * | xet7 quit (Remote host closed the connection) |
17:41:27 | FromGitter | <ephja> -funrolls \o/ |
17:42:02 | Araq | I'm adding my nimpretty tests |
17:42:40 | Araq | the reported bugs are easy |
17:42:45 | FromDiscord | <treeform> nice, I would like to help with nimpretty |
17:43:21 | FromDiscord | <treeform> hmm i ran the current devel version, it says a bunch of "Hint: line too long [LineTooLong]" |
17:43:23 | dom96 | oh we will bikeshed |
17:43:24 | FromDiscord | <treeform> but does not reformat the file |
17:43:32 | dom96 | bikeshed about what nimpretty should do :) |
17:44:37 | FromDiscord | <treeform> the idea with a code formatter is that all bikeshedding goes critical and condenses into a black hole never to come out again. |
17:45:44 | FromDiscord | <treeform> does it supposed to only complain? or does it actually reformats stuff? |
17:45:49 | Yardanico | it does |
17:45:51 | Yardanico | look in files |
17:46:03 | FromDiscord | <treeform> oh it does not replace, i see now |
17:46:15 | FromGitter | <ephja> not a fan of Foo[A, B, C,\nD,...] if it's not vertical aligned but w/e as long as it's consistent. it does break slightly before 80 columns though |
17:46:29 | FromGitter | <7sDream> interesting, it fails only when the recursive more then 87320 times... |
17:46:41 | Yardanico | Araq, by the way, why does it make a backup if it doesn't overwrite the file? |
17:46:52 | Araq | because I'm changing it |
17:47:00 | Araq | it will soon overwrite the file |
17:47:37 | Yardanico | Araq, also it seems that nimpretty inserts a space before "import a, b, c d" if it's on the first line |
17:47:42 | Araq | how can we ensure 'nimpretty' was run over the file in PRs? |
17:48:53 | Yardanico | well, that's not the simplest thing - maybe we can use github webhooks to check that? |
17:49:26 | * | nsf joined #nim |
17:50:33 | FromGitter | <ephja> will it not show LineTooLong eventually? |
17:50:51 | cryptocat1094 | Hm, why is "parallel"'s implementation empty? |
17:50:51 | FromDiscord | <treeform> yeah so it created a ton of syntax errors ... |
17:51:13 | Araq | :-) |
17:51:23 | Araq | treeform, can you gist your testfile? |
17:51:52 | FromDiscord | <treeform> no its a private file, but I will get the errors to you |
17:51:57 | FromDiscord | <treeform> they are all around comments |
17:52:55 | Yardanico | Araq, it replaced proc `cookies=` with proc `cookies = ` (although it still works), is that correct? |
17:53:05 | Yardanico | I always though that you need to write it without spaces :D |
17:53:12 | Yardanico | (and it won't work otherwise) |
17:53:20 | Yardanico | But it seems like it's more flexible |
17:53:32 | Araq | the backticks work badly in general :P |
17:53:37 | * | Trustable quit (Remote host closed the connection) |
17:57:06 | FromDiscord | <treeform> Araq, https://gist.github.com/treeform/dd1fe2078714c0aa5e732902f8765c0c |
17:57:13 | FromDiscord | <treeform> its comments are tipping it up |
17:58:30 | Yardanico | Araq, ok, found another issue with comments - https://gist.github.com/Yardanico/4cc4e54b75dd25a40038d8a79d56774e . nimpretty moves # (normal comment) on the same line to the doc comment |
18:00:09 | dom96 | Araq: cp module.nim module.nim.old && nimpretty module.nim && diff module.nim module.nim.old | wc -l # Check that this isn't above some value |
18:01:16 | isene | New to nim. Excuse my ignorance. How do I use the Mersenne Twister (https://nim-lang.org/docs/mersenne.html#getNum,MersenneTwister) to generate a random number from 1 to 6 (a dice roll)? |
18:01:27 | Yardanico | isene, you can use random module for stuff like that |
18:02:00 | Yardanico | !eval import random; echo(rand(5) + 1) |
18:02:03 | NimBot | 6 |
18:02:09 | Yardanico | or, if you really want to use mersenne twister |
18:02:17 | isene | Yardanico: Nope - the random module gives a very poor random distribution... very poor. |
18:02:34 | Yardanico | did you do "randomize()"? |
18:02:39 | isene | Yup |
18:02:50 | Yardanico | Well, as docs say in https://nim-lang.org/docs/mersenne.html#getNum,MersenneTwister |
18:02:59 | Yardanico | 1) create an object holding mersenne twister state |
18:03:09 | Yardanico | like "let myrng = newMersenneTwister(myseed)" |
18:03:25 | Yardanico | and then get random number from 0 to uint32 with myrng.getNum() |
18:03:28 | isene | What I am wondering is how to get the result to be 1-6 |
18:04:05 | Yardanico | hmm |
18:04:09 | FromGitter | <7sDream> @Yardanico https://glot.io/snippets/f24z1p4ybv , the MWE of the segmentation fault caused by `--stacktrace:off` |
18:04:39 | FromGitter | <7sDream> work well when use `-d:release` |
18:04:53 | FromGitter | <7sDream> cc @Araq |
18:05:29 | Araq | isene: very poor? it uses a state-of-the-art algorithm |
18:08:10 | Araq | !eval import random; echo(rand(1..6)) |
18:08:13 | NimBot | 6 |
18:08:17 | Araq | !eval import random; echo(rand(1..6)) |
18:08:20 | NimBot | 6 |
18:08:22 | Yardanico | Araq, you're not calling randomize() :) |
18:08:31 | Yardanico | !eval import random; randomize(); echo(rand(1..6)) |
18:08:33 | Araq | !eval import random; randomize(); echo(rand(1..6)) |
18:08:34 | NimBot | 4 |
18:08:36 | NimBot | 6 |
18:08:41 | Araq | !eval import random; randomize(); echo(rand(1..6)) |
18:08:44 | NimBot | 1 |
18:08:46 | Araq | !eval import random; randomize(); echo(rand(1..6)) |
18:08:47 | NimBot | Compile failed: <no output> |
18:08:51 | Araq | lol |
18:08:57 | Araq | !eval import random; randomize(); echo(rand(1..6)) |
18:09:00 | NimBot | 2 |
18:09:27 | Araq | it's super random, even crashes randomly |
18:09:29 | FromGitter | <ephja> it's kind of subjective, but it does seem decent considering the small state space. I wonder what his use case is |
18:09:42 | Araq | !eval import random; randomize(); echo(rand(1..6)) |
18:09:45 | NimBot | 2 |
18:10:14 | Araq | no! that should have been 3 here! |
18:10:21 | Araq | ;-) |
18:11:38 | FromGitter | <ephja> this is with different seeds every time though, but at least we can deduce that it doesn't do "return 4"! |
18:11:51 | FromGitter | <Vindaar> @isene: something like this should work: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ plotting the distributions shows it's pretty flat. Not entirely sure, if that naive division introduces any bias (not working on stuff like that usually..). Highest bin is 166,973, lowest 166,414. Guess that is a reasonable deviation based on statistics.. [https://gitter.im/nim-lang/Nim?at=5b2947675862c35f47b218d9] |
18:16:04 | FromGitter | <Vindaar> (ok, if you want them as ints, you still need to round those floats of course |
18:16:07 | FromGitter | <Vindaar> ) |
18:16:15 | isene | The use case is this: http://isene.org/cgi-bin/O6.rb (written in Fortran - looking to rewrite in nim) |
18:16:55 | miran | isene: how/why is std.random bad for this? |
18:17:07 | dom96 | !eval import random; randomize(); for i in 0..3: echo(rand(1..6)) |
18:17:09 | NimBot | 1↵5↵4↵2 |
18:17:22 | dom96 | seems random enough to me |
18:18:41 | Araq | dom96: well there are books written about this subject. ;-) |
18:18:46 | FromGitter | <mratsim> @isene, MersenneTwister is a flawed PRNG, really, don’t use it |
18:19:08 | isene | With this code (http://dpaste.com/07DQZVZ) I got crazy results (like 39 critical and -21 fumble) within just a few tries (chances of me getting hit by a meteor in the meantime is slightly bigger) |
18:19:14 | FromGitter | <ephja> I thought he was using the 'random' module (xoroshiro128+) |
18:19:42 | FromGitter | <ephja> yeah, he is |
18:19:44 | dom96 | isene: Maybe only call `randomize` once at the start |
18:19:55 | FromGitter | <mratsim> yes |
18:20:01 | miran | dom96: this is the first thing i noticed too |
18:20:02 | Araq | yeah, don't call randomize() in this way |
18:20:10 | FromGitter | <mratsim> randomize is to get an initial seed |
18:20:15 | Araq | it makes things far worse than calling it once |
18:20:17 | FromGitter | <mratsim> you are initializing the seed every time |
18:20:31 | isene | So, that's what's wrong? |
18:20:41 | FromGitter | <mratsim> you might as well read from /dev/urandom in that case |
18:20:41 | dom96 | Honestly, I have to wonder, why do we force users to call `randomize`? |
18:20:48 | FromGitter | <kaushalmodi> Jumping on this `randomize` train.. I was surprised too when I realized that that was needed |
18:20:57 | dom96 | It's not intuitive at all |
18:21:00 | FromGitter | <kaushalmodi> https://scripter.co/notes/nim/#call-randomize-before-rand |
18:21:17 | FromGitter | <mratsim> for me it’s intuitive :? |
18:21:21 | miran | so something like: either supply a seed, or randomize is called for you? |
18:21:22 | FromGitter | <7sDream> like `srand(time(NULL))` in c... |
18:21:34 | FromGitter | <kaushalmodi> > It's not intuitive at all ⏎ ⏎ +1 |
18:21:44 | Araq | we checked the other languages. |
18:21:54 | Araq | some default to an implicit randomize(), some don't. |
18:22:00 | isene | So, any suggestions as to what I should do there? |
18:22:04 | FromGitter | <mratsim> in Machine learning and Monte Carlo simulation we always initialize with random_seed(foobar) or call a randomize function |
18:22:25 | FromGitter | <mratsim> call randomize() in the global scope remove it from your D function |
18:22:29 | miran | isene: put `randomize` after the import, and then test it on 1_000_000 samples? :) |
18:22:36 | FromGitter | <ephja> yes but this relies on a global variable for convenience |
18:22:40 | isene | miran: ok |
18:22:59 | * | endragor joined #nim |
18:23:10 | * | Vladar quit (Quit: Leaving) |
18:23:13 | FromGitter | <kaushalmodi> @mratsim You can still set a fixed seed using `randomize(foobar)` |
18:23:17 | FromGitter | <mratsim> @ephja there is no way around having a global to hold the state |
18:23:23 | Araq | I think it's fair that the non-determinism between program runs is not done implicitly |
18:23:29 | FromGitter | <mratsim> ^ |
18:24:14 | dom96 | Hrm, I dunno. People expect `random` to give random results. |
18:24:19 | FromGitter | <mratsim> @kaushalmodi I know, what I mean is that calling randomize() manually to source from /dev/urandom is not unintuitive in all domains |
18:24:39 | Araq | it does give random results. |
18:24:47 | FromGitter | <kayabaNerve> dom96: I thought it always returned 4 |
18:24:50 | dom96 | They already know that they need to set the seed to something deterministic when testing. |
18:24:57 | FromGitter | <mratsim> xkcd? :P |
18:25:02 | FromGitter | <kayabaNerve> @mratsim Ofc |
18:25:43 | FromGitter | <ephja> 5 is more random I think |
18:26:17 | miran | agree with dom96 |
18:26:57 | FromGitter | <mratsim> I don’t really care =) |
18:27:17 | * | endragor quit (Ping timeout: 245 seconds) |
18:27:25 | isene | YEAY! Seems to work just fine now. Thanks guys :-) |
18:27:49 | Araq | here is an objective argument: |
18:27:52 | Araq | proc randomize*() {.benign.} = |
18:27:52 | Araq | ## Initializes the random number generator with a "random" |
18:27:52 | Araq | ## number, i.e. a tickcount. Note: Does not work for NimScript. |
18:27:54 | Araq | let now = times.getTime() |
18:27:56 | Araq | randomize(convert(Seconds, Nanoseconds, now.toUnix) + now.nanosecond) |
18:28:03 | miran | nobody would put `seed(42)` into a loop or function that is called repeteately, while, as we can see, somebody does that with `randomize` |
18:28:07 | Araq | is impossible to optimize out if called implicitly. |
18:28:33 | Araq | miran: that only means we should rename randomize() to something better. |
18:28:44 | dom96 | here is an objective argument: isene wouldn't need help if this was implicit |
18:28:46 | FromGitter | <mratsim> random_seed |
18:28:54 | Araq | that means if called implicitly, I import random and the time based stuff ends up in my .exe |
18:29:06 | Araq | whether I need it or not. |
18:29:07 | FromGitter | <ephja> I like implicit determinism |
18:29:16 | FromGitter | <mratsim> here is an objective argument: isene wouldn’t need help if there was an “How to use this library” ;) |
18:29:30 | miran | @ephja: i do too - when i'm not importing `random` ;) |
18:30:04 | FromGitter | <mratsim> so RFC? |
18:30:13 | FromGitter | <mratsim> (going out so not me) |
18:30:24 | FromGitter | <kaushalmodi> > RFC? ⏎ ⏎ yes please. I have +1 for actual randomization :) |
18:30:52 | Araq | so rename randomize() to setSeedFromCurrentTime() |
18:31:08 | FromGitter | <kaushalmodi> Araq: how about setRandSeed |
18:31:21 | Araq | but don't call it implicitly, can't optimize it out then |
18:31:42 | FromGitter | <kaushalmodi> A perspective from another language: SystemVerilog.. randomization is implicit |
18:32:01 | FromGitter | <kaushalmodi> Users wanting determinism pass a `-seed=NNN` switch |
18:32:20 | Araq | nothing that was said here addresses my dead-code-elimination point. |
18:32:55 | dom96 | Araq: Call it in `rand`? |
18:33:08 | dom96 | instead of globally? |
18:33:16 | FromGitter | <kaushalmodi> Araq: Can something like `when defined(seed):` optimize this? |
18:33:22 | dom96 | As far as languages go, I bet Python does it implicitly |
18:33:27 | Yardanico | of course |
18:33:28 | isene | In Julia it is implicit. In Fortran it depends on the implementation (in gfortran it is implicit) |
18:33:30 | miran | dom96: yup |
18:33:37 | Araq | and C++ doesn't. |
18:33:41 | Yardanico | dom96, "explicit is better than implicit" and they do it :) |
18:33:45 | dom96 | #ImplicitClub :P |
18:33:57 | Araq | real systems programming languages don't do it :P |
18:34:01 | FromGitter | <ephja> dom96: call it there just the first time or what? o.O |
18:34:07 | dom96 | ephja: yep |
18:34:14 | dom96 | Easy to store a flag somewhere |
18:34:15 | isene | Araq: Fortran is more real than Real ;-P |
18:34:25 | dom96 | Araq: So did I solve your dead-code-elim problem? |
18:34:36 | miran | you imported `random` - you want random stuff. if you want "deterministic random" - set a seed yourself. #implicitClub |
18:34:40 | Araq | you did, but your suggestion is terrible :P |
18:34:56 | dom96 | Sounds like a subjective opinion to me |
18:34:58 | Araq | and in fact |
18:35:01 | Araq | you're wrong |
18:35:12 | dom96 | Don't devolve your objective argument into subjectivity :P |
18:35:16 | Araq | obviously I want to call 'rand' when I import the module |
18:35:25 | Araq | but I don't necessarily want the time dependency |
18:35:41 | Araq | and yet you add it. |
18:35:51 | dom96 | so add a `seed` parameter to `rand` |
18:35:57 | Araq | so ... no, you haven't addresses it |
18:36:02 | dom96 | *optional parameter |
18:36:16 | isene | I'm glad I started a discussion :-) |
18:36:25 | Araq | you know the state can be passed explicitly already, right? |
18:36:36 | miran | isene: oh, discussions are what we are best at |
18:36:53 | miran | the results for these discussions? not so much.... :) |
18:37:08 | Araq | in the end we deprecate useful features. |
18:37:09 | miran | *for -> from |
18:37:34 | Araq | because somebody out there "misused" it, didn't read the docs or something similar |
18:37:45 | dom96 | An API shouldn't be so easy to misuse |
18:37:56 | dom96 | Everybody stumbles upon this |
18:37:58 | dom96 | Even I did |
18:38:18 | dom96 | And the problems you are coming up with can be fixed easily |
18:38:33 | dom96 | The evidence is there that this is causing issues for people |
18:45:44 | FromGitter | <Vindaar> I don't want to interrupt your important (:P) discussion, but a question regarding C FFI: If I have a proc with a `ptr cdouble` argument (as a Nim proc, which is handed to C), how do I get an unchecked array from the `ptr`? |
18:46:12 | FromGitter | <ephja> but very few people need determinism so if you can signal it explicitly then that's fine imo. anyway, creating your own global would involve very little work |
18:46:29 | Yardanico | @Vindaar maybe https://forum.nim-lang.org/t/3893#24246 can help ? |
18:46:57 | FromGitter | <Vindaar> Yardanico: thanks, I'll take a look |
18:47:01 | FromGitter | <ephja> you could specify an arbitrarily large array size |
18:47:38 | Araq | whatever, I gave an objective reason, you haven't solved it and I don't agree that "X stumbled upon this" when we don't know how many DIDN'T stumble upon this is a good way to deal with these things. |
18:50:06 | Araq | if Visual Basic programmer migrate to Nim and struggle with 'var' vs 'let' do we then create an RFC that 'let' should be removed from the language? |
18:50:28 | Araq | because there is evidence that it is causing issues for people? |
18:50:37 | Yardanico | Araq, I wonder how much Node people will struggle with "const" :P |
18:50:40 | Yardanico | in Nim |
18:50:51 | FromGitter | <Vindaar> Yardanico: thanks, that works perfectly fine :) For some reason I didn't think about trying ptr UncheckedArray, hehe. |
18:50:58 | Yardanico | well, not node programmers, but js programmers |
18:52:10 | FromGitter | <kaushalmodi> OK, this rand discussion is going off track.. the let/var/const etc are language concepts.. whereas to me, a rand() proc produces random output unconditionally. Currently the condition is that randomize() be called first. |
18:52:27 | Yardanico | I usually call randomize() after import |
18:53:15 | FromGitter | <kaushalmodi> To me a rand() should be deterministic only if the user intentionally wanted so.. by intensionally setting a seed. |
18:55:11 | FromDiscord | <treeform> I agree with all of you guys. |
18:55:42 | FromDiscord | <treeform> both setting seed at start and not setting seed at start are valid options with good arguments. |
18:56:15 | FromDiscord | <treeform> its in the docs what it does, so both ways are fine with me. |
19:00:53 | FromGitter | <kaushalmodi> Windows Console users: Is it safe to assume the default foreground to be white, and default background to be black? I googled around, but couldn't find anything conclusive. |
19:01:26 | * | jjido joined #nim |
19:02:28 | FromGitter | <kaushalmodi> Ref: https://github.com/nim-lang/Nim/pull/8073 |
19:04:39 | * | noonien quit (Quit: Connection closed for inactivity) |
19:04:45 | FromGitter | <zetashift> I use cmder and the default foreground color is white\green and the console background is black/transparenty |
19:05:10 | FromGitter | <zetashift> but cmder just uses conemu/cmd.exe so in general I think it'll be black and white |
19:06:05 | Araq | why do you need to assume anything? |
19:06:26 | FromGitter | <ephja> @zetashift by default? I see cmd/bash/powershell listed |
19:07:01 | FromGitter | <ephja> unless it's spawning children from cmd or something |
19:08:17 | FromGitter | <zetashift> yea by default |
19:09:38 | FromGitter | <kaushalmodi> Araq: I cannot figure out from the API how to set the console's default fg/bg |
19:09:52 | FromGitter | <kaushalmodi> https://docs.microsoft.com/en-us/windows/console/setconsoletextattribute |
19:10:05 | FromGitter | <kaushalmodi> .. and I don't use Windows.. just trying to improve that PR |
19:10:29 | FromGitter | <Vindaar> Doesn't PowerShell use blue background + white font by default? |
19:10:36 | FromGitter | <ephja> setForegroundColor/setBackgroundColor on stdout? |
19:11:01 | FromGitter | <kaushalmodi> @ephja Yes, this is about figuring out the default fg/bg values |
19:11:13 | FromGitter | <kaushalmodi> See that PR |
19:13:51 | Yardanico | @kaushalmodi do you understand that people can change their background color almost in every terminal? |
19:15:07 | Yardanico | even in windows cmd |
19:15:12 | FromGitter | <kaushalmodi> Yardanico: I do.. so am asking for help from folks familiar with Windows Console |
19:19:14 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:22:52 | FromGitter | <ephja> "To reset colors to their defaults, use ESC[39;49m (not supported on some terminals), or reset all attributes with ESC[0m. Later terminals added the ability to directly specify the "bright" colors with 90-97 and 100-107." |
19:23:55 | FromGitter | <kaushalmodi> The PR adds the ESC[39;49m support.. I am trying to do the equivalent thing for Windows |
19:24:27 | FromGitter | <kaushalmodi> The resetting using ESC[0m and bright color support is already there in terminal.nim. |
19:27:05 | FromGitter | <kaushalmodi> Yardanico: The PR sets fg to white and bg to black only if user uses the new fgDefault and bgDefault enum vals on Windows. On non-Windows, those enums do the "right thing" i.e. use the 39/49 esc values |
19:28:05 | FromGitter | <kaushalmodi> The right thing for Windows Console behavior would be to somehow get the fg/bg defaults that the user customized.. but I cannot figure out how to do that. |
19:30:56 | FromGitter | <ephja> https://github.com/nim-lang/Nim/blob/master/lib/pure/terminal.nim#L201 that's not quite the same thing though |
19:32:04 | FromGitter | <ephja> if it's not process-dependent |
19:32:10 | FromGitter | <kaushalmodi> right? |
19:32:38 | FromGitter | <ephja> I think so, which is why it's being called at the module scope |
19:33:01 | FromGitter | <kaushalmodi> @ephja I want to do the stuff in Windows like I do in this screenshot: https://github.com/nim-lang/Nim/pull/8073#issue-195901217 |
19:33:35 | FromGitter | <kaushalmodi> There should be some "default" fg/bg to fall back to when I want to retain just the styles(bold, italics, etc.) |
19:34:03 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:34:36 | FromGitter | <kaushalmodi> notice how the `fgDefault` in `fgRed, "red text ", styleBright, "bold red", fgDefault, " bold text"` brings only the fg color to the default value, leaving that bold style untouched. |
19:35:10 | Araq | kaushalmodi: I can see to make your code work on windows, but I don't remember the Win API details |
19:36:04 | * | jjido joined #nim |
19:36:22 | FromGitter | <kaushalmodi> @Varriount you mean assign the "default" fg/bg colors to `let` vars in the body of `terminal` module? |
19:37:39 | FromGitter | <kaushalmodi> But then I cannot leave the `lookup` as constants inside `setForegroundColor` and `setBackgroundColor`.. hmm |
19:39:01 | FromGitter | <kaushalmodi> Araq: Thanks. All I got was this: https://docs.microsoft.com/en-us/windows/console/setconsoletextattribute |
19:39:58 | * | jjido quit (Client Quit) |
19:40:24 | * | beatmox quit (Remote host closed the connection) |
19:40:32 | Araq | https://docs.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo |
19:40:54 | Araq | https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str has the field WORD wAttributes; |
19:40:55 | * | beatmox joined #nim |
19:41:49 | Araq | so you need to OR this word with your foreground color word. or something like this |
19:43:13 | FromGitter | <kaushalmodi> Araq: Setting the fg color is understood. The unknown is figuring out the default fg/bg colors |
19:43:39 | FromGitter | <kaushalmodi> What @Varriount suggested would work.. but I'd rather have someone with a Windows devel env implement that |
19:47:08 | elrood | you cannot rely on any "default" colour scheme anyway |
19:50:35 | FromGitter | <kaushalmodi> elrood: Atleast it works quite fine on GNU/Linux systems |
19:50:44 | FromGitter | <kaushalmodi> (https://files.gitter.im/nim-lang/Nim/XQkf/image.png) |
19:50:53 | * | yglukhov[i] quit (Ping timeout: 256 seconds) |
19:52:28 | FromGitter | <kaushalmodi> here I changed the default fg/bg to black/green (I know.. not pretty.. just to test this :P), and the 39/49 escape codes worked great! |
19:53:15 | FromGitter | <kaushalmodi> Here's with my usual defaults (white/black): |
19:53:23 | FromGitter | <kaushalmodi> (https://files.gitter.im/nim-lang/Nim/EAAT/image.png) |
19:53:55 | FromGitter | <kaushalmodi> The last parts "bold text" is where I use the new enums (in that PR) `fgDefault` and `bgDefault` |
20:08:22 | FromGitter | <tim-st> how does this work? https://nim-lang.org/docs/macros.html#statements-assignment |
20:08:36 | FromGitter | <tim-st> I have `import macros` and `var stmtList = newNimNode(nnkStmtList)` |
20:08:51 | FromGitter | <tim-st> then can I add the code to the stmtList? |
20:10:22 | FromGitter | <tim-st> Oh, I got it... |
20:14:21 | FromGitter | <tim-st> No, doesnt work, these single example code with `AST:` in front are not really helpful since they dont work... |
20:14:39 | FromGitter | <tim-st> (out of the box) |
20:15:11 | * | dzho is now known as deejoe |
20:15:15 | * | deejoe is now known as dzho |
20:18:18 | dom96 | yeah, they're confusing |
20:18:47 | dom96 | The syntax is: newTree(nnkStmtList, newTree(nnkBlock, ...)) |
20:18:58 | dom96 | vs. nnkStmtList(nnkBlock(...)) |
20:19:03 | FromGitter | <tim-st> thanks, tree in front makes sense^^ |
20:20:42 | FromGitter | <tim-st> but it's extremely useful to transpile to nim using this AST |
20:32:22 | * | jjido joined #nim |
20:35:37 | * | miran quit (Ping timeout: 260 seconds) |
20:57:33 | * | cryptocat1094 quit (Quit: later) |
21:08:13 | * | nsf quit (Quit: WeeChat 2.1) |
21:12:05 | * | btbytes joined #nim |
21:13:35 | Araq | boo! triggered! "transpile" detected :D |
21:14:37 | FromGitter | <tim-st> but to nim this time^^ |
21:14:44 | Araq | oh well. new policy. don't talk about the word "transpile" in #nim. People are free to use it and will secretly gain negative points :P |
21:15:35 | FromGitter | <tim-st> I think it was another person that introduced the word today^^ |
21:15:45 | Araq | the persons who get more than 4 negative points need to send me some local brand of beer |
21:16:00 | Araq | or tea. |
21:16:12 | FromGitter | <tim-st> I think about adding the word to my adblock |
21:18:33 | FromGitter | <Vindaar> Sweeeeet! Wrapped cMPFIT and managed to write a wrapper that's super simple to use for it :D I won't be dependent on curve_fit anymore, yay. Will clean it up tomorrow and create a nimble package :) |
21:19:30 | FromGitter | <tim-st> btw I thought nim was case insensitive, but I can do `type Type = object` ? |
21:20:03 | FromGitter | <Vindaar> @tim-st it's case insensitive except for the first letter! |
21:20:19 | FromGitter | <tim-st> ah, good to know, thanks |
21:20:49 | Araq | yeah. and eventually we will have tooling that makes use of this feature. |
21:22:21 | elrood | ← might have already qualified. any preference as to which kind of beer or tea? |
21:25:09 | Araq | no dark beer please and no fruity teas |
21:28:05 | FromGitter | <Varriount> Aw, I like fruit teas |
21:29:56 | * | find0x90 joined #nim |
21:30:45 | dom96 | Maybe I should get NimBot to make noises when someone says "transpile" :P |
21:31:45 | FromGitter | <Varriount> @kaushalmodi I can test any code you write on Windows |
21:32:02 | * | enthus1ast quit (Ping timeout: 260 seconds) |
21:33:30 | * | enthus1ast joined #nim |
21:43:29 | * | NimBot joined #nim |
21:51:36 | FromGitter | <Systra72_twitter> What is the reason fmt (in strformat) do not accept any string, only raw string literals? |
21:56:10 | * | btbytes quit (Quit: Textual IRC Client: www.textualapp.com) |
21:56:18 | FromGitter | <kaushalmodi> @Varriount Done! 100% Windows untested commit added to #8073; only tested to compile in GNU/Linux :) |
22:03:52 | * | elrood quit (Quit: Leaving) |
22:07:33 | FromGitter | <mratsim> @Vindaar cast\[ptr UncheckedArray\cdouble\ (yourCpointer) |
22:07:43 | FromGitter | <mratsim> ah I’m missing a bracket |
22:09:05 | * | find0x90 quit (Quit: find0x90) |
22:09:12 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:10:05 | * | jjido joined #nim |
22:11:40 | FromGitter | <Vindaar> @mratsim Yep, thanks! yardanico sent me a link to the forums. My issue was that I didn't think I had to cast it to a `ptr UncheckedArray`. I only tried a raw `UncheckedArray`. |
22:15:42 | FromGitter | <mratsim> If you have issue interfacing with C, it’s probably already solved in Arraymancer ;) https://github.com/mratsim/Arraymancer/blob/master/src/tensor/data_structure.nim#L216 |
22:19:50 | FromGitter | <Vindaar> Hehe, you're right. And indeed I've looked at the Arraymancer's source often enough. For some reason I didn't think about it for this though :) |
22:20:56 | * | jjido quit (Ping timeout: 256 seconds) |
22:22:36 | xomachine[m] | I've just found that at latest versions of Nim in the devel branch, the Nim compiler adds ".exe" to the underlying C compiler when --os:windows. Why it has been done? Is there a way to avoid it (I use winegcc on linux with --os:windows, and this change breaks my stuff) |
22:32:36 | * | PMunch quit (Quit: leaving) |
22:36:46 | FromDiscord | <2vg> Is nest stable? |
22:36:46 | FromDiscord | <2vg> I look like a very nice routing module. |
22:36:47 | FromDiscord | <2vg> |
22:36:47 | FromDiscord | <2vg> https://github.com/kedean/nest |
22:42:31 | Araq | Systra72_twitter because the format string is parsed at compile-time. |
22:42:51 | Araq | xomachine[m]: it always did that afaict. |
22:43:26 | Araq | or maybe it is an oversight caused by the massive refactorings in the compiler's code |
23:17:29 | * | cspar quit (Ping timeout: 276 seconds) |
23:42:32 | FromGitter | <Varriount> 2vg: Any documentation? |
23:46:46 | FromGitter | <fedkanaut> How do you transmit arguments using the events library? The compiler doesn't like it when I use an inheritee of EventArgs for my callback's arguments. |