00:29:53 | * | space-wizard joined #nim |
00:44:00 | * | Motan quit (Quit: Page closed) |
00:52:26 | * | ephja joined #nim |
01:10:50 | * | Jesin joined #nim |
01:21:55 | * | yglukhov joined #nim |
01:26:39 | * | yglukhov quit (Ping timeout: 276 seconds) |
01:28:13 | * | zxtx quit (Ping timeout: 250 seconds) |
01:32:25 | * | zxtx joined #nim |
01:53:56 | * | space-wizard quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
02:19:52 | * | Penagwin joined #nim |
02:37:33 | * | ephja quit (Ping timeout: 250 seconds) |
02:41:01 | * | zxtx quit (Ping timeout: 250 seconds) |
02:41:06 | * | zxtx_ joined #nim |
02:41:30 | * | zxtx_ is now known as zxtx |
03:01:17 | * | Penagwin quit (Read error: Connection reset by peer) |
03:23:25 | * | yglukhov joined #nim |
03:27:36 | * | yglukhov quit (Ping timeout: 244 seconds) |
03:47:07 | * | veganskaway is now known as vegansk |
04:18:47 | * | space-wizard joined #nim |
04:32:39 | * | apotheon quit (Ping timeout: 246 seconds) |
04:58:07 | * | Demos joined #nim |
05:05:01 | * | space-wizard quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
05:13:14 | * | perturbation quit (Quit: Leaving) |
05:24:58 | * | yglukhov joined #nim |
05:29:29 | * | BlaXpirit quit (Ping timeout: 260 seconds) |
05:29:56 | * | yglukhov quit (Ping timeout: 276 seconds) |
05:30:52 | * | BlaXpirit joined #nim |
05:32:22 | * | endragor joined #nim |
05:45:42 | * | s4 joined #nim |
05:54:20 | * | Trustable joined #nim |
05:56:13 | * | space-wizard joined #nim |
05:59:30 | * | pigmej quit (Ping timeout: 244 seconds) |
06:00:04 | * | pigmej joined #nim |
06:03:08 | * | yglukhov joined #nim |
06:07:37 | * | yglukhov quit (Ping timeout: 260 seconds) |
06:16:48 | * | endragor_ joined #nim |
06:20:51 | * | endragor quit (Ping timeout: 268 seconds) |
06:24:38 | * | space-wizard quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
06:25:41 | * | lokien left #nim ("Leaving") |
06:41:09 | * | endragor_ quit (Remote host closed the connection) |
06:41:38 | * | endragor joined #nim |
06:43:50 | * | BlaXpirit quit (Quit: Bye) |
06:44:00 | * | BlaXpirit joined #nim |
06:52:32 | * | yglukhov joined #nim |
06:52:47 | * | yglukhov quit (Read error: Connection reset by peer) |
06:53:04 | * | yglukhov joined #nim |
06:53:55 | * | yglukhov_ joined #nim |
06:53:55 | * | yglukhov quit (Read error: Connection reset by peer) |
06:55:13 | * | yglukhov joined #nim |
06:55:13 | * | yglukhov_ quit (Read error: Connection reset by peer) |
06:55:14 | * | rusua joined #nim |
06:59:28 | * | desophos quit (Read error: Connection reset by peer) |
07:09:52 | * | yglukhov_ joined #nim |
07:10:09 | * | yglukhov_ quit (Read error: Connection reset by peer) |
07:10:09 | * | yglukhov quit (Read error: Connection reset by peer) |
07:10:23 | * | yglukhov joined #nim |
07:14:52 | * | Arrrr joined #nim |
07:27:24 | * | yglukhov_ joined #nim |
07:30:39 | * | yglukhov quit (Ping timeout: 276 seconds) |
08:06:22 | * | yglukhov_ quit (Remote host closed the connection) |
08:11:47 | * | dorei joined #nim |
08:16:04 | * | yglukhov joined #nim |
08:20:07 | * | ephja joined #nim |
08:20:14 | * | StarBrilliant quit (Ping timeout: 276 seconds) |
08:20:25 | * | mtj_ quit (Ping timeout: 252 seconds) |
08:24:09 | * | yglukhov quit (Remote host closed the connection) |
08:24:44 | * | yglukhov joined #nim |
08:33:41 | * | StarBrilliant joined #nim |
08:34:04 | * | mtj_ joined #nim |
08:54:41 | * | StarBrilliant quit (Ping timeout: 276 seconds) |
08:55:10 | * | mtj_ quit (Ping timeout: 244 seconds) |
08:57:45 | * | StarBrilliant joined #nim |
08:58:06 | * | mtj_ joined #nim |
08:58:20 | * | Demon_Fox quit (Quit: Leaving) |
09:04:31 | * | fredrik92 joined #nim |
09:08:12 | * | yglukhov quit (Remote host closed the connection) |
09:08:32 | kingofoz | proc myWriteln(f: File, a: varargs[string]) = |
09:08:32 | kingofoz | for s in items(a): |
09:08:32 | kingofoz | write(f, s) |
09:08:32 | kingofoz | write(f, "\n") |
09:08:32 | kingofoz | var f: File = open("a.txt", fmReadWrite) |
09:08:33 | kingofoz | myWriteln(f, "abc", "def", "xyz") |
09:08:35 | kingofoz | echo(f.readLine()) |
09:08:37 | kingofoz | f.close() |
09:08:45 | kingofoz | ah, it is messed up |
09:09:27 | kingofoz | I want to say this code can write but f.readLine() doesn't work |
09:10:55 | Arrrr | try: '\n' -> '\l' |
09:12:16 | kingofoz | can not read either |
09:14:49 | * | gokr joined #nim |
09:18:16 | Arrrr | I tried flushing the file, but it gives me an exception. Probably you can't use files the way you want. Try with the streams module |
09:18:23 | Arrrr | http://nim-lang.org/docs/streams.html |
09:20:18 | * | yglukhov joined #nim |
09:21:55 | s4 | kingofoz: try setFilePos() http://nim-lang.org/docs/system.html#setFilePos,File,int64 |
09:24:37 | * | yglukhov quit (Ping timeout: 244 seconds) |
09:27:29 | kingofoz | setFilePos(f, 0) works |
09:27:38 | kingofoz | thanks! |
09:27:58 | kingofoz | I almost forgot position should be considered |
09:31:07 | s4 | You're welcome |
09:43:03 | * | M-Quora quit (Ping timeout: 264 seconds) |
09:43:39 | * | M-max quit (Ping timeout: 264 seconds) |
09:48:33 | * | M-Quora joined #nim |
09:48:39 | * | vendethiel- joined #nim |
09:49:09 | * | M-max joined #nim |
09:49:17 | * | vendethiel quit (Ping timeout: 268 seconds) |
10:00:58 | cheatfate | dom96, https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L260 this is place where recursion starting with "immediate completion" |
10:07:04 | dom96 | yeah, that comes from https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L1262 |
10:07:36 | dom96 | I seriously think the solution is to just get rid of the stack trace |
10:11:16 | cheatfate | dom96, its not a solution you just hiding serious bug which prevent from using nim in production |
10:12:51 | cheatfate | dom96, i dont think Araq wants to make language just for experimental usage... |
10:14:13 | dom96 | I guess you're right. Callback calls will always add more and more data onto the stack |
10:15:18 | cheatfate | dom96, not all callbacks but only when function returns finished future |
10:19:06 | dom96 | okay, create a `proc callSoon(cb: proc ())` which queues `cb` to be called by the global dispatcher |
10:19:17 | dom96 | then change all these fut.cb() calls to callSoon(fut.cb) |
10:19:43 | dom96 | The name `callSoon` is up for debate. |
10:21:12 | * | novavis joined #nim |
10:32:57 | * | endragor quit (Read error: Connection reset by peer) |
10:33:03 | * | endragor_ joined #nim |
10:58:53 | federico3 | Nim needs some reliable crypto primitives - second call for contributors to a libsodium wrapper github project - niv and me would be interested |
11:02:19 | reactormonk | federico3, c2nim it? |
11:03:04 | federico3 | reactormonk: not enough: https://github.com/judofyr/sodium.nim/blob/master/sodium.nim |
11:03:35 | reactormonk | :-( |
11:03:35 | federico3 | and also, a wrapper to a crypto library should be tested, documented and reviewed a bit :) |
11:04:04 | federico3 | ops, wrong paste: https://github.com/nim-lang/Nim/issues/3962 |
11:05:07 | niv | handcrafting the api is probably going to be prettier anyways, esp for some data types there might be reasonable cause to do wrappers |
11:05:26 | federico3 | and safer to use |
11:05:39 | niv | yep! |
11:08:45 | cheatfate | federico3, all crypto primitives in libsodium could not be reliable |
11:09:20 | cheatfate | federico3, except AES-CGM i think |
11:10:59 | federico3 | cheatfate: care to elaborate? |
11:11:52 | cheatfate | federico3, i think openssl library consist of much more crypto primitives you want... |
11:12:36 | cheatfate | federico3, or maybe you need to explain what is "crypto primitive" for you |
11:13:30 | federico3 | cheatfate: this ones https://en.wikipedia.org/wiki/Cryptographic_primitive#Combining_cryptographic_primitives |
11:14:47 | niv | speaking as a end-user, what nim stdlib is sorely lacking is hmacs, sha2 support, scrypt, and 25519 key stuff |
11:15:08 | federico3 | openssl is way bigger than libsodium, by design - agreed. |
11:16:44 | cheatfate | niv, to support all kinds of public key cryptography you need something like BigInteger |
11:17:20 | niv | maybe? but not to just sign, hmac, hash, or similar a arbitary byte sequence |
11:17:25 | niv | just speaking practically here |
11:17:41 | niv | i think its something a modern stdlib should have, not being a optional package |
11:17:53 | * | fredrik92 quit (Quit: Leaving) |
11:18:36 | cheatfate | niv, sign is a public key cryptography too |
11:19:34 | niv | yes, obv. but you can hide that all in the backing lib like libsodium. that just takes pointers to binary data too |
11:19:55 | niv | or what are you suggesting you need bigints for on the nim side? |
11:21:50 | cheatfate | niv, i dont think you want "Hello World!" executable to be compiled with SHA algorithm inside |
11:22:24 | federico3 | cheatfate: we are talking about a *wrapper* for libsodium, not implementing the algos in Nim :) |
11:22:53 | cheatfate | federico3, i know you talking about wrapper, but niv talking about crypto primitives inside standart library :) |
11:23:22 | niv | oh, right. thats a different thing then, i guess. maybe a nimble module isnt so bad :) |
11:23:29 | niv | sorry for the confusio |
11:23:30 | niv | ..n |
11:23:54 | federico3 | niv: you meant putting the wrapper inside the standard library? |
11:24:29 | niv | well in my dream world, yes, eventually, much like other languages ship with basic crypto stuff by default. it should be available to nim users at no additional dependency cost |
11:24:39 | niv | but i realise now it might not be that straightforward |
11:25:05 | niv | and it might not align with nims design principles |
11:25:18 | federico3 | Nim contains an openssl wrapper in the stdlib |
11:25:41 | cheatfate | niv, its not so hard to make crypto hash or simmetric crypto with nim |
11:26:13 | cheatfate | niv, you only need to take care about signed/unsigned integers |
11:26:23 | federico3 | not hard but very bad for security |
11:26:29 | niv | i wouldnt really call the openssl api straightfoward |
11:26:53 | niv | and yes, reimplementing stuff thats already battletested isnt really a good first option |
11:27:16 | federico3 | (otherwise we wouldn't be talking about libsodium :) ) |
11:27:26 | cheatfate | federico3, why do you think that one implementation is better then yours if you all producing equal test results? |
11:28:30 | niv | crypto is much more than just passing a few tests. there's all kinds of issues to keep in mind. sidechannel attacks, timing attacks, random corner cases. bugs happen in the most insidious ways. plus, adding your own impl puts the weight on you, whereas with libsodium you get it from upstream |
11:29:48 | federico3 | cheatfate: because 1) a well know implementation *might* be reviewed by a lot of people, mine is reviewed by noone 2) if there's a vuln in a famous library it might be announced very publicly and users/distros will update the wrapped library. |
11:30:47 | cheatfate | federico3, the only man you can trust with 100% guarantee is you |
11:31:07 | niv | getting crypto right is insanely hard and i wouldnt trust myself with it |
11:31:46 | federico3 | cheatfate: for a lot of stuff I trust other people more than myself, e.g. I wouldn't attempt to do surgery on myself |
11:32:42 | cheatfate | niv, with such approach you will be always dependant on other libraries, but as i can see you can avoid this |
11:32:44 | ephja | wimp! |
11:33:08 | niv | cheatfate: depending on proven libraries isnt a bad thing when it's something as complex as crypto |
11:33:20 | niv | handrolling your own crypto is the best way to fail hard |
11:33:33 | federico3 | cheatfate: but here we are talking about writing stuff that other people will use. :) |
11:33:35 | ephja | it's more about the importance of the task in question, but yes |
11:33:53 | cheatfate | niv, i'm not talking about inventing crypto primiteves i'm talking about implementation of known algorithms |
11:34:09 | ephja | there's nothing wrong with novel implementations that are unofficial though |
11:34:55 | cheatfate | federico3, we are not talking about other professions we are talking about programming |
11:37:58 | cheatfate | federico3, the only reason i'm talking about this - i dont trust Daniel J. Bernstein |
11:38:00 | federico3 | same thing - you still want many pairs of expert eyes looking closely at your stuff :) |
11:40:16 | cheatfate | federico3, you need expert eyes if you inventing new crypto algorithm... i dont think experts can take a look on crypto libraries from windows or macos... but everybody uses it... |
11:41:46 | federico3 | ehm, actually implementation is often the weakest spot of crypto |
11:45:21 | cheatfate | federico3, i dont think so... until your implementation can DEC(ENC(Y)) = Y on all limits of Y your implementation would correct, and i'm not talking about securezeromem and securezerocopy here |
11:46:25 | federico3 | I'm afraid there's more. Side channel attacks, timing attacs, as niv mentioned |
11:48:16 | cheatfate | federico3, side channel and timing attacks are suitable only for public key cryptography |
11:49:07 | federico3 | huh? symmetric crypto can be vulnerable as well |
11:51:50 | cheatfate | federico3, vulnerable to timing attacks and/or side-channel attacks? |
11:51:54 | federico3 | yep |
11:52:11 | cheatfate | federico3, i dont think you understand what are you talking about... |
11:52:46 | cheatfate | Symmetric ciphers have historically been susceptible to known-plaintext attacks, chosen-plaintext attacks, differential cryptanalysis and linear cryptanalysis. |
11:52:55 | cheatfate | https://en.wikipedia.org/wiki/Symmetric-key_algorithm |
11:53:19 | federico3 | that's what I said |
11:53:42 | cheatfate | federico3, and where you see this timing attacks and side-channel attacks? |
11:54:32 | federico3 | look at the list of examples of side channel attacks: |
11:54:38 | federico3 | https://en.wikipedia.org/wiki/Side-channel_attackh |
11:54:41 | federico3 | https://en.wikipedia.org/wiki/Side-channel_attack |
11:55:30 | federico3 | you can have power monitoring attacks in symmetrict crypto for example |
11:56:11 | * | yglukhov joined #nim |
11:57:25 | federico3 | or not protecting a key in memory properly and so on |
11:57:38 | * | BitPuffin joined #nim |
11:59:18 | cheatfate | federico3, you need to use terms properly "side channel attacks" are not used on primitives, they are used on protocols and primitives |
11:59:33 | cheatfate | *not primitives |
12:00:09 | cheatfate | we are talking about implementation of crypto primitive, and not talking about implementation of key storage, or network protocol, or disk encryption |
12:04:37 | federico3 | https://nacl.cr.yp.to/features.html |
12:05:11 | federico3 | ...under "No data-dependent array indices" |
12:05:26 | federico3 | (this is just a random example) |
12:08:56 | cheatfate | federico3, are dispute is useless just because you can't understand what i'm trying to say to you |
12:09:27 | federico3 | ok |
12:09:28 | cheatfate | AES-CGM is not a crypto primitive |
12:09:40 | cheatfate | AES - crypto primitive |
12:16:07 | cheatfate | federico3, its much easy to make reverse engineering on code which uses publicly available libraries, even if they bundled to your executable like static libraries |
12:26:30 | cheatfate | dom96, and how you want to implement this call_soon()? |
12:27:03 | cheatfate | dom96, because currently i have only one idea - make global Queue variable |
12:27:30 | cheatfate | dom96, to avoid all forward declaration problems |
12:29:02 | * | fredrik92 joined #nim |
12:29:31 | dom96 | what forward declaration problems do you foresee? |
12:29:52 | dom96 | just put a queue inside `Dispatcher` |
12:29:58 | dom96 | and use the global dispatcher |
12:33:12 | cheatfate | dom96, i thought to replace only one place https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L260 to call_sonn(future.cb()) |
12:34:55 | dom96 | I think it makes sense to do in complete and fail too. |
12:35:13 | dom96 | or maybe not |
12:35:38 | cheatfate | dom96, not need to patch in complete() and fail() just because when staff completed immediately future dont have callback yet |
12:37:41 | cheatfate | but the problem is "callback=" dont know about dispatcher yet |
12:38:36 | cheatfate | or maybe futures must know Dispatcher... |
12:46:17 | * | fredrik92 quit (Quit: Shutting down . . .) |
12:59:01 | * | zama quit (Ping timeout: 250 seconds) |
12:59:25 | * | zama joined #nim |
12:59:53 | * | Jesin quit (Ping timeout: 250 seconds) |
13:04:33 | * | yglukhov quit (Ping timeout: 240 seconds) |
13:11:50 | * | Jesin joined #nim |
13:31:18 | cheatfate | dom96, any suggestions? |
13:32:28 | * | apotheon joined #nim |
13:40:28 | cheatfate | dom96, because i dont think its a good choice to make Queue global variable but any other choices are depends on you |
13:46:32 | * | gokr quit (Ping timeout: 276 seconds) |
13:47:19 | dom96 | cheatfate: just forward declare `callSoon` |
13:47:27 | * | s4 quit (Quit: Konversation terminated!) |
13:47:59 | cheatfate | dom96, ok |
14:09:31 | cheatfate | dom96, ok i have encountered with 2 problems, one is easy but second one is tough |
14:09:56 | cheatfate | dom96, the tough one is "Non-2xx or 3xx responses: 2" when testing with wrk |
14:13:56 | * | saml joined #nim |
14:30:46 | * | GangstaCat quit (Quit: Leaving) |
14:36:01 | cheatfate | dom96, it looks like this patch reveal other bugs... |
14:36:16 | * | pregressive joined #nim |
14:38:06 | * | pregressive quit (Client Quit) |
14:41:57 | * | pregressive joined #nim |
14:44:15 | cheatfate | dom96, i need help with this warning [Warning: 'callback=' is not GC-safe as it calls 'call_soon' [GcUnsafe2]] |
14:49:14 | * | gokr joined #nim |
15:06:46 | cheatfate | dom96, please take a look https://gist.github.com/cheatfate/4e9dd1d870b89f6cb958897d399ac26c and my comment, i dont understand why this happend |
15:08:03 | * | rok joined #nim |
15:16:46 | cheatfate | Araq_, could you please take a look on https://gist.github.com/cheatfate/4e9dd1d870b89f6cb958897d399ac26c |
15:19:34 | Araq_ | cheatfate: to the callback add .gcsafe, locks: 0 and see why the compiler thinks that is not the case |
15:24:41 | * | dorei quit (Quit: Page closed) |
15:28:31 | cheatfate | Araq_, i dont understand why this changes affect this callback setup |
15:29:07 | Araq_ | it doesn't, it tells you more about the compiler error. |
15:29:39 | * | BlaXpirit quit (Quit: Bye) |
15:30:51 | * | BlaXpirit joined #nim |
15:34:34 | * | BlaXpirit quit (Client Quit) |
15:34:54 | * | BlaXpirit joined #nim |
15:35:14 | * | sorakun joined #nim |
15:40:02 | * | deavmi joined #nim |
15:40:14 | deavmi | how to concatenate strings in nim |
15:40:25 | deavmi | or should i say concat say now an int to a string |
15:41:22 | Araq_ | $i & "foo" |
15:41:48 | deavmi | where i is int |
15:41:53 | deavmi | made into a string uisng the $ |
15:41:55 | Araq_ | exactly |
15:42:03 | deavmi | and "foo" is concanetanted using conact operator & |
15:42:03 | deavmi | ? |
15:42:11 | deavmi | Thanks ;) |
15:42:13 | Araq_ | yes |
15:42:15 | deavmi | * concat |
15:42:23 | deavmi | awesome, thanks ;) |
15:42:31 | Araq_ | I often think about adding a & which can deal with ints and floats too |
15:42:57 | Araq_ | but I dunno. often these things also weaken the type checking too much. |
15:43:01 | deavmi | Oh lol. |
15:43:21 | deavmi | Starting to learn nim |
15:43:25 | deavmi | I like it so far |
15:43:34 | deavmi | Especially when coming from pyhton |
15:44:01 | deavmi | * python and you get that syntax but some more stuff (where stuff="WOWOWOWOWOWOWOOWOWOW") |
15:44:13 | Araq_ | it's addictive. |
15:44:20 | deavmi | It is |
15:44:28 | deavmi | Araq_: Do you work on the project? |
15:44:40 | Araq_ | I started it. |
15:44:53 | deavmi | Thought so |
15:45:07 | deavmi | You're a good guy for doing so. |
15:45:30 | deavmi | I don't have to struggle to find a modern high level language that compiles to low-level code |
15:45:45 | deavmi | I love watching the verbosity of the compilation, makes me smile. |
15:46:13 | deavmi | The day a book comes out I will be getting it, but I must say the "Manual" is great |
15:47:09 | deavmi | Is there shorthand notation for `f = f + 1` |
15:49:38 | Arrrr | Araq, why did you chose '&' instead of '+' which takes less keystrokes |
15:49:55 | Arrrr | deavmi you can use 'f += 1' or 'inc f' |
15:50:02 | deavmi | I see. |
15:50:16 | deavmi | Arrrr: Does incr or inc use pointers? |
15:50:42 | deavmi | Araq_: is `stdin` a predfined File object or something like that? |
15:51:26 | cheatfate | Araq_, i just want to know why this changes inflict this error |
15:51:38 | Araq_ | Arrrr: so that seqs of ints can have + for plus and & for concat |
15:52:10 | Araq_ | cheatfate: and I just want to help you find it out on your own because I cannot take a closer look right now ;-) |
15:52:51 | deavmi | f++ is not valid syntax in Nim. Could this be a feature in the future? |
15:52:59 | deavmi | oh wait, you have inc (I forgot) |
15:53:39 | Arrrr | I agree with auto-string on concatenating |
15:55:05 | deavmi | Wondering if my comments as descriptions are correct? - https://gist.github.com/deavmi/160ccf218ef07a9d7e997a0c91837842 |
15:55:26 | Araq_ | Arrrr: yeah but then why not have proc concat(x: varargs[`$`, string]) ? seems more idiomatic Nim these days. |
15:56:49 | Araq_ | deavmi: spot on, but you can use name.add "d" instead of name = name & "d" |
15:56:59 | Arrrr | The thing is, concatenating is used a lot, and you dont want to force the programmer to add boilerplate code that will hardly be absent |
15:57:08 | deavmi | so |
15:57:21 | deavmi | Araq_: Are strings an object? |
15:57:38 | deavmi | Cause of the dot operation |
15:58:52 | Arrrr | You can write your echoes like this: echo "its value is: ", i |
15:59:23 | Araq_ | Arrrr: not sure concatenating should be used a lot though, usually things like 'echo' can be introduced |
16:02:14 | Arrrr | Well, speaking for myself, i concatenate a lot with non-string variables, in different contexts. Eventually everything comes to echo or writeFile, but these operations are performed before. |
16:03:31 | Arrrr | And in other languages, i'm used to a + b + " " + etc, and therefore the difference is notable |
16:10:32 | cheatfate | Araq_, it looks like some kind of compiler bug, because when i have modified this to use "type cbProc = proc()" and modified my functions this bug just disappeares |
16:28:05 | * | rok quit (Quit: rok) |
16:28:25 | * | krux02 joined #nim |
16:30:42 | cheatfate | dom96, it looks like you need to patch asyncdispatch.nim with queue by yourself, all my tries raising errors which i dont understand |
16:32:00 | * | space-wizard joined #nim |
16:38:18 | dom96 | cheatfate: I can certainly try. Write a reminder for me on Github please (in the relevant issue). |
16:42:39 | * | elrood joined #nim |
16:43:23 | * | sorakun quit (Remote host closed the connection) |
16:45:52 | * | bozaloshtsh joined #nim |
16:46:29 | cheatfate | dom96, https://github.com/nim-lang/Nim/issues/3919 |
16:49:31 | deavmi | Araq_: Is the type string an object a class of some sorts like I can do "dd".add("a")? |
16:51:59 | ephja | deavmi: http://manual.nim-lang.org/docs/manual.html#procedures-method-call-syntax |
16:52:28 | deavmi | I see |
16:52:32 | deavmi | it's like an implicit parameter |
16:52:38 | deavmi | "d".add("d") |
16:53:36 | * | krux02 quit (Remote host closed the connection) |
16:53:58 | deavmi | I'm understanding OOP better now |
16:54:30 | reactormonk | deavmi, nah, no implicit parameters. Just plain function calls. |
16:55:10 | deavmi | Oh I see |
16:55:16 | deavmi | okay, let me get this straight then: |
16:55:29 | deavmi | If I have the function (proc) len |
16:55:44 | deavmi | And I do: "Tristan".len() |
16:55:53 | deavmi | It converst it to len("Tristan") |
16:55:58 | reactormonk | yeah, pretty much |
16:56:07 | deavmi | Oh |
16:56:16 | deavmi | that's clever (I think I am understanding Nim now) |
16:56:29 | reactormonk | It's just a way to teach OOP people about typeclasses |
16:56:32 | deavmi | so then... I'm going to write out some code and check this stuff out |
16:57:11 | deavmi | So wait, you basically will create procs that are in no class but can operate on the data in a way? |
16:58:37 | deavmi | I see now |
16:58:44 | deavmi | I kinda see what is happening. |
16:59:00 | deavmi | something.function |
16:59:09 | deavmi | where something will be placed as first arg in call to function? |
16:59:55 | deavmi | My word: var d = 23 ; d.inc() |
17:00:00 | deavmi | That worked, this is so cool. |
17:00:22 | deavmi | basically d.inc() or d.inc is translated into inc(d) |
17:00:31 | ephja | foo.bar(x, y, z) -> bar(foo, x, y, z), foo.bar() -> bar(foo), foo.bar -> bar(foo) |
17:00:37 | deavmi | WOW! #DennisRitchieBeJealousForMe |
17:00:45 | ephja | the latter of which can be used if the proc resembles a field (property) |
17:00:53 | deavmi | latter? |
17:01:02 | deavmi | sorry, my advanced english is not so good |
17:01:03 | ephja | the last of the three examples |
17:02:29 | reactormonk | deavmi, special case are fields of an object, which can only be accessed via obj.field IIRC |
17:02:37 | Arrrr | The trick even works for procs https://glot.io/snippets/ee3fhjhgrr |
17:02:52 | deavmi | I need to try something quickly |
17:05:15 | deavmi | I need to revise the type declaration syntax |
17:05:43 | deavmi | Cause my word. I just can;t remmeber that.... damn idnentation (killing me - but makes code look nice) |
17:06:04 | deavmi | RootObj |
17:06:33 | deavmi | is that a type (built-in) that contains like stuff for doing stuff with types and stuff with objects and stuff |
17:06:34 | deavmi | ? |
17:09:55 | deavmi | Must say glot.io is a nice site - thanks for sharing that. |
17:10:08 | Arrrr | No, is just an alias for object http://nim-lang.org/docs/system.html#RootObj |
17:11:58 | bozaloshtsh | RootObj is an alias for an object? It looks like a type from the error message from "echo RootObj" |
17:11:58 | * | brson joined #nim |
17:12:38 | * | PMunch joined #nim |
17:13:31 | Arrrr | You are right, it is an alias for type object |
17:16:43 | deavmi | Arrrr: And `object` is? |
17:20:05 | bozaloshtsh | object is object, a beefed-up tuple |
17:20:06 | Arrrr | It lets you define types formed by several fields, for example https://glot.io/snippets/ee3fz3ohrm |
17:20:31 | bozaloshtsh | but if you want an object hierarchy you need a root, so RootObj serves that purpose. It's no different from a bare object. |
17:23:17 | * | darkf quit (Quit: Leaving) |
17:34:26 | deavmi | bozaloshtsh: I see |
17:34:53 | deavmi | does it add anything useful? RootObj |
17:37:36 | deavmi | So yeah |
17:37:36 | deavmi | https://glot.io/snippets/ee3fz3ohrm |
17:37:43 | deavmi | This isn't working - https://glot.io/snippets/ee3fz3ohrm |
17:38:22 | bozaloshtsh | RootObj does nothing |
17:38:47 | bozaloshtsh | your code doesn't work because echo implicitly calls `$` on its arguments |
17:38:58 | bozaloshtsh | and since `$`(Person) isn't defined, you get an error |
17:40:01 | deavmi | bozaloshtsh: I'm utterly lost. |
17:40:03 | bozaloshtsh | https://glot.io/snippets/ee3fz3ohrm |
17:40:17 | bozaloshtsh | hmm, not sure if that link will work |
17:40:24 | * | rusua quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:40:47 | bozaloshtsh | trying to create a glot with working code to illustrate `$` procs |
17:40:47 | deavmi | nevrmind |
17:40:51 | deavmi | got it to work |
17:40:51 | deavmi | https://glot.io/snippets/ee3fz3ohrm |
17:41:06 | deavmi | https://glot.io/snippets/ee3fz3ohrm |
17:42:15 | bozaloshtsh | here try this: https://glot.io/snippets/ee3gl06xjz |
17:47:11 | deavmi | reactormonk: This makes sense now - deavmi, special case are fields of an object, which can only be accessed via obj.field |
17:47:46 | deavmi | reactormonk: Cause tbk.name makes sense, but name(tbk) just no. amkes no sense whatso ever |
17:48:37 | deavmi | How can one do inheritance in Nim |
17:48:52 | deavmi | https://glot.io/snippets/ee3gl06xjz |
17:49:02 | bozaloshtsh | deavmi: https://nim-by-example.github.io/oop/ |
17:49:03 | * | sarlalian quit (Ping timeout: 264 seconds) |
17:50:37 | * | ludocode joined #nim |
17:55:27 | * | client_ joined #nim |
17:55:30 | * | sarlalian joined #nim |
17:56:37 | * | client_ quit (Client Quit) |
17:57:39 | * | kulelu88 joined #nim |
18:02:08 | * | deavmi quit (Ping timeout: 250 seconds) |
18:08:46 | * | kulelu88 quit (Quit: Leaving) |
18:26:02 | * | Ven joined #nim |
18:30:04 | * | krux02 joined #nim |
18:38:41 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:02:14 | * | pregressive quit (Remote host closed the connection) |
19:03:23 | * | pregressive joined #nim |
19:12:41 | * | rok joined #nim |
19:15:10 | * | BitPuffin quit (Remote host closed the connection) |
19:19:03 | * | fredrik92 joined #nim |
19:26:41 | * | Arrrr quit (Quit: WeeChat 1.4) |
19:29:07 | * | Gonzih quit (Ping timeout: 260 seconds) |
19:31:31 | * | castlelore quit (Quit: WeeChat 1.4) |
19:44:17 | * | castlelore joined #nim |
19:59:10 | * | krux02 quit (Ping timeout: 268 seconds) |
20:00:06 | * | krux02 joined #nim |
20:22:21 | * | enthus1ast joined #nim |
20:24:52 | enthus1ast | does one know how to get some randomness at compiletime? |
20:31:22 | ephja | enthus1ast: it might be possible with this library https://github.com/BlaXpirit/nim-random |
20:32:34 | ephja | but it does use global variables |
20:33:39 | krux02 | can't you read from /dev/random ? |
20:33:44 | enthus1ast | nope |
20:33:46 | * | izi joined #nim |
20:33:59 | def- | krux02: sure, staticExec("head -c1 /dev/urandom") |
20:35:20 | enthus1ast | i have to use an unfree system |
20:37:06 | def- | enthus1ast: compile a small nim program to output a random number with your favorite C bindings and execute it at compile-time with staticExec |
20:37:26 | federico3 | enthus1ast: what are you doing with randomness at compile time? :D |
20:37:36 | enthus1ast | magiccc : ) |
20:37:50 | * | desophos joined #nim |
20:38:21 | enthus1ast | def-: i think i would go with that |
20:38:24 | ephja | maybe create a simple interface using some crude algorithm in the meantime, if the globals in nim-random can't be avoided |
20:39:06 | krux02 | assume I am a Jedi: you do not want randomnes at compile time |
20:40:26 | ephja | and who wanted to generate thousands of proc? I wonder what the use cases are |
20:43:47 | enthus1ast | im playing with anti debug as you might thought |
20:44:09 | enthus1ast | mainly im trying to reverse my own code |
20:44:26 | enthus1ast | and it would be more fun with compile time randomness |
20:44:31 | ephja | well, the opengl lib does, but the macro transforms the input (proc declarations) |
20:44:55 | ephja | ok |
20:45:34 | ephja | it's good to see a lot of metaprogramming experimentation |
20:48:33 | * | krux02 quit (Ping timeout: 240 seconds) |
20:48:55 | * | krux02 joined #nim |
20:51:22 | * | zahary quit (Ping timeout: 260 seconds) |
20:58:49 | * | yglukhov joined #nim |
21:03:09 | * | yglukhov quit (Ping timeout: 244 seconds) |
21:07:07 | * | Varriount_ quit (Ping timeout: 252 seconds) |
21:09:29 | * | Varriount joined #nim |
21:14:14 | * | elrood quit (Remote host closed the connection) |
21:14:22 | cheatfate | Araq_, is it possible with macro to access other modules which are imported and modify it? |
21:19:05 | reactormonk | cheatfate, nope, macros can produce code, not modify it. |
21:19:44 | Araq_ | cheatfate: no. |
21:20:12 | cheatfate | thanks, |
21:21:13 | cheatfate | reactormonk, but asyncdispatch modifies code with {.async.} macro... |
21:23:29 | * | krux02 quit (Ping timeout: 276 seconds) |
21:23:33 | reactormonk | cheatfate, yup, but only local code. |
21:23:55 | * | krux02 joined #nim |
21:24:27 | cheatfate | reactormonk, i think not only local code but all code where {.async.} macro used and asyncdispatch imported... |
21:27:01 | cheatfate | reactormonk, but anyway thanks for answer |
21:28:01 | * | Trustable quit (Remote host closed the connection) |
21:36:04 | ephja | no, the async macro modifies symbols that it's applied to |
21:39:25 | ephja | proc foo() {.bar.} = echo "test" |
21:39:50 | * | Varriount quit (Disconnected by services) |
21:39:50 | * | Varriount_ joined #nim |
21:40:29 | * | yglukhov joined #nim |
21:43:05 | ephja | the AST of the proc now gets passed to the 'bar' macro, which can parse and modify it in any way, really |
21:45:30 | * | rok quit (Quit: rok) |
21:51:14 | ephja | so 'async' in "proc p(): Future[int] {.async.} = ..." modifies 'p' only |
21:52:29 | cheatfate | ephja, yeah |
21:53:14 | ephja | take a look at the source code for the async macro and the asyncSingleProc proc if you want |
21:59:51 | ephja | "is it possible with macro to access other modules" not the ASTs, but a macro can depend on symbols defined in other modules, just like any other construct can |
22:00:11 | ephja | just in case you were confused when they simply answered "no" |
22:02:13 | ephja | there's no way to get the set of all enumerators, regardless of whether or not there are holes, right? |
22:02:19 | * | Varriount joined #nim |
22:02:34 | ephja | getType to the rescue yet again? Sweet getType |
22:03:21 | * | sarlalian quit (Ping timeout: 246 seconds) |
22:03:46 | * | Varriount_ quit (Ping timeout: 252 seconds) |
22:04:47 | * | sarlalian joined #nim |
22:07:41 | * | Varriount_ joined #nim |
22:07:41 | * | Varriount quit (Disconnected by services) |
22:08:09 | * | jonafato quit (Ping timeout: 276 seconds) |
22:09:32 | * | jonafato joined #nim |
22:12:22 | * | Varriount_ quit (Ping timeout: 250 seconds) |
22:14:10 | * | Varriount joined #nim |
22:14:49 | * | ephja quit (Quit: WeeChat 1.4) |
22:24:36 | * | endragor joined #nim |
22:26:28 | * | novavis quit (Ping timeout: 250 seconds) |
22:28:34 | * | endragor_ quit (Ping timeout: 260 seconds) |
22:28:55 | * | endragor quit (Ping timeout: 244 seconds) |
22:42:28 | * | ephja joined #nim |
22:44:35 | * | Demon_Fox joined #nim |
23:00:16 | * | pregressive quit (Remote host closed the connection) |
23:00:49 | * | pregressive joined #nim |
23:05:24 | * | pregressive quit (Ping timeout: 268 seconds) |
23:07:57 | federico3 | "foo.nim" =~ peg(".*?nim") why is this not matching? |
23:10:08 | Demon_Fox | It looks like your using regex |
23:10:30 | Demon_Fox | In which case, try this: "^.*num$" |
23:11:17 | federico3 | I'm using pegs not regexes |
23:17:13 | Demon_Fox | ok |
23:17:26 | Demon_Fox | regex is similar and might be worth a go |
23:17:43 | Demon_Fox | I haven't regretted learning it |
23:18:28 | federico3 | the re module? it's deprecated |
23:19:32 | Demon_Fox | Why is that? |
23:19:50 | Demon_Fox | I'm looking up peg, maybe it's a superset of regex |
23:19:54 | federico3 | no idea |
23:20:03 | * | yglukhov quit () |
23:26:55 | federico3 | it doesn't seem to support non-greedy matching :( |
23:31:33 | * | allan0 quit (Ping timeout: 240 seconds) |
23:39:00 | ephja | federico3: https://github.com/flaviut/nre.git |
23:39:06 | * | allan0 joined #nim |
23:57:47 | * | arnetheduck quit (Ping timeout: 244 seconds) |
23:58:18 | * | ephja quit (Ping timeout: 244 seconds) |