00:10:22 | * | Matthias247 quit (Read error: Connection reset by peer) |
00:12:20 | * | cryzed quit (Ping timeout: 246 seconds) |
00:15:38 | * | makoLine joined #nim |
00:24:29 | * | cryzed joined #nim |
00:37:09 | * | desophos_ joined #nim |
00:41:42 | * | desophos_ quit (Ping timeout: 260 seconds) |
00:46:15 | * | yglukhov joined #nim |
00:49:34 | * | desophos joined #nim |
00:50:29 | * | yglukhov quit (Ping timeout: 246 seconds) |
00:59:56 | * | jaco60 quit (Ping timeout: 246 seconds) |
01:09:54 | * | Trustable quit (Remote host closed the connection) |
01:31:54 | * | AMorpork left #nim ("Leaving") |
02:16:59 | * | tomp joined #nim |
02:17:10 | * | strcmp4 quit (Ping timeout: 240 seconds) |
02:18:56 | * | delian66 joined #nim |
02:18:57 | * | ayeganov_ joined #nim |
02:18:57 | * | Xe` joined #nim |
02:18:59 | * | Xe quit (Quit: *.yolo *.swag) |
02:19:02 | * | ayeganov quit (Write error: Broken pipe) |
02:19:04 | * | tomes quit (Write error: Broken pipe) |
02:19:05 | * | delian66_ quit (Remote host closed the connection) |
02:21:05 | * | Xe` is now known as Xe |
02:30:35 | * | desophos_ joined #nim |
02:35:17 | * | desophos_ quit (Ping timeout: 272 seconds) |
02:39:53 | * | C10RD joined #nim |
02:41:37 | * | pregressive joined #nim |
02:50:10 | * | C10RD quit (Remote host closed the connection) |
02:57:12 | * | strcmp4 joined #nim |
03:03:11 | * | C10RD joined #nim |
03:05:39 | * | C10RD quit (Remote host closed the connection) |
03:13:19 | * | Guest48911 is now known as Guest48911isaway |
03:24:59 | * | C10RD joined #nim |
03:30:16 | * | C10RD quit (Quit: Bye) |
03:30:40 | * | C10RD joined #nim |
03:30:55 | * | C10RD quit (Client Quit) |
03:48:53 | * | brson quit (Quit: leaving) |
04:10:01 | * | xtagon joined #nim |
04:18:10 | * | thume joined #nim |
04:23:58 | thume | So I’m having a super weird issue with a nim program. It won’t let me pipe its stdout to anything. |
04:24:25 | thume | Unlike every other program, doing ./server outputs to stdout but doing “./server | cat” gives no output whatsoever. |
04:24:54 | thume | This is an issue because it means that the systemd service for my server can’t get any logging data to put in journald |
04:26:13 | thume | It’s just a normal jester app that uses “echo”: https://github.com/trishume/ratewithscience/blob/master/server.nim |
04:27:56 | thume | It does work if I redirect to a file though like “./server > test.txt” |
05:07:06 | * | thume quit (Quit: thume) |
05:09:53 | * | thume joined #nim |
05:10:23 | thume | kk result is I gave up on piping the logs. My app now has no logging. |
05:10:33 | * | thume quit (Client Quit) |
05:18:35 | * | pregressive quit (Remote host closed the connection) |
05:19:29 | * | Varriount-Laptop joined #nim |
05:36:30 | * | darkf joined #nim |
05:56:36 | * | cyraxjoe_ joined #nim |
05:57:34 | * | cyraxjoe quit (Ping timeout: 276 seconds) |
06:09:07 | * | Varriount-Laptop quit (Ping timeout: 265 seconds) |
06:20:52 | * | xtagon quit () |
06:31:42 | * | strcmp4 quit (Ping timeout: 272 seconds) |
06:35:08 | * | desophos quit (Read error: Connection reset by peer) |
06:38:03 | * | Demon_Fox joined #nim |
06:52:02 | * | strcmp4 joined #nim |
07:01:28 | * | BitPuffin|osx quit (Ping timeout: 272 seconds) |
07:15:14 | * | gour joined #nim |
07:38:57 | * | smodo joined #nim |
07:55:28 | * | Demon_Fox quit (Ping timeout: 250 seconds) |
08:08:39 | * | Demon_Fox joined #nim |
08:30:52 | * | darkf quit (Read error: Connection reset by peer) |
08:31:17 | * | darkf joined #nim |
08:32:29 | * | yglukhov joined #nim |
08:51:51 | * | yglukhov quit (Remote host closed the connection) |
08:52:03 | * | yglukhov joined #nim |
09:01:30 | * | makoLine quit (Ping timeout: 260 seconds) |
09:09:19 | * | Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif) |
09:23:12 | * | Matthias247 joined #nim |
09:37:55 | * | yglukhov quit (Remote host closed the connection) |
10:01:06 | * | gokr joined #nim |
10:22:00 | * | gokr quit (Quit: Leaving.) |
10:33:06 | Araq | meh, "not nil" as a default is such a pita |
10:33:41 | Araq | how can I express "ptr Foo not nil if someCondition" |
10:35:27 | * | vendethiel joined #nim |
10:40:39 | reactormonk | Araq, what wou dbe someCondition? |
10:41:02 | Araq | something I cannot express via Nim's type system |
10:41:11 | Araq | like |
10:41:23 | Araq | if t.kind == tyObject |
10:42:08 | reactormonk | time for a case object? |
10:43:41 | * | Trustable joined #nim |
10:44:04 | Araq | can't, it's some really low level stuff |
10:44:45 | reactormonk | Integrating with C or lowlevel hardware? |
10:45:25 | * | Matthias247 quit (Read error: Connection reset by peer) |
10:48:21 | Araq | with my very own codegen which I'm not gonna change for this |
10:51:34 | * | gokr joined #nim |
11:22:43 | dom96 | Araq: Sounds like you're setting yourself up for "No, this can't work" |
11:23:14 | dom96 | If `not nil` is default then why would you need to express that? |
11:35:10 | * | gokr quit (Quit: Leaving.) |
11:54:05 | * | jaco60 joined #nim |
11:57:17 | Araq | dom96: because sometimes it can be nil, sometimes it can't |
11:57:28 | Araq | depending on a condition that I cannot express in the type system |
12:27:28 | dom96 | Araq: What is this condition? |
12:27:48 | dom96 | if it can't be expressed can't you just revert back to the default behaviour? |
12:29:43 | Araq | well I'm evaluating what the language looks like if 'not nil' were the default |
12:29:57 | Araq | so surely I can go back but that misses the point |
12:42:19 | dom96 | Araq: Surely some types will still need to be marked `has nil` |
12:42:29 | dom96 | The point is that most will not need to be |
12:43:25 | * | C10RD joined #nim |
12:49:45 | * | C10RD left #nim (#nim) |
12:55:51 | dom96 | Found a really good talk about RNGs: https://www.youtube.com/watch?v=45Oet5qjlms |
12:55:56 | strcmp4 | i think not nil will be a good idea |
13:01:56 | * | yglukhov joined #nim |
13:30:46 | * | Guest48911isaway is now known as Guest48911 |
13:32:02 | * | Demon_Fox quit (Quit: Leaving) |
13:52:01 | * | smede joined #nim |
13:52:51 | * | smede quit (Client Quit) |
13:53:00 | * | zepolen joined #nim |
13:59:02 | * | vendethiel quit (Ping timeout: 250 seconds) |
14:01:32 | * | smede joined #nim |
14:39:12 | * | yglukhov quit (Remote host closed the connection) |
14:53:44 | * | vendethiel joined #nim |
15:14:40 | * | zepolen quit (Remote host closed the connection) |
15:39:46 | * | yglukhov joined #nim |
15:46:19 | * | Trustable quit (Remote host closed the connection) |
16:13:38 | * | rkj-b joined #nim |
16:15:12 | * | desophos joined #nim |
16:19:43 | * | pmbauer left #nim (#nim) |
16:19:54 | * | pmbauer joined #nim |
16:41:54 | * | strcmp5 joined #nim |
16:44:15 | * | strcmp4 quit (Ping timeout: 240 seconds) |
16:49:50 | * | zepolen joined #nim |
16:54:16 | * | zepolen_ joined #nim |
16:55:21 | * | zepolen quit (Ping timeout: 272 seconds) |
17:02:29 | * | zepolen joined #nim |
17:02:49 | * | rkj-b quit (Quit: ChatZilla 0.9.92 [Firefox 42.0/20151029151421]) |
17:03:45 | * | zepolen_ quit (Ping timeout: 250 seconds) |
17:04:05 | * | aziz_ joined #nim |
17:14:15 | * | BitPuffin|osx joined #nim |
17:15:40 | * | pregressive joined #nim |
17:18:13 | * | mrkishi_ quit (Remote host closed the connection) |
17:20:18 | * | Trustable joined #nim |
17:20:51 | * | xet7 joined #nim |
17:23:05 | BitPuffin|osx | Araq: something like C++'s unique_ptr isn't implementable in nim, right? |
17:36:28 | * | zepolen quit (Remote host closed the connection) |
17:36:48 | * | Sornaensis quit (Excess Flood) |
17:37:12 | * | Sornaensis joined #nim |
17:40:14 | * | strcmp1 joined #nim |
17:42:50 | * | strcmp5 quit (Ping timeout: 276 seconds) |
17:44:46 | * | mikolalysenko quit (Ping timeout: 240 seconds) |
17:44:47 | * | Guest4360 quit (Ping timeout: 240 seconds) |
17:45:06 | * | Learath2 quit (Ping timeout: 240 seconds) |
17:45:26 | * | darkf quit (Ping timeout: 240 seconds) |
17:46:52 | * | Guest4360 joined #nim |
17:47:28 | * | mikolalysenko joined #nim |
17:47:48 | * | zepolen joined #nim |
17:50:49 | * | Learath2 joined #nim |
17:54:11 | Araq | BitPuffin|osx: it is once I finally fix destructors in Nim |
17:54:54 | BitPuffin|osx | Araq: ah, so you'll finally have deterministic destructors for value types going out of scope? |
17:56:39 | BitPuffin|osx | what about move semantics, I thought that's also a key recipe for unique_ptr |
18:04:24 | * | zepolen quit (Remote host closed the connection) |
18:09:12 | * | ephja joined #nim |
18:11:30 | * | smede quit (Ping timeout: 240 seconds) |
18:12:31 | * | smodo quit (Remote host closed the connection) |
18:13:50 | * | pregressive quit (Remote host closed the connection) |
18:14:11 | * | pregressive joined #nim |
18:16:15 | Araq | BitPuffin|osx: we have overloading of '=' too, override it to give it move semantics |
18:16:59 | BitPuffin|osx | well move doesn't only happen when you assign with = |
18:17:08 | BitPuffin|osx | it can also happen when you pass an argument, or return a value |
18:17:17 | BitPuffin|osx | or would = be called then too? |
18:23:55 | * | zepolen joined #nim |
18:26:12 | dom96 | Really wish somebody bothered to document why there is now a parseopt and parseopt2 |
18:26:55 | strcmp1 | more accomodating worldview |
18:27:26 | strcmp1 | python philosophy |
18:30:35 | dom96 | will we rename parseopt2 back to parseopt in the future? |
18:34:04 | * | zepolen quit (Remote host closed the connection) |
18:35:54 | * | cyraxjoe_ quit (Read error: Connection reset by peer) |
18:36:06 | * | brson joined #nim |
18:37:15 | * | cyraxjoe joined #nim |
18:37:55 | Araq | BitPuffin|osx: return and parameter passing are already move operations |
18:38:41 | BitPuffin|osx | Araq: can you overload that move? |
18:39:07 | BitPuffin|osx | or how do you mean, for the GC? |
18:39:16 | BitPuffin|osx | because we wanna implement unique_ptr here, which would not use the gc |
18:41:11 | * | smede joined #nim |
18:41:59 | * | zepolen joined #nim |
18:45:46 | * | zepolen quit (Remote host closed the connection) |
18:47:10 | * | yglukhov quit (Ping timeout: 260 seconds) |
18:48:56 | * | yglukhov joined #nim |
18:52:15 | * | yglukhov quit (Remote host closed the connection) |
19:00:10 | * | smede quit (Ping timeout: 240 seconds) |
19:28:18 | * | pregressive quit (Remote host closed the connection) |
19:31:24 | * | brson quit (Ping timeout: 250 seconds) |
19:35:26 | * | strcmp1 quit (Quit: return 0;) |
19:35:37 | * | strcmp1 joined #nim |
19:41:12 | * | Demon_Fox joined #nim |
19:43:46 | * | brson joined #nim |
19:45:30 | * | vendethiel- joined #nim |
19:47:08 | * | vendethiel quit (Ping timeout: 244 seconds) |
19:56:37 | * | gokr_ joined #nim |
19:57:41 | * | elrood joined #nim |
20:01:01 | * | terry_ joined #nim |
20:05:38 | terry_ | hi Araq, can I follow up on a comment you made on the forum? |
20:05:42 | terry_ | see http://forum.nim-lang.org/t/1804/2 |
20:06:00 | Araq | hi :-) |
20:06:02 | terry_ | Can you explain a little more to me why libmill's light weight threading is a deadend when interacting with Nim's GC? I am not sure I understand it |
20:06:37 | Araq | well tbh I don't know how libmill works but there are only a couple of solutions possible |
20:06:48 | Araq | 1. setjmp hacks |
20:07:08 | Araq | 2. stack switching via assembler instructions |
20:07:43 | terry_ | it is indeed based on setjmp hacks. and it is very similar to musl system inside Nim's coroutine system |
20:07:53 | Araq | 3. posix's setcontext |
20:09:16 | Araq | ok, well setjmp hacks are strictly speaking not compatible with Ansi C iirc |
20:09:39 | Araq | and you need to be aware of the volatile requirements etc |
20:10:08 | Araq | plus I found the code much harder to understand than just inline assembler |
20:10:22 | Araq | so what's the benefit? |
20:11:06 | terry_ | mostly just b/c I didn't know about -d:nimCoroutines (i didn't see it in the documentation) |
20:12:00 | terry_ | but i am more interested in whether there are some special things you needed to do in your -d:nimCoroutines that resolved some bad interaction b/w setjmp and Nim's GC |
20:12:26 | Araq | -d:nimCoroutines just supports Nim's GC |
20:12:45 | Araq | you don't need to avoid it because it tells the Gc properly about the available stacks |
20:13:02 | terry_ | but does a regular C library not handle GC if I only pass alloc'd memory to it? |
20:13:18 | terry_ | or if I use GC_ref/GC_unref with it? |
20:13:42 | Araq | r-ku knows the details, but he started with something with libmill and now it uses inline assembler and works much better |
20:14:20 | Araq | you can indeed use GC_ref/GC_unref as well as a couple of other solutions |
20:15:00 | Araq | (*he started with something like libmill) |
20:15:13 | terry_ | okay, that makes sense to me |
20:15:17 | terry_ | I definite have no issues with using nimCoroutines. I am just more worried about GC interactions in general when interfacing with C library. |
20:15:34 | terry_ | and it sounds like it wasn't that there was a problem but that nimCoroutines is a better starting point |
20:19:25 | Araq | yup, but it doesn't work yet with the default GC iirc |
20:19:45 | Araq | oh wait, it does |
20:22:27 | terry_ | okay, thanks for confirming. I will take a deeper look. |
20:22:35 | * | makoLine joined #nim |
20:24:45 | Araq | but it kinda sucks because he was too lazy to use a bloom filter for the isOnStack primitive |
20:26:25 | * | mat4 joined #nim |
20:26:27 | mat4 | hello |
20:26:58 | * | allan0 quit (Quit: no) |
20:27:56 | * | allan0 joined #nim |
20:31:58 | terry_ | i see, he loops through and checks each element in stack |
20:32:14 | Araq | hi mat4 |
20:32:57 | mat4 | hi Araq |
20:33:00 | * | pregressive joined #nim |
20:40:31 | mat4 | have you read the logs ? |
20:42:43 | Araq | no. |
20:42:58 | Araq | I haven't even read all my emails. |
20:45:01 | * | pmbauer left #nim (#nim) |
20:47:26 | * | pregressive quit (Remote host closed the connection) |
20:47:59 | mat4 | I was wondering why ranges of type [1..n] will get initializes to zero |
20:48:01 | * | pregressive joined #nim |
20:48:07 | * | pregressive quit (Read error: Connection reset by peer) |
20:48:15 | mat4 | ^initialized |
20:48:36 | dom96 | mat4: pretty sure that's a bug |
20:48:48 | mat4 | I think so |
20:48:51 | * | smede joined #nim |
20:50:51 | mat4 | (however someone here found this a rational initialisation choice) |
20:54:54 | Araq | it's not a bug, it's documented behaviour |
20:55:21 | Araq | default initialization is always binary zero because it's the most efficient thing that can be done |
20:55:47 | Araq | the compiler does warn you though |
20:56:13 | Araq | and at some point we can make it a compile time error. I see nothing wrong with it. |
20:56:48 | mat4 | ok, so I need to ensure manual initialisation for that cases |
20:57:44 | * | zepolen joined #nim |
20:57:54 | dom96 | Araq: Doesn't the compiler know at compile-time the range of the array? |
20:58:13 | dom96 | er, the range of the type |
20:58:23 | Araq | yes, it does |
20:59:02 | dom96 | so why can't it just emit a '= 1' or '= 2' or whatever low(rangeT) is? |
20:59:10 | BitPuffin|osx | Araq: you never answered if you can overload the code that runs on a move on return value, also parameter passing doesn't always have to be a move |
21:00:11 | Araq | dom96: it could do that but it's some work to implement and the resulting machine code ain't pretty |
21:00:54 | federico3 | are the buildbots running performance regression jobs? |
21:01:11 | dom96 | Araq: hrm, I'm not sure I can see why it would be a lot of work. |
21:01:18 | dom96 | But I'll take your word for it. |
21:01:23 | dom96 | federico3: Don't think so. |
21:01:54 | dom96 | Wish somebody would take over the maintenance of NimBuild off my hands ;) |
21:02:07 | dom96 | Benchmarks were on my todo list for a long time |
21:02:19 | federico3 | it would be nice to have some benchmarks and show their history |
21:02:59 | * | zepolen quit (Ping timeout: 272 seconds) |
21:03:09 | dom96 | I agree |
21:03:45 | federico3 | I could look for some simple tools to collect test run outputs and generate charts |
21:04:07 | federico3 | I also have a cubieboard that could join the fleet for building and testing |
21:05:45 | dom96 | The biggest problem we have is that none of us have the time for our infrastructure. |
21:05:54 | dom96 | Varriount is even way too busy. |
21:05:59 | dom96 | As far as I can see. |
21:06:02 | * | theduke joined #nim |
21:07:56 | theduke | Hey guys, dom just published my playground package: https://github.com/theduke/nim-playground |
21:08:21 | Araq | BitPuffin|osx: I don't know. By your logic 'const &T' would break C++ move semantics and I have never heard of that being the case. |
21:08:26 | def- | theduke: nice! |
21:08:32 | theduke | web-based light weight editor for playing with nimble code. I find it very convenient for testing things out |
21:08:46 | theduke | suggestions welcome |
21:08:54 | dom96 | theduke: that reminds me to test it! |
21:10:52 | dom96 | theduke: works really well, nice! |
21:11:09 | dom96 | One suggestion: make the "Press Ctrl+Enter to execute" a bit more visible. |
21:11:39 | BitPuffin|osx | Araq: I dunno what const &t does in nim necessarily |
21:11:55 | BitPuffin|osx | or why it would break |
21:12:16 | Araq | nim's parameter passing semantics are C++'s 'const &T' |
21:12:35 | BitPuffin|osx | yeah and C++ doesn't move every time you passa parameter |
21:13:16 | BitPuffin|osx | but yeah you wouldn't move to a const &T in C++ I think |
21:13:49 | BitPuffin|osx | but when you transfer ownership of a unique_ptr by calling some function you can move it |
21:14:20 | BitPuffin|osx | then I guess it's just like taking a T in C++ but since you use std::move it gets casted to an rvalue and it is move constructed rather than copy constructed |
21:14:55 | dom96 | bbl |
21:16:50 | * | Demos joined #nim |
21:18:22 | federico3 | theduke: you might want to add some comments on its security |
21:25:30 | * | smede quit (Ping timeout: 260 seconds) |
21:25:55 | federico3 | dom96: what kind of help do you need on the infrastructure? |
21:26:17 | * | theduke quit (Ping timeout: 252 seconds) |
21:30:57 | * | yglukhov joined #nim |
21:31:58 | * | vendethiel- quit (Read error: Connection reset by peer) |
21:34:05 | * | vendethiel joined #nim |
21:38:12 | * | theduke joined #nim |
21:40:05 | * | Trustable quit (Remote host closed the connection) |
21:48:06 | BitPuffin|osx | Araq: oh yeah I think I see what you mean now that I'm remembering more about nim, you don't really have pass by value you do proc foo(a: int) = let copied = a |
21:53:24 | BitPuffin|osx | so solution is take the parameter as a var |
21:53:28 | BitPuffin|osx | and overload = and move it |
21:53:46 | BitPuffin|osx | can you define your own effects so that you can statically prevent use after move? |
21:58:54 | * | gour quit (Quit: WeeChat 1.3) |
22:01:23 | BitPuffin|osx | Araq: so a basic implementation of the basics would look like this https://gist.github.com/BitPuffin/a3e145bf43f934098faf ? |
22:02:00 | * | Trustable joined #nim |
22:02:12 | BitPuffin|osx | you'd have to overload [] of course |
22:02:19 | * | Trustable quit (Remote host closed the connection) |
22:02:29 | BitPuffin|osx | but for the moving and destruction that would be the implementation roughly |
22:02:36 | * | Ven joined #nim |
22:02:40 | BitPuffin|osx | just that ideally you also wanna track the fact that it was moved with effects |
22:03:46 | BitPuffin|osx | you could add a moved boolean but then you're introducing runtime overhead that the whole point was to avoid with a unique_ptr |
22:18:18 | * | lazypenguin quit (Ping timeout: 240 seconds) |
22:22:22 | * | Kingsquee joined #nim |
22:28:34 | * | mat4 quit (Quit: Leaving) |
22:29:25 | Araq | BitPuffin|osx: yeah, that's how I imagine a basic implementation to look like |
22:29:50 | * | brson quit (Ping timeout: 240 seconds) |
22:30:38 | BitPuffin|osx | Araq: that's pretty decent |
22:31:56 | * | Ven_ joined #nim |
22:32:19 | BitPuffin|osx | Araq: if you have the ability to get to the root of the AST I suppose you could implement the checking for use after move with a macro |
22:32:30 | BitPuffin|osx | just that it would be tricky, and not very scalable |
22:32:34 | BitPuffin|osx | since you want local checking |
22:34:02 | * | brson joined #nim |
22:35:20 | * | Ven quit (Ping timeout: 276 seconds) |
22:35:25 | * | yglukhov quit (Remote host closed the connection) |
22:35:58 | Araq | BitPuffin|osx: that's better done in the language directly though |
22:36:39 | Araq | until a theory of programmable type systems comes along and Nim supports it |
22:37:14 | Araq | which is ten years away I guess |
22:38:53 | BitPuffin|osx | Araq: until then you could do pretty well with a static analysis tool that knows about uptr |
22:39:31 | BitPuffin|osx | you could also make it a runtime error I guess in debug mode and do the bool thing then |
22:41:56 | * | lazypenguin joined #nim |
22:44:50 | Araq | BitPuffin|osx: I agree. the static analysis is the way to go |
22:48:31 | BitPuffin|osx | where did proc free go? |
22:53:44 | Araq | it was removed because it wasn't a wrapper for C's free, but an alias for dealloc |
22:53:51 | Araq | so use dealloc instead |
22:54:11 | BitPuffin|osx | yeah alright |
22:57:37 | BitPuffin|osx | Araq: wait so if it's not C free, what is it? |
22:57:51 | Araq | Nim's free? |
22:57:59 | BitPuffin|osx | how does that differ from C free? |
23:00:10 | Araq | Nim has its own allocator |
23:01:10 | Araq | which is thread local, doesn't return 'nil' but dies with OOM instead and supports Nim's GC |
23:01:19 | BitPuffin|osx | I see |
23:01:35 | BitPuffin|osx | I also wanted to add a way to push and pop a sort of allocator "stack" |
23:03:06 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:03:18 | BitPuffin|osx | if you've kept up with jonnifer blowpez' language he has a thing where you can push a new context to get a different allocator |
23:03:23 | BitPuffin|osx | and I thought that could be added fairly easy with macrros |
23:09:09 | BitPuffin|osx | Error: implementation of 'uptr' expected o_O |
23:09:15 | BitPuffin|osx | type |
23:09:15 | BitPuffin|osx | uptr[T]* = object of RootObj |
23:09:15 | BitPuffin|osx | p: ptr T |
23:10:24 | * | Demos quit (Ping timeout: 265 seconds) |
23:11:15 | Araq | the star follows the identifier, not the brackets |
23:11:28 | Araq | because you export the identifier, not the brackets |
23:11:40 | BitPuffin|osx | ah okay |
23:12:36 | Araq | yeah but pushing and poping allocators is just horrible for memory safety |
23:12:48 | BitPuffin|osx | yeah this isn't really for safety though |
23:13:07 | Araq | and almost impossible to model with a type system |
23:13:19 | BitPuffin|osx | it's for manual memory management |
23:13:52 | BitPuffin|osx | so that I can go, create arbitrary memory stack, push this one and every allocation should now come from there, and then free it all in one go later |
23:14:12 | BitPuffin|osx | anyhow, move semantics aren't possible because you can't modify the rhs |
23:14:20 | BitPuffin|osx | mem.nim(27, 1) Error: signature for '=' must be proc[T: object](x: var T; y: T) |
23:14:30 | BitPuffin|osx | if y can't be var then you can't move |
23:15:34 | Araq | if it has to be var it cannot be constructed though |
23:16:33 | * | aziz_ quit (Remote host closed the connection) |
23:17:10 | BitPuffin|osx | wait it compiled even though I'm mutating rhs |
23:18:08 | Araq | hu? |
23:18:16 | BitPuffin|osx | proc `=`*[T: object](lhs: var uptr[T], rhs: uptr[T]) = |
23:18:17 | BitPuffin|osx | lhs.p = rhs.p |
23:18:17 | BitPuffin|osx | rhs.p = nil |
23:18:19 | BitPuffin|osx | rhs.p = nil |
23:18:26 | BitPuffin|osx | why does it let me do that when rhs is not var? |
23:18:37 | BitPuffin|osx | I thought the default was const T& |
23:22:47 | Araq | because you don't instantiate this generic? |
23:23:45 | BitPuffin|osx | ah, maybe that's why I'm getting can't instantiate deepCopy when I actually instantiate it :P |
23:25:00 | BitPuffin|osx | either way since you can't make rhs var I guess you can't implement move on assignment |
23:25:28 | BitPuffin|osx | since moving is supposed to clean up the object you're moving from |
23:28:54 | * | zepolen joined #nim |
23:39:45 | BitPuffin|osx | I guess you could make the operator <- isntead |
23:40:25 | * | vendethiel quit (Ping timeout: 240 seconds) |
23:42:32 | * | Sembei joined #nim |
23:44:04 | Araq | if '=' takes a rhs 'var' you cannot construct it. at all. |
23:44:34 | BitPuffin|osx | yeah but for move rhs needs to be a var |
23:44:37 | BitPuffin|osx | so move can't be with = |
23:44:58 | BitPuffin|osx | also why not? you just can't construct it with another thing of the same type |
23:49:34 | Araq | so how do you construct something with something of a different type? |
23:49:44 | Araq | that makes no sense. |
23:49:59 | Araq | var s: string = 8 # i don't think so ... |
23:50:30 | BitPuffin|osx | I meant more like var s: something = something(3, 2) |
23:50:35 | BitPuffin|osx | the construction isn't the assignment |
23:51:12 | BitPuffin|osx | it's the call to the constructor |
23:51:44 | Araq | yeah well |
23:51:46 | * | brson quit (Quit: leaving) |
23:52:09 | BitPuffin|osx | var a: uptr[int] = uptr[int](p: sp) |
23:52:09 | BitPuffin|osx | var b: uptr[int] = uptr[int](p: nil) |
23:52:09 | BitPuffin|osx | b <- a |
23:52:13 | BitPuffin|osx | didn't work either |
23:52:19 | BitPuffin|osx | because b and a are apparently not var |
23:52:44 | Araq | Nim rewrites 'var x = foo()' to 'var x; x = foo()' :P |
23:52:55 | Araq | if the type overloads '=' |
23:54:00 | BitPuffin|osx | type mismatch: got (uptr[system.int], uptr[system.int]) but expected one of: mem.<-(lhs: var uptr[<-.T], rhs: var uptr[<-.T]) |
23:54:17 | BitPuffin|osx | but yeah you really want move to be = here |
23:54:26 | BitPuffin|osx | so I dunno |
23:57:45 | lazypenguin | Araq: I enjoyed your talk at the Nim workshop (uploaded on Reddit)...too bad not a lot of people laughed at your jokes ;). |
23:59:49 | BitPuffin|osx | Araq: anyway I don't really see an obvious solution to it and I'm not so familiar with the language anymore, but it would be nice if there was one |