00:00:54 | BlaXpirit | no idea how nim "supports" 64 bit integers in JS |
00:01:35 | flaviu | BlaXpirit: A bignum-style implementation should be possible. |
00:01:41 | BlaXpirit | of course |
00:01:45 | BlaXpirit | but currently |
00:02:00 | flaviu | I'd guess it currently just looses precision. |
00:02:02 | def- | The JS backend is pretty buggy from what I can tell |
00:02:07 | def- | would be nice if someone worked on it |
00:03:18 | BlaXpirit | jsgen is one of the few compiler parts that is not just rocket science to me |
00:13:53 | * | zama quit (Ping timeout: 264 seconds) |
00:14:24 | * | zama joined #nim |
00:20:05 | * | irrequietus quit () |
00:26:34 | * | vendethiel joined #nim |
00:26:49 | * | flaviu quit (Remote host closed the connection) |
00:27:13 | * | flaviu joined #nim |
00:31:58 | reactormonk | BlaXpirit, https://github.com/Araq/Nim/labels/JS |
00:35:42 | * | mnemonikk quit (Ping timeout: 276 seconds) |
00:36:29 | * | mnemonikk joined #nim |
00:45:30 | * | pipeep quit (Excess Flood) |
00:45:49 | * | pipeep joined #nim |
00:47:28 | * | vendethiel quit (Ping timeout: 245 seconds) |
00:54:37 | dom96 | is there a bug on github for arrays of objects not working as a const? |
00:56:05 | Joe-T | https://github.com/Araq/Nim/issues/1986 that rot of? |
00:56:07 | Joe-T | sort* |
00:59:00 | dom96 | not quite |
00:59:04 | dom96 | That actually works for me with tuples |
00:59:29 | dom96 | not that example |
00:59:35 | dom96 | but in the case of my data structure it works |
01:00:08 | dom96 | good night |
01:04:34 | * | vendethiel joined #nim |
01:05:13 | * | Demon_Fox joined #nim |
01:11:27 | * | BitPuffin joined #nim |
01:11:40 | * | pipeep quit (Changing host) |
01:11:40 | * | pipeep joined #nim |
01:12:16 | * | wb quit (Ping timeout: 240 seconds) |
01:13:53 | * | nande joined #nim |
01:20:39 | * | gokr left #nim (#nim) |
01:24:57 | * | BlaXpirit quit (Quit: Quit Konversation) |
01:25:17 | * | vendethiel quit (Ping timeout: 244 seconds) |
01:27:39 | * | endragor joined #nim |
01:29:44 | * | BitPuffin quit (Ping timeout: 252 seconds) |
01:30:45 | * | vendethiel joined #nim |
01:34:56 | * | no_name quit (Remote host closed the connection) |
01:34:56 | * | devzerp quit (Remote host closed the connection) |
01:40:41 | * | table joined #nim |
01:40:50 | * | Jervac quit (Quit: Offline) |
01:41:03 | * | devzerp joined #nim |
01:41:05 | * | no_name joined #nim |
01:41:23 | table | who can tell me when to release 0.10.4 |
01:41:32 | * | MyMind quit (Read error: Connection reset by peer) |
01:42:36 | * | MyMind joined #nim |
01:42:57 | table | Is there anyone else ? |
01:43:18 | * | no_name quit (Remote host closed the connection) |
01:43:18 | * | devzerp quit (Remote host closed the connection) |
01:44:02 | table | ok ,bye |
01:44:06 | * | table quit (Client Quit) |
01:53:03 | * | TEttinger quit (Ping timeout: 252 seconds) |
01:53:38 | * | vendethiel quit (Ping timeout: 272 seconds) |
02:24:04 | * | brson quit (Quit: leaving) |
02:38:40 | * | darkf joined #nim |
02:51:04 | * | endragor quit (Remote host closed the connection) |
02:54:11 | * | endragor joined #nim |
03:00:24 | * | Jehan_ quit (Quit: Leaving) |
03:02:21 | Joe-T | https://github.com/Araq/Nim/pull/2499 |
03:26:50 | * | endragor quit (Remote host closed the connection) |
03:51:47 | * | endragor joined #nim |
03:53:20 | * | endragor quit (Remote host closed the connection) |
04:03:40 | * | Kingsquee joined #nim |
04:08:33 | * | jacksnipe quit (Ping timeout: 244 seconds) |
04:09:48 | * | jacksnipe joined #nim |
04:10:26 | * | endragor joined #nim |
04:11:58 | * | Menche quit (Quit: Leaving) |
04:20:04 | * | brson joined #nim |
04:20:22 | * | endragor_ joined #nim |
04:24:05 | * | endragor quit (Ping timeout: 264 seconds) |
04:25:55 | * | endragor_ quit (Remote host closed the connection) |
04:36:46 | * | endragor joined #nim |
04:37:46 | * | endragor quit (Remote host closed the connection) |
04:46:09 | * | Menche joined #nim |
05:03:43 | * | jokra quit (Ping timeout: 252 seconds) |
05:11:50 | * | TEttinger joined #nim |
05:13:15 | * | a5i quit (Quit: Connection closed for inactivity) |
05:16:30 | * | endragor joined #nim |
05:19:36 | * | brson quit (Quit: leaving) |
05:23:15 | * | RayoGundead joined #nim |
05:28:45 | * | endragor quit (Remote host closed the connection) |
05:30:43 | * | jokra joined #nim |
05:39:15 | * | endragor joined #nim |
05:41:08 | * | endragor quit (Remote host closed the connection) |
05:43:14 | * | Demon_Fox quit (Ping timeout: 256 seconds) |
05:45:30 | * | endragor joined #nim |
05:45:30 | * | endragor quit (Read error: Connection reset by peer) |
05:46:00 | * | endragor joined #nim |
05:49:47 | * | johnsoft quit (Ping timeout: 265 seconds) |
05:56:38 | * | HakanD_ joined #nim |
06:22:20 | * | MyMind quit (Read error: Connection reset by peer) |
06:23:08 | * | Pisuke joined #nim |
06:24:45 | * | BlaXpirit joined #nim |
06:27:22 | * | HakanD joined #nim |
06:27:55 | * | johnsoft joined #nim |
06:30:29 | * | HakanD_ quit (Ping timeout: 246 seconds) |
06:34:36 | * | nande quit (Remote host closed the connection) |
06:41:15 | * | Demon_Fox joined #nim |
06:46:42 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
06:58:54 | * | gsingh93 quit (Ping timeout: 272 seconds) |
07:04:23 | * | Ven joined #nim |
07:10:05 | * | fowl quit (Quit: Leaving) |
07:14:12 | * | fowl joined #nim |
07:23:01 | * | endragor_ joined #nim |
07:25:56 | * | endragor quit (Ping timeout: 240 seconds) |
07:31:36 | * | irrequietus joined #nim |
07:39:33 | * | endragor_ quit (Remote host closed the connection) |
07:40:03 | * | endragor joined #nim |
07:51:39 | * | bjz joined #nim |
07:59:02 | * | Menche quit (Quit: Leaving) |
08:00:23 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
08:04:04 | * | pipeep quit (Ping timeout: 250 seconds) |
08:12:42 | * | pipeep joined #nim |
08:18:40 | * | coffeepot joined #nim |
08:19:11 | * | Trustable joined #nim |
08:20:50 | * | jasondotstar quit (Quit: Leaving) |
08:21:49 | reactormonk | Araq, am I too strict on requesting tests, already too many? |
08:22:04 | Araq | nah I think it's fine |
08:23:32 | reactormonk | Araq, 0-element arrays may be useful in certain instances |
08:47:29 | LoneTech | I've seen those used as placeholders for unknown sizes (at the end of structures) and to force alignment |
08:48:02 | LoneTech | the former relies on the absence of bounds checking, though |
08:49:24 | * | banister joined #nim |
08:52:53 | * | johnsoft quit (Ping timeout: 264 seconds) |
08:53:08 | * | johnsoft joined #nim |
08:55:02 | * | Demon_Fox quit (Quit: Leaving) |
08:56:23 | * | endragor_ joined #nim |
08:57:49 | * | endragor_ quit (Remote host closed the connection) |
08:57:53 | * | milosn quit (Ping timeout: 245 seconds) |
08:59:40 | * | endragor quit (Ping timeout: 255 seconds) |
09:01:52 | * | endragor joined #nim |
09:12:39 | Araq | LoneTech: C doesn't support 0 length array afaik, but you can use int foo[] as the last struct element |
09:15:12 | dtscode | LoneTech, Araq |
09:15:12 | dtscode | <dtscode> ,cc int foo[] = {}; |
09:15:13 | dtscode | <candide> dtscode: warning: ISO C forbids empty initializer braces [-Wpedantic] error: zero or negative size array 'foo' |
09:15:38 | dtscode | candide is the ##c c eval bot fwiw |
09:16:05 | Araq | dtscode: *as the last struct element* |
09:16:20 | Araq | or rather *struct field* |
09:16:37 | dtscode | no you misundertood |
09:16:52 | dtscode | i was just confirming "<Araq> LoneTech: C doesn't support 0 length array afaik" |
09:17:01 | dtscode | not debasing the struct thing |
09:17:05 | Araq | ah ok, thanks |
09:31:39 | * | Trustable quit (Remote host closed the connection) |
09:32:29 | * | Trustable joined #nim |
09:39:04 | * | Tennis joined #nim |
09:41:46 | * | RayoGundead quit (Ping timeout: 246 seconds) |
09:52:48 | * | pafmaf joined #nim |
09:55:29 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:00:53 | * | milosn joined #nim |
10:04:33 | * | endragor quit (Remote host closed the connection) |
10:05:02 | * | endragor joined #nim |
10:24:15 | * | milosn quit (Read error: Connection reset by peer) |
10:24:40 | * | milosn joined #nim |
10:28:19 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:34:13 | * | pafmaf quit (Quit: This computer has gone to sleep) |
10:37:01 | * | bjz joined #nim |
10:39:30 | * | Ven joined #nim |
10:41:17 | * | irrequietus quit () |
10:41:56 | BlaXpirit | Araq, flaviu, I reimplemented `re` based on `nre` |
10:42:55 | * | wb joined #nim |
10:44:18 | BlaXpirit | all `re` tests pass except for split -> ["", "this", "is", "an", "example", ""] there were no "" at ends |
10:46:23 | flaviu | Great! IMO my API is more pleasant to use, but bug fixes are always nice. |
10:47:09 | BlaXpirit | this is all the bug fixes you could want |
10:47:21 | flaviu | If you're looking for additional fun, you can reimplement split(string, string) to properly handle len-0 needles. |
10:47:25 | BlaXpirit | what i'm trying to do here |
10:47:27 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
10:47:44 | BlaXpirit | is put nre and this in standard library |
10:47:52 | BlaXpirit | instead of re |
10:52:33 | BlaXpirit | fixes yesterday's pull request |
10:53:03 | BlaXpirit | flaviu, are you ready to try for this? |
10:53:18 | * | milosn quit (Ping timeout: 245 seconds) |
10:53:26 | BlaXpirit | Arаq isn't gonna like Option though |
10:53:40 | BlaXpirit | i don't like it, really |
10:54:07 | * | bjz joined #nim |
10:54:18 | def- | compile times also grow a lot when you build your own PCRE |
10:54:36 | BlaXpirit | flaviu, and I keep getting that problem with compilation |
10:54:47 | BlaXpirit | i think i know what it is |
10:55:00 | * | a5i joined #nim |
10:55:09 | BlaXpirit | when you use nre in your program and it fails to fully compile because of error in code |
10:55:21 | BlaXpirit | when you fix your program, then pcre fails to compile |
10:56:27 | flaviu | Definitely a compiler bug though, it happens to everything that brings in external C source files. |
10:56:54 | BlaXpirit | what is parallelReplace in re? |
10:57:06 | flaviu | def-: And executable sizes get bloated. I still need to test the effects of dead code elim though. |
10:57:57 | flaviu | BlaXpirit: for pattern, replacement in args: # do replace |
10:58:08 | BlaXpirit | why is it "parallel" i dont get it |
10:58:51 | flaviu | "parallel" doesn't refer to threads. |
10:59:01 | * | bjz quit (Ping timeout: 256 seconds) |
10:59:14 | BlaXpirit | oh the only difference is you replace with `by[i]` not `by` |
11:00:13 | flaviu | It's like `while stringHasCharacters: for pattern in patterns: if matchAnchored(..., pattern): # replace and break; inc idx |
11:00:39 | BlaXpirit | wut |
11:00:44 | flaviu | Semantics are more confusing, but it provides efficiency gains from avoiding string copies. |
11:00:49 | flaviu | https://github.com/Araq/Nim/blob/master/lib/impure/re.nim#L330-L348 |
11:00:59 | BlaXpirit | well of course i see the code |
11:01:45 | BlaXpirit | maybe it was meant to be threaded? |
11:02:01 | flaviu | No, the word parallel here has nothing to do with threads. |
11:02:35 | BlaXpirit | there is nothing parallel here at all |
11:02:41 | flaviu | "Interleave matching of patterns" instead of "chain matching of patterns" |
11:03:48 | flaviu | re. option, there isn't really a better solution here. |
11:04:27 | flaviu | Exceptions will be excessively slow, and ref is basically the same thing but will abuse the GC even more. |
11:04:33 | * | milosn joined #nim |
11:05:25 | * | pafmaf joined #nim |
11:05:38 | flaviu | I don't like the idea of optional_t getting into the stdlib though. |
11:06:29 | * | untitaker quit (Ping timeout: 245 seconds) |
11:07:56 | * | jefus__ joined #nim |
11:12:02 | * | jefus_ quit (Ping timeout: 276 seconds) |
11:13:49 | * | irrequietus joined #nim |
11:13:50 | * | untitaker joined #nim |
11:21:00 | * | davidhq joined #nim |
11:25:13 | * | milosn quit (Ping timeout: 265 seconds) |
11:26:52 | * | bjz joined #nim |
11:33:30 | * | milosn joined #nim |
11:58:41 | * | pafmaf quit (Quit: This computer has gone to sleep) |
12:04:40 | * | HakanD_ joined #nim |
12:04:40 | * | HakanD quit (Read error: Connection reset by peer) |
12:05:42 | * | irrequietus quit () |
12:12:17 | * | BlaXpirit quit (Read error: Connection reset by peer) |
12:13:08 | * | milosn quit (Ping timeout: 276 seconds) |
12:13:13 | * | BlaXpirit joined #nim |
12:18:32 | * | egrep joined #nim |
12:21:32 | * | banister joined #nim |
12:30:49 | Araq | BlaXpirit: parallelReplace is just another example that shows that I know much more about API design than you give me credit for :P |
12:31:10 | BlaXpirit | huh |
12:31:21 | BlaXpirit | Araq, what do you think about this? |
12:31:45 | Araq | say you want to replace 'foo' by 'bar' and 'bar' by 'foo'. How do you do that with the standard replace? |
12:32:06 | BlaXpirit | replace bar by foo, then replace foo by bar |
12:32:16 | Araq | "abc foo bar".replace("foo", "bar").replace("bar", "foo") |
12:32:24 | novist | where exactly can i get latest nimsuggest? one on github (https://github.com/nim-lang/nimsuggest) seems to be not updated for quite some time and compiling fails |
12:32:42 | pigmej | novist: in nim github repo |
12:32:47 | pigmej | in compiler dir |
12:32:48 | pigmej | :) |
12:32:55 | novist | err how do i build it then? |
12:33:04 | HakanD_ | this question came up more than a few times in the last few days (: |
12:33:07 | Araq | BlaXpirit: try it and see for yourself |
12:33:11 | * | Kingsquee quit (Quit: Konversation terminated!) |
12:33:21 | pigmej | novist: nim c ... :) |
12:33:39 | novist | its so hidden away.. k lets try |
12:33:41 | * | milosn joined #nim |
12:33:46 | BlaXpirit | oh right, Araq |
12:33:50 | BlaXpirit | that's fine |
12:34:04 | BlaXpirit | i don't have anything against it, just couldn't understand it for the life of me |
12:34:22 | Araq | well it needs to replace stuff "in parallel" for this to work |
12:34:31 | BlaXpirit | i get it now |
12:34:40 | Araq | if you find a better name I will deprecate the old one asap |
12:34:43 | BlaXpirit | i said earlier that i reimplemented `re` based on `nre` |
12:34:52 | Araq | I've read it |
12:34:58 | BlaXpirit | so, what do you think? |
12:35:23 | Araq | if nre includes PCRE as a C code that an immediate "no way dude" ;-) |
12:35:36 | Araq | linux packagers *hate* this |
12:36:00 | BlaXpirit | that's not something to be concerned about |
12:36:06 | Araq | no? |
12:36:36 | BlaXpirit | i'm sure flaviu would agree to use pcre in the same way that `re` uses it |
12:37:07 | BlaXpirit | it is even supported, just not the default |
12:38:02 | Araq | no we shouldn't have the C code in the repo at all, it frightens packagers |
12:38:34 | BlaXpirit | easy change |
12:40:24 | * | BitPuffin joined #nim |
12:43:38 | novist | nimsuggest.nim(13, 7) Error: cannot open 'options' |
12:43:39 | novist | nim c compiler/nimsuggest/nimsuggest.nim |
12:43:43 | novist | that must be not right |
12:44:37 | * | Jehan_ joined #nim |
12:45:11 | pigmej | novist: cd compiler/nimsuggest |
12:45:31 | novist | same |
12:49:32 | BlaXpirit | https://github.com/BlaXpirit/nim-re-compat/blob/master/re.nim |
12:49:54 | Jehan_ | Also a problem with including the C source is license pollution. |
12:50:46 | Araq | novist: it works if you use nim like it's supposed to be used. where nim is in 'bin' and relative to that there is a '../compiler' dir |
12:51:50 | novist | that worked, thanks |
12:51:55 | novist | hidden knowledge heh |
12:55:24 | * | milosn quit (Ping timeout: 252 seconds) |
13:08:48 | * | milosn joined #nim |
13:18:49 | * | Jehan_ quit (Ping timeout: 265 seconds) |
13:19:37 | * | HakanD__ joined #nim |
13:19:37 | * | HakanD_ quit (Read error: Connection reset by peer) |
13:23:27 | Joe-T | https://docs.python.org/3/library/stdtypes.html#str.translate |
13:24:11 | Joe-T | python can take a mapping, and replace all of those simultaneously |
13:31:55 | BlaXpirit | nope |
13:32:05 | BlaXpirit | can't do that example with this. it replaces single characters |
13:35:18 | Araq | BlaXpirit: maybe a better name is "multiReplace" though |
13:35:57 | BlaXpirit | yeah.. |
13:36:04 | BlaXpirit | funny thing is, it could be made parallel |
13:37:57 | * | Jehan_ joined #nim |
13:38:43 | BlaXpirit | just try a few regexes at a time |
13:43:16 | * | milosn quit (Ping timeout: 240 seconds) |
13:45:11 | * | endragor_ joined #nim |
13:45:42 | * | endragor_ quit (Remote host closed the connection) |
13:48:40 | * | endragor quit (Ping timeout: 272 seconds) |
13:51:17 | * | milosn joined #nim |
13:53:49 | * | jefus__ is now known as jefus |
14:01:11 | * | endragor joined #nim |
14:05:17 | * | endragor quit (Remote host closed the connection) |
14:05:36 | * | milosn quit (Ping timeout: 240 seconds) |
14:19:24 | * | milosn joined #nim |
14:29:40 | flaviu | Araq: I have C code for good reason, I cannot depend on the OS PCRE version to provide the features I want. Jehan_: PCRE is BSD licensed, so it's not too bad. |
14:31:45 | flaviu | re. packagers - It's possible to use the shared library. Still haven't gotten around to testing it with older PCREs like Debian and Ubuntu's, but it's possible. |
14:33:53 | Jehan_ | Lots of Debian packages are horribly outdated. |
14:36:36 | Jehan_ | I mean, some are 4-5 years old. |
14:40:08 | * | darkf quit (Quit: Leaving) |
14:40:51 | Araq | flaviu: we should simply fix re and add to the docs that nre is a good alternative it its docs and leave at that for the upcoming release |
14:41:29 | flaviu | Araq: That's fine with me. |
14:42:11 | Araq | and eventually we can move 're' out of the stdlib |
14:42:23 | Araq | bbl |
14:42:44 | * | endragor joined #nim |
14:44:24 | * | milosn quit (Ping timeout: 256 seconds) |
14:46:07 | * | endragor quit (Remote host closed the connection) |
14:53:32 | * | jefus_ joined #nim |
14:56:15 | * | Jehan_ quit (Ping timeout: 252 seconds) |
14:56:27 | * | jefus quit (Ping timeout: 256 seconds) |
14:58:50 | * | bcinman joined #nim |
14:58:54 | * | Jehan_ joined #nim |
14:59:49 | * | endragor joined #nim |
15:02:04 | * | jefus_ is now known as jefus |
15:02:16 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:02:38 | * | endragor quit (Remote host closed the connection) |
15:02:49 | * | endragor joined #nim |
15:03:20 | * | bcinman quit (Read error: Connection reset by peer) |
15:04:02 | * | bcinman joined #nim |
15:06:38 | * | endragor quit (Remote host closed the connection) |
15:10:01 | HakanD__ | is user defined type classes in a usable state? |
15:10:38 | def- | HakanD__: you can try it, but my tests didn't work yet |
15:11:30 | HakanD__ | can't get it to do what i want, but not sure if they are buggy, or i'm doing it wrong(TM) |
15:13:59 | HakanD__ | btw, I'm getting Warning: use 'concept' instead; 'generic' is deprecated [Deprecated], docs still shows it as 'generic' |
15:16:00 | def- | the docs are for the last release which is 0.10.2 and still has generic |
15:16:15 | def- | Would be nice to have online docs for devel branch though |
15:32:15 | * | jholland joined #nim |
15:35:09 | * | Sembei joined #nim |
15:37:15 | flaviu | Can verify that nre works fine dynamically linking with old PCRE libs. |
15:37:48 | * | endragor joined #nim |
15:40:26 | BlaXpirit | flaviu, so quit the douts and the stalling and embrace the opportunity |
15:40:27 | * | endragor quit (Remote host closed the connection) |
15:41:27 | flaviu | Doubts? |
15:42:51 | BlaXpirit | missed a B there, yes |
15:44:13 | flaviu | I wasn't remarking on your grammar, so sorry if it looked that way. I don't understand what you're talking about. |
15:44:49 | * | irrequietus joined #nim |
15:44:53 | BlaXpirit | we have an opportunity to fix `re`once and for all |
15:45:11 | flaviu | Yes, and you said that you have a PR ready for that? |
15:45:31 | flaviu | Keeping API compatibility, right? |
15:45:42 | BlaXpirit | i have a lib ready, but it's not a PR yet because other things need to be done first |
15:46:30 | BlaXpirit | it has taken many bug reports and pull requests to "simply fix re" and many are yet to come |
15:47:26 | BlaXpirit | this is the code i'm talking about. i've linked it earlier https://github.com/BlaXpirit/nim-re-compat/blob/master/re.nim |
15:48:42 | * | Arrrr joined #nim |
15:48:55 | Arrrr | Hello Nimrod |
15:49:42 | Arrrr | Is anyone doing gamedev with nim ? |
15:49:56 | flaviu | Arrrr: No longer Nimrod :) |
15:50:31 | * | Sembei quit (Max SendQ exceeded) |
15:51:09 | coffeepot | i'm doing gamedev |
15:51:24 | Arrrr | Do you have it on github? |
15:51:35 | coffeepot | nope, not even at that stage yet haha :) |
15:51:50 | Arrrr | Well, what are you doing anyway? |
15:51:55 | coffeepot | using opengl with the wrapper from nimble, and basic3d |
15:52:17 | coffeepot | 3d game using voxels |
15:52:18 | * | HakanD__ quit (Read error: Connection reset by peer) |
15:52:54 | Arrrr | Ah, and how it is going on? |
15:53:06 | flaviu | BlaXpirit: Oh, I see. Your lib is a wrapper around nre. |
15:53:11 | coffeepot | pretty cool actually, i really enjoy coding in nim |
15:53:25 | coffeepot | nice performance even when not in release |
15:53:59 | coffeepot | what are you planning gamedev-wise? |
15:54:20 | Arrrr | Nothing for now, just curious about the state of this programming language |
15:55:18 | coffeepot | in my experience, it's pretty good. Put it this way, I started in python and gave up due to performance. Prefer nim to python now :3 |
15:55:35 | Arrrr | I can see that happening. |
15:55:50 | Arrrr | How much time have you spent with nim? |
15:56:14 | coffeepot | um, hard to quantify, found out about the language a few months back and have been doing bits and bobs in it since |
15:56:36 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:56:37 | coffeepot | if I can sort out a native sql wrapper i'll start using it at work - it's just a really nice language to work in |
15:57:13 | * | milosn joined #nim |
15:57:13 | Arrrr | btw what's the difference between nimble or nible and babel |
15:57:46 | coffeepot | when nim was renamed from nimrod, babel was renamed to nimble. Other than that nothing AFAIK? |
15:58:19 | Arrrr | I see, i thought it. Thanks |
15:58:30 | coffeepot | dom96 wrote nimble so he can tell you better :) |
15:58:49 | Arrrr | Do you know about Ultima Ratio Regnum? it is written in python |
15:59:10 | Arrrr | *being |
15:59:58 | coffeepot | I hadn't heard of it but it looks cool :) |
16:00:42 | coffeepot | i am being rather ambitious with my game and it'll have a lot of physics in 3d with thousands of particles flying about so I have to have the performance off the bat |
16:01:35 | coffeepot | i love mud style games tho, might give this a proper look later :) |
16:01:51 | Arrrr | Does it take you more or less code lines? |
16:01:56 | Arrrr | in comparation to Python |
16:02:04 | coffeepot | hmm, i'd say around the same |
16:02:14 | coffeepot | i prefer the nim syntax though |
16:02:15 | Arrrr | Do you miss something from Python? |
16:02:24 | coffeepot | not yet! |
16:02:27 | pigmej | repl ;P |
16:02:47 | coffeepot | isn't someone doing a repl library? |
16:02:51 | Arrrr | Does nim use duck typing? |
16:02:55 | pigmej | yeah it 'wroks' :) |
16:03:32 | * | BitPuffin quit (Remote host closed the connection) |
16:03:50 | flaviu | Arrrr: Sure. Generics are typechecked after expansion. |
16:04:02 | * | BitPuffin joined #nim |
16:04:39 | Arrrr | I dont understand that, could you expand it? |
16:04:45 | flaviu | .eval proc add[T](a, b: T): T = a + b; echo add(1, 2), ' ', add(1.0, 2.0) |
16:04:46 | Mimbus | flaviu: 3 3.0 |
16:05:22 | Arrrr | lol, is that a bot? |
16:05:34 | pigmej | .eval echo "nope" |
16:05:35 | Mimbus | pigmej: nope |
16:05:48 | flaviu | yep, thanks to dtscode for writing it |
16:06:04 | Arrrr | And how efficient it is? |
16:06:20 | pigmej | it needs to compile your expression |
16:06:26 | pigmej | so it takes a while ;) |
16:06:38 | flaviu | The generics? 0-overhead, they are specialized at compile time. |
16:06:57 | coffeepot | performance is close enough to C |
16:07:13 | flaviu | ie, add[T](a, b: T): int gets turned into something like addInt(a, b: int): int |
16:07:15 | pigmej | the major difference is => python has dynamic types (let's say), nim has static |
16:07:32 | Arrrr | I understand. I want to learn this |
16:07:39 | coffeepot | also nim has dead code elimination (is that on by default btw?) and really nice compile time expression |
16:08:09 | Arrrr | But those 400+ issues give me the creeps |
16:08:34 | pigmej | Arrrr: http://bugs.python.org/ |
16:08:48 | pigmej | (4799) btw |
16:08:51 | coffeepot | honestly for general use I haven't noticed any bugs |
16:08:58 | coffeepot | i haven't got into macros yet tho |
16:09:00 | * | endragor joined #nim |
16:09:26 | Arrrr | I use mostly Java. Btw, are pragmas like java's annotations? |
16:09:27 | flaviu | python might also have lots of bugs, but they're obscure bugs. |
16:09:39 | flaviu | Arrrr: Yep |
16:10:30 | Arrrr | Fantastic. |
16:10:40 | Arrrr | Are you a contributor by a chance flaviu ? |
16:11:13 | flaviu | Small contributor, I've mostly focused on my own libraries rather than the compiler. |
16:11:23 | coffeepot | warning, when you get used to unified call syntax its hard to go back ;) |
16:11:36 | coffeepot | *unified function call syntax |
16:11:57 | coffeepot | maybe it's just me but UFCS is just awesome :) |
16:12:01 | Arrrr | And what is that? |
16:12:06 | pigmej | coffeepot: +1 |
16:12:23 | flaviu | Arrrr: foo.bar() == bar(foo) |
16:12:36 | flaviu | .eval 1.echo |
16:12:38 | Mimbus | flaviu: 1 |
16:12:46 | coffeepot | it means you can extend any class or type with no effort |
16:12:46 | Arrrr | Ah, i remember you could choose whatever style you liked |
16:13:23 | pigmej | coffeepot: except you still need to write a function :P |
16:13:51 | ldlework | Has anyone come up with a demo of deploying Nim to the web? |
16:14:03 | pigmej | Arrrr: generally ufcs allows you to extend / change class / type behaviour without changing the class itself |
16:14:04 | Arrrr | And i remember vars in nim were case and underscore insensitive, like myBigVar == My_Big_Var |
16:14:05 | coffeepot | yeah it makes it much more readable IMHO. Sometimes it's nice to be able to go, say, float(a.b.c), sometimes you want a.b.c.float it's just nice :) |
16:14:23 | pigmej | in python / java you would need to inherit the class, patch it or something |
16:14:32 | coffeepot | arrr: yeah, nice with numbers: var a = 1_000_000 |
16:14:33 | pigmej | in nim you just write a function where first arg is your 'object' |
16:14:41 | flaviu | Arrrr: Not quite. Now the first letter is case sensitive. |
16:14:51 | * | johnsoft quit (Ping timeout: 250 seconds) |
16:14:54 | flaviu | People really like let foo: Foo apparently. |
16:14:57 | pigmej | Arrrr: first is case sensitive the rest is 'whatever you wish' |
16:15:05 | Arrrr | I se |
16:15:38 | pigmej | which is also cool, because your code == your style :) |
16:15:46 | Arrrr | with change classes you mean you can write an existing function and force the program to use it ? |
16:15:56 | Arrrr | *rewrite |
16:15:58 | pigmej | Arrrr: not quite |
16:16:18 | pigmej | function has arguments, right? |
16:16:29 | pigmej | so nim calls correct function based on name AND types |
16:16:40 | pigmej | so, if you have a matching function it calls it |
16:16:40 | pigmej | the end |
16:16:41 | pigmej | . |
16:17:24 | pigmej | and because there is nothing special like 'object functions' (yeah yeah I know...) you just write a function that you need and it works |
16:17:31 | ldlework | Guess not. |
16:18:21 | Arrrr | And if im not mistaken, objects are not a thing here. Im not used to programming without objects. |
16:18:32 | coffeepot | also distinct is another awesome feature. You can have two int types for example, and set them distinct so they are not 'compatible'. Hard to explain but for example useful for money types where you dont want to be able to go dollars=euros |
16:18:34 | pigmej | Arrrr: there are object |
16:18:36 | pigmej | objects* |
16:18:43 | flaviu | Arrrr: What do you mean by objects? |
16:19:01 | coffeepot | you can do full OOP in nim |
16:19:42 | Arrrr | Yes, i wanted to say OOP |
16:19:43 | pigmej | Arrrr: just write a function where first arg type is your object type. |
16:19:57 | pigmej | then you can do object.my_function |
16:20:19 | Arrrr | So, can i declare a type of var that consists in a group of vars? |
16:20:41 | Arrrr | Like a class |
16:20:57 | flaviu | Arrrr: You do have inheritance and virtual methods. |
16:21:11 | pigmej | Arrrr: yeah you can have object of any other objects / types |
16:21:32 | pigmej | http://nim-lang.org/tut2.html#object-oriented-programming |
16:21:48 | Arrrr | Last time i checked there were public and private methods with '*' symbol. Does this still exists? |
16:21:48 | coffeepot | home time for me, have fun guys :) |
16:21:55 | pigmej | coffeepot: cu! |
16:21:56 | Arrrr | thanks pigmej |
16:22:04 | Arrrr | see you coffe |
16:22:10 | pigmej | * are available outside |
16:22:18 | pigmej | without * are available only in this file |
16:22:56 | pigmej | so it's kind of public / private but not exactly |
16:23:07 | Arrrr | Do people program with many * functions? |
16:23:30 | pigmej | Arrrr: probably 'depends' |
16:23:48 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
16:24:41 | Arrrr | Doesn't exist packages or namespaces like in c# ? |
16:25:13 | pigmej | more like in python |
16:25:37 | pigmej | file == module and you can import from it |
16:25:55 | pigmej | (or include if you with) |
16:25:58 | pigmej | wish* |
16:26:18 | flaviu | Please don't use include though. It's confusing. |
16:26:55 | pigmej | flaviu: it works like C equivalent ? |
16:27:06 | pigmej | it inserts contents of file to another file, isn't it? |
16:27:10 | flaviu | Yes. |
16:27:27 | Arrrr | Oh, and is there a way to enforce immutability? |
16:27:28 | flaviu | But it gets confusing when you read a file and can't figure out where things are defined. |
16:27:58 | pigmej | Arrrr: what do you mean by immutability ? |
16:28:04 | pigmej | something like final in Jav? |
16:28:22 | Arrrr | Initialize a variable with certain value and dont allow its value to change |
16:28:27 | Arrrr | yes |
16:28:28 | flaviu | Sure, let. |
16:28:45 | Arrrr | Does it work when defining a type? |
16:29:14 | pigmej | Arrrr: for this you can use setter with "private" field |
16:29:23 | flaviu | Like a final field? No. |
16:29:26 | pigmej | afaik there is no 'final' for object field |
16:29:47 | Arrrr | Why not? |
16:29:54 | pigmej | Arrrr: why should it be? |
16:30:39 | pigmej | you can make something like as I said, with "private" field and "public" setter |
16:30:48 | Arrrr | Well, it is usefull. If you dont want to make every field private and write an access |
16:30:55 | flaviu | I don't know for sure, but it might be because it's impossible to enforce. |
16:31:13 | pigmej | Arrrr: it's C level |
16:31:15 | * | Tennis quit (Quit: Leaving) |
16:31:18 | pigmej | so you have memory access |
16:31:35 | Arrrr | And also, it is easier to catch certain errors. If you are working inside the same file where the type is declared, you could ignore that |
16:31:38 | pigmej | also ptrs so... ;-) |
16:32:10 | pigmej | Arrrr: emulate it then with setters |
16:32:15 | pigmej | if you really need them |
16:32:23 | flaviu | I wonder if a macro would work here. |
16:32:46 | Arrrr | Yeah, well i suppose nim will give me a lot of alternatives. Just wanted to know if there were a reason to allow final vars and not final fields |
16:33:08 | Arrrr | *was |
16:33:37 | pigmej | well, because final variable has to be initialized on start |
16:33:49 | pigmej | you cannot define final variable and use it later |
16:34:24 | pigmej | which obviously is no go for OOP |
16:35:00 | pigmej | flaviu: what macro? inlined setters are already compact and no overhead, isn't it? |
16:35:14 | Arrrr | How are objects constructed? Do constructors exists, or how does it work? |
16:35:36 | pigmej | Arrrr: http://nim-lang.org/tut2.html#object-oriented-programming |
16:35:36 | pigmej | ;d |
16:36:04 | Arrrr | heh, i read a bit but |
16:36:06 | pigmej | in this section: http://nim-lang.org/tut2.html#objects |
16:36:21 | pigmej | " They provide inheritance and information hiding. Because objects encapsulate data, the T() object constructor should only be used internally and the programmer should provide a proc to initialize the object (this is called a constructor |
16:36:21 | pigmej | " |
16:36:21 | Arrrr | Only saw this: "Student(name: "Anton", age: 5, id: 2)" |
16:36:49 | Arrrr | So, what i wrote is actually a defined proc? |
16:36:59 | Arrrr | or it just exists by default inside the file? |
16:37:53 | pigmej | not at all, you just used object contructor, but you should provide newObject proc to initialize your object in hmm, friendly way |
16:38:04 | flaviu | pigmej: A macro to generate the boilerplate. |
16:38:17 | pigmej | flaviu: ah :) |
16:38:33 | ldlework | flaviu: did anything ever come of nimlets? |
16:38:35 | pigmej | I wondered if I miss something or so... |
16:39:22 | flaviu | ldlework: It exists, and it works. I never came up with any snippets though. |
16:42:55 | * | Jehan_ quit (Quit: Leaving) |
16:46:29 | Arrrr | Well, i'll have a look at the tutorial, a shame there are no color syntax defined for nim in notepad++. Thank you flaviu and pigmej for your answers. |
16:47:01 | pigmej | Arrrr: you can play with nim with aporia editor |
16:47:10 | pigmej | it understands nim |
16:47:19 | pigmej | may be useful ;-) |
16:47:20 | ldlework | flaviu: have you used asyncdispatch at all? |
16:47:41 | flaviu | Arrrr: A few more links: https://nim-by-example.github.io/ https://howistart.org/posts/nim/1 http://goran.krampe.se/ |
16:47:44 | flaviu | ldlework: Nope. |
16:47:45 | Arrrr | Heh, i opened it, pressed to compile, it told me to select a compiler, i pressed to cancel and suddenly the ide crashed. |
16:47:59 | flaviu | ldlework: nimlets is a static page generator. |
16:48:04 | Arrrr | I'll use plain notepad++. Thank you for those links flaviu |
16:48:20 | ldlework | flaviu: it was a new unrelated question |
16:48:46 | ldlework | flaviu: I'm wondering if Nim might grow any 'structured concurrency' in its asyncdispatch lib |
16:48:58 | ldlework | something like await { } or { } |
16:49:25 | ldlework | and, await { } and { } |
16:49:37 | pigmej | ldlework: 'unstable' afair |
16:49:52 | ldlework | which treats the entire await block as blocking, only passing it with either block returns, or both, depending on what form you use |
16:49:54 | pigmej | dom96 is working on improvements also |
16:50:54 | flaviu | ldlework: I'm the wrong person to ask, I haven't been keeping up with that stuff. |
16:51:18 | dom96 | ldlework: not entirely sure what you want to achieve with that syntax |
16:56:33 | ldlework | dom96: I'm trying to write an example but holy crap I've forgotten how to write any Nim at all |
16:56:35 | ldlework | lol |
16:59:55 | ldlework | dom96: https://gist.github.com/dustinlacewell/98b49e21576ce4792042 |
17:01:17 | ldlework | It will make both calls in parallel. The first block to finish, causes the other block to be canceled, and the whole await block is passed, reaching the final return |
17:01:40 | ldlework | You can imagine a looping version of this too |
17:01:48 | ldlework | That establishes multiple concurrent contexts |
17:02:36 | dom96 | you can already do that |
17:02:43 | dom96 | But you need to put the blocks in separate async procs |
17:02:54 | ldlework | dom96: can you modify the example |
17:03:03 | pigmej | dom96: but parallel have something similar by default, isn't it? |
17:03:17 | pigmej | waitAny or sth |
17:04:46 | dom96 | https://gist.github.com/dom96/88e06687979c0883c9de |
17:04:57 | dom96 | pigmej: I think so |
17:05:01 | dom96 | I haven't used it yet |
17:05:42 | * | Menche joined #nim |
17:06:04 | pigmej | dom96: I think it would be cool to have something like awaitAny http://nim-lang.org/threadpool.html#awaitAny,openArray[FlowVarBase] |
17:07:03 | dom96 | you could probably implement that easily with async's await. |
17:07:12 | pigmej | sure :) |
17:07:22 | pigmej | just saying about having something like that by default |
17:07:48 | pigmej | dom96: anyway, do you still consider async things as beta ? |
17:07:51 | dom96 | PRs welcome |
17:08:11 | dom96 | yes, but you should use it, if it interests you. |
17:08:21 | dom96 | the forum somehow manages to run on it |
17:09:14 | pigmej | cool |
17:09:16 | * | endragor quit (Remote host closed the connection) |
17:12:21 | pigmej | dom96: forum runs on jester + async? |
17:12:39 | dom96 | yep |
17:14:25 | pigmej | cool |
17:14:32 | pigmej | anyway, cu |
17:15:15 | ldlework | dom96: that's kind of gross tho :) |
17:16:52 | * | Matthias247 joined #nim |
17:18:02 | ldlework | Shouldn't the compiler be able to detect calls to async functions and treat them specially without 'await' ? |
17:18:35 | ldlework | "What color is your function? Red or Blue?" |
17:18:44 | ldlework | dom96: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ |
17:19:07 | ldlework | Really nice article that made me very interested in E/Erlang/Monte |
17:19:13 | EXetoC | it's all in userland |
17:20:48 | ldlework | EXetoC: right, I get that |
17:21:00 | ldlework | But it still makes Nim a language with polychromatic functions. |
17:21:57 | ldlework | I recommend that article, its really good! |
17:22:50 | ldlework | this is also good, https://vimeo.com/103492194 |
17:26:55 | ldlework | this is extra credit, I guess, http://joearms.github.io/2013/04/02/Red-and-Green-Callbacks.html |
17:27:14 | EXetoC | "Async functions don’t compose in expressions because of the callbacks, have different error-handling, and can’t be used with try/catch or inside a lot of other control flow statements." did we have a similar problem before? or maybe it was something else but I think it was just temporary |
17:29:21 | ldlework | Well await takes care of that problem he's mentioning there. |
17:29:37 | ldlework | since now you can call red functions from a blue function. |
17:33:12 | Arrrr | 'The third and last way to write string literals are long string literals. They are written with three quotes: """ ... """' |
17:33:35 | Arrrr | Would be nice to have literals with l" ... " as rawstrings |
17:35:03 | flaviu | Arrrr: Already exists. r" ... " |
17:35:19 | Arrrr | Yea, but it is not the same (i think) |
17:35:21 | Arrrr | it is |
17:35:21 | ldlework | flaviu: I think he means for long string literals |
17:35:22 | Arrrr | ? |
17:35:58 | flaviu | .eval echo r"\n" |
17:36:01 | Mimbus | flaviu: \n |
17:36:57 | Arrrr | The tutorial says "string literals" are written with """ blablabal """ |
17:37:24 | Arrrr | Since rawstring uses r" ... ", why not l" ..." for literal strings |
17:37:29 | * | BitPuffin quit (Ping timeout: 276 seconds) |
17:37:39 | ldlework | Arrrr: the r is bad and annoying |
17:37:43 | flaviu | I don't understand what "literal strings" are supposed to be. |
17:37:49 | ldlework | why would you want to extend its annoyance to normal strings? |
17:38:00 | flaviu | A small gotcha, btw: |
17:38:01 | flaviu | .eval echo """\n""" |
17:38:02 | Mimbus | flaviu: \n |
17:38:09 | Arrrr | because is more annoying to write 6 " |
17:39:19 | flaviu | Arrrr: Use C, you'll learn to appreciate some verbosity :) |
17:39:49 | Arrrr | I have more than enough with java |
17:40:04 | ldlework | Arrrr: oh you mean, use the quote prefix instead of 3 quotes |
17:40:23 | Arrrr | 6 quotes actually |
17:40:37 | ldlework | I mean its not a terrible idea/observation |
17:40:37 | Arrrr | or well, 6 chars for that matter |
17:41:56 | flaviu | Arrrr: 3 if you have a decent editor. |
17:42:04 | def- | then your literal string can't contain "? |
17:42:31 | Arrrr | Most editors will auto close the first one. |
17:48:34 | Arrrr | "Note that declaring multiple variables with a single assignment which calls a procedure can have unexpected results: the compiler will unroll the assignments and end up calling the procedure several times." This is indeed dangerous |
17:48:51 | * | drewsrem joined #nim |
17:54:32 | drewsrem | Trying to write a compile-time "proc" that takes an int and returns a new char-array with size of that int filled with some arbitrary char (e.g. X) - this doesn't work as a simple proc: http://ix.io/hM8 - at the same time, AFAIS I can't return values from templates or macros - any basic pointers? |
17:57:46 | Joe-T | is there a reason opcWrArr ensures that regA is a rkNode? |
17:58:24 | Joe-T | https://github.com/Araq/Nim/issues/2473 |
17:58:58 | Joe-T | opcWrDeref is putting into the reg at 0, rkNodeAddr |
17:59:01 | ldlework | EXetoC: flaviu if you guys read that article I'd love to hear your opinons on it at some point |
17:59:37 | Joe-T | then a bit after that, opWrArr is called, where the register value has to be a rkNode |
17:59:54 | Joe-T | but it is actaully rkNodeAddr at that point in the test program in that issue |
17:59:59 | * | gsingh93 joined #nim |
18:00:28 | Joe-T | it works if I remove the ensure(tkNode) (by removing the decodeBC) |
18:00:39 | Araq | ldlework: I read it. want to hear my opinion? ;-) |
18:00:48 | Joe-T | and then using regs[ra].regToNode..., but dunno if that would break anythign else or if |
18:01:04 | Joe-T | the bug is actually nothing to do with that block, but with whatever generate the instructions in that order |
18:02:27 | ldlework | Araq: of course I do |
18:02:47 | Araq | Joe-T: opcWrArr only deals with nodes because an array is mapped to a node |
18:03:29 | Araq | ldlework: it's essentially completely correct |
18:03:36 | Joe-T | but what about nkNodeAddr, and nkRegisterAddr |
18:04:12 | Araq | Joe-T: these should have been transformed to a node via some deref instruction |
18:05:22 | Araq | ldlework: we doesn't go into the disadvantages of blurring the async/sync distinction but the commentors do |
18:05:24 | * | johnsoft joined #nim |
18:05:38 | Araq | so it's all good if you also read the comments ;-) |
18:06:28 | Joe-T | so the bug is opcLdDeref should be called at some point? |
18:06:49 | Araq | Joe-T: you can modify the vmgen or vm.nim modules and run tests/testament/tester cat vm and see if you introduced any regressions |
18:07:46 | Araq | Joe-T: yes I think so, but this code is very complex because Nim's datatypes are very complex |
18:07:48 | renesac|away | Araq: I'm doing the change to what is considered "arrow like" |
18:07:53 | * | renesac|away is now known as renesac |
18:07:59 | Araq | renesac: excellent |
18:08:03 | renesac | if L > 1 and tok.ident.s[L-1] == '>' and |
18:08:03 | renesac | ('-' in tok.ident.s or '=' in tok.ident.s): return considerStrongSpaces(1) |
18:08:19 | renesac | that way "-+>" would be arrow like |
18:08:25 | renesac | but "+>" not |
18:08:28 | * | Sembei joined #nim |
18:08:37 | Araq | but +-> would be too? |
18:08:40 | renesac | yes |
18:09:01 | renesac | i check if there is any = or - in the operator, as the code line above |
18:09:05 | Araq | test tok.ident.s[0] in {'-', '='} instead |
18:09:17 | Araq | we look at the first or last char in an operator |
18:09:28 | renesac | ok |
18:09:29 | Araq | but have no rule yet that says "and this and that *somewhere*" |
18:09:51 | renesac | there is no test about arrow like operators yet, right? |
18:11:51 | Arrrr | Why incrementing a var with '++' isn't supported? i get an "Error: invalid indentation" |
18:12:02 | Arrrr | Don't know if bug or made on purpouse |
18:12:08 | renesac | Arrrr: you can create a proc like this |
18:12:13 | renesac | but it isn't in stdlib (yet) |
18:12:29 | renesac | I created one in my bithacks library, but I haven't properly released it yet |
18:12:34 | renesac | use "inc x" |
18:12:38 | Arrrr | the tutorial says i can use inc(), but im curious to know the reason behind this |
18:12:39 | renesac | or "x.inc" |
18:13:06 | Arrrr | so, not being able to use ++ is not a bug. |
18:13:10 | renesac | Arrrr: the reason is because Nim don't derive it's syntax from C |
18:13:31 | * | xet7 joined #nim |
18:13:37 | renesac | again, you are free to define your own ++ operator |
18:14:24 | Arrrr | Ok, thanks. Actually using inc x is not that bad. |
18:14:45 | Arrrr | But well, is hard to get rid of the classic ++ |
18:14:45 | renesac | https://gist.github.com/ReneSac/37bce0429eb4fc5d1ac3 |
18:14:48 | renesac | there |
18:15:18 | Arrrr | Oh, that's nice. Thank you renesac. What does {.discadable.} means? |
18:15:20 | Arrrr | What is doing? |
18:15:36 | renesac | that you don't need to assign the return value of the proc to a variable |
18:15:52 | renesac | you can do simply "++x", not "foo = ++x" |
18:16:01 | Arrrr | Ah, so if you dont want to include a return, you need that |
18:16:05 | Arrrr | I recall this |
18:16:14 | renesac | no |
18:16:47 | renesac | this is, if the proc returns something, and you don't want that return value where you call it, you have to write "discard bar()" to ignore the return value of bar |
18:17:04 | renesac | the discardable pragma frees you from having to write that |
18:17:52 | Arrrr | So ... is like x = result of proc? |
18:17:55 | BlaXpirit | in C if you call a function that returns int, you can just ignore that int. Nim makes you do something about it (if there is no .discardable.) |
18:18:45 | Arrrr | I see. Is this made to enforce a good practice ? |
18:19:46 | renesac | yeah |
18:20:59 | renesac | http://nim-lang.org/tut1.html#discard-statement |
18:21:00 | * | Sembei quit (Ping timeout: 252 seconds) |
18:21:09 | renesac | I should have linked this from the start |
18:21:36 | renesac | by the way, I updated my gist |
18:21:37 | Arrrr | Anyway im following that tutorial, so i'll get there. Thanks for pointing this to me |
18:21:54 | renesac | it is now "SomeInteger", "TInteger" is deprecated |
18:21:57 | * | brson joined #nim |
18:22:18 | * | milosn quit (Ping timeout: 264 seconds) |
18:22:36 | Arrrr | SomeInteger? wtf |
18:23:40 | renesac | it is a concept that matches any type of integer |
18:23:53 | renesac | to make it a more generic function |
18:24:19 | renesac | you could use simply T, but then it is a bit too generic |
18:24:37 | renesac | or simply "int", and it would probably suffice most of the time |
18:25:00 | * | milosn joined #nim |
18:25:02 | Arrrr | Yeah, but is a funny name. It still gives me the wrong identation error |
18:25:15 | Arrrr | http://pastebin.com/ftf1Fp9w |
18:25:40 | Arrrr | 'statement.nim(5, 4) Error: invalid indentation' |
18:26:08 | BlaXpirit | Arrrr, maybe it's actually the first line |
18:26:11 | BlaXpirit | oh wait |
18:26:18 | BlaXpirit | no, it isnt |
18:26:38 | BlaXpirit | no postfix operators in nim |
18:26:50 | Arrrr | Can it be related to this? https://github.com/nim-lang/c2nim/issues/10 |
18:26:50 | * | xcombelle joined #nim |
18:27:04 | BlaXpirit | no |
18:27:11 | renesac | it is a prefix operator |
18:27:12 | flaviu | .eval import macros; dumpLisp(i++) |
18:27:13 | Mimbus | flaviu: eval.nim(4, 13) Error: expression expected, but found ')' |
18:27:18 | renesac | no postfix operators in nim |
18:27:31 | flaviu | see? If it was valid synatx, that would have given a AST. |
18:27:36 | flaviu | .eval import macros; dumpLisp(++i) |
18:27:38 | Mimbus | flaviu: Prefix(Ident(!"++"), Ident(!"i")) |
18:27:54 | renesac | if you want the C's i++ behaviour, you can define a `+++` or something |
18:28:18 | BlaXpirit | proc `+++`*(x: var SomeInteger): SomeInteger {.discardable.} = result = x; inc x |
18:30:05 | Arrrr | What you mean by "no postfix", that i can only do this?: i ++ |
18:30:09 | Arrrr | with a separation |
18:30:18 | flaviu | Arrrr: Let's see. |
18:30:21 | flaviu | .eval import macros; dumpLisp(i ++) |
18:30:22 | Mimbus | flaviu: eval.nim(4, 14) Error: expression expected, but found ')' |
18:30:31 | * | davidhq quit (Read error: Connection reset by peer) |
18:30:32 | * | davidhq_ joined #nim |
18:30:57 | renesac | BlaXpirit was faster than me, but the gist is updated again |
18:31:43 | renesac | Arrrr: unary operators can only be placed in front their operand |
18:31:57 | renesac | and binary operators must be put between their operands |
18:32:21 | Arrrr | Ok, now it works |
18:32:32 | renesac | ops |
18:32:40 | Arrrr | yes, you put dec two times |
18:32:47 | renesac | yeah, corrected |
18:33:03 | Arrrr | Thanks |
18:33:19 | * | vendethiel joined #nim |
18:33:45 | xcombelle | hi! I rediscoverd nim. Looks pretty neat (sadly more complex than python) |
18:33:54 | * | irrequietus quit () |
18:34:18 | drewsrem | http://ix.io/hMb - can someone provide me pointers why this doesn't work? (simple expression macro) |
18:34:24 | renesac | xcombelle: unfortunatedly a expressive static type system is more complex |
18:35:00 | renesac | and performance optimization also brings some complexity |
18:35:11 | Arrrr | did you resolv your last problem drewsrem ? i was interested in |
18:35:20 | Araq | drewsrem: the types downright lie :-) within a macro everything is a NimNode |
18:35:29 | Arrrr | the one with the proc creating an array |
18:35:57 | renesac | Araq: there are no tests for arrow like operators? |
18:36:11 | Araq | renesac: there are in ... macros iirc |
18:36:34 | renesac | ./koch test c macros? |
18:37:17 | renesac | the closure macro one |
18:37:20 | renesac | well, all pass |
18:37:33 | Araq | exactly tclosuremacro is it |
18:37:50 | drewsrem | Arrrr, I'm on it |
18:38:06 | Araq | also the future.nim module uses them and has tests it its main section |
18:38:10 | drewsrem | Araq, I see |
18:38:42 | Araq | drewsrem: you can extract the int value from a node but this is not guaranteed to work |
18:39:05 | Araq | you need to use static[int] but this is so buggy I feel ashamed |
18:39:22 | Araq | but I'm working on static[T] now, at last. |
18:39:31 | drewsrem | Araq, not myint.intVal ? |
18:40:00 | xcombelle | renesac: but it's the neater C speed language I saw |
18:41:17 | Arrrr | muh rust |
18:41:21 | renesac | Araq: \o/ |
18:41:48 | * | renesac waits for the triunfant come back of semistatic (some day in the future) |
18:41:52 | renesac | XD |
18:41:57 | drewsrem | Arrrr, this seems to work superficially http://ix.io/hMf |
18:42:16 | drewsrem | Arrrr, so basically, using generics and then writing a macro wrapper |
18:42:34 | renesac | by the way, I'm tempted to remove {.discardable.} from the `+++` |
18:43:03 | BlaXpirit | that's cool |
18:43:11 | renesac | operator, as one should use the ++ one if he wants only the side effects anyway |
18:43:28 | Arrrr | Seems so hacky, but i dont know much about macros drewsrem |
18:43:40 | Arrrr | It is fair renesac |
18:43:52 | drewsrem | Arrrr, so basically, calling fillX(23) is the same as calling fillXArray[array[23, char]]() |
18:43:54 | drewsrem | Arrrr, it is |
18:44:24 | Arrrr | Does performance suffer ? |
18:44:40 | drewsrem | Arrrr, on my end? |
18:44:51 | Arrrr | Using macros like that |
18:44:56 | xcombelle | oh ? the thread share nothing by default: good point |
18:44:58 | drewsrem | Arrrr, no, macros are compile time |
18:47:45 | drewsrem | Araq, retrieving an intVal from a node can fail? |
18:48:41 | Araq | drewsrem: of course! |
18:49:05 | Araq | var x: int; thamacro(x) |
18:49:25 | Araq | <-- no value at compiletime |
18:49:51 | drewsrem | Aren't vars 0-initialized? |
18:49:52 | * | BitPuffin joined #nim |
18:50:35 | * | repax joined #nim |
18:50:45 | * | itPuffinB joined #nim |
18:51:29 | Araq | drewsrem: not the point |
18:51:31 | drewsrem | Araq, ah I see, thanks for the heads-up |
18:52:15 | drewsrem | It's fine for my requirements |
18:52:26 | drewsrem | I think |
18:53:39 | xcombelle | is there some interpreter written in nim ? |
18:53:45 | ldlework | brainfuck |
18:54:00 | renesac | mal lisp one |
18:54:00 | ldlework | https://github.com/def-/nim-brainfuck |
18:54:13 | * | BitPuffin quit (Ping timeout: 252 seconds) |
18:54:22 | renesac | https://github.com/def-/mal |
18:54:44 | Arrrr | renesac: i noticed your gist included var inside the definition of the ++ argument. Is the purpouse to make it mutable? Are arguments by default inmutable? |
18:54:54 | renesac | yes |
18:55:11 | * | itPuffinB quit (Ping timeout: 250 seconds) |
18:55:12 | Arrrr | Ok, thanks. |
18:57:16 | * | user7181 joined #nim |
18:59:13 | Arrrr | On the forum it is said a new version is about to be released. What has changed since the version used in the tutorial? |
18:59:43 | BlaXpirit | about a million bugs fixed |
18:59:53 | Arrrr | haha |
19:00:24 | BlaXpirit | https://github.com/Araq/Nim/blob/devel/web/news.txt |
19:01:30 | Arrrr | const objects, nice |
19:07:18 | xcombelle | until now the hardest thing about nim comparing to python is it's habit to automagically create variables |
19:08:15 | * | Sembei joined #nim |
19:08:43 | Araq | xcombelle: python had to introduce a nonlocal keyword because of this "feature" |
19:11:13 | federico3 | xcombelle: only that? |
19:11:15 | xcombelle | Araq for example in the import which as far as I understand don't specify which names are imported |
19:12:21 | renesac | xcombelle: |
19:12:24 | renesac | http://nim-lang.org/manual.html#import-statement |
19:12:35 | renesac | see below for "From import statement" |
19:13:39 | renesac | xcombelle: consider editing this wiki page too: https://github.com/Araq/Nim/wiki/Nim-for-Python-Programmers |
19:14:30 | xcombelle | renesac I saw it but the problem is it is not the community way to do it so the examples looks like sort of magic for example https://github.com/dom96/jester |
19:15:04 | renesac | yeah, the downside is that it is a bit difficult to know from which module some function came from |
19:15:09 | renesac | just by looking at the code |
19:15:27 | renesac | hopefully we will have very intelligent nim IDEs soon, so that will be less of a problem |
19:16:07 | federico3 | I'd love a Vim plugin to do Nim autocompletion |
19:16:10 | renesac | but when you are programming, it works very well |
19:16:12 | Araq | it works with nimsuggest for me... |
19:16:33 | xcombelle | renesac I really love that in python we pretty know where a variable come in existence just by grepping the code |
19:16:35 | renesac | when you are reading someones code on github, that can be a problem |
19:16:58 | xcombelle | and I love grepping code by hand |
19:17:03 | federico3 | don't this leads to name collisions? |
19:17:20 | renesac | federico3: when there are collisions, you must disambiguate then |
19:17:33 | renesac | like system.open, foo.open |
19:17:35 | renesac | but just for that |
19:17:54 | * | Sembei quit (Max SendQ exceeded) |
19:18:11 | renesac | or you "from foo import nil" and it namespaces everything in that module like python default import |
19:18:57 | renesac | I do like the explictiness of python, but the Nim way works better for the method call syntax |
19:18:58 | federico3 | wait a second: what if I'm using a 3rd party library that starts exposing "open" only from a certain version? Suppose my code is already written and deployed |
19:19:37 | renesac | that probably will lead your code to not compile anymore |
19:19:49 | federico3 | as I feared. urgh. |
19:19:50 | renesac | (so much for {.procvar}s |
19:20:07 | renesac | (so much for {.procvar.}s) |
19:20:26 | EXetoC | just include the module name as often as you like then |
19:20:51 | Arrrr | can you call procs like file.proc ? |
19:20:57 | EXetoC | yes |
19:20:59 | * | irrequietus joined #nim |
19:21:02 | Arrrr | for example, Math.sum(1, 2) |
19:21:06 | Araq | federico3: usually overloading resolution disambiguates then |
19:21:19 | Arrrr | So, it seems like a good practice to always to this |
19:21:24 | renesac | Arrrr: lower case on that Math |
19:21:29 | federico3 | I suppose there's a good practice of using descriptive names |
19:22:10 | renesac | nim don't adopts the Zen of Python |
19:22:22 | EXetoC | it helps to introduce more types too |
19:22:24 | renesac | Araq don't seems to like it very much |
19:22:56 | xcombelle | renesac: as far as I understand it's quite necessary because thre is a lot of type and importing them would be boring |
19:23:14 | BlaXpirit | types are actually the least of a problem |
19:23:32 | BlaXpirit | in python all the operations on a class reside inside the class |
19:23:58 | BlaXpirit | in nim if you import just the class, you can't even use the classes getter functions, can't use any operators |
19:24:56 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
19:25:06 | Arrrr | lol |
19:25:17 | Araq | you know, you can pretend the module is the class and then you get the same behaviour as in python |
19:26:45 | EXetoC | here we go again :p |
19:27:36 | ldlework | oh gawd |
19:27:44 | BlaXpirit | i'm not even criticizing anything here |
19:27:59 | renesac | Araq: by the way, I changed minds again, and now I think I might like your version of '\n' |
19:28:06 | EXetoC | d(:)|< |
19:28:37 | renesac | just needs better documentation and I still think an optional parameter for open() is desirable, when using \L for example |
19:31:31 | flaviu | xcombelle: Everyone forgot the Nim interpreter written in Nim! |
19:32:03 | xcombelle | eh eh flaviu |
19:32:27 | * | brson quit (Ping timeout: 250 seconds) |
19:32:59 | xcombelle | I tried to do nimble install aporia and get CustomStatusBar.nim(41, 24) Error: undeclared identifier: 'False' (after a lot of deprecated warnings) |
19:33:19 | Arrrr | Any experience with nim's GC? How does it perform? |
19:33:42 | * | elbow_jason joined #nim |
19:33:53 | flaviu | Arrrr: Not nearly as good as hotspot, but allocation is much rarer in Nim. |
19:34:33 | Arrrr | And i see you can even control it. is this a good idea? |
19:34:53 | flaviu | For games it's critical. |
19:35:10 | flaviu | But I'm not too familiar with the GC, maybe some in here can chime in. |
19:37:13 | dom96 | xcombelle: nimble install aporia@#hed |
19:37:15 | Arrrr | "Every variable, procedure, etc. needs to be declared before it can be used[...] Later versions of the language may get rid of the need for forward declarations." is this going to happen anytime soon? I recall asking this some time ago |
19:37:15 | dom96 | *head |
19:37:48 | flaviu | Arrrr: Unlikely to happen soon. Macros and code generation introduce major difficulties. |
19:38:08 | Arrrr | pff, and for 1.0 ? |
19:40:16 | xcombelle | dom96 this time after a lot of GcUnsafe: utils.nim(454, 40) Error: undeclared identifier: '^' |
19:41:05 | Araq | renesac: I still don't see a problem really. what is "text-mode"? does it deal with encodings, the UTF8-BOM, trailing whitespace, trailing newlines at the end of the file? text-mode drops dead. |
19:41:28 | dom96 | xcombelle: You need the latest nim compiler |
19:41:58 | * | repax quit (Remote host closed the connection) |
19:42:19 | Araq | renesac: I see no convenience in *only* transforming CR-LF to LF. |
19:43:02 | Araq | Arrrr: nothing it planned for 1.0 in this respect. |
19:43:07 | Araq | *is |
19:43:31 | renesac | well, python's open has a multitude of options |
19:43:32 | Arrrr | :( |
19:43:36 | * | BitPuffin joined #nim |
19:44:01 | renesac | the line ending one is one of them |
19:44:12 | renesac | well, I might do a pull request in the future |
19:44:13 | Araq | renesac: yes but then we are talking about a real new module that supports these things, not about a flag that mimics C's broken idea of a "text mode" |
19:44:33 | renesac | yeah, I'm not asking for text mode |
19:44:56 | renesac | just a optional parameter to make line end conversions on read/write, if desired |
19:45:07 | renesac | by default nothing is done |
19:45:19 | * | HakanD__ joined #nim |
19:45:33 | Araq | interesting, so you don't make it part of 'open'? |
19:46:15 | renesac | well, in the end it would be an parameter for open, I think |
19:46:21 | * | drewsrem quit (Quit: Leaving) |
19:46:22 | renesac | I'm not sure how the implementation will be made |
19:46:43 | renesac | I don't really know how C implements the text mode |
19:46:48 | renesac | I only know what it does |
19:50:56 | Arrrr | Well, i have to go. Thanks again to renesac and flaviu for their help. I suppose i'll come back tomorrow for more answers |
19:50:59 | * | Arrrr quit (Quit: Page closed) |
19:59:37 | * | irrequietus quit () |
20:00:18 | * | UberLambda joined #nim |
20:01:18 | * | rkj-b joined #nim |
20:01:35 | * | UberLambda quit (Read error: Connection reset by peer) |
20:01:51 | * | UberLambda joined #nim |
20:09:37 | xcombelle | dom96 with the devel nim branch and the head branch od aporia it's still fail with utils.nim(454, 40) Error: undeclared identifier: '^' |
20:11:17 | dom96 | make sure you don't have two nim compilers in your PATH |
20:11:22 | dom96 | I can compile it fine |
20:14:17 | * | Jehan_ joined #nim |
20:14:19 | BlaXpirit | xcombelle, yeah, u have an old compiler |
20:14:44 | BlaXpirit | it can be an old release or an outdated devel |
20:15:08 | BlaXpirit | this stuff is FAQ-worthy |
20:15:18 | BlaXpirit | undeclared identifier: '^' in 99% cases means u need to update |
20:18:28 | * | bcinman joined #nim |
20:18:54 | xcombelle | BlaXpirit, update to what master or devel ? |
20:19:06 | BlaXpirit | xcombelle, master doesn't support ^ yet |
20:19:13 | BlaXpirit | you need to update to latest devel |
20:19:32 | BlaXpirit | you may have devel but not latest |
20:19:46 | HakanD__ | hmm, the compiler just hangs without giving any errors, any tips on how i can find what is wrong? |
20:20:39 | BlaXpirit | yesterday i thought the compiler hung but it actually took so long for nim js |
20:20:58 | * | Menche quit (Quit: Leaving) |
20:23:26 | def- | BlaXpirit: you bootstrap with ./koch boot -d:release? |
20:23:37 | BlaXpirit | dunno |
20:24:27 | def- | HakanD__: you could build a temporary compiler with --linedir:on --debuginfo and use GDB to check where it hangs |
20:24:51 | def- | or just disable parts of your code until you notice what makes it hang |
20:25:35 | HakanD__ | I know what makes it hang, messing around with user defined type classes. I will try that tomorrow, should be fun |
20:30:27 | def- | maybe setting a higher verbosity for the compiler might help |
20:31:51 | dtscode | someone said my name? |
20:32:23 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
20:33:15 | xcombelle | thanks a lot BlaXpirit dom96 it works |
20:33:29 | * | xcombelle quit (Quit: Leaving) |
20:34:56 | * | bcinman joined #nim |
20:45:15 | * | irrequietus joined #nim |
20:47:02 | * | brson joined #nim |
20:49:52 | * | user7181 quit (Ping timeout: 252 seconds) |
20:51:31 | * | user7181 joined #nim |
20:55:03 | * | UberLambda quit (Quit: Leaving) |
21:21:15 | Araq | Jehan_: do you think it's feasible to look at a different thread's stack to determine if it's waiting on a syscall? |
21:22:55 | * | BlaXpirit quit (Quit: Quit Konversation) |
21:22:56 | Jehan_ | Araq: Umm, I'd see the bigger problem with the rather OS-specific parts of determining whether a syscall is in progress and if so, if it's actually blocking. |
21:23:22 | * | BlaXpirit joined #nim |
21:23:25 | Jehan_ | Or what do you mean? |
21:23:34 | Araq | "thread in syscall" is good enough for me |
21:24:06 | Araq | whether blocking or not is not that important |
21:24:47 | Jehan_ | Even that is … umm, it depends on the OS and even the processor type. Ideally. |
21:25:00 | Jehan_ | It's sort of the anti-thesis of something that can be done portably. |
21:26:50 | Jehan_ | And I'm not even sure if it can even be done on all of types of operating systems and architectures. |
21:30:13 | Jehan_ | Realistically, what I've been doing when needing that is to wrap syscalls (or anything that does syscalls and that I can't inject code into) in a begin … end structure. |
21:30:47 | Jehan_ | And yes, obviously, if that's forgotten somewhere, then things just block. |
21:31:35 | Araq | yeah but the stack pointer should be in a completely different address range, right? |
21:31:56 | Araq | because of memory protection between process and OS |
21:33:31 | Jehan_ | But can you see the stack pointer? As long as the processor is executing protected code, you cannot access its registers, either. |
21:35:46 | Jehan_ | I know you can do thread_get_state() on OS X, but even that's not portable. |
21:36:08 | Jehan_ | within OS X across different processor types, I mean. |
21:36:47 | Jehan_ | Generally, under POSIX, as soon as a thread does a syscall, it becomes a black box. |
21:38:29 | Jehan_ | What's the specific background for the question, by the way? Garbage collection? |
21:41:16 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
21:43:09 | Araq | I'm thinking about how to detect "every worker threads is blocked, start a new thread" |
21:43:10 | * | HakanD__ quit (Quit: Be back later ...) |
21:43:30 | Araq | and yeah, the stack pointer is not available, true |
21:44:19 | Jehan_ | My preferred solution has been to distinguish between computer and I/O threads in general. |
21:44:22 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:45:04 | Jehan_ | If you have threads that are supposed to do computations doing blocking syscalls you run into all kinds of other problems, too. |
21:47:00 | * | bjz joined #nim |
21:54:12 | * | Menche joined #nim |
21:55:59 | * | vendethiel quit (Ping timeout: 244 seconds) |
21:56:41 | * | user7181 quit (Quit: leaving) |
21:57:18 | renesac | https://github.com/Araq/Nim/pull/2503 <-- done |
21:57:30 | renesac | there were no tests in futures.nim |
21:59:44 | * | brson quit (Quit: leaving) |
21:59:57 | * | brson joined #nim |
22:00:29 | * | TEttinger quit (Ping timeout: 252 seconds) |
22:01:03 | * | saml quit (Quit: Leaving) |
22:03:20 | dom96 | renesac: they exist somewhere among all the tests in the tests dir |
22:03:38 | renesac | yeah, under macros |
22:03:41 | BlaXpirit | what is this |
22:03:45 | BlaXpirit | what about ~> |
22:03:56 | BlaXpirit | this is wrong |
22:03:56 | renesac | see the updated PR message |
22:04:09 | renesac | ? |
22:04:49 | renesac | you want ~ to be counted as arrow like too? |
22:05:00 | BlaXpirit | what exactly does this achieve? |
22:05:23 | BlaXpirit | this is just a random purposeless pull request |
22:05:53 | renesac | frees up things like |> to be used as an arithmetic operator |
22:06:19 | renesac | you might disagree though, I don't really fell too strongly about that |
22:06:25 | BlaXpirit | this is not an arithmetic operator |
22:07:03 | renesac | I might assign it to shl |
22:07:16 | * | gsingh93 quit (Ping timeout: 240 seconds) |
22:07:42 | renesac | if this arrow like operator change is refused, then maybe only do |>= as a shl assignment operator |
22:07:52 | renesac | as the |> will have wrong precedence anyway |
22:07:55 | * | davidhq_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:08:12 | Araq | renesac: ~ is like - I guess |
22:08:28 | renesac | yeah, I forgot about it |
22:08:43 | BlaXpirit | just why |
22:09:37 | renesac | to free up higher precedence combinations |
22:09:59 | renesac | there are still plenty of possible arrow like combinations even with this change |
22:10:21 | BlaXpirit | you may have explained the benefits to someone |
22:10:30 | flaviu | When treating a seq as a stack, is the best way of peek `mySeq[mySeq.high]`? |
22:10:31 | BlaXpirit | but i don't see it. but your pull request is isolated |
22:10:52 | Araq | flaviu: mySeq[^1] in devel |
22:10:57 | renesac | ^ |
22:11:04 | flaviu | Thanks! |
22:11:10 | * | Menche left #nim ("Leaving") |
22:11:54 | BlaXpirit | pull requests are usually treated like this: |
22:11:55 | dom96 | better yet, write a proc called 'peek' |
22:12:00 | renesac | BlaXpirit: the original reason was to use something like `*>` or `|>` as an alternative shr operator |
22:12:15 | BlaXpirit | a pull request solves a problem, which is described in detail in an issue |
22:12:37 | BlaXpirit | renesac, and why would anyone do that? |
22:12:38 | renesac | yeah, sorry, we only discussed this in irc |
22:12:48 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:12:52 | BlaXpirit | so u did discuss, sorry for being so harsh |
22:12:54 | renesac | anyway, we can still discuss it in the PR page |
22:13:23 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:14:22 | renesac | it would be nice to enter in this release, but it is better not to be too rash either |
22:15:01 | renesac | if there is disagreement let's discuss it |
22:15:28 | renesac | you already brought an overlooked point, the '~' |
22:16:11 | * | bcinman joined #nim |
22:16:21 | * | devzerp joined #nim |
22:16:21 | * | no_name joined #nim |
22:20:05 | BlaXpirit | strange that Arаq decided to use only first character |
22:20:42 | renesac | I'm neutral on this |
22:21:20 | * | vendethiel joined #nim |
22:25:38 | Araq | BlaXpirit: well it's a minor thing and if it keeps renesac making PRs, it's well worth it |
22:26:05 | renesac | lol |
22:26:18 | renesac | as I suspected, it was a bait |
22:26:55 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
22:27:00 | renesac | don't worry, I was even thinking on other alternative operators |
22:27:12 | * | bcinman joined #nim |
22:27:15 | renesac | like .| and .^ |
22:27:29 | renesac | but dot don't looks right, and might be problematic with ranges |
22:28:03 | BlaXpirit | i couldn't find anything looking like an arrow |
22:28:13 | BlaXpirit | except maybe >>---> lol |
22:28:14 | renesac | shl and shr are in the right precedence level, so an alternative operator for them might be more confusing than worth |
22:29:06 | renesac | well, -&> don't really looks like an arrow, but is still an arrow operator under my patch |
22:29:23 | Araq | yeah I'm thinking about this |
22:29:25 | renesac | while +-> is not |
22:29:39 | BlaXpirit | don't forget the actual arrow. >>---> |
22:29:44 | Araq | maybe - = or ~ should be *before* the > |
22:30:13 | BlaXpirit | seems to make more sense |
22:30:15 | renesac | or maybe they should just be in the operator, and let people choose? |
22:30:26 | BlaXpirit | that seems best to me |
22:30:29 | Araq | hum? |
22:30:48 | BlaXpirit | Araq, your previous rationale was "we don't have any rules for characters in the middle" |
22:31:00 | Araq | BlaXpirit: yes |
22:31:06 | BlaXpirit | well now you' |
22:31:10 | BlaXpirit | ve dropped it |
22:31:28 | Araq | it's still not somewhere in the middle |
22:31:49 | BlaXpirit | <-> exactly in the middle |
22:31:54 | BlaXpirit | whatever |
22:31:58 | Araq | but op[^1] == '>' and op[^2] in {'=', '-', '~'} |
22:32:18 | BlaXpirit | fine by me |
22:32:20 | Araq | it's still no *search* |
22:32:23 | BlaXpirit | as if someone cares |
22:32:28 | Araq | lol |
22:32:32 | renesac | fine for me too |
22:32:40 | renesac | it indeed might make more sense |
22:33:37 | renesac | and there is no big search to make |
22:33:49 | renesac | operators rarelly are more than 2 characters |
22:34:05 | renesac | and I never saw something bigger than 3 characters |
22:34:08 | BlaXpirit | possibly change description to "ending with -> => or ~>" |
22:34:21 | renesac | yeah, that makes for a nicer description |
22:34:52 | BlaXpirit | that's gonna be a lot of commits :s |
22:35:10 | * | BlaXpirit quit (Quit: Quit Konversation) |
22:35:13 | renesac | nah, I can make it in a single additional commit |
22:36:03 | def- | why not "containing -> => or ~>"? This still looks arrow-like: ->* |
22:36:51 | renesac | as this: -+> |
22:37:15 | renesac | well, this rule is for changing precedence |
22:37:51 | renesac | the point of my PR is that we still want some operators kinda arrow like, but with higher precedence |
22:38:20 | renesac | like for shift right, that you want the arrow indicating the direction, but don't want the lower precedence that comes with it |
22:39:26 | renesac | so ideally we would have a rule that gives plenty of both and isn't too complicated |
22:40:27 | renesac | the simplest not so invasive rule seems to be "ending with -> => or ~>" |
22:40:48 | renesac | not sure if it is the most consistent with the language though |
22:42:17 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
22:48:48 | * | rkj-b quit (Quit: ChatZilla 0.9.91.1 [Firefox 37.0.1/20150402191859]) |
22:52:21 | Jehan_ | How about just being able to set operator precedence explicitly? (And if you have multiple overloaded definitions with conflicting precedence, you'll just have to use parentheses.) |
22:53:31 | renesac | Jehan_: it was the first thing I suggested when I saw nim operators IIRC |
22:54:26 | renesac | as I discovered nim after I saw a python-like dialect that also let the user define it's own custom operators |
22:54:58 | * | gsingh93 joined #nim |
22:55:47 | renesac | but I fear that setting the operator precedence might raise even higher the cognitive load of those arcane incantations that some modules define |
22:56:09 | renesac | as you would have to remember it's function as well as it's precedence |
22:56:14 | renesac | one more thing to remember |
22:56:43 | renesac | though it took quite a while for me to mostly internalize the entire nim precedence rules |
22:57:17 | Jehan_ | renesac: I generally think that use of custom operators should be minimized. |
22:57:23 | renesac | that are not that simple, but at least you only have to learn once (for each of my PRs XD) |
22:57:54 | Jehan_ | They are useful for DSLs and stuff that you use an awful bloody lot, but writing out a procedure name makes code easier to read in the end. |
22:58:16 | renesac | Jehan_: yeah, the command syntax makes calling functions easier |
22:58:44 | Jehan_ | You can also use it for an operator-like syntax. |
22:58:52 | Jehan_ | E.g: let a = 1 .op 2 |
22:59:02 | Jehan_ | (At least I think it's fixed now so that you can.) |
22:59:20 | flaviu | My favorite operator is the -| operator. |
22:59:40 | flaviu | /s, in case it wasn't obvious. |
23:00:16 | Jehan_ | flaviu: I was about to say ... |
23:01:34 | Jehan_ | I'd honestly make that a candidate for deprecation. |
23:08:16 | * | jefus_ joined #nim |
23:09:56 | * | vendethiel quit (Ping timeout: 252 seconds) |
23:11:49 | * | jefus quit (Ping timeout: 248 seconds) |
23:21:16 | reactormonk | Araq, interesting, the bug where I get a segfault with the GC, shared libs and threads seems to have disappeared |
23:25:05 | * | bcinman joined #nim |
23:48:13 | * | saml_ joined #nim |
23:51:46 | * | bcinman quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
23:53:16 | * | a5i quit (Quit: Connection closed for inactivity) |
23:54:57 | * | Jehan_ quit (Quit: Leaving) |
23:59:26 | * | Jehan_ joined #nim |
23:59:35 | * | Demon_Fox joined #nim |