<< 01-04-2018 >>

00:07:48*Trustable quit (Remote host closed the connection)
00:28:40*clyybber quit (Ping timeout: 248 seconds)
00:36:03*arnetheduck joined #nim
01:01:27*SenasOzys quit (Ping timeout: 260 seconds)
01:07:11*clyybber joined #nim
01:12:17FromGitter<matrixbot> `petersjt014` Hi: I'm trying to compile something and am not getting any luck sofar. I have this set in nim.cfg: ⏎ ⏎ ```gcc.path = r"C:\Program Files\Git\mingw64\bin"``` ⏎ ⏎ which the compiler apparently doesn't like. It is a formatting thing? [https://gitter.im/nim-lang/Nim?at=5ac031f0458cbde557990876]
01:15:52*S1tiSchu joined #nim
01:19:28*SitiSchu quit (Ping timeout: 240 seconds)
01:41:59*tefter quit (Remote host closed the connection)
01:44:41*yglukhov quit (Read error: Connection reset by peer)
01:45:33*yglukhov joined #nim
02:14:35*clyybber quit (Quit: good night)
02:15:13*dddddd quit (Remote host closed the connection)
02:37:30*athenot joined #nim
02:41:18*max3 joined #nim
02:41:50*otep joined #nim
02:42:06*otep left #nim (#nim)
02:42:45*athenot quit (Ping timeout: 276 seconds)
02:44:34*athenot joined #nim
02:56:46FromGitter<data-man> @petersjt014: Try add path to system env %PATH%
03:05:07*athenot quit (Ping timeout: 260 seconds)
03:35:34FromGitter<matrixbot> `petersjt014` suddenly It's in `C:\bin\mingw64`. I have no idea how that happened, but it works now. thanks!
03:37:14FromGitter<matrixbot> `petersjt014` I finally have a working nim install. The fun begins.
03:41:57FromGitter<matrixbot> `petersjt014` it feels pretty nice to just be able to get an exe right away
03:43:40FromGitter<genotrance> That's the best part ;)
03:52:44FromGitter<matrixbot> `petersjt014` though calling command line utils without any kind of wrapper still feels...weird.
03:53:10FromGitter<matrixbot> `petersjt014` It gives me a mild fear of name collisions or something, but I'll admit it's convenient
03:59:05FromGitter<zacharycarter> is there a way to get a file handle from a directory?
03:59:13FromGitter<zacharycarter> trying not to resort to using the posix module
05:10:10*shashlick1 joined #nim
05:24:49*byte512 quit (Ping timeout: 248 seconds)
05:26:39*byte512 joined #nim
05:33:02FromGitter<zacharycarter> anyone have any examples of using the dispatcher w/ posix and asyncdispatch?
05:33:10FromGitter<zacharycarter> I've found a windows example but nothing for osx / linux
05:49:19FromGitter<zacharycarter> I'm really just needing help converting code from the old asyncio format to the new asyncdispatch format for osx
05:49:39FromGitter<zacharycarter> can't quite figure out how to register things w/ the global dispatcher - just calling register with the fd isn't working obv
06:05:28*shashlick1 quit (Quit: WeeChat 1.9.1)
06:05:50*shashlick1 joined #nim
06:42:37*Lord_Nightmare quit (Ping timeout: 256 seconds)
06:44:41*Lord_Nightmare joined #nim
06:49:26*yglukhov quit (Read error: Connection reset by peer)
06:50:03*yglukhov joined #nim
07:05:31*rokups joined #nim
07:06:24*max3 quit (Quit: Connection closed for inactivity)
07:08:36*yglukhov quit (Ping timeout: 276 seconds)
07:09:24*yglukhov joined #nim
07:21:00*gokr joined #nim
07:28:00FromGitter<kinkinkijkin> I'm having a confusing issue
07:28:13FromGitter<kinkinkijkin> for some reason, .contains from strutils is returning reversed values
07:28:23FromGitter<kinkinkijkin> true if not containing, false if containing
07:28:45FromGitter<kinkinkijkin> is this standard behaviour in nim or is this weird?
07:32:20FromGitter<kinkinkijkin> hmm, it's only happening sometimes
07:39:09*gokr quit (Ping timeout: 276 seconds)
07:50:56FromGitter<kinkinkijkin> nvm I was testing a strict upgrade of the code standard I'm making on code written to the old version of the standard
07:51:05FromGitter<kinkinkijkin> and it was causing some expectable issues
07:51:11FromGitter<kinkinkijkin> just added a compatability line
07:53:11*jjido joined #nim
07:53:55*arecaceae quit (Remote host closed the connection)
07:54:19*arecaceae joined #nim
07:58:34*xkapastel quit (Quit: Connection closed for inactivity)
08:00:31*gokr joined #nim
08:03:21*Senketsu_ joined #nim
08:04:15*nsf joined #nim
08:10:12*endragor joined #nim
08:17:39*Senketsu_ quit (Remote host closed the connection)
08:25:20*user1101 joined #nim
08:26:39*federico3 quit (Ping timeout: 260 seconds)
08:26:49*federico3 joined #nim
08:31:25*rockcavera joined #nim
08:44:22FromGitter<mratsim> it’s weird ;)
08:53:33*r3d9u11 joined #nim
08:58:38*yglukhov quit (Read error: Connection reset by peer)
08:59:11*yglukhov joined #nim
08:59:21*yglukhov quit (Remote host closed the connection)
08:59:54*yglukhov joined #nim
09:01:38*yglukhov quit (Remote host closed the connection)
09:01:50*yglukhov joined #nim
09:02:07*rauss quit (Read error: Connection reset by peer)
09:03:18*rauss joined #nim
09:06:00FromGitter<kinkinkijkin> okay, I have successfully implemented inline loops of arbitrary length, looping count, depth, position, and grouping
09:06:28*SenasOzys joined #nim
09:06:42FromGitter<kinkinkijkin> now that I've done the easy part, it's time to move on to the renderer
09:10:33*yglukhov quit (Remote host closed the connection)
09:10:36*Vladar joined #nim
09:20:13*yglukhov joined #nim
09:25:01FromGitter<alehander42> what project are you working on :O
09:25:15*ofelas quit (Ping timeout: 256 seconds)
09:37:04FromGitter<mratsim> A music project
09:39:44FromGitter<mratsim> https://irclogs.nim-lang.org/30-03-2018.html#08:10:05
09:41:23*gokr quit (Quit: Leaving.)
09:45:40*Ven`` joined #nim
09:52:47*rokups quit (Quit: Connection closed for inactivity)
10:17:20dom96So tempted to announce Nim v1 for April Fools :P
10:17:27Yardanicodom96, :P
10:17:43*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:17:57dom96Need something more ridiculous though, that's too believable :)
10:19:14Yardanicodom96, python backend :D
10:20:04*NimBot joined #nim
10:21:57*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:22:11federico3please don't /o\
10:25:09Yardanicodom96, what is the best way to limit number of running async futures at the same time?
10:25:46Yardanicomake a count, increment it when future starts, decrement from future callback? and also I need to wait until this count is lower than maximum
10:26:28Yardanicomy program is mostly IO intensive, but I think threads may actually be a better choice here
10:29:35*nsf quit (Quit: WeeChat 2.0.1)
10:30:03*jjido joined #nim
10:31:16FromGitter<alehander42> Haha python backend would be funny
10:32:15FromGitter<alehander42> And it will provoke an I
10:32:34FromGitter<alehander42> Interesting discussion in py5hon threads:D
10:32:56Yardanicowait, threads can't return values by themselves? I need to use channels or manual memory management, right?
10:32:58federico3actually some people could use it
10:34:30dom96Yardanico: Spawned procedures can
10:34:45dom96Yardanico: IO intensive means you should be using async
10:34:49dom96not threads
10:35:46Yardanicodom96, i'm trying, but I somehow need efficiently limit count of futures running at the same time
10:36:33dom96why?
10:38:08Yardanicodom96, well I'm making a program for pen-testing routers, so I call async proc for every ip:port combination, but I want to limit number of routers being scanned at the same time
10:38:27Yardanicoand also I need to think about timeouts with async http client
10:39:31federico3sounds more like a security scanner
10:39:54Yardanicofederico3, well, probably
10:40:13dom96okay, so yeah, just keep an int somewhere
10:40:20dom96increment when async proc starts
10:40:22dom96decrement when finishes
10:40:43dom96Try not to use global variables if you can help it, better to have a State object that you pass around
10:41:29federico3dom96: how about a blockchain-based backend? :D
10:42:17Yardanicodom96, and to check count of futures I can use "while runningCount >= maxCount: await sleepAsync(50)" ?
10:42:33YardanicoI mean to limit count of futures running at the same time
10:45:45*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:59:22FromGitter<dom96> Sure. There is probably a more efficient method but that'll work.
10:59:34*qwertfisch quit (Quit: ZNC - http://znc.in)
11:00:07*jjido joined #nim
11:11:04*zahary_ quit (Quit: Connection closed for inactivity)
11:15:45*dddddd joined #nim
11:16:03*SenasOzys quit (Read error: Connection reset by peer)
11:16:14*SenasOzys_ joined #nim
11:33:21Yardanicobut currently I'm fighting with async httpclient - for some reason it just hangs after 5-10 seconds from program start (async getContent proc)
11:34:44Yardanicowell, first calls to async getContent proc are being executed fine, but after 10-15 seconds new calls just hang
11:41:11FromGitter<mratsim> How about Nim PHP backend revived ? :P
11:43:17FromGitter<mratsim> but Python backend would be the best I think. “After listening to our community and the wealth on Python <-> Nim bridges, we decided to support Python bytecode as one of Nim’s official backend"
11:48:29FromGitter<mratsim> The best April’s Fools I ever saw was this one: http://dev.opera.com/articles/view/labs-introducing-opera-face-gestures/
11:50:16*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:59:32*aguspiza joined #nim
12:01:36VladarAnd the joke is that Opera is still relevant? =)
12:07:37*natrys joined #nim
12:18:15*jjido joined #nim
12:21:38FromGitter<mratsim> Opera is actually great
12:23:18*jaco60 joined #nim
12:35:21FromGitter<zetashift> +1 for the Python backend
12:35:32FromGitter<zetashift> also IS opera still great? I know it was great
12:45:02*jjido quit (Ping timeout: 256 seconds)
12:57:23*xet7 quit (Ping timeout: 256 seconds)
13:09:07*xet7 joined #nim
13:19:38VladarIMO, Opera *was* great while it used its own engine.
13:35:09*SenasOzys_ quit (Ping timeout: 264 seconds)
13:36:12*yglukhov quit (Remote host closed the connection)
13:43:42*nsf joined #nim
13:44:38*SenasOzys_ joined #nim
13:44:40*SenasOzys_ quit (Remote host closed the connection)
13:45:35*SenasOzys joined #nim
14:00:15FromGitter<zacharycarter> still looking for help w/ asyncdispatch
14:00:34FromGitter<zacharycarter> need someone to explain / show how to register handlers for posix based operating systems
14:00:39FromGitter<zacharycarter> I have an example for windows os
14:01:18*r3d9u11 quit (Remote host closed the connection)
14:05:39dom96zacharycarter: looked into fsmonitor's source code?
14:07:09FromGitter<zacharycarter> yes but it uses the old asyncio module I believe dom96
14:07:12FromGitter<zacharycarter> not asyncdispatch
14:08:01FromGitter<zacharycarter> that's where I started - then I realized asyncio was being deprecated
14:08:05FromGitter<zacharycarter> and replaced w/ asyncdispatch
14:09:00FromGitter<diegogub> hi guys, someone could send me few examples of macros? i'm trying to build a case statement with variable cases..
14:09:30FromGitter<diegogub> I have been reading everywhere from macros, but Im not sure which is correct way to code one
14:09:50FromGitter<diegogub> I wanted to avoid parsing a string..
14:10:06FromGitter<zacharycarter> the best way IMO is to first figure out what AST you need to generate
14:10:26FromGitter<zacharycarter> then use one of the helper macros inside the macros module to show you want code you need to write to do so
14:10:46FromGitter<diegogub> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac0e866458cbde5579b45f6]
14:11:08FromGitter<zacharycarter> that's what you want to generate?
14:11:35FromGitter<diegogub> yes, at first..to get started, but I would send a array of strings..to generate more Ofbranch
14:11:44FromGitter<diegogub> something like:
14:11:45FromGitter<diegogub> macro mcase(val: string; events: seq[string]): typed =
14:11:58FromGitter<zacharycarter> well start out this way -
14:16:15*user1101 left #nim (#nim)
14:17:18FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac0e9ed458cbde5579b4cd6]
14:17:42FromGitter<zacharycarter> the second macro basically gives you the code you need to write the macro
14:17:49FromGitter<zacharycarter> minus writing the macro signature and handling parameters
14:17:57*user1101_ joined #nim
14:18:09FromGitter<zacharycarter> dom96: so should I use asyncio? or is there a way to do this with asyncdispatch too?
14:18:59FromGitter<diegogub> thank you @zacharycarter
14:19:12FromGitter<diegogub> Also reading the code behing helpers is good
14:19:25FromGitter<zacharycarter> np
14:20:09*user1101_ quit (Read error: Connection reset by peer)
14:48:34dom96zacharycarter: oh, you definitely shouldn't use asyncio
14:50:04dom96You should use the selectors module I think https://nim-lang.org/docs/selectors.html
14:51:11FromGitter<zacharycarter> ah okay - I had a suspicion (last weekend or the weekend before) that that's what I should be using - thank you for confirming :)
15:07:05*arnetheduck quit (Ping timeout: 240 seconds)
15:07:38dom96Wow, I'm amazed. My WiFi deauther works on my home WiFi network and I don't even need its passphrase :o
15:08:24*arnetheduck joined #nim
15:12:34FromGitter<zacharycarter> :D
15:14:27*yglukhov joined #nim
15:21:09FromGitter<alehander42> https://nim-lang.org/blog.html I am dissapointed, no 1 april result :D
15:26:14federico3*disappointed
15:26:36dom96We can still do something, ideas welcome :)
15:28:04federico3dom96: the backend I suggested :p
15:29:05dom96blockchain?
15:30:57federico3...at the risk of being taken seriously and receiving millions in funding
15:32:23dom96Not sure how I could explain that :)
15:40:01*edcragg quit (Quit: ZNC - http://znc.in)
15:40:03dom96Nice thought though, Bitcoin is all the rage.
15:40:09federico3the compiler starting the build puts sources into DAG nodes. Other compiler compile them into C sources into other nested nodes and then objects and then link them. This achieves distributed building - consensus ensures the build is trusted (aka nobody injected backdoors).
15:40:10dom96Even though it's dropping like a stone right now
15:40:15*edcragg joined #nim
15:40:35dom96hah, proof-of-work by compilation
15:41:09federico3that wasn't meant as PoW but why not throwing that in :D
15:42:32*enthus1ast joined #nim
15:44:21*enthus1a1t quit (Ping timeout: 256 seconds)
15:45:54*xkapastel joined #nim
15:46:02*SenasOzys quit (Remote host closed the connection)
15:48:31*SenasOzys joined #nim
15:50:41FromGitter<alehander42> @dom96 give me a min
15:54:15FromGitter<mratsim> can I give you a nim instead ;)
15:54:26*natrys quit (Ping timeout: 276 seconds)
15:56:16FromGitter<mratsim> Ethereum is dropping because an ASIC miner for Ethereum has been running for 2 months. And ASICs increase centralization, so no the discussion is about forking Ethereum: https://github.com/ethereum/EIPs/issues/958
15:57:26FromGitter<mratsim> I just spent more time wrapping a Fortran proc to do linear regression than doing an emulator for Chip-8 :/. And the code I produced is super unclean ...
15:58:06dom96mratsim: oh? And why is Bitcoin dropping? :)
15:58:28FromGitter<mratsim> I don’t know :P
16:00:34*yglukhov quit (Remote host closed the connection)
16:01:06*yglukhov joined #nim
16:05:53*yglukhov quit (Ping timeout: 256 seconds)
16:06:39*Ven`` joined #nim
16:06:39*natrys joined #nim
16:06:41*Ven`` quit (Client Quit)
16:09:52FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac1044f92f5d6205781d563]
16:10:52FromGitter<alehander42> :D that's my 1 april idea but it's probably a bit too random (and it requires some more ideas & editing from somebody who knows english )
16:11:45FromGitter<alehander42> https://gist.github.com/alehander42/2a8bfd7b4dedd6dc9e9b5999e75c98e3
16:16:07*S1tiSchu is now known as SitiSchu
16:24:53*xincognito10[m] left #nim ("User left")
16:36:04FromGitter<zetashift> I wouldn't mention it as a new release version, maybe under a new flag or something
16:38:06*Snircle joined #nim
16:38:31FromGitter<AjBreidenbach> wait it's an april fools joke, right?
16:38:44FromGitter<data-man> And OpenCL backend! :)
16:41:37*enthus1a1t joined #nim
16:41:54federico3that sounds way too real to be an april fool
16:42:12FromGitter<alehander42> exactly
16:42:31FromGitter<alehander42> the best april fools are the ones that make you doubt if it's actually real
16:43:27*enthus1ast quit (Ping timeout: 240 seconds)
16:43:31FromGitter<alehander42> anyway if you guys or @dom96 want you can reuse something of this for some parody article, I am heading out now
16:44:13FromGitter<data-man> Hm, Brainfuck backend?
16:58:03FromGitter<alehander42> I admit this whole brains-of-Araq-and gitter people connected into a cloud that compiles Nim projects in realtime
16:58:06FromGitter<alehander42> is a bit creepy
16:59:41FromGitter<mratsim> the computer research scientist is a bit too far fetched
17:00:13FromGitter<mratsim> "Nim releases its borrow checker!"
17:00:22FromGitter<mratsim> would actually be believable :P
17:01:40*ofelas joined #nim
17:17:38*PMunch joined #nim
17:18:33PMunchHmm, would it be possible for the documentation generator to check hyperlinks somehow?
17:19:10PMunchI feel a lot of links are always broken
17:19:22*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
17:19:53PMunchThe last one I noticed is the link to "built in set type" here: https://nim-lang.org/docs/sets.html
17:20:24PMunchIt links to https://nim-lang.org/docs/manual.html#set-type but the actual section is https://nim-lang.org/docs/manual.html#types-set-type
17:22:52PMunchAnother question, is it possible to create a type with some fields hidden? I know you can use the export marker to export things, but that only applies across module borders. So I guess what I need to do is create same kind of pseudo-module
17:26:55FromGitter<mratsim> @PMunch, this is what i use: https://github.com/status-im/nim-eth-keys/blob/f22ae0a827f74ddad0e9c5ce39b64e9f93453f9f/src/datatypes.nim#L34-L51
17:30:16FromGitter<wu-lee> newbie question: how do I echo the address of a variable/ref? I seem to be unable to stringify the result of addr().
17:32:35FromGitter<mratsim> repr
17:32:59FromGitter<mratsim> or $castByteAddress (add foo)
17:33:19FromGitter<mratsim> cast ByteAddress addr foo (Gitter eating brackets)
17:35:13FromGitter<wu-lee> @mratsim thanks!
17:36:46FromGitter<data-man> My new console favorites: :) ⏎ https://github.com/rgburke/grvhttps://github.com/rgburke/wed
17:39:13*yglukhov joined #nim
17:43:21*yglukhov quit (Read error: Connection reset by peer)
17:43:58*yglukhov joined #nim
17:49:32*SenasOzys quit (Remote host closed the connection)
17:52:33*SenasOzys joined #nim
17:53:56*r3d9u11 joined #nim
17:54:32*yglukhov quit (Remote host closed the connection)
17:55:22*xkapastel quit (Quit: Connection closed for inactivity)
18:00:07FromGitter<Vindaar> just replace both by emacs + magit (magit alone is a good enough reason to use emacs, imo :P )
18:10:34*yglukhov joined #nim
18:12:06*yglukhov quit (Remote host closed the connection)
18:13:24FromGitter<Vindaar> rereading my message makes it sound way too serious, haha
18:28:27*PMunch quit (Ping timeout: 240 seconds)
18:37:57*miran joined #nim
18:42:58*PMunch joined #nim
18:45:28PMunchmratsim, and that's sufficient for them to be seen as regular variables?
19:03:16*xkapastel joined #nim
19:06:00PMunchHmm, Araq did you mention that you wanted to fix that int literals weren't accepted in container initialisation?
19:06:17Araqno.
19:06:50PMunchie. var x: seq[uint8] = @[1, 2, 3]
19:06:54PMunchHmm, why not?
19:07:21Araqbecause special typing rules to save keystrokes suck.
19:07:34Araqto save keystrokes, Nim has macros.
19:08:24PMunchBut 1 could just as well be a uint8 and not an int. It's just chosen to be always be an int..
19:12:24dom96This is what mapLiterals is for https://nim-lang.org/docs/sequtils.html#mapLiterals.m,untyped,untyped
19:13:06dom96I do wish Nim was more friendly here though.
19:13:11dom96s/friendly/permissive/
19:13:15FromGitter<data-man> ```import sequtils ⏎ var x = mapLiterals([1, 2, 3], uint8) ⏎ ⏎ echo x``` ⏎ ⏎ I late :) [https://gitter.im/nim-lang/Nim?at=5ac12f4bc4d0ae8007250c06]
19:24:28*smt` joined #nim
19:25:43PMunchHmm, I guess that works. But it's kind of a hack IMO
19:25:55PMunchWhy would 1 be locked to the int type anyways
19:26:40PMunchEspecially since you can do "var x: uint8 = 5"
19:28:10mirancan't you do something like @[5'u8, 6, 7, 8] ?
19:28:37*smt quit (Ping timeout: 260 seconds)
19:29:13PMunchmapLiterals didn't even work for what I was trying to do.. http://ix.io/15u0/
19:29:43PMunchmiran, yes you can. And it works fine for uint8. But take my example, I want to use a set of a range type
19:30:28PMunchIt works fine if I do x = {range[0..10](1), 2, 3, 4} as it assumes the same type for the rest of the integers
19:31:01*shashlick1 quit (Read error: Connection reset by peer)
19:31:08PMunchBut that just looks confusing. If Nim is able to convert all the other integers, why not also the first. The type of x is already known to be seq[range[0..10]]
19:31:16PMunchs/seq/set
19:31:40PMunchI'll be back in a bit, going to take a shower
19:31:41*shashlick1 joined #nim
19:32:15miranagreed
19:33:07FromGitter<data-man> @PMunch: ⏎ ⏎ ``` I agree with you.``` [https://gitter.im/nim-lang/Nim?at=5ac133f227c509a774c85f71]
19:34:33dom96I think the compiler doesn't have easy access to the type of 'x' when it's resolving the type of the set
19:34:42dom96I think that's the problem
19:35:03dom96And Araq doesn't want to convolute the logic further to support it
19:35:10dom96Which I can sympathise with
19:46:03PMunchBack now, apparently someone needed the shower before I got the chance :P
19:47:10PMunchdom96, sure. But does 1 have to be resolved to int before knowing what type it wants. Wouldn't it be possible to have an intermediary NumberLiteral type that the compiler could apply before they got resolved to whatever was expected?
19:49:44PMunchdata-man. The thing is I want to generate objects were each field is optional. Instead of just having them defined as optional this and optional that I wanted to save some space and try to make the interface easier by using a bitset for which variables where available and getters/setters like the ones miran showed to manage the fields and the set.
19:50:27PMunchBut it doesn't really make sense to give the set many more possible values than I have types, hence why I wanted to restrict them with a range
19:50:49PMunchSo making a new type for each of the various ranges is a bit odd
19:54:10miranIMO, if you define your x as a set of range[0..10], then when you later create it with {1, 2}, it should be "known" that these values are from that range
19:56:04FromGitter<data-man> @PMunch: Oh, I'm just working on over the bitset with arbitrary size. Based on bitsets module from compiler's dir. Candidate for collections/bitsets. :)
20:02:45*SenasOzys quit (Ping timeout: 256 seconds)
20:07:09*gokr joined #nim
20:12:29PMunchHmm, miran. Do you know if there is a way to override the object constructor as well?
20:12:46PMunchAs in MyObject(someField: 100, anotherField: "Hello world")
20:15:18miranoverride in which sense?
20:16:05PMunchI've now created a type similar to yours
20:16:22PMunchWith hidden fields and setters and getter
20:17:46PMunchAnd it works fine if I do "var x: MyObject; x.someField = 100" But I can't do "var x = MyObject(someField: 100)" since that is an object constructor
20:18:19PMunchWhich are not privy to the setter and getters
20:19:42*SenasOzys joined #nim
20:21:02miranyou want to use the second way to do what the first way does?
20:21:44miran(sorry, it's getting late and i'm quite tired, so i might be slow :))
20:22:39PMunchYes
20:22:41PMunchExactly
20:23:51FromGitter<data-man> https://www.reddit.com/r/programming/comments/88phv7/c_will_no_longer_have_pointers/ ⏎ ⏎ > I hate April 1st on the internet ⏎ ⏎ :-D [https://gitter.im/nim-lang/Nim?at=5ac13fd7e4ff28713a98f409]
20:26:08PMunchhttp://ix.io/15vS/Nim
20:26:38PMunchmiran, that is what I have now. As you can see it fails on line 46, but the three preceding lines work if you uncomment them and comment out line 46
20:27:56PMunchOh well, shower is apparently available now. Back in a bit (hopefully)
20:28:12miranthanks for the example, now your intent is more clear, let me check and think a bit
20:30:00*SenasOzys quit (Ping timeout: 268 seconds)
20:33:28*miran_ joined #nim
20:35:19miran_sorry PMunch, it is too late for me to think clearly.... hopefully someone else will jump in and help... good night everybody
20:36:38*miran quit (Ping timeout: 256 seconds)
20:37:56*miran_ quit (Client Quit)
20:39:22dom96PMunch: that sounds like it could work, perhaps you could dive into the compiler source and try to hack it in there? :)
20:41:32dom96This is a good one: https://blog.adacore.com/getting-rid-of-rust-with-ada
20:46:07*yglukhov joined #nim
20:47:30*r3d9u11 quit (Remote host closed the connection)
20:53:28PMunchdom96, what sounds like it could work?
20:53:29*SenasOzys joined #nim
20:53:41dom96"Wouldn't it be possible to have an intermediary NumberLiteral type that the compiler could apply before they got resolved to whatever was expected?"
20:53:44dom96That
20:54:46PMunchAnd nice punny article by the way
20:55:06PMunchdom96, oh right. Hmm..
20:55:35PMunchThat would have to wait 'til tomorrow at least
20:56:09PMunchGetting late already, and delving into the compiler source is something I have to do with a clear head :P
20:57:12*Vladar quit (Quit: Leaving)
21:01:28*rockcavera quit (Remote host closed the connection)
21:02:06FromGitter<wu-lee> newbie q: given a ref x, I can get the var with x[]; given a var/const/let y, can I get a ref to it? and are refs always mutable?
21:08:58FromGitter<zacharycarter> we should have done a april fools blog post about Nim having a Rust target
21:09:21PMunchzacharycarter, haha yes, that would've been great!
21:09:48PMunchwu-lee, const and let doesn't have an address
21:10:02PMunchBut otherwise yes
21:11:20dom96zacharycarter: gist creation on play.nim-lang.org is broken :(
21:11:29dom96and I can't even create my own gist manually and then use
21:12:07dom96I'm not sure if it this is also an april fools joke: https://www.reddit.com/r/programming/comments/88sqrn/a_modern_syntax_for_ada/
21:12:08dom96but lol
21:12:12dom96Nim literally has this feature
21:12:30FromGitter<zacharycarter> yeah I need to update the playground to not use anon gists
21:12:33FromGitter<zacharycarter> just haven't gotten around to it yet
21:16:40*Ven`` joined #nim
21:17:14AraqPMunch: I don't think a language where const x: T = value is different from const x = value is particularly elegant or consistent
21:17:29*Ven` joined #nim
21:17:50Araqbut I noticed 'consistency' is only an argument when others use this word.
21:18:35FromDiscord<treeform> there should be `value = T : const x` too!
21:19:16Araqon the other hand, we have var x: seq[int] = @[] and var x = @[] is illegal :-/
21:19:48Araqbut that means empty constructors are badly designed :P
21:21:18*Ven`` quit (Ping timeout: 260 seconds)
21:22:28*Ven` quit (Ping timeout: 260 seconds)
21:24:59FromDiscord<treeform> Hey Araq, what would it take to replace the cairo library: https://github.com/nim-lang/cairo with this: https://github.com/treeform/cairo which has more docs and tests.
21:25:26*Ven`` joined #nim
21:27:25Araqhmmm
21:28:22dom96treeform: oooh, beautiful
21:28:33FromDiscord<treeform> thanks
21:29:53FromGitter<kinkinkijkin> I can't help but feel there's something wrong with this code but I can't pinpoint what https://i.imgur.com/wasZ2Cg.png
21:30:45dom96treeform: So I'm not sure how to best handle these situations
21:30:55dom96There are projects out there that depend on the current 'cairo' package
21:31:11dom96I don't think replacing it with another package under people's noses is a good idea
21:31:19*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:31:49FromGitter<kinkinkijkin> add it under a different name from the current package
21:32:02*smt` is now known as smt
21:32:05FromGitter<kinkinkijkin> and deprecate but keep in for compatability the old one
21:32:18FromDiscord<treeform> but then people would use the old package because it has a better name?
21:33:26FromDiscord<treeform> I don't think package could be deprecate right now?
21:33:38PMunchAraq, problem is that Nim now appears to be inconsistent. "var x: uint8 = 5" works, while "var x: seq[uint8] = @[5]" doesn't work? We already have "var x: T = 5" != "var x = 5" with integer types as well which you just said isn't elegant or consistent..
21:34:04Araqnimble could have "selected" packages
21:34:21*Ven`` joined #nim
21:34:30AraqPMunch: yeah, so it's already bad. don't want to make it worse
21:34:43PMunchWell I'd say it'd make it better
21:34:51PMunchMore consistent with what already exists
21:35:04PMunchAnd seem less like some feature is missing..
21:35:22AraqI'd rather remove the int literals from the language
21:35:50dom96kinkinkijkin: Regarding your code: you can take advantage of type inference in many places
21:36:01dom96kinkinkijkin: also, you should space out your code a bit more
21:36:55dom96another style thing, the 'else' in your first if isn't necessary
21:36:55PMunchAraq, remove int literals? How would you define x = 5?
21:36:58dom96you are returning anyway
21:37:07dom96so you can just deindent the code under that 'else' and remove the 'else'
21:37:22dom96also, the 'return' at the bottom of the proc isn't necessary
21:38:00Araqplus your code is doing string parsing in a convoluted way, try parseutils.nim
21:38:29FromGitter<kinkinkijkin> I know the return isn't necessary but I've committed it to this project's code style
21:38:42FromGitter<kinkinkijkin> I'll look at parseutils if it's part of the standard modules
21:39:22FromGitter<kinkinkijkin> I don't quite know how to implement a fast parser very well so this is the best I came up with
21:40:24dom96better than going straight for regex :)
21:40:54FromGitter<kinkinkijkin> yeah, I went straight for regex on the original, first version of this project in C#
21:41:03FromGitter<kinkinkijkin> v2 was also c# but far better
21:41:05FromGitter<kinkinkijkin> this is v3
21:42:01dom96btw, my book has a nice chapter on parsing and parallelism ;)
21:42:25AraqPMunch: 5 would be 'int', not 'int literal(5)'
21:42:58dom96Araq: Why isn't it just `number literal(5)`?
21:43:14AraqPMunch: var x: seq[byte] = @[3] does not work and var x: seq[byte] = @[myintVar] does not work either. it is consistent in its own ways.
21:44:04PMunchYeah but var x:byte = 3 does, and that makes it confusing that var x: seq[byte] = @[3] doesn't work
21:44:26PMunchI know why it doesn't, but I'd wager 99% of Nim users have tried that at some point
21:44:39FromGitter<kinkinkijkin> imo it seems inconsistent that you can't initialize a numeric seq like that
21:45:27dom96Literals are in special
21:45:40dom96You're saying that var x: seq[byte] = @[myintVar] does not work
21:45:42dom96it shouldn't
21:45:46*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:45:49dom96but literals are different
21:45:49Araqtype conversions do not compose. that's not specific to Nim.
21:46:46Araqthe problem is that that literals are different. in retrospect, I wouldn't do this anymore, it makes everything more complex and confusing. it does save some typing though.
21:47:11PMunchdom96, yeah it makes sense that int variables won't work in a byte assignment. Of course they won't, different types and all. But literals don't really have a type in most peoples heads, and especially not when they can do "var x: byte = 5"
21:47:16dom96You've saved some typing, but not enough
21:47:33dom96yeah, that's exactly it.
21:47:39dom96To many people `5` can be a float too
21:47:50PMunchAh yes
21:48:23PMunchAnd in fact "var x: float = 5" does work
21:48:30FromGitter<kinkinkijkin> hmmm, isn't that a standard thing to learn learning programming though? that literals of different types look different
21:48:51PMunchIf anything an integer and a float should not be mixable, they are stored completely differently!
21:49:31*Ven`` joined #nim
21:50:25FromGitter<kinkinkijkin> like a float should be 5.0 or 5.0f, an int should be 5, a fixed of 5 decimal places should be 5.00000 etc
21:50:46FromGitter<kinkinkijkin> thinking about it, it feels convenient but in a bad way that nim is like this
21:51:31PMunchI think "var x:float = 5" is fine
21:51:58PMunchHaving to write .0 just to specify that something is a float is just annoying
21:52:47*nsf quit (Quit: WeeChat 2.0.1)
21:52:55federico3dom96: regarding #7463 turns out some tests need jester :)
21:52:59FromGitter<kinkinkijkin> I do too but I think if you can do that you should also be able to use a natural literal for any kind of initialization of a number variable that can be natural and contain a natural of the size of the given natural
21:53:26FromGitter<kinkinkijkin> or just remove the "any natural to any type that can contain one" thing
21:53:27*jijiji joined #nim
21:53:53dom96federico3: to be honest, those tests should probably have a Nimble file and require `jester` in it
21:53:53*jijiji quit (Client Quit)
21:54:01dom96federico3: then use nimble to build and test
21:54:14federico3dom96: that would me much more hygenic
22:03:46dom96hrm, so I muted freenode webchat and now I can't remember how to unmute it D:
22:06:37FromDiscord<treeform> when compiling to 32bit platform is int still 64 bit?
22:07:40PMunchDon't think so
22:07:49PMunchI think it's platform specific int
22:08:21FromDiscord<treeform> ok
22:09:19*dom96_ joined #nim
22:09:32*dom96_ quit (Client Quit)
22:09:39PMunchWhich makes it even more annoying that literals don't work with other types than int..
22:09:44dom96yay for past me documenting the hostmask I muted
22:11:28*S1tiSchu joined #nim
22:12:59*SitiSchu quit (Ping timeout: 268 seconds)
22:23:41*natrys quit (Quit: natrys)
22:23:59*rockcavera joined #nim
22:24:53*S1tiSchu quit (Ping timeout: 260 seconds)
22:26:58*SitiSchu joined #nim
22:33:20*smt` joined #nim
22:37:21*smt quit (Ping timeout: 248 seconds)
22:37:50*smt_ joined #nim
22:38:38FromGitter<AjBreidenbach> yay
22:41:05*smt` quit (Ping timeout: 248 seconds)
22:45:26FromGitter<mratsim> by the way `let x = [float32 1, 2, 3, 4]` works but `let x = [float32 -1, 2, 3, 4]` will throw an error
22:46:35Araq-1 is not a int literal, it's unary minus followed by an int literal
22:51:33Araqwe could make -1 an int literal and then -1 is different from - 1
22:52:52dom96please no
22:55:55Araq:P
22:56:21*aguspiza quit (Ping timeout: 256 seconds)
22:57:59*dddddd quit (Remote host closed the connection)
23:02:05PMunchAgain, let's make it not an int literal but a number literal..
23:02:17PMunchWould solve all these strange discrepancies
23:02:48PMunchBy the way, what is the correct way to create a set that I can then assign with {1, 2, 3}?
23:03:17PMunchI tried set[int], but that's too large. set[int16] throws expected range[0..65535]
23:03:32Araqthere you go.
23:03:52Araqset[range[0..65535]]
23:04:33*smt_ quit (Ping timeout: 248 seconds)
23:04:35Araqso ... we rename "int literal" to "number literal" and that solves our problems? lovely
23:04:55Araqthat doesn't even work for 'echo 5'
23:05:22Araq# I doubt this allowed to print 5.0
23:05:43PMunchI really have to do set[range[0..65535]]? Why does that work and not set[range[0..1]]?
23:05:57PMunchEven more crazy discrepancy..
23:06:14Araqactually it's the same reason and the same topic
23:06:30PMunchI know..
23:06:43PMunchWhy wouldn't it work for echo 5?
23:07:02PMunchnumber literal as a string would just be the literal, as a string
23:07:07Araqbecause 5 is too ambiguous, it is just a number
23:07:27Araqso both $ for ints and the $ for floats would match
23:07:47PMunchYeah, but the new $ for number literals would also match
23:07:48Araqor maybe your proposal is to "yeah, well, prefer int" in which case it's today's 'int literal'
23:07:50PMunchAnd take precedence
23:08:01Araqhorrible.
23:08:46PMunchWhy? Because it makes sense to whoever reads it?
23:08:48Araq"your operators should also work on 'numbers' which is a type with no runtime values, but it resolves overloading ambiguities"
23:09:19Araqnew rule for #nim: write an RFC before proposing anything.
23:09:35PMunchThey don't have to work on 'numbers', they would just get resolved at compile-time to whatever is asked for.
23:09:49PMunchHaha, I'll type one up tomorrow
23:09:55Araqit's tiresome to debunk half-assed ideas that are based on word games.
23:09:57FromGitter<mratsim> currently printing integer range type is broken for uint8-16-32, you always get ambiguous call both system.`$` and repr.`$` match
23:10:04PMunchLet's leave it dead for tonight, I'm going to bed soon anyways
23:10:46Araqhappy easter
23:10:55PMunchOh yeah, happy easter!
23:11:03FromGitter<krux02> you too happy easter
23:11:40Araqmratsim. there is no repr.`$`
23:11:47FromGitter<krux02> and we all know easter is the opposite of wester(n)
23:13:49FromGitter<mratsim> Error: ambiguous call; both system.$(x: uint64)[declared in lib/system/repr.nim(28, 5)] and system.$(x: int)[declared in lib/system.nim(1898, 5)] match for: (ProgMem)
23:14:00FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac167b826a769820b2b4a8e]
23:14:38FromGitter<mratsim> I’ll add an issue
23:15:17FromGitter<Araq> why? just fix your code
23:15:57FromGitter<mratsim> I’ve added an overload that converts them to int before printing but why is there ambiguous call here?
23:16:17FromGitter<mratsim> u16 != u64 and != int
23:16:25Araqbecause the compiler says so and it's consistent. it's a program.
23:16:26FromGitter<mratsim> so I guess it’s a converter conflict
23:16:34Araqevery program is 100% perfectly consistent.
23:16:50FromGitter<mratsim> I suppose so, but is it your intent?
23:17:09Araqyou said it yourself.
23:17:23Araqu16 is neither int nor u64
23:18:09FromGitter<mratsim> In that case I should get a `$` not found for type u16.
23:18:38Araqu16 converts to both types though. so both match.
23:18:54FromGitter<mratsim> this works: ⏎ ⏎ ```var a: uint16 ⏎ ⏎ echo a``` [https://gitter.im/nim-lang/Nim?at=5ac168de26a769820b2b4a90]
23:19:34Araqbut that's not a range
23:19:40FromGitter<mratsim> so I really think there is a something that is done for uint16 that is not done for range types
23:19:49Araqyes.
23:20:25FromGitter<mratsim> But range types should have the same semantics has the normal type, besides checking the value right?
23:20:57FromGitter<krux02> @mratsim I just checked the compile error you had
23:20:57Araqnah, ranges make everything more complicated
23:21:07FromGitter<krux02> what exactly is the issue you have with it?
23:21:39FromGitter<krux02> it tells you that it is ambiguous
23:21:45FromGitter<krux02> but what is wrong with that
23:21:54FromGitter<mratsim> I don’t have any issue, it’s easy to workaround it, but that means that if you don’t use uint64 or int or char, you need a specific `$` overload to disambiguate
23:22:26FromGitter<krux02> the range type is not an uint16 anymore and therefor the type has to be converted to an int or uint first before it can be printed
23:22:29Araqno, uint16 works but ranges have an additional conversion relation
23:22:37FromGitter<mratsim> Imagine I’m a new guy coming from say Ada, “cool range types” let’s use it to constrain an uint16 to 100..200 —> why do I need a specific print proc.
23:23:28Araqirrelevant, nobody uses Ada.
23:23:56PMunchWhat?
23:24:00FromGitter<mratsim> You can’t dismiss that argument with Ada, I could have say Rust, or C++ or whatever
23:24:06PMunchAda is used for lots of stuff..
23:24:14AraqRust has range types?
23:24:22Araqthat's news to me.
23:24:30FromGitter<mratsim> It doesn’t, hence working range types could appeal to them
23:24:51PMunchkrux02, I'm going to make a point of inviting people over for watching western movies during easter :P
23:25:00dom96I think it's time for all of you to head for sleep :)
23:25:18PMunchYeah, I'm on my way to bed :)
23:25:21FromGitter<krux02> I am already in bed :P
23:25:25FromGitter<mratsim> well anyone I’ll file an issue, feel free to close it, but I do think it has value.
23:25:26*PMunch quit (Quit: Leaving)
23:25:30FromGitter<mratsim> anyway*
23:25:36FromGitter<krux02> I just thought I peek into this chat befor sleeping :D
23:25:50Araqkrux02: you can help me
23:26:21Araqconsider this type definition
23:26:24FromGitter<krux02> @mratsim it is much nicer, if you provide solutions to problmes that just talking about things that you think are problems.
23:26:25Araqtype
23:26:25Araq string {.core.} = object
23:26:25Araq len, cap: int
23:26:26Araq data: ptr UncheckedArray[char]
23:26:56*gmpreussner quit (Ping timeout: 276 seconds)
23:28:17Araqnow how do I tell the codegen how to map string literals to this
23:28:32*gmpreussner joined #nim
23:28:33Araqso far I have: const nimStringLiteral {.core.} = "{$1, $1, $2}"
23:28:56Araqbut that's not good enough for LLVM, nor for the current strings
23:29:17Araqdepending on the implementation the codegen needs to take the address of this static memory or not
23:31:12Araqso I also need const nimStringLiteralIsAddr {.core.} = false
23:31:20Araqbut that's rather inelegant
23:33:56*Ganonmasteroj joined #nim
23:34:41FromGitter<mratsim> @krux02 I don’t understand, I’m explaining the problem (ambiguous call on range[uint16]), the reasoning why it’s a problem (will trip new people) and the solution (range types should work like their base type for ambiguous call resolution).
23:34:57*Ganonmasteroj left #nim ("#superbowl")
23:38:29FromGitter<krux02> well yea actually I think that is a good point.
23:41:05*endragor quit (Remote host closed the connection)
23:42:30*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:50:11FromGitter<krux02> well I would say the actual problem is that I can't overload the `$` for range types generically. at least not afaik
23:51:14FromGitter<krux02> proc `$`T (arg: range[T]): string = ⏎ $(T(arg))
23:51:22FromGitter<krux02> ``` $(T(arg))```
23:51:48FromGitter<krux02> ```proc `$`[T](arg: range[T]): string = ⏎ $(T(arg))``` [https://gitter.im/nim-lang/Nim?at=5ac17094e3d0b1ff2c8fba62]
23:51:54FromGitter<krux02> this does not compile :(
23:57:21FromGitter<AjBreidenbach> :(
23:57:21*gokr quit (Ping timeout: 265 seconds)
23:57:40arnetheduckAraq, well, I know for a fact the (specially different int) types passed around in the ast are often wrong (ie different on sides of assignments), and this gets hidden by the c gen because of the liberal casting to NI and back
23:57:49arnetheduckvery annoying for nlvm :)