<< 29-03-2019 >>

00:10:54*a__b__m quit (Quit: Leaving)
00:43:04*rnrwashere joined #nim
01:00:03*rnrwashere quit (Remote host closed the connection)
01:01:38*rnrwashere joined #nim
01:04:12*d10n-work quit (Quit: Connection closed for inactivity)
01:05:51*rnrwashere quit (Remote host closed the connection)
01:13:24*fredrik92 quit (Quit: Client Disconnecting)
01:23:24*I_Right_I joined #nim
01:27:51*kapil____ quit (Quit: Connection closed for inactivity)
01:46:35*rnrwashere joined #nim
01:54:09*rnrwashere quit (Remote host closed the connection)
02:24:17*rnrwashere joined #nim
02:29:03*noeontheend quit (Remote host closed the connection)
02:54:20*theelous3_ quit (Ping timeout: 250 seconds)
03:05:59*banc quit (Quit: Bye)
03:07:01*dddddd quit (Remote host closed the connection)
03:19:28*rnrwashere quit (Remote host closed the connection)
03:26:01*rnrwashere joined #nim
03:27:33*banc joined #nim
03:30:48*Cthalupa quit (Ping timeout: 246 seconds)
03:31:49*Dragon-Warrior joined #nim
03:32:54*Cthalupa joined #nim
03:49:45*rnrwashere quit (Remote host closed the connection)
03:50:21*rnrwashere joined #nim
03:54:27*rnrwashere quit (Ping timeout: 240 seconds)
03:55:48*kapil____ joined #nim
04:00:30*rnrwashere joined #nim
04:10:26*rnrwashere quit (Remote host closed the connection)
04:12:28*cgfuh quit (Quit: WeeChat 2.3)
04:28:04*rnrwashere joined #nim
04:38:08*nsf joined #nim
04:54:25*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
05:02:23*I_Right_I quit (Remote host closed the connection)
05:06:07*mal`` quit (Quit: Leaving)
05:10:58*mal`` joined #nim
05:20:33*rnrwashere quit (Remote host closed the connection)
06:01:35*narimiran joined #nim
06:02:01Araqhttps://forum.dlang.org/post/[email protected] so they are waking up in D-land too.
06:02:46AraqThis is also what we should do, stop deprecating stuff that is "wrong", add new stuff instead
06:15:54*kapil____ quit (Quit: Connection closed for inactivity)
06:22:40*kapil____ joined #nim
06:33:49*solitudesf joined #nim
06:34:58*sealmove quit (Quit: WeeChat 2.4)
06:37:52FromGitter<cabhishek> n
06:44:06*uvegbot quit (Remote host closed the connection)
06:45:00*uvegbot joined #nim
06:54:13*nc-x joined #nim
06:54:28nc-xi disagree
06:56:02nc-xi don't want a language that keeps on adding stuff and not removing badly designed features
06:57:07nc-xbackward compatibility vs mischief causing capability should be taken into consideration to decide whether something should remain or not
06:58:42nc-xalso too many features create a big learning difficulty. e.g. c++ requires a lot of years to learn how to use properly
06:59:36nc-xand then people write manifestos on how to write c++. dont use this, dont use that, etc.
07:00:00*gmpreussner quit (Quit: kthxbye)
07:00:18nc-xtoo less features also makes people use anti-patterns
07:00:26nc-xso things should be balanced
07:00:43nc-xand I think Nim is going pretty good atm.
07:04:55*gmpreussner joined #nim
07:05:09*nc-x quit (Ping timeout: 256 seconds)
07:07:25*krux02 joined #nim
07:21:04*PMunch joined #nim
07:30:08*Trustable joined #nim
07:31:15*solitudesf quit (Ping timeout: 244 seconds)
07:37:57*uvegbot quit (Remote host closed the connection)
07:38:11*sutke1178 joined #nim
07:38:22*pwntus quit (Ping timeout: 245 seconds)
07:39:12*uvegbot joined #nim
07:40:33*sutke11782 quit (Ping timeout: 244 seconds)
07:46:37*rokups joined #nim
08:20:47*mal`` quit (Quit: Leaving)
08:30:17*mal`` joined #nim
08:42:53FromGitter<Varriount> Araq: You have to be careful though, otherwise you end up with situations like PHP's mysql_real_escape_string
08:44:52*narimiran_ joined #nim
08:47:07*narimiran quit (Ping timeout: 245 seconds)
08:49:53AraqI dunno, once we are as successful as PHP and C++ we are allowed to complain about it.
08:51:18Araqmaybe the development process that leads to success is also the development process that keeps cruft for a looong time
09:07:37*pwntus joined #nim
09:07:37*pwntus quit (Changing host)
09:07:37*pwntus joined #nim
09:12:06*neceve joined #nim
09:18:05FromGitter<mratsim> you need something to show for people to start complaining :P
09:18:17FromGitter<mratsim> Good enough goes a long way
09:19:07FromGitter<mratsim> deprecating stuff to avoid being hindered by legacy/bad decisions because we didn't know enough a couple years ago is OK though
09:19:14FromGitter<mratsim> otherwise you get windows
09:21:34FromGitter<Varriount> Araq: With the checkRefs switch, a positive reference count on an unowned reference will always abort the program?
09:22:16FromGitter<Varriount> (when the object is deallocated)
09:22:39FromGitter<Varriount> Will there be any way to customize that?
09:23:07FromGitter<Varriount> And how will this interact with threads? Will atomic reference counting be used?
09:23:42Araqif the checks are on it will always abort, quite deterministically so testing your program helps
09:24:17Araqit also fails more quickly than valgrind because the existence of the dangling ref is detected, not when it's used later on
09:25:36Araqthere won't be a way to customize this but keep in mind that with the flexible destructors you can write your own shared_ptr that nils the weak references or does other more crazy stuff
09:26:20Araqfor 'ref' which is used everywhere in the stdlib it's the right set of semantics for all know.
09:26:52Araqwe need a prototype and see but I did some analysis.
09:27:19Araqthe RC ops will be atomic for thread safety, yes.
09:37:06*ng0 joined #nim
09:52:37*stefanos82 joined #nim
10:02:16*Vladar joined #nim
10:17:04*narimiran_ is now known as narimiran
10:21:34*rnrwashere joined #nim
10:25:53*rnrwashere quit (Ping timeout: 245 seconds)
10:40:32*abm joined #nim
10:55:20FromGitter<Varriount> Araq: I guess I'm rather skeptical that the benefits of the proposed model will outweigh the downsides.
10:56:38FromGitter<Varriount> One of the things that drew me to Nim in the first place was that it had garbage collection. This feels like a step back, towards C++ smart pointers.
10:58:51FromGitter<mratsim> You can still rely on GC though
10:59:23FromGitter<mratsim> In my case I need more fine grained memory control
10:59:41FromGitter<Varriount> @mratsim "the GC" simply becomes reference counting, which is what smart pointers do.
10:59:53FromGitter<mratsim> it already is refcounting
11:00:26FromGitter<Varriount> But not refcounting everything
11:02:56FromGitter<mratsim> it says that it will not refcount stack assignments, like today
11:03:52FromGitter<Varriount> If anything, the proposal is even less flexible than what C++ has - the proposal essentially restricts you to using only unique and raw pointers (references)
11:04:28livcdHow would I go about merging chunks of smaller files into a bigger chunk ?
11:06:21FromGitter<Varriount> livcd: Open the output file, open each input file, then repeatedly read data from each into a buffer, which you then write into your output file.
11:06:35FromGitter<Varriount> *each input file
11:07:03FromGitter<Varriount> livcd: You could also look at the implementation of the `cat` utility
11:08:06livcdok thanks. I am trying to search in lots of small files
11:15:47ZevvVarriount: Don't look at GNU cat, its a *bad* example
11:16:28*theelous3_ joined #nim
11:32:18FromGitter<alehander42> Is there a Nim treesitter grammar
11:32:28FromGitter<alehander42> Or something like that
11:32:36FromGitter<alehander42> Maybe @shashlick
11:36:11*rokups quit (Quit: Connection closed for inactivity)
11:42:07*Dragon-Warrior quit (Ping timeout: 245 seconds)
11:45:53*Dragon-Warrior joined #nim
11:49:49FromGitter<Varriount> @alehander42 I believe someone was using treesitter to handle C binding generation.
11:57:32*sealmove joined #nim
12:02:19AraqVarriount: the "raw" pointers are still checked and that makes all the difference for me
12:03:20Araqand graphs are intrinsically more complex than trees, if you use a graph to model trees, it's wrong
12:04:09Araqthere are no good algorithms that support general graphs and scale to terabyte heap sizes
12:04:47*Snircle joined #nim
12:06:07Araqgive me a single file system implementation that uses tracing
12:09:07*Vladar quit (Remote host closed the connection)
12:10:35FromGitter<Varriount> Araq: https://en.wikipedia.org/wiki/Singularity_(operating_system)
12:13:25FromGitter<mratsim> @livcd, instead of writing to a buffer directly write to a stream
12:16:09AraqI said "file system"
12:16:32Araqnot "operating system", an OS is ok with GC
12:39:12shashlick@alehander42 - nimterop uses tree-sitter to read c/c++
12:39:23shashlickBut there's no Nim grammar so far
12:41:18shashlickhttp://tree-sitter.github.io/tree-sitter/#available-parsers
12:41:38shashlickThere's 14 supported languages, 6 more in development
12:44:03*rokups joined #nim
13:21:44*Dragon-W1rrior joined #nim
13:21:56*Dragon-Warrior quit (Read error: Connection reset by peer)
13:26:13*nsf quit (Quit: WeeChat 2.4)
13:29:25FromGitter<liquid600pgm> oh well, `static bool = true` doesn't work anywhere it seems
13:29:41FromGitter<liquid600pgm> I just tried adding it to a proc, no luck
13:30:42FromGitter<liquid600pgm> oops, it was my fault actually
13:33:57shashlickTry passing false, I don't think that works
13:34:19FromGitter<liquid600pgm> both work, it was just an error in a `when` block
13:41:25FromGitter<liquid600pgm> I was fixing a bug which appeared when I was testing if passing `false` causes errors with procs
13:43:15FromGitter<arnetheduck> > <Araq> This is also what we should do, stop deprecating stuff that is "wrong", add new stuff instead ⏎ ⏎ this works well if your language is equipped with the infrastructure to add new stuff (like the D versioning/namespacing).. nim is tricky - every symbol lives in the global namespace by default.. if I import something, the author of that library can (very) easily break my code by adding a symbol, if I just
13:43:15FromGitter... follow the "normal" way of using nim. I have to fight the language to prevent this, and it's uphill. ⏎ ⏎ thus, before committing to maintenance, ensure there actually exists a way to add things that is practical - and the smaller your starting point, the easier that becomes. [https://gitter.im/nim-lang/Nim?at=5c9e20f2e4561321d05a671f]
13:45:21FromGitter<arnetheduck> that said, I'm all for add-only - this is what package management generally is about - you have a repository of "old stuff" that *never* changes, and you can choose if you want the new stuff or not in a more manageable way, library by library instead of one huge std lib + language where you have to accept *all* changes to get a small one
13:46:53FromGitter<arnetheduck> from the post: `We have a language with virtually no global scope ` <- of course it's easy to keep adding stuff then
13:48:54FromGitter<liquid600pgm> does `{.bycopy.}` do a shallow or deep copy?
13:49:07*Cadair left #nim ("User left")
13:49:27FromGitter<mratsim> nothing of the sort
13:49:39FromGitter<liquid600pgm> what does it do then?
13:50:02FromGitter<mratsim> By default if an object is bigger than 3x pointer size, Nim passes it via pointer
13:50:11FromGitter<mratsim> you can check that in your code
13:50:24FromGitter<mratsim> if you use the bycopy pragma, Nim will not do this optimisation
13:50:58FromGitter<mratsim> if you use the byref pragma, Nim will always pass it by pointer even though it could be faster by with passing it via registers (in fastcall convention)
13:51:12FromGitter<mratsim> the main use case is interfacing with C/C++
13:51:23FromGitter<liquid600pgm> good to know. the manual was a little vague on this so I preferred to ask than wonder
13:52:16FromGitter<mratsim> so bycopy/byref does not change assignment semantics but parameter passing
13:52:36FromGitter<liquid600pgm> now, another question: are object variants just tagged unions? or are they something else?
13:52:48FromGitter<mratsim> plain tagged unions
13:53:07FromGitter<liquid600pgm> thanks
13:53:08FromGitter<mratsim> also called sum types in ML countries ;)
13:55:00FromGitter<liquid600pgm> I mean, using tagged unions makes sense here, using different types would be pretty weird
13:55:47FromGitter<liquid600pgm> and complex to compile
14:02:56*Vladar joined #nim
14:04:01*Dragon-W1rrior quit (Quit: leaving)
14:14:02*cgfuh joined #nim
14:14:21FromGitter<arnetheduck> btw, the default nim GC, is it.. quadratic, in terms of performance? ie the more I allocate, the more it has to scan?
14:17:56FromGitter<mratsim> I managed to load the official EF state tests yeah :)
14:18:15Araqarnetheduck: I'm not aware of any quadratic behaviour
14:18:25FromGitter<mratsim> arg wrong chat again
14:19:17FromGitter<arnetheduck> quadratic in the sense that when I allocate N times, it will call GC N/constant times, and the time gc takes is proportional to the memory allocated
14:20:14Araqit uses a watermark and it's like nextAllocationAtCurrentMem * 2
14:30:16*rnrwashere joined #nim
14:34:36*rnrwashere quit (Ping timeout: 250 seconds)
14:39:21*solitudesf joined #nim
14:39:59*PMunch quit (Remote host closed the connection)
14:57:16*rnrwashere joined #nim
14:59:16*dddddd joined #nim
15:11:20*a_b_m joined #nim
15:14:25*abm quit (Ping timeout: 246 seconds)
15:22:17*thomasross_ joined #nim
15:22:18*thomasross quit (Killed (asimov.freenode.net (Nickname regained by services)))
15:22:18*thomasross_ is now known as thomasross
15:23:25*redlegion quit (Ping timeout: 255 seconds)
15:24:41*redlegion joined #nim
15:24:41*redlegion quit (Changing host)
15:24:41*redlegion joined #nim
15:29:27*d10n-work joined #nim
15:42:30*stefanos82 quit (Remote host closed the connection)
15:55:20*Snircle_ joined #nim
15:55:30*Snircle quit (Ping timeout: 250 seconds)
16:32:18*Snircle joined #nim
16:33:25*Snircle quit (Client Quit)
16:34:12*Snircle_ quit (Ping timeout: 245 seconds)
16:40:14*rnrwashere quit (Remote host closed the connection)
16:40:19*neceve quit (Quit: No Ping reply in 180 seconds.)
16:41:23*nsf joined #nim
16:44:55*rnrwashere joined #nim
16:45:49*I_Right_I joined #nim
16:47:30*neceve joined #nim
16:50:17*Snircle joined #nim
16:51:56*rnrwashere quit (Remote host closed the connection)
16:52:53*rnrwashere joined #nim
17:06:40*rnrwashere quit (Remote host closed the connection)
17:16:11*rokups quit (Quit: Connection closed for inactivity)
17:35:01*a_b_m quit (Quit: Leaving)
17:36:24*clyybber joined #nim
17:46:01*stefanos82 joined #nim
17:48:06*sealmove quit (Quit: WeeChat 2.4)
17:55:29FromGitter<kdheepak> If I have a large pascal codebase that I want to convert to nim, is there anything that I can use?
17:55:51FromGitter<kdheepak> My understanding is that the nim compiler was bootstrapped from pascal, right?
18:05:49*natrys joined #nim
18:07:13*Cthalupa quit (Ping timeout: 255 seconds)
18:08:15*Cthalupa joined #nim
18:14:08narimirankdheepak: maybe https://github.com/nim-lang/pas2nim ?
18:17:50FromGitter<kdheepak> Thanks, just found that as well.
18:24:25FromGitter<kdheepak> I think the codebase I'm using has a lot of classes + inheritance
18:24:47FromGitter<kdheepak> I don't know enough about pascal at the moment to know exactly what I'm dealing with. I'll look into it further.
18:30:02*I_Right_I quit (Remote host closed the connection)
18:35:33*rnrwashere joined #nim
18:43:47*zestyr quit (Quit: WeeChat 2.4)
18:46:37*rnrwashere quit (Remote host closed the connection)
18:49:10*rnrwashere joined #nim
18:54:01*rnrwashere quit (Remote host closed the connection)
18:57:19*skaruts joined #nim
18:58:59skarutsif I have a type Point with a x and y fields, is there a way to make it so it can accept both ints and floats?
19:00:12Araqfloats can hold most integers
19:01:03Araqfloats are not "imprecise" numbers, they are more like fractions with flexible precision but integer values are fine
19:02:23skarutsbut if I define them as floats I'll have to cast to int if I do any arithmetic, right?
19:02:40skaruts(with other stuff that's defined as int)
19:03:52skarutslike p.x - camera.pos.x (or p - camera.pos)
19:04:33Araqthere are about three ways to handle that
19:04:42Araq1. introduce a converter from float to int
19:05:19Araq2. introduce an operator for the conversion so that it's short
19:05:55Araq3. live with the int() syntax, it won't kill you
19:06:04skaruts:)
19:06:11skarutstbh, I'm not needing floats, I'm just wondering how to generalize my Point type for the potential future
19:06:48skarutsbut yea, converters... I was meaning to read more about those (saw it in nim-csfml for vector types)
19:06:53Araqthen YAGNI applies, the only buzzword that makes sense
19:07:50*neceve quit (Read error: Connection reset by peer)
19:08:53skarutsbtw I ended up doing the ECS like you were saying
19:10:10skarutsusing sequences, and keeping a lookup table for by_id lookups
19:11:40skarutsoh btw, I found myself having to cast enum fields to int every time I use them as indices to sequences, is this normal behavior?
19:12:11skarutsentity.comps[int(Visible)]
19:17:20Araqfor seqs yes but for arrays you can do array[EnumType, T]
19:18:02Araqyou can introduce custom [], []= accessors for the seqs.
19:18:18skarutsoh!
19:18:36skarutsgonna try that
19:22:37skarutsI suppose it's like this:
19:22:39skarutsproc `[]`*(c:Comps):int = result = int(c)
19:22:45skarutsseems to work
19:23:47skaruts(it's not compiling due to other stuff, so I can't test it to be sure)
19:25:00clyybber[] needs two arguments
19:25:18Araqproc `[]`*(c: var Comps; i: MyEnum): var int = c[int i]
19:25:23Araqproc `[]`*(c: Comps; i: MyEnum): int = c[int i]
19:25:30skarutsComps is the enum
19:25:42Araqproc `[]=`*(c: var Comps; i: MyEnum; val: int) = c[int i] = val
19:25:49Araqyou need all three
19:25:59Araq(yeah, yeah, sucks I know I know, whatever)
19:26:19clyybberAraq: Why do you need the first one?
19:26:49skarutsbut Comps it my enum, so I'm confused about the "MyEnum" part
19:27:08clyybberreplace MyEnum with Comps and Comps with your seq type
19:27:14skarutsah
19:27:50*rnrwashere joined #nim
19:28:07Araqa[i] means [] is a binary operation
19:28:53*rnrwashere quit (Remote host closed the connection)
19:28:59*rnrwashere joined #nim
19:30:10skarutsso I suppose it should be like this:
19:30:13skarutsproc `[]`*(c: var seq[Component]; i: Comps): var int = c[int i]
19:30:26skaruts(made the same changes for the other two)
19:31:03Araqyes
19:32:34*rnrwashere quit (Remote host closed the connection)
19:33:56*rnrwashere joined #nim
19:34:47skarutsstill giving me errors, I'm gonna just finish what I was doing so that it compiles, and then I'll see about this
19:36:37*Jesin quit (Quit: Leaving)
19:38:34shashlickAraq when can code reordering become the default
19:39:25Araqshashlick, it needs clean separator points and a spec
19:40:14Araqalso automatic forwarding proc generation would be sweet
19:40:36Araqbut I'm glad to see it seems to work so well for you that you're asking ;-)
19:43:04*rnrwashere quit (Remote host closed the connection)
19:43:14shashlickYep made recent code changes in feud very easy
19:43:32*Jesin joined #nim
19:49:19*d10n-work quit (Quit: Connection closed for inactivity)
20:09:40*rnrwashere joined #nim
20:11:25skarutsseems to work well for me too, so far (though my code isn't very complex)
20:14:01*rnrwashere quit (Ping timeout: 246 seconds)
20:20:14*rnrwashere joined #nim
20:24:55*rnrwashere quit (Ping timeout: 255 seconds)
20:26:23*solitudesf- joined #nim
20:26:27*solitudesf- quit (Remote host closed the connection)
20:28:30*solitudesf quit (Ping timeout: 250 seconds)
20:29:37*sealmove joined #nim
20:29:54sealmovehttps://github.com/sealmove/ease any suggestion? what to add?
20:42:01*natrys quit (Quit: natrys)
20:42:13shashlick@sealmove: I don't get the use case for anonymous
20:42:34shashlickWhy is a closure not adequate
20:42:41*rnrwashere joined #nim
20:43:11sealmoveYou want to get a clean namespace
20:43:18*rnrwashere quit (Remote host closed the connection)
20:46:15sealmoveYou can think of it as a more explicit closure. If you want to use stuff from the enclosing scope, you have to write it explicitly. So if you do it by mistake it's caught.
20:46:49sealmoveAlso don't have to provide a name.
20:49:56sealmoveexplicit closure = normal proc, but whatever :P
20:53:26*rnrwashere joined #nim
20:56:39*Vladar quit (Remote host closed the connection)
21:01:42rayman22201I did not realize gc vs no - gc in Nim would be so controversial... And people do not seem to realize the difference between existence and dereference... geeze... (╯°□°)╯︵ ┻━┻
21:03:20sealmoveYeah... I saw you answered in the reddit thread.
21:05:24rayman22201I'm more venting about Varriount on the RFC lol. I have much respect for him, but I disagree with him on this issue strongly :-P
21:06:58rayman22201I'm all about engaging people on Reddit and such though. communication is key to a good community :-)
21:07:31FromGitter<akavel> Hi! Is there a proc/macro to dump (debug) a value to stdout/err, and still return it as-is?
21:08:09FromGitter<akavel> for example: `some_func(10+dump(7*8/3))` ?
21:08:59FromGitter<akavel> I want to inject it into some somewhat complex expressions.
21:09:10FromGitter<akavel> (To see what's calculated in them.)
21:10:29sealmoveAraq: Why is shadowing not prefered in your proposal? Instead of having to write x = nil to free memory.
21:14:22*noeontheend joined #nim
21:15:20sealmovesorry nvm, misunderstood smthing
21:15:49rayman22201@akavel, nothing built in afaik, but easy enough to write.
21:16:39rayman22201@sealmove, I was about to say, what would shadowing accomplish here?
21:17:19FromGitter<akavel> rayman22201: I thought I've seen something that dumped AST and value, but maybe I mixed it with something. Or maybe it was an example in some tutorial? Thanks anyway for the reply.
21:18:44sealmoverayman22201: nothing, my bad. I was thinking how Rust doesn't require you to write `dangling = nil`, but that has nothing to do with shadowing, and the real reason is because it forces you to write a whole bunch of lifetime annotation.
21:19:33rayman22201@akavel, the old macro tutorial had "debugEcho" macro, but that doesn't really do what you want.
21:20:00rayman22201@sealmove yup. pretty much.
21:20:45rayman22201There was talk of making a `dispose dangling` sugar macro to make it more obvious what is going on. Since `dangling = nil` is kind of ugly.
21:20:52Araqsealmove, not even lifetime annotations, a 'safe' doubly linked list is impossible with Rust's lifetimes and you're left with workarounds like array indexing or dynamic checks
21:21:28sealmoveoh!
21:21:49Araqthe examples in my blog post are not randomly chosen
21:22:03*Jesin quit (Quit: Leaving)
21:22:03Araqthe show how the model improves over both Rust's and Swift's model
21:22:07Araq*they show
21:22:28sealmovetruth is I couldn't understand the doubly linked list example, will try harder ;)
21:23:19Araqdangling = nil may be ugly but it's exactly what needs to happen under the hood
21:23:57rayman22201I agree. That's why I said *sugar* macro lol. It's definitely just fine, but you can always put lipstick on it :-P
21:24:03Araqwe can make it 'disarm dangling' but at this point I don't even want to discuss the syntax
21:24:37rayman22201fair enough
21:24:58*noeontheend quit (Ping timeout: 250 seconds)
21:25:20sealmovebut... in essence, what is the real difference? Um.. I mean, Rust has the concept of owned ref and "borrowed ref", no?
21:25:41sealmove(excuse my ignorance, did read the blog)
21:26:10AraqRust has a plethora of pointer types, 3 builtin iirc and then 4 in the stdlib
21:27:38Araqthe builtins cover unsafe and then unowned and owned but the unowned's lifetime is statically proven and in my proposal it's not.
21:28:21sealmoveso... in Rust basically they use a prover but don't codify "owner" in the typesystem?
21:28:32Araqthey do
21:30:31Araqthe unowned/borrowed pointers have regions attached to them so that they cannot outlive their owners, pretty sweet but the regions use lexical scoping and the point of a heap is to break the lexical scopes
21:31:28sealmoveyeah, sounds rational. I remember I couldn't do basic stuff before Rust 2018 because of that.
21:32:07sealmoveso Nim will do the same but using a non-lexical scoping approach?
21:32:32Araqthat's one way of putting it
21:34:55sealmoveokay, guess I'll have to read https://researcher.watson.ibm.com/researcher/files/us-bacon/Dingle07Ownership.pdf as you proposed multiple times.
21:35:54*kapil____ quit (Quit: Connection closed for inactivity)
21:36:08AraqGel is less unproven technology than Rust's lifetimes are, in Gel you can write doubly linked lists, trees with 'parent' pointers etc; all without leaving the "safe subset" or resorting to classical reference counting
21:40:13FromGitter<mratsim> For me I had lots of troube trying to represent a DAG in Rust
21:40:19sealmove"reference counting elimination", is that the catch?
21:40:19FromGitter<mratsim> trouble*
21:40:21*Jesin joined #nim
21:40:56FromGitter<mratsim> I was a programming noob at the time but still.
21:41:41FromGitter<mratsim> To be fair, in Nim I also have a lot of troube representing a DAG without too much GC overhead/genericReset ;)
21:42:21sealmoveI stopped believing in Rust's approach some time ago. It's nice but *there has to be a better way* (asking less from programmer)
21:43:03FromGitter<mratsim> The thing with Rust is that it's all or nothing
21:43:28FromGitter<mratsim> you can't gradually opt-in for more security (say once your prototype is proven), you have to get it right from the start
21:44:17sealmoveyeah too hardcore, and you pay for it even when you don't need it
21:44:31sealmovewhich makes it a non-general purpose language
21:44:33FromGitter<mratsim> it's zero cost abstraction though ;)
21:44:40FromGitter<mratsim> (I guess sanity is not a cost)
21:44:45sealmovehaha!
21:44:51sealmovenice one
21:45:07sealmovesanity cost abstraction
21:46:12FromGitter<mratsim> Nonetheless kudos to Rust for showing one approach to memory safety that works and basically jumpstarted lots of new research
21:47:02Araqsure but if after a decade of research I need to run a dynamic leak detector over my Rust programs it's quite telling
21:47:40sealmovePoint is Rust is selling for more than research.
21:50:37FromGitter<mratsim> I wouldn't go there Araq, Nim has been created a decade ago ;)
21:50:44disruptekit's a rope path up the hill, but there are other avenues of ascent, and the view from the nim side seems more pleasant to me at present.
21:52:39Araqmratsim: Pascal in 1970 was memory safe. you don't offer a 'free' operation, people need to reuse ref objects on their own, no memory safety problems, logical bugs. Ah but Rust with its painful borrow checker is better because it makes you use arrays plus indexing instead which ... is the Pascal solution.
21:59:13Araqmratsim: Nim is older than Rust but it had far fewer resources put into it and it never modeled the heap as a second stack
22:00:28Araqand I tried to do that twice, it's so tempting.
22:00:54sealmoveheap as a second stack :D btw question: for system programming Rust uses a lot of unsafe { } code. isn't that an obvious issue too?
22:01:17*narimiran quit (Ping timeout: 245 seconds)
22:01:49*rockcavera quit (Remote host closed the connection)
22:04:52Araqnot in my opinion.
22:06:52*krux02 quit (Remote host closed the connection)
22:07:52disruptekAraq: wrt immutability, why can't we ask the list to perform the mutation on the elem?
22:08:13disrupteki mean, automagically.
22:08:18Araqat least they understood that safe code must be allowed to call unsafe code and that unsafe code can call safe code. D has @system and @trusted and @safe and it's terrible IMO.
22:09:58Araqdisruptek, it doesn't work well, then you need to say in the signature that 'elem' is reachable from 'head'
22:11:10disruptekit couldn't be abstracted to an alias by the compiler?
22:11:42AraqI haven't thought much about it. How do you think it can work?
22:11:53disruptekoh, maybe i see the problem. hmm.
22:12:24Araqlook, there are phases.
22:12:38Araq1. complex graph is constructed (it's mutable)
22:12:50disruptekput it like this... if the compiler knows how to deny on an immutable pragma, then it should know how to alias it without the pragma, no?
22:12:55Araq2. complex graph is queried (immutable)
22:13:28Araqwhat does a type system do? it models the invariants. Mutability is not invariant it's phase dependent.
22:13:43Araqthat's why it's so hard to design properly.
22:14:25disrupteki thought it was more like taint.
22:14:56FromGitter<Varriount> Araq: Is it possible to detect possible cyclic data structures using a type graph, at compile time?
22:17:40*I_Right_I joined #nim
22:17:53Araqkoch boot -d:release # (134609 lines compiled; 4.595 sec total; 510.93MiB peakmem; Release Build)
22:18:20Araqkoch boot -d:release --gc:markAndSweep # (134266 lines compiled; 4.129 sec total; 424.383MiB peakmem; Release Build)
22:19:04*jjido joined #nim
22:20:09Araqkoch boot -d:release --gc:boehm # (131783 lines compiled; 3.580 sec total; 325.227MiB; Release Build)
22:20:44Araqnotice that the default GC is the RC GC without the cycle collector
22:21:28Araqand that we don't count the RC ops on the stack
22:21:54Araqthe problems of RC are not only the cycles
22:22:26disruptekand the graph queries in each phase have to be identical? the query methodology, not the results?
22:22:45disruptekie. could you have a node reachable via different paths in different phases?
22:23:03*ghidra joined #nim
22:23:07Araqdisruptek, it was an abstract example
22:23:29disruptekAraq: i'm okay with that. :-D
22:25:48*solitudesf joined #nim
22:25:49AraqVarriount: the default GC is already the worst for throughput and atomic ops don't help it. Now that maybe ok for when responsiveness matters much more but in the stdlib we don't know the application
22:26:41Araqand the stdlib is a piece of software that you might want to optimize
22:26:48FromGitter<Varriount> Araq: How is the new model going to be faster? It's still going to need to use refcounting, and atomic operations (if threads are used).
22:27:03disruptekno, it doesn't need atomics.
22:27:13Araqwe can disable the refcounting, that's how it's faster.
22:27:28Araqordinary RC cannot be disabled
22:28:23*ng0 quit (Quit: Alexa, when is the end of world?)
22:28:43sealmove"If a destroyed object has a non-zero reference count, a run-time error occurs and theprogram is terminated" why can't we catch this at compile-time?
22:29:06Araqsealmove, we are going to but I don't know how much of it we can catch
22:29:40Araqand we need to gain experience first to see if it's worth it
22:29:54Araqwe lived with dynamic checking for array indexing quite fine
22:30:15sealmovei see
22:30:21FromGitter<Varriount> What I'm trying to get at is this: Couldn't you use a regular refcounting system (something like what Swift uses) and try to detect cyclic data structures at compile time? Then, for cyclic data structures, require extra information (like whether a reference is owned or not).
22:31:53Araqa regular refcounting system that simply ignores the cycles is what Swift does and the performance is so bad that it's like betting on a dead horse
22:32:12Araqignore the cycle problems.
22:32:22Araqit also has performance problems.
22:33:46sealmoveit has to do with ref counting elimination opts?
22:34:29*ghidra quit (Ping timeout: 256 seconds)
22:34:29*skaruts quit (Ping timeout: 256 seconds)
22:36:47sealmoveit says Gel "eliminates typically 90% of all counting operations"
22:37:03Araqyes but Gel can only do that in single-threaded mode
22:37:56Araqif I take the risks and introduce this runtime split I might as well care for multi-threading
22:37:58FromGitter<Varriount> I still don't understand how you can just "disable refcounting" in this new model.
22:38:41disruptekit's weaker guarantees; static analysis in debug mode, while release presumes safety.
22:38:53FromGitter<Varriount> Other than by using raw pointers, or risking memory leaks
22:39:43*vjalmr joined #nim
22:39:54*vjalmr left #nim ("Textual IRC Client: www.textualapp.com")
22:40:35Araqevery debug run is a weak proof, these add up and problems in production are rare
22:40:55*ghidra joined #nim
22:41:25Araqexactly the runtime model we have lots of experience with. Imperfect but that's the real world here with its compromises.
22:41:36disruptekAraq: have you done anything with klee and nim output? i'm about to get stuck in on that.
22:42:32Araqklee?
22:42:56FromGitter<Varriount> Araq: What are Nim's target use-cases?
22:43:03disruptekit's static analysis for c/++
22:43:21disruptekhttp://www.doc.ic.ac.uk/~cristic/papers/klee-osdi-08.pdf
22:43:34sealmoveVarriount: wait I have just that Araq quote :))
22:44:24disruptekthis is another good paper on the subject, from last month: https://www.ndss-symposium.org/wp-content/uploads/2019/02/ndss2019_04A-4_Chau_paper.pdf
22:44:50disrupteksorry, symbolic analysis. dunno why i said static.
22:45:25sealmove"Nim's target audience is the enlightened/misguided programmer who doesn't understand why there should be more than one programming language."
22:45:45AraqVarriount: it's a general purpose programming language where "general purpose" also works when the heap sizes grow.
22:46:12AraqI added a new requirement so that my new runtime makes more sense than the old one. :P
22:46:40disrupteklol
22:46:47FromGitter<Varriount> Araq: And this new runtime will draw in "general purpose" programmers?
22:46:53*al_ joined #nim
22:47:07FromGitter<Varriount> Those that currently use Go, Python, Java, and C#?
22:47:13FromGitter<Varriount> Oh, and Javascript
22:47:28disruptekit will draw in people who are willing to settle for compile-time guarantees over jumping through the rust hoop.
22:47:50FromGitter<Varriount> disruptek: Except that there aren't compile-time guarantees, only runtime ones.
22:47:59FromGitter<Varriount> And even then, that's only in debug mode.
22:48:28disruptekis there a difference? let's just say compilation takes twice as long and call it even.
22:48:34Araqwell it's optional, you can leave it on for as long as you want. Just like array indexing
22:48:53AraqWhere are your complaints that we don't prove array indexing at compile-time?
22:49:04Araqah you don't care because not even Rust does that.
22:49:26sealmoveNim can't win in advertising. It can only win in being a better language. The hope is that given time, people will appreciate it and realize the usefulness.
22:49:29disruptekdid you see v-lang dude's link to the refutation of iterators in c++? i thought that was pretty interesting.
22:49:30FromGitter<Varriount> Araq: Surprisingly, I don't use arrays or sequences all that much in the software I write.
22:49:45FromGitter<Varriount> And when I do, it's usually looping through them, not accessing random elements.
22:49:59disrupteki mean, it's not his work, but that's where i got turned on to it recently.
22:50:30Araqsurprisingly I don't use graphs that often, I use trees and modeling trees with graphs is an abstraction inversion
22:51:16disruptekgraphs are incredible to me.
22:51:26*nsf quit (Quit: WeeChat 2.4)
22:51:35disrupteki mean, i believe they exist, but the models their enable are mind-blowing.
22:52:27FromGitter<Varriount> disruptek: There's a difference between getting an error when you compile your production application, and having it crash at 3 in the morning due to a runtime check.
22:52:51disruptekand that's why we don't do runtime checks in production.
22:52:58disrupteklogic bugs are your own.
22:53:32FromGitter<Varriount> disruptek: Ok, so you forgo the runtime checks... In this model, that means you then get all the fun of possible memory corruption and data errors.
22:53:47disruptekyes.
22:54:10disruptekthe solution to writing better software isn't to pay the penalties for runtime checks every time through the loop.
22:54:24disruptekthe solution is to write better tests and then run them before deployment.
22:54:44disrupteklet's not guess, y'know?
22:54:50disrupteki mean, are we men or mice?
22:54:52AraqI've seen so many Java programs die with OOM that I don't believe in GCs anymore.
22:55:29disrupteki had a bad experience with java in like '91 and haven't touched it since.
22:55:38disruptekbut, graalvm might just bring me back.
22:55:53Araqthere were android log statistics, now offline
22:56:04Araqnumber one bug in Java was NullPointerException
22:56:05sealmovefirst thing is to get deterministic behaviour, then it's a matter of balance between compile-time guarantees and mental overhead. tests might prove cheaper than having to do lifetime anotation.
22:56:13Araqsecond bug was Out of memory.
22:56:30disruptekthen we give you a way to run the runtime check on demand.
22:56:57disrupteklike, at runtime. ya feel?
22:59:05*al_ quit (Quit: al_)
23:02:25I_Right_IAraq: Dare I jump in to agree with you, I am not a big fan of GC's either.
23:02:47AraqVarriount: I might also come up with a 2nd, different proposal of how to evolve Nim's runtime.
23:03:17sealmovewhen you do `x: owned ref = Foo(); y: owned ref = x` what happens with x? does it downgrade to a regular ref or what?
23:03:36Araqcan't you at least see it's totally worth trying?
23:04:33disruptekwhy would it have to downgrade?
23:04:48FromGitter<Varriount> Araq: I have no doubt that it will work, from a technical perspective. It's the... social perspective that worries me.
23:04:52Araqsealmove, if you access 'x' afterwards it's a static error
23:05:00sealmovedisruptek: because can't have 2 owners for the same thing?
23:05:25disruptekoh, i didn't even read the whole snippet.
23:05:30sealmoveok so x is erased from the namespace
23:05:33sealmovegreat
23:05:45disruptekyeah, that's obviously static.
23:05:49Araqthat's not how it's implemented, it uses a control flow graph
23:05:54FromGitter<Varriount> The programmers I know generally don't like having to do any more work than absolutely necessary.
23:06:12disruptekthat's the whole point.
23:06:24disruptekto let the computer do the heavy lifting; you just say when.
23:07:11disruptekthere's no cost for unowned pointing to owned, too.
23:07:12AraqVarriount: winning these programmers is hard because they also don't want to learn anything new or anything not coming from Big Coorporation
23:07:42Araqor something that hasn't as many libraries as Python.
23:07:49*solitudesf quit (Ping timeout: 255 seconds)
23:08:38disruptekit's like now that the world found python, it's the new yardstick. a yardstick that only measures length, not width, or depth.
23:09:21Araqhave you seen how to use Java for Big Data? I have and IMO it's no fun.
23:09:38disrupteki guess the real problem is that there are so few old programmers compared to the number of noobies.
23:10:24sealmoveNim can grow as Python did :)) the long game
23:10:34sealmovegood design stacks up
23:10:42*rnrwashere quit (Ping timeout: 250 seconds)
23:11:12disruptekwe don't need any more languages north of python; we need more languages closer to the equator, like nim.
23:11:31clyybberAraq: And I'd argue it isn't worth it to win those programmers
23:11:46Araqwell we need to grow.
23:12:00Araqand we're doing pretty bad, IMO.
23:12:23disrupteki had no idea that was the case. how do you measure that? google trends?
23:12:46Araqdon't want to share the details, sorry.
23:13:07disruptekthat makes sense.
23:14:57disrupteki'm not worried.
23:16:08*rnrwashere joined #nim
23:16:39sealmoveNim is big enough already to not go unnoticed when it's totally stable
23:17:47Araqwell it's not like we stopped development and are working on this unproven piece of technology because it's more fun
23:17:54disruptekit's just nicer to use.
23:18:18ghidraHow granularly could new-runtime be used, i.e. could I depend on a nimble package that uses old runtime?
23:18:34disrupteki don't know about you, but if the community was limited only those who program recreationally, i'd be totally fine with that.
23:18:43disruptekit feels like haskell, that way.
23:19:49disruptekwhy would you not be able to depend on a previous runtime?
23:19:52sealmove@Araq: This is the game Nim has to win, not advertising, so don't even have second thoughts!
23:20:33sealmovedisruptek: no, it's nothing like haskell!
23:21:12ghidradisruptek: Should have been more specific, a nimble package without owned annotations.
23:21:27sealmoveit's all for the sake of being more efficient, not for the sake of doing something new
23:22:05*Trustable quit (Remote host closed the connection)
23:22:08Araqghidra, I don't have a good solution for that, libraries should use 'owned' and your code can continue to use the GC
23:22:26Araqthe libraries need to be ported.
23:22:39Araqit's like a Python 2/3 split
23:22:59Araqpretty bad but we have the eternal "not yet v1" excuse
23:27:03*rnrwashere quit (Remote host closed the connection)
23:35:19AraqVarriount: let's assume we can do the "dangling check" at compile-time, always. Would that make you change your mind? Because for me the real negative aspects remain:
23:35:31Araq- breaks code
23:35:47Araq- in rare cases you don't have an ownership tree
23:35:59*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:37:03Araqfor me that are the real costs; I already enumerated its advantages.
23:38:12FromGitter<arnetheduck> here we go - first public launch of nimbus beacon chain: have a spin :) https://our.status.im/the-nimbus-mvp-testnet-is-here/
23:39:55Araqwow, wasn't aware you're so far
23:40:03Araqcongrats!
23:44:45FromGitter<arnetheduck> neither were we, but here were are :)
23:49:02sealmoveAraq: does this model essentially eliminates the need for multiple ownership?
23:49:50Araqit enforces single ownership
23:50:19Araqwell you can always write a SharedPtr[T] with a cycle detector
23:50:21sealmoveand since RC is done on normal refs, you can do more with them
23:50:31sealmoveoh ok, that would be my next question :)
23:50:54Araqlook, my proposal is about what 'ref' should mean, the one thing everywhere in Nim
23:51:06Araqthat we don't have many good solutions for
23:52:39sealmoveI hope it is the case that porting is just a matter of "strategically placed `owned`s", but I'm afraid it might not...
23:55:31Araqhe he
23:57:45Araqif it's not, maybe it's because your program sucks ;-)