00:21:06 | FromDiscord | <auxym> In reply to @Isofruit "That might turn into": @40yd alternatives might also include object inheritance, simulating interfaces sort of like in std/streams, or closures |
00:24:35 | FromDiscord | <Patitotective> In reply to @Patitotective "i have this code": copying std/jsonutils worked :p↵couldnt copy josny (also jsony for some reason doesnt allow multiple discriminators) |
00:25:47 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dhN |
00:35:03 | FromDiscord | <Patitotective> jsony hooks look so copyable |
00:43:29 | * | droidrage joined #nim |
01:07:30 | FromDiscord | <Elegantbeef> `result = default(T)` |
01:07:34 | FromDiscord | <Elegantbeef> 😄 |
01:19:45 | FromDiscord | <Patitotective> In reply to @Elegantbeef "`result = default(T)`": huh↵now it warns the same but in `system.default` |
01:20:05 | FromDiscord | <Elegantbeef> No clue then |
01:20:37 | FromDiscord | <Patitotective> may be because of `range`s |
01:21:08 | FromDiscord | <Elegantbeef> Ah yea `when x is range: result = T.low` |
01:22:30 | * | xet7 quit (*.net *.split) |
01:22:31 | * | rez quit (*.net *.split) |
01:22:31 | * | genpaku quit (*.net *.split) |
01:22:31 | * | sagax quit (*.net *.split) |
01:22:31 | * | koltrast quit (*.net *.split) |
01:22:31 | * | dtomato quit (*.net *.split) |
01:22:31 | * | qwr quit (*.net *.split) |
01:22:31 | * | tk quit (*.net *.split) |
01:22:31 | * | ldlework quit (*.net *.split) |
01:22:31 | * | cornfeedhobo quit (*.net *.split) |
01:22:31 | * | Amun-Ra quit (*.net *.split) |
01:22:45 | * | qwr joined #nim |
01:23:09 | * | Amun-Ra joined #nim |
01:23:17 | * | genpaku joined #nim |
01:23:35 | * | dtomato joined #nim |
01:24:14 | * | tk joined #nim |
01:25:05 | * | hexeme joined #nim |
01:25:20 | * | koltrast joined #nim |
01:27:48 | * | arkurious quit (Quit: Leaving) |
01:31:18 | * | cornfeedhobo joined #nim |
01:49:45 | FromDiscord | <Patitotective> 🌃 |
02:14:34 | FromDiscord | <sOkam!> How can you write a Nim type into a string buffer byte by byte? |
02:14:41 | FromDiscord | <Elegantbeef> `copyMem` |
02:15:27 | * | Jjp137 quit (Quit: Leaving) |
02:16:03 | FromDiscord | <sOkam!> does copyMem allow starting at a certain position in the string? |
02:16:24 | FromDiscord | <Elegantbeef> Yes you'd do `copyMem(myStr[index].addr, myData.addr, sizeof(myData))` |
02:16:40 | FromDiscord | <sOkam!> tyty |
02:16:43 | FromDiscord | <Elegantbeef> This doesnt work for any type that has references of course |
02:16:57 | FromDiscord | <Elegantbeef> So like `string, seq, ref, ptr, pointer` or any types that build on those |
02:17:09 | FromDiscord | <sOkam!> oh |
02:17:15 | FromDiscord | <sOkam!> crap |
02:17:29 | FromDiscord | <Elegantbeef> To do that you need to use something like flatty or frosty |
02:17:58 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dhY |
02:18:12 | FromDiscord | <sOkam!> In reply to @Elegantbeef "To do that you": oh do you happen to know how to do it with flatty? I'm already using it |
02:19:25 | * | Jjp137 joined #nim |
02:20:29 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4di0 |
02:21:11 | FromDiscord | <Elegantbeef> `toFlatty` |
02:21:14 | FromDiscord | <Elegantbeef> Iirc |
02:21:18 | FromDiscord | <Elegantbeef> I now use frosty so dont recall |
02:33:51 | * | kenran joined #nim |
02:34:47 | * | kenran quit (Remote host closed the connection) |
02:36:55 | FromDiscord | <sOkam!> What does toFlatty do exactly? Just convert any type into a string? |
02:40:55 | FromDiscord | <Elegantbeef> Yes |
02:47:58 | FromDiscord | <sOkam!> Is there a way to not need to use `enumField.ord` for getting the index of an enum as a regular type? |
02:48:10 | FromDiscord | <Elegantbeef> "a regular type" |
02:48:16 | FromDiscord | <sOkam!> int or whatever |
02:48:28 | FromDiscord | <Elegantbeef> You mean as an integer, you can write a converter |
02:48:43 | FromDiscord | <sOkam!> kk |
02:51:19 | FromDiscord | <Elegantbeef> `converter toInt(myEnum: MyEnum): int = ord(myEnum)` |
03:18:02 | FromDiscord | <ChocolettePalette> How does this work? Does it just remove "to" from function name and converts your stuff to the type name left? |
03:18:17 | FromDiscord | <Elegantbeef> Converters are implicitly called |
03:24:37 | FromDiscord | <ChocolettePalette> Right, but is it some predefined set of converters like toInt, toString etc which you can overload, or some kind of metaprogramming magic which makes it possible to write converters for your own types to your own types? |
03:24:45 | FromDiscord | <Elegantbeef> No it's based off of return type |
03:27:37 | FromDiscord | <ChocolettePalette> So the name doesn't matter and I can write such converters to convert anything to anything else? |
03:27:42 | FromDiscord | <Elegantbeef> Yes |
03:27:52 | FromDiscord | <Elegantbeef> The name only matters if you want to explicitly call it |
03:27:59 | FromDiscord | <ChocolettePalette> Omg, that's so cool actually |
03:28:35 | FromDiscord | <sOkam!> agreed. but careful of hiding stuff with converters. might make the code hard to read if its not an obvious one |
03:29:01 | FromDiscord | <sOkam!> depends if you like abstracting away stuff, cpp style, or not. so more a style choice, probably |
03:38:30 | * | kenran joined #nim |
04:15:15 | * | kenran quit (Remote host closed the connection) |
04:37:25 | * | fallback quit (Ping timeout: 246 seconds) |
05:22:00 | * | fallback joined #nim |
05:31:25 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
06:10:23 | FromDiscord | <ringabout> It's weird that even I tried to switch to locally installed Nim, choosenim need to download dlls which blocks forever. |
06:10:30 | FromDiscord | <ringabout> https://media.discordapp.net/attachments/371759389889003532/1031086714237755503/unknown.png |
07:24:45 | * | xet7 joined #nim |
08:08:02 | FromDiscord | <FM> Could someone explain to me this sentence from the manual please?↵↵"A character literal that does not end in ' is interpreted as ' if there is a preceeding backtick token." |
08:09:59 | FromDiscord | <Elegantbeef> It's talking numerical/custom literal syntax |
08:10:08 | FromDiscord | <Elegantbeef> !eval echo 100'i32 |
08:10:15 | NimBot | 100 |
08:14:55 | FromDiscord | <FM> Thank you! |
09:02:12 | FromDiscord | <UrNightmaree> what's the best way to practice nim without doing `echo "Hello World!"` or things? |
09:02:40 | FromDiscord | <Rika> think of a project |
09:02:42 | FromDiscord | <Rika> a small one |
09:02:44 | FromDiscord | <Rika> work on that with nim |
09:03:01 | FromDiscord | <Rika> lets say oh i want to make a website; okay, what website? |
09:03:21 | FromDiscord | <Rika> perhaps a cache layer or maybe a quiz website or a blog |
09:03:39 | FromDiscord | <UrNightmaree> well that's too much for making website 💀 |
09:03:48 | FromDiscord | <UrNightmaree> maybe just some random parser? |
09:03:56 | FromDiscord | <Rika> sure |
09:03:59 | FromDiscord | <UrNightmaree> or just guess number |
09:04:00 | * | xet7 quit (Ping timeout: 264 seconds) |
09:04:02 | FromDiscord | <Rika> if thats your interest then thats good |
09:04:27 | FromDiscord | <Rika> i guess i start hard when moving languages :InaTehe: |
09:06:29 | * | xet7 joined #nim |
09:06:55 | * | kevinsjoberg joined #nim |
09:07:22 | FromDiscord | <FM> sent a long message, see http://ix.io/4diY |
09:08:35 | FromDiscord | <FM> Should it be written 0b10000000'i8 == 0x80'i8 == -128 instead? |
09:08:36 | FromDiscord | <Elegantbeef> `0x80` is only a single bit |
09:08:54 | FromDiscord | <Elegantbeef> single byte |
09:08:57 | FromDiscord | <ShalokShalom> In reply to @Rika "i guess i start": How often do you do that? |
09:08:59 | FromDiscord | <Elegantbeef> Cannot cause an overflow from a literal |
09:09:06 | FromDiscord | <ShalokShalom> You seem to be loyal to Nim for years |
09:09:09 | FromDiscord | <Rika> In reply to @ShalokShalom "How often do you": only rarely |
09:09:22 | FromDiscord | <Rika> ive only really switched from python then to nim then now im doing it with elixir |
09:09:38 | FromDiscord | <Rika> In reply to @ShalokShalom "You seem to be": only three years |
09:09:46 | FromDiscord | <Rika> it hasnt been that long yet |
09:10:00 | FromDiscord | <Rika> wow its been 3 years since 1.0 |
09:10:11 | FromDiscord | <ShalokShalom> Just checked out Elixir again, like the past hour |
09:10:21 | FromDiscord | <ShalokShalom> In reply to @Rika "wow its been 3": Yeah, bonkers |
09:10:25 | FromDiscord | <ShalokShalom> Time flies |
09:10:40 | FromDiscord | <ShalokShalom> Elixir is just too much noise (for me) |
09:10:46 | FromDiscord | <ShalokShalom> Nice language, otherwise |
09:10:50 | FromDiscord | <Rika> ive been enjoying it so far |
09:10:59 | FromDiscord | <Rika> it hasnt been noisy to me it seems |
09:11:04 | FromDiscord | <Rika> as in the language syntax |
09:11:59 | FromDiscord | <ShalokShalom> Well, Nim is much shorter |
09:12:06 | FromDiscord | <ShalokShalom> Despite being typed |
09:12:06 | FromDiscord | <FM> In reply to @Elegantbeef "Cannot cause an overflow": So shouldn't it be written "0b10000000'i8 == 0x80'i8 == -128" ? This is the part I don't get |
09:12:47 | FromDiscord | <FM> instead of `0b10000000'i8 == 0x80'i8 == -1` |
09:13:02 | FromDiscord | <Elegantbeef> !eval echo 0b10000000i8 |
09:13:07 | NimBot | -128 |
09:13:14 | FromDiscord | <Elegantbeef> !eval echo 0b10000000'i8 |
09:13:19 | NimBot | -128 |
09:13:26 | FromDiscord | <Rika> In reply to @ShalokShalom "Well, Nim is much": i guess so yes, but i like the features elixir gives, like the crazy amount of pattern matching |
09:13:44 | FromDiscord | <Rika> overloading on steroids |
09:13:45 | FromDiscord | <Rika> pretty cool |
09:14:25 | FromDiscord | <ShalokShalom> Mhn |
09:14:40 | FromDiscord | <ShalokShalom> I am very sensitive to syntax |
09:14:50 | FromDiscord | <ShalokShalom> Too much of it quickly overloads my brian |
09:14:52 | FromDiscord | <FM> Yes, I understand that `echo 0b10000000i8` prints out -128.↵So this means that it was a typo in the manual? |
09:15:01 | FromDiscord | <ShalokShalom> (edit) "brian" => "brain" |
09:15:07 | FromDiscord | <FM> https://media.discordapp.net/attachments/371759389889003532/1031133176334127104/unknown.png |
09:15:14 | FromDiscord | <Rika> im sensitive in a different way, if i do not like it then i cannot make myself like it |
09:15:24 | FromDiscord | <ShalokShalom> Yeah, same. |
09:15:31 | FromDiscord | <ShalokShalom> I often try hard. |
09:15:35 | FromDiscord | <Elegantbeef> Likely |
09:15:50 | FromDiscord | <Elegantbeef> 'PRs welcome' is what i'll say |
09:16:07 | FromDiscord | <Rika> they accidentally forgot twos complement i guess lol |
09:16:14 | FromDiscord | <ShalokShalom> @FM Nim's best error messages are the community↵↵Nim's best tutorials are the community |
09:16:36 | FromDiscord | <ShalokShalom> Those two things, I still struggle to find differently. |
09:17:22 | FromDiscord | <ShalokShalom> Is there testing, or proof reading going on for documentation? |
09:17:34 | FromDiscord | <FM> In reply to @Elegantbeef "Likely": Thank you |
09:18:13 | FromDiscord | <Elegantbeef> The manual is untested as it's mostly human written documentation to convey the loose definition of Nim |
09:18:15 | FromDiscord | <Elegantbeef> There is proper testing for module documentation |
09:39:15 | * | xet7 quit (Ping timeout: 248 seconds) |
09:43:13 | * | xet7 joined #nim |
10:05:53 | FromDiscord | <Rika> In reply to @ShalokShalom "You seem to be": well, there isnt really anything that can replace it for me, but ive kind of been growing discontent with it i guess |
10:43:01 | * | xet7 quit (Ping timeout: 268 seconds) |
10:51:47 | * | jmdaemon quit (Ping timeout: 248 seconds) |
10:53:15 | FromDiscord | <FM> Does anyone else also get hundreds of nimsuggest.exe process? I use VS Code with nimsaem's extension https://media.discordapp.net/attachments/371759389889003532/1031157869791412274/unknown.png |
10:56:31 | FromDiscord | <baalajimaestro> Lemme check |
10:56:59 | FromDiscord | <FM> I had 1000+ |
10:59:21 | FromDiscord | <baalajimaestro> image.png https://media.discordapp.net/attachments/371759389889003532/1031159407259684904/image.png |
10:59:35 | FromDiscord | <baalajimaestro> just having 2 processes of nimsuggest |
11:03:03 | * | PMunch joined #nim |
11:03:36 | FromDiscord | <FM> 😢↵i'll try to find the source of the issue https://media.discordapp.net/attachments/371759389889003532/1031160474022187038/unknown.png |
11:06:10 | FromDiscord | <FM> It seems to only happen if I work on a single file |
11:06:28 | FromDiscord | <FM> If I open the folder in VS code and work on a nim file, there is no issue |
11:06:46 | PMunch | Do you use NimLSP? |
11:07:11 | FromDiscord | <FM> I use this extension: https://media.discordapp.net/attachments/371759389889003532/1031161375780765706/unknown.png |
11:07:23 | PMunch | So no |
11:07:34 | PMunch | It could be a project-root detection issue |
11:08:34 | PMunch | nimsuggest needs to be provided with the root of the project. It could be that that plug-in isn't able to automatically detect the project root and therefore keeps spinning up nim nimsuggest processes |
11:08:49 | FromDiscord | <FM> I remember this thread:↵https://forum.nim-lang.org/t/9499 |
11:09:39 | FromDiscord | <FM> it's a related problem, it gave me the "workaround" |
11:16:11 | PMunch | Ah yes, so it seems to be what I said, project folder detection gone awry |
11:21:39 | FromDiscord | <Bung> that's sad , after years still have problem with that. |
11:32:45 | FromDiscord | <40yd> sent a code paste, see https://play.nim-lang.org/#ix=4djG |
11:40:37 | PMunch | I don't think so. And I'm having a hard time to reason about how such a thing would even be implemented |
11:51:25 | FromDiscord | <40yd> sent a code paste, see https://play.nim-lang.org/#ix=4djJ |
12:10:17 | FromDiscord | <vestel> how nim's linter is called? |
12:19:13 | FromDiscord | <sOkam!> When should I use `doAssert` instead of `assert`?↵I have read the documentation, asking about practical used for when its best to use one or the other |
12:19:24 | FromDiscord | <sOkam!> (edit) "used" => "uses" |
12:20:33 | FromDiscord | <Bung> `assert` when u want debug |
12:21:05 | FromDiscord | <sOkam!> doesnt doAssert do debugging too? |
12:21:23 | FromDiscord | <sOkam!> aren't they both debugging tools in essence? |
12:21:26 | FromDiscord | <Bung> assert is removed after release your program |
12:22:00 | FromDiscord | <sOkam!> yeah, I understood that part. which is why I asked to begin with |
12:24:07 | FromDiscord | <Rika> In reply to @sOkam! "doesnt doAssert do debugging": It can also be used for validation |
12:24:14 | FromDiscord | <Rika> Though I wouldn’t recommend it personally |
12:26:56 | FromDiscord | <sOkam!> For example, I saw some glfw and opengl examples that used both `doAssert glfwInit()` and `assert glfwInit()`↵Different examples used different assertion types, even for the same function. So made me wonder why even use one or the other to begin with |
12:27:16 | FromDiscord | <Rika> Probably unintentional |
12:28:03 | FromDiscord | <sOkam!> In reply to @Rika "It can also be": What happens if a production app hits a doAssert? Does it just stop working? |
12:28:25 | FromDiscord | <Rika> It raises an assertion error which I think is a defect too so yes in some cases |
12:33:47 | * | arkurious joined #nim |
13:43:53 | * | estiquelapice quit () |
13:45:05 | * | estiquelapice joined #nim |
13:46:14 | * | xet7 joined #nim |
13:46:49 | * | xet7 quit (Remote host closed the connection) |
13:47:03 | * | xet7 joined #nim |
14:42:40 | * | vicecea quit (Remote host closed the connection) |
15:08:51 | * | krux02 joined #nim |
15:12:42 | FromDiscord | <vestel> how do I get all identifiers exported by module in macro? |
15:17:49 | * | krux02 quit (Remote host closed the connection) |
15:18:32 | * | krux02 joined #nim |
15:33:47 | * | vicecea joined #nim |
15:50:54 | * | rwb is now known as rb |
16:18:08 | PMunch | @vestel, that's not (trivially) possible |
16:18:21 | FromDiscord | <vestel> In reply to @PMunch "<@961348955080388659>, that's not (trivially)": Ye I see |
16:18:33 | FromDiscord | <vestel> took different approach |
16:21:03 | * | al1ranger joined #nim |
16:21:57 | * | al1ranger quit (Client Quit) |
17:26:44 | FromDiscord | <vestel> Can I just print code generated by macros and not compile it? |
17:28:24 | FromDiscord | <Patitotective> In reply to @vestel "Can I just print": `--expandMacro:MACRO dump every generated AST from MACRO` |
17:28:38 | FromDiscord | <Patitotective> you have to compile it afaik |
17:28:42 | FromDiscord | <Patitotective> (edit) "you have to compile it ... afaik" added "though" |
17:29:06 | FromDiscord | <Patitotective> (edit) "you" => "compile with the above (you" | "though afaik" => "though)" |
17:29:27 | FromDiscord | <Patitotective> you can also `echo repr result` at the end of the macro |
17:30:50 | FromDiscord | <vestel> In reply to @Patitotective "you can also `echo": Yeah, that works. Thanks! |
17:31:01 | FromDiscord | <Patitotective> :] |
17:44:34 | FromDiscord | <Horizon [She/Her]> `literal: string | float64` isn't possible, is there a way to do something similar? Because I don't want to make it so you do `MyType[T](literal: literal)` since then I'd imagine I won't be able to have a list of tokens with different literal types |
17:47:11 | FromDiscord | <vestel> In reply to @Event Horizon "`literal*: string | float64`": ref objects + methods? |
17:47:31 | FromDiscord | <Patitotective> In reply to @Event Horizon "`literal*: string | float64`": object variants? |
17:47:50 | FromDiscord | <vestel> In reply to @Patitotective "object variants?": ye, like nimnodes do |
17:49:47 | FromDiscord | <Horizon [She/Her]> Ah alright |
18:00:41 | FromDiscord | <d4rckh> went back to an older nim project where i use asynchttpserver |
18:00:53 | FromDiscord | <d4rckh> it didnt cause problems before but now it does |
18:00:54 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=4dlR |
18:00:58 | FromDiscord | <d4rckh> it complains that cb is not gcsafe |
18:01:04 | FromDiscord | <d4rckh> (edit) "it complains that ... cbpro" added "the" | "thecb ... is" added "pro" |
18:01:06 | FromDiscord | <d4rckh> (edit) "pro" => "proc" |
18:01:27 | FromDiscord | <d4rckh> did anything change? |
18:06:17 | FromDiscord | <System64 ~ Flandre Scarlet> Hi, is there a way to make that kind of GUI on Nim please? https://media.discordapp.net/attachments/371759389889003532/1031266848685162496/unknown.png |
18:16:12 | FromDiscord | <Patitotective> In reply to @System64 "Hi, is there a": should be able to do it on imgui (https://github.com/nimgl/nimgl) by using the draw list (or if you mind wrapping https://github.com/thedmd/imgui-node-editor)↵i guess you can also do it with wxwidgets (https://github.com/PMunch/wxnim) by manually drawing things with `wxGraphicsContext` https://forums.wxwidgets.org/viewtopic.php?t=47474 |
18:17:40 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Patitotective "should be able to": and is that something that is hard to do? Also, what is a Draw List? |
18:19:37 | FromDiscord | <Patitotective> In reply to @System64 "and is that something": you would have to know imgui really well↵a draw list is imgui's way of custom drawing |
18:19:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Patitotective "you would have to": Ah, I don't know imgui at all :/ |
18:20:41 | FromDiscord | <Patitotective> its not that hard↵take a look at https://github.com/Patitotective/ImTemplate https://github.com/Patitotective/ImDemo↵https://nimgl.dev/docs/imgui.html#addRect%2Cptr.ImDrawList%2CImVec2%2CImVec2%2Cuint32%2Cfloat32%2CImDrawCornerFlags%2Cfloat32 |
18:21:06 | FromDiscord | <Patitotective> https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html (cpp though its easily translatable to nim) |
18:21:40 | FromDiscord | <Patitotective> can also try wrapping https://github.com/thedmd/imgui-node-editor |
18:23:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Patitotective "can also try wrapping": Can Futhark do its job for wrapping this? |
18:24:08 | * | ephaptic joined #nim |
18:24:13 | PMunch | Futhark can't do C++ (yet) |
18:24:44 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright, thanks |
18:25:10 | PMunch | Hmm, this is suuper weird.. |
18:25:41 | PMunch | I compare a int32 number to the value 25000. It says that it is always higher than that. But if I print it out, it is 17000.. |
18:26:31 | FromDiscord | <Patitotective> `25000i32` :P |
18:26:33 | FromDiscord | <Patitotective> (edit) ":P" => ":p" |
18:27:34 | PMunch | Looking at the C code it does that conversion.. |
18:28:06 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Patitotective "can also try wrapping": And I need to wrap all this stuff? https://media.discordapp.net/attachments/371759389889003532/1031272336093085807/unknown.png |
18:28:56 | NimEventer | New thread by Aetopia: Using Multi file select with wNim's File Dialog returns an empy sequence., see https://forum.nim-lang.org/t/9533 |
18:29:51 | FromDiscord | <Patitotective> you can try looking for an imgui node editor that uses cimgui and try the same that nimgl does for wrapping cimgui itself (maybe futhark would even work) |
18:30:30 | FromDiscord | <System64 ~ Flandre Scarlet> what is cimgui? C implementation of imgui? |
18:30:42 | FromDiscord | <Patitotective> yes |
18:31:39 | FromDiscord | <Patitotective> https://github.com/cimgui/cimnodes |
18:31:53 | FromDiscord | <System64 ~ Flandre Scarlet> Lol I just found the same thing |
18:43:20 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4dm1 |
18:44:01 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4dm1" => "https://play.nim-lang.org/#ix=4dm2" |
18:44:51 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4dm2" => "https://play.nim-lang.org/#ix=4dm3" |
18:45:10 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4dm3" => "https://play.nim-lang.org/#ix=4dm4" |
18:46:33 | FromDiscord | <hovsater> sent a code paste, see https://play.nim-lang.org/#ix=4dm5 |
18:46:57 | FromDiscord | <hovsater> (edit) "https://play.nim-lang.org/#ix=4dm5" => "https://play.nim-lang.org/#ix=4dm6" |
18:47:07 | FromDiscord | <hovsater> (edit) "https://play.nim-lang.org/#ix=4dm6" => "https://play.nim-lang.org/#ix=4dm7" |
18:47:24 | FromDiscord | <hovsater> (edit) "https://play.nim-lang.org/#ix=4dm7" => "https://play.nim-lang.org/#ix=4dm8" |
18:48:00 | FromDiscord | <hovsater> (edit) "https://play.nim-lang.org/#ix=4dm8" => "https://play.nim-lang.org/#ix=4dm9" |
18:50:17 | FromDiscord | <Phil> If you have a distinct type alias, any proc defined for the original will not work with the type alias unless it has its own proc with the same name (which may be borrowed from the original).↵Could be the author wasn't aware that Port has its own stringification proc, if that works it's all good anyway, the uint16 just "converts" the Port-variable into a uint16 type for the stringifier proc |
18:52:10 | FromDiscord | <hovsater> @Phil right got it. So it works in this case due to https://nim-lang.org/1.4.8/nativesockets.html#%24%2CPort. |
18:52:15 | FromDiscord | <Phil> I mean, it could also be for example that the Port specific proc is defined as `proc $(x: Port): string = "Port " & $x.uint16` , which you wouldn't want in this scenario. |
18:52:28 | FromDiscord | <hovsater> If this wasn't defined, casting it to `uint16` would help as `$` is defined for that type? |
18:52:42 | FromDiscord | <Phil> Correct |
18:52:56 | FromDiscord | <hovsater> Got it. Thanks for the explanation. 👍 |
18:52:59 | FromDiscord | <Phil> What you see in that part of the code is the type alias "borrowing" the original `$` proc from uint16 |
18:54:29 | PMunch | Figured out it was me using snprintf wrong.. |
18:54:37 | PMunch | But Nims $ got it wrong as well.. |
18:54:48 | PMunch | But now everything works! |
18:55:03 | PMunch | I'm able to run a BME280 on an Attiny85 with pure Ratel code! |
18:55:10 | FromDiscord | <hovsater> I have another question, while I'm at it. `HttpStatus` is a type defined as a range from 0 to 599. That's all fine. But then there's constants like `Http200` that are defined as ` Http200 = HttpCode(200)`. What does this mean? Is `Http200` a type or a value here? Both? |
18:55:21 | FromDiscord | <hovsater> (edit) "`HttpStatus`" => "`HttpCode`" |
18:55:42 | FromDiscord | <hovsater> (edit) "599." => "599 (https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/httpcore.nim#L26)." |
18:59:34 | FromDiscord | <Phil> In reply to @hovsater "I have another question,": HttpCode is the type as in "I can be any value between 0 and 599".↵That's just a type definition, not an actual instance or value of anything.↵`Http200 = HttpCode(200)` is for convenience, if you want to have an `Http200` you can't just pass in `200` into a proc that expects an `HttpCode` instance.↵It's a distinct range, you need to convert the number 200 first into the type `HttpCod |
19:00:42 | FromDiscord | <Phil> And doing the conversion of 200 to `HttpCode(200)` (or various other ways as nim supports a lot of different syntax variations) is very annoying, thus these shortcuts for convenience |
19:00:47 | FromDiscord | <hovsater> Got it. So `Http200` is an actual value here (200) but conforming to the type `HttpCode`. `HttpCode` is a type as in something I can annotate my procs with. |
19:00:57 | FromDiscord | <Phil> In reply to @hovsater "Got it. So `Http200`": Correct |
19:03:18 | FromDiscord | <hovsater> I must say, I've been doing Nim for about two hours now, and I'm already productive. I have an HTTP server going, I render HTML and I'm about to look into getting some JS on the screen (written in Nim of course). That's pretty dang sweet! 🙂 |
19:07:13 | FromDiscord | <Phil> In reply to @hovsater "I must say, I've": If you're checking out webdev, taken a look at Jester and/or Prologue yet?↵They're pretty much the 2 backend frameworks around (I've heard of nexus being in development, but no idea how far it is).↵For frontend there's karax if you want SPA or nimja if you want Server Side Rendering |
19:08:06 | FromDiscord | <Phil> Jester e.g. starts you up a webserver with ridiculously few lines of code (due to some macro magic that you need to be aware about to use properly) |
19:08:18 | FromDiscord | <Phil> (edit) "about" => "off" |
19:08:21 | FromDiscord | <Phil> (edit) "off" => "of" |
19:09:00 | FromDiscord | <hovsater> In reply to @Isofruit "If you're checking out": Cool. I'll definitely look into those later! I tend to explore languages by basically writing as much as possible myself to really learn the ins and outs of the language. 🙂 |
19:21:23 | * | PMunch quit (Quit: leaving) |
19:23:36 | * | wallabra quit (Ping timeout: 260 seconds) |
19:24:02 | * | wallabra joined #nim |
19:30:53 | * | wallabra quit (Ping timeout: 268 seconds) |
19:32:12 | FromDiscord | <vestel> Why does macro prints its output as ast repr when added NimNode return type? |
19:33:37 | FromDiscord | <Patitotective> In reply to @vestel "Why does macro prints": example? |
19:33:47 | FromDiscord | <Patitotective> In reply to @hovsater "I must say, I've": thats how nim is :] |
19:34:13 | FromDiscord | <vestel> In reply to @Patitotective "example?": my example is too huge to provide (14k > lines printed) |
19:34:25 | FromDiscord | <vestel> (edit) ">" => "<" |
19:34:44 | FromDiscord | <vestel> but i think it works with any macro |
19:35:47 | FromDiscord | <Patitotective> In reply to @vestel "but i think it": example? |
19:42:22 | FromDiscord | <jos> choosenim installed the amd64 version of nim on my m1 mac and it's messing up a bunch of FFI stuff |
19:42:33 | FromDiscord | <jos> i noticed the choosenim install script doesn't support arm |
19:42:45 | FromDiscord | <jos> is there some way to get choosenim working with arm64, even if you have to build from source |
19:50:01 | FromDiscord | <auxym> In reply to @jos "is there some way": https://github.com/dom96/choosenim/issues/149 |
19:50:35 | FromDiscord | <jos> i did see that, was wondering if there was a workaround |
19:50:49 | FromDiscord | <FM> sent a code paste, see https://play.nim-lang.org/#ix=4dmp |
19:51:56 | FromDiscord | <jos> what error do you get? |
19:52:59 | FromDiscord | <FM> `Error: execution of an external program failed: 'pathToMyFolder\test2.exe ' |
19:55:17 | FromDiscord | <FM> ah this does compile, but the .exe can't be run |
19:55:40 | FromDiscord | <jos> maybe your stack size is too small, that's the only thing i can think of |
19:56:36 | FromDiscord | <jos> the MSVC default is 1mb, and since nim compiles to C and uses MSVC on windows, probably that |
19:59:08 | FromDiscord | <auxym> 510 int64's works out to only 4kb though. but yeah I also don't see another reason it would crash |
19:59:36 | FromDiscord | <auxym> though nim uses mingw64 (aka gcc) by default on windows I think |
19:59:40 | FromDiscord | <FM> tried this on 2 Windows 10 laptops, both crash (the other crashes at 509) |
20:01:04 | FromDiscord | <FM> i'll install Nim on WSL and try again |
20:01:22 | FromDiscord | <auxym> which C compiler are you using on windows? and which version of nim? |
20:02:33 | * | ephaptic quit (Quit: WeeChat 3.7) |
20:02:56 | FromDiscord | <FM> Nim version 1.6.8 |
20:03:38 | FromDiscord | <FM> and I'm pretty sure the C compiler is MinGW (but where can I check to be sure of that?) |
20:05:19 | FromDiscord | <FM> I used choosenim to install nim |
20:07:31 | FromDiscord | <auxym> you can compile with `--verbosity:2` to output the full C compiler command line |
20:11:10 | FromDiscord | <FM> ok it's MinGW |
20:11:14 | FromDiscord | <FM> it says gcc.exe |
20:12:01 | FromDiscord | <FM> and I have this in my choosenim installation folder https://media.discordapp.net/attachments/371759389889003532/1031298487712747640/unknown.png |
20:17:04 | * | disso_peach quit (Quit: Leaving) |
20:27:08 | FromDiscord | <jos> In reply to @auxym "510 int64's works out": isn't it 510510 int32s |
20:27:11 | FromDiscord | <jos> which is 1mb |
20:27:29 | FromDiscord | <auxym> oh yeah |
20:27:32 | FromDiscord | <auxym> missed that |
20:27:37 | FromDiscord | <FM> On WSL, it crashes at a==1024 |
20:27:49 | FromDiscord | <FM> with the gcc compiler |
20:28:05 | FromDiscord | <auxym> see https://stackoverflow.com/questions/156510/increase-stack-size-on-windows-gcc |
20:28:12 | FromDiscord | <FM> Segmentation fault |
20:28:25 | FromDiscord | <jos> Jesus, the default stack size is 8mb on most Linux distros |
20:28:30 | FromDiscord | <jos> what do you aim to achieve FM? |
20:28:34 | FromDiscord | <Elegantbeef> `--passC:"--stack, 321321321321321"` |
20:28:37 | FromDiscord | <jos> at some point you're going to overflow the stack |
20:28:56 | FromDiscord | <jos> do you want to allocate your array on the heap instead? |
20:29:05 | FromDiscord | <FM> I'm just trying to have an array like a numpy array |
20:29:07 | FromDiscord | <Elegantbeef> Anywho yea heap is better |
20:29:14 | FromDiscord | <FM> and work on it |
20:29:33 | FromDiscord | <Elegantbeef> `var a = new array[a, array[a, T]]` |
20:29:45 | FromDiscord | <Elegantbeef> This heap allocates it which is how you should do it for something this large |
20:29:45 | FromDiscord | <auxym> In reply to @Elegantbeef "`--passC:"--stack, 321321321321321"`": wouldn't that be passL? |
20:29:58 | FromDiscord | <Elegantbeef> No clue auxym i dont know C compilers |
20:30:03 | FromDiscord | <Elegantbeef> I barely know Nim's compiler |
20:30:13 | FromDiscord | <auxym> so you pretend 😉 |
20:31:26 | FromDiscord | <Elegantbeef> Eh i'm still fighting implementing `toOpenArray` in the VM so who knows what i know |
20:32:07 | FromDiscord | <FM> In reply to @jos "do you want to": Yes I think that was my problem, thank you |
20:32:31 | FromDiscord | <Elegantbeef> Heap allocated types are nilable so be conscious of that |
20:33:25 | FromDiscord | <FM> sent a code paste, see https://play.nim-lang.org/#ix=4dmE |
20:33:34 | FromDiscord | <Elegantbeef> Yes `T` is the type you want |
20:33:40 | FromDiscord | <Elegantbeef> so if you want `int` you put `int` there |
20:33:51 | FromDiscord | <Elegantbeef> also you want `freq = new array[a, array[a, int]` |
20:34:00 | FromDiscord | <Elegantbeef> `:` is for type annotations, not for assignment |
20:34:01 | FromDiscord | <FM> I get `Error: expected type, but got: new array[a, array[a, int]]` |
20:34:36 | FromDiscord | <FM> oh right sorry |
20:35:21 | FromDiscord | <FM> i don't know how I missed that |
20:35:35 | FromDiscord | <Elegantbeef> Well the compiler told you 😛 |
20:39:07 | FromDiscord | <FM> thank you all! |
21:20:47 | * | disso_peach joined #nim |
21:29:44 | * | jmdaemon joined #nim |
21:46:35 | FromDiscord | <SirOlaf> Why does this add a space for used names https://play.nim-lang.org/#ix=4dmV |
21:46:48 | FromDiscord | <SirOlaf> If you replace add with something that isn't defined it does not add a space |
22:05:24 | FromDiscord | <SirOlaf> `xor add f` keeps all spaces, why does it participate in resolution |
22:24:43 | FromDiscord | <SirOlaf> https://github.com/nim-lang/Nim/blob/devel/compiler/lookups.nim#L48 |
22:24:59 | FromDiscord | <SirOlaf> Turns out I got scammed, x is a nkOpenSymChoice which is not handled |
22:25:16 | * | attah quit (Ping timeout: 246 seconds) |
22:26:37 | FromDiscord | <SirOlaf> So it never reaches lookup and instead raises |
22:35:53 | * | attah joined #nim |
23:20:49 | * | arkanoid joined #nim |
23:21:17 | arkanoid | is there any reason why nim prefers c2nim/futhark to swig? https://www.swig.org/exec.html |
23:38:57 | * | adium quit (Quit: Stable ZNC by #bnc4you) |
23:46:55 | * | adium joined #nim |