00:36:43 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
00:40:01 | Cadey | how do i export everything in a nim file? |
00:40:06 | Cadey | like all at once |
00:40:13 | Cadey | (yes i know this is a bad idea) |
00:48:45 | shashlick | Nice @treeform |
00:49:08 | shashlick | I'm using scintilla |
00:50:38 | shashlick | Is this cross platform? Will be cool to use it for feud |
01:09:18 | * | laaron quit (Remote host closed the connection) |
01:11:54 | * | laaron joined #nim |
01:37:00 | * | owl_000 joined #nim |
01:39:32 | * | owl joined #nim |
01:51:32 | * | btop joined #nim |
02:03:06 | owl | i created a function, if i try to compile it says "expression.......type of int and has to be discarded", what does it mean. then i use discard bfore function call and it works fine. |
02:04:31 | FromGitter | <zacharycarter> treeform: neat - looks awesome |
02:04:58 | FromGitter | <awr1> @owl in nim all non-void functions must have their return value used. otherwise you use "discard" |
02:05:01 | owl | var y = function, also works. so if function return unused then i should discard? |
02:05:29 | owl | yes |
02:05:33 | FromGitter | <awr1> alternatively if you really want you can tag a proc `{.discardable.}` and you don't have to prepend `discard` if you want to just call it by itself |
02:10:21 | owl | another question, in online i see some example of function/proc call without any brackets, same like echo. but when i going to use bracket in that function it produces error |
02:11:49 | * | btop quit (Ping timeout: 246 seconds) |
02:13:10 | owl | https://nim-by-example.github.io/varargs/ here, in first example, `printThings "words", "to", "print"` no bracket works fine. but i tried it by using bracket as i thought it as proc call, it produces error. |
02:13:47 | owl | this error E:\Nim\function\procedure.nim(22, 13) Error: type mismatch: got <tuple of (string, string, string)> |
02:17:26 | owl | so when one use bracket and when should avoid. |
02:21:03 | * | nif quit (Quit: ...) |
02:21:12 | * | nif joined #nim |
02:23:24 | * | endragor joined #nim |
02:24:08 | * | nif quit (Client Quit) |
02:24:18 | * | nif joined #nim |
02:27:14 | * | owl_000 quit (Quit: Leaving) |
02:27:29 | * | nif quit (Client Quit) |
02:27:36 | * | owl quit (Quit: Leaving) |
02:27:48 | * | nif joined #nim |
02:28:20 | * | owl_000 joined #nim |
02:55:34 | FromGitter | <awr1> you can show me your code but if i had to guess it's because you put a space between the procedure and the parentheses, e.g. `foo ("abc")` and not `foo("abc")` |
02:57:25 | FromGitter | <awr1> i want to say there was some github issue about generating a warning for this. but i can't remember |
02:58:55 | * | btop joined #nim |
03:04:14 | leorize | owl_000: don't put a space between the proc name and the brackets |
03:04:41 | leorize | it's an artifact of this: https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
03:09:41 | FromGitter | <awr1> we really should be emitting more warnings for the errors new nim users run into |
03:25:47 | owl_000 | leorize, yes the problem is with space. removing space works fine. |
03:26:52 | owl_000 | fromGitter, true compiler should warn me about this. simple error, because of my lack of knowledge, creates all the troubles. |
03:27:21 | leorize | that's just the forwarding bot from nim's gitter channel |
03:27:33 | leorize | the user name is in those brackets <> |
03:28:39 | * | owl joined #nim |
03:32:10 | * | owl_000 quit (Ping timeout: 272 seconds) |
03:32:48 | * | owl left #nim (#nim) |
03:33:02 | * | owl joined #nim |
03:34:39 | * | owl quit (Quit: Leaving) |
03:49:59 | * | snooptek joined #nim |
03:52:04 | * | chemist69 quit (Ping timeout: 252 seconds) |
03:53:54 | * | chemist69 joined #nim |
04:02:03 | * | owl_000 joined #nim |
04:10:38 | * | rockcavera quit (Remote host closed the connection) |
04:14:22 | * | dddddd quit (Remote host closed the connection) |
04:25:53 | * | theelous3 quit (Ping timeout: 245 seconds) |
04:29:14 | * | fjellfras joined #nim |
04:29:22 | * | laaron quit (Remote host closed the connection) |
04:31:19 | * | laaron joined #nim |
04:37:40 | * | nsf joined #nim |
04:43:34 | * | darithorn quit (Quit: Leaving) |
04:56:41 | FromGitter | <awr1> made an issue https://github.com/nim-lang/Nim/issues/12006 |
04:59:13 | Araq | how should we "warn" about it? you get an error already |
04:59:47 | Araq | extend the error message? |
05:01:49 | FromGitter | <Varriount> Araq: Wave a red flag in front of the user. :P |
05:05:09 | FromGitter | <awr1> extend the error to a suggestion, since it's not obvious what happened |
05:05:54 | FromGitter | <awr1> uhhhh |
05:08:14 | FromGitter | <awr1> "Potentially incorrect procedure call: if you meant to call this as an argument list and not as a tuple, avoid spaces between the parentheses and the procedure name." |
05:08:31 | FromGitter | <awr1> something like that |
05:10:11 | * | snooptek quit (Remote host closed the connection) |
05:11:17 | FromGitter | <awr1> also how frequently does the nim-lang.org docs update |
05:12:08 | FromGitter | <awr1> maybe i should rephrase that |
05:12:36 | FromGitter | <awr1> are those docs just from master or are they supposed to be from devel but they need to be updated |
05:17:18 | * | owl_000 quit (Ping timeout: 272 seconds) |
05:23:58 | FromGitter | <Obround> How do you set code reordering for a section of code? |
05:24:35 | FromGitter | <awr1> you can't. you can only localize it to a specific module |
05:24:55 | FromGitter | <Obround> Hmm... |
05:26:11 | FromGitter | <awr1> @Obround you keep asking how to accomplish very strange things in nim and i keep getting progressively more puzzled, lol |
05:28:33 | FromGitter | <Obround> :) |
05:40:14 | Araq | awr1: the error message is already excessive |
05:40:39 | Araq | and ideally newbies become advanced users |
05:44:43 | * | solitudesf- joined #nim |
05:52:18 | Araq | awr1: the docs reflect the latest stable release |
05:53:05 | leorize | Araq: it's still 0.20.0 docs |
05:56:36 | skrylar[m] | @zacharycarter what ever happened to that pr for DDS :^) |
05:59:43 | skrylar[m] | also i thought it already did some degree of incremental compilation. hm |
06:01:33 | skrylar[m] | i remember trying to use gtk-rs took about fifteen seconds to compile a hello world that was just one frame and a label, and they weren't exactly using overly ambitious macros. |
06:01:54 | FromGitter | <zacharycarter> skrylar[m]: I don't think the Nim ecosystem has what I need atm for working with bgfx and different image formats |
06:02:16 | FromGitter | <zacharycarter> I was trying to produce bindings last night to bimg but it's C++ and I think I've hit my patience threshold |
06:03:47 | skrylar[m] | bindings are a real bear. i managed to mostly do it with gdk and some python scripting, haven't turned it on gtk yet |
06:07:39 | FromGitter | <zacharycarter> yeah, I'm sure I'm doing something wrong, but what exactly isn't easy to figure out |
06:08:26 | FromGitter | <zacharycarter> I do know though, that it's going to be a lot more work to get all the texture loading support for different formats in Nim than the alternative |
06:09:45 | * | narimiran_ joined #nim |
06:09:58 | * | narimiran_ is now known as narimiran |
06:15:09 | * | PMunch joined #nim |
06:15:50 | FromGitter | <zacharycarter> Zevv: question about npeg, and this may be a very naive question because I'm quite new to PEGs... |
06:16:34 | FromGitter | <zacharycarter> I have an input file that has a bunch of lines I don't care about - I'm really only interested in extracting quoted strings that start with specific prefixes |
06:17:33 | FromGitter | <zacharycarter> would it be easy to construct a grammar to extract these strings, or would it just be easier to use regex? I was playing around with a peg tool in my browser, but I couldn't figure out a way to construct a rule that ignored everything but the rule(s) I set up to match the quoted, prefixed strings |
06:18:01 | FromGitter | <zacharycarter> I guess anyone who is familiar with PEGs can answer this question :) |
06:22:21 | leorize | narimiran: can you fix the stable docs "Source" link? |
06:22:43 | narimiran | leorize: hmm, wasn't that fixed? :/ |
06:23:05 | leorize | nope, still pointing to master |
06:25:37 | Zevv | zacharycarter: that should be no problem. |
06:25:42 | Zevv | do you have an example? |
06:25:43 | skrylar[m] | @zacharycarter depending on the particular syntax of the peg implementation, you'd just parse something like "not prefix all" and then ignore it |
06:25:56 | Zevv | or use the @ operator to search |
06:26:09 | Zevv | which is just sugar for what skylar says |
06:26:32 | FromGitter | <zacharycarter> Zevv: Let me put together a quick gist |
06:26:38 | Zevv | k |
06:27:14 | FromGitter | <zacharycarter> https://gist.github.com/zacharycarter/fe815a244bc26b370183cd16ab817c3a |
06:27:27 | FromGitter | <zacharycarter> basically I just want to extract the strings that start with "RES_" |
06:27:43 | FromGitter | <zacharycarter> and I'll have multiple of these string matchers, another will be "CONSUM_" etc |
06:27:52 | FromGitter | <zacharycarter> and everything else I can pretty much ignore |
06:31:23 | * | fjellfras_ joined #nim |
06:32:15 | * | fjellfras quit (Read error: Connection reset by peer) |
06:43:13 | Zevv | ~astebinit /tmp/t.nim |
06:43:16 | Zevv | oops |
06:43:30 | Zevv | https://paste.debian.net/1097054/ |
06:43:33 | Zevv | something like that |
06:44:19 | leorize | I can see that you got the same way of pasting files as I do :P |
06:44:35 | FromGitter | <zacharycarter> thanks |
06:45:11 | Zevv | match multiple zachs, where one zach is "search for" RES followed by everything but a quote |
06:45:34 | FromGitter | <zacharycarter> awesome - I'll give this a shot, thanks a lot Zevv! |
06:45:45 | Zevv | yw |
06:46:02 | leorize | Zevv: why is the second argument to `peg` a string and not an ident? |
06:46:19 | Zevv | could be an ident as well i gues, try it |
06:46:31 | Zevv | its just strvalled |
06:46:49 | Zevv | good point btw |
06:47:34 | Zevv | zach: if you want to match others like CONSUM |
06:47:59 | * | krux02 joined #nim |
06:48:29 | Zevv | do ("RES" | "CONSUM") |
06:55:05 | * | Vladar joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:01:30 | FromGitter | <zacharycarter> gotcha - thanks |
07:04:36 | * | gmpreussner joined #nim |
07:05:36 | * | btop quit (Ping timeout: 272 seconds) |
07:15:51 | FromGitter | <zacharycarter> Zevv: is there any way to enforce that the match starts from the start of the string? |
07:16:09 | FromGitter | <zacharycarter> I guess there are some strings in this file that are like "BLD_FOO_RES" |
07:16:12 | FromGitter | <zacharycarter> and it's grabbing those as well |
07:16:41 | FromGitter | <zacharycarter> for instance - `BLD_RES_OilDerrick|->RES_Level` |
07:16:57 | FromGitter | <zacharycarter> I'd like to ignore all occurrences that don't start with "RES_" |
07:20:35 | FromGitter | <zacharycarter> meh - I'm probably just going to end up asking you tons of questions about this so I'll just try to do more learning about pegs |
07:21:28 | Zevv | sure, explicitly match the leading quote: https://paste.debian.net/1097057/ |
07:21:42 | * | owl_000 joined #nim |
07:21:49 | Zevv | its better to split it up a bit to keep it clear |
07:22:34 | * | owl joined #nim |
07:23:38 | FromGitter | <zacharycarter> cooool - thank you! |
07:25:35 | Zevv | https://paste.debian.net/1097059/ |
07:25:52 | Zevv | I can make a little video tutorial one day |
07:26:47 | narimiran | Zevv: ^ yes please!!! |
07:34:22 | * | laaron- joined #nim |
07:35:27 | FromGitter | <arnetheduck> @mratsim in bls, we use bigint ops and do recalcs in nim + `stint` |
07:35:33 | * | laaron quit (Remote host closed the connection) |
07:36:32 | FromGitter | <mratsim> bls doesn't import stint, it's pure C: https://github.com/status-im/nim-blscurve/blob/master/blscurve.nimble |
07:37:27 | * | d10n quit (Quit: why all the #hashtags #lol #hackers #overheard) |
07:37:35 | * | btop joined #nim |
07:39:41 | * | d10n joined #nim |
07:39:41 | * | d10n quit (Changing host) |
07:39:41 | * | d10n joined #nim |
07:41:25 | * | fjellfras_ quit (Quit: Leaving) |
07:41:52 | Araq | https://play.nim-lang.org/#ix=1T7e @mratsim, this compiles |
07:42:19 | Araq | so if you happen to have Tensor-related stuff that fails |
07:42:24 | Araq | I would be grateful |
07:42:34 | * | btop quit (Ping timeout: 246 seconds) |
07:42:41 | FromGitter | <arnetheduck> @deech takes about 30s to build one of the binaries in debug mode on a 6-core machine - we have about 15 binaries to build |
07:43:04 | FromGitter | <mratsim> interesting, my tensors are dynamic though, I don't use static dimension |
07:43:21 | FromGitter | <arnetheduck> I know bls is pure C, but we use stint throughout and it's a bigint library |
07:43:27 | FromGitter | <arnetheduck> sort of |
07:43:56 | Araq | bbl |
07:43:58 | FromGitter | <arnetheduck> point is, we have plans to eventually move that to nim too - |
07:43:58 | FromGitter | <mratsim> If static array / higher-order static works, do you know if that works now? https://github.com/nim-lang/Nim/issues/11142 |
07:44:52 | * | shomodj joined #nim |
07:44:53 | FromGitter | <mratsim> I can define the "modulo static bigint" types but not pass them to a function |
07:48:28 | * | arecaceae quit (Remote host closed the connection) |
07:48:52 | * | arecaceae joined #nim |
07:52:14 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
07:55:41 | * | terps joined #nim |
07:58:02 | * | shomodj joined #nim |
08:09:26 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:10:00 | * | btop joined #nim |
08:15:03 | * | btop quit (Ping timeout: 244 seconds) |
08:15:59 | * | NimBot joined #nim |
08:16:38 | * | floppydh joined #nim |
08:41:24 | * | ng0 joined #nim |
08:48:53 | * | shomodj joined #nim |
08:53:54 | * | laaron- quit (Remote host closed the connection) |
08:54:16 | * | laaron joined #nim |
09:08:26 | * | btop joined #nim |
09:14:10 | * | btop quit (Ping timeout: 272 seconds) |
09:22:50 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:24:45 | * | Perkol joined #nim |
09:31:36 | * | terps quit (Ping timeout: 252 seconds) |
09:32:27 | * | snooptek joined #nim |
09:36:20 | * | owl quit (Ping timeout: 272 seconds) |
09:36:20 | * | owl_000 quit (Ping timeout: 272 seconds) |
09:39:16 | * | fjellfras joined #nim |
09:39:30 | * | fjellfras quit (Max SendQ exceeded) |
09:40:01 | * | fjellfras joined #nim |
09:50:44 | * | shomodj joined #nim |
09:56:52 | PMunch | Hmm, what AST would the "echo join args" line actually expand to in this case? http://ix.io/1T7J/Nim |
10:03:00 | Araq | nkCommand("echo", nkCommand("join", "args")) |
10:04:09 | * | btop joined #nim |
10:04:33 | * | shomodj_ joined #nim |
10:07:20 | * | narimiran quit (Remote host closed the connection) |
10:07:58 | * | shomodj quit (Ping timeout: 245 seconds) |
10:09:12 | * | btop quit (Ping timeout: 245 seconds) |
10:16:49 | * | terps joined #nim |
10:36:32 | * | Perkol quit (Remote host closed the connection) |
10:39:01 | * | btop joined #nim |
10:44:13 | * | btop quit (Ping timeout: 245 seconds) |
10:56:10 | * | nif quit (Quit: ...) |
10:56:20 | * | nif_ joined #nim |
11:08:11 | * | joki1337 joined #nim |
11:20:15 | * | endragor quit (Remote host closed the connection) |
11:20:56 | PMunch | Araq, well yeah, but since it's a template, what does "args" become? |
11:21:15 | PMunch | I'm unable to call getAst on a vararg template.. |
11:21:19 | PMunch | For some reason |
11:23:42 | * | fjellfras quit (Quit: Leaving) |
11:32:30 | * | joki1337 quit (Quit: WeeChat 2.5) |
11:35:08 | * | leorize quit (Ping timeout: 260 seconds) |
11:36:13 | * | theelous3 joined #nim |
11:37:56 | * | leorize joined #nim |
11:39:06 | FromDiscord_ | <Núkley> Hello |
11:39:11 | PMunch | Hi |
11:39:19 | FromDiscord_ | <Núkley> How would i download a file through nim? |
11:40:05 | PMunch | Guessing it's from a HTTP server, in that case the httpclient would work |
11:40:12 | PMunch | nim-lang.org/docs/httpclient.html |
11:40:39 | FromDiscord_ | <Núkley> Does it matter if its https? |
11:40:45 | FromGitter | <alehander42> notice you can use `AsyncHttpClient` from this module |
11:40:48 | FromGitter | <alehander42> if you want async/await |
11:41:14 | PMunch | Núkley: https://nim-lang.org/docs/httpclient.html#sslslashtls-support |
11:41:47 | PMunch | Basically just pass -d:ssl to Nim when it's compiling and it should work fine |
11:42:08 | * | terps quit (Ping timeout: 245 seconds) |
11:43:07 | FromGitter | <alehander42> PMunch, btw you can use instantiation info in such a debug dsl |
11:43:25 | PMunch | Yeah I know |
11:43:28 | FromGitter | <alehander42> i've found out its very helpful to have original path/line for all of my output |
11:43:31 | FromGitter | <alehander42> even in my python code |
11:43:42 | FromGitter | <alehander42> (where i use the frame api or something) |
11:43:45 | PMunch | But I'm writing an article about AST and metaprogramming |
11:43:56 | PMunch | And creating nice dot diagrams of the AST |
11:44:01 | FromGitter | <alehander42> ah i see |
11:44:12 | PMunch | So I try to keep everything as short as possible to not create monstrous graphs :P |
11:44:27 | FromGitter | <alehander42> well, thats the problem with dot diagrams :P |
11:44:29 | PMunch | Ref. this thing: https://uploads.peterme.net/macro.png |
11:44:48 | FromGitter | <alehander42> i think thats one of the biggest problems with visual languages overally |
11:44:57 | PMunch | What do you mean? |
11:45:00 | Araq | PMunch: check your code still works with https://github.com/nim-lang/Nim/pull/11985 please |
11:45:02 | FromGitter | <alehander42> text scales easily |
11:45:10 | FromGitter | <alehander42> in one direction |
11:45:24 | PMunch | Araq, what code? |
11:45:36 | Araq | your macro tutorial stuff |
11:46:30 | PMunch | Huh? |
11:46:35 | FromGitter | <alehander42> i dont think ive ever used gensym |
11:46:38 | PMunch | This thing? peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html |
11:47:01 | PMunch | alehander42, I've used it from time to time |
11:47:20 | Araq | alehander42: but 'quote do' uses templates which use gensym... |
11:47:28 | FromGitter | <alehander42> i see |
11:47:44 | Araq | PMunch: I mean if you generate the DOT graphs |
11:48:10 | FromGitter | <alehander42> but often i dont want it and i make my own let aNode = ident"a" |
11:48:23 | FromGitter | <alehander42> to use it like `aNode: int` etc |
11:48:28 | PMunch | Oh you want me to check that the graphs don't change? |
11:48:32 | Araq | we're getting 'quoteAst' |
11:48:35 | Araq | PMunch: yeah |
11:48:53 | Araq | 'quoteAst' doesn't have quote do's problems but all new ones |
11:49:02 | Araq | :-) |
11:49:08 | PMunch | Well they're super simple stuff, like echo "Hello world" simple |
11:49:29 | PMunch | I'm just trying to explain what the AST is and what it means for templates and macros |
11:50:19 | FromGitter | <alehander42> what will happen with all the `quote:` code |
11:50:30 | FromGitter | <alehander42> i have it everywhere |
11:51:03 | FromGitter | <alehander42> will it be removed, or just not bugfixed anymore |
11:52:03 | Araq | alehander42: there will be 2 ways for a period of time |
11:52:19 | Araq | that means "not bugfixed anymore" |
11:52:54 | FromGitter | <gogolxdong> @shashlick, do you have plan to use typography instead of scintilla? I think it would help a lot. |
11:53:37 | FromGitter | <gogolxdong> We need an official Nim editor ;) |
11:55:11 | PMunch | Aporia? |
11:57:03 | FromGitter | <Vindaar> @Araq just saw you had to use `--setversion:0.19` for plotly on your gensym branch. I'll look into it over the weekend. I'll get back to you if I stumble on some showstoppers |
11:57:19 | shashlick | It's a long shot and I'm stuck for other reasons but using a Nim cross platform ui will be awesome |
11:57:39 | shashlick | Depends on how far @treeform takes it |
11:57:56 | Araq | Vindaar: well I'm still working on it, maybe it already works without this switch |
11:58:27 | FromGitter | <Vindaar> ok, I'll test it :) |
12:00:18 | * | vlad1777d joined #nim |
12:04:47 | * | skelett joined #nim |
12:04:54 | * | Kaivo joined #nim |
12:08:21 | PMunch | In case anyone else wants to play around with creating dot graphs: http://ix.io/1T88/Nim |
12:10:04 | FromGitter | <alehander42> we need a dot-building dsl lib |
12:10:07 | * | rockcavera joined #nim |
12:10:11 | FromGitter | <alehander42> to graph all the things :P |
12:11:47 | FromGitter | <mratsim> to graph nimble dependencies |
12:19:58 | FromGitter | <alehander42> good idea |
12:23:20 | FromDiscord_ | <Kiloneie> Does anyone have experience with wordpress.org ? I am currently in a dilema between the 3 hosting sites that go along with it... |
12:25:37 | FromGitter | <alehander42> btw Araq, would it be |
12:25:47 | FromGitter | <alehander42> possible to use the tag system to catch blocking calls |
12:26:20 | FromGitter | <alehander42> e.g. i have a macro m call() |
12:26:33 | Araq | the tag system is useless |
12:26:37 | FromGitter | <alehander42> and m can check call's function type and its explicit tags |
12:26:44 | FromGitter | <alehander42> hmm |
12:26:46 | dom96 | alehander42: that is a thought I had as well |
12:26:51 | dom96 | The tag system isn't useless |
12:26:54 | FromGitter | <alehander42> but wouldnt it work |
12:27:04 | FromGitter | <alehander42> because if e.g. there is no explicit blocking tag |
12:27:05 | Araq | surely you can tag blocking procs, the IO tag already exists for it |
12:27:09 | FromGitter | <alehander42> but later the compiler typechecks it |
12:27:18 | FromGitter | <alehander42> and finds out it has io calls, it will error |
12:27:19 | FromGitter | <alehander42> so its ok |
12:27:23 | FromGitter | <alehander42> ah IO ok |
12:27:23 | dom96 | Araq is just giving up on it prematurely IMO |
12:27:40 | dom96 | We should have a dedicated SynchronousIO tag |
12:27:43 | * | PMunch quit (Remote host closed the connection) |
12:27:49 | FromGitter | <alehander42> yeah, thats what i mean |
12:27:57 | dom96 | and the ability to state that async procs are not allowed that tag |
12:28:09 | Araq | can async procs log? |
12:28:15 | FromGitter | <alehander42> @dom96 or you can even auto-offload them to threads sometimes |
12:28:22 | FromGitter | <alehander42> when the thread-async combo works |
12:28:26 | dom96 | yep |
12:28:34 | dom96 | Araq sure |
12:28:43 | Araq | does 'log' block? |
12:28:57 | Zevv | I assume it can |
12:30:06 | Zevv | I does for me if its just writing to a file |
12:30:16 | dom96 | yes, it can. |
12:30:17 | FromGitter | <alehander42> well, somebody must've solved this |
12:33:41 | Araq | wohoo, it's green https://github.com/nim-lang/Nim/pull/11985 |
12:33:58 | FromGitter | <alehander42> the thing is, @zah explained me some reasons why detecting blocking probably needs something more involved than tags, but i thought i've found a way that works |
12:34:05 | FromGitter | <alehander42> so i wondered what am i missing |
12:35:29 | Araq | "blocking" doesn't mean much, if anything. |
12:35:42 | * | owl_000 joined #nim |
12:36:13 | Araq | does 'write' "block" when the OS keeps it in the RAM file cache? |
12:36:20 | FromGitter | <alehander42> ok, generally invoking a procedure of the set "X" |
12:36:32 | Araq | what about an SSD? |
12:36:41 | * | terps joined #nim |
12:37:08 | Araq | how exactly is a cache miss on a[i] not blocking? |
12:37:23 | dom96 | Can you do it asynchronously? |
12:37:31 | dom96 | If no -> not a blocking call |
12:37:43 | FromGitter | <alehander42> well its a matter of X i guess |
12:37:57 | FromGitter | <alehander42> whats the limit for a certain usecase |
12:38:14 | FromGitter | <alehander42> if e.g. a cache miss can't get close to that limit as a time |
12:38:25 | FromGitter | <alehander42> it doesnt matter |
12:39:37 | Araq | that reminds me... I wanted to benchmark threads |
12:39:40 | FromGitter | <alehander42> thats why a more general nuanced method might be more useful |
12:40:09 | * | sz0 joined #nim |
12:40:10 | * | btop joined #nim |
12:40:18 | FromGitter | <alehander42> e.g. for my app i decide that certain 20 primitives should be checked, other 15 not |
12:40:25 | FromGitter | <alehander42> and i tag only those somehow |
12:42:01 | dom96 | yes, you would just tag all the functions in `net` |
12:42:08 | dom96 | initially at least |
12:42:17 | dom96 | also `waitFor` |
12:42:23 | dom96 | and that would already make this feature sweet |
12:43:16 | Zevv | a recv is not bocking if the underlying socket is set to nonblock |
12:43:27 | Zevv | track that :/ |
12:43:52 | Zevv | same for any unix fd, actually |
12:44:44 | dom96 | good point |
12:44:56 | dom96 | something that should be made impossible to do on a Socket |
12:45:23 | dom96 | or perhaps not |
12:45:26 | * | btop quit (Ping timeout: 268 seconds) |
12:45:42 | Araq | Zevv: you can introduce two different unix FD types and have a distinction that the OS doesn't make |
12:45:48 | dom96 | but if you set your Socket to be non-blocking you're on your own when it comes to its effects |
12:46:07 | dom96 | in that case we might allow tags to be overriden temporarily |
12:46:23 | Zevv | Araq: i was thinking the same, but that's nasty and error prone. Keeping redundant track of the blockyness |
12:46:29 | Araq | not really difficult to do but the problem is the concept of "blocking" itself IMHO |
12:46:58 | Zevv | well, I think doms definition is pretty pragmatic, but then again *everything* is blocking |
12:47:23 | Zevv | a = 3 blocks as well |
12:48:04 | Zevv | on the OS level I'd say everything that potentially scheduls your process out is blocking. |
12:48:14 | Araq | 'spawn' and concurrency in general is not defined in terms of "blocking" |
12:48:43 | Zevv | if "something else" needs to done "somewhere else" to fulfill your request, then its blocking. But that does not make sense at the programming language level |
12:48:48 | Araq | you create a new thread/task/process, it runs concurrently |
12:50:42 | Zevv | but you're right, the definition is problematic at least. Allocating a handful of bytes might block on the VM, nothing you can do or track for that. It might happen while growing a stack frame, not on function call boundaries |
12:51:07 | Zevv | /block on VM/ |
12:51:35 | Zevv | it might happen when writing data when the kernel is COWing |
12:52:57 | FromGitter | <alehander42> ok Araq i have another idea |
12:57:59 | FromGitter | <alehander42> how .. |
12:58:10 | FromGitter | <alehander42> there was a way to write down just one overload of `call` |
12:58:16 | dom96 | The goal is to prevent accidentally using blocking calls which have async equivalents |
12:58:37 | dom96 | I don't see why we're arguing about the definition of `blocking` for that |
12:58:48 | FromGitter | <alehander42> `(proc: void)(call)` ? |
12:58:50 | Zevv | sorry :) |
13:02:57 | * | terps quit (Ping timeout: 250 seconds) |
13:04:31 | FromGitter | <alehander42> https://paste.ofcode.org/3bRqPwHVE9uBRRnhNu7JswA |
13:04:40 | FromGitter | <alehander42> Araq @dom96 : so this is another approach |
13:04:47 | FromGitter | <alehander42> its like a custom macro-based tag system |
13:05:10 | FromGitter | <alehander42> which has some pro-s: e.g. in my own project i can "tag" whatever functions i import |
13:05:16 | FromGitter | <alehander42> without touching the stdlib/original code |
13:06:02 | FromGitter | <alehander42> and it seems i can check succesfully in a macro if a call is blocked on base of it (at least for this simple example) |
13:06:13 | FromGitter | <alehander42> or not even blocked , it doesnt matter |
13:06:23 | FromGitter | <alehander42> that it's X-ed where i care for X in my own project |
13:06:44 | FromGitter | <alehander42> (the other problem is that i couldnt access tags in macros .. i guess they're inferred .. and thats why) |
13:07:16 | * | narimiran joined #nim |
13:08:50 | FromGitter | <alehander42> of course the point where this completely fails is that it has to check non-direct calls |
13:08:58 | * | terps joined #nim |
13:10:48 | * | leorize quit (Ping timeout: 260 seconds) |
13:11:40 | * | leorize joined #nim |
13:13:23 | * | btop joined #nim |
13:15:26 | dom96 | that just looks like reinventing tags |
13:15:42 | dom96 | you can also mark procs with your own tags in your own project |
13:16:03 | dom96 | just wrap the API in a proc doBlah() {.tags: [MyTags].} = someLib.doBlah() |
13:17:45 | FromGitter | <alehander42> but the problem is |
13:17:47 | FromGitter | <alehander42> that this cant work |
13:18:00 | FromGitter | <alehander42> because you cant access tags in e.g. macros |
13:18:22 | * | btop quit (Ping timeout: 245 seconds) |
13:18:41 | FromGitter | <alehander42> the wrapping thing doesnt work |
13:18:46 | FromGitter | <alehander42> because i can use another lib |
13:18:52 | FromGitter | <alehander42> which directly calls those primitives |
13:19:00 | FromGitter | <alehander42> without my new tags |
13:19:09 | FromGitter | <alehander42> but my approach also doesnt work for that |
13:19:44 | FromGitter | <alehander42> the bigger problem is macros generate new code which can lead to more new inferred tags |
13:20:02 | FromGitter | <alehander42> so there isnt really a way to somehow run a macro after "all tags are known" |
13:22:59 | dom96 | why do you need to access tags in macros? |
13:25:11 | FromGitter | <alehander42> well, how else would you generate different code based on them? |
13:25:23 | disruptek | it's a shame nim is so large a language and yet so much of it feels deprecated. |
13:25:50 | Araq | lol |
13:26:22 | Araq | it's not as large as many think |
13:28:06 | FromGitter | <alehander42> another option is to add somehow tag callbacks |
13:28:29 | FromGitter | <alehander42> sym.onTag(Blocking) do: # when such a tag is inferred for this generated symbol .. uh |
13:29:33 | FromGitter | <alehander42> replace the original callsite with new stuff .. which triggers new semcheck of this context |
13:29:38 | FromGitter | <alehander42> which probably totally doesnt work |
13:29:39 | * | dddddd joined #nim |
13:29:47 | disruptek | you cannot achieve it with an inference due to ffi. |
13:29:59 | disruptek | there has to be annotation. |
13:30:07 | FromGitter | <alehander42> this is harder .. even if there is an annotation for all of FFI |
13:30:11 | FromGitter | <alehander42> i cant think of a good way |
13:30:40 | disruptek | anyway, it's pointless to speculate as long as tags are crippled with lack of support. |
13:31:05 | FromGitter | <alehander42> as it seems as a loop: infer tags in indirect calls => generate new code based on that => semcheck again => infer new tags |
13:31:17 | FromGitter | <alehander42> maybe you can repeat it until no new tags |
13:31:24 | FromGitter | <alehander42> but this is probably a very bad algo |
13:31:47 | disruptek | well, the tags could change or flip-flop. what then? |
13:32:10 | FromGitter | <alehander42> well, even worse i guess |
13:32:27 | disruptek | has to be idempotent. |
13:32:55 | FromGitter | <alehander42> maybe there is another thing |
13:34:10 | FromGitter | <alehander42> or another |
13:34:18 | FromGitter | <alehander42> actually, usually you can ignore all of that |
13:35:15 | FromGitter | <alehander42> and do a very different thing: just replace the primitives you wanted to tag in the beggining with over*rides* |
13:35:23 | FromGitter | <alehander42> which somehow apply to the whole of your project |
13:35:49 | dom96 | why do you wish to generate different code based on the tags? |
13:35:59 | disruptek | silly rabbit. |
13:36:04 | disruptek | tags should do nothing! |
13:36:24 | dom96 | disruptek Trix are for kids |
13:37:00 | disruptek | oh i knew i had it wrong as soon as i said it. |
13:37:29 | FromGitter | <alehander42> @dom96 i wanted to make the example work: m(code) : m replaces calls to functions with tag A to calls that run them in a special way |
13:37:35 | FromGitter | <alehander42> but i realized this isnt needed |
13:37:48 | FromGitter | <alehander42> as if one can replace directly the primitives he wants |
13:38:03 | FromGitter | <alehander42> all the functions that would've had this tag (invoked any of those primitives) |
13:38:21 | FromGitter | <alehander42> would've already run the thing i need in a special way |
13:38:38 | FromGitter | <alehander42> (e.g. "dangerous" functions in a "sandbox") |
13:38:51 | disruptek | do you really want to paint with a color future generations may not be able to see? |
13:39:26 | FromGitter | <alehander42> which is kinda the same thing as passing a LD_PRELOAD thing to a binary |
13:39:28 | FromDiscord_ | <treeform> @shashlick, scintilla is a code editor component. Mine is just a backend for a text box. Mine is useful if you are making a game and need a text box. Because its just a backend of a text box its very cross platform. I have hooked up a openGL/glfw front end that works on Windows and Mac. |
13:40:22 | Araq | treeform: is that usable in NimEdit? |
13:41:44 | shashlick | @treeform - would be great to extend to do syntax colors and other stuff but ya, i understand it is a huge undertaking |
13:42:52 | * | floppydh quit (Quit: WeeChat 2.5) |
13:44:01 | * | shomodj_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:46:11 | dom96 | Araq: you're better off turning VS Code into a Nim IDE at this point |
13:50:57 | Araq | dom96: meh but where is the fun in that? |
13:51:37 | Araq | I'll consider it if somebody tells me how to script VS code |
13:51:42 | owl_000 | https://paste.ofcode.org/g3Xr3dtRPiWYwKLmJe9hf9 how to take input from same line. after "type your name:" this |
13:52:08 | Araq | owl_000: stdout.write("Type your name: ") |
13:52:37 | Araq | or better: |
13:52:41 | Araq | import rdstdin |
13:53:01 | Araq | let name = readLineFromStdin("Type your name: ") |
13:53:35 | Araq | which reminds me. dom96: that works on every OS because we ship linenoise.c |
13:53:49 | Araq | Nimble should use that |
13:53:55 | Araq | no dependency. |
13:54:36 | owl_000 | stdout.write better and works, single line. thanks |
13:55:17 | Araq | the problem is that stdin.readLine doesn't work |
13:55:31 | Araq | on Unix when you try to use the cursors |
13:55:45 | Araq | it requires the rdstdin module or something comparable |
13:58:49 | owl_000 | readLineFromStdin is more compact, because i don't need to print type your name beforehand, thank you. |
14:02:32 | owl_000 | another question, how to know what other things can be use from rdstdin |
14:03:01 | Araq | you type in rdstdin. and use nimsuggest auto-completion |
14:03:30 | Araq | or you visit: https://nim-lang.org/docs/rdstdin.html |
14:04:07 | Araq | and now that I've done this... |
14:04:21 | Araq | it exports some crap that it shouldn't |
14:11:15 | Araq | fixed --> https://github.com/nim-lang/Nim/pull/12014 |
14:25:29 | * | narimiran quit (Remote host closed the connection) |
14:26:00 | * | narimiran joined #nim |
14:32:28 | FromGitter | <Vindaar> was there a reason json does not provide `%` for tuples? Even the docstring of `%` for objects mentions tuples https://nim-lang.github.io/Nim/json.html#%25%2CT |
14:34:08 | narimiran | i think there was a support for them and later on it was reverted |
14:34:35 | FromGitter | <Vindaar> yeah, I remember something too. But I was confused just now, because the inverse via `to` works |
14:34:43 | * | endragor joined #nim |
14:34:46 | Araq | it was error-prone |
14:34:53 | FromGitter | <Vindaar> ah |
14:40:12 | Araq | fyi I'll be offline this weekend |
14:40:49 | FromGitter | <Vindaar> no worries, enjoy the time off! |
14:45:40 | FromDiscord_ | <treeform> @Araq you can try using my textbox in NimEdit, but again its not a code editor, its just an abstract text box. Which turns out require a ton of little annoying features. I have tried building NimEdit when I tried it had build errors. |
14:47:43 | FromDiscord_ | <treeform> @shashlick turning it into a text editor - I have though about this, I have build code editors before: https://github.com/treeform/asterisk (not in nim) And probably some thing I can do almost independent of the text box part. |
14:50:36 | FromDiscord_ | <treeform> @dom96 @Araq: I use VS Code for nim now and it works great. |
14:52:14 | shashlick | @treeform - well, keep me in mind when you decide to expand the functionality |
14:52:41 | shashlick | although i'm currently blocked due to other nim issues, some day it will be cool to use a nim native cross-platform UI |
14:57:04 | FromDiscord_ | <treeform> @shashlick yeah I am working up to that, but its hard. |
14:57:21 | * | terps quit (Ping timeout: 250 seconds) |
14:57:24 | FromDiscord_ | <treeform> A true cross platform UI is my end goal. |
14:57:46 | disruptek | treeform: this is a text box behind, like, an immediate mode opengl ui? |
14:58:00 | FromDiscord_ | <treeform> But it seems to really hard to get there, the more I explore the problem, the more I realize I have to go. |
14:58:41 | FromDiscord_ | <treeform> @disruptek in that case yes. But you can use anything to render the box. You just send it keyboard and mouse inputs and it gives you the rectangles/characters to draw. |
14:58:49 | FromGitter | <awr1> it's an image you can blit anywhere |
14:58:55 | FromGitter | <awr1> iirc |
14:58:56 | disruptek | right. |
14:59:02 | disruptek | that's useful, thanks. |
14:59:42 | FromDiscord_ | <treeform> Na its not an image - that might be slow. Its rectangles. Here is me drawing it to an image using my other flippy library: |
14:59:53 | FromGitter | <awr1> one of these days i'll use Typography for something |
15:00:15 | FromDiscord_ | <treeform> https://github.com/treeform/typography/blob/master/tests/textboxtest.nim#L30 |
15:01:59 | FromDiscord_ | <treeform> here is my drawing it with openGL kind of: https://github.com/treeform/fidget/blob/master/src/fidget/backendopengl.nim#L83 |
15:03:42 | FromGitter | <awr1> i kind of agree and disagree with your thoughts about subpixel antialiasing, there are still a lot of cheap low-res panels (for example my laptop is from 2016 and its some enterprise 13-inch cheap dell lattitude with a 1366x768 display) |
15:04:02 | FromGitter | <awr1> that being said i've never been a huge fan of the "color fringing" that's associated with subpixel AA |
15:06:08 | FromDiscord_ | <treeform> awr1, yeah its a difficult topic. |
15:07:36 | FromDiscord_ | <treeform> awr1, if any there ware good APIs to get the shape and the arguments of the color emitters. But there isn't. So you always guess. And increasingly with modern monitors your guesses are wrong ... so it ends up being worse. |
15:08:19 | FromDiscord_ | <treeform> It just feels impossible to do a good job... and modern monitors are so high DPI it does not matter. |
15:09:36 | FromDiscord_ | <treeform> "The fact that there is no standard pixel layout grid anymore and the fact that high resolution displays are everywhere makes subpixeling obsolete. Apple, Adobe, Bohemian and other companies in the typography space are abandoning subpixeling for these reasons." |
15:11:36 | * | nsf quit (Quit: WeeChat 2.5) |
15:13:41 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
15:14:15 | FromDiscord_ | <treeform> Also with fonts I found people like their fonts looking how they are used to them looking. |
15:14:27 | FromDiscord_ | <treeform> So switching font modes are really jarring to people and me |
15:14:30 | * | btop joined #nim |
15:14:44 | FromDiscord_ | <treeform> but after I get used to one method... the other method feels jarring |
15:15:36 | FromGitter | <awr1> some googling suggests using DisplayID to acquire subpixel ordering |
15:15:40 | FromDiscord_ | <treeform> Look at all the different pixel arguments: |
15:15:42 | FromDiscord_ | <treeform> |
15:15:42 | FromDiscord_ | <treeform> https://cdn.discordapp.com/attachments/371759389889003532/614477875718127616/lcd-screens-under-a-microscope1.png |
15:17:18 | FromGitter | <awr1> https://en.wikipedia.org/wiki/DisplayID |
15:17:18 | shashlick | @treeform - i agree - reimplementing stuff is a loong journey |
15:17:20 | FromGitter | <awr1> ctrl+f subpixel |
15:17:20 | Zevv | the nexus is interesting |
15:17:30 | shashlick | that's why i spend so much time making wrapping easy in nim |
15:17:48 | Zevv | kind of camera bayer |
15:17:54 | shashlick | in fact, i have some good additions to nimterop in dev |
15:18:11 | disruptek | this is a pretty good primer on the font situation: https://pandasauce.org/post/linux-fonts/ |
15:18:17 | * | jxy joined #nim |
15:19:14 | disruptek | looks like it was updated recently, too. |
15:19:19 | * | btop quit (Ping timeout: 246 seconds) |
15:20:09 | FromDiscord_ | <treeform> awr1, that's cool I did not know that was part of the standard. I don't know if there is a way to access this info? Also it should probably send back like an image of the pixels not just a bit. |
15:20:36 | FromDiscord_ | <treeform> One could probably try to get monitor string and look it up in a db of layouts of some sort. |
15:21:19 | FromDiscord_ | <treeform> |
15:21:19 | FromDiscord_ | <treeform> https://cdn.discordapp.com/attachments/371759389889003532/614479278234664971/a-Seven-subpixel-configurations-traditional-1D-RGB-stripe-three-different-proposed.png |
15:22:03 | FromGitter | <awr1> you will very likely to have to probe platform specific APIs. i sort of remember how to probe EDID in win32, but idk for displayID |
15:22:33 | FromDiscord_ | <treeform> Also because the emitters are getting smaller, more of the surface are is taken up by wires: |
15:22:34 | FromDiscord_ | <treeform> |
15:22:34 | FromDiscord_ | <treeform> https://cdn.discordapp.com/attachments/371759389889003532/614479604035485754/square_RGGB.png |
15:22:54 | FromDiscord_ | <treeform> Look at all the black areas, those are wires |
15:23:08 | FromGitter | <awr1> and of course this gets more complicated if "what if the user has multiple displays?" |
15:23:19 | FromDiscord_ | <treeform> yeah |
15:23:26 | FromDiscord_ | <treeform> you basically have to rebuild your entire font cache for each display |
15:23:44 | FromDiscord_ | <treeform> there is another problem |
15:24:11 | FromDiscord_ | <treeform> and blending characters with colors with backgrounds you might get some thing that is worse looking |
15:24:54 | disruptek | there was a large display announced recently in which only 1% of the area is emitters. crazy. |
15:24:59 | FromDiscord_ | <treeform> Subpixel AA gets worse if your text is on colorful background. |
15:25:24 | FromDiscord_ | <treeform> |
15:25:24 | FromDiscord_ | <treeform> https://cdn.discordapp.com/attachments/371759389889003532/614480317721477171/7553095570c7ab372a6a.png |
15:25:27 | FromGitter | <awr1> yeah you need some type of layering algorithm/shader |
15:26:24 | FromDiscord_ | <treeform> Good Subpixel AA is just too hard. So big companies are not longer doing it. |
15:26:49 | FromGitter | <awr1> i've personally never been a huge fan of it. although i might be the minority |
15:26:49 | FromDiscord_ | <treeform> Its not worth it anymore in terms of cost/quality. |
15:37:01 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
15:38:04 | * | laaron joined #nim |
15:38:31 | FromGitter | <iffy> How would I make a nim proc adhere to what C is expecting to be: `void (*)(napi_env__ *, void *)`? |
15:40:55 | FromGitter | <iffy> I'm passing `asyncEcho_execute` which is defined as `proc asyncEcho_execute(env: napi_env, data: pointer) {.exportc.}` |
15:41:46 | FromGitter | <iffy> This is with a c2nim-made library |
15:43:56 | FromGitter | <awr1> make it `{.cdecl.}`, make `env` as `ptr napi_env` |
15:44:51 | FromGitter | <awr1> also i forget my C function typedef syntax but idk if that's supposed to return a pointer, but if it does make sure it returns `pointer` |
15:45:26 | * | btop joined #nim |
15:46:36 | FromGitter | <iffy> Hmm... using `{.cdecl.}` makes nim through a mismatch error (rather than the c compiler). |
15:46:54 | FromGitter | <iffy> Here's the original C header: `typedef void (*napi_async_execute_callback)(napi_env env, void* data);` |
15:47:10 | FromGitter | <iffy> Here's what c2nim made from that: `napi_async_execute_callback* = proc (env: napi_env; data: pointer)` |
15:48:22 | FromGitter | <awr1> whatever procedure you pass in as a callback must also be `{.cdecl.}` |
15:48:33 | FromGitter | <iffy> Here's the nim error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d600ad19b381b084fdfffc7] |
15:50:05 | FromGitter | <awr1> the type c2nim wrote is wrong |
15:50:08 | FromGitter | <awr1> should be |
15:50:13 | FromGitter | <iffy> that was my guess |
15:50:28 | * | btop quit (Ping timeout: 246 seconds) |
15:50:32 | FromGitter | <awr1> `type napi_async_execute_callback* = proc (env: napi_env; data: pointer) {.cdecl.}` |
15:50:47 | FromGitter | <iffy> oh! |
15:54:01 | FromGitter | <iffy> even adding `{.cdecl.}` as you have it, nim throws the same error |
15:54:03 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d600c1b49ac0519239ac22d] |
16:00:56 | FromGitter | <alehander42> Araq can it be done |
16:00:58 | FromGitter | <alehander42> conceptually? |
16:01:16 | FromGitter | <alehander42> replacing a function code later in a codebase with `override` builtin |
16:01:21 | FromGitter | <alehander42> i think IC |
16:01:24 | FromGitter | <alehander42> can work with it |
16:01:32 | FromGitter | <alehander42> but maybe there is recursive relationship |
16:02:19 | FromGitter | <iffy> I feel like I had this same problem before (working on this same library) but with a different callback type and Araq had an easy fix. But Gitter is impossible to search |
16:02:31 | * | owl_000 quit (Quit: Leaving) |
16:03:15 | FromGitter | <alehander42> i think you could do something like |
16:03:27 | FromGitter | <alehander42> (napi_async_execute_callback)(arg) |
16:04:32 | FromGitter | <iffy> in the type definition? |
16:04:55 | FromGitter | <iffy> I think the prior solution had something to do with closures |
16:05:30 | FromGitter | <alehander42> no no |
16:05:31 | FromGitter | <alehander42> in the caal |
16:05:33 | FromGitter | <alehander42> calll |
16:07:10 | FromGitter | <iffy> My call looks like this right now: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d600f2e07d1ff39f86ea542] |
16:08:36 | FromGitter | <iffy> Oh, that's casting or something? Doing that makes the errors a little nicer: |
16:10:18 | Araq | alehander42: roughly speaking, you can do it for every proc that is not specialized (not inline, not generic) and not run at compile-time |
16:11:29 | FromGitter | <iffy> bah, I'm an idiot. I was editing a file in a different directory. awr1, what you suggested (adding {.cdecl.} to the type definition worked). Sorry for the noise |
16:12:28 | FromGitter | <alehander42> oh it happens often to me @iffy |
16:12:59 | FromGitter | <alehander42> Araq but i want to do |
16:13:02 | FromGitter | <alehander42> different thing |
16:13:10 | FromGitter | <alehander42> i want to override it for my whole compile unit |
16:13:20 | FromGitter | <alehander42> so e.g. other modules that use it in this build |
16:13:22 | FromGitter | <awr1> :) |
16:13:25 | FromGitter | <alehander42> also use my version |
16:13:25 | FromGitter | <awr1> glad to help |
16:13:47 | FromGitter | <alehander42> something lik what ld_preload does but statically |
16:16:13 | Araq | meh |
16:16:28 | Araq | and what if I already run the proc at compile-time? |
16:16:39 | Araq | what are you gonna fix it afterwards? |
16:16:44 | Araq | *how |
16:17:43 | * | Trustable joined #nim |
16:19:06 | FromGitter | <alehander42> well, i dont care for those |
16:19:08 | FromGitter | <alehander42> :P |
16:19:28 | FromGitter | <alehander42> i am happy to keep them run in the same way on CT |
16:35:27 | * | laaron quit (Remote host closed the connection) |
16:37:07 | FromGitter | <awr1> https://github.com/nim-lang/Nim/pull/11742 |
16:37:10 | FromGitter | <awr1> is this PR okay for merge? |
16:37:24 | FromGitter | <awr1> i forgot that the CI messed up |
16:37:37 | FromGitter | <awr1> and remembered it yesterday |
16:39:08 | * | sz0 quit (Quit: Connection closed for inactivity) |
16:43:46 | * | laaron joined #nim |
16:53:47 | FromGitter | <iffy> This C library lets me pass a `pointer` value for some object I control. If I later receive that `pointer` as an argument to a function, how do I turn that pointer back into the object I originally passed in (via `myobj.unsafeAddr`). |
16:55:44 | disruptek | can't you cast it? |
16:56:34 | FromGitter | <iffy> `var data = castptr Promisory (data)[]; echo data.repr` produces: `(invalid data!)` |
16:58:30 | Zevv | iffy: technically, you can not turn the pointer back into the object, you can cast it into a `ptr T` - a pointer to your object |
16:59:03 | FromGitter | <iffy> hmm... looks like it's (invalid data!) when I first create it, so maybe the casting is working |
16:59:18 | Zevv | http://ix.io/1T9S |
16:59:20 | FromGitter | <iffy> Zevv, good point -- thank you for pointing that out |
16:59:25 | disruptek | i have a feeling either you're not getting a valid pointer back, or the data is truly invalid. |
16:59:32 | Zevv | that's a little snippet showing how tot do it |
17:02:58 | * | wildtrees joined #nim |
17:08:28 | * | terps joined #nim |
17:14:13 | * | btop joined #nim |
17:14:47 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
17:15:20 | * | laaron joined #nim |
17:18:28 | * | btop quit (Ping timeout: 248 seconds) |
17:19:25 | * | terps quit (Ping timeout: 276 seconds) |
17:25:02 | FromGitter | <iffy> I think maybe it's getting GC'd before I get the pointer back |
17:26:58 | * | shomodj joined #nim |
17:27:45 | Zevv | if you dont hold on to it yourself that is indeed very likely |
17:27:55 | Zevv | but you can ref it |
17:28:07 | FromGitter | <iffy> GC_ref(data) ? |
17:28:18 | Zevv | right |
17:28:29 | Zevv | dont forget to unref when you're done |
17:28:31 | FromGitter | <iffy> and then data has to be of type `ref object` |
17:28:33 | FromGitter | <iffy> ? |
17:29:08 | Zevv | one step back: where does your original object live? it is a ref or is it just an object? |
17:29:15 | Zevv | because if the latter, it is on the stack |
17:29:36 | FromGitter | <iffy> I get to decide. I was going to just use and object |
17:30:06 | Zevv | is your C callback happening while the function where you created the object is still active? |
17:30:17 | FromGitter | <iffy> nope, it's probably happening in another thread |
17:30:23 | Zevv | ok, there is your problem |
17:30:28 | FromGitter | <iffy> (after the function I made it in has finished) |
17:30:39 | FromGitter | <iffy> So I want something like this instead? |
17:30:42 | Zevv | your object is on the stack, and it gets unwound, and *poof* its gone |
17:30:45 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d6022c510bb5d2db05aa98a] |
17:30:50 | Zevv | so make your object a ref type |
17:30:57 | Zevv | and explicitly new() it |
17:31:10 | Zevv | it will basically be malloced and put on the heap |
17:31:36 | Zevv | the ref you get is already an address, albeit a special one because the gc manages it |
17:32:03 | Zevv | you can take the raw address and pass that around, and make sure you gc_ref() it in the mean time |
17:32:08 | Zevv | does that make sense? |
17:32:52 | FromGitter | <iffy> Yes, I think so; do I get that raw address from `thing.unsafeAddr`? |
17:34:19 | Zevv | or just addr |
17:34:40 | FromGitter | <iffy> okay, let me take a crack at it |
17:34:45 | FromGitter | <iffy> thank you! |
17:35:30 | Zevv | i'm on mobile with limited keyboard and processing power so I cant make you a little example |
17:36:37 | * | natrys joined #nim |
17:38:29 | * | endragor quit (Remote host closed the connection) |
17:40:40 | Zevv | (and make sure myself if this even is all true) |
17:47:02 | FromGitter | <iffy> Am I going to have trouble using GC_ref/unref with --gc:regions? |
17:49:32 | Zevv | hmm dont know anything about that Im afraid |
17:53:07 | * | elrood joined #nim |
18:06:33 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:29:53 | * | narimiran quit (Ping timeout: 244 seconds) |
18:30:26 | * | narimiran joined #nim |
18:42:40 | FromDiscord_ | <strexicious> This is so unhelpful :( |
18:42:40 | FromDiscord_ | <strexicious> https://cdn.discordapp.com/attachments/371759389889003532/614529954713042957/unknown.png |
18:45:12 | FromDiscord_ | <strexicious> shoot, ok, so it was because that `loadMeshData` is a template and it was using a method from strutils |
18:48:59 | * | btop joined #nim |
18:58:52 | shashlick | who puts #defines in the middle of a struct definition - https://github.com/kobolabs/liblzma/blob/master/src/liblzma/api/lzma/lzma.h#L217 |
19:04:56 | Zevv | pretty common, often done to define bits for flags near the flag itself for example |
19:08:58 | FromGitter | <iffy> I'm having trouble getting back to my object from the pointer C gives me. Here's a snippet: http://ix.io/1TaB |
19:09:00 | shashlick | nuisance for nimterop, and no solution in sight |
19:10:05 | shashlick | I use -dD to dump macros after preprocessing so that I can convert them into consts |
19:10:24 | shashlick | if i use -dM instead, it gives me all macros including predefined ones, which isn't what i need |
19:12:01 | FromGitter | <iffy> It ends up with `data` in the second proc having the same address as the original `mydata` in the first proc, but accessing `data.name` causes the program to crash |
19:15:07 | FromGitter | <iffy> I think I'm doing one dereferencing too many, or not enough... or maybe some of each? |
19:15:38 | Zevv | you're taking the address of the ref |
19:17:16 | Zevv | you're taking the address of the ref |
19:17:38 | Zevv | Try cast[ByteAddress](mydata) instead? |
19:18:11 | * | laaron quit (Remote host closed the connection) |
19:19:17 | FromGitter | <iffy> data = castByteAddress (dataptr) |
19:19:17 | FromGitter | <iffy> ? |
19:19:55 | Zevv | let me try your snippet |
19:20:08 | FromGitter | <iffy> k, (it won't run because it lacks the c functions) |
19:20:25 | Zevv | yeah I see, np |
19:20:48 | * | PrimHelios quit (Ping timeout: 258 seconds) |
19:21:17 | * | laaron joined #nim |
19:24:17 | * | natrys quit (Quit: natrys) |
19:27:08 | Zevv | tricky stuff eh |
19:27:12 | Zevv | your MyData is a ref type |
19:27:23 | Zevv | you can cast that to a ptr without taking addr |
19:27:41 | * | Ven``_ joined #nim |
19:27:42 | Zevv | and you can cast a pointer back to that type straight away |
19:27:55 | Zevv | http://ix.io/1TaN |
19:27:58 | Zevv | This one is on the heap |
19:28:31 | Zevv | but I think it is still not quite ok, since this casts back to a ref type |
19:28:47 | Zevv | which is lying, it should cast back to a ptr type |
19:29:24 | Zevv | so this might be better: http://ix.io/1TaP |
19:29:29 | Zevv | here the type itself is not a ref |
19:29:37 | Zevv | but myData is a ref value |
19:29:48 | Zevv | and later that generic pointer is cast back to a 'ptr myData' |
19:30:06 | Zevv | ref = GC managed, ptr = not GC managed |
19:31:29 | FromGitter | <iffy> So, when a C function wants me to give it a `void *`, do I give it `castpointer (mydata)` or `mydata.unsafeAddr`? |
19:32:18 | FromGitter | <iffy> I'm guessing the former, now |
19:32:25 | Zevv | if myData is a ref to an object, you do `let p = cast[pointer](myData)` |
19:32:37 | Zevv | which is basically a `void *` to your object |
19:33:25 | FromGitter | <iffy> okay, that makes more sense, I think. Let me try on the real code |
19:34:54 | FromGitter | <iffy> Success! |
19:34:56 | Zevv | I once started a little document about this stuff, but never finished it to describe exactly this stuff where you pass nim data through C functions: http://zevv.nl/nim-memory/ |
19:35:00 | FromGitter | <iffy> Zevv: thank you and thank you for explaining it! |
19:35:20 | Zevv | sorry for my wrong first example earlier today. That was on the stack |
19:35:36 | Zevv | probably part of the confusion |
19:36:20 | FromGitter | <iffy> I think it being decades since I've dealt with pointers might have contributed too ;) |
19:36:54 | Zevv | anyway, good to hear it worked out |
19:37:51 | * | rockcavera quit (Remote host closed the connection) |
19:41:07 | * | theelous3 quit (Ping timeout: 258 seconds) |
19:44:13 | * | Trustable quit (Remote host closed the connection) |
19:44:25 | * | Ven``_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:45:17 | * | Ven``_ joined #nim |
20:18:09 | * | nsf joined #nim |
20:24:23 | * | shomodj joined #nim |
20:27:41 | * | narimiran quit (Ping timeout: 244 seconds) |
20:39:40 | FromDiscord_ | <llum1na> Does anybody have any idea what the time format for this is? `2019-04-19T17:09:49.974Z` - Can't seem to get it working in Nim when using `#parse()` of the `times` module |
20:39:50 | FromDiscord_ | <llum1na> Does anybody have any idea what the time format pattern for this is? `2019-04-19T17:09:49.974Z` - Can't seem to get it working in Nim when using `#parse()` of the `times` module |
20:39:55 | disruptek | it's iso8601. |
20:40:24 | disruptek | you want something like this; const ISO8601 = initTimeFormat "yyyy-MM-dd\'T\'HH:mm:ss\'.\'fff\'Z\'" |
20:40:48 | FromDiscord_ | <llum1na> jeez, thank you |
20:40:59 | disruptek | np |
20:55:34 | * | Kaivo quit (Quit: WeeChat 2.5) |
20:57:08 | * | btop quit (Ping timeout: 248 seconds) |
20:57:26 | * | lmariscal joined #nim |
21:04:04 | * | elrood quit (Remote host closed the connection) |
21:16:36 | * | Vladar quit (Remote host closed the connection) |
21:31:36 | * | solitudesf- quit (Remote host closed the connection) |
21:31:56 | * | solitudesf- joined #nim |
21:36:57 | * | solitudesf-- joined #nim |
21:39:12 | * | solitudesf- quit (Ping timeout: 245 seconds) |
21:41:48 | * | solitudesf-- quit (Client Quit) |
21:42:10 | * | solitudesf joined #nim |
21:48:11 | * | ng0 joined #nim |
21:53:16 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:03:22 | * | Ven``_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:04:38 | * | solitudesf quit (Ping timeout: 245 seconds) |
22:08:11 | * | laaron quit (Remote host closed the connection) |
22:08:41 | * | laaron joined #nim |
22:09:04 | * | nsf quit (Quit: WeeChat 2.5) |
22:36:46 | * | Ven`` joined #nim |
22:40:30 | * | Ven`` quit (Client Quit) |
22:53:23 | * | btop joined #nim |
23:10:48 | * | Jjp137 quit (Ping timeout: 258 seconds) |
23:11:35 | * | Jjp137 joined #nim |
23:17:31 | * | vlad1777d quit (Ping timeout: 268 seconds) |
23:19:58 | * | theelous3 joined #nim |
23:27:16 | * | theelous3 quit (Ping timeout: 272 seconds) |
23:42:15 | * | krux02 quit (Remote host closed the connection) |
23:53:57 | * | aq60 joined #nim |
23:55:17 | aq60 | is there any way to convert NimNode to string? |
23:56:32 | aq60 | ProcDef Ident "add" |
23:57:09 | aq60 | Id like to put `add` into string |