00:00:02 | * | junland quit (Quit: %ZNC Disconnected%) |
00:01:15 | * | junland joined #nim |
00:08:44 | * | ftsf joined #nim |
00:11:18 | Avatarfighter | Finally fixed my loop the reason why it wasn't working is because I forgot to enable ssl, only sad thing is I had no idea |
00:12:01 | Yardanico | that's why you should check for errors properly |
00:12:06 | Yardanico | and not just try: stuff except: discard :P |
00:12:33 | Avatarfighter | I would've been able to figure out the error if the compiler actually threw one :P |
00:12:41 | Yardanico | well it does throw errors |
00:12:47 | Yardanico | i mean httpclient does |
00:12:51 | Yardanico | if you try to connect to https without ssl support |
00:12:51 | Avatarfighter | the compiled program without -d:ssl didn't throw an ssl error :P |
00:12:58 | Yardanico | well blame your website then |
00:13:01 | Avatarfighter | haha |
00:13:32 | Avatarfighter | I don't blame it because when I awaited my futures manually it yelled at me |
00:13:54 | Yardanico | maybe you just don't try: except the full body |
00:14:02 | Yardanico | so some errors are getting ignored |
00:14:14 | Avatarfighter | Let me send a playground :P |
00:15:19 | Avatarfighter | https://play.nim-lang.org/#ix=2nT9 |
00:15:40 | Yardanico | well yeah you don't catch errors at all |
00:15:43 | Avatarfighter | if you run that without ssl it will just stall the whole program and wont raise an error |
00:16:09 | Avatarfighter | when you run with ssl it wont stall and errors are actually reported |
00:16:25 | Avatarfighter | (I removed all my error handling to show this) |
00:16:34 | Yardanico | Avatarfighter: you should test if a future failed in cb |
00:16:43 | Yardanico | if fut.failed(): echo fut.error.msg else: add stuff |
00:17:13 | Yardanico | something like that |
00:17:13 | Yardanico | https://play.nim-lang.org/#ix=2nTb |
00:17:25 | Yardanico | or you might want to handle it instead of raising it |
00:17:26 | Avatarfighter | Ohhhhhh |
00:17:28 | Yardanico | but never ignore it |
00:17:32 | Yardanico | you just ignored it before that |
00:17:32 | Avatarfighter | oh my gosh |
00:17:38 | Avatarfighter | I didn't even know that was a thing |
00:17:51 | Avatarfighter | I thought that my futures weren't even being registered :L |
00:18:02 | Yardanico | there's no thing as "register a future" |
00:18:32 | Avatarfighter | How does the polling find the futures ? |
00:18:49 | Avatarfighter | Does a future not have to create an event for it to be processed? |
00:19:13 | disruptek | see asyncdispatch |
00:19:19 | Avatarfighter | Yeah I'm looking at it right now :( |
00:19:21 | disruptek | Yardanico: wanna track down another arc bug? |
00:19:29 | Yardanico | disruptek: if it's small enough :P |
00:19:35 | Yardanico | i planned on going to bed a bit later |
00:19:54 | disruptek | don't sweat it, then. |
00:20:00 | Yardanico | well you can still share it |
00:20:03 | Avatarfighter | I thought when you create a future it creates an event for the dispatcher is that not how it works? |
00:20:03 | disruptek | it's small but it's also w/e. |
00:20:12 | Yardanico | Avatarfighter: events are a separate thing |
00:20:51 | disruptek | Yardanico: see swamp.nim in this repo |
00:20:53 | Avatarfighter | That's neat, I'm stuck thinking that Nim async works like JS promises |
00:20:53 | Yardanico | nim async is done with closure iterators |
00:20:54 | disruptek | !repo disruptek/marsh |
00:20:55 | disbot | https://github.com/disruptek/marsh -- 9marsh: 11marshal native Nim objects via streams 15 0⭐ 0🍴 |
00:21:21 | disruptek | nim async is dumb with closure iterators |
00:21:24 | disruptek | ftfy |
00:23:25 | * | zacharycarter joined #nim |
00:23:54 | Avatarfighter | Wow I'm mindblown right now |
00:24:08 | Avatarfighter | Thanks Yardanico and disruptek |
00:24:21 | disruptek | what did i do |
00:24:38 | Avatarfighter | you were hear when I got mindblown |
00:24:40 | Avatarfighter | here* |
00:24:51 | Avatarfighter | haha :) |
00:26:03 | Yardanico | also nim async isn't a language feature as you might've already noticed |
00:26:08 | Yardanico | although async abuses closure iterators a lot :P |
00:27:52 | * | zacharycarter quit (Ping timeout: 258 seconds) |
00:34:19 | disruptek | Yardanico: i guess it's a destroy of a loopvar. |
00:35:50 | Yardanico | good night :P ill look into it later today |
00:35:59 | disruptek | peace |
00:46:13 | * | lritter quit (Ping timeout: 246 seconds) |
00:47:09 | * | lritter joined #nim |
01:13:32 | * | chemist69_ joined #nim |
01:13:39 | * | bjornroberg quit (Quit: leaving) |
01:16:42 | * | chemist69 quit (Ping timeout: 272 seconds) |
01:24:26 | * | Jesin quit (Quit: Leaving) |
01:27:39 | * | Jesin joined #nim |
01:49:54 | FromDiscord | <dayl1ght> On 64-bit systems, isn't `int` an alias to `int64` ? |
01:50:14 | disruptek | it's 64-bit but it's not an alias. |
01:50:41 | FromDiscord | <dayl1ght> I'm trying to divide two `int64`s but getting an error |
01:50:52 | disruptek | what's the error? |
01:51:35 | FromDiscord | <dayl1ght> it doesn't find any matching overloads for `/`, even though `/` is defined for int |
01:52:24 | FromDiscord | <dayl1ght> https://ghostbin.co/paste/59pgt |
01:53:09 | disruptek | try div |
01:55:09 | disruptek | i seem to have a bug with intset that i cannot reproduce. i know, it's ridiculous. |
01:55:20 | disruptek | i mean, i cannot reduce it. |
02:04:58 | Avatarfighter | wow what Yardanico said about the async system caused me to understand how to correctly use it |
02:05:08 | Avatarfighter | its sooo cool |
02:05:30 | Avatarfighter | Speaking of cool, is anyone else working on a cool project atm? |
02:06:13 | Prestige | A tiling window manager.. just finishing up support for floating windows atm. What are you working on Avatarfighter ? |
02:06:37 | FromDiscord | <Generic> disruptek: looks like I have a two minute macro 🙂 |
02:06:44 | Avatarfighter | Prestige: that sounds awesome, what OS are you targeting? |
02:06:56 | Avatarfighter | Prestige: I'm working on a helper library for people writing webscrapers |
02:06:58 | Prestige | Just Linux (and x11 only) |
02:07:15 | Prestige | Nice, that sounds useful |
02:07:24 | disruptek | generic: eh get in line. |
02:07:50 | Avatarfighter | disruptek are you working on anything cool atm? |
02:07:59 | disruptek | never. |
02:08:05 | Avatarfighter | ah |
02:08:12 | Avatarfighter | so what super uncool stuff are you working on :P |
02:08:36 | disruptek | !repo marsh |
02:08:37 | disbot | https://github.com/disruptek/marsh -- 9marsh: 11marshal native Nim objects via streams 15 0⭐ 0🍴 |
02:08:40 | disruptek | !repo lunacy |
02:08:41 | disbot | https://github.com/disruptek/lunacy -- 9lunacy: 11 15 6⭐ 0🍴 |
02:08:44 | disruptek | !repo disruptek/gram |
02:08:46 | disbot | https://github.com/disruptek/gram -- 9gram: 11Generic graphs in Nim 15 2⭐ 0🍴 |
02:08:49 | disruptek | !repo disruptek/poison |
02:08:51 | disbot | no results 😢 |
02:09:27 | Avatarfighter | marsh seems like a fun one |
02:09:38 | disruptek | you'd be surprised. |
02:10:38 | Avatarfighter | What is lunacy? |
02:11:07 | FromDiscord | <Generic> I measured this time |
02:11:12 | disruptek | the kind of insanity that is broken by intervals of reason. |
02:11:23 | FromDiscord | <Generic> to be exact it's a 3:27m macro |
02:11:43 | disruptek | you don't get extra points for writing slow code. |
02:11:49 | Avatarfighter | disruptek: are you writing a lua vm? |
02:12:03 | disruptek | i hadn't planned on it. |
02:12:14 | * | Guest40129 quit (Ping timeout: 240 seconds) |
02:12:20 | FromDiscord | <Generic> my code isn't slow, it just does a lot of things |
02:12:42 | disruptek | show me. |
02:12:54 | FromDiscord | <Generic> very well, wait a moment |
02:14:14 | disruptek | !repo lunacy |
02:14:15 | disbot | https://github.com/disruptek/lunacy -- 9lunacy: 11a hack to let me work with some lua data more naturally 15 6⭐ 0🍴 |
02:14:17 | disruptek | ftfy |
02:14:33 | Prestige | I should add eye-tracking software to my wm to automatically select which window you are looking at... hmm |
02:14:36 | disruptek | also, it does implement the "goal", but to what end? |
02:17:02 | * | NimBot joined #nim |
02:19:25 | Avatarfighter | welp I think I managed to max out my IO on my chromebook with my program :L |
02:19:41 | Avatarfighter | all this IO are *very* slow |
02:19:45 | Avatarfighter | things* |
02:23:43 | * | zacharycarter joined #nim |
02:26:01 | * | muffindrake quit (Ping timeout: 272 seconds) |
02:28:01 | * | muffindrake joined #nim |
02:28:04 | * | zacharycarter quit (Ping timeout: 246 seconds) |
02:33:59 | FromDiscord | <Zed> how are you programming on a chrome book? |
02:37:39 | FromDiscord | <Zed> Yardinco: is there a way to install a private library onto your system without uploading to nimble? |
02:37:58 | disruptek | specify the url. |
02:38:36 | FromDiscord | <Zed> like: nimble install <url>? |
02:38:43 | disruptek | sure. |
02:39:11 | disruptek | or just clone it into a directory and import it. |
02:39:18 | disruptek | !repo nimph |
02:39:19 | disbot | https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 64⭐ 4🍴 7& 1 more... |
02:40:55 | FromDiscord | <Zed> That looks pretty interesting, i may use that |
02:42:41 | disruptek | i should warn you that working software is addictive. |
02:43:26 | FromDiscord | <Zed> lmao |
02:45:52 | * | mono joined #nim |
02:46:43 | * | xet7 joined #nim |
02:48:17 | * | monok quit (Ping timeout: 256 seconds) |
02:57:47 | * | def- quit (Quit: -) |
02:58:02 | * | def- joined #nim |
02:58:03 | * | opal quit (Ping timeout: 240 seconds) |
02:58:15 | * | kitech1 quit (Quit: ZNC 1.7.5 - https://znc.in) |
02:58:33 | * | kitech1 joined #nim |
02:59:22 | * | Jesin quit (Ping timeout: 260 seconds) |
03:00:46 | * | wgetch quit (Ping timeout: 260 seconds) |
03:01:25 | FromDiscord | <SeanOMik> What is the difference between a `proc` and `method` |
03:01:29 | FromDiscord | <SeanOMik> (edit) '`method`' => '`method`?' |
03:01:55 | FromDiscord | <SeanOMik> Oh and `func` |
03:02:03 | * | opal joined #nim |
03:03:16 | leorize | `func` is `proc {.noSideEffects.}` |
03:03:32 | leorize | `method` is `proc` but uses dynamic dispatching |
03:03:42 | leorize | meaning that it's bound at runtime and not compile time |
03:03:48 | leorize | also means that it's slower in general |
03:03:58 | disruptek | don't be rude. |
03:04:41 | FromDiscord | <SeanOMik> Okay, I'm new to nim |
03:04:47 | FromDiscord | <SeanOMik> So I'm not sure what `dynamic dispatching` is |
03:04:55 | FromDiscord | <SeanOMik> And the `noSideEffects` pragma |
03:05:03 | FromDiscord | <SeanOMik> Could you explain please? |
03:05:04 | disruptek | it means function dispatch performed dynamically at runtime. |
03:05:15 | disruptek | as opposed to happening "for free". |
03:05:48 | disruptek | noSideEffects lets the compiler optimize the call with the presumption that side effects do not occur. |
03:06:04 | FromDiscord | <SeanOMik> What side effects could occur? |
03:06:09 | disruptek | this is mostly relevant to functional programming paradigms of immutability. |
03:06:22 | disruptek | think memory alloc. |
03:06:48 | leorize | side effects in Nim speak is "changing anything that's not reachable by input" |
03:06:53 | disruptek | also, there's a coven near me where they do something with funcs and sheeps blood. |
03:07:10 | disruptek | i really don't want to get into the details. |
03:07:48 | FromDiscord | <SeanOMik> Okay, so its probably better to use `func` in general then? |
03:08:01 | disruptek | it'll just piss you off. |
03:08:06 | disruptek | use proc and don't worry about it. |
03:08:22 | FromDiscord | <SeanOMik> Okay |
03:08:24 | leorize | I do try to use func, but swapping between func and proc takes time :P |
03:08:25 | disruptek | it's basically a concession to neckbeards. |
03:08:59 | disruptek | i'm a grumpy old man for other reasons. |
03:09:09 | FromDiscord | <SeanOMik> Well I'm new to nim so I haven't really gotten used to writing `proc` yet |
03:09:17 | FromDiscord | <SeanOMik> Anyway |
03:09:22 | FromDiscord | <SeanOMik> Thanks for answering all my questions! |
03:27:30 | * | wgetch joined #nim |
03:53:52 | * | dddddd quit (Ping timeout: 256 seconds) |
03:57:24 | FromDiscord | <SeanOMik> Is there a way I could parse a int64 from a string? |
03:57:49 | disruptek | parseInt has always worked well for me. |
03:58:38 | leorize | parseBiggestInt |
03:59:01 | disruptek | gtfo |
04:05:29 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:38 | * | supakeen joined #nim |
04:23:52 | * | zacharycarter joined #nim |
04:27:54 | * | zacharycarter quit (Ping timeout: 240 seconds) |
04:28:21 | disruptek | how come whenever my family goes looting, they never bring me back something nice? |
04:32:44 | Avatarfighter | They're looting the wrong places duhhh |
04:33:43 | FromDiscord | <j-james> quick question↵is it possible to check if a directory's empty via getting a filelist or similar↵right now i'm iterating with walkDir and running quit() but that feels like a ridiculous hack |
04:34:15 | disruptek | your hack sounds like the best method to me. |
04:35:44 | FromDiscord | <j-james> alright if it works it works |
04:35:45 | FromDiscord | <j-james> thanks |
04:36:15 | leorize | the only way to get a file list is to walkDir :p |
04:40:23 | * | opal quit (Ping timeout: 240 seconds) |
04:54:37 | * | opal joined #nim |
04:57:24 | * | Jesin joined #nim |
04:59:17 | * | kungtotte quit (Read error: Connection reset by peer) |
05:00:25 | * | kungtotte joined #nim |
05:01:42 | * | hyuke joined #nim |
05:06:39 | FromDiscord | <SeanOMik> I'm getting a weird error when trying to use JsonNode anywhere: ```↵ambiguous identifier: 'JsonNode' -- use one of the following:↵json.JsonNode: JsonNode↵utils.JsonNode: JsonNode``` |
05:06:46 | FromDiscord | <SeanOMik> (edit) 'anywhere:' => 'in a certain num file:' |
05:07:35 | * | solitudesf joined #nim |
05:12:34 | leorize | does your code define a JsonNode type? |
05:16:34 | FromDiscord | <SeanOMik> No |
05:16:41 | FromDiscord | <SeanOMik> I have it `included` |
05:16:49 | FromDiscord | <SeanOMik> `include json` |
05:18:17 | bung | why not using import |
05:23:17 | FromDiscord | <SeanOMik> Oh |
05:23:23 | FromDiscord | <SeanOMik> Thats probably my issue |
05:23:41 | FromDiscord | <SeanOMik> Coming from C++ and it uses `include` |
05:25:13 | leorize | c++ will finally catching up with the world with c++20 modules |
05:25:23 | leorize | catches* |
05:25:29 | leorize | catch* |
05:25:30 | leorize | :P |
05:25:34 | FromDiscord | <SeanOMik> lol |
05:25:35 | FromDiscord | <SeanOMik> Yeah |
05:25:38 | FromDiscord | <SeanOMik> Modules are cool |
05:25:46 | FromDiscord | <SeanOMik> Haven't messed with them though |
05:26:15 | leorize | use nim and you will hate c++ include :P |
05:26:23 | FromDiscord | <SeanOMik> I do |
05:26:27 | FromDiscord | <SeanOMik> No more linker errors |
05:26:32 | FromDiscord | <SeanOMik> Or cyclic includes |
05:26:49 | FromDiscord | <SeanOMik> So also no more having to use pointers just because you have to avoid cyclic includes in headers |
05:30:08 | FromDiscord | <dayl1ght> I'm trying to use `execProcess` from `osproc` to get the `stdout` from a command, but it also mixes in `stderr` in the output string |
05:30:14 | FromDiscord | <dayl1ght> Is there a way to only get the stdout? |
05:31:13 | Prestige | I think with the options u can |
05:31:30 | FromDiscord | <dayl1ght> oh, I didn't realize `poStdErrToStdout` was in the default option set |
05:32:25 | * | narimiran joined #nim |
05:33:10 | * | solitudesf quit (Remote host closed the connection) |
05:33:36 | * | solitudesf joined #nim |
05:45:45 | FromDiscord | <SeanOMik> sent a code paste, see https://discordapp.com/channels/371759389889003530/371759389889003532/716527820238618645 |
05:46:16 | FromDiscord | <SeanOMik> (edit) |
05:46:42 | FromDiscord | <SeanOMik> Oops I edited it |
05:46:46 | FromDiscord | <SeanOMik> I'm sorry to the people on IRC |
05:48:27 | * | hyuke quit (Ping timeout: 265 seconds) |
05:52:34 | FromDiscord | <Yardanico> don't name your variable "json" |
06:02:14 | FromDiscord | <Yardanico> The error tells you that you call getElems from the json module on your json variable and then use json["users"] as the second argument to that. Basically compiler sees this code as jsonmodule.getElems(jsonvariable, jsonvariable["users"]) |
06:03:08 | FromDiscord | <Yardanico> the best way is to rename your variable and also maybe take advantage of UFCS |
06:03:52 | FromDiscord | <Yardanico> let users = data["users"].getElems() where data is the parsed json variable |
06:04:32 | FromDiscord | <dayl1ght> if they have a variable named "json", shouldn't they get a redefinition error? |
06:04:41 | FromDiscord | <Yardanico> no, Nim has shadowing |
06:04:50 | FromDiscord | <Yardanico> It's quite useful in some cases |
06:05:27 | FromDiscord | <SeanOMik> Ah okay |
06:05:33 | FromDiscord | <SeanOMik> Thanks |
06:07:03 | FromDiscord | <dayl1ght> I wonder if shadowing could be disabled only for module identifiers |
06:07:08 | FromDiscord | <Yardanico> why though |
06:07:11 | FromDiscord | <dayl1ght> so that confusing errors like htis would be prevented |
06:07:29 | FromDiscord | <Yardanico> well most Nim code doesn't use module identifiers anyway :) |
06:07:51 | FromDiscord | <Yardanico> and also only modules like json might become an issue |
06:08:41 | FromDiscord | <Yardanico> I don't see people naming their variables "strutils" or "strscans" |
06:08:58 | FromDiscord | <Yardanico> And you can always do this |
06:09:07 | FromDiscord | <Yardanico> import json as jsonmodule |
06:09:23 | * | narimiran quit (Ping timeout: 258 seconds) |
06:09:41 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#modules-module-names-in-imports |
06:10:07 | FromDiscord | <dayl1ght> true |
06:11:27 | FromDiscord | <dayl1ght> maybe the compiler could warn when you're shadowing a variable _and_ there's an error related to that variable |
06:11:44 | FromDiscord | <dayl1ght> i.e. include an extra line in the error message "btw, you're shadowing the `json` module" |
06:11:49 | FromDiscord | <Yardanico> Well that might be helpful, yeah |
06:12:26 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/13518 |
06:12:27 | disbot | ➥ Improve error message on name collision ; snippet at 12https://play.nim-lang.org/#ix=2cNL |
06:17:22 | FromDiscord | <dayl1ght> I'm writing an interpreter for a toy language in nim and I'm really enjoying it |
06:17:39 | FromDiscord | <dayl1ght> my biggest issue is that it seems like object variants are not fully type safe |
06:17:51 | FromDiscord | <dayl1ght> and null safety is missing 😦 |
06:17:57 | FromDiscord | <Yardanico> What do you mean exactly about object variants |
06:19:06 | FromDiscord | <dayl1ght> sent a code paste, see http://ix.io/2nTP |
06:19:33 | FromDiscord | <dayl1ght> if I have `x` of type `Value`, and I'm inside an `if x.type == Bool`, I can access `x.intVal` |
06:19:39 | FromDiscord | <dayl1ght> that should be a compile-time error |
06:20:14 | FromDiscord | <Yardanico> well the thing is that a variable of an object variant can be changed at runtime |
06:20:34 | FromDiscord | <Yardanico> so it's all about the compiler complexity :P |
06:21:25 | FromDiscord | <dayl1ght> I don't see how being able to change the type affects type safety of accesses |
06:21:37 | FromDiscord | <dayl1ght> oops, changing the `kind` if that's what you mean |
06:21:44 | bung | Yarnaico does jsObject has dynamic dispatch ? so I can `.anything` ? |
06:22:30 | FromDiscord | <dayl1ght> if I'm inside a `case Bool` or `if <variable of type Value>.type == Bool`, I can be sure that intVal will never be set |
06:22:34 | FromDiscord | <Yardanico> Also there's already an RFC for that https://github.com/nim-lang/RFCs/issues/25 |
06:22:34 | disbot | ➥ RFC: Typesafe object variants |
06:22:51 | FromDiscord | <Yardanico> @dayl1ght well it's about how smart the compiler is |
06:23:17 | FromDiscord | <dayl1ght> I see yeah 😛 you'd need some kind of flow analysis like typescript does |
06:23:35 | FromDiscord | <Yardanico> @bung yeah, I think you can, but then you need to convert it to a native Nim type if your want to use it in Nim |
06:23:59 | FromDiscord | <dayl1ght> but for `case`s it should be easier to implement than for arbitrary `if`s |
06:24:04 | FromDiscord | <Yardanico> @dayl1ght well Nim already has a DFA for destructors as an example |
06:24:10 | * | zacharycarter joined #nim |
06:24:45 | bung | if it is chained like a(b).c(d) and result to nim type it also works? |
06:25:08 | FromDiscord | <Yardanico> maybe,I don't know |
06:25:31 | FromDiscord | <Yardanico> I think JsObject has . and .() defined so it will probably work |
06:25:37 | bung | I wrote something wraped like that compiled pass , but not sure it will work |
06:25:47 | FromDiscord | <Yardanico> @dayl1ght of course it's for a different thing, but https://github.com/nim-lang/Nim/blob/devel/compiler/dfa.nim |
06:25:54 | FromDiscord | <dayl1ght> it does look like you can get type safety from libraries using macros though, so that's nice |
06:26:11 | FromDiscord | <dayl1ght> ah interesting |
06:26:27 | FromDiscord | <Yardanico> But yeah, the idea about doing that analysis at least in case objects is nice |
06:26:28 | bung | oh thanks , that would be easy wrap js lib |
06:26:30 | FromDiscord | <dayl1ght> it'd be really nice to have that + null safety |
06:26:40 | FromDiscord | <Yardanico> Well null safety was attempted |
06:26:41 | FromDiscord | <dayl1ght> e.g. in typescript you can have a type like `type X = string | null` |
06:27:01 | FromDiscord | <Yardanico> There's "not nil" in Nim but it's mostly abandoned now |
06:27:05 | FromDiscord | <dayl1ght> and then the compiler forces you to check `if x != null` before calling any string methods in x |
06:27:24 | FromDiscord | <dayl1ght> (it narrows the type of x to `string` inside an `if x != null`) |
06:27:24 | bung | string nil is abandoned |
06:27:49 | FromDiscord | <dayl1ght> which I'd argue is bad :p |
06:27:56 | FromDiscord | <Yardanico> why though? |
06:28:04 | FromDiscord | <dayl1ght> an empty string is not the same as nil |
06:28:10 | FromDiscord | <Yardanico> you can have use options module then |
06:28:34 | * | zacharycarter quit (Ping timeout: 265 seconds) |
06:28:37 | FromDiscord | <Yardanico> to distinguish between none, an empty string and a non empty string |
06:28:56 | FromDiscord | <dayl1ght> and default values + automatic result variable in procs can lead to bugs easily |
06:29:00 | FromDiscord | <Yardanico> But in most cases checking for nil means the same as checking for the empty string, at least that's how it is in Nim |
06:29:03 | FromDiscord | <dayl1ght> ``` ↵proc aaa(x: string): string =↵ echo "1"↵``` |
06:29:31 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/6379 |
06:29:39 | FromDiscord | <dayl1ght> right, you can use Option[T] |
06:29:53 | FromDiscord | <dayl1ght> but that's opt-in |
06:30:16 | FromDiscord | <dayl1ght> ``` ↵I completely agree with this proposal. It's time to make implicit result values a warning. The extra line result = 0 or similar in the beginning of a proc won't kill us.↵``` |
06:30:17 | FromDiscord | <dayl1ght> nice |
06:30:49 | leorize | currently we also have `{.requiresInit.}`, which helps prevent a fair share of use-before-init bugs |
06:30:49 | FromDiscord | <Yardanico> but still, nil strings can lead to more issues since there's no full null safety in nim |
06:31:02 | leorize | nil strings are terrible |
06:31:08 | FromDiscord | <dayl1ght> right, it'd be useful if you had them with null safety |
06:31:13 | leorize | strings are value type, nil should have never been an option |
06:31:20 | FromDiscord | <Yardanico> seqs and strings were nil in nim before |
06:31:25 | FromDiscord | <Yardanico> That was charged |
06:31:31 | FromDiscord | <dayl1ght> a value type doesn't mean non-nil? |
06:31:32 | FromDiscord | <Yardanico> (edit) 'charged' => 'changed' |
06:32:19 | FromDiscord | <Yardanico> Nim in nil is related to a null pointer |
06:32:24 | leorize | the only thing nice about nil strings was that you have `nil` as `none(string)` |
06:32:38 | FromDiscord | <Yardanico> nil in Nim* |
06:32:52 | leorize | other than that it's pretty useless imo |
06:33:22 | FromDiscord | <Yardanico> And the change from nil seqs/strings was made because a lot of people wanted that :) |
06:33:24 | * | disruptek quit (Ping timeout: 265 seconds) |
06:33:25 | * | disbot quit (Ping timeout: 246 seconds) |
06:33:53 | FromDiscord | <dayl1ght> well, nim doesn't have null safety |
06:33:58 | FromDiscord | <Yardanico> It was changed in 0.19.0 https://nim-lang.org/blog/2018/09/26/version-0190-released.html |
06:34:03 | FromDiscord | <dayl1ght> so it makes sense that they would want it |
06:34:31 | leorize | well nil safety is staged for 2020, but it's kinda low prio compared to other stuff atm |
06:34:42 | FromDiscord | <dayl1ght> having null safety implies that you could have a nil string |
06:35:16 | FromDiscord | <Yardanico> well that won't be changed any time soon |
06:35:33 | * | disruptek joined #nim |
06:35:37 | FromDiscord | <Yardanico> right now the hot thing is arc/orc :) |
06:35:47 | FromDiscord | <dayl1ght> maybe we're talking past each other, I'm thinking of the "typescript way" of implementing null safety where you can have the type `string | null` |
06:35:55 | FromDiscord | <dayl1ght> but you could also do it like rust of course, using option and forbidding nil |
06:35:56 | leorize | !rfc nil |
06:36:03 | * | disbot joined #nim |
06:36:05 | leorize | oh wait disbot died earlier |
06:36:08 | leorize | !rfc nil |
06:36:19 | FromDiscord | <Yardanico> Is there an RFC about it? |
06:36:32 | leorize | https://github.com/nim-lang/RFCs/pull/169 |
06:36:33 | disbot | ➥ Nilable and non-nilable types |
06:36:36 | leorize | yes, staged for 2020 |
06:37:17 | leorize | ofc, this is currently low priority :P |
06:38:07 | FromDiscord | <dayl1ght> looks like it's only for `ref` s |
06:38:11 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/5734 for arcs |
06:38:14 | FromDiscord | <Yardanico> arc |
06:38:27 | Prestige | oh time to read that rfc. Sounds interesting |
06:38:28 | leorize | well ref is the only thing in the language with nil atm |
06:38:29 | FromDiscord | <Yardanico> @dayl1ght because only ref and ptr may be nil |
06:38:42 | FromDiscord | <Yardanico> and ptr is kinda unsafe anyway |
06:39:11 | FromDiscord | <dayl1ght> are strings and seqs refs? |
06:39:16 | leorize | nope |
06:39:30 | leorize | they are opaque objects |
06:39:42 | leorize | the fact that they could be nil was an implementation leak |
06:45:22 | FromDiscord | <dayl1ght> these RFCs look nice |
06:45:40 | FromDiscord | <dayl1ght> on the topic of object variant type safety, another issue for me is with default values |
06:45:51 | FromDiscord | <dayl1ght> sent a code paste, see http://ix.io/2nTV |
06:45:57 | FromDiscord | <dayl1ght> you can create `X(kind: A)` |
06:46:05 | FromDiscord | <dayl1ght> and that's probably a bug imo |
06:46:15 | Yardanico | why? |
06:46:22 | FromDiscord | <dayl1ght> I don't want a to be 0 |
06:46:27 | leorize | tag the type with {.requiresInit.} |
06:46:34 | FromDiscord | <dayl1ght> ah nice |
06:46:52 | leorize | once the tag is there, you will have to initialize "everything" |
06:47:13 | FromDiscord | <dayl1ght> so `type X {.requiresInit.} = ...`? |
06:47:17 | leorize | yea |
06:47:29 | FromDiscord | <dayl1ght> hmm I'm not getting any warnings after doing that |
06:48:23 | leorize | https://play.nim-lang.org/#ix=2nTW |
06:48:26 | leorize | what version are you on? |
06:48:43 | leorize | the latest (1.2) will scream at you :P |
06:48:45 | FromDiscord | <dayl1ght> 1.0.6 |
06:48:55 | FromDiscord | <dayl1ght> oh that's probably it |
06:48:55 | leorize | yea update to 1.2, lots of goodies |
06:48:56 | FromDiscord | <dayl1ght> thanks! |
06:50:02 | FromDiscord | <dayl1ght> there a lot of things that put me off of nim at first |
06:50:08 | FromDiscord | <dayl1ght> like the case insensitivty |
06:50:14 | FromDiscord | <dayl1ght> I still dislike it, but turns out it doesn't matter much in real code |
06:50:21 | FromDiscord | <dayl1ght> and the language is super nice so it makes up for that :p |
06:50:27 | * | brainbomb joined #nim |
06:50:30 | leorize | people like to shit on that feature :P |
06:50:52 | leorize | also --styleCheck:error |
06:51:21 | FromDiscord | <dayl1ght> awesome! |
06:51:45 | Yardanico | leorize: gonna go fix stdlib :P |
06:51:47 | FromDiscord | <dayl1ght> oh `nimpretty` too |
06:51:50 | FromDiscord | <dayl1ght> I really need to update |
06:51:51 | Yardanico | found out ssl_certs.nim has snake_Case |
06:51:56 | Yardanico | snake_case * variable |
06:51:58 | leorize | lol |
06:52:03 | Yardanico | line 23 |
06:52:30 | Yardanico | asyncmacro too lol |
06:52:37 | Yardanico | guess I'll make a PR with some of these |
06:52:54 | leorize | people always act like style insensitivity is the end of the world lol |
06:52:59 | Yardanico | "/home/dian/.nimble/pkgs/cligen-0.9.47/cligen/humanUt.nim(35, 7) Error: 'K' should be: 'k'" :P |
06:53:06 | FromDiscord | <dayl1ght> right, it's not |
06:53:07 | Yardanico | well this I wouldn't fix |
06:53:18 | Yardanico | or maybe I should |
06:53:22 | FromDiscord | <dayl1ght> the problem is if people end up not trying the language because of it 😐 |
06:55:09 | leorize | well people start talking less about it now :P |
06:55:32 | Yardanico | leorize: also about style check - seems like whole threadpool uses "compilerProc" instead of "compilerproc" which fails the style check :P |
06:55:54 | leorize | we should mark the stdlib as styleCheck-incompatible :P |
06:56:06 | Yardanico | or maybe fix it instead :D |
06:56:07 | leorize | iirc styleCheck only check your project, right? |
06:56:09 | Yardanico | no |
06:56:16 | Yardanico | it checks all the code |
06:56:19 | leorize | well maybe we should fix that then :P |
06:56:34 | Yardanico | styleCheck is enforced for compiler code too btw |
06:56:38 | Yardanico | at least as far as I know |
06:57:14 | Yardanico | we also have nimfix |
06:57:32 | leorize | that one has not been updated for several years I guess |
06:57:43 | Yardanico | yep |
06:58:00 | leorize | I think we should make styleCheck only applies to the main project |
06:58:09 | bung | requiresInit pragma is same as -d:nimOldCaseObjects |
06:58:12 | bung | ? |
06:58:14 | Yardanico | https://github.com/nim-lang/Nim/issues/10201 |
06:58:17 | Yardanico | bung: no |
06:58:19 | disbot | ➥ [styleCheck] --styleCheck:error inconsistent with --styleCheck:hint : doesn't respect package boundaries ; snippet at 12https://play.nim-lang.org/#ix=2nTX |
06:58:19 | Yardanico | they're much different |
06:58:26 | leorize | bung: that pragma extends to everything |
06:59:35 | bung | hmm how does it work, code same as nimOldCaseObjects |
06:59:43 | leorize | Yardanico: well that bug should be fixed or else using mratsim's library will be a pain :P |
06:59:48 | Yardanico | haha |
06:59:57 | leorize | he write everything in snake_case the last time I checked :P |
07:00:16 | Yardanico | leorize: styleCheck:hint doesn't mention the stdlib or other modules as the issue says |
07:00:18 | leorize | bung: requiresInit enforce initialization for all custom types, not just case objects |
07:01:14 | Yardanico | leorize: btw, do you know if it's safe to have "used" on templates? |
07:01:20 | leorize | Yardanico: maybe we can just hook styleCheck:error to --styleCheck:hint --hintAsError[Name]:on |
07:01:29 | leorize | Yardanico: yes |
07:01:32 | Yardanico | I want to make a small pr to not have all these annoying warnings about unused await |
07:01:44 | Yardanico | in big async projects you can get more than 30 of these warnings |
07:01:52 | leorize | sure, PR that one in |
07:02:04 | leorize | {.used.} is literally designed for this :P |
07:02:35 | FromDiscord | <dayl1ght> can I have requiresInit on my whole project by default? |
07:02:49 | leorize | {.push requiresInit.} |
07:02:50 | FromDiscord | <dayl1ght> or in a whole file |
07:03:06 | leorize | `{.push requiresInit.}` |
07:03:11 | leorize | added formatting for discord :P |
07:03:14 | FromDiscord | <dayl1ght> thanks! time to update all my files :p |
07:03:30 | leorize | I wouldn't recommend spamming that all over the place |
07:03:50 | * | kradnoel joined #nim |
07:03:55 | Yardanico | leorize: https://github.com/nim-lang/Nim/pull/14517 |
07:03:56 | disbot | ➥ Disable unused warnings for await in async macro |
07:04:08 | Yardanico | ah maybe I didn't have to do it for the first template |
07:04:18 | Yardanico | coz it's a template to catch errors |
07:04:44 | FromDiscord | <dayl1ght> leorize: why not? |
07:05:00 | bung | still cant get the point, A() also init its all fields doesnt it ? |
07:05:27 | leorize | @dayl1ght the empty state is an useful default state to have |
07:05:38 | leorize | usually I design my structures so that the default state have meanings |
07:05:39 | FromDiscord | <dayl1ght> right |
07:05:47 | leorize | unless that's just wrong |
07:05:55 | FromDiscord | <dayl1ght> I guess for object variants it makes more sense to use requireInit |
07:06:02 | Yardanico | bung: it's about explicit initialization |
07:06:13 | Yardanico | so you'll _have to_ explicitly initialize all fields |
07:06:15 | Yardanico | yourself |
07:07:21 | FromDiscord | <dayl1ght> yeah I prefer that too. if you use empty states a lot you can have a proc that returns that. but I see your point |
07:07:23 | Yardanico | wait |
07:07:31 | bung | oh , got that, so that will not initialize with default value |
07:07:36 | Yardanico | leorize: I think I can't do that for templates lol |
07:07:42 | Yardanico | ah nvm I just used the wrong pragma |
07:07:54 | Yardanico | guess I should not stay awake for a long time |
07:08:07 | leorize | I'm pretty sure you can, since I added a bunch to make `norm` stop printing a bunch of hint |
07:08:25 | Yardanico | I for some reason typed "{.pure.}" without looking at what I'm typing :P |
07:10:07 | leorize | @dayl1ght I'd recommend that you write Nim without trying to imitate the flow from other languages |
07:10:28 | FromDiscord | <dayl1ght> I just found out that |
07:10:31 | FromDiscord | <dayl1ght> ``` ↵{.experimental: "codeReordering".}↵{.push requiresInit.}↵``` |
07:10:32 | FromDiscord | <dayl1ght> is broken |
07:10:41 | FromDiscord | <dayl1ght> .push needs to be before the expeirmental line |
07:10:56 | leorize | there's a reason why experimental is experimental :P |
07:12:31 | leorize | iirc we have an issue open for that |
07:12:42 | leorize | !issues codeReordering |
07:12:43 | disbot | https://github.com/nim-lang/Nim/issues/14308 -- 3Experimental code reordering does not work on macro generated content |
07:12:43 | disbot | https://github.com/nim-lang/Nim/issues/14290 -- 3Experimental code reordering has issues with pragma |
07:12:43 | disbot | https://github.com/nim-lang/Nim/issues/10867 -- 3code reordering edge case 7& 2 more... |
07:13:28 | FromDiscord | <dayl1ght> leorize: I just think that not using requiresInit opens you up to bugs that are easily avoidable |
07:13:38 | FromDiscord | <dayl1ght> the X() case makes sense, but what about objects with many fields? |
07:13:44 | FromDiscord | <dayl1ght> you might forget to write one of the fields |
07:14:13 | FromDiscord | <dayl1ght> by X() I meant the empty state |
07:14:38 | * | sagax quit (Ping timeout: 260 seconds) |
07:15:13 | bung | am wondering can I give a default value to type's field |
07:15:37 | leorize | that's a fair point |
07:15:48 | leorize | I wish that {.requiresInit.} can be applied per-object |
07:15:54 | leorize | per-proc/var |
07:15:59 | Yardanico | bung: not yet |
07:16:02 | Yardanico | !rfc default |
07:16:02 | disbot | https://github.com/nim-lang/RFCs/issues/126 -- 3Support default values for object properties 7& 29 more... |
07:16:19 | * | brainbomb quit (Ping timeout: 256 seconds) |
07:16:22 | * | brainbomb1 joined #nim |
07:16:24 | leorize | attaching `{.requiresInit.}` to a type is inflexible imo |
07:16:35 | leorize | only able to attach* |
07:16:36 | FromDiscord | <dayl1ght> can't you do that push and pop? |
07:16:41 | FromDiscord | <dayl1ght> although a bit verbose |
07:16:46 | leorize | nah |
07:17:06 | leorize | `{.requiresInit.}` have no meaning in a proc def, so it's not applied |
07:17:31 | FromDiscord | <dayl1ght> ohh yeah it would only applies for objects defined inside the push scope I suppose? |
07:17:35 | leorize | yea |
07:17:50 | FromDiscord | <dayl1ght> and what you want is that objects used inside the push scope behave as if they have the requiresInit annotation |
07:18:02 | FromDiscord | <dayl1ght> yeah that would be nice |
07:18:05 | leorize | yea, it'd be much more useful |
07:18:07 | * | brainbomb joined #nim |
07:18:08 | leorize | I don't need it all the time |
07:18:10 | * | kradnoel quit (Remote host closed the connection) |
07:18:11 | leorize | just sometimes |
07:18:47 | * | kradnoel joined #nim |
07:19:22 | leorize | to be fair it might not be that hard to implement this :P |
07:19:34 | leorize | but probably should write an rfc first |
07:20:51 | * | brainbomb1 quit (Ping timeout: 256 seconds) |
07:21:45 | FromDiscord | <dayl1ght> are there any plans to add inference of effects (thinking specifically of `raises` here)? |
07:21:54 | leorize | that's already a thing |
07:22:03 | Zevv | c |
07:22:33 | Yardanico | p |
07:22:35 | Yardanico | s |
07:22:44 | Zevv | dude, no, it was supposed to be /c to clear my terminal |
07:22:53 | Yardanico | lol |
07:23:45 | * | kradnoel_ joined #nim |
07:24:37 | FromDiscord | <dayl1ght> leorize: huh that's weird |
07:24:56 | leorize | so what are you having trouble with? |
07:25:10 | FromDiscord | <dayl1ght> I'm pretty sure I was forced to add .raises to all functions before |
07:25:17 | bung | hmm I read the rfc, thought may just allow CT default value |
07:25:19 | FromDiscord | <dayl1ght> but now I can't reproduce it |
07:25:23 | FromDiscord | <dayl1ght> maybe it's the nim 1.20 update |
07:25:34 | leorize | that has been the case since 0.18 |
07:25:52 | leorize | or maybe even earlier |
07:26:16 | leorize | the auto inference was a talking point in 4raq's early talks about Nim |
07:26:18 | * | kradnoel quit (Ping timeout: 256 seconds) |
07:26:41 | leorize | though `{.tags.}` might go away in the future |
07:28:07 | * | Trustable joined #nim |
07:28:11 | FromDiscord | <dayl1ght> hmmm |
07:29:44 | FromDiscord | <dayl1ght> I'm getting weird errors but I can't write a minimal reproduction case |
07:29:51 | FromDiscord | <dayl1ght> I'll play with it a bit more |
07:30:12 | leorize | try removing codeReordering |
07:30:22 | FromDiscord | <dayl1ght> then my whole project breaks :p |
07:30:33 | bung | no dont do that |
07:30:33 | leorize | that feature is broken atm |
07:30:51 | FromDiscord | <dayl1ght> so the error that I'm getting is |
07:30:58 | leorize | also you really don't want codeReordering if you ever write macros |
07:31:00 | FromDiscord | <dayl1ght> proc `outer()` calls `inner` |
07:31:07 | FromDiscord | <dayl1ght> `outer` declares exceptions [X, Y] |
07:31:21 | FromDiscord | <dayl1ght> if I change inner to raise Z, I get an error that Z is not listed anywhere |
07:31:32 | FromDiscord | <dayl1ght> even though `inner` doesn't have any `raises` pragma |
07:31:42 | leorize | it's in the scope of outer() |
07:31:49 | FromDiscord | <dayl1ght> I get that error on `inner` , not `oute` |
07:31:52 | FromDiscord | <dayl1ght> `outer` * |
07:32:11 | bung | if I want patch some lib, I dont want move existed things |
07:32:22 | FromDiscord | <dayl1ght> I'm trying to get a minimal reproduction |
07:33:13 | FromDiscord | <dayl1ght> ah |
07:33:20 | FromDiscord | <dayl1ght> `choosenim 1.2.0` fixed it 😛 |
07:34:27 | * | brainbomb quit (Ping timeout: 272 seconds) |
07:39:02 | FromDiscord | <dayl1ght> DrNim looks really nice, I should start using it |
07:39:12 | Yardanico | don't confuse it with design by contract though :) |
07:39:18 | Yardanico | and it's still in experimental stage afaik |
07:39:46 | FromDiscord | <dayl1ght> yup. it's better than design by contract 🙂 |
07:40:06 | FromDiscord | <dayl1ght> proving things at compile time > testing at runtime 🙂 |
07:41:13 | leorize | it's really slow though :P |
07:42:09 | * | kradnoel_ quit (Remote host closed the connection) |
07:45:19 | Zevv | it's only sunday morning, who cares |
07:45:57 | * | sagax joined #nim |
07:48:39 | * | tdc joined #nim |
07:51:05 | FromDiscord | <Zed> Is there an official indent size for nim? |
07:51:27 | FromDiscord | <Rika> 2 spaces |
07:52:17 | FromDiscord | <Zed> phew, that's what im just reformatting my code to now |
07:52:24 | FromDiscord | <Rika> you can use nimpretty for that |
07:52:39 | Yardanico | nimpretty also has support for reindenting |
07:52:43 | Yardanico | ye as Rika said |
07:54:36 | FromDiscord | <Zed> what line length do you guys use? |
07:54:57 | Yardanico | well most of people try to use less than 80 |
07:55:01 | Yardanico | that's the official limit :P |
07:55:07 | Yardanico | but in rare cases it's okay to go over that I guess |
07:55:52 | FromDiscord | <Zed> does it fill up fast? i read a thread the other day on reddit about line length and people were complaining about how 80 is not enough for python because of indentation |
07:56:05 | Yardanico | yeah I saw that thread, but it doesn't fill up fast really |
07:56:10 | Yardanico | that thread talked about context managers |
07:56:11 | Yardanico | classes |
07:56:13 | Yardanico | and stuff like that |
07:56:23 | Yardanico | since nim has UFCS you don't need classes - that's already one less level of indentation |
07:56:33 | FromDiscord | <Rika> also we use 2 and not 4 spaces 😛 |
07:56:35 | Yardanico | I mean you don't need to define everything under a "class" section |
07:56:38 | Yardanico | yeah that too |
07:56:41 | FromDiscord | <Elegant Beef> And no name spaces |
07:56:42 | FromDiscord | <Rika> there's significant savings there |
07:56:56 | Yardanico | 5 indentation levels is 20 spaces in python but 10 in nim by default |
07:57:11 | Yardanico | i mean you can do 2-space indent in python fine too |
07:57:13 | Yardanico | or 1-space indent |
07:57:46 | FromDiscord | <Zed> so it's basically no different to normal formatted braces code |
07:58:03 | Yardanico | well yeah, people indent code even with braces :D |
07:58:21 | FromDiscord | <Elegant Beef> Yea that's why i dont get the "oh it has significant white space" complaint |
07:58:36 | FromDiscord | <Elegant Beef> 99% of the time your code will be indented the same way |
07:59:18 | Prestige | tbh I'd like if I could use braces in nim |
07:59:24 | Yardanico | no |
07:59:24 | * | Prestige ducks |
07:59:24 | FromDiscord | <dayl1ght> ^ |
07:59:29 | Yardanico | they were there but were removed |
07:59:34 | Yardanico | (braces syntax skin) |
07:59:43 | Yardanico | and as I said just make a transpiler based on that code if you really want it |
07:59:48 | FromDiscord | <dayl1ght> indentation based syntax makes correct auto formatting impossible |
08:00:38 | FromDiscord | <Elegant Beef> If you're in a block and the code is indented to deep move it to that one else leave it at the current indent |
08:00:47 | FromDiscord | <Elegant Beef> Nim pretty exists |
08:00:49 | Prestige | I've accidentally put code at the wrong indentation level a few times and it took forever to figure out why my code wasn't working. Was very annoying |
08:00:52 | FromDiscord | <Rika> why are you programming with wrong indentation |
08:01:13 | FromDiscord | <dayl1ght> and it also makes it hard to copy paste code from the internet |
08:01:19 | FromDiscord | <Zed> i've found indent rainbow to be super helpful for those things, Prestige |
08:01:25 | bung | dont copy paste then |
08:01:35 | FromDiscord | <dayl1ght> that's just avoidingn the problem |
08:01:38 | Prestige | I'll have to look that up @Zed |
08:01:40 | Prestige | hopefully it helps |
08:01:47 | Yardanico | well the thing is @dayl1ght |
08:01:49 | Prestige | but a transpiler for curley brackets sounds very nice... |
08:01:53 | Yardanico | braces were there as a syntax skin |
08:01:53 | * | brainbomb joined #nim |
08:01:56 | Yardanico | but nobody liked them |
08:02:04 | Yardanico | and they were removed because there's a real maintenance cost |
08:02:05 | FromDiscord | <mratsim> @zevv @Araq, interesting bench and discussions on Rust futures overhead vs what seems to be continuation passing style: https://github.com/newpavlov/fsm-bench |
08:02:10 | FromDiscord | <Elegant Beef> My only real complaint is lack of native tab support 😄 |
08:02:18 | Yardanico | use that magic source code filter |
08:02:23 | FromDiscord | <Elegant Beef> Yea i know |
08:02:26 | FromDiscord | <dayl1ght> Oh I'm not saying nim should change now |
08:02:51 | FromDiscord | <Zed> can nim pretty format entire directories? |
08:03:12 | FromDiscord | <Rika> you can make it |
08:03:21 | Yardanico | "nimpretty src/*.nim" |
08:03:24 | FromDiscord | <Rika> use the globbing patterns |
08:03:53 | FromDiscord | <Zed> duh |
08:05:50 | FromDiscord | <dayl1ght> with braces, I could copy paste code from the internet, have it all broken and `nimpretty` would be able to fix it |
08:06:02 | FromDiscord | <dayl1ght> (broken in regards to indentation) |
08:06:44 | Prestige | visually lining up lines just doesn't go well for me |
08:07:04 | FromDiscord | <dayl1ght> whereas with indentation based syntax it's simply impossible to auto format broken code |
08:07:34 | FromDiscord | <Elegant Beef> Prestige how many spaces do you use for indents? |
08:07:39 | Prestige | 2 |
08:07:49 | FromDiscord | <dayl1ght> there are also other tooling disadvantages |
08:07:56 | FromDiscord | <dayl1ght> e.g. editors have jump to matching brace |
08:08:09 | FromDiscord | <Rika> jump to end of block |
08:08:18 | FromDiscord | <Rika> i dont see how "jump" is an argument |
08:08:41 | FromDiscord | <dayl1ght> how do I do that in vscode? |
08:08:55 | FromDiscord | <Rika> maybe fold the block and press down |
08:09:00 | FromDiscord | <dayl1ght> exactly |
08:09:03 | FromDiscord | <Zed> could you copy/paste nim code with braces and configure nimpretty to format and delete the braces? |
08:09:04 | FromDiscord | <dayl1ght> I'm not saying it's impsosible |
08:09:10 | FromDiscord | <dayl1ght> to implement |
08:09:12 | FromDiscord | <Rika> go make the skin then |
08:09:18 | FromDiscord | <dayl1ght> just that most editors don't support it by default |
08:09:40 | FromDiscord | <Rika> man you dont need to convince us that its worse for you |
08:09:47 | FromDiscord | <Rika> we dont need convincing |
08:09:57 | FromDiscord | <Rika> zed: i dont think so, no |
08:10:00 | FromDiscord | <dayl1ght> not trying to convince anyone ¯\_(ツ)_/¯ |
08:10:19 | FromDiscord | <Rika> you can do it with source code filters but they'd be nonfunctional to nimpretty |
08:10:26 | FromDiscord | <Rika> so you'd need your own formatter |
08:10:34 | FromDiscord | <Rika> day: then what are you trying to do |
08:11:09 | FromDiscord | <dayl1ght> there was a discussion about braces/indentation-based syntax. I'm just commenting on it. |
08:12:09 | FromDiscord | <Rika> ok i seem to have gotten lost then |
08:14:26 | Prestige | would be cool if we could just write something that ignores the curly brackets, so I could write them without it affecting anything |
08:14:35 | FromDiscord | <Elegant Beef> I do have to laugh at the "Some people dont think line width of 80 is enough cause of indention", whilst i use 8 space tabs on C# |
08:14:36 | FromDiscord | <Rika> source code filterrrrrrrr |
08:14:50 | FromDiscord | <Rika> https://nim-lang.org/docs/filters.html |
08:14:53 | FromDiscord | <Zed> why @Elegant Beef ? |
08:14:59 | FromDiscord | <Zed> 8 spaces is massive |
08:15:03 | Yardanico | @Rika I don't think it'll be possible to do it with filters |
08:15:05 | FromDiscord | <Rika> why not |
08:15:13 | FromDiscord | <Rika> Yardanico: why? |
08:15:17 | FromDiscord | <Rika> ah |
08:15:19 | FromDiscord | <Rika> i see |
08:15:19 | Yardanico | coz you can't define custom filters |
08:15:25 | FromDiscord | <Rika> no no |
08:15:29 | FromDiscord | <Rika> theres another issue i thought of |
08:15:37 | FromDiscord | <Rika> you wouldnt be able to use set sytax |
08:15:39 | FromDiscord | <Rika> (edit) 'sytax' => 'syntax' |
08:15:45 | Yardanico | why? |
08:15:49 | Yardanico | it was possible with syntax skins |
08:15:52 | Yardanico | with braces skin |
08:16:03 | FromDiscord | <Rika> i mean for custom filters |
08:16:03 | FromDiscord | <Elegant Beef> Cause i like wide indents |
08:16:15 | * | brainbomb1 joined #nim |
08:16:20 | FromDiscord | <Zed> well you could define the minimum number of characters between the braces for the filter to format |
08:18:09 | FromDiscord | <Zed> so if there are 10 characters between the braces, that set of braces is ignored |
08:19:44 | * | neceve joined #nim |
08:19:54 | * | brainbomb quit (Ping timeout: 240 seconds) |
08:20:16 | FromDiscord | <Rika> not foolproof |
08:24:26 | * | zacharycarter joined #nim |
08:26:53 | * | brainbomb joined #nim |
08:27:27 | * | dadada joined #nim |
08:27:49 | * | dadada is now known as Guest71686 |
08:28:17 | * | brainbomb1 quit (Ping timeout: 272 seconds) |
08:28:55 | * | zacharycarter quit (Ping timeout: 265 seconds) |
08:30:45 | FromDiscord | <Recruit_main707> someone should proably add this to the supported IDE's page https://github.com/itmuckel/nimtellij |
08:31:25 | FromDiscord | <Recruit_main707> it uses the nimlsp, which is nice |
08:31:44 | * | idf joined #nim |
08:33:05 | Prestige | nimlsp needs some work D: |
08:33:19 | Yardanico | well you can contribute |
08:33:22 | Yardanico | it's based on nimsuggest btw |
08:33:52 | FromDiscord | <Recruit_main707> nimlsp, or the intellij plugin |
08:34:02 | Yardanico | i replied to prestige |
08:34:07 | FromDiscord | <Recruit_main707> ok |
08:34:54 | Prestige | yeah I plan on contributing once I get my wm to beta |
08:35:03 | Prestige | which shouldnt be too long I hope |
08:37:35 | Prestige | Would've been tomorrow (today?) but I have to write my own status bar |
08:38:24 | FromDiscord | <Recruit_main707> can you guys think of a way to make this function work with complex types? (lets take a vector3 for instance)↵`Something` its just `SomeInteger | bool` for now↵https://play.nim-lang.org/#ix=2nUn |
08:38:34 | FromDiscord | <Rika> complex? |
08:38:42 | FromDiscord | <dayl1ght> small thing I'd like to contribute is to have the VSCode extension show types on hover |
08:39:02 | FromDiscord | <dayl1ght> right now it shows types only for usage, not definitions |
08:39:03 | FromDiscord | <Rika> @Recruit_main707 use a concept LOL |
08:39:14 | FromDiscord | <Recruit_main707> time to google |
08:39:22 | FromDiscord | <Rika> its in manual_experimental |
08:41:07 | FromDiscord | <Recruit_main707> i dont see how can this help |
08:41:25 | * | Trustable quit (Remote host closed the connection) |
08:41:44 | Yardanico | @dayl1ght wdym types on definitions? |
08:42:04 | Yardanico | vscode-nim-lsp shows me definitions everywhere |
08:42:12 | Yardanico | (it's a vscode extension by bung which uses nimlsp) |
08:42:27 | FromDiscord | <Recruit_main707> he probably means the "default" or most used one |
08:42:36 | Yardanico | i know, I just said as a reference |
08:42:40 | bung | I just need one more feature , formating thing. |
08:43:07 | FromDiscord | <dayl1ght> Yardaanico: like let x = newSeq[int]() |
08:43:09 | bung | other parts seems good to me , the extension |
08:43:12 | FromDiscord | <Recruit_main707> @Rika i really cannot see it, can you tell me how? |
08:43:20 | FromDiscord | <dayl1ght> it only shows the type of x if you hover on something like `echo x` |
08:43:25 | Yardanico | @dayl1ght and what type there? x? |
08:43:32 | Yardanico | oh i see then |
08:43:43 | bung | control hover |
08:43:47 | livcd | Prestige: do you plan to write something like a lemonbar? |
08:43:54 | FromDiscord | <Rika> https://nim-lang.org/docs/manual_experimental.html↵ctrl+f "concept" |
08:43:57 | Yardanico | bung: that's now what they wants |
08:43:58 | FromDiscord | <dayl1ght> control hover doesn't do it for me |
08:44:00 | FromDiscord | <Rika> @Recruit_main707 ^ |
08:44:09 | bung | yeah |
08:44:13 | FromDiscord | <Recruit_main707> ye, i have already reached that :P |
08:44:13 | Yardanico | bung: in "let kk = 1" they want to hover over kk to get the type of "kk" |
08:44:33 | livcd | i use explicit types :X |
08:44:43 | FromDiscord | <dayl1ght> 😮 |
08:44:53 | bung | hmm let me see |
08:45:40 | bung | it works,by hover ,control + hover |
08:45:41 | FromDiscord | <Rika> @Recruit_main707 then you make a concept that makes sure "n.uint8" works |
08:46:19 | bung | nothing else need to be shown I thought |
08:46:50 | livcd | does VSCode has something like aggressive indentation? |
08:46:52 | FromDiscord | <dayl1ght> bung: does it show `int` for you? in `let kk = 1` |
08:48:07 | FromDiscord | <Recruit_main707> Rika: i am not sure if you understood what i meant, i was thinking of a way to accept user defined types (such as a vector3, of 3 floats) |
08:49:20 | bung | oh , implicit type , that's the problem |
08:49:54 | Yardanico | yes |
08:49:58 | FromDiscord | <Recruit_main707> so that it runs that function with each field of the type (as a possible solution) |
08:50:15 | FromDiscord | <Rika> eh? why? |
08:50:24 | * | brainbomb1 joined #nim |
08:50:41 | FromDiscord | <Rika> not easily i dont think |
08:51:08 | FromDiscord | <Rika> you need to make another proc that calls the original proc per field |
08:51:28 | bung | contorl + hover shows whole expression , seems not a big problem. |
08:51:54 | FromDiscord | <Recruit_main707> could it overload WriteVal, possibly by specifying the generic as [not Something]? |
08:52:33 | FromDiscord | <dayl1ght> yeah, the way I work around it right now is just adding `echo x` and hovering over `x` |
08:52:45 | FromDiscord | <Rika> use `object` instead |
08:52:59 | * | brainbomb quit (Ping timeout: 272 seconds) |
08:52:59 | FromDiscord | <Rika> to ensure you dont take in a non-number primitive |
08:53:10 | FromDiscord | <Recruit_main707> ok |
08:53:11 | FromDiscord | <dayl1ght> I'll look into vscode-nim's source code, hopefully it's easy to change |
08:55:16 | FromDiscord | <Recruit_main707> How can i acess the number and type of the fields of an object? can it be done from within a proc? |
08:55:24 | bung | I want wrap os.nim to nodejs , seems most procs I need wrap around proc not inside it |
08:55:37 | Yardanico | bung: you can do that too |
08:56:08 | bung | am not sure the pragma will affect what |
08:56:11 | Yardanico | ? |
08:56:15 | Yardanico | you usually use stuff like |
08:56:15 | bung | `{. noSideEffect, rtl, extern: "nos$1".}` |
08:56:17 | Yardanico | when defined(js): |
08:56:30 | Yardanico | bung: you don't need rtl or extern for js I guess, not sure |
08:56:37 | FromDiscord | <Rika> @Recruit_main707 https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT |
08:57:05 | bung | so I need use `when` uppon it |
08:57:15 | FromDiscord | <Recruit_main707> thanks Rika |
08:57:18 | Yardanico | outside of the proc yes bung |
08:57:29 | bung | ok ,Thanks! |
08:57:31 | Yardanico | you can also do it inside |
08:57:36 | Yardanico | just check how much code can you share or stuff |
08:59:07 | bung | I guess less than 20% |
09:00:08 | bung | and another thing I worried , what about exceptions |
09:02:18 | * | dddddd joined #nim |
09:07:38 | FromDiscord | <dayl1ght> anyone familiar with `nimsuggest` in `stdin` mode? |
09:08:16 | FromDiscord | <Rika> prolly leorize 😛 but i dont know |
09:11:28 | FromDiscord | <dom96> 'morning |
09:11:41 | FromDiscord | <Elegant Beef> Hello |
09:56:48 | bung | the os.nim should work with nodejs |
09:57:19 | bung | but it declare `this proc is not available on the NimScript target` globally |
09:57:20 | FromDiscord | <Rika> nodejs support is poor right now |
09:57:57 | FromDiscord | <Rika> theres no distinction right now for nodejs and js target (rather there are no when statements for nodejs) |
09:58:00 | * | Vladar joined #nim |
09:58:01 | bung | as it call system api, dont know why declare it as that |
09:58:18 | FromDiscord | <Rika> (edit) 'are' => 'is' | 'when statements' => 'code in os' |
09:59:30 | bung | oh, I realize jsgen only generate language level code.. |
10:02:13 | Yardanico | disruptek: replied about your arc bug in telegram |
10:05:40 | FromDiscord | <dayl1ght> can I rename imports without introducing everything into scope? |
10:05:52 | FromDiscord | <dom96> Why do you want to use Nim with nodejs? |
10:05:59 | FromDiscord | <dayl1ght> e.g. `import terminal as t` gives me `t.styledWrite`, but `styledWrite` also works |
10:06:24 | FromDiscord | <dayl1ght> I can do `from terminal import nil` but that doesn't allow me to rename the impotr |
10:06:24 | FromDiscord | <Recruit_main707> from terminal as t import nil maybe works |
10:06:33 | FromDiscord | <dayl1ght> ah awesome |
10:06:35 | FromDiscord | <Recruit_main707> but its ugly af |
10:06:42 | Yardanico | because you shouldn't do that :P |
10:06:44 | FromDiscord | <Rika> then you lose UFCS too lol |
10:06:51 | FromDiscord | <dayl1ght> Yeah I lose UFCS |
10:07:14 | FromDiscord | <dayl1ght> but I won't be using this too much so idc |
10:07:17 | Yardanico | and then you write C |
10:07:23 | FromDiscord | <dayl1ght> all my other imports are qualified |
10:07:24 | Yardanico | @dayl1ght that's a mistake :) |
10:07:29 | Yardanico | UFCS in nim is really used everywhere |
10:07:36 | FromDiscord | <dayl1ght> I don't use `import x` |
10:07:43 | FromDiscord | <dayl1ght> always `from x import ...` |
10:07:48 | FromDiscord | <Rika> ok |
10:07:49 | Yardanico | well then your code probably looks really verbose |
10:07:52 | FromDiscord | <Rika> you do you really |
10:07:59 | FromDiscord | <dayl1ght> verbose why? |
10:08:10 | FromDiscord | <Rika> because you dont have ufcs and qualify all imports |
10:08:13 | Yardanico | ^ |
10:08:14 | FromDiscord | <dayl1ght> no |
10:08:19 | FromDiscord | <dayl1ght> I'm only qualifying terminal |
10:08:29 | FromDiscord | <dayl1ght> for other imports I import the procs individually |
10:09:15 | FromDiscord | <dayl1ght> e.g. from strutils import strip, split, etc |
10:09:27 | FromDiscord | <Rika> well thats fine really |
10:09:32 | FromDiscord | <Rika> its your code anyway |
10:09:38 | Yardanico | true that |
10:09:43 | FromDiscord | <Rika> unless this is on a repo 😛 |
10:09:47 | FromDiscord | <Rika> github repo i mean |
10:09:51 | FromDiscord | <dayl1ght> it will be :p |
10:09:53 | FromGitter | <bung87> @dom96 some lib seems useful , I also want to use it in js |
10:09:54 | Yardanico | ohno |
10:10:07 | FromDiscord | <dayl1ght> oh no is my reaction when I see `import strutils` :p |
10:10:21 | FromGitter | <bung87> and I want compile nimpretty to js these days |
10:10:24 | FromDiscord | <Rika> and oh no is our reaction when we see `import nil` |
10:10:30 | Yardanico | or "from x import stuff" |
10:10:35 | FromDiscord | <dayl1ght> I don't do import nil! |
10:10:35 | Yardanico | when it's used everywhere :P |
10:10:43 | FromDiscord | <Rika> you just did for terminal did you not |
10:10:49 | FromDiscord | <dayl1ght> one time 🙂 |
10:10:53 | Yardanico | cmon, it's 2020, we have editors with easy go to definition or hover |
10:10:55 | FromDiscord | <dayl1ght> from x import stuff for other things |
10:11:02 | FromDiscord | <dayl1ght> github doesn't have go to definition |
10:11:03 | FromDiscord | <dayl1ght> nor does cat |
10:11:04 | FromDiscord | <Rika> but that means "i dont do import nil" is false |
10:11:16 | FromDiscord | <Rika> why use cat then lol |
10:11:26 | FromDiscord | <dayl1ght> sometimes it's useful |
10:11:38 | Yardanico | well I mean for me it's not an issue since I remember quite a lot of stdilb procs :P |
10:13:12 | FromDiscord | <dayl1ght> editor support goes the other way |
10:13:26 | FromDiscord | <dayl1ght> many editors automatically add the right imports for you |
10:13:49 | FromDiscord | <dayl1ght> like you type `str.add<TAB>` and it does `from strutils import split` |
10:13:58 | FromDiscord | <dayl1ght> oops, str.split<TAB> |
10:14:07 | FromDiscord | <Rika> interesting editor support there |
10:14:14 | FromDiscord | <Rika> i always add my imports manually lol |
10:14:15 | Yardanico | well with no need to qualify by default that's not a big problem really |
10:14:30 | Yardanico | just "import strutils" for all string procs |
10:15:06 | FromDiscord | <dayl1ght> I mean with that you get the best of both worlds :p no time wasted typing out imports |
10:15:21 | Yardanico | I don't spend that much time typing out imports |
10:15:23 | FromDiscord | <dayl1ght> and betterreadability for cases where you don't have an IDE (e.g. reading code on github) |
10:15:56 | Yardanico | blame github for not having proper nim go to definition support :) |
10:16:06 | Yardanico | they do it for some languages |
10:16:26 | FromDiscord | <dayl1ght> i doubt they will ever support nimgrep :p |
10:16:46 | Yardanico | we can make a PR |
10:16:46 | Yardanico | https://github.com/github/semantic |
10:16:48 | FromDiscord | <dayl1ght> but nim go to definition would be nice |
10:17:13 | Yardanico | but i wont write in haskell |
10:17:36 | FromDiscord | <dayl1ght> LOL |
10:17:52 | FromDiscord | <dom96> Haskell is nice 🙂 |
10:18:34 | FromDiscord | <dayl1ght> something something monoid in the category of endofunctors |
10:20:18 | * | sagax quit (Remote host closed the connection) |
10:24:20 | * | zacharycarter joined #nim |
10:28:00 | FromDiscord | <Rika> dom: why dont you add the support then 😛 |
10:28:32 | * | zacharycarter quit (Ping timeout: 246 seconds) |
10:33:10 | FromDiscord | <dayl1ght> Is there some example of custom pragmas? I want all my code to have `{.requiresInit.}`, so I'm doing `{.push requiresInit.}` at the top of my files |
10:33:40 | FromDiscord | <dayl1ght> but now I'd like to have some specific fields where I don't need {.requiresInit.}, is it even possible to do that/write a pragma for it? |
10:34:04 | Yardanico | well it should be, but it's not that simple |
10:34:08 | Yardanico | you'll have to write a macro :) |
10:34:41 | FromDiscord | <dayl1ght> ok so _it's possible_ |
10:34:47 | Yardanico | yeah of course |
10:35:13 | Yardanico | see e.g. how pragma annotations are used there https://github.com/status-im/nim-json-serialization/blob/master/tests/test_serialization.nim#L8 |
10:35:26 | * | neceve quit (Remote host closed the connection) |
10:35:57 | * | luis_ joined #nim |
10:36:02 | * | Guest71686 quit (Ping timeout: 265 seconds) |
10:36:39 | luis_ | Hi all, I need to calculate a root above the cubic base... is there a math module supporting roots of any case? |
10:36:44 | FromDiscord | <dayl1ght> looks like dontserialize comes from the stdlib? |
10:36:54 | luis_ | the base math goes up to cubic only |
10:37:10 | FromDiscord | <dayl1ght> oh it's from nim-serialization |
10:37:15 | Yardanico | yep |
10:37:21 | Yardanico | luis_: isn't root just pow with < 1 ? |
10:38:39 | luis_ | sorry if this is a ridiculous question, what is the syntax for power in Nim? |
10:38:53 | FromDiscord | <Recruit_main707> ^ i think |
10:39:02 | FromDiscord | <Recruit_main707> but its in the math module iitc |
10:39:05 | Yardanico | yes |
10:39:17 | Yardanico | !eval import math; echo pow(8, 1/3) |
10:39:20 | NimBot | 2.0 |
10:39:26 | Yardanico | cubic root :P |
10:39:28 | FromDiscord | <Rika> pow for float, ^ for int |
10:39:35 | luis_ | yep, that is what i need |
10:39:37 | luis_ | thanks |
10:44:37 | FromDiscord | <dayl1ght> huh, weird. this code https://play.nim-lang.org/#ix=2nV5 gives me an error in vscode, but it compiles fine |
10:44:43 | FromDiscord | <dayl1ght> not sure if it's a bug in nimsuggest or the vs code extension |
10:45:00 | Yardanico | nimsuggest |
10:45:32 | Yardanico | actually hmm, I think I might try to fix that later |
10:45:48 | Yardanico | for some reason nimsuggest treats "template/generic instantiation from here"" intermediate message as an error |
10:45:59 | Yardanico | see https://gist.github.com/Yardanico/9aa9ee5320a9e9b422ee1b7b04ebd173 |
10:46:06 | Yardanico | for your code example |
10:47:23 | FromDiscord | <dayl1ght> ah so it's a problem in parsing the compiler output? |
10:47:34 | Yardanico | nimsuggest isn't parsing the compiler output though :P |
10:47:39 | Yardanico | nimsuggest itself uses compiler as a library |
10:47:45 | FromDiscord | <dayl1ght> ah ok |
10:48:05 | FromDiscord | <dayl1ght> well since you know how to use `nimsuggest`'s stdin mode, how do I use `def`? :p |
10:48:13 | FromDiscord | <dayl1ght> I was trying to do `def file.nim line column` |
10:48:17 | FromDiscord | <dayl1ght> but don't get anything back |
10:48:29 | Yardanico | idk def too, I learned "chk" from PMunch (creator of nimlsp) :P |
10:49:37 | FromDiscord | <dayl1ght> it seems like `def` is what VSCode uses on hover |
10:49:40 | FromDiscord | <dayl1ght> https://github.com/pragmagic/vscode-nim/blob/master/src/nimHover.ts#L24-L25 |
10:49:46 | Zevv | hmm, I think I hit a wall already, cps-wise |
10:49:55 | Zevv | there's just not enough info avaible when doing this with macros |
10:49:58 | FromDiscord | <dayl1ght> and because of these lines I assume that nimsuggest doesn't return the type when hovering over `let kk = 1` |
10:50:04 | FromDiscord | <dayl1ght> oops, when calling `def` |
10:50:20 | bung | dayl1ght its not split by space |
10:50:49 | FromDiscord | <dayl1ght> file.nim:<line>:<column>? |
10:53:14 | bung | hmm I also need check source code.. but not space that I remenber |
10:53:37 | * | lritter quit (Ping timeout: 264 seconds) |
10:57:46 | bung | guess check vscode-nim that's easier , I give up searching nim source.. |
10:58:13 | FromDiscord | <dayl1ght> I was reading it too |
10:58:30 | FromDiscord | <dayl1ght> apparently it works with spaces |
10:58:36 | FromDiscord | <dayl1ght> I was just giving the wrong file name lol |
10:58:48 | FromDiscord | <dayl1ght> and wrong line number (0 instead of 1) |
10:58:53 | bung | oh, my bad |
10:59:17 | FromDiscord | <dayl1ght> if you don't give it the right filename + line number + column combination it doesn't print anything |
11:00:11 | FromDiscord | <dayl1ght> no problem, thanks for helping 🙂 |
11:02:25 | FromDiscord | <dayl1ght> oh, so it does look like nimsuggest doesn't give the type when hovering definitions: |
11:02:30 | FromDiscord | <dayl1ght> https://ghostbin.co/paste/xy88k |
11:03:43 | bung | https://github.com/pragmagic/vscode-nim/blob/master/src/elrpc/elrpc.ts#L68 here I found it |
11:05:21 | FromDiscord | <dayl1ght> yeah, I think that's the syntax for the emacs RPC thing it uses |
11:05:36 | FromDiscord | <dayl1ght> but for nimsuggest --stdin it accepts a different format |
11:05:45 | Yardanico | well --stdin is only for debug really |
11:05:57 | FromDiscord | <dayl1ght> yep |
11:06:11 | FromDiscord | <dayl1ght> now I'm trying to find where nimsuggest handles `def` requests |
11:06:20 | FromDiscord | <dayl1ght> to see why it's not sending the types for definitions |
11:08:04 | Yardanico | you can search for different places in the compiler with nimsuggest branches with "defined(nimsuggest)" |
11:08:10 | Yardanico | nimsuggest itself is in, well, "nimsuggest" directory |
11:09:05 | FromDiscord | <dayl1ght> ohh I was looking in numsuggest.nim |
11:09:15 | Yardanico | well as I said nimsuggest uses the compiler as a library |
11:09:20 | * | brainbomb1 quit (Quit: Leaving.) |
11:10:15 | FromDiscord | <dayl1ght> right, it looks confusing to me because what it does there is call out to execute("def", filename, line, column) |
11:10:31 | FromDiscord | <dayl1ght> and execute doesn't really return anything, but it calls out to graph.compileProject |
11:10:50 | Yardanico | well it's all in the compiler :P |
11:12:15 | FromDiscord | <Recruit_main707> why is there no swapEnidan universal function in endians |
11:12:15 | Yardanico | also compiler/suggest.nim |
11:12:27 | FromDiscord | <Recruit_main707> so that any size can be used |
11:12:36 | Yardanico | use endians2 from nim-stew |
11:13:02 | FromDiscord | <Recruit_main707> i already implemented it :P↵but thx |
11:16:40 | Yardanico | @dayl1ght check symToSuggest in suggest.nim |
11:16:56 | * | luis_ quit (Ping timeout: 256 seconds) |
11:17:21 | Yardanico | type is stored in result.forth |
11:17:45 | FromDiscord | <dayl1ght> https://github.com/nim-lang/Nim/blob/77834f0fdabc9d39cf111c4c94e717bd2c4f00d2/compiler/suggest.nim#L489-L490 |
11:17:48 | FromDiscord | <dayl1ght> seems like these are the lines |
11:18:03 | FromDiscord | <dayl1ght> oh nvm |
11:18:05 | FromDiscord | <dayl1ght> thanks |
11:18:44 | Yardanico | and the compiler itself doesn't have enough info for the symbol there |
11:18:53 | Yardanico | it's just how it works |
11:18:56 | Yardanico | https://gist.github.com/Yardanico/4cb333deebbb5560cf69ed70e3f3b8af |
11:18:57 | FromDiscord | <dayl1ght> now I don't know where PSym comes from |
11:19:04 | FromDiscord | <dayl1ght> see, this is why we need from x import PSym :p |
11:19:06 | Yardanico | from compiler itself |
11:19:23 | Yardanico | you're not gonna easily add types there :) |
11:19:35 | FromDiscord | <dayl1ght> What's that gist you linked? |
11:19:44 | Yardanico | debug output of the symbol node for "xs" |
11:19:49 | Yardanico | from "let xs = newSeq..." |
11:19:56 | Yardanico | the compiler just doesn't attach the type to "xs" here |
11:20:01 | FromDiscord | <dayl1ght> hmm |
11:20:14 | FromDiscord | <dayl1ght> but it does _know_ the type I assume? |
11:20:17 | Yardanico | not sure |
11:20:21 | Yardanico | that's all we get |
11:20:23 | Yardanico | so s.typ is nil |
11:20:26 | FromDiscord | <dayl1ght> right |
11:21:00 | FromDiscord | <dayl1ght> I'll look a bit more to see why s.typ is nil |
11:21:15 | * | zacharycarter joined #nim |
11:27:16 | Yardanico | ah well actually the compiler knows the type, yes |
11:27:26 | Yardanico | i tried debugging newSymNode from ast.nim line 1221 |
11:27:46 | Yardanico | anyway it's not simple :P |
11:28:49 | FromDiscord | <dayl1ght> how are you debugging? |
11:28:58 | Yardanico | "debug" or "echo" :) |
11:29:11 | Yardanico | like if sym.name.s == "xs": echo sym[] |
11:29:13 | FromDiscord | <dayl1ght> oh did you recompile the compiler? |
11:29:16 | Yardanico | no? |
11:29:24 | Yardanico | you don't have to since nimsuggest uses the compiler as a library |
11:29:42 | Yardanico | so you can modify the compiler code and recompile nimsuggest |
11:30:10 | FromDiscord | <dayl1ght> I see |
11:30:18 | FromDiscord | <dayl1ght> that pretty much recompiles the whole compiler though, no? :p |
11:30:33 | FromDiscord | <dayl1ght> it takes a while to build nim in my laptop |
11:32:57 | Yardanico | semstmts.nim line 333 |
11:33:06 | Yardanico | the thing is that it processes "xs" as an indent (which is correct, yes) |
11:33:09 | Yardanico | and then gives a suggestion |
11:34:22 | * | dadada joined #nim |
11:34:46 | * | dadada is now known as Guest20166 |
11:34:59 | FromDiscord | <dayl1ght> yardanico: how are you debugging? |
11:35:03 | Yardanico | as I said |
11:35:06 | Yardanico | echo and "debug" :) |
11:35:08 | FromDiscord | <dayl1ght> I've cloned nim, added a line to `ast.nim` in the line you said |
11:35:12 | FromDiscord | <dayl1ght> and recompiled nimsuggest with: |
11:35:18 | FromDiscord | <dayl1ght> `bin/nim c nimsuggest/nimsuggest.nim` |
11:35:28 | FromDiscord | <dayl1ght> then `nimsuggest/nimsuggest --stdin --debug myfile.nim` |
11:35:38 | FromDiscord | <dayl1ght> but I'm not getting my echos back |
11:35:44 | FromDiscord | <dayl1ght> oh nvm I'm stupid |
11:35:52 | Yardanico | also see https://nim-lang.org/docs/intern.html#debugging-the-compiler |
11:41:16 | FromDiscord | <dayl1ght> hmm `b compiler/semstmtst.nim:333` doesn't work in lldb 😦 |
11:41:27 | Yardanico | did you compile with --debugger:native ? |
11:41:41 | FromDiscord | <dayl1ght> I ran bin/nim c --debuginfo --linedir:on nimsuggest/nimsuggest.nim |
11:41:49 | Yardanico | --debuginfo is for C debug lines |
11:41:56 | Yardanico | if you want to get nim source code lines you need --debugger:native |
11:42:01 | Yardanico | also --linedir:on is redundant here |
11:42:09 | Yardanico | since you're compiling in debug mode anyway (not release/danger) |
11:42:09 | FromDiscord | <dayl1ght> kk, I'll try again |
11:43:12 | FromDiscord | <dayl1ght> worked now 🙂 thanks |
11:43:25 | Yardanico | you won't get pretty printed ast structure and stuff anyway :D |
11:43:56 | Yardanico | there's nim-gdb to make gdb work for some nim name mangling, but nothing for lldb |
11:45:10 | FromDiscord | <dayl1ght> yeah debugging with lldb was one of the first things I tried when first using nim |
11:45:25 | FromDiscord | <dayl1ght> does nim-gdb support arbitrary nim expressions? |
11:45:33 | Yardanico | of course not, how would it do that? :D |
11:45:33 | FromDiscord | <dayl1ght> i imagine it must be hard to add support for that |
11:45:44 | FromDiscord | <dayl1ght> I saw thta LLDB has an API to add support |
11:45:52 | FromDiscord | <dayl1ght> but maybe I misread it |
11:46:01 | Yardanico | yes, there *is* a way to do that |
11:46:08 | Yardanico | like apple has an lldb fork with repl for swift |
11:47:03 | FromDiscord | <dayl1ght> well I guess the answer to how hard it is is to diff apples fork and lldb and count the number of lines :p |
11:48:03 | * | konvertex joined #nim |
11:48:05 | Yardanico | endb had some limited nim expression support |
11:48:28 | Yardanico | https://nim-lang.org/0.18.0/endb.html it's dead now though |
11:48:38 | Yardanico | (hence the doc for 0.18.0) |
11:48:41 | FromDiscord | <dayl1ght> looks like with python you can add support for custom formatting |
11:48:47 | Yardanico | yes you can |
11:48:51 | Yardanico | lldb has a python api just like gdb |
11:49:01 | FromDiscord | <dayl1ght> but probably not nim expressions? |
11:49:04 | Yardanico | no :) |
11:49:11 | Yardanico | it's a matter of time and script size :P but nim doesn't really have runtime type information in most cases |
11:49:16 | FromDiscord | <dayl1ght> that requires changing lldb internals I guess? |
11:49:26 | Yardanico | well it's there for default GC and stuff, but it's going away with arc/orc which will become the default eventually |
11:49:39 | FromDiscord | <dayl1ght> hmm |
11:49:54 | FromDiscord | <Recruit_main707> arc hopefully, since orc is a "quickfix" to use async |
11:49:58 | Yardanico | uh no? |
11:50:00 | Yardanico | wtf |
11:50:12 | Yardanico | sometimes you *need* to have cycles in your program |
11:50:19 | Yardanico | orc is not just made for async |
11:50:58 | FromDiscord | <Recruit_main707> oh, ok, its just that every time i heard of orc it came next to async |
11:51:04 | FromDiscord | <dom96> T R I G G E R E D |
11:51:08 | Yardanico | XD |
11:51:43 | FromDiscord | <dayl1ght> wait why would adding support for nim expressions require rtti? I'm thinking of things like `print "a,b,c".split(",")` |
11:51:54 | Yardanico | @dayl1ght I talked about pretty printing nim variables |
11:51:59 | FromDiscord | <dayl1ght> ah ok |
11:52:04 | Yardanico | and the expressions themselves still will be hard to do |
11:52:07 | FromDiscord | <dayl1ght> yeah |
11:55:24 | * | luis_ joined #nim |
11:55:25 | FromDiscord | <dayl1ght> things like object variants probably could be pretty printed without RTTI |
11:55:33 | FromDiscord | <dayl1ght> but strings, seqs etc would require rtti I guess |
11:55:38 | FromDiscord | <Yardanico> No |
11:56:07 | FromDiscord | <dayl1ght> actually yeah, an object variant is still an opaque binary blob |
11:56:10 | FromDiscord | <Yardanico> strings and seqs aren't that complicated and nim-gdb supports them I think |
11:56:16 | FromDiscord | <dayl1ght> hmm |
11:56:51 | FromDiscord | <Yardanico> They're just an object with len, cap and the data itself in the raw C array (for the C backend) |
11:57:21 | FromDiscord | <dayl1ght> right |
11:57:27 | FromDiscord | <dayl1ght> but do you type `print_string` or just `print` ? |
11:57:54 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/blob/devel/lib/system/strs_v2.nim |
11:58:39 | FromDiscord | <dayl1ght> what I meant is |
11:58:40 | FromDiscord | <Yardanico> Check out https://github.com/nim-lang/Nim/blob/devel/tools/nim-gdb.py |
11:58:50 | FromDiscord | <dayl1ght> how does nim-gdb know that it's looking at a string |
11:58:53 | livcd | anyone deployed on an obscure platform? |
11:59:14 | FromDiscord | <Yardanico> @livcd depends on what your mean by that :D |
11:59:23 | livcd | my most obscure platform is windows server 2008 |
11:59:26 | livcd | :D |
11:59:41 | FromDiscord | <Yardanico> @dayl1ght you still have debug info from the C code |
11:59:43 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/blob/devel/tools/nim-gdb.py#L37 |
11:59:53 | livcd | But I am thinking along the lines of Nintendo Switch, HP-UX,AIX,Solaris etc |
12:00:01 | * | brainbomb joined #nim |
12:00:15 | livcd | basically platforms where you *can't* use Go |
12:00:24 | FromDiscord | <Yardanico> Well I was able to run simple Nim programs easily on KolibriOS |
12:00:37 | FromDiscord | <Yardanico> os:any, arc, useMalloc, etc |
12:00:53 | FromDiscord | <Yardanico> Although that OS has a C library and it's x86 |
12:04:53 | Zevv | livcd: depends on what you call "obscure" |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:36 | * | supakeen joined #nim |
12:07:28 | livcd | Zevv: ahh you have those routers right |
12:08:24 | * | luis_ quit (Ping timeout: 272 seconds) |
12:18:39 | Zevv | no problem there |
12:18:49 | Zevv | I've run on almost anything with a C compiler lately |
12:27:58 | * | fredrikhr joined #nim |
12:28:06 | FromDiscord | <Yardanico> rust: "you can't just support almost any platform out there, that's illegal!" nim:"haha c compiler go brrrrr" |
12:29:29 | FromDiscord | <dayl1ght> anyone familiar with the compiler code knows what fileIndex in TLineInfo means? |
12:30:30 | FromDiscord | <dom96> @Yardanico haha, dare you to post that in r/nim 😛 |
12:30:42 | FromDiscord | <dom96> or maybe we need a r/nimjerk ala rustjerk |
12:36:19 | FromDiscord | <willyboar> Do you want it in comic? |
12:36:20 | FromDiscord | <willyboar> 😛 |
12:36:50 | * | Vladar quit (Quit: Leaving) |
12:37:37 | zacharycarter | cool - imgui plugin is working - https://imgur.com/a/EsyXfhd |
12:41:20 | zacharycarter | of course now hot reloading breaks when I try to reload the app plugin - but I think I know why |
12:44:18 | zacharycarter | yay hot reloading works again! |
12:50:59 | * | zacharycarter quit (Ping timeout: 246 seconds) |
12:52:51 | FromDiscord | <dayl1ght> how print a string in lldb? |
12:54:15 | FromDiscord | <dayl1ght> ah, `print (char*) <string>->data` |
12:55:48 | disruptek | fileindex is an index into a list of files. |
12:55:58 | FromDiscord | <Rika> ? |
12:57:06 | FromDiscord | <dom96> The mitochondria is the powerhouse of the cell |
12:57:16 | FromDiscord | <Rika> water is wet |
12:57:24 | * | luis_ joined #nim |
12:57:26 | disruptek | clipper ships |
12:57:36 | FromDiscord | <Rika> shipper clips |
12:57:43 | FromDiscord | <dayl1ght> yeah, I was debugging the compiler and trying to find out where to use that index |
12:58:00 | FromDiscord | <dom96> hipper lips |
12:58:05 | luis_ | Hi again, the function inDays from the times module returns an int64, but I need an int... how to cast? |
12:58:08 | FromDiscord | <dayl1ght> turns out it's `(lldb) print (char*)(c->graph->config->m.fileInfos[0]).data[fileIndex].shortName->data` |
12:58:09 | FromDiscord | <dayl1ght> 🙂 |
12:58:21 | FromDiscord | <Rika> luis_ `theInt64.int` |
12:58:31 | FromDiscord | <Rika> day: damn, thats complicated |
12:58:48 | FromDiscord | <dayl1ght> I just want my vscode to show types on hover |
12:58:56 | FromDiscord | <dayl1ght> and now I'm debugging the internals of the nim compiler |
12:58:58 | FromDiscord | <dayl1ght> lol |
12:59:01 | FromDiscord | <Rika> lmao rip |
12:59:10 | livcd | Yardanico: lol these memes |
12:59:23 | disruptek | this is the wrong way to go about it. |
12:59:26 | luis_ | works great, thanks |
12:59:36 | FromDiscord | <dayl1ght> disruptek: what is the right way? |
13:00:28 | * | brainbomb quit (Quit: Leaving.) |
13:07:18 | * | luis_ quit (Remote host closed the connection) |
13:07:49 | * | luis_ joined #nim |
13:12:49 | * | tdc quit (Ping timeout: 264 seconds) |
13:15:05 | * | haxscramper joined #nim |
13:16:44 | * | Senny joined #nim |
13:26:35 | * | luis_ quit (Ping timeout: 272 seconds) |
13:27:11 | FromDiscord | <willyboar> disruptek miss your streams |
13:40:35 | * | zacharycarter joined #nim |
13:45:54 | * | zacharycarter quit (Ping timeout: 240 seconds) |
13:48:38 | FromGitter | <zacharycarter> Meeee tooooo |
13:56:58 | * | filcuc joined #nim |
14:09:26 | disruptek | my creditors say they miss my checks. |
14:13:02 | * | Senny quit (Ping timeout: 260 seconds) |
14:13:32 | FromDiscord | <willyboar> creditor sucks |
14:13:44 | * | filcuc quit (Ping timeout: 256 seconds) |
14:14:48 | FromDiscord | <willyboar> I hope more nim jobs open in the next years |
14:15:30 | FromDiscord | <willyboar> (edit) 'creditor' => 'creditors' |
14:16:01 | * | filcuc joined #nim |
14:16:23 | * | Guest20166 is now known as dadada |
14:16:32 | dadada | hi people |
14:16:40 | dadada | case someString |
14:16:47 | dadada | of "case1": |
14:16:51 | dadada | of "case2": |
14:17:13 | FromDiscord | <Rika> ? |
14:17:16 | dadada | say I want of "foobar" to be case insensitive for all cases |
14:17:22 | dadada | is there a simple way to do this? |
14:17:31 | FromDiscord | <Rika> make it lowercase 😛 |
14:17:40 | disruptek | no, make it uppercase. |
14:17:47 | FromDiscord | <Rika> either works |
14:17:48 | FromDiscord | <Rika> ¯\_(ツ)_/¯ |
14:17:57 | dadada | oh my, I'm thinking entirely too complicated today |
14:18:09 | FromDiscord | <Rika> lmao thats fine |
14:18:34 | dadada | I have used this exact technique hundreds of times ... what's wrong with me |
14:19:04 | FromDiscord | <Rika> brains work in mysterious ways |
14:21:29 | * | bjornroberg joined #nim |
14:22:02 | Zevv | mine does not work at all today |
14:22:30 | FromDiscord | <willyboar> dadada does moe supports nim-suggestions and this kind of futures? |
14:24:10 | FromDiscord | <willyboar> by the way onivim is very cool for inspirations |
14:37:55 | dadada | is there an intersection version of the in operator? |
14:38:14 | dadada | when I have to containers and I want to see if any of their elements are the same? |
14:38:19 | dadada | to=two |
14:39:13 | dadada | willyboar: it's planned, there will be lsp support, so nimlsp will work |
14:39:50 | dadada | willyboar: onivim looked enticing to me, hopefully moe will take inspiration from everything that is good |
14:43:39 | FromDiscord | <Rika> dadada: for sets, yes |
14:50:51 | * | narimiran joined #nim |
14:56:01 | disruptek | set1 * set2 |
15:01:02 | * | Senny joined #nim |
15:17:49 | * | bung_ joined #nim |
15:20:47 | * | bung quit (Ping timeout: 246 seconds) |
15:21:07 | FromDiscord | <Technisha Circuit> Is there a way to compile multiple nim files into one file? |
15:21:27 | FromDiscord | <Technisha Circuit> Or a entire Nim library into one file preferably |
15:21:44 | FromDiscord | <Technisha Circuit> Like Dimscord for example |
15:21:49 | FromDiscord | <Rika> why |
15:22:07 | FromDiscord | <Rika> use `include` instead of `import` |
15:22:14 | * | ftsf quit (Ping timeout: 240 seconds) |
15:22:33 | FromDiscord | <Rika> but all nim libraries that arent dynamically loaded are already compiled to one file so i dont understand what you mean |
15:25:32 | FromDiscord | <Technisha Circuit> I want to make Dimscord available for Python and it'll be ideal if i can compile it into one file for Python |
15:26:05 | FromDiscord | <Rika> ??? |
15:26:32 | FromDiscord | <Rika> why do you want to make dimscord available for python when the costs of FFI might be just as high as using the actual python library |
15:30:20 | FromDiscord | <Technisha Circuit> I'm going to use Nimpy aswell and idk I'm bored |
15:30:28 | FromDiscord | <Technisha Circuit> Can you blame me for being bored af? |
15:30:39 | FromDiscord | <Rika> no but i can point out that what youre doing makes no sense |
15:30:52 | FromDiscord | <Technisha Circuit> Yuo |
15:30:54 | FromDiscord | <Technisha Circuit> Yup* |
15:33:19 | FromDiscord | <Recruit_main707> @itmuckel is your intellij support still actively developed? |
15:38:54 | * | PMunch joined #nim |
15:50:31 | * | waleee-cl joined #nim |
15:59:05 | FromDiscord | <KrispPurg> How would I convert an array of numbers to a byte string like in python `bytes([6, 6, 6])`? https://media.discordapp.net/attachments/371759389889003532/716682169854066689/unknown.png |
16:02:00 | * | nuxdie quit (Quit: Connection closed for inactivity) |
16:06:54 | leorize | no procs for that, but you can easily write one |
16:07:34 | leorize | var s: string; for i in <array of numbers here>: s.add chr(i) |
16:07:45 | leorize | `var s: string; for i in <array of numbers here>: s.add chr(i)` <- formatting for discord peeps |
16:16:58 | * | filcuc quit (Ping timeout: 258 seconds) |
16:35:09 | * | filcuc joined #nim |
16:37:44 | FromDiscord | <__ibrahim__> hello, noob question: when i write things like {.importc: "SDL_Init"} procs, where does nim look for required files (dlls)? |
16:37:54 | disruptek | cwd |
16:38:16 | FromDiscord | <__ibrahim__> but i have nothing in my cwd, and it just works |
16:39:16 | disruptek | you're loading the system's shared lib, i guess. |
16:39:41 | leorize | when you write something like that, nim doesn't look :P |
16:39:45 | PMunch | When you do `importc` it just tells Nim that "this comes from C code, just keep the name like this and don't worry about the implementation" so it's up to what the C compiler does and the flags you pass it how they get into your program. |
16:40:02 | disruptek | linux behavior of the dlopen is pretty lousy, honestly. |
16:40:35 | FromDiscord | <__ibrahim__> where are these paths defined? |
16:40:44 | disruptek | they aren't; that's the problem. |
16:40:53 | FromDiscord | <__ibrahim__> i should say that i have vcpkg installed |
16:41:14 | leorize | when you only write `{.importc.}`, nothing happens |
16:41:17 | leorize | you need more than that |
16:41:28 | FromDiscord | <__ibrahim__> i love that it just works, but i want to know how |
16:41:45 | FromDiscord | <__ibrahim__> proc init*(flags: uint32): cint {.importc: "SDL_Init", dynlib: libName.} |
16:41:59 | leorize | usually the libraries you use will use `{.dynlib.}`, which will tell Nim to use the system dynamic loader to load the specified library |
16:42:13 | FromDiscord | <__ibrahim__> const libname* = "libSDL2.dylib" |
16:42:28 | disruptek | oh, osx. |
16:42:30 | FromDiscord | <__ibrahim__> yes exactly, but im trying to find which dylib it's fetching |
16:42:38 | FromDiscord | <__ibrahim__> it should work on any os |
16:42:56 | leorize | it's magic :) |
16:43:08 | leorize | the system dynamic loader have a set of paths that it will try to look for |
16:43:10 | FromDiscord | <__ibrahim__> xD |
16:43:19 | FromDiscord | <Recruit_main707> you can do --nimcache:./cache and check the c code |
16:43:41 | leorize | you will only find dlopen() there :) |
16:44:03 | leorize | the behavior is os-dependant |
16:44:20 | FromDiscord | <__ibrahim__> the only reason i want to know is that what if i want to add more dlls |
16:44:44 | Zevv | right. on linux check "man dlopen" for the rules how it finds your lib |
16:44:52 | FromDiscord | <__ibrahim__> on my current os, its kind of a mess coz i installed dlls from multiple sources, so i dont know which one it is fetching |
16:44:52 | leorize | usually it's healthier to think "how can I reduce the amount of dll I have" :P |
16:45:15 | leorize | osx have DYLIB_LIBRARY_PATH env var |
16:45:21 | leorize | usually it looks via that |
16:45:32 | leorize | if it's unset then it looks at the system folders |
16:45:41 | leorize | but don't quote me on that, I don't use mac |
16:46:06 | Zevv | i love how araq is always cursing as a madman about linux dlls, distributions and packages. while in practice this has worked mostly just fine for me for the last 20 years |
16:46:28 | FromDiscord | <__ibrahim__> ok. how would you go about setting up a nim project that is dependent on some dlls |
16:46:39 | leorize | Zevv: well try to package a distribution, you will understand what he meant :P |
16:46:55 | Zevv | leorize: sure, but thats what debian is for, right :) |
16:47:08 | leorize | actually, try to generate a binary nim package for linux that will run everywhere :P |
16:47:32 | disruptek | actually, the problem is that nim doesn't use the shared library semantics that we use just about everywhere else in the os. |
16:47:34 | Zevv | I dont, there is just debian. |
16:47:58 | Zevv | i know perfectly well what ar4q means, but I choose not to make it my problem :) |
16:48:04 | leorize | :P |
16:48:37 | leorize | __ibrahim__: you, uh, just tell people to install the missing dlls into their system if they're on a sane os :P |
16:48:41 | disruptek | the fact is, my hardware is dogshit under windows and brilliant under linux. |
16:48:47 | disruptek | draw whatever conclusions you may. |
16:49:07 | FromDiscord | <__ibrahim__> lol i want to supply them with the dlls :D |
16:49:09 | leorize | I wouldn't say nouveau is an actual improvment :P |
16:49:42 | disruptek | tell me when microsoft reverse engineers an nvidia driver. |
16:49:48 | FromDiscord | <__ibrahim__> there is no such thing as a sane os? xD |
16:50:42 | FromDiscord | <__ibrahim__> leorize: LOL |
16:51:02 | leorize | well if you want to supply them with the dlls... yea you can't :P |
16:51:09 | Zevv | https://itvision.altervista.org/why.linux.is.not.ready.for.the.desktop.current.html |
16:51:14 | leorize | the mechanism differs between os |
16:51:16 | FromDiscord | <__ibrahim__> i cant put them next to the exe? |
16:51:26 | leorize | that's a windows thing :P |
16:51:39 | FromDiscord | <__ibrahim__> oh |
16:51:44 | * | solitudesf quit (Remote host closed the connection) |
16:52:03 | leorize | well you can |
16:52:07 | * | solitudesf joined #nim |
16:52:10 | leorize | it's not simple |
16:52:17 | FromDiscord | <__ibrahim__> i guess for macos, nim finds the homebrew installs ? |
16:52:24 | leorize | not always :) |
16:52:42 | FromDiscord | <__ibrahim__> xD |
16:52:58 | leorize | also Nim don't look around, it's your os :P |
16:53:14 | FromDiscord | <__ibrahim__> it doesnt look around, and i cant tell it where to look? |
16:53:15 | FromDiscord | <Recruit_main707> how will the new windows based on linux kernel affect things? |
16:53:16 | * | sagax joined #nim |
16:53:29 | leorize | they have that? |
16:53:37 | FromDiscord | <__ibrahim__> yes |
16:53:55 | leorize | well finally I will have more games on linux? :P |
16:53:57 | FromDiscord | <Recruit_main707> will dlls now be .so for instance? |
16:54:07 | leorize | probably not |
16:54:25 | leorize | where's the windows based on linux kernel news? I haven't seen it :o |
16:54:48 | FromDiscord | <Recruit_main707> let me see |
16:54:49 | FromDiscord | <__ibrahim__> WSL |
16:54:57 | FromDiscord | <Recruit_main707> ah :) |
16:54:59 | leorize | that's not windows based on linux kernel |
16:55:05 | FromDiscord | <__ibrahim__> https://docs.microsoft.com/en-us/windows/wsl/install-win10 |
16:55:16 | leorize | it's still the nt kernel underneath |
16:55:25 | FromDiscord | <__ibrahim__> oh maybe i missunderstood what @Recruit_main707 meant |
16:56:15 | leorize | WSL 1 is basically wine but the other way around |
16:56:31 | leorize | WSL 2 is "wine is hard so we virtualize instead" |
16:56:51 | FromDiscord | <__ibrahim__> leorize: so basically there is no "safe" way of installing dlls, you just need to tinker with it |
16:57:21 | leorize | welcome to the age old problem of dependency management :P |
16:57:27 | FromDiscord | <__ibrahim__> xD |
16:57:33 | FromDiscord | <__ibrahim__> im trying to run away from it :D |
16:57:39 | FromDiscord | <__ibrahim__> from c++ |
16:57:40 | leorize | the popular way out is to statically link everything |
16:57:57 | FromDiscord | <__ibrahim__> fat exe |
16:57:59 | leorize | you are gonna face it a lot, since you're interfacing with C code :P |
16:58:04 | FromDiscord | <Rika> dynamic linking hell |
16:58:43 | FromDiscord | <Rika> fat exe is preferred over "issues being opened because the dll is missing lmao" |
16:58:46 | leorize | you can use dlls too if you use some -rpath tricks |
16:58:50 | leorize | but yea fat exe is the best |
16:58:52 | leorize | it just works |
16:59:26 | leorize | ofc if you are a linux distribution then dlls is the best since you control every single dll |
17:00:17 | FromDiscord | <__ibrahim__> .so right? |
17:00:23 | leorize | yea |
17:00:43 | leorize | but unless you are a distribution (which you probably aren't), static linking is the best |
17:00:53 | leorize | unless that's not permitted by the license of your library |
17:01:11 | FromDiscord | <__ibrahim__> whats cool is that static and dynamic use the same workflow of {.importc.} right? |
17:01:20 | leorize | yea |
17:01:32 | FromDiscord | <__ibrahim__> so its easy to swap |
17:01:44 | leorize | --dynlibOverride lets you disable the dlopen() generation |
17:01:57 | leorize | so you can link however you want, just like with C code |
17:02:14 | disruptek | this hasn't been my experience. |
17:02:46 | FromDiscord | <__ibrahim__> build systems hell :D |
17:02:59 | FromDiscord | <__ibrahim__> so many hells |
17:03:03 | FromDiscord | <__ibrahim__> call back hell |
17:03:06 | FromDiscord | <__ibrahim__> micro service hell |
17:04:26 | FromDiscord | <__ibrahim__> what was your experience disruptek |
17:05:05 | disruptek | well, i cannot trivially link ssl/ssh statically. |
17:08:14 | * | filcuc quit (Ping timeout: 260 seconds) |
17:17:04 | disruptek | !last shashlick |
17:17:04 | disbot | shashlick spoke in 12#nim-offtopic 3 days ago |
17:17:12 | disruptek | you okay, buddy? |
17:20:46 | * | zacharycarter joined #nim |
17:24:49 | * | idf quit (Read error: Connection reset by peer) |
17:25:16 | * | narimiran quit (Ping timeout: 256 seconds) |
17:28:10 | * | solitudesf quit (Remote host closed the connection) |
17:28:24 | * | solitudesf joined #nim |
17:28:55 | disruptek | but what did he SAY? |
17:33:12 | * | zacharycarter quit (Ping timeout: 256 seconds) |
17:35:43 | bjornroberg | maybe this helps? https://irclogs.nim-lang.org/28-05-2020.html |
17:37:33 | leorize | lol gateway timeout |
17:39:00 | * | NimBot joined #nim |
17:43:28 | * | fredrikhr quit (Ping timeout: 256 seconds) |
17:55:06 | * | hyuke joined #nim |
17:58:21 | * | zacharycarter joined #nim |
18:03:50 | FromDiscord | <Technisha Circuit> How does include work and why/what cases would i use it over import? |
18:04:07 | leorize | include literally means include :P |
18:04:10 | * | Jjp137 quit (Read error: Connection reset by peer) |
18:04:15 | leorize | it read the entire file into your current module |
18:04:15 | FromDiscord | <Recruit_main707> include takes that file and slaps it in the otehr one |
18:04:22 | FromDiscord | <Technisha Circuit> O |
18:04:34 | FromDiscord | <Technisha Circuit> So what cases would i use it in? |
18:04:48 | Zevv | did mratsims raytracer make it to HN yet? |
18:04:49 | leorize | when you want to read a file directly into your current module :P |
18:04:55 | FromDiscord | <Technisha Circuit> Oh okay |
18:05:12 | leorize | Zevv: it hasn't even got to our frontpage :P |
18:05:44 | Zevv | it has not even been submitted to HN it seems :/ |
18:05:53 | Zevv | whos in charge of that? |
18:05:56 | Zevv | fire the bloke! |
18:06:02 | leorize | usually narimiran :P |
18:06:24 | * | hyuke quit (Quit: leaving) |
18:06:40 | Zevv | no wonder! fire the bloke! |
18:14:29 | Zevv | I shall take the liberty to do this now then. "Trace of Radiance - Faster and safer raytracing with Nim?" |
18:15:48 | * | Jjp137 joined #nim |
18:16:10 | Zevv | Wuha the guy embedded a h.264 encoder for animations |
18:16:33 | Zevv | We have our own Fabrice Bellard! |
18:20:31 | PMunch | https://peterme.net/using-nimscript-as-a-configuration-language-embedding-nimscript-pt-1.html |
18:20:40 | PMunch | https://peterme.net/how-to-embed-nimscript-into-a-nim-program-embedding-nimscript-pt-2.html |
18:20:42 | PMunch | Woop woop |
18:21:01 | Zevv | but why nimscript? |
18:21:02 | Zevv | why?! |
18:21:25 | Zevv | nice PMunch, nice. |
18:21:31 | PMunch | (For some weird reason my CMS really doesn't like the word "nimscript" in links, it converts it to "nimscxxxript", so all the links are broken..) |
18:21:43 | PMunch | Can't be arsed to figure out why atm |
18:21:47 | Zevv | haha that's pretty weird |
18:21:49 | PMunch | Zevv, read the first article ;) |
18:22:13 | PMunch | But I've gotta run |
18:22:14 | PMunch | bbl |
18:22:15 | * | PMunch quit (Quit: leaving) |
18:22:27 | Zevv | Well, I id. but now I can't read the 2nd. "nimscxxxript" page not found :) |
18:25:52 | Zevv | anyway, trace of radiance: https://news.ycombinator.com/item?id=23371434 |
18:34:11 | * | nphg joined #nim |
18:49:36 | * | PMunch joined #nim |
18:49:56 | PMunch | Zevv, I posted both links :P |
18:50:05 | Zevv | yeah I know :) |
18:50:19 | Zevv | just trolling |
18:50:19 | * | PMunch quit (Read error: Connection reset by peer) |
18:55:42 | FromDiscord | <dom96> Should have submitted that as a show hn |
18:58:37 | Zevv | sure, why not: https://news.ycombinator.com/item?id=23371721 |
18:58:45 | Zevv | it only had 1 point so resubmitted, just for you :) |
19:03:04 | FromDiscord | <__ibrahim__> This code works on mac, but gives `attempting to access nil` error on windows. https://media.discordapp.net/attachments/371759389889003532/716728474286555136/sdl2nimtest.7z |
19:04:05 | * | chemist69_ quit (Ping timeout: 246 seconds) |
19:05:16 | * | chemist69 joined #nim |
19:08:01 | FromDiscord | <Technisha Circuit> Is there an assembly compiler in Nim? |
19:08:11 | FromDiscord | <Technisha Circuit> Where I can't use Nim stuff |
19:10:12 | FromDiscord | <Rika> ? |
19:11:56 | * | krux02 joined #nim |
19:14:49 | disruptek | bjornroberg: you gave me a cute idea; thanks. |
19:14:54 | disruptek | !last zevv |
19:14:55 | disbot | Zevv spoke in 12#nim 16 minutes ago 12https://irclogs.nim-lang.org/31-05-2020.html#18:58:45 |
19:19:44 | leorize | @Technisha wdym? |
19:20:33 | FromDiscord | <Technisha Circuit> I want to compile assembly using Nim :p |
19:20:51 | FromDiscord | <Recruit_main707> written in Nim? |
19:21:06 | FromDiscord | <Recruit_main707> or compiling asm from within nim code |
19:21:55 | FromDiscord | <Technisha Circuit> Depends what you mean |
19:22:10 | FromDiscord | <Technisha Circuit> I want an asm compiler written in Nim so i assume the first one |
19:22:19 | FromDiscord | <Technisha Circuit> !last Technisha |
19:22:20 | disbot | Technisha never seen. |
19:22:35 | FromDiscord | <Technisha Circuit> !last Technisha Circuit |
19:22:36 | disbot | Technisha Circuit spoke in 12#nim 15 seconds ago 12https://irclogs.nim-lang.org/31-05-2020.html#19:22:19 |
19:22:42 | FromDiscord | <Technisha Circuit> Nice |
19:22:42 | Avatarfighter | Are you trying to compile ASM within nim code or using a compiler written in nim for assembly? |
19:22:57 | FromDiscord | <Recruit_main707> an assembler made in nim |
19:23:13 | FromDiscord | <Technisha Circuit> ^^^ |
19:23:18 | Avatarfighter | ohhhh |
19:23:24 | FromDiscord | <Rika> Y tho |
19:23:25 | FromDiscord | <Technisha Circuit> The latter for Avatar's question |
19:23:33 | FromDiscord | <Recruit_main707> > Y tho↵Y not |
19:23:40 | FromDiscord | <Technisha Circuit> ^^^ |
19:26:47 | FromDiscord | <Rika> Perhaps there is a more specific reason than just why not |
19:27:09 | FromDiscord | <Rika> And if not then ok |
19:27:25 | FromDiscord | <Recruit_main707> I also had a season obsessed with assemblers |
19:27:28 | FromDiscord | <Technisha Circuit> Just curious specifically |
19:27:31 | FromDiscord | <Technisha Circuit> Also, I can't be bothered trying to track down an assembler for Termux :P |
19:27:44 | FromDiscord | <Technisha Circuit> But more of me just being curious |
19:28:18 | FromDiscord | <Recruit_main707> anyone knows how to use cmake? |
19:30:11 | FromDiscord | <Technisha Circuit> I just do `cmake .` normally and it works :P |
19:30:22 | leorize | I'm pretty sure gas and nasm is available for termux |
19:30:26 | FromDiscord | <Technisha Circuit> But idk how to make something that uses Cmake to compile/build |
19:30:32 | FromDiscord | <Technisha Circuit> Lemme see |
19:30:47 | leorize | also clang have an integrated assembler |
19:31:20 | FromDiscord | <Technisha Circuit> I found yasm |
19:31:36 | Zevv | don't go cmake. it hurts. |
19:31:58 | FromDiscord | <Recruit_main707> its a sacrifice to get nim into https://github.com/google/flatbuffers |
19:41:11 | * | Senny quit (Ping timeout: 246 seconds) |
19:45:42 | FromDiscord | <Recruit_main707> is there a list of nim keywords? |
19:45:47 | FromDiscord | <treeform> can some one help me with this code? https://play.nim-lang.org/#ix=2nY6 |
19:45:53 | FromDiscord | <Recruit_main707> possibly sorted in a cpp array? :P |
19:45:56 | * | beatmox_ quit (Quit: ZNC 1.8.0 - https://znc.in) |
19:46:42 | * | beatmox joined #nim |
19:47:02 | * | qwertfisch_ joined #nim |
19:47:37 | FromDiscord | <Recruit_main707> found it |
19:47:45 | Zevv | doc/keywords.txt |
19:48:50 | FromDiscord | <Recruit_main707> @treeform cast seems to work |
19:49:00 | FromDiscord | <Recruit_main707> idk why it doesnt the other way though |
19:49:52 | * | qwertfisch quit (Ping timeout: 244 seconds) |
19:51:50 | FromDiscord | <treeform> you right cast does work |
19:51:52 | FromDiscord | <treeform> very strange! |
19:53:29 | Zevv | disruptek: zup |
19:53:54 | disruptek | just a test. |
19:53:58 | disruptek | what are you up to? |
19:54:06 | Zevv | iteration #3 |
19:54:11 | disruptek | beer? |
19:54:15 | Zevv | xfrms |
19:54:24 | disruptek | oh, way less interesting. 😁 |
19:54:38 | disruptek | how does it look? |
19:54:39 | * | tdc joined #nim |
19:54:43 | Zevv | crappy |
19:54:45 | Zevv | can't be done |
19:55:10 | disruptek | because of info loss? |
19:55:16 | Zevv | but I should be able to make something that works with caveats |
19:55:16 | Zevv | right |
19:55:26 | disruptek | did you push it? |
19:55:26 | Zevv | well, not "loss", but just not the right info there |
19:55:36 | leorize | treeform: https://play.nim-lang.org/#ix=2nYa |
19:55:42 | leorize | @treeform |
19:56:13 | Zevv | disruptek: nothing usable yet. Try #1 you saw yesterday I think, and #2 was never put in git |
19:57:11 | FromDiscord | <treeform> leorize, nice! |
19:57:13 | disruptek | i'm currently trying to figure out how to serialize self-referential objects, breaking them during write and restoring them during read. |
19:58:12 | Zevv | hm is that not solved in channels already? |
19:58:12 | FromDiscord | <treeform> like ones that have loops? |
19:58:32 | disruptek | is it? i thought channels was dead and buried. |
19:58:40 | * | haxscramper quit (Remote host closed the connection) |
19:58:45 | Zevv | oh I don't know actually. It's never clear to me what is and what isn't |
19:59:36 | disruptek | well, i will look at them. thanks for the tip. |
20:00:15 | * | qwertfisch_ is now known as qwertfisch |
20:01:08 | Zevv | well, it might *not* be solved there, but that would surprise me :) |
20:03:30 | disruptek | using a channel as my api is a brilliant idea, but other than that, i don't think it helps me. |
20:03:42 | Zevv | what is your problem |
20:03:52 | disruptek | i'm underemployed and underemployable. |
20:04:35 | Zevv | right, no channels helping there |
20:05:25 | disruptek | but it's still a super idea. |
20:06:00 | Zevv | not it's not |
20:06:08 | Zevv | https://nim-lang.github.io/Nim/channels.html |
20:06:12 | Zevv | note #3 on the top |
20:06:17 | Zevv | "Note: The current implementation of message passing does not work with cyclic data structures" |
20:06:24 | disruptek | i know. |
20:06:34 | disruptek | that's why i said it doesn't help. |
20:06:45 | Zevv | ah right |
20:06:49 | disruptek | but it actually does, because i can build my api around a channel. |
20:07:24 | disruptek | then you can transparently move your persistence to a thread, and anything that you currently move around via channels can be invisibly persisted. |
20:07:29 | disruptek | no additional code/api to learn. |
20:07:39 | Zevv | hm ok |
20:08:00 | disruptek | but, yeah, i still have to solve this problem. but now i have a new api to work with to do so. |
20:11:02 | Zevv | I did something similar ages ago in lua. If i remember correctly it was something like this |
20:11:12 | Zevv | - have a set of pointers of objects already serialized |
20:11:23 | Zevv | - have a ref ID counter, starting at 0 |
20:11:26 | Zevv | algo: |
20:11:40 | Zevv | - check if your object is already in the serialized set, if so, return |
20:11:53 | Zevv | - emit the sequence number and seralize the object |
20:11:58 | Zevv | - recurse through all its child refs |
20:12:24 | disruptek | this is almost exactly what i'm doing; only difference is that i don't use a counter -- i cast the memory address; it's a suitable unique identifier. |
20:12:25 | Zevv | - look up each address in the already serailized set. If the pointer is there, just note the id |
20:12:48 | Zevv | yeah but you can't just put it in an array easily |
20:12:54 | Zevv | but it's basically the same of course. |
20:13:02 | disruptek | the problem is only object self: ptr |
20:13:24 | disruptek | ie. an object that has a field pointing to itself. and i think i licked it. |
20:13:47 | Zevv | hm that wasn't really a problem for me. It's ref Id just points to its own Id. |
20:14:09 | disruptek | i was thinking i'd just detach it by simply not recursing with the right value. we'll see if this iteration works, first. |
20:14:45 | disruptek | its own id has been recorded but not actually written yet, so... |
20:15:14 | Zevv | yeah, that's your own fault |
20:15:22 | disruptek | lol maybe you're right. |
20:16:09 | disruptek | it's like i reversed it because i foresaw this comin'. |
20:16:48 | disruptek | but seriously... are we gonna make badges for fosdem2021 or won't it be held next year? |
20:17:42 | Zevv | well, given the state of the venue and the amount of people crammed in, I wouldn't be surprised if fosdem was an essential link in the chain of getting corona spread through europe |
20:18:08 | Zevv | I must say I did enjoy meeting the Nim folks and spending time in the Nim room, but there was a lot I hated there |
20:18:10 | disruptek | but i couldn't get sick there no matter how many toilet seats i licked. |
20:18:45 | disruptek | there's just so much to hate about belgium. |
20:18:51 | disruptek | let's be honest. |
20:18:54 | Zevv | licking toilet seats is generally safe - just don't lick the door knobs |
20:19:01 | disruptek | it's not like there's anyone listening. |
20:19:11 | Zevv | oh I'm fine with brussels and all |
20:19:49 | Zevv | but these *belgians* |
20:19:59 | disruptek | wimpy beer, huh |
20:20:09 | Zevv | no sir, nothing wrong with the beer sir |
20:21:04 | Zevv | but conference-wise, I'm not sure if I would attend again, or recommend to friends&family |
20:21:52 | disruptek | i would do it again to hang-out, if i'm not in jail then. |
20:23:10 | Zevv | we'll crowdfund bail for you, for the occasion |
20:24:03 | disruptek | awww you guys |
20:24:59 | disruptek | i think you just brought a tear to the eye of every agency reading my screen right now. |
20:25:38 | Zevv | you bet |
20:26:12 | disruptek | it's the kind of material that will play well at my trial. |
20:26:26 | disruptek | lord knows i need as much of it as i can get. |
20:27:05 | disruptek | i guess this code is working after all. |
20:27:17 | disruptek | it's just reads that need impl. |
20:27:28 | disruptek | but man, this channel idea is genius. |
20:28:43 | Zevv | i though channels was dead and buried |
20:28:52 | disruptek | right? |
20:28:56 | Avatarfighter | death never stops genius :P |
20:29:29 | Zevv | well, I'm off for an early night, next time you come up with a genius idea to fix my lambda lifting |
20:29:38 | disruptek | aight peace |
20:29:50 | Zevv | keep up the good work dude! |
20:31:14 | disruptek | hmm, an array. |
20:32:40 | disruptek | i'm using a table of address/pointer; i guess there's no advantage to switching. |
20:48:26 | * | bjornroberg quit (Quit: leaving) |
20:57:55 | * | tdc quit (Ping timeout: 246 seconds) |
21:04:55 | * | Trustable joined #nim |
21:05:17 | FromDiscord | <Clyybber> Araq: Isn't NRVO done after injectdestructors? |
21:20:32 | FromDiscord | <dom96> https://github.com/nim-lang/Nim/pull/14519 why though? |
21:20:33 | disbot | ➥ os module nodejs support |
21:21:46 | FromDiscord | <Rika> because nodejs supports os functionality? |
21:39:04 | bung_ | nimsl test against js backend ,dont know why it cant find jsos identifier |
21:41:00 | FromDiscord | <dom96> why target nodejs with Nim? |
21:42:27 | bung_ | just thought nim can compile to js , so |
21:45:15 | bung_ | and I want nimpretty to be a js module |
21:45:15 | FromDiscord | <dom96> Yes, for browsers |
21:45:28 | FromDiscord | <dom96> Nim can run natively on servers |
21:45:41 | FromDiscord | <dom96> so there is little reason to use nodejs |
21:46:08 | FromDiscord | <Rika> dom: why's -d:nodejs still exist then |
21:48:58 | FromDiscord | <dom96> so that Nim's JS backend can be tested in CI without depending on a browser |
21:50:06 | disruptek | that's ridiculous. |
21:50:16 | disruptek | it's useful to share logic between software with different backends. |
21:52:27 | bung_ | I would like to write program in Nim like I does in typescript not vanilla js |
21:55:10 | FromGitter | <sheerluck> disruptek as an american what are your feelings about today (SpaceX's Dragon + ISS)? |
21:55:31 | FromDiscord | <Rika> #nim-offtopic? |
21:55:55 | disruptek | i pray that a bus somehow finds a way to run over musk at least once between now and the end of the day. |
21:56:01 | * | solitudesf quit (Ping timeout: 246 seconds) |
21:56:28 | disruptek | if not a bus, maybe he can die in a fire somehow. |
21:56:51 | disruptek | radiation would be cool, too. |
22:00:41 | * | nphg_ joined #nim |
22:01:07 | Avatarfighter | The docking was super cool! |
22:02:05 | * | Trustable quit (Remote host closed the connection) |
22:03:59 | * | nphg quit (Ping timeout: 246 seconds) |
22:18:53 | skrylar[m] | drat. there's no way to reuse the futures in i/o loops is there |
22:19:02 | skrylar[m] | they dont take futurevars |
22:25:54 | * | dadada quit (Ping timeout: 240 seconds) |
22:27:49 | * | nphg_ quit (Ping timeout: 264 seconds) |
22:28:53 | * | dadada joined #nim |
22:29:16 | * | dadada is now known as Guest7896 |
22:29:52 | * | nphg_ joined #nim |
22:39:45 | FromDiscord | <dom96> You mean to avoid reallocating them? |
22:48:51 | * | oprypin quit (Quit: Bye) |
22:48:51 | * | nphg_ quit (Read error: Connection reset by peer) |
22:48:59 | * | oprypin joined #nim |
22:49:03 | * | nphg_ joined #nim |
22:53:07 | * | Guest7896 quit (Ping timeout: 265 seconds) |
22:55:47 | * | leorize quit (Remote host closed the connection) |
22:58:52 | * | dadada__ joined #nim |
22:59:23 | * | fredrikhr joined #nim |
22:59:27 | * | nphg1 joined #nim |
22:59:54 | * | nphg_ quit (Read error: Connection reset by peer) |
23:03:53 | * | lritter joined #nim |
23:04:37 | * | nphg1 quit (Ping timeout: 246 seconds) |
23:04:38 | Yardanico | leorize[m]: my PR doesn't fix all issues |
23:04:45 | Yardanico | see the comment I just posted about another case with phantom errors |
23:04:54 | Yardanico | I'll try test_lazytree.nim though |
23:04:59 | * | nphg1 joined #nim |
23:06:08 | leorize[m] | if you can, please add tests |
23:06:11 | Yardanico | yeah it's still not fixed |
23:06:33 | Yardanico | leorize[m]: after my PR I get this output for lazytree example https://play.nim-lang.org/#ix=2nZ5 |
23:06:46 | Yardanico | well yeah, there are nimsuggest tests but AFAIK they're not a part of the CI |
23:09:23 | leorize[m] | they are a part of ci |
23:09:30 | Yardanico | oh really? |
23:09:55 | leorize[m] | yea |
23:10:07 | * | nphg1 quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )) |
23:10:11 | leorize[m] | try to see how `compiles()` interact with nimsuggest chk |
23:10:42 | Yardanico | leorize[m]: error :) |
23:10:45 | Yardanico | for simple echo compiles(2 + "hello") |
23:10:53 | Yardanico | type mismatch |
23:10:58 | leorize[m] | that's your bug |
23:11:02 | Yardanico | :P |
23:11:22 | leorize[m] | fix that and it should solve the table issue |
23:11:28 | Yardanico | I'll try lol |
23:12:45 | Yardanico | leorize[m]: seems like this type mismatch comes from notFoundError in semcall.nim |
23:12:48 | Yardanico | line 276 |
23:13:28 | skrylar[m] | yes |
23:14:44 | skrylar[m] | @reallocting futures each recv |
23:16:40 | Yardanico | semOverloadedCall line 590 |
23:17:03 | Prestige | bung_: regarding running nodejs locally, why would you want to do that instead of running a program that was complied to a binary? Just trying to understand the use case |
23:17:13 | * | sschwarzer joined #nim |
23:17:44 | FromGitter | <sealmove> Hey, is there an exec in nimscript that returns the output? |
23:19:49 | skrylar[m] | Prestige: maybe they need to make a nodered module :) |
23:20:28 | FromDiscord | <Cut a weeb and a pedo bleeds> is there an alternative to system.marshal? |
23:20:37 | leorize[m] | Yardanico: https://github.com/nim-lang/Nim/blob/7ccc7d7e93e0fdfcf72aed239cf8b5d4c04e7de5/compiler/semexprs.nim#L2063 |
23:20:44 | FromDiscord | <Cut a weeb and a pedo bleeds> it doesn't work on javascript backend (intentionally) |
23:20:49 | Yardanico | yeah I found that one too :P leorize[m] |
23:20:56 | leorize[m] | Yardanico: probably you just need to remove the structuredErrorHook here before running the test semcheck |
23:21:00 | Yardanico | ohh |
23:21:46 | FromGitter | <PMunch> Disruptek, what kind of badges were you thinking of? |
23:21:56 | Yardanico | @PMunch btw we're fixing nimsuggest phantom errors :P |
23:22:12 | FromGitter | <PMunch> We were actually talking about making Nim shaped paper crowns :P |
23:22:40 | FromGitter | <PMunch> @Yardanico oh cool! Which ones are that? |
23:22:41 | sschwarzer | PMunch :-D |
23:22:48 | Yardanico | the one with tables comes fro nimsuggest not being able to compiles() |
23:22:52 | Yardanico | and another one https://github.com/nim-lang/Nim/pull/14526 |
23:22:55 | disbot | ➥ Change severity of template instantiation message ; snippet at 12https://play.nim-lang.org/#ix=2nZ8 |
23:22:58 | FromGitter | <PMunch> @Elegant Beef, did you see the articles? |
23:23:01 | Yardanico | basically template/generic instantiation was reported as an error |
23:23:05 | Yardanico | with severity of the error |
23:23:17 | leorize[m] | @Cut json.% |
23:23:30 | FromDiscord | <Elegant Beef> Did you at them to me? |
23:24:10 | FromGitter | <PMunch> Oh yeah, I've noticed that, was considering to hack it into NimLSP to stop them from being errors.. |
23:24:10 | FromGitter | <PMunch> Ah no, I forgot.. |
23:24:20 | Yardanico | well that one is a 1-line fix, the compiles issue is a bit harder :D |
23:24:40 | FromGitter | <PMunch> @Elegant beef, they are the two last ones on peterme.net |
23:24:42 | Avatarfighter | Does anyone know how to stop Httpclient socket handle leaks? |
23:24:49 | Yardanico | Avatarfighter: close httpclient? |
23:24:51 | Yardanico | instance |
23:24:59 | leorize[m] | it doesn't leak |
23:25:03 | FromGitter | <PMunch> Compiles error? |
23:25:10 | Yardanico | discard compiles(2 + "hello") |
23:25:16 | Yardanico | nimsuggest will report a type mismatch for this one |
23:25:20 | Yardanico | it affects tables module |
23:25:33 | leorize[m] | Yardanico: after that one you might be able to fix this one: https://github.com/alaviss/nim.nvim/issues/18 :P |
23:25:34 | disbot | ➥ Highlighting sometimes disappears |
23:25:37 | FromDiscord | <Cut a weeb and a pedo bleeds> leorize, last time I checked % doesn't serialize mutiple references to the same object as such |
23:25:54 | FromDiscord | <Cut a weeb and a pedo bleeds> then they are deserialized as different objects |
23:26:21 | Avatarfighter | I swear httpclient has a leak, I close my client after every use but after ~1000 requests I get similar issues as this https://github.com/nim-lang/Nim/issues/12381 |
23:26:23 | disbot | ➥ HttpClient socket handle leak ; snippet at 12https://play.nim-lang.org/#ix=2nZa |
23:26:37 | FromGitter | <PMunch> Yardanico , I see |
23:26:39 | FromDiscord | <dayl1ght> hey folks, I have repetitive code like this: https://play.nim-lang.org/#ix=2nZ9 |
23:26:39 | Avatarfighter | oh dang this bot is fancy |
23:27:03 | Yardanico | @dayl1ght use templates? |
23:27:06 | FromGitter | <PMunch> Avatarfighter, which one? Disbot? |
23:27:16 | FromDiscord | <dayl1ght> I'm trying to refactor it to use macros:https://play.nim-lang.org/#ix=2nZb |
23:27:20 | sschwarzer | Avatarfighter: yep! |
23:27:20 | FromDiscord | <Rika> use templates |
23:27:22 | Avatarfighter | PMunch: Disbot is fancy |
23:27:24 | Yardanico | I don't think macros are needed there |
23:27:27 | FromDiscord | <Rika> its easier for your use case |
23:27:30 | Yardanico | I think templates should be enough |
23:27:32 | FromDiscord | <Rika> macros are overkill |
23:27:46 | FromDiscord | <dayl1ght> hmm how can I do it with templates? I need a special case for when the operator passed to binrayOp is "/" |
23:28:05 | Yardanico | there's "when" statement |
23:28:05 | Yardanico | for compile-time if |
23:28:07 | FromDiscord | <dayl1ght> I'm also having trouble passing `op.strVal` to the string inside the quotation |
23:28:38 | FromDiscord | <Elegant Beef> Pmunch you really need to stop looking up porn when writting hyperlinks, from part 1 ↵`https://peterme.net/how-to-embed-nimscxxxript-into-a-nim-program-embedding-nimscxxxript-pt-2.html` |
23:28:50 | leorize[m] | we really need to remove `void` from the language |
23:29:00 | leorize[m] | people are doing `: void` too much :P |
23:29:05 | Yardanico | wonder why :P |
23:30:02 | FromGitter | <PMunch> @Elegant Beef, I don't know what happened there.. It's my CMS that kept changing them. I tried like 7 times to manually edit them back, but each time I saved them the links went like that... |
23:30:12 | FromDiscord | <Elegant Beef> Suuuuure |
23:30:39 | FromGitter | <PMunch> I have a theory that CouchCMS is after NimScript! |
23:30:46 | FromDiscord | <Rika> @dayl1ght https://play.nim-lang.org/#ix=2nZd i think works |
23:31:14 | FromGitter | <PMunch> But I'm tired after celebrating my birthday yesterday and just wanted to get these out so I could go do something else :P |
23:31:31 | leorize[m] | @Rika do `bindSym` on it |
23:31:56 | FromDiscord | <Rika> ¯\_(ツ)_/¯ |
23:32:01 | FromDiscord | <Rika> i dont know what that does |
23:32:04 | FromDiscord | <Cut a weeb and a pedo bleeds> @dayl1ght this should work, maybe https://play.nim-lang.org/#ix=2nZe |
23:32:48 | Yardanico | leorize[m]: well I mean I guess I did it, but I don't know if it's the right way |
23:32:59 | Yardanico | so basically I store the hook in a temp variable, set c.graph.config.structuredErrorHook to nil |
23:33:01 | FromDiscord | <dayl1ght> @Rika that does work, thanks! |
23:33:02 | Yardanico | and then in the end restore c.graph.config.structuredErrorHook |
23:33:05 | Yardanico | that way it works |
23:33:07 | Yardanico | :D |
23:33:12 | FromDiscord | <dayl1ght> @Cut a weeb and a pedo bleeds your solution works too, I didn't think of the nested template |
23:33:22 | FromDiscord | <dayl1ght> one thing that I'm confused about |
23:33:26 | Yardanico | ofc I do it under when defined(nimsuggest) |
23:33:29 | FromDiscord | <Rika> only issue for that other one is the string in the expression |
23:33:37 | FromDiscord | <dayl1ght> is in my macro I'm calling it with a string, e.g.: `binaryOp("+")` |
23:34:07 | * | krux02_ joined #nim |
23:34:20 | FromDiscord | <dayl1ght> if I call it with binaryOp(`+`) , what am I doing exactly? |
23:34:24 | FromDiscord | <dayl1ght> am I passing the identifier node to the macro? |
23:34:58 | FromDiscord | <dayl1ght> I meant ```↵binaryOp(`+`)↵```↵discord formatting is bad :p |
23:35:12 | FromDiscord | <Cut a weeb and a pedo bleeds> sure |
23:35:36 | Yardanico | leorize[m]: with my fix lazytree seems to work fine |
23:35:36 | FromDiscord | <Cut a weeb and a pedo bleeds> you could treeRepr(op) to see it |
23:35:36 | FromDiscord | <Rika> you're passing `AccQuoted(Ident +)` to the macro |
23:35:37 | FromDiscord | <Rika> assuming that its untyped |
23:35:38 | FromDiscord | <Cut a weeb and a pedo bleeds> `echo treeRepr(op)`, exactly |
23:35:51 | leorize[m] | Yardanico: looking at the git blame it seems like that should be the right fix |
23:35:56 | Yardanico | oh okay :) |
23:36:01 | Yardanico | I'll make a separate PR for this one I guess |
23:36:28 | FromDiscord | <Elegant Beef> Pmunch i do have to ask if there's a way we could clean up this to not be so boilerplatey |
23:36:28 | Yardanico | Need to figure out tests too |
23:36:28 | FromDiscord | <Rika> you can do treerepr to verify, but i think im right |
23:36:51 | leorize[m] | you can group them in one PR, except that the github flow is terrible and you can only review PRs, not commits :P |
23:36:58 | Yardanico | well I mean just to be safe |
23:37:01 | Yardanico | idk if it will break something |
23:37:06 | Yardanico | and easier to review |
23:37:07 | * | krux02 quit (Ping timeout: 260 seconds) |
23:37:08 | FromDiscord | <Elegant Beef> if you use `+` it'll be `ident "+"` if you use `"+"` it'll be a `stringLit "+"` |
23:37:20 | FromDiscord | <Elegant Beef> Atleast if i understood the question |
23:37:42 | FromDiscord | <dayl1ght> I don't think it's ident "+"? I can't call .strVala on it |
23:37:45 | FromDiscord | <dayl1ght> .strVal* |
23:37:55 | FromDiscord | <Rika> > you're passing `AccQuoted(Ident +)` to the macro↵(this is for ``` `+` ```) |
23:38:18 | FromDiscord | <Rika> you have to do theUntyped[0].strVal |
23:38:43 | FromDiscord | <Rika> since its wrapped in an AccQuoted |
23:38:43 | FromDiscord | <dayl1ght> ahh ok |
23:39:19 | FromDiscord | <dayl1ght> thanks everyone! |
23:39:19 | FromDiscord | <Cut a weeb and a pedo bleeds> AccQuoted seems like boilerplate :P |
23:39:42 | * | NimBot joined #nim |
23:39:42 | FromDiscord | <Rika> accent? |
23:39:58 | FromDiscord | <Rika> 😛 my guess was right |
23:40:01 | FromGitter | <PMunch> @Elegant Beef, what do you mean boilerplate-y? |
23:40:24 | FromDiscord | <Cut a weeb and a pedo bleeds> unexpected |
23:40:25 | FromDiscord | <Rika> its not beef who said that |
23:40:35 | FromDiscord | <Elegant Beef> I mean let's say you make your WM config with nims, there is going to be a large portion dedicating to setting up up procs and the like |
23:40:36 | FromDiscord | <Elegant Beef> I did |
23:40:39 | FromDiscord | <Rika> oh? |
23:40:42 | FromDiscord | <Rika> maybe i missed it lol |
23:40:45 | FromDiscord | <Elegant Beef> Was talking about nims -> nim |
23:40:49 | FromDiscord | <Elegant Beef> Nah earlier |
23:40:56 | FromDiscord | <Rika> cut's message overwrote my context! |
23:41:57 | FromGitter | <PMunch> @Elegant Beef, well that would be put in a library and either string concatenated onto the file or put in the stdlib you'll need to ship anyways. |
23:42:34 | FromDiscord | <dayl1ght> and if I want to make my macro more "type-safe", is that possible? e.g. can I emit a compile-time error if it's called with anything other than +, -, *, /? |
23:42:39 | FromGitter | <PMunch> So you won't see it in the actual config. The idea is that the config will end up looking like e.g. the .nimble files |
23:42:39 | Yardanico | yes |
23:42:48 | Yardanico | https://nim-lang.org/docs/macros.html#error%2Cstring%2CNimNode |
23:42:58 | FromDiscord | <dayl1ght> perfect |
23:43:02 | FromDiscord | <dayl1ght> thanks |
23:43:41 | FromDiscord | <Elegant Beef> Ah ok so we can abstract it away |
23:43:45 | FromDiscord | <Elegant Beef> That was my question |
23:43:52 | FromDiscord | <Elegant Beef> Cause this is just... interesting↵https://hatebin.com/wuvubukqrd |
23:44:17 | FromDiscord | <Elegant Beef> Well good stuff, do hope to find a place for this stuff |
23:46:18 | FromGitter | <PMunch> Oh right, yeah that kind of stuff would stay that way.. But that won't be in your config |
23:46:41 | FromDiscord | <Elegant Beef> Yea i got that now, i was worried it was going to be there |
23:46:47 | Avatarfighter | stupid question guys, in the uri module would this behavior be considered a bug https://play.nim-lang.org/#ix=2nZk |
23:46:52 | FromDiscord | <Elegant Beef> Seems like nimscript could be nice for game modding |
23:47:11 | FromDiscord | <dayl1ght> so another thing I don't understand (on a high level) are macros that change nim's syntax, e.g. sugar.`->` |
23:47:17 | FromDiscord | <dayl1ght> wouldn't (string) -> string be invalid for the nim parser? |
23:47:29 | FromDiscord | <dayl1ght> or does it build a valid AST for that |
23:47:39 | FromDiscord | <ThothLoki> Hey all. I am writing an app (sorry, don’t have code available right now as I am on mobile) and am using the nigui GUI module. I am trying to turn the text from a text box into a float variable. Does anyone have a code snippet I could reference? |
23:47:47 | FromDiscord | <Clyybber> it builds a valid ast |
23:47:56 | FromDiscord | <Clyybber> -> is an operator |
23:47:56 | Yardanico | @ThothLoki strutils.parseFloat(yourstring) |
23:48:11 | Yardanico | !eval import strutils; echo parseFloat("3.14") |
23:48:14 | NimBot | 3.14 |
23:48:21 | Yardanico | https://nim-lang.org/docs/strutils.html#parseFloat%2Cstring |
23:48:26 | FromDiscord | <ThothLoki> Will that handle jsonNode format as well? |
23:48:29 | Yardanico | no? |
23:48:33 | Yardanico | well I mean it's only for floats |
23:48:46 | Yardanico | if you want to get a float from json you need to use getFloat from json module for your JsonNode object |
23:49:02 | FromDiscord | <ThothLoki> I am also grabbing a number for on an API that returns in json |
23:49:13 | Yardanico | https://nim-lang.org/docs/json.html ? |
23:49:21 | Yardanico | see https://nim-lang.org/docs/json.html#overview-reading-values |
23:49:23 | FromDiscord | <ThothLoki> Ok. I will have to dig more. |
23:49:46 | FromDiscord | <dayl1ght> hmm. but wouldn't the parser try to create some kind of type node, not any node after `proc x(fn:`? |
23:49:59 | FromDiscord | <dayl1ght> if -> is an operator, that would be an expression node no? |
23:50:24 | FromGitter | <PMunch> @Elegant Beef, it could definitely be, but if performance is critical it's likely better to use a dynamic library approach. That gives you a much easier time with types as well.. |
23:50:34 | FromDiscord | <dayl1ght> I don't understand how the parser doesn't blow up on that |
23:50:51 | FromDiscord | <ThothLoki> Thanks Yardanico. Bookmarked those pages |
23:51:45 | leorize[m] | Avatarfighter: https://tools.ietf.org/html/rfc3986#section-3.1 |
23:52:05 | leorize[m] | not really a bug, the standard said the scheme can't contain spaces :P |
23:52:19 | Yardanico | leorize[m]: it's a bug that parseUri doesn't throw an exception :P |
23:52:31 | leorize[m] | why should it? |
23:52:40 | FromDiscord | <Elegant Beef> Yea pmunch i was more thinking of like two mod types low level and highlevel |
23:53:28 | FromDiscord | <Elegant Beef> Cause wouldnt dynamic libraries require relaunching? |
23:54:32 | FromGitter | <PMunch> Nope |
23:54:36 | FromDiscord | <Elegant Beef> Oh |
23:54:40 | Yardanico | leorize[m]: ok figured out how to add tests :P |
23:54:42 | FromDiscord | <Elegant Beef> Im just a numpty |
23:55:15 | bung_ | dayl1ght it's just strings |
23:55:33 | FromGitter | <PMunch> I'm going to bed now, I'll write up a NimScript vs. Sim dynamic library comparison as well |
23:56:46 | sschwarzer | Good night, PMunch :) |
23:56:56 | Yardanico | leorize[m]: https://github.com/nim-lang/Nim/pull/14527 |
23:56:58 | disbot | ➥ Fix `compiles` for nimsuggest |
23:57:17 | Yardanico | will add a test to my other PR too |
23:57:31 | * | ftsf joined #nim |
23:58:40 | FromDiscord | <Cut a weeb and a pedo bleeds> afaik none of the marshalling libraries work on js 😯 |
23:59:22 | leorize[m] | well json will always work |
23:59:23 | leorize[m] | marshall probably won't |
23:59:32 | leorize[m] | it relies on Nim RTTI, which I don't think we emit for js |