00:09:07 | * | alexday joined #nim |
00:09:11 | alexday | hey |
00:09:32 | FromGitter | <data-man> Does anyone use this in Windows? https://github.com/Maximus5/ConEmu |
00:09:36 | dom96 | hi alexday :) |
00:12:40 | alexday | is there a nil type in nim? I am implementing a simple trie with nim. I have type NodeObj = object children: seq[ref Node], isTermal: false. but when I initialize a new Node which is type Node = ref NodeObj. how can I make sure that (in terms of C) children[i] = NULL ? |
00:13:06 | alexday | I can think of like setting an isEmpty property in the NodeObj . |
00:13:17 | dom96 | you shouldn't be using double 'ref's |
00:13:22 | dom96 | seq[Node] should be enough |
00:13:36 | alexday | ok |
00:13:54 | dom96 | you can just write: type Node = ref object .... |
00:14:17 | alexday | noted. |
00:14:18 | dom96 | and if you want to make something nil just assign nil to it |
00:14:26 | dom96 | maybe I'm misunderstanding though |
00:16:52 | alexday | so if I assign nil say, I would have to have something like a fixed size of children, and then iterate and set null. I was thinking, since seq[Node] is dynamic, is there anyway to check if the children[0]'th node is not empty or NULL |
00:17:15 | alexday | without pre-assigning fixed set of child nodes |
00:17:39 | FromGitter | <brentp> @mratsim good to |
00:17:42 | FromGitter | <brentp> know |
00:17:52 | FromGitter | <brentp> Cigar:https://genome.sph.umich.edu/wiki/SAM#What_is_a_CIGAR.3F |
00:19:45 | * | gangstacat quit (Quit: Ĝis!) |
00:20:58 | dom96 | alexday: check the length and then the contents |
00:21:06 | alexday | ok. yeah |
00:21:15 | alexday | that sounds cool. stupid me :D |
00:23:26 | * | gangstacat joined #nim |
00:23:35 | * | gokr quit (Ping timeout: 276 seconds) |
00:27:33 | GitDisc | <lotzz> Hello everyone |
00:32:10 | * | dddddd quit (Remote host closed the connection) |
00:34:35 | * | MJCaley joined #nim |
00:45:45 | FromGitter | <data-man> Hello! |
01:01:19 | * | kafke quit (Ping timeout: 248 seconds) |
02:02:45 | * | S1tiSchu joined #nim |
02:03:28 | * | MJCaley quit (Quit: MJCaley) |
02:06:56 | * | S1t1Schu quit (Ping timeout: 276 seconds) |
02:10:28 | * | zahary quit (Quit: Leaving.) |
02:17:30 | * | chemist69 quit (Ping timeout: 246 seconds) |
02:19:14 | * | MJCaley joined #nim |
02:29:46 | * | MJCaley quit (Quit: MJCaley) |
02:32:01 | * | chemist69 joined #nim |
02:47:31 | * | sz0_ joined #nim |
02:49:55 | * | sz0_ is now known as sz0 |
02:56:31 | * | Cthalupa quit (Ping timeout: 248 seconds) |
03:00:00 | * | Cthalupa joined #nim |
03:11:04 | * | marenz_ joined #nim |
03:15:11 | * | marenz__ quit (Ping timeout: 276 seconds) |
03:25:35 | FromGitter | <saolof> does Nim distinguish between statements and expressions? |
03:26:45 | FromGitter | <RedBeard0531> yes, but most statements also have expression forms and there is a way to use multiple statements as an expression |
03:27:10 | FromGitter | <RedBeard0531> what are you trying to do? |
03:27:37 | FromGitter | <saolof> ah, I was just curious, I'm taking a look at the language and the syntax seemed python-like |
03:29:29 | * | vlad1777d quit (Ping timeout: 276 seconds) |
03:29:30 | FromGitter | <RedBeard0531> it is. but there are also things like https://nim-lang.org/docs/manual.html#statements-and-expressions-statement-list-expression and https://nim-lang.org/docs/manual.html#statements-and-expressions-case-expression that blur the line a little bit |
03:56:23 | * | endragor quit (Remote host closed the connection) |
04:12:20 | * | endragor joined #nim |
04:19:35 | shashlick | @data-man: I use ConEmu, pretty nice |
04:23:49 | FromGitter | <data-man> @shashlick: Which Windows version are you using? |
04:24:06 | shashlick | 10 |
04:24:50 | FromGitter | <data-man> With all updates? :) |
04:26:22 | shashlick | I hope 🙂 ... it is build 1607 Enterprise |
04:27:13 | FromGitter | <data-man> Can you check terminal module from my PR https://github.com/nim-lang/Nim/pull/6936 in the ConEmu? Please. |
04:29:23 | shashlick | sure |
04:29:42 | shashlick | what exactly do I need to do? |
04:29:58 | FromGitter | <data-man> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a56e846ba39a53f1affe3ca] |
04:35:01 | FromGitter | <data-man> What you see? :-) |
04:35:51 | shashlick | cannot open strformat? |
04:36:51 | FromGitter | <data-man> Oh! Isn't Nim devel? |
04:37:36 | shashlick | let me choosenim update #head |
04:46:59 | shashlick | https://imgur.com/a/M5MvE |
04:47:11 | shashlick | left is conemu in default color scheme, right is cmd.exe |
04:47:25 | * | arnetheduck quit (Remote host closed the connection) |
04:48:42 | shashlick | looks bad in Monokai colorscheme |
04:50:05 | FromGitter | <data-man> Big thanks! ⏎ I will try ConEmu on Windows 8 in the VirtualBox. |
04:50:25 | shashlick | no problem |
04:50:59 | * | arnetheduck joined #nim |
04:52:20 | * | arnetheduck quit (Remote host closed the connection) |
04:53:51 | * | arnetheduck joined #nim |
04:54:57 | FromGitter | <data-man> @shashlick: Are you using Far Manager? |
04:55:20 | * | Atomic2 quit (Ping timeout: 260 seconds) |
04:56:09 | shashlick | nope, just ConEmu |
04:58:51 | FromGitter | <data-man> Why? Far Manager so cool! And I'm one of the contributors. :-) |
05:03:48 | shashlick | I used to use norton commander some decades ago, now so used to explorer |
05:04:08 | shashlick | of course, with fzf and ff (my tool), I avoid explorer too mostly |
05:04:33 | shashlick | https://github.com/genotrance/ff |
05:06:10 | FromGitter | <data-man> Did you see my message to you about the Everything? |
05:08:26 | * | Elronnd quit (Quit: BRB) |
05:09:17 | * | Elronnd joined #nim |
05:09:24 | shashlick | ya i did try out everything but the fzf approach is much faster |
05:09:46 | shashlick | plus I can run any tool I want on any selection with shortcuts |
05:10:08 | shashlick | like I can do "ff T" and kill a process |
05:11:06 | shashlick | i've also bound it to a hotkey with autohotkey so now all I do is WIN-/ d c and I can open a command line window on the sub-directory I picked on my desktop |
05:11:43 | FromGitter | <data-man> Of course, its own utility is always better. :-) |
05:12:35 | shashlick | agreed, but it's worth a try, especially when it comes to coding - really speeds things up |
05:13:12 | FromGitter | <data-man> Remains to write NimFZF |
05:13:19 | shashlick | i even have a conemu shortcut to open a new cmd tab in a directory selected |
05:14:07 | shashlick | I've stayed away from terminal/ncurses stuff historically, kudos to you on your PR |
05:14:09 | shashlick | and the Far work too |
05:15:35 | * | kordanza joined #nim |
05:16:10 | FromGitter | <data-man> Oh, no problem! :-) |
05:16:56 | shashlick | where are you located? |
05:19:50 | FromGitter | <data-man> Can you login to gitter? |
05:19:53 | * | Elronnd quit (Quit: brb) |
05:20:03 | * | elronnd joined #nim |
05:21:10 | * | elronnd is now known as Elronnd |
05:22:26 | shashlick | how does that help? |
05:24:18 | FromGitter | <data-man> I can write to you privately. |
05:28:42 | * | kordanza quit (Quit: Leaving) |
05:33:21 | * | Atomic2 joined #nim |
05:34:22 | * | Atomic2 quit (Client Quit) |
05:52:37 | * | nsf joined #nim |
06:11:07 | * | arecaceae quit (Remote host closed the connection) |
06:11:26 | * | arecaceae joined #nim |
06:11:45 | * | marenz_ quit (Ping timeout: 260 seconds) |
06:14:08 | * | arnetheduck quit (Remote host closed the connection) |
06:41:34 | * | vlad1777d joined #nim |
06:47:27 | * | arnetheduck joined #nim |
06:55:44 | * | gokr joined #nim |
07:56:50 | * | yglukhov joined #nim |
07:57:25 | * | yglukhov quit (Read error: Connection reset by peer) |
07:57:37 | * | yglukhov joined #nim |
08:07:50 | * | PMunch joined #nim |
08:10:13 | FromGitter | <survivorm> @Yardanico you're using arch, aren't you? |
08:10:54 | FromGitter | <survivorm> How do you install nim/nimsuggest? |
08:13:24 | miran | choosenim |
08:13:38 | Araq | koch nimsuggest |
08:25:42 | * | floppydh joined #nim |
08:25:58 | * | claudiuinberlin joined #nim |
08:30:31 | FromGitter | <survivorm> i'm a looser... ⏎ no installations of nimsuggest seem to work properly on my PC |
08:31:37 | Araq | what editor are you using? |
08:31:57 | PMunch | survivorm, I'm using Manjaro (Arch based) and choosenim works fine for me :) |
08:32:07 | FromGitter | <survivorm> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a572107b48e8c3566c81ac7] |
08:32:41 | FromGitter | <survivorm> As you see, none given ANYTHING |
08:32:49 | FromGitter | <survivorm> not even one |
08:32:59 | Araq | check nimsuggest.log maybe |
08:33:57 | Araq | oh and all these commands require a file.nim argument |
08:34:07 | Araq | but don't tell you you need it :P |
08:34:34 | Araq | nimsuggest is mostly used over sockets and it used to be chatty |
08:34:45 | Araq | this caused all sort of protocol related problems |
08:34:54 | Araq | and so now it shuts up completely. |
08:35:51 | FromGitter | <survivorm> https://gist.github.com/survivorm/c9953b6e361cd7999a4bc337423ac8a0 |
08:36:24 | Araq | cmd: sug, file: 36, dirtyFile: [11:0] |
08:36:24 | Araq | Error: invalid module name: '' |
08:40:49 | FromGitter | <survivorm> input file, @@34-36 ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a572311290a1f456175b1d0] |
08:44:02 | FromGitter | <survivorm> btw, code is compiling and working, if that matters |
08:44:33 | FromGitter | <survivorm> i may provide full example, if needed |
08:47:58 | FromGitter | <Yardanico> @yglukhov gist works for me, I posted a gist raw link |
08:48:26 | Araq | survivorm: give it an absolute filename |
08:48:57 | FromGitter | <survivorm> in starting, or in sug/def ? |
08:49:04 | Araq | in sug/def |
08:49:04 | FromGitter | <survivorm> @Araq |
08:49:14 | FromGitter | <survivorm> ok, i'll try |
08:51:12 | FromGitter | <survivorm> gave me something |
08:51:22 | FromGitter | <survivorm> it's great |
08:52:03 | Araq | PRs welcome |
08:52:58 | FromGitter | <survivorm> in improving nimsuggest? |
08:53:11 | Araq | yes |
08:54:10 | Araq | I didn't consider these problems of importance as the tools feed nimsuggest the commands in the way it requires |
08:54:13 | FromGitter | <survivorm> And that may be the place i'll start digging. Even if only because of how much blood it costed myself |
08:54:33 | Araq | nimsuggest is not for humans :-) |
08:54:40 | FromGitter | <survivorm> i now |
08:54:59 | FromGitter | <survivorm> but it doesn't work in editors, too |
08:55:19 | Araq | it does for VSCode |
08:56:13 | FromGitter | <survivorm> I tested it in textadept, vim, qt creator and some more on my PC (with pluggins, of cource) and so far - to no avail |
08:57:40 | FromGitter | <survivorm> Maybe my before's install was broken. Maybe i've got unlucky. Maybe it's system running version was corrupt - don't now, All i now - it didn't, for me |
08:58:14 | FromGitter | <survivorm> So, testing it and making it work better sounds like a plan |
08:59:54 | FromGitter | <survivorm> But i think i need a little more maths on parsers/compilators for this task :) ⏎ Currently trying to dig Ullman/Aho THE THEORY OF PARSING, ⏎ TRANSLATION AND COMPILING |
09:01:09 | FromGitter | <survivorm> Good book, but unfortunately I'm not so good at maths to read and understand it for more than 2-4 pages a day :) |
09:03:17 | * | gmpreussner quit (Ping timeout: 255 seconds) |
09:05:03 | * | gmpreussner joined #nim |
09:08:30 | Araq | meh, forget about that book |
09:10:17 | PMunch | Hmm, slight annoyance with nimble. I have a main file and a support file in my project. I added both to "src" but it asked me to move the support file into a folder named the same as the project and the main file. Problem is that trying to compile the main file now gives me an error saying that it's output already exists and is a folder as it tries to compile it to the same name as the folder.. |
09:10:56 | euantor | @PMunch I've complained about that a few times :P |
09:11:16 | euantor | I still find it unexpected that compiling from the root directory tries to output an executable in the src/ dir |
09:11:28 | euantor | THe solution is to pass the `-o` option to change the output filename |
09:11:38 | Araq | Nim supports --output, I think nimble does the same |
09:13:16 | Araq | Unix simply requires .exe extensions |
09:15:04 | Araq | or maybe some lovely double fuck like exeNameHere.elf |
09:15:45 | Araq | exegcc, execp, exemv, execlang, exenim -- what's there to dislike? you can easily delude yourself it adds "clarity" to your system |
09:17:34 | alexday | https://w.awalgarg.me/d/NiRQ3HLJu can someone please help me with this? I pasted the error as comment at the end of the code |
09:18:18 | Araq | for s in toSeq(value.items) ? |
09:18:54 | Araq | for s in value # sometimes Nim is like Python |
09:19:12 | alexday | ow ok |
09:19:26 | Araq | let index = int(s) - int('a') |
09:19:26 | Araq | # ? |
09:19:34 | Araq | how does this addressing work? |
09:19:47 | * | Vladar joined #nim |
09:20:46 | Araq | anyway, you need to use crit bit trees from the stdlib |
09:20:56 | Araq | they do what you attempt to do |
09:20:59 | Araq | I think. |
09:21:52 | Araq | or at least learn about setLen and sequence indexing, it doesn't work as in Perl |
09:24:03 | alexday | ok will look |
09:43:13 | alexday | that adressing is just like the difference between character and 'a'. so like z - a is 25 |
09:43:22 | alexday | and that's the array index |
09:43:54 | Araq | yeah I know but your seqs are empty |
09:44:09 | Araq | and you should have used an 'array' instead |
09:51:44 | * | sendell joined #nim |
09:53:35 | FromGitter | <Yardanico> @yglukhov maybe you checked gist yesterday, it was made with my old nickname so link was invalid |
09:53:51 | yglukhov | Yardanico: yeah, most likely |
09:54:30 | yglukhov | anyways, inlining the crash log into the issue looks like a more bullet-proof approach |
09:56:31 | * | Atomic2 joined #nim |
09:56:50 | * | c0ntribut0r joined #nim |
09:57:03 | * | c0ntribut0r quit (Client Quit) |
09:57:39 | * | c0ntribut0r joined #nim |
09:57:55 | * | Atomic2 quit (Remote host closed the connection) |
09:58:19 | * | gokr quit (Read error: Connection reset by peer) |
10:09:05 | * | Yardanico joined #nim |
10:10:44 | FromGitter | <Yardanico> well it's pretty big |
10:11:09 | FromGitter | <Yardanico> but OK, I'll inline crash logs in issues directly, I know that's better for the future :) |
10:19:49 | Araq | do we have a simple and fast zip algorithm written in pure Nim? |
10:25:48 | Yardanico | Araq, I don't think so :( |
10:26:36 | Yardanico | it seems that everyone uses libzip |
10:27:02 | FromGitter | <data-man> @Araq: https://github.com/jangko/nimz ? ⏎ I not testing :-) |
10:27:08 | Yardanico | oh wow! |
10:27:15 | Yardanico | sorry, I'm wrong then |
10:27:21 | Yardanico | but we don't know if it's simple or fast :) |
10:28:00 | Yardanico | data-man: how did you find it? :D |
10:28:20 | FromGitter | <data-man> It's my big secret :-) |
10:28:33 | FromGitter | <codenoid> he is data man |
10:28:35 | Yardanico | well I'm good at finding nim projects too |
10:28:40 | Yardanico | everyone knows that :P |
10:34:16 | FromGitter | <data-man> @Yardanico: You're amazing, no one is arguing that. :-) |
10:38:09 | FromGitter | <Yardanico> @GULPF hello, maybe you're around, what would be the best way to select random date if I have start and end of range? ⏎ currently I use "let randdate = fromUnix(int64(float(min) + rand(1.0) * float(max.toUnix - min.toUnix)))" |
10:39:50 | FromGitter | <Yardanico> min and max are both of "Time" type |
10:39:52 | livcd | hmm i am not able to install c2nim. Should I try to install nim 0.7.13 first ? |
10:40:12 | Araq | livcd, can you fix c2nim please? |
10:40:18 | Araq | I can guide you |
10:40:26 | Araq | the change should be one or two lines |
10:40:35 | livcd | ok lets try |
10:41:15 | Araq | fork it from https://github.com/nim-lang/c2nim |
10:41:45 | livcd | ok |
10:42:02 | Araq | c2nim.nim |
10:42:08 | Araq | the lines like |
10:42:09 | Araq | renderModule(tree, outfile, outfile) |
10:42:12 | * | Tanger quit (Ping timeout: 268 seconds) |
10:42:14 | Araq | should become |
10:42:30 | Araq | when compiles(renderModule(tree, outfile, outfile)): |
10:42:38 | Araq | renderModule(tree, outfile, outfile) |
10:42:42 | Araq | else: |
10:42:47 | Araq | renderModule(tree, outfile) |
10:43:07 | Araq | it's used in two places apparently |
10:43:19 | Araq | then c2nim should compile again against an older Nim |
10:44:29 | * | BitPuffin joined #nim |
10:45:53 | * | xet7 joined #nim |
10:46:38 | livcd | and the line 97? : renderModule(m, outfile, outfile) |
10:48:47 | Araq | similar. |
10:49:51 | livcd | also I have not found how to install this local version with nimble |
10:50:12 | Araq | "nimble develop" in c2nim's directory |
10:50:28 | Araq | you don't have to install it |
10:50:44 | Araq | just ensure it compiles with your Nim version and maybe run its testsuite |
10:51:05 | Araq | and then use your fork to create a PR |
10:51:20 | Araq | this step will run the tests anyway |
10:51:39 | Araq | it's fool proof muhahaha |
10:51:47 | livcd | really? but it won't be in the output right ? |
10:51:58 | Araq | what output? |
10:55:10 | * | Tanger joined #nim |
10:56:54 | Yardanico | wait, https://github.com/nim-lang/Nim/issues/2090 is this really implemented? AFAIK csources are still 1-core only :) |
10:57:02 | livcd | that it ran tests |
10:57:32 | Yardanico | ah, it's not for nim's csources |
10:57:53 | * | xet7 quit (Ping timeout: 265 seconds) |
11:14:32 | * | gangstacat quit (Quit: Ĝis!) |
11:15:33 | * | xet7 joined #nim |
11:22:48 | FromGitter | <GULPF> @Yardanico `let randdate = min + rand(0..(max.toUnix.int - min.toUnix.int)).seconds` is better since casting `Time` to `float` will break soon. |
11:23:02 | Yardanico | ok, thank you! |
11:24:51 | * | vlad1777d quit (Ping timeout: 240 seconds) |
11:28:29 | Yardanico | Araq, is this supposed to work? https://gist.github.com/Yardanico/cd3fb7a093a177da255335cb9d90c632 |
11:29:17 | Araq | not sure, I think so? |
11:29:39 | Yardanico | well I mean fmt at compile time works, but this one fails (probably because of a template) |
11:29:48 | * | gangstacat joined #nim |
11:31:01 | Araq | Yardanico, make the template .dirty and it works :-) |
11:31:10 | Yardanico | ah, ok :) |
11:31:19 | Araq | otherwise the hygenic symbol binding rules bite you |
11:43:07 | Yardanico | oh wait, fmt actually takes raw strings? because fmt"{a[\"a\"]" doesn't compile (a is a table) |
11:43:14 | Yardanico | of course I can still use triple quotes :) |
11:46:20 | Araq | fmt is nothing special |
11:46:33 | Araq | fmt"" is an extended raw string literal |
11:46:38 | Araq | fmt "" is not |
11:46:43 | miran | Yardanico: aren't you missing } ? |
11:47:07 | Yardanico | miran, well I do, but that doesn't really matter here |
11:47:23 | Yardanico | Araq, ah, ok, thanks again |
11:48:05 | * | MyMind joined #nim |
11:49:53 | * | Sembei quit (Ping timeout: 248 seconds) |
11:50:09 | * | zahary joined #nim |
12:02:12 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
12:07:34 | miran | Yardanico: have you received your hacktoberfest t-shirt? |
12:08:05 | Yardanico | miran, yep |
12:08:20 | miran | nice. i didn't :( |
12:08:24 | Yardanico | :( |
12:11:07 | miran | when did it come? |
12:12:52 | Yardanico | https://i.imgur.com/ay5kYYy.png |
12:14:57 | miran | pfffft, before new year, and you were telling us sad stories about russia being last in the line.... :) |
12:15:01 | Yardanico | :P |
12:24:18 | Yardanico | btw, @alehander42 you rock! py2nim is getting advanced features much faster than I could've imagined: https://github.com/metacraft-labs/py2nim/issues/4 |
12:24:26 | * | LyndsySimon quit (Read error: Connection reset by peer) |
12:24:42 | Yardanico | stuff like hasattr/generics/isistance |
12:24:47 | * | LyndsySimon joined #nim |
12:27:13 | * | literal quit (Ping timeout: 256 seconds) |
12:27:47 | * | literal joined #nim |
12:29:30 | * | zahary quit (Read error: Connection reset by peer) |
12:37:41 | alexday | :P check in the json file for the nim repos |
12:37:46 | alexday | :P check in the json file for the nim repos |
12:38:26 | alexday | wut. I replied to a super old message. twice. |
12:38:27 | alexday | my bad |
12:48:32 | * | zahary joined #nim |
13:01:45 | miran | "Also in the near future, -d:safety will be available to use along with -d:release for performance and safety (see: #2809)" |
13:02:00 | miran | is this implemented? or any news about it? |
13:02:43 | * | Snircle joined #nim |
13:08:39 | * | ShalokShalom joined #nim |
13:10:51 | * | zahary quit (Ping timeout: 256 seconds) |
13:11:41 | * | ShalokShalom quit (Remote host closed the connection) |
13:14:59 | * | zahary joined #nim |
13:15:14 | Yardanico | not yet TM |
13:15:26 | * | marenz_ joined #nim |
13:15:37 | Yardanico | you can make it by yourself since -d:release is defined in config/nim.cfg in main nim repo |
13:24:01 | dom96 | make it yourself and make a PR to add it for everyone :) |
13:27:58 | * | zahary quit (Read error: Connection reset by peer) |
13:28:11 | * | zahary joined #nim |
13:34:39 | FromGitter | <survivorm> @PMunch do you plan for xrc in wxnim? I think it would be great |
13:35:16 | FromGitter | <survivorm> and this will add more compatibility with the external tools, too |
13:36:08 | PMunch | xrc? |
13:36:19 | FromGitter | <survivorm> https://wiki.wxpython.org/XRCTutorial |
13:36:39 | FromGitter | <survivorm> Generated by many GUI builders |
13:36:52 | PMunch | Huh, not sure how I've never heard of that :P |
13:37:06 | FromGitter | <survivorm> The idea is to separate the design from code |
13:38:17 | FromGitter | <survivorm> http://wxglade.sourceforge.net/, https://github.com/wxFormBuilder/wxFormBuilder generate it as a result. Glade too, of cource :) |
13:38:20 | PMunch | Yeah, similar to how Gtk has XML loading |
13:38:54 | PMunch | It's a good idea, although a bit weird since you can change it without changing code |
13:38:55 | FromGitter | <survivorm> It's gtk-related thing, you know :) |
13:38:58 | PMunch | For better or worse :P |
13:39:14 | Araq | form designers lead to non-generic code |
13:39:41 | PMunch | What do you mean? |
13:39:42 | Araq | better is a DSL that describes the forms IMO |
13:40:02 | FromGitter | <survivorm> Compatibility? Reuse? |
13:40:25 | PMunch | Yeah, that's why I created the GenUI DSL for various graphical toolkits :) |
13:40:40 | Araq | I mean with Delphi to create 5 check boxes I'll have to insert 5 check boxes on my formular |
13:40:56 | FromGitter | <survivorm> A-a-and? |
13:41:09 | PMunch | Oh you want to be able to do for i in 0..5: checkbox() ? |
13:41:19 | PMunch | Or something similar |
13:41:43 | Araq | but these likely come from some data model that is not captured at all |
13:41:47 | alexday | what does TObject mean? |
13:42:36 | Araq | and so I have code that sets these 5 checkboxes according to the underlying object my UI represents and also to read it back |
13:42:42 | PMunch | alexday, Type Object as opposed to PObject which is Pointer Object (or rather a ref in Nim). It's deprecated style though |
13:43:19 | PMunch | I feel there is a good way to make UIs, just that no-one have discovered it yet.. |
13:43:25 | * | zahary quit (Quit: Leaving.) |
13:43:26 | Araq | PMunch, kind of yes, for i in 0..4: checkbox() |
13:43:45 | PMunch | Oh yeah, I always forget that .. is inclusive :P |
13:44:11 | FromGitter | <survivorm> @Araq I'll look into it, but may be, yes. But it may mean the wrong domain. There are grid and table controls, and may be they ARE not limited |
13:44:23 | FromGitter | <survivorm> maybe not |
13:44:24 | alexday | oh I see. that's why I can't see it in the docs? or maybe I am blind |
13:44:28 | PMunch | I still hope to be able to complete my type-based UI system. But I'm still having trouble with it.. |
13:44:34 | Araq | oh it's not hard the problem is that you have 2 representations of the same thing and so you struggle with the consistency problems |
13:45:42 | Araq | immediate mode UIs don't have these problems, you have your program state not in a messy polymorphic non-generic tree structure |
13:45:57 | Araq | and everything becomes much simpler. |
13:46:02 | FromGitter | <survivorm> But idea is, for the menus and regular staff, this may be life-saver. And for something more... I'm thinking about something about Jinja2 on top of xrc |
13:46:19 | PMunch | alexday, well TObject is still used I think when ref is the default type. So you would have Something = ref TSomething if you use the reference by default or PSomething = ref Something if non-reference version is default |
13:46:21 | PMunch | IIRC |
13:46:34 | Araq | PMunch, it's called system.RootObj now |
13:46:52 | PMunch | Oh yeah, I was talking about the general naming convention |
13:47:05 | PMunch | TObject -> RootObj? |
13:47:30 | Araq | PObject -> RootRef |
13:47:33 | Araq | yes. |
13:47:37 | PMunch | Right |
13:47:49 | Araq | I still love immediate mode :P |
13:48:09 | PMunch | Immediate mode is nice in it's simplicity. But not very resource friendly.. |
13:48:35 | PMunch | Updating the entire UI at 30FPS seems a bit of a waste if nothing actually changes.. |
13:48:47 | Araq | there is no other way. |
13:49:49 | dom96 | PMunch: Note: the common type should have no suffix, so in most cases PObject -> Object |
13:49:57 | FromGitter | <survivorm> Who was talking about resource-saving and economy :) |
13:50:42 | PMunch | dom96, yeah I know. That's what I was talking about before Araq mentioned RootObj which was a more direct answer to alexdays question :) |
13:51:15 | Araq | where are the benchmarks? seems unlikely in the presence of all these software layers that the list of rectangles to be updated makes it to the hardware. |
13:51:35 | Araq | I bet the HW redraws the whole screen instead :P |
13:52:19 | FromGitter | <survivorm> No bets as i have no idea how do they work ^P |
13:52:22 | Araq | it's a stupid idea anyway, what if you need to update the full window at 30FPS anyway (watching a video anybody?) |
13:52:53 | Araq | are then tell your users "you're fucked, can only update a smart part of the screen because of efficiency" |
13:53:24 | Araq | the worst case is quite common, deal with it. |
13:57:42 | Araq | the only problem with immediate UIs is where to put the state that is UI specific (for animations etc.) |
13:58:45 | * | dddddd joined #nim |
13:58:53 | Araq | the other problem is that most APIs are for retained mode |
14:00:44 | * | chemist69 quit (Ping timeout: 255 seconds) |
14:01:58 | * | arecaceae quit (Remote host closed the connection) |
14:02:17 | * | arecaceae joined #nim |
14:03:08 | * | chemist69 joined #nim |
14:03:18 | FromGitter | <alehander42> thanks @Yardanico , all of those are also very alpha yet, hasattr / isinstance mostly work for 1,2 situations in libraries I work on translating: basically a very early form of flow-based type checking (but eventually they'll improve haha) |
14:04:31 | alexday | PMunch thanks |
14:04:38 | FromGitter | <alehander42> btw why "" escapes " in strformat, instead of \" |
14:09:56 | Yardanico | fmt "look, I can use \" escape now!" |
14:10:07 | Yardanico | fmt("look, I can use \" escape now!") that's more clear ? :) |
14:10:15 | Yardanico | I mean that there are different rules] |
14:10:35 | Yardanico | <Araq> fmt"" is an extended raw string literal |
14:10:38 | Yardanico | <Araq> fmt "" is not |
14:12:29 | FromGitter | <GULPF> to bad the syntax highlight in vs code doesn't understand that |
14:13:45 | FromGitter | <GULPF> `fmt("\"")` and `fmt"\""` is highlighted the same, showing `\"` in a different color indicating it's a escape sequence |
14:17:42 | dom96 | I wonder if we should make a bunch of syntax highlighter tests and shame everyone that doesn't abide. |
14:19:21 | FromGitter | <alehander42> argh so I have to use fmt<space> *sometimes* |
14:20:15 | Araq | https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/oopsla065-burckhardt.pdf |
14:20:38 | Araq | alehander42 same like you "sometimes" have to use r"" vs "" |
14:21:05 | FromGitter | <alehander42> but not for each \n and ", which are very common |
14:21:56 | FromGitter | <alehander42> not a big deal, I just define endl for my projects and interpolate it, I'll use the "" for " and use fmt extended literal always |
14:22:15 | Araq | "{a}\n{b}".fmt |
14:22:33 | Araq | can be your default syntax |
14:24:05 | Araq | alternatively we could make fmt interpret the \ differently but I dunno |
14:24:09 | FromGitter | <alehander42> hm, that's nice too |
14:25:25 | FromGitter | <RedBeard0531> I thought you had a plan for fmt/fmtr to handle that? |
14:25:48 | Araq | RedBeard0531: you had one, never got any PR from you |
14:25:50 | FromGitter | <alehander42> still I think some special handling for \ would be perfect , as one way to do something in 95% of cases (fmt".." instead of fmt function/method) will be best |
14:26:26 | Araq | we should really figure out this thing before releasing 0.18 |
14:26:39 | Araq | also the lookup rules for the format protocol seem fishy |
14:27:07 | FromGitter | <RedBeard0531> Yeah, I found out that macros run too late for the difference from nnkStrLit vs nnkRawStrLit (or whatever the right names are) to matter |
14:27:31 | FromGitter | <RedBeard0531> I was hoping that would Just Work |
14:27:56 | Araq | well it's not much work to implement the lexing step that deals with \ |
14:28:10 | Araq | but we need to figure out what to do. |
14:28:43 | Araq | the current way is super consistent but apparently non-intuitive |
14:29:00 | FromGitter | <RedBeard0531> Is there already a function that does nim-style escaping/unescaping? |
14:29:09 | Araq | (hey, dom96, see? consistency can produce *worse* results) |
14:29:50 | Araq | RedBeard0531: Nim is written in Nim, copy it from lexer.nim to be on the safe side |
14:29:51 | FromGitter | <RedBeard0531> It's not consistent with python's f-str vs fr-str :) |
14:30:25 | Araq | nor is the rest of Nim consistent with Python. strange argument. |
14:30:46 | dom96 | Can't we just special case r""? |
14:30:56 | dom96 | and get rid of this rule that blah"" is also a raw string literal? |
14:31:00 | FromGitter | <RedBeard0531> Sure, I just meant is there already one exposed in stdlib. I'll take your answer to mean no. |
14:31:12 | FromGitter | <GULPF> +1 dom96 |
14:31:28 | Araq | dom96, and what about re"\d+" ? |
14:31:35 | Araq | or pegs? |
14:31:49 | Araq | there is a reason for why the things are as they are |
14:31:50 | dom96 | Turn it into a macro and have it emit a raw string literal? :P |
14:32:09 | Araq | since fmt is already a macro, why not fix that instead? |
14:32:11 | dom96 | yeah, nah, syntax highlighting that would be impossible |
14:32:34 | dom96 | fixing fmt has the same problem |
14:32:36 | FromGitter | <RedBeard0531> Could the type system handle it if compile-time functions could take either raw or cooked strings? |
14:32:54 | FromGitter | <GULPF> fmt will need special syntax highlighting anyway though |
14:33:03 | FromGitter | <RedBeard0531> actually nevermind fmt needs raw strings |
14:33:03 | Araq | you can overload by ast kind but please let's not. |
14:34:04 | FromGitter | <RedBeard0531> fmt"{isSpace('\L')}" should work |
14:34:27 | FromGitter | <RedBeard0531> it is only in the "stringy" parts that escapes should be interpreted |
14:34:58 | Araq | I don't think so, char/string literals within fmt do smell. |
14:35:32 | FromGitter | <RedBeard0531> Sure its weird, but between the {} should be Plain Old Code |
14:36:28 | dom96 | hm, that shows a limitation |
14:36:37 | FromGitter | <RedBeard0531> And sometimes its really useful: fmt"""blah {someSeq.join("\n")} blah""" |
14:36:39 | dom96 | Technically everything inside {...} in a fmt"" should be treated as Nim code |
14:36:56 | dom96 | which implies fmt"" should be implemented in the compiler :P |
14:37:27 | Araq | wrong, we can make fmt interpret \ outside the {} as we see fit |
14:37:45 | Araq | if we want to, no compiler magic required. |
14:37:57 | Araq | I don't think it's necessary though. |
14:38:04 | Araq | but be my guest. |
14:38:11 | dom96 | well I dunno |
14:38:16 | dom96 | I still haven't had a chance to test fmt"" |
14:38:21 | dom96 | because I was hoping we would rename it to f"" |
14:38:40 | FromGitter | <RedBeard0531> IIRC In python f-strs you don't need to use """ to embed a ". But I don't see that working in nim without compiler support. |
14:39:13 | FromGitter | <RedBeard0531> To me that's not enough justification for compilerizing it. But nimsuggest support inside {} is :) |
14:39:15 | dom96 | as far as this issue goes, either we embrace Nim or not |
14:39:52 | Araq | I will tell what does not embrace Nim. a shitty special lexer rule for "f strings" |
14:40:19 | dom96 | Presumably, currently, char escapes in fmt"" are not intuitive because people are applying their knowledge of Python |
14:40:44 | FromGitter | <RedBeard0531> Not just python |
14:40:51 | euantor | I'd expect everything in an `fmt""` string to act the same as any other Nim string, unless isnde a `{}` context |
14:40:51 | Araq | no, it's that \n is more useful as a newline than as backslash-N |
14:40:55 | euantor | Same as in C~ |
14:40:59 | euantor | *C# |
14:41:17 | FromGitter | <RedBeard0531> I think that is how every other language with string interpolation works |
14:41:27 | dom96 | yeah, and without compiler support that's impossible, no? |
14:42:13 | FromGitter | <RedBeard0531> no, the macro can just unexcape before calling newStrLit |
14:42:20 | dom96 | I can't write: fmt"{toUpper("\n")}" |
14:42:28 | dom96 | or can I? |
14:42:39 | Araq | you can't because of the " |
14:42:40 | dom96 | will it expand to toUpper("\n")? |
14:42:43 | FromGitter | <RedBeard0531> You need """ but then it would work |
14:42:43 | Araq | not because of the \ |
14:43:12 | Araq | neither can you write String.format("{toUpper("\n")}") in C# |
14:43:16 | Araq | for the same reasons. |
14:43:31 | dom96 | but I can in Python, no? |
14:43:40 | FromGitter | <alehander42> I agree with Araq it's about usefullness, not about Python users expectations |
14:44:34 | Araq | >>> f"{0}""" |
14:44:34 | Araq | '0' |
14:44:38 | dom96 | another approach to subtly hinting people towards not using raw string literals is to rename this to `format` and make all examples: "{x}".format() |
14:44:49 | Araq | no idea what Python's doing here |
14:45:00 | FromGitter | <alehander42> and about consistency, if we need 3 special patterns (use fmt"..", but use fmt(..) for some escaped stuff or best, use var a = .., fmt"..{a}" for some joins because we can't join inside), that's not good |
14:45:34 | Araq | it is good to have a consistent language at the cost of a stdlib you have to learn. |
14:45:41 | FromGitter | <GULPF> handling `\` specially in fmt is brutally inconsistent though |
14:45:54 | FromGitter | <RedBeard0531> I think they made f"" and fr"" strings a new type of string in the lexer, at the same layer as r"" strings. |
14:46:01 | euantor | @Araq The modern C# way is `$"{toUpper("\n")}"` |
14:46:07 | euantor | And I believe that will work |
14:46:25 | dom96 | Swift uses "blah: \(myVar)" as far as I can tell |
14:46:54 | Araq | GULPF: we can error out though and require {\} for literal backslashes |
14:46:56 | dom96 | but indeed, Nim's philosophy is not to build these things into the language |
14:47:41 | Araq | Python's f-strings are broken |
14:47:42 | euantor | Yep, works as I thought it did. The C# compiler translates it to `string.Format("Hello {0}", "test".ToUpper())` https://www.irccloud.com/pastebin/4936Nbk9/ |
14:47:56 | Araq | >>> f"{0}""908" |
14:47:56 | Araq | '0908' |
14:48:08 | dom96 | https://www.python.org/dev/peps/pep-0498/#escape-sequences |
14:48:08 | Araq | where is my quote in there? |
14:48:19 | Araq | try it with Python 3.6. |
14:48:28 | dom96 | That's just two string literals, side-by-side |
14:48:42 | Araq | oh, wtf |
14:48:44 | dom96 | which Python concatenates |
14:48:49 | dom96 | implicitly |
14:48:53 | Araq | I see, thanks |
14:48:56 | FromGitter | <alehander42> yep |
14:49:16 | euantor | @dom96 Yes, Swift uses `"\(var)"` which I personally don't like. Kotlin uses `"$var"` or `"${var}"` for more complex cases: https://kotlinlang.org/docs/reference/idioms.html#string-interpolation |
14:49:19 | Araq | yeah, I remember this misfeature of Python |
14:49:36 | Araq | euantor, it's about backslashes and quotes |
14:49:44 | Araq | not about dollar vs braces vs whatever |
14:49:51 | FromGitter | <alehander42> ok, why can't fmt implement special escape char handling itself, it's a macro, why would it need language level fixes |
14:49:53 | Araq | we settled for the curlies. |
14:50:11 | Araq | alehander42: yes, it can do that. |
14:50:28 | euantor | Curlies are for the best, was just wondering why dom posted about what Swift does |
14:50:38 | Araq | but I dunno whether it's a good idea |
14:50:44 | dom96 | so, see in Python: fr"" is a raw f-string |
14:50:51 | dom96 | whereas f"" is a f-string |
14:51:08 | Araq | I know. |
14:51:12 | dom96 | that would be a weird rule for Nim |
14:51:31 | FromGitter | <RedBeard0531> But is seems like the most useful API |
14:51:40 | FromGitter | <GULPF> not for re |
14:51:54 | FromGitter | <RedBeard0531> Since 99% of the time you want your \n to mean newline new slash n |
14:51:59 | Araq | do we need "raw" f-strings though? surely I can use fmt""" """ instead |
14:52:12 | Araq | and make fmt distinguish between triple lit strings or not |
14:52:29 | Araq | the macro system allows for that |
14:52:36 | FromGitter | <RedBeard0531> You need """ to embed a " inside the {} |
14:52:48 | dom96 | I don't think hacking fmt to treat fmt"" as a non-raw string literal sets a good precedent |
14:53:10 | FromGitter | <alehander42> it doesn't make sense for fmt to treat fmt"" as a raw string literal |
14:53:19 | Araq | dom96, for now it seems the most pragmatic solution though |
14:53:27 | Araq | and 'fmt' is all about getting shit done |
14:53:33 | Araq | and not about purity. |
14:53:36 | FromGitter | <alehander42> most of the time people format text or echo stuff with it |
14:53:47 | FromGitter | <RedBeard0531> That said, I don't know of any use cases for fmtr... |
14:53:51 | dom96 | That's another rule for syntax highlighters to follow |
14:54:06 | FromGitter | <RedBeard0531> They should already special case fmt"" |
14:54:20 | Araq | not really as far as the highlighter is concerned it can treat it like the Nim compiler does |
14:54:31 | Araq | fmt"" is an extended raw string literal. |
14:54:43 | dom96 | hrm |
14:55:18 | FromGitter | <RedBeard0531> I'd rather a highligher be fmt-aware and highlight the stuff inside {} as code rather than a string |
14:55:52 | dom96 | It won't be so easy |
14:55:56 | FromGitter | <RedBeard0531> That is what good highlighters do in python fstrs or js `${strs}` |
14:56:02 | dom96 | The stuff inside {} won't exactly be the same as normal Nim code :\ |
14:56:18 | FromGitter | <alehander42> exactly, highlighters for other languages with this kind of interpolation do work |
14:56:22 | FromGitter | <RedBeard0531> why not? |
14:56:34 | miran | Araq: re: "where is my quote in there? (f"{0}""908" > '0908') - this works as it should |
14:56:56 | dom96 | well I suppose " is the only special case |
14:57:08 | miran | f"{0}" is first string, "908" is concatenated to it |
14:57:25 | Araq | miran, implicit string concats are dumb. ("a", "b" "c") # yay, typo lead to a bug |
14:57:28 | Yardanico | RedBeard0531: fmt supports some special stuff |
14:57:37 | Yardanico | it's not just plain string interpolation |
14:57:45 | miran | oh, now i see dom96 already answered that. sorry for duplication |
14:57:57 | Yardanico | it's possible to highlight it properly, but it requires some work |
14:57:59 | Araq | that should have fixed that bullshit for Python 3 |
14:58:18 | Araq | only C requires it because it has no string concat operator that can work at compile-time |
14:58:33 | FromGitter | <RedBeard0531> "\"" is much more common (and logical) than """" |
14:58:49 | dom96 | yeah, if " is the only special case then it matches Python behaviour as well |
14:59:12 | miran | that works nice when you break a long string in couple of lines of code |
14:59:33 | * | c0ntribut0r quit (Ping timeout: 265 seconds) |
14:59:36 | Araq | miran, a + also works nice. |
14:59:44 | * | c0ntribut0r joined #nim |
14:59:45 | miran | it is uglier |
14:59:48 | dom96 | Araq: I do still get annoyed that I have to separate by & every time though :P |
15:00:03 | miran | just like \ line breaks are ugly |
15:00:15 | Yardanico | miran, I wouldn't agree that "a""b" is better than "a" + "b" :) |
15:00:22 | Araq | miran, I beg to differ, clarity cannot be ugly. |
15:00:44 | miran | Yardanico: i wouldn't agree that "a" + "b" is better than "ab" :P |
15:00:54 | dom96 | okay, so since we're making fmt"" even more like python |
15:01:01 | dom96 | Why not go all the way and change it's name to 'f'? |
15:01:04 | Araq | dom96, no, we are not. |
15:01:12 | Araq | we make it more useful for the common cases. |
15:01:16 | miran | dom96: why are you insisting on it so much? :D |
15:01:39 | dom96 | because I love it |
15:02:05 | miran | as i said on github - i love it too in python. but in nim it feels wrong |
15:02:15 | dom96 | Araq: And we do that by treating fmt"" as a non-raw-string literal |
15:02:15 | Yardanico | then even more people will use f without space |
15:02:22 | dom96 | which puts us closer to Python semantics |
15:03:03 | * | kivyion quit (Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/) |
15:03:11 | Araq | we don't do anything like that. right now the proposal is to make fmt parse backslashes |
15:03:11 | * | yglukhov quit (Remote host closed the connection) |
15:03:27 | miran | can this (non)-raw discussion be supplemented with some examples? |
15:03:36 | Araq | much like regexes parse backslashes |
15:03:37 | dom96 | Araq: What's the difference? |
15:03:56 | miran | what would `echo fmt "{4+3}\n{9+5}"` print? |
15:03:57 | dom96 | The change in behaviour is the same |
15:04:25 | FromGitter | <RedBeard0531> mirin: https://github.com/RedBeard0531/icemonim/blob/master/icemonim.nim#L192 should work with fmt"" rather than requiring "".fmt |
15:05:06 | FromGitter | <RedBeard0531> 714 |
15:05:09 | * | pwntus quit (Ping timeout: 264 seconds) |
15:05:36 | FromGitter | <RedBeard0531> shift-enter didn't work. pretend there is a real newline in there |
15:05:38 | * | yglukhov joined #nim |
15:05:48 | Yardanico | you don't need to use it like that |
15:06:06 | Yardanico | fmt "this should work too" |
15:06:08 | Yardanico | fmt("or this") |
15:06:12 | Yardanico | but I'm not sure :) |
15:06:17 | Araq | so ... yeah, there is precedent, regexes parse backslashes in their own way, fmt can parse backslashes too |
15:06:39 | Araq | mimicing Nim's backslash rules |
15:06:41 | * | yglukhov quit (Read error: Connection reset by peer) |
15:06:50 | dom96 | Once again, why not rename to 'f'? |
15:07:08 | Araq | bluenote worked with 'f' and it did bite. |
15:07:10 | * | yglukhov joined #nim |
15:07:17 | dom96 | how? |
15:07:23 | miran | 2. what would `echo fmt"text {"more\ntext"} bla"1 print? |
15:07:31 | Araq | lots of reasons. |
15:07:49 | Yardanico | dom96, people will say "fuuu! nim copies everything from python! lame!!" :D |
15:08:07 | miran | dom96: 'f' is the most common one letter function name |
15:08:10 | Araq | proc generic[T] = var t = 9; echo f # typo not caught |
15:08:39 | dom96 | Araq: Why is that not an error? |
15:09:00 | dom96 | miran: Do you have data to back that claim? :P |
15:09:15 | Araq | proc transform(f: proc()) = echo f"{8}" # type error? |
15:09:41 | miran | dom96: you cannot go around telling people "stop using `i` as a variable in iteration, now it has a special meaning in nim" |
15:09:42 | Araq | this one works thanks to OR I think but I'm sure I can create a case where it hurts |
15:10:07 | Araq | dom96, 'f' is in scope, no error. |
15:10:12 | dom96 | miran: That's not what I'm doing. That variable is indeed common, but 'f', I don't see it much. |
15:10:45 | dom96 | Araq: 'f' takes arguments, how can it not be an error? |
15:10:45 | Araq | dom96, it will caught at generic instantiation time but it's meh |
15:11:03 | miran | dom96: then you're not looking at much mathematical/physics codes, nor functional programming |
15:11:05 | Araq | it is a "late" error. |
15:11:29 | * | yglukhov quit (Ping timeout: 248 seconds) |
15:11:31 | Araq | because in plenty of contexts Nim does symbol bindings without type disambiguations |
15:11:46 | Araq | as types are not yet available. |
15:13:08 | Araq | that said, I like 'fstr' better as 'fmt' as a name |
15:13:27 | Araq | or maybe 'fs' |
15:13:34 | FromGitter | <GULPF> both `fmt` and `fstr` are so long :( |
15:13:40 | * | c0ntribut0r quit (Ping timeout: 260 seconds) |
15:13:44 | Araq | 'fs' then? :-) |
15:13:56 | dom96 | Araq: Did you ever fix VS code's search? |
15:13:59 | subsetpark | fmt is pretty damn short, just to say |
15:14:00 | dom96 | now it's failing for me... |
15:14:13 | Araq | what do you mean? |
15:14:19 | Yardanico | dom96, ah, when we talked about ripgrep? |
15:14:26 | Araq | yeah. |
15:14:34 | * | c0ntribut0r joined #nim |
15:14:37 | FromGitter | <GULPF> @subsetpark not compared to string interpolation in other languages |
15:14:37 | dom96 | yeah |
15:15:10 | Yardanico | dom96, "search.useRipgrep": false |
15:15:14 | Yardanico | in your settings in vscode |
15:15:18 | FromGitter | <GULPF> 'fs' is better, but IMO it should be a 1-character name |
15:15:33 | Yardanico | all 1-character names are too common :) |
15:15:42 | Araq | can't take this seriously, sorry |
15:15:52 | subsetpark | Let's not overstate the case here. Python didn't even *have* f-strings up until about a week ago. Myself and the rest of the python-speaking world have been getting along just fine with "".format() for a long time. |
15:15:53 | miran | 1-char name? big no from me |
15:16:06 | Araq | will name you GUL until you see the light :P |
15:16:15 | Yardanico | subsetpark, week ? wtf |
15:16:16 | dom96 | btw |
15:16:19 | Yardanico | :P |
15:16:20 | FromGitter | <GULPF> haha |
15:16:23 | dom96 | var fmt = 42; fmt"..." works fine |
15:16:29 | miran | Araq: GUL is too long, why not G? |
15:16:30 | dom96 | as does defining a `proc fmt` |
15:16:44 | miran | G"" |
15:17:00 | dom96 | so I'm still unconvinced that this will be a problem |
15:17:07 | FromGitter | <GULPF> you have no right to complain, the compiler is full of 1-character names after all ; ) |
15:17:11 | dom96 | You can still use 'f' as an identifier to your hearts content |
15:17:28 | Yardanico | ◍"this is better" :D |
15:17:33 | Araq | GULPF: not because I'm too lazy to type. |
15:17:38 | Yardanico | (and it's actually possible lol) |
15:17:41 | Araq | because I'm too lazy to invent stupid names. |
15:18:03 | Araq | actually I'm also to lazy to read the result, so ok. |
15:18:13 | Araq | point goes to you. |
15:18:40 | dom96 | Araq: Also, your first example doesn't compile |
15:18:56 | Araq | dom96, it does if you have one 'f' in your scope |
15:19:11 | Araq | which is the context we're talking about. |
15:19:37 | FromGitter | <GULPF> what about using an operator like `@`? C# uses `$` so it's not completely alien |
15:19:54 | dom96 | oh right, well, that already happens a lot with generics |
15:20:00 | Araq | operators are reserved for common operations. |
15:20:04 | dom96 | IMO it's a non-issue |
15:20:25 | Araq | and "common" is defined as "what Araq considers important" |
15:20:37 | dom96 | I could import some package that exports 'f' too and have the same problem |
15:20:43 | dom96 | and I wouldn't even know |
15:20:44 | Araq | since Araq doesn't even like format strings an operator is off the table :P |
15:21:01 | Yardanico | argh, again unicorn on github |
15:21:03 | FromGitter | <GULPF> well then :P |
15:21:10 | Yardanico | https://twitter.com/githubstatus/status/951473930031779841 |
15:21:15 | dom96 | yeah, gist is unicorning |
15:21:19 | Yardanico | not only gist |
15:21:23 | Yardanico | github is unicorning for me |
15:22:43 | * | miran left #nim (#nim) |
15:22:53 | dom96 | Pastebin it is I guess |
15:23:02 | dom96 | https://pastebin.com/BnD8dxqD |
15:23:09 | dom96 | No issues there |
15:23:17 | FromGitter | <RedBeard0531> That is worded strangely. Like they are waiting for people to report to them that their site is down rather than having monitoring in place. |
15:23:38 | dom96 | and this works too https://pastebin.com/7ae2xs4f |
15:23:42 | Yardanico | yay they updated their status https://status.github.com/messages |
15:23:47 | Yardanico | " We are investigating reports of service unavailability." |
15:24:00 | subsetpark | the web is poison, people! |
15:24:13 | dom96 | wow, so much red in the past |
15:24:23 | Yardanico | dom96, it wasn't there before they changed current status |
15:24:29 | Araq | ok, here is the solution |
15:24:35 | Araq | an unary % operator! |
15:24:42 | dom96 | Another reminder that we should come up with a way to store issues/PRs/etc in the git repo as well |
15:24:48 | Araq | % is already the format operator |
15:24:51 | Yardanico | Araq, hmm |
15:24:59 | Yardanico | %"{myvar}" not that bad |
15:25:02 | Araq | and %"{0}\n" does the right thing |
15:25:07 | Yardanico | well I mean it's good :) |
15:25:11 | Araq | since it's not a raw string literal |
15:25:12 | subsetpark | That makes a lot of sense... |
15:25:35 | Yardanico | Araq, will %"{a[\"b\"]}" work? yay |
15:25:45 | FromGitter | <GULPF> +1 from me |
15:26:24 | dom96 | hah |
15:26:34 | dom96 | that's genius |
15:26:36 | FromGitter | <RedBeard0531> It would be weird if the escaping applied inside the {} |
15:26:53 | dom96 | and we're back to square one :P |
15:27:00 | FromGitter | <RedBeard0531> but still seems better than status quo...hmm |
15:27:18 | Yardanico | :D https://strawpoll.com/hy366wp8 |
15:27:34 | Yardanico | sorry, no "other" option today |
15:27:36 | dom96 | ooh, strawpoll got a redesign |
15:27:46 | dom96 | Now I'm reminded of our livestream polls |
15:27:47 | Yardanico | that's another strawpoll afaik |
15:27:55 | dom96 | Hrm, maybe I'll do a livestream this weekend |
15:27:58 | Yardanico | http://www.strawpoll.me/ this is the one we've used in the past |
15:28:08 | dom96 | oh, interesting |
15:29:52 | dom96 | I didn't realise that operators in front of string literals don't create a raw string |
15:32:27 | Araq | yeah, let's go with % I doubt it can be topped |
15:32:43 | dom96 | Challenge acce-- nah, I doubt it too |
15:34:24 | dom96 | I wonder how nitely's regex implementation is going (that was nitely wasn't it?) |
15:39:08 | Yardanico | yay, github works |
15:41:16 | Yardanico | argh, my eyes are bleeding https://github.com/bung87/gpx2baidumap-array/blob/master/main.nim |
15:42:26 | dom96 | this is why we need nimpretty |
15:42:33 | * | azur_kind joined #nim |
15:44:43 | Yardanico | actually I did a few random PRs to small nim projects to make them look prettier :) |
15:45:26 | livcd | did i see nimpretty here ? :D |
15:46:16 | Yardanico | dom96, I bet changelog (including closed issues) will be quite big for 0.18.0 :P |
15:47:24 | Yardanico | it's very satisfying to read big changelogs btw (unless you have to fix a ton of deprecation warnings) |
15:50:17 | Yardanico | also - semaphoreci is faster even on small projects (because of nim compiler compilation), it takes only ~1:30 to build nim and nimble: https://semaphoreci.com/yardanico/nickel/branches/master/builds/3 |
15:50:48 | Yardanico | (best test suite ever - check if program compiles) |
15:54:31 | * | BitPuffin quit (Remote host closed the connection) |
16:09:36 | FromGitter | <Varriount> semaphorici? |
16:11:13 | * | der joined #nim |
16:12:40 | Yardanico | SemaphoreCI :) |
16:15:03 | * | der quit (Remote host closed the connection) |
16:15:17 | * | derlafff quit (Remote host closed the connection) |
16:15:36 | * | derlafff joined #nim |
16:15:36 | FromGitter | <alehander42> unary `%` is smart :D |
16:15:48 | * | endragor quit (Remote host closed the connection) |
16:15:52 | * | miran joined #nim |
16:19:35 | * | PMunch quit (Ping timeout: 260 seconds) |
16:24:07 | Araq | even better, %r"\n" gives a raw string |
16:24:16 | Araq | no special casing in the macro required |
16:24:26 | Araq | everything works out beautifully |
16:24:58 | Yardanico | Araq, will you push it today? :) |
16:26:27 | * | arnetheduck quit (Ping timeout: 240 seconds) |
16:31:14 | * | floppydh quit (Quit: WeeChat 2.0.1) |
16:31:26 | Araq | yes |
16:33:22 | * | endragor joined #nim |
16:35:23 | * | zahary joined #nim |
16:37:41 | * | endragor quit (Ping timeout: 256 seconds) |
16:43:27 | * | yaiyan is now known as Yaiyan |
16:47:00 | miran | if somebody could create a forum post to showcase the new usage of %, that would be great |
16:47:38 | miran | on the other hand, those kinds of things should be somewhere in documentation/manual, right? |
16:47:49 | Araq | lol why? %"{foo}" is the syntax |
16:48:09 | Araq | the manual contains the lexing rules, yes |
16:49:15 | Araq | I can replace 'fmt' with '%' in strformat, that's the whole patch |
16:49:27 | miran | how does it behave with those \n inside, and how outside of {}? |
16:49:40 | * | azur_kind quit (Remote host closed the connection) |
16:50:00 | miran | can i do %"{3.333333:.2f}"? |
16:50:45 | miran | can i do %"{2.5:>10}"? |
16:51:33 | Araq | why not? |
16:51:51 | Araq | identifier"string" is an extended raw string literal |
16:51:55 | Araq | %"string" is not |
16:51:59 | miran | i don't know why not. i don't know what works and what doesn't |
16:52:02 | Araq | so \n is parsed differently |
16:52:25 | Araq | according to Nim's lexing rules |
16:52:34 | Araq | everything works out |
16:53:40 | * | azur_kind joined #nim |
16:58:39 | * | azur_kind quit (Remote host closed the connection) |
17:03:06 | c0ntribut0r | Hello guys! Let me distract you from that "%" thing :) Is there any way in nim to tell compiler to use tail call optimization? |
17:08:06 | Araq | c0ntribut0r, no, you can enable it for GCC though |
17:08:21 | Araq | independently of the other optimizer settings afaict |
17:09:15 | Yardanico | there's also tailcallelim pass in clang https://llvm.org/docs/Passes.html#tailcallelim-tail-call-elimination |
17:09:31 | Araq | now ... what do we do with the "format" protocol? |
17:09:40 | Yardanico | Araq, what is wrong with it? |
17:10:11 | Araq | it simply assumes that format(T, string) yields void and means "append" semantics |
17:10:17 | c0ntribut0r | Thanks everyone |
17:10:26 | Araq | addFormat would be clearer |
17:12:12 | dom96 | Araq: What's wrong with that? |
17:19:42 | * | darithorn joined #nim |
17:21:11 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
17:24:51 | FromGitter | <krux02> Araq: can you give me a few seconds of your time? |
17:25:05 | FromGitter | <krux02> I try to understand the compiler internal type ast |
17:25:32 | Yardanico | OH MY EYES https://github.com/nim-lang/Nim/blob/425f221440cbd453591d0fca9eaf93671d5f6d62/lib/pure/strformat.nim |
17:25:35 | FromGitter | <krux02> here is the AST I am currently working with http://ix.io/E1Z |
17:27:09 | FromGitter | <krux02> or here with line numbers: http://ix.io/E1Z/Nim |
17:28:31 | FromGitter | <krux02> I try to extract Vec[4,float32] as a node, somehow. |
17:29:25 | FromGitter | <krux02> the only position in this AST where I can see a 4 followed by a float32 is in line 75 |
17:32:03 | dom96 | Araq: Why was readChar deprecated? |
17:32:26 | * | sendell quit (Remote host closed the connection) |
17:33:39 | dom96 | It was deprecated here and I don't get it: https://github.com/nim-lang/Nim/commit/794d36cf31d8f7debc2ede1f7792fdbcc0a1ef5e |
17:36:04 | Araq | krux02: yeah it's messy, usually I only look at the "implementation" part |
17:36:19 | dom96 | "readChar shouldn't be used for anything as it's too slow (usually needs to acquire a lock)." |
17:36:26 | Araq | (the object arr: array[] thing you refuse to base your analysis on) |
17:36:29 | dom96 | Despite this I would argue it's still useful |
17:36:55 | Araq | dom96, it also uses the IOError exception as the EOF marker |
17:37:02 | Araq | which is also not nice IMO. |
17:37:14 | dom96 | The reason I ask is because of this https://stackoverflow.com/questions/48186397/nim-readchar-deprecated-what-to-use-instead |
17:37:36 | Araq | if readBuffer(addr myChar, 1) == 1 |
17:37:41 | Araq | or something like that |
17:38:27 | dom96 | look at the code |
17:38:36 | dom96 | replacing that function with this is bleh |
17:38:40 | dom96 | and it's unsafe code (!) |
17:41:26 | Yardanico | Araq, ohhh, % has the same signature as %from json, so % from json is being implicitly picked up by default |
17:42:07 | Yardanico | hmm, I don't get it |
17:42:55 | Yardanico | it works fine in separated code |
17:42:58 | Yardanico | but not in my project :) |
17:43:31 | Yardanico | oh, here it is |
17:44:21 | Yardanico | Araq, seems like I shouldn't use unindent this way :) https://gist.github.com/Yardanico/f6f9f5942f936d1db9cfd33f3257f330 |
17:44:39 | Yardanico | and this code compiles |
17:44:53 | Yardanico | and echoes "{a}\n{b}\n" :) |
17:46:58 | Araq | Yardanico: argh... |
17:47:32 | Araq | any obvious solutions? |
17:48:02 | Araq | omg that was stupid |
17:48:13 | dom96 | omg lol |
17:48:34 | Yardanico | so as I understand unindent is called first, and only after json.% is called |
17:49:18 | * | Pisuke joined #nim |
17:49:39 | * | MyMind quit (Ping timeout: 256 seconds) |
17:49:52 | FromGitter | <Yardanico> *after that |
17:50:23 | * | azur_kind joined #nim |
17:51:05 | FromGitter | <krux02> Araq: what does the last child of a type semantically mean? |
17:51:12 | Araq | Yardanico: +obj.field # how do think this is parsed? |
17:51:25 | Araq | krux02: the instantiation |
17:51:38 | Araq | Yardanico: %x.f is the same |
17:53:26 | FromGitter | <krux02> Araq: getTypeInst recrusevely taks the last child of the last child until termination |
17:53:40 | FromGitter | <krux02> that is causing the problem I have |
17:54:16 | Araq | quite possibly |
17:54:22 | Araq | try it without the loop? |
17:54:38 | Araq | hello ...? I need a solution asap |
17:54:50 | Araq | strformat.% bites json.% |
17:55:19 | FromGitter | <krux02> well the loop was introduced intentionally |
17:55:25 | FromGitter | <krux02> with a patch recently |
17:55:51 | FromGitter | <krux02> I check when it happened |
17:56:02 | dom96 | Araq: I have no ideas |
17:56:08 | dom96 | There isn't really a solution |
17:56:16 | dom96 | Either we use a different operator |
17:56:25 | dom96 | or ... there is no other solution |
17:56:26 | Araq | which one? |
17:56:32 | Araq | which operator to pick instead? |
17:56:44 | dom96 | \ ? |
17:57:00 | Araq | unary '&' ? because it translates into a concat expression? |
17:57:24 | Araq | &"{foo}\n" # still looks nice |
17:57:38 | dom96 | I don't like that: "Hello" & &"{foo}" |
17:57:58 | Araq | hmm but it hardly comes up |
17:58:15 | Araq | since you would embed the concat into the format string, that's its point after all. |
17:58:15 | dom96 | it will come up if I need to wrap the strings |
17:58:35 | Araq | I said "hardly", not never. |
17:59:28 | miran | back to 'fmt'? :D |
17:59:49 | Araq | *& but then it's 2 chars and somebody's fingers will start to bleed |
18:00:01 | dom96 | two shifted chars as well... |
18:00:05 | Yardanico | miran, nah, it'll still be a operator I think |
18:00:19 | Araq | the operator solution is too elegant |
18:00:21 | Yardanico | people like me will need to carefully read manual :P |
18:00:30 | dom96 | we could also rename json.% |
18:00:33 | miran | how come we don't have bitwise & and |? |
18:00:39 | Yardanico | miran, we do |
18:00:40 | dom96 | well, we actually can't |
18:00:40 | Araq | we need to keep it but pick an operator that is not yet used. |
18:00:42 | dom96 | It's canon |
18:00:42 | Yardanico | and and or |
18:00:46 | miran | i guess it was readability |
18:00:51 | Araq | dom96: was about to say that :P |
18:01:22 | miran | Yardanico: i'm talking about exactly & and | as keywords, not `and` and `or` |
18:01:34 | Yardanico | keywords? :D |
18:01:46 | miran | and now suddenly `&` is ok for something more common |
18:02:07 | miran | and it is something which is not as widespread as bitwise & |
18:02:38 | Araq | I like *& fwiw, it produces zero or more concats |
18:02:53 | Araq | *&"{foo}\n" |
18:03:02 | * | yglukhov joined #nim |
18:03:03 | Araq | meh. I dunno |
18:03:08 | miran | i don't see connection between `*&` and string formatting |
18:03:08 | dom96 | -1 from me |
18:03:18 | dom96 | \"{foo}\n" |
18:03:22 | dom96 | Inspired by Swift |
18:03:31 | dom96 | not sure if that's even possible |
18:03:35 | Araq | dom96: I find that harder to read |
18:03:43 | Araq | it is possible. |
18:03:52 | miran | ?"{bla}" |
18:04:02 | Yardanico | !@#$ |
18:04:05 | Araq | "lambda foo -- what?" |
18:04:17 | dom96 | yeah, reminds me of lambda too |
18:04:38 | miran | to be honest, ? makes more sense to me than & |
18:04:39 | dom96 | it does contain code though, so it sorta makes sense |
18:04:52 | miran | you're "asking" to evaluate string |
18:05:20 | dom96 | @"{bla}" maybe? |
18:05:34 | dom96 | although with seq using it, it's weird |
18:07:33 | * | yglukhov quit (Ping timeout: 264 seconds) |
18:10:22 | * | S1tiSchu quit (Read error: Connection reset by peer) |
18:11:07 | miran | it should be a symbol not used elsewhere, so that leaves out: @#$%^&*()-+=/<>\ |
18:11:27 | miran | remaining: ` ~ ? |
18:11:54 | dom96 | what about ! ? |
18:12:03 | Yardanico | macros module? |
18:12:07 | Yardanico | but ! is deprecated anyway :) |
18:12:12 | Yardanico | (in macros) |
18:12:12 | miran | ` is too similar to ', ~ is too similar to - (remember those don't use `l` as a name warnings?) |
18:12:17 | dom96 | yeah, its use in macros isn't very useful |
18:12:51 | miran | `!` seems logical |
18:13:22 | dom96 | I think we've kind of been loosely keeping `!` free for others to use |
18:13:39 | * | devdri joined #nim |
18:13:57 | Yardanico | and people still say that nim is unstable, look at this: https://gist.github.com/Yardanico/adb9315d3b77df3998fa195453126cf7 I have a DSL in my project which also uses async, so C code is compilcated as hell, but it works :) |
18:14:26 | * | devdri quit (Client Quit) |
18:15:22 | Yardanico | (it's compiled in release mode here) |
18:15:26 | * | yglukhov joined #nim |
18:16:05 | miran | ok, if ! should be used for other stuff, what do you guys think about `?` ? |
18:16:29 | * | yglukhov quit (Read error: Connection reset by peer) |
18:16:53 | miran | ?"{3+4}" |
18:17:01 | * | yglukhov joined #nim |
18:17:14 | FromGitter | <RedBeard0531> I still like fmt. It's also easier to do the right thing internally if it is a name rather than an operator |
18:17:58 | miran | `fmt` is fine by me, but suddenly there was "it has to be an operator":) |
18:20:41 | * | Trustable joined #nim |
18:25:03 | FromGitter | <RedBeard0531> It also seems like it would be generally useful to expose equivalent logic from getString in macros.nim. Once that is done, it becomes easy to make fmt do the right thing. |
18:27:54 | * | Sembei joined #nim |
18:28:02 | * | Pisuke quit (Ping timeout: 255 seconds) |
18:28:47 | dom96 | Operator makes sense because it won't require parsing of the backslashes in the string |
18:29:12 | * | Vladar quit (Remote host closed the connection) |
18:29:22 | FromGitter | <RedBeard0531> But that makes it impossible to avoid parsing backslashes inside the {} |
18:30:00 | * | azur_kind quit (Read error: Connection reset by peer) |
18:30:21 | FromGitter | <RedBeard0531> And I think unescapeStr is a generally useful function to have exposed, which takes the hard part out of fmt itself |
18:30:38 | * | azur_kind joined #nim |
18:35:51 | FromGitter | <RedBeard0531> strutils.unescape is almost right, but it only handles a subset of the \ escape codes. Can that be expanded to cover the rest and error on unknown escapes? |
18:36:06 | * | Jesin joined #nim |
18:39:33 | * | Vladar joined #nim |
18:51:35 | FromGitter | <GULPF> making it an operator means that doesn |
18:52:02 | FromGitter | <GULPF> *means that it doesn't need special handling of '\' though |
18:52:40 | FromGitter | <GULPF> it's much more elegant that any alternative |
18:54:35 | * | c0ntribut0r quit (Ping timeout: 240 seconds) |
18:54:41 | FromGitter | <GULPF> the problem is not that it's hard to implement with a normal identifier, the problem is that it breaks the consistency of the raw string syntax |
18:55:26 | * | yglukhov quit (Read error: Connection reset by peer) |
18:55:36 | * | azur_kind quit (Remote host closed the connection) |
18:56:02 | * | yglukhov joined #nim |
19:04:02 | * | devdri joined #nim |
19:06:44 | FromGitter | <RedBeard0531> But you don't actually want fmt to take a fully cooked string. You only want to parse escapes outside of the {}. You can't do that with an operator. |
19:17:17 | FromGitter | <GULPF> Hmm that means that operators named `\` can't be used inside the `{}`. That's pretty bad |
19:21:55 | * | Vladar quit (Quit: Leaving) |
19:24:31 | yglukhov | dom96: you around? |
19:24:46 | dom96 | yes |
19:27:28 | FromGitter | <RedBeard0531> Gulph that is why you don't want fmt to be an operator. |
19:29:14 | Araq | RedBeard0531: use ?r"\n" to get the non interpreted backslashes |
19:29:18 | Araq | works. |
19:29:28 | Araq | (assuming we go for '?') |
19:29:51 | Araq | echo ?"{foo}" |
19:30:00 | Araq | I still prefer unary & |
19:30:10 | Araq | it's sugar for a concatenation |
19:30:17 | Araq | why not use & ? |
19:30:43 | miran | "abc" & &"{123}" |
19:30:56 | Araq | so what, nobody has proven that comes up |
19:31:19 | Araq | besides, I use that in Karax and it quickly becomes acceptable |
19:31:38 | FromGitter | <RedBeard0531> The key is that I think the most common use case wants *some* slashes escaped |
19:31:48 | miran | i don't see the connection between the symbol & and string formatting |
19:31:57 | Araq | &"abc{123}" |
19:31:59 | Araq | --> |
19:32:13 | Araq | "abc" & $123 |
19:32:29 | Araq | how can you not see the connection? |
19:33:00 | miran | btw, what do you think about slightly changing how `echo` works? echo a, b, c now produces abc |
19:33:15 | miran | what about `,` produces one space? |
19:33:40 | Araq | don't see the point |
19:33:55 | miran | better connection is $"abc{123}" |
19:34:00 | Araq | for debugging it's usally echo a, " b: ", b |
19:34:10 | miran | let a = 10; b = 30 |
19:34:17 | miran | echo a, b --> 1030 |
19:34:21 | Araq | with string literals in between so you can have your spaces there |
19:34:30 | Araq | echo a, " ", b |
19:34:42 | Araq | echo a, ": ", b |
19:34:53 | Araq | echo "(", a, ", ", b, ")" |
19:35:13 | miran | you don't find it ugly/unnecessary? |
19:35:34 | miran | if i want concatenated, i would use & or sth |
19:35:41 | miran | usually i want them separated |
19:36:06 | Araq | yeah but I never want them separated by a space. |
19:36:25 | Araq | and so there is no good default. |
19:36:25 | FromGitter | <RedBeard0531> Any chance future.dump could be varargs? That seems more useful for a lot of cases |
19:36:37 | miran | echo "(", a, ", ", b, ")" -> this will be much nicer with fmt/f/%/&/? :D |
19:36:43 | Araq | also concentations are more expensive than a varargs mechanism |
19:37:29 | Araq | how do I "not" use the space in Python and avoid the allocations? ok, it's Python, nobody cares about allocations. |
19:37:31 | miran | echo ?"{a}{b}" |
19:37:39 | Araq | but Nim is systems programming. |
19:37:54 | miran | nice and simple :) |
19:38:00 | FromGitter | <RedBeard0531> Also, if command syntax could use named args, you could probably do echo a, b, sep=" " |
19:38:07 | Araq | hardly. it's disgusting |
19:38:14 | alexday | hi Araq , I just wanted to keep in touch with you. :P |
19:39:07 | FromGitter | <RedBeard0531> Is there a technical reason why command syntax can't support named args? |
19:39:28 | Araq | I think it would take the syntax past its breaking point |
19:39:31 | Araq | but I'm not sure. |
19:40:14 | FromGitter | <RedBeard0531> Breaking compilers is my specialty ☺ |
19:40:17 | Araq | so ? or & |
19:40:29 | miran | ok, so no space between things in echo? :( i guess i'll have to use string formatting for that.... (as i find `a, " ", b` ugly) |
19:40:29 | Araq | can we decide on that? I want to work on something important. |
19:40:40 | miran | imho ? |
19:41:00 | miran | i stated my reasons above, but i can repeat them if necessary |
19:41:15 | Araq | miran, it's logical and with a bit of luck makes you use an even better separator |
19:41:24 | miran | what about `!`? |
19:41:32 | Araq | so that others can interpret the output of your programs |
19:42:17 | * | Yardanico_ joined #nim |
19:43:18 | Araq | miran, I think '!' should be some dangerous operation |
19:43:39 | miran | haha, ok |
19:44:15 | miran | then `?` as a shorthand for "can you evalute this string please?" :) |
19:44:27 | Araq | echo &"{foo} {bar}" |
19:44:30 | * | MyMind joined #nim |
19:44:34 | Araq | echo ?"{foo} {bar}" |
19:44:47 | miran | what is foo? what is bar? |
19:44:55 | miran | (translated) |
19:45:04 | * | Yardanico quit (Ping timeout: 255 seconds) |
19:45:08 | Araq | why does it matter? it uses your precious space |
19:45:26 | Araq | as the separator, that should be enough to make you happy :P |
19:45:28 | miran | &"{foo} --> "concatenate one thing?" |
19:45:42 | Araq | yes, nothing wrong with that |
19:45:57 | * | Sembei quit (Ping timeout: 240 seconds) |
19:46:07 | * | kier quit (Ping timeout: 248 seconds) |
19:46:12 | Yardanico_ | 4400 stars :) |
19:46:19 | miran | i just wanted to say that ? makes more sense to me |
19:46:35 | Araq | ok, now we only need some feedback from others |
19:46:42 | Araq | Yardanico_, ! |
19:46:51 | Araq | what do you say? |
19:46:53 | FromGitter | <RedBeard0531> ! Would be a good operator to let you store openarray in a data structure, not just an arg☺ |
19:47:06 | miran | well, dom96 is for `f` and nothing else :D :D |
19:47:30 | FromGitter | <data-man> echo <{foo} {bar}> |
19:47:40 | Yardanico_ | Araq, honestly I don't encounter a lot of operators like ! or @ , so I'm fine with ! |
19:47:56 | Araq | but ! is not in your list of options :P |
19:48:00 | Araq | it's ? or & |
19:48:00 | * | Yardanico_ is now known as Yardanico |
19:48:27 | FromGitter | <GULPF> ! > ? > & imo |
19:48:34 | Yardanico | Araq, well ? is a bit easier for me to type because it's closer to my fingers :P |
19:49:19 | FromGitter | <RedBeard0531> https://nim-lang.org/docs/pegs.html#%3F,Peg |
19:49:58 | FromGitter | <data-man> echo <{format}{me}"please"> |
19:50:09 | miran | GULPF: agreed |
19:50:24 | Araq | data-man: we don't have angle brackets |
19:50:28 | * | kier joined #nim |
19:51:28 | Yardanico | data-man: nim tries to implement as much of stdlib without compiler changes as possible |
19:51:34 | Yardanico | that's why async is not built-in for example |
19:51:39 | Yardanico | so core language is not that complicated |
19:52:36 | Araq | echo +"{foo}" |
19:52:54 | Araq | unary plus anyone? |
19:53:28 | FromGitter | <data-man> Ё"Hi{Yo!}" |
19:53:49 | Araq | data-man: it has to be an operator |
19:54:17 | miran | Araq: maybe you can leave !! for something exclamatory, and have ! for this? :) |
19:54:23 | Araq | !\?&"{0}" # best compromise so far |
19:54:46 | miran | :D |
19:54:47 | * | Ven`` joined #nim |
19:54:48 | FromGitter | <RedBeard0531> Araq: would a PR to make fmt only unescape the string parts be rejected outright? I still think that is the right design, and I'm willing to write it. |
19:54:51 | Araq | the "bang backlash question mark amp" operator |
19:54:59 | Yardanico | data-man: cyrillic letters huh? :P |
19:55:04 | FromGitter | <RedBeard0531> aka the "fuck this shit" operator |
19:55:13 | * | gokr joined #nim |
19:55:14 | Yardanico | Araq, !@#$ is better maybe? :) |
19:55:21 | FromGitter | <RedBeard0531> capital s-sharp? |
19:55:24 | Yardanico | ah |
19:55:27 | Yardanico | # can't be used |
19:55:51 | Araq | RedBeard0531: I don't like the name 'fmt' tbh |
19:56:03 | FromGitter | <RedBeard0531> emoji happy face since it makes you happy when you use it? |
19:56:16 | FromGitter | <RedBeard0531> Sorry, I've got my troll hat on and it is hard to remove... |
19:56:18 | * | gokr left #nim (#nim) |
19:57:00 | Yardanico | let's bring some names from emojicode programming language |
19:57:05 | Yardanico | 🐖 |
19:57:11 | FromGitter | <RedBeard0531> Hmm I like fmt since it seems imediately obvious what it is for. but `fstr` also seems fine |
19:57:18 | Araq | can't we remove the string{lit} and then json.% for strings would be ambiguous with strformat.% |
19:57:45 | FromGitter | <RedBeard0531> although I think that only makes sense by reference to a python feature, which is kinda silly |
19:57:48 | FromGitter | <data-man> > "{fmt}" |
19:57:58 | Araq | so only the people who use both all the time need to do something like import json except % |
19:58:28 | Araq | data-man: unary > is rewritten to < it would work but it also would be weird |
19:58:35 | Yardanico | Araq, I think strformat will be pretty commonly used with json |
19:58:50 | Araq | ok |
19:58:51 | FromGitter | <data-man> > "{fmt}" |
19:59:00 | Yardanico | I mean because people will for example call json apis |
19:59:08 | FromGitter | <data-man> Two > |
19:59:30 | FromGitter | <RedBeard0531> interp""? a bit long I guess |
19:59:35 | Yardanico | well I mean I'm ok with any choice |
20:00:15 | FromGitter | <RedBeard0531> Oh, is `F` a common name? How about F""? |
20:00:31 | FromGitter | <RedBeard0531> it won't collide with `f` due to partial case sensitivity |
20:00:48 | Araq | yeah I know but it's not in NEP-1 |
20:01:00 | Araq | and not that good to look at either IMO |
20:01:24 | Araq | also it means we need to use the complex implementation that cares about backslashes |
20:02:09 | FromGitter | <data-man> _{fmt} :-) |
20:02:14 | FromGitter | <RedBeard0531> I don't think so. I think it is just a matter of replacing the call to newStrLit(x) with newStrLit(unescape(x)) |
20:03:56 | Araq | an operator feel more idiomatic to me. :P |
20:05:18 | FromGitter | <RedBeard0531> Yeah, but it does the wrong thing inside of {}. Also it would behave differently with """ strings |
20:07:09 | * | yglukhov quit (Read error: Connection reset by peer) |
20:07:37 | FromGitter | <RedBeard0531> I think python got the f- vs fr-string distinction right. The stuff between {} never interprets \ and f vs fr decides how to treat \ outside the {}. I'm hopeful we can make it work that well in nim. |
20:07:56 | * | yglukhov joined #nim |
20:10:36 | Araq | I think I'll go with unary +, it has no meaning for strings and easy to type |
20:10:50 | Araq | and that's the main selling point of 'fmt' in the first place |
20:11:16 | alexday | when I do a nimble install nimsuggest. why does it start cloning the Nim repo? |
20:11:27 | Yardanico | alexday, firstly - why do you install it like that? |
20:11:30 | Yardanico | secondly - it uses compiler |
20:11:58 | alexday | then how do you install? |
20:12:17 | alexday | with koch? |
20:13:13 | FromGitter | <data-man> ~"{a}{b}" |
20:13:29 | Yardanico | alexday, yes |
20:13:37 | alexday | ok |
20:13:40 | Yardanico | ./koch tools will clone&compile nimble and nimsuggest |
20:14:40 | alexday | oh, Araq is the founder of nim :P . maybe he will mentor me someday :P |
20:14:47 | alexday | on writing languages |
20:15:26 | FromGitter | <RedBeard0531> ~ is the char lisp uses for formatting. but that always felt insane. D uses ~ for concat, so I guess it is kinda like & |
20:16:41 | FromGitter | <nitely> what about `%%"{abc}"`? |
20:16:56 | * | devdri quit () |
20:20:37 | FromGitter | <data-man> @@"{a}{b}" ⏎ ->"{a}{b}" ⏎ !!"{a}{b}" |
20:20:45 | * | claudiuinberlin joined #nim |
20:22:00 | FromGitter | <RedBeard0531> would implementing `macro \`{}\` (fmt: string): untyped` work? The use of {} feels right with the syntax. |
20:22:54 | FromGitter | <RedBeard0531> Well I fail at markdown. I meant for it to be named {} with the striped syntax. |
20:27:09 | dom96 | to be honest I dislike all operators except % :( |
20:30:11 | FromGitter | <data-man> sf"{a}{b}" |
20:30:50 | dom96 | nitely: how's your regex package coming along? |
20:31:02 | dom96 | also, %% might be a good idea |
20:33:58 | Araq | %%"{x}" this gets ugly fast |
20:34:15 | Araq | +"{x}" is growing on me |
20:34:39 | dom96 | I think I just prefer fmt"" now |
20:34:43 | FromGitter | <nitely> dom96: almost there. I'll open source it this weekend |
20:35:02 | dom96 | nitely: why not just pop it on to github now? |
20:35:10 | Araq | dom96, that doesn't work with \n though and would have to be special cased |
20:35:20 | Araq | and then it won't work with " inside |
20:35:24 | dom96 | we were going to do that anyway |
20:35:36 | dom96 | it shouldn't work with " inside |
20:35:43 | FromGitter | <nitely> dom96: you wanna try it or just check the code? |
20:36:02 | Araq | dom96, problem is wouldn't work with \" either |
20:36:14 | Araq | which is hard to argue for |
20:36:18 | dom96 | nitely: I'm just afraid you'll disappear someday and we won't ever get to see your masterpiece |
20:36:35 | dom96 | but I would like to try it |
20:37:20 | FromGitter | <nitely> dom96: ahaha I'm sure if I get hit by a bus someone in my family will release it XD |
20:37:30 | FromGitter | <data-man> +1 to try it :) |
20:37:46 | * | devdri joined #nim |
20:37:57 | dom96 | still, you should release it right now, there is no reason not to :) |
20:38:15 | FromGitter | <nitely> problem is, it requires my package nitely/nim-unicodedb and there were a couple of things missing theere |
20:38:35 | * | yglukhov quit (Read error: Connection reset by peer) |
20:39:18 | * | yglukhov joined #nim |
20:39:56 | FromGitter | <nitely> mainly for matching unicode with shorthands: `\w`, `\d`, etc |
20:40:19 | dom96 | why is that a problem? |
20:40:28 | dom96 | it doesn't have to be working 100% to be released :) |
20:40:46 | FromGitter | <nitely> well, it's almost done now anyway |
20:41:04 | Yardanico | wow, it supports unicode? |
20:41:05 | FromGitter | <nitely> I'll try and release it in a couple hours |
20:41:11 | dom96 | thanks :) |
20:41:22 | dom96 | Yardanico: Kind of a must-have for regex engines nowadays |
20:41:26 | FromGitter | <nitely> my goal is to have unicode level 2 support (i.e: graphemes) |
20:41:40 | FromGitter | <nitely> but that will take much longer |
20:41:59 | Araq | release early, release often. and start with version 1. |
20:42:11 | Araq | bufixes produce version 1.1, 1.2 etc |
20:42:22 | Araq | graphemes produce 2.0 |
20:42:31 | Araq | see Nim for how to not do things |
20:42:48 | Yardanico | yeah, if nim would be 17.2 no one would be complaining about 1.0 :D |
20:42:51 | Araq | version 1 should be "works for me" |
20:42:56 | enthus1ast | and if you see v1.1 wait for v1.2 ;) |
20:43:43 | * | Yardanico quit (Remote host closed the connection) |
20:44:14 | Araq | or go for a year-month release. |
20:45:13 | Araq | open source software is not a master thesis, there is no deadline |
20:45:39 | Araq | and the goals shift within time. |
20:46:11 | Araq | when you were born you couldn't even eat properly, your mother released you anyway |
20:46:36 | enthus1ast | but she had a deadline! |
20:46:44 | Araq | lol |
20:47:11 | Araq | ok, release any crap you have after 9 months |
20:49:43 | FromGitter | <data-man> A little bit about music https://github.com/lieff/minimp3 |
20:49:49 | enthus1ast | or sometimes deadlines help to get the best out |
20:52:15 | miran | i've been afk for cca 1 hour. has any decision been made? :) |
20:52:40 | Araq | always remember beneath a steel sky. https://youtu.be/d-x0qghlvfE?t=569 |
20:54:27 | Araq | miran, I went with an unary plus |
20:55:22 | miran | +"{it's better than &}" |
20:55:44 | Araq | the + looks a bit like an f :P |
20:56:25 | dom96 | :/ |
20:56:28 | FromGitter | <RedBeard0531> are you drunk or just have worse vision than me? |
20:56:35 | * | dom96 dislikes it |
20:57:02 | miran | :D |
20:57:04 | dom96 | let's go back to fmt"" |
20:57:14 | dom96 | I guess that's what I get about complaining about that name... |
20:57:26 | miran | memo for the future :) |
20:57:45 | dom96 | hah, nah, nothing will ever stop me fighting for what I believe in! |
20:58:31 | Araq | + t f |
20:58:32 | FromGitter | <RedBeard0531> My offer to make fmt"" work correctly still stands :) |
20:58:46 | Araq | and f is a plus with some bow |
20:59:04 | Araq | these are abstract symbols I doubt my vision has anything to do with it |
20:59:11 | dom96 | + is just weird here |
20:59:12 | FromGitter | <RedBeard0531> It is a very tall and depressed + |
20:59:23 | FromGitter | <RedBeard0531> hanging its head in shame |
20:59:28 | dom96 | please please reconsider |
21:00:18 | Araq | RedBeard0531: You can't fix \" for 'fmt' |
21:00:24 | miran | if only my iterator syntax proposal got 1/10 of the attention this fmt thing has got.... :( |
21:00:43 | Araq | miran, I read it and I like it. what else is there to say? |
21:01:19 | miran | Araq: that's nice to know, thanks! i was hoping if somebody else have something to add/say/improve.... |
21:01:41 | * | nsf quit (Quit: WeeChat 2.0.1) |
21:01:42 | dom96 | miran: Is there an RFC for this? |
21:01:59 | FromGitter | <data-man> StrFormat -> sf"{is}{the}{best}" |
21:02:11 | miran | https://github.com/nim-lang/Nim/issues/7047 |
21:02:25 | Araq | dom96, what if we stick to % then and live with the incompatibility with json? |
21:03:44 | * | MJCaley joined #nim |
21:04:06 | dom96 | argh |
21:04:21 | dom96 | what if we provide % and format? |
21:04:39 | enthus1ast | format formats |
21:04:42 | dom96 | put the % alias into a separate module, like: import strformat.ops |
21:05:02 | Araq | 'fmt' does not work well, again. |
21:05:15 | Araq | only an operator does. |
21:05:25 | dom96 | it does if you write fmt("..."), no? |
21:05:29 | miran | can json's % be changed? and why not? :) |
21:05:38 | dom96 | miran: because it's canon |
21:05:54 | dom96 | (my book shows many examples with it) |
21:06:00 | enthus1ast | § ? |
21:06:19 | Araq | dom96, true but that's too verbose for some people |
21:06:28 | dom96 | I feel like there should be a wiki article titled "Nim's historic moments" |
21:06:35 | dom96 | Where we put links to discussions like this |
21:06:51 | miran | can't you just have errata repo where will be errors plus differences in newer nim versions? |
21:07:08 | dom96 | I can, but I don't want to |
21:07:18 | miran | i know you're trying to avoid any thing that breaks the code in the book, but.... |
21:07:20 | dom96 | Me and Araq agreed that we will release v1 that's compatible with my book |
21:07:44 | Araq | what's wrong with + ? use it for one day and then come back and complain. |
21:08:03 | dom96 | + is commonly used for addition |
21:08:09 | dom96 | it's odd to use it for formatting |
21:08:12 | Araq | unary + is a nop. |
21:08:21 | Araq | and has no meaning for string literals |
21:08:29 | dom96 | yes, but it has meaning for humans |
21:08:57 | Araq | I'm a human and it has no meaning to me. |
21:08:58 | FromGitter | <data-man> wtf"{Oh}" |
21:09:10 | miran | ! in vim is 'execute command', i see some connection with 'evaluate string' :) |
21:09:26 | FromGitter | <RedBeard0531> Is the only problem with fmt that you need to use """ if you want to embed a " in a {} block? |
21:09:27 | Araq | pegs use unary + for "one or more" |
21:09:31 | dom96 | yeah, I would prefer ! to + |
21:09:56 | dom96 | Yeah, I'm still unclear about what the problem with fmt"" is |
21:10:06 | FromGitter | <RedBeard0531> assuming that fmt called newLit(unescape(str)) |
21:10:20 | Araq | fmt"\"" |
21:12:07 | dom96 | elaborate |
21:12:37 | FromGitter | <GULPF> second " ends the string since it's a raw string |
21:13:29 | dom96 | no, that raw string isn't finished |
21:13:31 | FromGitter | <RedBeard0531> Its a bit odd that you can't \" inside a raw string, but I guess that ship sailed long ago |
21:14:17 | Araq | fmt"\"" doesn't work |
21:14:36 | Araq | \/"\"" does |
21:15:09 | FromGitter | <RedBeard0531> We *could* make fmt require nnkTripleStrLit, but I guess that won't make anyone happy |
21:15:23 | FromGitter | <RedBeard0531> That is a cut the baby in half solution |
21:15:27 | FromGitter | <GULPF> @dom96 oh, I didn't realize that `""` is an escaped `"` in raw strings |
21:16:09 | FromGitter | <RedBeard0531> Yeah, that felt weird to me, but it is what it is |
21:16:16 | dom96 | yep |
21:16:27 | Araq | doubling the escape hatch is the only way that truely works |
21:16:33 | Araq | see \\ for an example. |
21:16:51 | dom96 | fmt"{\"}" would be a valid workaround |
21:17:23 | Araq | so I don't really think these criticisms against "" or '' are valid |
21:18:09 | Araq | or C's format strings where a percent is written as %% |
21:18:46 | Araq | by your logic that should have been \% and printf should do the interpretation of \n |
21:18:56 | alexday | https://nim-lang.org/docs/tut1.html#procedures-result-variable why is the design done like this. the result variable |
21:19:00 | alexday | implicit |
21:19:00 | FromGitter | <RedBeard0531> but \ is the escape in strings, not " |
21:19:22 | FromGitter | <GULPF> but not in raw strings |
21:19:29 | FromGitter | <RedBeard0531> alexday that has become one of my favorite nim features. give it a shot. You'll probably like it! |
21:19:44 | dom96 | RedBeard0531: I love that feature too :D |
21:19:48 | Araq | the point of raw strings is that the backslash is untouched |
21:19:56 | FromGitter | <GULPF> what if you actually want `\"` |
21:20:23 | FromGitter | <GULPF> `\\"`? then what if *thats* what you actually want |
21:20:56 | alexday | it sounds good, its unique. but then unless one knows the feature its difficult to know :P |
21:21:10 | Araq | alexday, Delphi and Eiffel have the feature too :P |
21:21:18 | Araq | and I took it from them. |
21:21:25 | miran | alexday: that's true about, well... everything, no? |
21:21:48 | alexday | oh ok. I see. |
21:22:09 | FromGitter | <GULPF> I'm starting to think `fmt""` is the best option... IMO backslashes needs to be handled differently inside and outside the `{}` blocks. The wart of having to use `"""` for `"` is OK |
21:23:20 | dom96 | now that I've seen the dreaded +, I will happily take `fmt""` |
21:23:28 | dom96 | Don't even care about f"" anymore |
21:23:37 | FromGitter | <GULPF> fmt"{\foo}\n" should work, where `\` is an operator |
21:23:38 | miran | echo "{"a\nb"}\n{"c\nd"}" == ? |
21:24:06 | miran | with fmt/+/?/whatever in front |
21:25:24 | dom96 | !eval echo r"{"a\nb"}\n{"c\nd"}" |
21:25:25 | NimBot | Compile failed: in.nim(1, 11) Error: undeclared identifier: '\' |
21:25:44 | dom96 | perfect for this occassion |
21:26:08 | Araq | ok, one last idea |
21:26:22 | Araq | we will have both fmt and % |
21:26:35 | dom96 | I suggested that above |
21:26:37 | Araq | import strformat except % can be used with JSON |
21:26:51 | dom96 | but also putting `%` into a separate module |
21:27:06 | Araq | why? people need to learn about import except |
21:27:07 | dom96 | i.e. import strformat.ops |
21:27:08 | miran | can't %/fmt be used without any import? |
21:28:24 | Araq | strformat.ops is not how anything else in the stdlib does things |
21:29:57 | * | Trustable quit (Remote host closed the connection) |
21:29:59 | dom96 | I suppose it makes sense to introduce people to this 'except' stuff ASAP |
21:30:28 | dom96 | but I fear it will be too prevalent |
21:33:16 | * | gokr joined #nim |
21:36:17 | * | natrys joined #nim |
21:38:16 | miran | "import strformat except % " --> so this is in separate module from strutils? |
21:38:46 | FromGitter | <GULPF> https://github.com/nim-lang/Nim/blob/devel/lib/pure/strformat.nim |
21:38:50 | FromGitter | <GULPF> yes |
21:39:26 | miran | my imports will be longer than my code :D |
21:40:00 | Araq | miran, my documentation comments are longer than my code |
21:40:11 | miran | that's ok :) |
21:45:02 | miran | well guys. i'm off to sleep, can't wait to see in the morning if it is still %/fmt, something else that already was a candidate, or something completely new :) |
21:46:42 | * | miran quit (Quit: Konversation terminated!) |
21:49:38 | * | Jesin quit (Ping timeout: 255 seconds) |
21:53:32 | yglukhov | Imo, all operators should be lightweight wrappers to something with a more meaningful name |
21:53:48 | dom96 | +1 |
21:54:28 | yglukhov | especially when those operators are macros, which are sometimes don't behave well in overloading resolution |
21:55:22 | yglukhov | e.g. https://github.com/nim-lang/Nim/issues/6643 |
22:03:04 | Araq | that issue uses 'foo' which is not an operator. |
22:03:36 | Araq | what's the logic here? 'untyped' is a bit aggressive, yes. |
22:03:49 | Araq | the connection with operators doesn't exist. |
22:07:29 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:11:26 | * | MJCaley quit (Quit: MJCaley) |
22:15:08 | * | Sentreen joined #nim |
22:17:29 | yglukhov | Araq: the logic is that operators are more likely to clash, because everyone thinks that his particular function is so extremely handy that it's gonna be used all over the place, so let's make this `%` = toJson(smth). Why `%`? because arithmetic operators are definitely meaningless here, and would just confuse everyone. So let's take some really meaningless operator and give it some meaning :D |
22:18:02 | yglukhov | and `%` is the first meaningless operator that comes to mind |
22:18:21 | yglukhov | just kidding of course, but you get the point ;) |
22:20:16 | * | joshbaptiste quit (Ping timeout: 268 seconds) |
22:22:23 | * | natrys quit (Quit: natrys) |
22:23:05 | Araq | I don't really. `%` doesn't use 'untyped' |
22:23:31 | Araq | and the stdlib is careful with its operators |
22:23:51 | Araq | case in point: % used to be fmt until we figured out it sadly doesn't really work well. |
22:24:49 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
22:25:16 | * | vlad1777d joined #nim |
22:25:18 | Araq | where are these operator clashes that you see? |
22:26:04 | Araq | and how would 'asgnPlus' instead of '+=' help? |
22:27:11 | yglukhov | % used to be (a) lightweight, non-generic (b) proc. |
22:27:23 | yglukhov | clashes may occur in non-std libs |
22:28:18 | Araq | json.`%`(a) # disambiguate. it works. |
22:28:40 | Araq | I think this is really nicely done in Nim and don't see why we need to change anything |
22:29:35 | Araq | now ok, json.% in particular it a bit misdesigned as the single %* that was introduced later would do the same job |
22:33:22 | yglukhov | "I think this is really nicely done in Nim" - i think so too. however, there's a bson module in nimongo, which has introduced `%*` as well (ok, that was a mistake, but still). now any module that imports bson and json (a lot of our server code) is doomed to always do json.`%*`(smth) and bson.`%*`(smth). With my suggestion we could just opt out to toJson(smth) and toBson(smth), which is (a) shorter and (b) meaningful. |
22:34:31 | Araq | well you can do that with a short helper module |
22:34:33 | yglukhov | other than that i'm completely happy with using the operators, and i like them. i'm just suggesting a friendly practice |
22:35:27 | Araq | it's unfortunate but you can put the discipline somewhere else ("import bsonex" to make things easy to write) |
22:37:10 | yglukhov | Araq: ok, here's another sample. this macro `%*` adds `%` to the ast nodes of its input |
22:37:29 | yglukhov | it hopes, that `%` will return JsonNode for MyType |
22:37:58 | yglukhov | now what if bson.`%*` wants the same? |
22:38:16 | Araq | it doesn't hope, I fixed that long ago, it uses bindSym"%" |
22:38:17 | yglukhov | and i want MyType to be both json and bson compliant |
22:38:31 | Araq | so it only uses the %'s in json.nim |
22:38:32 | yglukhov | even worse |
22:38:47 | dom96 | To all the people coming to FOSDEM, you guys want me to get Nim t-shirts for you? |
22:38:57 | dom96 | If so, tell me your size |
22:39:01 | yglukhov | so i can't put mytype into the json literal |
22:39:06 | yglukhov | dom96: yes! |
22:39:35 | yglukhov | L |
22:40:06 | dom96 | Oh, also need a colour preference: |
22:40:12 | dom96 | Denim Blue: https://uktshirtprinting.com/product/custom-product-5a5673687806c3-14363436 |
22:40:20 | dom96 | Dark Grey: https://uktshirtprinting.com/product/custom-product-5a56738b901695-06005377 |
22:40:27 | dom96 | Black: https://uktshirtprinting.com/product/custom-product-5a5673baf0ecc8-16150316 |
22:40:40 | dom96 | Navy Blue: https://uktshirtprinting.com/product/custom-product-5a567eba2753f5-71020628 |
22:40:53 | Araq | yglukhov, ok but now the problem shifted from "% clashes" to "%* doesn't support a protocol that it otherwise could" |
22:41:12 | Araq | which is true and we should fix json.nim |
22:41:13 | dom96 | There is also a fabric choice, one is ~£19.00 the other is ~£24.00 (but has less colour choices: just black and grey) |
22:41:39 | yglukhov | dom96: black lgtm |
22:42:02 | dom96 | The cheaper or more expensive one? |
22:42:09 | yglukhov | Araq: well, with my friendly practice this would never be a problem |
22:43:27 | yglukhov | but ok, maybe there's no point in arguing about it until the next nice use-case. |
22:43:29 | FromGitter | <RedBeard0531> @yglukhov We finally invested some time a few weeks ago to tune our server-internal BSON parser. If you are using bson a lot it may be worth doing the same thing in nimongo: https://github.com/mongodb/mongo/commit/3c586a7c946ac7f9485b9ff978fa029ac4b5108e |
22:44:17 | yglukhov | dom96: let it be the premial =) |
22:44:26 | dom96 | yglukhov: okay :) |
22:45:25 | dom96 | I wonder if I should ask on the forum |
22:45:31 | dom96 | not much time to order these now though |
22:45:43 | yglukhov | RedBeard0531: thanks! even though bson performance is not our main problem atm =) |
22:47:04 | dom96 | PMunch, federico3 ^^ any special requests for t-shirts? |
22:47:13 | * | joshbaptiste joined #nim |
22:50:11 | * | Jesin joined #nim |
22:51:43 | * | arecaceae quit (Ping timeout: 268 seconds) |
22:51:54 | dom96 | btw any comments on these designs welcome |
22:52:59 | * | arecaceae joined #nim |
22:54:23 | * | devdri quit () |
22:56:53 | * | chemist69 quit (Ping timeout: 276 seconds) |
23:07:37 | * | yglukhov quit (Remote host closed the connection) |
23:08:10 | * | yglukhov joined #nim |
23:09:41 | enthus1ast | join c |
23:09:56 | * | chemist69 joined #nim |
23:09:56 | enthus1ast | sorry |
23:11:00 | * | dddddd quit (Remote host closed the connection) |
23:11:45 | FromGitter | <zetashift> @RedBeard0531 I |
23:11:57 | FromGitter | <zetashift> ve heard some mixed things about MongoDB, where does it shine? |
23:12:27 | * | yglukhov quit (Ping timeout: 240 seconds) |
23:14:16 | FromGitter | <RedBeard0531> I've been working on it for over 8 years now so I'm a bit biased :) |
23:16:28 | FromGitter | <RedBeard0531> But we try really hard to make it damn easy to use. We focus on dev productivity for people building apps that use the DB. Probably best to DM if you have more questions though. |
23:16:47 | * | endragor joined #nim |
23:17:16 | * | MJCaley joined #nim |
23:21:03 | * | endragor quit (Ping timeout: 248 seconds) |
23:26:31 | Araq | RedBeard0531: Oh are you working for them? |
23:27:11 | Araq | interesting, Mongodb saved my butt once |
23:29:26 | FromGitter | <RedBeard0531> Yup. Glad to hear it! Any chance it was a feature I worked on? |
23:36:16 | * | MJCaley quit (Quit: MJCaley) |
23:39:31 | * | yglukhov joined #nim |
23:41:40 | FromGitter | <zetashift> Well I'm not asking why it's better than others, what kind of problems does MongoDB solve easier than others. I've used it twice before in small js sites and I liked how easy it was to get started with |
23:43:22 | Araq | RedBeard0531: Windows support? :-) |
23:43:53 | Araq | performance? |
23:44:09 | * | yglukhov quit (Ping timeout: 264 seconds) |
23:44:11 | Araq | being easy to setup and deploy? |
23:44:32 | Araq | the only downside is your query language :-) |
23:45:29 | FromGitter | <RedBeard0531> heh. I try to avoid working on our windows support but sometimes I can't help it. I do spend a LOT of time on perf improvements. I'm the goto guy for when things are slower than they should be. |
23:45:51 | * | zahary quit (Quit: Leaving.) |
23:46:10 | FromGitter | <RedBeard0531> Have you tried the agg language? I spent a lot of time on that a few years ago, although I've largely handed it off. |
23:46:18 | Araq | http://www.globalnerdy.com/wordpress/wp-content/uploads/2014/05/how-do-i-query-the-database.jpg |
23:46:41 | FromGitter | <RedBeard0531> trust me, we hate map/reduce more than you do... |
23:46:55 | Araq | that comic never gets old lol |
23:47:09 | FromGitter | <RedBeard0531> the new (well old now) agg language is our replacement for map reduce |
23:47:22 | Araq | never heard of it |
23:47:36 | Araq | it's been awhile since I last used Mongo |
23:49:55 | Araq | did you fix the "mongodb just keeps growing" problems on Windows? |
23:49:56 | FromGitter | <RedBeard0531> db.postcodes.aggregate([{$match: {state: "NY}}, {$group: {_id: "$city", totalPop: {$sum: "$pop"}, avgPop: {$avg: "$pop"}}}]) |
23:50:30 | Araq | oh yeah, that's not a query language. |
23:50:37 | FromGitter | <RedBeard0531> probably? I don't remember that one. |
23:51:58 | Araq | that's "too lazy to write a parser". ;-) |
23:52:00 | FromGitter | <RedBeard0531> I kinda like the queries-are-data API. It makes it really easy to build them programatically. |
23:52:34 | Araq | yeah or that. |
23:52:36 | FromGitter | <RedBeard0531> Haven't I told you that parsing is my least favorite part of programming ;) |
23:52:47 | Araq | it's an API, not a query language. fail. |
23:53:13 | Araq | the trick about "adhoc queries" is in the "adhoc" part |
23:53:44 | Araq | I don't write programs that construct these queries as often as I write queries. |
23:53:45 | FromGitter | <RedBeard0531> Most users access it programatically. and not from COBAL. |
23:58:26 | Araq | *shrug* I used Mongo because it works on Windows and had superior performance |
23:58:51 | Araq | and losing some data wasn't also a problem. |
23:59:44 | Araq | the "you have no schema" and "your query is a JSON" parts were a pita ;-) |