00:35:27 | * | endragor joined #nim |
00:37:39 | * | kier quit (Ping timeout: 268 seconds) |
00:39:17 | * | Cthalupa quit (Ping timeout: 276 seconds) |
00:39:19 | * | PMunch quit (Quit: leaving) |
00:39:59 | * | endragor quit (Ping timeout: 248 seconds) |
00:40:06 | * | Cthalupa joined #nim |
00:43:03 | * | Trustable joined #nim |
00:48:37 | * | kier joined #nim |
00:50:09 | * | Cthalupa quit (Ping timeout: 264 seconds) |
00:51:52 | * | Trustable quit (Remote host closed the connection) |
00:53:21 | FromGitter | <Varriount> @Quelklef Making a parser generator? |
00:54:17 | * | Cthalupa joined #nim |
00:55:38 | FromGitter | <Quelklef> Yessir :) although I didn't know that's what they're called when I started |
01:27:49 | FromGitter | <Quelklef> actually, if you know things about things, could you tell me what class parser im writing |
01:28:05 | FromGitter | <Quelklef> tbh I know minimal theory and just thought it'd be a cool thing to make |
01:34:46 | * | dddddd quit (Remote host closed the connection) |
01:35:22 | * | devdri quit () |
01:49:53 | * | MJCaley joined #nim |
02:33:03 | * | vlad1777d quit (Ping timeout: 248 seconds) |
02:33:20 | * | vivus quit (Quit: Leaving) |
02:57:53 | * | chemist69 quit (Ping timeout: 265 seconds) |
03:11:06 | * | chemist69 joined #nim |
03:14:03 | FromGitter | <Varriount> I wonder what kind of parser could parse Nim code |
03:14:21 | FromGitter | <Quelklef> A Nim parser :-P |
03:14:55 | FromGitter | <Quelklef> Could ask what kind the current one is |
03:15:14 | FromGitter | <Varriount> Current one is manually written |
03:15:27 | FromGitter | <Varriount> Araq is against parser generators |
03:15:35 | FromGitter | <Quelklef> Prolly still fits into a classification tho, ye? |
03:32:35 | * | arthurz joined #nim |
03:34:59 | * | arthur joined #nim |
03:35:23 | * | arthur is now known as Guest13415 |
03:35:39 | * | Guest13415 left #nim (#nim) |
03:58:48 | * | zarthur joined #nim |
03:59:19 | * | zarthur quit (Client Quit) |
03:59:19 | * | arthurz quit (Quit: Leaving) |
04:00:12 | * | arthurz joined #nim |
04:02:15 | * | thomasross_ joined #nim |
04:02:46 | * | thomasross_ quit (Max SendQ exceeded) |
04:03:15 | * | thomasross_ joined #nim |
04:04:47 | * | thomasross quit (Ping timeout: 248 seconds) |
04:08:57 | * | MJCaley quit (Quit: MJCaley) |
04:21:03 | * | MJCaley joined #nim |
04:23:22 | * | arthur joined #nim |
04:23:46 | * | arthur is now known as Guest59416 |
04:25:39 | * | arthurz quit (Ping timeout: 246 seconds) |
04:31:21 | * | MJCaley quit (Quit: MJCaley) |
04:35:05 | * | Guest59416 is now known as arthurz |
04:36:16 | * | endragor joined #nim |
04:37:12 | * | MJCaley joined #nim |
04:40:42 | * | endragor quit (Ping timeout: 246 seconds) |
04:47:23 | * | arthurz quit (Quit: Leaving) |
04:49:47 | * | MJCaley quit (Quit: MJCaley) |
05:03:07 | * | sz0 joined #nim |
05:19:19 | * | endragor joined #nim |
05:20:25 | * | endragor quit (Remote host closed the connection) |
05:20:33 | * | endragor joined #nim |
05:26:25 | * | UxerUospr quit (Quit: Lost terminal) |
05:37:29 | * | yglukhov joined #nim |
05:37:31 | * | user0 quit (Quit: user0) |
05:38:09 | * | endragor quit (Remote host closed the connection) |
05:39:25 | * | endragor joined #nim |
05:41:11 | * | qwertfisch quit (Ping timeout: 240 seconds) |
05:41:43 | * | qwertfisch joined #nim |
05:42:21 | * | yglukhov quit (Ping timeout: 264 seconds) |
06:06:15 | * | tefter quit (Remote host closed the connection) |
06:22:19 | * | endragor quit (Remote host closed the connection) |
06:24:32 | * | endragor joined #nim |
06:54:48 | * | Guest60668 joined #nim |
06:54:52 | Guest60668 | Check out this new language, it is better than Nim. https://www.ponylang.org |
06:55:52 | Guest60668 | see ya |
06:56:32 | FromGitter | <Quelklef> uh |
06:56:46 | Guest60668 | what? |
06:57:24 | FromGitter | <Quelklef> ...why |
06:57:30 | Guest60668 | Nim has a bad philosophy is it even has one, also, what the hell happens with the unsigned ints in Nim? |
06:57:38 | Guest60668 | if* it |
06:57:48 | FromGitter | <Quelklef> what do you mean what happens |
06:57:50 | FromGitter | <Quelklef> they're unsigned |
06:57:56 | FromGitter | <Quelklef> they're a data typ |
06:58:21 | Guest60668 | But i can't even get the max value of an unint64 |
06:58:44 | FromGitter | <Quelklef> Also I've found the Nim philosophy to be a very pragmatic and, frankly, refreshing one |
06:58:49 | Guest60668 | and the admins hates me, they didn't want to help me and they called me troll |
06:59:11 | FromGitter | <Quelklef> ... probably because you come on and advertise other languages |
06:59:56 | Guest60668 | How would you get the max value of an unint64? |
07:00:11 | Guest60668 | i bet you can't |
07:00:14 | FromGitter | <Quelklef> Dunno, I don't need to |
07:00:31 | Guest60668 | you would need to hard code it i guess |
07:00:31 | FromGitter | <Quelklef> Hardcode it. `.high` doesn't work, I assume because it's an Ordinal type |
07:00:33 | FromGitter | <Quelklef> but remember: |
07:00:37 | FromGitter | <Quelklef> Nim is in development |
07:00:43 | Guest60668 | okay |
07:00:47 | FromGitter | <Quelklef> and it has incredibly amazing other features which matter much more than `.high` |
07:01:05 | Guest60668 | like which one? |
07:01:27 | FromGitter | <Quelklef> idk, how about: |
07:01:40 | FromGitter | <Quelklef> incredibly powerful and flexible metaprogramming |
07:01:50 | FromGitter | <Quelklef> easy to use metaprogramming (templates) |
07:01:55 | FromGitter | <Quelklef> c-like speed |
07:02:09 | FromGitter | <Quelklef> efficient compiling (only compiling referenced procs) |
07:02:25 | FromGitter | <Quelklef> a robust type system that manages to work without the overhead of, say, interfaces |
07:02:35 | FromGitter | <Quelklef> closures |
07:02:47 | FromGitter | <Quelklef> exceptions |
07:03:04 | Guest60668 | is it data-race free? |
07:03:16 | FromGitter | <Quelklef> a type system which doesn't encourage mutation |
07:03:35 | FromGitter | <Quelklef> Look, buddy, I don't know what that means, and I don't really care. Don't come to the Nim IRC to diss Nim, please |
07:03:42 | Guest60668 | is it type safe and memory safe? |
07:03:55 | Guest60668 | why you get mad? we are just talking |
07:04:27 | Guest60668 | i was just asking you |
07:04:28 | FromGitter | <Quelklef> It sure is, unless you want it to not be (right, did I mention interfacing with C, optionally manually dealing with GC, ref, var, ptr, ...) |
07:05:51 | FromGitter | <Quelklef> I'm not mad per se, I'm just calling you out for being rude |
07:06:20 | * | solitudesf joined #nim |
07:06:52 | Guest60668 | well Pony compiles with LLVM, and Pony programs can natively call C libraries, also the compiler is able to generate C header files for Pony libraries so C/C++ programs can natively call Pony programs |
07:06:59 | FromGitter | <Quelklef> \ |
07:07:04 | FromGitter | <Quelklef> Oops, that was my cat |
07:07:12 | Guest60668 | cute cat |
07:07:19 | FromGitter | <Quelklef> Yeah, but this isn't the Gitter for Pony |
07:07:41 | FromGitter | <Quelklef> sorry, you're on IRC. This isn't the IRC room for Pony |
07:07:48 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
07:08:19 | Guest60668 | also, i think pony is more cute than Nim, cuz Nim has python's syntax but it feels like to program in C/C++ anyway |
07:09:02 | Guest60668 | then basically Nim is pure syntactic sugar |
07:09:08 | Guest60668 | true? |
07:09:17 | FromGitter | <Quelklef> Any compiled language could be called "pure syntactic sugar" |
07:09:37 | Guest60668 | but Nim is just C with another syntax |
07:09:41 | FromGitter | <Quelklef> er, no |
07:09:51 | Guest60668 | okay |
07:10:18 | Guest60668 | why the developer hates the unsigned ints tho? he thinks he is the only one who use the language |
07:10:29 | Guest60668 | it is like he doesn't give a fuck about the users |
07:10:34 | FromGitter | <qqtop> Well guest60668 it is time to pony up, before being banned from here , alternatively you could contribute an idea and some corresponding code. |
07:10:47 | FromGitter | <Quelklef> What is your goal here, man |
07:10:52 | FromGitter | <Quelklef> revenge on the devs? |
07:11:22 | Guest60668 | To show a better language?, also when the hell will Nim become post-1.0 |
07:11:32 | FromGitter | <Quelklef> but why |
07:11:33 | FromGitter | <Quelklef> O |
07:11:43 | FromGitter | <Quelklef> I think most people here are |
07:11:46 | FromGitter | <Quelklef> that's why we're here |
07:12:16 | Guest60668 | are you a contributor? |
07:12:28 | FromGitter | <Quelklef> In a sense |
07:13:04 | Guest60668 | Okay |
07:13:12 | Guest60668 | have you made something in Nim? |
07:13:19 | FromGitter | <Quelklef> yup |
07:14:05 | * | sz0 quit (Quit: Connection closed for inactivity) |
07:14:08 | Guest60668 | why should i choose Nim over Pony?, Pony's philosophy is defined and it is written on their website, where can i read Nim's philosophy? |
07:14:49 | FromGitter | <Quelklef> Does it matter? I never read about Nim's philosophy. I was looking for a language that was "type-safe Python" and found Nim, which turned out to be much more |
07:15:06 | Guest60668 | Nim is not really type safe |
07:15:11 | FromGitter | <Quelklef> I tried the language out, I loved it, end of story |
07:15:15 | FromGitter | <Quelklef> Why's that? |
07:15:22 | Guest60668 | because it has Nil |
07:15:33 | FromGitter | <Quelklef> That doesn't mean it isn't type safe, man |
07:15:42 | FromGitter | <Quelklef> It just means you have to do nil checks |
07:15:53 | FromGitter | <Quelklef> for, like, 6 types. Is Java also not type safe? |
07:16:02 | FromGitter | <SolitudeSF> well, pack it up boys, we found better language, lul |
07:16:08 | FromGitter | <Quelklef> for real lol |
07:16:18 | FromGitter | <Quelklef> may as well just cease development here and now |
07:17:33 | Guest60668 | do you have proof Nim is really type safe?, in PonyLang's website, they posted a document with a mathematical proof about their type safety |
07:18:02 | FromGitter | <Quelklef> The proof is in the putting |
07:18:07 | FromGitter | <Quelklef> I put bad type in, I get bad type out |
07:18:20 | Guest60668 | and Nim's multithreading sucks? |
07:18:30 | FromGitter | <Quelklef> never needed it, never used it |
07:18:34 | Guest60668 | i heard it is a pain in the ass |
07:18:44 | FromGitter | <Quelklef> you heard |
07:19:05 | Guest60668 | that is the problem, the developers of Nim just care about what they need |
07:19:17 | FromGitter | <Quelklef> good point |
07:19:25 | FromGitter | <Quelklef> write me a mathematical proof that that's the issue, and I'll listen to you |
07:20:23 | Guest60668 | Well just go to Nim's github repository, and read what they talk there |
07:20:35 | FromGitter | <Quelklef> I've spoken with the devs |
07:20:38 | Guest60668 | they are selfish developers |
07:21:01 | FromGitter | <Quelklef> They seem pretty reasonable from what I've read from them and my experiences with them |
07:21:14 | FromGitter | <Quelklef> not to mention helpful, spending time in this chat room to help the users out :] |
07:24:00 | * | miran joined #nim |
07:25:19 | * | Guest60668 quit (Ping timeout: 256 seconds) |
07:34:02 | * | yglukhov joined #nim |
07:34:56 | * | yglukhov quit (Remote host closed the connection) |
08:02:49 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a644929ce68c3bc74e3fb94] |
08:03:19 | miran | change let to var? |
08:03:31 | FromGitter | <Bennyelg> I tried it |
08:03:37 | FromGitter | <Bennyelg> it was my first check |
08:03:47 | FromGitter | <Bennyelg> i forgot to change it before post my question |
08:05:23 | FromGitter | <Bennyelg> ```code paste, see link``` ⏎ ⏎ try it [https://gitter.im/nim-lang/Nim?at=5a6449c3290a1f4561b5fa40] |
08:07:23 | * | dddddd joined #nim |
08:07:52 | miran | you have some typos - gussedTypes and guEssedTypes |
08:09:49 | miran | after that, it works but the logic seems wrong to me |
08:13:08 | miran | here you go: https://play.nim-lang.org/?gist=166584dd5f088df0e45c029592ccf54a |
08:14:46 | * | miran quit (Remote host closed the connection) |
08:16:01 | * | miran joined #nim |
08:19:38 | * | yglukhov joined #nim |
08:48:55 | FromGitter | <Bennyelg> Thanks |
08:53:47 | * | yglukhov quit (Remote host closed the connection) |
09:02:03 | * | nsf joined #nim |
09:02:43 | FromGitter | <data-man> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a645733ba39a53f1a40fd97] |
09:02:50 | * | gmpreussner quit (Ping timeout: 260 seconds) |
09:05:45 | * | gmpreussner joined #nim |
09:12:23 | * | endragor quit (Remote host closed the connection) |
09:13:53 | * | endragor joined #nim |
09:18:30 | Araq | hmmm I'm selfish |
09:19:51 | FromGitter | <Bennyelg> nice |
09:19:55 | FromGitter | <Bennyelg> @Araq |
09:24:17 | * | yglukhov joined #nim |
09:28:51 | * | yglukhov quit (Ping timeout: 256 seconds) |
09:31:19 | endragor | how do you make a cstring literal with escape sequences (e.g. line ending?) |
09:32:09 | Araq | cstring("\n") |
09:32:19 | endragor | doesn't that create a string first? |
09:33:21 | Araq | the conversion happens at compiletime |
09:33:31 | Araq | technically you're right |
09:33:55 | FromGitter | <tim-st> Does anyone knows of a working leveldb or rocksdb wrapper for nim? |
09:35:41 | endragor | @Araq ok, thanks :) |
09:36:02 | * | BitPuffin joined #nim |
09:38:36 | FromGitter | <data-man> @tim-st: https://github.com/zielmicha/leveldb.nim ? |
09:39:07 | FromGitter | <tim-st> I read the source code. No mention of dll or c sources, how should I use it? |
09:40:09 | FromGitter | <tim-st> there is only `{.passl: "-lleveldb".}` dont know if that's a hint |
09:41:21 | FromGitter | <tim-st> Is it hard to create a nim interface from the official rocksdb java JNI class? |
09:41:31 | FromGitter | <tim-st> that loads the dll |
09:43:34 | FromGitter | <data-man> https://github.com/singularperturbation/nim-leveldb |
09:43:53 | FromGitter | <tim-st> `(HIGH LEVEL WRAPPER STILL NEEDS TO BE WRITTEN)` |
09:44:00 | * | Yardanico joined #nim |
09:44:17 | FromGitter | <tim-st> It says. So basically it doesnt exist :( |
09:44:56 | Araq | -lldeveldb essentially means "Unix only" |
09:45:54 | FromGitter | <tim-st> ok, thanks |
09:48:22 | * | arecaceae quit (Remote host closed the connection) |
09:48:40 | * | arecaceae joined #nim |
10:00:43 | * | thomasross_ quit (Read error: Connection reset by peer) |
10:01:14 | * | thomasross_ joined #nim |
10:01:44 | * | thomasross_ quit (Max SendQ exceeded) |
10:02:12 | * | rauss quit (Read error: Connection reset by peer) |
10:02:14 | * | thomasross_ joined #nim |
10:04:40 | * | rauss joined #nim |
10:05:17 | * | yglukhov joined #nim |
10:07:29 | FromGitter | <Bennyelg> @data-man template tryCast(r: untyped, y: proc): bool = ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a646661ce68c3bc74e4794c] |
10:08:21 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a646695e01412265070b8f0] |
10:09:10 | FromGitter | <data-man> @Bennyelg: Bench an implementations :) |
10:09:39 | * | yglukhov quit (Ping timeout: 256 seconds) |
10:09:42 | FromGitter | <Bennyelg> hehe |
10:10:08 | * | vlad1777d joined #nim |
10:10:52 | * | devdri joined #nim |
10:15:04 | FromGitter | <tim-st> @data-man The second url you provided works on windows, thanks! Only 2 procs would be needed to have the wrapper complete without these c strings |
10:19:14 | FromGitter | <data-man> @tim-st: Good, no problem! Fork it. :) |
10:20:00 | FromGitter | <tim-st> I would do it, I have no idea how to interface between these types and when I have to free memory and use pointers etc... :( |
10:21:13 | * | miran quit (Quit: Konversation terminated!) |
10:21:13 | * | nc-x joined #nim |
10:24:57 | FromGitter | <data-man> https://github.com/singularperturbation/nim-leveldb/blob/master/src/internal/tests.nim is a good start |
10:26:10 | FromGitter | <tim-st> Yes, I looked at it already, `copyMem(addr result[0], x, length[])` is already too much for me... |
10:26:49 | * | marenz_ joined #nim |
10:28:24 | * | nc-x quit (Ping timeout: 260 seconds) |
10:28:51 | * | user0 joined #nim |
10:37:50 | * | yglukhov joined #nim |
10:42:21 | * | yglukhov quit (Ping timeout: 264 seconds) |
10:44:20 | * | devdri quit () |
10:46:45 | * | devdri joined #nim |
11:02:57 | * | user0 quit (Ping timeout: 268 seconds) |
11:05:59 | * | user0 joined #nim |
11:10:39 | FromGitter | <dom96> Aww. I missed our troll. |
11:26:58 | * | Guest60770 joined #nim |
11:27:09 | Guest60770 | Hi, i need help |
11:27:16 | Guest60770 | can someone help me please? |
11:27:29 | FromGitter | <Bennyelg> what do you need |
11:27:48 | Guest60770 | i want to know why pony lang is better than nim :V |
11:28:10 | FromGitter | <Bennyelg> sorry I dont know what is pony lang |
11:28:23 | Guest60770 | it is a better language |
11:29:48 | Araq | because of your mother. |
11:29:59 | Guest60770 | i fucked yours yesterday |
11:30:09 | Guest60770 | araq common, admit it |
11:30:13 | Guest60770 | Nim sucks |
11:30:18 | Guest60770 | it will never be popular |
11:30:31 | FromGitter | <Bennyelg> So what do you want? |
11:30:32 | Guest60770 | because it is a creepy language |
11:30:39 | FromGitter | <Bennyelg> if you dont like it dont use it |
11:30:39 | Araq | maybe never as popular as your mother. |
11:30:45 | Guest60770 | sex with Araq's gf |
11:30:51 | Guest60770 | or with his little sister |
11:30:57 | FromGitter | <Bennyelg> we already have plenty of bad programmers we dont need you abord |
11:31:26 | Guest60770 | Nim you are fired |
11:31:37 | Guest60770 | Pony you are hired |
11:31:45 | FromGitter | <Bennyelg> I bet Guest60770 think his rob stark |
11:31:54 | FromGitter | <Bennyelg> Hahahah 😄 |
11:32:20 | Guest60770 | Nim is for weirdos, Pony is for programmers XD |
11:33:20 | Araq | too bad neither is for you then. |
11:33:23 | FromGitter | <Bennyelg> I guess Guest60770 love to get is ass dicked well, and his probably didn't got is daily dic*k meal for today, let him wait @Araq` |
11:33:59 | FromGitter | <alehander42> @Guest60770 , mate, I suggest you write this stuff in a blog post and publish it, I am sure it will popularize Pony a lot |
11:34:28 | FromGitter | <Bennyelg> thats for sure :D |
11:35:08 | FromGitter | <alehander42> anyway, who can ban the guy, he's obvsly unstable |
11:35:13 | Guest60770 | if you want to write brograms use Nim, if you want to write programs use Pony |
11:35:57 | Guest60770 | i feel pity |
11:36:06 | FromGitter | <RayoGundead> what's a Brony (Guest60770) doing here? |
11:36:09 | FromGitter | <RayoGundead> you're in the wrong chat, degenerate horsefucker. |
11:36:12 | Guest60770 | i feel pity for everyone who bought Nim in action book |
11:36:25 | Guest60770 | XD |
11:36:32 | FromGitter | <Bennyelg> I feel happy to know why I should see pony lang lol |
11:36:51 | Guest60770 | because it will change your life |
11:36:53 | FromGitter | <Bennyelg> if it attract idiots like you |
11:36:55 | FromGitter | <Bennyelg> HAhahaha |
11:37:31 | Guest60770 | it is an interesing project unlike Nim, cuz Nim is just python + c++ |
11:38:00 | Guest60770 | where is the originality ? |
11:38:05 | Guest60770 | XD |
11:39:04 | Guest60770 | py++ would be a better name XD |
11:39:33 | FromGitter | <Bennyelg> we dont love "originality" |
11:39:33 | Guest60770 | :V |
11:39:39 | FromGitter | <Bennyelg> we love nim |
11:39:41 | FromGitter | <alehander42> guys, don't feed him |
11:39:42 | FromGitter | <Bennyelg> you love pony |
11:39:44 | FromGitter | <Bennyelg> go to the chat |
11:39:59 | FromGitter | <RayoGundead> > https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md ⏎ ⏎ now I understand... ⏎ soyboys are invading Nim again with their SJWism push [https://gitter.im/nim-lang/Nim?at=5a647c0fce68c3bc74e4d535] |
11:40:00 | Guest60770 | alehander42 i am Not hungry :V |
11:41:56 | Guest60770 | the best Nim program ever: |
11:42:06 | Guest60770 | echo "Nim sucks" |
11:42:07 | Guest60770 | ? |
11:42:46 | Guest60770 | oh it is |
11:42:55 | Guest60770 | echo("Pony Rulez") |
11:43:12 | FromGitter | <Bennyelg> are you 7 yo? |
11:43:20 | Guest60770 | 23 |
11:43:40 | Guest60770 | and i am pedophile |
11:44:19 | Guest60770 | i am the most strange person you will ever meet online |
11:45:31 | Guest60770 | who lives in USA? |
11:45:35 | Guest60770 | i go to USA soon |
11:47:10 | Guest60770 | i will go to Tennessee to kidnap my little girls |
11:47:58 | Guest60770 | Cya guys, i am gonna learn Pony now :) |
11:48:28 | * | Guest60770 left #nim ("Leaving") |
11:48:56 | FromGitter | <dom96> Araq: can you not do that? And ban him instead? |
11:49:17 | FromGitter | <dom96> Btw guys, do this survey: https://twitter.com/jetbrains/status/948935309319983105 |
11:49:57 | FromGitter | <dom96> Maybe they'll make a Nim IDE :) |
11:51:02 | * | yglukhov joined #nim |
11:55:37 | * | yglukhov quit (Ping timeout: 256 seconds) |
11:56:39 | Yardanico | just ignore him :P |
11:56:48 | Yardanico | ah he leaved |
11:56:51 | * | couven92 joined #nim |
11:58:48 | FromGitter | <dom96> The responses are shocking imo. Fyi there is nothing wrong with being a brony. |
11:58:52 | FromGitter | <RayoGundead> he left |
11:59:37 | FromGitter | <dom96> Just because a troll comes in here gives you no excuse to act like him. |
12:01:59 | FromGitter | <RayoGundead> @dom96 MLPFIM was the first thing that came to my mind when he mentioned pony language |
12:03:12 | FromGitter | <RayoGundead> well, actors are nice for concurrency/multithread stuff ⏎ but it's also a design pattern that can be done in Nim |
12:04:57 | FromGitter | <RayoGundead> ..... and I'm actually a brony |
12:06:12 | FromGitter | <RayoGundead> weirdly he didn't see by my gitter avatar |
12:07:16 | Yardanico | dom96, compelted the survey :P |
12:07:22 | Yardanico | *completed |
12:07:28 | FromGitter | <Bennyelg> max, min form seq |
12:07:38 | FromGitter | <Bennyelg> there is something ready? or i should implement it |
12:07:42 | Yardanico | ? |
12:07:48 | Yardanico | you need to get max or min value from seq? |
12:08:07 | FromGitter | <Bennyelg> yes but it's complex num tuple like |
12:08:30 | FromGitter | <Bennyelg> so it's seq[(int, int)] i need to get the max using by the first int of the tuple |
12:08:43 | Yardanico | Bennyelg: you need to define `<` for your tuple |
12:08:47 | Yardanico | for a tuple of this type |
12:08:52 | Yardanico | and then "max" and "min" will use it |
12:09:13 | FromGitter | <Bennyelg> how i define something like that? |
12:09:18 | FromGitter | <Bennyelg> template? |
12:09:23 | Yardanico | just a proc |
12:09:28 | FromGitter | <Bennyelg> ok |
12:10:13 | Yardanico | proc `<`(a, b: (int, int)): bool = a[0] < b[0] |
12:11:00 | FromGitter | <alehander42> oh man that jetbrains survey is longer than a book |
12:11:16 | Yardanico | well yeah :) |
12:11:27 | FromGitter | <alehander42> I think they asked me what is my favorite ide/editor like four times already |
12:11:39 | FromGitter | <alehander42> there are even questions about music style, but maybe I am hallucinating |
12:14:22 | FromGitter | <RayoGundead> enter "Power Metal" |
12:14:34 | FromGitter | <RayoGundead> they might add that genre in ther vlog |
12:18:11 | FromGitter | <alehander42> "the gang builds a Power Metal IDE" |
12:31:46 | FromGitter | <Bennyelg> ```code paste, see link``` ⏎ ⏎ t1(a) not working its expecting the option string which I want it to be optional like scala [https://gitter.im/nim-lang/Nim?at=5a648832ce68c3bc74e505ab] |
12:33:27 | FromGitter | <ZarsBranchkin> @Bennyelg For optional arguments you must define it's default value |
12:34:24 | FromGitter | <ZarsBranchkin> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6488d0290a1f4561b70957] |
12:34:49 | FromGitter | <ZarsBranchkin> Or whatever is the way you initialize options |
12:35:10 | FromGitter | <Bennyelg> thanks |
12:38:39 | * | devdri quit () |
12:40:30 | FromGitter | <Bennyelg> @ZarsBranchkin undeclared newOption() |
12:40:51 | FromGitter | <ZarsBranchkin> well yeah, that's not a thing by default |
12:43:25 | FromGitter | <ZarsBranchkin> Hm, if it's the Option that comes from here https://nim-lang.org/docs/options.html then I guess you'd use: ⏎ ⏎ ```proc t1(csvTypes: seq[string], header: Option[string] = none(string)) =``` [https://gitter.im/nim-lang/Nim?at=5a648aec5ade18be39a34a77] |
12:43:44 | FromGitter | <ZarsBranchkin> @Bennyelg |
12:44:18 | FromGitter | <Bennyelg> @ZarsBranchkin thanks I just saw that in the options lib |
12:44:25 | * | Vladar joined #nim |
12:52:22 | * | yglukhov joined #nim |
12:54:06 | * | devdri joined #nim |
12:56:39 | * | yglukhov quit (Ping timeout: 246 seconds) |
12:57:43 | * | dddddd_ joined #nim |
12:59:27 | * | dddddd quit (Ping timeout: 240 seconds) |
13:00:20 | * | dddddd_ is now known as dddddd |
13:10:47 | * | devdri quit () |
13:14:34 | FromGitter | <Bennyelg> Question: ⏎ How do I formatting a seq of tuples to a string ? |
13:14:53 | FromGitter | <Bennyelg> I tried using join(",") but it's not working it's leave the bad format of the tuples |
13:15:10 | FromGitter | <Bennyelg> (a: "x", b: "1"),(a: "y", b: "2"),... |
13:17:50 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6492feba39a53f1a41f920] |
13:17:55 | FromGitter | <Bennyelg> better way? |
13:31:32 | * | yglukhov joined #nim |
13:35:35 | * | yglukhov quit (Ping timeout: 240 seconds) |
13:35:52 | FromGitter | <Bennyelg> how to get a value from a shell execute command ? |
13:38:00 | FromGitter | <ZarsBranchkin> @Bennyelg this seems like it https://nim-lang.org/docs/osproc.html#execCmdEx,string,set[ProcessOption] |
13:42:45 | FromGitter | <data-man> @Bennyelg ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6498d55ade18be39a3880a] |
13:53:14 | * | PMunch joined #nim |
13:59:41 | * | Snircle joined #nim |
14:12:00 | * | Yardanico quit (Remote host closed the connection) |
14:13:01 | * | Yardanico joined #nim |
14:13:15 | * | Yardanico quit (Remote host closed the connection) |
14:15:53 | PMunch | Hmm, is there any existing module to parse a C-like struct format? |
14:20:53 | FromGitter | <data-man> @PMunch: What is it "C-like struct format"? :) |
14:21:47 | PMunch | Well I'm thinking of writing a pure-Nim library for protobuf: https://developers.google.com/protocol-buffers/docs/proto3 |
14:22:05 | PMunch | And the way you specify protobuf formats are a C-like format |
14:23:02 | FromGitter | <data-man> cparse.nim from c2nim? |
14:24:34 | PMunch | Yeah I was looking at that.. |
14:24:51 | PMunch | Seems a bit of an overkill though.. |
14:25:27 | * | Cthalupa quit (Ping timeout: 240 seconds) |
14:25:30 | PMunch | Eh, I guess I'll write my own. That way I can also validate that it's actually a protobuf file |
14:29:52 | * | Cthalupa joined #nim |
14:33:15 | * | yglukhov joined #nim |
14:33:18 | FromGitter | <data-man> "The idea is there locked inside. All you have to do is remove the excess stone." Michelangelo. |
14:34:55 | FromGitter | <tim-st> I now have open, close, get, contains, put and delete working for leveldb dll version, that's enough for now :) |
14:35:08 | PMunch | Nice |
14:36:13 | * | natrys joined #nim |
14:37:27 | * | yglukhov quit (Ping timeout: 240 seconds) |
14:38:20 | * | Snircle quit (Ping timeout: 276 seconds) |
14:45:07 | * | Yardanico joined #nim |
14:47:53 | FromGitter | <data-man> @PMunch: About Michelangelo? Or about leveldb? :) |
14:58:45 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a64aaa55a9ebe4f75b5d586] |
15:05:45 | * | yglukhov joined #nim |
15:09:49 | FromGitter | <Bennyelg> I assume it's because the MaxThreadPoolSize = 256 |
15:09:51 | FromGitter | <Bennyelg> ? |
15:09:57 | * | yglukhov quit (Ping timeout: 240 seconds) |
15:20:53 | * | xkapastel joined #nim |
15:20:54 | * | MJCaley joined #nim |
15:23:15 | * | adeohluwa joined #nim |
15:28:54 | * | Snircle joined #nim |
15:33:29 | * | miran joined #nim |
15:38:31 | * | Yardanico_ joined #nim |
15:41:44 | FromGitter | <data-man> @Bennyelg: I can't repeat your error. Tested it with 100000 rows. |
15:43:20 | * | Snircle quit (Ping timeout: 276 seconds) |
15:44:07 | * | MJCaley quit (Quit: MJCaley) |
15:45:48 | * | Snircle joined #nim |
15:50:09 | * | llll joined #nim |
15:51:31 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
15:55:31 | PMunch | data-man, I was referencing leveldb. But it's a good quote :) |
16:00:53 | llll | gb |
16:00:56 | * | llll quit (Quit: Page closed) |
16:01:15 | FromGitter | <Bennyelg> Interesting I have no Idea why its fails |
16:05:32 | * | MJCaley joined #nim |
16:06:02 | FromGitter | <Bennyelg> @data-man how did you open sqlite conn? |
16:06:32 | FromGitter | <Bennyelg> I open memory connection and not a disk |
16:08:20 | FromGitter | <tim-st> When I expect cuchar(1) how should I compare it? should I use c.ord() == 1 or is there a better way? |
16:11:35 | FromGitter | <data-man> @Bennyelg: With ":memory:" also not reproduced. |
16:15:28 | * | yglukhov joined #nim |
16:17:07 | * | Snircle joined #nim |
16:17:23 | * | Snircle quit (Client Quit) |
16:19:35 | * | yglukhov quit (Ping timeout: 240 seconds) |
16:21:28 | * | Yardanico_ quit (Quit: Leaving) |
16:25:48 | FromGitter | <tim-st> Does someone knows the equivalent of Golangs `C.GoBytes(unsafe.Pointer(data), C.int(len))` for nim? |
16:26:29 | FromGitter | <tim-st> When I just use `$` there is a bit garbage in the string |
16:28:55 | FromGitter | <Bennyelg> I can understand why Im failing |
16:32:26 | FromGitter | <Bennyelg> After few chunks I get ⏎ Illegal storage access. (Attempt to read from nil?) |
16:32:43 | FromGitter | <Bennyelg> this error drove me crazy |
16:39:00 | * | Yardanico_ joined #nim |
16:39:15 | FromGitter | <Bennyelg> How I can investigate: ⏎ ⏎ ```SIGSEGV: Illegal storage access.``` [https://gitter.im/nim-lang/Nim?at=5a64c232ba39a53f1a42c876] |
16:39:27 | dom96 | tim-st: you can setLen on the string, maybe that would help? |
16:40:05 | * | Yardanico quit (Ping timeout: 256 seconds) |
16:41:51 | FromGitter | <tim-st> @dom96 I will try it. I now created procs for it and copied the identical code into it and it works, now^^ |
16:42:15 | * | Ven`` joined #nim |
16:44:42 | FromGitter | <tim-st> No, it only works on the reverseIterator not the normal one, maybe it's not my mistake |
16:45:09 | FromGitter | <Bennyelg> @data-man When I os.sleep(1) I did manage to put alot more records before it failed |
16:45:27 | FromGitter | <Bennyelg> maybe my memory is corrupted :d ? |
16:48:55 | FromGitter | <tim-st> @dom96 wow, it really works with setLen, thanks! But it feels like performance loss isnt it? |
16:49:25 | FromGitter | <tim-st> should I free the cstring before casting to string? |
16:49:26 | dom96 | Why do you think that? |
16:49:55 | FromGitter | <tim-st> because I already get the pointer to a string and I create a new one using $cstring |
16:50:15 | dom96 | good question, I'm not sure whether converting a cstring to string copies the string |
16:50:43 | FromGitter | <tim-st> thanks, do you know if I have to free the returnt cstring? |
16:51:05 | dom96 | that would require knowing whether `$` copies the cstring :) |
16:51:10 | dom96 | you can probably check that |
16:51:13 | dom96 | using repr |
16:51:26 | FromGitter | <tim-st> ok, mom |
16:51:31 | dom96 | check if `addr str[0]` points to the same address |
16:51:39 | dom96 | I'm not your mom lol |
16:51:59 | FromGitter | <tim-st> in German it means moment^^ |
16:52:03 | FromGitter | <tim-st> wait a moment |
16:52:16 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:52:22 | FromGitter | <Clyybber> never seen that abbreviaton lol |
16:52:31 | * | Ven`` joined #nim |
16:52:40 | miran | he just made that up :P |
16:53:01 | FromGitter | <tim-st> It's really not good to use in english^^ |
16:53:06 | dom96 | lol yeah |
16:53:39 | FromGitter | <Clyybber> never seen it in german either 😄 |
16:53:44 | FromGitter | <tim-st> sure |
16:54:19 | FromGitter | <Clyybber> btw did github give u that sad face avatar? |
16:54:39 | FromGitter | <tim-st> yes^^ |
16:55:20 | FromGitter | <Clyybber> wow i call that lucky |
16:55:26 | FromGitter | <Clyybber> or rather the opposite |
16:56:11 | FromGitter | <Clyybber> i wonder what they use to determine the avatar |
16:56:55 | FromGitter | <tim-st> @dom96 which one should I use? echo repr(keyC) ⏎ echo repr(key) ⏎ echo addr keyC[0] ⏎ echo addr key[0] [https://gitter.im/nim-lang/Nim?at=5a64c657e014122650726590] |
16:57:20 | FromGitter | <tim-st> repr is different |
17:05:49 | FromGitter | <tim-st> So the address is different but I read in the golang version that at this point there is no need for freeing the memory because the closing proc does it |
17:07:32 | * | nsf quit (Quit: WeeChat 2.0.1) |
17:07:39 | * | MJCaley quit (Quit: MJCaley) |
17:07:51 | * | nsf joined #nim |
17:12:30 | * | endragor quit (Remote host closed the connection) |
17:12:58 | * | endragor joined #nim |
17:13:54 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:16:29 | * | merv joined #nim |
17:17:19 | * | endragor quit (Ping timeout: 248 seconds) |
17:22:09 | * | merv quit (Quit: Page closed) |
17:22:35 | * | MJCaley joined #nim |
17:25:12 | * | endragor joined #nim |
17:26:36 | * | yglukhov joined #nim |
17:29:18 | * | endragor quit (Ping timeout: 246 seconds) |
17:31:11 | * | yglukhov quit (Ping timeout: 248 seconds) |
17:31:32 | * | Ven`` joined #nim |
17:32:27 | * | gmpreussner quit (Ping timeout: 240 seconds) |
17:32:53 | FromGitter | <Quelklef> By the way, is the behavior of `import` planned to change, or stay as-is? |
17:33:05 | * | gmpreussner joined #nim |
17:33:52 | FromGitter | <Quelklef> More specifically, the behavior that `import A` includes everything from `A` into the current namespace |
17:42:37 | miran | won't change afaik |
17:42:54 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:43:14 | miran | you get used to it after some time.... |
17:43:53 | FromGitter | <Quelklef> yeah |
17:44:39 | FromGitter | <Quelklef> I mean, I use it, I'm fine with it, it makes it nicer to work within a closed environment / project easily |
17:44:49 | FromGitter | <Quelklef> but also makes it harder to read code which is my main issue |
17:45:16 | FromGitter | <Quelklef> then again i can always `from A import nil` |
17:59:44 | FromGitter | <ZarsBranchkin> I try to keep the `A.proc()`notation, so it's clear from where I got the procedure. I guess exception could be a huge library like SDL, where I won't want to prefix the library name to all the procedures which are obviously imported |
18:02:31 | FromGitter | <Quelklef> or operators |
18:02:50 | FromGitter | <Quelklef> `result = misc.>$ text` |
18:04:16 | FromGitter | <Quelklef> I've noticed also that if two module's namespaces clash the compiler won't complain unless you actually make am ambiguous call |
18:04:39 | FromGitter | <Quelklef> Which makes a lot of sense but also is kind of weird. I know if I were writing a language I would have (thoughtlessly) made it complain on import |
18:04:45 | FromGitter | <Clyybber> That should give at least a warning IMO |
18:04:52 | FromGitter | <Quelklef> I don't think so tbh |
18:05:10 | FromGitter | <Quelklef> I've noticed this kind of thing seems to be a trend in the language |
18:05:26 | FromGitter | <Quelklef> You can write procs with conflicting types, etc., etc. and it won't complain until you try to use them |
18:05:54 | FromGitter | <Quelklef> which I thought was weird at first but I actually kind of like now because it's like, "We don't care if it doesn't work if you don't use it" |
18:06:06 | FromGitter | <Clyybber> Hmm |
18:06:11 | FromGitter | <Quelklef> Perhaps an issue when writing a library or something, but then you can write tests |
18:06:27 | FromGitter | <Quelklef> it's like how procs that aren't used aren't compiled |
18:06:39 | FromGitter | <Quelklef> idk. Idk if other languages do this but I feel like they generally don't |
18:07:50 | FromGitter | <Clyybber> Yeah, i concur. This is better suited for a linter to check or something like that |
18:08:49 | FromGitter | <Quelklef> Speaking of which, what's the most comprehensive editor from Nim rn? |
18:09:02 | FromGitter | <Quelklef> I'm using Sublime text + Nimline which is pretty great but not perfect |
18:09:23 | FromGitter | <Clyybber> I use kakoune but thats really only a editor and far from an IDE |
18:09:30 | FromGitter | <Clyybber> but it has Nim support |
18:09:33 | FromGitter | <Clyybber> so thats cool |
18:09:56 | FromGitter | <Clyybber> and a linter can be plugged in too |
18:10:04 | FromGitter | <ZarsBranchkin> Been using Nim with spacemacs. Thanks to the nimsuggest, the suggestions and quick documentation is pretty nicely supported |
18:10:04 | FromGitter | <Quelklef> I can't handle command-line editors :[ |
18:10:05 | dom96 | What's the reason for giving a warning in that instance? |
18:10:11 | FromGitter | <Quelklef> I *need* to scroll, man. Lol |
18:10:54 | FromGitter | <Quelklef> "The best editor is neither Emacs nor Vim, it's Emacs and Vim!" Chaotic good |
18:11:42 | FromGitter | <ZarsBranchkin> Oh yes, best combination. Couldn't use vim, as it was annoying to tweak and i found it hard to use on bigger projects |
18:12:09 | FromGitter | <ZarsBranchkin> Luckily emacs provides darn solid IDE and spacemacs configuration integrates vim keybindings into emacs so well |
18:12:25 | dom96 | TIL of kakoune |
18:12:32 | FromGitter | <Clyybber> its really good |
18:12:37 | dom96 | I'm the same as Quelklef though |
18:12:38 | FromGitter | <Clyybber> can only recommend |
18:13:23 | * | MJCaley quit (Quit: MJCaley) |
18:13:27 | dom96 | I prefer editors that adopt the operating system's editing capabilities and extend them |
18:13:34 | FromGitter | <Clyybber> dom96 A warning could help forsee problems in the planning phase of a projects |
18:13:35 | dom96 | instead of coming up with their own weird conventions :) |
18:14:06 | FromGitter | <Clyybber> Kakoune actually kinda does this, by sticking to the UNIX way |
18:14:13 | dom96 | Clyybber: two symbols conflicting isn't a problem though. You just disambiguate :) |
18:14:35 | FromGitter | <Clyybber> yes true |
18:14:48 | miran | Quelklef: i'm using vscode with nim plugin |
18:14:50 | FromGitter | <Clyybber> thats why i concur |
18:14:58 | FromGitter | <ZarsBranchkin> Luckily emacs GUI does support mouse events, but I've heard the whole graphical interface is basically a hacked together terminal interface onto X windows |
18:15:15 | adeohluwa | is payments via ussd a good idea? |
18:15:32 | adeohluwa | like very feasible & no security issues |
18:17:20 | FromGitter | <Clyybber> @ZarsBranchkin correct me if im wrong here but AFAIK emacs supports basic mouse input in the console too |
18:17:48 | * | Trustable joined #nim |
18:17:55 | FromGitter | <Clyybber> at least in xterm |
18:18:46 | FromGitter | <ZarsBranchkin> Right, yeah, works for me too |
18:19:17 | FromGitter | <ZarsBranchkin> Don't really use emacs in terminal, I usually just use vim when I need to edit few things from terminal quickly |
18:20:58 | FromGitter | <Bennyelg> Nim docker: Error: cannot open 'templates' |
18:21:05 | FromGitter | <Bennyelg> when try to compile file |
18:21:48 | * | yglukhov joined #nim |
18:23:35 | dom96 | adeohluwa: ussd? |
18:23:54 | PMunch | dom96, yeah I looked into Kakoune a while back. Looks really interesting with the solid multi-selection edit |
18:24:16 | PMunch | But I had just "finished" setting up my Vim so I couldn't bring myself to switch at that point :P |
18:25:37 | PMunch | And Vim supports the mouse just fine if you set it up right. Scrolling, selecting, copy-paste with middle mouse button on Linux, all that stuff. |
18:26:03 | miran | PMunch: is kakoune still under heavy development or is it ready for some general use (as a main editor)? |
18:26:07 | * | yglukhov quit (Ping timeout: 248 seconds) |
18:26:20 | PMunch | miran, haven't used it much but it seemed pretty solid to me |
18:26:31 | FromGitter | <Clyybber> It is perfectly usable as far as i have used it |
18:27:29 | miran | ok, why would one use kakoune istead of: (1) vim, (2) vscode? |
18:27:40 | miran | what are the advantages of it? |
18:27:42 | FromGitter | <Clyybber> it has a simpler codebase |
18:27:51 | FromGitter | <Clyybber> though neovim has that too |
18:28:04 | FromGitter | <Clyybber> it is more lightweight than vscode |
18:28:48 | miran | everything is more lightweight than vscode :P any other advantages? |
18:29:02 | FromGitter | <Clyybber> i find the design makes much more sense |
18:29:06 | PMunch | kakoune has multi-selection support like Sublime |
18:29:18 | FromGitter | <Clyybber> as in better keyboard shortcuts |
18:29:45 | PMunch | And yeah, easier to use and better keyboard shortcuts are touted, although I haven't used it enough to verify |
18:29:54 | FromGitter | <Clyybber> and i find the multi selection as the main concept thing pretty elegant |
18:29:57 | PMunch | It does outperform Vim at vim-golf though :P |
18:30:13 | miran | PMunch: i often hear about sublime's multi-selection - vscode also has it, but usually sublime is mentioned - what is so unique about it? |
18:30:21 | adeohluwa | dom96: yes ussd , doesn't make sense to u? |
18:30:22 | FromGitter | <Clyybber> @PMunch yes thats the byproduct of good features |
18:30:26 | PMunch | Yeah, that way of editing text feels much more natural to me than recordings and regexes like Vim uses |
18:30:51 | miran | i use vim plugin in vscode, and so far i'm satisfied with it |
18:31:12 | miran | but i'm open to trying new things |
18:31:12 | FromGitter | <Clyybber> well, if it works... |
18:31:26 | PMunch | miran, well the capabilities in vscode is pretty similar to Sublimes. It was just that Sublime was the first one to have them and that was their key selling point (if not the first then at least the first well known) |
18:31:58 | PMunch | The benefit of multi-selection edit is that you can easily take one piece of formatted data and transform it into something else |
18:32:00 | dom96 | adeohluwa: no |
18:32:24 | PMunch | Once you get used to having it though it is a really powerful tool |
18:32:30 | miran | dom96: adeohluwa: usd? us dollars? |
18:32:42 | adeohluwa | oh!! |
18:32:45 | PMunch | I've got a plugin for Vim that makes me do some of the things, but it's not perfect and a bit finicky at times |
18:32:52 | adeohluwa | maybe its not a thing over there |
18:33:00 | adeohluwa | I mean codes like |
18:33:07 | adeohluwa | *99*2# |
18:33:13 | adeohluwa | on mobile phones |
18:33:23 | PMunch | adeohluwa, oh wow. Haven't used those in a while :P |
18:33:44 | PMunch | Hmm, for payments though.. |
18:34:10 | adeohluwa | PMunch: gets passed on by everyone |
18:34:23 | adeohluwa | but pretty convenient for most users |
18:34:36 | PMunch | Well, they're a pain to type.. |
18:35:34 | PMunch | What a USSD code does is just tell the network that this message is not to be interpreted as a phone number and rather to handle it internally on the SIM (which then might initiate other things). So I guess if you had a SIM with a trusted area you could do some USSD payment stuff but you'd probably have to be a teleco to do that .. |
18:38:18 | PMunch | Huh apparently India uses USSD payments |
18:39:11 | FromGitter | <tim-st> If I want a proc `serialize[T] -> string` that can take any possible type and marshalls to string, is that possible? how would be the signature? |
18:39:39 | FromGitter | <tim-st> and the fitting deserialize that defaults to nil |
18:39:58 | FromGitter | <Quelklef> How would that work? |
18:40:10 | FromGitter | <Quelklef> You'd need to be able to iterate over all of the object's fields, ye? |
18:40:15 | PMunch | proc serialize[T](input: T): string |
18:40:18 | FromGitter | <tim-st> the marshal package can do it |
18:40:20 | PMunch | Something like that probably |
18:40:31 | FromGitter | <Quelklef> why not just use the marshal package then |
18:40:53 | FromGitter | <tim-st> I want to ship the proc with my lib to work out of the box |
18:41:02 | FromGitter | <Quelklef> but |
18:41:09 | FromGitter | <Quelklef> if the marshal's one works with any type |
18:41:12 | FromGitter | <Quelklef> why do you need one for your type |
18:41:41 | adeohluwa | PMunch: or have a relationship with a telco |
18:41:43 | FromGitter | <tim-st> because there is logic behind, how to call it |
18:41:54 | adeohluwa | not every country has rock solid internet |
18:41:58 | PMunch | adeohluwa, well yeah of course |
18:42:48 | adeohluwa | I just wanna get card details & then submit that automatically via some payment API |
18:43:17 | PMunch | "just" |
18:43:31 | adeohluwa | Lmao! |
18:43:53 | adeohluwa | I'm implying its supposed to be simple , its 2018 |
18:43:57 | FromGitter | <data-man> emacs, vim, kakoune... ⏎ eon! :) https://github.com/tomas/eon |
18:45:41 | PMunch | We should write our own terminal editor in Nim :) |
18:45:41 | adeohluwa | I definitely find ussd easier than going to some website & completing multiple steps not forgetting ADs everywhere |
18:46:19 | PMunch | Hmm, I think you and I have very different experiences with USSD :P |
18:46:45 | adeohluwa | must have bn pretty horrible for u |
18:48:24 | * | c0ntribut0r joined #nim |
18:48:30 | miran | data-man: oh, another editor.... |
18:50:11 | miran | i should better start writing/editing things are should be doing, and not just watch gifs of various editors.... |
18:54:05 | PMunch | Hmm, now for something completely different (we can get back to editors afterwards) |
18:54:59 | PMunch | I want to parse a file in Nim. A unit can start with one of two categories. I want to first sort them by category then handle the categories by themselves |
18:55:44 | PMunch | So I was thinking of having a set of strings and do something like if token in union(class1, class2) |
18:55:51 | PMunch | But Nim sets can only be ordinals |
18:56:15 | PMunch | I can use a set from the sets module, but that seems a bit overkill since I'm not going to insert anything in these |
19:13:23 | PMunch | Hmm, maybe one large enum with all the tokens in it and then some const sets to group them? |
19:15:10 | dom96 | that sounds like a good plan |
19:15:14 | dom96 | what is this for? |
19:15:15 | dom96 | protobuf? |
19:15:24 | PMunch | Yup |
19:15:41 | dom96 | The answer is simple: if the categories are pre-defined then use an enum |
19:15:47 | dom96 | if they are entirely arbitrary then don't |
19:16:07 | PMunch | Oh yeah they are pre-defined |
19:16:33 | PMunch | This is for all types and keywords that can be found in the .proto file |
19:18:04 | dom96 | then enum |
19:18:08 | dom96 | definitely the way to go |
19:18:27 | PMunch | Yeah I realized as well |
19:18:46 | dom96 | also do try to keep the parser separate so others can make use of it if necessary :) |
19:18:54 | PMunch | Good idea |
19:19:03 | PMunch | Well |
19:19:22 | PMunch | The parser in protobuf generally converts to code to read and write a Protobuf message.. |
19:19:45 | PMunch | The others do this by a separate tool but for Nim I was planning on just making it a macro that takes a string |
19:19:58 | PMunch | So either statically read a file or inline the definition |
19:20:21 | PMunch | But I might parse it to a subtype first.. |
19:20:55 | dom96 | You should create an AST-like structure for protobuf |
19:21:03 | dom96 | then create a macro that takes this as an input |
19:21:21 | dom96 | and a separate parser that takes a string and gives you the AST as an output |
19:21:30 | * | onionhammer quit (Quit: WeeChat 1.9.1) |
19:21:36 | PMunch | Hmm, yeah I guess.. |
19:22:03 | PMunch | That way you could theoretically load a proto file on runtime as well |
19:22:21 | PMunch | If you wrote a generic reader for any AST |
19:25:51 | FromGitter | <tim-st> Now I found out why my deserialize proc didnt work: I can not call `a.procnameT (b)` but in this situation I am forced to use `procnameT (a,b)` |
19:25:59 | FromGitter | <tim-st> is this a bug @Araq ? |
19:27:11 | dom96 | it is |
19:27:12 | * | fredrik92 joined #nim |
19:27:23 | dom96 | not really a bug |
19:27:30 | dom96 | more of a language gotcha you need to be aware of |
19:27:48 | FromGitter | <tim-st> Well at least the error message is wrong |
19:27:57 | FromGitter | <tim-st> and lead me in the totally wring direction |
19:30:28 | * | couven92 quit (Ping timeout: 268 seconds) |
19:30:29 | FromGitter | <tim-st> I now have leveldb implement with full json support working out of the box optionally for keys and values ;) |
19:30:49 | FromGitter | <tim-st> for any type |
19:30:55 | * | onionhammer joined #nim |
19:30:59 | dom96 | actually now that I looked into it |
19:31:11 | dom96 | I remembered that there was talk of implementing a new syntax for generics |
19:31:21 | dom96 | to fix this: foo.blah[:T]() |
19:31:29 | dom96 | (because the problem is that [] is ambiguous) |
19:31:41 | FromGitter | <Quelklef> That syntax feels misleading |
19:31:47 | * | couven92 joined #nim |
19:32:04 | FromGitter | <Quelklef> v:T looks like it says "v is of type T" so foo.blah:T looks like it says "foo.blah() is of type T" |
19:32:05 | FromGitter | <Quelklef> imo |
19:32:27 | * | fredrik92 quit (Ping timeout: 240 seconds) |
19:32:50 | dom96 | oh no |
19:32:54 | dom96 | FromGitter has a bug here |
19:32:58 | FromGitter | <tim-st> @dom96 should this work already? |
19:33:11 | FromGitter | <Quelklef> ? @dom96 |
19:33:13 | dom96 | it's missing the [] |
19:33:22 | FromGitter | <tim-st> I tried with both |
19:33:22 | dom96 | foo.blah\[:T\] |
19:33:26 | FromGitter | <tim-st> yes |
19:33:29 | FromGitter | <tim-st> didnt work |
19:33:32 | dom96 | no, it's not implemented |
19:33:38 | FromGitter | <tim-st> ah, ok |
19:34:04 | FromGitter | <Quelklef> I see foo.blah[:T] |
19:34:21 | FromGitter | <Quelklef> Wait, I'm confused |
19:34:22 | dom96 | Here is the relevant issue: https://github.com/nim-lang/Nim/issues/3502 |
19:34:31 | FromGitter | <Quelklef> (also [:T] looks like a face) |
19:35:24 | FromGitter | <tim-st> ok, thanks for looking into it |
19:37:15 | FromGitter | <tim-st> Is it possible to return a default type for T? If object -> nil, value: 0 ? |
19:37:35 | FromGitter | <tim-st> maybe with ptr |
19:37:36 | FromGitter | <Quelklef> My vote goes for changing array subscript notation rather than generics notation |
19:38:50 | dom96 | That's not gonna happen :) |
19:39:51 | * | couven92 quit (Read error: Connection reset by peer) |
19:39:52 | FromGitter | <Quelklef> Really? Seems like generics would be more important than array subscripting, so should take precedence. Is that wrong? |
19:41:27 | dom96 | why would we change such a common operation's syntax? |
19:41:38 | dom96 | when it's already using a syntax that is used by most languages? |
19:41:56 | miran | dom96: i'm looking in the example 3.1 - why `let x = newTable[:string, int]` doesn't have : before int? |
19:42:21 | dom96 | oh, maybe I got it wrong |
19:42:21 | FromGitter | <Quelklef> Are generics not more common? |
19:42:30 | dom96 | and it's actually just `:` at the start |
19:43:01 | miran | dom96: also, can these :foo be limited only for :T, and not used for int, string, char, etc.? |
19:43:17 | dom96 | huh? |
19:43:31 | FromGitter | <Quelklef> @miran why break consistency? |
19:43:31 | dom96 | it's for generics, there is no type specificity |
19:44:01 | miran | Quelklef: because it looks ugly? :D |
19:44:18 | dom96 | Quelklef: maybe, but Nim's generic instantiation syntax is fairly unique |
19:44:49 | dom96 | so it makes more sense to supplement it |
19:44:51 | FromGitter | <Quelklef> @miran I guess. Consistency > beauty in this situation imo |
19:45:12 | FromGitter | <Quelklef> @dom96 That's true. I personally really love the `[]` syntax so I guess i'd just hate to see it go |
19:45:18 | miran | i guess this might be a new strfmt :D :D |
19:45:22 | dom96 | it won't go |
19:45:27 | dom96 | Like I said, it'll be supplemented |
19:45:43 | FromGitter | <Quelklef> Won't it? From `[]` to `[:type]` |
19:45:54 | dom96 | both will be supported |
19:46:27 | * | couven92 joined #nim |
19:46:29 | PMunch | Hmm, now I have all the symbols defined in an enum and various sets of those enum values. Is it possible to define a type as any enum in a certain set? |
19:46:29 | miran | then why introduce new stuff? the old one will be deprecated at some point? |
19:46:30 | FromGitter | <Quelklef> Ah. Seems dangerous to go that way, though |
19:46:40 | miran | or just to get rid of some bug(s)? |
19:47:20 | * | yglukhov joined #nim |
19:48:49 | dom96 | I'm not sure. It's possible this won't happen at all |
19:48:53 | dom96 | Araq and I discussed it a while back |
19:49:34 | * | BitPuffin is now known as webgl |
19:49:44 | FromGitter | <Quelklef> What'll happen to the current related issues, then? |
19:50:07 | * | webgl is now known as Muresan |
19:50:19 | * | Muresan is now known as Murii |
19:52:04 | * | yglukhov quit (Ping timeout: 256 seconds) |
19:53:00 | * | Murii is now known as Allah |
19:53:14 | * | Allah is now known as BitPuffin |
19:56:07 | PMunch | Hmm, and how can I check if a string matches one of the enums in a set? |
20:01:17 | PMunch | Well okay, I can just write a simple contains method for my last question |
20:01:36 | PMunch | But the first one, can I specify a type that is a subset of an enum? |
20:04:19 | dom96 | no idea what you mean |
20:05:22 | PMunch | I have my enum with all the tokens in the language. I also have sets (built-in kind) of various sub-sets of this enum to distinguish them. |
20:05:46 | PMunch | It would be neat if I could specify a type that could hold only one of the values in such a subset |
20:06:03 | PMunch | This is what I have: http://ix.io/Etd |
20:09:15 | dom96 | I'm still unsure, but what I would be doing is making an object variant out of that |
20:09:32 | dom96 | btw IIRC setting a string value to an enum value like that isn't valid |
20:10:47 | PMunch | What do you mean isn't valid? It appears to work just fine |
20:11:28 | PMunch | This is what the parser looks like so far: http://ix.io/Etg |
20:19:02 | dom96 | I always end up just defining a `$` for the enum for one reason or another |
20:19:34 | PMunch | Well there seems to be one pre-defined |
20:19:41 | FromGitter | <tim-st> Can I check the type of an Generic Type Parameter? |
20:19:49 | FromGitter | <tim-st> K of string: ... |
20:19:59 | PMunch | If I do "echo syntax" after the loop then it shows the string value and not the enum name |
20:25:49 | * | Yardanico_ quit (Remote host closed the connection) |
20:39:19 | * | user0 quit (Quit: user0) |
20:46:29 | * | MJCaley joined #nim |
20:56:11 | * | BitPuffin quit (Remote host closed the connection) |
20:56:51 | * | vlad1777d quit (Ping timeout: 246 seconds) |
20:59:20 | * | clyybber joined #nim |
20:59:40 | * | clyybber quit (Client Quit) |
20:59:58 | * | clyybber joined #nim |
21:00:45 | * | clyybber left #nim (#nim) |
21:01:13 | * | clyybber joined #nim |
21:05:02 | * | yglukhov joined #nim |
21:11:56 | * | miran quit (Quit: Konversation terminated!) |
21:12:57 | * | adeohluwa quit (Quit: Connection closed for inactivity) |
21:17:18 | * | billakos joined #nim |
21:17:31 | * | billakos quit (Client Quit) |
21:19:54 | * | chemist69 quit (Ping timeout: 256 seconds) |
21:20:40 | * | chemist69 joined #nim |
21:25:02 | * | Trustable quit (Remote host closed the connection) |
21:28:21 | * | yglukhov quit (Remote host closed the connection) |
21:32:58 | * | lamda_ joined #nim |
21:33:50 | lamda_ | damn, well, both: Nim and Pony, aren't stable yet, so i will just learn fucking rust |
21:33:59 | lamda_ | fucking rust |
21:33:59 | PMunch | :( |
21:34:09 | PMunch | lamda_, Nim is getting there :) |
21:34:18 | lamda_ | okay cool |
21:34:25 | * | Cthalupa quit (Ping timeout: 268 seconds) |
21:34:27 | * | MJCaley quit (Quit: MJCaley) |
21:34:31 | PMunch | And it's actually fairly stable already |
21:34:37 | lamda_ | i may change my mind about Nim when it get stable |
21:34:42 | lamda_ | okay yeah |
21:34:48 | PMunch | But there will probably be some larger changes now that we are coming up on 1.0 |
21:34:52 | lamda_ | i think it is more stable than Pony honestly |
21:35:06 | PMunch | Just to make sure that it doesn't have to be done after 1.0 :P |
21:35:06 | lamda_ | like what? |
21:35:13 | lamda_ | okay |
21:35:30 | PMunch | Hmm, can't think of anything at the moment. But there has been talk about improving the standard library |
21:35:39 | PMunch | Or at least make it more coherent |
21:35:45 | * | Vladar quit (Remote host closed the connection) |
21:36:03 | PMunch | Araq is also working on some cool memory stuff but he says that will be for Nim 2.0 |
21:37:16 | lamda_ | Okay cool |
21:38:31 | * | Cthalupa joined #nim |
21:40:41 | * | xkapastel quit (Quit: Connection closed for inactivity) |
21:41:21 | clyybber | I think rust is not really comparable to nim, as the design goals are pretty different |
21:41:23 | PMunch | And by the way lamda_ Nim 1.0 is not that far away (I think) |
21:41:46 | PMunch | Araq mentioned something about the next version being RC1 |
21:42:59 | clyybber | while nim strives for elegance as in maximise productivity per code, rust just throws its syntactic salt everywhere |
21:43:22 | FromGitter | <ZarsBranchkin> Nice, hadn't heard of that term yet |
21:44:04 | lamda_ | yeah, rust isn't perfect, there isn't a perfect language :( |
21:44:24 | lamda_ | humans aren't perfect :/ |
21:45:01 | lamda_ | i just wish these languages were stable now or asap |
21:45:33 | FromGitter | <ZarsBranchkin> Yeah, I suppose just like with everything else, everyone has to find their own language, that satisfies their needs |
21:46:08 | clyybber | Yeah rust is actually pretty good at what its for |
21:46:34 | clyybber | and the little hickups dont matter that much in the grand scheme of a huge project |
21:46:38 | clyybber | such as firefox |
21:47:10 | clyybber | But i must say Pony looks interesting |
21:47:59 | lamda_ | yes but it is not stable yet :( |
21:48:26 | lamda_ | https://github.com/ponylang/ponyc/issues |
21:48:33 | dom96 | lamda_: Maybe instead of trolling you should help these projects? |
21:49:04 | PMunch | That's a bit harsh isn't it dom96? :P |
21:49:16 | lamda_ | i reported a bug yesterday, but idk if it is worth learning it now |
21:49:41 | dom96 | PMunch: It's not: https://irclogs.nim-lang.org/21-01-2018.html#06:54:52 |
21:50:27 | PMunch | Oh, you think he's just trying to garner supporters for Pony? |
21:50:37 | dom96 | No, read the full logs |
21:51:50 | FromGitter | <ZarsBranchkin> Oh, saw some of that guy yesterday. How is that troll related though? |
21:51:58 | clyybber | i thought to myself "wierd, seeing a new language(pony) mentioned twice on the same irc channel" |
21:52:03 | dom96 | It's the same person |
21:52:19 | clyybber | prbbly |
21:52:29 | FromGitter | <ZarsBranchkin> Heh, makes sense since I hadn't heard of Pony before as well |
21:52:43 | lamda_ | should i give up on pony until it is stable? |
21:52:51 | PMunch | I have actually heard of it before |
21:53:01 | clyybber | @lamda_ decide yourself |
21:53:07 | lamda_ | how? |
21:53:14 | FromGitter | <SolitudeSF> just give up on programming and computers altogether |
21:53:17 | PMunch | lamda_, flip a coin? |
21:53:28 | FromGitter | <ZarsBranchkin> Could also help making it stable, as dom said. Besides while doing that, you'll be real proefficient at it by the time it's usable |
21:53:43 | lamda_ | okay, also, i guess, i shouldn't give up, Rust has bugs too and it is stable |
21:54:21 | clyybber | accept that most things have bugs |
21:55:40 | lamda_ | okay :) |
21:57:04 | clyybber | Also if you are just starting to learn programming you could try lua too |
21:57:19 | clyybber | and work your way up |
21:57:34 | clyybber | or down to more low level languages |
21:57:44 | lamda_ | no, i use C since 2016, i just got tired of C |
21:57:51 | clyybber | oh well |
21:58:11 | FromGitter | <ZarsBranchkin> Heh, I started off with Lua and I found Nim to be so far the best combination of high level abstractions and low level functionality |
21:58:35 | clyybber | i srarted with lua too |
21:58:46 | clyybber | and can only agree with your statement |
21:59:05 | lamda_ | i am tired of C, but i haven't decided which language to learn :/ |
21:59:18 | clyybber | terra is also a very bery interesting language |
21:59:36 | lamda_ | i heard of terra |
21:59:39 | clyybber | somewhat hard to compile yourself but really cool |
22:00:26 | clyybber | Have ypu tried it? |
22:00:29 | FromGitter | <ZarsBranchkin> That's an interesting idea, combine Lua with low level language |
22:00:41 | clyybber | Yep and it works pretty well too |
22:00:42 | FromGitter | <RayoGundead> would be nice if there was a lisp(or clojure) with borrow checker instead of GC |
22:00:49 | lamda_ | no, i haven't try it |
22:00:55 | clyybber | Go ahead |
22:01:08 | clyybber | its pretty easy to install the binaries |
22:01:38 | PMunch | I wish Pixie would come back |
22:01:42 | PMunch | Very interesting language |
22:03:14 | FromGitter | <ZarsBranchkin> Ooh nice, lisp like language. Have had pretty fun experience with lisp. Mainly using emacs now, so I mess around with lisp from time to time |
22:03:23 | clyybber | Is pixie dead? |
22:04:22 | PMunch | clyybber, well they recently had some activity |
22:04:29 | PMunch | But very little in the last year or two |
22:04:45 | PMunch | So it might be edging back but haven't seen any activity in the IRC channel now for a few days |
22:05:04 | clyybber | Hmm, it surprises me that it is fast written in python |
22:05:35 | FromGitter | <ZarsBranchkin> Yeah, found that bit odd as well. I'm not exactly familiar with RPython though |
22:05:50 | FromGitter | <data-man> Pony is a little horse? Why not a hippopotamus? |
22:05:57 | PMunch | Well, it is RPython and it uses a JIT to compile itself. The compiler is written in RPython so as soon as one iteration of a loop is compiled you can run it many times without much overhead |
22:06:46 | PMunch | Plus it's a functional language so fast is a bit relative |
22:07:27 | clyybber | i find it wierd that there are so many lisp dialects, why? |
22:07:47 | dom96 | because it's easy to implement lisp dialects |
22:08:01 | FromGitter | <RayoGundead> and then there's gambit scheme |
22:10:00 | lamda_ | lol read the story behind the name |
22:12:49 | * | adeohluwa joined #nim |
22:13:38 | * | endragor joined #nim |
22:16:26 | lamda_ | what is everyone doing now? |
22:17:04 | PMunch | lamda_, I'm playing around with implementing Protobuf natively in Nim |
22:17:52 | FromGitter | <ZarsBranchkin> Sick with studying, thinking of returning to writing a small Nim post |
22:18:16 | PMunch | Ooh, any interesting topic Zars? |
22:18:30 | * | endragor quit (Ping timeout: 260 seconds) |
22:18:46 | PMunch | Err, I mean "you should not stop studying, studying good, fun bad" |
22:19:39 | FromGitter | <ZarsBranchkin> Been a tough session, some break is alright, haha |
22:20:33 | PMunch | What're you studying? |
22:20:36 | FromGitter | <ZarsBranchkin> I stumbled upon post about the command `yes` and how it uses clever things to write to stdout reaaally quickly. Wanted to see if Nim can match it's speed to see how it stands up to native C |
22:21:20 | FromGitter | <ZarsBranchkin> Well in general, going for physics bachelor, but right now I have left differentialequations and mathematical analysis(I guess same as calculus) exams |
22:22:22 | PMunch | Oh cool, got some friends studying physics |
22:22:39 | PMunch | Personally I did computer science, just finished my masters degree |
22:22:49 | FromGitter | <data-man> I am reading the "Origin" (Dan Brown novel) :) |
22:23:13 | dom96 | I'm watching BBC news because it's too late to really do anything substantial :) |
22:23:19 | PMunch | data-man, is it good? |
22:23:28 | FromGitter | <ZarsBranchkin> Yeah, all this time I thought I'll go for computer science, but ended up going for physics to change things up. Probably will work as programmer though, but this knowledge will still be handy |
22:23:34 | * | lamda_ quit (Ping timeout: 260 seconds) |
22:23:56 | FromGitter | <data-man> @PMunch: Yes |
22:23:59 | PMunch | Hmm, there was someone on here recently asking about using an iterator in a recursive way. Did he figure out how to do it? |
22:24:54 | PMunch | data-man, I read Digital Fortress, The Da Vinci Code, Deception Point, and Angels & Demons |
22:25:01 | FromGitter | <tim-st> In the docs it's recommended to use stack instead, but many problems are difficult to write equivalent using a stack |
22:25:18 | clyybber | Im going to bed |
22:25:28 | PMunch | But "The lost symbol" hadn't come out by the time I was done with the others so never got further |
22:25:35 | PMunch | Night clyybber |
22:25:49 | clyybber | good night |
22:25:58 | * | clyybber left #nim (#nim) |
22:26:02 | PMunch | tim-st, where in the docs? |
22:26:10 | dom96 | I'm reading Fire and Fury currently |
22:26:37 | dom96 | PMunch: Why do you need that? |
22:26:40 | PMunch | Haha, that's gotta be a ride |
22:26:59 | FromGitter | <tim-st> @PMunch search for "preorder" here: https://nim-lang.org/docs/tut2.html |
22:27:11 | PMunch | I'm currently reading "The Time Machine" by H. G. Wells |
22:27:25 | FromGitter | <tim-st> but preorder is also an easy example, I had a very difficult one and gave up^^ |
22:27:28 | PMunch | dom96, well messages in the protobuf format can be nested |
22:27:43 | dom96 | PMunch: oh, that's a classic. I enjoyed it a lot. |
22:27:45 | PMunch | So I wanted to run the "parseMessage" procedure again when I found a new message block |
22:28:27 | FromGitter | <tim-st> @PMunch maybe you could break to outer block and save the state in a var |
22:28:33 | FromGitter | <tim-st> I use this way for my parser |
22:28:36 | dom96 | where does an iterator come into that? |
22:28:46 | PMunch | Well that's basically what a stack would be used for tim-st :P |
22:28:56 | PMunch | for t in proto.tokenize({'{', '}', ';'}) |
22:29:02 | PMunch | That's where it comes in :) |
22:29:12 | FromGitter | <tim-st> But it's more difficult to implement it using a stack instead of using vars |
22:29:37 | PMunch | Well, I should probably rewrite this parser anyways to be more secure.. |
22:29:51 | PMunch | Parsers are sometimes such a pain in the ass to write.. |
22:30:34 | FromGitter | <tim-st> especially for natural languages, yes |
22:31:01 | PMunch | Oh yeah, this is a bit easier than that :P |
22:31:27 | FromGitter | <data-man> If you have not read "The Hyperion Cantos" by Dan Simmons, I highly recommend. |
22:31:30 | PMunch | But since it's so rigid I kinda want to check for bugs as well. Which means a lot of extra checks |
22:31:59 | dom96 | It seems like you should create some sort of Tokenizer object |
22:32:11 | dom96 | Which offers a ``take`` procedure that yields the next token |
22:32:15 | * | nsf quit (Quit: WeeChat 2.0.1) |
22:32:24 | PMunch | Hmm, that could work.. |
22:32:39 | PMunch | Or I could just assume that the .prot file is not absurdly large and read the whole thing into memory |
22:32:47 | PMunch | Just give me a seq of some sort |
22:32:52 | dom96 | yep |
22:33:35 | * | solitudesf quit (Ping timeout: 248 seconds) |
22:33:38 | dom96 | when I needed to do something like this I just wrote my own lexer and parser |
22:33:50 | dom96 | by using a while loop + index |
22:33:56 | dom96 | https://github.com/dom96/nael/blob/master/src/lexer.nim#L10 |
22:34:31 | dom96 | Your parser might benefit from a Token object as well |
22:36:32 | FromGitter | <ZarsBranchkin> Recently started using token objects when parsing some text, pretty neat to work with them |
22:36:47 | FromGitter | <tim-st> in @dom96's code the technique could be used I said with breaking to outer scope instead of nested while true's it's described in the xmlparser section, where html is parsed using xml |
22:37:12 | FromGitter | <tim-st> at least there is a simple example |
22:37:27 | PMunch | I was thinking read the entire file into a string (which I already do). Then remove comments and newlines (tokens are otherwise separated anyways). Then split on ';' and strip whitespace from all ends. Then I can write parser procedures that take a seq and an index (to avoid copying), and have those recursively parse the tokens. |
22:38:52 | dom96 | Well... that's a bit of a complicated way of going about it |
22:39:47 | dom96 | You'd probably be better off generating tokens like {, }, ';', '//' etc. Then in your parser you can easily skip after a // token. |
22:39:58 | dom96 | It's just more flexible this way |
22:40:47 | dom96 | Also, there are many edge cases which pegs will be hard to get right on |
22:41:01 | * | c0ntribut0r quit (Ping timeout: 268 seconds) |
22:41:05 | dom96 | I don't know if this applies to protobuf, but what if I write "// blah"? |
22:41:21 | dom96 | Adding special cases to the peg will be a PITA |
22:41:43 | PMunch | proto.replacef(peg"'/*' @ '*/' / '//' @ \n / \n", "") |
22:41:57 | PMunch | That's what I currently to. Removes comments and newlines |
22:42:22 | * | c0ntribut0r joined #nim |
22:43:18 | * | Ven`` joined #nim |
22:43:47 | dom96 | I would strongly encourage you to have your parser handle these |
22:44:02 | dom96 | it could even be useful to represent comments in your AST |
22:44:09 | dom96 | someone might have a use for them |
22:44:10 | PMunch | Why? That's a PITA |
22:44:39 | PMunch | Handling /**/ in the middle of pretty much everything, no thanks.. |
22:44:51 | FromGitter | <tim-st> Btw what I didnt find in the docs is whether I can overload generic procs, e.g. first one all unless string, last one only string. does it work? |
22:44:52 | dom96 | because replacing it with pegs is hackish and error prone |
22:45:10 | FromGitter | <ZarsBranchkin> Doesn't seem so, recognize comment while you're not parsing any other token, start a new token for comment. Sounds pretty clean to me |
22:45:29 | PMunch | What if I do "int /* was float */ variableName = 3;" |
22:45:54 | PMunch | dom96, well there are problems with it, sure |
22:46:08 | dom96 | token: "int", commentStartToken: "/*", token: " was float ", commentEndToken: "*/" |
22:46:08 | FromGitter | <ZarsBranchkin> Well you check if you're not parsing any token first. Here you'd be inside a string token already |
22:46:40 | PMunch | Having a */ in a string for example would terminate a comment early with my current peg |
22:46:53 | dom96 | case tokens[i]: of commentStartToken: while tokens[i].kind != commentEndToken: inc(i) |
22:47:10 | PMunch | Yeah, but that makes for unreadable parsers.. |
22:47:31 | dom96 | er.. how? |
22:47:39 | dom96 | in what way is what you're doing more readable? |
22:48:21 | FromGitter | <tim-st> I think there are not really good readable parsers for complex languages. Jetbrains defines a static proc for every state and calls it in there IDEs |
22:48:29 | PMunch | Because the entire body of the main proc ends up being a check that delegates parsing off to smaller chunks of specific parts of the language |
22:48:46 | PMunch | So if you have a bug with one part of the parsing then you can go the the aptly named proc and fix it |
22:49:03 | dom96 | that sounds like a description of the code I'm proposing |
22:49:03 | PMunch | And not some obscure "take" procedure that does everything |
22:49:08 | PMunch | Hmm |
22:49:30 | FromGitter | <tim-st> Does anyone knows the answer to my question above^^ |
22:49:36 | dom96 | You don't have to have procedures to make things clear |
22:49:55 | PMunch | No, but they help |
22:50:04 | PMunch | Take something in, spits something concrete out |
22:50:06 | dom96 | This is how Araq taught me to write parsers btw |
22:50:20 | PMunch | Then it's just a matter of calling on the right proc at the right time |
22:50:43 | PMunch | Well it's probably the right way, I just don't like it :P |
22:51:06 | dom96 | Well then you'll likely have a buggy parser |
22:51:24 | PMunch | Might've.. |
22:51:46 | PMunch | Well, I've got to go hang up some clothes, then I'm probably off to bed. I'll think about it :) |
22:52:26 | dom96 | Please do, and feel free to ping me if something isn't clear. |
22:52:49 | FromGitter | <ZarsBranchkin> @tim-st pretty sure I saw that case mentioned on manual. Not sure if I'll find it now, but from what I remember, concrete type proc defentition will take higher priority than generic one |
22:53:21 | dom96 | tim-st: you should be able to. Why not give it a try? |
22:53:31 | FromGitter | <tim-st> Thanks for your answer, unfortuantely it didnt work. I got error "two matching procs" |
22:53:45 | dom96 | Show us your code :) |
22:54:13 | FromGitter | <tim-st> I have to uncomment it and find it again |
22:58:22 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:58:59 | FromGitter | <ZarsBranchkin> Just tested out and it works fine for me: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a651b335ade18be39a5f545] |
23:00:17 | FromGitter | <tim-st> first one: `proc deserialize*T (self: LevelDbConn, key: string): T =` |
23:00:34 | FromGitter | <tim-st> second one: `proc deserialize*K, V (self: LevelDbConn, key: K): V =` |
23:01:22 | dom96 | oprypin: ping, bug with FromGitter ^^ |
23:01:28 | FromGitter | <tim-st> Error: type mismatch: got (LevelDbConn, int literal(1)) ⏎ but expected one of: ⏎ proc (self: LevelDbConn, key: string): string{.gcsafe, locks: 0.} |
23:01:33 | * | natrys quit (Quit: natrys) |
23:02:19 | FromGitter | <ZarsBranchkin> How can it resolve the first one |
23:03:01 | FromGitter | <ZarsBranchkin> Hm, haven't really looked into generic return types |
23:03:32 | FromGitter | <tim-st> the first one works using ``let x: someType = deserializesomeType (db, "key")` |
23:03:53 | FromGitter | <ZarsBranchkin> ah right, makes sense |
23:04:46 | FromGitter | <tim-st> I hope it's not again *return type overloading* which is not supported |
23:04:52 | dom96 | https://play.nim-lang.org?gist=8972f312dc0293d1906fd343b1bc3aa4 |
23:04:54 | dom96 | Tried to reproduce |
23:05:20 | dom96 | it could possibly be to do with return type overloading |
23:05:57 | FromGitter | <tim-st> I think it was my mistake I didnt declared using [K,V] but only [K] |
23:06:02 | FromGitter | <tim-st> Thanks! |
23:10:42 | FromGitter | <tim-st> perfect it works, thanks. I additionally had the Key declarations switched^^ |
23:33:10 | * | marenz_ quit (Ping timeout: 260 seconds) |
23:36:59 | * | devdri joined #nim |
23:48:53 | FromGitter | <ZarsBranchkin> Hm, why does https://nim-lang.org/docs/lib.html page load so slowly every time I visit it? |
23:49:29 | FromGitter | <ZarsBranchkin> I suppose it has to do with fetching the unofficial packages, but could at least fetch the standard libraries first and load the unofficial ones in background |
23:50:18 | FromGitter | <ZarsBranchkin> I'm using firefox and the page seems to load some content and then hangs up for a bit |
23:55:12 | PMunch | Hmm, looking into parsers maybe I'll end up writing something like Parslet in Nim instead of Protobuf :P |