00:21:44 | * | MJCaley joined #nim |
00:23:10 | * | xkapastel quit (Quit: Connection closed for inactivity) |
00:27:28 | * | devdri quit () |
00:37:07 | FromGitter | <Quelklef> `seq[A]` where `type A = ref object of B` is by identity, right? |
00:37:45 | FromGitter | <Quelklef> Wait, I can probably just test this, sorry |
00:57:10 | * | SitiSchu quit (Ping timeout: 260 seconds) |
01:01:47 | * | SitiSchu joined #nim |
01:06:15 | * | S1tiSchu joined #nim |
01:07:12 | * | SitiSchu quit (Ping timeout: 268 seconds) |
01:46:17 | * | xkapastel joined #nim |
02:04:32 | * | MJCaley quit (Quit: MJCaley) |
02:09:22 | * | MJCaley joined #nim |
02:14:18 | * | vivus quit (Quit: Leaving) |
02:21:32 | * | MJCaley quit (Quit: MJCaley) |
02:25:26 | * | S1t1Schu joined #nim |
02:29:02 | * | S1tiSchu quit (Ping timeout: 256 seconds) |
02:29:27 | * | zahary_ quit (Quit: Connection closed for inactivity) |
02:35:36 | * | MJCaley joined #nim |
02:46:23 | * | marenz quit (Ping timeout: 248 seconds) |
02:47:12 | * | chemist69 quit (Ping timeout: 246 seconds) |
03:01:33 | * | chemist69 joined #nim |
03:31:22 | * | couven92 quit (Ping timeout: 256 seconds) |
03:47:21 | * | MJCaley quit (Quit: MJCaley) |
03:56:12 | * | dddddd quit (Remote host closed the connection) |
04:20:55 | * | rockcavera joined #nim |
04:33:10 | * | xkapastel quit (Quit: Connection closed for inactivity) |
04:38:24 | FromGitter | <Varriount> @Quelklef it will compare the identity, yes. |
04:39:51 | FromGitter | <Quelklef> I have a very subtle bug then... :( |
04:41:35 | FromGitter | <RedBeard0531> can't you define a proc `==`(a, b: A): bool which would give value comparison rather than identity? |
04:43:07 | FromGitter | <Quelklef> Yes. I want it to compare by identity. If it's working as I expect, then the bug is somewhere else :/ |
04:43:47 | * | arthurz quit () |
04:43:48 | FromGitter | <RedBeard0531> The identity of the seq or of the elements? |
04:44:00 | FromGitter | <Quelklef> The elements |
04:46:58 | FromGitter | <RedBeard0531> To rule it out, try defining your own proc==(a, b:A) with identity semantics and see if the problem goes away |
04:50:44 | * | rauss quit (Quit: WeeChat 2.0.1) |
04:52:06 | * | rauss joined #nim |
04:53:04 | * | MJCaley joined #nim |
04:56:31 | Araq | if you want values, don't use 'ref' |
04:59:30 | * | rockcavera quit (Ping timeout: 252 seconds) |
05:04:49 | * | MJCaley quit (Quit: MJCaley) |
05:34:26 | * | endragor joined #nim |
05:37:58 | * | tinAndi joined #nim |
05:43:10 | * | tinAndi quit (Ping timeout: 240 seconds) |
05:56:10 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
06:01:09 | * | endragor quit (Remote host closed the connection) |
06:02:56 | * | endragor joined #nim |
06:03:38 | FromGitter | <Quelklef> But they're references to values |
06:06:13 | * | nsf joined #nim |
06:24:10 | * | wurui joined #nim |
06:25:34 | Araq | a[] == b[] |
06:28:10 | * | c0ntribut0r quit (Ping timeout: 256 seconds) |
06:28:55 | * | c0ntribut0r joined #nim |
06:40:34 | * | c0ntribut0r quit (Read error: Connection reset by peer) |
06:41:30 | * | c0ntribut0r joined #nim |
06:45:42 | * | radagast joined #nim |
06:45:43 | * | wurui quit (Read error: Connection reset by peer) |
06:48:31 | * | c0ntribut0r quit (Ping timeout: 248 seconds) |
06:49:26 | * | c0ntribut0r joined #nim |
07:11:28 | * | c0ntribut0r quit (Read error: Connection reset by peer) |
07:16:53 | * | c0ntribut0r joined #nim |
07:34:19 | livcd | I know that there's karax but does anyone use React with Nim ? (i also saw a reactjs binding lib for nim in github) |
07:35:41 | * | miran_ joined #nim |
07:41:20 | * | endragor_ joined #nim |
07:44:40 | * | endragor quit (Ping timeout: 256 seconds) |
08:00:15 | * | couven92 joined #nim |
08:07:29 | * | gokr joined #nim |
08:22:34 | * | endragor joined #nim |
08:25:45 | * | endragor_ quit (Ping timeout: 260 seconds) |
09:03:27 | * | gmpreussner quit (Ping timeout: 248 seconds) |
09:05:25 | * | gmpreussner joined #nim |
09:06:58 | * | obadz- joined #nim |
09:07:40 | * | obadz quit (Ping timeout: 240 seconds) |
09:07:42 | * | obadz- is now known as obadz |
09:07:52 | * | dddddd joined #nim |
09:14:27 | * | Arrrr joined #nim |
09:14:27 | * | Arrrr quit (Changing host) |
09:14:27 | * | Arrrr joined #nim |
09:17:12 | * | yglukhov joined #nim |
09:18:17 | * | PMunch joined #nim |
09:20:53 | FromGitter | <andreaferretti> it was an experiment of mine |
09:21:11 | FromGitter | <andreaferretti> it should work, but I don't guarantee anything :-) |
09:21:26 | FromGitter | <andreaferretti> it would be nice if someone tried doing something serious with it |
09:21:30 | FromGitter | <andreaferretti> and possibly update it |
09:30:56 | livcd | ah :) |
10:41:41 | * | c0ntribut0r quit (Ping timeout: 276 seconds) |
10:42:17 | * | c0ntribut0r joined #nim |
10:47:28 | * | sendell joined #nim |
11:00:35 | * | c0ntribut0r quit (Read error: Connection reset by peer) |
11:00:50 | * | c0ntribut0r joined #nim |
11:01:11 | * | chemist69 quit (Ping timeout: 276 seconds) |
11:15:10 | * | chemist69 joined #nim |
11:25:20 | * | yglukhov quit () |
11:25:42 | * | yglukhov joined #nim |
11:28:54 | * | arnetheduck joined #nim |
11:37:21 | * | marenz joined #nim |
11:42:21 | * | byte512_ quit (Ping timeout: 246 seconds) |
11:45:12 | radagast | Hi, I have two questions. 1. Is there a quick and easy trick to generate link to the source code of a particular function in a documentation? For example, in Nim standard library documentation, there is always a nice hyperlink to the relevant source (in github) beside each functions. 2. I have this module https://gist.github.com/57fdcae0649edee8606269333b63145f while documenting it, both `nim doc` and `nim doc2` command fails for a |
11:45:14 | radagast | strange reason, it says "`" not found in line 20, which is a comment! Also, another question. How can I make nimble to generate documentation for each modules in the project? |
11:46:41 | Araq | you can use nimscript in your nimble file to do that |
11:47:03 | Araq | not a strange reason, the docgen uses RST, the comments have to be in RST format |
11:48:03 | * | Vladar joined #nim |
11:48:44 | * | floppydh joined #nim |
11:49:00 | dom96 | it would be nice for the doc gen to support linking to specific functions |
11:57:44 | * | tinAndi joined #nim |
11:59:00 | PMunch | Hmm, this auto type. Does it not work with closures? |
11:59:04 | PMunch | https://github.com/PMunch/combparser/blob/master/combparser.nim#L299 |
11:59:22 | PMunch | Tried to change the (proc(lhs: Node, rhs: Node): Node) return type to auto |
12:01:03 | * | marenz quit (Ping timeout: 248 seconds) |
12:02:23 | * | Snircle joined #nim |
12:03:35 | * | tinAndi quit (Ping timeout: 276 seconds) |
12:08:01 | radagast | Nim's templates are a lot like D's template mixins. |
12:24:41 | * | byte512 joined #nim |
12:26:28 | * | chemist69 quit (Ping timeout: 252 seconds) |
12:28:05 | * | yglukhov_ joined #nim |
12:28:05 | * | yglukhov quit (Read error: Connection reset by peer) |
12:31:58 | PMunch | Hmm, auto works in a simple case like this: http://ix.io/ESE/ |
12:32:10 | * | yglukhov_ quit (Ping timeout: 240 seconds) |
12:34:04 | PMunch | http://ix.io/ESG/ |
12:34:11 | PMunch | That's the error I get for combparser |
12:34:32 | PMunch | The only thing I can see between them is that the pragmas differ.. |
12:35:24 | PMunch | And if I change both the parts of / to auto I get this http://ix.io/ESH/ |
12:35:46 | * | yglukhov joined #nim |
12:36:56 | * | yglukhov quit (Remote host closed the connection) |
12:37:28 | * | yglukhov joined #nim |
12:38:23 | * | kunev quit (Ping timeout: 248 seconds) |
12:38:52 | * | chemist69 joined #nim |
12:39:10 | * | kunev joined #nim |
12:41:52 | * | yglukhov quit (Ping timeout: 252 seconds) |
12:53:05 | Araq | PMunch: you can't use 'auto' with forward declarations |
12:57:01 | PMunch | What do you mean? The stuff that is being auto-d isn't forward declared |
13:01:41 | flyx | radagast: for generating hyperlinks, use something like this: nim doc2 -o:docout/yaml.html --docSeeSrcUrl:https://github.com/flyx/NimYAML/blob/`git log -n 1 --format=%H` yaml |
13:01:46 | flyx | (substitute your URL) |
13:02:32 | flyx | it basically queries the current git commit and generates a hyperlink to that version of the file |
13:02:55 | flyx | you can also use a branch name |
13:07:05 | * | arecaceae quit (Remote host closed the connection) |
13:07:29 | * | arecaceae joined #nim |
13:15:20 | radagast | Hmm, thanks. I'll note that down. |
13:21:33 | * | yglukhov joined #nim |
13:25:52 | * | yglukhov quit (Ping timeout: 252 seconds) |
13:35:34 | * | yglukhov joined #nim |
13:46:58 | * | survivorm joined #nim |
13:50:12 | * | survivorm quit (Client Quit) |
13:57:48 | * | gokr quit (Ping timeout: 246 seconds) |
14:03:40 | * | fvs joined #nim |
14:15:14 | skelett | Does anybody know, how I can get this `breaks` function running: http://ix.io/ET0 ? It seems to get called with the wrong call convention when I pass `varargs[string]`. |
14:19:24 | dom96 | Seems like a possible bug |
14:20:51 | skelett | I tried various cdecl and nodecl things, but nothing worked so far |
14:24:20 | flyx | skelett: calling convention is not the problem I think. generated C code looks like this: `T1_ = printf(fmt->data, args);` |
14:25:14 | flyx | so instead of calling printf with elements from the varargs list, it gives a pointer to that list (args is a `NimStringDesc**`) |
14:25:29 | flyx | C tries to read that as string which is why you get garbage |
14:26:08 | skelett | Actually, I get "garbage => fmt" |
14:26:56 | skelett | As if this stack address would be loaded twice, once as parameter for printf and once as second string |
14:27:22 | skelett | * `garbage => %s => %s` |
14:28:12 | flyx | well the thing is, iirc there is no way to pass an array to a varargs parameter in C. which means that interoperating with Nim's varargs probably won't work. |
14:28:42 | * | gokr joined #nim |
14:29:28 | flyx | you can look at the generated C code and try to understand why you're getting the output you're getting, it's not that complex |
14:30:51 | skelett | Ahh I see |
14:34:35 | flyx | also, it'd say it's not a bug. Nim's manual says that „The compiler converts the list of arguments to an array implicitly“ for varargs parameters. so you are passing an array to printf instead of a list of parameters. |
14:35:57 | flyx | and using the template directly will substitute the varargs parameter's usage with the values you give, which is why it works |
14:37:03 | skelett | Do you know of a way to get this running with procedures (my actual use case is a bit more complex, so I'd rather use a `proc` than a template) |
14:43:19 | * | Yardanico joined #nim |
14:46:45 | FromGitter | <ZarsBranchkin> Hey, how do I route stdout out of startProcess to the stdout of the main program? poParentStreams doesn't seem to work, from source it seems that they are automatically disabled on POSIX |
14:56:00 | flyx | skelett: I would say it's impossible for the general case (i.e. you don't know the maximum number of arguments) with procedures, but you could define a macro that on each call generates a proc with the right number of arguments if none exists yet; and that proc then calls printf. I am pretty sure you need to replicate your printf call for each number of parameters in your code, because as I said before, C varargs does not take an array. |
14:57:05 | * | arnetheduck quit (Ping timeout: 240 seconds) |
14:57:39 | skelett | flyx: I would be happy about a pure nim version of formatted printing, too (I'm printing tables). Chances are high, I just did not see the right function |
14:57:47 | flyx | skelett: perhaps you can use vprintf instead which takes an explicit va_list parameters, but I have no idea how to handle that properly in Nim |
14:59:08 | flyx | skelett: you're searching for the % operator from strutils |
14:59:46 | skelett | I did not see there a way to specify a column width |
14:59:48 | flyx | skelett: https://nim-lang.org/docs/strutils.html#%,string,openArray[string] |
15:00:07 | skelett | sth like `%-30s` in c for example |
15:01:10 | skelett | and aligning every single argument is comparable verbose |
15:02:40 | flyx | ah well. I guess strutils gives you all the basic capabilities you need to implement a formatter that does that yourself, but I don't know about an existing implementation |
15:02:50 | flyx | though someone probably already has done this |
15:04:21 | Araq | skelett: nim devel has strformat.nim |
15:04:28 | skelett | there are two libraries listed: stringinterpolation and strfmt. The last ist a dead link, the first is for me (as I'm a beginner) too obscure |
15:05:29 | skelett | Araq: Thx! I'll have a look at that! |
15:06:14 | skelett | Ok thx flyx and Araq, that's what I'm searching for |
15:06:31 | skelett | installing devel now ^^ |
15:10:15 | * | Arrrr quit (Ping timeout: 246 seconds) |
15:12:21 | * | obadz- joined #nim |
15:14:06 | * | obadz quit (Ping timeout: 246 seconds) |
15:14:08 | * | obadz- is now known as obadz |
15:28:16 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
15:34:04 | * | xkapastel joined #nim |
15:55:13 | FromGitter | <Quelklef> I have a question about the type system |
15:55:23 | PMunch | Fire away :) |
15:55:41 | FromGitter | <Quelklef> I come from a Java background, so am largely thinking in terms of needing interfaces, which is where my issue is |
15:55:45 | FromGitter | <Quelklef> I wrote the following proc: |
15:55:54 | FromGitter | <Quelklef> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6f440a98927d57454ee863] |
15:56:29 | FromGitter | <Quelklef> In what was does the compiler verify that `T` implements `==`? |
15:56:46 | FromGitter | <Quelklef> Does it check at the parameterization (?) of `allSame` each time? |
15:57:23 | GitDisc | <treeform> yes it would make sure you can `T == T` when you use it. |
15:57:40 | FromGitter | <Quelklef> But only on the line, like, `allSame(newSeqsomething ())` |
15:57:40 | GitDisc | <treeform> not when you define it like in java |
15:57:44 | FromGitter | <Quelklef> ahhhhh ok |
15:57:52 | FromGitter | <Quelklef> that's.... |
15:58:05 | FromGitter | <Quelklef> Interesting. An approach I've never seen before. Seems more flexible |
15:58:07 | FromGitter | <Quelklef> Thanks : ) |
15:58:08 | GitDisc | <treeform> well not at run time, when you put the T is known it will check. |
15:58:14 | FromGitter | <Quelklef> right |
15:58:22 | FromGitter | <Quelklef> When it becomes a concrete type (?) |
15:58:46 | GitDisc | <treeform> yes |
15:58:52 | GitDisc | <treeform> this is kind of related: https://en.wikipedia.org/wiki/Structural_type_system |
15:58:53 | flyx | == is actually an example in the spec: https://nim-lang.org/docs/manual.html#generics-symbol-lookup-in-generics |
15:58:56 | PMunch | Yeah, the idea with T is that Nim will actually create a proc of that kind for each time you call the proc with a new type |
15:59:07 | GitDisc | <treeform> Java uses https://en.wikipedia.org/wiki/Nominal_type_system |
15:59:13 | FromGitter | <Quelklef> @PMuch that's why using `compiles` works then? |
15:59:19 | PMunch | And if the body isn't possible to compile with the new type it will throw an error |
15:59:30 | FromGitter | <Quelklef> @GitDisc thanks for the lniks |
15:59:39 | PMunch | Quelklef, what do you mean? |
16:00:20 | FromGitter | <Quelklef> Well, I was thinking if generics were done the Java way in terms of having one instance of the procedure and just verifying the types will check out then inserting casts |
16:00:50 | FromGitter | <Quelklef> Then how would `compiles` work? Like if a proc had `if compiles($val): ... else: ...` how would it do it since it can only compile to one proc |
16:00:52 | GitDisc | <treeform> yeah if stuff was done java way you would have to pass it an interface, an stuff would have to implement it |
16:00:58 | FromGitter | <Quelklef> But if you're saying it makes a new one for each instantiation that makes sene |
16:01:01 | FromGitter | <Quelklef> right |
16:01:05 | GitDisc | <treeform> but in nim they just have to "fit" to work |
16:01:24 | PMunch | Yeah |
16:01:47 | PMunch | If you look at something like the Stream type that is what an "interface" would look like in Nim |
16:02:26 | FromGitter | <Quelklef> ooh that looks dirty |
16:02:33 | FromGitter | <Quelklef> you mean the streams module right? cause thats what im looking at |
16:02:41 | PMunch | Yeah |
16:02:59 | PMunch | A "Stream" is just an object that has various procedures assigned to it |
16:03:04 | FromGitter | <Quelklef> any reason it's done that way rather than using the typical typing methods? |
16:03:19 | PMunch | No idea, ask Araq. He doesn't seem to like interfaces :P |
16:03:25 | GitDisc | <treeform> well this is typic in nim, you mean like in java? |
16:03:40 | FromGitter | <Quelklef> wait, but streams seems to take the "java way" rather than the nim way I mean |
16:03:50 | FromGitter | <Quelklef> it seems to diverge from the nim way by emulating an interface |
16:04:50 | GitDisc | <treeform> yeah streams is odd, it seems to do it kind of C++ way with a vtable like thing... |
16:04:59 | Araq | the way streams.nim does it is one of the fastest all things considered |
16:05:12 | * | Trustable joined #nim |
16:05:39 | GitDisc | <treeform> so StreamObj has a bunch of pointers to function that implement the stream? |
16:05:46 | FromGitter | <Quelklef> Wym, Araq? |
16:05:53 | GitDisc | <treeform> and then a buch of higher level functions on top of that? |
16:06:04 | PMunch | treeform, something like that yeah :) |
16:06:06 | Araq | treeform: that's how it works, yes |
16:06:48 | Araq | Quelklef indirect branch without a C++ like VTable indirection |
16:07:02 | Araq | only a direct branch would be faster |
16:07:32 | GitDisc | <treeform> How many stream types are there? Like 3, File, Socket, Buffer? |
16:07:42 | PMunch | String as well |
16:07:49 | FromGitter | <Quelklef> "direct/indrect branch"? "indirection"? |
16:07:58 | FromGitter | <Quelklef> We're moving towards unknown territory for me : P |
16:07:59 | GitDisc | <treeform> I would say string stream is a type of a buffer stream? |
16:08:00 | PMunch | Quelklef, don't worry about it :P |
16:08:16 | GitDisc | <treeform> Quelklef, I am a bit confused now |
16:08:19 | FromGitter | <Quelklef> Ok. You guys answered my original question anyway, thanks |
16:08:29 | FromGitter | <Quelklef> @treeform What's up |
16:08:40 | GitDisc | <treeform> no I mean about the streams vtable thingy |
16:08:46 | Araq | well read about branch prediction on modern CPUs and caches, perhaps |
16:09:25 | FromGitter | <Quelklef> @treeform Oh, ask Araq about that |
16:09:57 | Araq | treeform: C++ does it like self.vtable[methodOffset](self) |
16:10:14 | Araq | streams do self.functionPointer(self) |
16:11:35 | GitDisc | <treeform> Araq, Why not have FileStream, SocketStream, and like BufferStream and just use [T] to pass them about? Would that produce direct branches? Why not have stream point to like class, right now each stream carts 8 pointers about that are probably identical anyways? |
16:12:59 | GitDisc | <treeform> so if you have like a million buffer streams most of memory would just be 8 of the same pointers? |
16:13:43 | Araq | yeah... I never have a million of these |
16:13:50 | * | Amun_Ra quit (Ping timeout: 276 seconds) |
16:14:23 | Araq | the data duplication is what enables to us to avoid a memory load |
16:15:10 | GitDisc | <treeform> I just though that nim had enough meta programming stuff to fully quality run time code paths so that no dynamic type dispatch is needed. |
16:16:11 | Araq | that's true but generics are viral and so not always the best option. |
16:16:38 | Araq | you said it yourself, every stream based proc grows a [T] then |
16:16:53 | GitDisc | <treeform> by viral, you mean it can generate too many code paths and its acctually worse? |
16:17:23 | Araq | no, I mean viral. |
16:17:35 | Araq | affecting everything which touches it. |
16:17:47 | Araq | take an SQL parser for example |
16:18:08 | Araq | it parses from a Stream |
16:18:27 | Araq | if the stream is parametrized so should be the SQL parser |
16:18:30 | * | Amun_Ra joined #nim |
16:18:54 | GitDisc | <treeform> I see. |
16:19:21 | Araq | the code bloat caused by these instantiations is a different problem |
16:19:46 | Araq | in theory the backend can merge identical machine code, removing the code bloat completely |
16:20:48 | Araq | in practice it never works out so well, but good enough that you need to look at specific examples before saying anything about it |
16:20:57 | GitDisc | <treeform> well you would have to use both FileStream and like StringStream, but if you only use one... no code bloat |
16:21:08 | GitDisc | <treeform> but having to type [T] everywhere would be a pain |
16:21:20 | * | BitPuffin joined #nim |
16:21:26 | Araq | actually, nim's "implicit generics" avoid the [T] |
16:21:42 | Araq | but it's still a tradeoff |
16:22:08 | Araq | for example you cannot create a heterogenous list of streams if they are not based on subtyping |
16:22:15 | GitDisc | <treeform> interesting |
16:22:48 | Araq | and your "but if you only use one... no code bloat" is spot on |
16:23:14 | Araq | "if you only use one ..." --- hard to enforce, very hard, libraries can use the stdlib in multiple ways |
16:23:52 | GitDisc | <treeform> But here if you use it at any time you still get to call the function pointers. |
16:24:30 | GitDisc | <treeform> Well I would file this under another tick I can use. I was just surpsied on how its implemented. |
16:24:37 | Araq | with its 100% correctly predicated jump targets? ;-) |
16:24:46 | Araq | *predicted |
16:24:57 | GitDisc | <treeform> Yeah it probably does not matter in practise. |
16:25:06 | Araq | what is the overhead you're concerned about? |
16:25:55 | GitDisc | <treeform> Not really, i guess I am consuerned about some abstract form of "cleanleness"... and I guess not really concerned .. just trying to understand. |
16:28:38 | * | MJCaley joined #nim |
16:29:43 | Araq | well streams predate methods, closures and (stable) generics ;-) |
16:30:01 | Araq | but now that we have all these I would still do it the same way |
16:32:24 | GitDisc | <treeform> I been using the nim JS backend at work, and its working great. Thank you for that. |
16:33:50 | Araq | you're welcome :-) |
16:35:43 | * | endragor quit (Remote host closed the connection) |
16:36:17 | * | endragor joined #nim |
16:40:33 | * | endragor quit (Ping timeout: 246 seconds) |
16:47:12 | * | tinAndi joined #nim |
16:51:26 | * | endragor joined #nim |
16:55:22 | FromGitter | <data-man> stb updated https://github.com/nothings/stb |
16:56:38 | * | endragor quit (Remote host closed the connection) |
16:58:20 | * | c0ntribut0r quit (Ping timeout: 255 seconds) |
17:00:49 | * | gokr quit (Ping timeout: 256 seconds) |
17:05:21 | * | PMunch quit (Quit: Leaving) |
17:10:02 | * | xet7 quit (Quit: Leaving) |
17:17:14 | * | xet7 joined #nim |
17:17:56 | * | c0ntribut0r joined #nim |
17:22:58 | * | yglukhov quit (Remote host closed the connection) |
17:23:32 | * | yglukhov joined #nim |
17:23:56 | * | Jesin joined #nim |
17:25:14 | * | yglukhov_ joined #nim |
17:25:14 | * | yglukhov quit (Read error: Connection reset by peer) |
17:29:53 | * | yglukhov_ quit (Ping timeout: 276 seconds) |
17:33:11 | * | Trustable quit (Remote host closed the connection) |
17:36:30 | shashlick | hey guys, needed some general help - if I don't do a blocking getch() on linux terminal, I lose the cursor - any ideas? |
17:37:14 | * | sendell quit (Remote host closed the connection) |
17:37:36 | shashlick | if I do the blocking getch() in a spawn'd thread, it doesn't help either |
17:48:47 | * | nsf quit (Quit: WeeChat 2.0.1) |
17:49:46 | * | couven92 quit (Quit: Client disconnecting) |
17:54:00 | * | MJCaley quit (Quit: MJCaley) |
17:55:46 | * | MJCaley joined #nim |
17:59:28 | * | floppydh quit (Quit: WeeChat 2.0.1) |
18:19:03 | * | yglukhov joined #nim |
18:20:09 | * | gokr joined #nim |
18:23:18 | * | yglukhov quit (Ping timeout: 240 seconds) |
18:25:00 | * | tinAndi quit (Ping timeout: 256 seconds) |
18:25:14 | * | yglukhov joined #nim |
18:31:17 | yglukhov | Araq: what do you think about refactoring nimsuggest a bit? |
18:35:39 | Araq | nothing. |
18:36:04 | * | skelett quit (Ping timeout: 252 seconds) |
18:40:51 | shashlick | I don't get it - if I spawn a thread then my cursor disappears on the terminal |
18:41:36 | shashlick | okay never mind, it is the same getch() issue |
18:42:04 | shashlick | if I run getch() in a background thread, it still doesn't give me a cursor |
18:42:16 | shashlick | so I have to have the getch() in my main thread and threadvar a whole bunch of vars :( |
18:42:42 | shashlick | any ideas on how to organize the code so that I don't have to threadvar every single global I have? |
18:43:05 | Araq | certainly, run the getch() in a different thread |
18:43:29 | Araq | instead of the main thread, a dedicated IO thread works for nimsuggest |
18:43:44 | shashlick | but I don't get a cursor if I do that - let me verify again though |
18:44:22 | Araq | works for nimsuggest and the examples in dom's book |
18:45:36 | shashlick | how come when I change a single file in my project, recompile goes through every file? I'm not using -f |
18:46:51 | Araq | nim doesn't yet cache compilations |
18:55:12 | shashlick | okay cool |
19:00:37 | shashlick | no luck - moved getch() to a background thread and everything works but no cursor |
19:01:19 | Araq | use readline like the rest of us |
19:01:34 | Araq | or use some real UI library, the terminal is bullshit |
19:02:00 | shashlick | i'm writing an editor so cannot wait for a newline, and avoiding ncurses so getting tortured as expected |
19:04:02 | shashlick | here's the code - check it out https://github.com/genotrance/snip |
19:04:33 | shashlick | i am trying to get the compile done in the background and that's working great but cannot update the UI since i'm blocked for user input |
19:04:58 | shashlick | that's why want to move the getch() into a thread |
19:07:52 | shashlick | looks like I'll have to go back to my old model of showing output only when you hit F5 instead of realtime |
19:08:03 | shashlick | regardless, it takes time to compile/execute and get the output so there will always be a delay |
19:09:07 | Araq | fork nimedit and make it awesome |
19:10:59 | shashlick | will look into it Araq - snip is just a quick test tool, no plans for making it a fully competent editor |
19:11:23 | shashlick | like snip https://gist.github.com/user/hash will load the gist, also looking into creating/updating gists |
19:11:38 | * | couven92 joined #nim |
19:12:46 | * | couven92 quit (Remote host closed the connection) |
19:13:11 | * | couven92 joined #nim |
19:31:33 | shashlick | got it to work, needed to flush stdout |
19:31:52 | * | yglukhov quit (Remote host closed the connection) |
19:31:53 | Araq | interesting, good to know |
19:32:02 | Araq | patch the docs to mention that for 'getch' |
19:32:23 | Araq | (which should have gotten a real name btw, like readKey) |
19:32:57 | * | obadz quit (Ping timeout: 240 seconds) |
19:35:28 | FromGitter | <data-man> terminal should have getInputEvent (keyboard, mouse, changes of console size) |
19:37:14 | * | obadz joined #nim |
19:37:54 | shashlick | Araq: had to use conio.h for getch() and kbhit() on windows since terminal doesn't have kbhit and getch() eats up special chars |
19:39:21 | shashlick | for Linux, again had to make up kbhit() |
19:40:14 | shashlick | mapping getch() values to actual keys is a separate nightmare |
19:41:51 | FromGitter | <data-man> @shashlick: See #6966 |
19:45:43 | * | BitPuffin quit (Remote host closed the connection) |
19:47:05 | shashlick | @data-man: nice work, and recent too! |
19:47:45 | shashlick | check out my hodge podge around key detection https://github.com/genotrance/snip/blob/master/src/snip/key.nim#L22 |
19:48:12 | shashlick | https://github.com/genotrance/snip/tree/master/src/snip/term |
19:49:18 | * | scriptum joined #nim |
19:51:30 | FromGitter | <data-man> @shashlick: I can't agree, not nice. There is a bugs. |
19:55:11 | shashlick | I'll bet - desperately need a good implementation |
19:55:29 | shashlick | termbox is not supported on Windows so couldn't use that |
20:01:00 | FromGitter | <data-man> #7062 The more opinions and ideas, the closer the implementation. ;) |
20:03:31 | shashlick | I scavenged the net for days to find something useful, there's no consistency on key codes that I could see so you have to make a map for each OS/terminal |
20:04:27 | shashlick | terminfo/termcap also are not useful since they don't cover all keys and $TERM doesn't necessarily match what keys are sent by the terminal client |
20:04:41 | shashlick | say putty which can change it's mappings but remote server still just says TERM=xterm or whatever |
20:04:54 | * | Snircle joined #nim |
20:05:35 | * | obadz quit (Ping timeout: 240 seconds) |
20:06:29 | shashlick | happy to help in any way though |
20:06:52 | shashlick | that's why you see this hodge podge (confused mess) for key mapping in snip :) |
20:07:16 | * | obadz joined #nim |
20:14:20 | * | obadz quit (Ping timeout: 276 seconds) |
20:14:59 | * | endragor joined #nim |
20:16:31 | * | yglukhov joined #nim |
20:17:14 | * | obadz joined #nim |
20:19:11 | * | endragor quit (Ping timeout: 248 seconds) |
20:33:39 | * | jxy quit (Quit: leaving) |
20:33:58 | * | jxy joined #nim |
20:36:01 | * | Yardanico quit (Remote host closed the connection) |
20:42:08 | * | marenz joined #nim |
20:44:28 | * | obadz- joined #nim |
20:44:58 | * | obadz quit (Ping timeout: 256 seconds) |
20:45:00 | * | obadz- is now known as obadz |
20:59:12 | * | rauss quit (Quit: WeeChat 2.0.1) |
21:02:00 | * | marenz quit (Remote host closed the connection) |
21:03:01 | * | rauss joined #nim |
21:30:14 | * | xet7_ joined #nim |
21:31:29 | * | xet7_ quit (Remote host closed the connection) |
21:32:01 | * | xet7_ joined #nim |
21:32:15 | * | xet7 quit (Ping timeout: 256 seconds) |
21:33:07 | * | xet7_ is now known as xet7 |
21:43:20 | * | couven92 quit (Ping timeout: 256 seconds) |
21:43:29 | * | Vladar quit (Quit: Leaving) |
21:55:40 | * | MJCaley quit (Quit: MJCaley) |
21:59:32 | * | nsf joined #nim |
22:09:18 | * | endragor joined #nim |
22:13:48 | * | endragor quit (Ping timeout: 240 seconds) |
22:18:46 | * | Jesin quit (Quit: Leaving) |
22:19:36 | * | nsf quit (Quit: WeeChat 2.0.1) |
22:55:39 | * | couven92 joined #nim |
23:02:11 | * | MJCaley joined #nim |
23:05:30 | * | sz0 joined #nim |
23:12:52 | * | MJCaley quit (Quit: MJCaley) |
23:15:14 | * | endragor joined #nim |
23:18:08 | FromGitter | <Quelklef> So, I just fixed a bug that arose because I overrode the `==` operator for a `ref` type to compare data rather than identity... Araq, I'm so sorry. I regret all my sins. |
23:18:19 | FromGitter | <Quelklef> Is there a way to write a `==` comparing the underlying non-ref type? |
23:18:37 | FromGitter | <Quelklef> Or will I have to define `type A = ref object of B` and defined `==` for `B`? |
23:19:00 | FromGitter | <Quelklef> So that I can compare data via `first[] == second[]` |
23:19:18 | * | endragor quit (Ping timeout: 240 seconds) |
23:21:30 | dom96 | Why don't you just define a non-ref type? |
23:22:35 | FromGitter | <Quelklef> That's what I was planning on doing, but I figure'd i'd ask in case there's a more elegant solution |
23:22:43 | FromGitter | <Quelklef> Writing a one-off type just feels gross |
23:25:13 | FromGitter | <Quelklef> Oh, also, it won't work, unfortunately |
23:25:33 | FromGitter | <Quelklef> wait ignore me |
23:27:11 | FromGitter | <Quelklef> Yeah, it won't. I'm using method and sub-types (?), and part of my equality test is that they're the same type (`first of second.type and second of first.type`) |
23:27:26 | FromGitter | <Quelklef> This means I can't define it for the non-ref type, because all the polymorphism happens on the level of the ref type |
23:28:26 | FromGitter | <Quelklef> And I can't define it for the ref type, because `==` should be for identity. The only remaining option is writing a second equality tester, say, `proc equiv`, which does the testing I want. Is this all just a manifestation of bad coding on my part? |
23:35:03 | * | gokr left #nim (#nim) |
23:36:50 | dom96 | It might help if you explain what this type of yours is |
23:43:20 | * | MJCaley joined #nim |
23:43:36 | FromGitter | <Quelklef> A node on an AST. The base type is `Node` and each subtype is an actual node type, `Operator`, `FuncDef`, etc. |
23:44:12 | FromGitter | <Quelklef> I wanted to define special equality testing for these types which compared a subset of properties, because I wanted to ignore a few |
23:44:22 | FromGitter | <Quelklef> So I did, via `==`, and found out that was a terrible idea. |
23:44:43 | FromGitter | <Quelklef> If there were a dedicated comparison by identity operator my problem would be solved (is there? am I just ignorant?) |
23:45:18 | dom96 | So you're using inheritance for an AST type? |
23:45:40 | * | CcxWrk quit (*.net *.split) |
23:45:40 | * | Shoozza quit (*.net *.split) |
23:48:58 | * | arecaceae quit (Remote host closed the connection) |
23:49:21 | * | arecaceae joined #nim |
23:51:11 | * | Shoozza joined #nim |
23:51:11 | * | CcxWrk joined #nim |
23:56:18 | FromGitter | <Quelklef> right |
23:57:41 | * | MJCaley quit (Quit: MJCaley) |