<< 25-09-2019 >>

00:15:20*shota joined #nim
00:20:58*matlock joined #nim
00:21:49matlockI wanted to mention that Snap packages of Nim are now available in stable, LTS 1.0.x, and nightly flavors. Testing is greatly appreciated. https://github.com/sirredbeard/nim_lang_snap
00:46:50*adeohluwa left #nim (#nim)
00:46:58*adeohluwa joined #nim
00:47:00*adeohluwa quit (Remote host closed the connection)
00:51:15FromDiscord<has1> How do you deal with concurrency in nim? I am used to go and channels
00:51:19FromDiscord<has1> I found this
00:51:28FromDiscord<has1> https://nim-lang.org/docs/channels.html
00:52:12FromDiscord<has1> But it tells me "Note: This is part of the system module. Do not import it directly. To activate thread support compile with the --threads:on command line switch."
00:52:12FromDiscord<has1>
00:52:12FromDiscord<has1> So are we not supposed to use this?
00:52:39FromDiscord<has1> Also having to explicitly enable threads via the argument seems pretty strange
00:55:35disruptekthis is the current recommendation for threading: https://github.com/yglukhov/threadpools
00:56:25disruptekwhat you'll find with nim is that it's not really about what's impossible to do by default; it's more about what's possible to do, full stop.
00:57:15disruptekby opting into features like this, you get a better result across all scenarios.
01:02:16*jmiven joined #nim
01:04:08FromDiscord<romulo27> Hello, I am very new to nim but I got the grasp (kinda) on how to use it, but I have been having a bit of issue when attempting to use the --path command
01:04:22FromDiscord<romulo27> It gives me a "command missing" error and I have no idea what that means
01:10:39*ng0_ joined #nim
01:10:55owl_000`proc walkTo(pointA:Coordination, pointB= (0,0))` how to know if pointB is not given by user.
01:13:16*ng0 quit (Ping timeout: 260 seconds)
01:13:18owl_000inside the proc there is a mechanism to auto generate pointB using other value inside `coordination` type
01:14:02owl_000but if pointB is given then it will use directly that value. so how to know pointB is given.
01:22:45leorize@has1: in Nim we use async for concurrency instead
01:23:33leorize@romulo27: what exactly are you trying to do?
01:23:51leorizeowl_000: you can't
01:24:04leorizethe only way is to have an overload without `pointB`
01:24:53FromDiscord<romulo27> >leorize I am tying to install NiGui, and I am literally not doing anything wrong
01:25:02FromDiscord<romulo27> all I am doing is literally use the path command
01:25:12FromDiscord<romulo27> which is imagine is nim --path:<pathhere>
01:25:35owl_000https://play.nim-lang.org/#ix=1WNP i made like this
01:25:49FromDiscord<romulo27> at least I think I am doing it right?
01:25:57leorize@romulo27 if you've installed it via nimble, you wouldn't have to pass `--path`
01:26:53leorizecan I have the full output of Nim when you run it like so?
01:27:13FromDiscord<romulo27> sure
01:27:26FromDiscord<romulo27> but if that changes anything I am currently on windows, might wanna specify this beforehand
01:29:10FromDiscord<romulo27> Hint: used config file 'C:\Users\Romulo\.nimble\config\nim.cfg' [Conf]
01:29:10FromDiscord<romulo27> Error: command missing
01:29:18FromDiscord<romulo27> that is all that is outputted
01:30:32Jjp137--path is an option, and you need to specify something like the "compile" (or c) command before any options, such as: nim c --path:blah hello.nim
01:30:49Jjp137you can see this if you do: nim --help
01:31:03FromDiscord<SodaScripter> Is the nim basics tutorial good
01:31:14FromDiscord<SodaScripter> I've been using it but I wanna know if there's something better out there
01:31:15FromDiscord<romulo27> but I did specify something
01:31:37FromDiscord<romulo27> I specified the src folder path like I was told to in the github page for nigui
01:31:53FromDiscord<SodaScripter> 🤔
01:32:09*shota quit (Remote host closed the connection)
01:32:15FromDiscord<SodaScripter> I'm new to nim too, so I cant really help here ._.
01:32:18FromDiscord<SodaScripter> I'm new to nim too, so I cant really help here. ._.
01:32:19Jjp137you're missing the "c" between nim and --path
01:32:37FromDiscord<SodaScripter> try @romulo27 nim c --path <ur stuff here>
01:32:46leorizeowl_000: try this instead https://play.nim-lang.org/#ix=1WNS
01:32:57FromDiscord<romulo27> I am not trying to compile something
01:33:10FromDiscord<SodaScripter> wut r u trying to do then
01:33:12leorize--path can only be used while compiling...
01:33:15*dwdv quit (Ping timeout: 240 seconds)
01:33:15FromDiscord<romulo27> install nigui
01:33:22FromDiscord<SodaScripter> nigui is a library iirc
01:33:25leorizeuse `nimble install nigui`
01:33:26FromDiscord<romulo27> I am confused then
01:33:30Jjp137oh you should probably install it--yeah with nimble
01:33:31FromDiscord<SodaScripter> u gotta use nimble
01:33:37Jjp137nimble is Nim's package manager
01:33:41FromDiscord<SodaScripter> nimble install nigui
01:33:42FromGitter<zetashift> SodaScripter, Nim Basics is a great start! The main tutorials are better if you already know a programming language
01:33:48Jjp137I'm guessing you're trying to follow the manual install instructions instead?
01:33:53Jjp137for NiGui?
01:33:53FromDiscord<romulo27> ok I thought nimble was a linux thing only
01:34:03Jjp137oh no it isn't
01:34:04FromDiscord<romulo27> yes
01:34:16FromDiscord<SodaScripter> @zetashift I've barely programed with umm other languages but I come from a python, javascript and basic background
01:34:29FromDiscord<SodaScripter> a bit of C in the mix aswell
01:34:45FromDiscord<romulo27> ok I will try the nimble way of installing nigui
01:34:50FromDiscord<SodaScripter> never made anything really cool yet
01:34:59FromDiscord<SodaScripter> nim seems like the first language I might be able to make stuff with
01:35:11owl_000leorize thanks
01:35:40FromDiscord<SodaScripter> is nvim slow for anyone else or is it just me
01:35:46FromDiscord<SodaScripter> like compared to just vim
01:35:50leorizeit's just you :)
01:35:52FromDiscord<SodaScripter> ah
01:35:56FromDiscord<romulo27> oh right I need git
01:36:01FromDiscord<romulo27> greeaaaat
01:36:03FromDiscord<SodaScripter> b r u h
01:36:07FromDiscord<SodaScripter> how do you not have git
01:36:29FromDiscord<romulo27> I am from the scripting language universe
01:36:32Jjp137well...there's always hg :p or svn, or cvs...
01:36:35FromDiscord<SodaScripter> Git is the best invention ever made
01:36:44FromDiscord<romulo27> also known as we already did everything to you so just throw text on screen and see stuff happen
01:36:48*shota joined #nim
01:36:56FromDiscord<SodaScripter> what the actual hell
01:37:06FromDiscord<SodaScripter> my battery indicator just started dying all of the sudden
01:37:55FromDiscord<SodaScripter> it aint workin lole
01:37:56FromDiscord<SodaScripter> oh I see
01:37:56FromDiscord<SodaScripter> this is why you don't combine 2004 GTK themes with 2019 ones
01:38:21FromDiscord<romulo27> ok I did a filename to test
01:38:33FromDiscord<romulo27> and even with the path for a actual .nim file the path command asks for a file
01:38:52leorize@romulo27 uhmm, what exactly are you doing?
01:38:55FromDiscord<SodaScripter> can you show me your command
01:38:58FromDiscord<SodaScripter> like what you just typed
01:38:59leorizecan we have the command + output?
01:39:09FromDiscord<romulo27> going back to the manual way of installing nigui
01:39:13FromDiscord<romulo27> I am not getting git
01:39:18FromDiscord<SodaScripter> why not
01:39:36FromDiscord<romulo27> I don't need another thing to break in the path variable chaos that windows 8 likes to do like nim did 2 hours ago
01:39:46FromDiscord<SodaScripter> it's literally just you click the exe and go through the wizard
01:39:56FromDiscord<SodaScripter> https://git-scm.com/download/win
01:39:59*endragor joined #nim
01:40:07FromDiscord<romulo27> and so is a lot of the stuff that creates a entry in the path variable list
01:40:17FromDiscord<romulo27> yet windows 8 finds a way to break every single time
01:40:27FromDiscord<SodaScripter> it's not just gonna b r e a k for no reason
01:40:38FromDiscord<SodaScripter> it's better to have tried than not tried at all
01:41:02FromDiscord<romulo27> I am using one of the very first windows 8 builds because microsoft decided I should not have windows 8.1
01:41:11FromDiscord<romulo27> like every human being that has 8
01:41:19leorizeit shouldn't break
01:41:48leorizewell, here's the "alternative" way to install
01:41:56leorizedownload NiGui as a zip file from github
01:42:01leorizeunzip it
01:42:06leorizeopen a command prompt in the folder
01:42:10leorizetype `nimble install`
01:42:54FromDiscord<romulo27> ok thank you
01:42:59leorizeif you're on windows you might want to use wNim instead
01:43:02leorizeit supports more widgets
01:43:22FromDiscord<SodaScripter> I thought everyone used NiGui?
01:43:28FromDiscord<romulo27> greeeeeaaaaaaaaat
01:43:30sealmoveguys, can testament be used outside of Nim project?
01:43:31FromDiscord<SodaScripter> man nim really has changed since I last used it haha
01:44:06leorizenigui has never reached popularity in Nim :P
01:44:07FromDiscord<romulo27> I see why people started going for electron
01:44:21FromDiscord<romulo27> no offense, native software is great, but all that library jazz is painful
01:44:59leorizeif you don't want anyone to touch your PATH, then it will always be painful
01:45:13leorizealso you need to read the docs
01:45:35leorizesealmove: yea, IIRC @mratsim is using it for his arraymancer
01:46:00sealmovegreat
01:46:45FromDiscord<has1> @disruptek this thing doesn't even have a readme though??
01:47:00*BonusSoda joined #nim
01:47:02leorize@has1 threadpool is for parallelism
01:47:03BonusSodaHello me
01:47:06FromDiscord<SodaScripter> hi me
01:47:16leorizefor concurrency we use asyncdispatch
01:48:04BonusSodabye me
01:48:05FromDiscord<SodaScripter> bye
01:48:06*BonusSoda quit (Client Quit)
01:49:01FromDiscord<has1> This is one of those concepts that's hard to grasp
01:50:03disruptekthere are a number of different storylines surrounding concurrency in nim, and none of them are without compromise.
01:50:12disruptekit all depends on what you're trying to accomplish.
01:50:19FromDiscord<has1> The way I understand it, you want to use concurrency to split your workload into multiple takes
01:50:35leorizeah, that's parallelism
01:50:51FromDiscord<has1> So for example you might have 3 tasks that you want to execute
01:50:59disrupteki almost never use threads, but that's because almost everything i do is serverless (single-core).
01:51:18leorizeserverless just got a new definition thanks to a startup :P
01:51:46FromDiscord<has1> go do1()
01:51:47FromDiscord<has1> go do2()
01:51:47FromDiscord<has1> go do3()
01:51:47FromDiscord<has1>
01:51:47FromDiscord<has1> Now in Golang you might only have 1 CPU core so those 3 tasks run sequentially after each other
01:52:07FromDiscord<has1> But if you have 3 cores then those tasks can run in parallel
01:52:10disruptekall depends on what `task` means. if it's i/o, you probably want async. if it's an os process, you probably want threads. concurrency in nim doesn't have the oomph of go's channels.
01:52:30leorize@has1 download that threadpool library
01:52:39leorizethen run nim doc threadpool_simple.nim
01:52:58FromDiscord<has1> But I don't care about parallelism, I just want to do things like in go
01:53:15disruptekwell, you can use go for that.
01:53:15FromDiscord<has1> So that it's handled for me automatically
01:53:40leorizethreadpool is kinda similar
01:53:45FromDiscord<has1> That's such a weak argument
01:53:51disruptekif you don't care about parallelism, then there's nothing to talk about.
01:53:52leorizeI've actually done several example in go tutorial in threadpool
01:54:11FromDiscord<has1> I don't like X about language y, so let's throw out the entire language?
01:54:47FromDiscord<has1> @disruptek I care about concurrency
01:54:58leorizewell go have this kind of automated 'concurrency/parallelism'
01:55:19disrupteki'm just quoting you.
01:55:22leorizewhich is really good when you write application code since you won't care what kind is being used
01:55:26FromDiscord<has1> How can I care about parallelism? How do you even know if your app runs on a server with more than 1 core?
01:55:42disruptekhow do i know what hardware my code runs on?
01:55:42leorizebut in Nim these are separated concepts
01:56:08leorize"systems language" quirks :P
01:56:29leorizeanyhow, for your use case, which is computational, parallelism is what you're looking for
01:56:36leorizetry threadpools
01:57:20FromDiscord<has1> All the articles I read tell me that the way go handles things is much more efficient than Java style thread pools
01:57:39leorizeit depends
01:58:01FromDiscord<has1> And how do I know the size of the thread pool?
01:58:02leorizeyou can do benchmarks if you'd like :)
01:58:03disrupteki'm sorry that nim doesn't have an analogue to go's channels, but i'm not going to pretend that it does, just like i'm not going to pretend that there aren't lots of different ways to handle concurrency in nim, each with their own strengths.
01:58:30leorize@has1 by default it's the number of cpu cores
01:58:54FromDiscord<has1> I read somewhere it's 256
01:59:06FromDiscord<has1> Maybe that was something different though
01:59:58FromDiscord<has1> But why can't it implement the concurrency thing that go did does? Is it because the go solution has disadvantages?
02:00:03disruptekare you not able to run the go toolchain?
02:00:16FromDiscord<has1> Or because it is too hard to implement in nim?
02:00:21disruptekgolib is ported to nim, if you'd like to try that.
02:00:21leorizedisruptek: these are legitimate questions, really...
02:00:41leorize@has1: it's just no one has looked into it
02:00:43disruptekgo's solution is indemic to the entire language.
02:01:17disruptekit's baked into everything and everywhere, the stdlib, all the i/o, everything.
02:01:17leorizefrom what I know, go-style concurrency muddles the line between async and threads
02:01:29disruptekyes.
02:01:30leorizeit's great when you don't care about what to use
02:01:44leorizebut it's terrible and full of surprises when you actually care
02:02:34FromDiscord<has1> Can you elaborate?
02:03:00FromDiscord<has1> Can you give me an example where you would "care"?
02:06:52disruptekcare about what?
02:07:06disruptekwhen you sit down to write software, you usually have goals in mind.
02:07:16disruptekmaybe one of those goals is to not think about parallelism.
02:07:26disruptekmaybe one of those goals is memory consumption.
02:07:35disruptekmaybe one of those goals is speed.
02:07:45leorizehttps://blog.container-solutions.com/surprise-golang-thread-scheduling
02:07:49disruptekeverything is a trade-off. you don't get go's channels for free.
02:08:01disruptekwith nim, you get to choose your trade-offs.
02:08:59FromDiscord<has1> Can you give me an example where go channels would be a bad solution?
02:09:14FromDiscord<has1> And tell me which nim solution would make more sense?
02:09:47leorizewell you can use our Channel...
02:09:51leorizeit's kinda the same
02:10:21disrupteki'm not really familiar with go, unfortunately. i only wrote a few thousand lines years ago.
02:11:22leorizeI don't write go so I don't really know
02:11:39*owl_000 quit (Ping timeout: 240 seconds)
02:12:22disrupteki know it tends to be unwieldy at the high end. in terms of overhead, i mean.
02:13:12leorize@has1 hmm, each kind of concurrency/parallelism has their quirks and perks
02:13:41leorizeit really depends on what you want to do
02:13:55disrupteki can tell you why i didn't stick with go, and it wasn't due to channels.
02:14:25disruptekjust like the fact that i didn't choose nim for what came in the box.
02:15:20FromDiscord<has1> I didn't start out with c or C++, so concurrency and parallelism are new concepts for me and they seem to be connected but not the same, it's just hard to understand for me
02:16:04leorizeso... what's your use case?
02:17:44FromDiscord<has1> I'll give an example, if I have 1 million numbers that I want to add together, I would just split the numbers into 100k each, call "go" to run them in their own goroutine and then sum the results together. Now this code scales very well because it runs well on a cpu with 1 core and it runs well on a cpu with 10 cores
02:18:24FromDiscord<has1> Next example, I have a web server. Once a request comes in I handle it in its own goroutine. This scales very well too
02:18:45FromDiscord<has1> Go can handle many thousands of requests and it's really fast
02:21:25disruptekwell, there are libs you can use for your computation challenge. you don't really need anything special for i/o.
02:22:08FromDiscord<has1> so someone on here linked me to this https://github.com/yglukhov/threadpools
02:22:08FromDiscord<has1> But there doesn't seem to be any documentation for this, but there is also
02:22:08FromDiscord<has1> https://nim-lang.org/docs/threadpool.html
02:22:24FromDiscord<has1> From the nim stdlib
02:22:24leorizethat one is kinda... broken
02:22:38leorizeyglukhov's threadpool was meant to be the replacement
02:23:10FromDiscord<has1> but there is also
02:23:10FromDiscord<has1> https://nim-lang.org/docs/channels.html
02:23:25FromDiscord<has1> Which tells me to not "import it directly"
02:23:50FromDiscord<has1> And I also saw something about async procs and multisync
02:24:28leorizechannels is a part of system
02:24:40FromDiscord<DeltaPHC> That message to not import it directly just means it's already imported. Because system is already imported
02:24:40leorizecompile with --threads:on and you'll have it automatically
02:25:13FromDiscord<has1> Ahh, so that's what that means
02:28:15disruptekyou can run `nim doc somefile.nim` to generate documentation for `somefile` module.
02:28:45FromDiscord<has1> I see
02:30:33FromDiscord<has1> But the channel thing doesn't solve the goroutine example for me. It seems like I want something like fibers (green threads?) That are lightweight will this threadpool library do this for me?
02:30:47leorizeprocs that are launched with threadpool can have their return value captured
02:30:47*laaron joined #nim
02:30:54leorizeso you might not need channels as much as in go
02:31:09disruptekhttps://nim-lang.github.io/Nim/coro.html
02:32:15FromDiscord<has1> Wait but what's this now?
02:32:27FromDiscord<has1> What's the difference between coroutines and a thread pool?
02:32:56disruptekcoroutines are lightweight pseudothreads. threads are os-level threads.
02:34:01disrupteklibev was wrapped recently, too, so you could build something with that if you wanted that event-based interface.
02:34:38FromDiscord<has1> But don't coroutines actually run on os threads?
02:35:17leorizenope, it uses the same mechanism as go routines
02:35:39FromDiscord<has1> But goroutines run on an os thread though
02:35:45leorizebut it's not really well maintained as no one use it
02:35:47disruptekthey can.
02:36:19disrupteklisten, i'm not gonna lie: go has the best implementation of goroutines.
02:36:26leorizegoroutines is this mess of schrödinger thread :P
02:36:31disruptekif that's what you want, you can download it from golang.org.
02:36:37leorizeon a good day it's actual OS thread
02:36:50leorizebut it can also be green thread
02:36:56leorizeno one knows
02:37:35FromDiscord<DeltaPHC> Goroutines multiplex themselves onto available cores. Each core might have more than one goroutine running
02:37:43FromDiscord<has1> https://rakyll.org/scheduler/
02:38:05FromDiscord<has1> I'm coming from go and checking out nim
02:38:14FromDiscord<has1> I already use go and have that installed
02:40:01disruptekagain, nim has many options. it all depends on what you're after.
02:40:42disruptekhere's yet another option that some are working on: https://github.com/nim-lang/RFCs/issues/160
02:41:07disruptekit sounds like you need to develop your problem before you choose your solution.
02:41:25FromDiscord<has1> Why would I use a thread pool instead of the goroutine style concurrency in go?
02:41:47FromDiscord<has1> Why would I use async instead of the way go does it?
02:42:22disruptekbecause async is faster and lighter for certain tasks.
02:42:34disruptekbecause a thread pool is faster and lighter for certain tasks.
02:42:42leorizebecause with threadpool you can always be sure that you own the thread
02:42:49disruptekbecause you cannot use goroutines in nim natively, as nim is not go.
02:43:00leorizewith async you skip the pain of threading, and uses native os scheduler instead
02:44:00FromDiscord<has1> But now I need to declare my function as async right?
02:44:56disrupteki wouldn't bother. it doesn't sound like you have anything to run concurrently.
02:47:42FromDiscord<has1> I'm asking about how to deal with concurrency in nim
02:48:00disruptekwell, it feels like trolling.
02:48:26FromDiscord<has1> That seems to be the problem for me, creating explicit async functions
02:48:52FromDiscord<has1> Instead of having one newHttpClient() function, now you have
02:48:54FromDiscord<has1> newAsyncHttpClient
02:49:39disruptekit's quite a hardship.
02:49:57FromDiscord<has1> If you do concurrency without the async thing, then you could just run the blocking code with go client.getContent() instead
02:50:36disruptekgood idea.
02:50:38FromDiscord<has1> And I don't like the fact that you call me a troll for asking about concurrency tbh.
02:51:12FromDiscord<has1> I think that's a legitimate question. Because it sounds like you now need to have two implementations for sync and async code
02:51:32FromDiscord<has1> And indeed, the httpclient module seems to have that
02:52:40disruptekwell, i don't like feeling trolled. and i'm not about to engage in a color debate with you.
02:53:07disruptekgood luck with your research.
02:53:32*dddddd quit (Remote host closed the connection)
02:53:50*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
02:54:18FromDiscord<has1> Also this isn't even about nim specifically, rust and JavaScript seem to do the same thing here.
02:55:15*laaron joined #nim
02:57:38FromDiscord<treeform> async gives you Concurrency
02:57:44FromDiscord<treeform> threadpool gives you Parallelism
02:58:22FromDiscord<treeform> async gives you Concurrency in that you can hold 1000s connections, but the CPU only works on 1 at a time.
02:58:58FromDiscord<treeform> threadpool gives you Parallelism, here you can hold 100s of connections but, its slower to witch between them, but each core of your CPU can be doing work.
02:59:10FromDiscord<treeform> threadpool gives you Parallelism, here you can hold 100s of connections but, its slower to switch between them, but each core of your CPU can be doing work.
02:59:55FromDiscord<treeform> Parallelism is great for games or compilers where the CPU is doing work like math.
03:00:10FromDiscord<treeform> Concurrency is great for where you are not doing much CPU work but moving tons of bytes around like in a chat server.
03:03:01FromDiscord<treeform> Go language has a much better story around Concurrency and Parallelism then nim.
03:03:10FromDiscord<treeform> But that was the whole point of go to get that right.
03:04:12*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
03:04:52*laaron joined #nim
03:05:06leorize@has1: I think you should give all concurrency/parallel methods a try
03:05:28leorizethat way you'll have a better idea of how that works outside of go
03:07:47FromDiscord<Shield> brainfuck censorship was a weird one, but hey, blame it on programmer humor
03:09:03leorizeto be fair that language is still easy enough to write
03:09:24leorizethere are creepier language that deserve that name more :P
03:15:41FromDiscord<Shield> why is creating explicit async functions is a bad thing?
03:15:57leorizebecause goroutines are magical
03:16:48leorizeyou call a routine with `go func()` and it just works
03:17:05FromDiscord<treeform> one one hand explicit async functions do document more what they are about, on the other thing there is more "crap" to write that is not your code.
03:17:47leorizeto be fair, all the crap that powers goroutines are hidden in go's stdlib
03:17:55leorizenot sure if they causes any overhead
03:19:36leorizegoroutines is weird
03:20:23leorizeyou expect them to be a thread, but turns out some of your operations can block because they also uses green thread
03:22:30*shota quit ()
03:22:37FromDiscord<Shield> nothing beats Lua's coroutines imo, but Nim requires as much care as when writing C code, especially when you do concurrency or multithreading, you need to be deliberate about it
03:23:42FromDiscord<Shield> async functions are already transformed to closures under the hood which helps with the syntax
03:23:55FromDiscord<Shield> but i don't think there's a magical way to hide everything
03:24:26FromDiscord<treeform> go routines do have downsides but they do work well
03:25:05FromDiscord<Shield> i'd like to see some benchmarks
03:25:11FromDiscord<treeform> what if all nims functions were async --- that is basically what go is
03:25:31FromDiscord<treeform> every call every standard library is async in go
03:25:56FromDiscord<Shield> like Araq said, green threads kinda fall appart when saving the stack is slow
03:26:15FromDiscord<treeform> I actually think its the OS that fails here
03:26:37FromDiscord<treeform> OS could provide lightweight fast threads
03:26:57FromDiscord<treeform> then we would just use normal threads for everything
03:27:23FromDiscord<treeform> but no we have to reimplement them user side
03:27:46FromDiscord<treeform> its the biggest OS issue I think
03:27:56leorizeisn't the I/O dispatcher an attempt to do so?
03:28:15FromDiscord<treeform> in linux?
03:28:37leorizeeverywhere?
03:29:11leorizeisn't asyncdispatch a kind of green thread backed by the os?
03:30:08FromDiscord<treeform> yeah it sure is
03:30:39FromDiscord<treeform> I am just saying OS should have provided lightweight threads as part of its offering...
03:30:52FromDiscord<treeform> so there would have been no need for go-lang or nim's aysnc
03:31:03FromDiscord<treeform> so there would have been no need for go-lang or nim's async
03:31:23leorizelightweight threads is userspace threads afaict
03:31:37FromDiscord<treeform> lightweight threads could be part of the OS
03:31:43FromDiscord<treeform> then all OS calls would know how to deal with them
03:31:46FromDiscord<robohack> This may be a dumb question, but what is the downside to using .async. ? I have been messing around with a hobby project (a Nim MUD Server) that has some async network and file procs. As a result, many other things have ended up being async. Initially I looked at threading also, but that seemed like it would get very complex very quickly (mutexes etc.). Any reason to be sparing with how many procs end up bein asyn? I mean, are there
03:31:51leorizeisn't the point was to avoid syscalls?
03:33:02leorizein a way "heavy" threads are the same as these "lightweight" threads
03:33:07leorizethe scheduler is in the kernel
03:33:12FromDiscord<treeform> @robohack, for a MUD server not much. If you start doing like complex simulations like gas propagation or pathfinding + async you might have issues.
03:33:36leorizeand every primitives in the OS understood it
03:33:40FromDiscord<treeform> Issues in that if you would have written it differently your program might run a bit faster.
03:33:55leorizeif you use the write() syscall, text will never overlap no matter how many threads you use
03:34:02FromDiscord<treeform> Yeas I think OS threads are great
03:34:05*rockcavera quit (Remote host closed the connection)
03:34:31FromDiscord<treeform> Except they are slow to create and they take up a bunch of memory.
03:35:07leorizethat's the cost of syscalls
03:35:13FromDiscord<treeform> On linux new thread size is about 2mb.
03:35:20leorizeuse musl libc
03:35:27leorizethe stack will be 8k
03:35:44leorizeunless you widen them yourself
03:35:49FromDiscord<treeform> yeah that's what I want
03:35:59FromDiscord<treeform> 8k threads + easy to make/delete them
03:36:07FromDiscord<Shield> i hate how the stack is divided between threads
03:36:28FromDiscord<robohack> My understanding with asynchronous procs, you don'n need to care about data synchronization, since everything is happening on one thread. Is that correct? If you have multiple threads then you have to worry about sharing state between threads, meaning mutexes or similar?
03:36:38leorizeyea
03:36:55FromDiscord<treeform> @robohack yes and no
03:37:01FromDiscord<Shield> it's even worse that hyperthreading makes the core share cache too
03:37:28*laaron quit (Remote host closed the connection)
03:37:35FromDiscord<treeform> so you can get into race conditions with anything
03:37:35FromDiscord<treeform> you don't have to care about low level mutexes
03:37:35FromDiscord<treeform> but the problem they solve also translate into higher level logic stuff
03:37:35FromDiscord<robohack> Been a while since I've done anything multithreaded, and that was in Java.
03:37:45FromDiscord<treeform> because it can live in your code not the libraries
03:37:48FromDiscord<Shield> async multithreading is still in the work
03:38:28leorize@Shield can you try chronos?
03:38:49leorizeif the leak is in asyncdispatch, then I think chronos should have already solved it somehow?
03:39:18*laaron joined #nim
03:39:58FromDiscord<robohack> That was what I was looking for initially. Like a threadpool to handle new connections and process input from client, buy asunchronous file and network ops to not block the threads. @Shield Do you have more info on this? Is there a github issue or something?
03:40:51leorizehttps://github.com/nim-lang/Nim/pull/11724
03:41:53FromDiscord<robohack> Thanks.
03:42:01FromDiscord<Shield> i'm not sure
03:42:15FromDiscord<Shield> will chronos be a part of the stdlib?
03:42:41FromDiscord<Shield> i was just checking weave for multithreading
03:43:15leorizenope, but it's useful to know if someone else have already managed to fix async
03:44:08FromGitter<awr1> does using `break` from a block call dtors
03:44:40leorizecan you even use break from a block
03:45:08FromGitter<awr1> yes
03:45:13FromDiscord<Shield> you can break to a named outer block
03:45:33leorizedtors are only called at the end of a proc
03:45:44FromGitter<awr1> https://nim-lang.org/docs/manual.html#statements-and-expressions-block-statement
03:46:18FromGitter<awr1> i mean it is basically `goto`
03:46:53leorizeonly works in a loop-in-block though
03:48:35FromDiscord<robohack> Hmm, that wasn't what I understood from reading that doc, but what do I know.
03:48:56FromDiscord<robohack> Docs make it dound like labels and goto statements.
03:49:14FromDiscord<robohack> Docs make it sound like labels and goto statements.
03:49:49FromDiscord<Shield> sadly there are no goto statements
03:50:09FromDiscord<robohack> lol
03:50:55FromDiscord<robohack> I guess breaking out of a block is not the same aas goin t to a labeled block
03:51:00leorizehere is a hack that I hope no one will ever use: https://play.nim-lang.org/#ix=1WPp
03:59:45*chemist69 quit (Ping timeout: 250 seconds)
04:01:36*chemist69 joined #nim
04:06:17FromGitter<awr1> oh god
04:06:24FromGitter<awr1> i wonder if you could make goto with macros
04:09:15FromDiscord<DeltaPHC> Not without summoning Chutulu
04:10:44FromDiscord<robohack> Hah! You can make anything with macros, can't you? I am new to metaprogramming (have done c macros, but that is different). Would macros be a decent way to implement a very basic scripting language (MUD hobby project)?
04:11:17*theelous3 quit (Ping timeout: 245 seconds)
04:13:06FromDiscord<robohack> As in read a file from dick, apply macros to translate script to nim code?
04:13:22FromDiscord<robohack> As in read a file from disk, apply macros to translate script to nim code?
04:13:44FromDiscord<robohack> As in read a script file from disk, apply macros to translate script to nim code?
04:13:58FromDiscord<DeltaPHC> The macro itself can read the script file from disk, afaik
04:14:14FromDiscord<DeltaPHC> And then generate the Nim syntax tree from it
04:15:26FromDiscord<DeltaPHC> (feel free to correct me if I'm wrong)
04:17:50FromDiscord<Shield> quick question, what does "static[int]" mean?
04:19:33FromDiscord<DeltaPHC> https://nim-lang.org/docs/manual.html#special-types-static-t
04:20:03FromDiscord<DeltaPHC> Basically a type that must be a constant expression. Where the value is known to the compiler
04:28:24FromDiscord<Shield> oh wow, it generates a new function per static argument
04:28:43FromDiscord<Shield> that will be certainly useful
04:29:27*laaron quit (Remote host closed the connection)
04:29:45*laaron joined #nim
04:32:20sealmoveis it possible to turn-off type-checking for 1 line of code?
04:33:51sealmoveI want to do `let x = if root == nil: result else: x` and I know that when `root == nil` then result definitely has the same type as x, but compiler doesn't know this.
04:43:11leorizeyou can't
04:43:17leorizecan I have the full code?
04:43:22leorizeit's kinda hard to imagine the use case
04:46:40leorizesealmove: I'd say fix the else branch
04:46:58leorizeyou can't have `else: x` when `x` is not defined yet
04:47:10leorizeuse `default(typeof result)` instead
04:47:28leorizeor just bypass with `cast`
04:47:51leorizebut if you have the code I can probably think of a better way
04:50:00sealmovewell, let me show an example
04:50:10sealmovehttps://termbin.com/ujvi
04:51:00*LargeEpsilon joined #nim
04:51:54sealmovesorry, https://termbin.com/g76t
04:51:54*nsf joined #nim
04:53:44sealmovehttps://termbin.com/z1e7
04:54:19sealmoveyes, my current solution is cast, but it's ugly
04:56:18sealmoveI think it's hard to explain actually... this code is auto-generated, so this pattern is convenient. Out of context this code seems stupid.
05:09:51*cornfeedhobo quit (Quit: ZNC - https://znc.in)
05:15:42leorizeit looks to me that you're trying to re-invent inheritance
05:16:22leorizeand/or object variant
05:19:13sealmoveI try to avoid inheritance for the sake of speed, since the code is autogenerated
05:20:23*cornfeedhobo joined #nim
05:21:39*Vladar joined #nim
05:23:08*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
05:27:54*laaron joined #nim
05:28:16*owl_000 joined #nim
05:31:21*laaron quit (Client Quit)
05:32:03*gangstacat joined #nim
05:39:19*narimiran joined #nim
05:41:37*LargeEpsilon quit (Ping timeout: 240 seconds)
05:58:03*LargeEpsilon joined #nim
05:59:16*LargeEpsilon_ joined #nim
06:03:22*LargeEpsilon quit (Ping timeout: 265 seconds)
06:03:48*laaron joined #nim
06:05:00*laaron quit (Client Quit)
06:07:10*solitudesf joined #nim
06:09:53leorizesealmove: `cast` it is then
06:10:13leorizebut what kind of code are you generating?
06:11:06leorizehave you measured any meaningful overhead from inheritance?
06:26:00*PMunch joined #nim
06:29:46*laaron joined #nim
06:30:27*laaron quit (Client Quit)
06:31:04FromDiscord<Shield> is there a way to do this in Nim? https://youtu.be/ZHqFrNyLlpA?t=1512
06:32:11FromDiscord<Shield> basically instead of having to type foo.bar.field you just type foo.field
06:34:17*Mister_Magister joined #nim
06:35:28lqdev[m]proc field*(foo: Foo): int = foo.bar.field
06:38:23PMunchI guess you could possibly create a macro to make those fields available in the current scope..
06:41:49Zevvoi lqdev[m], fixed your generics yet?
06:42:05Zevvscrollback is too large to read up
06:43:04PMunchShield, for the using on a parameter there was a pragma "this: self" that did something similar
06:43:38FromDiscord<Shield> yeah that's what i'm thinking, what's the priority for field/proc/template if they have the same name?
06:43:43lqdev[m]Zevv: nope, I'm at school now.
06:43:50FromDiscord<Shield> and you use the command call
06:44:02lqdev[m]it'll have to wait until afternoon
06:44:04Zevvlqdev[m]: ok!
06:44:40Zevvshield: cant watch your vid so not sure if this apply, but check the "with" nimble macro, that might help you out maybe
06:45:18Zevvs/apply/applies/,
06:46:41PMunchZevv, link to that macro?
06:47:02Zevvhttps://github.com/zevv/with
06:47:45PMunchAh yes, that is pretty much exactly what he wanted I think
06:49:23leorize@Shield: field have the highest priority
06:49:30leorizeproc/template have equal priority
06:49:39leorizemeaning: they will conflict
06:51:25FromDiscord<Shield> oh nice, now if only you can put multiple 'with' at the start of a function without having to make a new block per use
06:53:33PMunchShield, you can pass a tuple of things
06:54:06PMunchhttps://github.com/zevv/with/blob/master/tests/tests.nim#L53-L61
06:54:42FromDiscord<Shield> i missed that, thanks
06:55:00PMunchNo problem
06:55:19PMunchNote that it works by rewriting the body though, so you can't move your logic to a template
06:55:50leorizeyou can
06:55:56leorizejust make sure it's hygenic
06:56:48PMunchhttp://ix.io/1WQr/Nim I meant something like this
06:57:15PMunchMight not be that relevant for this macro, but just something I noticed with how Jester used to do `resp`
06:57:40Zevvhm should it also take a vararg instead of a tuple?
06:58:02PMunchZevv, can you do varargs and then a block?
06:58:28PMunchOr do you mean take varargs[typed] and just assume the last element is the block?
06:59:14PMunchWith Jester I set up a template that checked some DB stuff and did a "resp" with an error, but that failed since the resp didn't get rewritten
07:00:00*gmpreussner quit (Quit: kthxbye)
07:00:01ZevvPMunch: nah, indeed, that will not work, there's a reason there's a tuple there of course
07:03:04PMunchWell the varargs[typed] and assume the last is a block should work shouldn't it?
07:04:30leorize`typed` would make the last typechecked before it got passed to the macro, no?
07:05:38FromDiscord<Kiloneie> Wau, quite a few views from just late night to early morning to my video, this is good ^^
07:07:35*Kameleon joined #nim
07:09:48PMunchKiloneie, link?
07:10:12PMunchZevv, Shield, leorize: http://ix.io/1WQz/Nim
07:10:31FromDiscord<Kiloneie> one second
07:10:46FromDiscord<Kiloneie> https://youtu.be/5tVIsDYPClA
07:11:03PMunchThat super simple macro just creates templates that will expand to the correct field access. This approach makes it possible to use templates within the with statement :)
07:11:36PMunch(That is similar to how Jester solved the issue IIRC)
07:15:53*laaron joined #nim
07:19:49FromDiscord<Shield> does it create templates and call the body within a new block?
07:20:36PMunchYeah, pretty much
07:21:04PMunchFrom --expandMacro:with http://ix.io/1WQE/Nim
07:21:36PMunchOh, that expanded it one step further :P
07:22:08PMunchHere is from echo result.repr right before the macro returns: http://ix.io/1WQF/Nim
07:23:10leorizeyou have successfully rendered Zevv's with obsolete :p
07:23:50PMunchNot quite :P Mine doesn't take tuples, and it doesn't take multiple arguments :)
07:23:58PMunchThose are both easy to fix though..
07:24:17Zevvoh tell me, how did he dod that?
07:26:56FromDiscord<Shield> yeah, taking multiple arguments and emitting an error when name conflict happens would be nice
07:29:03PMunchWell, I kinda prefer it to just shadow the outer variable
07:35:48Zevvoh wait you're inserting templates?
07:35:55*asymptotically joined #nim
07:36:15*Vladar quit (Remote host closed the connection)
07:36:28PMunchYup
07:36:29Zevvhave you no shame
07:36:37*Vladar joined #nim
07:36:40PMunchHaha, it means Nim will do all the heavy lifting :)
07:36:57Zevvmakes perfect sense, me gusta
07:39:04Zevvso, you're publishing pmunch/with, or do I recieve a PR with a rewrite? :)
07:39:10*ng0_ is now known as ng0
07:39:30PMunchOh, I wasn't thinking of putting it anywhere..
07:39:37PMunchBut I can make a PR if you like :)
07:39:52Zevvit's much better like that imho
07:40:14Zevvalthough it's always kind of risky, some of the semantics might change still, so it breaks for someone somewhere sometimes
07:40:28Zevvwell, who cares, just let it be as it is then
07:40:34Zevvif it ain't broooke
07:40:46*narimiran_ joined #nim
07:40:50PMunchI will try to send it through your test suite :)
07:42:03*narimiran quit (Read error: Connection reset by peer)
07:48:10*laaron quit (Remote host closed the connection)
07:48:39PMunchAha, it breaks on the "proc member" test Zevv
07:49:59Zevvhttps://i.imgur.com/RG0BS1U.gif
07:50:51PMunchThat is actually one of the features I miss in Nim
07:51:01PMunchA way to completely transparently make one thing mean another thing
07:51:14Zevvbecasue there is not yet enough confusion in the world already?
07:52:22PMunchIt's like I say with meta-programming, it's a really powerful tool, but in the same way that a chainsaw is a powerful tool you must be careful how you use it
07:52:59PMunchMuch easier to horrible mangle yourself when using a chainsaw than a hand saw, but if I'm chopping trees all day you can bet that's what I'd use
07:53:11*mpcjanssen joined #nim
07:53:39PMunchSame with meta-programming, if used carefully it is a great way to get things done. But use it incorrectly and it's easy to really mess things up
07:53:50Zevvof course
07:56:15mpcjanssenI am getting an error when trying to install jester using nimble: https://pastebin.com/vzaQGN1a . Am I missing something obvious? I am using nim from homebrew (1.0)
07:59:54asymptoticallympcjanssen: looks like something is borked with your installation https://github.com/dom96/jester/issues/207
08:02:44PMunchmpcjanssen, what is your "nimble --version"?
08:06:10*navin joined #nim
08:06:31mpcjanssennim --version
08:06:33mpcjanssenNim Compiler Version 1.0.0 [MacOSX: amd64]
08:07:18PMunchYeah but your nimble version
08:07:23mpcjanssensorry :)
08:07:34PMunchNo worries :)
08:07:35Araqalso ... due to a "glitch", report the git commit hash
08:07:46mpcjanssennimble --version
08:07:48mpcjanssennimble v0.11.0 compiled at 2019-09-24 03:04:27
08:08:50mpcjanssengit hash: couldn't determine git hash
08:10:04PMunchThat one was for the Nim version
08:10:39mpcjanssenPMunch: nope, same for nimble
08:10:48FromGitter<alehander42> hm, it means it couldn't git rev-parse HEAD
08:10:53FromGitter<alehander42> while building
08:11:02FromGitter<alehander42> afaik
08:11:20mpcjanssenif the answer for now is, build nim yourself, that's ok
08:11:34PMunchI'd just use choosenim
08:11:58PMunchThat way you can easily update, jump between versions, and generally just manage your Nim install better :)
08:13:06mpcjanssenPMunch: agreed. So I am not missing something obvious.
08:14:07PMunchZevv, ooh another cool use of the `with` macro: with result
08:14:19PMunchJust assign stuff directly to your result variable
08:14:40PMunchMakes it quite hard to see what you're doing though, but might be practical for initialisers
08:15:01PMunchBasically those procs that just consist of a long list of result.<somevar> = <someval>
08:15:56FromGitter<alehander42> i mostly like
08:16:02FromGitter<alehander42> `update:`
08:16:06FromGitter<alehander42> or at least thats how i call it
08:16:13FromGitter<alehander42> when you need to update many fields of the same object
08:16:16FromDiscord<Shield> btw can you override an object constructor?
08:16:24FromGitter<alehander42> everything else seems a bit confusing to me
08:16:44FromGitter<alehander42> Shield object constructors are just functions
08:16:51FromGitter<alehander42> nothing special about them
08:16:52FromGitter<alehander42> iirc
08:17:22FromGitter<alehander42> if you talk about `A(b: ..)` synta
08:17:25FromGitter<alehander42> then not
08:18:06FromGitter<alehander42> which is a good question: maybe this can solve some of the "default value/always init with x" stuff
08:18:54navinHi, i'm trying to working with encoding of utf strings using punycode module, seems like it is not always giving result as expected.
08:19:30navinhttps://play.nim-lang.org/#ix=1WQX if someone can please take a look.
08:21:17FromDiscord<Shield> it looks like you can't have a function the same name as the type, so Foo(...) doesn't work, so you have to call a custom constructor manually? is there no way to change the default
08:21:53Araqnavin, punycode is old, you're better off with unidecode
08:22:52AraqShield: use a constructor proc like everybody does
08:23:07Araqdon't override "construction"
08:23:30*laaron joined #nim
08:24:05Araqalehander42: I think the time is ripe for making 'not nil' a reality
08:25:26Araqref should not be nilable, 'nil ref T' means it can be 'nil', you need to check for '!= nil' before deref'ing
08:25:31PMunchZevv, https://github.com/zevv/with/pull/2
08:26:04PMunchShield, no you can't override the default construction of objects
08:26:08*laaron quit (Client Quit)
08:26:42Araqwe should use the existing control flow graph for it
08:26:51ZevvPMunch: passes them all?
08:27:13PMunchShield, the normal way to do this is to have a initMyType procedere
08:27:24PMunchZevv, yup, and the new test case I added
08:27:26Araqand instead of errors it'll produce warnings unless you use --strictNilChecks or something, smooth transition
08:27:52AraqC# managed to pull it off
08:27:57ZevvPMunch: "Complete rewrite that works without rewriting.". That sounds a bit like Gödels theorem
08:28:16PMunchHaha, yeah I didn't realise what I had written until I submitted the PR
08:28:19PMunch:P
08:28:45ZevvI trust you on this one, I just merge without reviewing!
08:28:57Zevv"hoepla"
08:28:58PMunchI of course meant rewriting the body, but the first line of a git commit can't be too long..
08:29:08PMunchOh, just realised that the README is now wrong..
08:29:13PMunchDidn't look at that..
08:29:37Zevvtoo late :)
08:30:33FromDiscord<Shield> lol
08:31:20PMunchI mean it's still pretty much the same..
08:31:37PMunchThe nimble version is also still 0.3.0 which isn't great..
08:32:58ZevvYeah, bumping only when everthing is ok of course
08:33:11ZevvI merge blindly, but I release carfully
08:33:24PMunchCreating a new PR now that updates the readme and version number
08:33:35Zevvoh sweet, I was just typing that in myself. Please do!
08:33:51ZevvI'll do the bump myself though, I like those in a separate commit
08:33:56PMunchWhat, but that means 0.3.0 can be two completely different implementations depending on when you installed it :S
08:34:01PMunchAh okay
08:34:05Zevvno, it's about the tag
08:34:11PMunchOh right
08:35:09PMunchAraq, not sure if you saw that earlier, but one feature I miss in Nim is the ability to make a symbol completely behave like some expansion. Like templates get you 90% of the way there, but things like the proc case from earlier doesn't work..
08:35:37FromGitter<alehander42> Araq, i agre
08:35:48FromGitter<alehander42> i guess reusing the cfg makes sense
08:35:49AraqPMunch, I don't like aliases but there is a PR from timothee that implemented it
08:36:30Araqalehander42, yeah, so ... we start by writing a spec
08:36:35FromGitter<alehander42> ok
08:36:57FromGitter<alehander42> one thing i wondered is, in my old ast pr i tried to make the check a bit smarter
08:37:08Araqbiggest problem that I can foresee is Table[string, ref T]
08:37:29FromGitter<alehander42> e.g. `if not a.field.field2.isNil: a.field.field2.field3 work`
08:38:04*Arrrrrrr joined #nim
08:38:19Araqinside the table implementation we do tab.data = newSeq[Value](someSize)
08:38:40ArrrrrrrCongratulations on the release. Where is the cake?
08:38:42Araqpre-allocating seqs can only work when you have a sentinel value
08:38:47FromGitter<alehander42> and `if not a[t].isNil: a[t].other should work` : should those be supported? (we mostly need to track that e.g. `t` isn't changed as well)
08:39:14Araqno, we don't support these, we support 'let' variables
08:39:28PMunchArrrrrrr, here: 🎂 do you want a slice?
08:39:29AraqArrrrrrr, thanks
08:39:40*PMunch slides 🍰 to Arrrrrrr
08:40:14FromGitter<alehander42> Araq, hmm, i still feel they should work in the obvious cases, but `let` is a good workaround indeed
08:40:23PMunchAraq, I can see why aliases in normal code might be confusing, but as a tool for generated macros I think they could be useful
08:40:43PMunchLike I wouldn't mind if it was only able as a procedure within the macros module
08:42:23Araqalehander42: much more pressing is what we do about the fact that default(ref T) does not exist anymore
08:42:36Araqdefault values crop up in array processing all the time
08:43:15PMunchZevv, github.com/zevv/with/pull/3
08:43:19Araqvar s = newSeq[ref T](10); for i in 0..<s.len: s[i] = new(T) # save, but hard to prove it
08:44:05Araqthis can be mitigated by a dedicated array construction syntax, var s = new(T) *& 10
08:44:23Araqbut it doesn't help for hash tables
08:46:00FromGitter<alehander42> what was default(ref(T))
08:46:02FromGitter<alehander42> before?
08:46:28*laaron joined #nim
08:47:44FromGitter<alehander42> so, i am not sure what the problem about tables is: is it expected that `if a.hasKey(b): a[b].field` should just work
08:47:46*laaron quit (Client Quit)
08:47:52FromGitter<alehander42> without checking `a[b]` is nil?
08:48:15FromGitter<alehander42> if it's just about the internal implementation, i guess the internal procs can just use a pragma which says "dont check me"
08:48:35Araqit's about the implementation, yes
08:49:27FromGitter<alehander42> i see, so it's about optimizing perf, where we know checks aren't really needed?
08:50:05*krux02 joined #nim
08:50:50ArrrrrrrTalking about tables, why doesn't initTable()-initHashSet() call rightSize() under the hood? I see no benefit in having to do it explicitly.
08:52:21AraqArrrrrrr, yeah, PR is welcome
08:52:42Araqalehander42: no, it's not about optimizing, we need an escape hatch, look
08:53:17FromGitter<alehander42> but all the newSeq in tables i see are with tuple elements etc, i dont see ref
08:53:17Araqvar s: seq[ref T not nil] = @[] # ok, empty seq is fine
08:53:27FromDiscord<Shield> aliasing is great since i'm ditching inheritence and relying fully on composition
08:53:34Araqs.setLen(10) # needs to be forbidden
08:53:56FromGitter<alehander42> oh the setLen
08:53:57FromGitter<alehander42> problem
08:54:17Araqyes.
08:54:49*mibr joined #nim
08:55:39FromGitter<dumjyl> with generic constraints? `proc setLen[T: Nilable](len: int)`
08:55:53FromGitter<alehander42> yeah, it can be forbidden
08:55:58FromGitter<alehander42> i think the problem is that it's useful
08:56:12FromGitter<alehander42> in generic algo-s, e.g. sequtils
08:56:36ZevvPMunch: merged and tagged. Thanks a lot!
08:56:59FromDiscord<SodaScripter> what is the difference between a let and a const
08:57:00FromGitter<alehander42> and i guess auto-filling it with `new()` is out of the question, because allocations?
08:58:27Araqdefinitely
08:59:04FromDiscord<Kiloneie> @Araq Have you seem my video yet ? I would like your feedback the most 🙂
08:59:14AraqsetLen is the wrong interface btw, it should be 'shrink' (no problems with non-nilable types)
08:59:20FromGitter<alehander42> exactly
08:59:22Araqand 'grow'
08:59:24FromGitter<alehander42> shrinking is safe
08:59:26FromGitter<alehander42> growing not
08:59:30Araqand 'grow' should be marked as unsafe
08:59:32FromGitter<alehander42> i wondered how to catch that on CT
08:59:46PMunchZevv, no problem :)
08:59:57*navin quit (Remote host closed the connection)
09:00:11PMunchSodaScripter, const must be known at compile time, while let can be assigned at runtime
09:00:14PMunchBut both are immutable
09:00:41FromGitter<alehander42> maybe there can be something like growAlloc if people explicitly opt in to grow their not nil seq-s
09:00:48*SodaScripter joined #nim
09:01:05Araqalehander42: well 'grow' is not common and can be marked as "unsafe for not-nil" in the docs
09:01:10SodaScripterok I'm on IRC now
09:01:12SodaScriptermuch comfier
09:01:21Araqbut 'newSeq(lengthHere)' is common
09:01:23FromGitter<alehander42> or they can just have a GrowableAllocSeq
09:01:25FromGitter<alehander42> or something
09:01:43FromGitter<alehander42> that's true
09:02:00SodaScripter<PMunch> Oh, that makes sense, thanks for the explanation.
09:02:05Araq'newSeq' is common and in generic code we need an unsafeNewSeq
09:02:08FromGitter<alehander42> well, maybe it's easy to replace newSeq with newSeqWith
09:02:17FromGitter<alehander42> for not nil ref seq-s
09:02:30FromGitter<alehander42> and forbid newSeq as well
09:02:40FromGitter<alehander42> for those
09:02:57Araqnot good enough, consider that we don't have default(T) for not-nil refs
09:03:19PMunchSodaScripter, no problem :)
09:03:22FromGitter<alehander42> yes, and newSeqWith is a bad fit for ref-s
09:03:39FromGitter<alehander42> as one would easily point all the elements to the same init object by mistake
09:03:43Araqfor tables we want to be able to say "look, it's nilable in the inside, but from outside it's what people declared it to be"
09:04:21FromGitter<alehander42> well, for tables i think we can just use the `{.nilCheck: off.}`
09:04:24FromGitter<alehander42> or something pragma
09:04:29Araqas both Table[K, ref T] and Table[K, ref T not nil] can just work
09:04:36FromGitter<alehander42> internally
09:05:01Araqyes but we need to be precise about what .nilCheck: off means
09:05:17FromGitter<alehander42> ah, but i see another meaning
09:05:22*couven92 joined #nim
09:05:33Araqand the problem pops up in array processing quite often.
09:05:35FromGitter<alehander42> what happens in generic code where T can be `nil` or `not nil` indeed
09:05:44Araqexactly
09:05:48FromGitter<alehander42> and isNil doesn't always work
09:06:07*dwdv joined #nim
09:06:08*laaron joined #nim
09:06:27FromGitter<alehander42> maybe somehow we can map isNil to genericIsNil before sem checking instantiations
09:06:45FromGitter<alehander42> and genericIsNil can be a safe noop for not nil
09:07:46Araqtoo complex, the T doesn't really cause problems
09:07:50*laaron quit (Client Quit)
09:08:24Araqthe real underlying issue is that we need both default(T) and unsafeDefault(T)
09:08:41Araqso that we can sneak 'nil' into a not-nilable ref type
09:09:09Araqproc grow(x: seq[T]; n: int; value: T) # nothing unsafe about it
09:09:31Araqs.grow(10, default(T)) # ok
09:09:42Araqs.grow(10, default(ref T)) # nah, it has no default
09:09:58Araqs.grow(10, unsafeDefault(ref T)) # ok, you obviously know what you're doing
09:10:32FromGitter<alehander42> so we expect that the function which does the unsafeDefault grow
09:10:39FromGitter<alehander42> will fill correctly those new elements
09:11:12FromGitter<alehander42> it's interesting, because you can auto-test this in debug builds
09:11:31FromGitter<alehander42> e.g. if a function does this, and before return `s` has nil elements in the growed area
09:11:58FromGitter<alehander42> it broke the contract
09:14:29*neceve joined #nim
09:14:50Araqcurrently default(ref T not nil) gives you 'nil' iirc
09:14:55*laaron joined #nim
09:15:01Araqso the current default(T) is the unsafe variant
09:15:19FromGitter<alehander42> yes, the current one doesn't work well
09:15:36*navin joined #nim
09:15:39Araqhey, I used it extensively, what's wrong with it?
09:15:51FromGitter<alehander42> well, for this particular scenario obviously
09:16:26Araqah ok
09:16:44*laaron quit (Client Quit)
09:17:03FromGitter<alehander42> but what i dont get fully is: in generic seq processing, doesn't this mean `default(T)` would just not work
09:17:04*Arrrrrrr quit (Remote host closed the connection)
09:17:16FromGitter<alehander42> as you always can have `T: ref`
09:17:20Araqyup
09:17:31FromGitter<alehander42> so people would just use `unsafeDefault` anyway
09:17:46Araqwell they have to
09:17:58Araqin generic code
09:18:07FromGitter<arnetheduck> the c++ solution is kind of not that bad - you can use whatever subset of for example vector that your type supports - no zero-arg constructor? `resize` fails.. etc
09:19:14*SodaScripter quit (Quit: Leaving)
09:19:27FromGitter<alehander42> well, i think the `grow` / `shrink` think makes sense, as `resize` is too general on type level indeed
09:19:32FromGitter<alehander42> thing*
09:19:37*SodaScripter joined #nim
09:20:02*navin quit (Ping timeout: 245 seconds)
09:20:26Araqa different table implementation that uses a sum type internally doesn't have this issue
09:20:28FromGitter<alehander42> you have algorithms (e.g. filter etc) where you don't need to resize to a bigger seq, so forbidding that wouldn't make sense
09:21:10Araqbut I don't think a design that forces us to rewrite tables is a good one
09:21:13FromGitter<arnetheduck> related: we were just hit by two nasty bugs related to types that are not all-zeroes-initialized (due to how the math / standards work). we missed them / they're hard to track down because the all-zeroes init happens in sometimes hidden places that can't be searched for, such as deep in an object graph.. `not nil` is just one special kind of default one wants to avoid, but there are others too: `not zero`
09:22:23Araqarnetheduck: yes, it's related to the fact that Nim has "the axiom of choice" / default(T) but a better design could do without
09:23:36*bertiebun joined #nim
09:23:50*alops joined #nim
09:23:53FromGitter<alehander42> but isn't this more related to limiting/overriding construction works
09:24:10Araqnot in my opinion.
09:24:34alopsHi all. Congrats on 1.0. I cloned the snake example, ran nimble build, getting: Error: Downloaded package's version does not satisfy requested version range: wanted >= 0.1.1 got 0.0.1.
09:24:38alopsIdeas?
09:24:41FromGitter<alehander42> and about tables, i see newSeq with seq of tuples
09:24:41*clyybber joined #nim
09:25:08Araqalehander42: the tuple can contain a 'not nil' type
09:25:15FromGitter<alehander42> ok, but i dont see `val`
09:25:20FromGitter<alehander42> being dereffed anywhere
09:25:25FromGitter<alehander42> in tables.nim
09:25:40Araqlook, it doesn't matter.
09:26:01Araqvar s = newSeq[ref T not nil)(1000)
09:26:02SodaScripteris there something like Ncurses for nim?
09:26:18Araq^ it's the newSeq, that one already is unsafe
09:26:32Araqwe there is no value we can use
09:26:49FromGitter<alehander42> but in tables, we only have newSeq[some tuple]
09:26:52FromGitter<alehander42> you said `but I don't think a design that forces us to rewrite tables is a good one`
09:26:58FromGitter<alehander42> i just dont see how tables is a block
09:27:05Araqcommon
09:27:31Araqit bubbles up, so Value = ref T not nil; tuple[... Value ...] is a type with no default(T)
09:28:05AraqSodaScripter, terminal.nim ?
09:28:05PMunchSodaScripter, well you can use ncurses: https://github.com/rnowley/nim-ncurses
09:28:19FromGitter<alehander42> ah true
09:28:22FromGitter<alehander42> sorry, well, tables.nim can use unsafeDefault
09:28:30PMunchDepends on how much of its functionality you need
09:28:48FromGitter<alehander42> it is a good example of a generic impl which should know what is doing
09:28:52clyybberShouldn't a type with not-nil error when default(T) is invoked?
09:29:07Araqclyybber, yeah, we know
09:29:23FromGitter<alehander42> and when people use []
09:29:23PMunchalops, hmm that's strange. I thought nimble was supposed to download it for you in that case
09:29:24SodaScripterAraq, Sorry, I'm not a very nimble nim user, haha.
09:29:47clyybberalehander42: Because it invokes default(T) ?
09:29:53FromGitter<alehander42> look, basically you can't have an error
09:29:57alopsPMunch: what is "it" and how to solve? :)
09:30:13FromGitter<alehander42> because the only ways you can add values are e.g. `[]=` and others, which accept only not nil
09:30:18FromGitter<alehander42> and `[]` depends on hasKey
09:30:40PMunchalops, it appears like it's treeform/chroma that fails
09:30:47FromGitter<alehander42> so, if hasKey is true, somethign which added an actual not-nil value should have happened
09:31:06FromGitter<alehander42> and if it's not true, there should be a key missing error before
09:31:10FromGitter<alehander42> trying to return the value
09:31:13*laaron joined #nim
09:31:27FromGitter<alehander42> so unsafeDefault should be fine for tables
09:31:53PMunchWhich is required from dom96's gamelight
09:32:30Araqalehander42: ok. problem solved. maybe
09:32:51clyybberBtw, can we override default(T) nowadays?
09:33:03PMunchWhich is a bit weird, because chrome seems to have always been 0.0.1
09:33:09alopsoh well
09:33:18alopsliterally all examples I've tried today have failed
09:33:21dom96what's up?
09:33:25Araqclyybber, nah
09:33:47Araqdom96, we're fixing 'nil'
09:34:17PMunchdom96, gamelight requires chroma 0.1.1, but the version in treeform/chroma is 0.0.1, which means that your snake game fails to build
09:34:20*navin joined #nim
09:34:34PMunchalops, well that's not good
09:34:53alops.cache/nim/fib_d/fib.nim.c:9:10: fatal error: 'nimbase.h' file not found
09:34:55FromGitter<alehander42> Araq, and from what i see in sequtils
09:35:08FromGitter<alehander42> shrink or newSeq with unsafeDefault
09:35:09alopsthe fib/C integration example fails with the above for instance
09:35:11PMunchalops, uhm, how did you end up with that error?
09:35:14FromGitter<alehander42> should be valid for most algo-s
09:35:29alopsPMunch: followed the docs to the letter :D
09:35:39clyybberIf we could overwrite default(T), implementing not-nil should be as simple (in principle) as adding {.error.} pragma to it.
09:35:45*laaron quit (Client Quit)
09:35:45PMunchalops, which docs?
09:35:48alopsPMunch: https://nim-lang.org/docs/backends.html#backend-code-calling-nim-nim-invocation-example-from-c
09:36:20Araqclyybber, the problem is not "Nim produces an error", the problem is "how to fix nil and still have generic code"
09:36:27clyybberAraq: WDYT, should overriding default(T) be allowed? And is it a simple change?
09:36:34clyybberAraq: Ah, I see
09:36:43FromGitter<arnetheduck> one might ask oneself what the purpose of calling `unsafeDefault` is vs simply leaving the memory uninitialized, since accessing it remains invalid behavior
09:37:01alopsPMunch: I'm a total Nim noob, so I'm literally just cloning repositories and trying examples in the docs. So far, nothing has worked as advertised. Hopefully just outdated docs.
09:37:02FromGitter<alehander42> it still calls `default` for most types
09:37:30FromGitter<arnetheduck> I'm asking about the non-most types
09:37:44FromGitter<alehander42> well, unsafeDefault is a generic call
09:38:03FromGitter<alehander42> for most types, it can resolve to default, for ref, it can resolve to a noop indeed
09:38:18FromGitter<alehander42> but you need it from a type level point of view
09:38:24PMunchalops, did you change the -Ipath/to/nim/lib to actually point to the Nim lib folder?
09:38:29PMunchDoing that made it work for me
09:39:03PMunchIn the last command: gcc -o m -I$HOME/.cache/nim/fib_d -Ipath/to/nim/lib $HOME/.cache/nim/fib_d/*.c maths.c
09:39:04alopsPMunch: I tried various things, what did you set it to?
09:39:28PMunchI set it to $HOME/.choosenim/toolchains/nim-1.0.0/lib
09:39:37alopshow to know these things :D
09:40:08PMunchI guess you just have to have delved into these things before to know :P
09:40:16FromGitter<arnetheduck> so with that solution, you converge towards what c++ does, but without some of the tools it offers for a number of situations that arise (ie constructors)
09:40:35PMunchnarimiran_, maybe that ^ should be mentioned in the docs?
09:41:18alopsPMunch: I still get ~/Users/alops/.cache/nim/fib_d/fib.nim.c:9:10: fatal error: 'nimbase.h' file not found
09:41:46Araqif C++ constructors worked it wouldn't have make_shared, make_unique
09:41:59PMunchalops, does that folder exist on your system? How did you install Nim?
09:42:14Araqso what are these mystical "tools it offers" ?
09:42:15*narimiran_ is now known as narimiran
09:42:21alopsPMunch: installed with brew
09:42:27PMunchSeeing that /Users path makes me think you might be on a Mac and installed trough homebrew?
09:42:29PMunchAh yeah
09:42:40PMunchSo you need to figure out where homebrew has put your files
09:43:14alopsShould nim(ble) know these things?
09:43:22alopsoh I guess gcc...
09:43:23PMunchTry "nim dump | grep lib"
09:44:10PMunchThat should show you where the lib folder is located on your system
09:45:02alopsyeah, that solved the nimbase.h, not it doesn't find fib.h
09:45:07alopsnow*
09:45:17FromGitter<alehander42> @arnetheduck how does c++ even prove you can deref safely? genuinely wondering, i am not an expert in modern c++
09:45:33PMunchalops, that is because nim uses a different cache directory than on Linux
09:46:07PMunchYou see those $HOME/.cache/nim/fib_d paths, that is where Nim places the C files it generated during compilation by default on a linux machine
09:46:08alopscould Nim during install put these locations in an environment variable to make it easier?
09:46:47PMunchI guess, or just allow you to call "nim cachefolder" or something to get it
09:46:59Araqalehander42: it doesn't do anything like that, it gives you some control over the default value so that it can be 1 instead of 0. The problem remains that 'ref T not nil' has *no* default value.
09:47:13FromGitter<arnetheduck> in a way, it doesn't, except at runtime with special analyzers. generally, when you use reference types, the language prevents you in most ways to create instances that are not nil (for example, it prevents the equivalent of newSeq(1000) or resize), though there are some loopholes as well if you're adventerous
09:47:21PMunchBut you can add a --nimcache:<folder> argument to the Nim command, that will tell nim to put these file in a specific directory
09:48:04PMunchSo if you create a "nimcache" directory in the same folder as fib.nim and main.c and then run "nim c --nimcache:nimcache --noMain --noLinking --header:fib.h fib.nim" it should put the files there
09:48:56FromGitter<arnetheduck> in other words: as long as you stay within the reference system, it's not-null safe, but you can cont amine it if you start use pointers that you turn into references
09:49:11PMunchThen run "gcc -o m -Inimcache -I$HOME/.cache/nim/fib_d/fib.nim.c nimcache/*.c maths.c" and it should hopefully work :)
09:49:17dom96PMunch it's possible I just typo'd that requirement
09:49:31alopsPMunch: found paths manually, works now. Thanks!
09:49:34*ehmry quit (Ping timeout: 265 seconds)
09:49:38Araqalops, we don't produce the brew Nim
09:49:38PMunchdom96, But it's weird though, I'm pretty sure the snake game used to build
09:49:47PMunchalops, no problem. Now it's time for lunch :)
09:49:49dom96PMunch of course, gamelight evolved
09:50:02alopsAraq: if it's not in brew it doesn't exist. True for a lot of macOS users :D
09:50:05dom96this is why we need lock files
09:50:06FromGitter<alehander42> yeah, so the default value of ref T not nil is basically "nil .. which you should fill with a non-nil value until the end of the function hopefully"
09:50:22PMunchdom96, oh right, gamelight added the chroma dependency since last time I tried to build it, makes sense.
09:50:32Araqalops, so write a bug report for this brew package
09:50:46alopsuhg, what's the bug?
09:50:52FromGitter<alehander42> @arnetheduck i see, thanks for the explanation
09:51:02Araqthat nothing works after 'brew install nim' ?
09:51:03PMunchAraq, I still think it would be nice if the Nim binary could tell you the location of its lib and cache folder in an easy way
09:51:34alopsAraq: that's not brew's fault. The docs are wrong and the example above was wrong too, dom96 will fix it >D
09:51:45Araqhow are the docs wrong?
09:51:59FromGitter<arnetheduck> PMunch `nim dump` will give you some hints at least
09:52:20PMunchThen you could do things like "gcc -o m -I`nim cachedirectory`/fib_d -I`nim libdirectory` `nim cachedirectory`/fib_d/*.c maths.c"
09:52:37alopsone example is the websocket module. It contains examples calling methods that doesn't exist. Encountered lots of these today. And yes, I will file issues as I discover them.
09:52:57alopsPMunch: I like that!
09:53:17AraqI don't even know what you're talking about, I never invoke gcc manually
09:53:29FromGitter<alehander42> Araq, there is another posiblity for generic: just have a `newSeqWithCode` overload which is a template which takes a type, len and a code block which should result in `T`: it sets the length, and fills each elements with the code
09:53:36FromGitter<alehander42> so e.g. newSeqWith
09:53:37alopsAraq: the fib example does
09:53:49Araqfib example?
09:53:51PMuncharnetheduck, yeah that gives you all the paths, but I was thinking something like what various config utilities does. For an example wx-widgets have `wx-config --libs` which include all the libs needed to build it.
09:53:53FromGitter<alehander42> newSeqWithCodetype(init) (len): ⏎ init
09:53:56alopsAraq: yes
09:54:00PMunchAraq, https://nim-lang.org/docs/backends.html#backend-code-calling-nim-nim-invocation-example-from-c
09:54:04*laaron joined #nim
09:54:30Araqhttps://nim-lang.org/docs/tut1.html#the-first-program
09:54:36PMunchBut anyways, I'm off to lunch
09:54:49alopshave a good one
09:55:02Araqyou are not supposed to start the 'backends' guide
09:55:23FromGitter<alehander42> basically combine length + init logic in one invocation of a primitive which we know that fills all new elements with a valid value
09:55:28FromGitter<alehander42> (result of init)
09:55:49FromGitter<alehander42> but this works mostly for sequtils
09:56:23alopsdom96: can I fix it manually locally somehow?
09:56:25Araqalehander42: you can name it anyway you want in the end you need a default value for 'not nil' in order to circumvent the overly strict type sytem
09:57:09dom96alops: fix what?
09:57:16alopsthe snake error
09:57:20FromGitter<alehander42> you don't really: the pattern i showed seems quite applicable and you can have an escape hatch for a small number of cases as unsafeDefault
09:57:38FromGitter<zacharycarter> clyybber: playing around with vulkan using your bindings - thanks for making those!
09:57:52*ikan-keli_ quit (Ping timeout: 246 seconds)
09:58:07Araqalops, https://nim-lang.org/learn.html doesn't link to backends.hml
09:58:11alopschroma: Downloaded package's version does not satisfy requested version range: wanted >= 0.1.1 got 0.0.1
09:58:24FromGitter<alehander42> it works for map newSeq(result, s.len): op(s[i])
09:58:27alopsAraq: I've read all that
09:58:30FromGitter<alehander42> newSeqWithCode*
09:59:01Araqit's listed here though https://nim-lang.org/documentation.html and meh, this document is old
09:59:13alopsright
09:59:35Araqgonna remove this link from documentation
09:59:46*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
09:59:55clyybberzacharycarter: Cool, tell me when you need them to be updated, or find any other problem
10:00:00alopsmy primary use of Nim is going to be to interoperate with C
10:00:04FromGitter<zacharycarter> will do
10:00:06alopsare there other docs on that?
10:00:11*ikan-keli_ joined #nim
10:00:35leorizeso you want to call Nim from C or the other way around?
10:00:53alopsboth
10:01:21leorizealright, calling C from Nim is heavily documented
10:01:29FromGitter<alehander42> otherwise `nilCheck:off` would just turn off the cfg nilcheck pass for the given function: it would still count its `not nil` signatures etc
10:01:35alopswell, it's going to be Nim -> call C with a Nim callback -> C calls back
10:01:52leorizethat's simple
10:01:57*ehmry joined #nim
10:02:06alopsleorize: good to hear :D
10:02:06ronnyare there any suggested libs for deserialization/parsing/transforming json/cbor/msgpack to structs?
10:02:15leorizealops: make sure the callback is decorated with {.cdecl.}
10:02:21leorizeand you're done :P
10:02:26alopssweet
10:02:30Araqronny, PMuch's protobuf maybe
10:02:34FromGitter<alehander42> not sure if it makes sense to have `{.nilCheck:off.}` on a sub-function level tho .. but it can work in the same way
10:02:36leorizeofc you'd need to create a wrapper for the C function you're calling first
10:02:43leorizebut I think that part is straightforward
10:02:52alopswhere are the docs for that?
10:03:06ronnyi specifially have no use for protobuf however - i need json, cbor and msgpack
10:03:25Araqjson.nim covers simple objects
10:03:34leorizealops: https://nim-lang.org/docs/manual.html#foreign-function-interface-importc-pragma
10:03:43FromGitter<alehander42> https://github.com/status-im/nim-json-serialization is another good json option
10:03:55alopsleorize: perfect
10:04:00FromGitter<alehander42> seems like a newer cbor https://github.com/ehmry/nim-cbor
10:04:17leorizealops: for automated tools, look for c2nim and nimterop
10:04:24FromGitter<alehander42> and this one seems maintained https://github.com/jangko/msgpack4nim
10:04:26leorizethe latter is newer
10:04:57FromGitter<alehander42> ronny ^ (links )
10:05:23ronnycurrenctly checking, the json-serialization one us useless for me
10:05:25ronny*is
10:06:18FromGitter<alehander42> why?
10:06:50alopsAnyway, I would fix the Snake example. It's featured prominently on the Features page.
10:07:02ronnyi need deserialization first
10:07:14ronnyhmm
10:07:21FromGitter<alehander42> but it does both
10:07:24FromGitter<alehander42> that's just the name
10:08:04FromGitter<alehander42> `Json.encode(@[1, 2, 3], pretty = false) == "[1, 2, 3]"` and `Json.decode("{....}", MyObj)`
10:08:44leorizealops: looks like it's broken due to an update in its dependency
10:09:51ronnyare there any plans for tagged unions in nim (im looking at the cbor lib and it looks like a strange looking pattern is used to express the polimorphism of the values
10:09:56ronnyi retract my statement about json-serialization, its indeed useful
10:10:03*laaron joined #nim
10:10:34leorizeronny: they're called object variants
10:11:38ronnyare there any macros to derive the constructors/comparators for those, at first glance it looks something thats quite a step back from tagged unions
10:12:16leorizewell it's a type-checked tagged union
10:12:27FromGitter<alehander42> constructing them is simple
10:12:40FromGitter<alehander42> comparator shortcuts would be useful indeed
10:12:59FromGitter<alehander42> but i would compare them a bit more to ADT-s
10:15:50*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
10:16:54ronnyhmm, i just recall tagged unions from haskell (that has utilities to dreive operators/comparators and has direct consturction via the expressions, it seems quite a bit better than what i see in https://github.com/ehmry/nim-cbor/blob/master/src/cbor.nim#L28 and the following
10:18:43alopswell, in Haskell sum types *are* the datatypes, so the language is optimized for it
10:20:22leorizeNim's version of this is much more customizable, but ofc it can be a bit of a mess when you don't need that
10:20:39leorizethere's a macro somewhere that let you construct these similar to how haskell does it
10:21:13leorizehere: https://github.com/andreaferretti/patty
10:21:52*abm joined #nim
10:23:24*navin quit (Ping timeout: 265 seconds)
10:24:01*abm quit (Client Quit)
10:24:29*navin joined #nim
10:28:05ronnypatty looks exactly like what id need
10:29:53ronnyanother item i havent seen easiyl - has nm utilities for late binding polimorphism? (aka tools to declare subtypes later and have them participate)
10:31:19ronnyhmm, nm, i tihnk i have found it, so methods are needed for the dispatch
10:35:35Araqronny, I usually use proc vars / closures for dynamic binding
10:35:46Araqfind it easier to work with
10:36:00Araqas you don't need an inheritance relationship for them
10:36:51ronnyhmm, letss see if i can get myself used to that model
10:40:56*laaron joined #nim
10:42:03*laaron quit (Remote host closed the connection)
10:53:45FromDiscord<Kiloneie> @Araq you here ?
10:55:37AraqKiloneie: haven't watched it yet, give me a link please
10:56:01FromDiscord<Kiloneie> https://youtu.be/5tVIsDYPClA
10:57:20FromDiscord<Kiloneie> The next video will get VS Code to full screen, and captions enabled for all to contribute, got that info from forums. Any more criticism is appreciated
10:57:54*shomodj joined #nim
10:58:58SodaScripterhold up gotta reboot
10:59:03*SodaScripter quit (Quit: Leaving)
11:00:07*NimBot joined #nim
11:01:48alops"The compiler ensures that every code path initializes variables which contain non nilable pointers. The details of this analysis are still to be specified here."
11:01:53alopsWill this be added now that 1.0 is out?
11:02:07PMunchalops, just to answer your question, you can fix it manually. First, clone gamelight, then change the version in the .nimble file. Now run "nimble install" in the base directory. This should install gamelight. Now you can go to the snake game directory and run nimble build.
11:02:08FromGitter<alehander42> praise God, such a great weather today
11:02:28alopsPMunch: oh thanks, will try
11:02:42PMunchalehander42, what do you mean, it's raining and pretty cold..
11:02:57alopspraise physics and local variations
11:03:04Zevvmore recording-technical comments: try using a mic on a headset, or anything reducign your room's acoustics, and set your desktop resolution to 720p max so the resulting video is viewable at lower resolutions
11:03:16Zevv^ that was @Kiloneie
11:03:16*laaron joined #nim
11:03:21PMunchalops, and of course you have the option to clone gamelight, push up the change, and PR it to dom96 :)
11:03:39AraqKiloneie: put it on the desktop? brave...
11:04:23FromDiscord<Kiloneie> Isn't the background noise reduced to almost nothing ?
11:04:34FromDiscord<Kiloneie> i can't hear it at pretty high volume
11:05:29FromDiscord<Kiloneie> got my headphones HD 599 at 50%(which is quite high for good headphones) and i hear nothing
11:06:30FromDiscord<Kiloneie> Yeah my mic is on a stand on my desk... is that a problem ? vibrations somehow ? idk.
11:07:13FromGitter<alehander42> PMunch, it's just slightly cold here, fresh
11:07:22AraqKiloneie: sound quality is bad, but apart from that I really like it! well done
11:07:27FromDiscord<Kiloneie> Wouldn't capturing VS Code directly and stretching it to full screen fix that problem of viewing at lower resolutions ?
11:08:04PMunchKiloneie, Araq, not sure if background noise is the issue. I can't hear any of that. But it does sound a bit distant
11:08:06FromDiscord<Kiloneie> Thank you, i did try to find an actual microphone arm, but i can't find information if it will fit my old mic... it cost 100€ like 8 years ago <.<
11:08:09AraqI can tell you a secret: I didn't know about the F6 shortcut :D
11:08:30alopsAnd it works on mac too
11:08:33FromDiscord<Kiloneie> You didn't ? how did you run your programs then xD ?
11:08:58PMunchalehander42, here it's 8 degrees. which is quite a bit warmer than yesterday
11:09:15PMunchYesterday I had snow on my windshield when I went to work
11:09:19FromGitter<alehander42> Araq, i think growWithInit(int, untyped => T) / newSeqWithInit(int, untyped => T) are the perfect additions to grow and shrink: ⏎ shrink works, because no default needed, growWithInit works because it can still do a single allocation and run a loop which ensures filling with not nil, no default needed
11:09:42FromGitter<alehander42> so grow with unsafeDefault remains for just the other case
11:09:53FromGitter<alehander42> PMunchh, yes i am surprised its not hot
11:09:53FromGitter<alehander42> here
11:10:00FromGitter<alehander42> so different climate surely
11:10:25*SodaScripter joined #nim
11:11:32FromDiscord<Kiloneie> I know i sounded more distant on my introduction part of the video, it's quite noticable, i had my head turned to the right a bit, reading my second monitor script.
11:11:32FromDiscord<Kiloneie>
11:11:32FromDiscord<Kiloneie> But on the second part, it's better, is it too quiet being the main sound quality problem ?
11:12:47FromDiscord<Kiloneie> Which can be fixed by a mic arm, if i can find one... or buy a set ... (trying not to spend money so i can do this for longer, living on my savings atm, which can go as long as 6+ months)
11:13:58PMunchNot really volume that's the issue. I can't really explain it :P But don't get me wrong, you sound fine
11:14:01narimiranyour current mic is probably fine
11:14:15PMunchThe keyboard clicking might be a bit distracting to some though
11:16:21Araqalehander42: you can't use a "single" allocation most of the time anyway
11:16:34narimiranif your mic is on the table where your keyboard is, try putting a towel underneath mic base, it should dampen some of the vibratons
11:16:36Araqthink about the aliasing problems this implies
11:19:51FromDiscord<Kiloneie> Hmm, i guess a microphone arm, if i can find it., sound volume is what it is, so that background noise is non existent or very low, will try a towel for the next video, and see if that helps
11:20:39FromDiscord<Kiloneie> and yeah my keyboard is loud... it's a mechanical one, for gaming xD... i have a much quieter for another computer, could use that for recording
11:22:20FromGitter<alehander42> Araq, i mean that newSeqWithInit and growWithInit just do a single
11:22:29FromGitter<alehander42> newSeq(len .. or setLe(len ..
11:22:53FromGitter<alehander42> but they combine it with a init logic loop
11:23:00FromGitter<alehander42> so the whole invocation preserves
11:23:03FromGitter<alehander42> not nil safety
11:23:09solitudesftrying to package choosenim for my distro, but `nimble build` fails with `Error: unhandled exception: cannot open: /tmp/nimblecache/nimscriptapi.nim [IOError]`. what could be the cause?
11:24:42Araqsolitudesf, no idea, your disto hates /tmp?
11:25:41solitudesfim sure not. it was building fine with older/with-compiler version of nimble.
11:32:43Araqtry 'koch nimble' instead
11:33:04FromDiscord<exelotl> @Kiloneie I'd recommend also doing some post processing on the audio. Use a gate to eliminate background noise, compressor to reduce the difference between loud and quiet sections and a limiter to maximise the volume without clipping
11:33:29*owl_000 quit (Ping timeout: 265 seconds)
11:33:48FromDiscord<exelotl> (out of those I'd say limiter is the most important)
11:33:58FromDiscord<Kiloneie> i already have those in obs
11:34:19FromDiscord<Kiloneie> that's how i can't hear my background noise
11:34:36FromDiscord<Kiloneie> let me check again though
11:36:46FromDiscord<Kiloneie> i put my volume to max, and i hear some static like sound maybe, but im pretty sure that's my computer
11:37:07FromDiscord<Kiloneie> which is a dark base 900 chasis, made to reduce noise
11:37:12FromDiscord<Kiloneie> idk
11:37:21FromGitter<alehander42> https://paste.ofcode.org/yGDVcfhgn5eTCyLEgBE4tx
11:37:33FromDiscord<Kiloneie> at 50% i hear none of those things,
11:37:49clyybbersolitudesf: For void?
11:37:56solitudesfyes
11:38:11*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
11:38:27FromGitter<alehander42> Araq ^ something like this in ~pseudo code
11:39:28*laaron joined #nim
11:39:56FromGitter<alehander42> often processing code just copies other values from another collection/generates new ref values in a loop when grow/setLen is used
11:40:10FromDiscord<Kiloneie> Yeah okay 60% volume and up i can hear my computer, under that it's not there. Not much i can do about that though, it's already top of the line sound dampening, i could try to move my desk a bit away from it, or put some cardboard in between, maybe that would help some
11:43:43FromDiscord<Kiloneie> I will put a towel under my microphone stand, put some carboard seperating my computer, adjust my obs settings a bit more, now targeting max volume, and use a quieter keyboard, then make a video #2 with that, and hopefully it's gonna be much better.
11:44:46*endragor quit (Remote host closed the connection)
11:48:02FromDiscord<Mamy> offtopic: so updating fontconfig seems to have broken Gitter forever and the desktop client had no commits on master since 7 months :/
11:50:16FromGitter<alehander42> there is a desktop client?
11:53:15FromGitter<alehander42> https://www.zerotier.com/zerotier-2-0-status/ "Go feels like a somewhat different animal geared toward rapidly developing high quality servers, interfaces, APIs, and management backends." i often felt this is a niche nim can shine in: all kinds of TUI-s/CLI-s and simple API-s/services
11:53:43FromGitter<alehander42> still dont understand why so many cli tools/interfaces are being written in go these days
11:53:45clyybberAraq: Found a cool bug: https://github.com/nim-lang/Nim/issues/12260
11:53:55clyybberIts not deterministic afaict
11:55:13alopsThat's a lot of open issues :o
11:56:03FromDiscord<Mamy> @alehander: https://gitter.im/apps
11:56:08ZevvDoes anyone know of a hack to get a fallthrough behaviour in a case or sequence of ifs?
11:56:10FromDiscord<Mamy> alehander42 ^
11:56:37clyybberZevv: Maybe with named blocks and break?
11:56:48FromDiscord<Mamy> I use goto 😛
11:57:04clyybberMamy: There is no goto in nim :p
11:57:20Zevvyeah, there is a kind-of-goto
11:57:21FromDiscord<Mamy> I beg to differ: https://github.com/mratsim/weave/blob/330a5113e62f332441397208b1084008a576f83f/e04_channel_based_work_stealing/runtime.nim#L988
11:58:01FromDiscord<Mamy> but yeah named blocks + break work, I use them as well
11:58:13Zevvaraq told me about that once, let me refresh my memory, mayby that can help me with new insights I have now
11:58:45clyybberMamy: Oh, how does that work? Is there any documentation on this?
11:58:59FromDiscord<Mamy> no it's undocumented, but there is a test case
12:00:01FromDiscord<Mamy> ah, this: https://forum.nim-lang.org/t/1320#8332
12:00:03FromGitter<alehander42> alops, not really: most languages have more issues
12:00:18FromGitter<alehander42> but this is normal, the more usage you have , the more issues
12:00:23Zevvbasically, I have pretty long things like this http://ix.io/1WSN where a lot of cases require a loop iteration, while a fallthrough would suffice
12:00:36FromDiscord<Mamy> basically you have goto blocks as enum values
12:00:55FromDiscord<Mamy> change the enum values of your control variable and you change block
12:01:39clyybberMamy: Ah, so its kind of equivalent to computedGoto
12:01:53ZevvYes, but what I did not say: I also need to go to computed values
12:01:59Zevvso that was why this did not work for me
12:02:01FromDiscord<Mamy> @Zevv it seems like you want a Duff's device
12:02:10Zevvmamy: right indeed
12:02:32clyybberZevv: What about the named blocks?
12:02:45mpcjanssenUsing choosenim to install nim 1.0.0 fixes the nimble issue. Seems homebrew nim 1.0.0 is broken
12:02:52Zevvclyybber: how would that work, any examples anywhere?
12:03:03clyybberhttps://nim-lang.github.io/Nim/manual.html#statements-and-expressions-block-statement
12:03:17clyybberZevv: Assuming I understand you correctly
12:03:23FromDiscord<Mamy> I have an example here: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/backend/openmp.nim#L55-L67
12:03:29FromDiscord<Shield> sadly Duff's device isn't enough of an excuse to change Case behavior or even make a new keyword that doesn't break by default in each case
12:04:11FromDiscord<Mamy> so you would have nested named blocks just call "break mynameblock1"
12:04:16clyybberZevv: Or do you want something like a C switch statement?
12:04:42Zevvclyybber: that is my intuition yes. What I *actually* would like is a 'goto whatever I say' :)
12:04:58FromDiscord<Mamy> use a computed goto otherwise
12:05:15Zevvbut see my last ix.io example. The case 0 and case 1 both allow for fallthrough, but case 2 requires a jump-to-computed block
12:05:23Zevvwhich rulels out the {.goto.}
12:05:40FromDiscord<Mamy> computedGoto is different
12:05:43FromGitter<gour> @Araq my sincere congratulations for achieving 1.0 release as well as bulding nice community around the project!
12:05:48FromDiscord<Mamy> see second example here: https://github.com/status-im/nimbus/wiki/Interpreter-optimization-resources#nim-implementation-benchmark
12:05:54Zevvgour: the community was always nice :)
12:06:34Zevvmamy: that looks similar, let me check
12:06:35FromDiscord<Mamy> that's probably the best way to do what you want
12:07:40FromDiscord<Shield> did the goto pragma name changed or it has 2 names?
12:07:47Zevvok, cumputedgoto is simply hinting at the C level that a computed goto would be appropriate here, although it will still hit the while() loop every iteration
12:08:03ZevvI'm micro-optimizing stuff away, but my inner loop now still eats about 15% of my performance
12:08:29*navin quit (Remote host closed the connection)
12:08:30ZevvI suspect branch prediction is also not optimal here
12:10:07*navin joined #nim
12:11:14*rockcavera joined #nim
12:11:21FromDiscord<Mamy> actually it generates a jump label table with &&something
12:11:38PMunchZevv, we were just talking about this in #nim-offtopic: https://www.youtube.com/watch?v=r-TLSBdHe1A
12:11:47PMunchMight be interesting, especially the second part with the coz profiler
12:12:02FromDiscord<Shield> it looks like .goto. doesn't require being inside a while true loop, i didn't know that
12:12:31alopsis there a big int library?
12:12:39alopsarbitrary precision that is
12:12:58FromDiscord<Mamy> @PMunch here is coz wrapper for nim: https://github.com/mratsim/weave/blob/master/e04_channel_based_work_stealing/primitives/coz.nim
12:12:59PMunchThere is Stint
12:13:09FromDiscord<Mamy> Stint is not arbitrary it's fixed
12:13:17FromDiscord<Mamy> there is a wrapper for gmp
12:13:34FromDiscord<Mamy> nim-bigint is available but it's not optimized
12:13:39PMunchYeah I know, answered after having just read big int.
12:13:54PMunchOh cool, that is for setting the progress thingies?
12:14:08clyybberZevv: Maybe using templates and a single if statement would be faster? I suppose code size will suffer though
12:14:15alopscan't use gmp wrapper due to its license
12:14:16FromDiscord<Mamy> if you look in coz repo, coz generates a file (json) tat you can paste on a website
12:14:16clyybbers/code size/binary size
12:14:35Zevvclybber: I don't really care about code size right now
12:14:59FromDiscord<Mamy> I plan to write a contant-time modular bigint for crypto, but never had the time, + I have a showstopper bug for my design :/
12:16:05Zevvclyybber: and the function calls in my example are not really there, those are already expanded
12:16:07FromDiscord<Mamy> one thing that you can do
12:16:33FromDiscord<Mamy> is use this for the time being: https://github.com/status-im/nim-decimal
12:16:53FromGitter<gour> @Zevv, I meant to say in terms of "size" ;)
12:17:15Zevvooh :)
12:17:32*gour joined #nim
12:18:14FromDiscord<Kiloneie> What is better, a big piece of wood(for a desk) or a lot of cardboard for sound insulation/dampening ?
12:19:34clyybbercardboard
12:20:27clyybberBest would be some stonewool/glasswool inside of plastic wrap
12:20:38FromDiscord<Kiloneie> lucky me i got a shit ton of that , just not the biggest of pieces
12:20:43FromDiscord<Kiloneie> don't have that
12:21:13FromDiscord<Kiloneie> imma build a wall next to my computer xD
12:21:17clyybberlol
12:21:19alopsMamy, trying nim-decimal, but unable to import it after install. Tried decimal, decimal/decimal, uppercase variants etc
12:21:43FromDiscord<Kiloneie> Make sound great again ! imma let myself out now.
12:21:56clyybberwait, Mamy, are you mratsim?
12:22:33PMunchKiloneie, there is a guy on YouTube who does some DIY sound isolation stuff
12:22:37PMunchDIY Perks IIRC
12:23:17gourthe other day I stumbled upon one app written in Eiffel(Studio) and out of curiosity installed that IDE (https://www.eiffel.com/) - it looks nice and wonder what could be missing in Nim's ecosystem to provide something similar (where it is applicable) considering the differences in programming paradigms between Nim & Eiffel?
12:23:33Zevvwell yes, I tried {.computedGoto.} again, and this time it fit and worked, 25% improvement!
12:23:34PMunchMamy, how does the channel based work stealing work in Nim? I've been looking at work stealing, but the separate heaps of the GC makes it not too trivial..
12:23:56Zevvdaang that's a pretty easy gain, 25% in 10 minutes. Thanks ppl!
12:24:03FromDiscord<Shield> amazing, {.goto.} isn't just a hint, it translates to goto
12:24:25FromDiscord<Kiloneie> @PMunch i will check that out
12:24:26clyybberZevv: Nice, are you working on npeg?
12:24:30Zevvwhat else :)
12:25:49clyybberNice, can npeg parse to an enum at compile-time?
12:26:00ZevvAt my current work I can not get to concentrate on *anything* at all, it's different things twice a day, a lot of plumbing and ploughing to other peoples code. So my spare time is now filled with totally overengineering and microoptimizing. Every time I walk the dog something new comes to mind, it's great to go *deep*
12:26:16ZevvHow do you mean 'parse to an enum'?
12:26:19Zevvexample?
12:26:31PMunchphrasing..
12:26:54Zevv..
12:26:55*alops quit (Quit: leaving)
12:28:42*Hideki_ joined #nim
12:29:13clyybberZevv: Something like this: http://ix.io/1WT6
12:29:37Zevvyes.
12:29:41Zevvgimme a minute
12:31:39*Entropic is now known as icyphox
12:33:38Zevvhttp://ix.io/1WT9
12:33:50Zevv--> @[door, wall, floor, window, pond, hole]
12:34:47clyybberAmazing, thanks!
12:34:54clyybberI have to dig into npeg
12:35:08clyybberOh
12:35:22clyybberBut Zevv, can I generate the enum at compile time?
12:35:22Zevvand the compile-time variant: http://ix.io/1WTc
12:35:38clyybberLike the type section itself?
12:35:47gourif nim project would need to include 3rd party C lib and build bindings for it which build system would you recommend or Nim's own ecosystem can handle it?
12:36:12Zevvclybber: then I still do not understand your question I think. This parses text and creates a const seq[someThing] from the text
12:36:39clyybberZevv: And I want it to parse text and create an enum type from the text
12:36:44Zevv*create* an enum type
12:37:04*Zevv scratches his head
12:37:48Zevvwell, I built you a const seq of strings. Can you create a macro that builds an enum type of that? :)
12:38:07PMunchgour, you can use c2nim or nimterop to generate the bindings, then Nim handles the rest.
12:38:13clyybberZevv: Ah sure, thanks
12:38:21*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
12:38:28Zevvinteresting use case though!
12:38:50ZevvI guess I should even be able to parse into NimNodes and parse another language and compile to nim
12:39:07*laaron joined #nim
12:39:14ZevvNot that that would be *fun* to do, but it should be very possible
12:40:22FromGitter<alehander42> you can do something like ⏎ ⏎ proc inLisp(e: int) {.lisp.} = ⏎ "(display (* e 2))" [https://gitter.im/nim-lang/Nim?at=5d8b6035309dc95e597a51fc]
12:40:45shashlickWow 1500+ messages
12:40:59shashlickGave up on catching up
12:41:45FromGitter<alehander42> sue me, but a chat with threads would work greatly for this
12:41:52gourPMunch: the build system is provided by nimble?
12:41:58clyybberZevv, alehander42: That would indeed be very cool
12:42:04clyybberAnd !!FUN!! to build
12:42:06clyybber..
12:42:50*laaron quit (Client Quit)
12:43:04Zevvalehander42: c'mon, of all things I can parse, you ask me to parse *lisp*
12:43:38FromGitter<alehander42> well, it's the factorial of syntaxes
12:43:46FromGitter<alehander42> parse C++
12:44:09FromGitter<alehander42> come at it bro
12:44:09clyybberparse befunge
12:44:24FromGitter<alehander42> parse perl4
12:44:46*laaron joined #nim
12:46:20*laaron quit (Client Quit)
12:47:20ZevvHere is your lisp parser: http://ix.io/1WTk
12:47:32*Hideki_ quit (Remote host closed the connection)
12:47:35Zevvand here is java1.6 http://zevv.nl/div/java.html
12:47:47ZevvI have heard rumours C++ can not be parsed
12:48:01Zevvmumble-numble-something-NP-numble
12:48:38clyybberWhat?
12:48:47clyybberIs parsing Cpp np hard?
12:49:20Zevvit must be
12:49:23ZevvI find C++ hard
12:50:30Zevvpeople complain that Nim has too many ways to do X or Y. I point them to C++ and they say, "Yeaaah, but C++ is different"
12:50:33Zevvbooooh, I say
12:51:36*laaron joined #nim
12:52:27PMunchgour, yeah nimble can be used to build. But it is mostly for ensuring that you have the packages you need
12:52:44PMunchNot quite sure what kind of tasks you want from your build system
12:52:51clyybberIf ppl want only one way to do anything they should write in pure lambda calculus and make a linter that simplifies the terms
12:53:04ZevvAPL to the max
12:54:08clyybberI like these commit messages, he has been doing those for years lol: https://github.com/githwxi/ATS-Xanadu/commits/master
12:55:01*hhr quit (Ping timeout: 268 seconds)
12:56:01PMunchclyybber, what?! That's horrible!
12:56:12FromDiscord<Shield> https://github.com/b3liever/looper
12:56:33FromDiscord<has1> hi, i am getting an error when trying to install nim on linux mint
12:56:53FromDiscord<has1> ```
12:56:54FromDiscord<has1> Extracting nim-1.0.0.tar.xz
12:56:54FromDiscord<has1> Building Nim 1.0.0
12:56:54FromDiscord<has1> Exception: Execution failed with exit code 1
12:56:54FromDiscord<has1> ... Command: sh build.sh
12:56:54FromDiscord<has1> ... Output: # OS: linux
12:56:55FromDiscord<has1> ... # CPU: amd64
12:56:57FromDiscord<has1> ... gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/stdlib_assertions.nim.c -o c_code/1_2/stdlib_assertions.nim.o
12:56:59FromDiscord<has1> ... In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h:7:0,
12:57:01FromDiscord<has1> ... from /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h:34,
12:57:03FromDiscord<has1> ... from c_code/nimbase.h:257,
12:57:05FromDiscord<has1> ... from c_code/1_2/stdlib_assertions.nim.c:6:
12:57:08FromDiscord<has1> ... /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory
12:57:09PMunchhas1, again with the multi-line pastes..
12:57:10FromDiscord<has1> ... #include_next <limits.h> /* recurse down to the real one */
12:57:11FromDiscord<has1> ... ^~~~~~~~~~
12:57:13FromDiscord<has1> ... compilation terminated.
12:57:14FromDiscord<has1> Cleaning failed build
12:57:16FromDiscord<has1> Error: Build failed
12:57:16Zevvstop that
12:57:17FromDiscord<has1> ```
12:57:20FromDiscord<Shield> "Same functionality can be achieved with two templates" this exactly what happened to me when i spent a couple of days learning macros to unroll loops, then i did it in 3 lines with templates
12:57:20clyybberlol
12:57:21FromDiscord<has1> what can i do about that?
12:57:23FromDiscord<Shield> holy shit has1
12:57:31clyybberhas1: Use hastebin
12:57:36PMunchOr ix.io
12:57:40FromDiscord<has1> ahh true, i forgot
12:58:02lqdev[m]Zevv: I have a great idea for you. if you really don't want all of this colorful syntax highlighting, only green on black, how about making keywords bold and some other parts dark
12:58:06lqdev[m]this is just perfect
12:58:18PMunchBut yeah, someone should fix FromDiscord to do that automatically..
12:58:23*matlock quit (Ping timeout: 276 seconds)
12:58:38*SodaScripter quit (Ping timeout: 245 seconds)
12:58:46FromDiscord<has1> so this is the error https://pastebin.com/Xgg7VWSM
12:59:00Zevvlqdev[m]: naaaah, I'm fine :)
12:59:50FromDiscord<Shield> yeah, the bot should detect multiline code blocks and just trim them or auto dump them in a ix.io
12:59:57lqdev[m]has1: check out termbin or ix
13:00:40lqdev[m]@Shield the gitter bot can do that, it's just the discord bot that's broken
13:00:43leorize@has1: have you installed `build-essentials`?
13:00:57*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
13:01:10leorizelqdev[m]: the gitter bot can because you can see a discussion without logging in
13:01:14FromDiscord<has1> its bare installation
13:01:18FromDiscord<has1> so i dont think so
13:01:35leorizeyea, you need to install that package before you can do any C building
13:01:47clyybberShield: FYI you can do `while (name = readLineFromStdin("Enter your name: "); name.len == 0): echo "Empty value. Try again."`
13:01:51FromDiscord<has1> which package exactly?
13:01:54clyybberFound out yesterday
13:02:01FromDiscord<has1> ```sudo apt-get install build-essentials``` this one doesnt exist
13:02:31leorizetry removing the `s` at the end
13:02:38clyybberShield: You can even introduce new variables in the block before the condition and they will be in the scope of the while block
13:02:38leorizeI'm not sure what's the exact name
13:02:54FromDiscord<has1> ah its the name, you are right
13:03:31clyybberHey, our issue to star ratio is ~16%
13:03:38clyybberFor reference rust is at ~13%
13:03:40FromDiscord<Shield> that is actually pretty neat clyybber
13:03:54PMunchclyybber, is that a useful metric?
13:04:00clyybberPMunch: Not really
13:04:05PMunchHaha
13:05:06PMunchI mean my toy language stacklang has inf% star to issue ratio. alehander42 stared it, and I have no issues :)
13:06:00clyybberHehe, but the issue to star ratio is still at 0..
13:06:17clyybberWhich is what I was referring to
13:06:18FromDiscord<has1> hi
13:06:27clyybberhas1: hi
13:06:45FromDiscord<has1> shouldn't the install instructions be updated to mention the dependency on build-essential ??
13:07:01FromDiscord<has1> or shouldn't the script itself install build-essential ??
13:07:05leorizewell, not everyone runs a debian-derivative
13:07:40FromGitter<alehander42> PMunch i've thoguth about
13:07:44FromGitter<alehander42> pagerank for github start
13:07:44leorizeand if you do development knowing that you need to install `build-essential` is common sense
13:07:45FromGitter<alehander42> for a while
13:07:52FromGitter<alehander42> because e.g. i starred a lot of stuff before
13:08:14FromDiscord<has1> So its ok for it not to work out of the box for the most widely used linux distros out there?
13:08:22FromGitter<alehander42> but on the other hand that's a pretty petty thing to add to a simple star rated site
13:08:38FromGitter<alehander42> so i am glad it isnt there
13:09:09FromDiscord<has1> @leorize golang works fine without this and I did not know that you need to install it
13:09:25FromDiscord<has1> So i guess i dont have common sense, that's a nice way to talk to new users
13:09:37leorizebecause go is packaged by your distribution
13:09:49leorizethey already included the needed dependency when you install it
13:09:51FromGitter<alehander42> `You probably already have a compiler installed. If not, use your package manager to install either gcc or clang.`
13:09:55FromGitter<alehander42> isn't this enough?
13:10:02leorizeno
13:10:03FromDiscord<has1> no. I downloaded it from https://golang.org/
13:10:04solitudesffetch random github repo, do `make` in it and see if it works
13:10:10FromGitter<alehander42> is there anything else needed by build-essential
13:10:15leorizedebian-derivative split stuff into `libc-dev`, etc
13:10:20leorizebecause "headers are heavy"
13:10:28FromGitter<alehander42> ah
13:10:40FromDiscord<has1> @leorize so you are wrong.
13:10:41FromGitter<alehander42> well, then it can be mentioned for debian i guess
13:11:07leorize@has1 i stand corrected
13:11:21leorizebut don't quote me as if I'm authorative in this project :P
13:11:50leorizejust stating my experiences of developing on *nix
13:12:25leorize@has1: https://github.com/nim-lang/Nim
13:12:34leorizethe dep is already mentioned in the README
13:12:58*owl_000 joined #nim
13:13:30leorizebuild_all.sh is made for the compiler devs to quickly rebuild a newer version
13:13:42leorizewhich explains why it doesn't have all the dep checking
13:15:10FromDiscord<has1> doesn't that defeat the purpose? choosenim is supposed to make it easy to install nim, correct? If i have to manually install stuff myself then it kinda defeats the purpose, doesn't it?
13:15:14*navin quit (Ping timeout: 240 seconds)
13:15:22leorizeoh, so you got it from choosenim?
13:15:28leorizeplease file an issue there then
13:15:37leorizeI thought you were compiling Nim from the git repo
13:15:38FromDiscord<has1> yes
13:16:24FromDiscord<Shield> i'm using spartan mode, aka renaming nim folder to switch versions lol
13:16:39solitudesfhttps://github.com/dom96/choosenim#dependencies
13:16:43shashlickChoosenim doesn't install compiler except on Windows
13:17:10leorizefederico3: do you have a ppa for linux mint? it might be useful for new users to skip all the building stuff
13:18:03federico3leorize: no need for a ppa, Nim is in Debian
13:19:00federico3doesn't mint has a process to ingest packages from Ubuntu or Debian?
13:19:19narimiranmint takes from ubuntu LTS, IIRC
13:19:37leorizeyou can't get the latest version of Nim unless you also runs the latest version of debian
13:19:59federico3LTS? For a desktop distribution?
13:21:07leorizeubuntu still recommends LTS iirc
13:21:26leorizealso, wouldn't you need to be on debian unstable to get the latest nim?
13:22:02*hhr joined #nim
13:22:07federico3yes, albeit you can pull the package from Unstable. However I can do an official backport
13:22:18PMunchclyybber, oh issue to star ratio... Yeah that is at 0%, but you want that to be the case right?
13:23:07clyybberYeah :p
13:23:35federico3leorize: how can you ask for a package inclusion in Mint?
13:24:18leorizeno idea
13:24:19shashlickBoth the nim website and choosenim talk about dependencies
13:24:41shashlickAs a new user, you are expected to read some documentation
13:25:20shashlickPeople are happy to help here as well as learn from new user experience
13:25:46FromDiscord<has1> @shashlick https://nim-lang.org/install_unix.html
13:25:57FromDiscord<has1> where does that say to install build-essential ?
13:26:04PMunchhas1, if you get choosenim from your package manager it should grab build-essentials as well as a dependency. And I agree that 90% of devs will already have this, if it wasn't pre-installed on their distro to begin with. And "why not just install it automatically" is exactly what your package manager is for, which is why grabbing it from there should solve this issue.
13:26:11solitudesf`The Nim compiler needs a C compiler in order to compile software. `
13:26:13solitudesfhere
13:26:13shashlickIt says to install your c compiler
13:26:36sealmoveleorize: https://github.com/kaitai-io/kaitai_struct_compiler
13:26:41shashlickIs it really sensible to document install instructions for every single distro
13:26:41leorizeon debian and its derivative, installing the c compiler is never enough
13:27:02shashlickThen that's a Debian doc issue
13:27:04sealmoveNo, haven't done any measurements, but apart from this edge case, inheritance is not needed.
13:27:10federico3not everybody wants to use Nim with the compiler
13:27:16FromDiscord<has1> @PMunch i was installing it from the website https://nim-lang.org/install_unix.html
13:27:38FromDiscord<has1> @solitudesf i already had gcc installed and it still didnt work
13:27:42PMunchBut you didn't follow the instructions to have a C compiler?
13:27:57leorizethey already have gcc
13:28:02PMunchAh, I guess it could mention that you need build-essentials as well..
13:29:07leorizeyou probably wouldn't need the entire set
13:29:08FromDiscord<has1> @PMunch "Linux
13:29:08FromDiscord<has1>
13:29:09FromDiscord<has1> You probably already have a compiler installed. If not, use your package manager to install either gcc or clang."
13:29:15leorizejust libc-dev should be fine
13:29:15FromDiscord<has1> and i already have gcc
13:29:24*BigEpsilon joined #nim
13:29:30shashlickGoogle Debian c compiler
13:29:44federico3has1: what's the error message?
13:30:08FromDiscord<has1> by the way though, this part is way down under "manual installation"
13:30:09shashlickEvery link talks about build-essential
13:30:23*navin joined #nim
13:30:26leorize#include_next <limits.h> no such file or directory
13:30:29federico3I'm adding a Recommends: for build-essential
13:30:44FromDiscord<has1> as a user, why would i scroll down there if i dont want to do a manual installation? And it still doesnt mention build-essential
13:31:06FromDiscord<has1> @shashlick "Every link talks about build-essential" which link?
13:31:11FromDiscord<has1> you mean the github?
13:31:15shashlickThis is really ridiculous
13:32:08shashlickYou don't expect to read the docs but want this documented
13:32:12PMunchEvery link that comes up when you google the kind of errors yo have
13:32:25leorizeto be fair, for a beginner tool like `choosenim`, some instructions should be there
13:32:53Cadeylet's go file a PR
13:32:58Cadeynim has the distros module
13:33:03PMunchYeah I agree that choosenim, if not installing it automatically could at least do a check to see if it isn't installed and stop, giving a more straight error to the user that they are missing something.
13:33:05Cadeyhttps://nim-lang.org/docs/distros.html
13:33:22FromDiscord<has1> @shashlick i read the website. It gives me this 1 command to install nim using "choosenim", below that i get instructions for "Manual installation"
13:33:29*LargeEpsilon_ quit (Ping timeout: 276 seconds)
13:33:44FromDiscord<has1> but even in the Manual installation, it doesn't mention build-essential, it mentions gcc (which i have installed)
13:33:46CadeyforeignDepInstallCmd("build-essential")
13:33:59Cadeyor foreignDepInstallCmd("alpine-sdk")
13:34:01Cadeyetc
13:34:24Cadeyi misread
13:34:29Cadeyi'm tired
13:34:34CadeyforeignDep*
13:35:01shashlickSo if it said c compiler instead of gcc, would it be any clearer?
13:35:10FromGitter<alehander42> yes, choosenim can check/doc that
13:35:15shashlickYou'd still run into the issue
13:35:24Cadeyit would be nice if there was a function in distros that returned your current distro
13:35:31Cadeyi wonder how difficult that would be to implement
13:35:38PMunchhas1, I guess no one every really came across this as most of us already have build-essentials installed. It's good to get new users so we can see what friction there is to the install process for complete beginners.
13:35:53shashlickAdd a line saying check your distro docs how to do get a c compiler and call it
13:35:55leorizeCadey: it's easy thanks to systemd :P
13:36:14PMunchCadey, probably does that in the macro from distros.nim
13:36:15federico3Cadey: there is but some distros don't even bother...
13:36:16Cadeyi don't use systemd on most of my nim installs
13:36:20PMunchSo you could have a look at how it does it.
13:36:24FromDiscord<has1> @shashlick well not for me at least. My understanding is that gcc IS a c compiler. If i already have that installed, why would i need build essential? I dont know what that is.
13:36:25FromDiscord<has1>
13:36:25FromDiscord<has1> but that is besides the point. I would expect choosenim to install those dependencies for me (i thought that is kind of the point of it)
13:36:25FromDiscord<Kiloneie> is it harder to install on mac os and linux ?
13:36:44Cadeywith macos you need to install the xcode command line tools
13:36:46FromDiscord<Delta231> it takes time
13:36:48Cadeywhich is a trivial thing
13:36:53solitudesfyou expect choosenim to handle every dependency on every linux distro?
13:37:06PMunchchoosenim is meant to choose the version of Nim
13:37:12Cadeysolitudesf: if we can at least get debian and ubuntu we should be okay
13:37:26PMunchSo you can switch between versions, grab the latest devel, or update the stable channel easily.
13:37:29FromDiscord<has1> I also have some good news though, the visual studio code extension works on ubuntu correctly when you set the nim binary in your .bashrc file (This didn't work on manjaro, i had to set the path inside /etc/profile )
13:37:36FromDiscord<Delta231>
13:37:36FromDiscord<Delta231> https://cdn.discordapp.com/attachments/371759389889003532/626411986367807488/unknown.png
13:37:53PMunchIt's mostly a tool to keep your Nim install up to date and allow you to move between versions (which might become less common now that 1.0 is out).
13:38:19FromDiscord<Kiloneie> Whever i installed any software and any programming language i just took the default stuff that is guaranteed to work. Shouldn't everyone do that first ?
13:39:21CadeyPMunch: i don't see a macro in distros.nim
13:39:32FromDiscord<Kiloneie> i honestly wouldn't use a compiler you used for Visual Studio, just because you used it with c++.
13:39:36Cadeyoh i see
13:39:38Cadeyyou do it backwards
13:40:07Cadeyi'll submit a PR
13:40:29FromDiscord<has1> @solitudesf yes, or at least tell me about the things i need to install on the website (github seems to mention build-essential but the website does not)
13:40:58leorize@Delta231 do you happen to be using gentoo?
13:41:52FromDiscord<Delta231> wsl
13:42:01shashlickYou cannot document everything, especially since you can fix your issue in 30 seconds with Google
13:42:06FromDiscord<Shield> windows installation was super easy
13:42:14FromDiscord<Kiloneie> MinGW being default compiler for Nim is used for a reason of speed and minimalism correct ?
13:42:21FromDiscord<Kiloneie> Portability maybe too ?
13:43:04FromDiscord<Shield> minGW works, clang is awful
13:43:15FromDiscord<Shield> i keep getting dll related problems
13:43:28FromDiscord<Delta231> I don't wanna use mingw
13:43:35shashlickBeing new to something means being open to learning stuff that you don't know or haven't experienced
13:43:50shashlickIt does not mean more documentation
13:44:08shashlickNote also that people are willing to help here, stack overflow and that not
13:44:31shashlickEverything isn't wrong or broken needing fixing all the time
13:45:11FromDiscord<Shield> pretty much, programming is all about problem solving, being on linux already means a minimum tolerance for stuff breaking *cough* configs *cough*
13:45:25solitudesfwebsite and tools are open. submit a pr if you think that documentation is lacking.
13:45:41FromDiscord<Shield> btw @shashlick how's your editor project going? did you try the newruntime?
13:46:52leorize@Shield use a proper distro :P
13:47:50Cadeysubmitting a PR
13:48:02PMunchCadey, oh template sorry
13:48:05FromDiscord<Shield> sadly no distro can fix intel drivers for old graphic cards
13:48:12Cadeyhttps://github.com/dom96/choosenim/pull/138
13:48:33FromDiscord<Cadey~> @has1 is this a good start? I can PR the website after work
13:49:19FromDiscord<Shield> but out of curiosity, what's a proper distro? the only one i had fun with was puppylinux, i love live cd distros
13:49:25FromDiscord<has1> yes anything helps, either a message, warning, or installing it by default
13:49:44shashlick@Shield no luck, just tried yesterday cc @Araq - feud is still broken on 1.0
13:49:59Araqshashlick, with --gc:boehm ?
13:50:07shashlickRan in 32 bit but crashes in 64 bit
13:50:08shashlickYes
13:50:47federico3https://github.com/nim-lang/Nim/wiki/Common-Criticisms somebody should update this
13:50:57FromDiscord<Shield> is it hard to rewrite it to use newruntime? what's broken about it exactly?
13:51:16AraqShield: we don't know, need to investigate
13:52:29shashlickBasically table is created by exe and modified by dll
13:52:45shashlickIt then gets garbage collected probably cause it becomes empty
13:53:10shashlickDll is also Nim binary
13:53:33Araqthe DLLs all should be built with --gc:boehm
13:54:11FromGitter<alehander42> very interesting how the julia people were up in arms about x being the same as X
13:54:36FromGitter<alehander42> you can never predict all the possible issues /misconceptions for different auditory
13:55:10FromDiscord<Shield> ah, i'm looking at that issue about tables crashing and i can't seem to find it, the other one was related to loading multiple libraries causing problem depending on the order
13:55:32shashlickYes it is also being built with boehm - I'll check to be sure though
13:56:44FromDiscord<Shield> i lowkey want to make a minimal plugin system with newruntime, but i still don't know how to monitor memory leaks properly on windows
13:58:04clyybberAraq: Is `array[someEnum, something]` a valid type?
13:58:11leorizeyes
13:58:13Araqcertainly
13:58:32leorizeif the enum is w/o holes iirc
13:59:09*BigEpsilon quit (Ping timeout: 268 seconds)
13:59:11clyybberOk, then this should work: http://ix.io/1WTS ?
13:59:26FromGitter<alehander42> Shield, i guess valgrind?
13:59:37leorizevalgrind don't run on windows
13:59:39FromGitter<alehander42> or do you mean, while working normally
13:59:41FromGitter<alehander42> ohhhh
13:59:58FromGitter<alehander42> well, what are the window equivalents
14:00:45leorize@Shield a proper distro depends a lot on your use case :P
14:01:11leorizeI found that Arch gives me the least amount of problems
14:01:24PMunchleorize, ditto
14:01:33*nif quit (Quit: ...)
14:01:43*nif joined #nim
14:01:43PMunchclyybber, not sure you can initialise an array that way..
14:01:48Cadeythe distros module leaves a lot to be desired :(
14:02:13shashlickI think config files might be my problem
14:02:19shashlickNeed to test the theory
14:02:23narimiranalehander42: thanks for replying there on julia forum
14:02:24*dddddd joined #nim
14:02:35clyybberPMunch: Lets ask Araq
14:02:40*hhr quit (Quit: WeeChat 2.4)
14:02:46clyybberPMunch: If you are referring to the explicit indexes, that should work
14:02:52clyybberits in the manual
14:03:16Araqit's also covered by tests
14:03:27PMunchHuh, never seen that before
14:03:35PMunchBut yeah, that works..
14:03:35clyybberOk, so this is a bug?
14:03:58clyybberError: type mismatch: got <array[0..3, int]> but expected 'Tile = CompositeTypeClass'
14:04:16FromDiscord<Shield> yeah windows debug tools are lacking, there's a tool for detecting memory leaks but apparently if it's reachable it's not a leak
14:04:26FromDiscord<Shield> only segfaults are easy to detect
14:04:27PMunchclyybber, yeah that makes sense
14:04:32clyybberThat error isn't particularily great either. I came across that ` = CompositeTypeClass` in error messages often recently
14:04:33AraqCadey, why, it's aweseom
14:04:38*nif quit (Client Quit)
14:04:59*nif joined #nim
14:05:03CadeyAraq: it is, but i'd like to be able to get the list of commands for the current OS
14:05:14AraqTileset[n: enum] = array[n, Discriminator[n]] # ok, so it's a generic
14:05:27PMunchYou try to cast [Air: 1, Land: 0, Water: 0, Wall: 0], an array of four ints into a Tile which is an object with twe fields `a` the array your probably trying to assign, and `collapsed` a bool.
14:05:27Araqah never mind
14:05:46AraqCadey, what "commands"?
14:05:51*krux02 quit (Remote host closed the connection)
14:05:56leorize@Shield: then it's a logical leak
14:06:28CadeyAraq: https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/distros.nim#L185
14:06:31leorizethose are terrible
14:07:17clyybberPMunch: Ah right
14:07:32*bertiebun quit (Remote host closed the connection)
14:08:06*nif quit (Client Quit)
14:08:17*nif_ joined #nim
14:08:18AraqCadey, it's private, use the API
14:08:30Araq if detectOs(Ubuntu): foreignDep "lbiblas-dev" foreignDep "libvoodoo"
14:08:45Cadeyyes but how do i get the contents of that without implicitly echoing them?
14:09:05Araqit's for the Nimble integration
14:09:17Cadeyref: https://github.com/dom96/choosenim/pull/138#pullrequestreview-293091480
14:09:36clyybberAraq, PMunch: Ok this one is definitely a bug: http://ix.io/1WTY
14:09:45clyybberSpits out an internal error
14:10:18FromGitter<alehander42> i didnt know this syntax exist
14:10:47PMunchYes, that is an error. But it's probably caused by you not specifying `n` for your tile.
14:10:57PMunchclyybber, if you change them to Tile[Tiles](a: [Air: 1, Land: 0, Water: 0, Wall: 0], collapsed: false) it works fine
14:11:12*nif_ quit (Client Quit)
14:11:21*nif joined #nim
14:11:33AraqCadey, ah, hmm, well it was written for Nimble and it shows
14:11:41clyybberPMunch: Shouldn't the type inference be smart enough?
14:11:42Araqhowever I can offer you a hack
14:12:08PMunchclyybber, yes, and it should also make tea
14:12:17PMunchOh shit, I've gotta run!
14:12:19*PMunch quit (Remote host closed the connection)
14:12:49CadeyAraq: i'm half considering just pr-ing a function to the distros module that returns either a copy of the seq[string] or allows you to run your own function on the contents of it
14:12:51AraqCadey, 'include distros' instead of 'import distros' and then you have access to the internals
14:13:02Cadeyi love and hate that
14:13:05Araq:D
14:13:21Cadeynim amazes me daily
14:14:07Araqand watch out that you include it only once
14:14:16*BigEpsilon joined #nim
14:14:18Araqto prevent duplicated symbols and code bloat
14:14:51FromGitter<alehander42> clybber, thats where its hard for coffeescript
14:14:53FromGitter<alehander42> making tea
14:14:59FromDiscord<Shield> we need a page for cool things nim can do but aren't obvious
14:16:45clyybberalehander42: lol
14:16:59FromDiscord<DeltaPHC> `concept` seems pretty cool and underutilized. Though maybe for good reason :P
14:17:06Yardanico@Shield you mean manual :P
14:17:23clyybberDeltaPHC: It can make your compile times boom exponentially :D
14:18:02Cadeyi've had great luck with concepts as used in an astar package
14:21:17*matlock joined #nim
14:21:41*zyklon joined #nim
14:23:30FromDiscord<Kiloneie> i think i know what you guys were talking about my video's sound quality, i think you guys are hearing the freaking creek like 20 meters away from my window
14:24:19sealmovehow to specify type for a seq literal like `@[1, 2, 3]`. For example if I want it to be of type seq[byte]. is casting the only option?
14:25:20FromDiscord<Shield> did you remove the noise and such? i've found that even my phone using discord noise cancellation will net a really clear voice
14:25:29*uvegbot quit (Ping timeout: 250 seconds)
14:25:41FromDiscord<Shield> my pc headphone doesn't even come close to that
14:26:35leorizeKiloneie: try listening via a common audio source (ie. your phone)
14:27:02Yardanicosealmove: let a = @[1.byte, 2, 3]
14:27:43FromDiscord<Kiloneie> on my computer i hear a watery sound, which is the creek, i will check via phone now
14:28:06sealmovemm I see, but it won't work in my case, the items are generated, so I can't touch them.
14:28:24Yardanicosealmove: let a = @[myitem.byte, myitem2, myitem3]
14:28:28Araqgenerate 1'u8 literals then
14:28:36AraqnkUInt8Lit iirc
14:33:45leorizein the aftermath of Nim 1.0 release, nim.nvim gains... 1 star :P guess there aren't many people that uses neovim
14:33:45FromDiscord<Kiloneie> on my phone i hear a slight coil whine like sound which is my computer, and yes the intro to setup sounds weird, because the distance where i am speaking is a bit different, which will remain trough out the tutorials to what it was after the intro, i can't fix that one without a mic arm. the noise in the background i think i can, i will up the noise supressor, and try to noise gate some more, i played around with compressor like some tutor
14:34:40sealmovewanted to avoid this, since the code is more generic (works for types over than numbers), without having to take cases, but I guess this is the proper way..
14:34:50sealmoveother than*
14:35:35FromDiscord<Kiloneie> the weird noise is mostly in the after the intro part, when there are parts where i don't talk, then that wobbly watery sound kicks in a bit
14:38:10CadeyAraq: on stable: ... /home/cadey/.choosenim/toolchains/nim-1.0.0/lib/pure/distros.nim(144, 54) Error: cannot evaluate at compile time: unameRes
14:38:39Araqmeh
14:38:53Cadeyhttp://ix.io/1WUh
14:39:32Araq'if' not 'when'
14:39:48shashlicki keep getting this - oserr.nim(94) raiseOSError
14:39:48shashlickError: unhandled exception: The filename, directory name, or volume label syntax is incorrect.
14:39:51shashlickany ideas
14:40:23leorizedid you trip on any windows-reserved names?
14:40:45FromDiscord<Shield> Araq is there a clear distinction of what's inlined and what's computed at compile time for templates?
14:41:04leorizetemplates don't do compile time computation...
14:41:11FromDiscord<Mamy> templates are inlined
14:42:21FromDiscord<Shield> the template parameters certainly turn into a constant when you recurse
14:42:30Cadeychanging when to if gives me different errors
14:42:39leorize@Shield no
14:42:40Cadeybut
14:42:44Cadeyoutside of the file i'm working on
14:42:54leorizetemplate parameters are AST trees slotted directly into the template body
14:48:13FromDiscord<Shield> is there a way to dump a template code?
14:48:40FromDiscord<Shield> i just look at the generated c code
14:49:06Araqthere is only --expandMacro:foo
14:49:18Araqput your template in a macro, maybe lol
14:50:00FromDiscord<Mamy> you can use getAst too I think
14:50:19leorizeecho getAst template()
14:50:54Araqoh, never tried that
14:51:20Yardanicolol
14:51:46Yardanicobtw, I just found a compiler crash with getAst + const, should I report it?
14:51:58leorizeyes :P
14:52:09FromGitter<alehander42> i wonder if anybody tried
14:52:12FromGitter<alehander42> to fuzz the compiler
14:52:15FromGitter<alehander42> for similar crashes
14:52:44leorizellvm has a fuzzer I think
14:53:37Araqalehander42: there was a tool but I never tried it because we have plenty of real bugs, discovered by real users who maybe appreciate bugfixes
14:55:06FromDiscord<Shield> i get 'Error: request to generate code for .compileTime proc: $'
14:55:16FromGitter<alehander42> Araq, was it nim specific?
14:55:20Araqyes
14:55:33FromGitter<alehander42> interesting, do you have a name/link
14:55:50FromDiscord<Shield> because i'm using echo to see the parameters
14:55:59owl_000https://www.youtube.com/watch?v=zb3Sqs7lNJo gem [add in nim archive]
14:56:04leorize@Shield: put it in a static block
14:56:19FromGitter<alehander42> https://github.com/nim-lang/Nim/wiki/Fuzzing-your-nim-code-to-rabbit-out-all-the-hard-bugs ?
14:56:28FromDiscord<Mamy> are you holding your mic like a rapper? :p
14:57:07Araqleave me alone, I'm shy
14:57:16Araqnever watch my own videos :P
14:57:58Yardanicoi like programming videos where you can hear a person typing and maybe his comments
14:58:10FromDiscord<Kiloneie> wait what
14:58:21Yardanicolike https://www.youtube.com/watch?v=JO0iqGDgFqA
14:58:26FromDiscord<Kiloneie> i literarlly went to get a different keyboard because my keyboard is loud as fuck
14:58:33FromDiscord<Shield> using static i get 'Error: Invalid node kind nnkStmtList for macros.`$`'
14:58:35Yardanicowell I'm not a majority
14:58:41*hades__ joined #nim
14:58:44ZevvWhat is with the @ signs in my nimcache?
14:58:50FromDiscord<Kiloneie> mine is like slamming on the keyboard
14:59:02FromDiscord<Kiloneie> mechanical keyboards D:
14:59:10FromDiscord<Shield> i like loud mechanical keyboards too
14:59:19CadeyAraq: i have to have other people edit my own videos because i can't stand the sound of my recorded voice
14:59:53Yardanico@Kiloneie I have a cheap mechanical keyboard which has "Outemo Blue" switches, they're also loud but typing is really satisfying
15:00:03FromGitter<awr1> if the compiler becomes significantly more stable in a few years fuzzing could be desirable
15:00:43owl_000now nim version is 1, it started like that way, wow, that video is a history. great araq
15:01:11FromDiscord<Mamy> a stable compiler is a dead compiler :p
15:02:08FromGitter<alehander42> @awr1 agree
15:02:27FromGitter<alehander42> mamy how is discord
15:02:31FromGitter<alehander42> isn't it very meme-y
15:03:18FromGitter<awr1> how do you mean meme-y
15:03:37FromGitter<awr1> like in terms of community or UI?
15:03:46FromGitter<alehander42> like, i feel the community is more
15:03:48FromGitter<alehander42> like that
15:03:58FromGitter<alehander42> but i remembered the prog lang discord seems serious
15:04:03FromGitter<alehander42> so probably not like telegram
15:04:20FromDiscord<Shield> lol
15:05:08FromGitter<awr1> generally when most people talk shop it moves away from memes and similar bullshit
15:06:00FromGitter<awr1> but like a comet that comes around periodically, so too does that sort of stuff come back every so often
15:06:06FromDiscord<Mamy> I'm only on serious discord communities, nee more nim-offtopic :p
15:06:16FromDiscord<Mamy> need*
15:06:21lqdev[m]huh, that's really strange https://play.nim-lang.org/#ix=1WUC
15:06:23lqdev[m]I'll report this
15:06:34FromDiscord<Kiloneie> okay i will keep the keyboard then, i don't wanna use a different keyboard if quite a few of the audience actually likes that lol
15:06:49FromDiscord<Yardanico> @Mamy I made you a moderator on Discord just in case 😄
15:06:55FromDiscord<Mamy> @lqdev, Positive is >= 1
15:07:14lqdev[m]right, so what? this should work
15:07:29FromDiscord<Mamy> U is initialized to 0 by default
15:07:30FromDiscord<Kiloneie> also iwas about to start YouTube like 8 years ago, making Game maker games, the moment i heard my voice, i was No NO NO, DONE, and it was over till my friend convinced me half a year ago that since i got REALLY good at gaming, i should make videos
15:07:36*owl_000 quit (Ping timeout: 265 seconds)
15:07:36lqdev[m]oh gosh
15:07:43lqdev[m]that's pretty weird
15:07:48FromDiscord<Kiloneie> nobody likes their voice( i do like it a ton more now though)
15:08:00FromGitter<awr1> @lqdev[m] that is interesting
15:08:06narimiranlqdev[m]: will `Natural` work?
15:08:10FromDiscord<Mamy> yes
15:08:13lqdev[m]it should, let me try
15:08:14FromGitter<awr1> why does it not compile without `FloatGen`
15:08:22FromGitter<alehander42> i also feel strange about my voice on audio
15:08:27FromGitter<alehander42> but this is usually an illusion
15:08:47FromDiscord<Shield> expandMacros helps expanding the template but it only works on one level
15:08:48Araqyay playground is on version 1.0.0
15:08:50lqdev[m]nope, https://play.nim-lang.org/#ix=1WUE
15:08:55lqdev[m]Natural doesn't help
15:09:23FromDiscord<Mamy> seems like a compiler bug
15:09:24Araqresult.a = [] is invalid
15:09:32FromGitter<alehander42> Araq, when the spec for not nil is ready, i can try to do some work on the impl, if you guys need contributors
15:09:43Araqalways
15:09:45lqdev[m]int does the same thing
15:09:55lqdev[m]Araq: how so?
15:10:00Araqlook arrays have a fixed size, like [0, 0]
15:10:11FromDiscord<Mamy> you don't need the [] line
15:10:17lqdev[m]aah, that makes sense
15:10:32Araqalehander42: where to find the spec?
15:10:33lqdev[m]that array should be initialized to zeroes anyways
15:10:39FromDiscord<Shield> how to recurse expand templates?
15:10:41lqdev[m]and it doesn't matter in a ring buffer
15:10:51FromDiscord<Shield> expand recused templates*
15:10:52lqdev[m]but still, that doesn't explain the bad compiler error message
15:11:06Araqsure, that's a bug. a regression, in fact, I think
15:11:09*owl_000 joined #nim
15:11:12Araqyay new bugs
15:11:15Araqmore bugs
15:11:44disruptekthe b-word is fair game today.
15:11:47FromGitter<alehander42> Araq well, you said you want to write a spec for the `not nil` refs first
15:12:00FromGitter<alehander42> at least iirc
15:12:17lqdev[m]I'll report the bug on github
15:12:18disruptekthere's no way to `unexport` a symbol, right?
15:12:32AraqI misread
15:12:40AraqI read "the spec ... is ready"
15:12:42Araq:P
15:12:48Yardanicodisruptek: well, you can import everything from the module except something
15:13:08Yardanicobut I don't think there's a way to unexport an already imported symbol once you're past the import stage
15:13:15Araqyou can also do 'from x import nil'
15:13:33disruptekyeah, i'm trying to allow the user to unexport something in generated code; best i can do is macro the removal of the `*`.
15:14:14FromGitter<alehander42> Araq well, I know the spec is important :P but i feel like most of it should be relatively clear by now
15:14:29Araqnot good enough, write it
15:15:25leorize@Shield try macros.expandMacros
15:18:05*owl_000 quit (Ping timeout: 268 seconds)
15:19:07FromGitter<alehander42> i can write it
15:19:28FromDiscord<Shield> i'm using it, having trouble to expand correctly, the template calls itself and expandMacros only expands one level
15:20:52*Trustable joined #nim
15:21:17*BigEpsilon quit (Ping timeout: 245 seconds)
15:23:36leorizethe template calls itself?
15:23:51leorizeshouldn't that results in infinite expansion?
15:24:01leorizeor does the template have some mechanism to prevent that?
15:24:38FromDiscord<Shield> yeah i'm using when to break out, the template has a counter
15:24:59FromDiscord<Shield> it's basically unroll n times
15:25:22leorizetry this: --expandMacro:expandMacros
15:25:24Araqsounds to me you want to write a macro instead
15:26:14leorizefrom PMunch's demonstration of his `with` rewrite, it seems like that switch will expand indefinitely
15:29:50*gour quit (Ping timeout: 265 seconds)
15:31:19FromDiscord<Shield> i think an easy why to expand templates recursively will be helpful, expandMacros kinda works
15:31:46Araqdon't write recursive templates, write a macro instead
15:31:58*gour joined #nim
15:32:04AraqNim is not some shitty FP language where you need to fake iteration with recursion
15:32:30FromGitter<zetashift> oh damn Araq bringing the heat to FP languages
15:32:46FromDiscord<Shield> actually never mind, expandMacros does work recursively, i forgot to change the parameter
15:34:47clyybberAraq: Is there a spec of how signature matching works? I remember seeing it but cant find it anymore
15:35:10FromDiscord<Mamy> I have a bug where I detail that @clyybber
15:35:44FromDiscord<Mamy> see: https://github.com/nim-lang/Nim/issues/11142#issuecomment-487776827
15:36:19Araqclyybber, overloading resolution?
15:37:10FromDiscord<Mamy> you can change the traceTypeRel constant to true for debugging
15:37:25FromGitter<zetashift> A lot of questions about Nim being asked here without answer: https://www.reddit.com/r/rust/comments/d8ygfm/nim_programming_language_10/
15:37:42Araqnarimiran, ^ answer
15:38:35FromGitter<zetashift> `borrowed too many Pascal features without stopping to think about whether they were a good idea` was this ever true?
15:38:46Araqno.
15:38:50narimirandepends on who you ask, i guess :)
15:38:59clyybberAraq: Yeah
15:39:05Araqit's bullshit
15:39:09clyybbermratsim: Thanks
15:40:11clyybberAraq: Ah, sry found it. But yeah it was overloading resolution
15:42:22clyybberAraq: Is that algorithm from the spec in the implementation still, or has the implementation diverged too far to pinpoint where it is exactly?
15:42:46FromGitter<awr1> again this is the issue of hearing about the language secondhand contradicts actually using the language
15:45:13Araqwhat does he know about Pascal anyway, ':=' vs '=' not copied, 'function' vs 'procedure' not copied, operator precedence not copied, silly {$IO+} switch not copied, "strings start at index 1" not copied, "const required in parameters for speed" not copied
15:45:47Araq'class' not copied
15:45:47FromGitter<awr1> "oh i've been using nim for a month and here are my concerns" is obviously a stronger critique than "i heard from some cool guy on HN 5 years ago that you had to import a module to get unsigned ints and that seems like the worst idea, of all time"
15:45:49*theelous3 joined #nim
15:48:16FromDiscord<Shield> good thing Nim doesn't use ':='
15:48:36FromDiscord<Shield> it looks ugly, part of the reason i never bothered with Go
15:49:51*hades__ quit (Quit: leaving)
15:50:08FromGitter<zetashift> @awr1 it's why I linked the thread, a lot of comments seemed to be giving off a wrong image. Hoping more experienced people here could chime in and clarify
15:50:17*hades joined #nim
15:50:29FromDiscord<Kiloneie> the less symbols all over the place, the less typing, quicker reading and understanding
15:50:40*hades is now known as Guest96751
15:51:29narimiran"It was pointed out previously that it is possible to create UB (undefined behaviour) in Nim, because it translates directly to C which has UB everywhere. Nim didn't (at that time) protect from C's UB."
15:51:39narimiranAraq: opinion about ^ ?
15:52:06narimiran(hopefully one i can copy-paste there, not the one with swearing :P :D )
15:52:20Araqwe still lack the NULL/nil protection but it's being worked on
15:52:40Araqwhich doesn't come up all that often
15:52:53FromDiscord<Kiloneie> everyone compares Nim with D and Rust, i can't look at D <.<... bloody c family syntax
15:53:05Araqand there are C compiler switches to mitigate
15:53:44rayman22201People hear about the "result" variable and have Pascal anxiety all of a sudden. I don't understand... I also love that feature. But what do I know
15:53:58*LargeEpsilon joined #nim
15:54:05AraqEiffel also has 'result'
15:54:11Araqand so does Go iirc
15:54:13leorizepeople argue that it's redundant
15:54:17Araqbut in Go you can choose the name
15:54:17FromDiscord<Kiloneie> i don't get why they hate it, they DON'T have to use it
15:54:23FromDiscord<Kiloneie> it's there, and optional
15:54:50leorizeall of them be like: "but you can just `var result =`" like C does it
15:54:50FromDiscord<Kiloneie> it makes things a bit quicker to write, i don't get the hate
15:54:51rayman22201It's the argument that "there should only be one way to do something"
15:55:15leorizeand "less is better"
15:55:28FromDiscord<Mamy> var result is a recipe for strange shadowing disasters
15:55:31FromDiscord<Kiloneie> honestly if everything is well done, having multiple ways of doing it is a good thing, as long as best practices are upheld
15:55:58AraqMamy: the compiler warns about shadowing 'result'
15:56:05FromDiscord<Kiloneie> in Game Maker everyone freaking used their own style and people produced literal walls of text, i ain't even kidding, completely unreadable
15:56:16leorizeeh, people were paranoid about Nim's style-insensitivity because they thought the world will use it the the worst way possible
15:57:11lqdev[m]I think I'm gonna simplify that ring buffer to a classic static-size array with some utility functions
15:57:14*clyybber quit (Quit: WeeChat 2.6)
15:57:15*MrAxilus left #nim ("User left")
15:57:22FromDiscord<Mamy> 10 years ago that might have been true to be fair. But 20 years ago, plenty of development was done in silos with strange coding conventions if the language permitted them
15:57:41FromDiscord<Kiloneie> Yep
15:57:52AraqC has 3 ways to increment 'i' by 1
15:57:52FromDiscord<Kiloneie> check out CNC programming of old, LOL, shoot me
15:57:56Araqactually 4.
15:58:08Araqi++; ++i; i += 1; i = i + 1
15:58:10FromDiscord<Shield> style insensivity is the best thing that ever happened
15:58:27leorizerust itself have 3 ways to return a value
15:58:27Araqnobody gives a fuck about it, it's C
15:58:49FromDiscord<Kiloneie> everyone uses different naming convention, so if they wanna go crazy with it, let them ... i think
16:00:15FromDiscord<Shield> i see that a lot of hate come from people who only like C style languages
16:00:15rayman22201@narimiran: I would ask the guy specifically what UB he cares about? C has a lot of UB lol. It's a big topic...
16:00:33*navin_ joined #nim
16:00:53Araqhe doesn't care about it, it's just another "cool, I don't have to check it out, saved my time"
16:01:19rayman22201Yeah. Seems like a troll question.
16:01:44leorizehttps://old.reddit.com/r/rust/comments/d8ygfm/nim_programming_language_10/f1dor7k/
16:01:50leorize^ anyone wanna argue about that?
16:04:15*navin quit (Ping timeout: 264 seconds)
16:06:40sealmove"only 1 way of doing things" is an important choice for the language. It has to do with consistency vs flexibility tradeoff.
16:06:52FromGitter<zetashift> wow comparing goto to an implicit result variable
16:07:03FromGitter<mratsim> Gnome vs KDE
16:07:23leorizegnone vs kde still makes sense :P
16:07:23FromGitter<mratsim> Mac vs Linux
16:07:27solitudesfkde
16:07:33Yardanicokde
16:07:38lqdev[m]gnome
16:07:42leorizei3
16:07:49lqdev[m]pantheon
16:07:53Yardanicowell I use i3 as well, but IMO KDE > GNOME :P
16:08:21leorizekde scored too low on the 'default styling' for me
16:08:33YardanicoI'm having an argument with Juan right now in Telegram, so basically, will .nims eventually fully replace .cfg? And also, is it a good thing to define some big constant strings in .cfg instead of creating a new file which would export these constant strings or just defining them in the modules that need it?
16:08:39Yardanicowe're arguing about .nims vs .cfg
16:08:50lqdev[m]kde scores too low on the aesthetics part for me, it's UI design is really cluttered
16:09:08leorizethey're going to fix that iirc
16:09:18leorizei'm interested in their efforts
16:09:20Araqthere are always multiple ways to accomplish the same, even Python has 'lambda' though it could do without
16:09:49leorizesealmove: for certain places
16:10:04leorizenot everything should have only one way of doing things
16:10:05Araqit's just a marketing gag, no substance to the claim
16:10:35narimiranxfce >> kde and gnome
16:10:36sealmovebut for example Go is stupid on purpose so that everyone has to write code in same way. it's definitely a sacrifice of power for the sake of forcing consistency.
16:10:44leorizethere should be reasonable ways to do things, rather than only one way
16:10:50narimiran"i use i3, btw"
16:11:05federico3sealmove: while being inconsistent with itself
16:11:18Araqthe way I structure my code, how I break it up into functions is not enforced by Go.
16:11:59Araqand Go has 'var x = 0' vs 'x := 0' or something like that
16:12:00sealmoveobviously you can't enforce everything, but some languages try to enforce as much as possible and leave as little style choices to programmer as possible.
16:12:12Araqyeah but then even Go doesn't, see :=
16:12:43Yardanicothings I like in Nim the most are actually indentation-based syntax without using parenthesis when you can live without them (e.g. in an if expression or a while loop), and UFCS
16:12:54sealmovethat's true, I find this weird, why they have both `var x = 0` and `x := 0`
16:13:15leorizeturns out that typing less is actually a feature
16:13:23Cadeysealmove: := works on multiple returns
16:13:29Cadeyfoo, err := bar()
16:13:36sealmoveoh right, that's why
16:13:42sealmoveforgot
16:13:48Yardanicoleorize: yes and I like it a lot
16:13:52Araqthey also have both 'break' and 'goto' iirc
16:13:55asymptoticallyleorize: i learned that after coming from java, with IAbstractBeanFactoryTestTestImplTestFactories. its very refreshing :)
16:14:15CadeyAraq: goto is actually useful in some edge cases, it just requires a certain level of insanity
16:14:27Araqnot the point, I don't mind 'goto'.
16:14:33leorizesome day I'll have to learn java just to understand all the memes
16:14:34Araqbut if you have it, you can remove 'break'
16:14:38YardanicoI tried Zig for a bit, but it's still very incomplete (you need to look in source for stdlib to find functions you need), and you need to type much more than you do in Nim
16:15:03sealmoveI love the break _with label_ feature nim has, it's something like goto but saner and covers most cases you would want to use a goto
16:15:56leorizeI consider Zig to be a low-level system language
16:16:20leorizeit appears to have removed general types like `int`, `float` and settled on explicitly specifying the size
16:16:21Cadeyzig is C
16:16:25disrupteki struggled with UFCS style for the longest. my current style is to use whatever reads easiest, and name symbols according to what will be most readable. but, point remains that finding the right balance in UFCS was the biggest struggle i had with the "look" i wanted.
16:16:43narimirandisruptek: how so?
16:17:25FromDiscord<Shield> i didn't understand what zig is trying to solve, you don't type less than C
16:17:30narimirani changed my ufcs style over the years, but calling it "the biggest struggle" is another league.... :)
16:17:47leorizezig is trying to be a safer C I think
16:18:05disruptekwhat can i say? i haven't changed much of my other initial syntax decisions. except maybe for the for loops.
16:18:07Cadeyit'd be interesting to see a zig backend for nim
16:18:35disruptekbut path.encoded or encodePath(path) ... that changed.
16:18:48Araqit'd be a futile excercise accomplishing nothing whatsoever, Cadey
16:18:57leorizesince `path` is a string, I use `encodePath()` :p
16:19:06CadeyAraq: zig has a webassembly backend tho
16:19:08Araqwe already have NLVM, Nim targeting LLVM directly
16:19:13Cadeyah
16:19:21disruptekthe llvm backend is the future, i hope.
16:19:43leorizellvm does bring some nice stuff, but I doubt it would be a major step
16:19:51Araqdisruptek, if history is a guide, there is no chance we'll compile to C for forever
16:20:08Yardanicothere were some plans to change default backend to C++ some time ago, are they still here?
16:20:13AraqC++ started as a translator to C too, as did Objective C
16:20:34leorizeeven haskell started off by translating to C
16:20:45leorizeor at least GHC
16:20:51Araqinteresting
16:21:09Cadey(part of the GHC bootstrap process still involves compiling a C version of GHC and using that to compile the haskell one, then the haskell one to compile itself again)
16:21:12disruptekit'd be a big step for me because then i could finish my graal/klee ecosystem effort.
16:21:36leorizeklee has a problem of being too slow for practical usage though
16:22:04leorizealso you can already compile to llvm by going through clang
16:22:04disruptekwhat a strange thing to say.
16:22:31Araqa klee, yeah, well, tried NLVM with it?
16:22:53disruptekyeah.
16:22:53sealmovewhat's the idiomatic Nim way to have an optional object field. add a corresponding flag field, use `Option`, or something else?
16:23:05leorizedisruptek: https://stackoverflow.com/questions/5742618/limits-of-klee-the-llvm-program-analysis-tool
16:23:32disruptekleorize: what's your point?
16:23:43leorizethat klee is not really scalable :(
16:23:53disruptekyou don't have the resources to devote 89hrs of computer time to debuging your code?
16:24:34disruptekanyway, don't use it if you don't like it. do you want to argue about the merits of graal instead?
16:24:51Cadeysealmove: how optional is it?
16:25:12FromGitter<awr1> i'm team GNOME
16:25:41FromDiscord<treeform> sealmovie, "Nim way to have an optional object field" I think that's cbject variants. https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
16:25:47sealmoveCadey: it's initially empty, later gets filled-in always (so not exactly optional). but need to have a way to know if it's filled-in yet.
16:25:49lqdev[m]GAAH https://termbin.com/4rmf
16:25:51FromDiscord<treeform> sealmovie, "Nim way to have an optional object field" I think that's object variants. https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
16:25:51leorizedisruptek: i won't, but I wonder if there's any faster alternative out there
16:26:00lqdev[m]it doesn't work even though I removed all the gc code from here
16:26:01Cadeysealmove: i'd say option then
16:26:03solitudesfsealmove, option
16:26:22sealmovety
16:26:30FromGitter<awr1> you can use object variants with bools btw if you dont want to use enums
16:26:30Cadeythere, now you have consensus!
16:26:44Cadeyawr1: options are safer in this case
16:26:44disruptekit's often possible to write tests of code that are smaller than the applications in which they enter production.
16:26:48FromDiscord<treeform> yeah for 1 thing I agree option is better. But if you have many fields object variants are better.
16:27:29disruptekbugs found outside production which nonetheless emerge during production workloads are no less valuable than those found in production.
16:28:08lqdev[m]ah I see, it crashes on raiseIndexError2
16:28:54disruptekthey just cost less.
16:29:32disruptekleorize: https://github.com/mre/awesome-static-analysis
16:32:34leorizenice
16:32:57*MrAxilus joined #nim
16:33:19leorizeeven crystal have a static analyzer :P we need one for Nim
16:33:51disruptekthere are already efforts to do this in the compiler.
16:33:57lqdev[m]oh god, look at the amount of analyzers for PHP
16:34:08lqdev[m]I guess people are sick of bugs in this piece of crap
16:34:22*MrAxilus left #nim ("Kicked by @appservice-irc:matrix.org : issued !quit command")
16:34:26FromDiscord<Mamy> = vs == vs ===
16:34:33leorizeyou can always use the php backend of Nim
16:34:36lqdev[m]ooooh yesss
16:34:36leorizeoh wait that one is removed
16:34:41lqdev[m]haha
16:36:03FromDiscord<Mamy> it was removed in may and it's self contained (in jsgen.nim :D)
16:36:15FromDiscord<treeform> i wonder who removed it and why...
16:36:22FromDiscord<Mamy> it was Araq
16:36:40FromDiscord<Mamy> no tests? And a silly when defined(php) 😛
16:37:13livcdbtw is not -d:danger still a bit of a problem ?
16:38:00FromGitter<awr1> somehow i have been spared of the need to write anything in PHP
16:38:09FromGitter<awr1> but if it's anything like perl i can only imagine
16:38:39federico3no, they are very different
16:38:54FromGitter<awr1> ah, ok
16:39:29FromGitter<awr1> perl for me is probably the worst "real-world" language i've ever used
16:40:15leorize[m]!eval echo float64 high uint64
16:40:18NimBot-1.0
16:40:59leorize[m]is that a bug?
16:41:18sealmove!eval echo high uint64
16:41:20NimBot18446744073709551615
16:41:24*asymptotically quit (Remote host closed the connection)
16:41:31FromGitter<awr1> yeah seems to me it's a bug
16:41:31*asymptotically joined #nim
16:41:48disruptekman, i guessed 18446744073709551616. stupid off-by-one error.
16:41:52disrupteki'm an idiot.
16:42:00FromGitter<kaushalmodi> !eval echo float64 high uint32
16:42:03NimBot4294967295.0
16:42:04federico3leorize: what is your use case for a static analyzer?
16:42:07Zevv@clybber, mamy: the inner loop is now completely gone, another 7%. Guess I reached the optimum here!
16:43:36leorizewait until someone brings the big 'ol book of handwritten assembly out :P
16:44:06ZevvOh I got my copies :) "Hackers delight" is one of my favorites :)
16:44:35leorizefederico3: mainly to catch stupid stuff I might have written half asleep
16:44:35ZevvI know most of the the tricks in C, i'm pretty pleased that Nim now optimizes away to the same level
16:44:59leorizewell assembly might be too overkill for now, so... simd?
16:45:01federico3leorize: anything more specific?
16:46:42*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:46:43Zevvsimd will not really help me here - last low hanging fruit would be to try to inject some 'likely' or 'unlikelies', but there is not much control flow left. I have a theory about spawning a thread when reaching a choice operator, and having both threads continue parsing their own part of the tree. Any thread that fails the parsing dies, and the only survivor parsed the string.
16:47:12disruptekZevv: i am working on that idea inside cloud functions.
16:47:22Zevvcloud functions?
16:47:42Zevvis that a proc running on someone elses computer?
16:47:47leorizeusing a threadpool would help mitigate the overhead
16:47:53disrupteki'll have some nim that compiles to aws lambda and when you paralellize something, it runs in the cloud across multiple nodes.
16:48:14ZevvOh dang it is *really* cloud functions. I was joking, I thought :/
16:48:26Zevvwell, but that makes sense indeed
16:48:33leorizefederico3: mostly always true/false expressions
16:48:43livcdbtw is not -d:danger still a bit of a problem ?
16:49:04FromDiscord<Mamy> so did you remove the innerloop via inline assembly? or computed gotos?
16:49:07disruptekit's like your idea in that maybe you only care about the winners.
16:49:18disruptekkinda like quantum computing.
16:49:38FromDiscord<Mamy> likely/unlikely pretty much doesn't do anything anymore, apart from removing cmov 😛
16:49:54ZevvI know, I *never* managed to speed up an algorithm with that
16:49:59leorizelivcd: what do you mean?
16:50:04Zevvbranch predictors are simply smarter then me
16:50:13disrupteki've always said that about you.
16:50:21ZevvI know
16:50:25disruptek`dumber than a branch predictor`.
16:50:27Zevvbut I don't care
16:50:36Zevvbecause I know who's saying that \o/
16:50:37disruptekit's okay; you're much better looking.
16:50:46lqdev[m]dear god i'm fed up with these stupid crashes, I'm trying so hard not to swear the hell out right now
16:50:49disruptek`cuter than a branch predictor`.
16:50:55Zevvlqdev[m]: still your audio thread?
16:51:01lqdev[m]yes
16:51:13*navin_ quit (Remote host closed the connection)
16:51:26lqdev[m]I can't even debug this god damn thing properly because any echo I try to do results in an immediate segmentation fault
16:51:32ZevvYeeah :)
16:51:57lqdev[m]I guess gdb to the rescue
16:52:03Zevvlqdev[m]: been there. Don't rely on *anything* there. The rule is basically: don't do any stdlib calls, and check your generated C code
16:52:22FromDiscord<Shield> aren't they using unlikely to make exceptions cost free?
16:52:24ZevvIn my SDL audio callback I only do a c_memcpy() and an assignment
16:52:41leorize@Shield nah, they use some weird dwarf table magic
16:53:28lqdev[m]Zevv: I set my buffer size to 32768 out of frustration to prevent the crashing at least for a short while and all I can hear is silence.
16:53:32FromDiscord<Shield> btw Zevv how did you optimize the inner loop away? spill the beans
16:53:41leorizelqdev[m]: try importing `printf` then print the stuff out
16:53:51leorizeit will avoid the allocations from the gc
16:53:58leorizewhich might be a problem on its own
16:55:23ZevvShield: well, in the end the c compiler does the hard work. The computed goto is a table with goto offsets which get jumped to, and gcc seems to understand my intentions well enough. The loop instruction pointer is the index into this jump table, and nim generates stuff like "ip = 132; goto _TMP[ip]". Which becomes one jmp
16:55:34lqdev[m]leorize: yeah it seems like that's a problem
16:55:44lqdev[m]it always crashes on some GC-related shit
16:55:54Zevvwhich is has the right to do. You violate the contract
16:56:00Zevvyou suffer
16:56:17AraqsetupForeignThreadGC(), lqdev[m]
16:56:31ZevvHe went there, but came back crying as well
16:56:40*navin joined #nim
16:56:42Zevvif I remember correctly
16:56:53Araquse araq's GC then.
16:57:07shashlicki'm also running into https://github.com/nim-lang/Nim/issues/12242
16:57:08leorizegithub.com/Araq/araqsgc
16:57:17lqdev[m]Araq: I have no control over the startup of that thread
16:57:54leorizejust call it before you do anything in the thread
16:58:11lqdev[m]but anyways, how can I try your GC out?
16:58:14Araqshashlick, working on it...
16:58:21FromDiscord<Shield> interesting, it's always nice when the compiler does most of the work
16:58:30leorizeAraq, shashlick: https://github.com/nim-lang/Nim/pull/12265
16:58:34Araqlqdev[m], hardly, it's WIP and as usual bugfixes take up all our resources
16:58:35shashlick@Araq - there's a patch here - https://github.com/Endeg/Nim/commit/04fb6d649c35db7de5dd2a63564d84c61ed090f9 not sure if it works
16:58:53Araqlqdev[m], I can explain how it works though and you can take over its development
16:58:57Araq:-(
16:59:24FromDiscord<Mamy> @Zevv just beware that we had a stackoverflow issue with computed gotos in Nimbus: https://github.com/status-im/nimbus/blob/7d74d38530881e883c408d55d8213fea31f247a3/nimbus/vm/interpreter_dispatch.nim#L266-L267
16:59:38leorizewe need to clone Araq :P
16:59:45FromDiscord<Mamy> I didn't revisit that (uint256 arithmetic is quite stack space consuming)
16:59:58Zevvmamy: where does the stack go?
17:00:00AraqMamy: stack overflow? as in "compiler crashes"?
17:00:17lqdev[m]Araq: sadly, I have no experience in garbage collectors and advanced memory management
17:00:32Zevvlqdev[m]: you're working on that! :)
17:00:40Zevvin a few days you will be the expert here
17:01:08Araqlqdev[m], it's actually quite simple, the debugging will kill you though
17:01:26ZevvMamy: I don't see how that can happen
17:02:43FromDiscord<DeltaPHC> It's kinda why memory safety is such a concern in modern times
17:02:48FromDiscord<DeltaPHC> among other reasons
17:04:03FromDiscord<Mamy> @Zevv, @Araq, not sure, it was @jangko who removed the computedGoto
17:04:43Araqthat means that it compiles/d
17:04:44FromDiscord<Mamy> it's a runtime one
17:04:57Araqmakes no sense to me but ok
17:05:05FromDiscord<Mamy> I agree 😉
17:05:19Zevvjust put it back in and dont tell him :)
17:05:35FromDiscord<Mamy> but we have a 256-bit VM so maybe that + holding all the opcodes addresses on the stack was too much?
17:05:45Zevvthe're not on the stack
17:05:54lqdev[m]wait, .computedGoto was removed completely?
17:05:59lqdev[m]I wasn't following on the discussion
17:06:02Zevvnon just from their code
17:06:06Zevvthey dont use it anymore
17:06:09lqdev[m]ah fine
17:06:31shashlick@Araq - i checked again, all DLLs are compiling with --gc:boehm but feud still doesn't work
17:06:34Zevvnot sure when I last ran out of stack anyway in lin
17:06:43Zevvlinxu userland. the stack is just extended when needed
17:06:57disruptek1991 for me.
17:07:49lqdev[m]damn it. open jam 2019 is starting on friday and my audio engine doesn't work at all.
17:08:00lqdev[m]what an idiot I am for not working on this earlier.
17:09:23FromDiscord<Shield> what's wrong with it Lqdev[m]?
17:09:27leorizelqdev[m]: have you tried to use printf to debug print?
17:09:48lqdev[m]leorize: ah right, I started but never finished lol
17:10:01lqdev[m]Shield: it doesn't work. no audio, constant segfaults, lots of annoyance.
17:10:16*LargeEpsilon quit (Ping timeout: 240 seconds)
17:11:08Araqlqdev[m], GC_disable() at startup and enable it in strategic places?
17:11:17Araqer, make that GC_disable() in your wild thread
17:12:28FromDiscord<Shield> i was looking for an audio library myself
17:13:07AraqSDL2 ?
17:13:23*Araq actually only knows a single library for everything, SDL2
17:14:04livcdleorize: i thought that the safety vs performance ratio was a problem. That we eventually dont want to use -d:danger
17:14:29lqdev[m]wait, so GC_disable works per thread?
17:14:36FromDiscord<Mamy> yes, compiler is much slower for example
17:14:39Araqyeah, everything does
17:14:42lqdev[m]I thought it's global for all working threads
17:14:56Araqit is not, heaps are tied to threads
17:14:56FromDiscord<Mamy> and on laser -d:danger is 5x slower
17:15:12Araqwhat? you mean 'faster' right?
17:15:23lqdev[m]-d:danger doesn't work with my game, lmao
17:15:35lqdev[m]it crashes immediately after startup
17:15:44lqdev[m]without it, everything just works
17:16:01Araqyou should definitely use valgrind. now.
17:16:04FromDiscord<Shield> so far i found one of those one header sound library, SDL2, SFML bindings, Fmod
17:16:15leorizeAraq: they're on windows
17:16:22leorizeit's soundio iirc
17:16:23FromDiscord<Shield> but i might do bindings for Sunvox
17:16:37FromDiscord<Shield> because i want to have some effects and disable channels and such
17:16:39shashlickSoloud
17:16:44Araqrun a Linux VM
17:16:54AraqI do too. sometimes.
17:17:50FromDiscord<Shield> why is synchronizing code with sound is so hard
17:19:15FromDiscord<Mamy> time is hard
17:20:43lqdev[m]leorize: I'm not on windows anymore. thankfully
17:23:53*shomodj joined #nim
17:30:05lqdev[m]printf works, I suppose
17:30:09lqdev[m]it doesn't crash
17:30:25lqdev[m]also, I went ahead and added GC_disable as Araq suggested
17:30:35FromDiscord<treeform> printf works but echo does not? I had this issue with iOS and Android.
17:30:55FromDiscord<treeform> I needed to call NimMain manually to setup the GC and objects. because iOS and Android have their own mains.
17:34:25*navin quit (Remote host closed the connection)
17:34:56*navin joined #nim
17:39:07*navin quit (Remote host closed the connection)
17:39:24*navin joined #nim
17:39:38*navin quit (Remote host closed the connection)
17:46:11planetis[m]hi all, check out the new zip macro: https://gist.github.com/b3liever/caf536f34b5791afbc61a5d75e0de405
17:46:57solitudesfcan this be in sequtils?
17:47:08shashlickWhat package can I use to build a rest API
17:47:20disruptekthe openapi one you made me write.
17:47:21*matlock quit (Read error: Connection reset by peer)
17:47:29lqdev[m]can anyone explain to me why `system.cpuRelax` exists/how is it used?
17:47:57Cadeyshashlick: i'd suggest either jester or rozencrantz, i'm working on a blogpost i'm calling "Jester: The Missing Manual" atm
17:49:09*neceve quit (Ping timeout: 252 seconds)
17:50:18*narimiran quit (Remote host closed the connection)
17:50:40Yardanicoshashlick: I think jester is quite good for a REST API
17:50:58Cadeyi should really write up that jester the missing manual guide
17:51:01Cadeyugh
17:51:05Cadeyi'll do that after work
17:51:49planetis[m]sure, will make a PR, once there are no bugs left. Could use someone to test it.
17:52:04shashlickCool
17:52:28shashlick@disruptek - that's a client, and great work by the way!
17:52:37shashlickI need something lightweight
17:52:45shashlickI'll check both out
17:52:48Cadeywhat does "lightweight" mean?
17:53:00Cadeythat word is notoriously meaningless in programming terms
17:53:02disruptekso add the server portion for me.
17:54:17shashlickWell basically I'm looking at converting my plug-in system to communicate over rest
17:54:29FromDiscord<exelotl> @Shield oh! I did sunvox bindings, but never published them
17:54:30disruptekfor feud?
17:54:39shashlickYes
17:54:43FromDiscord<exelotl> I'll share when I get home
17:54:52shashlickWill allow communicating with remote machines for free
17:54:53disruptekwhy not use something more local, like dbus?
17:55:15Cadeydbus is okay if you are using only linux
17:55:15shashlickRemote editing
17:56:01disruptekremote editing could be amazing if it was really don't write.
17:56:05disruptekright, too.
17:56:06shashlickI need Windows
17:56:10disruptekreally done, too.
17:56:18disrupteki really shouldn't write.
17:56:21Cadeywords is hard
17:57:01shashlickWhat's the best way to communicate then - I don't like the idea of inventing an api
17:57:02*SodaScripter joined #nim
17:57:05disruptekwell, write it in openapi. you can use the generator that hideki wrote.
17:57:12disruptekthough, it's written in java iirc.
17:57:38shashlickI just want various components of my app to talk to each other
17:58:17disruptekhard to beat something rest-like for portability. treeform has a websockets impl you can use for transport.
17:58:29shashlickEach plug-in will offer a subset of functionality
17:58:35shashlickAnd will need to talk to other plugins
17:58:47shashlickIn my case, even the GUI is a plug-in
17:59:18shashlickCan I use web sockets with rest
17:59:23shashlickJester
17:59:32disruptekyes, though it's kinda early days there.
17:59:53shashlickI don't want to do any bleeding edge stuff anymore
17:59:53Cadeyi need to do some experimentation on that front
18:00:02shashlickHave thrown out enough code
18:00:17disruptekwell, contribute your fixes and they won't be thrown out.
18:00:25shashlickI have an nng wrapper which works well
18:00:32disruptekshashlick: you really outta try contributing more. 😉
18:00:52shashlickI've thought about it, but lack the brain cells
18:01:32zedeuswhat about something like zeromq?
18:01:51disruptekthe only thing i'd be worried about with ws is the client keep-alive stuff, but it shouldn't be hard for you to write a quick poc to see how robust it is.
18:02:37disruptekzmq is pretty great, but it could create a needless barrier of entry for ad hoc clients.
18:02:39*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:03:03lqdev[m]could someone test if there's any audio output from tests/taudio? https://github.com/liquid600pgm/rapid
18:03:35FromGitter<alehander42> Araq, an early draft
18:03:46FromGitter<alehander42> https://github.com/alehander42/Nim/commit/ad21855a7b63235019a120a979a8f59537400933
18:03:46lqdev[m]I get silence and pavucontrol doesn't list my device. No idea why. soundio reports zero errors along the way.
18:04:13lqdev[m]s/device/application
18:04:58Araqalehander42: nice, but make it a document of its own please
18:05:18FromDiscord<Shield> @exelotl that would be very nice of you, make it public too, i like sunvox gui too, too bad the dev didn't share that, will build something similar
18:05:18Araqspec, impl, fixed spec --> manual entry is the order
18:06:36shashlickIf anything I'll use nng, no need for zeromq
18:06:48shashlickBut will look into jester as well
18:07:27shashlickAnyway I'm not going to get tricked into debugging gc's!
18:07:47Cadeyi've been working on a STOMP library i rescued from bitbucket
18:09:35FromGitter<alehander42> Araq, ahok
18:09:52*NimBot joined #nim
18:11:20Araq echo nilable.a # OK
18:11:20Araq call() # maybe sets nilable to `nil`?
18:11:20Araq echo nilable.a # warning/error: `nilable` might be nil
18:11:31Araq^ no... call() doesn't affect 'nilable'
18:11:56FromGitter<alehander42> Araq, the document should be still `rst` not markdown?
18:12:05Araqbut you need to be precise about what locations can be used in 'isNil(location)' for deref to be allowed (let vars, local vars)
18:12:19FromGitter<alehander42> hmm, but what happens when nilable is aliased to a global
18:12:36FromGitter<alehander42> ok, this case is not really possible
18:12:40Araqwe have been through this, there is no way to "alias" it through a global
18:12:54Araqit would be a pointer to a pointer then, different
18:13:11FromGitter<alehander42> yes , yes, so only stuff like call(nilable)
18:13:16FromGitter<alehander42> where call takes a `var` ?
18:14:01Araqyes
18:14:14FromGitter<alehander42> i expect that `location` can be a let var, a local var or an arg for now
18:14:32Araqyes
18:19:30FromGitter<alehander42> hmm
18:19:35FromGitter<alehander42> call() can still lead to nil
18:19:49FromGitter<alehander42> if you assign a closure to a global
18:20:04Araqno.
18:20:23FromGitter<alehander42> i wrote a program which does it
18:20:24*thomasross joined #nim
18:20:30disruptekyou're still wrong.
18:20:46FromGitter<alehander42> ix.io/1WW9/nim
18:21:03FromGitter<alehander42> it's very nonsensical
18:21:08FromGitter<alehander42> i admit
18:21:59FromGitter<alehander42> and i guess this is not hard to check for
18:22:04Araqa is not a local, it escapes
18:22:09Araqit's transformed into
18:22:14Araqclosure.a
18:22:39FromGitter<alehander42> ah, so in this moment in the sempass it's a field of this `b`?
18:22:41Araqyou do the check after lambda-lifting
18:22:52Araqand then it simply works (TM)
18:23:12FromGitter<alehander42> ok
18:23:55*whaleman joined #nim
18:25:33FromGitter<alehander42> is the end of `tracProc` in `sempass2.nim` such a place, i remember i saw dfa stuff there before and figured that's where usually cfg stuff runs?
18:26:59Araqthe order might be wrong and the cfg is only done in the backend
18:27:00*whaleman quit (Remote host closed the connection)
18:27:07Araqwe need to watch out
18:27:20*disruptek 👀
18:27:26Araqalso the CFG doesn't track conditions properly for the purpose
18:27:36Araqit needs to be patched
18:27:42Araqalso and more importantly
18:27:45Araqis this allowed:
18:27:49Araqif x == nil: return
18:27:56Araqx[]
18:28:20disruptekyou're gonna make him impl that?
18:28:48Araqdisruptek, I'm trying, but this example is not hard, the CFG does the hard work for this
18:28:55FromGitter<alehander42> yes, i mostly wanted to see listings of the current cfg on small test programs to get a better idea
18:29:04FromGitter<alehander42> but i figured out how to echo them
18:29:26FromGitter<alehander42> well, oh yeah
18:29:35FromGitter<alehander42> i think this should be supported, at least i did in my previous pr
18:30:16disruptekif you make that work, then i will look into fixing try/except and maybe even the case clause.
18:30:55disrupteki thought cfg was further away from readiness, honestly.
18:30:57FromGitter<alehander42> but yeah, i remember try/except was a harder thing to support
18:31:07FromGitter<alehander42> but that's why i wanted to see how this all looks on cfg level
18:31:16FromGitter<alehander42> because it simplifies many of those constructs
18:31:20sealmoveis there a way to make option unpacking automatical when accessing fields? for example if Type1 has a field called x, then if y is of type Option[Type1] you can do y.x instead of get(y).x
18:31:44disruptekdid you look into impl `.`?
18:31:51sealmoveno
18:32:05Araqsealmove, it would defy the purpose of Option[T]
18:32:13disruptekspeaking of hacks, shashlick, did that env hack work?
18:32:22sealmoveI thought about overloading it, but I have no idea how that works
18:32:31FromGitter<alehander42> also i think stuff like if x == nil or y == nil: stuff else: x.a + y.a
18:32:37FromGitter<alehander42> should work
18:33:04sealmoveAraq: I know, but my I want to automate that for some auto-generated tests and still get to use Option
18:33:29Araqalehander42: meh, 'x != nil and y != nil' is good enouhg, 'or' is complex. but that's exactly what the spec should cover
18:34:03*SodaScripter quit (Ping timeout: 245 seconds)
18:34:12FromGitter<alehander42> but i need to know a bit more about the low level repr for that
18:34:25FromGitter<alehander42> e.g. i guess the logical operators are all expressed in a simpler way
18:34:35FromGitter<alehander42> (all of them can be expressed as and + not comb?)
18:35:01sealmoveso `.` is overloadable?
18:35:15FromDiscord<Rika> oh wow only realized the irc bridge is working again
18:35:16FromGitter<alehander42> so basically if the low level repr uses only those, probably we can always say `all high level logical operators are taken into consideration`
18:35:47Araqalehander42: they are mapped to control flow
18:36:15FromGitter<alehander42> but i mean, do we have `or` in the cfg
18:36:26Araqno, we have jumps
18:36:32Araqcontrol flow.
18:36:59FromDiscord<DeltaPHC> I think overloadable `.` is an experimental feature?
18:37:15Araqyes, but it exists
18:38:34sealmoveexperimental is good enough for me
18:39:04disruptekthe stones on this guy...
18:39:22FromDiscord<DeltaPHC> What makes it experimental, out of curiosity? Design not final?
18:39:54Araqit kinda sux
18:40:20Araqfor instance if you write x.y in a template, the template does not bind `.`
18:41:01Araqit's the old "1 letter is fine, 0 letters are from hell" misdesign
18:41:28Araqsee also: implicit items iterators, converters
18:41:54Araqthe `()` operator
18:43:23Araqor the {.this: self.} idea
18:43:39Araqfeatures work better when they work together
18:45:40*daddoo joined #nim
18:49:38*exelotl joined #nim
18:50:04FromDiscord<treeform> wow so many new issues: https://github.com/nim-lang/Nim/issues
18:50:16FromDiscord<treeform> this 1.0 is a flood of people trying things out
18:50:34*SodaScripter joined #nim
18:51:00FromDiscord<Kiloneie> this is why i have to pump out a lot of videos to get them to watch D:
18:51:09FromDiscord<Kiloneie> and it's hard QQ
18:51:33Araqtreeform: that's why you release version 1.0.*0*
18:51:58Araqyou will never find all the bugs on your own, waiting for perfection is silly
18:52:56FromDiscord<Kiloneie> why is it so hard to speak freely, i gotta start streaming one day, my english free talk sucks
18:53:13Cadeyto be fair
18:53:23FromDiscord<Shield> always script your videos
18:53:28Cadeyenglish is about as simple as latin-family gender declensions
18:54:16*laaron joined #nim
18:55:09FromDiscord<Kiloneie> i am scripting them, and then it sucks and im fixing them, and.... blah D:
18:56:05AraqKiloneie: I'm working on a video too, I feel the pain
18:59:28FromGitter<alehander42> Araq, ok, ill just see what the current cfg does
18:59:33FromDiscord<Kiloneie> ^^ i hope i can finish it tonight
19:00:40FromGitter<alehander42> btw i still think we should add to locations fields of local vars/let: because iirc often in existing code people already have stuff like if not a.b.isNil: a.b stuff and making them rewrite it to `let newvar = a.b` would be probably hard
19:01:18FromGitter<alehander42> we can just invalidate those field locations on every call indeed (or maybe not, if we have some logic for "is this local var escaped/visible from outside")
19:01:33FromGitter<alehander42> but not too important
19:01:35Araqtoo hard to prove correct
19:01:37FromGitter<alehander42> to have that
19:01:42Araqintroduces aliasing problems
19:01:54FromGitter<alehander42> well, it seems the same to me with more conservativeness
19:01:55Araqwe want it to be sound
19:02:02FromGitter<alehander42> if the location is used directly after the check
19:02:04FromGitter<alehander42> its' fine
19:02:18FromGitter<alehander42> if not, we can still warn
19:02:36*daddoo quit (Quit: Leaving)
19:02:36FromGitter<alehander42> but this can be added later, if it seems useful
19:02:48FromGitter<alehander42> for enough % of cases
19:03:50FromDiscord<treeform> Araq, yesterday I did some experiments with GC arenas. Where you have like a "whole game arena", "level arena" and "frame arena". You clear the level arena when you switch game levels and clear the frame arena every frame. What are your thoughts on an arena based GC?
19:04:44Araqcovered by our upcoming "allocator API"
19:04:47FromDiscord<treeform> Most GC's frees are per object. Event with manual C style frees it's per object. But with an Arena you can just "clear" the whole thing.
19:05:09AraqI tried it with --gc:regions
19:05:20FromDiscord<treeform> Oh is that still in?
19:05:48Araqkind of, all these ideas are getting combined
19:06:38Araqbut it's the most inflexible way to manage memory than I found
19:06:42Araq*that
19:06:56FromDiscord<Mamy> regions per type would be nice
19:07:07FromDiscord<Mamy> but I think we call that an object pool
19:07:52Araqand I prefer solutions that are fluent, "I need to get shit done. Ok, now let me optimize this..."
19:08:59Araqif you start with your arenas idea, Nim is already there, 'ptr T' is a thing, it's not going away
19:09:25FromDiscord<treeform> Memory arena regions appear to work with tons of usage patterns that are comment - game frames or http requests.
19:09:35FromDiscord<treeform> But I have never programmed with them - so I don't know.
19:09:43FromDiscord<treeform> They could totally sux
19:10:08FromDiscord<treeform> yeah I was using ptr T for my experiments
19:10:20FromDiscord<Kiloneie> the next video will be like 4 minutes long xD... gonna try to make the next one a bit longer
19:10:39FromDiscord<Mamy> short videos are good
19:10:40FromDiscord<Shield> regions is very not flexible, the problem is that you can only work on one region at a time
19:11:01FromDiscord<Mamy> for presentations you want to showcase very short videos
19:11:33FromDiscord<Kiloneie> it's gonna be called How Programs work, showing that programs are written and executed from top to bottom, echo with multiple parameters, that you can do calculations and some basic data type info
19:11:44*mibr quit (Ping timeout: 246 seconds)
19:12:00FromDiscord<treeform> @Shield, I think thats API depended. For system I would defined regions ahead of time. And I could allocate to any region at any time. And free them at any time.
19:12:09FromDiscord<treeform> @Shield, I think thats API depended. For system I defined regions ahead of time. And I could allocate to any region at any time. And free them at any time.
19:12:33lqdev[m]hey guys, I don't want to brag but someone please test tests/taudio. I don't know if the issue I'm having is specific to my machine or not and I really need to know https://github.com/liquid600pgm/rapid
19:13:00lqdev[m]doesn't matter what OS, just try to run it
19:13:08lqdev[m]and tell me if you get any sound
19:13:55FromDiscord<treeform> man audio is so hard to get right, its so hard to get rid of the clips...
19:14:14Araqtreeform: well in game programming regions/arenas are very common indeed.
19:14:40FromDiscord<treeform> I think if most http servers were written with C++, they would be common there too?
19:14:49Araqand yeah, you can use them for servers too. it's also very easy to use up more memory with them than a GC takes
19:14:52FromDiscord<treeform> if most http servers were written like games?
19:15:01FromDiscord<Shield> the problem is that i wasn't sure if things stayed in their right regions when I copy stuff around when working on another region, just concatinating strings and displaying text became a problem
19:15:18FromDiscord<Mamy> you use them for multithreading runtimes as well
19:15:24FromDiscord<Shield> @lqdev[m] sadly i'm on windows and using minGw
19:15:26FromDiscord<Mamy> and big int
19:15:34FromDiscord<Mamy> and tensor libraries
19:17:56lqdev[m]Shield: the compilation issue is fixed, go ahead and try
19:18:00Araqthe real problem is not how to do better than a GC, that's easy
19:18:06FromDiscord<treeform> @Shield I think big thing with GC regions is some thing like a "dev time leak detector" some thing that can detect pointing from other regions into regions that is bering freed.
19:18:12*justsomeguy joined #nim
19:18:49Araqthe real problem is to come up with a scheme that works for "average library code" out there that is not tied to an application
19:18:50lqdev[m]treeform: I don't care about stuttering right now. I just want to hear something other than silence.
19:18:56FromDiscord<treeform> Kind of what Araq was doing for --newruntime do the debugging in dev with more tools, don't do that in release mode.
19:19:45FromDiscord<treeform> lqdev, I used openAl for my project. worked really well. https://github.com/treeform/openAL
19:20:01lqdev[m]openal is proprietary
19:20:20Araqapplication development is easy, library development is hard, take json.nim. can we assume all the json ends up in a region? why? how?
19:20:41lqdev[m]and I'm fine with my current audio model.
19:21:16Araqdo we really want to have a parameter 'a: Allocator' in every proc we write?
19:21:23FromDiscord<treeform> Araq, yeah thats tough
19:21:34FromGitter<alehander42> Araq, it's strange, i get ` `false` dfa construction pass requires the elimination of 'defer' `
19:21:38FromDiscord<treeform> a global `a: Allocator` or a global allocator stack could work...
19:21:42FromGitter<alehander42> when constructing the current dfa
19:21:54FromGitter<alehander42> treeform, i think there is an easier way to pass Allocator
19:21:56Araqtreeform: that's --gc:regions then
19:22:14FromGitter<alehander42> with a global or stack
19:22:18FromDiscord<treeform> Yeah I want to learn more about --gc:regions
19:22:23FromGitter<alehander42> with a helper like https://github.com/nim-lang/RFCs/issues/165
19:22:48*SodaScripter quit (Ping timeout: 245 seconds)
19:23:42justsomeguyJust spend my first five minutes with Nim and it seems like a mash-up of Python, ES6, and Haskell -- but in a good way. Seems amazingly accessible for what it is, actually.
19:23:48justsomeguys/spend/spent/
19:24:02FromGitter<alehander42> nice, welcome <3
19:24:08Araqmemory management is the heart of a programming language. Python uses refcounting everywhere, it's slow but at least it works independent of the size of the heap and all 3rd party addons obey
19:24:22FromDiscord<treeform> justsomeguy, yeah nim is great, I came here for the python and speed part, stayed because of everything else.
19:25:57FromDiscord<treeform> Araq, also python's ref counting was very consistent until they added a cycle detector. I like consistent. I which it would tell me about cycles at "dev time" only so that I could compile that out.
19:26:21Araqstill possible to disable the cycle detector in Python
19:26:39Araqand set things to None manually to break up cycles
19:26:40FromDiscord<treeform> yeah but it does not tell you when you have cycles so it's easy to accidentally get them.
19:27:13FromDiscord<treeform> if they added a function like "check for cycles" I could run at "dev time" that would be great.
19:27:35Araqwell anyway, "slower but works with the rest of an entire ecosystem" wins over "fast and specialized"
19:27:48FromDiscord<treeform> thats true
19:28:37Araqand that's why development on 'owned' was paused.
19:28:50FromDiscord<treeform> it got too complex?
19:29:20Araqno, I found an alternative
19:29:40FromDiscord<treeform> have you written stuff about the alternative?
19:29:53Araqwhich gives us the same benefits without splitting the language
19:30:04Araqno .... i'm working ... on it.
19:30:34FromDiscord<treeform> I started to write "--newruntime for beginners" post/doc, but myself got confused - i was the beginner 🙂
19:31:04Araqwell --newruntime is still the MUCH better --gc:none solution
19:31:14Araqmuch much better.
19:31:29FromDiscord<treeform> does your new solution work with threads?
19:31:38Araqof course
19:31:55FromDiscord<treeform> cool
19:32:23Araqbut as I said elsewhere, the design that supports 'async' first wins
19:33:29Araqbut be my guest, we need more and better libraries and using 'ptr' and arenas and marking the library as "for games or servers" is nice
19:33:32FromDiscord<treeform> something like "gc regions stack" would not work with async at all.
19:34:16Araqit kinda works, but you need to be careful and most people are forced into writing servers and are careless about everything
19:34:32FromDiscord<treeform> The thing is with games you don't need to do the high performance GC stuff in many places. You could have an area marked ... CRAZY GC RULES HERE ... and use normal gc everywhere else.
19:35:07AraqI would love to see an EASTL for Nim :-)
19:35:38Araqwe simply get most libraries wrong and we're not alone, C++ had the same problem
19:36:14FromDiscord<treeform> I think people writing servers are getting wiser slowly.
19:36:50FromDiscord<treeform> I think the moore law (on single core speed) not working is slowly catching up.
19:37:08Araqwe introduced -d:safe vs -d:release because of that, people compiled the servers in -d:release, all the time
19:37:10FromDiscord<treeform> Why run 1000 servers when you can run 100 and save $$$.
19:38:41*gangstacat quit (Ping timeout: 246 seconds)
19:39:31Araqer, I mean -d:danger
19:39:51FromDiscord<treeform> Hmm I compile my servers with -d:release .. but I also add --d:nimTypeNames --d:stackTrace --d:lineTrace
19:39:58FromDiscord<treeform> What should I to instead?
19:40:12Araqit's fine now, -d:release does the right thing for servers
19:40:18Araqwe changed it :-)
19:42:14*SodaScripter joined #nim
19:42:49FromDiscord<Kiloneie> you know the feeling, when you ended one part of a video with one voice and start the other with another and you take 15 minutes to fix it and nothing works ? yolo...
19:45:16Araqer no, I only have one voice
19:45:21*SodaScripter quit (Remote host closed the connection)
19:46:18FromDiscord<Kiloneie> no i mean, you were talking louder more casual in one part, then you start the other HEI GUYS !!!!
19:46:25FromDiscord<Kiloneie> something like that xD..
19:46:36FromDiscord<has1> hi, two questions
19:47:12FromDiscord<has1> It seems like i didnt find maps in nim yet, where are those? (i am looking for a map like in go)
19:47:34*SodaScripter joined #nim
19:47:38*theelous3 quit (Ping timeout: 240 seconds)
19:47:52FromDiscord<has1> and second question, what is a "placeholder" type? In Go it is "interface{}" auto doesn't seem to work
19:47:53FromGitter<alehander42> kiloneie i dont really think thats bad
19:48:02FromGitter<alehander42> has1 tables
19:48:46Araqhas1 there is RootRef but I never use it, Nim has generics it doesn't need interface{}
19:49:16FromDiscord<Kiloneie> well you will tell me once i post it, i can definetly hear that someone glued it together O,O
19:49:38FromDiscord<has1> @gitterirc So i am trying to parse some json, it has this kind of structure
19:50:28FromDiscord<has1> https://play.nim-lang.org/#ix=1WWN
19:50:37*justsomeguy left #nim (#nim)
19:51:30solitudesf@has1 `gitterirc` is relay account
19:51:36FromDiscord<has1> inside the handleEvent proc, i am manually parsing the json though, I would like to avoid that and just check for the type itself
19:51:36*gangstacat joined #nim
19:52:18Araqcalling a simple string case "manually parsing" should be a sin
19:52:36Araq;-)
19:52:58FromDiscord<has1> what i mean is that i am parsing the json to the object based on the name of the thing
19:53:49Araqyou can hide it in a macro
19:54:11FromDiscord<has1> but it doesnt work in this simple form
19:54:18FromDiscord<has1> because i cant use the type string
19:54:28FromDiscord<has1> because its an object
19:54:33Araqyou can use a 'case' object, maybe
19:55:37FromDiscord<has1> so which type do i use for payload?
19:55:56*shomodj joined #nim
19:57:47FromDiscord<has1> oh, so i am just trying things out
19:57:54*gour quit (Remote host closed the connection)
19:57:54FromDiscord<has1> and it seems like i can just use ```JsonNode```
19:57:56FromDiscord<has1> as type
19:58:09FromDiscord<treeform> @has1 I think the way you are doing it fine? JSON type system does not match nim's type system so you have to convert.
19:58:37Araqhttps://play.nim-lang.org/#ix=1WWQ
19:59:12FromDiscord<treeform> @has1 I have a ton of code like this because my JSON is generated by some one else does not fit into nim's object structure.
19:59:22Araqbut I doubt it'll work out, in the end you have the stuff in a "single type" but then you need to do event specific things anyway
19:59:58Araqand that's what the 'case' is, it's a dispatching mechanism, you can't avoid it, nor is it wise to hide it
20:00:12Araq"manually parsing" has nothing to do with dispatching.
20:00:20FromDiscord<has1> i was hoping for some nice solution. I was using go before and i was using interface{} for it, i thought maybe nim could help me here with generics and macros and everything
20:01:17Araqmaybe it can but it depends on the JSON
20:01:36*SodaScripter quit (Remote host closed the connection)
20:01:54Araqand as I said, once it's all in the 'Event' type, what are you gonna do with it?
20:02:20FromDiscord<has1> i want to handle it in an event handler
20:03:18Araqand what does the event handler do with the message? dump to somewhere else? because for everything else there would be a dispatching step
20:04:57Araqit's like: heterogenous input (json) --> single type --> heterogenous handling
20:05:20Araqsee the problem? the type in the middle is a lie.
20:07:20FromGitter<alehander42> has1 can you give an example of your json
20:08:15Araqhe did, it's the usual message setup, a message has a kind and depending on the kind ("name" in this case) a different payload with different fields in it
20:08:21FromDiscord<Rika> its in the playground link he sent
20:08:49FromGitter<alehander42> well that's a typical `case object` has1, perfectly type safe imho
20:09:45FromGitter<alehander42> tho i have to admit maybe not perfectly, because of field name
20:09:46FromDiscord<Shield> @lqdev[m] having trouble with nimterop, can't get the test to compile
20:10:09Araqargh, now I need to write a macro...
20:10:51*krux02 joined #nim
20:11:13FromDiscord<Shield> i tend to avoid anything c++, i'm in library hell and i get error messages to run the compiled exe, can't run toast.exe, damn windows
20:11:50FromDiscord<has1> i created an example
20:11:58Araqhas1: one sec please
20:12:22FromDiscord<has1> https://play.nim-lang.org/#ix=1WWU
20:12:40FromDiscord<Shield> dependencies are my heart breakers
20:13:47lqdev[m]Shield: what's the error?
20:14:02lqdev[m]if it's something with GLFW, try again. seems to be a weird bug with git or something
20:14:04FromDiscord<has1> there is no error
20:14:40FromDiscord<treeform> @has1, I think your code is fine.
20:14:44FromDiscord<has1> but, i have to do the "manual" json parsing inside the case
20:15:41FromDiscord<treeform> I think your manual step is fine instead of some complex macro thing
20:15:59Araqbummer I was about to show the macro
20:16:08*paxis joined #nim
20:16:12FromDiscord<treeform> once you have different versions of events or need to clean up old json data you would need to do it manually
20:16:33FromDiscord<treeform> Araq, show us the macro then
20:16:39FromDiscord<exelotl> I want to see the macro
20:17:04AraqI suck at macros lol
20:17:18Araqbut let me try...
20:17:25FromDiscord<exelotl> lmao
20:17:40FromDiscord<treeform> well you set yourself up for that one
20:17:54Araqhey, I rarely get to write Nim user level code
20:18:04*nsf quit (Quit: WeeChat 2.5)
20:18:23rockcaveraHi Araq. Since you designed the language, you wanted to know how to calculate the space occupied by a sequence in memory. I tried with this code to confirm my theory that it would be 8 bytes per sequence plus 1 byte per int8 in an sequence of sequence of int8: https://pastebin.com/NhWQe3i1
20:18:26FromDiscord<Shield> git.nim(25, 12) `ret == 0` Command failed: (128, false) ccmd: cmd /c cd "D:\gamedev rebirth\sandbox\rapid\rapid-master\src\rapid\lib\soundio_src" && git remote add origin https://github.com/andrewrk/libsoundio
20:18:26FromDiscord<Shield> result: fatal: remote origin already exists [AssertionError]
20:18:47FromDiscord<Kiloneie> what font did you guys use in you black nim logo ?
20:18:53*Trustable quit (Remote host closed the connection)
20:19:09lqdev[m]Shield: try removing src/lib/soundio_src
20:20:07FromGitter<alehander42> rockavera cool!
20:20:13FromGitter<alehander42> rockcavera *
20:20:55Araqrockcavera, er... thanks but I don't really remember
20:21:00FromGitter<alehander42> Araq, so liftLambdas and transf are called .. in cgen? does this mean cfg taking that in account has to be called after that as well
20:21:11FromGitter<alehander42> i expected they are in sempass2
20:22:36*uu91 joined #nim
20:23:57Araqalehander42: as I said, we will need to change the order
20:24:19FromDiscord<Kiloneie> Okay Video #2 is done, but i put it as unlisted because i don't really feel like it's as good as the first one... idk, if you guys like it i will make it public
20:24:19FromDiscord<Kiloneie>
20:24:19FromDiscord<Kiloneie> LINK: https://youtu.be/wD-p06zbY1g
20:24:28FromDiscord<Shield> no luck, the folder is empty, deleted all of them, now it says the same error for ogg_src
20:24:59FromGitter<alehander42> Araq no problem, i echo the cfg after transformBody now
20:25:15FromGitter<alehander42> so i can see how it looks, that's enough to understand it for me
20:26:19FromDiscord<has1> Alright so this is the go solution (for reference)
20:26:19FromDiscord<has1> https://play.golang.org/p/47D91Dv2iqb
20:26:23rockcaveraAraq thanks for answering. If you remember, please let me know, as I have so far failed to come up with a solution.
20:27:19FromGitter<alehander42> so in this case we have to specify the nil check doesnt work for captured locals
20:27:56FromDiscord<has1> the problem is that i am using the actual even objects and store them as "interface{}", that means go know what type it is.
20:27:56FromDiscord<has1> If the events come via json, then the interface{} loses its type information and this code doesn't work
20:29:05FromDiscord<Shield> hold on, i'm getting a new error
20:29:19FromDiscord<has1> it will store the payload as a map instead of the actual object.
20:29:19FromDiscord<has1> Long story short, basically you guys told me the same thing that the Go guys told me, which is to unmarshal in case after checking for the event name
20:29:42FromDiscord<has1> it will store the payload as a map instead of the actual object.
20:29:42FromDiscord<has1> Long story short, basically you guys told me the same thing that the Go guys told me, which is to unmarshal in the "case" after checking for the event name
20:30:01Araqmaybe the Go guys had a point
20:30:08FromGitter<alehander42> well, you can have all the payloads inherit a common EventBase object maybe
20:33:07Araqhas1: here you go, https://play.nim-lang.org/#ix=1WWU
20:33:19Araqer sorry
20:33:22Araqwrong link
20:33:43Araqhttps://play.nim-lang.org/#ix=1WX0
20:36:20FromDiscord<Shield> @lqdev[m] now I get nimPNG.nim(333, 18) Error: type mismatch: got <seq[RGBA8], typeof(nil)>
20:37:54lqdev[m]woah, that's strange
20:38:05lqdev[m]what version of Nim are you running?
20:40:03FromDiscord<Shield> 0.20.99, i'm still using a previous nightly build
20:40:26FromDiscord<exelotl> When my friend updated to Nim 0.20 the other week, he couldn't build some of my code that used NimPNG. I told him to reinstall via nimble in case there was a newer version.
20:40:49FromDiscord<exelotl> The version of nimpng hadn't changed but he overwrote it anyway, and then the problem went away
20:43:09Araqyou just described how computers work. all good after a reboot
20:43:55FromDiscord<Shield> the weirdest thing was one of the libraries complaining that i should have --threads:on and --tlsEmulation:off
20:44:24FromDiscord<Kiloneie> I almost thought you were talking to me xD...
20:46:39FromDiscord<Kiloneie> Anyone watched my #2 yet ? should i make it public, is it any good ? Did any of that sound quality problem go away ? Im not sure at all.
20:46:54*Vladar quit (Remote host closed the connection)
20:53:03FromDiscord<Shield> okay, nimble install nimpng fixed it
20:53:44FromDiscord<Shield> i dunno why there was an error, the nimble installed it automatically
20:54:46FromDiscord<Shield> @lqdev[m] rejoice! it plays the sound onces and freezes my computer since it ate all cpu until i killed it, is that because of the 'while true' loop?
20:54:55FromDiscord<Shield> once*
20:56:00FromDiscord<Shield> @Kiloneie dem keyboard sounds, pretty satisfying
20:56:10FromDiscord<Kiloneie> xD
20:56:26FromDiscord<Kiloneie> and everything else ?
20:56:48FromDiscord<exelotl> Looks like the sunvox header changed a little since I wrote the binding last year, bringing it up to date now
20:57:05FromDiscord<Shield> sound quality is clear, the voice is level is consistent, good job
20:57:39FromDiscord<Shield> i wasn't aware of nimtrop, it looks like you can use it to generate bindings automatically
20:57:42FromDiscord<Kiloneie> i put 5 hard cardboards infront of my computer, 2 towels on it, a towel under mic, played with audio settings for 2-3 hours D:
20:57:50Yardanicolol
20:58:34FromDiscord<Kiloneie> so that's good, how about the actual tutorial part ? im so unsure about it, feels kinda off to me.
20:58:50FromDiscord<Kiloneie> i can re do it tomorrow, but if it's good i can make it public before i go to bed
20:59:47FromDiscord<Kiloneie> i mean i did watch thenewboston youtube guy i used to watch years ago a bit before my videos, taking notes, and he gave 0 fucks what he was talking about or how xD
21:00:03FromDiscord<Kiloneie> and yet people watched it a ton
21:00:14FromDiscord<Shield> "" turned into "hello" through the magic of editing, i can't comment much on the very beginner stuff
21:01:02FromDiscord<Kiloneie> yeah i know i fucked that part up D:, you didn't see anything xD,
21:02:05FromDiscord<Shield> oh wow i'm getting those random '@' in path and i can't compile a second time, i thought that happened only on v1
21:02:32shashlickSame bug
21:03:19shashlickhttps://github.com/nim-lang/Nim/pull/12265
21:04:28*dwdv_ joined #nim
21:07:32*dwdv quit (Ping timeout: 245 seconds)
21:08:38FromDiscord<Kiloneie> Okay after watching my video again, ehhhh it's not that bad, imma make it public, better than to waste all the time invested
21:10:52*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
21:11:53dom96anyone with macOS 10.14.6 (or thereabouts)?
21:11:55*laaron joined #nim
21:15:27FromDiscord<Shield> @shashlick I applied the changes in the PR and the bug still persists
21:18:07*asymptotically quit (Quit: Leaving)
21:18:52FromDiscord<Shield> @lqdev[m] I can only run taudio, have trouble compiling/running the other tests, maybe focus on audio tests without including glfw and i'll try them
21:20:04*solitudesf quit (Ping timeout: 268 seconds)
21:25:30FromDiscord<Shield> reopen this
21:25:30FromDiscord<Shield> https://github.com/nim-lang/Nim/issues/12249
21:26:27FromDiscord<Shield> oh wait, do i need to recompile nim?
21:27:12*doesntgolf joined #nim
21:31:39*clyybber joined #nim
21:35:06*daddoo joined #nim
21:39:54*SodaScripter joined #nim
21:42:58dom96I totally forgot about Snake
21:43:10dom96Just restarted the server and there are like 5 people playing :O
21:43:34FromDiscord<Kiloneie> Wait what ?
21:43:44dom96https://nim-lang.org/features.html
21:43:49dom96middle of that page
21:44:01FromDiscord<Kiloneie> yeah i thought you meant that xD
21:44:03FromDiscord<Kiloneie> lol
21:44:45FromDiscord<Kiloneie> it's a great example
21:45:30clyybberAraq: WDYT about https://github.com/nim-lang/Nim/pull/12220/files#diff-92288f1d4e61a914791381a2f5e440caR50 should that be allowed?
21:46:04Araqnah, '.val' is not a type
21:46:18Araqvar x: typeof(Foo[int].val)
21:46:18dom96I should probably recompile with Nim 1.0
21:46:29dom96server will likely be more reliable then
21:48:38clyybberAraq: Cool, I agree on that
21:50:06clyybberAraq: But `var x: Foo.val` compiles too, when Foo is not a generic
21:50:20clyybberSo I think it makes sense for Foo[int].val to compile too?
21:50:36Araqno, it's shit
21:51:05FromDiscord<treeform> dom96, I am on the mac you want macOS 10.14.6
21:51:05Araqand shouldn't work
21:51:19clyybberAraq: You mean the whole Foo.val thing?
21:51:33clyybberAraq: As in using fields of types as types?
21:51:38Araqyes
21:52:00clyybberIt has its use cases I suppose
21:52:08Araqoffsetof(Foo.val) oh, so it's not a type as types have no offset
21:52:22Araqdangerous stuff, bad it already works
21:53:48dom96treeform: can you repro https://github.com/dom96/choosenim/issues/139 ?
21:53:52clyybberAraq: Seems more like a problem of offsetof ? To be sound it should be offsetof(Foo, val) as offsetof *has* to consider the object val is a field of internally
21:54:34Araqthe point is that fields are not types
21:54:43Araqand could be interpreted differently
21:55:17clyybberYeah, I get that. But what is Foo.val then?
21:55:28clyybberIts certainly not a value
21:55:40clyybberAnd according to you not a type
21:55:46clyybberOr shouldn't be
21:55:52clyybberBut what else should it be then?
21:56:11clyybberinvalid?
21:56:38FromDiscord<treeform> dom96, I alreayd have nim installed
21:56:49FromDiscord<treeform> how to remove it to a fresh state?
21:56:57FromDiscord<treeform> on man i hope this does not go badly
21:57:18dom96treeform: you can mv ~/.choosenim/ ~/.choosenim.bak
21:57:25Araqclyybber, it's nothing
21:57:47FromDiscord<treeform> dom96, I put my trust in your tool
21:58:40dom96the only other files it generates are ~/.nimble/bin/nim etc. and those it happily overwrites so it's all good :)
21:59:11clyybberAraq: Sounds like that would create problems with typeof(Foo[int].val) if `Foo[int].val` would indeed be nothing
22:00:30FromDiscord<SrMordred> Hello people. hot code reloading are a experimental feature? i´m trying to test it on windows without success
22:01:57FromDiscord<treeform> dom96, everything worked for me see my reply: https://github.com/dom96/choosenim/issues/139
22:02:05Araqit's experimental but for me it worked well, SrMordred
22:03:10dom96treeform: strange, thanks for testing.
22:03:33FromDiscord<SrMordred> hmm. for ex: `nim c --hotcodereloading:on nim_server.nim` this don´t create any .exe
22:08:09Araqhttps://nim-lang.org/docs/hcr.html read this?
22:09:07*LargeEpsilon joined #nim
22:13:14*LargeEpsilon quit (Ping timeout: 240 seconds)
22:15:51FromDiscord<SrMordred> oh, i think the main proc is needed, right?
22:15:51FromDiscord<SrMordred> now i´m getting could not load: nimhcr.dll
22:17:34FromDiscord<SrMordred> (after successfully created the .exe)
22:28:08shashlick@shield did recompile help?
22:29:44FromDiscord<Shield> recompile what? the compiler?
22:37:09clyybbernarimiran[m]: I would really love to get https://github.com/nim-lang/Nim/pull/10515 merged, should I open a PR with a rebase or do you usually rebase yourself?
22:39:28shashlickya, code change is in compiler file so need to recompile nim to fix that issue
22:40:35FromDiscord<Shield> I don't know how to recompile it >.>
22:41:04Araqclyybber, I think he is sleeping
22:41:27Araqre-create the PR so that we get all the new CI checks
22:41:31Araqgood night
22:43:37shashlicknim c -r koch boot -d:danger
22:43:46clyybberAraq: Fine, gn8
22:44:39*dwdv_ quit (Quit: quit)
22:45:11*daddoo quit (Quit: Leaving)
22:49:52*ng0 quit (Quit: Alexa, when is the end of world?)
22:55:21FromDiscord<Shield> it doesn't work like the fix fixed the issue, i'll wait for the nightlies to confirm
22:56:24*clyybber quit (Quit: WeeChat 2.6)
23:00:53*owl_000 joined #nim
23:05:35*MrAxilus joined #nim
23:09:26*laaron quit (Quit: ZNC 1.7.4 - https://znc.in)
23:09:35*shomodj quit (Quit: Textual IRC Client: www.textualapp.com)
23:10:22*laaron joined #nim
23:10:59*theelous3 joined #nim
23:23:03*krux02_ joined #nim
23:25:43*krux02 quit (Ping timeout: 245 seconds)
23:30:50*snooptek quit (Remote host closed the connection)
23:32:01*snooptek joined #nim
23:35:01*couven92 quit (Quit: Client Disconnecting)
23:38:20SodaScripterhow get good at programming
23:38:39disruptekpractice.
23:38:54disruptekthough, i can't say it always works.
23:39:08SodaScripternim tutorials are really confusing to my peanut prain
23:40:11disruptekwrite what you know and slower accrete new technique as you get comfortable.
23:40:19disruptek^slowly, too.
23:42:57*snooptek quit (Remote host closed the connection)
23:43:47*snooptek joined #nim
23:57:30*krux02_ quit (Remote host closed the connection)
23:59:12Cadeytbh
23:59:22Cadeythe best way to get good at something is to first be awful at it