<< 04-04-2017 >>

00:09:52*devted joined #nim
00:42:41*ftsf joined #nim
01:16:30*qzo quit (Read error: Connection reset by peer)
01:16:50*brson joined #nim
01:35:42*devted quit (Quit: Sleeping.)
01:48:39*aedigix quit (Ping timeout: 256 seconds)
01:52:25*couven92 quit (Quit: Client Disconnecting)
01:53:17*Serenitor quit (Quit: Leaving)
01:54:23*brson quit (Quit: leaving)
01:56:08*chemist69 quit (Ping timeout: 260 seconds)
01:56:56*devted joined #nim
01:58:51*yglukhov joined #nim
02:01:11*brson joined #nim
02:03:19*yglukhov quit (Ping timeout: 258 seconds)
02:03:50*brson quit (Client Quit)
02:04:23*brson joined #nim
02:09:48*chemist69 joined #nim
02:27:57*brson quit (Quit: leaving)
02:35:46*zachcarter joined #nim
02:53:41*zachcarter_ joined #nim
02:55:41*suswombat__ joined #nim
02:56:04*zachcarter quit (Ping timeout: 240 seconds)
02:56:04*zachcarter_ is now known as zachcarter
02:58:45*SusWombat_ quit (Ping timeout: 246 seconds)
03:31:39*BitPuffin|osx quit (Ping timeout: 246 seconds)
04:26:02*devted quit (Quit: Sleeping.)
04:33:44*Nobabs27 quit (Quit: Leaving)
04:41:54*devted joined #nim
04:46:07*devted quit (Ping timeout: 240 seconds)
05:08:13*athaudia joined #nim
05:09:37*antranig1 joined #nim
05:11:58*samdm joined #nim
05:12:23*flyx|znc joined #nim
05:13:53*SirCmpwn_ joined #nim
05:14:19*xet7 quit (*.net *.split)
05:14:20*Jesin quit (*.net *.split)
05:14:20*nightmared quit (*.net *.split)
05:14:20*_yeeve quit (*.net *.split)
05:14:21*flyx quit (*.net *.split)
05:14:21*antranigv quit (*.net *.split)
05:14:21*jivank[m] quit (*.net *.split)
05:14:21*MrAxilus[m] quit (*.net *.split)
05:14:21*ehmry[m] quit (*.net *.split)
05:14:22*onionhammer quit (*.net *.split)
05:14:23*athie quit (*.net *.split)
05:14:23*joshbapt1 quit (*.net *.split)
05:14:24*demi- quit (*.net *.split)
05:14:24*SirCmpwn quit (*.net *.split)
05:14:25*tstm quit (*.net *.split)
05:14:25*samdm is now known as demi-
05:14:26*flyx|znc is now known as flyx
05:19:59*tstm joined #nim
05:20:39*_yeeve joined #nim
05:20:53*MrAxilus[m] joined #nim
05:20:57*xet7 joined #nim
05:21:10*joshbapt1 joined #nim
05:21:38*jivank[m] joined #nim
05:21:44*Jesin joined #nim
05:21:46*onionhammer joined #nim
05:21:51*ehmry[m] joined #nim
05:22:44*nightmared joined #nim
05:46:23*yglukhov joined #nim
05:47:43*madgoat joined #nim
05:48:03*madgoat left #nim (#nim)
05:55:49*yglukhov quit (Remote host closed the connection)
06:01:05*libman quit (Quit: Connection closed for inactivity)
06:01:47*Vladar joined #nim
06:03:25*gangstacat quit (Quit: Ĝis!)
06:16:50ldleworkI'm sad that variants can't use the same name
06:17:27ldleworkit seems like at any point to use the variant fields, you'd have to be already discriminating against the kind, and so the compiler should know that its really kindA_foo vs kindB_foo
06:17:30ldleworkor whatever
06:20:45ldleworklike it could internally mangle the name maybe
06:22:01*antranig1 is now known as antranigv
06:24:35ldleworkCan Concepts constrain on field requirements?
06:30:49*gangstacat joined #nim
06:39:04Araqnot sure why it comes up, I think think sum types in any language support ambiguous field names
06:39:14Araq*I don't think
06:39:30Araqldlework: move the common fiels out of the 'case'?
06:39:30*nsf joined #nim
06:41:50*rokups joined #nim
06:43:41*xet7 quit (Quit: Leaving)
06:47:45ldleworkAraq: because other variants don't have those common fields
06:47:52ldleworkAraq: I'm also surprised I can't do this, https://gist.github.com/dustinlacewell/596c7add8f6f7ead8d70d31c6bf69c1d
06:48:10ldleworkIE, overload a proc based on concept
06:48:19ldleworkthough I guess it has no way to discriminate which one it should use
06:48:54ldleworkit would be cool to call someThing.set(someValue) and have it call the right set()
06:50:26ldleworkOK I think I understand
06:53:16ldleworkI would need inheritance or whatever to do that kind of thing
06:54:27ldleworkAraq: is wanting to overload like that, dumb pretty much?
06:57:33AraqI don't know.
06:58:12Araqldlework: there is an RFC for exactly this object field feature, so it's definitely come up before
06:58:44Araqbut I don't understand why it doesn't come up for all the languages that use | instead of 'of' to write sum types.
07:00:04ldleworkAraq: I moved away from the object variants here in my second question
07:00:08Araqfor someThing.set(someValue) ... it seems like a cool idea that can be done with a single macro that does type inspection
07:00:43Araqdon't overload the macro, make the macro do the type switching based on macros.getType
07:00:58Araqit's a bit cumbersome to write, but also a good exercise ;-)
07:01:38ldleworkAraq: is it because there's just no heuristic to use for the compiler?
07:01:55ldleworkLike, just theoretically, could it check in the order that the types were defined?
07:02:12ldleworkOr even the order in which the overloads were defined
07:02:18Araqwell you can also use a generic constraint like RangedValue: range
07:02:20ldleworkSomething simple and not usecase specific
07:02:32Araqbut where is the fun in that? :P
07:02:41ldleworkI don't know what you mean
07:03:00Araqproc set[RangedValue: range; V](t: RangedValue, v: V): bool =
07:03:14ldleworkwhat does that do?
07:03:37Araqit says RangedValue needs to a Nim 'range' type
07:03:56ldleworkoh is there a built in range?
07:04:41ldleworkBut this doesn't help if I have type A which only satisfies PortValue and type B which satisfies PortValue and RangedValue
07:04:58ldleworkI need to call set() on A but I can't, since I can't redefine set()
07:05:01euantorhttps://nim-lang.org/docs/system.html#range
07:05:57ldleworkOr I can define it for just PortValue, but then I can't implement a version of set() with the min/max logic
07:08:55ldleworkAraq: ooo I thought I was gonna get it by using 'or' generic constraint, https://gist.github.com/dustinlacewell/1a175834657dcf8e1d368b6296bb853b
07:09:11ldleworkBut neither type is now considered to be Value[T]
07:09:31ldleworkIf I simply comment out the `when` block inside of set() then it works...
07:09:52ldleworkwait no it doesn't
07:10:59ldleworkbleh
07:12:32Araqvery complex code you got there.
07:12:34Araqhttps://gist.github.com/dustinlacewell/1a175834657dcf8e1d368b6296bb853b
07:12:39Araqlook at my reply
07:12:46Araqthat's all it takes.
07:15:33ldleworkthat is mindblowing
07:16:35ldleworkjesus that is really expressive lol
07:19:54*yglukhov joined #nim
07:23:44ldleworkAraq: it doesn't work though :(
07:24:04Araqwhy not?
07:25:07ldleworkAraq: https://gist.github.com/dustinlacewell/682a6a17d41e393a9dad95997cce185b
07:25:58ldleworkThe error happens on : https://gist.github.com/dustinlacewell/682a6a17d41e393a9dad95997cce185b
07:26:00ldleworkoops
07:26:05ldlework if v < t.min: return false
07:26:25ldleworkWhich should never be run, because BoolValue wouldn't compiles(t.min)
07:26:34ldleworkbug?
07:27:26*xet7 joined #nim
07:28:11Araqx.min does compile for 'bool' ;-)
07:29:19Araqproc min*[T](x: varargs[T]): T =
07:29:20Araq ## The minimum value of `x`. ``T`` needs to have a ``<`` operator.
07:29:41Araqand for some reason bool has a '<', false < true and all that
07:30:04Araqbut it's stupid, system.min and system.max should take openArrays
07:38:09ldleworkAraq: so what's my solution?
07:38:45Araqwait until my fix was merged into devel or use crappier field names like minValue, maxValue
07:39:20ldleworkoh its because UCS?
07:39:26ldleworkoh haha, jeeze
07:40:39ldleworkAraq: I'll add an additional when t.value is Comparable
07:40:55Araqbool is Comparable.
07:41:13ldleworkthis made it compile though..
07:41:46ldlework Comparable = concept x, y
07:41:48Araqok, I might be wrong
07:41:49ldlework x < y is bool
07:41:51ldlework x > y is bool
07:41:53ldleworkI wrote that
07:42:10Araqyou shouldn't write 'x > y' btw
07:42:32Araqthere is always a '>' :-)
07:42:50Araqtemplate `>`(a, b): untyped = b < a ;-)
07:43:07ldleworklol why does it make it work then
07:43:17ldleworkshouldn't it have no effect and find the same code path and blow up in the same way?
07:47:47ldleworkAraq: I would seriously wonder what other languages are capable of expressing this set() implementation as short and expressively as nim: https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133#file-concepts-nim-L21
07:50:14AraqD-lang can do it too, its generics are very much the same and they have 'compiles' builtin via a strange name that I forgot
07:51:21ldleworkOh I just made it nicer: https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133#file-concepts-nim-L18
07:51:38ldleworkdon't even need compiles() now!
07:51:40ldleworkwow!
07:51:49ldleworkI'm sorely impressed right now.
07:51:54ldleworkor Comparable
07:53:38flyxwouldn't you need to use v.value instead of v for the comparisons?
07:54:35flyxI mean, v is a RangedValue, which is a Value, which has a field .value
07:54:39Araqldlework: my solution works when you only have a max or only have a min too :P
07:55:01ldleworkflyx: v is not a RangedValue
07:55:11flyx`when v is RangedValue`
07:55:17ldleworkoh crap
07:55:20ldleworkI meant T
07:55:31ldleworkdang now it doesn't work
07:55:33ldleworklmao
07:55:37ldleworkAraq: :(
07:56:11AraqI told you what to do. name it maxValue and minValue and live with my solution for now
07:56:13ldleworkcorrect version, that doesen't work https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133
07:56:21ldleworkoh right
07:56:24Araqsorry, this is too distracting, I need to work.
07:56:26Araqbye
07:58:01*nightmared quit (Ping timeout: 260 seconds)
07:58:17ldleworkflyx: why do neither of the echo's output now? https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133
07:59:10ldleworkI changed it to `t is RangedValue`
07:59:16flyxldlework: I think because you need to say `when b is Value` instead of `when BoolValue is Value`
07:59:48ldleworknah that doesn't do anything
08:00:02ldleworkits like the Value concept no longer applies to either type now
08:00:25ldleworkIf I comment out the `when t is RangedValue` block, it works again
08:00:32flyxthe let assignments seem wrong. you declare b as BoolValue but then assign new(BoolValue) to it
08:01:32flyxunless new() actually returns a BoolValue because that is a `ref object` (which I would find surprising)
08:01:53ldleworkI see
08:02:06ldleworkbut you can delete those lines
08:02:19ldleworkthey are not relevant to the last when clauses
08:03:09ldleworkmaybe its because...
08:03:16ldleworkset() is part of the concept
08:03:31ldleworkand so, types defined so far, can't be part of the concept because set hasn't finished being defined?
08:03:34ldleworkor something?
08:03:39flyxwell you won't need v.value in the comparisons now, seeing that you supply v.value to v in the Value concept
08:04:11ldleworkoh yeah
08:04:14ldleworkanother bug
08:04:19ldleworkI really messed up t vs v
08:04:35flyxI would also supply the generic parameters to the concepts
08:04:40flyx`when t is RangedValue[V]`
08:05:25flyxthat also improves readability. right now, I have to think about what kind of types are used on every line
08:05:45ldleworkflyx: ok current implementation, https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133
08:05:49ldleworkneither echo's emit
08:06:17flyxin RangedValue[T], say `v is Value[T]`
08:06:37flyxbut that wouldn't bother the whens
08:07:29ldleworkflyx: by upgrading T to Value it works
08:07:29flyxand yes, the error could well be that you have kind of a circular dependency
08:07:31ldleworkfor some reason
08:08:08ldleworkworking version, https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133
08:08:18flyxyou are aware that set is a builtin type and can lead to further complications?
08:08:58ldleworkhuh
08:09:00ldleworklol
08:10:12flyxthis code looks strange, you are using `Value` as a new type identifier in the generic proc, even though its also a generic
08:10:23flyxtry simply `proc[V](self: Value, v: V): bool`
08:11:04ldleworkOh I didn't realize you could use concepts without going through the generic discriminators
08:11:06ldleworknice
08:11:15flyxthat's kind of the point ;)
08:11:39ldleworkflyx: nah that doesn't work actually
08:11:43flyxbetter yet, `proc[V](self: Value[V], v: V): bool`
08:11:50ldleworkI'll try that though
08:12:00ldleworknope
08:12:11ldleworkNeed Value in the discriminator list
08:12:20ldleworkprobably because it generates different implementations
08:12:24flyxwell I think the problem is the circular dependency
08:12:26ldleworkbased on the self type
08:12:32ldleworkwhat about what I just said?
08:12:53flyxno. concepts are *designed* as implicit generics
08:12:56flyxin general, this works
08:12:59ldleworkif it just worked on [float] vs [FloatType, float] then you'd only get one implementation for each type thaht used float internally
08:13:01ldleworkhmm
08:13:16ldleworkIs it really a circular dependency
08:13:24ldleworkmore like a race condition right?
08:13:32ldleworkor order of compilation order
08:13:37ldleworkI wonder if I can define set ahead of time
08:13:48flyxdoesn't work with generics afaik
08:14:10ldleworkyeah that didn't work
08:14:57flyxlet's be a compiler and try to check `BoolValue is Value`
08:15:15flyxcompiler sees „well, it would need to have a set() operation, let's try if it has one“
08:15:36flyxit checks the available procs and sees „ah, there is one, let's see if parameter types match“
08:15:50flyxthen it sees „oh, first parameter needs to be a Value, let's check if it is one“
08:15:58ldleworkflyx: I think what happens, is by including Value in the discriminator, it probably defers the generation of the `set` implementations.
08:16:25ldleworkBy the time it does them, Value has been fully defined (because set has too, just not generated)
08:16:28ldleworkor something
08:16:35flyxno, implementations are only generated once the proc is actually called
08:16:54ldleworkwell the proc is never called in my examples
08:17:08ldleworkwe're testing for whether types are a concept
08:17:13flyxyeah, the compiler just checks if it would be able to instantiate it
08:17:14*Andris_zbx joined #nim
08:17:25flyxwhy not remove the set() restriction from the concept
08:17:50flyxif your proc is `proc set[V](self: Value[V], v: V): bool`, it is guaranteed to be defined for every Value
08:18:35ldleworkBecause I will take Value in other places
08:18:42ldleworkand then call .set on them
08:18:53ldleworkOh I see what you're saying
08:19:06flyxif I remove the set() restriction, it works
08:19:15ldleworkflyx: this worked
08:19:18ldleworkyep
08:19:19ldleworkgood job
08:19:30flyxnow try with actual values to be sure it still works
08:19:33ldleworkflyx: it would be interesting to know why adding Value to the discrimantor works
08:19:44ldleworkor what the compiler does differently in that case
08:20:26flyxbecause then, Value is just a new name, and it hides the type descriptor Value defined above
08:20:36flyxor that's what I assume anyway
08:22:48ldleworkflyx: thanks for your guidance
08:22:59flyxno problem
08:25:02*Arrrr joined #nim
08:26:00flyxout of curiosity, I tried: https://gist.github.com/flyx/ef2564bf4dbb1b8cc343daa91118c94f
08:26:11flyxit doesn't work, complains about missing `value=`
08:27:20ldleworkYeah you need all the fields
08:27:38ldleworkI've since removed default, btw
08:27:47ldleworkmy current, https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133
08:30:07flyxinteresting. yours seems to work because you removed the generic params from the concepts
08:30:10flyxstrang
08:30:11flyxve
08:30:37ldleworkflyx: Nim's generics are powerful but totally mysterious.
08:30:49flyxindeed
08:30:56ldleworkCompare to say C#'s generics which can't quite do as much as Nim, but they are very easy to understand.
08:31:05ldleworkConcepts are so amazing though.
08:40:08*couven92 joined #nim
08:47:25ldleworkflyx: :( https://gist.github.com/dustinlacewell/d89d210778c449aff6496a7d6ad5d645
08:48:04ldleworkoh
08:48:23ldleworktypo
08:48:26ldleworks/i/is
08:48:30ldleworkno error, strange
08:50:21ldleworkflyx: check this out, https://gist.github.com/dustinlacewell/d89d210778c449aff6496a7d6ad5d645
08:50:29ldleworkit doesn't generate any of the correct implementations
08:50:31ldleworkonly basic ones
08:52:03ldleworkflyx: probably because of what you said
08:52:28ldleworkwell we removed the requirement on set, so the recusion is gone
08:52:33ldleworkso actually, no I don't know why this doesn't work
08:57:02flyxldlework: this works: https://gist.github.com/flyx/2339540977a80a530ca716f615d230f8
08:57:24flyxI removed `v is Value[T]` from MinValue and MaxValue and renamed min and max as Araq suggested
08:58:45*Pisuke quit (Read error: Connection reset by peer)
08:59:25ldleworkflyx: check this out, https://gist.github.com/dustinlacewell/d89d210778c449aff6496a7d6ad5d645
08:59:28ldleworkit works
08:59:30ldleworklol
08:59:40ldlework(as in, it generates the right implementations)
08:59:52*Pisuke joined #nim
09:00:37flyxinteresting
09:00:54ldleworka super-concept
09:00:56ldleworklmao
09:01:18flyxI feel like getting this to work is like walking on a reverse minefield
09:01:31flyxit blows up on every step unless you hit the exact right spots
09:01:55FromGitter<andreaferretti> just use `Value[T] = RangedValue[T] or MinValue[T] or MaxValue[T] or BasicValue[T]`
09:02:08FromGitter<andreaferretti> no need for concepts here
09:02:19*zachcarter_ joined #nim
09:02:21ldleworkflyx: haha, Nim in a nutshell right there
09:02:37ldleworkandrea nice
09:02:58*zachcarter quit (Ping timeout: 240 seconds)
09:02:58*zachcarter_ is now known as zachcarter
09:03:03ldleworkthat doesn't actually work
09:03:14ldleworkgood idea though
09:04:59*yglukhov quit (Remote host closed the connection)
09:07:53FromGitter<nimit95> Hi
09:10:08cheatfatehi nimit95
09:10:21*yglukhov joined #nim
09:10:37ldleworkflyx: I wonder why removing the dependency on Value in your version makes it work
09:10:38ldleworkwtf
09:11:17FromGitter<nimit95> I am new here and would like to contribute
09:11:18ldleworkflyx: wtf, if you add the depenency back, but without the [T] it works!
09:11:21ldleworkin your version
09:11:24ldleworklol
09:11:39*SirCmpwn_ is now known as SirCmpwn
09:12:48cheatfatenimit95, you are welcome
09:12:57ArrrrThen you might want to read this section https://github.com/nim-lang/Nim/#contributing
09:14:26flyxldlework: https://cdn.meme.am/instances/500x/76432699/ancient-aliens-why-does-it-work-without-the-t-aliens.jpg
09:15:08ldleworklol
09:15:13*yglukhov quit (Remote host closed the connection)
09:15:18ldleworkflyx: do you think I should put it to the forums?
09:15:26ldleworkworth knowing?
09:15:28flyxprobably would be a good thing
09:15:46flyxall suggestions I made wer just guessing
09:16:04*yglukhov joined #nim
09:16:09flyxan explanation would be really good to be able to *know* how to write this code correctly
09:16:18ldleworkyou get me
09:16:22FromGitter<nimit95> I am in my pre final year, computer science engineering
09:16:30*yglukhov quit (Remote host closed the connection)
09:16:35FromGitter<nimit95> And I know c and c++
09:16:48FromGitter<nimit95> how and where can i contribute?
09:19:33ldleworknimit95 did you see Arrrr's suggestion?
09:20:57*yglukhov joined #nim
09:21:36*yglukhov quit (Remote host closed the connection)
09:22:35FromGitter<nimit95> oops sorry missed it, would definitely read it now
09:24:37*yglukhov joined #nim
09:35:32Araqldlework there is {.explain.} for this purpose
09:35:43*Sentreen joined #nim
09:36:02*ldlework blinks
09:40:08ArrrrWhy isn't explain the default?
09:43:08ldleworkArrrr, where is it documented?
09:44:06subsetparkI've never heard of {.explain.} - what's it for?
09:44:49ldleworkDunno, its not listed on the documentation index
09:51:09Araqyeah sure, whenever I compile something, I want detailed compiler explanations of why it actually compiled
09:51:14Araqmakes sense.
09:51:19Araqlet's make it the default.
09:52:05Araqwell concepts are bleeding edge, .explain is not yet in the generated docs
09:52:15Araqwhich refer to the latest official release.
09:59:38ldleworkAraq: haha
10:02:05*couven92 quit (Quit: Client disconnecting)
10:06:35ldleworkWhen using NimScript tasks, and using setCommand("c"), how do you set the file to compile?
10:07:21*couven92 joined #nim
10:08:48ldlework:3
10:14:41AraqsetCommand("c", "myfile.nim") ? not sure, never use it
10:17:18*yglukhov quit (Remote host closed the connection)
10:18:16*yglukhov joined #nim
10:20:47*wan joined #nim
10:22:50ldleworkIt seems I can't turn off hints with nimscript
10:22:59ldleworkAraq: what do you use for building, etc?
10:23:01ldleworkbash?
10:23:19AraqI use nimscript.
10:23:40Araqbut I don't use setCommand it's confusing me :-)
10:23:45ldleworkAh
10:24:04ldleworkAraq: should put("hints", "off") cause there to be no hints?
10:24:06ldleworklol
10:24:21Araq--hints: off
10:25:12ldleworkoh Ididn't know you could do that
10:26:17ldleworkHow come --out: bin/synth doesn't work?
10:26:25ldlework???(???, 0) Error: invalid command line option: '--var'
10:27:17ldleworkI have to do
10:27:24ldleworktask build, "build the example":
10:27:26ldlework --hints: off
10:27:28ldlework put("out", "bin/synth")
10:27:30ldlework setCommand("c", "synth.nim")
10:27:43Araqput? is that a thing?
10:27:58ldleworkhttps://nim-lang.org/0.11.3/nimscript.html#put,string,string
10:28:23Araqisn't that switch("out", "bin/synth")
10:28:45Araqyeah, use 'switch' for that
10:29:28ldleworkhuh
10:29:38ldleworkwhy can't I do the -- thing?
10:29:57Araqhttps://nim-lang.org/0.16.0/nimscript.html#put,string,string is more recent than 0.11.3 btw
10:30:12Araqoh you can do the -- thing but you don't understand it
10:30:47ldleworklol clearly
10:31:35ldlework -- out "bin/synth" ???(???, 0) Error: invalid command line option: '--var "bin/synth"'
10:32:23ldleworkis it because out is a keyword?
10:32:34*shashlick quit (Ping timeout: 240 seconds)
10:35:59*shashlick joined #nim
10:37:31ArrrrMaybe you forgot to add ':' ?
10:38:37ldlework -- out: "bin/synth"
10:38:46ldlework???(???, 0) Error: invalid command line option: '--var'
10:38:54ldleworkthink its bugged
10:39:03ldleworkalso in nimscript, when I turn off hints
10:39:12ldleworkit shows me
10:39:15ldleworkHint: used config file '/home/dlacewell/src/nim/Nim/config/nim.cfg' [Conf]
10:39:17ldleworkanyway
10:39:23ldleworkaaaaaand its 3:30 AM
10:39:47ldleworkbash will work for now
10:40:15ArrrrI think you cannot turn conf hints off because they are displayed before processing the config files
10:40:23Araqswitch("out", "bin/synth")
10:40:33ldleworkwhen you provide it as a commandline flag it turns off all hints
10:40:38AraqI dunno why my help is consistently ignored
10:40:49ldleworkAraq: yes that works, but why doesn't the -- syntax work for it
10:41:07ldleworkIts not like I didn't hear you and I even mentioned that I was using that version, because the -- doesn't work
10:41:09*yglukhov quit (Ping timeout: 264 seconds)
10:41:14ldleworkyou said I can use -- I just don't understand it
10:41:20ldleworkso
10:41:49ArrrrI think you can use -- for standalone values in nimscript because it parses it like any nim file
10:41:50ldleworkCan one use -- with out, or do you have to use switch()
10:42:12ldleworkArrrr: but it works for `-- hints: off`
10:42:27ArrrrHmm, in that case ...
10:42:42Araqsorry about that, -- only works for some cases :-)
10:42:52ldleworkAh which ones?
10:42:59Araqif you want to know why, here is what it does:
10:43:20Araqtemplate `--`(x, y: untyped) = switch(astToStr x, astToStr y)
10:43:34Araqsee? it turns it into a string literal.
10:44:00Araqwhat does it do with string literals? it turns them to string literals, in other words wrapped in "" and \ escaped
10:44:17Araqwhich is wrong :-)
10:45:26AraqI may deprecate this `--` template again, seems more confusing than useful
10:45:43ArrrrI didn't know that syntax was valid https://glot.io/snippets/eomf0jls18
10:46:42Araqsurely you did.
10:46:53AraqwithFile f: body
10:47:08Arrrrmind = blown
10:47:47*yglukhov joined #nim
10:48:48ldleworkAraq: OK but why doesn't it work for out?
10:49:12Araqit's not the 'out'
10:49:22Araqit's the fact that you pass a string literal to 'out'
10:49:50Araqand stupid -- quotes this string literal again to make it a string literal
10:49:57ldlework -- out: bin/synth
10:50:04ldlework???(???, 0) Error: invalid command line option: '--var'
10:50:10*PMunch joined #nim
10:50:21ldleworkWhat explains this?
10:50:54ArrrrYep, out -> var https://glot.io/snippets/eomf5tzr3m
10:51:16ldleworklol wtf
10:51:32ArrrrAnd glot io is running 1.14 i believe
10:51:45Arrrr*0.14
10:52:34*byte512 quit (Ping timeout: 240 seconds)
10:52:51ldleworkOK so avoid the template
10:53:05ldleworkLast annoying thing is the fact that the Conf hint is displayed
10:53:14ldleworkBut I'm guessing there's just no way around that
10:53:39*Tiberium joined #nim
10:54:39Araq'out' is a Nim keyword and mapped to 'var'
10:55:09*byte512 joined #nim
10:57:31ldlework#!/usr/bin/env sh
10:57:33ldleworknim --hints:off $@
10:57:35ldleworkhehe
11:03:09ArrrrDoes --o:foo/bar work?
11:08:21ArrrrThe cheap hack is to check when astToStr(key) == "var"
11:08:25ldleworkArrrr: no it doesn't
11:08:55ldleworkNew question, in nim script how do you call one task from another?
11:09:29Araqtasks are mapped to procs
11:09:32Araqtask foo
11:09:39Araqbecomes proc taskfoo
11:09:48Araqso call it as taskfoo()
11:10:12Arrrrhttps://github.com/nim-lang/Nim/blob/master/lib/system/nimscript.nim#L286
11:11:00Araqoh I misremembered, to it's fooTask()
11:14:54ldleworkHmm how do I hide output like this: CC: dadren_synth
11:17:36ldleworkverbosity
11:17:48Araq--verbosity:0
11:18:46ldleworkNice my build scripts are pretty nice now
11:19:01ldleworkAraq: Arrrr flyx thanks, goodnight
11:19:44Arrrr--hints[exec]:off ?
11:40:04Tiberiumcan I use staticRead in a macro to import a module?
11:44:38flyxTiberium: parseStmt(staticRead("myFile.nim")) should work
11:44:57Tiberiumflyx, oh nice, and can I access proc which is defined in this file?
11:45:02flyxhowever, you didn't import it then, you parsed its code
11:45:25flyxyou can also generate an import statement within the macro
11:45:54flyxwhat you need to do depends on what you actually want to do
11:46:18flyxif you want to use the code in the module within the macro, you could just use a normal import statement without staticRead
11:46:50Tiberiumflyx, I want to "import" all files from directory, and generate case statement to match strings and call appropriate module (via modulename.call proc)
11:48:22flyxdo you search for those strings inside the code of the modules?
11:48:28Tiberiumflyx, ideally I want to
11:48:54Tiberiummaybe I can both staticRead a module and import it later
11:48:59flyxthen I would suggest to use staticRead to read them and do the searching. but afterwards, just generate a normal import statement
11:49:04AraqTiberium: what do you really want to achieve?
11:49:04Tiberiumok, thanks!
11:49:22Araqseems like a huge hack
11:49:37TiberiumAraq, make writing plugins a little bit easier (I have a big case statement in my app which calls plugins based on command match)
11:50:24Tiberiumit looks like this (sorry for russian): https://gist.github.com/TiberiumN/03b2d88b7038ae04b11d4276d13affe6
11:50:37TiberiumrunCatch is an asyncCheck wrapper
11:51:59flyxTiberium: this looks like you rather want to write a macro which provides a syntax `command "привет": # implementation`
11:52:36flyxthis syntax would generate the proc to call and also add "привет" to a hashtable linked to the implementation
11:52:55flyxthen later, you just get the proc ref from the hashtable
11:53:02Tiberiumah, so I just need to have global hashtable in main module?
11:53:03flyxand call runCatch() on it
11:53:18TiberiumI thought it would be impossible to append to variable in main module from other modules
11:54:11flyxyou would rather have a command.nim file where the macro and the global hashtable are defined
11:54:47flyxyou can even make the hashtable a compile-time variable and generate the case statement from it with another macro in the main module
11:55:21Tiberiumflyx, Araq, thanks for answers! will try to do it :)
11:56:01flyxbtw, this has nothing to do with plugins. plugins are things that can be loaded at runtime. you are adding stuff at compile time
11:58:44Tiberiumbtw, if syntax like import plugins/[a, b, c, d] is possible, why import ../[types, vkapi, utils, command] is not?
12:00:07flyxTiberium: have you tried it with " quotes
12:01:17Tiberiumflyx, no, what it would look like?
12:06:13Araqimport ".." / [types, vkapi, utils, command]
12:07:49Tiberiumit says "base.nim(2, 13) Error: cannot open '".."/types'" but there's types.nim in parent folder
12:08:19Araqthat's a bug :-)
12:09:00Araqimport `..` / [types, vkapi, utils, command] # just guessing
12:10:21*bjz joined #nim
12:10:28*smt quit (Ping timeout: 240 seconds)
12:11:20*smt joined #nim
12:12:49*Vladar quit (Quit: Leaving)
12:19:59*BitPuffin|osx joined #nim
12:22:14wanI understand that the js output of nim doesn't generate source maps, is that correct? Would it be difficult for someone relatively not familiar with the codebase to add it in?
12:23:39*arnetheduck joined #nim
12:24:00*Tiberium quit (Remote host closed the connection)
12:24:14*Tiberium joined #nim
12:31:35PMunchwan, what would those source maps map to?
12:32:12*fastrom1 joined #nim
12:32:12Tiberiumehm, is it a bug if compilation fails on C compilation step?
12:32:39PMunchDepends a bit Tiberium
12:33:02PMunchSince you can do unsafe casts and stuff it is possible that you've messed up
12:33:08Tiberiumah, nvm
12:33:18PMunchwan, I see now that it can map to other languages. Interesting
12:33:21TiberiumI was adding values to table at compile time without "static" block
12:33:30wanjs source maps are a must for languages that compile to js. When error occurs, instead of showing you compiled js, it shows you the original source
12:33:30Tiberiumso I added static block and it works now
12:34:15*erwana[m] joined #nim
12:34:58*fastrom quit (Ping timeout: 240 seconds)
12:36:39Tiberiumbtw, will compile-tim variable - defined as "var" transformed to const after compilation?
12:37:17PMunchDon't think so
12:37:28flyxTiberium: consts are propagated during compilation. they are nothing after compilation
12:38:00flyxsame for compile time vars
12:38:02Tiberiumflyx, ah, I mean I will populate my table by about 20-40 values at compile-time, will it be fine for performance?
12:38:37flyxif you do not assign the table to any runtime var, it will have no impact on runtime performance
12:38:58Tiberiumok, nice
12:41:01*zachcarter quit (Quit: zachcarter)
12:43:48*AndroUser joined #nim
12:45:37Araqwan: nim gives you a custom stack trace instead
12:45:47Araqnot ideal, but it predates source maps, so there. :P
12:45:49*AndroUser quit (Client Quit)
12:47:31*AndroUser joined #nim
12:48:44*AndroUser quit (Read error: Connection reset by peer)
13:00:41Tiberiumwait, how is a "func" is reserved keyword?
13:01:41bbl__Tiberium: hopefully someday a prettier syntax for {.noSideEffect.} with proc
13:02:10Tiberiumbbl__, can we also hope for async proc prettier syntax for {.async.} with proc?
13:02:30PMunchWhy hasn't that been added yet by the way? The func this has been mentioned for ages :P
13:04:15flyxdom96: I am still getting mails from [email protected]. „Undelivered Mail Returned to Sender“
13:04:56flyxdom96: this seems to occur for each post I write on the forum
13:05:13def-oh yeah, i got the same mail a few times
13:09:22wanAraq: I don't see any nim stacktrace, that's the thing. Nothing in the js console points to the last line in the nim code here for example https://gist.github.com/idlewan/98ad973e7eadce4a85e457b89003e229
13:10:30wan(should be bounds error or something, the array is empty)
13:11:11wanSo I wouldn't mind having some stacktrace that would help, but I can't find it
13:11:33wanand the question remains: is it not too difficult to hack it in?
13:12:45wanI've started looking into using native JS strings as cstrings AND nim strings, seems weird not to use them and have to convert between them when JS strings should do
13:13:21wanWould that be a welcome change, or would there be problems with having cstrings == strings for js output ?
13:13:36Araqwell it would break nim's stdlib
13:14:02Araqand I just use cstring everywhere in my code that compiles to JS
13:14:08*bjz_ joined #nim
13:14:21wanjs has .length though, most of the stdlib relies on having \0 at the end always ?
13:14:27AraqI was thinking about {.cstringlits: on.}
13:14:34Araqto improve the situation.
13:14:54Araqnot only \0, but a string is a bunch of bytes
13:15:08*bjz quit (Ping timeout: 260 seconds)
13:15:24Araqand s[i] should give the i-th byte, not some strange barbaric utf-16 "character"
13:17:59Araqnot sure what happens with the stack traces, I have this snippet https://gist.github.com/Araq/123b11204bfe98469fdbd0d78eca7592
13:19:33wanit doesn't point to the line in the nim code that errors though, right ?
13:20:57wanI wonder how much effort it would be to generate source maps in the official format https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/preview
13:23:04Araqthe last time I thought about it, it was a huge amount of work
13:25:08wandamn
13:27:37Araqedit lib/system/jssys.nim
13:27:43Araqproc unhandledException
13:27:56Araqit turns the Nim exception including the stacktrace into a JS exception
13:28:25Araqand to answer your question, it does point to the line in the Nim code, if it works at all. :-)
13:28:52Araqso .. with my snippet it should work
13:29:04wanah, I'll test with your snippet
13:29:10*zachcarter joined #nim
13:29:22wanmaybe it should be compiled in by default if it makes errors bearable
13:29:46Araqdefinitely, yglukhov messed this up a bit
13:30:00Araqit was fine initially.
13:30:16yglukhovoO
13:31:03Tiberiumdom96, can I somehow wait for all async functions to die and then exit the app? (If user pressed ctrl+c)
13:31:14TiberiumI mean all async procs to end :)
13:31:32Tiberiumah I see
13:31:35Tiberiumprobably hasPendingOperations
13:33:44Araqyglukhov: maybe it wasn't you
13:36:40yglukhovAraq: this case in the gist does not raise nim exception (in which case unhandledException) would be triggered.
13:37:33Araqyglukhov: can't we console.log the Nim stack trace as default?
13:39:02yglukhovAraq: not in the general case. but for HTML it might be possible by setting window.onerror callback.
13:40:16yglukhovfor nodejs it is process.on('uncaughtException', myHandler)
13:40:31Araqwell nodejs requires a -d:nodejs switch
13:40:41Araqthe default is "runs in a browser"
13:41:06yglukhovAraq: "runs in a browser"? since when? :)
13:41:13wanconsole.error seems more appropriate than console.log, but yes, a default nim printout would be good
13:41:43Araqyglukhov: well I wrote the js code generator with that in mind.
13:41:53Araqso... since forever.
13:41:56yglukhovAraq: what about any generic JS VM
13:42:51Araqthere is no such thing. you compile to JS to make HTML dynamic. nodejs was only added for our tester
13:42:55yglukhovi have an Adobe AfterEffects extension which is neither HTML nor nodejs
13:43:07*Sentreen quit (Quit: WeeChat 1.4)
13:43:09Araq:D
13:43:31FromGitter<andreaferretti> also gnome shell extensions :-P
13:43:35Araqwell, so create a -d:adobe switch for it
13:43:51Araqargh ... stupid popular JS target
13:44:01FromGitter<andreaferretti> nashorn
13:44:08FromGitter<andreaferretti> IoT devices
13:44:21cheatfateyglukhov, i dont think its generic JS VM, because generic JS VM comes without any objects...
13:44:33yglukhovAraq: i don't think nim should make HTML assumption by default.
13:44:56FromGitter<andreaferretti> in any case, yes, I agree that browsers and node are the most important targets right now
13:45:04FromGitter<andreaferretti> let's make at least those two work
13:45:12yglukhovthey work already.
13:45:25AraqHTML doesn't, it doesn't show stack traces
13:45:28FromGitter<andreaferretti> well, I meant, in the sense of diplaying nice exceptiosn
13:45:35*Sentreen joined #nim
13:46:08Araqdo you really write gnome shell extensions in Nim?
13:46:17FromGitter<andreaferretti> no, just kdding
13:46:23Araqawww
13:46:31FromGitter<andreaferretti> but still, the fact is that js is everywhere
13:47:20yglukhovwell this handler could be set up in runtime. if (typeof window !== 'undefined') setupNimUncaughtExceptionHandler();
13:47:46yglukhovso that it still falls back to nothing for Adobe JS and Gnome JS
13:47:54Araqmeh, runtime checks for what should be different compiler targets
13:48:00Araqbut ok.
13:48:02*couven92 quit (Quit: Disconnecting)
13:48:21FromGitter<andreaferretti> also, let us not forget http://iotjs.net/ :-P
13:48:39FromGitter<andreaferretti> I think that given the number of different runtimes
13:48:44FromGitter<andreaferretti> runtime checks make more sense
13:49:09TiberiumCan I convert iterator to sequence of iterator values in one line?
13:49:39arnetheduckAraq, hello, how are things? ;)
13:50:43yglukhovwell in any case this exception handler is a feature request, not a bug. so... if anyone does consider it critical, there's github for that ;)
13:52:14Araqsure it's a bug, it's a regression. it used to write the stack trace in the HTML page :-)
13:52:27*bjz joined #nim
13:52:44Araqarnetheduck: the sun is shining.
13:53:34*bjz_ quit (Ping timeout: 240 seconds)
13:53:46arnetheducknot here, too late. thought I'd get back to nlvm for a bit, I see there's a windows test runner up now which is nice
13:53:56Tiberiumhow can I check architecture of machine in nim.cfg? when defined(amd64) - like this?
13:54:21arnetheduckhttps://github.com/nim-lang/Nim/pull/5656 even passes on it!
13:55:29AraqTiberium: @if amd64:
13:55:34TiberiumAraq, thanks!
13:57:51cheatfatearnetheduck, what does it mean this PR could you explain more?
13:58:10yglukhovAraq: again, Nim has does not interfere with this exception. and technically can't. it's a JS-originated exception. this particular example could never work.
13:58:48arnetheduckcheatfate, it disables rtti generation for types which are imported from C (essentially, types that nim didn't write the corresponding struct for)
13:58:55cheatfateso if C struct has 20 members and i will declare my object {.importc.} and only 2 properties will be declared with {.importc.}
13:59:10cheatfateis it will be affected?
13:59:39arnetheduckif you do that, nim will now generate rtti for the two fields, and depending on the C features used, that rtti will be more or less correct
14:00:17FromGitter<dom96> There are definitely bugs with our JS backend when it comes to exception handling.
14:00:29FromGitter<dom96> catching an exception doesn't work for me
14:00:31cheatfatearnetheduck, i'm doing that and most of os related modules in stdlib uses such mechanics
14:00:39FromGitter<dom96> Probably related to: https://github.com/nim-lang/Nim/issues/5563
14:01:02cheatfatearnetheduck, is it will be broken?
14:01:37FromGitter<dom96> Tiberium: runForever()
14:01:54arnetheduckcheatfate, take a union for example - some nim object types have accessors for two members of the same union, so walking rtti will hit the same field twice
14:02:07Tiberiumdom96, I mean to wait until all events are done
14:02:14Tiberiumor runForever() does that?
14:02:27cheatfatearnetheduck, does your patch will break such mechanics or not?
14:02:45arnetheduckultimately, it's also useless - rtti is used for deep copies and such, and c structs need not be visited that way
14:03:02arnetheduckno, it doesn't break anything - at least that's what the test suite says
14:03:17arnetheduckif anything, it makes nim a little more efficient
14:03:36arnetheduckie less rtti bloat for stuff that's never useful
14:03:42cheatfatewhen i make my object {.importc.} i want it to be binary compatible with c struct
14:04:20cheatfatewhen i declare some fields of my object as {.importc.}, i want that fields to be compatible with appropriate c struct members
14:04:40arnetheduckno changes there. what happens is that it will skip generating TNimNode and friends for the C struct
14:24:32*ftsf quit (Remote host closed the connection)
14:26:37*nsf quit (Quit: WeeChat 1.7)
14:28:20*PMunch quit (Quit: leaving)
14:29:47*PMunch joined #nim
14:30:44Tiberiumok, I have a strange issue in my app: after some time cpu usage goes 100% and it hangs... I'll try to compile and run with boehm gc first
14:33:01*sz0 joined #nim
14:33:44Tiberiumwell, at least it crashed instead of using 100% and freezing :)
14:33:48Tiberiumalso there's traceback
14:43:47*devted joined #nim
14:44:08*krux02 joined #nim
14:52:04*rauss joined #nim
14:55:08*brson joined #nim
14:57:37*krux02_ joined #nim
14:57:39Tiberiumwell, it still happens even with boehm, so issue is somewhere in my code
14:57:46*krux02 quit (Quit: Leaving)
14:57:46*couven92 joined #nim
14:58:03*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
15:01:23*krux02_ quit (Client Quit)
15:01:34*krux02 joined #nim
15:09:20*couven92 quit (Quit: Client disconnecting)
15:09:29Tiberiumhttps://gist.github.com/TiberiumN/dd79ee75043dae70f11e78fcdc12fa1e
15:09:49Tiberiumthis is what I got with "perf record -p <pid of process>"
15:16:21*Andris_zbx quit (Remote host closed the connection)
15:22:07*rauss quit (Ping timeout: 240 seconds)
15:27:37FromGitter<Varriount> Tiberium: Are you using exceptions in an excessive way?
15:28:17Tiberiumhmm, I don't use them everywhere, but I use them at future callback to catch exception from future
15:28:47*yglukhov quit (Remote host closed the connection)
15:29:07FromGitter<Varriount> Also, if you send a sigterm to a process that's using 100% cpu, the stack trace is likely to occur in whatever function is getting called the most
15:29:13TiberiumI use a proc from Nim's stdlib called injectStacktrace
15:29:51FromGitter<Varriount> What happens when you disable the injection?
15:31:05Tiberiumlet me try
15:33:27*rauss joined #nim
15:33:45FromGitter<Varriount> Tiberium: By the way, here's a performance tip: Nim strings and sequences copy on assignment. It's better to mutate them in-place
15:34:40*yglukhov joined #nim
15:39:25*yglukhov quit (Ping timeout: 260 seconds)
15:49:08FromGitter<Danielez> Hello what is the idiomatic way to check if table has a key and if the corresponding value is not empty ("")? In python I write ```if "key" in dictionary and dictionary["key"]: etc```
15:49:32FromGitter<Danielez> Thanks
15:50:43*krux02 quit (Disconnected by services)
15:51:03*krux02_ joined #nim
15:51:59*krux02_ quit (Client Quit)
15:51:59Araqd.getOrDefault("key").len > 0
15:52:08Araqmaybe.
15:52:26FromGitter<Danielez> Tanks
15:53:58FromGitter<Danielez> *Thanks
15:55:47PMunchDanielez http://bit.ly/1XQU0tT
15:57:50FromGitter<Danielez> hihihihi
16:01:49*zachcarter_ joined #nim
16:02:07*couven92 joined #nim
16:02:38*zachcarter_ quit (Client Quit)
16:03:34*zachcarter quit (Ping timeout: 240 seconds)
16:03:44*krux02 joined #nim
16:04:47*Vladar joined #nim
16:06:04*libman joined #nim
16:13:01*BitPuffin joined #nim
16:21:50*vlad1777d joined #nim
16:29:18*yglukhov joined #nim
16:33:57*yglukhov quit (Ping timeout: 264 seconds)
16:38:27*arnetheduck quit (Ping timeout: 246 seconds)
16:42:27*yglukhov joined #nim
16:44:51*Serenitor joined #nim
16:47:03*yglukhov quit (Remote host closed the connection)
16:50:48*BitPuffin quit (Read error: Connection reset by peer)
16:51:26*BitPuffin joined #nim
17:05:44*krux02 quit (Remote host closed the connection)
17:06:37*yglukhov joined #nim
17:07:41*Trustable joined #nim
17:34:26Araqer ... offtopic but how does routing work in single page apps? what JS event does it trigger?
17:35:21PMunchAraq, depends a bit Araq
17:35:34dom96http://caniuse.com/#search=hash
17:35:37dom96Probably that one
17:35:49PMunchNowadays you use push to the history and you get an event when it changes
17:36:01*yglukhov quit (Remote host closed the connection)
17:36:15PMunchSo you can actually use the back buttons and such
17:36:30dom96But honestly, why reinvent what the browser does for you already?
17:38:13PMunchWell, single-page apps have the benefit that they only load once
17:39:04PMunchAnd then typically only pulls small JSON objects if it needs it
17:39:17demi-megabytes and megabytes of javascript, yum
17:39:28PMunchFair point :P
17:39:32PMunchDoesn't have to be that huge though
17:39:38TiberiumVarriount: even with injectStacktrace off cpu usage is 100%
17:39:40couven92Araq, removed vccdiscover now...
17:39:46Tiberiumstill the same log for 3 million samples
17:40:10Tiberiumsomething is constantly throwing an error?
17:40:23PMunchI wrote a single file task tracker with HTML+JSON+CSS that auto-resolves git conflicts within the file itself so you can keep it in your repository and it's smaller than jQuery
17:40:26dom96PMunch: I really doubt the JSON they pull is small
17:40:30Tiberiumhttps://gist.github.com/TiberiumN/d4b85165c0452b95809db669e0b5f529
17:40:50PMunchdom96, smaller than a modern web-page
17:40:54dom96How?
17:41:01couven92PMunch, but ALite still does not work because you cannot save state
17:41:07dom96You still need to construct a full page using this JSON
17:41:13PMunchOf course you can, right-click save os
17:41:18PMunchs/os/as
17:41:37PMunchThe save button is just apparently broken in IE for some reason
17:41:57couven92no, it didn't work in either of Firefox, Edge, Chrome and IE
17:42:15PMunchWorked fine for me in Chrome and Vivaldi, along with Opera on my phone..
17:42:19PMunchBut besides the point
17:42:34dom96I don't see how the size can differ too much. For a normal web page the extra data is cached.
17:42:50PMunchdom96, but to change from one page to a completely different one you only need to pull the text data
17:43:02PMunchWell some of it
17:43:08dom96couven92: hey! Are you still planning to work on SChannel?
17:43:11PMunchI guess it wouldn't be that big a difference
17:43:52dom96Yeah, it's really not worth this small difference
17:43:55dom96Whatever it is.
17:43:55couven92dom96, I am! I am flying to Germany tomorrow for Easter holidays :) I'll do it while on holiday :)
17:44:03dom96couven92: yay, awesome
17:44:18PMunchWell, all side menus, footer, header etc. would still need to be loaded..
17:44:26PMunchDepends a bit on the content I think
17:45:48dom96I doubt those things are that large.
17:47:03demi-most modern websites don't work on anything less than full-speed LTE 
17:48:57Tiberiumhow can I debug high cpu usage? maybe with gdb? so I can see nim source lines
17:49:12PMunchdemi-, yeah it's a bit of a mess
17:50:56dom96also, I find it funny how the progress bar was removed by web browsers
17:51:00dom96and then brought back by websites
17:52:06PMunchHuh? I still have progress bars in all my browsers..
17:52:07couven92dom96, especially since progress bars is sth that is mostly supported natively by all OSes
17:52:23couven92PMunch, but there is no HTML5 element for that
17:52:41PMunchFor a progress bar? That's true..
17:52:42dom96PMunch: What web browsers are you using?
17:52:58PMunchVivaldi on my desktop and Opera on my phone
17:54:24dom96Ahh. Yeah, but Chrome/Firefox/Safari and IE (IIRC) don't have a progress bar anymore
17:54:57PMunchHmm, that's a shame
17:55:22couven92neither has Edge
17:55:25PMunchHowever websites nowadays can load stuff from other sources dynamically. So the progress bar might not even be correct
17:56:23Tiberiumthere's progress bar on chrome on android
17:56:36Tiberiumbut it doesn't really make any sense
17:56:53couven92Tiberium, yeah, that's right... But it is also really subtle
17:56:59Tiberiumor maybe does, but I have 4G so I'm fine :)
17:59:25Araqdom96: that site doesn't really help me
17:59:43dom96Araq: search for "js hash change event"
18:01:38Araqhttps://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onhashchange =
18:01:40Araq?
18:02:15*yglukhov joined #nim
18:03:18dom96sure
18:26:02*nsf joined #nim
18:29:22*nhywyll joined #nim
18:30:31*Tiberium quit (Remote host closed the connection)
18:47:23*xet7 quit (Quit: Leaving)
18:51:42*yglukhov quit (Remote host closed the connection)
18:51:59*yglukhov joined #nim
19:01:28*fredrik92 joined #nim
19:03:57*couven92 quit (Ping timeout: 264 seconds)
19:05:10*yglukhov quit (Remote host closed the connection)
19:05:34*hcorion joined #nim
19:20:34FromGitter<Varriount> @TiberiumPY Hm.
19:21:40*Sembei joined #nim
19:21:47*Vladar quit (Quit: Leaving)
19:24:19FromGitter<Varriount> @TiberiumPY You could try removing/disabling portions of your code. Does perf have a way of generating flame graphs?
19:33:44*Arrrr quit (Quit: Leaving.)
19:34:58ldleworkAraq: I have been impressing people all over with that concepts example we worked on yesterday
19:37:46FromGitter<Varriount> ldlework: What example?
19:38:01ldleworkhttps://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133
19:40:30dom96"yesterday" hehe. Still the same day for me.
19:40:55FromGitter<Varriount> ===nim spans around the globe!===
19:40:56ldleworkhehe yeah only a handful of hours ago I guess
19:41:09ldleworkVarriount, "the sun never sets on the Nim empire"
19:42:51dom96I'm having a hard time imagining what this code would be used for
19:42:55dom96What are you using it for?
19:44:05*nsf quit (Quit: WeeChat 1.7)
19:44:10*Trustable quit (Remote host closed the connection)
19:44:35ldleworkdom96: I'm implementing a visual modular-synth editor like NimSynth that ftsf is working on. Mine will feature typed ports on the modules. Each port will be assigned a Value.
19:44:50dom96oh cool
19:45:00ldleworkI'm not sure if it is useful to do it this way yet, I am just experimenting and got stuck in a pl-design-K-hole trying to express the isomorphism
19:45:13ldleworkNim is good drug for that.
19:45:28FromGitter<Varriount> ldlework: Do it aaalll in macros. >:D
19:45:47ldleworkVarriout, the actual module definitions will be a nice macro for sure
19:45:59*BitPuffin quit (Read error: Connection reset by peer)
19:46:13dom96ldlework: Glad you're rediscovering the magic of Nim :)
19:46:14ldleworkI tried to help ftsf with their project but they are allergic to abstraction
19:46:22ldleworkAnd I'm basically chemically dependent on it
19:46:42FromGitter<Varriount> Hrm. You can have too much of a good thing.
19:46:51dom96More than one synth project couldn't hurt :)
19:47:11ldleworkVarriount, Nim represents to me the language that is capable of expressing the densest isomorphs.
19:47:12dom96I think we should start featuring these projects on Nim's website
19:47:22ldleworkIf I cared about the application itself, I would write it in Unity and make money.
19:47:30dom96ftsf created some really awesome things that will immediately make people go "wow"
19:47:40ldlework+1
19:47:46ldleworkHis synth is incredible
19:48:00ldleworkQuite literally, inspiring. :)
19:48:12ldleworkSpaghetti code for miles though.
19:48:17ldlework^^
19:48:51ldleworkI'm building just a toy version as the next example app for Dadren
19:50:06ldleworkNim allows me to directly exercise my sixth cortical layer.
19:51:51ldlework(where the highest-order invariant representations of your knowledge exists, before patters are kicked off to the hypothalamus for short-term memory processing)
19:52:30FromGitter<Varriount> <3 Psychology
19:53:13ldleworkVarriount, Jeff Hawkins' _On Intelligence_ and Michael Graziano's _The Social Brain_ are the two of the four most important non-fiction books I've ever read.
20:00:52*hcorion quit (Quit: Konversation terminated!)
20:01:05*libman quit (Quit: Connection closed for inactivity)
20:07:21*vivus joined #nim
20:08:49vivusare there any libs for log-analysis in nim ?
20:11:09ldleworkI don't see anything on the package listing
20:12:16*rokups quit (Quit: Connection closed for inactivity)
20:13:32vivusldlework: I just need to match x-thousand IPs from the log against a set of IPs. any idea of a way to store those IPs and match them efficiently ?
20:16:30demi-lol
20:18:23ldleworkvivus: I mean just implement it. Nim is fast, and then you can profile your implementation.
20:19:00vivusldlework: that is true, but I am asking for ways to store the IP. would a seq be good enough?
20:19:16ldleworkYou could calculate how much memory it will cost you
20:19:33ldleworkAlso, "good enough" is an answer of profiling
20:19:52ldleworkmake a naive implementation who's code cares to expose what you're doing rather than care about speed
20:20:00ldleworkmaybe its already wayyyy faster than you care about
20:20:08ldleworkmaybe it needs slight optimization
20:20:11ldleworkmaybe you have to rewrite it
20:20:18vivusI guess you're right, first build, then optimize
20:26:04*libman joined #nim
20:31:47FromGitter<TiberiumPY> @Varriount maybe I can try the simplest way - add echo to every proc so this echo would output proc name
20:32:14FromGitter<TiberiumPY> So I would know which proc was called last or which is called many times
20:32:45dom96vivus: I think you might be looking for a set
20:32:51*Matthias247 joined #nim
20:33:48ldleworkMy friend who knows rust thinks that rust could accomplish the same feat as the concept example above but I think they are confused
20:37:35ldleworkthe real special sauce in this example is that the `when` blocks take place at compile time, and are run for each implementation expansion. And so you get multiple implementations of `set` each one with the exact code to handle the type.
20:38:16ldleworkIn other languages you need to dispatch either at runtime, or you need to write "setWithValue" "setWithValueAndMin" "setWithValueAndMax"
20:38:53ldleworkAnd likely you need to create second-order traits the capture each unique combination of the first order traits
20:39:02ldleworkI'm not a Rust expert but I don't think its even close.
20:39:12cheatfatevivus, this is not true `first build, then optimize` :)
20:40:02cheatfatevivus, if you need only IPv4 without port information the best way to store it is uint32/int32
20:40:10ldleworkcheatfate: good thinking
20:40:23cheatfateif it has port information, then you can use uint64
20:40:55cheatfateand maybe its better to start from tree structure
20:41:00cheatfatenot sequence
20:41:01dom96ldlework: ask your friend to implement it in Rust :)
20:41:11ldleworkdom96: ya.
20:42:21dom96So I'm thinking about how to best prevent cheating the high score in my poor little Snake game.
20:42:40ldleworkdom96: hahahahaha
20:43:01ldleworkdom96: it doesn't matter what the game is
20:43:05ldleworkthe answers are the same
20:43:17dom96Yeah.
20:43:20ldleworkdom96: does Nim have a threadless goroutine like thing? run each game as a simulation on the server
20:43:33dom96But I don't want to put the simulation on the server.
20:43:43ldleworkWell that's what the answer is...
20:43:58ldleworkYou could further obsfucate your javascript
20:44:02ldleworkbut then I can just look at the wire
20:44:07ldleworkwhat now?
20:44:23dom96I'm considering storing a replay and submitting that
20:44:39ldleworkWhat will that do
20:44:40FromGitter<TiberiumPY> Use http over TCP over websockets :D
20:44:46ldleworkrun it as a simulation on the server?
20:44:50ldleworkXD
20:44:51dom96That way I can at least verify manually whether it's a cheat or not
20:45:13ldleworksure but now I can just generate a replay
20:45:18ldleworkwhich sounds like a fun challenge
20:45:21dom96lol
20:45:35dom96yeah, but it's more difficult :P
20:45:35FromGitter<TiberiumPY> This is not a joke btw
20:45:38FromGitter<TiberiumPY> https://github.com/n1nj4sec/pupy/blob/master/README.md
20:45:42ldleworkin the end, writing an AI for snake is very easy
20:45:46FromGitter<Varriount> ldlework: We have a Go GC backend, with Goroutines
20:45:48dom96precisely
20:45:55ldleworkI saw a snake AI implemented as a CA before
20:46:02FromGitter<TiberiumPY> "All transports in pupy are stackable. This mean that by creating a custom transport conf (pupy/network/transport/<transport_name>/conf.py), you can make you pupy session looks like anything. For example you could stack HTTP over HTTP over base64 over HTTP over AES over obfs3 :o)"
20:46:02dom96In the end, even a server-side simulation isn't fool-proof.
20:46:10FromGitter<TiberiumPY> I don't know how it works
20:46:15ldleworkdom96: yes but at least you are teaching people AI
20:46:21ldleworkso the cheating has value
20:47:02ldleworkheh for generating the replay
20:47:17dom96I want the game to work even if the server is down though
20:47:23ldleworkyou can just have the snake go around the outside in a spiral going inwards, generating the food infront of their face on each turn
20:47:23*bjz joined #nim
20:47:27*nhywyll quit (Quit: nhywyll)
20:47:56FromGitter<TiberiumPY> Make offline version without score submitting
20:47:58dom96Yes, but like I said, I can verify that myself.
20:47:59ldleworkI suppose any curve filling pattern would work
20:48:13FromGitter<TiberiumPY> Or with later submitting via replay
20:48:24dom96Tiberium: yes, that's my plan currently.
20:48:42dom96I want to ensure that if the server crashes, that I can bring it back and let people reconnect.
20:48:59ldleworkdom96: write a convolutional network to review the replays for a while before the cheaters get started
20:49:04dom96Without losing their high score
20:49:24dom96a convolutional network eh? What is that? :)
20:49:28ldleworkdom96: whaat?
20:49:45ldleworkI figured you'd be all over deep learning
20:50:07FromGitter<Varriount> The most I know about convolution is that it's a kind a image filter. :/
20:50:23ldleworkSame principle is used in some learning networks
20:50:37ldleworkhttps://www.youtube.com/watch?v=FmpDIaiMIeA
20:50:50dom96I probably would be if I didn't spend so much time working on Nim things
20:50:51ldleworkThey learn higher and higher order features
20:51:27ldleworkSeriously just order _On Intelligence_ and read it
20:51:29FromGitter<TiberiumPY> Make neural networking library for Nim :)
20:51:42ldleworkyou wont regret it and it will update your neuroscience real good
20:51:55ldleworkIt will teach you the general cortical learning algorithm
20:52:39ldleworkhow regions of cortical columns work together to store invariant representations of memories to create all the new-brain knowledge you have
20:53:01ldleworkhow actually remembering how to move is what causes you to move
20:53:43ldleworkugh it kinda gives me strange internal vertigo thinking about it
20:54:10*dom96 adds it to his Amazon wishlist
20:58:15FromGitter<TiberiumPY> Is it a good idea for me to create something like terraria (but simpler) in Nim for self education?
20:58:45dom96sure, sounds like a fun project.
20:59:02FromGitter<TiberiumPY> And what's game framework I need to choose? Something like nimgame2?
20:59:04dom96Then move on to a Minecraft clone :)
20:59:47dom96That I cannot say, I never used it.
21:00:05dom96Although if you want to learn you should probably just go with sdl2
21:00:30FromGitter<TiberiumPY> (terraria because my friend was doing simple terraria-style game with blocks with python and pygame, and then he moved to Java because of performance)
21:00:52FromGitter<TiberiumPY> Probably it's because pygame uses sdl1
21:00:58dom96ahh, so you want to beat his performance? :D
21:00:58FromGitter<TiberiumPY> Which is very old
21:01:25dom96More likely because Python is just darn slow
21:01:52FromGitter<TiberiumPY> I didn't create any real games yet, so I need to star
21:03:01FromGitter<TiberiumPY> *start
21:04:34*nightmared joined #nim
21:06:27ldleworkTiberiumPY wanna get acquainted with Dadren?
21:06:49ldleworkTiberiumPY, that's my SDL2 game library for Nim
21:08:30FromGitter<TiberiumPY> I've never made any real game, so I'm like a noob there, but sure :) (also I'm not good at Nim for now)
21:08:59FromGitter<TiberiumPY> Well I can use Nim, but no big metaprogramming etc
21:09:44ldleworkTiberiumPY well that's good if we make it easy for you we make it easy for everyone else too
21:09:54ldleworkI think I have a good sense for API design but you never know
21:11:04FromGitter<stisa> Idlework : do you have a link?
21:13:32ldleworkhttps://github.com/dustinlacewell/dadren
21:13:39ldleworkignore the readme, which is actually for a game I want to write
21:13:49ldleworksome minimal docs here, http://dadren.github.io/
21:14:03ldleworkI put it down for a long time since the first period of progess
21:14:10ldleworkBut I recently updated it for latest nim
21:14:38ldleworkso you can clone it and build the hatchet example which includes an example of biome generation and tilemap and camera, etc
21:21:04FromGitter<TiberiumPY> By the way, waiting for wasm so we can enjoy Nim speeds in browser :)
21:31:37FromGitter<TiberiumPY> Wait
21:32:10FromGitter<TiberiumPY> There's seems to be new GCC back end ⏎ Without emscripten
21:36:00dom96no support for marshal in JS target? D:
21:37:52FromGitter<TiberiumPY> I believe in 3-5 years almost all modern programming languages will support wasm
21:38:06FromGitter<TiberiumPY> Including interpreted ones
21:38:24FromGitter<TiberiumPY> So rip JS :d
21:38:33dom96I wouldn't be so sure
21:38:38ldleworkheh
21:38:38dom96Keep in mind what happened with asm.js
21:39:55*Jesin quit (Quit: Leaving)
21:40:37ldleworkTiberiumPY let me know if you take a look over Dadren and the hatchet example
21:41:58FromGitter<TiberiumPY> Ok, only tomorrow, after school :D
21:42:25dom96Araq: Any ideas why string streams aren't supported in the JS target?
21:43:43*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:45:00dom96le sigh
21:46:28ldleworklol
21:46:50dom96I recall flyx running into the same problem
21:49:41dom96IRC logs sure are handy :) https://irclogs.nim-lang.org/04-09-2016.html#14:51:52
21:50:00dom96Sadly it doesn't help me
21:50:59*rauss quit (Quit: WeeChat 1.7)
21:51:14ldleworkdom96: why don't you simply offer a procedure that accepts a string?
21:51:22dom96lol
21:51:57dom96ldlework: a) Stream seams more versatile and b) marshal needs a Stream
21:52:02ldleworkhehe
21:57:49Araqdom96: not sure, make it work
22:00:13dom96Araq: how do I implement copyMem for the JS target?
22:00:34Araqa for loop?
22:03:09dom96is it safe to just use `=`, or do I need to copy somehow?
22:03:15*devted quit (Quit: Sleeping.)
22:03:42Araq= should be fine
22:11:14dom96Looks likeI can't simply write: pointer[0] :/
22:16:57*Sembei quit (Ping timeout: 240 seconds)
22:17:57*bjz joined #nim
22:19:50*zachcarter joined #nim
22:21:39dom96lib/core/typeinfo.nim(513, 35) Error: internal error: genDeref
22:21:45dom96oh well
22:21:49dom96good night]
22:25:34*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:26:45*zachcarter_ joined #nim
22:27:47*zachcarter quit (Ping timeout: 240 seconds)
22:27:47*zachcarter_ is now known as zachcarter
22:42:22*Nobabs27 joined #nim
22:45:12*krux02 joined #nim
22:46:04*PMunch quit (Quit: leaving)
22:47:34*nsf joined #nim
22:49:46fredrik92Araq, I needed some instant gratification, so I went ahead and picked one of the Easy marked issues on GitHub from 2015... https://github.com/nim-lang/Nim/pull/5663
22:50:25*fredrik92 is now known as couven92
22:51:23Araqcool. the next time learn to type 'template' instead of CRTL+C CTRL+V
22:52:34couven92oops :D
22:53:18*Jesin joined #nim
22:53:42AraqNim is not Java, you don't need a never ending clusterfuck of boilerplate because there is no control flow abstraction available.
22:54:07krux02Araq: i kind of want to implement sizeof/alignof, but I have problems
22:55:10krux02I tried to find out how sizeof actually works, but I am very puzzled
22:55:30couven92ok, I'll read up on templates on the plane tomorrow... Good night. :)
22:56:24krux02I have a working version based on macros, but it misses one single bit of information, the knowledge if an object is packed
22:56:28*couven92 quit (Quit: Client Disconnecting)
22:58:46Araqkrux02: can you patch the compiler please?
22:59:24krux02well that is what I want to do, but I can't do it, because I don't understand the sourcecode
22:59:42AraqtfPacked in t.flags
23:00:30krux02ok
23:00:32*nsf quit (Quit: WeeChat 1.7)
23:00:57krux02I still don't know where the sizeof that is executed on the vm is implemented
23:01:33krux02when I grep for SizeOf, I found caseof branch with this line:
23:01:49krux02 globalError(n.info, errCannotInterpretNodeX, renderTree(n))
23:02:27Araqthe vm expects this to be already evaluated in this stage of the compiler pipeline
23:02:43Araqtypes.computeSize is what you're looking for
23:04:12krux02ok thanks
23:04:20*rauss joined #nim
23:04:40krux02now I have something to work with
23:06:26libmanhttp://libman.org/img/scr/20170404-nake.png
23:09:21*vlad1777d quit (Quit: Leaving)
23:10:02krux02I am a bit puzzled about compileSizeAux, it has a var parameter for the result, but also a result
23:13:06krux02ok I think a is for the alignment
23:18:57libman... but `cd ~/.nimble/pkgs/nake-1.9 && nimble install` works.
23:20:17libmanBut then all files in that directory except "nimblemeta.json" become 0 bytes.
23:21:58libmanShould I file this as a nimble issue on github?
23:24:43*winnebagel joined #nim
23:24:47*Matthias247 quit (Read error: Connection reset by peer)
23:40:01FromGitter<Varriount> krux02: Exploring the compiler source code? I hope you've brought along a torch and a map.
23:42:00krux02Varriount: well I first clean up a bit the code that I am going to change
23:42:07krux02I hope Araq likes it
23:44:10FromGitter<Varriount> krux02: There's only one person who knows what Araq likes. ;P
23:44:20ldlework^^
23:56:09*arnetheduck joined #nim