<< 12-04-2018 >>

00:02:54*smt_ quit (Read error: Connection reset by peer)
00:03:38*smt joined #nim
00:09:27*dddddd quit (Remote host closed the connection)
00:27:01*gokr quit (Ping timeout: 265 seconds)
00:43:21*yglukhov joined #nim
00:47:48*athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
00:53:52*arecaceae quit (Remote host closed the connection)
00:54:15*arecaceae joined #nim
01:11:42FromGitter<Varriount> @zacharycarter I'm redoing the signing code using nimcrypto. If successful, then the signing code should make around 5 memory allocations from the heap. :D
01:17:43*nixfreak quit (Ping timeout: 260 seconds)
01:23:09FromGitter<gogolxdong> Has anyone ever got `Error: internal error: getTypeDescAux(tyProxy) ⏎ No stack traceback available ⏎ To create a stacktrace, rerun compilation with ./koch temp c <file>`
01:24:40FromGitter<krux02> yes, and I did what it said
01:24:47FromGitter<krux02> it helped
01:24:55FromGitter<gogolxdong> where to check
01:24:56FromGitter<krux02> but still it is annoying that you have to do it
01:25:25FromGitter<krux02> you have to rerun it with `./koch temp c <file>`
01:26:25FromGitter<krux02> koch is the "makefile" for nim itself, so you need a clone of the nim git repo to actually do it
01:28:19*yglukhov quit (Read error: Connection reset by peer)
01:28:45FromGitter<gogolxdong> say it was the exception of running nim c -d:ssl server.nim, now run koch temp c server.nim?
01:29:06*yglukhov joined #nim
01:30:01FromGitter<gogolxdong> and I wonder what happend caused this lovely exception.
01:32:05FromGitter<gogolxdong> Do I have to copy the whole repo to nim repo at the same level of koch to run ./koch temp c server.nim ? Because `Error: unhandled exception: No such file or directory [OSError] ⏎ FAILURE`
01:45:54TangerHey guys, has anybody used genotrance's nimssl library before? https://github.com/genotrance/nimssl
01:46:29TangerI don't think I understand how it works. Does it only implement the sha lib at the moment or do you have to build the rest of the library?
01:56:49FromGitter<Varriount> Tanger: It looks like the nimgen configuration is incomplete.
01:57:09FromGitter<Varriount> Tanger: What do you need? SSL handling, or hashing/encryption?
01:57:25shashlickIt does only sha and aes
01:57:46shashlickAnd compiles the code in
01:58:19shashlickSee the tests
02:00:03*endragor joined #nim
02:01:19shashlickTanger ^
02:02:55TangerVarriount: rsa_sign is what I'm after
02:03:15Tangershashlick, Ah bugger. Oh well
02:03:18*yglukhov quit (Remote host closed the connection)
02:03:31TangerThanks guys! Maybe I'll give porting what I need by itself
02:03:40TangerI mean, how hard could it be to port the openssl library <_<
02:04:24*yglukhov joined #nim
02:05:40FromGitter<Varriount> Tanger: You could try updating that nimssl wrapper. It uses Nimgen, which makes the wrapping process somewhat easier.
02:06:36shashlickWhat portion are you interested in
02:06:54Tangershashlick, the rsa_sign function, pretty much
02:07:03shashlickThere's already wrappers that load the dll or so
02:07:13shashlickLet me take a look tonight
02:07:28TangerVarriount: Yeah, if I get it working I'll definitely submit a PR. Haven't looked at Nimgen yet, will have a gander
02:07:47Tangershashlick, Awesome, thanks man!
02:07:48shashlickMy goal with nimssl is to compile in the code and not depend on the full build
02:08:48Tangershashlick, Oh, that's your project?
02:10:40shashlickYa same guy
02:11:42TangerAyy! Thanks for the library mate! You're fighting the good fight
02:13:30*endragor quit (Remote host closed the connection)
02:14:05*endragor joined #nim
02:18:27*endragor quit (Ping timeout: 240 seconds)
02:32:08*endragor joined #nim
02:41:46FromGitter<gogolxdong> Can I import modules using macro ?
02:42:18FromGitter<zacharycarter> why would you want to?
02:42:32FromGitter<zacharycarter> I don't think so - but I've never tried...
02:42:47FromGitter<gogolxdong> result.add nnkImportStmt.newTree(ident"json")
02:43:10FromGitter<gogolxdong> didn't work.
02:44:30FromGitter<gogolxdong> sorry, it worked.
02:44:49*endragor quit (Remote host closed the connection)
02:47:08FromGitter<zacharycarter> \o/
02:47:48*yglukhov quit (Read error: Connection reset by peer)
02:48:59*yglukhov joined #nim
03:10:33shashlickLovely
03:12:30*endragor joined #nim
03:12:50*endragor quit (Remote host closed the connection)
03:13:18*endragor joined #nim
03:47:48*smt quit (Read error: Connection reset by peer)
03:48:22*smt joined #nim
03:54:34*leorize joined #nim
03:55:24leorizehi, does compiles() works for compile time type conversion error?
03:55:29*craigger quit (Ping timeout: 255 seconds)
03:56:35*craigger joined #nim
04:00:28*leorize quit (Ping timeout: 260 seconds)
04:01:16FromGitter<zacharycarter> what would be a compile time type conversion error?
04:01:28FromGitter<zacharycarter> like - ```const foo: int = 1.0``` ?
04:01:35FromGitter<zacharycarter> orrrr
04:01:45FromGitter<zacharycarter> are you saying like
04:02:07FromGitter<zacharycarter> ``````
04:02:12FromGitter<zacharycarter> or something else? I don't know?
04:07:25*leorize joined #nim
04:08:24leorizezacharycarter: compiles(Natural(-1))
04:09:10leorizethis results to true for me. Is it a bug?
04:19:23*yglukhov quit (Remote host closed the connection)
04:19:38*yglukhov joined #nim
04:19:53*yglukhov quit (Remote host closed the connection)
04:20:46*yglukhov joined #nim
04:29:18FromGitter<zacharycarter> well...
04:29:27FromGitter<zacharycarter> !eval echo -1.Natural
04:29:30NimBot-1
04:29:33FromGitter<zacharycarter> seems to work fine...
04:29:53FromGitter<zacharycarter> also - Natural(-1) is not a compile time expression
04:30:16FromGitter<zacharycarter> not sure if you were implying that it was or not - just pointing it out
04:30:29FromGitter<zacharycarter> I need to get some sleep before my test for the job thing tomorrow - have a good night all
04:31:47*kunev quit (Ping timeout: 276 seconds)
04:31:55leorizewell a compile time error is issued if you do ``discard Natural(-1)``
04:33:35*kunev joined #nim
04:35:25FromGitter<zacharycarter> well - !eval compiles(discard Natural(-1))
04:35:36FromGitter<zacharycarter> !eval compiles(discard Natural(-1))
04:35:38NimBotCompile failed: in.nim(1, 10) Error: expression expected, but found 'keyword discard'
04:35:54FromGitter<zacharycarter> hrm...
04:37:40leorizein.nim(1, 16) Error: conversion from int literal(-1) to Natural is invalid
04:37:47leorizethat's on the playground
04:37:55leorizebut I can't make a gist for some reason
04:38:32FromGitter<zacharycarter> yeah anonymous gists are broken because github deprecated them
04:38:44FromGitter<zacharycarter> I need to replace it with something else - but I've been a bit busy with this job thing
04:38:56FromGitter<zacharycarter> but after I get / don't get this job I'll have more free time to work on it
04:39:33leorizewell, you should go to sleep now. Good juck with your job thing tmr :)
04:39:40FromGitter<zacharycarter> thanks!
04:39:41leorizeluck*
04:48:02*yglukhov quit (Ping timeout: 276 seconds)
04:59:28leorize!eval discard int -1
04:59:29NimBotCompile failed: in.nim(1, 9) Error: internal error: expr(skType); unknown symbol
05:02:16*user1101 quit (Quit: user1101)
05:07:33*leorize quit (Quit: WeeChat 2.1)
05:51:20*voidspacexyz joined #nim
06:00:20FromGitter<data-man> @Araq: I'm using https://github.com/watzon/github-api-nim ⏎ Can be improved to interact with https://developer.github.com/v3/issues/#get-a-single-issue
06:01:38*voidspacexyz quit (Quit: Gotta run. Later)
06:02:21Araqwell do it please
06:05:32*nsf joined #nim
06:06:24FromGitter<data-man> Is a tool something like GHGrep?
06:13:10Araqwrite a tool that extracts all snippets into tests/github/*.nim
06:13:46*leorize joined #nim
06:14:14Araqpreferably filter by bugs marked with "crash"
06:19:10FromGitter<data-man> Ok. And a file with name: i_issueNumber.nim
06:27:41Araqwell better derive the name as t_title_without_spaces_<issueNumber>.nim
06:35:20FromGitter<data-man> Yeah, I started. :)
06:37:39*smt` joined #nim
06:41:31*smt quit (Ping timeout: 268 seconds)
06:52:41*gokr joined #nim
06:58:05*gokr left #nim (#nim)
06:58:40*xet7 joined #nim
07:01:11FromGitter<GULPF> @Araq Does NaN/NegInf/Inf need to be magic? Removing the magic seems to simplify the semcheck, and it doesn't look like it's used for anything useful
07:02:16FromGitter<GULPF> I don't know why but it looks like magic consts are folded at a later stage than normal consts
07:04:53Araqgo for it, the tests shall tell us when it's wrong :P
07:06:06FromGitter<GULPF> ok :)
07:08:10*ldlework quit (Quit: co'o ro pendo be mi)
07:09:37*ldlework joined #nim
07:11:26*yglukhov joined #nim
07:11:30*ldlework quit (Changing host)
07:11:30*ldlework joined #nim
07:12:21*yglukhov_ joined #nim
07:12:21*yglukhov quit (Read error: Connection reset by peer)
07:20:31*Vladar joined #nim
07:24:47*yglukhov_ quit ()
07:26:54*jaco60 joined #nim
07:28:26*smt_ joined #nim
07:32:07*smt` quit (Ping timeout: 260 seconds)
07:45:02*yunfan quit (Ping timeout: 268 seconds)
07:46:20*yglukhov joined #nim
07:46:59*zahary joined #nim
07:54:11FromGitter<gemath> Just defined this `macro noProcs(procSigs): int = procSigs.len` without an arg type by accident and it *works*?
08:00:06*zahary quit (Quit: Leaving.)
08:02:46*gmpreussner quit (Ping timeout: 264 seconds)
08:02:48*avsej quit (Ping timeout: 265 seconds)
08:02:52*smt` joined #nim
08:05:32*gmpreussner joined #nim
08:06:21*smt_ quit (Ping timeout: 263 seconds)
08:07:50*Torro joined #nim
08:10:25*zahary joined #nim
08:25:09*smt_ joined #nim
08:29:09*smt` quit (Ping timeout: 264 seconds)
08:31:20*couven92 joined #nim
08:35:52*user1101 joined #nim
08:38:08*rokups joined #nim
08:59:18*smt` joined #nim
09:03:29*smt_ quit (Ping timeout: 276 seconds)
09:08:34*smt_ joined #nim
09:09:54Widdershinswell, it's a macro. so, that seems reasonable?
09:12:27*smt` quit (Ping timeout: 260 seconds)
09:20:05FromGitter<mratsim> I thought auto inferred args were deprecated?
09:21:40FromGitter<mratsim> `from` is now a keyword?
09:22:37Araqnow? it always was
09:23:55FromGitter<mratsim> huh :? well I just met some strange code then
09:24:46Araqfor templates and macros typeless parameters are 'untyped'
09:24:51Araqthey are not inferred.
09:26:05Widdershinsmacros are less like functions that are executed and more like templates for code you would write, perhaps for many different otherwise incompatible types. it's metaprogramming.
09:29:30Araqactually macros and templates are the same. the only difference is in how you produce the resulting AST (imperative vs declarative)
09:29:40*yglukhov quit (Remote host closed the connection)
09:30:16*yglukhov joined #nim
09:33:49*yglukhov quit (Remote host closed the connection)
09:35:20*yglukhov joined #nim
09:40:44Widdershinsright. i was using template in the generic sense, forgot that's also a nim keyword :)
09:41:06Widdershinsinb4 "ah HA GENERICS ARE A THING TOO"
09:55:31*avsej joined #nim
09:55:31*avsej quit (Changing host)
09:55:31*avsej joined #nim
09:57:57*leorize quit (Ping timeout: 264 seconds)
10:02:00FromGitter<krux02> Widdershins: macros are not for incompatible types, they are more for automation of dedious tasks, such as serialization deserialization code and for embedded dsl definitions.
10:02:50FromGitter<krux02> I used a macro in the nim port of glm to generate all swizzling procedures.
10:02:55FromGitter<krux02> they are a lot
10:05:28FromGitter<diegogub> @krux02 I'm starting to love macros and templates in nim, How Im supposed to go back to work in go? 😟
10:05:52FromGitter<diegogub> Go has soooo much boilerplate..
10:06:11Araqthe best macro features are yet to come *cough*
10:06:21Araq:-)
10:06:30FromGitter<mratsim> Try Java, I’m sure it has much more boilerplate than go :D
10:06:52FromGitter<diegogub> @mratsim dont remind me...in University..writting exams in paper ..of Java
10:06:59FromGitter<diegogub> pages and pages...
10:07:12FromGitter<diegogub> It was not hard, just TOO much writting...
10:07:20FromGitter<krux02> Araq: well I am improving macros, because I need them
10:07:53FromGitter<diegogub> @Araq more features? :P
10:07:56FromGitter<krux02> @diegogub: I programmed in Go, too. And I have to say I liked it despite it has a lot of boilerplate.
10:08:38FromGitter<mratsim> My father offered 3 books on neural networks from the 80s. You had to type everything to reproduce the program. Well it came with floppy disks but I’m pretty sure they are dead. THankfully it’s in C++
10:08:52FromGitter<krux02> go has a generate task, so generating code in go has become such a common practice that it even got integrated in the normal process of building a library.
10:09:18FromGitter<krux02> but code generation is not as powerful has the macros in Nim
10:09:24Araqdiegogub: not really, I hope it will create a simplification
10:09:31FromGitter<diegogub> @krux02 yes, me too. yeah, I have a few projects where I use it
10:09:50FromGitter<diegogub> @Araq great
10:11:00FromGitter<mratsim> my main grip with go is the lack of generics but this boat has sailed.
10:11:21FromGitter<krux02> @mratsim I heared that floppies from the 80s are much more likely to still work than the last floppies from the early 2000s because they had better built quality. But the real problem will be, nobody has a floppy drive anymore. And those who have a floppy drive can't put it into their computers, because the connectors don't fit
10:11:43FromGitter<krux02> yea I miss generics and static dispatch
10:11:58FromGitter<krux02> and I didn't like the GC pause times in Go
10:12:09Widdershinsi believe the '80s ones were more likely to work not just because they were built like a fire hydrant but because the actual bits were enormous, too
10:12:17FromGitter<krux02> I noticed them when I wrote my game project
10:13:44FromGitter<krux02> Widdershins: that's true, I wish you could see magnetization somehow, then you would be able to just read the floppies with a photo
10:17:57*Calinou_ is now known as Calinou
10:18:36FromGitter<data-man> Floppies? It's too modern. ⏎ https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Blue-punch-card-front-horiz.png/640px-Blue-punch-card-front-horiz.png
10:28:35*zahary quit (Ping timeout: 240 seconds)
10:31:47*yglukhov quit (Ping timeout: 260 seconds)
10:32:49*xkapastel quit (Quit: Connection closed for inactivity)
10:38:26*yglukhov joined #nim
11:00:57*smt` joined #nim
11:05:02*smt_ quit (Ping timeout: 260 seconds)
11:08:59*yglukhov quit (Ping timeout: 256 seconds)
11:10:20*zahary joined #nim
11:30:38*Torro quit (Read error: Connection reset by peer)
11:41:05*yglukhov joined #nim
11:45:44*Torro joined #nim
11:56:10*leorize joined #nim
12:04:12FromGitter<krux02> Araq: `cmpIgnoreStyle` is broken
12:06:45Araqwell it doesn't care about first char sensitivity...
12:07:18FromGitter<krux02> yea and when I fix it, I break code
12:07:29FromGitter<krux02> also the normalize does not do it
12:07:43Araqnor should it, we need some Nim specific procs
12:08:14AraqI use normalize for all my command line apps and I don't want them to not support --HELP anymore because you "fixed" the stdlib
12:08:15FromGitter<krux02> but the documentation explicity says it is used for nim identifiers
12:08:28Araqthe documentation is outdated.
12:09:03Araqwe need cmpNimStyle and normalizeNim
12:09:08FromGitter<krux02> well then I will at least fix the documentation and put a warning in that it should not be used for nim identifiers
12:09:17Araqyup.
12:10:57*SenasOzys quit (Ping timeout: 240 seconds)
12:12:12Araqin retrospect that partial case sensitivity thing was a mistake lol. makes macros harder to write. :-/
12:13:25FromGitter<mratsim> That could be a HackerNews top post :P
12:14:10FromGitter<mratsim> another thing for Nim v2!
12:14:22FromGitter<mratsim> the next 8 years will be exciting :D
12:14:36Araqyou have no idea... ;-)
12:15:58Araqbut yeah this Nim v2 things sounds like a plan, now how do we get v1 out?
12:16:17Araqso many nasty crashes remain ...
12:17:59FromGitter<krux02> well I would really thik to throw out a lot of stuff before v1
12:18:08*zahary left #nim (#nim)
12:18:31*SenasOzys joined #nim
12:18:52AraqI'm always looking for things to remove
12:19:00AraqI'm all ears. what do you suggest?
12:19:36Araqand don't say the .deprecated procs. ok, but these are rather obvious.
12:19:51FromGitter<krux02> well what I would like to remove are the arg{nkStmtList} patterns on functions
12:20:02FromGitter<krux02> yes they are useful, but they are horribly dirty
12:20:19FromGitter<krux02> they introduce compiler internal names to the frontend
12:20:30FromGitter<krux02> and they are not something you coun't do in macros.
12:21:25Araqhuh? what? what is arg{nkStmtList} ?
12:21:46FromGitter<krux02> maybe at some point there should be something like the c++ enable if with a programmable overload resolution
12:22:06Araqdo you talk about AST based overloading?
12:23:27FromGitter<krux02> yes
12:23:47FromGitter<krux02> I am not saying it is not useful, but it is also not necessary
12:24:02FromGitter<krux02> it is unnecessary complexity
12:24:13Araqyeah, it was before I figured out how to do move semantics
12:24:41Araqwe can deprecate them for the next release and see who complains
12:27:35FromGitter<krux02> and I would like to have concepts not in the v1 release at least not in the form they are today
12:28:05Araqthe problem with that is that it's already "behind" a keyword
12:28:07FromGitter<krux02> concepts should have a clear and strict distinction between value and type experssions
12:28:20AraqI tried {.experimental.} but have mixed feelings about it
12:28:27FromGitter<krux02> and there are a lot of type relations
12:28:33Araqfirstly, .experimental is an all-or-nothing
12:28:49Araqyou use it to enable concepts, you get more auto-derefs for free...
12:28:54FromGitter<krux02> `sameType` `compatibleType` `convertableType`
12:29:01Araq{.experimental.}
12:29:06FromGitter<mratsim> I also think concepts can be behind an experimental flag, but experimental contaminates lots of stuff (destructors, overloading “.” and a recent issue as well)
12:29:19Araqusing a, b: int # come on, it's a keyword, 'using'
12:29:38Araq.experimental needs to be done by-feature.
12:29:40Araqand then
12:29:47Araq{.experimental: concept.}
12:29:56Araqtype Foo = concept # why?
12:30:34FromGitter<krux02> yes, but the keyword can remain as a reserved word before they are enabled.
12:30:45Araqwe can claim 'concept' to be an experimental feature.
12:30:49Araqwell it pretty much is.
12:31:01Araqbut what else to do with it?
12:31:13AraqI can use a nimble package that uses 'concept' internally
12:31:19Araqand not be affected by it.
12:31:42Araqremoving the feature altogether only means I cannot use these packages anymore.
12:31:49FromGitter<krux02> well as long as it doesn't expose it.
12:32:19Araqit's some philosophical issue about a "clean" language for v1
12:32:48FromGitter<krux02> well clean is very subjective
12:32:52FromGitter<krux02> but it can be minimal
12:32:56Araqbut we have to watch out that it doesn't just mean "now even more stuff is broken"
12:35:01FromGitter<krux02> I don't want to break stuff, but there should be a way to fix things that were bad design decisions in the standard library.
12:35:04FromGitter<alehander42> I think moving stuff back to experimental after it's already been enabled by default is risky
12:35:43FromGitter<krux02> there are languages out there that have a method provided that allows old code to be automatically upgraded to new code.
12:35:44*sendell joined #nim
12:36:00FromGitter<alehander42> especially stuff like concepts, I use them in many places, and suddenly one day I find out I need to add `{.experimental.}` everywhere because somebody doesn't like their design
12:36:19FromGitter<krux02> @alehander42 yea, but do you want to freeze broken parts of the language?
12:36:55FromGitter<zah> what’s broken about concepts, again?
12:37:15FromGitter<krux02> @zah I just said it, they confuse type expressions with value expressions
12:37:29FromGitter<zah> can you elaborate?
12:38:34Araqit's the old typedesc vs varof(int) issue, zah
12:39:10FromGitter<zah> why is it an issue? can you give me a code example that demonstartes a problem?
12:39:24Araqwhich I still don't like either btw. but let's move this topic slightly into the more abstract
12:39:36Araqlet's say feature X is
12:39:38Araqa) useful
12:39:40Araqb) used.
12:39:45Araqand c) quirky.
12:39:52Araqd) behind a language keyword.
12:40:07Araqwhat to do with it for v1 ?
12:40:38Araqit's not only concepts, my .closure iterators are also another point of pain :-)
12:41:40Araqoh and let's add to the list
12:41:52Araqe) really much work to get rid of the quirks.
12:42:29FromGitter<krux02> x.foo(T1) should only compile when there is actually a fuction ``proc foo(X, typedesc[T1])`` and not ``proc foo(X, T1)``
12:42:59Araqyes, I'm sure zahary knows.
12:43:11FromGitter<krux02> well he asked
12:43:51FromGitter<zah> @krux02 there is a way to request this. you can say ⏎ ⏎ ```Foo = concept type T ⏎ bar(T)``` [https://gitter.im/nim-lang/Nim?at=5acf54875f188ccc1559a46d]
12:44:19FromGitter<krux02> well I would guess that (T) is a type expression here
12:44:57FromGitter<krux02> therefore I would assume that there needs to be a proc/template/macro that takes a `typedesc[T]` as argument.
12:44:58FromGitter<zah> I don’t follow you
12:45:21Araqconcept x
12:45:39Araq foo is (int, int) -> int
12:45:46Araqinstead of
12:45:56Araq foo(int, int) is int
12:46:12Araqseems to solve this issue in a way nobody has brought up before
12:46:41Araqand is logical once we embrace the arrow for proc types.
12:46:45FromGitter<krux02> well that is ok with me
12:47:40FromGitter<krux02> and thene there are the other relations that I just mentioned
12:47:57Araqthese type relations are pretty universal
12:48:08FromGitter<zah> well, as I said, I don’t see the issue yet ⏎ ⏎ another way to request a typedesc param is to say ⏎ ⏎ `bar(x, type T)` [https://gitter.im/nim-lang/Nim?at=5acf5588270d7d3708bd0203]
12:48:32Araqzah, we talked about this for hours
12:48:34FromGitter<krux02> @zah, then please try to see and instead of trying to be ignorant
12:48:57Araqit's not objectively wrong, but it's inelegant.
12:49:22Araqand subtle to understand.
12:49:32Araqesp when you're new to nim.
12:49:47FromGitter<zah> elegance is perhaps subjective, for sure my design produces shorter concept definitions
12:49:49FromGitter<krux02> I just figured out the (int,int) -> int does not solve everything
12:50:06Araqonce you finally understood 'typedesc' Nim fucks with you and change the rules in a concept declaration.
12:50:24FromGitter<krux02> often `foo` is not a proc, but can also be a template or macro
12:50:32FromGitter<zah> it’s a simple rule that requires just one sentence in the manual
12:50:42Araqand you wrote the "typedesc skipping" logic yourself, you know what we're talking about ;-)
12:51:01FromGitter<krux02> @zah well short code is not the best argument, I mean APL aslo produces short programs
12:51:40Araqkrux02: we need special rules for proc matches in concepts in every case, we can special case the '->', we can special case the 'is' operator
12:51:50Araq*in any case.
12:51:56FromGitter<zah> please show me some people who were confused by this rule after seeing the explanations and the examples
12:52:41FromGitter<krux02> <--- there is one
12:52:45Araqwell I can't even show you some people who used 'concept' in production.
12:53:43FromGitter<zah> https://github.com/status-im/nim-rlp/blob/master/rlp/writer.nim#L16
12:53:52FromGitter<krux02> I was confused, because I did not know how to specify a concept that explicitly asks for a type as arugment
12:54:13FromGitter<zah> it’s covered in the manual, @krux02
12:54:43Araq x shl y is T
12:54:43Araq x and int
12:55:01Araqthe "wrong" logic is extremely visible in your own example
12:55:39FromGitter<krux02> yes I just wanted to point that out
12:55:45FromGitter<zah> > In order to check for symbols accepting typedesc params, you must prefix the type with an explicit type modifier. The named instance of the type, following the concept keyword is also considered an explicit typedesc value that will be matched only as a type.
12:55:58AraqI know it's documented, I know you like it.
12:56:01FromGitter<krux02> it should be x and varof(int) is T
12:56:04FromGitter<zah> x and y and considered dummy variables in this example
12:56:23FromGitter<krux02> I have no problem with x and y
12:56:26FromGitter<krux02> that is nice
12:56:29FromGitter<krux02> and T is nice
12:56:29AraqI don't like it. at all. and I'm not suddenly gonna like it having looked at more examples.
12:56:54FromGitter<krux02> x and int is not nice
12:58:13Araqbut again. can we talk about these features in the context of v1 instead?
12:58:16FromGitter<zah> well, in operators it looks a bit odd, I can accept that
12:59:02FromGitter<zah> but it’s just a small quirk and you can still defined varof(T) yourself if that’s your cup of tea
13:01:17FromGitter<krux02> http://ix.io/17AW
13:01:36FromGitter<krux02> @zah no it's not about that
13:01:42FromGitter<zah> also, it should really be valueof(T), because you need to be able to discriminate between vars and non-vars
13:01:56FromGitter<krux02> the problem is that I actually have templates that expect a type argument
13:02:05Araqwell it should be 'varof', 'letof', 'constof'
13:02:15Araqand 'type' should be 'typeof'.
13:02:41FromGitter<krux02> and I do not want a concept that say "ah you use a type year, you probably mean a value of that type, let me fix that for you"
13:02:42FromGitter<zah> looks much more baroque to me this way
13:02:52FromGitter<krux02> then I say "no I really mean a type, nothing else"
13:03:05FromGitter<krux02> and then I just discard concepts alltogether
13:03:22FromGitter<zah> just because types look a bit funny when used with operators
13:03:31Araqnot too mention that technically typedesc[typedesc[int]] should be a thing :-)
13:03:40FromGitter<krux02> well I also don't really like it, i just wanted to strip it all down to the minimum
13:03:54FromGitter<krux02> Araq: yes
13:03:59FromGitter<zah> this is not in conflict with the concept escape rule - it can strip just one level
13:04:35AraqI know, but it makes things more confusing.
13:05:37FromGitter<krux02> concepts feel a lot like emacs trying to do the right thing for you, when in reality emacs just does the wrong thing. and that automated.
13:05:40FromGitter<zah> confusing is a bit of overstament I think - agter all, programmers are capable of escaping backslashes in regular expressions - a much harder problem :P
13:05:46FromGitter<krux02> automatically doing the wrong thing is horrible
13:05:55Araqok I see we won't talk about v1 here.
13:05:56FromGitter<krux02> I prefer a lot to have a bit more boilerplate
13:06:32FromGitter<zah> well, for v1, I think we should just try to have as many systems implemented in full without known major bugs and limitations
13:06:45FromGitter<zah> hopefully, the concepts will be ready too
13:07:20FromGitter<zacharycarter> what are the speculated major changes / improvements between 0.18.X and 1.0 ? Or is that known yet?
13:07:24FromGitter<zacharycarter> Also - hello
13:08:22FromGitter<tim-st> I mentioned this before here and remembered now when seeing a similiar issue: in Python `assert not False` is ok, in nim `assert not false` does not compile. I know there is a workaround but shouldnt this work?
13:08:45FromGitter<tim-st> (logically by binding prio)
13:09:32Araqbth I don't remember if 'not' is an unary-only operator. I think Nim doesn't have unary-only operators
13:09:52Araqso 'assert not false' is parsed as '(assert) not (false)' (binary not-operator)
13:09:53FromGitter<zacharycarter> assert(not false)
13:09:58FromGitter<zacharycarter> is it really that much of a work around?
13:10:02FromGitter<krux02> @zah well when concepts keep to have this automatic conversation of type expressions to value expressions, then I will vote against them
13:10:44Araqhow do we fix .closure iterators? async is built on top of them ...
13:10:53FromGitter<zacharycarter> what's wrong with them?
13:11:20Araqthey are subtle to understand
13:11:25FromGitter<zah> my understanding so far is that cheatfate’s transform seems to work
13:11:29Araqand lead to artificially looking factories.
13:11:43FromGitter<krux02> well when not would not be parsed as an operator, but a smple function call, assert not false would work
13:11:48FromGitter<zacharycarter> gotcha
13:11:50FromGitter<krux02> I am not sayting I would want that
13:11:55FromGitter<tim-st> @zacharycarter no, it's not. but it makes the language harder, because there are more special cases; I think the syntax shouldnt be dependant on the implementation
13:12:14FromGitter<zah> regarding the consuing aspect of the syntax, we can stop calling them closure interators and instead call them resumable functions
13:12:25Araqno, in this case things are harder because they are fewer rules than you assume there are.
13:12:38FromGitter<krux02> well the error you get when you have `assert not foo(a,b)`is pretty confusing
13:12:39Araq@tim-st
13:13:07FromGitter<krux02> maybe assertNot should be defined
13:13:17FromGitter<tim-st> I just used this trivial example of course that problem appears more often in normal code
13:13:20FromGitter<zah> then the reality that they work like closures will be more apparent ⏎ the inline iterators can gain the ability to be instantiated as a resumable function too - then they will just act like a factory creating a `iterator: T` type
13:14:18FromGitter<zah> part of the existing confusion is that the proc type of the inline iterators is not really treated as a factory returning `iterator: T`
13:17:07AraqIMO in for idents in mymacro() should mean 'mymacro' gets to rewrite the full for-loop
13:17:46Araqand then mymacro can translate it into hasNext(); next() calls that types implement much like they implement '$' today
13:17:56FromGitter<zah> this looks like an intersting idea, but it’s not incompatible with having regular iterators
13:18:24Araqand then .inline iterators can produce hasNext(); next() operations
13:18:56Araqand closure iterators and inline iterators can disappear.
13:19:50FromGitter<zah> well, part of the benefit of inline iterators is the very efficient Implementation. transforming the iterator into an object with `hasNext`, `next` is not the same
13:20:15Araqafter inlining it's on par with a modern optimizer
13:20:27Araqneeds some tests to prove it.
13:21:14Araqbut these are exactly these kind of designs that I want to keep for v2, because I can see better solutions for pretty much every aspect of Nim.
13:21:39FromGitter<alehander42> are chainable iterators somewhere on the horizon?
13:21:51Araqthe curse of an overly long development process.
13:22:41FromGitter<alehander42> @michael72 continues to do some impressive stuff with zero-functional, but one can only go so far without lang support (basically, a normal user can't extend it)
13:23:02FromGitter<zah> I tried to implement higher-order inline iterators once - this part of the code is quite tricky
13:24:58*endragor quit (Remote host closed the connection)
13:24:59FromGitter<zah> only very basic examples used to work ⏎ https://github.com/nim-lang/Nim/blob/devel/tests/iter/tchainediterators.nim
13:25:26FromGitter<zah> I think Araq killed the support in one bugfix
13:26:30Araqsorry :D
13:28:05*endragor joined #nim
13:28:36Araqso my conclusion is 'concept' and 'closure' iterators are technically not part of v1 and the solution is to mention it in the docs
13:29:42FromGitter<krux02> Araq: I just realized this cmpIgnoreStyle is copied over everywhere
13:30:16Araqthat doesn't matter as you are not supposed to change cmpIgnoreStyle
13:30:31Araqyou shall write a cmpNimStyle
13:30:53FromGitter<krux02> what do all the pragmas mean btw?
13:31:17FromGitter<krux02> rtl, extern: "csuCmpIgnoreStyle"
13:31:46Araq'extern' does what you think it does, 'rtl' is custom for DLL support
13:32:22FromGitter<krux02> well I could not find any string matching "csuCmpIgnoreStyle"
13:32:43*endragor quit (Ping timeout: 260 seconds)
13:32:52FromGitter<krux02> so I don't know what extern does
13:33:20Araqhttps://nim-lang.org/docs/theindex.html
13:33:26AraqCTRL+F: extern
13:33:38Araq--> https://nim-lang.org/docs/manual.html#foreign-function-interface-extern-pragma
13:33:48*Vladar quit (Quit: Leaving)
13:34:37FromGitter<krux02> but I am not 100% sure how to implement cmpNimStyle, because `_` is a valid identifier
13:34:39FromGitter<zacharycarter> https://hacks.mozilla.org/2018/04/sneak-peek-at-webassembly-studio/#comment-23208 - I'm going to work on this after my programming test today, as well as the playground
13:34:42*sleepyqt joined #nim
13:34:46FromGitter<zacharycarter> I finally got the playground running inside a docker container
13:34:55FromGitter<zacharycarter> well - I got docker to run inside of another docker container
13:35:10FromGitter<alehander42> well what does "technically not part" mean
13:35:21FromGitter<krux02> and in theory with macros anybody can create identifiers starting with an arbitray amount of "__"
13:35:23FromGitter<alehander42> btw has somebody had
13:35:41FromGitter<alehander42> invalid type: Future[stuff] only for some stuff types
13:35:44FromGitter<krux02> so should "a" and "__A" be identical
13:35:51FromGitter<alehander42> I never got something like this
13:36:00FromGitter<krux02> and should "_" be identical to "__"
13:36:23AraqI'm not following you. the manual says only one underscore is allowed
13:36:46FromGitter<krux02> yes allowed, but yea you can still create them
13:36:58FromGitter<krux02> in macros
13:37:29FromGitter<krux02> or should newIdentNode actually check for valid identifier names
13:37:48Araqhttps://github.com/nim-lang/Nim/blob/devel/lib/system/inclrtl.nim#L48
13:38:16Araqwell the AST is not the same as the surface syntax
13:38:33Araqthe AST is more forgiving and powerful.
13:38:58FromGitter<alehander42> aaaaaaaaaaaaaah `A | B` in a field with proc type
13:39:07FromGitter<alehander42> we really need a better error message for this
13:39:18Araqbe my guest, it's hard
13:39:25Araqor at least quite some work
13:39:41Araqbut hey, before that error message the compiler crashed, yummy
13:41:39FromGitter<krux02> so when I understand it correctly `rtl` makes the nimvm call into the C function instead of executing it on the vm
13:43:02Araqthat's a side-effect of it, perhaps. rtl annotates it with importc or exportc or nothing. much like a header file in C++ that you use for building a DLL.
13:43:33Araqdepending on the build the header file is used to compile the DLL. or to link against the DLL
13:43:52Araq'rtl' does the same for Nim.
13:44:33FromGitter<alehander42> maybe the flags can be useful info
13:44:46FromGitter<alehander42> or one can annotate some obvious errors in typeAllowedAux
13:44:53FromGitter<alehander42> but I'll take a look later
13:45:05FromGitter<zetashift> Using PDCurses I have a `var input = getch()` which returns a cint and a proc that takes in a `var cint` as parameter but I'm getting an error that it can't take the input as a paramter because it's immutable?
13:45:19Araqjust make typeAllowedAux also return some enum describing the problem more explicitly
13:46:06FromGitter<gemath> It seems the AST is node identity agnostic, meaning that I can add the same NimNode (pointing to the same NimNodeObj) to a parent node twice with no problems. Can I rely on this being true in the future?
13:46:56Araqgemath: in the future it will probably duplicate these nodes under the hood
13:47:33Araqbut if you treat them as immutal after construction, nothing will change
13:47:52Araqthey don't have an identity, yes.
13:48:10Araqat least they are not meant to have an identity.
13:48:15*dddddd joined #nim
13:48:49skelettIs there a way to use `mapIt` etc. in a function with a return value in a way without creating a "shadowed identifier" warning?
13:49:21*Torro quit (Quit: -bye)
13:51:09FromGitter<gemath> @Araq I was thinking of "refactoring" the AST by simply mutating that single Node that is used 20 times in the tree. Would thnat be possible then?
13:52:27FromGitter<gemath> @Araq I guess not if the have to immutable then..
13:53:43Araqyeah, don't do that :-)
13:54:25*sleepyqtx joined #nim
13:54:47Araqskelett: I don't know
13:55:33skelettOk that would explain why I did not find one yet :D
13:55:35*nsf quit (Quit: WeeChat 2.0.1)
13:55:39*sleepyqt quit (Ping timeout: 268 seconds)
13:56:06AraqI dont have this warning enabled.
13:56:46skelettit's automatically enabled when I compile with --verbosity=2
13:57:47*leorize quit (Quit: WeeChat 2.1)
13:58:41FromGitter<arnetheduck> @gemath please, please, please don't do that :) then the AST is no longer a *tree* killing certain assumptions about how it can be traversed and how nodes can be cached or processed lazily / alternatively, @Araq, please do what you're suggesting and copy them or whatever so they remain a tree and nodes get a unique id
13:59:57*sleepyqtx quit (Ping timeout: 240 seconds)
14:01:21FromGitter<gemath> Its a tree with *wormholes*, Rust doesn't have that 😄
14:03:52Araqarnetheduck: got any suggestions how to do that?
14:04:15Araqintroduce a wasCopied flag that we set in []= and 'add' ?
14:04:51Araqhmm that could work
14:06:24Araqright now internally nodes are shared though...
14:06:59Araqeven if I ensure no sharing occurs in the ASTs resulting from macros
14:07:12Araqother parts in the compiler do sharing too.
14:08:46Araqmacro m(): untyped =
14:08:46Araq let x = newLit(8)
14:08:46Araq result = newCall("echo", x, x)
14:08:48Araq x.intVal = 90
14:09:05Araq--> 9090
14:09:52Araqthis will break some macro code :-)
14:11:08FromGitter<gemath> Hmm, make the AST a "set" as per NimNode[] then?
14:11:22*smt joined #nim
14:11:48Araqinternally I want to switch from 'ref object' to 'object'
14:12:11Araqso everything that uses identity semantics will be broken
14:14:58*smt` quit (Ping timeout: 265 seconds)
14:17:34FromGitter<gemath> Would solve that problem at the root. I already use `lineInfo` to identify nodes by module/source code position, but this relies on unique module names. Can I rely on that, or is there some way to get a module path?
14:17:43*bzb_hh joined #nim
14:18:01*bzb_hh quit (Client Quit)
14:18:21*leorize joined #nim
14:25:24*xkapastel joined #nim
14:26:05FromGitter<arnetheduck> Araq, well, Node has an explicit id field (when useNodeIds is enabled).. and yeah, no free solutions for enforcing it that I can think of, short of the first transformation in the compiler that makes use of the fact (enforcing used liberally here, through a compiler crash) - the obvious way is through a parent field which can be useful for some types of tree analysis.. a flag will solve it also.. a third way I was
14:26:05FromGitter... thinking was a special lint mode that would simply check the tree but that's a bit sad
14:27:22FromGitter<arnetheduck> @gemath almost `set` - needs to be order-preserving as well
14:27:46Araqtechnically it's an acyclic graph.
14:28:16FromGitter<zacharycarter> I love graph theory
14:28:19Araqarnetheduck: what do you annotate the nodes with?
14:31:08Araqthe TLoc structure is supposed to be good enough for the backends :P
14:31:15FromGitter<gemath> @arnetheduck yes, I just badly paraphrased "uniqueness" -- and it should be as of NimNode, not NimNode[].
14:31:58Araqit's Node = object kids: seq[Node] vs Node = ref object kids: seq[Node]
14:32:18Araqinterestingly Nim can enforce a tree shape, but not an acyclic graph shape
14:34:52*aguspiza joined #nim
14:35:51Araqkrux02: int8 is convertible to int, Subtype is a subtype of Supertype. then there is type equality.
14:36:10Araqwhat is left to simplify here?
14:37:41FromGitter<arnetheduck> Araq, I have to keep an id->node map because there's nothing in the node I can use
14:37:52Araqobviously, yes.
14:37:58Araqwhat would you need to use?
14:38:07Araqwhat sort of information is attached to a node?
14:39:19AraqLLVM's IR is close to C, I don't need node information for producing C code hence I wonder why you need it
14:40:05FromGitter<arnetheduck> in nlvm? I'd need an opaque object ref most probably.. right now that's just an llvm `ValueRef` but I think I'm gonna need some more things for some data analysis soon
14:40:48FromGitter<arnetheduck> in C, you have a rope field to dump things in, like C names
14:41:13FromGitter<arnetheduck> `sym.r`
14:41:26Araqthey are attached to the PSym though, not the PNode
14:42:26FromGitter<arnetheduck> you're right, let me check that
14:43:40*nixfreak joined #nim
14:45:53FromGitter<arnetheduck> ooh. I'm actually not using the node id:s either - just the symbol ids. let me update that bug report then, I must have misunderstood the generated bytecode.
14:48:33Araqbtw a 'when defined(llvm): r: ValueRef else: r: Rope' in ast.nim is nothing I would complain about
14:55:58*miran joined #nim
14:58:51FromGitter<arnetheduck> thanks, I'll think about it - would certainly make a few things easier! seems a bit like pollution though for whoever doesn't care about llvm, so as long as it's not an existential need.. also, I use the .r field for a few hacks where I have to replace certain symbols with llvm-specific stuff (intrinsics, ABI workarounds) and I have a vague memory of using some c gen utils that depend on it as well, so it would more
14:58:51FromGitter... likely be an addition of a field
15:02:19Araqsure
15:03:38FromGitter<arnetheduck> right now, I think the biggest issue I have is understanding `genAssignment` - it's a bit of a mess because of all ref count optimizations - the way TLoc is handled is pretty hard to make sense of, because it gets passed through layers of `expr` and `genAssignment` and often going through conditional updates along the way
15:05:41AraqgenAssignment is the result of a number of subtle bugfixes
15:06:09Araqthe whole code generator is wrongly designed.
15:06:12Araq:-)
15:06:20Araqit should be an AST to AST transformation.
15:06:43Araqthe resulting AST should have the property to be trivial to map to C syntax.
15:07:58Araqor to map to LLVM IR syntax, I'm sure they are similar enough to make this feasible.
15:09:09AraqA rope is just an AST you cannot traverse.
15:12:36Araqthe idea behind TLoc is that you can produce better code when you look at 'dest = x+y' instead of only at 'x+y'. because you can construct the result in 'dest' directly.
15:12:38FromGitter<arnetheduck> that's kind of what I tried to do with nlvm, but it's causing trouble now that I have to start implementing those optimizations and bugfixes :) I actually wrote a java-to-c++ converter once and I regret to this day I didn't make it AST-to-AST (used a stream I think, so in a way that's even less information preserved than a rope)
15:12:56*artem[m] joined #nim
15:13:50FromGitter<arnetheduck> yeah, that much I understand. it's untangling all the variations on that theme that makes it tricky. eg object inits, assignments, temporaries, arguments, whatever
15:14:06Araqso conceptually everything tries to construct the expression in the destination and if there is no destination a temporary location is used instead.
15:15:07FromGitter<arnetheduck> in c for example, you sometimes try to optimize to avoid a temporary - in llvm, everything is basically a temporary, so that's another "mismatch" (for stuff like a = a+b)
15:16:53FromGitter<arnetheduck> yeah, but then it also depends on what the source is - stack, heap, global etc - so there's a fair number of combinations and subtle ways to get it wrong.. I'm down to about a hundred unit test fails though I think, so it's not that bad :)
15:17:55Araqit's pretty tough. consider that tmp = foo(); in C can be rewritten to foo(&tmp); depending on the ABI
15:17:56*athenot joined #nim
15:18:38Araqbut when that is done it might result into stores into the heap that you didn't notice
15:18:45Araqand in the end the RC'ing is off.
15:19:12Araqwhich is why do this particular rewrite on our own.
15:19:27Araqso that we stay in control.
15:19:53*leorize quit (Quit: WeeChat 2.1)
15:19:55*artem[m] left #nim ("User left")
15:21:08FromGitter<arnetheduck> yeah, I noticed this in a specially icky case - adding an element to a seq.. the order in which you grow the array, init it with new data, copy the old items and paste in the new item in is a mystery to me, when you start nesting expressions and having the gc run mid-grow
15:25:01Araqmaybe it's still wrong :-)
15:26:22*nsf joined #nim
15:26:42*noonien quit (Quit: Connection closed for inactivity)
15:28:49FromGitter<stisa> ast-to-ast is what I'm (slowly) trying to do with wasm, even if I initially based the structure of the pass on the js one
15:29:39FromGitter<arnetheduck> mine is more wrong, it crashes on some obscure test, and gut-feeling wise I suspect I have to implement in-place construction to make it work, which means understanding the tloc mess, which is demotivating, which is why I wanted to get rid of that dead code in the ast for skenumfield, because the less code there is, the less I have to understand :)
15:30:28FromGitter<zacharycarter> @stisa - if I can help out in any way with the wasm backend please let me know!
15:30:34FromGitter<arnetheduck> ... it's nice and mergeable today btw: https://github.com/nim-lang/Nim/pull/7458
15:30:40FromGitter<zacharycarter> going to be busy for the rest of the day - but this evening I'm free
15:31:53FromGitter<arnetheduck> @stisa that's really cool, I have to check out yours :) fyi, I have a semi-working branch that spits out wasm as well, based on the llvm wasm target
15:32:06AraqI don't use 'for it in obj.sons'
15:32:15Araqplease use 'for it in obj'
15:32:45Araqbut you can do that later,
15:32:52AraqI'm merging it
15:33:09FromGitter<stisa> thanks @zacharycarter ! Sadly lately I'm pretty busy too, I'll keep it in mind for when I start working on it again
15:34:20FromGitter<arnetheduck> Araq, that sounds like something you can sed and fix without me going through the PR circus
15:34:38Araqyeah indeed
15:35:42FromGitter<arnetheduck> it's totally inconsistent throughout as well, so I have no basis for choosing one style over the other :)
15:35:53*Trustable joined #nim
15:37:01AraqI think I'm pretty consistent these days but it's amazing how much pas2nim'ed code still is in there.
15:39:41FromGitter<stisa> @arnetheduck don't expect too much 😄 and yeah, llvm -> wasm is probably a better path to follow, I just wanted to see if I could do it without any external lib
15:41:02FromGitter<arnetheduck> @stisa totally! much better way to pick up a good understanding of both nim and wasm at the same time :)
15:43:49FromGitter<arnetheduck> Araq, so just do it! and while you're at it, get a nice, clang-format-style-rule-based autoformatter to clean up the rest as well :) manually formatting code is *sooooooo* pre-1.0
15:44:13*Vladar joined #nim
15:44:55FromGitter<arnetheduck> porting python autofmt should be a breeze, since it already understands significant whitespace and all that :)
15:45:17Araqwhy would I port autofmt?
15:45:30AraqI have nimpretty
15:46:15Araqit's not far from working reliably, I have ideas of how to tackle the comment problems
15:47:11FromGitter<arnetheduck> `clang-format` works admirably, in large parts thanks to its weights-based algo, that `autofmt` reuses.. are you using the same?
15:47:53FromGitter<arnetheduck> er.. well, working reliably is kind of important, you know, in particular for a code formatter
15:50:30Araqweights-based algo?
15:51:02Araqnow I'm interested
15:51:39Araqgot some links handy?
16:01:34FromGitter<arnetheduck> hm. nothing really good, there's https://llvm.org/devmtg/2013-04/jasper-slides.pdf
16:03:33FromGitter<arnetheduck> but basically, it penalizes different formatting possiblities and spits out the one with the least penalty - that allows it to deal with tricky cases in a way that humans feel warm and fuzzy about, for example line breaking function arguments or dealing with very_long_names_in_the_wrong_place
16:05:33Araqok, nimpretty does break up long lines though.
16:05:36FromGitter<arnetheduck> it is absolutely stunning to watch when it gets introduced in any medium-to-large project - a) how much people say they're gonna hate it, b) how quickly people stop hating it, and c) how much less bickering there is in merge requests :)
16:06:08FromGitter<arnetheduck> yeah, but it's not just breaking them up, but doing so "intelligently", the way a human presumably would
16:06:23Araqwell you don't have to convince about the fact that a stream-of-bytes is a bullshit format for anything
16:07:19*gokr joined #nim
16:08:08FromGitter<arnetheduck> I think it's that last piece that makes people like it, that the code actually looks better than most people would come up with when carefully hand-formatting it.. it doesn't dogmatically line-break in a stupid and obnoxious way that wastes space
16:09:44FromGitter<krux02> Araq: well if you remove all state changing functions from the macros module, then your changes could work
16:10:21FromGitter<krux02> but I use ast mutation quite a lot, but for the most part just result.add ...
16:12:30FromGitter<krux02> I think nnkStmtList.generate: yield newLit(123); yield ... could be powerful enough to create all kinds of ast nodes without state
16:13:23Araqwell 'add' is special
16:14:43*sendell quit (Remote host closed the connection)
16:14:48FromGitter<arnetheduck> and in python, it's `yapf`, not `autofmt`.. and there's a nice description there as well: https://github.com/google/yapf#algorithm-design
16:15:29Araqwell I know dynamic programming algorithms.
16:19:26Araqon the other hand ... a tool that figures out the prevalent coding style and adapts the rest of the code is not the Unix way (TM). instead we should have a plethora of special comments at the start of the file and environment variables to store these settings ... :P
16:20:16FromGitter<zacharycarter> hrm... - You should use standard, unmanaged, non-garbage-collected C++. - does that mean no C++11?
16:20:42FromGitter<zacharycarter> like can I use - unique_ptr?
16:21:06AraqUnix is about broken tools that produce more broken tools when pipelined together. Intelligent tooling ... heresy.
16:21:21*gokr quit (Ping timeout: 264 seconds)
16:22:25Araqzacharycarter: unique_ptr is not GC.
16:22:34AraqC++11 is still without GC.
16:22:56Araqthey mean "no managed C++" which is Microsoft's extension
16:23:17FromGitter<zacharycarter> okay thanks
16:23:28FromGitter<zacharycarter> yeah I think the key is - avoid managed C++ and avoid STL
16:24:31Araqwhat? STL is fine
16:24:43Araqit even has "standard" in its name
16:24:44FromGitter<arnetheduck> Araq, you get that by adjusting the costs / penalties - that's another beauty of it, you don't need a lot of conditionals to deal with style differences, just a cost lookup table
16:24:49FromGitter<zacharycarter> it says further down don't use the STL
16:24:56Araqoh ok
16:25:12Araqarnetheduck: I wasn't serious.
16:25:35Araqthis tool should have as few knobs as possible. as it is about a consistent outcome.
16:25:49FromGitter<arnetheduck> I know, but you could have been ;) it's sadly not an uncommon position to have
16:27:53FromGitter<arnetheduck> and for whatever reason, people like their styles actually thinking one space-count is superior to the other.. if you intro it with the programming language from day 1, noone will want options, but if you have to deal with existing code-bases...
16:28:30FromGitter<krux02> Araq: when unix is about broken tools, what is windows then?
16:28:53Araqabout backwards compatibility so that you can sell commercial software for it.
16:29:38subsetparkYes, I would *love* a formatter with 0 options
16:32:08Yardanicobtw, I really started liking space count of two after discovering Nim :D
16:33:15FromGitter<krux02> Araq: I am not quite happy basically everything in strutils is a trap
16:33:57Araqthat's the nature of string handling.
16:34:24FromGitter<krux02> I think the strutils module should become deprecated :/
16:34:50subsetpark?
16:35:13Araqit never works, you think you want x.replace("$foo", "bar).replace("$bar", "foo") and then you figure out it's instead a multiReplace and then you figure you actually need multiReplace*Words*
16:35:46FromGitter<krux02> subsetpark: use quteString for anything and you will notice that it doesn't work, use cmpIgnoreStyle and you will notices that it doesn't work for nim identifier equality and so on and so on.
16:36:03FromGitter<krux02> it's just a bunch of legacy fuctions that sholud be avoided alltogether
16:36:03FromGitter<mratsim> what I’m confused about is the mix between pareutils and strutils ...
16:36:12FromGitter<mratsim> parse*
16:36:22Araqparseutils works much better :P
16:38:28Araqnot to mention that 'split' is not a tokenizer any compiler writer would come up with.
16:40:36Araqkrux02: come up with something better than strutils. :-)
16:41:24FromGitter<krux02> stritools, a much better name :P
16:41:56Araqcan't be that hard, you need some PEG like DSL for analysis and some subex like thing for synthesis.
16:43:13shashlickYardanico: I see you are keeping track of snip, did you have any feedback?
16:43:27Yardanicoshashlick, not really, I just have it in my watching list on github :)
16:43:59FromGitter<krux02> Araq: i am currently converting astspec.txt into ast pattern matching tests
16:44:11FromGitter<krux02> it's fun when things seem to work out
16:44:54shashlickNice, I use it all the time for quick tests, in fact was thinking of adding what araq asked about yesterday - download, extract and run snippets in GitHub comments
17:00:01*so quit (Read error: Connection reset by peer)
17:04:34miranis there an idiomatic way to "rotate" elements of an array? e.g. [1, 2, 3, 4, 5] to become [3, 4, 5, 1, 2]
17:10:07FromGitter<mratsim> I’m pretty sure there is a way with swap
17:10:26FromGitter<GULPF> @miran algorithm.rotateLeft
17:10:59FromGitter<mratsim> ah victory by KO :P
17:11:20miranGULPF: nice find, thanks!
17:11:35miranmratsim: swap is only to swap single elements, no?
17:11:53FromGitter<mratsim> swap in a loop: https://github.com/nim-lang/Nim/blob/master/lib/pure/algorithm.nim#L392
17:13:14miranbtw, rotateLeft vs rotatedLeft, to continue the discussion from the other day :)
17:15:42FromGitter<krux02> what is with rotateLeft?
17:16:05FromGitter<krux02> miran: I implemented it, if you mean that function in algorithm
17:16:30mirannothing with it, it is about mutating vs non-mutating versions naming conventions :)
17:16:42FromGitter<mratsim> this @krux02 :https://github.com/nim-lang/Nim/issues/7551
17:19:21FromGitter<krux02> well yea, I think think the m and the -ed are two different use cases
17:19:39FromGitter<krux02> one creates a mutable view, and the other one actually mutates
17:20:15FromGitter<krux02> @mratsim: mitems does not mutate anything
17:31:06*odc quit (Read error: Connection reset by peer)
17:31:18*odc joined #nim
17:50:07*d10n quit (Quit: why all the #hashtags #lol #hackers #overheard)
17:53:31*sz0 joined #nim
17:57:48*d10n joined #nim
17:57:48*d10n quit (Changing host)
17:57:48*d10n joined #nim
18:01:57miranFWIW, julia uses `!` to denote mutating version. so `replace` is non-mutating, and `replace!` is mutating
18:03:21AraqRuby does that too.
18:03:24*aguspiza quit (Ping timeout: 260 seconds)
18:07:46FromDiscord<treeform> Araq, thank you for merging my sql stuff.
18:08:00*vivus joined #nim
18:09:29*nsf quit (Quit: WeeChat 2.0.1)
18:12:08shashlickaraq: so how exactly did you want to use snippets in github issue comments?
18:14:48Araqwell to extract test cases out of these.
18:15:05Araqneeds some manual work too, of course
18:15:21Araqthe idea is to see which bugs out of the 'crashes' now don't crash the compiler
18:15:26Araqand to close these.
18:16:45Araqcrashes seem the easiest to start with as they have a clear "fixed" state. (The compiler should not crash.)
18:17:06vivusthat sounds too painful to automate, unless you have a certain format for the issues where the code is stored in ```my code``` style.
18:17:33shashlickat least the ones that do have clear code can be tested
18:18:24vivuswhat is the go-to lib/package for GUI programming?
18:19:46shashlickaraq: for all open issues where label = crash: find code snippets in all issue comments and run with latest devel. if not crash: flag for analysis
18:20:11Araqsomething like that, don't get overly ambiguous
18:20:36Araqwe have 100 crashes, if the tool asks me [good/bad] 100 times
18:20:46Araqthat is already much better than tool.
18:20:52Araq*than no tool.
18:21:15Araqsemi automatic is fine.
18:21:35Araqmuch better than me copy&pasting snippets from the browser
18:22:10shashlickokay give me some time, i'll get you something sensible
18:22:27YardanicoAraq, internal error is a crash too, right?
18:22:33Araqthanks, you rock. :-)
18:22:36AraqYardanico: yup.
18:22:49shashlickI could also enhance snip to make it easy on a per issue basis
18:22:59shashlicksnip URLtoIssueComment
18:23:42YardanicoI'll browse through some issues to add a "crash" label (not all crash issues have crash labels sadly)
18:24:01shashlickthat will help
18:24:37shashlickplus if folks can make sure they use ```nim for their code snippets instead of just ```, it will be easier to find as well
18:26:00miranYardanico: ah, i remember when you said (not that long ago): "oh, we should close some issues so we're under 1000 open ones" - now that looks like it will never happen again :)
18:26:21Yardanicomiran, :D
18:27:15Yardanicothere was much more activity in the issue tracker recently
18:27:17*pineapple0 joined #nim
18:27:46miran...and the number of people closing issues hasn't changed (much) :)
18:27:46*flyx quit (Quit: ZNC - http://znc.in)
18:28:13Araqthe number of PRs to the compiler has rarely been higher.
18:28:28Araqwhich makes me particularly happy.
18:28:55Araqit's not reflected yet in the number of fixed issues I guess, but more compiler devs are exactly what we need
18:29:25miranvery nice indeed
18:30:24mirani try to go through open issues periodically, but it seems all/most of low hanging fruits are fixed now
18:30:55dom96There are definitely more brave souls making changes to the compiler nowadays :)
18:33:07AraqI'm still not happy that I cannot effectively look at the issues without any filters
18:33:18Araqbut I don't know how to solve that.
18:33:28Araqa separate tracker for RFCs and feature requests?
18:34:28miransomething like https://github.com/nim-lang/needed-libraries ?
18:34:36Araqyeah
18:36:35dom96For RFCs yes, for feature requests no.
18:36:58shashlickthat could be solved as well - what views are you looking for
18:37:07Araqhuh? shouldn't it be the other way round?
18:37:16AraqRFCs are often language design problems
18:37:21Araqfeatures are just features.
18:37:35dom96Depends how we treat RFCs
18:37:55Araqshashlick: I usually look at bugs tagged with
18:38:00Araq- crash
18:38:00dom96We could formalise them which would up the barrier of entry to writing one
18:38:04Araq- high priority
18:38:09Araq- next release
18:38:12Araq- showstopper
18:38:15Araq- regression
18:38:17dom96I like having features in the main repo
18:38:28dom96I don't see what separating them into a different repo would accomplish
18:38:28Yardanicook, I've added crash labels to 7 more issues :P
18:39:04AraqYardanico: that's very kind of you but I want to discourage you from doing that.
18:39:48YardanicoAraq, why? :D
18:39:51FromGitter<krux02> Araq: that seems to me like a job for the github api and a few dirty unix tools
18:39:52Araqbecause better tooling would filter 'crash' in the title (and maybe 'ICE' and 'internal error') without any tags
18:40:04Yardanicoah, yes
18:40:06FromGitter<krux02> I mean the issues list
18:40:24*couven92 quit (Quit: Client disconnecting)
18:40:39FromGitter<krux02> just use the gh api and put all issues in a file, and then use grep
18:41:00Araqwell shashlick and data-man promised me something
18:41:07dom96So I thought I unmuted webchat but apparently not?
18:41:25dom96Reposting what pineapple0 wrote:
18:41:26dom96I'm having some trouble with an error (attempt to read from nil) and I can't figure out what's causing it, anyone got any ideas how I can debug this? Details here: https://pastebin.com/ijh185uL (I haven't been able to reproduce the problem in a simple way I'm afraid)
18:42:03FromGitter<krux02> Araq: you can review this https://github.com/nim-lang/Nim/pull/7585/files
18:42:30*dom96_w joined #nim
18:42:49shashlickaraq: so priority - issue crash tester vs. this?
18:44:07dom96well shit
18:45:51dom96_wtest
18:46:00dom96There we go
18:46:23Araqshashlick: well ... I'm not sure. just create something that would help *you* to close ~50 bugs in 30 minutes :P
18:46:46shashlickautomation is always a better first step :P
18:46:57shashlickokay, will look into that, shouldn't take too long anyway
18:47:32pineapple0test
18:48:05dom96Araq: pineapple0's issue is why making len(nil) for a seq "just work" is confusing :(
18:48:40dom96pineapple0: Sadly `echo` will not error out when it prints an uninitialised seq, it treats it as if it was empty
18:48:53pineapple0Ah I see
18:48:57pineapple0Yeah that is confusing
18:48:59FromGitter<krux02> dom96: the goal is to get to the point the seq are empty by default and can't be nil
18:48:59dom96So just init your seq
18:49:13dom96krux02: yes, well, that should have been done all at the same time then
18:49:25Araqthe only thing that is bad here is that 'nil' is a state for 'seq' IMO
18:49:44FromGitter<krux02> well I acutally tried to implement that. The problem. The GC goes all crappy then
18:49:51FromGitter<krux02> I have no idea why
18:50:02vivusI dont know if this is over-engineering, but for compiler failures, maybe a repo should store these as tests? that way, when the compiler is updated on the latest branch, some CI is running tests against this repo to see if the compiler errors still show up
18:50:09pineapple0So it is initialised like this: "myItems: seq[myItem] = @[]"
18:50:19pineapple0Is there some reason that wouldn't be running?
18:50:41dom96pineapple0: looks good, you sure it runs? Add an echo before it
18:50:52*dom96_w quit (Quit: Page closed)
18:52:04pineapple0Yeah echos either side of the init both show up
18:52:41dom96Show us more of your code then :)
18:53:26pineapple0Will do, let me clean it up a bit :)
18:54:54Araqkrux02: what is worse, I have no idea either. should probably look at it again.
18:55:02Yardanicoshashlick, ugh, it seems to be a real issue - you can't install snip (at least or linux) because snip binary has the same name as snip directory :)
18:55:08pineapple0Does `mySeq == nil` work? Adding "mySeq == nil" to the echo prints "false"
18:55:10YardanicoI mean `nimble install nimble install https://github.com/genotrance/snip
18:55:10Yardanico`
18:55:18pineapple0So it's not nil at that point right?
18:56:01shashlickYardanico: ya I need to post a new tag - nimble is trying to install from the latest tag rather than master
18:56:12Yardanicoshashlick, ah, forgot about that
18:56:15dom96nimble install snip@#head
18:56:20*flyx joined #nim
18:56:23shashlicklet me fix it right now
18:56:30dom96pineapple0: sounds right
18:56:44FromGitter<krux02> I think the most important changes are in the strutils comments: "should NOT be used to normalize Nim identifier names"
18:57:51FromGitter<krux02> Really every time I wanted to use a feature from strutils, it fired back on me.
19:01:36shashlickYardanico: done - v0.2.0 posted
19:02:17Araqvivus: I don't understand your remark. every thing I do to the compiler causes the CIs to re-run all the tests we have. and we have plenty.
19:03:28Araqwe never have enough tests apparently, but it's a solid development process.
19:05:55miranregarding issues: if we manage to close every issue opened by timotheecour - we're easily below 1000 again :D :D
19:06:36Yardanicomiran, true actually xD
19:11:53*SenasOzys quit (Ping timeout: 276 seconds)
19:12:57vivusAraq: these would be the failures opened as "issues" that are stored in another repo, eg. "user-failing-tests"
19:15:36FromGitter<krux02> hmm how do I quote a an expression that contains quotes?
19:16:03FromGitter<krux02> for example ``let ast = quote do: `+`(2,3)``
19:20:05FromGitter<krux02> the is an op argument for quote do, but I don't know the syntax to pass that argument
19:20:15FromGitter<krux02> do notation is really messy
19:20:28*SenasOzys joined #nim
19:21:19FromGitter<krux02> Araq: how do I change the quoting operator in ``quote do:``?
19:21:40FromGitter<krux02> I could not find a single instace anywhere, not even in the tests
19:23:49Yardanicokrux02: it's in the docs AFAIK?
19:24:06Yardanicoah, you wouldn't be able to do it with quote do probably
19:32:13*aguspiza joined #nim
19:34:07*nsf joined #nim
19:44:36Araqkrux02 I don't know
19:44:44AraqI use templates+getAst
19:44:59Araqbecause with templates I have control over .dirty vs non-dirty
19:45:23FromGitter<krux02> well the @ documentation must have some meaning?
19:45:42Araqvivus: we don't have failing tests.
19:45:59Araqor let's say, we don't want to have failing tests.
19:46:06vivusAraq: probably miscommunication.
19:49:02Araqyeah, we do have a collective bug report
19:49:19Araqthe bugs that a tool found
19:49:24Araqfor us.
19:49:43Araqthe only problem with it is: we don't need it, we have plenty of open issues :-)
19:54:16pineapple0dom96: I figured it out. What threw me off was the wording of this error: "Attempt to read from nil?" as the problem was the next line writing to an un-initialised ref-object result
19:56:55*rokups quit (Quit: Connection closed for inactivity)
20:10:46FromDiscord<geckojsc> this is the best readme I've ever seen https://github.com/2vg/mofuw
20:11:18mirani don't have to click the link, i know exactly what you're talkin about :)
20:12:14dom96pineapple0: Glad you got it figured out :)
20:16:12*pineapple0 quit (Quit: Page closed)
20:16:26FromGitter<krux02> Araq: I have a feature request unless you can provide a nice solution for it
20:16:45FromGitter<krux02> for pattern matching I would like to add arbitray conditions to the branches
20:16:56FromGitter<krux02> but it is a case of ast
20:17:25FromGitter<krux02> I don't know how I can put an if condition in the of branch
20:17:36FromGitter<krux02> naturally I would put it at the end
20:18:09FromGitter<krux02> of <pattern> if a > 7 and b < 2: echo yay the pattern did match
20:19:02FromGitter<krux02> http://ix.io/17CV
20:19:20FromGitter<krux02> in that example I would like to join the two else branches
20:19:42*vivus quit (Quit: Leaving)
20:22:33*miran quit (Quit: Konversation terminated!)
20:26:06*endragor joined #nim
20:26:41Araqkrux02: Haskell style, got it
20:27:15Araqyou can do that like 'of Pattern | guard' ?
20:28:23FromGitter<krux02> I can try it, but I have to leave the office now
20:30:10Araqsure thing
20:30:26*endragor quit (Ping timeout: 255 seconds)
20:30:51FromGitter<krux02> ok I tried it, `|` doesn't work
20:30:53FromGitter<krux02> of foo(bar) | a > b:
20:31:18FromGitter<krux02> is parsed as: ⏎ ``of ((foo(bar) | a) > b):``
20:32:12FromGitter<krux02> but I really have to go now
20:32:19FromGitter<krux02> will be back in 20 minutes
20:36:03*yglukhov quit (Remote host closed the connection)
20:36:21Araqof foo(bar) | (a > b)
20:36:39*yglukhov joined #nim
20:39:19FromGitter<alehander42> isn't `|` confusing? I think of binary or when I see it
20:41:28*yglukhov quit (Ping timeout: 260 seconds)
20:41:56FromGitter<alehander42> btw @krux02 why isn't your example
20:42:46FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5acfc4c6df3e0fb547cf72d1]
20:43:12FromGitter<alehander42> I think everything here should be expressable directly in the pattern
20:44:43FromGitter<alehander42> also how would you express
20:44:50FromGitter<alehander42> `of pattern or condition`
20:44:57FromGitter<alehander42> if you want to combine them
20:45:38FromGitter<alehander42> I think just using `and` and `or` would be best ⏎ ⏎ of `pattern` and/or conditions: (the macro knows that the first argument is special)
20:46:45FromGitter<alehander42> otherwise, ast-match starts looking good
20:47:16*Trustable quit (Remote host closed the connection)
20:47:59FromDiscord<geckojsc> so I found some dirty bindings for sdl-gpu ( https://github.com/fedkanaut/sdl-gpu-nim ) and I'm trying to update them with all the changes made to the library since then (thankfully not too many)
20:49:03FromDiscord<geckojsc> I was wondering what's the best way to translate typedef uintptr_t GPU_TextureHandle; to nim?
20:49:51FromDiscord<geckojsc> would I just do type GPU_TextureHandle* = pointer
20:53:07FromGitter<krux02> @alehander42 `stmt1` @ nnkLit(...) would not match
20:53:18FromGitter<krux02> stmt1 is in the genrated ast an identifier
20:53:52FromGitter<krux02> so `` `stmt1` @ nnkIdent("stmt1") `` would work
20:54:01FromGitter<krux02> but that is not the point
20:54:50FromGitter<krux02> I would like to have ``of `stmt1` @ nnkStmtList if stmt1.len > 7``
20:54:59shashlickaraq: what is "ICE" when you mentioned crash, internal error
20:56:23FromGitter<Varriount> shashlich: Internal Compiler Error
20:57:02shashlickcool
21:08:01*jaco60 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:16:32FromDiscord<geckojsc> man it's gonna take me a while to remember to put * to export functions :')
21:16:42*Vladar quit (Quit: Leaving)
21:17:31FromDiscord<geckojsc> oh shit I said function
21:17:46FromDiscord<geckojsc> man it's gonna take me a while to remember they're called procedures :')
21:22:34*xet7 quit (Quit: Leaving)
21:32:59dom96It's a synonym ;)
21:33:12dom96So "function" is fine too
21:41:12*yglukhov joined #nim
21:43:12FromDiscord<geckojsc> ah okay :)
21:45:57*yglukhov quit (Ping timeout: 265 seconds)
21:47:11FromGitter<mratsim> @krux02 You can change the quoting symbol for quote do, it’s documented
21:47:30FromGitter<mratsim> but you can’t use the quote do syntax in that case
21:47:53FromGitter<krux02> @mratsim ?
21:48:01FromGitter<krux02> can you give an equample?
21:49:44FromGitter<mratsim> https://nim-lang.org/docs/macros.html#quote,typed,string
21:50:35*nsf quit (Quit: WeeChat 2.0.1)
21:50:57FromGitter<mratsim> so ⏎ ⏎ ```result = quote do: ⏎ `+`(2,3) ⏎ do : “##”``` ⏎ ⏎ maybe [https://gitter.im/nim-lang/Nim?at=5acfd4c101a2b40f382ebb3b]
21:51:41FromGitter<mratsim> to change quote operator to # (which is probably a bad idea)
21:52:46FromGitter<krux02> http://ix.io/17Df
21:54:17FromGitter<krux02> @mratsim it doesn't compile
21:54:24FromGitter<krux02> not my example, not your example
21:56:49FromGitter<mratsim> mmm at least it’s not a quote issue :P
21:58:26FromGitter<mratsim> ```code paste, see link``` ⏎ ⏎ bug worthy @Araq ? [https://gitter.im/nim-lang/Nim?at=5acfd682012ff2bf681e6d5a]
21:59:50FromGitter<krux02> @mratsim that's a bug
22:03:05FromGitter<mratsim> https://github.com/nim-lang/Nim/issues/7589
22:03:26shashlickaraq: your github snippet tester is mostly ready
22:03:38shashlickwhat do you want the output to be?
22:04:30*mostly-harmless quit (Ping timeout: 256 seconds)
22:05:53shashlickwhat does "koch temp c" generate
22:11:14*mostly-harmless joined #nim
22:13:29*nixfreak quit (Ping timeout: 255 seconds)
22:17:41*vlad1777d joined #nim
22:21:54*smt quit (Read error: Connection reset by peer)
22:22:27*smt joined #nim
22:46:21FromGitter<zacharycarter> ugh stuck on the last question of my test
22:46:34FromGitter<zacharycarter> need to find the longest path through a 2d array representing a map w/ obstacles
22:46:40FromGitter<zacharycarter> A* and shortest path is simple
22:46:45FromGitter<zacharycarter> longest path not sure how to do
22:47:07FromGitter<krux02> longest path is actually quite uncommon
22:47:23FromGitter<krux02> but it is also not possible to have a fast solution for it
22:48:49FromGitter<krux02> I mean when you are allowed to run in circles, then the longest path in neither unique nor finite
22:53:09*aguspiza quit (Ping timeout: 264 seconds)
23:39:30*user1101 quit (Quit: user1101)
23:44:27*sputniksl joined #nim
23:46:29*sputniksl quit (Remote host closed the connection)
23:46:45*leorize joined #nim