00:02:27 | FromDiscord | <aintea> Another day I woke up knowing Nim could be 5 times better if it has proper sum types and good pattern matching on sum types.↵↵There are libraries that provide macros for pattern matching but oh boy when there's an error just restart the whole project over again |
00:03:57 | FromDiscord | <aintea> I have seen a GitHub issue open about this and sum types that could be implemented as well as the desired syntax↵↵Do you guys see any way sum types could be not implemented by choice ?↵Or am I just a bad programmer wanting sum types where I should be using something else ? |
00:07:07 | FromDiscord | <Robyn [She/Her]> In reply to @aintea "I have seen a": Sum types actually have an RFC and are supposed to be Eventually™️ be implemented, I believe |
00:08:10 | FromDiscord | <Elegantbeef> Sum types are just object variants but with a more concise syntax and type system |
00:08:25 | FromDiscord | <Elegantbeef> So you're not a bad developer just someone that wants some sugar |
00:38:10 | FromDiscord | <auxym> Tried to install Nim on my work PC yesterday. Got caught by Windows Defender, which caused IT to immediately get a notificatiton and block me from accessing anything on the network. Also had me immediately bring in my laptop to be re-imaged, "just in case".↵↵I'm aware of the whole false positive situation and I understand the Nim team's position. But the whole situation is quite unfortunate. Now I'll have to code the thing I wanted in C |
01:14:37 | FromDiscord | <threefour> Holy moly |
01:16:00 | FromDiscord | <threefour> I'm glad my employer isn't so overbearing |
01:19:45 | FromDiscord | <auxym> it's a university, used to be pretty chill, then they got a few scares / close call security incidents in the past year or two. Now everything is locked down and security, security, security. Security first, get work done second. |
01:20:18 | FromDiscord | <Elegantbeef> Maybe they should use linux instead of windows |
01:21:07 | FromDiscord | <Elegantbeef> Can't get a virus if you don't know how to use the PC |
01:44:40 | * | m5zs7k quit (Quit: m5zs7k) |
01:45:06 | * | m5zs7k joined #nim |
01:57:44 | FromDiscord | <.bobbbob> and install i3 while youre at it |
01:58:09 | FromDiscord | <Elegantbeef> Nah we use AwesomeWM in this house |
01:58:33 | FromDiscord | <Elegantbeef> i3wm is for people that'd prefer smashing rocks together instead of using their PC |
02:18:59 | * | beholders_eye quit (Ping timeout: 244 seconds) |
03:06:23 | FromDiscord | <k0ts> In reply to @auxym "Tried to install Nim": does compiling Nim from source not avoid this? (asking, never tried it on Windows) |
03:52:33 | * | lucasta joined #nim |
04:08:07 | * | lucasta quit (Quit: Leaving) |
04:45:51 | FromDiscord | <alpaca_vita> In reply to @Array 🇵🇸🇸🇩🇸🇾🇨🇩 "jester has been abandoned": It gives the same error on nim 1 |
06:20:15 | FromDiscord | <ayex> sent a long message, see https://pasty.ee/ZSDLTlOB |
06:30:01 | FromDiscord | <emmuni> In reply to @k0ts "does compiling Nim from": yes because the issue stems from windows freaking out when something is compiled using gcc so if you compile stuff with clang or msvc it should be fine |
06:30:38 | FromDiscord | <emmuni> choosenim also prevented the false positive from the standard windows installer for me if i recall correctly |
06:30:49 | FromDiscord | <emmuni> so perhaps that's a easy solution |
06:31:50 | FromDiscord | <zumi.dxy> are legitimate malware written in nim that common?? 💀 |
06:32:03 | FromDiscord | <emmuni> no |
06:32:06 | FromDiscord | <emmuni> that's not the issue at all |
06:32:09 | FromDiscord | <emmuni> read what i said |
06:32:49 | FromDiscord | <zumi.dxy> so it's an issue with all gcc/mingw binaries? |
06:33:29 | FromDiscord | <emmuni> not all, some code compiled using gcc even if not malicious gets flagged by windows, it has been an issue for ages on windows, i've never looked into why |
06:34:11 | FromDiscord | <emmuni> then again, even if you compile a binary in C++ for example, using any compiler, as soon as you read/write to virtual memory windows also flags that |
06:34:52 | FromDiscord | <angelsdust> I remember back during win 7/xp era compiling any `"\n"` with mingw/gcc would trigger windows defender lol |
06:35:21 | FromDiscord | <spotlightkid> The whole thing is part of an educational program by the free software foundation to teach Windows users by practical example why proprietary operating systems are bad. |
06:37:05 | * | redj quit (Ping timeout: 260 seconds) |
06:37:19 | * | redj_ joined #nim |
06:39:42 | FromDiscord | <emmuni> In reply to @angelsdust "I remember back during": at least windows defender went from being totally useless in windows 7 and actually being useful in windows 10/11 albeit it flags a lot of false positives |
06:42:33 | FromDiscord | <ayex> very interesting - I have to try that with some of my formerly flagged nim code. 🤔↵(@emmuni) |
06:46:42 | FromDiscord | <emmuni> In reply to @ayex "very interesting - I": you can probably google mingw gcc false positive and get results that are the same problem but in C/C++ so the issue does not stem from Nim itself in any way |
06:54:15 | * | coldfeet joined #nim |
07:02:16 | FromDiscord | <nnsee> In reply to @emmuni "you can probably google": it's not just that |
07:03:48 | FromDiscord | <nnsee> patterns from nim's stdlib (when compiled into the exe) - I can't recall what specifically, might've been string formatting - was in a large portion of vendors' databases for a while |
07:04:42 | FromDiscord | <nnsee> (edit) "was" => "were" |
07:14:49 | * | ntat joined #nim |
07:23:45 | * | cornfeedhobo quit (Read error: Connection reset by peer) |
07:26:59 | * | cornfeedhobo joined #nim |
07:29:06 | * | PMunch joined #nim |
07:31:11 | FromDiscord | <pmunch> In reply to @auxym "Tried to install Nim": Yikes, that's quite the reaction! |
07:31:19 | FromDiscord | <pmunch> Where do you work, the NSA or something? |
07:31:31 | FromDiscord | <pmunch> Maybe you could fire up a VM to do Nim coding in |
07:34:04 | FromDiscord | <pmunch> And yeah, if the problem was as easy as "compile with clang instead of gcc" then it would be very easy to work around |
07:43:41 | * | ntat quit (Quit: Leaving) |
08:12:52 | FromDiscord | <nnsee> In reply to @pmunch "Maybe you could fire": as an alternative, ssh + sshfs works nicely |
08:13:17 | FromDiscord | <nnsee> i'm not sure how well supported sshfs is on windows, though |
08:14:04 | FromDiscord | <ringabout> I use WSL2+vscode, it's very smooth |
08:35:31 | FromDiscord | <pmunch> In reply to @nnsee "as an alternative, ssh": sshfs? |
08:35:38 | FromDiscord | <odexine> ssh file system via fuse |
08:35:49 | FromDiscord | <odexine> https://github.com/libfuse/sshfs |
09:02:48 | PMunch | Ah right |
09:03:07 | PMunch | So everything is hosted externally and only mounted localy |
09:03:17 | PMunch | But if it is fuse then it won't run on Windows will it? |
09:03:31 | PMunch | And if you're running Linux this is a moot point |
09:18:21 | * | coldfeet quit (Quit: leaving) |
09:20:16 | * | coldfeet joined #nim |
09:28:58 | FromDiscord | <odexine> wsl |
09:29:52 | PMunch | Oh it's good enough for fuser? Cool! |
09:41:52 | FromDiscord | <nnsee> In reply to @PMunch "But if it is": yeah that's why i said i have no clue if it works on windows |
09:42:08 | FromDiscord | <nnsee> i thought maybe windows would have fuse support... but perhaps not |
09:44:30 | FromDiscord | <odexine> i was under the impression that wsl is fuse capable |
09:44:51 | FromDiscord | <nnsee> oh, that probably does |
09:44:55 | FromDiscord | <nnsee> i meant, like, native windows |
10:02:48 | * | coldfeet quit (Remote host closed the connection) |
10:05:32 | * | coldfeet joined #nim |
10:24:32 | * | coldfeet quit (Remote host closed the connection) |
10:42:43 | FromDiscord | <.tokyovigilante> Is there any concept of a file/path URI in the stdlib? The existing `uri` seems based around URLs only |
11:33:26 | FromDiscord | <k0ts> There's Path from std/paths but that's just a distinct string |
11:36:30 | * | perr_ joined #nim |
11:40:58 | * | Artea joined #nim |
12:02:21 | FromDiscord | <balugrizzly> In reply to @Elegantbeef "Depends on OS and": tryina for linux and ideal without display server or something that is universal |
13:10:20 | * | PMunch_ joined #nim |
13:12:59 | * | PMunch quit (Ping timeout: 260 seconds) |
13:51:20 | * | PMunch__ joined #nim |
13:53:53 | * | PMunch_ quit (Ping timeout: 248 seconds) |
13:59:54 | Amun-Ra | I was pranked by sizeof: https://play.nim-lang.org/#pasty=wajcDwcO |
14:16:16 | * | PMunch__ quit (Quit: Leaving) |
14:28:44 | FromDiscord | <angelsdust> Can enums not contain enums? |
14:31:28 | FromDiscord | <k0ts> what does it mean for an enum to contain an enum |
14:35:58 | FromDiscord | <angelsdust> sent a code paste, see https://play.nim-lang.org/#pasty=WUJBgrJP |
14:36:08 | FromDiscord | <angelsdust> But prolly a bad idea lol |
14:36:15 | FromDiscord | <angelsdust> Does nim support multiple returns? |
14:36:30 | FromDiscord | <k0ts> there is no types-inside-types |
14:37:41 | FromDiscord | <demotomohiro> In reply to @angelsdust "Does nim support multiple": You can use a tuple to return multiple values. |
14:38:13 | FromDiscord | <angelsdust> In reply to @demotomohiro "You can use a": Can I do sth like `var a,b,c = "a_b_c".split("_")`? |
14:38:41 | FromDiscord | <k0ts> no because the number of elements is not known at compile time |
14:38:46 | FromDiscord | <k0ts> you can do something like that with strscans though |
14:38:47 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#statements-and-expressions-tuple-unpacking |
14:39:06 | FromDiscord | <angelsdust> In reply to @k0ts "no because the number": Makes sense, ripge me being lazy |
14:40:41 | FromDiscord | <k0ts> sent a code paste, see https://play.nim-lang.org/#pasty=KimqAyms |
14:40:47 | FromDiscord | <k0ts> (edit) "https://play.nim-lang.org/#pasty=xfWZYBcy" => "https://play.nim-lang.org/#pasty=tBeJJxoF" |
14:50:11 | FromDiscord | <demotomohiro> In reply to @angelsdust "Can I do sth": Yes you can if arguments are constant: https://play.nim-lang.org/#pasty=TOVbbRak |
14:59:26 | FromDiscord | <angelsdust> If you have a `proc(foo: var FOO) = foo.Bar()` you can write it shorter no? |
15:21:47 | * | lucasta joined #nim |
15:33:12 | FromDiscord | <odexine> What do you mean write it shorter? |
15:33:40 | FromDiscord | <odexine> There are functions in the sugar module that would help shorten that yes |
15:41:41 | * | ntat joined #nim |
15:47:33 | FromDiscord | <angelsdust> Like lambdas |
15:50:04 | FromDiscord | <demotomohiro> `proc(foo: var FOO) = foo.Bar()` is not a lambda? |
15:51:52 | FromDiscord | <odexine> Anonymous function and lambdas are commonly conflated |
15:57:06 | FromDiscord | <angelsdust> I meant it as, is there a short hand notation for lambas/anonymous functions like `(foo) -> foo.bar` |
16:04:16 | strogon14 | WTF GitHub? (short screen video) https://0x20.eu/nc/s/2MQqWs6y5QFQWat |
16:10:28 | FromDiscord | <odexine> In reply to @angelsdust "I meant it as,": See what I mentioned, the sugar module |
16:18:26 | FromDiscord | <auxym> sent a long message, see https://pasty.ee/eTQPKatR |
16:20:22 | FromDiscord | <auxym> In reply to @emmuni "choosenim also prevented the": Installing via choosenim was also flagged by Defender. nim.exe and nimble.exe don't get flagged, I think it's finish.exe and maybe another binary |
16:21:48 | FromDiscord | <emmuni> In reply to @auxym "Installing via choosenim was": oh, perhaps i already added it as an exception then |
17:14:25 | FromDiscord | <michaelb.eth> In reply to @odexine "Anonymous function and lambdas": are they not the same thing, generally speaking ?↵↵maybe you have in mind a difference that’s contextual, like a specific language where the terms mean slightly different things? |
17:16:42 | FromDiscord | <michaelb.eth> wikipedia redirects “Lambda function (computer programming)” to “Anonymous function” |
17:21:32 | * | Onionhammer0 joined #nim |
17:21:57 | * | tokyovigilante quit (Ping timeout: 248 seconds) |
17:22:11 | * | tokyovigilante joined #nim |
17:23:41 | * | Onionhammer quit (Ping timeout: 252 seconds) |
17:23:41 | * | Onionhammer0 is now known as Onionhammer |
17:53:05 | * | GnuYawk quit (Quit: The Lounge - https://thelounge.chat) |
17:53:34 | * | GnuYawk joined #nim |
20:07:51 | * | krux02_ joined #nim |
20:45:24 | FromDiscord | <luteva> Hi! I would like to have a "field pragma" to genrate some code, just like the bitsize pragma:↵https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-bitsize-pragma↵how can I do this? Any Example? (I do not want to explicitly call a macro after the type declaration.) |
20:46:16 | FromDiscord | <Elegantbeef> codegendecl is the closest you can get |
20:46:21 | FromDiscord | <Elegantbeef> Otherwise you need a typesection macro |
20:47:43 | FromDiscord | <luteva> is there any example of how to implement this? |
20:49:19 | FromDiscord | <Elegantbeef> What are you trying to do though? |
20:51:53 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#pasty=xYbSHdLM |
20:52:34 | FromDiscord | <Elegantbeef> So you do not need code gen? |
20:52:51 | FromDiscord | <luteva> but i see codegendecl seems to be too specific for something else 😉 |
20:52:57 | FromDiscord | <Elegantbeef> you can use a user defined pragma then detect it later using `std/macros` |
20:53:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=SimrpLeN |
20:53:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JKNXhpGN |
20:54:19 | FromDiscord | <Elegantbeef> the sunny package also uses the pragma pragma to some effect |
20:55:53 | FromDiscord | <Elegantbeef> As does https://github.com/beef331/dodger/blob/master/dodger/protocol/queries.nim |
20:56:05 | FromDiscord | <Elegantbeef> Though in your case I'd just implement procs over the pragma |
20:56:18 | FromDiscord | <luteva> but pragma pragma afaik has to be called later in the code right?↵I just don't want to call it. It should all be done by the pragma declaration. |
20:56:34 | FromDiscord | <Elegantbeef> Call what? |
20:56:37 | FromDiscord | <Elegantbeef> You're tagging afaict |
20:56:37 | FromDiscord | <luteva> but thx anyway. i'll have a look at the repo! |
20:56:39 | FromDiscord | <Elegantbeef> Why do you need to call |
20:57:32 | FromDiscord | <luteva> oh yes you can detect it, right? yes that may work for me. |
20:57:38 | FromDiscord | <luteva> thx! 💯 |
21:08:02 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#pasty=mSaFDYse |
21:08:33 | FromDiscord | <Elegantbeef> What does `hasMany` actually do though? |
21:09:49 | FromDiscord | <luteva> generate some procs like User.add(post) which adds posts to the list of posts etc. and for deletion etc. |
21:10:15 | FromDiscord | <luteva> just like thi: https://guides.rubyonrails.org/association_basics.html#has-many |
21:10:39 | FromDiscord | <Elegantbeef> Where would it add them to though? |
21:11:39 | FromDiscord | <Elegantbeef> Like write the code you want to automate |
21:11:43 | FromDiscord | <luteva> to that module for the type User i think/hope 😄 |
21:13:54 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#pasty=RTGwkneg |
21:15:45 | FromDiscord | <luteva> so user.add(comment) is just shorthand for user.comments.add(comment) |
21:18:36 | FromDiscord | <luteva> so if the has_many macro is being detected, it should add a seq[Comment] field to the type and add some procs to easily fill and clear this field. later, it should also handle the db references (like setting the foreign keys etc.) |
21:19:06 | FromDiscord | <luteva> that's just what ActiveRecord do. |
21:19:19 | * | coldfeet joined #nim |
21:20:03 | FromDiscord | <luteva> (edit) "that's just what ActiveRecord do. ... " added "So it is for "standard web development" purposes." |
21:25:29 | FromDiscord | <luteva> can you explain, what you meant by "implement procs over the pragma"? |
21:40:26 | * | coldfeet quit (Remote host closed the connection) |
21:43:11 | FromDiscord | <Elegantbeef> @luteva https://play.nim-lang.org/#pasty=SAzXcZyv |
21:44:57 | * | lucasta quit (Quit: Leaving) |
21:45:56 | FromDiscord | <Elegantbeef> slightly fixed some things https://play.nim-lang.org/#pasty=JDgSENGI |
21:51:10 | FromDiscord | <luteva> ok first of all: thanks a lot!↵So, just to chack if i understood correctly:↵What you do is: write the "add"-proc and in that proc you check, if the proc is valid, by checking if the filed has the desired progma, right? |
21:51:24 | FromDiscord | <luteva> (edit) "chack" => "check" |
21:51:42 | FromDiscord | <Elegantbeef> You find where to add by iterating an objects fields and detecting the pragma |
22:13:09 | * | tokyovigilante quit (Read error: Connection reset by peer) |
22:13:24 | * | tokyovigilante joined #nim |
22:26:54 | * | lucasta joined #nim |
22:47:33 | * | ntat quit (Quit: Leaving) |
22:50:55 | * | lucasta quit (Quit: Leaving) |
23:11:10 | * | krux02_ quit (Remote host closed the connection) |
23:12:00 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#pasty=UYWQoJdD |
23:12:16 | FromDiscord | <luteva> (edit) "https://play.nim-lang.org/#pasty=rvqnwSUh" => "https://play.nim-lang.org/#pasty=hmgJiQcF" |
23:12:53 | FromDiscord | <Elegantbeef> declare a proc |
23:13:05 | FromDiscord | <Elegantbeef> Annotate it `compileTime` if it should only run at CT |
23:13:12 | FromDiscord | <Elegantbeef> Otherwise just declare a proc |
23:24:37 | * | krux02_ joined #nim |
23:55:52 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=qvrBYhWP |