<< 16-08-2018 >>

00:13:24*seni_ joined #nim
00:15:29*seni quit (Ping timeout: 248 seconds)
00:17:43AlexMaxGot a question. I have four sequences of different types of tuples, and two of those tuples need to refer to specific other tuples in the other sequences
00:18:11AlexMaxAnd some of the references need to be optional
00:19:23AlexMaxI was originally going to have the references be of type ptr, but I realized that maybe that isn't such a good idea
00:20:38AlexMaxin C++, an std::vector can invalidate references to individual elements if the vector is grown past its reserved capacity, and I'm assuming sequences do something similar?
00:26:23*maskedlua15 joined #nim
00:29:31*maskedlua15 quit (Remote host closed the connection)
00:38:28AlexMaxI found something weird with assigning to tuples in a sequence
00:38:57AlexMaxSyntax that I thought ought to work...doesn't
00:39:00AlexMaxhttps://paste.ee/p/0z14s
00:39:36AlexMaxI can populate a tuple in an array or sequence with a pointer, but I can't populate it with a nil
00:39:53AlexMaxWhy?
00:53:03*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
00:53:11*francisl quit (Quit: francisl)
00:56:05*vosper joined #nim
01:02:17*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:05:15*francisl joined #nim
01:05:57*cspar quit (Ping timeout: 240 seconds)
01:05:59*vosper joined #nim
01:07:46*mentifis20 joined #nim
01:09:01*mentifis20 quit (Remote host closed the connection)
01:09:24*wildlander quit (Quit: Konversation terminated!)
01:15:19*cspar joined #nim
01:26:51*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:41:12*Shinobi joined #nim
01:42:04*Shinobi quit (Remote host closed the connection)
02:01:34FromGitter<gogolxdong> which to use when gc:regions deprecated?
02:32:06*dddddd quit (Remote host closed the connection)
02:48:14AlexMaxOoo, found another oddity
02:51:34AlexMaxIf the tuple member is not nil
02:51:47AlexMaxvar side_c: SideWithNotNill = (sector: secp)
02:52:38AlexMaxwait, that...sorta makes sense I guess? secp isn't not nil
02:52:54AlexMaxThanks, not nil!
02:53:01AlexMaxfrom preventing me from making a terrible mistake
02:53:05AlexMaxfor
02:56:34AlexMaxActually I'm going to need to think about that part of the type system to see if it makes sense or not....in any case, my original confusion about nil still stands
02:59:18zacharycarter[m]is there any strong reason atm not to use the default GC? I keep hearing about destructors and RTTI patterns but I'm a bit confused as to where things are at presently on devel
03:01:29*vosper joined #nim
03:04:15*Sargun_ quit (Changing host)
03:04:15*Sargun_ joined #nim
03:04:19*Sargun_ is now known as Sargun
03:10:30zacharycarter[m]Varriount: Are you around?
03:10:55zacharycarter[m]@Varriount - maybe that works?
03:14:59AlexMaxooo!
03:15:08AlexMaxcast[ptr int](nil)
03:15:20AlexMaxI'm not invoking black magick here am I?
03:15:38*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
03:16:42*vosper joined #nim
03:16:53cow_2001what are some gamedev libs for nimlang? i see this https://github.com/VPashkov/awesome-nim#game-development
03:17:07zacharycarter[m]what do you want to do?
03:17:09AlexMaxI suppose that allows me to pass a typed nil to a tuple in a seq constructor
03:17:35AlexMaxBut I'm still not sure why Nim is smart enough to figure out the type of the nil outside the seq constuctor
03:17:39zacharycarter[m]there's nimgame
03:17:43zacharycarter[m]and then that's about it - but there's a lot of example game code out there
03:17:52AlexMaxseems like a weird inconsistency
03:19:00AlexMax...maybe casting the nil isn't the best thing to be doing, since the nim docs say it circumvents the type system
03:19:14zacharycarter[m]haha
03:19:33zacharycarter[m]probably why it works
03:20:19zacharycarter[m]um - so is it possible to have a binary package with nim that also acts as a library?
03:20:36zacharycarter[m]I've done the opposite - have a library that includes a binary
03:20:54zacharycarter[m]but never had a binary that also includes a library
03:21:09AlexMaxBut I'm not sure how to express a typed nil literal
03:21:28zacharycarter[m]I'm expecting the user to clone my project - and then create a folder in it and reference modules in my project
03:21:34zacharycarter[m]but I don't want them to have to use relative imports
03:21:59AlexMaxI'm not even sure what 123'u32 does
03:22:07AlexMax' is ungoogleable
03:22:21zacharycarter[m]I think I found the docs for that one time one sec
03:22:26AlexMaxbut it looks to me like a literal type annotation
03:22:47AlexMaxah, found it
03:22:49AlexMaxhttps://nim-lang.org/docs/manual.html#lexical-analysis-numerical-constants
03:22:50zacharycarter[m]AlexMax: it is but I think it's also omitable
03:22:56zacharycarter[m]in that situation
03:22:59zacharycarter[m]I think you can also do
03:23:02zacharycarter[m]`123u32`
03:23:16cow_2001hmm
03:23:16zacharycarter[m]AlexMax: do you know about play.nim-lang.org?
03:23:32AlexMaxIn any case, it doesn't seem like it applies to nil literals
03:23:43AlexMaxNo I don't
03:23:49zacharycarter[m]now you do
03:24:44*stefanos82 joined #nim
03:29:55AlexMaxzacharycarter[m]: master or 0.18?
03:29:59*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
03:30:29zacharycarter[m]I don't know when the last time I updated this thing was lemme see
03:30:42zacharycarter[m]I want to put up a new version where you can pull down a version of Nim at your choosing
03:30:52zacharycarter[m]but I have a lot of work to do on this thing - including writing a new web framework for it
03:30:58AlexMaxthe error...
03:31:00zacharycarter[m]for the frontend I mean
03:31:02AlexMaxseems....kinda truncated?
03:31:06AlexMaxin.nim(24, 31) Error: type mismatch: got but expected 'array[0..0, Side]'
03:31:18zacharycarter[m]it probably is
03:31:49zacharycarter[m]it's 0.18.0
03:31:58zacharycarter[m]!eval echo NimVersion
03:32:01NimBot0.18.0
03:32:19zacharycarter[m]I forget how this works
03:32:23zacharycarter[m]!echo NimVersion
03:32:40AlexMaxohn noooooooooooooooooo
03:32:47AlexMaxzacharycarter[m]: you naughty naughty boy
03:33:00AlexMaxyou're not escaping your HTML
03:33:02zacharycarter[m]?
03:33:21zacharycarter[m]on the playground website?
03:33:25AlexMaxhuh.nim(24, 31) Error: type mismatch: got <array[0..0, tuple[sector: nil]]> but expected 'array[0..0, Side]'
03:33:25zacharycarter[m]or where?
03:33:33AlexMaxthat's the _actual_ error
03:33:52AlexMaxthe browser is interpreting the unescaped < as the beginning of an HTML tag
03:34:10AlexMaxwhich is why the type is missing from the error output
03:34:14zacharycarter[m]are you typing this into the editor?
03:34:16AlexMaxYeah, from the playground website
03:34:22AlexMaxTake this
03:34:23AlexMaxhttps://paste.ee/p/0z14s
03:34:32AlexMaxPaste it into the playground
03:34:41AlexMaxcheck the error you get it
03:34:55*zacharycarter[m] sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/rylszoSIXoTQtzDsgaOwBXkl >
03:35:34AlexMaxYep, see how there's two spaces between "got" and "but"
03:35:41zacharycarter[m]`in.nim(24, 31) Error: type mismatch: got but expected 'array[0..0, Side]'`
03:35:55zacharycarter[m]yes so it got nothing
03:36:08AlexMaxno, this is what the error is actually supposed to say
03:36:13AlexMaxhuh.nim(24, 31) Error: type mismatch: got <array[0..0, tuple[sector: nil]]> but expected 'array[0..0, Side]'
03:36:30zacharycarter[m]in 0.18.0?
03:36:34AlexMaxYes sir
03:36:50leorize /urlselect
03:36:55leorizeoops
03:37:00AlexMaxYour browser interprets "<array[0..0, tuple[sector: nil]]>" as an malformed HTML tag
03:37:10AlexMaxSo nothing shows up in its place
03:37:13zacharycarter[m]Im not surprised - there are existing issues with the playground
03:37:57zacharycarter[m]https://github.com/zacharycarter/nim-playground-deprecated
03:38:44zacharycarter[m]actually
03:38:46zacharycarter[m]the bug is probably in
03:38:59AlexMaxAnytime unescaped HTML can be written into the page that is controlled by a user, it's a potential security issue
03:39:22AlexMaxSurely nim has an html escaping function
03:39:23zacharycarter[m]https://github.com/zacharycarter/nim-playground-frontend/blob/master/src/app.nim#L64-L82
03:39:29zacharycarter[m]it does
03:39:38zacharycarter[m]I'm pretty sure dom pointed this out to me
03:39:39zacharycarter[m]one sec
03:40:10zacharycarter[m]but erm
03:40:14zacharycarter[m]probably should take this to PMs
03:40:35*endragor joined #nim
03:52:04*meti4 joined #nim
03:56:47*meti4 quit (Remote host closed the connection)
04:00:26*vivus quit (Quit: Leaving)
04:09:32*seni_ quit (Remote host closed the connection)
04:20:28*vosper joined #nim
04:22:32*francisl quit (Quit: francisl)
04:28:06*vosper quit (Quit: Textual IRC Client: www.textualapp.com)
05:04:50*th3bmw joined #nim
05:06:30*th3bmw quit (Remote host closed the connection)
05:15:01*nsf joined #nim
05:38:16*miran joined #nim
05:44:42*iooner13 joined #nim
05:46:02*iooner13 quit (Remote host closed the connection)
05:49:00*cspar quit (Ping timeout: 272 seconds)
06:10:12*cspar joined #nim
06:10:34*vosper joined #nim
06:15:35*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
06:27:05*vosper joined #nim
06:48:11Araqso ... travis is red, here is the log https://api.travis-ci.org/v3/job/416588542/log.txt
06:48:19Araqwho can tell me where it failed?
06:53:49FromGitter<alehander42> reminds me of the legendary ERROR_SUCCESS
06:59:32cow_2001oh there's this https://vladar4.github.io/nimgame2/
07:25:55*ven473 quit (Read error: Connection reset by peer)
07:26:27*rdococ24 joined #nim
07:26:42FromGitter<mratsim> @cow_2001 pure Nim or wrapper counts because for wrapper you have Godot, Unreal Engine, Atomics, Urho3D. And for OpenGL UI: Imgui and Nuklear
07:28:24*rdococ24 quit (Remote host closed the connection)
07:30:03cow_2001I am an almost 100% newbie to game development.
07:30:27cow_2001I have been using golang's Ebiten for a little while
07:31:18cow_2001i don't know how to link nim to outside c/c++ libs yet. is it not that hard?
07:31:37cow_2001mratsim
07:32:04cow_2001do i need to put an at behind your nickname? @mratsim
07:32:28FromGitter<mratsim> yeah
07:32:30Tangercow_2001, https://gist.github.com/zacharycarter/846869eb3423e20af04dea226b65c18f#soloud
07:32:42Tangerzacharycarter does a pretty solid walkthrough
07:33:05TangerIf you have dominik96's Nim In Action, one of the sections is a complete explanation of wrapping parts of the SDL library
07:33:25FromGitter<mratsim> If you go at the bottom of this: https://nim-lang.org/features.html you have an example of how to wrap SFML in Nim
07:33:58FromGitter<mratsim> SDL is already available though nimble install sdl2.
07:35:03cow_2001so that's why there aren't many nimlang gamedev libs. all the libs needed are easily importable from c/c++ :|
07:36:41Tangercow_2001, No point in rebuilding the wheel if C already has an efficient and working version of the lib ;)
07:36:59cow_2001what's the most.. uhm.. nimlangable gamedev lib, then?
07:37:10FromGitter<mratsim> A gamedev lib is a lot of work as well. But you can check the repos of fats, he has a lot of minimal game engine that he used in Ludum Dare: https://github.com/ftsf
07:37:15cow_2001for 2d stuff
07:37:32FromGitter<mratsim> Maybe Vladar’s? I’m not really a game dev so :P
07:38:11FromGitter<mratsim> https://github.com/ftsf/nicohttps://forum.nim-lang.org/t/2730
07:38:26ldleworkI made a game library, http://dadren.github.io/
07:38:31ldleworkbut it has probably bitrot by now
07:38:40ldleworki made it in early nim version
07:38:44cow_2001this is rather exciting. i never really used c/c++ libs directly before!
07:38:47ldleworkbut it has some cool ideas
07:38:56FromGitter<mratsim> You can also check zacharycarter’s frag and zengine but AFAIK he is working on a new one: https://github.com/zacharycarter
07:41:16cow_2001first i need to follow through the nimlang tutorial… <_<
07:43:04FromGitter<mratsim> you can also check this one: https://narimiran.github.io/nim-basics/
07:44:11FromGitter<mratsim> And seems like this is getting some traction: https://exercism.io/tracks/nim
07:44:18cow_2001very nice of you all!
07:55:00*vosper quit (Quit: Textual IRC Client: www.textualapp.com)
07:58:43*PMunch joined #nim
08:02:16*yglukhov[i] joined #nim
08:03:38*gmpreussner joined #nim
08:05:10*gmpreussner_ quit (Ping timeout: 272 seconds)
08:09:44*yglukhov_ joined #nim
08:11:12*codevance[m] quit (Remote host closed the connection)
08:11:13*stisa[m] quit (Remote host closed the connection)
08:11:13*gh0st[m] quit (Read error: Connection reset by peer)
08:11:13*sendell[m] quit (Remote host closed the connection)
08:11:14*Miguelngel[m] quit (Remote host closed the connection)
08:11:16*bitstoppa[m] quit (Remote host closed the connection)
08:11:16*Demos[m] quit (Read error: Connection reset by peer)
08:11:16*yglukhov[m] quit (Remote host closed the connection)
08:11:17*pqflx3[m] quit (Read error: Connection reset by peer)
08:11:18*hitchhooker[m] quit (Read error: Connection reset by peer)
08:11:22*dyce[m] quit (Read error: Connection reset by peer)
08:11:23*endes[m] quit (Read error: Connection reset by peer)
08:11:24*SolitudeSF[m] quit (Read error: Connection reset by peer)
08:11:27*Connor[m]1 quit (Remote host closed the connection)
08:11:28*unclechu[m] quit (Remote host closed the connection)
08:11:29*GitterIntegratio quit (Remote host closed the connection)
08:11:30*toofly[m] quit (Remote host closed the connection)
08:11:30*narimiran[m] quit (Remote host closed the connection)
08:11:30*spymasterd[m] quit (Remote host closed the connection)
08:11:31*TheManiac[m] quit (Remote host closed the connection)
08:11:31*zacharycarter[m] quit (Read error: Connection reset by peer)
08:11:31*sg-james[m] quit (Remote host closed the connection)
08:11:32*petersjt014[m] quit (Remote host closed the connection)
08:11:32*xomachine[m] quit (Remote host closed the connection)
08:11:32*TheKing[m] quit (Write error: Connection reset by peer)
08:11:32*zielmicha[m] quit (Write error: Connection reset by peer)
08:11:32*macsek1911[m] quit (Write error: Connection reset by peer)
08:11:40*jaens[m] quit (Read error: Connection reset by peer)
08:12:35*yglukhov[i] quit (Ping timeout: 240 seconds)
08:12:36*yglukhov_ quit (Remote host closed the connection)
08:16:54*Yardanico quit (Ping timeout: 256 seconds)
08:18:59*hitchhooker[m] joined #nim
08:21:12*alphaseg26 joined #nim
08:22:29*alphaseg26 quit (Read error: Connection reset by peer)
08:30:04*Yardanico joined #nim
08:31:18*codevance[m] joined #nim
08:31:18*TheKing[m] joined #nim
08:31:18*yglukhov[m] joined #nim
08:31:18*dyce[m] joined #nim
08:31:19*Miguelngel[m] joined #nim
08:31:19*unclechu[m] joined #nim
08:31:19*pqflx3[m] joined #nim
08:31:19*Demos[m] joined #nim
08:31:20*bitstoppa[m] joined #nim
08:31:20*GitterIntegratio joined #nim
08:31:20*gh0st[m] joined #nim
08:31:25*sendell[m] joined #nim
08:31:25*zielmicha[m] joined #nim
08:31:25*toofly[m] joined #nim
08:31:26*endes[m] joined #nim
08:31:26*stisa[m] joined #nim
08:31:26*jaens[m] joined #nim
08:31:26*sg-james[m] joined #nim
08:31:26*narimiran[m] joined #nim
08:31:26*TheManiac[m] joined #nim
08:31:26*xomachine[m] joined #nim
08:31:26*macsek1911[m] joined #nim
08:31:27*SolitudeSF[m] joined #nim
08:31:27*petersjt014[m] joined #nim
08:31:27*zacharycarter[m] joined #nim
08:31:27*spymasterd[m] joined #nim
08:31:27*Connor[m]1 joined #nim
08:42:48*cspar quit (Ping timeout: 260 seconds)
08:46:07PMunchTaken from this it seems that all the work on error messages has paid off: https://sgoel.org/posts/nim-first-impressions/ :)
08:46:49*Pugabyte1012 joined #nim
08:51:09*Pugabyte1012 quit (Remote host closed the connection)
08:52:02*vosper joined #nim
08:54:18*vosper quit (Client Quit)
08:56:51*BitPuffin joined #nim
08:59:09pigmejhey guys after a while
08:59:20pigmejdoes anyone know any decent message queue lib for Nim ?
09:03:44PMunchDepends on what you need it for
09:04:03pigmejwell, I need pub-sub with topics
09:04:03PMunchThere are channels if you just want to communicate between threads
09:04:10pigmejno, I need multi server thingy
09:04:22pigmejno ack from client side required though
09:04:45pigmejHA is must have sadly
09:05:04pigmejbut I can do HA on on devops side too, so not critical.
09:05:30PMunchWell there is a wrapper for MQTT: https://sgoel.org/posts/nim-first-impressions/
09:05:33PMunchhttps://github.com/barnybug/nim-mqtt
09:05:36PMunchWoops, wrong link
09:06:27pigmejyeah but it seems to be outdated :(
09:06:43PMunchOh it's broken?
09:07:31pigmej3y ago last commit
09:07:50pigmejand sadly far from being complete
09:08:09PMunchThere's also this: https://bitbucket.org/mahlon/nim-stomp
09:08:54PMunchThis thing: https://makingspace.github.io/cittadino/
09:09:18pigmejhmmm
09:09:48PMunchMost of these seem a bit old though.. Nothing wrong with that though if they work
09:10:31*Vladar joined #nim
09:16:53pigmejthat's true, I'll check them
09:17:17pigmejmaybe somehow they are still working with recent nim
09:21:15*anticrisis joined #nim
09:22:34*andries15 joined #nim
09:25:03*anticrisis quit (Remote host closed the connection)
09:25:13*andries15 quit (Remote host closed the connection)
09:45:17PMunchIt's typically not a large feat to fix them if the only issues are version incompatibilities
09:57:14*erratic_ quit (Quit: this server has gone to sleep)
10:08:04FromGitter<Clyybber> u
10:08:43FromGitter<Clyybber> Sry disregard that, gitter on mobile is terrible
10:15:21*krux02 joined #nim
10:15:33krux02hello people
10:16:39krux02zacharycarter[m], you worked with bgfx, I can't compile it right now. But can you tell me what happens when I accidently misspell a Uniform in the cpp file?
10:17:29krux02is it like raw OpenGL that you get no feedback at all that you misspelled the uniform
10:23:57federico3https://nimble.directory/pkg/uibuilder nice
10:37:14PMunchfederico3, oh nice
10:41:02dom96hi guys
10:43:24PMunchHi dom
10:43:33PMunchhttp://ix.io/1klt/ <- bug or feature?
10:43:34*rokups joined #nim
10:44:03krux02feature
10:44:09krux02a weird one indeed
10:44:43PMunchSo it's intended to work like that?
10:44:43krux02you can use it to initialize several variables with a create proc
10:44:47krux02yes
10:44:59krux02var a,b,c = createFooBar()
10:45:04krux02and you have three instancing
10:45:12krux02and three calls to createFooBar()
10:45:16PMunchI mean I like the "var x, y = 3" thing, but when it's a proc I think it should be called only once
10:45:25*Guest59138 joined #nim
10:45:31PMunchvar head, tail = newNode()
10:45:33krux02no it really is intended like it works
10:45:55krux02yea, two new nodes
10:45:57PMunchThat would then instantiate one node and set it as the head and tail of a double-linked list
10:46:00krux02each individually allocated
10:46:13krux02don't use double linked lists
10:46:15PMunchHmm, I guess both ways has their pros and cons
10:46:25PMunchkrux02, of course. That was just an example
10:47:07krux02if you don't like it, then don't use this language feature
10:47:13krux02I don't like it
10:47:18krux02and I avoid it
10:47:30krux02but it can be used for iota like initializers
10:47:31PMunchI like it, just didn't know it was there :P
10:47:37krux02let a,b,c = iota()
10:47:55krux02where iota is returns 0 then 1, 2 3 etc
10:48:22krux02iota is an APL concept
10:48:36krux02and it got its way into golang to avoid implementing enums
10:49:51*Guest59138 quit (Remote host closed the connection)
10:50:12krux02iota is the greek i without the dot (ι)
10:50:46PMunchWhy don't they like enums?
10:52:12dom96Simplicity (TM)
10:53:54krux02in fact enums in C are not much more that constants that are initialized with a continuous sequence of ints
10:54:20krux02so I can understand that they say that this doesn't justify a language feature.
10:55:12krux02and the names generator can be generated by a code generator.
10:56:55krux02code generators in go can do a lot that macros do in Nim, but they are by far not as powerfull, because they are not as embedded in the build process as the macros in Nim, and they don't have the AST available, just the reflection library.
10:58:28*erratic joined #nim
11:04:00*Vladar quit (Ping timeout: 265 seconds)
11:05:55*dddddd joined #nim
11:13:50*miran quit (Ping timeout: 256 seconds)
11:18:56*Vladar joined #nim
11:27:09FromGitter<alehander42> that's one of the things that annoy me most about go
11:27:48FromGitter<alehander42> on the one hand, the language is simple, and then you have this weird ad hoc code generator substitute of a macro system
11:35:15*noonien joined #nim
11:49:13*xet7 joined #nim
12:07:56*NimBot joined #nim
12:12:17AlexMaxMorning. Gonna repeat some weirdness I found last night concerning seq/array types and tuples
12:12:20AlexMaxhttps://paste.ee/p/0z14s
12:12:50AlexMaxI was able to bypass the error by casting the nil to a type, but I'm not sure why the compiler can determine the type of nil in one case and not the other
12:13:12AlexMaxalso, i don't know if there's some way to annotate the nil type inline
12:14:50krux02AlexMax, you should use object, not tuple
12:16:22AlexMaxMaybe?
12:16:40krux02nil can be casteted to ptr Sector, but tuple[sector: pointer] cannot be casted to tuple[sector: ptr Sector]
12:17:09krux02(ptr Sector)nil
12:18:27krux02initializer lists from c++ have an advatge here
12:18:34krux02nim does not have initializer lists
12:18:56krux02it only has expressions that need to match the type on the left side of the assignment
12:21:33krux02sorry I was wrong, the tuple aparently can be casted, it is the array of the tuple that doesn't work
12:21:43AlexMaxYeah, _that_ was the weirdness I found
12:21:51AlexMaxThe tuple worked, but the array/seq of tuple didn't
12:22:00krux02but still you should be aware that (sector: secp) is not the same type as (sector: nil)
12:22:33krux02the tuple thing is just a very common use cas that has been hacked to work because otherwise there would be too many complaints
12:22:33AlexMaxYeah, I figured that out - raw nil doesn't have the type of the pointer that the other one does
12:23:22krux02raw nil isn't even of type pointer, it is it's own nilpointer type that can't be used in declarations at all.
12:23:29krux02I am not sure if I like that.
12:23:34AlexMaxWhy do both tuples and objects exist if they do almost the same thing?
12:23:35krux02(I don't like it)
12:23:45krux02they don't do the same thing
12:23:56krux02tuples are implicit types
12:24:03AlexMaxseems like the only thing a tuple gives you that an object can't do is that you can cast from similar tuple types
12:24:05krux02you don't need to declare them first
12:24:21AlexMaxoh yeah, that too
12:24:49krux02general rule of thumb, if you need a type declaration or want a type declaration, use object
12:25:22krux02you don't want that every tuple of two int32 is also a Sector
12:25:37krux02objects provide better type safety, because they are stricter
12:28:56AlexMaxShould I submit a bug about this Behavior I found
12:29:11AlexMaxOr is it one of those things that's unlikely to ever get fixed
12:29:45krux02there is no bug
12:30:00krux02this is all intended behavior, it is just a bit strange
12:30:24Araqit's "nominal" vs "structural" typing
12:30:34krux02but it isn't much of a problem when you learned how to use Nim effectively for your advantage
12:30:45Araqfrom a type perspective these are vastly different concepts
12:31:50FromGitter<mratsim> structural is “if it’s resemble a duck, then OK”, nominal “If you don’t say it’s a duck, it’s not"
12:36:19Araqno regressions yet :-)
12:36:46AraqI merged araq-misc 3 hours ago, still no reported regressions :P
12:37:18*miran joined #nim
12:39:21krux02what does araq-misc do?
12:39:47krux02I think it is weird that it is illegal to use the nil type.
12:39:56Araqso fix it
12:40:39krux02I thought that is was a design decision that you can't use the nil type.
12:40:43Araqstart with the spec that adds a new specialized type inference rule for type annotated consts
12:41:53krux02that is not what I mean
12:41:59AraqI'm tired of this "I feel like ..." nonsense, Nim has a spec. A terribly insufficient one, but a spec nonetheless.
12:42:17krux02I mean ``let myvalue = nil`` is a compilation error in nim
12:42:40krux02``echo name(type(nil))`` prints nil, so the type of nil is nil
12:43:00krux02but actually using the type like: ``var mynil: nil`` is illegal in nim
12:43:05krux02that is what I mean
12:43:20Araqthe type of 'nil' is actually 'type(nil)'
12:43:34Araqand not 'nil'
12:43:49krux02the nil type is very much like the ``Unit`` type in scala, it only has a signle value, and therefore may never contain actual information.
12:44:06Araqthe nil type is not 'nil', 'nil' is a value
12:44:18*Vladar quit (Ping timeout: 260 seconds)
12:44:18Araqthe nil type has no name but can be accessed via 'type(nil)'
12:44:31krux02well ``echo name(type(nil))`` prints nil
12:44:39Araqyeah, that's a bug :-)
12:44:59krux02I think that is a bug that can be fixed.
12:46:10krux02but still ``var mynil: type(nil)`` remains a compile error.
12:46:31Araqnot every type in Nim is concrete enough for variables
12:47:11Araqif I want a language where every nonsense compiles, I know where to find C
12:47:12*Vladar joined #nim
12:47:36krux02``i[ptr]``
12:48:55krux02I think allowing the explicit nil type could be very beneficial.
12:49:32krux02generic programming often creates non useful identifers with non useful values.
12:50:06krux02and here it is nicer if they are just optimized away (C compiler does that already) instead of being a compile error that the macros need to take care to avoid.
12:50:36Araqyeah, I'm familiar with the argument "it needs to compile because generic code"
12:50:37krux02but I can't name a specific use cane at the moment.
12:51:08*cryptocat1094 joined #nim
12:51:10Araqthat argument becomes convincing with convincing specific examples that are not pure sophistry
12:51:17krux02And I totally agree `let mynil = nil` is total nonsens in non generic code.
12:51:48Araqin C++ you can write 'return foo()' when foo returns 'void' because of "generic code".
12:52:24Araqstill I hesitate to copy this behaviour.
12:52:30krux02yea, but that void is much better handled in languages such as Scala.
12:52:44krux02Scala does not have void as a concep, because void is not a type
12:52:56Araqyeah, spare me this lecture please
12:53:12krux02so you know the Unit type?
12:53:32krux02I mentioned it already when I was still new to Nim
12:53:32Araqyes. And I know it's different from 'void' etc etc yadda yadda
12:53:51krux02it fixes the problems of void
12:54:07krux02explicitly, the problem that `void` is not a type.
12:54:20krux02and therefore needs "special treatment" everywhere.
12:54:36Araq'void' is a type without a value, Unit is a type with a single value
12:55:00krux02no void, is no type at all
12:55:22krux02`Nothing` is the type without a value
12:55:47krux02`Nothing` is like `void {.noReturn.}`
12:57:10Araqno, that's wrong, but I guess as usual, there are multiple conflicting definitions
12:57:43Araq'noReturn' is implicit for all types in an imperative PL.
12:57:54krux02the `Nothing` type is useful for `raise` and `quit`. So for example when you have a `case of` expression, and in the `else` branch you have a raise expression, the whole expression doesn't collapse to `void`
12:58:00Araqif I say proc (x, y: int): int it is allowed to not return at all.
12:58:16krux02yes
12:58:49Araqtypes are propositions about sets of values, the void type covers the empty set.
12:58:52krux02but noReturn doesn't mean that it is allowed to not return. It means it may not neturn at all.
12:59:25Araqand so 'void' is a perfectly fine type, no matter what you say about the control flow aspects that are not covered by the type system
13:00:30krux02but the void type is the reason that I can't use the the case of as an expression anymore, when I use `raise` in one of the branches.
13:01:08Araqseriously, you're living in the past. Nim allows for 'raise' in case expressions
13:01:18Araqand 'void' has nothing to do with it...
13:01:30krux02should I give you an example of what doesn't work?
13:01:46krux02I tested it recently
13:02:27*Fridtjof joined #nim
13:03:32Araqnah, I don't give a fuck. tomorrow you'll teach me about how Jai is so nicely designed because it only supports concrete types without type theory sophistry
13:03:39*ultrabong25 joined #nim
13:06:53krux02I never used Jai, so I don't know if it is nicely designed, but I am very interested in it.
13:06:54*Fridtjof quit (Remote host closed the connection)
13:08:24*ultrabong25 quit (Remote host closed the connection)
13:09:15krux02Araq: sorry aparently I did live in the past
13:09:26krux02my example does compile
13:09:34krux02I am surprised and happy
13:10:47Araqno worries
13:11:36krux02http://ix.io/1klY
13:11:38krux02yay
13:11:55krux02I know it didn't work that long ago
13:12:03krux02or my sense of time ise really bad
13:12:18Araqit should be in 0.18
13:27:46*francisl joined #nim
13:29:34*endragor quit (Remote host closed the connection)
13:30:08*endragor joined #nim
13:34:29*endragor quit (Ping timeout: 244 seconds)
13:36:11PMunchHmm, the Nim playground. Is it possible to run the compile function from another web-site?
13:37:12PMunchI'm toying with the idea of a "A tour of Go" thing for Nim. But to test it I need to be able to get the compilation thing working..
13:37:14krux02PMunch, why don't you customize your local editor to substitute Nim playground for you?
13:37:43PMunchWhat do you mean?
13:37:52krux02ok tahta is a good use case
13:38:16krux02for example I bound a key in my emacs to open up a Nim file in the temp folder for me.
13:38:17FromGitter<alehander42> a tour of Nim would be very nice
13:39:12dom96PMunch: yes, see how NimBot does it
13:39:14FromGitter<alehander42> but how would the repl feel work?
13:39:39FromGitter<alehander42> ah tour of go uses whole programs
13:39:53krux02Nim has no official repl (I know the secret)
13:40:14FromGitter<alehander42> :D I know, just a lot of the "tour of x"
13:40:19FromGitter<alehander42> i've used were web repl-s
13:40:27FromGitter<alehander42> and I totally forgot the go version
13:40:43FromGitter<alehander42> i use nim secret from time to time, and i am proud
13:40:50PMunchdom96, yeah I looked at that. But that's from one server to another
13:40:59PMunchDoing it through JS is a bit trickier
13:40:59FromGitter<alehander42> inim is actually nice too
13:41:02PMunchBecause of CORS
13:41:23FromGitter<alehander42> can't you host a new instance of the playground server code?
13:42:19FromGitter<alehander42> or maybe dom can give you a subdomain of nim-lang
13:42:24FromGitter<alehander42> tour.nim-lang.org
13:42:26PMunchYeah I could..
13:42:39FromGitter<alehander42> and than the cors wouldn't be a prob?
13:42:44PMunchtour.nim-lang.org is obviously the end goal here
13:43:08FromGitter<alehander42> well while it's in development, you'll need a local playground anyway (I guess ?)
13:43:10Araqalehander42: what did devel break? fp...?
13:43:17dom96You could proxy it as a workaround
13:43:18Araqand on what OS to reproduce?
13:44:14FromGitter<alehander42> @Araq are you mentioning the wrong user? I haven't tried devel today :D
13:45:01PMunchdom96, oh yeah that could work
13:45:42Araqno, you said the recent GC changes introduced new crashes
13:45:47FromGitter<alehander42> aaaaah
13:45:51FromGitter<alehander42> I found out the reason!
13:46:13FromGitter<alehander42> I was doing just a single `old_nim compile new_nim` thing, and when I compiler new_nim with new_nim it all worked
13:46:29FromGitter<alehander42> that's why it worked with nimd: because i usually compile it with new_nim anyway
13:47:02Araqno idea what you're saying. everything fine now?
13:48:02FromGitter<alehander42> so sorry, my fault
13:48:33FromGitter<alehander42> well, what `koch` does is: it builds nim with the existing nim compiler, and then it does it again, right?
13:48:46FromGitter<alehander42> but I started doing just the first part, because it's 1faster
13:49:16FromGitter<alehander42> and obviously here I did hit a bug, that happens when you build the new nim version with an older nim compiler
13:49:43FromGitter<alehander42> and it doesn't happen when I build it with *itself*
13:53:18*marig joined #nim
13:57:38*marig quit (Remote host closed the connection)
14:10:19Araqyou need to do a full bootstrap otherwise something weird may happen
14:10:26Araqas the internals changed quite a bit
14:10:51Araqusually it's not necessary but for the upcoming v0.19 we have so many changes...
14:11:49FromGitter<alehander42> yeah exactly
14:11:59FromGitter<alehander42> when is 0.19 expected?
14:14:19Araqtomorrow but we won't make it
14:14:48FromGitter<alehander42> oh well I expected the autumn :D
14:14:51FromGitter<alehander42> awesome
14:15:03FromGitter<alehander42> i have to try to get my js sourcemaps in for 0.20
14:17:17Araqoh hmm ok
14:17:26*wildlander joined #nim
14:22:13FromGitter<alehander42> :D where is help most needed for the next version?
14:24:05FromGitter<kaushalmodi> @alehander42 I would think.. Documentation, improving accessibility to more folks.. like creating "A tour of Nim" idea that PMunch presented above, etc.
14:27:26Araq0.19 is not about that polish, it's the Nim that removed 'nil' from strings and seqs, removed a couple of features, introduced others
14:28:03Araqand we expect to release 0.19.2 soon after it because of the massive amount of changes
14:29:24AraqPMunch, btw devel has case statement macros for your pattern matching experiments, but please don't add that to Options.nim, it should be a new module with experimental stuff
14:31:39FromGitter<Clyybber> What are the benefits of removing nil for strings and seqs?
14:32:33PMunchcase statement macros?
14:34:04AraqClyybber: fewer 'nil' dereference bugs, cleaner APIs
14:34:23FromGitter<Clyybber> Hmm nice
14:34:42FromGitter<data-man> @PMunch: https://gist.github.com/Araq/169d1e24b2b996d024a780ef6a4e6c09
14:34:46FromGitter<Clyybber> and also the ability to += on empty strings i guess?
14:35:24Araqit's usually spelt 'add' but yes
14:35:45FromGitter<Clyybber> Cool!
14:36:17FromGitter<Clyybber> I guess this really plays well with the implicit result variable
14:38:59FromGitter<alehander42> @Araq is the not nil support lacking/planned to improve? i'd like to fix some issues there if there are any , i remember i had problems with it
14:39:28Araqit's now .experimental and I'm not sure it really can be fixed
14:39:45Araqthe problems with e.g. Table[] are pretty severe
14:40:18FromGitter<kayabaNerve> Hmm? Table has problems or the radical 0.19 changes don't work with Table yet?
14:40:24dom96+=? no, that would be `&=`
14:41:05AraqkayabaNerve Table has problems with types that are annotated with 'not nil'
14:41:08FromGitter<Clyybber> dom96
14:41:14FromGitter<Clyybber> 'add' it is then
14:41:16FromGitter<Clyybber> :P
14:41:26FromGitter<kayabaNerve> Got it
14:41:42FromGitter<alehander42> @Araq only with table? or with all kinds of generic collections?
14:41:44FromGitter<alehander42> bizarre
14:42:28PMunchdata-man, interesting
14:42:37PMunchDid you look at TOML 0.5.0 by the way?
14:43:40*threeFifths joined #nim
14:44:05FromGitter<kaushalmodi> `strfmt` breaks again because of the string not allowed to be nil change on devel
14:44:07FromGitter<kaushalmodi> https://github.com/kaushalmodi/strfmt/blob/master/strfmt.nim
14:44:45FromGitter<kaushalmodi> Hopefully replacing `nil` with `""` would work.. but not quite sure. How would the library distinguish between that string parameter "not being set" vs set as "" by user?
14:44:58*threeFifths quit (Killed (Sigyn (Spam is off topic on freenode.)))
14:45:02FromGitter<kayabaNerve> Use a ref string?
14:45:05FromGitter<GULPF> Option[string]?
14:45:26FromGitter<kaushalmodi> hmm.. need to look into that. Would someone be kind enough to submit a PR?
14:45:43FromGitter<alehander42> @Araq and how easy would be to improve nil type safety for ref types, e.g. to catch those cases https://github.com/nim-lang/Nim/issues/7248
14:46:20FromGitter<alehander42> is it something that a contributor like me would be able to handle?
14:49:11FromGitter<data-man> @PMunch: Yes :) https://github.com/NimParsers/parsetoml/issues/22
14:49:17FromGitter<kaushalmodi> @kayabaNerve I am not familiar with ref string. Or how that would solve this problem.
14:50:33Araqkaushalmodi: I actually looked into it and you need to use Option[string] for it
14:50:50FromGitter<kaushalmodi> @GULPF I have read about Options module in passing, but not yet used it. I have to yet read the blog post on that by @PMunch. If either of you have a chance, can you please provide a PR to strfmt? If not, I am tracking this in an issue in that repo to get to it at some point.
14:51:28FromGitter<kaushalmodi> Araq: That sounds like a plan. Learning the options module is on my list
14:52:19Araqalehander42: it's mostly just Table and related collections
14:52:52Araqbecause it uses a seq under the hood und sizes it to a power of two
14:53:26Araqand that seq has default(T) values in it, but default(T) is what does not exist for T = ref U not nil
14:54:27FromGitter<kayabaNerve> @kaushalmodi I wrote you the code for it
14:54:41FromGitter<kayabaNerve> https://gist.github.com/kayabaNerve/0dacec555afd8e216662b8df5181c42c
14:54:42Araqthe table could use seq[Option[T]] instead of seq[T] but it would be quite a change
14:55:29FromGitter<kayabaNerve> I just left a comment with the output
14:55:50FromGitter<kaushalmodi> @kayabaNerve Thank you.
14:55:54FromGitter<kayabaNerve> Araq is `ref string` too low level for your taste? :P
14:56:19Araqno, it's slower than Option[string]
14:56:38FromGitter<kayabaNerve> a is not nil before new(a); a is Nil after.
14:56:43FromGitter<kayabaNerve> Really? Good to know
14:56:58FromGitter<kaushalmodi> @kayabaNerve It is using `cast`, which from reading the manual says that should not be used
14:57:09Araqand it's also wrong, just because it can be nil/None doesn't mean that you have aliasing
14:57:26Araq'ref' is about aliasing.
14:57:42FromGitter<kaushalmodi> I'll stick with Options, as it has been on my list.
14:58:00FromGitter<kaushalmodi> It allows a var to be "tri-Boolean".. if that even makes any sense :)
15:01:43krux02some(true), some(false), none
15:02:18krux02for for that I think I would define an enum with three states
15:03:12FromGitter<kaushalmodi> Araq: Does this look right? https://ptpb.pw/4STK/nim
15:03:40krux02it does
15:03:54FromGitter<kaushalmodi> I'm bugged that it's outputing: ⏎ ⏎ ```None[string] ⏎ Some("") ⏎ Some("abc")``` [https://gitter.im/nim-lang/Nim?at=5b75925aa3a93d242272add5]
15:04:19FromGitter<kaushalmodi> Can I open an issue so that `$` for options uses double-quotes for strings?
15:04:51Araqah it's covered by PMunch's PR
15:04:55krux02yea can create a PR to patch it
15:05:02krux02is it?
15:05:05krux02ok then not
15:05:05Araqwhich sadly does too much weird stuff :-)
15:05:16krux02well then you have a chance again
15:05:44Araqkrux02: go for it
15:05:51krux02kaushalmodi: generally you have to use the `addQuoted`
15:06:33FromGitter<kaushalmodi> OK.. I can work on it. PMunch, are you fine with that?
15:07:08FromGitter<kaushalmodi> krux02: Thanks for that hint.. I am not sure how it would work.. but will grep for existing uses of `addQuoted`
15:07:58PMunchWhat is covered by by PR?
15:08:04PMunchI removed most of the weird stuff :)
15:09:07FromGitter<kaushalmodi> PMunch: OK, I will hold off on this proposed PR then
15:09:17FromGitter<GULPF> doesn't look like it was changed: https://github.com/nim-lang/Nim/pull/8358/files#r203996796
15:09:19PMunchOh, I don't think I did anything with the string representation of options
15:09:47Araqit's still not good enough :-) I'm sorry, but it feels like you read some blog post and tried how far Nim can pushed with this new paradigm
15:10:03Araqand that's fine, but that's nothing for the stdlib
15:10:24Araqthe stdlib needs tried and battle-tested stuff
15:10:37PMunchI can see how the original PR had a bit too much stuff in it
15:10:43FromGitter<kayabaNerve> @kaushalmodi I only used cast to print the memory address. You can directly compare it to nil. Araq is right though that the value it's set to can be nil, so this kinda solves it but doesn't really.
15:10:53PMunchBut the latest revision pretty much only adds .?, require, and some wrapper macros
15:11:36FromGitter<kayabaNerve> This is a stupid question I'm asking for absolute certainty. If I have a ref object A, which contains two ref object Bs, and I define the 2 Bs and the construct A, there's no copying going on there, right?
15:11:58AraqI happen to dislike .? though, 'require' feels misnamed and I don't want options.nim to be 900 lines long
15:12:15PMunchWhy don't you like .?
15:12:18FromGitter<kayabaNerve> Double checking because if that does do any copying I am kinda screwed over and need to move on to raw pointers.
15:12:22PMunchIt's practical
15:12:29dom96I'm pro-`.?`
15:12:41PMunchAnd how is require misnamed? It requires that all the options have a value
15:13:19AraqGulpf, ok, my bad
15:13:35PMunchAnd it's only some 700 odd lines, most of which is tests and documentation..
15:14:17PMunchThe require macro is only 73 lines
15:14:29AraqI can write an Option[T] in 5 lines
15:14:47Araqand everything else might not be required so could live in optionutils
15:15:06Araqand yes, I know you didn't write options.nim
15:15:57Araqbut it's getting out of control
15:16:04dom96I'm unsure about `require`
15:16:10dom96also seems like a weird name to me
15:16:22Araq'require' should be 'allSome' or something better
15:16:27PMunchWhat would you call it then?
15:16:35PMunchHmm, I guess allSome works
15:16:39Araqthe value is called 'Some' vs 'None', you want them all to be some
15:17:03krux02https://github.com/nim-lang/Nim/pull/8659
15:17:18PMunchI can add it to optionutils if you want
15:18:15PMunchJust seems a bit odd since string and seq is part of system and has their *utils modules to keep things like this in. But options is already a module by itself. Now options would have two modules..
15:19:40krux02PMunch, the options.nim file is already too bloated with crap that I would never want to use
15:20:45FromGitter<kaushalmodi> Sorry, an interjection.. If I want to set an `Option[string]` value, I always need to do `some("value")`?
15:20:55Araqyes
15:20:56krux02with optionutils the crap is decoupled from the option type
15:21:01FromGitter<kaushalmodi> ok
15:22:59Araqand indeed, it's kinda bad that strings and seqs live in system
15:23:19Araqand I avoid sequtils already and 50% of the stuff in strutils is unnecessary
15:23:31PMunchOkay, so should I move the stuff I've added, along with the map and filter stuff that was there from before into optionutils?
15:23:39PMunchAnd rename require to allSome?
15:23:45*francisl quit (Quit: francisl)
15:23:48Araqfine with me
15:23:57krux02
15:23:59PMunchI tend to use sequtils and strutils pretty much everywhere
15:24:10PMunchWell, not everywhere. But I import them a lot
15:24:56*brand05 joined #nim
15:25:04krux02well what are you actually using
15:25:08krux02and what did you never ues?
15:25:41krux02I think `zip` is pretty useless, because it is not an iterator
15:26:13krux02cycle is also useless
15:26:28PMunchOh yeah, there is a lot of stuff in there that I don't use all the tie
15:26:41PMunchBut it's nice to have so you don't have to implement your own if you need it
15:27:41krux02the problem is that these fucntions are better to be avoided
15:27:49krux02but still they are omnipresent
15:28:05*brand05 quit (Killed (Sigyn (Spam is off topic on freenode.)))
15:29:18FromGitter<kaushalmodi> so.. I am ending up having to add a lot of `get` and `some` to convert a nil-using code to Option[string]
15:29:21FromGitter<kaushalmodi> sounds right?
15:29:25krux02distribute, even worse
15:29:44Araqkaushalmodi: Only one field is affected iirc
15:30:08FromGitter<kaushalmodi> there are 2 fields
15:30:49FromGitter<kaushalmodi> here's the diff so far: https://ptpb.pw/8wq-/diff
15:30:54FromGitter<kaushalmodi> not yet tested or finished
15:31:00Araq'arysep' is the only where nil vs "" makes a difference
15:31:10krux02one question you should also really ask yourself is, do you really need an option[string]
15:31:19krux02isn't just string enough?
15:31:44FromGitter<kaushalmodi> see https://ptpb.pw/8wq-/diff#L-43 (I have to replace "" with some(""))
15:31:54krux02is this nil vs "" difference really that important
15:32:05Araq'fill' doesn't distinguish between nil and ""
15:32:36FromGitter<kaushalmodi> Araq, krux02: hmm, ok. let me try removing Option for fill
15:32:37FromGitter<kaushalmodi> thanks
15:33:36FromGitter<kaushalmodi> though, the fill refactoring was ok
15:33:39PMunchHmm, slight issue
15:33:44FromGitter<kaushalmodi> the arysep refactoring gets a bit crazy
15:33:55PMunchThe helpers use variables that are hidden in options
15:33:57FromGitter<kaushalmodi> https://ptpb.pw/8wq-/diff#L-115
15:34:39PMunchSo I need to `include` the options module
15:35:03Araqthe helpers can use the accessors instead
15:35:11Araqthe accessors must stay in options.nim
15:36:59*lmartin9212 joined #nim
15:37:14krux02why dos arysep be an option[string]?
15:39:50Araq if fmt.arysep == nil:
15:39:50Araq sep = "\t"
15:39:51Araq elif fmt.arysep == "":
15:39:53Araq sep = ""
15:39:55Araqthat's why.
15:40:09*lmartin9212 quit (Remote host closed the connection)
15:40:39krux02isn't it better to initialize arysep with "\t" instead, when it is not set explicitly?
15:41:02Araqmaybe but I only skim over these things :P
15:41:58krux02I mean precision is also something that shouldn't be 0 by default
15:45:04FromGitter<kaushalmodi> krux02: I am none the wiser. Would you like to fix this in a better way without using Option?
15:45:33FromGitter<kaushalmodi> btw while refactoring, I came across this another piece using nil in strfmt: https://ptpb.pw/D6AR/nim
15:45:53FromGitter<kaushalmodi> It uses `newNilLit` and `newLit` which is new to me
15:46:14Araqresult = if s == nil: newNilLit() else: newLit(s)
15:46:16Araq-->
15:46:21Araqresult = newLit(s)
15:46:53*Trustable joined #nim
15:47:00FromGitter<kaushalmodi> Araq: Thanks. That was my best uneducated guess as s now won't ever be nil
15:47:23krux02that is the point of it
15:47:53krux02get rid of all the `if s == nil` special case handlings
15:48:09AraqI only guessed it too, but the tests will tell us and if it's not covered by tests it's an edge case nobody cares about
15:48:43krux02I wouldn't go so far
15:48:55krux02not everything that people care about is in the tests.
15:49:00FromGitter<kaushalmodi> ok, I ended up with this: https://github.com/kaushalmodi/strfmt/commit/8fb457c2de0995b5f7b4e4af68967b21530409bd
15:49:13FromGitter<kaushalmodi> it still fails compilation and is out of my "zone" as I don't understand macros
15:49:24Araqstrfmt has extensive tests
15:49:26FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b759d062a4b1910f5e5d852]
15:52:19krux02don't use Opition for arysep
15:52:52Araq# literal format string, precompute the format data
15:52:53krux02initialize arysep with "\t" in DefaultFormat
15:53:22Araqyou need to adapt this code, you need to precompute the format data differently for an Option
15:53:24krux02and whenever you would set aryformat to None, set it to "\t" instead
15:53:24FromGitter<kaushalmodi> krux02: OK, but I think this compilation error is unrelated to that?
15:53:29Araqbut krux02's solution seems easier
15:53:35FromGitter<kaushalmodi> ok
15:53:47FromGitter<kaushalmodi> will try the default to `\t` suggestion
15:53:48FromGitter<kaushalmodi> thanks
15:54:43Araqand remove the 'try finally: discard'
15:54:46krux02you might want to introduce a constant and call it default separator
15:54:58krux02that would be more "normalized"
15:54:59Araqstarting in line 766
15:55:04krux02but that is up to you if you want that
15:57:34krux02line 222, you can initialize here with: ``result.arysep = DefaultFormat.arysep``
15:57:45krux02that is super duper normalized and very readable
16:01:15FromGitter<kaushalmodi> krux02: Your suggestion (`\t`) worked, but I didn't get your later normalization tip.
16:01:18FromGitter<kaushalmodi> Thanks!
16:01:35FromGitter<kaushalmodi> I'll commit what I have right now and revisit your optimization point later.
16:03:26*francisl joined #nim
16:03:35*PMunch quit (Quit: Leaving)
16:04:10*nsf quit (Quit: WeeChat 2.2)
16:04:42krux02can you show your diff?
16:06:14*Vladar quit (Remote host closed the connection)
16:06:24krux02Araq: I think its strange, there is this test that tests the string repr of Option[string], and there it is obvious that the string isn't quoted, but nothing has been done about this
16:06:59Araq$ used to not quote, now it does
16:07:17Araqpreviously it was consistent, than we patched it and forgot options.nim :P
16:07:22FromGitter<kaushalmodi> krux02: https://github.com/kaushalmodi/strfmt/commit/d25e175dc35098b653aec33b151b252699fe36c2
16:07:48FromGitter<kaushalmodi> `nimble test` passes
16:09:19krux02kaushalmodi: ``if arysep == '\t': sep = '\t' `` really?
16:09:42FromGitter<kaushalmodi> sorry :P
16:09:49FromGitter<kaushalmodi> I just wanted to get back to work
16:11:39krux02how about: if fmt.arysep.len <= 1: sep = fmt.arysep else: ...
16:12:07FromGitter<kaushalmodi> you'd also need to handle the len==0 case separately
16:12:11krux02well, sorry no that doesn't work
16:12:16FromGitter<kaushalmodi> it's an if..elif..else construct
16:12:36FromGitter<kaushalmodi> so what I did worked the best after trying few hasty optimization
16:12:57krux02yes, but the "\t" case isn't a special case anymore
16:13:27FromGitter<kaushalmodi> it's the default case now
16:13:47FromGitter<kaushalmodi> so if it is already `\t`, the else: block shouldn't be entered
16:14:03krux02I mean it will be handled by the else branch
16:14:24*Vladar joined #nim
16:14:27*Jesin quit (Remote host closed the connection)
16:14:51FromGitter<kaushalmodi> I tried removing the \t case altogether, but fails the "arrays of arrays" test
16:14:51krux02I even think the fmt.arysep.len == 0 is the same on the else branch
16:14:59FromGitter<kaushalmodi> I did not have time to investigate it further
16:15:27FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b75a31f988005174eea2be2]
16:15:42krux02well year for me the code smells a lot
16:15:45krux02but it's not my code
16:16:33FromGitter<kaushalmodi> Not mine either, but the original dev knew a lot more Nim than I do. I'm just trying to keep that library alive
16:17:57krux02are you sure this test is correct: ``[[1, 2, 3], [4, 5, 6]].format("") == "1\t2\t3\t4\t5\t6"``?
16:18:26krux02I don't think so
16:18:49*natrys joined #nim
16:22:13FromGitter<kaushalmodi> krux02: No idea.. that test was already there.. so was there by design I suppose?
16:23:09krux02pleas think
16:23:17*Caraway22 joined #nim
16:24:45*Caraway22 quit (K-Lined)
16:25:21*tersec_ quit (Read error: Connection reset by peer)
16:30:23FromGitter<kaushalmodi> hmm.. yeah, empty format should have produced `$` representation of the input.
16:30:35FromGitter<kaushalmodi> This library was written before the `$` got improved
16:31:04FromGitter<kaushalmodi> Earlier `echo [1, 2, 3]` produced `"123"`.
16:31:25FromGitter<kaushalmodi> So the original strfmt probably wanted to make it better by spacing out the array elements
16:31:31FromGitter<kaushalmodi> using `\t`
16:31:38miranit produced an error, IIRC
16:32:00FromGitter<kaushalmodi> Yeah, don't remember the details
16:32:02miranyou couldn't echo an array (again, IIRC)
16:32:11FromGitter<kaushalmodi> but all I know was that echo was unusable for arrays, seqs
16:33:51FromGitter<kaushalmodi> sorry, I take that back. The issue was something else
16:34:27FromGitter<kaushalmodi> I meant this issue: https://github.com/nim-lang/Nim/issues/6225 but it's a different thing
16:35:32FromGitter<kaushalmodi> So.. in Python empty `format` uses the object `__repr__`. Here the original author for some reason thought of depicting array elements as tab-separated, which isn't accurate either.
16:35:44FromGitter<kaushalmodi> I'll open an issue on my fork to track this.
16:36:57FromGitter<kaushalmodi> For anyone interested, fixing this: https://github.com/kaushalmodi/strfmt/issues/4 is up for grabs :D
16:44:48*Jesin joined #nim
16:50:47FromGitter<kaushalmodi> May be a simple options example like this is useful in the stdlib docs? https://scripter.co/notes/nim/#nil-string
17:04:24*seni joined #nim
17:06:34*cspar joined #nim
17:06:40*Trustable quit (Remote host closed the connection)
17:09:37*cryptocat1094 quit (Ping timeout: 260 seconds)
17:11:26*cryptocat1094 joined #nim
17:12:00*natrys quit (Quit: natrys)
17:12:40*hvxgr6 joined #nim
17:14:59*gamma7 joined #nim
17:15:18*Algernop15 joined #nim
17:16:52*hvxgr6 quit (Killed (Unit193 (Spam is not permitted on freenode.)))
17:19:03*Algernop15 quit (Remote host closed the connection)
17:19:35*gamma7 quit (Remote host closed the connection)
17:22:26*musician_pro joined #nim
17:23:07*musician_pro quit (Remote host closed the connection)
17:37:33*vosper joined #nim
17:40:56*cryptocat1094 quit (Quit: WeeChat 2.2)
17:41:08*cryptocat1094 joined #nim
17:42:12*johtso joined #nim
17:42:13*johtso quit (Remote host closed the connection)
17:44:49*berndj11 joined #nim
17:44:53*berndj11 quit (Remote host closed the connection)
17:46:50*Vladar quit (Remote host closed the connection)
17:48:28*francisl quit (Quit: francisl)
18:01:49*francisl joined #nim
18:10:34FromGitter<mratsim> @miran, you can echo an array since about 6 months ago
18:10:58mirani know it is doable now, but i remember it was not before
18:12:48FromGitter<kaushalmodi> @mratsim Yes, we were thinking of that time before 6 months :)
18:13:02FromGitter<kaushalmodi> the `strfmt` was created a couple of years back
18:27:07stefanos82if I'm not mistaken, strfmt got replaced with strformat
18:28:57FromGitter<kaushalmodi> *here we go again*.. :)
18:29:15FromGitter<kaushalmodi> stefanos82: I have brief description here.. https://scripter.co/notes/nim/#strfmt
18:30:41stefanos82so, basically strfmt is Python's str.format() whereas strformat is Python's 3.6 f-string
18:31:32FromGitter<kaushalmodi> Yes. Purists will say that that's not a correct comparison. But I see that comparison as pretty good.
18:33:21stefanos82then strfmt and strfomat should get first merged to strformatter and then deprecate the aforementioned modules in favor of the new one
18:36:23FromGitter<mratsim> strfmt is user lib. No need to introduce yet another name/deprecation path.
18:36:34FromGitter<mratsim> we can just use strformat.
18:37:15shashlickdo we have any support for forward declaration of objects?
18:37:22FromGitter<mratsim> yes
18:37:56FromGitter<mratsim> if they are declared in the same type section
18:39:16FromGitter<mratsim> if you have type declaration issues the usual way to solve it is by having a types.nim/datatypes.nim file with all types that you will use.
18:43:11shashlickuhm, that's hard when you are wrapping stuff and using nimgen to do the manipulations 😞
18:46:10*natrys joined #nim
18:46:38Araqshashlick, {.reorder: on.} helps with wrappers
18:50:22*jxy quit (Quit: leaving)
18:54:17shashlickya I was looking for that
18:54:44shashlicklet me try - am playing with libui to see how feasible it is
18:55:34*yglukhov[i] joined #nim
19:00:30shashlickit worked!
19:00:33*yglukhov[i] quit ()
19:11:45*Vladar joined #nim
19:11:50shashlickanyone seen this before: ui.nim(1, 2) Error: implementation of 'ui' expected
19:11:58shashlickline 1 is "import strutils"
19:13:48*natrys quit (Ping timeout: 256 seconds)
19:16:33*nsf joined #nim
19:16:57*francisl quit (Quit: francisl)
19:17:52*francisl joined #nim
19:23:08*rokups quit (Quit: Connection closed for inactivity)
19:24:06*HarryS22 joined #nim
19:24:46*HarryS22 quit (Remote host closed the connection)
19:26:12*natrys joined #nim
19:43:12shashlickokay totally stuck with this - any tips appreciated ^^
19:48:06thor77shashlick: where do you expect "ui" to come from?
19:48:13thor77ah
19:48:13thor77uh
19:48:15thor77nvm
19:49:00shashlickhere's a gist of ui.nim: https://gist.github.com/genotrance/eef3c4965cd1230ed3b1c884817067ca
19:54:37*S1tiSchu joined #nim
19:56:23*PMunch joined #nim
20:04:36*zachk joined #nim
20:05:48zachkcan I run nim as a repl / interpreter?
20:07:01*vivus joined #nim
20:07:10*miran_ joined #nim
20:08:27*miran quit (Ping timeout: 240 seconds)
20:09:29*cryptocat10941 joined #nim
20:09:36*cryptocat10941 quit (Client Quit)
20:10:00*cryptocat10941 joined #nim
20:10:41*cryptocat1094 quit (Disconnected by services)
20:11:09*cryptocat10941 is now known as cryptocat1094
20:18:41FromGitter<mratsim> @zachk: https://github.com/AndreiRegiani/INim
20:20:04FromGitter<zetashift> oh wow I thought that was an old non-working repl
20:22:03*francisl quit (Quit: francisl)
20:23:07FromGitter<Clyybber> Araq Can cstrings still be nil?
20:23:40*nsf quit (Quit: WeeChat 2.2)
20:28:36PMunchzachk, you can try "nim secret" :)
20:29:53*noonien quit (Quit: Connection closed for inactivity)
20:30:29*Tools21 joined #nim
20:30:33PMunchzacharycarter[m], is it possible to run a "headless" version of the playground?
20:30:48PMunchie. just have the /compile thing but not the web-page
20:30:52PMunchOr better yet run it locally
20:33:39*Tools21 quit (Remote host closed the connection)
20:37:05krux02Clyybber
20:37:07krux02yes
20:37:09krux02they can
20:37:22FromGitter<Clyybber> Ok thx
20:37:25*Vladar quit (Remote host closed the connection)
20:37:44krux02you can see cstrings just as an alias for ptr char
20:37:52Araqshashlick, it's weird indeed
20:41:02Araqbut PLEASE use c2nim's --nep1 switch
20:41:47*PMunch quit (Quit: leaving)
20:51:26*francisl joined #nim
20:57:06*cryptocat1094 quit (Quit: WeeChat 2.2)
20:58:40*miran_ quit (Ping timeout: 268 seconds)
21:00:22shashlickokay I'll try that, that will be needed anyway to keep compatibility with your work
21:00:29shashlickintention is for this to be a dropin replacement
21:12:30*seni quit (Quit: Leaving)
21:23:35*pwntus quit (Ping timeout: 240 seconds)
21:23:55*pwntus joined #nim
21:27:42*francisl quit (Quit: francisl)
21:27:51*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:30:56*sparr26 joined #nim
21:30:59*Jesin quit (Remote host closed the connection)
21:32:18shashlickaraq: ok, using --nep1 now but still same error if imported, if I compile ui.nim directly, it works fine
21:33:07*Jesin joined #nim
21:38:03*sparr26 quit (Ping timeout: 260 seconds)
21:44:34shashlickaraq: okay, I manually fixed up the forward declarations and removed {.reorder: on.} and now the implementation error went away
21:46:35shashlickso the issue is {.reorder: on.} causing import errors - does that help in any way?
21:55:37*vosper joined #nim
21:58:50Araqsure thanks.
21:59:01Araqdisappointing too, quite some testing went into this feature...
21:59:14shashlickwill open a defect with a simpler example if possible
21:59:36shashlickbut for now, will have to figure out how to reorder all these types in nimgen
22:13:31shashlickhttps://github.com/nim-lang/Nim/issues/8665
22:14:46*BitPuffin quit (Ping timeout: 260 seconds)
22:24:40*ketas14 joined #nim
22:25:19*ketas14 quit (Remote host closed the connection)
22:25:19FromGitter<kayabaNerve> I love Nim secret for testing features/helping people on Gitter...
22:25:26FromGitter<kayabaNerve> krux02 I had a message for you the other day
22:26:22FromGitter<kayabaNerve> No idea if you got
22:26:34FromGitter<kaushalmodi> so "nim secret" is repl?
22:26:38FromGitter<kayabaNerve> @kaushalmodi Yes
22:26:50FromGitter<kayabaNerve> Damn it. krux02 was on two hours ago lol. Thought that was more recent
22:27:10FromGitter<kayabaNerve> What even is the reorder pragma? It's not in the manual...
22:30:14FromGitter<kaushalmodi> About nim secret.. wonder why it's kept secret
22:30:27FromGitter<kaushalmodi> It's in the docs but commented out.. it seems: https://github.com/nim-lang/Nim/blob/1ef32dad8090f0a6c85026a10ec362ce6c6cfe98/doc/nimc.rst#L484-L498
22:30:42FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b75fb12dd0b74601e19df89]
22:31:04*K0HAX17 joined #nim
22:31:11FromGitter<kayabaNerve> Because it's unstable?
22:31:37*natrys quit (Quit: natrys)
22:31:56shashlick@kabayaNerve: it allows for forward declaration of types - not in the manual yes
22:32:03shashlickbeen around since 0.17.2 at least
22:32:43FromGitter<kayabaNerve> Got it. Good to know.
22:32:48FromGitter<kayabaNerve> Thanks shashlick
22:33:07shashlickbut doesn't work in imports 😞
22:33:27shashlicktrusting araq, it will be fixed in a day 😄
22:33:28FromGitter<kayabaNerve> ... so like 95% of Nim code?
22:33:29FromGitter<kayabaNerve> :P
22:34:09FromGitter<kayabaNerve> Seems interesting; I trust it will be fixed; I'm surprised this wasn't found way earlier
22:34:17*K0HAX17 quit (Remote host closed the connection)
22:35:26AlexMaxoh snap
22:35:28AlexMaxa REPL
22:35:33AlexMaxnever knew that
22:43:31AlexMaxSurely it's nim and not nimscript...
22:44:17AlexMaxlib\impure\re.nim(104, 3) Error: undeclared identifier: 'copyMem'
22:44:22AlexMaxguess it is
22:44:24AlexMaxstill, cool
22:44:38FromGitter<kayabaNerve> It is Nim
22:44:56AlexMaxoh, then why couldn't I import re?
22:46:33*deech joined #nim
22:47:45deechIs it possible to statically introspect on an identifier and figure out if it is immutable, i.e assigned with `let`?
22:48:02shashlick@AlexMax: are you talking of `nim secret`
22:48:55Araqdeech, it's possible but useless
22:49:35deechAraq: why is it useless?
22:50:28AlexMaxYes
22:50:51Araqbecause no known useful applications are known
22:52:16shashlick@AlexMax: then its because it is running your code in the VM so while it is nim, its a limited subset
22:52:36AlexMaxoh....so the limited subset of nim that runs in the VM and nimscript are not the same thing?
22:54:28Araqthey are.
22:56:25AlexMaxThat's what I thought
22:57:20AlexMaxIs importc in nimscript an impossibility, or just incredibly hard, something for later?
22:57:48AraqI implemented it twice
22:58:34Araqit always "kinda" works but I don't need yet-another imense attack surface for my poor compiler
22:59:39shashlickhttps://bintray.com <= seems like a good option to store nim nightly builds
23:02:11FromGitter<kayabaNerve> Araq is nim secret nim script?
23:02:33AlexMaxIt must be
23:02:35FromGitter<kayabaNerve> Because that wasn't directly declared and I would like to confirm that
23:03:19AlexMaxYou can't import an impure library like re
23:03:29Araqyes, it is
23:03:47FromGitter<kayabaNerve> Got it. Thanks
23:07:37krux02kayabaNerve I am back online and I got your message
23:07:56FromGitter<kayabaNerve> Great :P
23:09:42AlexMaxHrm, nim seems to take a second or two to "Process" ospaths or glm, can't figure out which
23:09:59AlexMaxThere's a noticable delay every time I hit compile
23:10:38AlexMaxThe C compiler itself seems almost lightning fast, by contrast
23:11:59AlexMaxAlso, wow, 0.19 is coming very soon, yay!
23:13:48Araqdon't hold your breath, regressions and showstoppers are quite a few
23:22:31krux02Araq: it is green now: https://github.com/nim-lang/Nim/pull/8659
23:24:58krux02yay, thank you
23:30:04*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:31:10FromGitter<arnetheduck> @Araq @krux02 since there's now an Option type in nim, I could submit Result as well if there's interest? https://github.com/arnetheduck/nim-result/pull/1/files
23:31:57*vosper joined #nim
23:32:11zachkError: tabulators are not allowed, what does this mean?
23:33:33*shashlick quit (Remote host closed the connection)
23:33:40*vivus quit (Quit: Leaving)
23:35:59zachkoh no tabs
23:36:02zachk:)
23:36:18*vivus joined #nim
23:45:24*krux02 quit (Remote host closed the connection)
23:51:17*zachk quit (Quit: Leaving)
23:59:02*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)