00:05:18 | * | stisa quit () |
00:10:28 | niv | krux02: https://github.com/niv/ed25519.nim |
00:10:51 | niv | its on nimble. installing it via nimble install ed25519 will not allow you to just go "import ed25519" and have it compile |
00:15:01 | * | hcorion quit (Quit: Konversation terminated!) |
00:31:24 | * | Matthias247 quit (Read error: Connection reset by peer) |
00:41:50 | * | vlad1777d quit (Quit: Leaving) |
00:49:17 | krux02 | niv: I don't have problems with "nimble install ed25519" it just compiles fine |
00:55:06 | * | dv- quit (Ping timeout: 240 seconds) |
00:56:06 | * | def-pri-pub joined #nim |
00:56:46 | * | dv- joined #nim |
00:56:52 | * | [ui] joined #nim |
01:15:11 | * | sz0 joined #nim |
01:21:13 | * | couven92 quit (Quit: Client disconnecting) |
01:28:57 | * | aedigix quit (Remote host closed the connection) |
01:29:06 | demi- | hmmm, is there something out there for nim that does what the "cmd" module does for python? (looking for an interactive command line prompt) |
01:29:22 | * | aedigix joined #nim |
01:45:34 | cheatfate | demi-, biggest part of packages nim has are inside of https://github.com/nim-lang/packages/blob/master/packages.json |
01:50:12 | * | yglukhov joined #nim |
01:54:42 | * | yglukhov quit (Ping timeout: 252 seconds) |
01:57:49 | Xe | this weekend, i'm gonna build something in nim |
01:58:50 | Xe | i'm gonna build a crud app / wiki for a community i'm in |
02:07:35 | * | chemist69 quit (Ping timeout: 264 seconds) |
02:12:04 | * | chemist69 joined #nim |
02:22:03 | * | chemist69 quit (Ping timeout: 276 seconds) |
02:23:12 | * | gokr quit (Quit: Leaving.) |
02:32:02 | demi- | cheatfate: thanks, i don't see anything in there based on the description, which means i get to implement it myself :) |
02:35:03 | * | chemist69 joined #nim |
02:52:17 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:06:36 | * | [ui] quit (Quit: Connection closed for inactivity) |
03:07:17 | * | brson quit (Quit: leaving) |
03:18:43 | * | kulelu88 quit (Quit: Leaving) |
03:20:10 | * | Trioxin quit (Ping timeout: 240 seconds) |
03:20:39 | * | Trioxin joined #nim |
03:52:13 | * | yglukhov joined #nim |
03:56:22 | * | krux02 quit (Remote host closed the connection) |
03:57:30 | * | yglukhov quit (Ping timeout: 240 seconds) |
04:09:47 | * | sz0 quit (Quit: Connection closed for inactivity) |
04:33:31 | * | def-pri-pub quit (Quit: leaving) |
05:06:55 | * | dyson joined #nim |
05:07:08 | * | Trioxin quit (Ping timeout: 255 seconds) |
05:07:18 | * | dyson is now known as Guest67728 |
05:12:09 | * | bjz joined #nim |
05:12:33 | * | bjz quit (Client Quit) |
05:54:51 | * | yglukhov joined #nim |
05:59:20 | * | yglukhov quit (Ping timeout: 255 seconds) |
06:46:32 | * | Guest67728 quit (Quit: Konversation terminated!) |
06:50:11 | * | gokr joined #nim |
06:53:50 | * | nsf joined #nim |
06:55:43 | * | bjz joined #nim |
06:59:53 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
07:21:19 | * | bjz joined #nim |
07:23:38 | * | Matthias247 joined #nim |
07:30:54 | * | Matthias247 quit (Read error: Connection reset by peer) |
07:34:24 | * | Matthias247 joined #nim |
07:38:41 | * | Matthias247 quit (Read error: Connection reset by peer) |
08:05:03 | * | rokups joined #nim |
08:08:23 | * | chemist69 quit (Quit: WeeChat 1.6) |
08:19:06 | * | Guest89004 joined #nim |
08:23:42 | * | yglukhov joined #nim |
08:26:37 | * | chemist69 joined #nim |
08:29:40 | * | yglukhov_ joined #nim |
08:30:10 | * | yglukhov quit (Read error: Connection reset by peer) |
08:37:28 | * | Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif) |
08:49:01 | * | yglukhov_ quit (Remote host closed the connection) |
09:04:58 | * | yglukhov joined #nim |
09:23:05 | * | Andris_zbx joined #nim |
09:31:47 | * | yglukhov quit (Remote host closed the connection) |
09:34:07 | * | couven92 joined #nim |
09:42:58 | * | Ven joined #nim |
09:49:09 | * | Guest89004 quit (Ping timeout: 260 seconds) |
09:56:25 | * | yglukhov joined #nim |
10:04:16 | * | yglukhov quit (Remote host closed the connection) |
10:04:48 | * | yglukhov joined #nim |
10:09:06 | * | yglukhov quit (Ping timeout: 240 seconds) |
10:11:30 | * | bjz quit (Ping timeout: 240 seconds) |
10:12:51 | * | bjz_ joined #nim |
10:13:46 | * | PMunch joined #nim |
10:23:57 | * | Guest89004 joined #nim |
10:35:28 | Araq | https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/oopsla065-burckhardt.pdf |
10:37:26 | * | Guest89004 quit (Ping timeout: 248 seconds) |
10:38:01 | * | yglukhov joined #nim |
10:40:17 | * | yglukhov quit (Remote host closed the connection) |
10:46:47 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:52:56 | * | arnetheduck joined #nim |
11:10:12 | * | MrAxilus[m] quit (Remote host closed the connection) |
11:10:12 | * | jivank[m] quit (Remote host closed the connection) |
11:10:12 | * | hohlerde quit (Read error: Connection reset by peer) |
11:10:13 | * | ehmry quit (Read error: Connection reset by peer) |
11:10:13 | * | Guest73656[m] quit (Read error: Connection reset by peer) |
11:10:13 | * | dyce[m] quit (Write error: Connection reset by peer) |
11:10:13 | * | erwana[m] quit (Remote host closed the connection) |
11:10:13 | * | TheManiac quit (Write error: Connection reset by peer) |
11:10:13 | * | M-Quora quit (Write error: Connection reset by peer) |
11:11:31 | * | zevlg quit (Remote host closed the connection) |
11:23:36 | * | dyce[m] joined #nim |
11:24:47 | * | yglukhov joined #nim |
11:41:16 | * | Kingsquee joined #nim |
12:01:07 | * | Vladar joined #nim |
12:02:53 | * | Snircle joined #nim |
12:04:46 | * | jivank[m] joined #nim |
12:04:46 | * | hohlerde joined #nim |
12:04:47 | * | MrAxilus[m] joined #nim |
12:04:48 | * | M-Quora joined #nim |
12:04:50 | * | ehmry joined #nim |
12:04:53 | * | erwana[m] joined #nim |
12:04:54 | * | Guest73656[m] joined #nim |
12:04:55 | * | TheManiac joined #nim |
12:14:44 | * | Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif) |
12:27:49 | * | yglukhov quit (Remote host closed the connection) |
12:31:20 | * | yglukhov joined #nim |
12:32:21 | * | yglukhov_ joined #nim |
12:32:21 | * | yglukhov quit (Read error: Connection reset by peer) |
12:35:03 | * | Ven joined #nim |
12:47:52 | * | plm joined #nim |
12:47:55 | plm | Hi all |
12:58:10 | ftsf | o/ yo |
12:58:11 | * | yglukhov_ quit (Remote host closed the connection) |
12:59:01 | * | yglukhov joined #nim |
13:03:41 | * | yglukhov quit (Ping timeout: 255 seconds) |
13:12:51 | demi- | how do i properly forward-declare this so that the type and the proc declaration are satisfied? https://gist.github.com/samdmarshall/9319a361eb0ba14a8e3f62683fecc547 |
13:13:26 | Vladar | demi-: place it under one type block |
13:15:43 | demi- | ah, and that will scope it correctly that the order doesn't matter? |
13:16:15 | demi- | wow, neat! thanks very much Vladar |
13:17:38 | * | arnetheduck quit (Ping timeout: 255 seconds) |
13:17:46 | Vladar | np |
13:27:00 | * | arnetheduck joined #nim |
13:29:00 | cheatfate | demi-, is your `micro` supports nim color syntax? |
13:29:18 | * | yglukhov joined #nim |
13:34:08 | demi- | I opened a PR for it yesterday, i took a stab but may have missed a few things |
13:43:01 | cheatfate | it will be awesome if you accept your PR, because i dont like to setup GO on all of my VMs |
13:44:48 | demi- | micro isn't my project, just one i contribute to, if you want to see how it looks in my local copy: http://magic.pewpewthespells.com/iv6s |
13:46:06 | cheatfate | demi-, looks very good, i like it |
13:46:12 | cheatfate | but you have problems with your code :) |
13:46:32 | demi- | haha, that's what happens when you leave your editor while you are in the middle of writing code |
13:46:33 | cheatfate | `var string` is usable only in procedure declaration |
13:46:51 | cheatfate | i mean `var Table`, `var bool` |
13:47:01 | cheatfate | and `var string` in your type declaration |
13:48:12 | cheatfate | if you want to store reference only, you need to make it `ref` or `ptr` |
13:48:43 | demi- | ah, so by using a ref i'd be able to change what value is "assigned" to it? |
13:48:59 | cheatfate | yep |
13:49:20 | cheatfate | but you also be able to change it without `ref` too |
13:49:34 | * | hendi_ joined #nim |
13:49:47 | flyx | demi-: you can also change the value if it is not a ref. but if it is a ref, the string object will not be copied if you do a shallow copy (typically, assignment) of a variable of the CmdPrompt typ |
13:49:48 | flyx | e |
13:50:39 | demi- | there might be a bug in the nim linter then, the bool property of the CmdPrompt object wouldn't let me assign a new value to it, then i added the "var" and it stopped complaining. |
13:51:48 | flyx | well, inside builtinHelpCommand, ctx is a `CmdPrompt` parameter which makes it read-only. you could make ctx `var CmdPrompt` if you need to change it (and the changes should propagate to the calling site) |
13:51:58 | * | bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
13:52:23 | flyx | ah, that's builtinQuitCommand where you change activePrompt |
13:52:24 | demi- | aaah, i see |
13:53:09 | demi- | yeah, if i leave off "var" on the bool property it complains, add the var to the bool property and it thinks it is ok; idk, is that a bug with `nim check`? |
13:53:40 | flyx | may well be. the syntax like you have it should not compile because `var Type` is only defined for parameter or return types |
13:53:49 | flyx | but Araq probably knows better |
13:54:56 | demi- | also, for the builtinQuitCommand, if i have the CmdPrompt parameter use "var" will that change be applied to only the scope of that call or will the object retain those changes afterwards as well? |
13:55:22 | flyx | `var` basically makes the parameter by-reference instead of by-value |
13:55:39 | flyx | so it just applies to the calling context of this proc |
13:56:19 | demi- | so i would need to pass in a reference to this object to make it retain the changes outside of the scope of the function call |
13:56:31 | flyx | i.e. if you pass a ctx object to a `var` parameter, changes to that value inside the proc will be reflected in the passed variable after the call |
13:56:48 | demi- | oh, ok, cool. |
13:57:48 | flyx | it's like & in C++ or `ref` in C# or `byref` in VB |
13:58:11 | demi- | yeah, i was hoping that was the case, thank you |
13:59:12 | * | nsf quit (Quit: WeeChat 1.7) |
13:59:20 | demi- | also wondering if there is a formal way to test nim packages without putting an additional nim file into the repo with the rest of the package (because that seems to cause erroneous messages when doing `nimble install`)? |
14:00:19 | flyx | you can put testing code right into the module inside a `when isMainModule:` block |
14:01:22 | flyx | but you can also set up separate test modules. there are no conceptual problems with nimble and test code, you may just have an errenous setup |
14:03:48 | flyx | might go away by just moving test code into a `test` or `tests` directory |
14:04:41 | demi- | for example: https://gist.github.com/samdmarshall/a709b6425f5cf06849b721b63fb4fccc (this is something i've seen with a number of packages) |
14:06:12 | flyx | ah yes. the reason is that for all packages you installed with nimble, you can `import foo` for any foo.nim in the main directory of the package. so if y |
14:06:19 | flyx | whoops |
14:06:39 | flyx | *so if people put additional files into the main directory, global namespace gets cluttered by name clashes |
14:07:03 | flyx | therefor, somewhen in the future, nimble will disallow any nim files in the root dir that are not named identically to the package name |
14:07:48 | flyx | the hint tells you what you can do. for example, tell nimble not to distribute that file with `skipFiles` |
14:07:59 | demi- | ah, is if i make a "tests" directory in the root of my nimble package, then that will be ignored and i'd just do `include "../foo.nim"` to access the package |
14:08:47 | flyx | well I am not sure whether the tests directory will be ignored automatically (would probably be a sensible thing), but even if not, you would need to `import tests/foo.nim` to include that file |
14:09:11 | flyx | but yes, moving it into tests and `import ../foo.nim` is the way to go |
14:09:36 | flyx | you can still disable tests from being distributed by adding the folder to `skipFiles`, I think |
14:09:51 | demi- | ok, cool. thanks |
14:10:03 | * | yeeve quit (Quit: Leaving) |
14:12:10 | flyx | I only publish packages, never look at what happens when people install them ^^ |
14:12:42 | * | yglukhov quit (Remote host closed the connection) |
14:18:30 | demi- | what does this message mean? "template/generic instantiation from here" is it just informative or am i doing something wrong? |
14:18:39 | * | yglukhov joined #nim |
14:18:48 | flyx | it usually occurs after a line which describes an error |
14:19:04 | Araq | no, before. |
14:19:11 | flyx | ah, okay |
14:22:18 | yglukhov | Araq: do you have any concerns if do() may be used as expression? let a = do(): echo "hi" |
14:23:56 | demi- | this is the output I am getting: https://gist.github.com/samdmarshall/4302ba8ab1a736ff5613fe0ea58257b8 from this code: https://gist.github.com/samdmarshall/80722b6af0ef4201749382e853ae754b -- I don't understand what it is trying to tell me |
14:25:36 | cheatfate | something wrong with line "let new_command_hooks = { "cmd": execCallback, "help": help_hook, "pre": pre_hook, "post": post_hook }.toTable" |
14:25:50 | cheatfate | and error happens deeper inside of Table[] code |
14:28:00 | flyx | demi-: seems to be a problem in the tables.nim module |
14:28:30 | flyx | the „template/generic instantiation from here“ lines belong with the succeeding warning lines |
14:28:37 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:29:44 | demi- | i'm using 0.16.0, does this mean there is a problem with tables package of the stdlib? |
14:30:25 | cheatfate | there is warning because demi storing callbacks |
14:30:41 | cheatfate | which are not marked as {.gcsafe.} |
14:31:10 | flyx | try to add {.gcsafe.} to line 34 |
14:31:20 | flyx | probably not a problem in tables |
14:33:29 | demi- | ypu, that fixed it, thanks |
14:33:32 | flyx | I also suggest to use the `result` variable directly in line 61 ff. there is no need to use another variable and assign it to `result` in the end |
14:33:45 | cheatfate | demi-, http://nim-lang.org/docs/manual.html#threads-gc-safety |
14:33:52 | * | Ven joined #nim |
14:56:33 | * | yglukhov quit (Remote host closed the connection) |
14:56:51 | * | vlad1777d joined #nim |
14:56:52 | * | xet7_ joined #nim |
15:04:09 | * | xet7 quit (Ping timeout: 260 seconds) |
15:04:17 | * | xet7_ quit (Ping timeout: 255 seconds) |
15:07:07 | * | rupil joined #nim |
15:09:55 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:11:23 | * | yglukhov joined #nim |
15:14:32 | * | Sembei joined #nim |
15:15:25 | yglukhov | Araq: i remember there was type extension feature in Nim, but now can't find evidence of it. Is it still there? |
15:16:44 | * | Ven joined #nim |
15:17:11 | * | Pisuke quit (Ping timeout: 240 seconds) |
15:25:07 | demi- | is there a way to allow some functions to be called from outside of a module and not others? |
15:25:33 | subsetpark | demi-: all procs are private by default, put a * after the name of the proc to allow it to be called from outside the module |
15:25:55 | demi- | aaah, that is very nice |
15:26:04 | subsetpark | Types work the same way :) |
15:27:22 | * | Jesin quit (Quit: Leaving) |
15:29:24 | * | Jesin joined #nim |
15:31:36 | * | xet7 joined #nim |
15:36:53 | Araq | yglukhov: annotate the object with .partial and in some other module do |
15:37:06 | Araq | type OriginalModule.TypeToExtend = object ... |
15:37:16 | Araq | but that has known bugs |
15:37:28 | Araq | I still like the feature though and don't want to remove it |
15:37:33 | yglukhov | Araq: so i have to know that my type is gonna be extended in advance? |
15:37:41 | Araq | yup |
15:37:50 | yglukhov | ahh. thats unfortunate... |
15:38:04 | Araq | no, that's just good design |
15:38:10 | yglukhov | yeah yeah |
15:38:14 | Araq | :P |
15:39:27 | Araq | about let a = do(): echo "hi" |
15:39:31 | Araq | what's wrong with it? |
15:39:44 | yglukhov | expression expected, but found "do" |
15:39:58 | yglukhov | parse error |
15:40:09 | * | yeeve joined #nim |
15:41:00 | Araq | ah yeah, probably 'do' is an expression "annotation", it cannot stand on its own |
15:41:41 | Araq | yeah, it cannot work, would produce ambiguities everywhere |
15:42:11 | Araq | foo do: |
15:42:13 | Araq | bar |
15:42:23 | yglukhov | Araq: regarding type extensions. I've been thinking of how to implement weak refs in library code. so that a weak ref could be created for any object type. and so that you might not control the type definition of which you're taking the weak ref. |
15:43:02 | yglukhov | and type extensions seemed like a perfect solution except the "no control" part. |
15:43:15 | Araq | is this foo(do: (bar)) or (foo do:)(bar) |
15:43:55 | Araq | WeakRef[T] ? |
15:44:02 | yglukhov | (foo do:)(bar) dosnt look like valid code... |
15:44:15 | yglukhov | WeakRef[T]? whats that? |
15:44:31 | Araq | yes it isn't valid code but it's how it's parsed currently |
15:45:06 | Araq | in no language weakrefs are created with partial classes. |
15:45:19 | Araq | it's just another container / generic type. |
15:45:56 | yglukhov | Araq: do you see a way to implement it currently? |
15:46:07 | yglukhov | WeakRefs, i mean |
15:46:15 | yglukhov | or does it already exists? |
15:46:29 | Araq | I showed how to do them 8 years ago |
15:46:37 | Araq | they are in some test case |
15:47:28 | Araq | tests/gc/weakrefs.nim |
15:48:23 | Araq | ah ok, that doesn't use generics |
15:48:23 | yglukhov | yep, found it, but its not fair |
15:48:53 | yglukhov | it only works for types which are intended to be weakrefed |
15:49:21 | yglukhov | and i want a completely decoupled solution |
15:51:40 | Araq | well it depends on the semantics |
15:52:29 | Araq | you have to watch out your "decoupled" solution is not a single huge ABA problem |
15:53:50 | Araq | consider this: ref X. you turn it into weakref X. you don't use the weakref for a long time. |
15:53:56 | yglukhov | proc weak[](ref T): WeakRef[T]; let wr = weak(myInstance); let strongRef = wr.get(); if strongRef.isNil: ... |
15:54:06 | Araq | ref X gets recycled. |
15:54:16 | Araq | the same memory gets used for a new object of the same type. |
15:54:30 | Araq | you access it via the old weakref. |
15:54:44 | Araq | no crash, no corruption, just a logical error. |
15:54:45 | yglukhov | no, you're talking about pointers, not weakrefs. |
15:54:58 | yglukhov | weakrefs would become nil upon finalization |
15:55:23 | Araq | ah ok, that's good |
15:55:45 | Araq | so you need to have a finalizer and it's already not "decoupled"? :P |
15:56:20 | yglukhov | no, because i can't set/change/tweak the finalizer of already created object |
15:56:38 | Araq | exactly. |
15:57:39 | yglukhov | maybe we should change cell finalizer to be an array? |
15:57:40 | yglukhov | =) |
15:57:50 | yglukhov | of procs |
15:58:16 | yglukhov | and then do addFinalizer/removeFinalizer or smth... |
15:58:57 | demi- | I think I am creating my function callbacks correctly, but the resulting code doesn't compile, i've attached logs and there are links to the code in the comment on here: https://gist.github.com/samdmarshall/2a109072fb926a2710c58a5bd2314b89 |
16:01:00 | Araq | demi-: no you don't understand callbacks yet. and apparently nobody else in #nim |
16:01:10 | demi- | :( |
16:01:17 | Araq | it's the old nimcall vs closure topic. |
16:01:22 | yglukhov | demi-: regardless your code is correct or not, C compiler errors are de facto Nim bugs. Either nim should tell you about your error, or it should compile. Exception is emit pragma and its friends. |
16:01:36 | Araq | yglukhov: he uses 'cast' though ;-) |
16:01:46 | demi- | she* |
16:01:46 | Araq | but I agree, the codegen should catch it |
16:01:54 | Araq | oh sorry. |
16:02:11 | demi- | and without casts it complains of wrong types, even though the type signatures are the same |
16:02:25 | Araq | no they are not |
16:02:31 | Araq | but maybe the error message is crap |
16:02:33 | * | Trustable joined #nim |
16:02:49 | Araq | your *proc type* has calling convention .closure |
16:02:57 | Araq | your *procs* have .nimcall |
16:03:18 | demi- | examining the C code that is generated says they aren't the same, but i don't know how to make them the same |
16:03:51 | Araq | there is an implicit conversion from .nimcall to closure but that tends to fail |
16:04:11 | Araq | in tuples which what your {:} construct uses under the hood |
16:04:28 | demi- | so I have to add {.closure.} to my procs then? |
16:05:51 | * | abeaumont quit (Read error: Connection reset by peer) |
16:06:26 | Araq | more likely wrap them in (do(): someProc()) |
16:06:50 | yglukhov | haha, i bet it will not work from the first try =)) |
16:07:03 | Araq | stupid 'do' notation. |
16:07:25 | Araq | that's what you get when not Araq himself designs a feature. |
16:07:26 | demi- | is this something i can do to not place a burden on people consuming this module? |
16:08:23 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:08:31 | Araq | dunno, the whole module seems to be based on the idea that 'string cases' don't exist in Nim, but they do. |
16:09:22 | demi- | oh? it very well be that i'm missing something vital here, just started to learn nim and come from a python+c background. |
16:10:35 | Araq | case mycommand |
16:10:42 | Araq | of "help": printHelp() |
16:10:57 | Araq | of "manual": printMoreHelp() |
16:10:58 | demi- | ooh |
16:11:31 | Araq | and even if 'case' fails for you, you write a 'case'-like macro then. |
16:13:17 | demi- | yeah I see -- though I don't think that solves the callback problem i'm having, or if it does then I don't see how |
16:14:52 | Araq | you don't have callbacks. |
16:15:34 | Araq | you wrote a mapping from strings to code blocks but since code blocks don't exist you used callbacks. |
16:15:42 | yglukhov | demi-: just init your tables with `[]=` operator instead of the literal. this should work for you. |
16:16:06 | Araq | the 'case' is already the mapping from strings to code blocks and it's as concise as it can get. |
16:16:16 | yglukhov | var myTable = initTable[string, proc()](); myTable["myProc"] = myProc |
16:16:45 | demi- | ah, i will try that yglukhov |
16:16:58 | Araq | fine, don't listen to me. -.- |
16:17:03 | demi- | Araq: i think I see what you are saying, i will try to refactor to use that approach |
16:24:49 | demi- | ha, i should have listened to you Araq, yglukhov's approach still yields the compiler errors for me :) |
16:25:50 | Araq | what you should write instead is a macro that does the trivial string to procname mapping |
16:26:13 | Araq | dispatch x: |
16:26:22 | Araq | help() |
16:26:27 | Araq | quit() |
16:26:46 | Araq | launch() |
16:27:03 | Araq | the 'dispatch' macro translates that into: |
16:27:07 | Araq | case x |
16:27:11 | Araq | of "help": help() |
16:27:17 | Araq | of "quit": quit() |
16:27:25 | Araq | of "launch": launch() |
16:27:32 | * | yglukhov quit (Remote host closed the connection) |
16:27:42 | demi- | ah |
16:27:51 | Araq | tada, you wrote something useful. so useful it should become a Nimble package. |
16:27:55 | Araq | ;-) |
16:28:47 | * | yglukhov joined #nim |
16:30:20 | * | xet7 quit (Quit: Leaving) |
16:31:07 | yglukhov | Araq: so what do you think about the weakrefs? what would be the good approach? currenlty i see two of them, both reaquire come compiler tweaks. 1. allow any obj type to be extended. 2. allow adding finalizers to existing ref instances. |
16:32:40 | yglukhov | Araq, demi-: i wonder why my suggestion failed. should not be nimcalls automatically upgraded to closures when passed to `[]=`? |
16:33:02 | Araq | yglukhov: yes but she probably messed up with .gcsafety |
16:34:11 | * | PMunch quit (Quit: leaving) |
16:34:34 | Araq | yglukhov: I have no opinion yet. |
16:34:45 | * | couven92 quit (Quit: Client disconnecting) |
16:36:23 | yglukhov | Araq: IMO 2 should be easy. Add a flag to cell (finalizerPtrIsActuallyANullTerminatedArrayAndNotAProc). Check this flag when working with finalizers. smth like that... |
16:37:15 | Araq | what does the finalizer *do* though? |
16:37:39 | Araq | it cannot access object fields since the object doesn't know about the weakref fields |
16:38:50 | Araq | it can access some globally shared table, not sure if that's a good idea |
16:38:51 | yglukhov | the finalizer nullifies the weakrefs to this object. |
16:39:04 | Araq | how do you find the weakrefs? |
16:39:20 | yglukhov | globally shared table? =) |
16:40:09 | Araq | so it's as expensive as an ID mechanism but it doesn't help with networking |
16:40:30 | Araq | I'd use an ID mechanism |
16:40:43 | yglukhov | ID mechanism? |
16:41:12 | Araq | objects have an ID and you can send it over the wire |
16:42:06 | Araq | pretty much like the weakref toy example does it |
16:43:13 | yglukhov | why would an object need id? cast[int](cast[pointer](myObj)) is an id already. |
16:43:33 | Araq | yes but that's fragile, non-deterministic, hard to debug |
16:44:04 | Araq | and it's an "ABA" ID |
16:44:16 | yglukhov | i would not call generating id by "inc gIdGenerator" any more deterministic. |
16:44:28 | Araq | object gets collected, new one gets created, same ID, oops. |
16:44:42 | yglukhov | oh, ok. |
16:46:13 | Araq | the globally shared table has other problems too: |
16:46:31 | Araq | if the weakref is on the stack what do you do? |
16:46:59 | Araq | unregister when it goes out of scope? |
16:47:13 | yglukhov | so... lets think about the 1st approach? Extending a type. We define a hidden ref type WeakReferencesToMe. a member of such type is silently injected to an object upon weak(myObj) call |
16:47:44 | Araq | 'WeakReferencesToMe' is the problem I'm talking about |
16:47:59 | Araq | these need to be kept up to date. |
16:48:25 | Araq | including the rather nasty "unregister when out of scope" |
16:48:26 | yglukhov | unregister when it goes out of scope: no. weak references can be ref objects themselves. with their own finalizer |
16:48:47 | Araq | sure but that's quite some overhead |
16:49:13 | yglukhov | true, but only if you use them =) |
16:49:17 | yglukhov | thats fair |
16:49:21 | Araq | my weakrefs don't require that. |
16:49:32 | yglukhov | because they are not weakrefs =) |
16:50:02 | Araq | what makes them non-weakrefs? |
16:50:24 | yglukhov | or.. ok, they are. except they require a unique id. |
16:50:39 | yglukhov | do cells have unique ids? |
16:51:22 | Araq | they have one when you define:corruption ... ;-) |
16:51:37 | Araq | because as I said, pointers suck :-) |
16:55:22 | dom96 | Guys, can we use -> instead of `do` for lambdas? |
16:55:28 | dom96 | -> and => |
16:56:14 | Araq | yeah well. "from future import `=>` ". maybe the future should arrive. |
16:56:16 | yglukhov | Araq: ok, so does it look like both changes are needed? silent extensions to add id field + multiple finalizers to clear global id set? |
16:56:31 | dom96 | Araq: indeed |
16:57:11 | Araq | yglukhov: if you patch the memory subsystem to provide IDs you need neither. |
16:57:49 | Araq | but this means every cell gets an ID and I guess that's just not necessary |
16:58:18 | yglukhov | Araq: i kinda like the concept of pay-as-you-go language. adding id to the memory subsystem doesnt comply with that. |
16:58:56 | Araq | the memory subsystem can do it smarter though |
16:59:26 | Araq | since it almost knows this anyway |
17:00:45 | Araq | but C++ doesn't need type extensions and a list of destructors for this feature. |
17:01:18 | Araq | the RC<T> container needs to support weakrefs and then you're done iirc |
17:02:41 | * | hendi_ quit (Quit: hendi_) |
17:02:50 | * | nsf joined #nim |
17:05:12 | yglukhov | Araq: i don't understand your last 2 messages. does c++ already have enough features to do a weakref? what is RC<T>? |
17:05:39 | Araq | checkout Urho's reference counting implementation |
17:10:00 | yglukhov | Araq: urho defines RefCounted, which is to be inherited. how does it help? like i said, there is no problem to make a weakref for an object, whose type explicitly allows weakrefs to it. |
17:11:08 | yglukhov | the problem i want to solve is that the type doesn't know upfront even about weakrefs existance |
17:14:50 | yglukhov | maybe im overcomplicating this. to make it clear, I don't need it badly, just trying to find the limits of nim, and to expand them =) |
17:14:50 | * | xet7 joined #nim |
17:25:08 | * | yglukhov quit (Remote host closed the connection) |
17:36:40 | * | brson joined #nim |
17:38:52 | * | yglukhov joined #nim |
17:43:24 | * | yglukhov quit (Ping timeout: 260 seconds) |
17:44:54 | * | byte512 joined #nim |
17:47:16 | Araq | BlaXpirit: we really depend on the gitter bridge now. any news? |
17:47:18 | * | krux02 joined #nim |
17:47:22 | * | krux02 quit (Remote host closed the connection) |
17:52:42 | plm | why nim needs a Garbage Collector? |
17:55:08 | Araq | because it was considered the best way to manage memory. |
17:56:31 | Araq | not sure I still agree with that but every way of managing memory has problems and far reaching implications. |
17:58:08 | plm | Araq: how rust is capable to mamage memory without a GC? |
18:01:38 | * | couven92 joined #nim |
18:10:43 | Araq | go and ask #rust |
18:11:01 | Araq | I think you're just trolling me. |
18:12:50 | plm | Araq: not, really. |
18:13:31 | plm | Araq: I would like to choose a new languge to learn, I am choosing between rust and nim, and for it I would like to know more about advantages of each one |
18:13:57 | Araq | I count the minutes until you try to convince me to convert to Islam |
18:18:40 | plm | Araq: You still not converted? ohh |
18:21:57 | * | yglukhov joined #nim |
18:25:51 | dom96 | plm: I think at this point you should evaluate the languages for yourself instead of asking us questions. |
18:26:08 | dom96 | At least when it comes to questions such as "Why did you do it this way?" |
18:26:20 | * | yglukhov quit (Ping timeout: 255 seconds) |
18:26:39 | Araq | the question is not even "why", it's more like "I'm too lazy, can you do my homework for me" |
18:26:45 | BlaXpirit | Araq, hm PING gitter.im (34.197.6.22) 56(84) bytes of data. 448 packets transmitted, 0 received, 100% packet loss, time 452972ms |
18:29:09 | dom96 | I guess they're still having issues |
18:29:29 | dom96 | maybe `mtr` could shed some light on where the traffic stops? |
18:31:12 | * | Matthias247 joined #nim |
18:36:19 | plm | Araq: please, less |
18:39:23 | * | byte512 quit (Ping timeout: 264 seconds) |
18:44:07 | gangstacat | hello, Araq, any news on the libui DLL? |
18:44:54 | demi- | maybe silly question but can I document the properties of an object? if not, can i apply formatting to the text taken from a documentation block in a .nim file? |
18:45:30 | * | brson_ joined #nim |
18:50:11 | * | brson quit (Ping timeout: 264 seconds) |
18:53:24 | cheatfate | demi-, is this https://gist.github.com/cheatfate/df05f18c1297a0b40ba8171d4c714b65 what you need? |
18:53:36 | BlaXpirit | dom96, travels well to 205.251.245.187 (Amazon's), then next item is just ??? |
18:54:07 | demi- | ah-ha, it needs to be indented, tyvm cheatfate |
18:54:17 | dom96 | BlaXpirit: hrm. Maybe you could get in touch with gitter and let them know about this problem? |
18:54:38 | Araq | gangstacat: patching the .compile pragma so that it doesn't require a DLL anymore |
18:54:54 | gangstacat | oh, cool :) |
18:54:58 | Araq | likely finished this weekend |
18:55:11 | BlaXpirit | dom96, I will not do that, sorry |
18:55:25 | dom96 | BlaXpirit: why not? |
18:56:35 | demi- | cheatfate: when i do a `nim doc foo.nim` I don't see the per property documentation comments displayed anywhere |
18:56:54 | BlaXpirit | also from a completely different part of Europe, travels well to 205.251.244.191 (Amazon's), then next item is just ??? |
18:57:23 | * | Andris_zbx quit (Remote host closed the connection) |
18:57:39 | BlaXpirit | but what about you people? can anyone else reach `ping gitter.im`? |
18:58:06 | dom96 | hrm, nope |
18:58:18 | dom96 | But it could be that they ignore ICMP packets |
18:58:37 | cheatfate | demi-, mark properties with `*` |
18:58:39 | dom96 | I can `curl gitter.im` perfectly fine |
18:58:49 | BlaXpirit | oh right.. |
18:58:51 | euantor | I can't ping them either, so they probably block ICMP |
18:58:53 | cheatfate | demi-, so if they market as public `*` it will be documented |
18:59:03 | demi- | yeah i have, that doesn't seem to do anything? |
18:59:05 | cheatfate | marked |
18:59:17 | cheatfate | could you gist it? |
18:59:22 | demi- | sure |
18:59:23 | * | FromGitter joined #nim |
18:59:39 | BlaXpirit | well that was easy... sorry that i failed with my checks. bot is back online |
18:59:59 | BlaXpirit | but yesterday the problem was certainly more than just with pings |
19:01:51 | dom96 | great, thanks for bringing it back |
19:02:07 | * | adeohluwa joined #nim |
19:03:40 | Araq | wow thanks :-) |
19:03:52 | Araq | demi-: 'nim doc2' is the better choice |
19:06:18 | demi- | oh |
19:06:36 | demi- | hahaha |
19:07:26 | demi- | turns out, you shouldn't have ad-blockers enabled in your webbrowser because it will strip the "comments" section of the page :) |
19:08:18 | cheatfate | looks like doc2 is buggy |
19:08:28 | cheatfate | but doc dont have such bug |
19:17:00 | * | xet7 quit (Quit: Leaving) |
19:21:52 | * | xet7 joined #nim |
19:23:16 | * | adeohluwa quit (Remote host closed the connection) |
20:13:53 | * | kunev quit (Quit: е те!) |
20:19:11 | * | kunev joined #nim |
20:28:47 | * | nsf quit (Quit: WeeChat 1.7) |
20:45:19 | * | mdeck joined #nim |
20:55:02 | * | xet7 quit (Quit: Leaving) |
20:57:17 | * | kunev quit (Quit: е те!) |
20:59:20 | mdeck | newb here. can anyone explain why "echo [0,1].len" fails but "echo array([0,1]).len" works? |
21:02:36 | * | kunev joined #nim |
21:02:59 | mdeck | using nim 0.16.0 |
21:05:18 | dom96 | echo([0,1].len) also works |
21:06:09 | mdeck | yeah, i figure it's interpreting as (echo [0,1]).len |
21:06:17 | mdeck | but why does the second form work? |
21:09:37 | dom96 | not sure, Araq? |
21:14:00 | * | gokr quit (Quit: Leaving.) |
21:17:22 | Araq | what's the question? |
21:17:51 | Araq | echo [0, 1].len will work in the next versions |
21:18:09 | Araq | it used to mean echo[0, 1] aka array access |
21:18:31 | Araq | we now warn about it because it will mean "pass array to echo" |
21:26:57 | * | mdeck left #nim (#nim) |
21:32:32 | dom96 | The question is:# "can anyone explain why "echo [0,1].len" fails but "echo array([0,1]).len" works?" |
21:33:28 | Araq | because it's a completely different statement. |
21:36:10 | Araq | the second form works because it converts it to the 'array' type class |
21:52:06 | * | rokups quit (Quit: Connection closed for inactivity) |
21:55:23 | * | Trustable quit (Remote host closed the connection) |
21:57:54 | dom96 | Araq: what will the new compile pragmas semantics be? |
22:01:15 | * | rupil quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
22:01:19 | Araq | .compile: ("dir/*.cpp", "$1.cpp.obj") |
22:01:38 | Araq | compile every file to ".cpp.obj" file |
22:02:31 | Araq | but now my libui example crashes at init time with "everything successful" |
22:02:32 | demi- | I am trying to publish a package and it keeps failing with this error message: https://gist.github.com/samdmarshall/6830f76aaf6636be44e367c75676d612 |
22:06:25 | dom96 | demi-: report it please |
22:06:43 | dom96 | I'm guessing your package has an incorrect Git/Hg URL though |
22:07:02 | dom96 | or Nim's uri module can't parse it |
22:08:56 | demi- | would that be this? https://github.com/nim-lang/Nim/blob/devel/lib/pure/uri.nim |
22:10:13 | dom96 | yes |
22:10:29 | demi- | ok cool, then i'll debug it |
22:11:19 | cheatfate | demi-, debugging nim application will be tough task :) |
22:12:29 | dom96 | cheatfate: how so? |
22:13:08 | * | couven92 quit (Quit: Client disconnecting) |
22:13:52 | demi- | dom96: i started using nim 2 days ago |
22:15:41 | cheatfate | demi-, as Araq always says to if you want to inspect nim variable in debugger use `tab` :) |
22:15:47 | cheatfate | says to me |
22:16:19 | dom96 | demi-: best approach is to use the stack trace to your advantage. Put some echo()'s to see what the URL is for example. |
22:16:33 | dom96 | and follow the stack trace to see where the URL is retrieved from. |
22:17:04 | Araq | cheatfate: last time I checked the "debugger" cannot even watch a page in memory. |
22:17:22 | Araq | so I don't see what we lose. |
22:17:35 | Araq | LLDB and GDB are mostly useless for me. |
22:18:18 | Araq | and watchpoints are the only sensible way to debug. breakpoints do not give me anything. |
22:18:26 | cheatfate | Araq, same for VC debugger, but a little bit easier, because it automatically captures local variables |
22:18:51 | cheatfate | and with your latest sighashes, names becomes so ugly :) |
22:18:56 | * | Ven joined #nim |
22:19:04 | cheatfate | and so long |
22:19:19 | demi- | is there a tool for demangling the symbol names? |
22:19:22 | Araq | yeah, I intend to fix this this weekend though. |
22:20:22 | cheatfate | Araq, so names becomes more friendly? or you just build some .symbol file with names associations? |
22:20:47 | Araq | locals will be MUCH more friendly |
22:20:53 | Araq | the rest stays the same |
22:21:04 | Araq | I can give you some mapping file though |
22:21:36 | cheatfate | Araq, mapping file will be needed of course |
22:22:24 | cheatfate | but i'm still thinking about to make plugin for gdb like `rust`ers doo |
22:23:00 | Araq | yeah and others will be grateful. |
22:23:14 | Araq | but I'm betting on my memory tracker. |
22:23:28 | Araq | eventually it will help me find bugs ... :-) |
22:23:55 | cheatfate | yep, but don't help me to find async bugs :) |
22:24:22 | demi- | ok, I found the problem, https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/publish.nim#L170 this line doesn't return anything for me, exit code is 1; thus `url` never gets set which makes `parseUri()` fail on the string "ssh://" here https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/publish.nim#L178 |
22:24:31 | Araq | we'll see about that. |
22:24:57 | Araq | I'm writing a wiki page about how to debug Nim code. |
22:26:44 | dom96 | demi-: nice find. What happens when you execute that command in your terminal? |
22:26:59 | demi- | same thing, exit code of 1 and no output |
22:27:32 | demi- | a remote origin is set (github), and I can push code to it |
22:28:05 | dom96 | strange, what's your git version? |
22:28:43 | demi- | 2.11.0 |
22:29:10 | dom96 | I've got 2.7.4 |
22:29:58 | * | Kingsquee joined #nim |
22:30:42 | dom96 | I suppose it's unlikely that it's broken in the newer version |
22:32:05 | * | Ven quit (Ping timeout: 248 seconds) |
22:34:00 | * | Ven joined #nim |
22:37:58 | demi- | i'm not seeing a value for any of the repos I have |
22:38:46 | demi- | tried with git 2.10.1, which is the oldest i have available to me |
22:39:42 | plm | It is easy to integrate Python with nim? I mean, like as ctypes. |
22:39:57 | dom96 | plm: yes |
22:40:56 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:41:21 | dom96 | demi-: what's in $gitRepo/.git/config? |
22:41:30 | plm | dom96: I can to find this information on the http://nim-lang.org/documentation.html |
22:42:16 | dom96 | plm: this might help https://github.com/jboy/nim-pymod |
22:44:03 | plm | dom96: thanks :) |
22:45:03 | plm | dom96: actually when I need something with high performance I do that part in C and all the rest in Python. My intention is to substitute that part by Nim. What do you think? |
22:45:23 | plm | *That C parts |
22:46:40 | * | bjz joined #nim |
22:46:49 | dom96 | plm: sounds like a great idea |
22:48:30 | * | libman joined #nim |
22:51:26 | plm | dom96: Some projects I migrate of ctypes to cython, becouse using Python with ctypes there was a few delay/low performance when compared with using cython. Said that, I see that the pymod used on nim is the same I would like to know if |
22:51:33 | plm | sorry |
22:51:43 | plm | wait.. |
22:52:06 | Araq | I often do the high performance parts in Nim and then all the rest in Nim. |
22:52:22 | demi- | lol |
22:52:41 | dom96 | This is why NimBot needs a quote database |
22:53:01 | plm | dom96: Some projects I migrate of ctypes to cython, becouse using Python with ctypes there was a few delay/low performance when compared with using cython. Said that, I see that nim(via pymod) are using the Python/C API, same as ctypes. Are there the same problem? |
22:53:22 | plm | Araq: yes, maybe when I will be good in nim :) |
22:54:15 | cheatfate | plm, you will not become good in nim, if you not try to make it |
22:54:47 | plm | cheatfate: but I already have so much work done in python :) |
22:54:58 | plm | cheatfate: For a new projects, maybe |
22:55:02 | cheatfate | i dont think you will get any performance boost with such approach |
22:55:12 | plm | cheatfate: why not? |
22:55:23 | plm | cheatfate: I have using cython |
22:56:50 | cheatfate | i dont know what is cython, but if it uses pythons objects/gc and gil then you can't make it faster |
22:57:35 | cheatfate | i mean you will not get any performance boost with pymod... |
22:57:51 | plm | cheatfate: cython you need to change on functions to static types and others things (python code will be streange) but is possible to compile the new "python" code |
22:57:59 | cheatfate | all you performance will be destroyed by memory allocations/deallocations |
22:58:12 | Araq | cheatfate: stop being so negative. |
22:58:28 | Araq | it's always worth a try if only to learn something. |
22:58:44 | plm | cheatfate: but if nim is faster as C/C++, do parts with slow in python (image processing for example) I can to do in nim and result to python |
22:59:05 | plm | The Araq is a bot? |
22:59:13 | plm | Is the Araq a bot? |
22:59:15 | subsetpark | I recently was experimenting with calling Nim via the Python FFI - I found `ctypes` to be by far the simplest solution |
22:59:26 | dom96 | plm: yes, he's written in Nim |
22:59:41 | dom96 | Naturally |
23:01:14 | plm | cheatfate: so, use nim binding to python will not be faster like as I use python with C (using ctypes)? |
23:07:54 | cheatfate | plm, it depends on many factors |
23:16:29 | * | plm quit (Quit: leaving) |
23:27:14 | * | Vladar quit (Quit: Leaving) |
23:30:36 | * | demi- quit (Quit: Server shutdown in 3... 2... 1...) |
23:46:56 | * | demi- joined #nim |
23:53:29 | demi- | dom96: i think this is the command that is wanted: `git ls-remote --get-url` |
23:54:31 | demi- | also this is the answer to your earlier question that i missed: https://gist.github.com/samdmarshall/25209c2342e9e64d992b9acdc2710044 |
23:56:21 | dom96 | demi-: works for me, feel free to create a PR to change the used command. |