00:01:14 | * | strcmp1 joined #nim |
00:20:33 | * | desophos joined #nim |
00:35:36 | * | johnsoft quit (Quit: Leaving) |
00:49:09 | * | johnsoft joined #nim |
00:52:03 | * | FPanda joined #nim |
00:55:50 | * | zama quit (Ping timeout: 244 seconds) |
00:56:24 | * | zama joined #nim |
00:56:24 | FPanda | hey, is someone here and has short time to answer a question? |
01:03:40 | desophos | FPanda, don't ask to ask; just ask |
01:09:30 | FPanda | k i want to create a table |
01:09:45 | FPanda | it looks like this right now but isnt there a different way? |
01:09:58 | FPanda | var keyTable = initTable[string, int](rightSize(100)) |
01:10:04 | FPanda | keyTable["a"] = VK_A |
01:10:08 | FPanda | keyTable["b"] = VK_B |
01:10:11 | FPanda | and so on |
01:11:25 | FPanda | like creating a seq like this let test = @[1, 2, 3} |
01:12:25 | * | no_name quit (Remote host closed the connection) |
01:12:25 | * | devzerp quit (Remote host closed the connection) |
01:13:43 | * | devzerp joined #nim |
01:13:43 | * | no_name joined #nim |
01:24:16 | ephja | FPanda: http://nim-lang.org/docs/tables.html#toTable,openArray[] http://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor |
01:29:53 | FPanda | ah thx for the 2nd link |
02:01:24 | * | zaquest quit (Quit: Leaving) |
02:09:22 | * | desophos_ joined #nim |
02:10:19 | * | jakesyl quit (Ping timeout: 240 seconds) |
02:13:53 | * | desophos_ quit (Ping timeout: 265 seconds) |
02:21:59 | * | brson quit (Ping timeout: 252 seconds) |
02:23:18 | * | jakesyl joined #nim |
03:10:22 | * | ulyssesdwolfe joined #nim |
03:38:19 | * | darkf joined #nim |
04:21:03 | * | ldlework quit (Quit: ZNC - http://znc.in) |
04:30:09 | * | ldlework joined #nim |
04:44:03 | * | desophos_ joined #nim |
04:48:04 | * | desophos quit (Ping timeout: 265 seconds) |
04:54:20 | * | ephja quit (Ping timeout: 246 seconds) |
05:43:34 | * | linkedinyou joined #nim |
05:52:40 | * | desophos_ is now known as desophos |
06:20:13 | Araq | desophos: true but c2nim makes it really easy to create more wrappers |
06:33:42 | * | gsingh93 quit (Ping timeout: 250 seconds) |
06:36:23 | * | gsingh93 joined #nim |
06:36:23 | * | FPanda quit (Read error: Connection reset by peer) |
06:37:39 | * | desophos quit (Read error: Connection reset by peer) |
06:42:13 | * | Ven joined #nim |
06:49:16 | * | strcmp1 quit (Remote host closed the connection) |
06:57:18 | * | ulyssesdwolfe quit (Remote host closed the connection) |
07:23:06 | * | ldlework quit (Remote host closed the connection) |
07:23:48 | * | ldlework joined #nim |
07:36:20 | * | desophos joined #nim |
07:40:59 | * | desophos quit (Ping timeout: 264 seconds) |
07:41:21 | * | yglukhov joined #nim |
07:55:55 | * | Trustable joined #nim |
07:56:28 | Araq | damn, my critical fix breaks 2 tests |
08:04:54 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:06:46 | * | Ven joined #nim |
08:07:38 | yglukhov | Hmm, seems like travis doesn't run tests. Is this intended? |
08:09:08 | * | gokr joined #nim |
08:11:16 | Araq | it does run the tests, that's why it's all red |
08:13:08 | yglukhov | e.g. https://github.com/nim-lang/Nim/pull/3419 this one is green |
08:13:23 | yglukhov | moreover, there are no tests in the build log |
08:13:48 | Araq | that predates our test activations |
08:16:26 | * | coffeepot joined #nim |
08:25:27 | NimBot | nim-lang/Nim devel 3f24a7f Araq [+0 ±1 -0]: mitigates unclear nimsuggest problem |
08:25:27 | NimBot | nim-lang/Nim devel d93507f Araq [+1 ±3 -0]: fixes #3338 |
08:25:57 | * | NimBot joined #nim |
08:38:06 | * | linkedinyou quit (Read error: Connection reset by peer) |
08:38:57 | * | bjz joined #nim |
08:39:55 | * | bjz quit (Read error: Connection reset by peer) |
08:44:38 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
08:44:51 | * | coffeepot joined #nim |
08:52:55 | * | Ven quit (Read error: Connection reset by peer) |
08:53:27 | * | Ven joined #nim |
08:56:20 | * | Arrrr joined #nim |
09:03:51 | * | shevy left #nim ("I'll be back ... maybe") |
09:04:34 | * | joelmo joined #nim |
09:17:08 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:22:54 | * | Ven joined #nim |
09:38:33 | NimBot | nim-lang/Nim devel c894f6f Yuriy Glukhov [+0 ±1 -0]: Fixed broken links |
09:38:33 | NimBot | nim-lang/Nim devel bf6211d Dominik Picheta [+0 ±1 -0]: Merge pull request #3463 from yglukhov/patch-1... 2 more lines |
10:04:11 | Araq | yglukhov: if you could make travis green that would be most welcome |
10:04:29 | Araq | you can disable what currently doesn't work, I think. |
10:04:41 | Araq | mostly some boehm GC related tests iirc |
10:15:19 | NimBot | nim-lang/Nim devel e722770 Araq [+0 ±4 -0]: doc\advopt.txt... 2 more lines |
10:15:19 | NimBot | nim-lang/Nim devel ec2d370 Araq [+0 ±1 -0]: added --reportConceptFailures switch |
10:15:19 | NimBot | nim-lang/Nim devel 9cc25f8 Araq [+1 ±2 -0]: fixes #3452 |
10:15:19 | NimBot | nim-lang/Nim devel a90e23a Araq [+0 ±1 -0]: added --reportConceptFailures switch to the manual |
10:23:25 | Arrrr | If im not mistaken, 'shallowCopy' does not perform a deep copy *until* you to modify it? Otherwise, i dont get it |
10:24:09 | Araq | you're not supposed to modify it at all after a shallowCopy but we don't enforce that yet at runtime |
10:24:20 | Araq | oh wait |
10:24:37 | Araq | I was thinking of shallow(), not shallowCopy() |
10:25:05 | Araq | shallowCopy() is simply unsafe, you need to understand what it means to have a single indirection to the seq/string. |
10:25:33 | Araq | we don't have 2 indirections like Python does it, so we cannot do it like Python does it. Simple as that. |
10:25:43 | Araq | bbl |
10:26:00 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:27:06 | Arrrr | Yes, im aware of that, but then i dont understand this http://ideone.com/xG3nSs |
10:27:55 | Arrrr | if you are not actually copying everything, then why modifying b does not affect a |
10:31:12 | dom96 | This may be wrong, but my understanding is that in that case shallowCopy will only copy the sequence without copying any of its items. |
10:36:01 | Arrrr | I thought the same, but it is not how it works http://ideone.com/2BRYbC |
10:36:21 | Arrrr | I would expect line 9 to only affect one MyRef if it actually does a deep copy |
10:37:06 | Arrrr | so i dont know what's the point of shallowCopy, other than turn let to var |
10:40:19 | * | cryzed quit (Ping timeout: 240 seconds) |
10:42:43 | * | cryzed joined #nim |
11:02:39 | * | Jehan_ joined #nim |
11:04:32 | Jehan_ | Arrrr: shallowCopy works differently outside a procedure. I don't recall why (i.e. whether it's a bug or necessity). But if you wrap it inside a `proc main()` and then call `main()`, it works as intended. |
11:04:55 | Jehan_ | That said, shallowCopy with a non-var right hand side is inherently unsafe. |
11:05:42 | Jehan_ | This is why I've been arguing to deprecate it as unsafeShallowCopy and create a safe version `shallowAssign[T](x, y: var T)`. |
11:06:32 | Arrrr | wow, you are right Jehan_ http://ideone.com/xG3nSs |
11:06:35 | Arrrr | Thank you |
11:06:43 | Jehan_ | The reason why it's unsafe is that if the rhs is a constant (or references a constant, such as when you assign one to `let` or pass it as a non-var parameter), then it points to static memory and can trash memory. |
11:07:10 | Jehan_ | I.e. you're making what's supposed to be immutable memory suddenly mutable. |
11:07:32 | * | yglukhov quit () |
11:08:25 | Jehan_ | The problem here is that there is zero warning that shallowCopy is unsafe in these cases. Even the documentation is sort of vague about it. |
11:10:52 | Arrrr | Well, in my case, and i suppose that in most cases, it is just for seqs |
11:11:13 | Jehan_ | Yeah, but seqs can be constant. |
11:11:28 | Arrrr | oh |
11:11:37 | Jehan_ | @["x", "y", "z"], for example, will be stored entirely in static memory and not on the heap. |
11:11:58 | Jehan_ | Unless and until you assign it to a `var` variable, basically. |
11:12:08 | Jehan_ | Or a field of a heap object. |
11:12:49 | Arrrr | so, let a = @[1, 2, 3, 4] is static too? |
11:17:32 | * | yglukhov joined #nim |
11:17:40 | Jehan_ | Arrrr: I'd actually have to check how that works right now and if `let` doesn't do anything different (the semantics for copying are a bit ... involved). But I do remember that passing as a non-var parameter doesn't allocate anything on the heap and `let` should normally mimic this behavior (so that you can have it in templates). |
11:19:37 | * | elrood joined #nim |
11:19:45 | * | Ven joined #nim |
11:21:12 | * | thotypous joined #nim |
11:39:55 | reactormonk | https://github.com/nim-lang/assets/blob/master/Art/logo.svg somehow renders empty in chromium? |
11:43:36 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
11:45:44 | elrood | reactormonk, not chromium's fault, it's the same for firefox |
11:47:22 | * | Ven joined #nim |
11:53:54 | * | zaquest joined #nim |
11:56:03 | * | strcmp1 joined #nim |
11:56:05 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:03:13 | * | smodo joined #nim |
12:11:38 | yglukhov | does anyone know what is the correct spelling of apt-get package for boehmgc in ubuntu? |
12:11:49 | yglukhov | does anyone has ubuntu in the first place? ;) |
12:13:02 | * | ayia joined #nim |
12:15:29 | r-ku | yglukhov apt-cache search ... |
12:15:40 | elrood | not as primary system, but probably libgc(-dev) |
12:15:49 | yglukhov | doesn't work on macos :( |
12:24:11 | * | strcmp2 joined #nim |
12:24:19 | elrood | yglukhov, oh, fun, it appears to be libgc1c2 and libgc-dev, so much for consistent naming schemes. http://packages.ubuntu.com/ |
12:24:23 | * | strcmp1 quit (Ping timeout: 250 seconds) |
12:29:52 | * | no_name quit (Remote host closed the connection) |
12:29:52 | * | devzerp quit (Remote host closed the connection) |
12:35:31 | yglukhov | yeah, already tried libgc-dev and it worked. thanks! =) |
12:37:27 | Araq | ah, do we need -dev packages to deploy things again? what a joy. |
12:41:46 | yglukhov | err.. no, that's for travis tests |
12:42:12 | * | strcmp2 quit (Remote host closed the connection) |
12:43:04 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
12:43:28 | * | coffeepot joined #nim |
12:43:58 | * | strcmp1 joined #nim |
13:01:18 | Araq | if travis needs it, we also need it on other linux machines |
13:03:18 | ayia | Hi friends! Do I understand correctly, that `type Person = ref object ... var person: Person` is the same as `type Person = object ... var person: ref Person` in context of final person variable? |
13:03:34 | Araq | yes |
13:05:17 | yglukhov | Araq: what is nimrtl_newObj? it cannot be imported by dll client. and it is not among exported symbols in libnimrtl.dylib |
13:05:33 | yglukhov | however, libnimrtl.dylib exports "newObj" |
13:06:23 | Araq | it's a mangled newObj |
13:06:49 | Araq | that means some pragma usage is inconsistent I think |
13:07:01 | Araq | read lib/system/incrtl.nim carefully |
13:07:37 | Araq | it's tiny, but you need to read it carefully anyway. |
13:07:50 | * | Jehan_ quit (Quit: Leaving) |
13:12:12 | * | pregressive quit (Remote host closed the connection) |
13:13:20 | * | Ven joined #nim |
13:14:14 | * | pregressive joined #nim |
13:14:42 | reactormonk | gotta switch to arch for no dev packages >:) |
13:18:19 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:27:12 | * | pregressive quit (Remote host closed the connection) |
13:28:56 | ayia | coming back to ref and non-ref objects... I have read the documentation... And it still unclear to me, what are general guidelines/best practices about when to use what... and in what style... Can somebody point me to some additional place to find the answers? or shortly explain here... |
13:30:06 | ayia | I am also curious what is more idiomatic: `type Node : ref object of ... ` or `type Node: ref NodeObj ... NodeObj: object ...` |
13:30:17 | Araq | ayia: there are 2 answers. |
13:30:33 | ayia | listening:) |
13:30:52 | Araq | if you are coming from Python or Ruby, 'ref object' is much more natural to work with (albeit produces slower code unless you know what you're doing) |
13:31:31 | Araq | and so it is the default to pick if you're after a scripting like experience. |
13:31:49 | ayia | I am coming from "everywhere"... But really in coding I am big fun clojure-like languages... i.e. with usage of immutability as mush as possible |
13:32:11 | Araq | if you're familiar with systems programming and care about control, use 'object' and pass it around but be aware that these are copied. |
13:32:41 | Araq | and so what usually happens that eventually it gets too messy to avoid the copying and so you evolve the code to use 'ref object' instead |
13:33:54 | ayia | (i am not familiar with systems programming) So "only the overhead in copying" may be a problem with non-ref objects? |
13:34:30 | ayia | Can there be also some problems with buffer overflow like in c++ ? |
13:34:55 | Araq | yes and no. |
13:35:19 | Araq | yes if you ask for it via 'cast' or perhaps .emit. |
13:35:51 | Araq | no, if you simply like to be careless. |
13:36:50 | Araq | Nim knows the bounds of the seqs, strings and arrays and so does perform bound checks. |
13:38:44 | Araq | and contrary to popular belief, -d:release works with --boundChecks:on just fine, even though it's not the default configuration. |
13:40:01 | Arrrr | ! |
13:42:01 | * | ephja joined #nim |
13:45:09 | * | Kingsquee quit (Quit: http://i.imgur.com/EsXzoum.png) |
13:45:28 | yglukhov | Araq: nim uses it's own mechanism for dynamic linkage. right? |
13:45:42 | Araq | not if you use --dynlibOverride |
13:45:54 | Araq | then it uses the usual C stuff. |
13:56:49 | * | smodo quit (Remote host closed the connection) |
13:57:28 | yglukhov | Ok, i'm facing some black magic here. |
13:57:36 | yglukhov | FAILS: nim c -d:useNimRtl -r tests/dll/client.nim |
13:57:48 | yglukhov | SUCCEEDS: nim c -d:useNimRtl tests/dll/client.nim; ./tests/dll/client |
13:58:39 | yglukhov | The failure: could not load: libnimrtl.dylib |
13:59:34 | * | smodo joined #nim |
14:00:19 | yglukhov | FAILS AS WELL: LD_LIBRARY_PATH=lib nim c -d:useNimRtl -r tests/dll/client.nim |
14:01:23 | Araq | well there is a reason why I don't use shared objects on unix. |
14:03:19 | * | Ven joined #nim |
14:12:13 | * | pregressive joined #nim |
14:18:45 | Araq | perhaps somebody can help us. |
14:18:52 | * | Araq looks at OnO |
14:19:58 | * | nande joined #nim |
14:23:15 | Araq | yglukhov: the tester doesn't use 'nim c -r' though. |
14:24:52 | yglukhov | yeah, i know, but the problem seems to be the same |
14:27:44 | yglukhov | ah, maybe LD_LIBRARY_PATH does not survive in the child process for some security reasons... |
14:38:19 | Araq | maybe try to set it permanently via /etc/ldconfigbananajoe.rc |
14:40:58 | yglukhov | no such thing on macos =) |
14:41:18 | Araq | but watch out, it only supports single tabs as separators and needs to end in a newline. because text based interfaces are best when you don't support free form. |
14:41:22 | yglukhov | i've made a dirty workaround. let's see if it works on travis. |
14:50:06 | elrood | yglukhov, you sure your third attempt didn't just fail because you haven't included tests/dll in your LD_LIBRARY_PATH and libserver.so couldn't be found? |
14:51:01 | yglukhov | oh good point, thanx |
14:51:53 | yglukhov | actually that may even explain the magic im facing =)) |
14:56:35 | * | yglukhov_ joined #nim |
14:59:17 | * | barosl quit (Read error: Connection reset by peer) |
15:02:23 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:04:19 | * | dtscode joined #nim |
15:04:25 | * | Yaiyan_ joined #nim |
15:05:56 | * | flyx|znc joined #nim |
15:06:22 | * | someplac- joined #nim |
15:06:46 | * | yglukhov quit (*.net *.split) |
15:06:47 | * | cryzed quit (*.net *.split) |
15:06:47 | * | darkf quit (*.net *.split) |
15:06:47 | * | jakesyl quit (*.net *.split) |
15:06:48 | * | nchambers quit (*.net *.split) |
15:06:50 | * | someplace quit (*.net *.split) |
15:06:50 | * | flyx quit (*.net *.split) |
15:06:50 | * | onionhammer quit (*.net *.split) |
15:06:50 | * | Yaiyan quit (*.net *.split) |
15:06:52 | * | dtscode is now known as nchambers |
15:06:52 | * | flyx|znc is now known as flyx |
15:07:26 | * | lokulin quit (Quit: bye!) |
15:07:28 | * | darkf joined #nim |
15:08:49 | * | barosl joined #nim |
15:10:52 | * | desophos joined #nim |
15:11:10 | * | cryzed joined #nim |
15:11:13 | * | onionhammer joined #nim |
15:18:31 | * | ayia quit (Remote host closed the connection) |
15:22:34 | * | Guest46705isaway is now known as Guest46705 |
15:38:17 | * | jakesyl joined #nim |
15:40:12 | * | allan0 joined #nim |
15:43:29 | * | Matthias247 joined #nim |
15:44:06 | OnO | Araq: regarding dll issue, is it Linux or OSX? |
15:44:34 | yglukhov_ | ЩЫЧ |
15:44:37 | yglukhov_ | OSX |
15:44:58 | OnO | okay, can you show me otool -L yourapp? |
15:45:45 | yglukhov_ | if you're on OSX, you can just run ./koch test c dll |
15:46:42 | OnO | ok, lemme try |
15:50:44 | yglukhov_ | bbl |
15:55:23 | * | yglukhov_ quit (Ping timeout: 264 seconds) |
15:55:32 | OnO | this dll client test fails here with message: could not load: libgc.dylib |
15:55:41 | OnO | I can't find any libgc.dylib anywhere |
15:59:20 | * | strcmp1 quit (Ping timeout: 246 seconds) |
16:02:43 | * | linkedinyou joined #nim |
16:11:37 | * | Ven joined #nim |
16:24:45 | * | coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
16:28:40 | * | edaaa_ quit (Quit: leaving) |
16:32:52 | * | UberLambda joined #nim |
16:41:19 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:41:20 | * | Guest46705 quit (Ping timeout: 244 seconds) |
16:44:15 | * | jaco60 joined #nim |
16:45:47 | * | yglukhov joined #nim |
16:50:48 | * | yglukhov quit (Ping timeout: 272 seconds) |
16:53:31 | * | brson joined #nim |
16:57:54 | * | Guest46705 joined #nim |
17:08:35 | * | yglukhov joined #nim |
17:09:14 | yglukhov | OnO: brew install boehmgc |
17:15:40 | * | irrequietus joined #nim |
17:20:31 | OnO | yglukhov: what's the reason it must use Boehm for this test? |
17:20:58 | yglukhov | it tests several gcs including boehm |
17:22:38 | OnO | hmm... I know, but isn't the test about something else? okay will install boehm |
17:30:03 | yglukhov | yeah, it tests dlls with different gcs |
17:35:24 | OnO | yglukhov, Araq: For some reason Nim on OSX use some Mac specific discouraged API instead simple dlopen: https://bz.apache.org/bugzilla/show_bug.cgi?id=41386 |
17:35:27 | OnO | any reason for that? |
17:36:10 | OnO | see link above, DYLD_LIBRARY_PATH is not respected when using NSCreateObjectFileImageFromFile, so there is no way to tell where the libnimrl.dylib is |
17:37:03 | Araq | OnO: no reason except legacy code. |
17:37:28 | Araq | I took inspiration for this code from Lua iirc |
17:42:12 | * | joelmo quit (Quit: Connection closed for inactivity) |
17:45:17 | OnO | I think we need to remove osx specific code from dyncalls and use just posix dlopen/dlsym |
17:45:28 | OnO | then the DYLD_LIBRARY_PATH will be respected |
17:45:31 | Araq | sure, go head |
17:46:23 | OnO | hmm... just stupid Q, is when defined evaluated in order? |
17:46:33 | Araq | of course |
17:46:39 | yglukhov | wow, i completely missed that there's another impl for mac. so my next question is: isn't defined(posix) on mac? =) |
17:46:44 | OnO | coz there's when defined(posix): then elif defined(windows) finally elif defined(osx): |
17:46:59 | OnO | isn't osx posix? |
17:47:10 | Araq | I think so. let me check |
17:48:31 | yglukhov | so, yeah, mac is posix, and the C code is actually dlopen and not NSCreateObjectFileImageFromFile |
17:48:37 | yglukhov | just checked it |
17:48:45 | Araq | static: |
17:48:46 | Araq | when defined(posix): |
17:48:48 | Araq | echo "yes" |
17:48:55 | Araq | produces yes for --os:macosx |
17:49:09 | yglukhov | OnO, the first question is back =) |
17:54:50 | Araq | maybe DYLD_LIBRARY_PATH is not LD_LIBRARY_PATH |
17:56:12 | yglukhov | DYLD_LIBRARY_PATH works the same way for me. |
17:56:26 | yglukhov | that is, as if not passed to child processes |
17:56:33 | * | Araq wonders if ld_library_path will be allowed in 2450. |
17:57:19 | OnO | argh... nim compiler does not pass it to ran process |
17:57:48 | OnO | DYLD_LIBRARY_PATH=/Users/ono/Code/SDK/Nim/lib nim c -r dy doesn't print anyting where DYLD_LIBRARY_PATH=/Users/ono/Code/SDK/Nim/lib dy does |
17:58:48 | OnO | any reason compiler is not passing full environment to child? |
17:59:19 | Araq | well I guess it just passes NULL as a "pick something reasonable" |
18:00:46 | yglukhov | no. arbitrary environment variables are passed correctly. |
18:00:56 | yglukhov | LD_LIBRARY_PATH is not passed |
18:01:07 | yglukhov | that really looks like system behavior |
18:01:47 | OnO | weird, you mean fork+exec? |
18:02:18 | OnO | oh... oh.... I got it, """The new OS X release 10.11 "El Capitan" has a "security" feature that prevents passing DYLD_LIBRARY_PATH to child processes""" |
18:02:54 | OnO | use DYLD_FALLBACK_LIBRARY_PATH then |
18:03:04 | yglukhov | damnit |
18:03:32 | OnO | fuuu....... fallback neither works |
18:04:36 | OnO | okay, I think we need to simply add -Wl,-rpath, instead |
18:05:03 | OnO | or symlink/copy dylib into test directory |
18:05:27 | OnO | or... compile - then run, not altogether |
18:07:13 | yglukhov | not into test directory, but into current dir, and that's what i've done =) |
18:08:31 | Araq | ha ha ha. ok, so it's a security feature, good to know. you know what's even more secure? not turning on the computer. |
18:17:15 | * | vendethiel joined #nim |
18:17:42 | * | strcmp1 joined #nim |
18:21:16 | * | darkf quit (Quit: Leaving) |
18:27:04 | OnO | dropping DYLD_LIBRARY_PATH makes sense, but removing DYLD_FALLBACK_LIBRARY_PATH is WTF? |
18:27:25 | OnO | DYLD_LIBRARY_PATH is common way to inject stuff eg. replace some libraries |
18:27:42 | OnO | which makes sense for apps because they can run other (eg. system apps) |
18:28:04 | OnO | but DYLD_FALLBACK_LIBRARY_PATH is rather harmless, since it is searched last, so you cannot inject anything with that |
18:29:53 | * | irrequietus quit () |
18:34:13 | OnO | anyway I just propose to separate compile & run in testament, then DYLD stuff won't be cleared and eveything will be ok |
18:41:24 | * | Yaiyan_ is now known as Yaiyan |
18:42:28 | OnO | https://github.com/nim-lang/Nim/pull/3466 - PR to remove dead OSX code from lib/system/dyncalls.nim |
18:44:12 | * | Arrrr quit (Quit: WeeChat 1.2) |
18:45:31 | yglukhov | I've changed my pr to use -rpath |
18:48:30 | yglukhov | Araq, travis is green. |
18:50:36 | * | yglukhov quit (Remote host closed the connection) |
18:56:04 | Araq | wow :-) |
19:00:34 | Araq | OnO: compile and run IS separated in testament, always was. |
19:00:41 | * | UberLambda quit (Quit: GTG) |
19:02:19 | OnO | Araq: so DYLD_LIBRARY_PATH should work then, maybe yglukhov was setting LD_LIBRARY_PATH which doesn't work on OSX? |
19:02:30 | OnO | anyway it's good to know travis is green again |
19:02:41 | Araq | yup |
19:10:52 | * | smodo quit (Remote host closed the connection) |
19:14:39 | * | yglukhov joined #nim |
19:14:59 | NimBot | nim-lang/Nim devel e5aefbd Yuriy Glukhov [+0 ±3 -0]: Fixed tests for TravisCI |
19:14:59 | NimBot | nim-lang/Nim devel da33d5e Andreas Rumpf [+0 ±3 -0]: Merge pull request #3464 from yglukhov/disable-failing-tests... 2 more lines |
19:15:34 | NimBot | nim-lang/Nim devel a02359b Adam Strzelecki [+0 ±1 -0]: system/dyncalls: OS X is already handled as posix... 3 more lines |
19:15:34 | NimBot | nim-lang/Nim devel 705cdf8 Andreas Rumpf [+0 ±1 -0]: Merge pull request #3466 from nanoant/patch/remove-dead-mac-platform-code... 2 more lines |
19:18:19 | yglukhov | DYLD_LIBRARY_PATH does not work either |
19:21:20 | yglukhov | Araq, where can i read about codegenDecl? |
19:22:22 | yglukhov | ok, asking questions before thinking, sorry =) |
19:22:26 | Araq | http://nim-lang.org/docs/nimc.html#additional-features-codegendecl-pragma |
19:26:17 | Araq | so ... who can make travis build the tar.xz ? |
19:30:29 | * | brson quit (Ping timeout: 252 seconds) |
19:42:10 | OnO | dom96 Araq : would be cool if forum mails had html version of reST and a link to the post |
19:42:24 | OnO | is it hackable at nim-forum project? |
19:42:30 | Araq | yes |
19:42:44 | Araq | you could also PLEASE add some spam filter |
19:42:54 | Araq | everything that contains "kitchen" in it. |
19:42:57 | Araq | can't be hard. |
19:43:49 | OnO | :> |
19:44:47 | Araq | well they already started to use ! instead i and use some stupid spacing. |
19:45:02 | Araq | but we can win this fight. |
19:45:20 | Araq | I can imagine a replace(" ", "") call |
19:46:13 | * | ayia_ joined #nim |
19:51:11 | * | edin joined #nim |
19:52:56 | edin | how should threads communicate in nim? |
19:53:03 | * | brson joined #nim |
19:53:11 | edin | i could not find any examples? |
19:54:43 | Araq | I usually use a channel |
19:56:19 | ayia_ | btw, are there any plans to implement something like "go" macro from clojure and go feature from go lang? |
20:00:58 | Araq | there are plans for something that's much better (Rust inspired) but I fear it will have to wait for version 2. |
20:01:45 | ayia_ | interesting... what's the name of this technology in rust? curious to get familiar with... |
20:02:52 | Araq | well Rust uses its lifetime annotations etc to make channels safe. well it's complicated it's not like Rust only gives you channels, it gives you plenty of tools |
20:05:10 | Araq | ayia_: right now we have async IO and a thread pool, but they don't really mix. |
20:05:40 | ayia_ | understood... still did not look into this nim's features... |
20:13:41 | * | brson quit (Ping timeout: 250 seconds) |
20:15:28 | edin | can I share a socket between threads? |
20:15:51 | Araq | only the native sockets cause these are just integer IDs |
20:18:52 | edin | i use net module to create socket |
20:18:57 | OnO | Araq: I know you are probably fed up with that but another PR https://github.com/nim-lang/Nim/pull/3467 making usage go always to stdout (as this isn't diagnostics/error but compiler command output). |
20:19:11 | OnO | now back to nimforum email thing |
20:19:53 | Araq | I will accept this PR if you say right here, right now, that I'm right. |
20:20:27 | Araq | the distinction between stderr/stdout is PITA for a compiler, at least. |
20:21:31 | Araq | and of course it's not a general solution either, cause that would support N streams, not only 2. |
20:21:36 | OnO | yes it is PITA to handle, but has one good advantage of silencing diagnostics with simple 2>/dev/null and leaving output |
20:22:28 | OnO | I know 2 streams to rule them all is not perfect, but still much better than single output :) |
20:22:59 | OnO | just one example/story: somebody is doing nimscript doing some pipe stuff like grep or sed, it is using function X |
20:23:20 | OnO | at Nim v2 function X gets deprecated, so Nim emits the warning |
20:23:39 | OnO | now if the warning goes to stdout if will fuck up the nimscript script output |
20:23:53 | OnO | that's why we need 2 streams, but of course we could get much more of them |
20:23:57 | Araq | well I'm not sure you know how Nimscript works. |
20:24:14 | Araq | Nimscript runs after compilation. it's easy enough to keep them separate. |
20:24:50 | OnO | are you saying that compile stage of nimscript doesn't emit any warnings? |
20:24:55 | Araq | we could also give the compile-time 'echo' a different hook. nimscript works with an API, not with streams. |
20:25:25 | OnO | I know that nimscript is essentially VM only interpreter |
20:25:37 | OnO | but still Nim has to parse all stuff into AST |
20:25:42 | OnO | then execute it |
20:26:11 | Araq | the bytecode is cached and kept in memory. you can compile it and then later run it. |
20:26:54 | OnO | sure sure, all I am saying that 2 streams guarantee us that we don't ruin pipe tool output |
20:27:00 | OnO | and pipes are really useful thing |
20:27:05 | Araq | but I agree anyway that's good to do it like Python does it, to keep unix fans happy. |
20:27:28 | Araq | no, actually, pipes are seriously underpowered. of course they are *very* useful. |
20:27:34 | OnO | eg. we could even feed CC with source code via pipe instead generating intermediate .c files |
20:27:48 | * | brson joined #nim |
20:28:02 | OnO | that will reduce HDD usage and may speed up compile time |
20:28:07 | Araq | yes, very useful. but could easily be replaced with something better. |
20:29:12 | Araq | and how powershell does it is just one out of many possible improvements |
20:30:16 | OnO | I was wondering once about this cache thing, one solution was to keep some pre-compiled AST on disk (this exp feature of Nim) or maybe 2nd is to have nim server for particular project running in the memory keeping all stuff in memory |
20:30:33 | OnO | as long it lives, so long incremental compilation works |
20:30:36 | Araq | been there, done that |
20:30:48 | Araq | that's what "nim caas" mode did. |
20:31:07 | Araq | zahary worked on it but of course we never got it stable |
20:31:37 | Araq | and at the end I decided to build nimsuggest on top of it, focussing only on the IDE aspects of it, not on the incremental code generation |
20:32:29 | OnO | how far this symbol files is from being stable? |
20:32:54 | OnO | I understand symbol files need to be on in order to incremental compilation work? |
20:33:06 | Araq | not really. |
20:33:19 | Araq | you can either try and get the caas mode to work or symbol files. |
20:34:03 | Araq | I recently looked into symbol files and there are a few obvious things left to do before hitting the real bugs. |
20:34:35 | Araq | for example, symbol files don't understand {.deprecated: [foo: bar].} statements |
20:35:23 | Araq | and since I didn't finish the obvious things I cannot tell what hard issues do remain. |
20:39:19 | OnO | dom96: I tried running nimforum, but I got a problem, it returns me empty HTTP response now, also I got some message: [WARNING] Couldn't read config file: ./forum.json |
20:39:27 | OnO | where do I get forum.json from? |
20:43:55 | * | avsej quit (Quit: Quit) |
20:44:46 | * | avsej joined #nim |
20:44:47 | * | avsej quit (Changing host) |
20:44:47 | * | avsej joined #nim |
20:47:29 | * | brson quit (Ping timeout: 250 seconds) |
20:49:07 | NimBot | nim-lang/Nim devel acb6a36 Adam Strzelecki [+0 ±3 -0]: msgs: One msgWriteln with optional flags... 2 more lines |
20:49:07 | NimBot | nim-lang/Nim devel 24731c5 Adam Strzelecki [+0 ±1 -0]: compiler/commands: Always write usage to stdout... 3 more lines |
20:49:07 | NimBot | nim-lang/Nim devel 2dff190 Andreas Rumpf [+0 ±4 -0]: Merge pull request #3467 from nanoant/patch/fuse-msg-api-n-use-stdout-help... 2 more lines |
20:49:31 | * | ayia_ quit (Read error: Connection reset by peer) |
20:51:11 | Araq | how can we get travis to test this PR https://github.com/nim-lang/Nim/pull/3442 again? |
20:51:25 | Araq | seems kinda stupid to not have this in the release |
20:51:35 | * | vqrs quit (Max SendQ exceeded) |
20:51:54 | * | vqrs joined #nim |
20:56:14 | dom96 | OnO: You need to write it yourself. Are you just testing the NimForum? You might not need it. https://github.com/nim-lang/nimforum/blob/master/utils.nim#L16 |
20:57:32 | dom96 | An empty http response sounds bad, perhaps a jester/asynchttpserver regression? |
20:59:17 | Araq | hurray, more async regressions, just what we need. will this ever get stable? |
20:59:57 | * | brson joined #nim |
21:00:05 | * | brson quit (Client Quit) |
21:00:13 | * | brson joined #nim |
21:10:29 | OnO | dom96: jester doesn't work anymore after table[...] raising exception :> |
21:10:49 | OnO | you need to rewrite everything into ugly getOrDefault |
21:10:58 | Araq | I create a PR for jester that does exactly that. |
21:11:11 | Araq | dom96 forgot to merge it. |
21:11:14 | OnO | oh, okay |
21:12:16 | desophos | sdl2_image.loadTexture seems to return a reference to the same texture every time i load the same file. is this a bug in nim sdl2? or expected behavior from sdl2? |
21:12:53 | Araq | never noticed it but SDL2 uses reference counting, so it's allowed to do that I think |
21:13:05 | Araq | you need to free it multiple times then |
21:13:25 | * | nande quit (Remote host closed the connection) |
21:13:46 | desophos | well my issue is that i want multiple copies of the same texture (e.g. for tiles), but when i render one it renders them all |
21:14:40 | desophos | or something like that... i'm not sure exactly what's going on but i think it's related to this |
21:15:04 | dom96 | I didn't like your usage of the let expression in the if, but i'll merge it now anyway. |
21:16:02 | * | strcmp2 joined #nim |
21:16:53 | Araq | yeah well, as I said, if you think it's more important to have beautiful utterly broken code rather than working code ... :P |
21:17:13 | * | yglukhov quit (Remote host closed the connection) |
21:18:45 | desophos | actually that might not be the problem... all my references have different addresses |
21:19:07 | * | strcmp1 quit (Ping timeout: 250 seconds) |
21:19:46 | desophos | wow. yeah that wasn't the problem |
21:20:21 | desophos | i was checking intersection with the src rect instead of the dst rect... |
21:20:47 | OnO | dom96 Araq: btw. we can really have some macro that rewrites x[y] !? z into x.getOrDefault(y, z) |
21:20:49 | Araq | yeah these rectangles are stupid, I wrote a wrapper that does what I think is natural |
21:21:12 | OnO | only problem I have no idea how I can match the macro to only x[y] |
21:21:12 | desophos | Araq, i'm using your wrapper :p |
21:21:42 | Araq | desophos: it's not my wrapper and the code I'm talking about is not open source, so I doubt it. |
21:21:58 | dom96 | OnO: `!?` could be a general operator to catch all exceptions and return `z` if one is caught. |
21:21:58 | Araq | I only maintain it, I didn't write it. |
21:22:04 | desophos | oh okay |
21:22:14 | dom96 | That would probably encourage inefficiency though. |
21:22:17 | desophos | yeah i thought you were referring to https://github.com/nim-lang/sdl2 |
21:22:23 | Araq | speaking of which |
21:22:31 | Araq | let me fix that wrong dependency |
21:22:38 | OnO | dom96: not if we can optimize it |
21:22:55 | Araq | OnO: you can hack it into nimfix |
21:22:56 | OnO | if table.`[]` was a template it would be easy |
21:23:08 | Araq | but it's not clear what you want. |
21:23:12 | dom96 | Araq: You mean the sdl dependency? I fixed it. |
21:23:20 | Araq | oh ok, great. :-) |
21:23:57 | Araq | nevertheless Nimble is over-engineered. > and < make no sense for version checks. |
21:24:05 | Araq | it's always >= and <= |
21:24:22 | Araq | since as I said, exclusive bounds are not constructive. |
21:24:38 | Araq | you need to give a witness. |
21:25:13 | dom96 | Then don't use those operators. Nobody is holding a gun to your head. |
21:25:15 | OnO | idea is to turn: try: if x: y else: raise Ex except Ex: z into: if x: y else: z |
21:26:01 | Araq | OnO: well the point of the change was to break [] to always raise an exception. |
21:26:17 | Araq | now you think getOrDefault is ugly. fair enough. |
21:26:17 | OnO | the problem is that in fact we deal with: try: proc(...) except Ex: z where: proc = if x: y else: raise Ex |
21:26:44 | Araq | but you then skip a couple of thoughts and present us an optimization problem. |
21:26:45 | OnO | Araq: nah I don't care about if it is ugly or not, I am thinking about how to make Nim to be compact and expressive |
21:27:03 | OnO | I don't like that we need 2 versions of throwing or not throwing |
21:27:16 | OnO | this makes everything bloated |
21:27:34 | Araq | the solution is rather simple though |
21:28:02 | dom96 | Just tested Jester. Still works. |
21:29:05 | OnO | I want to be able to write compact syntax: let x = hash["X"] or defaultX |
21:29:32 | dom96 | that would be nice |
21:29:53 | OnO | same goes to let x = newSuperDupaObj(x) or newStdObj(x) # when 1st fails |
21:30:07 | Araq | yes exactly. |
21:30:13 | Araq | so that's 1 `or` template. |
21:30:39 | Araq | and oohh! |
21:30:50 | Araq | the wise designer of Nim foresaw this requirement |
21:30:59 | Araq | and made 'try' available as an expression. |
21:31:01 | OnO | I am all ears |
21:31:08 | Araq | is that crazy or what? |
21:31:37 | OnO | I know try is an expression, but we get back to squre one that raising and catching is pricey |
21:32:11 | OnO | how we can optimize-out this raise&catch knowing we gonna catch anyway soon |
21:32:29 | Araq | that's a TR macro. |
21:32:41 | dom96 | Pity `[]` doesn't return an Option[T] |
21:33:08 | Araq | or you can optimize it in the backend, but then you need to be able to inline things |
21:33:12 | dom96 | Will it be broken in a couple of months again? |
21:33:22 | Araq | no. |
21:33:44 | OnO | dom96: the option thing seems to be very sexy, can we discuss it for a moment? |
21:33:45 | Araq | it will never return Option[T] because that is a) tedious to use |
21:33:53 | OnO | so it would raise only when dereferenced, right? |
21:33:57 | Araq | and b) not compatible with Python. |
21:34:02 | OnO | and when there's nothing inside? |
21:34:19 | OnO | but not raise when compared against false? |
21:34:25 | ephja | what about COBOL? |
21:34:43 | Araq | and the dissimilarity to Python is what actually caused bugs and made me change it. |
21:35:05 | Araq | it also doesn't help that the 'var' version of [] really needs to throw anyway. |
21:35:07 | * | pregressive quit () |
21:35:13 | OnO | Araq: you know, now it is dissimilar to Ruby and ObjC :P |
21:35:32 | Araq | Ruby doesn't raise a key missing exception? are you kidding me? |
21:35:48 | OnO | nope, it returns nil |
21:35:56 | OnO | same as ObjC |
21:36:06 | OnO | and you know what iOS and OSX works |
21:36:08 | Araq | interesting, but we don't have a nil for every type anyway |
21:36:18 | OnO | but I haven't seen OS based on Python yet |
21:36:30 | dom96 | It's a bit odd to have modules which do return an Option[T] and others which raise exceptions in the standard library. |
21:36:39 | Araq | no, it is not. |
21:36:41 | Araq | omg. |
21:36:52 | OnO | Araq: yes that's the problem, in ObjC hashes can store only object types, in Ruby everything is object type |
21:36:56 | Araq | that's why I argued against Option[T]. |
21:37:14 | Araq | because I knew discussions like these would come up. |
21:37:33 | Araq | again, option[t] is simply not convenient to use. and it's slower too. |
21:37:54 | Araq | and arrays don't return Option[T] either, they raise an IndexError. |
21:38:13 | Araq | and again, exceptions do not do the same thing as Option[T]. |
21:38:44 | Xe | even haskell has exceptions :) |
21:38:53 | OnO | Araq: I know it is slower... that's why I am thinking about our secret operator rewriting `[]` into `getOrDefault` when it is present (compilable) |
21:38:57 | Araq | and even Haskell has exceptions. |
21:39:28 | OnO | and then fallback to simple try catch when you can't optimize out it |
21:39:29 | Araq | and why or why can nobody understand the difference between O(1) and O(calling depth) |
21:39:52 | Araq | you cannot simply compare two code snippets, one that uses exceptions and one that doesn't. |
21:40:19 | Araq | exceptions alter the control flow! There is good things about that, there is bad things about that. |
21:40:35 | Xe | sometimes if things are decently fucked up |
21:40:39 | Xe | you want to alter the control flow |
21:40:52 | Xe | "I can't allocate memory, gtfo" |
21:41:24 | Araq | the designers of C++ and Ada were not morons that never heard about Option[T] and so they added exceptions to these languages. |
21:43:25 | * | strcmp2 quit (Ping timeout: 240 seconds) |
21:44:11 | OnO | I think you are mixing two different things, exceptions are not replacable by options |
21:44:27 | OnO | exceptions are for errors, options are for non-error missing value |
21:45:12 | OnO | now let = hash["XXX"] sounds like error because we are not really interested if the value is there |
21:45:56 | OnO | let x = hash["XXX"] or defX: is not an error, because developer expects that value is missing, so we shouldn't do it exception way |
21:46:50 | OnO | exceptions are usually sinked somewhere at the run-loop level, where options are used were tights, usually not escaping the frame |
21:46:56 | dom96 | Actually, I just realised that in the case of a Table[T] you would likely be checking for the existence of the key ahead of time. |
21:47:01 | Araq | OnO: it's offtopic but there was a python based OS in development. it died, not sure how far they got. |
21:47:02 | dom96 | Instead of relying on the error. |
21:47:42 | Araq | dom96: the only thing that is bad about the new getOrDefault is that it is verbose. It does exactly the right thing for jester though. |
21:48:04 | Araq | so IMO we're only talking about syntax here, its semantics are perfect for its use case. |
21:48:16 | OnO | Araq: for me it is not verbose enough, because I still need to look somewhere else to see what is the default |
21:48:56 | Araq | OnO: well but in the usual case which is tab.getOrDefault"key" == "foobar" you don't have to know |
21:49:11 | Araq | as both nil and "" compare to "foobar" as false. |
21:49:33 | dom96 | sure, but I think I will end up using: if x.hasKey(key): x[key] else: "", more often. |
21:50:00 | dom96 | I have thought about a wrapper for exceptions which returns an Option[T] |
21:50:06 | Araq | but sorry, that's just your personal taste. |
21:50:45 | Araq | I see nothing wrong with if (let y = x.getordefault"key"; y.len > 0): use(y) |
21:50:55 | OnO | Araq: tab.getOrDefault"key" == "foobar" still sucks because it should bail out with false when there is no value |
21:51:07 | Araq | hurm? |
21:51:20 | OnO | but in fact it takes default "" and compared to "foobar", pretty many CPU cycles lost |
21:51:53 | Araq | that's a good point. |
21:52:29 | Araq | so we actually want tab.keyOf("key", "foobar") |
21:52:48 | Araq | or a TR macro to spice it up |
21:54:12 | Araq | dom96: and the wrapper you speak of should really be added as a template to the optional module or whatever it is called |
21:54:43 | OnO | one question, why there needs to be an exception on: if tab["key"] == "foo": |
21:54:50 | OnO | for me it looks like not an error |
21:54:52 | dom96 | Araq: You think I should add it? |
21:55:00 | OnO | and it has to be false, because there is no value |
21:55:09 | Araq | yeah go ahead. you can even make it use 'concept' |
21:55:22 | Araq | 'concept' is getting good enough these days (I hope) |
21:55:27 | OnO | but let x = tab["key"] IMHO has to raise when there's no key |
21:55:37 | * | Guest46705 is now known as Guest46705isaway |
21:56:08 | OnO | I think we then don't need defaults or anything |
21:56:24 | Araq | OnO: well but this kind of crazy context dependency is just your personal taste. I can see the merits but it's just too inconsistent |
21:57:22 | Araq | only Perl does these kinds of stunts and Perl got a pretty bad reputation for it. |
21:57:29 | OnO | Araq: imagine that we are not stricly typed, and when there's no key we get some magic NotFound value |
21:57:41 | OnO | NotFound always returns false when compared to anything |
21:57:49 | OnO | but cannot be assigned to anything |
21:58:22 | Araq | but let foo = tab["key"] is not an assignment. |
21:58:34 | Araq | it's a simple substitution. |
21:58:52 | Araq | technically it is an assignment, but formal semantics disagree |
22:00:41 | dom96 | Interesting. According to TIOBE, Rust is more popular than Go. |
22:00:58 | Araq | but ok, your argument makes sense anyway. but what does it mean for Nim? Nim is not dynamically typed. |
22:01:16 | Araq | we don't have a NotFound available. |
22:02:38 | Araq | what? and Delphi is at 11? |
22:03:28 | dom96 | indeed |
22:04:18 | Araq | and assembly language comes after it? |
22:04:27 | Araq | that's just absurd. |
22:04:34 | Araq | no data is better than this data. |
22:05:08 | Araq | also they still split "Pascal" and "delphi". |
22:05:28 | OnO | just some inspiration from ObjC... I'd write if tab["key"].length, when to "key" it returns nil, nil returns 0 length, no temporary object created |
22:05:32 | Araq | which indicates they have not the slightest clue about what they are actually trying to measure |
22:06:21 | OnO | now If getOrDefault returned nil and instead comparing == "" we did: if tab.getOrNil"key".empty then it would be quicker already |
22:06:47 | Araq | btw 'len' returns 0 for 'nil' nowadays. |
22:06:56 | Araq | we could make it return nil. |
22:07:04 | OnO | but nil != "" |
22:07:12 | Araq | and the comparison always could handle nil too. |
22:07:22 | OnO | so all jester checks shouldn't compare to "" but check length of 0 |
22:07:39 | Araq | well ok, yes. |
22:07:48 | Araq | wasn't aware they do check against "" |
22:08:14 | OnO | lot of result.headers["Cookie"] != "" |
22:08:52 | OnO | but in fact headers.hasKey"" is not enough |
22:09:07 | Araq | well there is also the C++like small string optimization we could implement, then "" would not allocate anymore. |
22:09:18 | OnO | I mean headers.hasKey"Cookie" is not enough, because the value stored may be empty too |
22:09:53 | Araq | yeah, but that has always be a problem then with the hasKey coding style |
22:10:07 | Araq | which dom96 seems to like :P |
22:10:20 | OnO | yeah, I deal with that thing everyday writing these iOS apps using JSON HTTP apis |
22:11:31 | OnO | if you want to hear scary thing for the nights, the JSON deserialized container can on j["someKey"] return you nil or NSNull singleton instance :> |
22:11:36 | OnO | these both are different cases |
22:12:03 | OnO | 1st no value for that key at all, 2nd there is value of JSON's nil for that key |
22:12:07 | OnO | pretty fucked up |
22:12:25 | Araq | this is another argument against Option[T], you often need to check for s.len > 0, 'some' value doesn't cut it |
22:15:20 | OnO | yeah, I wish everything could happen at optimization level, leaving simple and nice syntax |
22:16:04 | OnO | for some newbie programmer or mathematician headers["HOST"] != "" is more clear than headers.getOrNil"Host".empty |
22:16:05 | Araq | but optimizations cannot eliminate corner cases and it's the corner cases that people get wrong and must be available |
22:16:22 | OnO | also such syntax is imho better for eyes |
22:16:35 | Araq | but I agree with you. |
22:16:58 | Araq | headers["Host"] != "" is the best syntax and a clear composition of concepts. |
22:17:03 | OnO | that's why I fucking hate Java, and avoid it by all means |
22:17:30 | Araq | it's unfortunately also wrong. so your optimization becomes a "do what I mean" *transformation* |
22:17:47 | OnO | true |
22:18:10 | OnO | by isn't the holy grail of programming languages to have expressiveness of spoken or math language? |
22:18:33 | OnO | and for spoken lang context matters |
22:20:54 | dom96 | FWIW .len used to crash on nil, and I preferred that behaviour. |
22:20:59 | dom96 | Returning 0 is too subtle. |
22:21:43 | dom96 | Suddenly you have `$` for seq[T] returning "@[]" for `nil`. |
22:21:44 | * | FroznPanda joined #nim |
22:22:04 | OnO | that's why Nim needs to have Nilable working |
22:22:30 | OnO | and proc arguments not be nillable by default |
22:22:37 | OnO | only when expressed explicitly |
22:22:57 | OnO | right now you never know what will happen when you put nil |
22:23:24 | * | Kingsquee joined #nim |
22:23:30 | Araq | actually you can be pretty sure that it crashes. |
22:23:51 | Araq | except ofc for 'len' which was perhaps a misguided attempt to make the language more user friendly |
22:24:10 | * | thotypous quit (Ping timeout: 240 seconds) |
22:27:33 | OnO | Araq: we you thinking about pointer tagging for some objects? |
22:27:46 | OnO | eg "" |
22:28:36 | OnO | I forgot, strings are mutable or immutable in Nim ? :P |
22:28:38 | Araq | nope. pointer tagging is never on my radar, because bad C interop and the GC needs to be aware of it too |
22:29:06 | Araq | Nim's strings are byte buffers and so mutable like the whole rest of the language |
22:29:29 | Araq | they are immutable as parameters and 'let's like the whole rest of the language. |
22:29:51 | Araq | they were designed -- guess it -- to be consistent with the whole rest of the language. |
22:30:18 | Araq | it's the one design aspect in Nim where I went for consistency over speed. |
22:30:51 | Araq | and it likely was the wrong decision but it's not like the alternative designs don't have they own problems too. |
22:31:09 | Araq | *their own |
22:31:20 | OnO | yeah, I know |
22:31:20 | * | vendethiel quit (Ping timeout: 246 seconds) |
22:32:28 | Araq | however, I knew we could always introduce Delphi-like or C++-like optimizations under the hood and make them as fast as they are in these languages |
22:32:59 | Araq | so ... it's perhaps still the best design out there. |
22:35:49 | OnO | yeah C++ optimizations are pretty cool, only compile time TR suck because of templates, I tend to writie everything as inline (class body) methods so the compiler can optimize everything |
22:36:35 | OnO | this comes to 2nd aspect of Nim, when Nim system lib procs should be template, when proc or maybe proc {.inline.} |
22:37:14 | Araq | I used to prefer .inline procs, but templates can be faster still, so in doubt, use a template |
22:38:06 | Araq | also we need to remove lists.nim from the stdlib and replace it with a template based solution. much more flexible. |
22:38:10 | ephja | are the optimizers that bad at deciding when to inline? |
22:38:33 | OnO | but some of short stuff like data container accessors should be inline? |
22:38:46 | Araq | ephja: no, but .inline means the C compiler gets to inline it which is not aware of Nim's semantics |
22:39:06 | Araq | Nim can optimize Nim code better than the C compiler. ;-) |
22:39:10 | ephja | ok |
22:39:59 | Araq | OnO: arguably especially these should be templates |
22:40:19 | Araq | since they give you the var/non-var versions for free |
22:40:39 | OnO | looking at tables.nim, `[]` embeds get (a template) which calls rawGet which embeds rawGetImpl |
22:40:58 | OnO | I think either `[]` or rawget should be template |
22:43:02 | Araq | perhaps but be aware that compilers are very bad at de-inlining stuff when you try to optimize for code size |
22:43:35 | OnO | okay then all rawSomething should be {.inline.} |
22:44:18 | Araq | well but usually I don't use .inline and trust the C compiler to find inline opportunities on its own. |
22:44:19 | * | pregressive joined #nim |
22:44:44 | Araq | link time optimizations are available for all big C compilers. |
22:44:47 | OnO | not sure if they do unless O3? |
22:45:13 | Araq | tables.nim in particular was optimized by an expert, so don't touch it. |
22:45:39 | Araq | he looked at the cache misses and instruction scheduling. |
22:45:55 | Araq | you can be sure he would have noticed if there was some .inline missing. |
22:47:41 | OnO | but all modules lives in separate compilation units? |
22:47:44 | OnO | s/lives/live |
22:48:54 | OnO | nevermind, I need to go get some sleep |
22:49:00 | OnO | good night |
22:50:19 | Araq | no, they don't. .inline procs are duplicated for the poor C compilers who don't use link time optimizations |
22:51:04 | * | FroznPanda quit (Read error: Connection reset by peer) |
22:52:35 | * | FroznPanda joined #nim |
22:54:17 | * | elrood quit (Quit: Leaving) |
22:56:29 | * | edin quit (Quit: leaving) |
22:57:00 | * | edaaa__ joined #nim |
23:13:45 | * | gokr quit (Ping timeout: 240 seconds) |
23:15:49 | * | Kingsquee quit (Quit: http://i.imgur.com/EsXzoum.png) |
23:17:05 | * | keypusher quit (Quit: Konversation terminated!) |
23:17:20 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:17:21 | * | desophos quit (Ping timeout: 255 seconds) |
23:18:00 | * | keypusher joined #nim |
23:28:27 | * | desophos joined #nim |
23:29:12 | * | Trustable quit (Remote host closed the connection) |
23:30:48 | * | thotypous joined #nim |
23:36:45 | * | vqrs quit (Max SendQ exceeded) |
23:37:36 | * | vqrs joined #nim |