<< 16-05-2022 >>

00:01:06FromDiscord<Zectbumo> is there something like the javascript `??`
00:01:36FromDiscord<Elegantbeef> wrapnils?
00:02:14FromDiscord<Yardanico> https://github.com/status-im/questionable
00:02:21FromDiscord<Yardanico> "Use the |? operator to supply a fallback value when the Option does not hold a value:"
00:02:34FromDiscord<Yardanico> but there are others as well
00:05:18FromDiscord<huantian> ooh that's a nice wrapper
00:07:04FromDiscord<Yardanico> https://github.com/arnetheduck/nim-result is even nicer, covers more usecases, but it's not compatible with options
00:07:23FromDiscord<Yardanico> I mean you can easily write code that converts std/options to Opt, but still
00:12:03FromDiscord<Zectbumo> okay, I think I need a debugger now. how do I step through nim code?
00:13:31FromDiscord<Elegantbeef> C debuggers work when you compile with `--debugger:native`
00:15:03FromDiscord<Zectbumo> there should be an entire debug section in the docs page (I know, I know, PR request 🙂 I'm going to have to start making a list of all these PRs I need to make 😉
00:16:08*krux02 quit (Remote host closed the connection)
00:19:53*noeontheend quit (Ping timeout: 260 seconds)
00:33:34FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3XSy
00:34:01FromDiscord<Elegantbeef> Lol pmunch really needs to make a better example
00:34:40FromDiscord<Elegantbeef> you need to have a `path` or `syspath` that has a `cstdio.h`
00:36:20FromDiscord<!Patitotective> what clang version should i use? 9, 9.0.1, 10, 10.0.0, 11, 11.1.0, 13, 13.0.1, 14 or 14.0.0 lol
00:36:55FromDiscord<Elegantbeef> Whichever you have
00:37:02FromDiscord<!Patitotective> all of those
00:40:12FromDiscord<Elegantbeef> It's only for parsing so just use whatever
00:40:16FromDiscord<!Patitotective> anyways, it seems like clang does not have cstdio, instead `gcc-4.8.5/libstdc++-v2` does
00:48:25*ltriant quit (Ping timeout: 248 seconds)
00:51:10*ltriant joined #nim
00:58:51*ltriant_ joined #nim
00:59:33*ltriant quit (Ping timeout: 260 seconds)
01:00:26*vicfred quit (Quit: Leaving)
01:06:34*dithpri quit (Ping timeout: 240 seconds)
01:09:33*dithpri joined #nim
01:14:45FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/l8W
01:15:17FromDiscord<!Patitotective> what was https://github.com/define-private-public/stb_image-Nim wrapped with?
01:15:33FromDiscord<Elegantbeef> Are you using it on C++?
01:16:32FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3XSH
01:18:35FromDiscord<Elegantbeef> isnt stdc a C++ wrapped C file?
01:18:36FromDiscord<Elegantbeef> Yea it's a C++ file
01:19:43FromDiscord<!Patitotective> soooo i shold compile to cpp? right
01:19:48FromDiscord<Elegantbeef> > A free C++11 file dialog library.
01:19:54FromDiscord<Elegantbeef> You cannot use futhark on C++
01:20:03FromDiscord<Elegantbeef> Just reimplement the code in Nim
01:20:22FromDiscord<!Patitotective> reimpl-who?
01:20:26FromDiscord<!Patitotective> whats that
01:20:38FromDiscord<Elegantbeef> Take the code and rewrite it in Nim
01:21:11FromDiscord<Elegantbeef> Or try c2nim
01:23:04FromDiscord<Elegantbeef> It's a C++ source library not a C++ library so it's going to be a pain to use
01:23:45FromDiscord<!Patitotective> In reply to @Elegantbeef "It's a C++ source": :[
01:26:24FromDiscord<!Patitotective> dang `/home/cristobal/minidev/nim-portable-file-dialogs/portable-file-dialogs.h(1513, 13) Error: invalid token $ (\36)`
01:26:41FromDiscord<!Patitotective> will i have to rewrite 1745 lines? :[
01:28:53FromDiscord<!Patitotective> theres also this thing https://sourceforge.net/p/tinyfiledialogs/code/ci/master/tree/tinyfiledialogs.c
01:30:39FromDiscord<Elegantbeef> What was the issue with the Nim official ones
01:30:48*noeontheend joined #nim
01:38:32*wallabra_ joined #nim
01:39:27*wallabra quit (Ping timeout: 252 seconds)
01:39:38*wallabra_ is now known as wallabra
01:45:34*dithpri quit (Ping timeout: 240 seconds)
01:56:19FromDiscord<yoyojambo> besides using a while loop, is there a way to have more control over the variable in a for loop that counts up?
01:56:34*dithpri joined #nim
01:56:56FromDiscord<yoyojambo> I am trying to skip several iterations at once by increasing the variable
01:57:34FromDiscord<yoyojambo> or should I just add a condition at the top with a `continue`?
01:58:26FromDiscord<Elegantbeef> You can make your own iterator
02:00:19FromDiscord<yoyojambo> hmmm I think that would complicate it a lot
02:01:11FromDiscord<yoyojambo> I kind of want the logic that increases the variable inside the for loop not as part of it
02:01:35FromDiscord<yoyojambo> but its fine ill just use `continue`
02:13:48*rockcavera joined #nim
02:13:49*rockcavera quit (Changing host)
02:13:49*rockcavera joined #nim
02:23:03FromDiscord<root> is there anywhere i can post a problem im having?
02:23:10FromDiscord<Elegantbeef> Here
02:23:16FromDiscord<root> ok
02:24:27FromDiscord<root> so im using this code https://github.com/elddy/Nim-Reverse-Shell and im a noob so i dont understand how to use it to send and receive commands between the server and the client, any help would be appreciated.
02:25:25FromDiscord<Elegantbeef> `socket.send` and `socket.recv` is how
02:26:53FromDiscord<Elegantbeef> Do you have a more descrpitive explanation of the problem?
02:28:55FromDiscord<root> Yes how would I format that if I wanted to send and receive messages typed in by the user?
02:29:10FromDiscord<root> And thank you so much for the help btw
02:29:24FromDiscord<Elegantbeef> What do you mean?
02:31:15FromDiscord<root> That’s ok I will try to give the rest out by myself, thank you tho!
02:31:47FromDiscord<Elegantbeef> Jeez people thank a lot for so little reason 😄
02:32:25FromDiscord<root> Sorry I just appreciate your time 🙂
02:40:51*noeontheend quit (Ping timeout: 256 seconds)
03:12:52*arkurious quit (Quit: Leaving)
03:16:34FromDiscord<root> what does "spawn" do ?
03:21:56*noeontheend joined #nim
03:25:23FromDiscord<Elegantbeef> spools up a thread with the right hand of the `spawn` statement
03:25:38FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#parallel-amp-spawn
03:26:34FromDiscord<root> i still dont understand how to use this code 😦
03:26:44FromDiscord<root> https://github.com/elddy/Nim-Reverse-Shell
03:28:32FromDiscord<root> i wanna use this to send commands from the server to the client
03:28:42FromDiscord<root> i cant figure it out tho 😦
03:28:52FromDiscord<root> (edit) "😦" => "😭"
03:30:02*Guest13 joined #nim
03:32:11*Guest13 left #nim (#nim)
03:41:08*noeontheend quit (Ping timeout: 260 seconds)
03:43:10*rockcavera quit (Remote host closed the connection)
04:19:54FromDiscord<Zectbumo> @root it looks pretty simple from the looks of the code. where are you stuck?
04:25:51FromDiscord<root> I don’t know how to use the recvMsg() and sendMsg() things
04:26:01*duuude quit (Ping timeout: 248 seconds)
04:26:28FromDiscord<root> In reply to @Zectbumo "<@817060943803973632> it looks pretty": I don’t know how to use the recvMsg() and sendMsg() things
04:28:29FromDiscord<Zectbumo> don't you just run the server and client?
04:32:00FromDiscord<root> Yea but idk how to send and receive data between them 😦
04:32:11FromDiscord<root> Sry I’m coming from python so I kinda dumb
04:32:11FromDiscord<Zectbumo> you just type
04:32:22FromDiscord<Zectbumo> me too 😄
04:33:03FromDiscord<root> So whenever u type and press enter into the server it send the info to client.py?
04:33:09FromDiscord<root> .nim
04:34:13FromDiscord<Zectbumo> so reading the program it looks like: run Client on your windows machine, ssh tunnel 4444, then run Server on the other machine, and start typing on "other machine"
04:34:45FromDiscord<Zectbumo> and of course open up TCP 4444 on the firewall on the Server side
04:34:59FromDiscord<root> Where does the client receive and use the data sent from server?
04:36:11FromDiscord<Zectbumo> in recvMsg it has a recvLine() and then writeLine(cmds)
04:36:19FromDiscord<root> Omg thank you
04:36:33FromDiscord<root> ❤️
04:39:08FromDiscord<Zectbumo> oh in my instructions I did it backwards. run the server first, then tunnel, then client 😛
04:39:30FromDiscord<root> Thank you!
04:40:23FromDiscord<root> How do I have nim execute system commands?
04:40:40FromDiscord<Zectbumo> oh and since you are tunneling there is no need to open port on 4444 either
04:40:56FromDiscord<root> That’s ok I already knew that I just appreciate the help
04:41:06FromDiscord<Zectbumo> it already is executing for you via cmd.exe
04:41:33FromDiscord<root> Wait so whatever I type into server is being sent and executed in the client?
04:41:41FromDiscord<Zectbumo> yes
04:41:46FromDiscord<root> Ohhhh
04:41:50FromDiscord<root> I didn’t know thattt
04:41:54FromDiscord<root> I’m dumb lol
04:41:56FromDiscord<root> Thank you
04:41:59FromDiscord<Zectbumo> type dir and you should see a listing pop up
04:42:15FromDiscord<root> I don’t 😦
04:42:53FromDiscord<Zectbumo> do you see "Got connection from:" on the server side?
04:42:59FromDiscord<root> Yes
04:43:36FromDiscord<root> Yea I just typed mkdir hi and no new directory was formed
04:43:39FromDiscord<Zectbumo> do you see the command you typed pop up on the client side?
04:43:49FromDiscord<root> No
04:43:56FromDiscord<Zectbumo> okay so message didn't make it through
04:44:20FromDiscord<Zectbumo> it actually echos before executing
04:44:34FromDiscord<root> Ok let me try something
04:48:04FromDiscord<Zectbumo> it looks like this program burns cycles waiting for the process to exit while in use. it may chew cpu just sitting there doing nothing
04:48:17FromDiscord<root> Oh ok
04:48:42FromDiscord<root> Exponentially? Or will it just always take up some cpu space
04:48:47FromDiscord<Zectbumo> do you have cmd.exe on the client side?
04:49:01FromDiscord<root> Yes
04:49:08FromDiscord<Zectbumo> just some. it has a dedicated thread just cycling, no wait, just checking a flag
04:49:47*slowButPresent quit (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1))
04:50:35FromDiscord<Zectbumo> probably checking the process thousands of times per second 😄
04:51:19FromDiscord<Zectbumo> anyway, just a side note. it's a basic program. and you have bigger issues
04:53:43FromDiscord<Zectbumo> okay, my guess is you do not have cmd.exe and the process gets closed and then the socket gets closed and the recvMsg returns and sendMsg is hanging because it's trying to read 1 char so since that's not moving the process gets stuck
04:54:05FromDiscord<Zectbumo> though, if you did type a command I would guess that the Client would exit
04:54:11FromDiscord<Zectbumo> possibly with error
04:54:52FromDiscord<Zectbumo> oh no, error. there is an except: return 😮
05:04:09FromDiscord<root> how do i compile a nim project to run on windows 😦
05:04:43FromDiscord<Zectbumo> 😄 I tried this today and gave up with I saw it needed minGW
05:05:00FromDiscord<root> okok
05:06:06FromDiscord<Zectbumo> https://nim-lang.org/install_windows.html↵check out compiler dependencies
05:06:47FromDiscord<Zectbumo> actually, I'll do it with you. I stopped prematurely
05:06:58FromDiscord<huantian> I would use choosenim myself↵<https://github.com/dom96/choosenim#choosenim>↵though I haven't tried either method on windows
05:07:02FromDiscord<huantian> because windows is for the weak
05:08:06FromDiscord<root> what does nim compile to by default? assembly?
05:08:20FromDiscord<Zectbumo> complies to C code
05:08:31FromDiscord<root> wouldnt that have a .c extention
05:08:41FromDiscord<Zectbumo> yes, somewhere you can find that
05:08:45FromDiscord<root> my output file has no extention
05:08:52FromDiscord<huantian> nim -> c -> binary
05:08:57FromDiscord<Zectbumo> that compiled to machine code
05:09:03FromDiscord<root> ok
05:09:24FromDiscord<root> can binary run on windows?
05:09:39FromDiscord<huantian> only if you compile it for windows
05:09:40FromDiscord<huantian> and not linux
05:09:42FromDiscord<Zectbumo> only if you build on windows, or crossbuild for windows
05:09:53FromDiscord<huantian> ^
05:09:56FromDiscord<root> how do u cross build for windows
05:10:01FromDiscord<Zectbumo> let's not go there
05:10:08FromDiscord<Zectbumo> just get nim working on windows
05:10:08FromDiscord<root> my pc is on linux but i want it to work on windows
05:10:15FromDiscord<huantian> <https://nim-lang.org/docs/nimc.html#crossminuscompilation-for-windows>
05:10:36FromDiscord<root> In reply to @Zectbumo "let's not go there": is it not worth it? should I just get my win 10 vm to use nim
05:11:16FromDiscord<Zectbumo> you would get cool points from me if you crossbuild, but that's just more steps
05:11:34FromDiscord<root> ok
05:11:40FromDiscord<root> well i do want cool points
05:11:44FromDiscord<Zectbumo> 😄
05:11:53FromDiscord<huantian> then read the docs 😛
05:11:54FromDiscord<root> In reply to @huantian "<https://nim-lang.org/docs/nimc.html#crossminuscomp": i did this now what
05:11:59FromDiscord<root> In reply to @huantian "then read the docs": i willll
05:12:18FromDiscord<huantian> you installed mingw, then did `nim c -d:mingw file.nim`?
05:12:28FromDiscord<root> its just hard moving from a lang with to much documentation (python) to nim with like none
05:12:28FromDiscord<huantian> you should have a file called `file.exe` and you can run that on windows
05:12:42FromDiscord<root> In reply to @huantian "you installed mingw, then": thx!
05:12:54FromDiscord<Elegantbeef> Or wine 😄
05:13:12FromDiscord<Elegantbeef> if you have wine you can actually do `nim c -d:mingw -r ...`
05:13:45FromDiscord<root> In reply to @Elegantbeef "if you have wine": i did this it worked 🙂
05:13:48FromDiscord<root> thank u all
05:16:22FromDiscord<Zectbumo> there's your cool point
05:25:37FromDiscord<Zectbumo> so I'm running chrome 101 on windows and I can't download the nim package from the website. chrome makes me delete the zip after download completion
05:26:03FromDiscord<Elegantbeef> Yep many antivirus programs flag it as a virus
05:26:59FromDiscord<Prestige> The browser makes you delete the file? Weird
05:27:18FromDiscord<Elegantbeef> Yep they can detect what they consider malware and remove it
05:27:20FromDiscord<Zectbumo> https://media.discordapp.net/attachments/371759389889003532/975630507914190879/unknown.png
05:27:35FromDiscord<Prestige> Can't you override that somehow?
05:27:47FromDiscord<Zectbumo> yeah, I can go into settings and disable standard protection
05:28:11FromDiscord<Zectbumo> just, not ideal for the non developers using nim
05:28:49FromDiscord<Zectbumo> (edit) "non developers" => "standard user"
05:29:33FromDiscord<huantian> You can also go to downloads
05:29:37FromDiscord<huantian> And then there’s a button
05:29:43FromDiscord<huantian> Like download anyways
05:30:52FromDiscord<Zectbumo> so I disabled it in chrome and now Windows: https://media.discordapp.net/attachments/371759389889003532/975631400172662804/unknown.png
05:31:02FromDiscord<Zectbumo> guys, Nim is going viral!
05:31:24FromDiscord<Elegantbeef> Yea it's well established for a year or so that Nim triggers AV
05:31:26FromDiscord<Elegantbeef> It's a shame but it's what it is
05:32:15FromDiscord<Zectbumo> has anyone talked to Microsoft about this?
05:32:31FromDiscord<Zectbumo> and Google
05:33:30FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/7885
05:33:43FromDiscord<Yardanico> <https://github.com/nim-lang/Nim/issues/17820>
05:33:56FromDiscord<Yardanico> Potentially https://github.com/nim-lang/Nim/pull/19767 can help with that
05:34:26FromDiscord<Yardanico> since last time I checked, the most detected binary from the 1.6.6 archive was nimgrab.exe with (i don't remember exactly) 15-18 detections, others only had 2-3 detections at max
05:35:16FromDiscord<Zectbumo> what? hmm, it actually looked like it caught a virus. maybe someone put a back door in? it flashed the name of the worm but then it oddly disappeared before I could quarantine it
05:35:24FromDiscord<Yardanico> no it's not a virus
05:35:26FromDiscord<Yardanico> it's a false positive
05:35:42FromDiscord<Zectbumo> I see
05:36:03FromDiscord<Yardanico> nimgrab is probably detected because it uses the (kind of) deprecated windows UrlMon API for downloading stuff, and it seems that AVs really don't like that
05:37:11FromDiscord<Zectbumo> the odd part is that it flagged as a threat but then reverses on its own without me doing anything and then says 0 threats
05:37:35FromDiscord<Yardanico> In reply to @Zectbumo "the odd part is": did you think it would let you actually decide what you want to happen on "your" device? hahaha
05:37:41FromDiscord<Yardanico> good joke :)
05:38:03FromDiscord<Zectbumo> aw well, at least I know the bitcoin miner running on my machine now is going to a good cause 😉
05:38:08FromDiscord<Yardanico> but in all seriousness, most windows users aren't tech savvy at all, so that's why defender behaves like that
05:39:18FromDiscord<undel> In reply to @Yardanico "but in all seriousness,": i've seen people (gamers in particular) download obvious malware because it promised to optimize gaming performance
05:39:36FromDiscord<undel> instead they got a cryptominer and a chrome extension that injected ads into every page
05:41:24FromDiscord<Zectbumo> so my guess is that the AV did a quick check raised a false positive and then once it did a full check it found it was okay
05:41:47*gshumway quit (*.net *.split)
05:41:48*via_ quit (*.net *.split)
05:41:48*Stink quit (*.net *.split)
05:41:48*robertmeta quit (*.net *.split)
05:41:48*oz quit (*.net *.split)
05:41:48*notchris quit (*.net *.split)
05:41:53FromDiscord<Yardanico> no? it just removed the binary
05:41:55*via_ joined #nim
05:42:00*notchris joined #nim
05:42:03*Stink joined #nim
05:42:19FromDiscord<Yardanico> if you unpacked the archive, check the binaries, you'll probably be missing a few that the defender removed
05:42:30FromDiscord<Zectbumo> maybe so. hopefully I didn't need it
05:42:33*gshumway joined #nim
05:42:35*Stink is now known as Guest7620
05:42:41*ox joined #nim
05:42:46*robertmeta joined #nim
05:42:46*robertmeta quit (Changing host)
05:42:46*robertmeta joined #nim
05:43:35FromDiscord<Zectbumo> arg and it deleted my zip
05:44:23FromDiscord<Zectbumo> this is abuse
05:45:45FromDiscord<Zectbumo> okay, install complete. I even added to start menu. whatever that means
05:47:00FromDiscord<Zectbumo> oh I get a custom cmd prompt now 👑 https://media.discordapp.net/attachments/371759389889003532/975635459453620244/unknown.png
05:56:42FromDiscord<Zectbumo> okay I got caught up with the details https://github.com/nim-lang/Nim/issues/17820
06:03:38FromDiscord<Prestige> In reply to @Zectbumo "this is abuse": That's why I don't use Windows
06:04:41FromDiscord<Zectbumo> I can't even remember why I wanted nim on windows now. this process took me for a spin
06:08:05FromDiscord<Zectbumo> That's why I run four operating systems 😄
06:49:37*ltriant joined #nim
06:50:44*ltriant_ quit (Ping timeout: 248 seconds)
06:55:12*PMunch joined #nim
07:09:25FromDiscord<Zectbumo> sent a code paste, see https://paste.rs/5wh
07:10:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XTl
07:13:08FromDiscord<Elegantbeef> `user.email` of course
07:13:22FromDiscord<Elegantbeef> I sometime write fantastic things 😄
07:13:53FromDiscord<Zectbumo> there's nothing standard? it's a basic need in nim
07:14:11FromDiscord<Elegantbeef> In nim the only truthy value is `true`
07:14:17FromDiscord<Elegantbeef> if you want other truthy values you use converters
07:14:58FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Bb7
07:15:03FromDiscord<Zectbumo> I would like a standard converter that checks for nonDefault
07:15:06FromDiscord<Yardanico> In reply to @Zectbumo "there's nothing standard? it's": i think checking if a string is not empty is simple enough :)
07:15:28FromDiscord<Elegantbeef> `myVal != default(typeof(myVal))`
07:15:29FromDiscord<Zectbumo> sure is, and is going to happen everywhere
07:15:32FromDiscord<Yardanico> In reply to @Zectbumo "I would like a": after all, nim is not python despite all the marketing people are trying to do
07:15:52FromDiscord<Elegantbeef> Nim is a statically typed language and all values implicitly turning into bools is bad design
07:15:54FromDiscord<Yardanico> and converters are kind of a bad practice except some specific cases
07:15:55FromDiscord<Zectbumo> no nim is better, or should be at least
07:16:26FromDiscord<Yardanico> nim only has implicit type conversion when it makes sense
07:16:33FromDiscord<Yardanico> without surprising behaviour
07:16:59FromDiscord<Yardanico> first you want `if string` to work, and then by accident you pass a string to a proc that accepts bool
07:17:00PMunchZectbumo, strings in Nim can't be nil like in many other languages. So the default value of a string is an empty string. You can check if a string is empty like you did above or with `user.email.len == 0`. Nim is also very strict about types, so checking if a string is true or false doesn't work.
07:17:12FromDiscord<Zectbumo> I like explicitly turning into bools. like @ElegantBeef default() check is cool. just needs to be standard, imo
07:17:47FromDiscord<Elegantbeef> I mean it's one line of code
07:18:08FromDiscord<Yardanico> In reply to @Zectbumo "I like explicitly turning": default as standard would only really work for simple builtin types
07:18:25FromDiscord<Yardanico> because user-defined types usually use constructor-like procs for initialization
07:18:53PMunchIn your case `if user.email`, let's rename the field to `user.hasAddress` and let's assume this comes from a HTTP form or something. Now this field is sent as "true" or "false" as strings. Now the check `if user.hasAddress` logically looks like it would check if the user has an address, but in fact it checks if the user `hasAddress` field isn't set properly.
07:18:56FromDiscord<Zectbumo> that's all I'm asking is the simple types. anyone else can make their own if needed for custom
07:19:18FromDiscord<Yardanico> and yeah, I don't see the need for these types of conversions in code i write usually :)
07:19:42FromDiscord<Yardanico> and i also started using nim after using python back in 2017
07:20:13PMunchAnd default is already built-in, so not sure what you want to be standard about that
07:20:28FromDiscord<Elegantbeef> They want a `isDefault` or similar
07:21:01FromDiscord<Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3XTn
07:21:02FromDiscord<Yardanico> has?
07:21:09FromDiscord<Elegantbeef> You can do that
07:21:10FromDiscord<Zectbumo> (edit) "https://play.nim-lang.org/#ix=3XTn" => "https://play.nim-lang.org/#ix=3XTo"
07:21:20FromDiscord<Yardanico> but again, this is not much different in length than `if user.email != ""`
07:21:29PMunchAah, something like `template isDefault(x: untyped): bool = x == default(typeof(x))`?
07:21:47FromDiscord<Zectbumo> In reply to @Yardanico "but again, this is": I'm going for elegance not char count
07:22:05FromDiscord<Yardanico> how is this not elegant 🤔
07:22:12FromDiscord<Yardanico> its a basic piece of code that's going to be the same in most languages
07:22:25FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/1BZ
07:22:27FromDiscord<Zectbumo> In reply to @Elegantbeef "You can do that": yes, but I would like to see this standard where it's the nim norm.
07:22:35FromDiscord<Elegantbeef> "standard"
07:22:39FromDiscord<Elegantbeef> It's one frigging proc 😄
07:22:46PMunch`template has(obj, field: untyped): bool = compiles(obj.field) and obj.field != default(typeof(obj.field))`
07:22:50FromDiscord<Yardanico> anyway, maybe you like it, but I like my "old-school" nim way
07:23:00PMunchNow you can if `if user.has email` :P
07:23:13FromDiscord<Elegantbeef> Pmunch really going off the deepend 😄
07:23:29FromDiscord<Zectbumo> In reply to @Elegantbeef "It's one frigging proc": I'll use that proc, but too bad I won't see anyone else using it because everyone will be stuck in != "" land
07:23:39FromDiscord<Elegantbeef> Well it's more expressive
07:23:55FromDiscord<Elegantbeef> `has` sounds like `compiles(myType.field)`
07:23:55PMunchI typically use .len == 0 for what it's worth
07:24:52FromDiscord<Yardanico> In reply to @Zectbumo "I'll use that proc,": if you want everyone to use the same idioms and code style, Nim is really, really not for you :)
07:24:58FromDiscord<Yardanico> look into things like Go that force one way to write code
07:25:18FromDiscord<Yardanico> nim has multiple ways to do the same thing, and people prefer different ones
07:25:28PMunchKeep in mind as well that `default(int)` is 0. So `if has user.age` would run if the user was a newborn
07:26:13FromDiscord<Zectbumo> there's no forcing everyone to use `has` it would be nice to have an elegant way built in already so not everyone comes up with their own or worse nothing at all
07:26:46PMunchIMO those auto-bool and default checks is more useful when you have nilable types that can't readily mix with the rest of the behaviour of your type
07:27:15FromDiscord<Zectbumo> In reply to @PMunch "IMO those auto-bool and": that's another area. I would like the ?? like in javascript
07:27:17PMunchNim luckily doesn't have those, if you have a string you can always call string-based procs on it, no silly nil checks
07:27:43FromDiscord<Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=
07:28:05FromDiscord<Yardanico> https://nim-lang.org/docs/wrapnils.html
07:28:16PMunchZectbumo, you don't really need that in Nim. But optionsutils has something similar for options: https://github.com/PMunch/nim-optionsutils
07:28:34FromDiscord<Yardanico> although it is a bit different, optionsutils is better
07:28:49FromDiscord<Yardanico> also there's https://github.com/status-im/questionable from status
07:29:16FromDiscord<Yardanico> @Zectbumo just make your own version of stdlib as some people do :P
07:29:35FromDiscord<Yardanico> if they don't agree with the way nim stdlib is structured or how it handles things
07:30:08FromDiscord<Zectbumo> In reply to @Yardanico "<@157415492812800000> just make your": it does seem that's the way
07:30:39FromDiscord<Yardanico> but really, i think your ideas are all a bit too pythony, e.g. the one about typeless arguments
07:30:45FromDiscord<Zectbumo> I went through optionutils earlier when I ran into it in the cookies module
07:30:59FromDiscord<Yardanico> if you use nim for some time you'll stop trying to make it look like python :)
07:31:21FromDiscord<Zectbumo> sure, and I really like that it's so flexible that I can get what I want
07:31:52*krux02 joined #nim
07:32:06FromDiscord<Yardanico> yes i didn't say you can't, that's why a lot of people use nim
07:32:13FromDiscord<Yardanico> even if they disagree with the stdlib or other stuff
07:32:28*krux02 quit (Remote host closed the connection)
07:32:33FromDiscord<Yardanico> but the majority still prefers to try to do it with existing nim means instead of doing something completely new
07:33:01FromDiscord<Zectbumo> wrapnils looks interesting. a bit backward for my taste but works.
07:36:10FromDiscord<Zectbumo> btw, not looking to make nim into python, just using python as a bar that I'd like to see nim meet or exceed
07:36:24FromDiscord<Zectbumo> javascript too
07:39:05*gsalazar joined #nim
07:56:43FromDiscord<Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3XTx
08:00:23FromDiscord<Zectbumo> sent a code paste, see https://paste.rs/KI3
08:19:20FromDiscord<sheerluck> what is `has` here?
08:20:13FromDiscord<Elegantbeef> A very obscure procedure name
08:20:21FromDiscord<Rika> sent a code paste, see https://paste.rs/cn9
08:20:47FromDiscord<Rika> It is elegant, but it is not self explanatory nor glance-understandable
08:21:13FromDiscord<sheerluck> In reply to @Elegantbeef "A very obscure procedure": so `I can has cheezburger?` is valid Nim, right?
08:21:15FromDiscord<Rika> “Elegant” for whatever that word means really
08:21:24FromDiscord<Rika> In reply to @sheerluck "so `I can has": Postfix ? 🙂
08:21:31FromDiscord<Rika> No postfix here other than
08:21:40FromDiscord<Elegantbeef> and `[]`
08:21:44FromDiscord<Rika> True
08:32:46*ltriant_ joined #nim
08:33:50*ltriant quit (Ping timeout: 240 seconds)
08:50:36*dithpri quit (Remote host closed the connection)
09:12:48FromDiscord<Phil> In reply to @Zectbumo "see, great example of": My friend, compile-time checks are heaven. It is very lovely to prevent yourself from being dumb at compile time
09:13:14FromDiscord<Phil> I wish python could prevent me more from being dumb
09:13:26FromDiscord<Phil> (edit) "dumb" => "dumb. Sadly it doesn't, it trusts me! What a foolish notion"
09:16:12FromDiscord<Phil> Also, Spy X Family has ruined me. I hear "elegant", I immediately have anime-memes in my head of an old bearded dude in a tailcoat and a cane shouting about how X is elegant or not
09:16:27FromDiscord<Elegantbeef> No comment
09:22:59*dmichiels joined #nim
09:38:48*Zectbumo quit (Remote host closed the connection)