00:01:11 | giaco | thank! |
00:01:13 | giaco | s! |
00:01:56 | * | rockcavera quit (Read error: Connection reset by peer) |
00:02:27 | * | rockcavera joined #nim |
00:06:40 | * | xet7 joined #nim |
00:15:53 | * | spiderstew quit (Ping timeout: 245 seconds) |
00:16:03 | * | spiderstew joined #nim |
00:16:48 | * | antranigv quit (Ping timeout: 245 seconds) |
00:17:26 | * | antranigv joined #nim |
00:18:30 | * | nxnl[m] quit (Ping timeout: 244 seconds) |
00:19:26 | * | alex[m]28 quit (Ping timeout: 240 seconds) |
00:19:27 | * | vycb[m] quit (Ping timeout: 240 seconds) |
00:19:32 | * | retroedgetech[m] quit (Ping timeout: 244 seconds) |
00:19:35 | * | romes[m] quit (Ping timeout: 240 seconds) |
00:19:42 | * | Clonkk[m] quit (Ping timeout: 258 seconds) |
00:21:44 | * | nxnl[m] joined #nim |
00:22:40 | * | vycb[m] joined #nim |
00:22:40 | * | alex[m]28 joined #nim |
00:23:32 | * | retroedgetech[m] joined #nim |
00:27:33 | * | j-james[m] joined #nim |
00:28:20 | * | Clonkk[m] joined #nim |
00:28:57 | * | romes[m] joined #nim |
00:43:44 | giaco | few days ago I read about a std proc/template used to turn an inplace proc into a return value one. It was into a discussion about adding all "*ed" function to std for each inplace version, but I can't remember the name of it or where is it |
00:45:02 | FromDiscord | <konsumlamm> `sugar.dup` |
00:45:08 | FromDiscord | <konsumlamm> it's a macro actually |
00:45:36 | FromDiscord | <konsumlamm> https://nim-lang.github.io/Nim/sugar.html#dup.m%2CT%2Cvarargs%5Buntyped%5D |
00:46:20 | giaco | thanks! |
00:50:32 | giaco | I have set of chars and I want to remove from a string all chars inside the set. I could do mystr.filterIt(it notin myset).join, but I think multiReplace would be a better choice. How can I create the proper input for multireplace starting from my char set? |
00:52:01 | giaco | what's the proper way to turn my set into something I can use as "replacements" for -> proc multiReplace(s: string; replacements: varargs[(string, string)]): string |
00:54:39 | FromDiscord | <Yardanico> if you want to use multiReplace, you can do something like that I guess |
00:54:46 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Ru0 |
00:56:22 | FromDiscord | <Yardanico> `const` ensures that `replacements` gets created at compile-time so that you don't spend runtime time doing `mapIt` |
00:56:53 | FromDiscord | <Yardanico> basically mapIt to create a tuple where the first element is char converted to string and second one is an empty string |
00:57:24 | * | teasea quit (Quit: Ping timeout (120 seconds)) |
00:57:48 | * | teasea joined #nim |
00:59:05 | FromDiscord | <Yardanico> @giaco ^ |
00:59:16 | giaco | yeah! I was trying to use the wrong tool to map the set into a tuple list. Thanks. Which one would you use: the filterIt at runtime, or the multiReplace? |
01:00:02 | * | lkjasdf quit (Quit: WeeChat 3.0.1) |
01:00:46 | FromDiscord | <Yardanico> i personally would've used multiReplace I guess |
01:01:13 | FromDiscord | <Yardanico> I just benchmarked and filterIt is slower than multiReplace, but not by much |
01:01:27 | FromDiscord | <Yardanico> but those benchmarks depend on a lot of stuff |
01:01:51 | FromDiscord | <Yardanico> in most cases you don't have to optimize the code to the brim, so stuff like that is ok |
01:02:04 | FromDiscord | <Yardanico> you might also be interested in https://github.com/zero-functional/zero-functional |
01:03:54 | FromDiscord | <Yardanico> or also https://nim-lang.org/docs/sugar.html#collect.m%2Cuntyped%2Cuntyped |
01:08:40 | giaco | this is a silver bullet to solve multi loop procedures into single one! I've been using stuff like this in python and C#, didn't know they were already available in nim. Thanks! |
01:08:41 | FromDiscord | <Yardanico> yeah, nim had somewhat pythonish list comprehensions before, but they didn't work well |
01:08:41 | FromDiscord | <Yardanico> back when the sugar module was named "future" :P |
01:08:41 | FromDiscord | <Yardanico> https://nim-lang.org/0.18.0/future.html |
01:08:45 | FromDiscord | <Yardanico> compared to `lc`, `collect` fits "nim style" much better |
01:13:31 | giaco | is collect optimizing loops like zero-functional? I've learned a bit of clojure months ago, I really like functional style, but yet achieved almost zero productivity out of it. Is it worth using collect and zero-functional in nim, or is just "sugar"? |
01:14:20 | FromDiscord | <Yardanico> It's certainly worth using zero-functional over sequtils when you chain a lot of sequtils calls like mapIt filterIt etc |
01:17:22 | FromDiscord | <Yardanico> of course you can also refactor those sequtils calls into a collect call |
01:17:39 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:17:58 | * | njoseph joined #nim |
01:19:03 | FromDiscord | <Yardanico> collect is just a thin macro over actual for loops |
01:19:06 | FromDiscord | <Yardanico> it doesn't do much "magic" |
01:21:38 | giaco | so natural progression would be sequtils -> collect -> zero-functional |
01:21:53 | FromDiscord | <Yardanico> I'd say you could always just start with collect :P |
01:23:56 | giaco | thanks! |
01:25:14 | * | ee7[m] joined #nim |
01:51:31 | FromDiscord | <konsumlamm> many things are "just sugar", but that doesn't mean they're not worth using |
01:53:09 | giaco | konsumlamm sure, but intention was about to discriminate a more performant solution to a one just more idiomatic. There's no doubt about that the fact that it is worth preferring it in both cases. |
01:55:18 | giaco | if I want to reuse a string inside a for loop, is it correct to use "mystr.delete(mystr.low, mystr.high)" considering the fact that I don't know the length of the next string in advance? |
01:58:35 | FromDiscord | <Yardanico> Use setLen instead |
01:59:23 | FromDiscord | <Yardanico> https://nim-lang.org/docs/system.html#setLen%2Cstring%2CNatural |
01:59:29 | FromDiscord | <Yardanico> mystr.setLen(0) |
01:59:53 | FromDiscord | <Yardanico> And it's okay if you don't know the length of the next string |
02:04:08 | giaco | setLen! I somehow missed it while skimming the docs. Thanks! |
02:04:47 | FromDiscord | <Yardanico> It might not be obvious that it doesn't deallocate I guess |
02:09:05 | FromDiscord | <Yardanico> You might be interested in http://ssalewski.de/nimprogramming.html |
02:09:32 | FromDiscord | <Yardanico> It covers a lot of topics in more depth |
02:13:20 | giaco | Yardanico: I'm already on it after "nim in action", but I dediced to stop for a while to write some real code before continuing |
02:14:37 | giaco | is there a function to get the number of digits of an integer without converting it to string? |
02:17:36 | giaco | I'm writing it myself, but I think all the parse functions must be doing it internally |
02:24:55 | * | asdflkj quit (Ping timeout: 240 seconds) |
02:28:15 | * | lritter quit (Ping timeout: 240 seconds) |
02:28:18 | * | sz0_ joined #nim |
02:29:16 | * | lritter joined #nim |
02:29:58 | * | unclechu quit (*.net *.split) |
02:29:59 | * | sz0 quit (*.net *.split) |
02:30:02 | * | sz0_ is now known as sz0 |
02:31:56 | giaco | nevermind, I wrote mine |
02:33:18 | * | unclechu joined #nim |
02:42:56 | giaco | well this is actually better, didn't know this trick "1234567.toFloat.log10.ceil.toInt" |
02:52:06 | * | abm quit (Read error: Connection reset by peer) |
02:55:11 | * | quantimnot quit (Quit: Connection closed) |
02:56:15 | * | lritter quit (Quit: Leaving) |
02:59:02 | * | lmariscal joined #nim |
03:07:18 | FromDiscord | <exelotl> Hehe nice |
03:10:28 | * | lmariscal quit (Quit: q) |
03:15:18 | FromDiscord | <hamidb80> hey |
03:17:33 | FromDiscord | <hamidb80> `Error: 'sleep' proc is not available on the NimScript/js target` |
03:17:48 | FromDiscord | <hamidb80> (edit) "`Error: 'sleep' proc is not available on the NimScript/js target` ... " added "π" |
03:18:34 | FromDiscord | <Yardanico> Are you trying to use `sleep` with JS? |
03:18:51 | FromDiscord | <hamidb80> In reply to @Yardanico "Are you trying to": i wanna use nimscript |
03:18:56 | FromDiscord | <hamidb80> (edit) "In reply to @Yardanico "Are you trying to": i wanna use ... nimscript" added "it with" |
03:19:06 | FromDiscord | <Yardanico> Well, as the error says, `sleep` is not available in NimScript :P |
03:23:34 | * | rockcavera quit (Remote host closed the connection) |
03:25:50 | * | muffindrake quit (Ping timeout: 264 seconds) |
03:27:19 | * | muffindrake joined #nim |
03:43:34 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=2Rvi |
03:43:47 | FromDiscord | <hamidb80> ` Error: 'export' is only allowed at top level11` |
03:44:00 | FromDiscord | <hamidb80> (edit) "level11`" => "level` :: proc wsChannel_reader() ..." |
03:45:56 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Rvj |
03:46:07 | FromDiscord | <Yardanico> You can't implement pragmas only with templates like that (unless for some purpose), generally you'd use macros to implement them |
03:46:57 | FromDiscord | <hamidb80> In reply to @Yardanico "Are you sure you": i don't know - i just did like that https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#decorators |
03:47:52 | FromDiscord | <hamidb80> oh |
03:48:18 | FromDiscord | <Yardanico> The code shown in that example will call the code from the template _outside_ the proc |
03:48:36 | FromDiscord | <Yardanico> the `body` you get in the template if it's a pragma is the whole proc, not just its body |
03:48:46 | FromDiscord | <hamidb80> i get it, tnx |
03:51:58 | FromDiscord | <Yardanico> You can do it with a macro like this: |
03:52:21 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Rvk |
03:52:28 | FromDiscord | <Yardanico> But don't forget - order of pragma declaration can matter |
03:52:57 | FromDiscord | <Yardanico> In this case, if you put the `async` pragma before `asyncLoop` the code won't compile, because `async` is the macro that understands all the "await" statements and later transforms them |
03:53:20 | FromDiscord | <Yardanico> (edit) "declaration" => "declarations" |
03:53:42 | FromDiscord | <flywind> Do we have some performance tutorial like this? https://crystal-lang.org/reference/guides/performance.html |
03:55:12 | FromDiscord | <Yardanico> I don't think so |
03:55:40 | FromDiscord | <flywind> Ok, thanks |
03:56:49 | saem | I think someone wrote a blog post, I think it related to lessons they learned writing a ray tracer in nim |
03:57:42 | saem | This: https://blog.johnnovak.net/2017/04/22/nim-performance-tuning-for-the-uninitiated/ |
03:57:43 | FromDiscord | <flywind> I will make one, then I hope beginners won't ask why Nim is much slower than Python(`-d:danger`) π |
03:58:04 | FromDiscord | <flywind> And this one https://github.com/nim-lang/RFCs/issues/188 |
03:58:04 | saem | Also there is the but at the end of the compiler manual |
03:58:04 | FromDiscord | <Yardanico> Yes but it's quite specific and already 4 years old :) |
03:58:24 | FromDiscord | <Yardanico> I mean the tuning article |
04:04:10 | * | WilhelmVonWeiner quit (Ping timeout: 276 seconds) |
04:04:29 | * | NimBot joined #nim |
04:15:42 | * | WilhelmVonWeiner joined #nim |
04:16:05 | * | WilhelmVonWeiner is now known as Guest20418 |
04:25:50 | * | spiderstew_ joined #nim |
04:26:55 | * | spiderstew quit (Ping timeout: 240 seconds) |
04:41:05 | FromDiscord | <hamidb80> `tuple[InteractableTerminal, proc(l: string)]` |
04:41:14 | FromDiscord | <hamidb80> Error: ':' or '=' expected, but got 'keyword proc' |
04:42:47 | FromDiscord | <ElegantBeef> `tuple[]` is for named tuples, you need to provide a name for each field there |
04:43:15 | FromDiscord | <ElegantBeef> If you want an anonymous tuple you'd just do `(InteractableTerminal, proc(l: string))` |
04:44:11 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#types-tuples-and-object-types |
04:45:59 | FromDiscord | <hamidb80> i wish there a macro to extract `proc`s arguments type |
04:46:37 | FromDiscord | <hamidb80> `createThread` would be so easier |
04:46:50 | FromDiscord | <ElegantBeef> I mean it's not overly complex to do |
04:46:57 | FromDiscord | <Rika> There are but the api is messy IMO |
05:06:58 | * | sz0 quit (Quit: Connection closed for inactivity) |
05:16:10 | FromGitter | <gogolxdong> Is it Nim suitable for smart contract language? |
05:32:30 | * | narimiran joined #nim |
05:41:38 | FromDiscord | <Hi02Hi> I'm not an expert, but I have heard smart contracts in the context of cryprocurrency, and https://github.com/status-im is an Ethereum client that uses Nim |
05:44:13 | FromGitter | <gogolxdong> yes, https://github.com/status-im/nimbus-eth1 https://github.com/status-im/nimbus-eth2 can interact with Ethereum. |
05:45:51 | FromGitter | <gogolxdong> They seek blockchain interoperability. |
05:51:39 | FromDiscord | <gogolxdong> People want blockchain interoperability. |
05:57:45 | * | vicfred quit (Quit: Leaving) |
06:08:13 | * | haxscramper joined #nim |
06:12:34 | ForumUpdaterBot | New thread by Halloleo: Yeay! Finally I udnerstand how to write a "Makefile" in Nim!, see https://forum.nim-lang.org/t/7575 |
06:34:36 | ForumUpdaterBot | New thread by Dponyatov: Relative "based/biased" long pointers and data structures over it, see https://forum.nim-lang.org/t/7576 |
07:05:11 | * | krux02 joined #nim |
07:16:40 | ForumUpdaterBot | New thread by Halloleo: How to have the generated executables in a bin directory out of the way when using testament, see https://forum.nim-lang.org/t/7577 |
07:20:15 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
07:33:11 | * | kenran joined #nim |
07:35:42 | * | wasted_youth2 quit (Quit: Leaving) |
07:38:08 | * | letto quit (Quit: Konversation terminated!) |
07:40:22 | * | letto joined #nim |
08:02:29 | * | ^Q-Master^ joined #nim |
08:04:34 | * | Q-Master quit (Ping timeout: 260 seconds) |
08:15:37 | * | PMunch joined #nim |
08:48:24 | FromDiscord | <Larry&10K> I'm not an expert, but I have heard smart contracts in the context of cryprocurrency, and https://github.com/status-im is an Ethereum client that (partially) uses Nim |
09:34:30 | PMunch | Hmm, I think I should finally replace my poor parser with npeg in protobuf.. |
09:37:59 | FromDiscord | <GreenFork> is there an efficient CSV writer in Nim? I only see parser |
09:41:11 | FromDiscord | <mratsim> CSV is really easy to write. |
09:41:32 | FromDiscord | <mratsim> I doubt you can even make it efficient. |
09:41:56 | FromDiscord | <mratsim> you'll be bottlenecked by disk |
09:43:31 | FromDiscord | <GreenFork> okay, thanks |
09:45:44 | PMunch | I mean the rules for CSV and escaping are a bit iffy |
09:45:52 | PMunch | But apart from that it's pretty trivial |
09:48:22 | FromDiscord | <mratsim> Time format is the most iffy thing |
09:48:50 | FromDiscord | <mratsim> and encoding. Because Excel can't open UTF-8 CSV without jumping through hops. |
09:49:00 | PMunch | Eh, time format isn't part of CSV |
09:49:10 | * | JustASlacker joined #nim |
09:49:11 | PMunch | Wait, really? |
09:49:40 | FromDiscord | <Rika> if i'm copying something from the nim repo, do i have to put the exact text of copying.txt as the license of the repo/file, or only the MIT part (incl ar_q's name)? |
09:50:47 | FromDiscord | <flywind> the license name + author name putting in the front of codes I think. |
10:15:45 | * | sz0 joined #nim |
10:21:10 | krux02 | recently somebody posted a link to a website similar to the programming language benchmark game, but with the difference to actually include languages (like Nim) |
10:21:16 | krux02 | do you recall the name? |
10:22:08 | krux02 | I would like to reference that in favor of the old website as it is to exclusive for my taste to serve a meaningful purpose. |
10:26:42 | PMunch | Someone was sharing code-golf stuff the other day, if that's what you are talking about? |
10:43:56 | krux02 | not talking about short programs, I mean performance. |
11:27:34 | * | JustASlacker quit (Quit: Leaving) |
11:27:47 | * | JustASlacker joined #nim |
11:28:17 | * | Vladar joined #nim |
11:29:25 | * | qwertfisch quit (Read error: Connection reset by peer) |
11:31:30 | * | qwertfisch joined #nim |
11:42:27 | FromDiscord | <mratsim> kostya? |
12:08:33 | FromDiscord | <Rika> is `=destroy` not supposed to call on signal? |
12:09:59 | * | asdflkj joined #nim |
12:12:30 | * | romes[m] left #nim ("User left") |
12:14:56 | FromDiscord | <Clyybber> nim doesn't do much for signals out of the box |
12:14:58 | FromDiscord | <Clyybber> https://nim-lang.github.io/Nim/nimc#signal-handling-in-nim |
12:18:34 | * | rockcavera joined #nim |
12:31:21 | FromDiscord | <Rika> nim's std/openssl wrapper is incomplete? |
12:31:41 | FromDiscord | <flywind> yeah |
12:56:13 | PMunch | It's pretty annoying.. |
12:56:25 | PMunch | It seems people have just added the bits and pieces they needed |
12:56:41 | PMunch | But to be fair that's exactly what I did when I noticed it was missing some things I needed.. |
13:00:22 | FromDiscord | <Rika> https://github.com/genotrance/nimssl is confusing to use... |
13:07:16 | FromDiscord | <Rika> ah basepath is wrong... |
13:09:11 | JustASlacker | can nimssl work with x509 files @Rika? |
13:10:09 | JustASlacker | doesnt look its doint much |
13:11:07 | FromDiscord | <Rika> it wraps basically all of openssl so |
13:11:14 | FromDiscord | <mratsim> It exposes the whole OpenSSL but you have to ask genotrance to generate the corresponding doc API because you can find it from the Nim code |
13:11:22 | FromDiscord | <mratsim> genotrance/shashlick |
13:11:38 | FromDiscord | <Rika> nimterop is failing to understand bio.h and i dont understand why |
13:11:40 | FromDiscord | <mratsim> which is my main grip with nimterop wrappers |
13:11:41 | FromDiscord | <Yardanico> Can someone make a new nimble package so it gets merged and we'll see if the bot will post an update? :D |
13:11:51 | FromDiscord | <mratsim> leftpad? |
13:13:52 | FromDiscord | <Rika> https://github.com/openssl/openssl/blob/OpenSSL_1_1_1/include/openssl/bio.h#L97 this line produces this in nimterop it seems (ignore the fucked highlighting) https://media.discordapp.net/attachments/371759389889003532/816659639978557470/unknown.png |
13:15:31 | JustASlacker | sounds funky |
13:16:49 | JustASlacker | and crazy |
13:18:04 | FromDiscord | <Rika> `/home/deodex/.cache/nim/nimterop/toastCache/nimterop_3227009606.nim(9, 19) Error: redefinition of 'std_time_t'; previous declaration here: /home/deodex/.choosenim/toolchains/nim-1.0.10/lib/std/time_t.nim(1, 2)` |
13:18:05 | FromDiscord | <Rika> ... |
13:18:33 | FromDiscord | <Rika> christ |
13:21:18 | FromDiscord | <Rika> this error doesnt actually make sense, what |
13:31:15 | FromDiscord | <Rika> oh -_- cimport includes |
13:32:03 | * | m4r35n357 joined #nim |
13:34:50 | FromDiscord | <Rika> nah i dont got a clue what this means |
13:36:36 | m4r35n357 | can anyone point me to a reference to syntax for passing (and receiving) procedures by name? I have tried the manual and "by example" and come up with nothing. without a type I get the error message "Error: typeless parameters are obsolete". |
13:37:46 | FromDiscord | <Rika> `proc a(procparam: proc(param: int): retType)` |
13:38:33 | FromDiscord | <Rika> pass is by just putting the name of the proc as the argument |
13:39:06 | liblq-dev | "typeless parameters are obsolete" is such a terrible error message. when were they obsoleted? why should i care if they have been deprecated since before 1.0? |
13:40:23 | m4r35n357 | IOW what does a formal parameter look like for a procedure? |
13:41:01 | liblq-dev | formal parameters are the ones in regular parentheses () |
13:41:14 | m4r35n357 | OK I saw an old github issue that claimed to be removing the need to procparam . . . |
13:41:19 | liblq-dev | so eg. `proc abc(a: int, b: float, c: string)` has the formal parameters `a: int, b: float, c: string` |
13:42:05 | m4r35n357 | liblq-dev, I mean the formal parameter in the procedure _receiving_ the procedure |
13:42:24 | liblq-dev | well |
13:42:33 | liblq-dev | it's still the thing in between the parentheses |
13:42:36 | m4r35n357 | or, what does the type in "typeless" look like? |
13:42:38 | FromDiscord | <Rika> `proc(param: int): retType` is the type of the parameter `procparam` from the procedure `a` |
13:42:52 | liblq-dev | m4r3n357: `proc abc(a, b, c)` |
13:42:58 | liblq-dev | basically it's a relict of the past |
13:43:08 | m4r35n357 | FromDiscord, OK tha, what if the procedure does not return a value? |
13:43:20 | liblq-dev | `proc (param: int)` |
13:44:22 | m4r35n357 | liblq-dev, so "param" is a keyword? |
13:44:30 | liblq-dev | no |
13:44:35 | liblq-dev | it's a normal identifier |
13:44:46 | liblq-dev | it could just as well be `a`, `hello`, or whatever |
13:45:25 | m4r35n357 | Here is my "receiving" procedure, proc solve(proc uq, proc up) = |
13:45:44 | m4r35n357 | what should it look like if uq and up are "void functions" |
13:45:48 | FromDiscord | <Rika> `proc solve(uq: proc(), up: proc())` |
13:46:01 | liblq-dev | frick, rika was faster |
13:46:03 | FromDiscord | <Rika> void functions as in no params and no return? |
13:46:14 | FromDiscord | <Rika> as i wrote |
13:46:15 | liblq-dev | i think that's what they mean |
13:46:19 | m4r35n357 | FromDiscord, ah OK that looks better, couldn't find that in the manual |
13:46:38 | liblq-dev | also it's not FromDiscord, that's the bot that relays discord messages to IRC |
13:46:43 | liblq-dev | the username is Rika |
13:46:45 | FromDiscord | <Rika> well just know that the type of a proc looks like the signature, just without the name |
13:47:00 | FromDiscord | <Rika> so if you want to pass a `proc dkajs()` the type would be `proc()` |
13:47:27 | m4r35n357 | FromDiscord, that works thanks. |
13:48:15 | m4r35n357 | shame it is so hard to find stuff like that in the docs, lots of useful snippets, but little guidance to putting something more complete together |
13:49:15 | m4r35n357 | Rika I mean thanks to you! |
13:49:51 | * | Vladar quit (Quit: Leaving) |
13:50:30 | FromDiscord | <Rika> π |
13:53:28 | liblq-dev | m4r35n357: it's possible that you were looking for the wrong terms, here's the relevant section in the manual https://nim-lang.org/docs/manual.html#types-procedural-type |
13:56:35 | m4r35n357 | liblq-dev, yes that looks like the right place, I was looking at "procedures" (amongst many other places!). So, if the passed procedure returns a value does that need to be stated in the formal parameter? |
13:56:54 | liblq-dev | yes |
13:57:13 | liblq-dev | and it'd look like `x: proc (): int` |
13:57:20 | FromDiscord | <Rika> nimterop is interpreting a lot of things in openssl incorrectly... |
13:57:27 | m4r35n357 | liblq-dev, OK I was about to ask how ;) |
13:58:40 | m4r35n357 | don't think that info is in there, but I am happy now! |
13:59:22 | m4r35n357 | liblq-dev, thx |
13:59:31 | liblq-dev | np |
14:01:04 | m4r35n357 | this porting is tricky, but I like the procedure overloading in nim |
14:03:09 | Oddmonger | not possible to have ptr on seq elements ? |
14:03:26 | Oddmonger | compiler says Β«maybe unsafeAddrΒ» |
14:03:30 | FromDiscord | <Rika> ? |
14:03:32 | FromDiscord | <Rika> wdym |
14:03:38 | FromDiscord | <Rika> what are you doing exactly |
14:04:33 | Oddmonger | i search a pattern in objects stored in a seq |
14:04:45 | Oddmonger | if i find it, i return the seq entry |
14:04:54 | Oddmonger | and if i don't find it, i return nil |
14:05:08 | FromDiscord | <Rika> seq[ptr T]? |
14:05:24 | Oddmonger | meh |
14:05:27 | FromDiscord | <Rika> if not, cant return nil |
14:05:43 | FromDiscord | <Rika> because return type of only T is not-nillable |
14:05:47 | FromDiscord | <Rika> use options module |
14:05:56 | Oddmonger | yes i see only options here |
14:06:03 | FromDiscord | <Rika> return none(T) instead |
14:06:29 | Oddmonger | ok i do that |
14:06:33 | Oddmonger | thank you |
14:13:36 | * | tane joined #nim |
14:16:29 | Oddmonger | i have missed something with options : https://play.nim-lang.org/#ix=2RxZ |
14:16:41 | Oddmonger | ah sh*t |
14:16:43 | Oddmonger | found |
14:16:57 | Oddmonger | Option[Foo] as return type |
14:17:48 | Oddmonger | thinking of all the time spent for this little snippet and just found when posted :') |
14:24:48 | * | abm joined #nim |
14:28:11 | * | superbia joined #nim |
14:29:48 | PMunch | Oddmonger, classic rubber ducking |
14:33:37 | * | sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in) |
14:33:54 | * | sacredfrog joined #nim |
14:34:25 | Oddmonger | ah , it's a little penguin plush in my case (i've used IRC because i was sleeping now) |
14:43:59 | m4r35n357 | I think I have misunderstood operator overloading in a major way! I thought that redefining e.g. '+' would only apply if the supplied arguments match my overload, but from the error I see now it looks like it redefines _all_ uses of '+' |
14:44:24 | PMunch | Uhm, I don't think it should |
14:44:31 | m4r35n357 | . . . match the _types_ in my overload, I mean |
14:45:10 | m4r35n357 | PMunch, I am getting an error for multiplying and int64 and a float64, and I haven't overloaded that combination |
14:45:59 | FromDiscord | <Solitude> operator overloading is the same as any procedure overloading |
14:46:12 | m4r35n357 | PMunch, so did my expectation sound correct? |
14:46:14 | narimiran | m4r35n357: show us your code |
14:46:22 | PMunch | You can't do that multiplication by default |
14:46:42 | m4r35n357 | PMunch, it seem to work though, I tested it! |
14:47:06 | FromDiscord | <Solitude> test it again |
14:47:07 | * | beatmox quit (Read error: Connection reset by peer) |
14:47:08 | m4r35n357 | narimiran, stand by . . |
14:47:15 | PMunch | As you can see you're not allowed to do that: https://play.nim-lang.org/#ix=2Ry9 |
14:47:17 | FromDiscord | <Rika> defining mult for int and float will not define it for float and int |
14:47:44 | PMunch | m4r35n357, and yes your expectation sounds correct |
14:48:26 | PMunch | What can happen though is that your error message changes (probably because Nim tries to pick the most likely error, you can see them all by --verbose), but it shouldn't disallow previously allowed things |
14:48:27 | m4r35n357 | https://pastebin.com/4LDt6v33 |
14:48:35 | m4r35n357 | BTW it is my first day ;) |
14:48:49 | m4r35n357 | I have left the tests at the bottom |
14:49:53 | * | beatmox joined #nim |
14:50:38 | FromDiscord | <haxscramper> Is it possible to disable style-insensetivity for an identifier somehow? Stropping does not work - `ec` and `eC` are still the same |
14:51:36 | FromDiscord | <haxscramper> I need to find a way to map C style-sensetive identifiers to nim, and I really don't want to add another layer of bookkeeping for wrapper generator to track all renames |
14:52:16 | FromDiscord | <haxscramper> I'm talking about wrapping things like `enum C { ec, eC };` |
14:52:46 | FromDiscord | <gogolxdong> Is there any way to prevent save as event in Windows application? |
14:54:34 | PMunch | m4r35n357, this works: https://play.nim-lang.org/#ix=2Rye |
14:54:36 | narimiran | m4r35n357: you're multiplying `step`, which is int, and `h`, which is float |
14:54:48 | PMunch | And I cleaned up the code in various ways and made it a bit more royale |
14:55:21 | narimiran | PMunch: and i, for one, thank you for that :) |
14:55:24 | PMunch | @haxscramper, I don't think there is.. |
14:55:34 | PMunch | narimiran, huh? |
14:55:39 | * | Vladar joined #nim |
14:55:47 | narimiran | PMunch: thanks for cleaning it up |
14:55:50 | PMunch | Oh :P |
14:55:57 | FromDiscord | <konsumlamm> who defines an enum with `ec` and `eC` variants lol |
14:56:03 | narimiran | you could have also clean up `h: float64 = 0.01`, but ok :P |
14:56:15 | PMunch | Oh good catch |
14:56:31 | narimiran | and `float64` == `float` |
14:56:35 | m4r35n357 | narimiran, most languages accept multiplying ints and floats ;) I don't think I understand your point |
14:56:44 | narimiran | m4r35n357: nim doesn't |
14:56:49 | m4r35n357 | wow |
14:56:55 | PMunch | There: https://play.nim-lang.org/#ix=2Ryg |
14:57:02 | m4r35n357 | didn't see that coming! |
14:57:05 | FromDiscord | <haxscramper> In reply to @konsumlamm "who defines an enum": Actual one was `ROFF_bp` and `ROFF_BP`, so it does make sense |
14:57:15 | PMunch | m4r35n357, Nim, unlike most other languages, is actually type-safe |
14:57:21 | PMunch | Who'da thunk! |
14:57:26 | m4r35n357 | PM so I need to do some "casting" |
14:57:34 | FromDiscord | <Solitude> converting |
14:57:39 | FromDiscord | <konsumlamm> there is `lenientops` if you really want that |
14:57:48 | narimiran | yep, converting would be more precise |
14:57:50 | FromDiscord | <konsumlamm> https://nim-lang.github.io/Nim/lenientops.html it also explains why it's often a bad idea |
14:58:19 | FromDiscord | <konsumlamm> does Nim have any formal type system specification? |
14:59:13 | m4r35n357 | PMunch, narimiran OK thanks I need to absorb all this! |
14:59:18 | narimiran | m4r35n357, PMunch: why is `cos` defined as ```func `cos` ```? |
14:59:47 | PMunch | I replaced `proc {.noSideEffects.}` with `func` which is cleaner |
15:00:04 | narimiran | i meant backticks around 'cos' (stropping) |
15:00:05 | m4r35n357 | PMunch, in what way is func cleaner? |
15:00:08 | PMunch | The `sin` and `cos` instead of sin and cos where yours :P |
15:00:23 | PMunch | Because they are functions and not procedures |
15:00:34 | m4r35n357 | narimiran, I am redefining sin and cos for dual numbers |
15:00:34 | PMunch | And you don't have to type {.noSideEffects.} everywhere.. |
15:00:51 | m4r35n357 | PMunch, I am only copying bits from the docs ;) |
15:01:03 | narimiran | m4r35n357: but you don't need backticks for them, like you don't need them for: update_q, plot, solve, etc. |
15:01:19 | PMunch | Ah, func is a new-ish addition, so the docs are probably outdated |
15:01:34 | m4r35n357 | ah OK I see they are functons notoperators |
15:01:54 | m4r35n357 | narimiran, the fog of a new language ;) |
15:02:19 | PMunch | `func` is just syntactic sugar for `{.noSideEffects.}` |
15:02:30 | narimiran | m4r35n357: you're doing fine for your first day, don't worry :) |
15:02:30 | m4r35n357 | this stuff has gone from Vala, to Python, to Fortran(!) and is currently in c |
15:02:33 | PMunch | Well they are operators, but not procedures |
15:02:41 | m4r35n357 | PMunch, that is useful to know |
15:03:18 | PMunch | operators are just anything that's a combination of the "operator characters": https://nim-lang.org/docs/manual.html#lexical-analysis-operators |
15:03:22 | m4r35n357 | OK thanks all, I think I can progress further on this now, some interesting gotchas in here ;) |
15:04:12 | PMunch | They can be called like `a + b` instead of `+(a, b)` or `a.+(b)` or `a.+ b` or `+ a b` |
15:04:48 | PMunch | functions are mathematically pure, no side effect functions, similar to what you expect from a function from functional languages |
15:05:16 | FromDiscord | <konsumlamm> ~~no side effects except through their parameters~~ |
15:05:21 | PMunch | procedures are what most imperative languages erroneously calls functions and are things that has side effects |
15:05:40 | FromDiscord | <konsumlamm> or rather can have side effects, they don't have to |
15:05:41 | PMunch | @konsumlamm, I left out that part to simplify :P |
15:05:50 | m4r35n357 | PMunch, yes I get the idea Nim is stricter, and I like that |
15:06:07 | m4r35n357 | too much "pragmatism" in programming these days IMO ;) |
15:06:08 | PMunch | But yes, they can modify stuff that's passed to them through `var`, a pointer, or a reference |
15:06:59 | PMunch | And yes, procedures can not have side effects, but Nim will then automatically realise that it's actually a function. But tagging it with `func` means the compiler will complain if you accidentally add a side-effect. |
15:07:51 | PMunch | The interesting thing with Nim is that it's stricter, but it still manages to feel easy to use compared to many less strict langugaes |
15:08:21 | PMunch | e.g. C/C++ feels a lot more clunky to me, but Nim is stricter in a lot of ways |
15:09:28 | FromDiscord | <konsumlamm> i don't think C/C++ feels clunky to you because of the type system though |
15:10:48 | FromDiscord | <haxscramper> I think C++ would be a fine language if it just dropped legacy parts |
15:11:21 | m4r35n357 | OK cheers all, I need to act on all this before I forget it! |
15:13:21 | FromDiscord | <haxscramper> One the things that is missing from C++ (and basically any other C-derived language, except rust) is `distinct`. It is so useful, and yet for some reason nobody has it |
15:13:41 | FromDiscord | <Firefell> Anybody has tested this library with Nim ? -> https://justine.lol/cosmopolitan/index.html?source=korben.info |
15:18:38 | FromDiscord | <Yardanico> This was brought up some times before - you'd need to adapt parts of Nim stdlib for that since it has a different libc |
15:19:24 | FromDiscord | <Yardanico> Also it uses freestanding mode which means that you won't get access to a lot of APIs easily |
15:20:52 | FromDiscord | <Yardanico> It's a cool PoC but I don't consider it to be useful for actual real programs |
15:20:56 | FromDiscord | <Firefell> In reply to @Yardanico "This was brought up": ok thank you. Made a multiplatform binary is very interested for my project. |
15:21:34 | FromDiscord | <Yardanico> Why not just compile different binaries for different platforms? Then you'll have access to all APIs for each platform |
15:21:49 | * | D_ quit (Remote host closed the connection) |
15:24:36 | FromDiscord | <Yardanico> Even the author says "Please note this is intended for people who don't care about desktop GUIs, and just want stdio and sockets without devops toil." |
15:24:56 | FromDiscord | <Firefell> Because I am a lazy man π It's interested for a tiny command line project. It is a project to be followed |
15:25:33 | FromDiscord | <Yardanico> But as soon as you want anything more complex than simple stdio and some data processing, you'll be limited by it |
15:25:42 | FromDiscord | <Yardanico> E.g. no SSL |
15:26:01 | FromDiscord | <Firefell> I agree with you |
15:26:23 | * | D_ joined #nim |
15:27:05 | FromDiscord | <Yardanico> Some people for some reason think that Cosmopolitan is the silver bullet for cross-conpilation, but it's certainly not |
15:27:43 | FromDiscord | <Yardanico> You should be able to compile Nim with it though, start with --os:any -d:posix -d:useMalloc --gc:arc |
15:27:49 | FromDiscord | <Yardanico> Not sure how much stuff you'll need to patch |
15:28:49 | FromDiscord | <fenrave> unless he has some os specific libraries, it should be cross compatible if its a tiny command line project |
15:31:19 | FromDiscord | <Yardanico> It really depends on what is "tiny" :P |
15:32:07 | FromDiscord | <Firefell> Parse JSON file and extract values for example |
15:42:08 | FromDiscord | <CAA> I'm using the emacs major mode for nim. Should I be concerned about errors like "error in process filter: Wrong type argument: stringp, nil"? Because it still compiles. |
15:43:29 | FromDiscord | <Solitude> In reply to @CAA "I'm using the emacs": thats emacs error, not nim error |
15:45:10 | FromDiscord | <CAA> What does the error even mean? Because nim-mode is part of the official github repo. |
15:53:53 | FromDiscord | <fenrave> its a predication error from what i can tell, i don't use emacs though |
15:54:13 | FromDiscord | <fenrave> it seems to be an issue related to C that carried over to nim, if it compiled and works that is |
15:57:35 | FromDiscord | <CAA> I have reason to believe that "string-match("/bin/[a-z]sh\\'" nil)" is what is causing the problem |
15:58:05 | * | dsrw_ quit (Remote host closed the connection) |
15:58:05 | FromDiscord | <fenrave> the error just seems to be related to the compiler expecting one thing and getting another |
15:58:11 | FromDiscord | <fenrave> or emacs itself |
15:58:34 | FromDiscord | <CAA> Looks like I"ll have to do some debugging. |
15:58:43 | FromDiscord | <fenrave> if its working its probably not an issue |
15:58:48 | * | kenran quit (Ping timeout: 245 seconds) |
16:10:13 | * | rockcavera quit (Ping timeout: 276 seconds) |
16:11:37 | FromDiscord | <CAA> It works perfectly fine If I send a shell command via M (alt key) - ! rather than use the compile command that nim-mode offers. It's just an issue with nim-mode rather than emacs and I can just send a shell command for compilation rather than use nim-mode to compile. |
16:14:10 | * | vicfred joined #nim |
16:17:48 | asdflkj | use `backticks` (below tilda normally) to keep Discord from interpreting special characters as formatting (eg. `*` as *italics*) btw |
16:18:18 | asdflkj | tilde* |
16:19:52 | asdflkj | out of curiousity, how does the Discord bridge handle markdown syntax in IRC messages? |
16:21:07 | FromDiscord | <Yardanico> it passes it as-is and discord converts it into formatting :) |
16:22:02 | asdflkj | good to know |
16:23:40 | FromDiscord | <Yardanico> That said, the bridge tries to translate IRC formatting to markdown too |
16:23:51 | FromDiscord | <Yardanico> But almost no one uses IRC formatting nowadays |
16:24:08 | asdflkj | eg. this is bold? |
16:24:14 | FromDiscord | <Yardanico> Yes |
16:24:45 | asdflkj | I use it from time to time, but many channels have it disable via +c |
16:24:52 | asdflkj | disabled* |
16:25:56 | asdflkj | I assume the formatting includes adding opengraph metadata to links unless IRC users surround them with `<>`? |
16:29:36 | * | sagax joined #nim |
16:30:36 | superbia | how would one reliably get the center of the pupil from already isolated photo of eye https://imgur.com/a/ITJmRxr |
16:32:54 | * | rockcavera joined #nim |
16:36:07 | FromDiscord | <ache of head> π³ |
16:36:10 | FromDiscord | <ache of head> that sounds suspicious |
16:37:53 | FromDiscord | <Yardanico> @asdflkj yes |
16:38:23 | FromDiscord | <Yardanico> Sadly I can't disable those via the bridge, the only way is to <> in the bridge itself |
16:39:11 | * | haxscramper quit (Remote host closed the connection) |
16:39:28 | * | haxscramper joined #nim |
16:39:37 | asdflkj | I don't really see that as a problem |
16:40:04 | asdflkj | (to have the thumbnails and titles) |
16:42:12 | asdflkj | I just have to remember to put `<>` around <https://www.youtube.com/watch?v=dQw4w9WgXcQ> <https://www.youtube.com/watch?v=jzwMjOl8Iyo> and <https://www.youtube.com/watch?v=Uf3ouaeB6UQ> |
16:42:32 | * | haxscramper left #nim (#nim) |
16:49:42 | FromDiscord | <Yardanico> I remember the first URL :) |
16:51:06 | asdflkj | I haven't memorized it yet but IIRC there are browser extensions that recognize it, so that's where the other two and Invidious become handy |
16:51:52 | FromDiscord | <Yardanico> dQw is really unique |
16:52:00 | FromDiscord | <Yardanico> just remember those 3 and you're set |
16:52:06 | asdflkj | thanks |
16:59:59 | ForumUpdaterBot | New post on r/nim by Unaimend: Bioinformatics package for nim, see https://reddit.com/r/nim/comments/lwymab/bioinformatics_package_for_nim/ |
17:01:04 | * | vicfred quit (*.net *.split) |
17:01:05 | * | junland quit (*.net *.split) |
17:01:05 | * | blackpawn quit (*.net *.split) |
17:01:05 | * | tribly quit (*.net *.split) |
17:01:05 | * | Jesin quit (*.net *.split) |
17:01:05 | * | Amun_Ra quit (*.net *.split) |
17:01:05 | * | mwbrown quit (*.net *.split) |
17:01:05 | * | nisstyre quit (*.net *.split) |
17:01:42 | * | superbia quit (Ping timeout: 256 seconds) |
17:02:24 | asdflkj | hopefully now even <https://vid.puffyan.us/watch?v=dQw4w9WgXcQ&autoplay=1&dark_mode=true> shouldn't get me (unfortunately it looks like some extensions would catch that too: <https://github.com/rangermattos/Rickroll-Detector/blob/master/data/detector.js>) |
17:03:31 | * | superbia joined #nim |
17:05:21 | * | vicfred joined #nim |
17:07:04 | * | junland joined #nim |
17:07:04 | * | blackpawn joined #nim |
17:07:04 | * | tribly joined #nim |
17:07:04 | * | Jesin joined #nim |
17:07:04 | * | Amun_Ra joined #nim |
17:07:04 | * | mwbrown joined #nim |
17:07:04 | * | nisstyre joined #nim |
17:20:49 | * | waleee-cl joined #nim |
17:28:54 | ForumUpdaterBot | New Nimble package! onnxruntime - onnxruntime C Api wrapped for nim, see https://github.com/YesDrX/onnxruntime-nim/ |
17:29:08 | FromDiscord | <Yardanico> it works! |
17:29:34 | narimiran | @Yardanico will it work if a new package is somewhere in the middle of the json? |
17:29:43 | FromDiscord | <Yardanico> of course, it's not that stupid :P |
17:29:50 | narimiran | :) |
17:29:51 | FromDiscord | <Yardanico> it'll also work if you merge multiple PRs in under 2 minutes |
17:30:17 | FromDiscord | <Yardanico> on the start of the bot I fetch pkg list and save all package names into a hashset, then on update I fetch it again, and check if there's a package that is not in the hashet |
17:30:25 | FromDiscord | <Yardanico> if it's not in a hashset - it's a new package |
17:30:27 | narimiran | noice |
17:30:33 | FromDiscord | <mratsim> Why not strtab? |
17:30:49 | FromDiscord | <Yardanico> wdym? |
17:30:52 | FromDiscord | <mratsim> ah you don't need the tables |
17:30:57 | FromDiscord | <Yardanico> I just need to remember which packages are already there, yeah |
17:30:59 | FromDiscord | <mratsim> it's optimized for strings |
17:31:08 | FromDiscord | <mratsim> not sure what that means though. |
17:31:13 | FromDiscord | <Yardanico> xd |
17:38:30 | FromDiscord | <Avatarfighter> hello hello everyone nice to see you all π |
17:38:39 | narimiran | you can see us?? |
17:38:50 | FromDiscord | <Avatarfighter> indeed, pull your pants up π |
17:38:55 | narimiran | shit. |
17:38:59 | narimiran | you indeed see me |
17:39:50 | narimiran | better now? |
17:40:06 | FromDiscord | <Avatarfighter> perfect π© |
17:45:52 | FromDiscord | <Yardanico> π₯΄ |
17:50:24 | * | tane quit (Quit: Leaving) |
18:02:01 | FromDiscord | <ache of head> π³ |
18:03:50 | FromDiscord | <Unaimend> In reply to @narimiran "better now?": i liked it better the other way |
18:04:24 | narimiran | me too @Unaimend, me too.... but we have some minors here, so i cannot do it anymore.... :'( |
18:04:40 | FromDiscord | <Unaimend> hmm, too bad |
18:11:19 | FromDiscord | <Yardanico> the chat's getting too hot |
18:11:46 | * | JustASlacker quit (Ping timeout: 276 seconds) |
18:13:46 | * | xet7 quit (Quit: Leaving) |
18:14:52 | * | xet7 joined #nim |
18:16:30 | * | xet7 quit (Remote host closed the connection) |
18:18:10 | * | kenran joined #nim |
18:19:01 | * | wasted_youth2 joined #nim |
18:19:34 | * | rockcavera quit (Ping timeout: 276 seconds) |
18:20:58 | idf | amazing |
18:25:20 | * | xet7 joined #nim |
18:30:37 | * | kenran quit (Ping timeout: 276 seconds) |
18:35:54 | * | rockcavera joined #nim |
18:37:01 | FromDiscord | <Unaimend> In reply to @narimiran "me too <@287576619718279178>, me": π₯ |
18:47:03 | FromDiscord | <Yardanico> ok since so many people want to try cosmopolitan I'll do it for their sake |
18:47:11 | FromDiscord | <Yardanico> i'll try to do nim hello world with cosmopolitan |
19:02:33 | * | gpanders quit (Remote host closed the connection) |
19:02:51 | * | gpanders joined #nim |
19:08:55 | FromDiscord | <Yardanico> well, it works |
19:09:09 | FromDiscord | <Yardanico> although I had to strip all includes from nim-compiled C files (and compile them manually with GCC) |
19:11:18 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816749590660907038/unknown.png |
19:14:29 | FromDiscord | <Yardanico> oh nice, I just made stub headers and made it compile with no modifications to Nim files (and with Nim itself without manually calling GCC) |
19:14:35 | FromDiscord | <Yardanico> time to make a blog post out of this |
19:19:36 | FromDiscord | <Yardanico> i mean on my blog :P |
19:20:35 | FromDiscord | <haxscramper> @Yardanico is it possibly to add custom infix operators to mathexpr? I need to evaluate C++ enums, and they can contain things like `(1 << 7 )` and so on |
19:20:39 | FromDiscord | <haxscramper> (edit) "possibly" => "possible" |
19:21:17 | FromDiscord | <Yardanico> sadly no, you can only define new custom functions. that said, the code is pretty simple so you can extend it to your needs pretty easily |
19:21:35 | FromDiscord | <Yardanico> just add it with needed precedence here https://media.discordapp.net/attachments/371759389889003532/816752178671910952/unknown.png |
19:21:49 | FromDiscord | <Varriount> In reply to @Yardanico "sadly no, you can": Did you test whether it runs on Windows? |
19:22:16 | FromDiscord | <Yardanico> lets see |
19:22:45 | PMunch | What's the best way to wrap stuff like `#define LED_ONβ β (PORTD |= (1<<6))` in Nim? |
19:22:53 | FromDiscord | <Yardanico> do you have windows right now @Varriount ? |
19:23:10 | FromDiscord | <Varriount> Just, it would be a bit embarrassing if a blog post was put up, but the result didn't actually work as a portable executable.β΅And yes, I do. |
19:23:10 | FromDiscord | <Yardanico> wine says that it can't run the thing because dosbox is not installed, but cosmopolitan says that it should generally run fine on Windows |
19:23:21 | FromDiscord | <Yardanico> ok one sec |
19:23:36 | FromDiscord | <haxscramper> In reply to @Yardanico "just add it with": It is easier for me to just eval ast directly from C++, I just wondered if there is a built-in support for custom operators that I missed |
19:23:45 | FromDiscord | <Yardanico> oh okay fine then |
19:23:51 | Prestige | PMunch: do you mean like creating a const? |
19:24:03 | PMunch | Nah, those aren't consts |
19:24:08 | PMunch | It's like a template thing |
19:24:11 | FromDiscord | <Varriount> \waits while Yardanico creates a virus\ |
19:24:22 | FromDiscord | <Yardanico> hehe |
19:24:41 | Prestige | oh, idk. Thought that was a const you could calculate at compile time |
19:25:41 | FromDiscord | <haxscramper> PMunch: create a template then, or just directly `{.emit.}` C code in wrapper proc |
19:25:42 | asdflkj | cosmopolitan seems super useful for malware (which has already been written in Nim) |
19:25:56 | FromDiscord | <Varriount> Also GUI applications |
19:26:04 | PMunch | haxscramper, that's what I'm trying to do.. |
19:26:24 | PMunch | But I'm getting weird errors like this: `@mblinky.nim.c:47:32: error: expected ')' before '=' token` |
19:26:45 | FromDiscord | <Yardanico> @Varriount cosmopolitan for GUI is almost unusable |
19:26:55 | FromDiscord | <Yardanico> you can make a simple win32 gui, yes |
19:27:09 | FromDiscord | <Yardanico> but even the developer said that it's not feasible to try to run wxwidgets/gtk/qt/etc |
19:27:24 | FromDiscord | <Yardanico> since it compiles in its own "environment" and doesn't use any shared libraries |
19:27:30 | FromDiscord | <Yardanico> remember, it can be booted from BIOS |
19:27:50 | FromDiscord | <Yardanico> its mainly for command-line apps |
19:27:53 | FromDiscord | <Varriount> In reply to @asdflkj "cosmopolitan seems super useful": Does it allow loading from DLLs? |
19:28:16 | asdflkj | IDK, but IDK if malware usually needs to |
19:29:19 | FromDiscord | <Yardanico> run at your own discretion (but I compiled and ran it myself, so there shouldn't be any viruses here) :P https://media.discordapp.net/attachments/371759389889003532/816754131443384370/hello.com |
19:29:23 | FromDiscord | <Recruit_main707> it usually does, at least a decent part of it |
19:29:32 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816754179816685618/unknown.png |
19:29:48 | FromDiscord | <Recruit_main707> https://tenor.com/view/doubt-press-x-press-la-noire-gif-18717264 |
19:29:49 | FromDiscord | <Yardanico> it writes to a file called "testing" by the way |
19:29:54 | Prestige | PMunch: Sounds like a bug. On a side note, I'm having a strange issue with event processing with the selector solution you showed me. If you have any time to talk this week/weekend I could use some help |
19:30:12 | Prestige | some events seem to be stuck in the queue, I think. Flushing didn't help |
19:31:42 | PMunch | Hmm, that sounds strange |
19:32:00 | PMunch | I can probably find some time where I'm able to talk |
19:32:15 | Prestige | Yeah, it's weird. Have spent a few days trying to figure out what's happening |
19:32:50 | FromDiscord | <Yardanico> @Varriount are you ok? :D |
19:32:57 | FromDiscord | <Yardanico> what happened, you went silent |
19:34:36 | asdflkj | IIUC almost all malware targets Android and Windowsβ¦ now in theory you can just pass a couple extra compiler flags w/ cosmopolitan and it will at least try to run on most OSs β which would be a no-brainer if there was no disadvantage to it on the main targets, but if it disables all dynamic linking I guess there is |
19:34:52 | PMunch | You're selecting on a web socket and the X11 socket right? |
19:34:52 | ForumUpdaterBot | New thread by Niminem: Full-time Nim developer rates for new software company, see https://forum.nim-lang.org/t/7578 |
19:34:59 | PMunch | Prestige * |
19:35:28 | Prestige | PMunch: yeah |
19:35:42 | Prestige | er, a unix socket |
19:36:03 | Prestige | https://github.com/avahe-kellenberger/nimdow/blob/master/src/nimdow.nim#L74 |
19:37:08 | PMunch | I would move all of this below the IPC bit: https://github.com/avahe-kellenberger/nimdow/blob/master/src/nimdow.nim#L86-L89 |
19:37:13 | FromDiscord | <Yardanico> jesus christ |
19:37:21 | FromDiscord | <Yardanico> even httpclient (non-ssl obviously) works |
19:37:26 | FromDiscord | <Yardanico> had to patch 1 line in nativesockets.nim though |
19:37:27 | PMunch | And make the IPC a `if event.fd == ipcSocketFd` |
19:37:41 | Prestige | I tried that as well but it didn't change the outcome |
19:38:10 | PMunch | That way you're sure no X11 events that are received while handling the unix socket are lost |
19:38:11 | Prestige | adding the XSync after handleCommand seems to have made more of the events get processed, but not all of them (I think) |
19:38:39 | Prestige | oh you mean no elif? |
19:39:10 | Prestige | I'll try that tonight, good idea... |
19:39:35 | FromDiscord | <dom96> In reply to @Yardanico "even httpclient (non-ssl obviously)": is this cosmopolitan? |
19:39:38 | FromDiscord | <Yardanico> ye |
19:39:45 | FromDiscord | <dom96> would be awesome to get it as a NIm target |
19:39:51 | PMunch | Prestige, something like this: https://play.nim-lang.org/#ix=2RzS |
19:39:54 | FromDiscord | <dom96> like `nim c --os:cosmo blah.nim` or something π |
19:39:56 | FromDiscord | <Yardanico> it doesn't need a separate target though :) |
19:40:21 | FromDiscord | <dom96> alternatively a wrapper around `nim` that does all the steps for you |
19:40:41 | Prestige | PMunch: good call, hopefully that works out. I thought the events would just be enqueued though. Would it just not trigger the selector, maybe? |
19:40:45 | FromDiscord | <Yardanico> the only manual step rn is `objcopy` |
19:41:06 | PMunch | Prestige, exactly |
19:41:09 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816757105860149259/unknown.png |
19:41:19 | Prestige | ahh that must be it. Thanks PMunch |
19:41:22 | PMunch | Conversely you might have the same problem with the IPC though I think.. |
19:41:25 | FromDiscord | <Yardanico> `stubs` is just empty include files nim expects from a normal libc |
19:42:22 | Prestige | PMunch: Hm it seems very weird to me that the check on the selector wouldn't be fired if I tried `select` after something was sent to it. But if that's the behavior, I need to restructure things |
19:42:50 | PMunch | I'm not 100% sure |
19:42:56 | PMunch | Might be a red herring.. |
19:43:07 | Prestige | If that's the behavior, I would always miss something (I think) |
19:44:25 | * | natrys joined #nim |
19:48:06 | PMunch | Yeah that would be a pretty silly system.. |
19:48:29 | PMunch | Hmm, anyone knows why Nim adds -ldl to the linker stage and what I need to get it to not do that? |
19:50:39 | FromDiscord | <mratsim> dynamic loading |
19:50:46 | FromDiscord | <mratsim> dynlibOverride |
19:50:52 | FromDiscord | <mratsim> maybe |
19:50:55 | PMunch | Yeah I know what -ldl does.. |
19:51:09 | FromDiscord | <Solitude> os:any/standalone? |
19:51:16 | PMunch | But I'm trying to compile for a Teensy2 chip, so I can't really use it |
19:51:23 | PMunch | I already have os:any |
19:51:29 | PMunch | And I've tried os:standalone as well |
19:56:19 | PMunch | I've used Nim with arduino chips before and this hasn't been an issue.. |
19:57:30 | Prestige | "A file descriptor is considered ready if it is possible to perform a corresponding I/O operation (e.g., read(2), or a sufficiently small write(2)) without blocking." I think this means that if there's something that has been written to the socket, select will still work if it's invoked afterward |
19:58:26 | FromDiscord | <Yardanico> I'm trying to somehow make asynchttpserver work |
20:05:56 | FromDiscord | <Yardanico> I MADE IT WORK AHHAHA |
20:06:04 | FromDiscord | <Yardanico> rip poor nim stdlib |
20:06:11 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816763402990780446/unknown.png |
20:06:27 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816763467713347624/unknown.png |
20:06:42 | FromDiscord | <Yardanico> I had to when false a lot of ipv6 code |
20:07:01 | PMunch | Prestige, hmm, yeah it should work |
20:07:23 | asdflkj | today *BSD, tomorrow the WORLD! and next year Hurd! |
20:07:38 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816763768834752522/hello.com |
20:07:40 | FromDiscord | <Yardanico> if you want to try |
20:07:46 | FromDiscord | <Yardanico> starts a webserver on localhost:8080 |
20:07:52 | FromDiscord | <Yardanico> (default asynchttpserver example) |
20:07:59 | PMunch | Hmm --verbosity:n crashes the compiler.. |
20:08:04 | Prestige | PMunch: makes me want to try xcb or just port this WM to wayland, lol |
20:08:13 | PMunch | Haha :P |
20:08:16 | PMunch | Bit drastic |
20:08:27 | Prestige | Probably |
20:08:38 | Prestige | I've been wanting to do a partial rewrite anyway |
20:09:16 | FromDiscord | <Yardanico> so yeah basically I needed to `when false` a lot of ipv6 related code (Sockaddr_in6, etc) |
20:09:22 | FromDiscord | <Yardanico> make nim use ioselectors_poll |
20:09:28 | FromDiscord | <Yardanico> and also make it think that this is a "BSD" platform |
20:10:23 | asdflkj | oh oops, I already forgot how Discord messes with formatting |
20:10:38 | asdflkj | today \*BSD, tomorrow the WORLD! and next year Hurd! |
20:10:51 | FromDiscord | <Yardanico> wdym? |
20:10:55 | FromDiscord | <Yardanico> I've seen your first message just fine |
20:10:59 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816764612389109770/unknown.png |
20:11:03 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/816764628755152926/unknown.png |
20:11:17 | FromDiscord | <Yardanico> i need windows testers |
20:11:42 | asdflkj | your message was all italicized after the first quote for me |
20:12:08 | FromDiscord | <Yardanico> ah I understand why |
20:12:16 | FromDiscord | <Yardanico> it's a bug, sry :( |
20:12:46 | asdflkj | np, I knew what it meant |
20:13:16 | FromDiscord | <Varriount> @Yardanico Had an appointment. Did you send me something? |
20:13:22 | PMunch | Anyone else watching Starship SN10? |
20:13:23 | FromDiscord | <Yardanico> I managed to run asynchttpserver |
20:13:29 | FromDiscord | <Yardanico> try to run the 228kb bin pls |
20:13:33 | FromDiscord | <Yardanico> In reply to @Yardanico "": ^ |
20:13:39 | FromDiscord | <Yardanico> should start a webserver on localhost:8080 |
20:16:45 | * | kenran joined #nim |
20:17:16 | * | haxscramper joined #nim |
20:17:50 | * | haxscramper quit (Remote host closed the connection) |
20:19:38 | * | natrys quit (Quit: natrys) |
20:25:47 | FromDiscord | <Varriount> Yardanico: Didn't work. |
20:25:49 | FromDiscord | <Varriount> > ResourceUnavailable: Program 'hello.com' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1 |
20:27:13 | FromDiscord | <dom96> @Yardanico how is it just a case of running `objcopy`? Isn't there other setup necessary? |
20:27:32 | FromDiscord | <Yardanico> @Varriount how did you launch it? |
20:27:34 | FromDiscord | <dom96> and where does `objcopy` come from? |
20:27:41 | FromDiscord | <Yardanico> it's a part of binutils |
20:27:58 | FromDiscord | <Yardanico> And other setup is required, yes, check the nim.cfg file I screenshoted before (I'll push all files to a repo now) |
20:28:13 | FromDiscord | <Yardanico> https://github.com/Yardanico/cosmonim |
20:28:34 | FromDiscord | <Varriount> Yardanico: If you've run the executable on Linux already, keep in mind that it re-writes the executable in order to run it on Linux |
20:28:39 | FromDiscord | <Yardanico> ah right |
20:28:47 | FromDiscord | <Yardanico> hm, I need to remove the binary files from git history so the repo is much smaller to clone |
20:28:59 | FromDiscord | <Yardanico> on my first commit I added cosmopolitan files accidentally |
20:29:05 | FromDiscord | <Varriount> It would be nice if there was a workaround for that... |
20:32:51 | FromDiscord | <dom96> In reply to @Yardanico "And other setup is": right, so a `cosmopolitan` target would remove the need for this set up |
20:33:20 | FromDiscord | <Yardanico> It's still a fast-moving target, we should definitely wait a bit before considering adding it as a target :P |
20:35:32 | FromDiscord | <Yardanico> ok removed the binary from the git history |
20:36:43 | FromDiscord | <Yardanico> (Used https://rtyley.github.io/bfg-repo-cleaner/ for that) |
20:37:17 | asdflkj | It would be nice if it could be added in master just as alpha support for a target. it could catch the cosmopolitan wave of hype on HN, which is how where me and IIUC many others learned of Nim |
20:44:13 | federico3 | weird... |
20:50:54 | FromDiscord | <Yardanico> @Varriount try again https://media.discordapp.net/attachments/371759389889003532/816774657188823078/asyncserv.com |
20:51:09 | FromDiscord | <Yardanico> also now I `git reset --hard`'d the nim repo and managed to patch stdlib with less LOC changed |
20:51:18 | FromDiscord | <Yardanico> and only with cosmLibc defines |
20:51:25 | FromDiscord | <Yardanico> although it's still dirty |
20:58:02 | FromDiscord | <Yardanico> Added the diff required to compile asynchttpserver - https://github.com/Yardanico/cosmonim/blob/master/asyncserv.diff |
20:58:25 | FromDiscord | <Yardanico> its really dirty for now, yes |
21:00:44 | * | kenran quit (Quit: leaving) |
21:06:06 | FromDiscord | <Yardanico> ah wait |
21:07:22 | FromDiscord | <Yardanico> nvm it's fine, was an issue on my end |
21:11:21 | * | narimiran quit (Ping timeout: 246 seconds) |
21:11:22 | FromDiscord | <Varriount> @Yardanico Hm, antivirus removed it. |
21:11:30 | FromDiscord | <Yardanico> well, I didn't put any virus inside :P |
21:14:55 | FromDiscord | <dom96> In reply to @Yardanico "It's still a fast-moving": fyi the author of cosmopolitan is considering implementing it as a target for zig |
21:15:03 | FromDiscord | <dom96> so I disagree with you that we should wait π |
21:15:31 | FromDiscord | <Yardanico> zig is a very fast moving target too, they don't have a stable release :) |
21:18:57 | FromDiscord | <dom96> I don't think so |
21:19:38 | * | JustASlacker joined #nim |
21:19:41 | * | JustASlacker quit (Client Quit) |
21:19:47 | * | gangstacat quit (Ping timeout: 272 seconds) |
21:20:32 | * | gangstacat joined #nim |
21:30:45 | FromDiscord | <enthus1ast> T |
21:33:38 | * | blueberrypie quit (*.net *.split) |
21:33:38 | * | ddevault quit (*.net *.split) |
21:33:38 | * | Kaivo quit (*.net *.split) |
21:33:38 | * | dddddd quit (*.net *.split) |
21:33:38 | * | revere quit (*.net *.split) |
21:33:38 | * | kali_ quit (*.net *.split) |
21:33:38 | * | fredsted quit (*.net *.split) |
21:33:38 | * | dgb quit (*.net *.split) |
21:33:39 | * | federico3 quit (*.net *.split) |
21:33:39 | * | shashlick quit (*.net *.split) |
21:34:44 | * | fredsted joined #nim |
21:34:44 | * | blueberrypie joined #nim |
21:34:44 | * | ddevault joined #nim |
21:34:44 | * | Kaivo joined #nim |
21:34:44 | * | dddddd joined #nim |
21:34:44 | * | revere joined #nim |
21:34:44 | * | kali_ joined #nim |
21:34:44 | * | dgb joined #nim |
21:34:44 | * | federico3 joined #nim |
21:34:44 | * | shashlick joined #nim |
21:47:21 | FromDiscord | <treeform> So you are telling me soon I could compile nim to run on every operating system? |
21:47:33 | FromDiscord | <Yardanico> TUI only mostly |
21:47:50 | FromDiscord | <Yardanico> for win32 you can have GUI with cosmopolitan, but generally only TUI |
21:48:17 | FromDiscord | <treeform> even console only could be a big step |
21:48:28 | FromDiscord | <Yardanico> also only x86_64, but yeah, it's nice |
22:01:20 | * | ^Q-Master^ quit (Read error: Connection reset by peer) |
22:01:36 | * | Q-Master joined #nim |
22:21:57 | FromDiscord | <Unaimend> sent a code paste, see https://play.nim-lang.org/#ix=2RAM |
22:23:31 | FromDiscord | <treeform> yes? |
22:24:03 | FromDiscord | <Unaimend> ok, then i must be doing sth. really funny in my code π |
22:24:10 | FromDiscord | <treeform> if code complies and you have not overloaded `and` with some thing else... |
22:26:14 | FromDiscord | <Unaimend> sent a code paste, see https://play.nim-lang.org/#ix=2RAN |
22:26:37 | FromDiscord | <Unaimend> (edit) "https://play.nim-lang.org/#ix=2RAN" => "https://play.nim-lang.org/#ix=2RAO" |
22:27:01 | FromDiscord | <Unaimend> It must be sth. really fcking obvious |
22:27:52 | FromDiscord | <Unaimend> (edit) |
22:28:25 | FromDiscord | <Unaimend> (edit) "https://play.nim-lang.org/#ix=2RAQ" => "https://play.nim-lang.org/#ix=2RAP" |
22:37:49 | FromDiscord | <Unaimend> Omg i think I got it wtf |
22:49:52 | FromDiscord | <tinygiant> sent a long message, see http://ix.io/2RAZ |
22:50:08 | FromDiscord | <tinygiant> (edit) "http://ix.io/2RAZ" => "http://ix.io/2RB0" |
22:50:10 | FromDiscord | <tinygiant> (edit) "http://ix.io/2RB0" => "http://ix.io/2RB1" |
23:07:09 | FromDiscord | <Varriount> In reply to @tinygiant "npeg question for the": Do you have a link to the complete grammer? |
23:07:33 | * | superbia quit (Ping timeout: 246 seconds) |
23:09:56 | FromDiscord | <tinygiant> https://play.nim-lang.org/#ix=2RB9 |
23:17:13 | * | Vladar quit (Quit: Leaving) |
23:31:14 | * | PMunch quit (Quit: leaving) |
23:34:40 | FromDiscord | <Clyybber> In reply to @dom96 "right, so a `cosmopolitan`": no need for a seperate target IMO, config system is flexible enough |
23:35:21 | FromDiscord | <Clyybber> like --os:any and a define to trigger stdlib workarounds should be enough I think |
23:40:52 | * | muffindrake quit (Quit: muffindrake) |
23:42:35 | FromDiscord | <Varriount> @tinygiant `(1 - parR[1]) nl (1 - parR[1])` |
23:42:52 | FromDiscord | <Varriount> (edit) "@tinygiant `(1 - parR[1]) nl ... (1" added "" |
23:43:45 | FromDiscord | <Varriount> I'd also recommend writing for readability, rather than terseness, similar to https://github.com/Varriount/commandant/blob/master/commandant/lexer.nim |
23:44:12 | FromDiscord | <tinygiant> @Varriount Thanks, I'll give it a shot. |
23:44:40 | FromDiscord | <tinygiant> And thanks for the link, I'm trying to build something similar (but simpler) |
23:49:46 | FromDiscord | <Clyybber> @Yardanico wouldn't --os:any be a better fit? |
23:49:53 | FromDiscord | <Yardanico> probably yes |
23:50:10 | FromDiscord | <Yardanico> but cosmopolitan is actually based on assumptions that you're targeting linux in your code |
23:50:16 | FromDiscord | <Clyybber> oh |
23:50:39 | FromDiscord | <Clyybber> like linux specifically or just posix? |
23:51:06 | asdflkj | linux specifically IIUC |
23:51:26 | FromDiscord | <Yardanico> yeah, cosmopolitan has a lot of APIs embedded |
23:51:28 | FromDiscord | <Yardanico> even zlib |
23:53:23 | * | krux02 quit (Remote host closed the connection) |