<< 18-07-2018 >>

00:00:06zacharycarterfails with invalid indentation
00:00:39*FromGitter quit (Read error: Connection reset by peer)
00:00:48*FromGitter joined #nim
00:00:53zacharycarterAlright - need some help with some type design
00:01:07*zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/rqyOGjTBakxxlRhERpIoBlpG >
00:01:11zacharycarterI want to do something like this -
00:01:28*zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/PUfawjbnDSwVxwIoLqZhVuQY >
00:01:41*zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/txARTXJDzQJBiMddYqNJILyr >
00:02:00zacharycarterbut I don't know how to mix types for the value / 2nd generic param
00:03:33FromGitter<rayman22201> @zacharycarter this does not compile though: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4e83c4ecc1f82e2fc08f01]
00:03:55*avsej joined #nim
00:03:55*avsej quit (Changing host)
00:03:55*avsej joined #nim
00:04:39*zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/yYHBehKGwteftBJpSDRSvsYb >
00:04:41zacharycarterwill though
00:05:55FromGitter<rayman22201> interesting. You are correct
00:06:28FromGitter<rayman22201> That fixed that issue. Thanks! The compiler could probably use a better error message there.
00:06:59zacharycarteryeah - may want to file an issue
00:07:09FromGitter<rayman22201> I now get the error: ```lib/pure/pegs.nim(91, 11) Error: attempt to redefine: 'sons'```
00:07:12zacharycarterI don't think Nim supports declarations like that
00:07:41zacharycarterah yeah you can't redefinine a type attribute with the same name in multiple case clauses in the same varidic type
00:07:42zacharycarterso
00:08:16*zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/iASgCuNRXcPSrFrYYeAesObG >
00:08:18zacharycartersorry
00:08:27*FromGitter quit (Read error: Connection reset by peer)
00:09:01*NimBot joined #nim
00:09:05zacharycarterbasically if you have the type attribute bar defined under 0
00:09:08zacharycarteryou can't re-define it again under `1
00:09:21zacharycarterit has to have a different identifier
00:10:54FromGitter<rayman22201> is that behavior considered a bug / open issue, or is it just an accepted design limitation?
00:11:24*zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/NOrKcHudcjbwyGRNcufMzpJg >
00:11:44*zacharycarter sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/MDBHuOvGxMwhkGNTLEvVBdUg >
00:12:02zacharycarterthis is as designed - it'd be very difficult to overcome this limitation
00:12:19*FromGitter quit (Read error: Connection reset by peer)
00:12:33zacharycarterthe compiler would have to get very smart
00:12:48zacharycarterand it's already very smart
00:12:58*FromGitter joined #nim
00:13:53*avsej quit (Ping timeout: 248 seconds)
00:14:20FromGitter<rayman22201> lol. ok? and?
00:17:10zacharycarterthat's the answer
00:17:35zacharycarterit's not going to be doable - not in the forseeable future of the language
00:17:45FromGitter<rayman22201> My question is why?
00:17:52zacharycarterI explained why
00:18:20zacharycarterit's extremely difficult to do in the compiler
00:18:31zacharycarterI didn't write the compiler
00:18:32*FromGitter quit (Read error: Connection reset by peer)
00:18:41zacharycarterbug Andreas if you want a real answer
00:20:02*FromGitter joined #nim
00:20:25*avsej joined #nim
00:20:25*avsej quit (Changing host)
00:20:25*avsej joined #nim
00:27:16*erblite joined #nim
00:30:21*xylef joined #nim
00:37:23FromGitter<rayman22201> Nothing? Is there documentation on this limitation anywhere? Github wiki, Github issue, the forum? I'm not trying to be an ass, I just want to understand this limitation better.
00:38:20FromGitter<rayman22201> It seems like the kind of thing that should be in the docs at least.
00:40:10zacharycarterI'm pretty sure it is
00:40:24zacharycarterhttps://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
00:40:38zacharycarteryou can always dig into the compiler to understand why it'd be difficult
00:41:30FromGitter<rayman22201> where does that document describe that limitation?
00:43:05FromGitter<rayman22201> neither is it described here: https://nim-lang.org/docs/manual.html#types-object-variants
00:43:11zacharycarterI'm not sure that it does - I was just linking to where I knew the doc was
00:43:31*FromGitter quit (Remote host closed the connection)
00:43:34zacharycarterwell - I guess the argument from the language creator would probably be that it doesn't assert that it allows for that either
00:43:39*FromGitter joined #nim
00:44:05zacharycarterand since Nim is built on top of C, it's on the user when they assert that the language does exhibit such a feature
00:44:16zacharycarterbut I don't disagree that a PR couldn't hurt
00:45:03zacharycarterbut I A) Don't know where the best place to put the comment would be or B) how it would be best phrased
00:45:27zacharycartermaybe an issue would be the best place to start - not sure if there is one already existing or not
00:45:28*FromGitter quit (Read error: Connection reset by peer)
00:46:07*FromGitter joined #nim
00:46:23zacharycartergoing to skate to the convenience store real quick, be back in a few
00:46:37FromGitter<rayman22201> πŸ‘
00:47:07*subsetpark quit (Quit: --)
00:50:29CodeVancerayman there's the docs for the compiler internal
00:50:49*FromGitter quit (Remote host closed the connection)
00:50:58*FromGitter joined #nim
00:51:21CodeVancehttps://nim-lang.org/docs/intern.html#the-compiler-s-architecture-short-description-of-nim-s-modules
00:56:14*avsej quit (Ping timeout: 256 seconds)
01:01:18*subsetpark joined #nim
01:03:55*avsej joined #nim
01:03:55*avsej quit (Changing host)
01:03:55*avsej joined #nim
01:07:25*cspar_ joined #nim
01:08:35*avsej quit (Ping timeout: 240 seconds)
01:17:58*Jesin joined #nim
01:21:26*avsej joined #nim
01:21:26*avsej quit (Changing host)
01:21:26*avsej joined #nim
01:31:29*avsej quit (Ping timeout: 256 seconds)
01:32:36*slmjkdbtl joined #nim
01:32:37*slmjkdbtl left #nim (#nim)
01:38:01*avsej joined #nim
01:38:01*avsej quit (Changing host)
01:38:01*avsej joined #nim
01:39:37*donlzx quit (Remote host closed the connection)
01:40:02*donlzx joined #nim
01:42:42*avsej quit (Ping timeout: 256 seconds)
01:50:24*avsej joined #nim
01:50:24*avsej quit (Changing host)
01:50:24*avsej joined #nim
01:52:05skrylari bring more presents https://github.com/skrylar/raylib-nim
01:54:02*leorize quit (Ping timeout: 256 seconds)
01:56:40*death916 quit (Quit: EliteBNC 1.6.5 - http://elitebnc.org)
02:00:09*Death916_ joined #nim
02:00:09*Death916_ quit (Changing host)
02:00:09*Death916_ joined #nim
02:00:09*Death916_ quit (Changing host)
02:00:09*Death916_ joined #nim
02:01:07*Snircle joined #nim
02:02:25*Snircle quit (Client Quit)
02:03:21*vegax87 quit (Quit: EliteBNC - http://www.elitebnc.net/)
02:16:19CodeVancethanks XD
02:17:23zacharycarterskrylar: zengine is basically a giant port of raylib πŸ˜…
02:17:31zacharycarterwith some added stuff
02:17:35zacharycarterand some missing stuff
02:17:59zacharycarterbut anyhow - I'm going to work on a new engine soon
02:18:06zacharycarterand skeasing will be in it for sure!
02:18:35zacharycarteralthough I really think you should name the library skeasy
02:19:48*Death916_ is now known as death916
02:24:28*donlzx quit (Remote host closed the connection)
02:31:42*donlzx joined #nim
02:37:32*vegax87 joined #nim
02:41:20skrylarzacharycarter, i did a big bugfix to skeasing the other day. and added physics springs
02:46:52*BitPuffin quit (Remote host closed the connection)
03:02:02*gangstacat quit (Ping timeout: 256 seconds)
03:04:20*gangstacat joined #nim
03:06:26*erblite quit (Ping timeout: 276 seconds)
03:07:40*endragor joined #nim
03:24:33FromGitter<gogolxdong> Is there any SOAP nimble packeage?
03:29:31*krux02 quit (Remote host closed the connection)
03:47:01skrylari don't see one
03:49:03skrylarzacharycarter, have you dealt with lattice deformations? having a trouble wrapping my head around them, although current best guess is to subdivide NxN lattices in to smaller 2x2's
03:49:47*dddddd quit (Remote host closed the connection)
03:50:26skrylarwill probably have to shelve the question until i have a tesselator and preview rig though :\
04:10:07FromGitter<gogolxdong> then how to translate a SOAP python serializer to nim?
04:23:45skrylaruse custom pragmas for annotations, have a macro scrape those annotations and generate code using the xml module to produce xml output?
04:27:26*xet7 joined #nim
04:42:38skrylarheh reading the 2017 survey; people wanted tk?
04:42:50skrylarI mean, i guess. Tk is a decently simple GUI, not a lot to it tho
05:09:01*beaumonta joined #nim
05:09:44*zama_ joined #nim
05:10:40*Calinou_ joined #nim
05:11:09*dzho_ joined #nim
05:16:29*Cthalupa quit (*.net *.split)
05:16:29*zama quit (*.net *.split)
05:16:35*Calinou quit (*.net *.split)
05:16:35*odc quit (*.net *.split)
05:16:35*zielmicha_ quit (*.net *.split)
05:16:35*euantor quit (*.net *.split)
05:16:35*m712 quit (*.net *.split)
05:16:35*dvn quit (*.net *.split)
05:16:35*dzho quit (*.net *.split)
05:16:35*abeaumont quit (*.net *.split)
05:17:45*Cthalupa joined #nim
05:20:07*zama_ quit (Changing host)
05:20:07*zama_ joined #nim
05:20:09*zama_ is now known as zama
05:24:30*nsf joined #nim
05:30:11*xet7 quit (Remote host closed the connection)
05:34:12*amosbird quit (Read error: Connection timed out)
05:34:41*amosbird joined #nim
05:35:13*dvn joined #nim
05:35:13*odc joined #nim
05:35:13*zielmicha_ joined #nim
05:35:13*euantor joined #nim
05:35:13*m712 joined #nim
06:06:09*xet7 joined #nim
06:26:12FromGitter<gogolxdong> Is tk popular ? never heard of.
06:29:48FromGitter<gogolxdong> tried http://rosettacode.org/wiki/100_doors#Tcl
06:33:20CodeVancepython
06:33:28Araqtk itself is undead
06:33:44Araqbut it's the standard UI lib for Python and maybe for Ruby too
06:34:36CodeVancetk would actually benifit from nim's macros
06:34:54Araqmost UIs would, see Karax.
06:34:56CodeVancesince theres so much boilerplate
06:35:15CodeVanceWhat I don't like about tk is the interface with its internals
06:35:30CodeVanceI know but tk especially.
06:39:59FromGitter<rayman22201> Good morning @Araq! Can you explain to me the situation with Variant types not being able to redefine type fields with the same name?
06:40:15Araqthere is a long issue about it
06:40:45FromGitter<rayman22201> Is there a github link I can read?
06:46:37Araqhttps://github.com/nim-lang/Nim/issues/3629
06:47:05FromGitter<rayman22201> Thank you! πŸ˜„ my search skills suck today
07:41:36*PMunch joined #nim
07:42:43PMunchHmm, we should promote this pattern in the internal options menu: https://github.com/superfunc/maybe
07:43:14*ng0 joined #nim
07:43:24PMunchs/menu/module
07:47:54FromGitter<mratsim> sounds good.
07:48:00Araqwhich pattern?
07:56:42PMunchInstead of doing a check if an option is valid, then try to access it's variable, have a block that exposes the value to you if it's there, and one where it's not there.
07:57:29PMunchRight now it would be entirely possible to do "if not x.isSome: echo x.get"
07:57:36PMunchWhich obviously won't work
07:57:55PMunchhttps://shreevatsa.wordpress.com/2015/01/31/boolean-blindness/
07:58:43PMunchCame across this when looking at Toccata: http://www.toccata.io/2017/10/No-Booleans.html
07:58:55PMunchIt's a functional language that compiles to C, and it doesn't have booleans
07:59:04PMunchNo if clauses
08:00:13AraqI've seen that, yes.
08:00:23AraqAnd don't understand it.
08:01:01PMunchWhat do you mean you don't understand it?
08:01:16Araq"bool" is not a result from "goto" statements, it's stupid
08:01:53Araqboolean logic predates imperative asm programming by hundreds of years
08:02:36Araqnor is the compression of information "bad".
08:02:47Araqevery "sum" and "avg" operation does that too.
08:03:11PMunchYeah he's not saying that booleans comes from gotos
08:03:37PMunchHe was just using gotos as an example of things most modern languages have removed, or at least shuns.
08:04:30PMunchAnd compression of information, while not inherently bad, can be scary
08:05:01Araqcompression is the essence of perception.
08:06:41PMunchLook at the maybe/options use-case. By creating two scopes, one with the value present, and one without it, we don't lose any information about our maybe. This means that we can't mess up something which is obviously illegal.
08:09:02PMunchOr consider NULL pointers, not a huge problem in Nim, but it happens from time to time. By compressing the check myPointer == nil into a boolean you've essentially lost information about what that boolean means. Booleans as a type is yes true or false, without retaining any information about what they actually checked. By scoping this in a similar way to the options we ensure that we can't create null pointer dereferences as the null pointer isn't visible in
08:09:02PMunchour scope.
08:09:08FromGitter<mratsim> > As Conor McBride puts it, to make use of a Boolean you have to know its provenance so that you can know what it means. ⏎ […] ⏎ > Keeping track of this information (or attempting to recover it using any number of program analysis techniques) is notoriously difficult. ⏎ ⏎ Checking where a boolean comes from is difficult? [https://gitter.im/nim-lang/Nim?at=5b4ef5a44b583a74a7250e46]
08:10:20FromGitter<mratsim> I’m fine with superfund/maybe pattern, currently reading the boolean blindness article but I think the hypothesis it’s starting with is flawed.
08:10:27PMunch@mratsim, if you only have a boolean it's impossible to know where it comes from
08:10:56FromGitter<mratsim> if you only have an int it’s impossible to know where it comes from, should we remove int?
08:11:51FromGitter<mratsim> i.e. use enums and a proper type system.
08:11:51PMunchNo, the idea is that while 5 is just a number, true carries some implicit meaning of what is true
08:12:27PMunchYeah, that is one way to solve a lot of the things they point out
08:13:00FromGitter<mratsim> 5 is not just a number, it can be kilometrs, miles, integer_overflow_error, launch the missile, health remaining, Passport ID
08:13:00PMunchI'm not saying we should go crazy and delete booleans from Nim by the way :P I just wanted to see it in the options module :P
08:13:26PMunchYes of course
08:14:01PMunchWhich is where distinct types comes in
08:16:49FromGitter<mratsim> I much prefer this essay by the same author: btw, it’s quite funny: https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
08:18:25PMunchI haven't actually read it yet, but I've seen it referenced. I think I'll read it right away :)
08:21:41*regtools joined #nim
08:21:46*regtools quit (Client Quit)
08:21:51*ng0 quit (Quit: Alexa, when is the end of world?)
08:30:49Araq"I’m fine with superfund/maybe pattern, currently reading the boolean blindness article but I think the hypothesis it’s starting with is flawed" exactly my position too.
08:37:22PMunchhttp://www.hxa.name/notes/note-hxa7241-20131124T0927Z.html <- This talks about the issue you raised mratsim of "5 is not just a number"
08:38:13PMunchAnd I agree with you, the same way a bool only carries its value, so does an integer
08:40:12PMunchImagine the case where we have many procedures which passes pointers around, each should check if it's null, even if that check was just done in the previous procedure.
08:41:02PMunchIf we had created a distinct type NonNullablePtr and required that for all our procedures along with creating some way to check and convert a pointer to a NonNullablePtr this check could be done once.
08:44:29PMunchHmm, in a macro, can you hide a symbol?
08:44:34Araqsure, so it's about 'nil' again.
08:45:27PMunchHuh, not really. That was just an example. You can make the exact same argument with e.g. range types
08:46:08PMunchOr any distinct type really
08:57:36*Vladar joined #nim
09:11:43*chemist69 joined #nim
09:33:14*dddddd joined #nim
09:44:36*yglukhov[i] joined #nim
09:55:11FromGitter<tim-st> @Araq I think it would be better if the github tags for compiler crashes are separated between crash with line number and crash without linenumber. the last one is more critical imo
09:56:43FromGitter<Vindaar> @Araq could you explain to me / point me somewhere as to what makes the `=~` template special? Looking at the code it's just an inject pragma in a `when declaredInScope` context. But I just checked and I have a similar template, which works just fine in generics.
09:58:18Araqwhat does "similar" mean? if it injects a variable, it has the same problem
09:59:25Araqtim-st: the compiler shouldn't crash.
10:00:48FromGitter<tim-st> Though when the linenumber is unknown maybe the dev has to search all the code
10:01:15FromGitter<tim-st> especially type definitions seem very easy to full crash
10:03:53FromGitter<tim-st> It seems only type definitions make full crashes?
10:04:05*xylef quit (Quit: WeeChat 2.2)
10:05:07FromGitter<Vindaar> Hm, yes. It also injects a variable and it works fine. I check again
10:09:08*erblite joined #nim
10:09:53*xylef joined #nim
10:09:56FromGitter<Vindaar> For example the following works fine: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4f11f3623cc3040b2bcbcb]
10:10:03*beaumonta is now known as abeaumont
10:10:06FromGitter<Vindaar> where the template `withH5` looks as follows:
10:10:34FromGitter<Vindaar> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4f121a3187ca3ee8bdb099]
10:12:21FromGitter<Vindaar> (yes it doesn't check whether h5f is declared in the scope. But I created my own `=~` template which doesn't do that either and it throws the same error)
10:16:33*Perkol joined #nim
10:19:05*cspar_ quit (Ping timeout: 240 seconds)
10:22:27Araqyes.
10:25:15Araqsections passed to an 'untyped' parameter are not subject to the generic scope checking
10:25:35Araqbut =~ doesn't take a block of code, it injects the 'matches' array
10:25:49*cspar_ joined #nim
10:26:29FromGitter<Vindaar> oohhhh, I was so focused on the variable being injected that I didn't even consider it the other way round. Thanks, that explains a lot :)
10:26:46Araqand it's a bad thing. It was mostly a clever idea back then to check if the compiler works.
10:27:21Araqso yeah ... maybe it's a library design problem and not a language design problem. injecting variables is pretty bad.
10:28:59FromGitter<Vindaar> I think it's a neat feature exactly for cases like this. At first I found it really weird, but if not overdone it's kinda nice. I love `mapIt`, hehe
10:30:09Araqoh hmm
10:31:32Araq`mapIt` solves my problem with `map`. it gives you an explicit "current item"
10:33:44FromGitter<Vindaar> so your problem with `map` is that there is no current item by default?
10:34:01Araqyeah.
10:34:28Araqmap means I have to pass a function to it, not an expression and so my function must adhere to a certain prototype
10:34:34Araqand it doesn't so I need currying...
10:37:10Araqand I dislike features that imply more features that then need more features...
10:38:07FromGitter<Vindaar> I can relate to that
10:38:42Araqand in the end you pray your map+filter code gets optimized into the imperative for-loops you've been taught to hate.
10:42:13PerkolHow do i increment a string? I know it sounds strange, it's just that crypto system I'm using uses nonces in string format.
10:43:14FromGitter<Vindaar> I guess that's true, yes. I just like the conciseness of map, filter etc. It makes the intent of the loop it replaces clear immediately. If I see a raw loop I need to check what it does manually
10:51:43*stefanos82 joined #nim
10:52:04FromGitter<tim-st> Perkol: the obvious way would be to parseInt and then back to string, but if the last char is in '0'..'8' you can increment without parseInt if it's '9' I would use parseInt
10:56:36FromGitter<tim-st> I didnt understand til today why "functional programming" is a thing... I asked different people noone could answer
11:06:29PerkolBut nonce are not a number, just a sequence of random bytes?
11:07:20FromGitter<tim-st> nonce=number only used once; that depends on your context, normally nonces are in fact random so maybe incrementing means calling random.next ?
11:11:02Perkolhttps://download.libsodium.org/doc/advanced/salsa20.html It says you can increment it
11:17:47FromGitter<tim-st> "Counter mode" yes, that's the only one that uses this unsecure thing
11:19:05FromGitter<tim-st> "to avoid incrementing the nonce after each block"
11:20:06FromGitter<tim-st> it says incrementing is prefered (that's the way I descibed) but it doesnt say why it's prefered (for good reason)
11:24:40*endragor quit (Remote host closed the connection)
11:25:10*endragor joined #nim
11:29:21*endragor quit (Ping timeout: 244 seconds)
11:30:18PMunchDoes macros have the power to remove a variable from a scope?
11:30:52PMunchWithout iterating the tree for it
11:31:12FromGitter<mratsim> @Perkol are your nonces hex strings?
11:32:12FromGitter<mratsim> I suggest you use an object backed by a sequence of bytes instead and define a β€œinc” proc on it
11:33:13PerkolYes, I guess
11:33:49FromGitter<mratsim> alternatively, you can use my library: https://github.com/status-im/nim-stint
11:34:25FromGitter<mratsim> the io proc to deal with Hex are there: https://github.com/status-im/nim-stint/blob/master/stint/io.nim#L185-L191
11:35:17FromGitter<mratsim> and: https://github.com/status-im/nim-stint/blob/master/stint/io.nim#L264-L305
11:35:19PerkolYeah, thanks
11:36:46FromGitter<mratsim> There is an Uint256 alias as I’m also using it for 256-bit integers mostly
11:37:25FromGitter<mratsim> but it seems like for Salsa20 you can just use uint64, since the nonce is 64-bit
11:41:34*krux02 joined #nim
11:50:54FromGitter<krux02> @mratsim when do you need 256 bit integers?
11:51:36FromGitter<mratsim> The Ethereum VM is 256-bit.
11:52:30FromGitter<mratsim> I also need Uint2048 for ethereum bloom filters
11:55:30FromGitter<krux02> all these virtual currency miners, they are the reason graphcis cards are so expensive right now
11:58:21FromGitter<mratsim> yeah, it’s costly to do deep learning due to the very high GPU price
11:58:30*endragor joined #nim
11:59:35FromGitter<mratsim> But the Ethereum VM is more about building a β€œworld computer”
12:02:35*endragor quit (Ping timeout: 240 seconds)
12:04:53FromGitter<krux02> I think these crypto currencies are generally a bad thing
12:07:10stefanos82@krux02: I thought I was the only one who was thinking about this
12:07:11FromGitter<krux02> they are a huge waste of energy, they have high deflation ratio that makes rich people richer, and making money flow a secrent mostly helps corruption.
12:08:15FromGitter<krux02> I honestly think that from a certain limit upwards of your income value, you should be watched very precisely on what you do with your money.
12:10:52*Perkol quit (Remote host closed the connection)
12:14:22FromGitter<tim-st> think so too
12:20:04stefanos82Araq: is it so bad that I like the second coding style from this example? http://paste.debian.net/hidden/06d79a3f/
12:20:23stefanos82the first one does not feel convenient for me personally :/
12:20:56stefanos82I'm reading Nim coding style and personally did not like this specific suggestion
12:21:43FromGitter<narimiran> stefanos82: you don't need square brackets in the second example
12:23:50stefanos82cool
12:24:11stefanos82way more consistent this way!
12:33:24FromGitter<kaushalmodi> stefanos82: You can probably do without the commas too, in the second style.
12:33:42stefanos82yeah, I'm reading the manual page right now
12:33:46FromGitter<mratsim> @krux02, huge waste of energy agree | deflation makes people richer: that’s wrong, deflation encourages hoarding money, inflation encourages consumption, they don’t make people richer or poorer in a vacuum | In mainstream cryptocurrencies, money flow is not secret, the underground world has been moving away from Bitcoin and Ethereum because all transactions are public. Also physical cash and diamonds are the best
12:33:46FromGitter... way to keep money flow a secret. ⏎ ⏎ Now I’m not really into cryptocurrencies, I am much more interested into the blockchain technology and its future use case. But I guess this conversation should be in #nim-offtopic
12:41:49FromGitter<codem4ster> Hi all :)
12:41:58FromGitter<mratsim> hi
12:42:08*donlzx quit (Quit: Leaving)
12:43:43FromGitter<codem4ster> I meet with Nim newly. Just looking around and trying to write some simple scripts.
12:45:36FromGitter<codem4ster> When I looked the 3rd party libraries of Nim, I noticed that most of them 3-4 years old but after that time no development on repos.
12:45:54FromGitter<codem4ster> Is this have a specific reason?
12:46:26FromGitter<codem4ster> like this: https://github.com/idlewan/jade-nim
12:47:14krux02it's just the libraries that you are looking at.
12:47:30krux02it is not that particularly something happened 4 years ago
12:48:50*yglukhov[i] quit (Read error: Connection reset by peer)
12:49:23*yglukhov[i] joined #nim
12:51:06FromGitter<codem4ster> Oh ok. I want to make web development with Nim. Do you know any microframework except Jester (I found it a bit slow on benchmarks)?
12:51:45dom96What are you planning to develop?
12:52:16dom96In the past few days I have been optimising Jester so it should be much faster now
12:52:20FromGitter<codem4ster> I will make a simple blog at first.
12:52:41FromGitter<codem4ster> Just for learning.
12:54:17FromGitter<codem4ster> I loved Nim so much and want to contribute by making 3rd party libraries to web side on my free time but firstly I want to learn the language well.
12:56:50FromGitter<Yardanico> @dom96 - just curious (again) - how many people finished the survey? :)
12:58:31dom96537
12:59:04dom96It's supposed to end on the 23rd but I might extend it
12:59:12dom96I want to add a banner on nim-lang.org about it
13:00:58FromGitter<mratsim> @codem4ster I’m like the last person you should ask fro webdev in Nim (and dom96 being the first) but here are some keywords besides Jester: Karax (react-like framework), mofuw (http client), httpbeast (http client used in Jester), check also the source code of the nimforum and nim/website
13:01:19dom96mofuw isn't an http client
13:01:22dom96It's a web framework too
13:01:28dom96neither is httpbeast
13:01:29FromGitter<mratsim> oh, nice
13:01:31dom96it's an http *server*
13:01:45FromGitter<mratsim> i.e. I’m the last person to ask about webdev ;)
13:02:06FromGitter<Yardanico> hmm, strange, in 2016 survey there were 790 responses, in 2017 one - 603
13:04:00PMunch@mratsim, Araq, added the Options safe pattern: https://github.com/nim-lang/Nim/pull/8358
13:04:13PMunchAlong with some other stuff from Toccata
13:05:25*Vladar quit (Quit: Leaving)
13:06:20dom96Yardanico: First year the survey was on HN
13:06:25dom96No such luck with the second year or this year
13:06:26FromGitter<mratsim> I don’t like the β€œoptionCase”, we should just use case fooOption: some x: none:
13:06:43FromGitter<codem4ster> thanks @mratsim I will look mofuw also.
13:06:47dom96Well, actually, a comment I made on the Rust community survey became popular
13:06:52dom96The launch itself wasn't on HN
13:07:21PMunchmratsim, is that even possible?
13:07:34PMunchThat would require having an overload on case..
13:07:37FromGitter<mratsim> rename optionCase to case β€”> ??? β€”> profit?
13:07:46PMunchDoes it work?
13:08:07FromGitter<mratsim> good question, if it’s a reserved keyword it won't
13:08:59dom96or rename it to `match`
13:09:08FromGitter<mratsim> yeah it’s reserved so it must be added on the compiler/magic side i suppose
13:09:15FromGitter<mratsim> match is good too
13:09:36dom96Can macros be overloaded though?
13:09:44dom96Could a `match` macro be defined for more types?
13:09:51dom96if not then we need a different solution
13:09:59FromGitter<mratsim> if the signature is different yes
13:10:40FromGitter<narimiran> PMunch: i don't understand why this is true `optCmp(some(30), 20, leq) == none(int)`
13:10:48FromGitter<mratsim> if it’s `match(body: untyped)` you will have several if-elseif in a super match macro
13:11:01FromGitter<narimiran> line 106 in your PR
13:11:34PMunchnarimiran, 30 is not lower or equal to 20
13:12:03FromGitter<narimiran> oooh, `none` is equivalent of `false`
13:12:12PMunchYeah, in a way
13:12:26dom96Why not just define `and` and `or` for these instead?
13:12:53dom96Meh, I'm not convinced about how practical these are
13:13:03FromGitter<mratsim> btw I’m pretty sure I saw a lengthy discussion about the bind (`>>=`) operator
13:13:25FromGitter<mratsim> and the outcome is, use something searchable
13:13:29dom96Yep
13:13:33FromGitter<narimiran> wooo, inplace right-shift! :D
13:13:33dom96We prefer words over operators
13:13:49dom96IIRC Scala takes this approach too
13:13:53dom96so it would be good to copy it
13:14:06PMunchdom96, well `or` typically returns a boolean
13:14:10FromGitter<mratsim> github doesn’t help, impossible to search for >>=
13:14:51PMunchOh yeah, that was just a plain copy from superfuncs version
13:15:08FromGitter<kaushalmodi> @mratsim https://github.com/nim-lang/Nim/pull/6404 ?
13:15:21FromGitter<mratsim> thank you
13:15:29PMunchdom96, you weren't here earlier when we discussed this, but this is what sparked it: http://www.toccata.io/2017/10/No-Booleans.html
13:16:02PMunchI read that, went searching for something similar in Nim and came across this: https://github.com/superfunc/maybe
13:16:27dom96TL;DR? :)
13:16:40PMunchUhm, booleans bad, composing good?
13:17:44FromGitter<kaushalmodi> PMunch: Looking forward to a blog post on this topic from you :)
13:17:55FromGitter<mratsim> more like, new syntax proposal, OK, article bad starting hypothesis ;)
13:19:17PMunchThe argument goes something like this: booleans hide what they actually compared. By using patterns like this you avoid doing bad stuff like "if not x.isSome: echo x.unsafeGet". The and/or/cmp things are to work with the has-ity of option values so that you can avoid these situations.
13:20:17dom96We need a longer example
13:20:19FromGitter<mratsim> i.e. this is extending case statement β€œnot all cases are covered” to Option
13:20:24dom96You can just `echo x`...
13:20:37dom96And I'm having a hard time imagining a use for these new templates
13:20:41PMunchkaushalmodi, I was thinking about it. But I'm not sure if I would contribute with anything new :P
13:21:04PMunchdom96, well I've already used them, so has superfunc apparently :P
13:21:28dom96I've used many things, doesn't mean they should be in the stdlib :P
13:21:41FromGitter<mratsim> I think within a `some x` block you can automatically unbox x.
13:21:47PMunchThe use case is the same as the regular if check and exceptions way of doing it, just a bit more on the functional side
13:21:56FromGitter<kaushalmodi> PMunch: In general I am intrigued about the options module. So if this PR goes through, it would be cool if you had a brief refresher post on the updated options module.
13:22:01PMunchmratsim, that's what it does
13:22:33FromGitter<mratsim> Anyway, it seems like you didn’t participate in https://github.com/nim-lang/Nim/issues/7476, you should add your input there
13:22:41PMunchThe "optionCase option: some x:" will unpack option into x when it has a value
13:22:57dom96I understand the purpose of `optionCase
13:23:16PMunchkaushalmodi, well that I can do :)
13:23:18FromGitter<krux02> I like the idea in toccata that (= x 15) yields <maybe 15>
13:23:20dom96But optCmp, optAnd, etc. I'm unconvinced about
13:23:26PMunchdom96, yeah that was for mratsim
13:23:33dom96Okay, just want to be clear
13:23:45FromGitter<mratsim> some position as dom96, optionCase/match seems good enough
13:24:04FromGitter<krux02> I don't know how useful it will be eventually, but often I want to do test conditions on a value, and if that test condition is true, then I want to operate on that value
13:24:10PMunchoptCmd/optAnd/optOr are basically flow control with options
13:24:42PMunchkrux02, that is exactly what optCmp would give you
13:24:44FromGitter<mratsim> just overload and/or?
13:24:56FromGitter<krux02> what is optCmp?
13:25:13Araqa comparison option.
13:25:36PMunchkrux02, comparison that returns a maybe like in Toccata
13:25:36FromGitter<mratsim> ...
13:25:52PMunchmratsim, but as I said and/or are meant to return booleans
13:25:56FromGitter<mratsim> that was for Araq comment
13:25:58PMunchThese return a maybe
13:26:02FromGitter<mratsim> mmm
13:26:05FromGitter<krux02> is it implemented somewhere?
13:26:28PMunchkrux02, https://github.com/nim-lang/Nim/pull/8358
13:28:03FromGitter<krux02> sorry, please no PR. This is highly experimental stuff.
13:28:34FromGitter<mratsim> I think we need proper lift proc like in Haskell or continuation β€œthen”/β€œand_then” like in Rust/JS, ⏎ That would be helpful for much more than Option (i.e. Result/Error/Either types).
13:28:39PMunchWhat? It's not experimental..
13:28:45FromGitter<krux02> there is absolutely no reason why you can't do this in a nimble package
13:29:00FromGitter<krux02> nim is very flexible in adding functionality to existing data types
13:29:08FromGitter<krux02> and the data type is given in th standard library.
13:29:22FromGitter<krux02> I like that you improved on the documentation
13:29:34FromGitter<krux02> but I don't like at all the new names that you introduced
13:29:35PMunchOh well, I guess I could add the optCmp/optAnd/optOr stuff in a nimble package..
13:29:55FromGitter<krux02> yes pleas
13:29:56PMunchYeah the names are open for change :P
13:30:09AraqI think this makes for an excellent blog post and nimble package
13:30:21PMunchSo in conclusion, find a new name for optionCase, and move the rest to a Nimble package?
13:30:40FromGitter<krux02> I mean if you make the nimble package and it turns out that you use it every of your projects and it really is super duper useful without too much performance penalty. Then yes it might become part of the standard library.
13:30:48Araqcan give you case statement macros ...
13:31:02Araqthey would work like for statement macros...
13:31:10PMunchHuh?
13:31:19FromGitter<krux02> but think about it. This is about to change several times, and everything that is in th standard library as to be maintained by the nim developers.
13:31:24Araqwhich really need to be behind an .experimental switch
13:31:44FromGitter<krux02> is there an .experimental switch?
13:31:50FromGitter<mratsim> yes
13:32:00PMunchkrux02, fair enough. I was just using superfunc/maybe and thought that it was a much nicer pattern than the current Options implementation. The optAnd/optOr/optCmp was just added as it was in the same vein.
13:32:06FromGitter<mratsim> {.experimental: myNewFeature.}
13:32:35FromGitter<krux02> what I did to improve the control flow in my macros is, I overloaded the `or` operator for the NimNode type
13:33:02FromGitter<krux02> so I could say: let mynode = nodaA or nodeB
13:33:26Araq^ yeah that can be nice.
13:33:58FromGitter<krux02> Araq: it is, and it is even very readable
13:34:09PMunchWait, what does that do?
13:34:11*nsf quit (Quit: WeeChat 2.1)
13:34:30FromGitter<mratsim> Pattern matching would be better than optAnd: ⏎ ⏎ match x { ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/nim-lang/Nim?at=5b4f41e6623cc3040b2c68a3]
13:34:46FromGitter<krux02> well men nodeA is empty or nil, then it evaluates to nodeB, otherwise it evaluates to nodaA
13:35:30FromGitter<mratsim> match x { ⏎ ⏎ ```Some(x) and y => β€œFoo", ⏎ Some(x) or z => β€œBar", ⏎ None => β€œBaz"``` ⏎ ⏎ }); [https://gitter.im/nim-lang/Nim?at=5b4f4221fd1b3474a69b8b3a]
13:35:35FromGitter<krux02> nil doesn't really exist for nodes, they are most of the time of kind`nnkEmpty`
13:36:00FromGitter<krux02> that I don't understand
13:36:41PMunchkrux02, ah gotcha
13:38:06FromGitter<krux02> BTW, the `or` is a pattern that I knew from lisp programming
13:39:09FromGitter<krux02> in elisp there is no boolean type, just a nil and anything else (and a T for non creative programmers).
13:39:17PMunch@mratsim, I agree that pattern matching would be better
13:39:45FromGitter<krux02> and (or (exp1) (exp2) ...) selects the first non nil value in the arguments. It even has lazy evaluation
13:40:24FromGitter<krux02> do you all know about my ast pattern matching library?
13:40:45PMunchYeah I've used it, great stuff!
13:41:09PMunchAnd that example would work exactly the same with optAnd and optOr :)
13:41:23PMunchBut not the non-nil, but the none options
13:42:08PMunchWell, you could even drop the and and just use optOr since you only pass it one argument
13:57:29PMunchOh well, I'm going on a little fishing trip. I'll play around with this some more when I get the time
13:58:30*PMunch quit (Quit: Leaving)
14:07:17*_dorelix joined #nim
14:09:27*dorelix_ quit (Ping timeout: 240 seconds)
14:11:15*dzho_ is now known as dzho
14:19:04*drazan quit (Remote host closed the connection)
14:20:56*drazan joined #nim
14:23:03*Vladar joined #nim
14:31:24*cspar_ quit (Ping timeout: 260 seconds)
14:42:23*cspar_ joined #nim
14:43:26FromGitter<codem4ster> Hi all
14:43:50FromGitter<codem4ster> I have two files with same name in different folders
14:44:05FromGitter<codem4ster> some/lib.nim and another/lib.nim
14:44:32FromGitter<codem4ster> but it says module names need to be unique per nimble package module clashes with ...
14:45:13FromGitter<codem4ster> ```import some/lib as some ⏎ import another/lib as another``` [https://gitter.im/nim-lang/Nim?at=5b4f52798fe2780689c0ccc6]
14:45:34FromGitter<codem4ster> cannot we use these just like this
14:46:08FromGitter<codem4ster> at the end they're different modules in different files
14:46:36*nsf joined #nim
14:47:21krux02codem4ster: can't you make your package names unique?
14:47:35krux02nim doesn't have nested packages
14:47:47krux02you only have paths to packages
14:48:30krux02it is not really recommended to names something just "lib" anyway.
14:48:39*yglukhov[i] quit (Read error: Connection reset by peer)
14:49:00dom96Create a pkgA.nimble and pkgB.nimble files inside those directories
14:49:02dom96then it will work
14:49:14*yglukhov[i] joined #nim
14:50:49krux02dom96: that is exactly what I think is weird about nimble projects
14:52:58FromGitter<codem4ster> in web perspective `models/user` and `controllers/user` are common used folder pattern
14:53:36dom96krux02: This is a Nim implementation detail
14:54:22krux02codem4ster: well nim is not web.
14:54:54FromGitter<codem4ster> oh ok, sorry for asking then :)
14:55:14krux02in nim you need to be able to use a unique package name for symbol disambiguation
14:55:37krux02so you can do pkgA.foo or pkgB.foo in case foo is not unique on it's own
14:55:53krux02the path where the package comes from is just not part of that unique identifier
14:56:46krux02dom96: One think that always bothered me in Nim, it is not universally possible to get correct syntax checking for any file just by providing the file name.
14:57:23FromGitter<codem4ster> I got it. But I think that is not a good design decision for modules.
14:57:35krux02this makes it hard for editors like emacs to support syntax checking by default
14:57:45FromGitter<codem4ster> But implementation is implementation at the end.
14:57:54krux02users always have to go though this hassle of setting up a project properly
14:58:04krux02I want to get rid of that.
14:58:26krux02Open a nim file in editorX and there you get syntax checking. No setup required
14:58:58dom96I would have liked for it to just work (TM) too
14:59:02krux02that should be highest priority, and that is what the language Go just got right, and Nim does fail at.
14:59:04dom96But Araq had his reasons for doing it this way
14:59:27Araqthat doesn't work for any language out there I know.
14:59:33Araqmaybe it does for Go.
14:59:47Araqit certainly doesn't for C# which has/had one of the best IDEs
14:59:53FromGitter<codem4ster> That is first language I ever saw using modules like this. But I will try to adapt. May be I can use include.
14:59:55krux02It does for Go and that is why I would recommend Go for every beginner in programming
15:00:02*fvs left #nim ("ERC (IRC client for Emacs 26.1)")
15:00:03krux02not Nim
15:00:50Araqok, so how can it work?
15:01:05krux02just because it doesn't work for C#, that is no reason that it also shouldn't work for Nim.
15:01:13Araqyou pass the directory to nimsuggest, nimsuggest figures out the main file and off you go.
15:01:33Araqah ok, but your plugin does not pass the directory and so it's Nim fault, got it.
15:01:45krux02and what exactly is the problem of figuring out the directory on it's own?
15:02:27krux02why not just search the directory tree upwards for "project.nimble" where project is a constant name that can't be changed
15:03:29krux02and that nimble file should work, even if it is empty.
15:03:52Araqthat's what nimsuggest does, except for the "search in parent dirs" part. which we can add.
15:04:08Araqbut then the problem remains because you're just unwilling to use a non-broken plugin.
15:04:58krux02when I open a file in emacs, The only information I have is that filename and the content of that file
15:05:36krux02so when I want to pass the directory to nimsuggest, I have no a single bit more information about a project than nimsuggest.
15:05:49krux02so my question is, why can't nimsuggest solve it?
15:07:01Araqif you pass a file to nimsuggest, that's the main file, if you pass a directory it performs a search.
15:07:13AraqI dunno what's so hard to understand here.
15:07:44Araqin VS code you can configure the main file, for example.
15:07:58Araqand that's useful because -- wait for it --
15:08:01krux02there is no concept of a "project" in emacs like in an IDE. It doesn't even have a constant working directory. When you open a file, the cwd (current working directory) is always the directory of that file
15:08:06Araqthe "main" file can be ambiguous.
15:08:29krux02and commands that work on the filesystem are then executed in the directory of the file.
15:09:05krux02yea in vs code you have one project open at a time and you can set "project" settings
15:09:13krux02emacs doesn't have "project" variables
15:09:26krux02all I can do is to put all the information in the file system
15:09:36krux02and that is what I eventually did.
15:09:52Araqeither you can extract the directory part of a filename in Elisp or you can't. if you can't, just say so. if you can, patch your plugin.
15:10:07krux02but when I have to put it in the filesystem anyway, then nimsuggest can read that information, too
15:10:38krux02and when nimsuggest actually reads that inforamtion, then I don't need to add support for different editors to read the information.
15:10:57Araqeither you can extract the directory part of a filename in Elisp or you can't. if you can't, just say so. if you can, patch your plugin.
15:11:17krux02I can extract the directory part of a filename
15:11:31Araqok, so patch the plugin.
15:12:25Araqyeah, I know you won't and in 2 weeks this discussion will pop up again.
15:12:52krux02Araq: I solved the problem of `ambiguous main` with a file in the filesystem
15:13:07krux02I have "nimsuggest-project-file" in my project
15:13:16Araqyes, you essentially solved it in exactly the way that nimsuggest does.
15:13:21krux02and the content of that file is just "fancygl.nim"
15:13:26Araqand I have told you this now for the 3rd time.
15:13:40krux02but then why doesn't it work for nimsuggest?
15:13:59krux02why do I need to pass nimsuggest that file manually?
15:14:40AraqPASS THE DIRECTORY TO NIMSUGGEST; OMG JUST HOW HARD IT CAN BE TO READ?
15:16:46krux02Araq: so when I pass /some/path/pkg/subpkg/ to the nimsuggest process of /some/path/pkg/subpkg/somefile.nim, it will find /some/path/pkg/main.nim?
15:21:54Araqhttps://github.com/nim-lang/Nim/blob/devel/compiler/options.nim#L572
15:22:40Araqas I said, it does the search, but doesn't go up in the path tree. you can patch it to do that, or you can patch your plugin to do that.
15:23:17Araqif I patch it, you still need to patch your plugin to pass a directory to nimsuggest.
15:30:41*erblite quit (Ping timeout: 276 seconds)
15:31:53*Vladar quit (Remote host closed the connection)
15:40:33*chemist69 quit (Quit: WeeChat 1.9.1)
15:43:53*stefanos82 left #nim ("Leaving the channel.")
16:07:39dom96Jester 0.4.0 is here: https://github.com/dom96/jester/blob/master/changelog.markdown#040---18072018 :)
16:17:20Araqdom96: is sendFile Linux-specific?
16:17:35dom96no
16:17:58dom96But there is an optimisation that I could do
16:18:01dom96which I don't do right now
16:18:19FromGitter<Varriount> I thought Windows didn't have sendfile?
16:19:04Araqah ok, got it, thanks
16:19:20dom96sendFile != posix sendfile
16:19:27dom96It's just a jester template
16:20:13FromGitter<Varriount> Also, this is interesting: https://docs.microsoft.com/en-us/windows/desktop/api/mswsock/nf-mswsock-transmitfile
16:21:08*cspar_ quit (Ping timeout: 255 seconds)
16:25:20*cspar joined #nim
16:25:36Araqyeah, so Windows has sendfile too
16:25:52*endragor joined #nim
16:30:15*endragor quit (Ping timeout: 245 seconds)
16:33:48FromGitter<Varriount> Araq: Regarding exceptions and that C++ paper, did you come to any conclusions?
16:35:04Araqyeah, but it requires an RFC
16:39:05*xylef quit (Quit: WeeChat 2.2)
16:39:07Araqin a nutshell, remove the 'ref object' exceptions, replace it by a single enum. attach stack traces, error messages etc to a thread-local variable. export system.panic() that is called for the builtin failures like IndexError. panic() can be overwritten in an 'supervise' environment, a supervisor knows the allocator and all open file handles and resources and can free them, it's our "poor man's OS" for webservices and embedded systems.
16:41:35dom96Yeah, write this RFC already. I have lots of questions about this
16:43:09*erblite joined #nim
16:47:37*cspar quit (Ping timeout: 244 seconds)
16:53:34Araqlike? ask them now so that I can address them in my proposal
16:54:42*Calinou_ is now known as Calinou
16:59:36*jjido joined #nim
17:00:36dom96Like, what's the problem with 'ref exceptions'?
17:01:39dom96enums imply there will no longer be an exception hierarchy, is that the case?
17:09:17*Vladar joined #nim
17:11:54*nsf quit (Quit: WeeChat 2.1)
17:15:40Araqyup, no hierarchy
17:16:25Araqref exceptions mean you need a heap and GC. for embedded targets these are problematic
17:17:35FromGitter<tim-st> maybe I'm completly wrong but arent exceptions and the amount of memory for those known at compile time?
17:19:02Araqno, they are not, you can inherit and add fields
17:19:11Araqexceptions can also be nested
17:20:03FromGitter<tim-st> yes, I thought this can be represented on an array as hierachy when specific features are turnt off which are not possible at compile time
17:37:50*stefanos82 joined #nim
17:38:54*rauss joined #nim
17:42:28*rauss quit (Client Quit)
17:45:51dom96Araq: That's a pretty serious limitation (No hierarchy)
17:53:14*yglukhov[i] quit (Remote host closed the connection)
17:53:50*yglukhov[i] joined #nim
17:55:24stefanos82dom96: I finished your book. I liked it, but you left me with lots of questions that I would love to read even more. How about writing another book, like "Nim in Depth" or "Advanced Nim"?
17:58:37*yglukhov[i] quit (Ping timeout: 256 seconds)
17:59:11dom96I'll let someone else do that. One book is enough for me for now :)
17:59:23stefanos82hahaha ^_^ that's fair!
17:59:46*nsf joined #nim
18:00:01*Vladar quit (Quit: Leaving)
18:00:12stefanos82dom96: it took me 1,5 years to finish mine while I was working for a private university and it was indeed quite exhausting procedure
18:06:18*sleepyqt joined #nim
18:08:15*yglukhov[i] joined #nim
18:12:26krux02stefanos82, I think dom96 would do a revision 1.1 of his book before making a second one, because of all the breaking changes that I put in the languages :P
18:12:40stefanos82I'm in.
18:12:47*yglukhov[i] quit (Ping timeout: 256 seconds)
18:13:03krux02I changed the output of a NimNode in the treeRepr
18:13:16krux02so the output from the book is incorrect now
18:14:22krux02and the nil won't be a state for seq and string anymore, but that change wasn't on me.
18:14:54krux02I just created a PR for it that caused weird problems in the GC
18:15:53*jjido quit (Ping timeout: 255 seconds)
18:16:03dom96What did you change in treeRepr?
18:16:14dom96I'm mainly concerned about people not being able to compile code in the book
18:16:20krux02I removed the `!` in identifier nodes
18:16:25dom96If the output is slightly different it shouldn't be an issue
18:16:32dom96Yeah, that's really a minor thing
18:16:46krux02there was a question about that here in the chat
18:17:18krux02dom96: I can imagine that by realeasing the book you didn't necessarily became rich.
18:17:45krux02but I am curious about how many book you actually sold.
18:18:09krux02but you may keep it as a secret
18:19:34dom96Yeah, I'd rather not say :)
18:20:11Araqstefanos82: which book did you write?
18:20:30*xylef joined #nim
18:23:01krux02dom96: there is still the chance that you might become richt with your book, if Nim becomes the new Holy Grail of programming language any your book will be adopted as the new Bible that every Nim programmer will carry around under their arm to quote from it when it might become necessary
18:23:44dom96That's the dream
18:24:21krux02but before that a lot of dirty work needs to be done
18:25:17*sleepyqt quit (Ping timeout: 265 seconds)
18:25:39zacharycarterI'm trying to drum up support for httpbeast / jester at work
18:25:45zacharycarterdom96 - do you know when the next round of benchmarks will be published?
18:26:56dom96Nope. But they have continuous benchmarks that are constantly running, sadly in the latest run httpbeast failed. No idea why :/
18:27:13dom96It takes ~70 hours to run all the benchmarks too
18:28:34zacharycarterugh
18:28:48stefanos82Araq: a shorter version of "The C++ Primer Plus" by Stephen Prata
18:29:11stefanos82I was given the task to reduce its size for my colleagues and did so for the pleasure of it
18:29:32stefanos82that's how I learned about LaTeX
18:29:50Araqno wonder it took over a year then :-)
18:29:56stefanos82yep
18:30:10stefanos82oh you mean due to the LaTeX use? on the contrary
18:30:15AraqLaTex -- spend 1 hour on the content, 4 on the layout.
18:30:17stefanos82learning it was the easy part
18:33:52AraqI need to visit a latex guru and watch him work. my theory is that he is actually objectively super unproductive but lives in a delusion of productivity because he doesn't have to touch the mouse.
18:34:06Araq:P
18:36:16stefanos82hey, if you sacrifice like a couple of hours of a whole 1.5 years of actual work, then that's nothing, really!
18:39:29*tribly quit (Quit: WeeChat 2.1)
18:40:32*tribly joined #nim
18:41:11dom96zacharycarter: What are they currently using at work?
18:51:23*Ven`` joined #nim
18:52:56*erblite quit (Remote host closed the connection)
18:58:54dom96hrm, seems boehm is to blame here
19:00:05dom96has anyone tested --gc:boehm with threads before?
19:01:19*poopBot joined #nim
19:01:21Araqit's part of the test suite
19:01:27AraqI think.
19:02:48stefanos82I have heard a few days ago a couple of folks here complaining about boehm too
19:03:00stefanos82what's seems to be the problem with it?
19:03:24dom96Not sure, it's only failing in the TechEmpower docker container
19:03:36dom96It crashes in release mode
19:03:49dom96and in debug mode it gives warnings about huge blocks being allocated
19:05:36*erblite joined #nim
19:11:19*yglukhov[i] joined #nim
19:13:10stefanos82what is the memory limit set up for boehm gc?
19:13:29*chopzwei joined #nim
19:17:25*yglukhov[i] quit (Read error: Connection reset by peer)
19:17:57*yglukhov[i] joined #nim
19:20:27*jjido joined #nim
19:20:52*chopzwei quit (Quit: Leaving)
19:25:12FromGitter<Quelklef> Is there any good comprehensive document on *exactly* what `var` is and how it works? Especially `var` parameters. I've been able to build up an intuition around them but I must admit I don't really get them. And I can't find anything from Google.
19:25:33FromGitter<Quelklef> IIRC it doesn't just mean "mutable"
19:28:47stefanos82the way I memorize it is the following: var == variable, let immutable once it gets assigned with a value, const the same as let but happens during compilation time
19:28:52stefanos82I hope I got it correct
19:29:43FromGitter<Quelklef> Right that's all fine but I'm wondering more with var parameters
19:30:05Araqa var parameter is very close to C++'s & parameters if that helps you.
19:30:06krux02var parameters are there, if you want to change the value of the argument
19:30:41FromGitter<Quelklef> @Araq unfortunately, I never learned C++. But that gives me a starting point, thanks
19:30:58FromGitter<Quelklef> @krux02 is the 'thing' I'm modifying the variable, or the value?
19:31:05krux02so you can implement ``proc swap(a,b: var int) = let x = a; a = b; b = x
19:31:05stefanos82Araq: the funny thing is that those 3 names are identical as those of JavaScript's but with a different semantic
19:31:06krux02``
19:31:09FromGitter<Quelklef> Sorry, that phrasing is a little weird
19:31:27FromGitter<Quelklef> Ah, interesting
19:31:35FromGitter<Quelklef> I'd've thought swap would have to be a macro
19:31:49krux02you can't do swap in javascript but in nim, no problem
19:32:13krux02that is called a "reference"
19:32:30krux02(in global terms, not nim terms or java terms)
19:32:41FromGitter<Quelklef> Are vars abstractions over pointers?
19:32:48krux02(with global I mean compiler construction terms)
19:32:56FromGitter<Quelklef> So a `var x: int` is like a `int *x`
19:33:01krux02they are internally pointers, yes
19:33:05FromGitter<Quelklef> Ahhhhh
19:33:06Araqno.
19:33:15FromGitter<Quelklef> No?
19:33:17Araq'var x: int' is not an internal pointer
19:33:36Araqbut it gets turned into one if you pass it to a proc that takes a 'var' parameter
19:33:48krux02yes
19:33:54FromGitter<Quelklef> Ok, better question
19:34:02krux02var for variables is a different thing as var for parameters
19:34:04FromGitter<Quelklef> Can I conceptualize `var x: T` as `T *x`
19:34:09FromGitter<Quelklef> Ah, I see
19:34:11Araqno.
19:34:22FromGitter<Quelklef> Ok
19:34:23krux02don't think that way
19:34:43krux02normal parameters are also often converted to pointers for performance reasons
19:35:00FromGitter<Quelklef> Right, but I don't have to worry about that
19:35:02Araqkrux02: that makes things more complex for no reason.
19:35:09stefanos82dom96: I have searched a bit about boehm's warnings and based on what others said in forums, github tickets, and so forth, happens when it tries to release a memory lower than the one it got reallocated with greater size than its original one.
19:35:48FromGitter<Quelklef> So then what's the difference between a var parameter and a pointer?
19:35:53FromGitter<Quelklef> If they shouldn't be conflated
19:36:03krux02different people trying to explain the same thing differently also makes things a bit more complicated. The question war about var parameters specifically, and they are internally pointers
19:36:30krux02a pointer is a different type
19:36:35krux02a var parameter, is not
19:36:45Araqit's an open question if they have to be implemented as pointers.
19:37:11Araqwe could also propagate the changes back on proc return
19:37:16krux02Araq: yea, but you wrote the compiler, it there any case where a var parameter is not a pointer?
19:37:31krux02and when someone understands pointers, then I might just use that
19:37:37krux02to base the explanation on
19:38:09*yglukhov[i] quit (Remote host closed the connection)
19:38:11Araqno, but I may want to change the implementation.
19:38:23krux02that is interesting
19:38:33krux02how would you want to change the implementation?
19:38:45krux02I can't thing about a different implementation than a hidden pointer
19:38:54Araqas I said, write back the changes on return.
19:39:19AraqtakesVar(a, b) --> (a, b) = takesVar(a, b)
19:39:51Araqunlikely to happen anytime soon though.
19:40:07FromGitter<Quelklef> Araq: I had a similarish idea and I wonder your thoughts on it. It'd be that all side-effects do not "actually" take place, but are instead carried by an implicit context and passed from function to function. Then, there would be special syntax to be able to interact with this context. This way, you could call a function and, for instance, ignore all side-effects
19:40:12krux02well might also turn out to be a bad idea
19:40:51Araqkrux02: it is the way aggressive optimizers like.
19:41:28krux02but what is with the cases where you pass a big object to a function and only change a single member of it?
19:41:43krux02then you would write the entire object back on return?
19:42:06Araqoptimizers reason about code, copy elimination is vastly more effective than removing false aliasing
19:43:53stefanos82Araq: have you played with the thought of offering your services as compiler or language designer by demonstrating your language as your actual case study?
19:44:07krux02I also have a lot of code written where I append to a string that is a var parameter
19:44:16stefanos82I wish I could afford this and I would love to book you a ticket and teach me everything you know around the topic
19:44:28Araqbut the devil is in the details and it might fail for your scenario, krux02
19:45:35krux02Araq: well maybe there is a hybrid solution that compiles sometimes by write back on return, and sometimes just uses pointers for parameters.
19:45:42Araqkrux02: yeah, "append semantics" are awesome for performance. and Nim should get a special rewrite rule to handle this better
19:47:07Araqstefanos82: lol, well I'm here.
19:47:46Araqyou can ask me here, but I know everything, so that would take some time to teach you all of it.
19:47:52stefanos82Araq: I will never stop hoping mate...one day I will make my goals reality
19:50:08AraqQuelklef: but I like the write effects. and I know where to find Haskell and if I didn't believe in them.
19:54:16FromGitter<Quelklef> Well the idea is that it'd be transparent. You'd write code as if it were procedural, not worrying about what's actually happening if it's not relevant
19:54:47stefanos82Araq: one thing that OCaml caught my attention is how they generate optimized code which if I understood them correctly, it's an optimized C code emitted as assembly that gets compiled in a really fast way.
19:54:49stefanos82mind blowing
19:55:03stefanos82now about Haskell I have no idea
19:58:05stefanos82btw, what's #nim-logos supposed to do? chat without being logged?
19:58:24stefanos82*#nim-nologs
19:59:52Araq#nim-nologs is for our illegal activities, yes
20:04:06stefanos82>:}
20:12:13FromGitter<codem4ster> how can I use include in nim
20:12:48FromGitter<Quelklef> `include filename`
20:12:50FromGitter<Quelklef> ...
20:13:03FromGitter<codem4ster> it seems not working
20:13:05FromGitter<Quelklef> more accurately, `include module`
20:13:07FromGitter<Quelklef> example?
20:15:24FromGitter<codem4ster> ```# main.nim ⏎ import models ⏎ ⏎ let user = User(name: "test-name")``` [https://gitter.im/nim-lang/Nim?at=5b4f9fdbecc1f82e2fc3936b]
20:15:52FromGitter<Quelklef> `User*` not `User`
20:16:02FromGitter<codem4ster> ah my bad
20:16:04FromGitter<codem4ster> sorry
20:16:07FromGitter<Quelklef> np
20:16:23FromGitter<Quelklef> Forgetting to export things trips me up fairly often as well
20:19:03FromGitter<codem4ster> I think, I get over folder structuring with include statement. Is this a good usage?
20:19:28FromGitter<Quelklef> What's wrong with just `import models/user`
20:20:01FromGitter<codem4ster> I don't want to make user a module
20:20:30FromGitter<codem4ster> because I will need controllers/user also
20:22:54stefanos82Araq: isn't there any print operator other than stdout.write that behaves more or less like echo, but without the implicit appending of newline at the end of the string?
20:23:07stefanos82*print statement, my apologies
20:27:48*Ven`` quit (Read error: Connection reset by peer)
20:27:49*jjido quit (Ping timeout: 260 seconds)
20:28:24*brainproxy quit (Ping timeout: 260 seconds)
20:30:33*brainproxy joined #nim
20:31:00*poopBot quit (Remote host closed the connection)
20:31:02*rockcavera quit (Remote host closed the connection)
20:35:00Araqno. and I wonder why it keeps coming up.
20:35:49Araqcodem4ster: MVC is dead, got succeeded by the Elm architecture
20:37:22stefanos82Araq: because echo appends a newline and people don't want it? Yes I know...it's easy to deal with stdout.write, but I guess it's a matter of habit to deal with print() and echo() separately
20:38:24Araqwell "real" code does not contain many echo/write statements.
20:39:27Araqsometimes it's full of 'echo' behind a 'when' switch.
20:39:46AraqI've yet to see a code that is full of "write without newline" calls
20:40:53stefanos82by the way Araq in https://nim-lang.org/docs/tut1.html#procedures-result-variable the "echos" comments should be "echoes"
20:41:51stefanos82Araq: for example, if I ask for a user input, I wouldn't want to see my user input inserted in the next line
20:41:59stefanos82I would like to see it in the same line as my question
20:42:15Araqthat's one implementation of "prompt" then.
20:42:37*yglukhov[i] joined #nim
20:42:53Araqproc prompt(question: string): string = stdout.write(question); result = stdin.readLine()
20:43:50stefanos82you see? that's one proc I didn't know we have...or did you just implement it on the spot for demonstrative purposes?
20:43:50Araqthis way you can later even go fancy and have some IO "abstraction". who knows, maybe even give your program a UI.
20:43:59Araqthe latter.
20:44:07stefanos82that was fast lol
20:44:09*yglukhov[i] quit (Read error: Connection reset by peer)
20:44:42*yglukhov[i] joined #nim
20:44:52stefanos82do we have something like fmt module?
20:45:17Araqstrformat
20:45:57stefanos82yeah, just found it
20:46:04stefanos82so fmt is a template
20:46:05stefanos82nice
20:46:15*rockcavera joined #nim
20:46:16*rockcavera quit (Changing host)
20:46:16*rockcavera joined #nim
20:46:37*nsf quit (Quit: WeeChat 2.1)
20:53:48*Ven`` joined #nim
20:54:23stefanos82can't we create a new project with nimble without creating the folder first? :/
20:59:09stefanos82also, why nimble creates only src and tests? what about bin?
21:00:16*xet7 quit (Ping timeout: 244 seconds)
21:00:32FromGitter<Bennyelg> Does someone experience this issue? ⏎ https://github.com/nim-lang/Nim/issues/8353 ⏎ because seems that I can't simulate it.
21:00:50*yglukhov[i] quit (Remote host closed the connection)
21:01:05*icebattle joined #nim
21:01:22*yglukhov[i] joined #nim
21:04:53AraqBennyelg: maybe it's just his own branch
21:05:15FromGitter<Bennyelg> Opening bugs :|
21:05:21FromGitter<Bennyelg> close it hehe
21:06:40stefanos82Araq: where should I open tickets for official documentation? I have found a couple of typos and deprecated code which I want to report so we won't forget about them
21:07:14Araqcan't you just create a PR for them? most docs even have an "edit" button
21:07:33stefanos82I can't find this in tut1
21:07:53Araqwell only the library docs have it
21:08:08stefanos82OK :/
21:08:17Araqand they are almost never used, so I don't want to spend more time on this feature.
21:08:35stefanos82you mean people don't use Nim's tutorial?
21:08:45Araqthey don't use the "edit" button
21:08:55*Ven`` quit (Quit: q+)
21:08:57FromGitter<Bennyelg> @Araq
21:09:07stefanos82lol how can they use it if it does not exist? ^_^
21:09:15FromGitter<Bennyelg> I modified my own branch ospath file I want to compile everything and test it
21:09:28FromGitter<Bennyelg> just ./koch ?
21:09:43FromGitter<Bennyelg> bin/nim c koch ?
21:10:02*yglukhov[i] quit (Ping timeout: 255 seconds)
21:11:11Araqkoch tests
21:11:38FromGitter<Bennyelg> running now :)
21:12:50*xet7 joined #nim
21:13:26*NimBot joined #nim
21:14:09FromGitter<Bennyelg> How can I sync between my Nim fork to the origin master ?
21:14:29FromGitter<Bennyelg> I clone my fork to my mac
21:14:47*yglukhov[i] joined #nim
21:15:51FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4fae071539a7040ce9b4d9]
21:18:10FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b4fae921539a7040ce9b62a]
21:18:13FromGitter<Bennyelg> how the hell
21:19:40stefanos82let me find my notes Bennyelg
21:21:35stefanos82Bennyelg: in my notes I have everything like your steps, but you didn't push your local changes to the master repo
21:21:51stefanos82that should be your last command, git push
21:22:00stefanos82right after git pull upstream master
21:37:50stefanos82off-topic: any metal heads in da house?
21:49:22*jjido joined #nim
21:55:15*jjido quit (Remote host closed the connection)
22:04:49*riidom_ joined #nim
22:06:27*riidom quit (Ping timeout: 240 seconds)
22:16:09FromDiscord<treeform> For javascript backend, is there a way to like, cast js object to some thing that behave like a table? I have a js with unknown keys and I need to iterate it?
22:19:12FromGitter<rayman22201> I think this is what you want? https://nim-lang.org/docs/jsffi.html#15
22:19:22FromGitter<rayman22201> @treeform
22:20:18FromDiscord<treeform> yeah! wow did not know about this module. And I been writing JS apps in nim for like 4 months.
22:21:17FromGitter<rayman22201> lol. Well, good news is, now you have a greater appreciation for the module after having done it the hard way :-P
22:26:37FromDiscord<treeform> true to that!
22:27:38FromDiscord<treeform> I can remove all the {.emits.} now!
22:34:15Araqwatch out for the type unsafe parts of jsffi
22:34:29AraqI prefer manual wrapping even though it's more work.
22:34:42Araqso that I get the most out of Nim's type checker.
22:43:35FromDiscord<treeform> I am casting everything to string anyways
22:44:13FromDiscord<treeform> https://gist.github.com/treeform/dec0decb4e36bdaa333aed59a9ef2f88
22:44:42FromDiscord<treeform> My problem is that keys are dynamic for this object.
22:51:45*Sembei quit (Ping timeout: 248 seconds)
22:56:22*geocar quit (Quit: Connection closed for inactivity)
23:00:22*dzho quit (Ping timeout: 264 seconds)
23:16:47Araqhttps://github.com/nim-lang/Nim/issues/8363
23:17:07*rockcavera quit (Remote host closed the connection)
23:18:43FromDiscord<treeform> Araq, do you like exceptions in general?
23:20:27Araqdepends on the problem domain.
23:20:57*rockcavera joined #nim
23:21:10Araqusually the designs that do without them are the better designs.
23:22:16Araqbut everybody nowadays thinks it means Either or Maybe types everywhere and I hate these much more than I hate exceptions.
23:24:56FromDiscord<treeform> Exceptions is a complicated topic, there are pro and cons to them. Error handling is hard in general.
23:25:59*endragor joined #nim
23:26:48FromDiscord<treeform> Looks like people have implemented their own Either or Maybe types in nim.
23:27:05FromDiscord<treeform> I have not programed with them though.
23:27:39Araqsure, people are free to use them. I don't.
23:28:19FromDiscord<treeform> There is also the return code style, which I have done, and some sections feel like they only handle errors and its very hard to see the non error logic.
23:30:27*endragor quit (Ping timeout: 240 seconds)
23:31:57Araqusually, they don't "Handle" errors. they propagate them upwards. all the time. human compiler at work.
23:35:07FromDiscord<treeform> I think the best answer is just don't fail. Try to minimize errors. Works great with all 3 styles exceptions, returns and maybe
23:38:17*krux02 quit (Quit: Leaving)
23:39:55*xet7 quit (Quit: Leaving)
23:44:10FromGitter<rayman22201> @Araq would library authors or end users implement their own supervisor?
23:44:44*yglukhov[i] quit (Remote host closed the connection)
23:44:45Araqyou can implement your own, it mostly relies on the panicHook callback.
23:45:06Araqbut it's tough and there will be a single stdlib one that tries to get it right.
23:48:03FromGitter<rayman22201> got it. cool
23:50:41*xylef quit (Ping timeout: 255 seconds)
23:50:43FromGitter<rayman22201> I like the rfc. embedded friendly is good. :-D
23:54:00FromGitter<Quelklef> I question `IndexError` and perhaps even `OverflowError` being fatal
23:54:42FromGitter<Quelklef> Especially given that `KeyError` is not and (in my mind, at least) it's the sister Exception to `IndexError`
23:55:05Araqif these are not fatal, performance suffers as then every proc becomes as "Potentially raises"
23:55:15FromGitter<kayabaNerve> @Quelklef I think IndexError and KeyError both should be unless in a try-catch, no?
23:55:46FromGitter<Quelklef> @kayabaNerve If I understand the RFC correctly, you're missing the point
23:55:52FromGitter<Quelklef> @Araq because they're so common?
23:55:58Araqand not only performance, if I write .raises: [] and the compiler tells me "can raise IndexError" I throw away the compiler.
23:56:08FromGitter<Quelklef> Hahahaha
23:56:11FromGitter<Quelklef> Wait
23:56:26Araqas my array indices are correct. and if not, it should trap.
23:56:28FromGitter<Quelklef> Scratch that, I think I don't understand
23:56:43AraqIndexError is "index out of bounds"
23:56:43FromGitter<Quelklef> Come again?
23:56:55FromGitter<Quelklef> Right. Why do you say that every proc can potentially raise it?
23:57:02FromGitter<Quelklef> Just because it's common
23:57:04FromGitter<Quelklef> ?
23:58:00Araqsure.
23:58:15FromGitter<Quelklef> got it
23:58:27Araqarray access is everywhere, especially in the lower level that everyybody else calls into, directly or indirectly.