00:07:37 | AlexMax | hrm |
00:08:07 | AlexMax | c2nim seems to turn *current = *current*10.0f; into current[] = current * 10.0[] |
00:13:28 | AlexMax | How do you get the ascii value of a number in Nim? |
00:13:32 | AlexMax | erm |
00:13:35 | AlexMax | of a letter |
00:15:16 | AlexMax | I suppose I could cast it to an integer, but maybe the standard library has something nicer? |
00:19:53 | FromGitter | <Quelklef> `ord` |
00:19:54 | FromGitter | <Quelklef> probably |
00:20:53 | FromGitter | <kayabaNerve> ord() or int() |
00:25:46 | zachcarter | gogolxdong: I'm sure I have some code lying around somwhere that does this - let me try to find something |
00:26:10 | * | Perkol joined #nim |
00:31:42 | zachcarter | well - I guess not... |
00:33:38 | zachcarter | gogolxdong: I haven't done any work with nuklear in quite some time - and I'm not an expert on the bindings (I never really was). You may be able to glean some insight from the GUI code in frag / zengine - but no guarantees |
00:33:57 | zachcarter | https://github.com/vurtun/nuklear/blob/27603d5b97bb010a58dada53105f430b78da0749/nuklear.h#L20928 - I think is the C code you're calling |
00:34:02 | zachcarter | so I'd start by looking at that |
00:37:39 | AlexMax | FromGitter: Thanks , not sure why I didn't just try that |
00:37:40 | FromGitter | AlexMax, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim |
00:37:52 | AlexMax | @quelklef, what I just said :P |
00:38:14 | AlexMax | man, this sample C program does a lot of raw C string manipulation :P |
00:44:41 | * | zachcarter quit (Quit: Lost terminal) |
00:46:45 | AlexMax | man, trying to cast an array to a cstring is giving me a problem, heh |
00:50:07 | * | dddddd quit (Remote host closed the connection) |
00:58:27 | * | abm quit (Read error: Connection reset by peer) |
01:16:23 | FromGitter | <Quelklef> Any way to circumvent the default behavior that getters are ignored in the same module as the declared type? |
01:16:26 | FromGitter | <Quelklef> Sorry, setters* |
01:36:03 | AlexMax | hrm, there's no built in way to convert a cstring to a string? |
01:36:56 | FromGitter | <kayabaNerve> AlexMax $ |
01:37:27 | AlexMax | ...Oh |
01:37:42 | AlexMax | I should've known that :P |
01:47:41 | FromGitter | <gogolxdong> @zacharycarter C code works, not sure whether the binding is right ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba44dbdb9531f2dfa99b2ad] |
01:48:32 | FromGitter | <gogolxdong> string implicitly convert to cstring? |
01:54:21 | FromGitter | <gogolxdong> or the casting from InputFilter which takes the first parameter as var text_edit to plugin_filter which taks it as ptr text_edit? object cast object to pointer? |
01:54:58 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba44f71f4bd1056ac933291] |
02:02:35 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba4513b0cfe7f30f1c589ba] |
02:03:34 | FromGitter | <gogolxdong> ah, it takes address , the main concern is on string impilictly converted to cstring. |
02:05:36 | FromGitter | <gogolxdong> conversion from string to cstring is automatic? |
02:06:02 | FromGitter | <kayabaNerve> string -> cstring = automatic ⏎ cstring -> string = `$` |
02:08:29 | FromGitter | <gogolxdong> yes, then it's an real issue . |
02:08:46 | * | tefter quit (Remote host closed the connection) |
02:08:58 | FromGitter | <gogolxdong> a |
02:28:37 | * | Perkol quit (Quit: Leaving) |
03:03:16 | FromGitter | <gogolxdong> hints Error: undeclared identifier: 'await' . |
03:11:37 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba461695df5194734edfbde] |
03:16:36 | Tanger | gogolxdong: You can't use await outside of a proc with the {.async.} pragma |
03:16:48 | Tanger | Try waitFor |
03:16:50 | Tanger | instead |
03:17:02 | Tanger | Or handle the futures directly |
03:30:01 | FromGitter | <gogolxdong> thanks for reminding, wouldn't the async module be rewritten? |
03:43:46 | Tanger | Ummm, I recall one of the async stdlibs going towards being deprecated, but I can't remember which one, sorry |
03:55:34 | * | Yardanico quit (Ping timeout: 240 seconds) |
03:56:54 | * | gsingh93 quit (Ping timeout: 264 seconds) |
03:58:35 | * | Yardanico joined #nim |
03:59:43 | * | gsingh93 joined #nim |
04:13:00 | * | miran joined #nim |
04:50:49 | FromGitter | <iffy> I'm trying to compile a c program using a nim-build statically linked library and I'm getting: : fatal error: 'nimbase.h' file not found |
04:51:05 | FromGitter | <iffy> where do I find that file? Or how do I resolve the bug? |
04:51:39 | * | jxy quit (Ping timeout: 252 seconds) |
04:52:10 | * | jxy joined #nim |
04:55:16 | * | erratic quit (Ping timeout: 246 seconds) |
05:00:10 | Tanger | iffy: What are you running to comp\ile it? |
05:02:07 | FromGitter | <iffy> Tanger: I added `-Ipath/to/Nim/lib` and now I'm getting a different error (probably not anything to do with Nim)? `gcc -o test_cprog -I/Users/matt/lib/Nim//lib/ -Isqlite3 -Inimcache libbuckets.a test.c` |
05:02:31 | FromGitter | <iffy> New error ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba47b67913ba7799b1fd99e] |
05:03:06 | FromGitter | <iffy> does that mean I compiled libsqlite3.a incorrectly? or libbuckets.a? |
05:04:24 | FromGitter | <iffy> oh :) it means I didn't include `libsqlite3.a` in my `gcc` command |
05:04:40 | Tanger | Haha |
05:04:54 | Tanger | From what I can gather, nimbase.h is in the csources installed by koch when building nim |
05:05:57 | Tanger | So it should be in the nim installation directory |
05:06:30 | Tanger | So mayeb it needs extra args to link against those headers? |
05:08:16 | FromGitter | <iffy> Yeah, `-I/Users/matt/lib/Nim/lib/` did the trick to fix that. So, is there a way to build my statically linked library (from nim code) which includes the statically linked libsqlite3.a? |
05:14:07 | * | erratic joined #nim |
05:14:12 | Tanger | Nothing solid except for a couple of SO articles. Maybe try this suggestion iffy: https://stackoverflow.com/questions/27078657/cannot-link-libsqlite3-so-in-gcc |
05:23:07 | * | leorize quit (Ping timeout: 250 seconds) |
05:31:52 | * | icebattl1 joined #nim |
05:34:05 | * | nsf joined #nim |
05:34:46 | * | icebattle quit (Ping timeout: 272 seconds) |
05:43:03 | * | SenasOzys quit (Remote host closed the connection) |
05:43:37 | * | SenasOzys joined #nim |
05:44:18 | * | nif joined #nim |
05:50:21 | * | leorize joined #nim |
05:58:16 | * | miran quit (Ping timeout: 246 seconds) |
06:10:36 | * | mhnoyes7 joined #nim |
06:12:32 | * | mhnoyes7 quit (Remote host closed the connection) |
06:13:31 | FromGitter | <gogolxdong> what to pass for pointer of `proc write*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}` |
06:19:03 | * | zcu15 joined #nim |
06:21:38 | * | zcu15 quit (Remote host closed the connection) |
06:28:36 | * | SenasOzys quit (Ping timeout: 272 seconds) |
06:30:50 | * | xet7 joined #nim |
06:32:33 | FromGitter | <gogolxdong> where goes wrong of this snippet, cannot write buffer to memory ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba49081b4990c30eee818c6] |
06:34:04 | Tanger | gogolxdong: SIGSEGV error? |
06:37:17 | FromGitter | <gogolxdong> not, content should be 'butte' from the 5th char, but it's random hex. |
06:41:10 | FromGitter | <gogolxdong> or this ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ be `butterfly` [https://gitter.im/nim-lang/Nim?at=5ba49285e5c2cc56adbf6831] |
06:42:03 | * | TheLemonMan joined #nim |
06:46:14 | Tanger | Oooh |
06:46:28 | Tanger | gogolxdong: I think your problem is `var writeBuff` |
06:46:38 | Tanger | I reckon that's auto typing to a string |
06:46:51 | Tanger | If you get the addr of a string, you get both the length and data parts of the string |
06:47:11 | Tanger | Try either defining it as a cstring or casting it to cstring |
06:47:57 | Tanger | I'm pretty sure a cstring is just a ptr[Char] or something similar, so you can probs write it in without `addr` |
06:51:24 | Tanger | Can also try casting content to a string instead of a char array, as it would be written in as a string |
06:52:46 | * | Electrux joined #nim |
06:54:07 | FromGitter | <gogolxdong> great, works. |
06:55:13 | FromGitter | <gogolxdong> Is this dangerous as writing physical memory directly. |
06:57:13 | FromGitter | <gogolxdong> write to memory through driver is more efficient than system call ,right? |
06:57:21 | Tanger | Yeah, more effecient |
06:57:26 | Tanger | But yes, less safe' |
07:05:18 | FromGitter | <gogolxdong> don't know where it writes the buffer. |
07:09:50 | Tanger | As in where in /dev/mem? |
07:09:59 | Tanger | Or are you talking about the var buffer? |
07:10:24 | FromGitter | <gogolxdong> former |
07:12:17 | TheLemonMan | mratsim, I guess you tried setting minSamples to something like 1000 and were wondering why it never finished, right? :) |
07:15:08 | Tanger | gogolxdong: As posix.read() returns a cint file descriptor, if you need to track where you're writing to, you might be better off using moveMem or copyMem |
07:15:18 | Tanger | Still both unsafe, but they return pointers to memory |
07:18:39 | FromGitter | <rayman22201> @gogolxdong this is a very dangerous thing you are doing. What are you trying to accomplish? /dev/mem is not just the virtual adress space for your program. It's the full physical ram space of the computer. writing random bits to /dev/mem is a notorious way to crash your system. |
07:26:02 | FromGitter | <gogolxdong> thanks for reminding , aware of the potential effect a little, exploring out of curiosity. |
07:29:38 | FromGitter | <rayman22201> /dev/mem is typically only used in special cases such as writing a driver for a physical device or something. Some PCI devices map to a specific absolute ram address for example. |
07:30:00 | * | navin joined #nim |
07:30:57 | * | Electrux quit (Quit: Quit) |
07:31:45 | * | Electrux joined #nim |
07:33:25 | FromGitter | <rayman22201> The fastest way to write to ram for a normal program is probably mmap |
07:42:08 | * | NimBot joined #nim |
07:52:35 | * | Electrux quit (Ping timeout: 252 seconds) |
07:55:32 | * | Electrux joined #nim |
07:57:08 | * | jolo joined #nim |
07:58:36 | * | PMunch joined #nim |
08:00:32 | Tanger | Hey guys, can you define your own NimNodeKinds? |
08:00:52 | Tanger | Like, could you designate something as a distinct type of a node that expectKind can match? |
08:01:12 | TheLemonMan | you can pass expectKind a set of nnkNode... |
08:02:10 | Tanger | Ah, and it'll pass if it's in that set? |
08:02:26 | Tanger | *return true |
08:02:53 | TheLemonMan | yep |
08:03:20 | * | gmpreussner quit (Quit: kthxbye) |
08:03:21 | Tanger | Awesome, thanks! |
08:03:35 | * | gmpreussner joined #nim |
08:08:01 | * | Vladar joined #nim |
08:08:39 | FromGitter | <xmonader> @kaushalmodi i think i'll just do it myself in the end |
08:10:22 | Tanger | Hey guys, can anybody explain this example from docs/macros? var res = findChild(n, it.kind == nnkPostfix and it.basename.ident == toNimIdent"foo") |
08:10:42 | Tanger | it.kind == nnkPostfix and it.basename.ident == toNimIdent"foo" is a `cond: untyped`, I'm just curious where the `it` is scoped from? Or if it's a separate lib |
08:11:31 | TheLemonMan | anaphoric macros, sequtils follows the same convention |
08:12:15 | TheLemonMan | long story short, the `it` is injected by `findChild` in the user-supplied expression |
08:18:55 | * | BenjaminDeuter joined #nim |
08:20:44 | * | BenjaminDeuter quit (Remote host closed the connection) |
08:24:32 | * | Electrux quit (Read error: Connection reset by peer) |
08:25:06 | * | navin quit (Remote host closed the connection) |
08:26:55 | Tanger | Ayy, thanks again TheLemonMan! Killing it this arvo XD |
08:27:21 | * | Electrux joined #nim |
08:30:18 | * | navin joined #nim |
08:55:23 | * | krux02 joined #nim |
09:03:48 | * | leorize quit (Ping timeout: 245 seconds) |
09:03:51 | * | PMunch quit (Ping timeout: 260 seconds) |
09:10:34 | TheLemonMan | hmm, isn't openFileStream supposed to be available on stable? |
09:17:52 | FromGitter | <mratsim> no |
09:17:58 | FromGitter | <mratsim> it has been added after :P |
09:18:12 | FromGitter | <mratsim> like 2 days after |
09:18:23 | FromGitter | <mratsim> but the documentation was generated 5 days after stable |
09:18:35 | FromGitter | <mratsim> so it pops up but isn’t available |
09:18:45 | TheLemonMan | _fuckin_ awesome, thanks mratsim |
09:19:39 | FromGitter | <mratsim> I think there is a bug or forum post about that already @Araq ^ |
09:22:00 | FromGitter | <gogolxdong> @Tanger , is it possible to read the memory addressed with the fd opened in posix? |
09:22:31 | FromGitter | <gogolxdong> memory address taken by the fd. |
09:22:43 | TheLemonMan | mratsim, I've just finished adding a way to export the raw benchmark data to json for comparison/post-processing/plotting |
09:23:13 | FromGitter | <mratsim> nice =) |
09:23:17 | FromGitter | <gogolxdong> it's only cint file descriptor now. |
09:23:45 | FromGitter | <mratsim> @gogolxdong I think there is a mmap or memmap module in Nim |
09:24:35 | shashlick | https://packnback.github.io/blog/programming_languages/ |
09:24:47 | FromGitter | <gogolxdong> it's the user space memory |
09:26:42 | TheLemonMan | shashlick, the other day I've finally learned what a shashlick was and now I'm hungry every time I see your nick |
09:27:09 | FromGitter | <gogolxdong> also system call context switching is expensive. |
09:27:44 | shashlick | That wasn't the intention but an interesting result nonetheless |
09:49:56 | FromGitter | <gogolxdong> wish we can manage memory manually. |
09:50:20 | * | navin quit (Remote host closed the connection) |
09:51:19 | TheLemonMan | ...just use C then? |
09:54:18 | FromGitter | <gogolxdong> at this level ,maybe yes. |
10:00:08 | Araq | you can manage memory manually all you want in Nim, there is 'ptr UncheckedArray', alloc, dealloc, cast |
10:00:18 | Araq | and the memfiles module for an mmap wrapper |
10:01:58 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
10:03:53 | FromGitter | <gogolxdong> Deeper than that , wonder anyone tried , writing everything via /dev/mem in memory to manipulate machine manually. |
10:06:27 | * | djural_18 joined #nim |
10:08:11 | * | Electrux quit (Read error: Connection reset by peer) |
10:08:51 | * | djural_18 quit (Remote host closed the connection) |
10:11:15 | * | navin joined #nim |
10:12:11 | * | Electrux joined #nim |
10:16:44 | * | PMunch joined #nim |
10:19:04 | FromGitter | <gogolxdong> http://highscalability.com/blog/2013/5/13/the-secret-to-10-million-concurrent-connections-the-kernel-i.html |
10:20:03 | * | dddddd joined #nim |
10:20:57 | * | navin quit (Remote host closed the connection) |
10:22:20 | * | navin joined #nim |
10:22:26 | * | bytesighs3 joined #nim |
10:24:44 | * | Fervor joined #nim |
10:26:31 | * | jolo quit (Ping timeout: 256 seconds) |
10:27:08 | * | bytesighs3 quit (Remote host closed the connection) |
10:27:13 | * | Fervor quit (Killed (Sigyn (Spam is off topic on freenode.))) |
10:30:08 | PMunch | Hmm, how can I turn on overflow errors in release builds? |
10:34:59 | * | refi649 joined #nim |
10:39:41 | * | refi649 quit (Remote host closed the connection) |
10:41:21 | * | Ven`` joined #nim |
10:49:54 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:53:28 | * | navin quit (Remote host closed the connection) |
10:53:50 | * | navin joined #nim |
10:57:10 | * | noonien joined #nim |
10:59:46 | * | ErnestG_29 joined #nim |
11:00:37 | * | ErnestG_29 quit (Remote host closed the connection) |
11:05:14 | * | stefanos82 joined #nim |
11:20:41 | * | xet7 quit (Remote host closed the connection) |
11:21:06 | FromGitter | <gogolxdong> like how to get the PCI-E Graphic Card address and write something to screen? |
11:21:36 | FromGitter | <mratsim> you should use OpenGL or Vulkan or a framebuffer for that @gogolxdong |
11:22:06 | FromGitter | <mratsim> `--overflowChecks:on` @PMunch |
11:23:28 | * | xet7 joined #nim |
11:23:43 | PMunch | Ah thanks |
11:25:02 | * | navin quit (Remote host closed the connection) |
11:25:27 | * | navin joined #nim |
11:25:57 | FromGitter | <gogolxdong> It's possible because of nuklear-nim except some issues |
11:26:02 | PMunch | Hmm, wouldn't it make sense for "try: expect:" to wrap itself in the correct pragmas for the caught exceptions? |
11:28:17 | FromGitter | <gogolxdong> I want to know more about memory. I wrote helloworld in memory and it stays at 0x0000000 |
11:29:45 | FromGitter | <gogolxdong> need to find the address application mapped to. |
11:30:19 | * | dgwana joined #nim |
11:30:59 | FromGitter | <mratsim> I used to play with directfb or fbdev, you can try: https://www.linuxquestions.org/questions/programming-9/hello-world-or-display-pixels-on-framebuffer-fb-h-4175539854/ |
11:31:36 | * | dgwana quit (Client Quit) |
11:31:39 | FromGitter | <mratsim> the last post. you need access to your framebuffer device like /dev/fb0 |
11:32:09 | * | dgwana joined #nim |
11:36:17 | * | leorize joined #nim |
11:37:37 | * | navin quit (Remote host closed the connection) |
11:38:40 | * | navin joined #nim |
11:56:35 | FromGitter | <gogolxdong> marked. |
12:00:26 | * | navin quit (Remote host closed the connection) |
12:01:38 | FromGitter | <gogolxdong> the last post doesn't compile. |
12:04:28 | * | navin joined #nim |
12:16:21 | * | navin quit (Remote host closed the connection) |
12:38:41 | * | PMunch quit (Quit: Leaving) |
12:41:48 | * | gangstacat quit (Quit: Ĝis!) |
12:49:38 | * | pnorman24 joined #nim |
12:50:29 | * | pnorman24 quit (Remote host closed the connection) |
12:59:06 | * | gangstacat joined #nim |
13:00:46 | * | navin joined #nim |
13:05:10 | * | navin quit (Ping timeout: 244 seconds) |
13:07:50 | * | dgwana quit (Quit: Leaving) |
13:17:47 | FromGitter | <kaushalmodi> PMunch: Someday I'd like to write a parser for Org mode. Can you point to a parsing library that serves as the best example if a parser written in Nim? |
13:30:26 | * | Diamondcite25 joined #nim |
13:31:15 | FromGitter | <mratsim> json from the stdlib or from Araq’s packedJson |
13:34:01 | pigmej | you can also take look into: https://github.com/OpenSystemsLab/jsmn.nim but it's rather hardcore parser (still json though) |
13:36:26 | * | SenasOzys joined #nim |
13:38:16 | * | ehmry quit (Quit: WeeChat 1.7) |
13:38:32 | * | Diamondcite25 quit (Ping timeout: 252 seconds) |
13:38:39 | FromGitter | <kaushalmodi> Thanks both, I'll take a look. |
13:38:50 | FromGitter | <kaushalmodi> pig |
13:39:02 | FromGitter | <kaushalmodi> Sorry, fat fingers on phone |
13:39:47 | FromGitter | <kaushalmodi> pigmej: What do you mean by hardcore parser? |
13:40:59 | FromGitter | <kaushalmodi> General question to all.. what does a parser ideally return? JSON? |
13:40:59 | pigmej | by using it as library :) |
13:41:24 | pigmej | stdlib / Araq one return pretty good things, JsonNode |
13:41:42 | pigmej | the one from my link returns tokens |
13:42:02 | pigmej | which makes it kinda counter-intuitive to use (for me obviously) |
13:42:13 | FromGitter | <kaushalmodi> Ok, thanks. Will need to make a mental model and plan before I venture out into writing this parser. |
13:44:14 | FromGitter | <mratsim> Ideally a parser returns a syntax tree, that’s the easier to work with. |
13:45:01 | FromGitter | <mratsim> if you return tokens you’re a lexer |
13:46:02 | FromGitter | <kaushalmodi> But I cannot wrap my head around on how to make a syntax tree "tangible".. |
13:46:23 | FromGitter | <kaushalmodi> With JSON output, I can visualize the parsed elements on stdout |
13:46:35 | FromGitter | <kaushalmodi> And any other tool can pick up from there |
13:46:41 | FromGitter | <mratsim> the first thing you need to write is a pretty-printer then |
13:47:08 | FromGitter | <mratsim> or just convert your tree to json and hand it over to a json pretty printer |
13:48:21 | FromGitter | <kaushalmodi> Hmm, so the syntax tree is like the primary parsed internal database. |
13:48:51 | FromGitter | <kaushalmodi> And JSON output is just one of the outputs |
13:50:35 | FromGitter | <mratsim> Nim abstract syntax tree (parsed by macros) can be converted to Lisp or Json for example |
13:51:04 | FromGitter | <mratsim> it’s just an easy way to represent structured data (code being structured data) |
13:51:19 | FromGitter | <kaushalmodi> Ah, making circle back to macros. I will eventually have to understand those. :) |
13:51:29 | FromGitter | <mratsim> but a text editor can also use it to detect indentation or brackets and implement code-folding |
13:51:36 | FromGitter | <kaushalmodi> And the macros can output Lisp ?! |
13:51:59 | FromGitter | <mratsim> https://nim-lang.org/docs/macros.html#dumpLisp.m,untyped |
13:52:30 | FromGitter | <kaushalmodi> Thanks! That might be the key for me to start tinkering with macros :) |
13:52:59 | FromGitter | <mratsim> weirdest reason ever :P |
13:54:50 | * | brimonk9 joined #nim |
13:58:27 | * | brimonk9 quit (Remote host closed the connection) |
14:12:42 | * | agk23 joined #nim |
14:13:25 | * | agk23 quit (K-Lined) |
14:23:04 | * | TheLemonMan joined #nim |
14:30:33 | * | navin joined #nim |
14:31:41 | pigmej | these kind of bugs make me sad: https://github.com/nim-lang/Nim/issues/9024 :( |
14:34:44 | * | Senketsu quit (Quit: WeeChat 2.2) |
14:35:03 | FromGitter | <mratsim> Does https://github.com/status-im/nim-asyncdispatch2 have the same behaviour? |
14:35:25 | FromGitter | <mratsim> (it was rewritten from the ground up so hopefully it doesn’t have the same bugs) |
14:38:35 | FromDiscord | <Shield> How can I make a proc type that returns itself? example: a callback that returns another callback of the same type |
14:41:01 | * | Electrux quit (Ping timeout: 260 seconds) |
14:41:19 | * | Electrux joined #nim |
14:43:43 | * | miran joined #nim |
14:53:00 | * | floppydh quit (Quit: WeeChat 2.2) |
14:54:07 | * | vivus joined #nim |
14:55:23 | pigmej | so ad2 had similar behaviour |
14:55:26 | pigmej | not sure if not even worse |
14:55:29 | pigmej | deadlocks when socket got closed |
14:55:32 | pigmej | not closing socket when close called etc |
14:55:55 | vivus | which nim library allows me to execute commands from a file/string? I found reference to nimscript, but im making sure there isnt something else |
14:56:11 | TheLemonMan | what kind of "commands" ? |
14:56:51 | TheLemonMan | Shield, you can probably try with a `auto` return type |
14:57:04 | TheLemonMan | but if you can't write down the type then it's probably a bad idea to boot |
14:57:50 | vivus | TheLemonMan: like "ls -la" |
14:58:14 | * | ctracey11 joined #nim |
14:59:10 | TheLemonMan | check out the osproc module |
14:59:26 | TheLemonMan | and don't parse `ls`! |
14:59:53 | FromGitter | <kaushalmodi> "don't parse ls!" - +1 |
14:59:53 | FromGitter | <mratsim> @Shield, you can start hacking around that `type Callback[T] = proc (foo: T): Callback[T] {.closure.}` |
15:00:49 | FromGitter | <mratsim> don’t forget to kill nimsuggest and nim from time to time :troll: the compiler/suggestions might get into stack overflow while you’re developing |
15:01:19 | pigmej | krux02: may I suggest something? You should split your pr into pieces, because in current form it may endup like never ending story |
15:01:32 | * | ctracey11 quit (Remote host closed the connection) |
15:01:50 | FromGitter | <kaushalmodi> @krux02: I agree with pigmej |
15:02:03 | FromGitter | <kaushalmodi> that last commit fixed that specific issue. So open a new PR for that |
15:02:12 | FromGitter | <kaushalmodi> if that PR relies on unmerged PR, mention so in the comments |
15:02:29 | krux02 | I would agree with that |
15:02:42 | krux02 | but yuuta yamada isn't maintaining at this point anymore. |
15:02:47 | pigmej | because you did serious fixes |
15:02:57 | krux02 | and splitting up the PR into several independent commits is just a lot of pain |
15:03:00 | FromGitter | <kaushalmodi> krux02: it's for posterity |
15:03:04 | pigmej | krux02: well |
15:03:09 | pigmej | you didn't mention that you finished your PR |
15:03:20 | FromGitter | <kaushalmodi> the PR's and separate commits will document the fixes in progression |
15:03:20 | pigmej | you stated: `This is an on going PR.` |
15:03:26 | pigmej | so everyone assumed that it's not yet done |
15:03:36 | FromGitter | <kaushalmodi> if you squash that humongous PR, all the info would be lost |
15:03:40 | FromGitter | <kaushalmodi> the rationale, etc |
15:03:52 | pigmej | I think all but last commit are fine there |
15:04:07 | pigmej | just say that it's ready and create separate for #202 |
15:04:10 | FromDiscord | <Shield> auto will hide the compilation error but will cause "Error: internal error: mapType" |
15:04:24 | vivus | TheLemonMan: what does "don't parse ls" mean? |
15:04:45 | FromGitter | <kaushalmodi> https://unix.stackexchange.com/questions/128985/why-not-parse-ls |
15:05:07 | FromGitter | <kaushalmodi> vivus: it's fine if you want to just print the ls output |
15:05:20 | FromGitter | <kaushalmodi> but don't post-process that ls output to do anything else |
15:05:35 | vivus | I just want to take a command from a string and execute it on the commandline |
15:06:00 | krux02 | pigmej, well I think the last commit is fine in that PR, because it is part of the same refactoring works that fixed an issue on the way. |
15:06:13 | pigmej | ok, can you then at least rephase PR ? |
15:06:18 | FromGitter | <kaushalmodi> vivus: For that, look at osprocs as TheLemonMan said |
15:06:19 | pigmej | to say that it's ready? |
15:06:32 | pigmej | I'll take short look, and let's ping yuuta |
15:06:34 | vivus | alright ty |
15:06:35 | krux02 | I already had the refactorings done, saw the issue and integrated it. Was around 15 seconds of work |
15:06:43 | pigmej | if no response, then I'll merge it |
15:07:09 | pigmej | I somehow still have merge rights even after few years.. |
15:07:15 | krux02 | yes it is ready |
15:07:34 | FromDiscord | <Shield> is there a way to achieve it? basically I want something like "callback = callback()" where callback holds a proc that can returns the same proc or another one of the same type |
15:07:34 | * | Electrux quit (Read error: Connection reset by peer) |
15:07:42 | FromGitter | <kaushalmodi> vivus: specific to ls, if you want a list of files the Nim way, look at https://nim-lang.org/docs/os.html#walkFiles.i,string |
15:07:49 | * | Electrux joined #nim |
15:08:18 | vivus | @kaushalmodi I want to execute different commands from a file. Think of it like ansible |
15:08:30 | FromGitter | <kaushalmodi> vivus: And to run a random shell command and return its output as string, look at https://nim-lang.org/docs/osproc.html#execProcess,string,openArray[string],StringTableRef,set[ProcessOption] |
15:08:56 | FromGitter | <kaushalmodi> vivus: Well, I don't know what ansible is :) But hopefully the above helps. |
15:09:03 | FromGitter | <mratsim> @Shield did you see my message? |
15:09:06 | vivus | ty i think it will |
15:11:58 | krux02 | pigmej, I updated the message |
15:11:59 | FromDiscord | <Shield> oh sorry i missed it, trying it now |
15:13:04 | krux02 | pigmej, I am sorry that I forgot to update the PR. |
15:14:11 | * | stefanos82_ joined #nim |
15:14:28 | FromDiscord | <Shield> wew it just crashes |
15:14:37 | * | stefanos82_ quit (Client Quit) |
15:16:21 | * | stefanos82 quit (Ping timeout: 252 seconds) |
15:16:28 | FromGitter | <mratsim> figures :P |
15:17:04 | FromGitter | <mratsim> I can probably makes something work but I don’t have time at the moment. Try opening a forum post. I’ll check when I have more time |
15:17:26 | pigmej | krux02: np :) |
15:22:12 | * | stefanos82 joined #nim |
15:24:23 | * | Guest42462 joined #nim |
15:26:07 | * | Guest42462 quit (Remote host closed the connection) |
15:30:21 | * | icebattl1 quit (Ping timeout: 244 seconds) |
15:33:10 | * | icebattle joined #nim |
15:55:56 | Araq | https://github.com/nim-lang/nightlies/releases/tag/t1 testers required |
15:56:44 | * | Tariul joined #nim |
16:06:21 | * | Senketsu joined #nim |
16:16:39 | TheLemonMan | Araq, works fine here, noice |
16:17:07 | * | Senketsu quit (Quit: WeeChat 2.2) |
16:23:57 | FromGitter | <iffy> I'm porting a Node.js program to Nim (it's that awful pseudo-line-parsing HTTP log thing from yesterday) and I'm surprised to find that Nim takes 13 seconds while the node version takes 3 seconds. Same 256MB input file. (And the node script is currently doing more than the Nim, too). Should this be surprising? I could come up with a shareable example case if it's surprising enough to pursue. |
16:24:21 | TheLemonMan | did you build it with -d:release ? |
16:24:25 | FromGitter | <iffy> yep |
16:24:32 | * | vivus quit (Remote host closed the connection) |
16:24:51 | pigmej | how are you parsing that file? |
16:25:33 | FromGitter | <iffy> line by line in both cases (Node's `readline` module and a simplified `readLine` in Nim): ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba51b7c33da0f649e329928] |
16:26:10 | FromGitter | <iffy> Let me make a shareable direct comparison so that I'm sure I'm comparing apples to apples |
16:26:36 | * | tewinget0 joined #nim |
16:26:38 | * | tewinget0 quit (Remote host closed the connection) |
16:28:06 | * | Tariul quit (Remote host closed the connection) |
16:29:41 | pigmej | why not readLine from fileStream? |
16:33:40 | FromGitter | <iffy> pigmej: this one? https://nim-lang.org/docs/streams.html#readLine,Stream,TaintedString |
16:34:37 | * | Electrux quit (Quit: Quit) |
16:34:45 | FromGitter | <iffy> it doesn't handle \0 bytes as I was hoping |
16:37:42 | * | miran quit (Ping timeout: 264 seconds) |
16:39:02 | * | Gaasmann24 joined #nim |
16:40:28 | * | navin_ joined #nim |
16:41:27 | * | Gaasmann24 quit (Remote host closed the connection) |
16:43:53 | * | navin quit (Ping timeout: 252 seconds) |
17:02:24 | FromGitter | <rayman22201> I have a feeling that Node is using fgets, which is much faster on Unix than getting one char at a time. that's what Python does anyway: https://hg.python.org/cpython/file/d77db57982a1/Objects/fileobject.c#l1207 |
17:02:35 | FromGitter | <rayman22201> http://www.cplusplus.com/reference/cstdio/fgets/ |
17:02:39 | * | wildlander joined #nim |
17:03:51 | FromGitter | <rayman22201> I'm curious if that is the issue. If it is, It may be worth doing a pr to the Nim readline implementation to use that optimization on unix as well? |
17:03:56 | * | Piraty left #nim ("--") |
17:04:53 | * | Trustable joined #nim |
17:07:25 | TheLemonMan | "Note: This is not very efficient." yeah |
17:08:43 | * | nsf quit (Quit: WeeChat 2.2) |
17:09:27 | * | martinda1414 joined #nim |
17:09:52 | federico3 | iffy: strace the two applications |
17:12:45 | * | martinda1414 quit (Remote host closed the connection) |
17:14:48 | FromGitter | <iffy> https://gist.github.com/iffy/ede3fb5b637b34566ecd36c447995c75 |
17:15:11 | FromGitter | <iffy> Let me know if you see the same behavior as I'm seeing ^ |
17:15:21 | * | dago joined #nim |
17:16:33 | FromGitter | <iffy> Node has its own definition of "line" that doesn't agree with Python or `wc`. Nim's built-in `readLine` also doesn't agree with Python or `wc`, nor does it agree with Node. My custom `readLine` agrees with Python and `wc` but is slow. |
17:16:52 | FromGitter | <iffy> (although no slower than the builtin `readLine`) |
17:17:42 | FromGitter | <iffy> oh, it consumes 200MB to run the test, btw |
17:19:17 | * | dago quit (Killed (Sigyn (Spam is off topic on freenode.))) |
17:25:21 | FromGitter | <iffy> TheLemonMan: I saw that note on `readLine(s:Stream)`; does it apply to the one I linked, too? |
17:27:23 | FromGitter | <iffy> federico3: I'm on a mac and I'm struggling to get `dtruss` to work |
17:29:49 | TheLemonMan | holy fuck, that jungle of callbacks is nasty |
17:31:11 | FromGitter | <iffy> Yeah, not completely straightforward (I'm trying to make each program do roughly the same thing as what I'm actually doing and the same as each other) |
17:32:19 | FromGitter | <kaushalmodi> Araq: Tested the t1 release, works great.. extracted, ran sh install.sh and found nim binary installed in bin/. 👍 |
17:32:53 | FromGitter | <kaushalmodi> only one thing .. |
17:33:16 | FromGitter | <kaushalmodi> while extracting (I use `dtrx` for that), I got these warnings (on RHEL 6.8): ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba52b5cd655361f76334291] |
17:34:18 | FromGitter | <iffy> Shall I file an issue? Is that the process? |
17:34:54 | TheLemonMan | kaushalmodi, https://superuser.com/questions/318809/linux-os-x-tar-incompatibility-tarballs-created-on-os-x-give-errors-when-unt |
17:35:09 | * | darithorn joined #nim |
17:35:19 | FromGitter | <kaushalmodi> yes, functionally there was no issue |
17:35:34 | FromGitter | <kaushalmodi> but a user seeing these warnings wouldn't get a comfortable feeling |
17:36:12 | FromGitter | <kaushalmodi> so.. this was built on a macOS? |
17:36:23 | FromGitter | <kaushalmodi> from that su answer: ⏎ ⏎ > Install GNU tar if you can on Mac OS and use that to create the tar |
17:37:40 | TheLemonMan | the tarball is created here: https://github.com/nim-lang/nightlies/blob/master/.travis.yml |
17:38:46 | FromGitter | <kaushalmodi> it's not tarred in that travis, it seems |
17:38:56 | FromGitter | <kaushalmodi> I see that gnu-tar is installed |
17:39:00 | FromGitter | <kaushalmodi> but where is it used? |
17:39:46 | FromGitter | <kaushalmodi> ok.. need to look in `koch xz` |
17:39:58 | FromGitter | <kaushalmodi> that is probably using plain `tar` and not `gnu-tar` |
17:42:04 | TheLemonMan | strace shows the node version uses a lot of pread64 calls to load the whole file into memory |
17:43:03 | TheLemonMan | screw that, I misread the pread64 manpage |
17:43:09 | FromGitter | <kaushalmodi> the .xz is created in koch.nim here: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba52dad5df5194734f2f417] |
17:43:15 | FromGitter | <kaushalmodi> I find that very cryptic |
17:43:29 | TheLemonMan | it uses a big chunk size (65535 vs 4096) |
17:45:04 | FromGitter | <rayman22201> @iffy maybe. I want to see if fgets fixes it first. I'm trying it out in a minute. |
17:46:44 | FromGitter | <mratsim> mixin not working properly in generics proc is annoying :/ that prevents defining “rand” proc later :/ |
17:46:51 | TheLemonMan | kaushalmodi, look at niminst.nim |
17:47:28 | FromGitter | <kaushalmodi> TheLemonMan: will have a look.. though what is `$#` in that exec? |
17:47:32 | krux02 | mratsim: where is mixin not working? |
17:47:37 | FromGitter | <tim-st> @iffy maybe the python implementation is better. My assumption for python is that it uses a buffered stream then parses on this stream for lines and refills buffer when needed, nim doesnt seem to buffer |
17:49:04 | FromGitter | <tim-st> maybe setting `bufSize` makes a difference: https://nim-lang.org/docs/streams.html#newFileStream,string,FileMode,int |
17:49:05 | FromGitter | <mratsim> @krux02, here, I’d like to use mixin rand: https://github.com/SimonDanisch/julia-challenge/pull/3/files#diff-7f0523acf6522d8908cac4b96d98dfa5R40 |
17:50:05 | FromGitter | <mratsim> but you actually already know the issue, it’s this: https://github.com/nim-lang/Nim/issues/6387 |
17:50:15 | FromGitter | <mratsim> (I think) |
17:50:29 | FromGitter | <kaushalmodi> TheLemonMan: from niminst.nim, looks like `tar` is used if `gtar` is not found |
17:50:40 | * | Trustable quit (Remote host closed the connection) |
17:50:41 | FromGitter | <Vindaar> @kaushalmodi `$#` is one possible placeholder for `strutils.%`, see https://nim-lang.org/docs/strutils.html#%,string,openArray[string] |
17:50:44 | FromGitter | <kaushalmodi> Araq: Is `gtar` available on Travis |
17:51:00 | FromGitter | <mratsim> The use case is to define `type Point3 = object; x, y, z: float32` later in bench |
17:51:14 | FromGitter | <mratsim> and a `rand` proc on those later as well |
17:51:28 | FromGitter | <mratsim> so I need to force the rand symbol open so I can define it later |
17:51:36 | krux02 | honestly I have no idea what I have written there |
17:51:52 | FromGitter | <mratsim> but due to generics, Nim tries to resolve the symbol anyway |
17:52:40 | FromGitter | <kaushalmodi> @Vindaar Thanks! I am too spoiled by strformat :) |
17:52:54 | FromGitter | <kaushalmodi> I have never yet needed to use that % operator |
17:53:12 | FromGitter | <kaushalmodi> s/never/not |
17:53:53 | krux02 | mratsim: why don't you use an explicit mixin |
17:55:11 | FromGitter | <Vindaar> @kaushalmodi hehe, almost thought as much :) |
17:55:28 | FromGitter | <iffy> @tim-st bufsize=4096 didn't seem to help |
17:56:31 | FromGitter | <tim-st> @iffy the pythons default is 8192 |
17:57:00 | FromGitter | <tim-st> but maybe it's not implemented to work together with FileStream, then it's a bug |
17:57:50 | FromGitter | <mratsim> @krux02, doesn’t work, I tried `mixin rand` |
17:58:14 | FromGitter | <kaushalmodi> question about the nightly build travis: https://github.com/nim-lang/nightlies/blob/master/.travis.yml |
17:58:36 | FromGitter | <kaushalmodi> on which OS is that koch xz run? |
17:58:37 | FromGitter | <iffy> @tim-st neither 4096 nor 8192 made any noticeable difference |
17:58:54 | FromGitter | <mratsim> full gist here: https://gist.github.com/mratsim/e29de51f73800e5bfce9419abd9ddcfc GTG |
17:59:28 | FromGitter | <tim-st> @iffy ok, then it's a bug I think because when `bufsize` is available for a `FileStream` it's expected to make a difference |
17:59:48 | FromGitter | <tim-st> I'd like to have buffer support for FileStream :\ |
17:59:49 | FromGitter | <iffy> @rayman22201 I filed this https://github.com/nim-lang/Nim/issues/9026 (cause I need to go now) so that we can keep track of discussion there |
18:01:05 | * | darithorn quit (Quit: WeeChat 2.2) |
18:04:49 | FromGitter | <tim-st> are nightly builds planned for windows too? |
18:05:07 | FromGitter | <kaushalmodi> they should work on windows too |
18:05:27 | FromGitter | <kaushalmodi> download that tar.xz, extract it, and run `sh build.sh` (so needs to run in bash on windows) |
18:06:20 | FromGitter | <tim-st> doesnt windows need `build.bat` ? |
18:06:25 | FromGitter | <kaushalmodi> actually ignore what I said |
18:06:28 | FromGitter | <kaushalmodi> sorry |
18:06:41 | FromGitter | <kaushalmodi> but reading through instructions, the same tar.xz should work on windows too |
18:06:55 | FromGitter | <kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba5333fe5c2cc56adc366af] |
18:07:51 | FromGitter | <kaushalmodi> I don't see finish.exe in the tar.xz |
18:07:57 | FromGitter | <kaushalmodi> but I do see some *.bat files |
18:08:22 | FromGitter | <kaushalmodi> try it out.. and probably open an issue saying that those instructions probably need to be updated |
18:08:23 | FromGitter | <kaushalmodi> :) |
18:11:36 | FromGitter | <tim-st> ok, thanks, I thought it was a precompiled binary with `nim.exe` |
18:13:03 | * | navin_ quit () |
18:13:09 | enthus1ast | if you dont have a nim.exe on windows already you can bootstrap from c and build the devel Nim with koch boot |
18:13:43 | FromGitter | <kaushalmodi> enthus1ast: This is about testing the new nightly releases |
18:13:57 | FromGitter | <tim-st> yes, I have one, but I thought that I read that appveyor can build nightlies with complete binaries like on the official nim download page |
18:14:02 | FromGitter | <kaushalmodi> I think anyone should be able to download the release and just build it |
18:14:13 | FromGitter | <tim-st> I think ziglang does it |
18:14:21 | enthus1ast | ah ok nice to know |
18:15:04 | FromGitter | <kaushalmodi> @tim-st Yes, that would be nice. Have a compiled (and hopefully static) binaries for each platform |
18:15:29 | FromGitter | <kaushalmodi> The Go lang distribution can serve as a great example |
18:15:54 | FromGitter | <kaushalmodi> I don't code in Go, but I can simply download the release tar, extract it and put the contents in PATH. Done. |
18:16:20 | FromGitter | <kaushalmodi> useful to routinely build certain Go apps that I love: hugo, peco |
18:16:26 | FromGitter | <tim-st> yes, that's nice |
18:22:25 | * | Spitfire2 joined #nim |
18:24:56 | TheLemonMan | tim-st, bufSize works but doesn't influence what fread does |
18:26:12 | * | flaviu quit (Remote host closed the connection) |
18:27:03 | * | Spitfire2 quit (Ping timeout: 244 seconds) |
18:28:10 | FromGitter | <tim-st> ok, then I think it would be better if the bufSize would work on the FileStream level, which had the wished impact I think |
18:29:23 | TheLemonMan | sure thing |
18:35:27 | * | anzuof13 joined #nim |
18:36:18 | * | anzuof13 quit (Remote host closed the connection) |
18:38:43 | Araq | tim-st: the appveyor nightlies will have the build binaries |
18:38:55 | Araq | once I got it to work... :-) |
18:44:08 | FromGitter | <kaushalmodi> Araq: As an aside, does `gtar caf foo.tar.xz foo/` work on OSX? |
18:44:17 | FromGitter | <kaushalmodi> you do not need to do tar and xz separately |
18:44:29 | FromGitter | <kaushalmodi> `ca` .. `a` stands for automatic |
18:44:47 | FromGitter | <kaushalmodi> the .xz extension makes tar figure out by itself what compression to use |
18:45:18 | FromGitter | <kaushalmodi> (unless of course that is less useful in niminst.nim if BSD tar does not understand `a` |
18:45:20 | FromGitter | <kaushalmodi> ) |
18:46:00 | FromGitter | <bung87> I remenber I installed xz as required |
18:46:34 | FromGitter | <kaushalmodi> @bung87 because right now it is explicitly calling `xz` |
18:47:24 | FromGitter | <kaushalmodi> so.. BSD tar supports the `a` switch too: https://www.freebsd.org/cgi/man.cgi?query=bsdtar&sektion=1&manpath=freebsd-release-ports |
18:48:07 | TheLemonMan | make sure you check out if OpenBSD and NetBSD and DragonFlyBSD and ... agree :) |
18:49:18 | FromGitter | <kaushalmodi> oh well :) |
18:54:02 | FromGitter | <bung87> Ok I just awared of the detail,that was a py lib packaged images from docker compose file |
18:54:44 | Araq | kaushalmodi: no idea |
19:03:31 | FromGitter | <unreadable> Any advatages by choosing cpp backend over c? |
19:04:13 | * | ritchie_ quit (Remote host closed the connection) |
19:04:13 | TheLemonMan | cheaper exceptions & you'll be able to stress-test it :) |
19:05:59 | * | Jesin joined #nim |
19:08:13 | * | Jesin quit (Remote host closed the connection) |
19:09:50 | Araq | TheLemonMan: I did stress test it, the results weren't bad |
19:10:06 | FromGitter | <tim-st> Araq: nice, good to hear! |
19:10:29 | Araq | but still made the CIs red and so I haven't merged my patch |
19:10:43 | TheLemonMan | Araq, the recent codegen problems prove otherwise heh the more people test it the merrier |
19:10:49 | Araq | also ... running all the tests both with C and C++ will produce more timeouts |
19:11:32 | TheLemonMan | one could shard the tests and run eg. C on travis and C++ on circleci or gitlab or whatever |
19:11:57 | TheLemonMan | the alternative is to shell out money for some more time on the boxes |
19:13:08 | FromGitter | <unreadable> Overall, what would you guys recommend as a backend |
19:13:34 | * | crem quit (Ping timeout: 240 seconds) |
19:13:37 | FromGitter | <unreadable> Or when to pick c over cop |
19:13:42 | FromGitter | <unreadable> cpp* |
19:13:56 | * | Jesin joined #nim |
19:15:52 | * | crem joined #nim |
19:19:16 | krux02 | C is just the default |
19:19:24 | krux02 | cpp should be as reliable |
19:19:52 | krux02 | C just has potentionally more backends |
19:20:04 | krux02 | so maximum compatibility -> C backend |
19:20:51 | Araq | TheLemonMan: yeah good idea |
19:35:48 | FromGitter | <codenoid> morning all |
19:35:49 | FromGitter | <codenoid> <3 |
19:37:15 | FromGitter | <Clyybber> morning |
19:37:30 | FromGitter | <Clyybber> even if its evening here... heh |
19:37:43 | * | thebotnet_ joined #nim |
19:44:21 | stefanos82 | morning...which day is it for you @codenoid? |
19:45:28 | FromGitter | <rayman22201> @iffy https://gist.github.com/rayman22201/6b26e1a14b5e4f04776103de976cd8d7 |
19:45:53 | FromGitter | <rayman22201> using the built in file.readLine, (which uses fgets btw) blows everything else out of the water. |
19:47:17 | FromGitter | <rayman22201> also @tim-st and anyone else who cares |
19:49:11 | FromGitter | <codenoid> yeah, it's 02:49 AM, technically morning |
19:49:33 | stefanos82 | ah lol I thought it was more like 8 or 9am for you |
19:50:01 | stefanos82 | here it's 22:50PM |
19:50:11 | FromGitter | <rayman22201> @araq wrote this nice buffered / fgets implementation of readline for Files, but that implementation is not used for generic streams. I think fgets should work for other kinds of streams, so why isn't it used there? https://github.com/nim-lang/Nim/blob/2745111fc333d58f663480639aae5b2e0e0e1636/lib/system/sysio.nim#L144 |
19:50:34 | Araq | I didn't write this, def- did iirc |
19:50:46 | FromGitter | <rayman22201> lol, git blame failed me then :-P |
19:51:34 | * | thebotnet_ quit (Quit: Page closed) |
19:52:33 | * | noonien quit (Quit: Connection closed for inactivity) |
19:54:33 | FromGitter | <rayman22201> Still, my question remains. I know fgets will at least work for File streams and Sockets, the two main uses for Streams, so why not use it in the stream module instead of the naive implementation? |
20:20:27 | FromGitter | <tim-st> @rayman22201 intersting, thanks, yes would be good if FileStream has the same performance as File |
20:22:45 | * | Jesin quit (Quit: Leaving) |
20:24:32 | * | Jesin joined #nim |
20:27:39 | * | cooldude13 joined #nim |
20:28:05 | FromGitter | <rayman22201> I think a reasonable solution is to do the dynamic dispatch thing and add a readLineImpl to the Stream interface here: https://github.com/nim-lang/Nim/blob/master/lib/pure/streams.nim#L41 |
20:28:14 | FromGitter | <rayman22201> I may do a PR for this |
20:28:49 | * | icebattle quit (Quit: leaving) |
20:29:01 | * | Ven`` joined #nim |
20:31:18 | FromGitter | <iffy> @rayman22201 Thanks! (and for your comments on GitHub). |
20:33:07 | * | Ven`` quit (Ping timeout: 240 seconds) |
20:33:31 | FromGitter | <tim-st> I missed a proc to read a null terminated string from a stream, the readLine breaks on new line or null char, but sometimes you need to parse for null char only :\ |
20:34:13 | * | cooldude13 quit (Ping timeout: 245 seconds) |
20:34:18 | TheLemonMan | use readData plus memchr? |
20:35:08 | FromGitter | <rayman22201> @iffy np. It was a small and fun / interesting problem :-P @tim-st This is true. pretty much every implementation of readLine works this way though |
20:36:01 | FromGitter | <rayman22201> @TheLemonMan lol, yeah, exactly, or mmap if you can at that point. |
20:37:59 | FromGitter | <iffy> wow... my real program is 5x faster than node now. More like what I expected |
20:38:34 | TheLemonMan | once again rayman saves the day! |
20:39:20 | FromGitter | <rayman22201> lol 😎 |
20:39:24 | FromGitter | <rayman22201> not really though |
20:39:29 | FromGitter | <rayman22201> but thank you |
20:39:43 | * | erratic quit (Quit: this server has gone to sleep) |
20:44:23 | Araq | rayman: PR is welcome. |
20:44:26 | * | Zeno[m] left #nim ("User left") |
20:44:37 | FromGitter | <rayman22201> @araq working on it |
20:45:46 | FromGitter | <rayman22201> after lunch though. :-) |
20:50:03 | * | leru joined #nim |
21:09:14 | * | lhavelund joined #nim |
21:15:07 | * | lhavelund quit (Ping timeout: 240 seconds) |
21:30:20 | * | nsf joined #nim |
21:32:11 | * | miran joined #nim |
21:32:18 | * | leru quit (Remote host closed the connection) |
21:33:16 | FromGitter | <almynic> Hi I just switch from stable to devel and now I got this Error: usage of 'isNil' is a user-defined error ⏎ ⏎ Here is my code: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba5639c33da0f649e346742] |
21:33:56 | FromGitter | <almynic> Can anyone help me out? |
21:34:08 | TheLemonMan | seqs (and strings) cannot be nil anymore |
21:34:27 | FromGitter | <kaushalmodi> *There should be a sticky for this somewhere.* |
21:34:31 | TheLemonMan | `this.formats.isNil` -> `this.formats.len == 0` |
21:35:29 | FromGitter | <almynic> Oh thanks. |
21:36:09 | FromGitter | <kaushalmodi> Also, if you want to *temporarily* keep using nil, compile with `--nilseqs:on` |
21:37:01 | * | leru joined #nim |
21:38:28 | FromGitter | <almynic> I'm not a fan of nil and null I try to avoid that as much as possible ;) |
21:39:12 | TheLemonMan | hmm, we could slip a `deprecated` pragma with an informative message along with the .error. one |
21:40:23 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
21:40:31 | FromGitter | <almynic> That would help others or at least update the documentation. |
21:41:11 | FromGitter | <kaushalmodi> How would documentation help? |
21:41:28 | FromGitter | <kaushalmodi> It's not as if people search the documentation on see the error. |
21:42:00 | FromGitter | <kaushalmodi> Talking of which, now the documentation from devel branch is published at https://nim-lang.github.io/Nim/theindex.html |
21:43:16 | FromGitter | <zacharycarter> nice! |
21:43:50 | FromGitter | <kaushalmodi> @almynic OK, I see.. there should have been some sign of `isNil` not working for strings and seqs here: https://nim-lang.github.io/Nim/system.html#isNil,string |
21:44:37 | FromGitter | <kaushalmodi> well.. there is a *sign* albeit a hidden one |
21:44:48 | FromGitter | <kaushalmodi> clicking on those 3 dots shows: `proc isNil(x: string): bool {.noSideEffect, magic: "IsNil", error.}` :D |
21:44:53 | FromGitter | <kaushalmodi> <-- error |
21:45:38 | FromGitter | <kaushalmodi> TheLemonMan: Should an issue be opened to track this? addition of deprecated pragma? |
21:52:56 | FromGitter | <kaushalmodi> Fun fact of the day: ⏎ ⏎ > 14 representing the 14 original members of the nazi party, and the 88 representing the HH sign ⏎ ⏎ https://github.com/nim-lang/Nim/issues/9030 [https://gitter.im/nim-lang/Nim?at=5ba5683833da0f649e3481e3] |
21:56:07 | FromGitter | <rayman22201> Wat |
21:57:39 | miran | and so it begins.... |
21:58:15 | * | WakiMiko3 joined #nim |
21:58:17 | FromGitter | <kaushalmodi> It's amusing.. there are a variety of trolls out there |
21:59:57 | miran | i really hope so somebody is having fun |
22:00:18 | FromDiscord | <Shield> this is how opensource dies |
22:00:44 | miran | and this is just a stab at the recent linux kernel events |
22:00:46 | * | WakiMiko3 quit (Remote host closed the connection) |
22:05:24 | FromDiscord | <Shield> it's sad, they found a way to waste people's time on stupid "issues", what's next? banning words from dictionaries? |
22:08:48 | * | Vladar quit (Remote host closed the connection) |
22:15:17 | * | nsf quit (Quit: WeeChat 2.2) |
22:22:58 | * | leru quit (Ping timeout: 245 seconds) |
22:23:47 | * | miran quit (Ping timeout: 252 seconds) |
22:25:51 | FromDiscord | <Tomohiro> When I write "const pi = 3.14159", it must be replaced with "const pi = 3.13159"? |
22:28:29 | stefanos82 | what? -_- |
22:34:20 | FromGitter | <kaushalmodi> stefanos82: see above linked issue 😂 |
22:34:28 | * | problame_ joined #nim |
22:36:34 | stefanos82 | is this a troll or something? |
22:36:49 | stefanos82 | "Diversity editor at NimGump Tech" |
22:44:01 | * | problame_ quit (Ping timeout: 260 seconds) |
23:09:47 | * | ariabuckles13 joined #nim |
23:10:40 | * | ariabuckles13 quit (K-Lined) |
23:32:20 | * | krux02 quit (Remote host closed the connection) |
23:32:34 | * | krux02 joined #nim |
23:34:16 | * | druonysus quit (Quit: No Ping reply in 180 seconds.) |
23:35:27 | FromDiscord | <exelotl> Is it possible to use a macro to modify a const after it has been defined? |
23:35:30 | * | druonysus joined #nim |
23:35:30 | * | druonysus quit (Changing host) |
23:35:30 | * | druonysus joined #nim |
23:44:41 | FromGitter | <rayman22201> Why not just have the macro generate the constant to begin with? |
23:54:48 | * | hydraz11 joined #nim |
23:56:29 | * | hydraz11 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
23:56:57 | * | xet7 quit (Quit: Leaving) |
23:57:10 | FromGitter | <kayabaNerve> ^^ |