| 00:09:52 | * | devted joined #nim |
| 00:42:41 | * | ftsf joined #nim |
| 01:16:30 | * | qzo quit (Read error: Connection reset by peer) |
| 01:16:50 | * | brson joined #nim |
| 01:35:42 | * | devted quit (Quit: Sleeping.) |
| 01:48:39 | * | aedigix quit (Ping timeout: 256 seconds) |
| 01:52:25 | * | couven92 quit (Quit: Client Disconnecting) |
| 01:53:17 | * | Serenitor quit (Quit: Leaving) |
| 01:54:23 | * | brson quit (Quit: leaving) |
| 01:56:08 | * | chemist69 quit (Ping timeout: 260 seconds) |
| 01:56:56 | * | devted joined #nim |
| 01:58:51 | * | yglukhov joined #nim |
| 02:01:11 | * | brson joined #nim |
| 02:03:19 | * | yglukhov quit (Ping timeout: 258 seconds) |
| 02:03:50 | * | brson quit (Client Quit) |
| 02:04:23 | * | brson joined #nim |
| 02:09:48 | * | chemist69 joined #nim |
| 02:27:57 | * | brson quit (Quit: leaving) |
| 02:35:46 | * | zachcarter joined #nim |
| 02:53:41 | * | zachcarter_ joined #nim |
| 02:55:41 | * | suswombat__ joined #nim |
| 02:56:04 | * | zachcarter quit (Ping timeout: 240 seconds) |
| 02:56:04 | * | zachcarter_ is now known as zachcarter |
| 02:58:45 | * | SusWombat_ quit (Ping timeout: 246 seconds) |
| 03:31:39 | * | BitPuffin|osx quit (Ping timeout: 246 seconds) |
| 04:26:02 | * | devted quit (Quit: Sleeping.) |
| 04:33:44 | * | Nobabs27 quit (Quit: Leaving) |
| 04:41:54 | * | devted joined #nim |
| 04:46:07 | * | devted quit (Ping timeout: 240 seconds) |
| 05:08:13 | * | athaudia joined #nim |
| 05:09:37 | * | antranig1 joined #nim |
| 05:11:58 | * | samdm joined #nim |
| 05:12:23 | * | flyx|znc joined #nim |
| 05:13:53 | * | SirCmpwn_ joined #nim |
| 05:14:19 | * | xet7 quit (*.net *.split) |
| 05:14:20 | * | Jesin quit (*.net *.split) |
| 05:14:20 | * | nightmared quit (*.net *.split) |
| 05:14:20 | * | _yeeve quit (*.net *.split) |
| 05:14:21 | * | flyx quit (*.net *.split) |
| 05:14:21 | * | antranigv quit (*.net *.split) |
| 05:14:21 | * | jivank[m] quit (*.net *.split) |
| 05:14:21 | * | MrAxilus[m] quit (*.net *.split) |
| 05:14:21 | * | ehmry[m] quit (*.net *.split) |
| 05:14:22 | * | onionhammer quit (*.net *.split) |
| 05:14:23 | * | athie quit (*.net *.split) |
| 05:14:23 | * | joshbapt1 quit (*.net *.split) |
| 05:14:24 | * | demi- quit (*.net *.split) |
| 05:14:24 | * | SirCmpwn quit (*.net *.split) |
| 05:14:25 | * | tstm quit (*.net *.split) |
| 05:14:25 | * | samdm is now known as demi- |
| 05:14:26 | * | flyx|znc is now known as flyx |
| 05:19:59 | * | tstm joined #nim |
| 05:20:39 | * | _yeeve joined #nim |
| 05:20:53 | * | MrAxilus[m] joined #nim |
| 05:20:57 | * | xet7 joined #nim |
| 05:21:10 | * | joshbapt1 joined #nim |
| 05:21:38 | * | jivank[m] joined #nim |
| 05:21:44 | * | Jesin joined #nim |
| 05:21:46 | * | onionhammer joined #nim |
| 05:21:51 | * | ehmry[m] joined #nim |
| 05:22:44 | * | nightmared joined #nim |
| 05:46:23 | * | yglukhov joined #nim |
| 05:47:43 | * | madgoat joined #nim |
| 05:48:03 | * | madgoat left #nim (#nim) |
| 05:55:49 | * | yglukhov quit (Remote host closed the connection) |
| 06:01:05 | * | libman quit (Quit: Connection closed for inactivity) |
| 06:01:47 | * | Vladar joined #nim |
| 06:03:25 | * | gangstacat quit (Quit: Ĝis!) |
| 06:16:50 | ldlework | I'm sad that variants can't use the same name |
| 06:17:27 | ldlework | it seems like at any point to use the variant fields, you'd have to be already discriminating against the kind, and so the compiler should know that its really kindA_foo vs kindB_foo |
| 06:17:30 | ldlework | or whatever |
| 06:20:45 | ldlework | like it could internally mangle the name maybe |
| 06:22:01 | * | antranig1 is now known as antranigv |
| 06:24:35 | ldlework | Can Concepts constrain on field requirements? |
| 06:30:49 | * | gangstacat joined #nim |
| 06:39:04 | Araq | not sure why it comes up, I think think sum types in any language support ambiguous field names |
| 06:39:14 | Araq | *I don't think |
| 06:39:30 | Araq | ldlework: move the common fiels out of the 'case'? |
| 06:39:30 | * | nsf joined #nim |
| 06:41:50 | * | rokups joined #nim |
| 06:43:41 | * | xet7 quit (Quit: Leaving) |
| 06:47:45 | ldlework | Araq: because other variants don't have those common fields |
| 06:47:52 | ldlework | Araq: I'm also surprised I can't do this, https://gist.github.com/dustinlacewell/596c7add8f6f7ead8d70d31c6bf69c1d |
| 06:48:10 | ldlework | IE, overload a proc based on concept |
| 06:48:19 | ldlework | though I guess it has no way to discriminate which one it should use |
| 06:48:54 | ldlework | it would be cool to call someThing.set(someValue) and have it call the right set() |
| 06:50:26 | ldlework | OK I think I understand |
| 06:53:16 | ldlework | I would need inheritance or whatever to do that kind of thing |
| 06:54:27 | ldlework | Araq: is wanting to overload like that, dumb pretty much? |
| 06:57:33 | Araq | I don't know. |
| 06:58:12 | Araq | ldlework: there is an RFC for exactly this object field feature, so it's definitely come up before |
| 06:58:44 | Araq | but I don't understand why it doesn't come up for all the languages that use | instead of 'of' to write sum types. |
| 07:00:04 | ldlework | Araq: I moved away from the object variants here in my second question |
| 07:00:08 | Araq | for someThing.set(someValue) ... it seems like a cool idea that can be done with a single macro that does type inspection |
| 07:00:43 | Araq | don't overload the macro, make the macro do the type switching based on macros.getType |
| 07:00:58 | Araq | it's a bit cumbersome to write, but also a good exercise ;-) |
| 07:01:38 | ldlework | Araq: is it because there's just no heuristic to use for the compiler? |
| 07:01:55 | ldlework | Like, just theoretically, could it check in the order that the types were defined? |
| 07:02:12 | ldlework | Or even the order in which the overloads were defined |
| 07:02:18 | Araq | well you can also use a generic constraint like RangedValue: range |
| 07:02:20 | ldlework | Something simple and not usecase specific |
| 07:02:32 | Araq | but where is the fun in that? :P |
| 07:02:41 | ldlework | I don't know what you mean |
| 07:03:00 | Araq | proc set[RangedValue: range; V](t: RangedValue, v: V): bool = |
| 07:03:14 | ldlework | what does that do? |
| 07:03:37 | Araq | it says RangedValue needs to a Nim 'range' type |
| 07:03:56 | ldlework | oh is there a built in range? |
| 07:04:41 | ldlework | But this doesn't help if I have type A which only satisfies PortValue and type B which satisfies PortValue and RangedValue |
| 07:04:58 | ldlework | I need to call set() on A but I can't, since I can't redefine set() |
| 07:05:01 | euantor | https://nim-lang.org/docs/system.html#range |
| 07:05:57 | ldlework | Or I can define it for just PortValue, but then I can't implement a version of set() with the min/max logic |
| 07:08:55 | ldlework | Araq: ooo I thought I was gonna get it by using 'or' generic constraint, https://gist.github.com/dustinlacewell/1a175834657dcf8e1d368b6296bb853b |
| 07:09:11 | ldlework | But neither type is now considered to be Value[T] |
| 07:09:31 | ldlework | If I simply comment out the `when` block inside of set() then it works... |
| 07:09:52 | ldlework | wait no it doesn't |
| 07:10:59 | ldlework | bleh |
| 07:12:32 | Araq | very complex code you got there. |
| 07:12:34 | Araq | https://gist.github.com/dustinlacewell/1a175834657dcf8e1d368b6296bb853b |
| 07:12:39 | Araq | look at my reply |
| 07:12:46 | Araq | that's all it takes. |
| 07:15:33 | ldlework | that is mindblowing |
| 07:16:35 | ldlework | jesus that is really expressive lol |
| 07:19:54 | * | yglukhov joined #nim |
| 07:23:44 | ldlework | Araq: it doesn't work though :( |
| 07:24:04 | Araq | why not? |
| 07:25:07 | ldlework | Araq: https://gist.github.com/dustinlacewell/682a6a17d41e393a9dad95997cce185b |
| 07:25:58 | ldlework | The error happens on : https://gist.github.com/dustinlacewell/682a6a17d41e393a9dad95997cce185b |
| 07:26:00 | ldlework | oops |
| 07:26:05 | ldlework | if v < t.min: return false |
| 07:26:25 | ldlework | Which should never be run, because BoolValue wouldn't compiles(t.min) |
| 07:26:34 | ldlework | bug? |
| 07:27:26 | * | xet7 joined #nim |
| 07:28:11 | Araq | x.min does compile for 'bool' ;-) |
| 07:29:19 | Araq | proc min*[T](x: varargs[T]): T = |
| 07:29:20 | Araq | ## The minimum value of `x`. ``T`` needs to have a ``<`` operator. |
| 07:29:41 | Araq | and for some reason bool has a '<', false < true and all that |
| 07:30:04 | Araq | but it's stupid, system.min and system.max should take openArrays |
| 07:38:09 | ldlework | Araq: so what's my solution? |
| 07:38:45 | Araq | wait until my fix was merged into devel or use crappier field names like minValue, maxValue |
| 07:39:20 | ldlework | oh its because UCS? |
| 07:39:26 | ldlework | oh haha, jeeze |
| 07:40:39 | ldlework | Araq: I'll add an additional when t.value is Comparable |
| 07:40:55 | Araq | bool is Comparable. |
| 07:41:13 | ldlework | this made it compile though.. |
| 07:41:46 | ldlework | Comparable = concept x, y |
| 07:41:48 | Araq | ok, I might be wrong |
| 07:41:49 | ldlework | x < y is bool |
| 07:41:51 | ldlework | x > y is bool |
| 07:41:53 | ldlework | I wrote that |
| 07:42:10 | Araq | you shouldn't write 'x > y' btw |
| 07:42:32 | Araq | there is always a '>' :-) |
| 07:42:50 | Araq | template `>`(a, b): untyped = b < a ;-) |
| 07:43:07 | ldlework | lol why does it make it work then |
| 07:43:17 | ldlework | shouldn't it have no effect and find the same code path and blow up in the same way? |
| 07:47:47 | ldlework | Araq: I would seriously wonder what other languages are capable of expressing this set() implementation as short and expressively as nim: https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133#file-concepts-nim-L21 |
| 07:50:14 | Araq | D-lang can do it too, its generics are very much the same and they have 'compiles' builtin via a strange name that I forgot |
| 07:51:21 | ldlework | Oh I just made it nicer: https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133#file-concepts-nim-L18 |
| 07:51:38 | ldlework | don't even need compiles() now! |
| 07:51:40 | ldlework | wow! |
| 07:51:49 | ldlework | I'm sorely impressed right now. |
| 07:51:54 | ldlework | or Comparable |
| 07:53:38 | flyx | wouldn't you need to use v.value instead of v for the comparisons? |
| 07:54:35 | flyx | I mean, v is a RangedValue, which is a Value, which has a field .value |
| 07:54:39 | Araq | ldlework: my solution works when you only have a max or only have a min too :P |
| 07:55:01 | ldlework | flyx: v is not a RangedValue |
| 07:55:11 | flyx | `when v is RangedValue` |
| 07:55:17 | ldlework | oh crap |
| 07:55:20 | ldlework | I meant T |
| 07:55:31 | ldlework | dang now it doesn't work |
| 07:55:33 | ldlework | lmao |
| 07:55:37 | ldlework | Araq: :( |
| 07:56:11 | Araq | I told you what to do. name it maxValue and minValue and live with my solution for now |
| 07:56:13 | ldlework | correct version, that doesen't work https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133 |
| 07:56:21 | ldlework | oh right |
| 07:56:24 | Araq | sorry, this is too distracting, I need to work. |
| 07:56:26 | Araq | bye |
| 07:58:01 | * | nightmared quit (Ping timeout: 260 seconds) |
| 07:58:17 | ldlework | flyx: why do neither of the echo's output now? https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133 |
| 07:59:10 | ldlework | I changed it to `t is RangedValue` |
| 07:59:16 | flyx | ldlework: I think because you need to say `when b is Value` instead of `when BoolValue is Value` |
| 07:59:48 | ldlework | nah that doesn't do anything |
| 08:00:02 | ldlework | its like the Value concept no longer applies to either type now |
| 08:00:25 | ldlework | If I comment out the `when t is RangedValue` block, it works again |
| 08:00:32 | flyx | the let assignments seem wrong. you declare b as BoolValue but then assign new(BoolValue) to it |
| 08:01:32 | flyx | unless new() actually returns a BoolValue because that is a `ref object` (which I would find surprising) |
| 08:01:53 | ldlework | I see |
| 08:02:06 | ldlework | but you can delete those lines |
| 08:02:19 | ldlework | they are not relevant to the last when clauses |
| 08:03:09 | ldlework | maybe its because... |
| 08:03:16 | ldlework | set() is part of the concept |
| 08:03:31 | ldlework | and so, types defined so far, can't be part of the concept because set hasn't finished being defined? |
| 08:03:34 | ldlework | or something? |
| 08:03:39 | flyx | well you won't need v.value in the comparisons now, seeing that you supply v.value to v in the Value concept |
| 08:04:11 | ldlework | oh yeah |
| 08:04:14 | ldlework | another bug |
| 08:04:19 | ldlework | I really messed up t vs v |
| 08:04:35 | flyx | I would also supply the generic parameters to the concepts |
| 08:04:40 | flyx | `when t is RangedValue[V]` |
| 08:05:25 | flyx | that also improves readability. right now, I have to think about what kind of types are used on every line |
| 08:05:45 | ldlework | flyx: ok current implementation, https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133 |
| 08:05:49 | ldlework | neither echo's emit |
| 08:06:17 | flyx | in RangedValue[T], say `v is Value[T]` |
| 08:06:37 | flyx | but that wouldn't bother the whens |
| 08:07:29 | ldlework | flyx: by upgrading T to Value it works |
| 08:07:29 | flyx | and yes, the error could well be that you have kind of a circular dependency |
| 08:07:31 | ldlework | for some reason |
| 08:08:08 | ldlework | working version, https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133 |
| 08:08:18 | flyx | you are aware that set is a builtin type and can lead to further complications? |
| 08:08:58 | ldlework | huh |
| 08:09:00 | ldlework | lol |
| 08:10:12 | flyx | this code looks strange, you are using `Value` as a new type identifier in the generic proc, even though its also a generic |
| 08:10:23 | flyx | try simply `proc[V](self: Value, v: V): bool` |
| 08:11:04 | ldlework | Oh I didn't realize you could use concepts without going through the generic discriminators |
| 08:11:06 | ldlework | nice |
| 08:11:15 | flyx | that's kind of the point ;) |
| 08:11:39 | ldlework | flyx: nah that doesn't work actually |
| 08:11:43 | flyx | better yet, `proc[V](self: Value[V], v: V): bool` |
| 08:11:50 | ldlework | I'll try that though |
| 08:12:00 | ldlework | nope |
| 08:12:11 | ldlework | Need Value in the discriminator list |
| 08:12:20 | ldlework | probably because it generates different implementations |
| 08:12:24 | flyx | well I think the problem is the circular dependency |
| 08:12:26 | ldlework | based on the self type |
| 08:12:32 | ldlework | what about what I just said? |
| 08:12:53 | flyx | no. concepts are *designed* as implicit generics |
| 08:12:56 | flyx | in general, this works |
| 08:12:59 | ldlework | if it just worked on [float] vs [FloatType, float] then you'd only get one implementation for each type thaht used float internally |
| 08:13:01 | ldlework | hmm |
| 08:13:16 | ldlework | Is it really a circular dependency |
| 08:13:24 | ldlework | more like a race condition right? |
| 08:13:32 | ldlework | or order of compilation order |
| 08:13:37 | ldlework | I wonder if I can define set ahead of time |
| 08:13:48 | flyx | doesn't work with generics afaik |
| 08:14:10 | ldlework | yeah that didn't work |
| 08:14:57 | flyx | let's be a compiler and try to check `BoolValue is Value` |
| 08:15:15 | flyx | compiler sees „well, it would need to have a set() operation, let's try if it has one“ |
| 08:15:36 | flyx | it checks the available procs and sees „ah, there is one, let's see if parameter types match“ |
| 08:15:50 | flyx | then it sees „oh, first parameter needs to be a Value, let's check if it is one“ |
| 08:15:58 | ldlework | flyx: I think what happens, is by including Value in the discriminator, it probably defers the generation of the `set` implementations. |
| 08:16:25 | ldlework | By the time it does them, Value has been fully defined (because set has too, just not generated) |
| 08:16:28 | ldlework | or something |
| 08:16:35 | flyx | no, implementations are only generated once the proc is actually called |
| 08:16:54 | ldlework | well the proc is never called in my examples |
| 08:17:08 | ldlework | we're testing for whether types are a concept |
| 08:17:13 | flyx | yeah, the compiler just checks if it would be able to instantiate it |
| 08:17:14 | * | Andris_zbx joined #nim |
| 08:17:25 | flyx | why not remove the set() restriction from the concept |
| 08:17:50 | flyx | if your proc is `proc set[V](self: Value[V], v: V): bool`, it is guaranteed to be defined for every Value |
| 08:18:35 | ldlework | Because I will take Value in other places |
| 08:18:42 | ldlework | and then call .set on them |
| 08:18:53 | ldlework | Oh I see what you're saying |
| 08:19:06 | flyx | if I remove the set() restriction, it works |
| 08:19:15 | ldlework | flyx: this worked |
| 08:19:18 | ldlework | yep |
| 08:19:19 | ldlework | good job |
| 08:19:30 | flyx | now try with actual values to be sure it still works |
| 08:19:33 | ldlework | flyx: it would be interesting to know why adding Value to the discrimantor works |
| 08:19:44 | ldlework | or what the compiler does differently in that case |
| 08:20:26 | flyx | because then, Value is just a new name, and it hides the type descriptor Value defined above |
| 08:20:36 | flyx | or that's what I assume anyway |
| 08:22:48 | ldlework | flyx: thanks for your guidance |
| 08:22:59 | flyx | no problem |
| 08:25:02 | * | Arrrr joined #nim |
| 08:26:00 | flyx | out of curiosity, I tried: https://gist.github.com/flyx/ef2564bf4dbb1b8cc343daa91118c94f |
| 08:26:11 | flyx | it doesn't work, complains about missing `value=` |
| 08:27:20 | ldlework | Yeah you need all the fields |
| 08:27:38 | ldlework | I've since removed default, btw |
| 08:27:47 | ldlework | my current, https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133 |
| 08:30:07 | flyx | interesting. yours seems to work because you removed the generic params from the concepts |
| 08:30:10 | flyx | strang |
| 08:30:11 | flyx | ve |
| 08:30:37 | ldlework | flyx: Nim's generics are powerful but totally mysterious. |
| 08:30:49 | flyx | indeed |
| 08:30:56 | ldlework | Compare to say C#'s generics which can't quite do as much as Nim, but they are very easy to understand. |
| 08:31:05 | ldlework | Concepts are so amazing though. |
| 08:40:08 | * | couven92 joined #nim |
| 08:47:25 | ldlework | flyx: :( https://gist.github.com/dustinlacewell/d89d210778c449aff6496a7d6ad5d645 |
| 08:48:04 | ldlework | oh |
| 08:48:23 | ldlework | typo |
| 08:48:26 | ldlework | s/i/is |
| 08:48:30 | ldlework | no error, strange |
| 08:50:21 | ldlework | flyx: check this out, https://gist.github.com/dustinlacewell/d89d210778c449aff6496a7d6ad5d645 |
| 08:50:29 | ldlework | it doesn't generate any of the correct implementations |
| 08:50:31 | ldlework | only basic ones |
| 08:52:03 | ldlework | flyx: probably because of what you said |
| 08:52:28 | ldlework | well we removed the requirement on set, so the recusion is gone |
| 08:52:33 | ldlework | so actually, no I don't know why this doesn't work |
| 08:57:02 | flyx | ldlework: this works: https://gist.github.com/flyx/2339540977a80a530ca716f615d230f8 |
| 08:57:24 | flyx | I removed `v is Value[T]` from MinValue and MaxValue and renamed min and max as Araq suggested |
| 08:58:45 | * | Pisuke quit (Read error: Connection reset by peer) |
| 08:59:25 | ldlework | flyx: check this out, https://gist.github.com/dustinlacewell/d89d210778c449aff6496a7d6ad5d645 |
| 08:59:28 | ldlework | it works |
| 08:59:30 | ldlework | lol |
| 08:59:40 | ldlework | (as in, it generates the right implementations) |
| 08:59:52 | * | Pisuke joined #nim |
| 09:00:37 | flyx | interesting |
| 09:00:54 | ldlework | a super-concept |
| 09:00:56 | ldlework | lmao |
| 09:01:18 | flyx | I feel like getting this to work is like walking on a reverse minefield |
| 09:01:31 | flyx | it blows up on every step unless you hit the exact right spots |
| 09:01:55 | FromGitter | <andreaferretti> just use `Value[T] = RangedValue[T] or MinValue[T] or MaxValue[T] or BasicValue[T]` |
| 09:02:08 | FromGitter | <andreaferretti> no need for concepts here |
| 09:02:19 | * | zachcarter_ joined #nim |
| 09:02:21 | ldlework | flyx: haha, Nim in a nutshell right there |
| 09:02:37 | ldlework | andrea nice |
| 09:02:58 | * | zachcarter quit (Ping timeout: 240 seconds) |
| 09:02:58 | * | zachcarter_ is now known as zachcarter |
| 09:03:03 | ldlework | that doesn't actually work |
| 09:03:14 | ldlework | good idea though |
| 09:04:59 | * | yglukhov quit (Remote host closed the connection) |
| 09:07:53 | FromGitter | <nimit95> Hi |
| 09:10:08 | cheatfate | hi nimit95 |
| 09:10:21 | * | yglukhov joined #nim |
| 09:10:37 | ldlework | flyx: I wonder why removing the dependency on Value in your version makes it work |
| 09:10:38 | ldlework | wtf |
| 09:11:17 | FromGitter | <nimit95> I am new here and would like to contribute |
| 09:11:18 | ldlework | flyx: wtf, if you add the depenency back, but without the [T] it works! |
| 09:11:21 | ldlework | in your version |
| 09:11:24 | ldlework | lol |
| 09:11:39 | * | SirCmpwn_ is now known as SirCmpwn |
| 09:12:48 | cheatfate | nimit95, you are welcome |
| 09:12:57 | Arrrr | Then you might want to read this section https://github.com/nim-lang/Nim/#contributing |
| 09:14:26 | flyx | ldlework: https://cdn.meme.am/instances/500x/76432699/ancient-aliens-why-does-it-work-without-the-t-aliens.jpg |
| 09:15:08 | ldlework | lol |
| 09:15:13 | * | yglukhov quit (Remote host closed the connection) |
| 09:15:18 | ldlework | flyx: do you think I should put it to the forums? |
| 09:15:26 | ldlework | worth knowing? |
| 09:15:28 | flyx | probably would be a good thing |
| 09:15:46 | flyx | all suggestions I made wer just guessing |
| 09:16:04 | * | yglukhov joined #nim |
| 09:16:09 | flyx | an explanation would be really good to be able to *know* how to write this code correctly |
| 09:16:18 | ldlework | you get me |
| 09:16:22 | FromGitter | <nimit95> I am in my pre final year, computer science engineering |
| 09:16:30 | * | yglukhov quit (Remote host closed the connection) |
| 09:16:35 | FromGitter | <nimit95> And I know c and c++ |
| 09:16:48 | FromGitter | <nimit95> how and where can i contribute? |
| 09:19:33 | ldlework | nimit95 did you see Arrrr's suggestion? |
| 09:20:57 | * | yglukhov joined #nim |
| 09:21:36 | * | yglukhov quit (Remote host closed the connection) |
| 09:22:35 | FromGitter | <nimit95> oops sorry missed it, would definitely read it now |
| 09:24:37 | * | yglukhov joined #nim |
| 09:35:32 | Araq | ldlework there is {.explain.} for this purpose |
| 09:35:43 | * | Sentreen joined #nim |
| 09:36:02 | * | ldlework blinks |
| 09:40:08 | Arrrr | Why isn't explain the default? |
| 09:43:08 | ldlework | Arrrr, where is it documented? |
| 09:44:06 | subsetpark | I've never heard of {.explain.} - what's it for? |
| 09:44:49 | ldlework | Dunno, its not listed on the documentation index |
| 09:51:09 | Araq | yeah sure, whenever I compile something, I want detailed compiler explanations of why it actually compiled |
| 09:51:14 | Araq | makes sense. |
| 09:51:19 | Araq | let's make it the default. |
| 09:52:05 | Araq | well concepts are bleeding edge, .explain is not yet in the generated docs |
| 09:52:15 | Araq | which refer to the latest official release. |
| 09:59:38 | ldlework | Araq: haha |
| 10:02:05 | * | couven92 quit (Quit: Client disconnecting) |
| 10:06:35 | ldlework | When using NimScript tasks, and using setCommand("c"), how do you set the file to compile? |
| 10:07:21 | * | couven92 joined #nim |
| 10:08:48 | ldlework | :3 |
| 10:14:41 | Araq | setCommand("c", "myfile.nim") ? not sure, never use it |
| 10:17:18 | * | yglukhov quit (Remote host closed the connection) |
| 10:18:16 | * | yglukhov joined #nim |
| 10:20:47 | * | wan joined #nim |
| 10:22:50 | ldlework | It seems I can't turn off hints with nimscript |
| 10:22:59 | ldlework | Araq: what do you use for building, etc? |
| 10:23:01 | ldlework | bash? |
| 10:23:19 | Araq | I use nimscript. |
| 10:23:40 | Araq | but I don't use setCommand it's confusing me :-) |
| 10:23:45 | ldlework | Ah |
| 10:24:04 | ldlework | Araq: should put("hints", "off") cause there to be no hints? |
| 10:24:06 | ldlework | lol |
| 10:24:21 | Araq | --hints: off |
| 10:25:12 | ldlework | oh Ididn't know you could do that |
| 10:26:17 | ldlework | How come --out: bin/synth doesn't work? |
| 10:26:25 | ldlework | ???(???, 0) Error: invalid command line option: '--var' |
| 10:27:17 | ldlework | I have to do |
| 10:27:24 | ldlework | task build, "build the example": |
| 10:27:26 | ldlework | --hints: off |
| 10:27:28 | ldlework | put("out", "bin/synth") |
| 10:27:30 | ldlework | setCommand("c", "synth.nim") |
| 10:27:43 | Araq | put? is that a thing? |
| 10:27:58 | ldlework | https://nim-lang.org/0.11.3/nimscript.html#put,string,string |
| 10:28:23 | Araq | isn't that switch("out", "bin/synth") |
| 10:28:45 | Araq | yeah, use 'switch' for that |
| 10:29:28 | ldlework | huh |
| 10:29:38 | ldlework | why can't I do the -- thing? |
| 10:29:57 | Araq | https://nim-lang.org/0.16.0/nimscript.html#put,string,string is more recent than 0.11.3 btw |
| 10:30:12 | Araq | oh you can do the -- thing but you don't understand it |
| 10:30:47 | ldlework | lol clearly |
| 10:31:35 | ldlework | -- out "bin/synth" ???(???, 0) Error: invalid command line option: '--var "bin/synth"' |
| 10:32:23 | ldlework | is it because out is a keyword? |
| 10:32:34 | * | shashlick quit (Ping timeout: 240 seconds) |
| 10:35:59 | * | shashlick joined #nim |
| 10:37:31 | Arrrr | Maybe you forgot to add ':' ? |
| 10:38:37 | ldlework | -- out: "bin/synth" |
| 10:38:46 | ldlework | ???(???, 0) Error: invalid command line option: '--var' |
| 10:38:54 | ldlework | think its bugged |
| 10:39:03 | ldlework | also in nimscript, when I turn off hints |
| 10:39:12 | ldlework | it shows me |
| 10:39:15 | ldlework | Hint: used config file '/home/dlacewell/src/nim/Nim/config/nim.cfg' [Conf] |
| 10:39:17 | ldlework | anyway |
| 10:39:23 | ldlework | aaaaaand its 3:30 AM |
| 10:39:47 | ldlework | bash will work for now |
| 10:40:15 | Arrrr | I think you cannot turn conf hints off because they are displayed before processing the config files |
| 10:40:23 | Araq | switch("out", "bin/synth") |
| 10:40:33 | ldlework | when you provide it as a commandline flag it turns off all hints |
| 10:40:38 | Araq | I dunno why my help is consistently ignored |
| 10:40:49 | ldlework | Araq: yes that works, but why doesn't the -- syntax work for it |
| 10:41:07 | ldlework | Its not like I didn't hear you and I even mentioned that I was using that version, because the -- doesn't work |
| 10:41:09 | * | yglukhov quit (Ping timeout: 264 seconds) |
| 10:41:14 | ldlework | you said I can use -- I just don't understand it |
| 10:41:20 | ldlework | so |
| 10:41:49 | Arrrr | I think you can use -- for standalone values in nimscript because it parses it like any nim file |
| 10:41:50 | ldlework | Can one use -- with out, or do you have to use switch() |
| 10:42:12 | ldlework | Arrrr: but it works for `-- hints: off` |
| 10:42:27 | Arrrr | Hmm, in that case ... |
| 10:42:42 | Araq | sorry about that, -- only works for some cases :-) |
| 10:42:52 | ldlework | Ah which ones? |
| 10:42:59 | Araq | if you want to know why, here is what it does: |
| 10:43:20 | Araq | template `--`(x, y: untyped) = switch(astToStr x, astToStr y) |
| 10:43:34 | Araq | see? it turns it into a string literal. |
| 10:44:00 | Araq | what does it do with string literals? it turns them to string literals, in other words wrapped in "" and \ escaped |
| 10:44:17 | Araq | which is wrong :-) |
| 10:45:26 | Araq | I may deprecate this `--` template again, seems more confusing than useful |
| 10:45:43 | Arrrr | I didn't know that syntax was valid https://glot.io/snippets/eomf0jls18 |
| 10:46:42 | Araq | surely you did. |
| 10:46:53 | Araq | withFile f: body |
| 10:47:08 | Arrrr | mind = blown |
| 10:47:47 | * | yglukhov joined #nim |
| 10:48:48 | ldlework | Araq: OK but why doesn't it work for out? |
| 10:49:12 | Araq | it's not the 'out' |
| 10:49:22 | Araq | it's the fact that you pass a string literal to 'out' |
| 10:49:50 | Araq | and stupid -- quotes this string literal again to make it a string literal |
| 10:49:57 | ldlework | -- out: bin/synth |
| 10:50:04 | ldlework | ???(???, 0) Error: invalid command line option: '--var' |
| 10:50:10 | * | PMunch joined #nim |
| 10:50:21 | ldlework | What explains this? |
| 10:50:54 | Arrrr | Yep, out -> var https://glot.io/snippets/eomf5tzr3m |
| 10:51:16 | ldlework | lol wtf |
| 10:51:32 | Arrrr | And glot io is running 1.14 i believe |
| 10:51:45 | Arrrr | *0.14 |
| 10:52:34 | * | byte512 quit (Ping timeout: 240 seconds) |
| 10:52:51 | ldlework | OK so avoid the template |
| 10:53:05 | ldlework | Last annoying thing is the fact that the Conf hint is displayed |
| 10:53:14 | ldlework | But I'm guessing there's just no way around that |
| 10:53:39 | * | Tiberium joined #nim |
| 10:54:39 | Araq | 'out' is a Nim keyword and mapped to 'var' |
| 10:55:09 | * | byte512 joined #nim |
| 10:57:31 | ldlework | #!/usr/bin/env sh |
| 10:57:33 | ldlework | nim --hints:off $@ |
| 10:57:35 | ldlework | hehe |
| 11:03:09 | Arrrr | Does --o:foo/bar work? |
| 11:08:21 | Arrrr | The cheap hack is to check when astToStr(key) == "var" |
| 11:08:25 | ldlework | Arrrr: no it doesn't |
| 11:08:55 | ldlework | New question, in nim script how do you call one task from another? |
| 11:09:29 | Araq | tasks are mapped to procs |
| 11:09:32 | Araq | task foo |
| 11:09:39 | Araq | becomes proc taskfoo |
| 11:09:48 | Araq | so call it as taskfoo() |
| 11:10:12 | Arrrr | https://github.com/nim-lang/Nim/blob/master/lib/system/nimscript.nim#L286 |
| 11:11:00 | Araq | oh I misremembered, to it's fooTask() |
| 11:14:54 | ldlework | Hmm how do I hide output like this: CC: dadren_synth |
| 11:17:36 | ldlework | verbosity |
| 11:17:48 | Araq | --verbosity:0 |
| 11:18:46 | ldlework | Nice my build scripts are pretty nice now |
| 11:19:01 | ldlework | Araq: Arrrr flyx thanks, goodnight |
| 11:19:44 | Arrrr | --hints[exec]:off ? |
| 11:40:04 | Tiberium | can I use staticRead in a macro to import a module? |
| 11:44:38 | flyx | Tiberium: parseStmt(staticRead("myFile.nim")) should work |
| 11:44:57 | Tiberium | flyx, oh nice, and can I access proc which is defined in this file? |
| 11:45:02 | flyx | however, you didn't import it then, you parsed its code |
| 11:45:25 | flyx | you can also generate an import statement within the macro |
| 11:45:54 | flyx | what you need to do depends on what you actually want to do |
| 11:46:18 | flyx | if you want to use the code in the module within the macro, you could just use a normal import statement without staticRead |
| 11:46:50 | Tiberium | flyx, I want to "import" all files from directory, and generate case statement to match strings and call appropriate module (via modulename.call proc) |
| 11:48:22 | flyx | do you search for those strings inside the code of the modules? |
| 11:48:28 | Tiberium | flyx, ideally I want to |
| 11:48:54 | Tiberium | maybe I can both staticRead a module and import it later |
| 11:48:59 | flyx | then I would suggest to use staticRead to read them and do the searching. but afterwards, just generate a normal import statement |
| 11:49:04 | Araq | Tiberium: what do you really want to achieve? |
| 11:49:04 | Tiberium | ok, thanks! |
| 11:49:22 | Araq | seems like a huge hack |
| 11:49:37 | Tiberium | Araq, make writing plugins a little bit easier (I have a big case statement in my app which calls plugins based on command match) |
| 11:50:24 | Tiberium | it looks like this (sorry for russian): https://gist.github.com/TiberiumN/03b2d88b7038ae04b11d4276d13affe6 |
| 11:50:37 | Tiberium | runCatch is an asyncCheck wrapper |
| 11:51:59 | flyx | Tiberium: this looks like you rather want to write a macro which provides a syntax `command "привет": # implementation` |
| 11:52:36 | flyx | this syntax would generate the proc to call and also add "привет" to a hashtable linked to the implementation |
| 11:52:55 | flyx | then later, you just get the proc ref from the hashtable |
| 11:53:02 | Tiberium | ah, so I just need to have global hashtable in main module? |
| 11:53:03 | flyx | and call runCatch() on it |
| 11:53:18 | Tiberium | I thought it would be impossible to append to variable in main module from other modules |
| 11:54:11 | flyx | you would rather have a command.nim file where the macro and the global hashtable are defined |
| 11:54:47 | flyx | you can even make the hashtable a compile-time variable and generate the case statement from it with another macro in the main module |
| 11:55:21 | Tiberium | flyx, Araq, thanks for answers! will try to do it :) |
| 11:56:01 | flyx | btw, this has nothing to do with plugins. plugins are things that can be loaded at runtime. you are adding stuff at compile time |
| 11:58:44 | Tiberium | btw, if syntax like import plugins/[a, b, c, d] is possible, why import ../[types, vkapi, utils, command] is not? |
| 12:00:07 | flyx | Tiberium: have you tried it with " quotes |
| 12:01:17 | Tiberium | flyx, no, what it would look like? |
| 12:06:13 | Araq | import ".." / [types, vkapi, utils, command] |
| 12:07:49 | Tiberium | it says "base.nim(2, 13) Error: cannot open '".."/types'" but there's types.nim in parent folder |
| 12:08:19 | Araq | that's a bug :-) |
| 12:09:00 | Araq | import `..` / [types, vkapi, utils, command] # just guessing |
| 12:10:21 | * | bjz joined #nim |
| 12:10:28 | * | smt quit (Ping timeout: 240 seconds) |
| 12:11:20 | * | smt joined #nim |
| 12:12:49 | * | Vladar quit (Quit: Leaving) |
| 12:19:59 | * | BitPuffin|osx joined #nim |
| 12:22:14 | wan | I understand that the js output of nim doesn't generate source maps, is that correct? Would it be difficult for someone relatively not familiar with the codebase to add it in? |
| 12:23:39 | * | arnetheduck joined #nim |
| 12:24:00 | * | Tiberium quit (Remote host closed the connection) |
| 12:24:14 | * | Tiberium joined #nim |
| 12:31:35 | PMunch | wan, what would those source maps map to? |
| 12:32:12 | * | fastrom1 joined #nim |
| 12:32:12 | Tiberium | ehm, is it a bug if compilation fails on C compilation step? |
| 12:32:39 | PMunch | Depends a bit Tiberium |
| 12:33:02 | PMunch | Since you can do unsafe casts and stuff it is possible that you've messed up |
| 12:33:08 | Tiberium | ah, nvm |
| 12:33:18 | PMunch | wan, I see now that it can map to other languages. Interesting |
| 12:33:21 | Tiberium | I was adding values to table at compile time without "static" block |
| 12:33:30 | wan | js source maps are a must for languages that compile to js. When error occurs, instead of showing you compiled js, it shows you the original source |
| 12:33:30 | Tiberium | so I added static block and it works now |
| 12:34:15 | * | erwana[m] joined #nim |
| 12:34:58 | * | fastrom quit (Ping timeout: 240 seconds) |
| 12:36:39 | Tiberium | btw, will compile-tim variable - defined as "var" transformed to const after compilation? |
| 12:37:17 | PMunch | Don't think so |
| 12:37:28 | flyx | Tiberium: consts are propagated during compilation. they are nothing after compilation |
| 12:38:00 | flyx | same for compile time vars |
| 12:38:02 | Tiberium | flyx, ah, I mean I will populate my table by about 20-40 values at compile-time, will it be fine for performance? |
| 12:38:37 | flyx | if you do not assign the table to any runtime var, it will have no impact on runtime performance |
| 12:38:58 | Tiberium | ok, nice |
| 12:41:01 | * | zachcarter quit (Quit: zachcarter) |
| 12:43:48 | * | AndroUser joined #nim |
| 12:45:37 | Araq | wan: nim gives you a custom stack trace instead |
| 12:45:47 | Araq | not ideal, but it predates source maps, so there. :P |
| 12:45:49 | * | AndroUser quit (Client Quit) |
| 12:47:31 | * | AndroUser joined #nim |
| 12:48:44 | * | AndroUser quit (Read error: Connection reset by peer) |
| 13:00:41 | Tiberium | wait, how is a "func" is reserved keyword? |
| 13:01:41 | bbl__ | Tiberium: hopefully someday a prettier syntax for {.noSideEffect.} with proc |
| 13:02:10 | Tiberium | bbl__, can we also hope for async proc prettier syntax for {.async.} with proc? |
| 13:02:30 | PMunch | Why hasn't that been added yet by the way? The func this has been mentioned for ages :P |
| 13:04:15 | flyx | dom96: I am still getting mails from [email protected]. „Undelivered Mail Returned to Sender“ |
| 13:04:56 | flyx | dom96: this seems to occur for each post I write on the forum |
| 13:05:13 | def- | oh yeah, i got the same mail a few times |
| 13:09:22 | wan | Araq: I don't see any nim stacktrace, that's the thing. Nothing in the js console points to the last line in the nim code here for example https://gist.github.com/idlewan/98ad973e7eadce4a85e457b89003e229 |
| 13:10:30 | wan | (should be bounds error or something, the array is empty) |
| 13:11:11 | wan | So I wouldn't mind having some stacktrace that would help, but I can't find it |
| 13:11:33 | wan | and the question remains: is it not too difficult to hack it in? |
| 13:12:45 | wan | I've started looking into using native JS strings as cstrings AND nim strings, seems weird not to use them and have to convert between them when JS strings should do |
| 13:13:21 | wan | Would that be a welcome change, or would there be problems with having cstrings == strings for js output ? |
| 13:13:36 | Araq | well it would break nim's stdlib |
| 13:14:02 | Araq | and I just use cstring everywhere in my code that compiles to JS |
| 13:14:08 | * | bjz_ joined #nim |
| 13:14:21 | wan | js has .length though, most of the stdlib relies on having \0 at the end always ? |
| 13:14:27 | Araq | I was thinking about {.cstringlits: on.} |
| 13:14:34 | Araq | to improve the situation. |
| 13:14:54 | Araq | not only \0, but a string is a bunch of bytes |
| 13:15:08 | * | bjz quit (Ping timeout: 260 seconds) |
| 13:15:24 | Araq | and s[i] should give the i-th byte, not some strange barbaric utf-16 "character" |
| 13:17:59 | Araq | not sure what happens with the stack traces, I have this snippet https://gist.github.com/Araq/123b11204bfe98469fdbd0d78eca7592 |
| 13:19:33 | wan | it doesn't point to the line in the nim code that errors though, right ? |
| 13:20:57 | wan | I wonder how much effort it would be to generate source maps in the official format https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/preview |
| 13:23:04 | Araq | the last time I thought about it, it was a huge amount of work |
| 13:25:08 | wan | damn |
| 13:27:37 | Araq | edit lib/system/jssys.nim |
| 13:27:43 | Araq | proc unhandledException |
| 13:27:56 | Araq | it turns the Nim exception including the stacktrace into a JS exception |
| 13:28:25 | Araq | and to answer your question, it does point to the line in the Nim code, if it works at all. :-) |
| 13:28:52 | Araq | so .. with my snippet it should work |
| 13:29:04 | wan | ah, I'll test with your snippet |
| 13:29:10 | * | zachcarter joined #nim |
| 13:29:22 | wan | maybe it should be compiled in by default if it makes errors bearable |
| 13:29:46 | Araq | definitely, yglukhov messed this up a bit |
| 13:30:00 | Araq | it was fine initially. |
| 13:30:16 | yglukhov | oO |
| 13:31:03 | Tiberium | dom96, can I somehow wait for all async functions to die and then exit the app? (If user pressed ctrl+c) |
| 13:31:14 | Tiberium | I mean all async procs to end :) |
| 13:31:32 | Tiberium | ah I see |
| 13:31:35 | Tiberium | probably hasPendingOperations |
| 13:33:44 | Araq | yglukhov: maybe it wasn't you |
| 13:36:40 | yglukhov | Araq: this case in the gist does not raise nim exception (in which case unhandledException) would be triggered. |
| 13:37:33 | Araq | yglukhov: can't we console.log the Nim stack trace as default? |
| 13:39:02 | yglukhov | Araq: not in the general case. but for HTML it might be possible by setting window.onerror callback. |
| 13:40:16 | yglukhov | for nodejs it is process.on('uncaughtException', myHandler) |
| 13:40:31 | Araq | well nodejs requires a -d:nodejs switch |
| 13:40:41 | Araq | the default is "runs in a browser" |
| 13:41:06 | yglukhov | Araq: "runs in a browser"? since when? :) |
| 13:41:13 | wan | console.error seems more appropriate than console.log, but yes, a default nim printout would be good |
| 13:41:43 | Araq | yglukhov: well I wrote the js code generator with that in mind. |
| 13:41:53 | Araq | so... since forever. |
| 13:41:56 | yglukhov | Araq: what about any generic JS VM |
| 13:42:51 | Araq | there is no such thing. you compile to JS to make HTML dynamic. nodejs was only added for our tester |
| 13:42:55 | yglukhov | i have an Adobe AfterEffects extension which is neither HTML nor nodejs |
| 13:43:07 | * | Sentreen quit (Quit: WeeChat 1.4) |
| 13:43:09 | Araq | :D |
| 13:43:31 | FromGitter | <andreaferretti> also gnome shell extensions :-P |
| 13:43:35 | Araq | well, so create a -d:adobe switch for it |
| 13:43:51 | Araq | argh ... stupid popular JS target |
| 13:44:01 | FromGitter | <andreaferretti> nashorn |
| 13:44:08 | FromGitter | <andreaferretti> IoT devices |
| 13:44:21 | cheatfate | yglukhov, i dont think its generic JS VM, because generic JS VM comes without any objects... |
| 13:44:33 | yglukhov | Araq: i don't think nim should make HTML assumption by default. |
| 13:44:56 | FromGitter | <andreaferretti> in any case, yes, I agree that browsers and node are the most important targets right now |
| 13:45:04 | FromGitter | <andreaferretti> let's make at least those two work |
| 13:45:12 | yglukhov | they work already. |
| 13:45:25 | Araq | HTML doesn't, it doesn't show stack traces |
| 13:45:28 | FromGitter | <andreaferretti> well, I meant, in the sense of diplaying nice exceptiosn |
| 13:45:35 | * | Sentreen joined #nim |
| 13:46:08 | Araq | do you really write gnome shell extensions in Nim? |
| 13:46:17 | FromGitter | <andreaferretti> no, just kdding |
| 13:46:23 | Araq | awww |
| 13:46:31 | FromGitter | <andreaferretti> but still, the fact is that js is everywhere |
| 13:47:20 | yglukhov | well this handler could be set up in runtime. if (typeof window !== 'undefined') setupNimUncaughtExceptionHandler(); |
| 13:47:46 | yglukhov | so that it still falls back to nothing for Adobe JS and Gnome JS |
| 13:47:54 | Araq | meh, runtime checks for what should be different compiler targets |
| 13:48:00 | Araq | but ok. |
| 13:48:02 | * | couven92 quit (Quit: Disconnecting) |
| 13:48:21 | FromGitter | <andreaferretti> also, let us not forget http://iotjs.net/ :-P |
| 13:48:39 | FromGitter | <andreaferretti> I think that given the number of different runtimes |
| 13:48:44 | FromGitter | <andreaferretti> runtime checks make more sense |
| 13:49:09 | Tiberium | Can I convert iterator to sequence of iterator values in one line? |
| 13:49:39 | arnetheduck | Araq, hello, how are things? ;) |
| 13:50:43 | yglukhov | well in any case this exception handler is a feature request, not a bug. so... if anyone does consider it critical, there's github for that ;) |
| 13:52:14 | Araq | sure it's a bug, it's a regression. it used to write the stack trace in the HTML page :-) |
| 13:52:27 | * | bjz joined #nim |
| 13:52:44 | Araq | arnetheduck: the sun is shining. |
| 13:53:34 | * | bjz_ quit (Ping timeout: 240 seconds) |
| 13:53:46 | arnetheduck | not here, too late. thought I'd get back to nlvm for a bit, I see there's a windows test runner up now which is nice |
| 13:53:56 | Tiberium | how can I check architecture of machine in nim.cfg? when defined(amd64) - like this? |
| 13:54:21 | arnetheduck | https://github.com/nim-lang/Nim/pull/5656 even passes on it! |
| 13:55:29 | Araq | Tiberium: @if amd64: |
| 13:55:34 | Tiberium | Araq, thanks! |
| 13:57:51 | cheatfate | arnetheduck, what does it mean this PR could you explain more? |
| 13:58:10 | yglukhov | Araq: again, Nim has does not interfere with this exception. and technically can't. it's a JS-originated exception. this particular example could never work. |
| 13:58:48 | arnetheduck | cheatfate, it disables rtti generation for types which are imported from C (essentially, types that nim didn't write the corresponding struct for) |
| 13:58:55 | cheatfate | so if C struct has 20 members and i will declare my object {.importc.} and only 2 properties will be declared with {.importc.} |
| 13:59:10 | cheatfate | is it will be affected? |
| 13:59:39 | arnetheduck | if you do that, nim will now generate rtti for the two fields, and depending on the C features used, that rtti will be more or less correct |
| 14:00:17 | FromGitter | <dom96> There are definitely bugs with our JS backend when it comes to exception handling. |
| 14:00:29 | FromGitter | <dom96> catching an exception doesn't work for me |
| 14:00:31 | cheatfate | arnetheduck, i'm doing that and most of os related modules in stdlib uses such mechanics |
| 14:00:39 | FromGitter | <dom96> Probably related to: https://github.com/nim-lang/Nim/issues/5563 |
| 14:01:02 | cheatfate | arnetheduck, is it will be broken? |
| 14:01:37 | FromGitter | <dom96> Tiberium: runForever() |
| 14:01:54 | arnetheduck | cheatfate, take a union for example - some nim object types have accessors for two members of the same union, so walking rtti will hit the same field twice |
| 14:02:07 | Tiberium | dom96, I mean to wait until all events are done |
| 14:02:14 | Tiberium | or runForever() does that? |
| 14:02:27 | cheatfate | arnetheduck, does your patch will break such mechanics or not? |
| 14:02:45 | arnetheduck | ultimately, it's also useless - rtti is used for deep copies and such, and c structs need not be visited that way |
| 14:03:02 | arnetheduck | no, it doesn't break anything - at least that's what the test suite says |
| 14:03:17 | arnetheduck | if anything, it makes nim a little more efficient |
| 14:03:36 | arnetheduck | ie less rtti bloat for stuff that's never useful |
| 14:03:42 | cheatfate | when i make my object {.importc.} i want it to be binary compatible with c struct |
| 14:04:20 | cheatfate | when i declare some fields of my object as {.importc.}, i want that fields to be compatible with appropriate c struct members |
| 14:04:40 | arnetheduck | no changes there. what happens is that it will skip generating TNimNode and friends for the C struct |
| 14:24:32 | * | ftsf quit (Remote host closed the connection) |
| 14:26:37 | * | nsf quit (Quit: WeeChat 1.7) |
| 14:28:20 | * | PMunch quit (Quit: leaving) |
| 14:29:47 | * | PMunch joined #nim |
| 14:30:44 | Tiberium | ok, I have a strange issue in my app: after some time cpu usage goes 100% and it hangs... I'll try to compile and run with boehm gc first |
| 14:33:01 | * | sz0 joined #nim |
| 14:33:44 | Tiberium | well, at least it crashed instead of using 100% and freezing :) |
| 14:33:48 | Tiberium | also there's traceback |
| 14:43:47 | * | devted joined #nim |
| 14:44:08 | * | krux02 joined #nim |
| 14:52:04 | * | rauss joined #nim |
| 14:55:08 | * | brson joined #nim |
| 14:57:37 | * | krux02_ joined #nim |
| 14:57:39 | Tiberium | well, it still happens even with boehm, so issue is somewhere in my code |
| 14:57:46 | * | krux02 quit (Quit: Leaving) |
| 14:57:46 | * | couven92 joined #nim |
| 14:58:03 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
| 15:01:23 | * | krux02_ quit (Client Quit) |
| 15:01:34 | * | krux02 joined #nim |
| 15:09:20 | * | couven92 quit (Quit: Client disconnecting) |
| 15:09:29 | Tiberium | https://gist.github.com/TiberiumN/dd79ee75043dae70f11e78fcdc12fa1e |
| 15:09:49 | Tiberium | this is what I got with "perf record -p <pid of process>" |
| 15:16:21 | * | Andris_zbx quit (Remote host closed the connection) |
| 15:22:07 | * | rauss quit (Ping timeout: 240 seconds) |
| 15:27:37 | FromGitter | <Varriount> Tiberium: Are you using exceptions in an excessive way? |
| 15:28:17 | Tiberium | hmm, I don't use them everywhere, but I use them at future callback to catch exception from future |
| 15:28:47 | * | yglukhov quit (Remote host closed the connection) |
| 15:29:07 | FromGitter | <Varriount> Also, if you send a sigterm to a process that's using 100% cpu, the stack trace is likely to occur in whatever function is getting called the most |
| 15:29:13 | Tiberium | I use a proc from Nim's stdlib called injectStacktrace |
| 15:29:51 | FromGitter | <Varriount> What happens when you disable the injection? |
| 15:31:05 | Tiberium | let me try |
| 15:33:27 | * | rauss joined #nim |
| 15:33:45 | FromGitter | <Varriount> Tiberium: By the way, here's a performance tip: Nim strings and sequences copy on assignment. It's better to mutate them in-place |
| 15:34:40 | * | yglukhov joined #nim |
| 15:39:25 | * | yglukhov quit (Ping timeout: 260 seconds) |
| 15:49:08 | FromGitter | <Danielez> Hello what is the idiomatic way to check if table has a key and if the corresponding value is not empty ("")? In python I write ```if "key" in dictionary and dictionary["key"]: etc``` |
| 15:49:32 | FromGitter | <Danielez> Thanks |
| 15:50:43 | * | krux02 quit (Disconnected by services) |
| 15:51:03 | * | krux02_ joined #nim |
| 15:51:59 | * | krux02_ quit (Client Quit) |
| 15:51:59 | Araq | d.getOrDefault("key").len > 0 |
| 15:52:08 | Araq | maybe. |
| 15:52:26 | FromGitter | <Danielez> Tanks |
| 15:53:58 | FromGitter | <Danielez> *Thanks |
| 15:55:47 | PMunch | Danielez http://bit.ly/1XQU0tT |
| 15:57:50 | FromGitter | <Danielez> hihihihi |
| 16:01:49 | * | zachcarter_ joined #nim |
| 16:02:07 | * | couven92 joined #nim |
| 16:02:38 | * | zachcarter_ quit (Client Quit) |
| 16:03:34 | * | zachcarter quit (Ping timeout: 240 seconds) |
| 16:03:44 | * | krux02 joined #nim |
| 16:04:47 | * | Vladar joined #nim |
| 16:06:04 | * | libman joined #nim |
| 16:13:01 | * | BitPuffin joined #nim |
| 16:21:50 | * | vlad1777d joined #nim |
| 16:29:18 | * | yglukhov joined #nim |
| 16:33:57 | * | yglukhov quit (Ping timeout: 264 seconds) |
| 16:38:27 | * | arnetheduck quit (Ping timeout: 246 seconds) |
| 16:42:27 | * | yglukhov joined #nim |
| 16:44:51 | * | Serenitor joined #nim |
| 16:47:03 | * | yglukhov quit (Remote host closed the connection) |
| 16:50:48 | * | BitPuffin quit (Read error: Connection reset by peer) |
| 16:51:26 | * | BitPuffin joined #nim |
| 17:05:44 | * | krux02 quit (Remote host closed the connection) |
| 17:06:37 | * | yglukhov joined #nim |
| 17:07:41 | * | Trustable joined #nim |
| 17:34:26 | Araq | er ... offtopic but how does routing work in single page apps? what JS event does it trigger? |
| 17:35:21 | PMunch | Araq, depends a bit Araq |
| 17:35:34 | dom96 | http://caniuse.com/#search=hash |
| 17:35:37 | dom96 | Probably that one |
| 17:35:49 | PMunch | Nowadays you use push to the history and you get an event when it changes |
| 17:36:01 | * | yglukhov quit (Remote host closed the connection) |
| 17:36:15 | PMunch | So you can actually use the back buttons and such |
| 17:36:30 | dom96 | But honestly, why reinvent what the browser does for you already? |
| 17:38:13 | PMunch | Well, single-page apps have the benefit that they only load once |
| 17:39:04 | PMunch | And then typically only pulls small JSON objects if it needs it |
| 17:39:17 | demi- | megabytes and megabytes of javascript, yum |
| 17:39:28 | PMunch | Fair point :P |
| 17:39:32 | PMunch | Doesn't have to be that huge though |
| 17:39:38 | Tiberium | Varriount: even with injectStacktrace off cpu usage is 100% |
| 17:39:40 | couven92 | Araq, removed vccdiscover now... |
| 17:39:46 | Tiberium | still the same log for 3 million samples |
| 17:40:10 | Tiberium | something is constantly throwing an error? |
| 17:40:23 | PMunch | I wrote a single file task tracker with HTML+JSON+CSS that auto-resolves git conflicts within the file itself so you can keep it in your repository and it's smaller than jQuery |
| 17:40:26 | dom96 | PMunch: I really doubt the JSON they pull is small |
| 17:40:30 | Tiberium | https://gist.github.com/TiberiumN/d4b85165c0452b95809db669e0b5f529 |
| 17:40:50 | PMunch | dom96, smaller than a modern web-page |
| 17:40:54 | dom96 | How? |
| 17:41:01 | couven92 | PMunch, but ALite still does not work because you cannot save state |
| 17:41:07 | dom96 | You still need to construct a full page using this JSON |
| 17:41:13 | PMunch | Of course you can, right-click save os |
| 17:41:18 | PMunch | s/os/as |
| 17:41:37 | PMunch | The save button is just apparently broken in IE for some reason |
| 17:41:57 | couven92 | no, it didn't work in either of Firefox, Edge, Chrome and IE |
| 17:42:15 | PMunch | Worked fine for me in Chrome and Vivaldi, along with Opera on my phone.. |
| 17:42:19 | PMunch | But besides the point |
| 17:42:34 | dom96 | I don't see how the size can differ too much. For a normal web page the extra data is cached. |
| 17:42:50 | PMunch | dom96, but to change from one page to a completely different one you only need to pull the text data |
| 17:43:02 | PMunch | Well some of it |
| 17:43:08 | dom96 | couven92: hey! Are you still planning to work on SChannel? |
| 17:43:11 | PMunch | I guess it wouldn't be that big a difference |
| 17:43:52 | dom96 | Yeah, it's really not worth this small difference |
| 17:43:55 | dom96 | Whatever it is. |
| 17:43:55 | couven92 | dom96, I am! I am flying to Germany tomorrow for Easter holidays :) I'll do it while on holiday :) |
| 17:44:03 | dom96 | couven92: yay, awesome |
| 17:44:18 | PMunch | Well, all side menus, footer, header etc. would still need to be loaded.. |
| 17:44:26 | PMunch | Depends a bit on the content I think |
| 17:45:48 | dom96 | I doubt those things are that large. |
| 17:47:03 | demi- | most modern websites don't work on anything less than full-speed LTE |
| 17:48:57 | Tiberium | how can I debug high cpu usage? maybe with gdb? so I can see nim source lines |
| 17:49:12 | PMunch | demi-, yeah it's a bit of a mess |
| 17:50:56 | dom96 | also, I find it funny how the progress bar was removed by web browsers |
| 17:51:00 | dom96 | and then brought back by websites |
| 17:52:06 | PMunch | Huh? I still have progress bars in all my browsers.. |
| 17:52:07 | couven92 | dom96, especially since progress bars is sth that is mostly supported natively by all OSes |
| 17:52:23 | couven92 | PMunch, but there is no HTML5 element for that |
| 17:52:41 | PMunch | For a progress bar? That's true.. |
| 17:52:42 | dom96 | PMunch: What web browsers are you using? |
| 17:52:58 | PMunch | Vivaldi on my desktop and Opera on my phone |
| 17:54:24 | dom96 | Ahh. Yeah, but Chrome/Firefox/Safari and IE (IIRC) don't have a progress bar anymore |
| 17:54:57 | PMunch | Hmm, that's a shame |
| 17:55:22 | couven92 | neither has Edge |
| 17:55:25 | PMunch | However websites nowadays can load stuff from other sources dynamically. So the progress bar might not even be correct |
| 17:56:23 | Tiberium | there's progress bar on chrome on android |
| 17:56:36 | Tiberium | but it doesn't really make any sense |
| 17:56:53 | couven92 | Tiberium, yeah, that's right... But it is also really subtle |
| 17:56:59 | Tiberium | or maybe does, but I have 4G so I'm fine :) |
| 17:59:25 | Araq | dom96: that site doesn't really help me |
| 17:59:43 | dom96 | Araq: search for "js hash change event" |
| 18:01:38 | Araq | https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onhashchange = |
| 18:01:40 | Araq | ? |
| 18:02:15 | * | yglukhov joined #nim |
| 18:03:18 | dom96 | sure |
| 18:26:02 | * | nsf joined #nim |
| 18:29:22 | * | nhywyll joined #nim |
| 18:30:31 | * | Tiberium quit (Remote host closed the connection) |
| 18:47:23 | * | xet7 quit (Quit: Leaving) |
| 18:51:42 | * | yglukhov quit (Remote host closed the connection) |
| 18:51:59 | * | yglukhov joined #nim |
| 19:01:28 | * | fredrik92 joined #nim |
| 19:03:57 | * | couven92 quit (Ping timeout: 264 seconds) |
| 19:05:10 | * | yglukhov quit (Remote host closed the connection) |
| 19:05:34 | * | hcorion joined #nim |
| 19:20:34 | FromGitter | <Varriount> @TiberiumPY Hm. |
| 19:21:40 | * | Sembei joined #nim |
| 19:21:47 | * | Vladar quit (Quit: Leaving) |
| 19:24:19 | FromGitter | <Varriount> @TiberiumPY You could try removing/disabling portions of your code. Does perf have a way of generating flame graphs? |
| 19:33:44 | * | Arrrr quit (Quit: Leaving.) |
| 19:34:58 | ldlework | Araq: I have been impressing people all over with that concepts example we worked on yesterday |
| 19:37:46 | FromGitter | <Varriount> ldlework: What example? |
| 19:38:01 | ldlework | https://gist.github.com/dustinlacewell/6b97b658c2db44e1b22fa021873fe133 |
| 19:40:30 | dom96 | "yesterday" hehe. Still the same day for me. |
| 19:40:55 | FromGitter | <Varriount> ===nim spans around the globe!=== |
| 19:40:56 | ldlework | hehe yeah only a handful of hours ago I guess |
| 19:41:09 | ldlework | Varriount, "the sun never sets on the Nim empire" |
| 19:42:51 | dom96 | I'm having a hard time imagining what this code would be used for |
| 19:42:55 | dom96 | What are you using it for? |
| 19:44:05 | * | nsf quit (Quit: WeeChat 1.7) |
| 19:44:10 | * | Trustable quit (Remote host closed the connection) |
| 19:44:35 | ldlework | dom96: I'm implementing a visual modular-synth editor like NimSynth that ftsf is working on. Mine will feature typed ports on the modules. Each port will be assigned a Value. |
| 19:44:50 | dom96 | oh cool |
| 19:45:00 | ldlework | I'm not sure if it is useful to do it this way yet, I am just experimenting and got stuck in a pl-design-K-hole trying to express the isomorphism |
| 19:45:13 | ldlework | Nim is good drug for that. |
| 19:45:28 | FromGitter | <Varriount> ldlework: Do it aaalll in macros. >:D |
| 19:45:47 | ldlework | Varriout, the actual module definitions will be a nice macro for sure |
| 19:45:59 | * | BitPuffin quit (Read error: Connection reset by peer) |
| 19:46:13 | dom96 | ldlework: Glad you're rediscovering the magic of Nim :) |
| 19:46:14 | ldlework | I tried to help ftsf with their project but they are allergic to abstraction |
| 19:46:22 | ldlework | And I'm basically chemically dependent on it |
| 19:46:42 | FromGitter | <Varriount> Hrm. You can have too much of a good thing. |
| 19:46:51 | dom96 | More than one synth project couldn't hurt :) |
| 19:47:11 | ldlework | Varriount, Nim represents to me the language that is capable of expressing the densest isomorphs. |
| 19:47:12 | dom96 | I think we should start featuring these projects on Nim's website |
| 19:47:22 | ldlework | If I cared about the application itself, I would write it in Unity and make money. |
| 19:47:30 | dom96 | ftsf created some really awesome things that will immediately make people go "wow" |
| 19:47:40 | ldlework | +1 |
| 19:47:46 | ldlework | His synth is incredible |
| 19:48:00 | ldlework | Quite literally, inspiring. :) |
| 19:48:12 | ldlework | Spaghetti code for miles though. |
| 19:48:17 | ldlework | ^^ |
| 19:48:51 | ldlework | I'm building just a toy version as the next example app for Dadren |
| 19:50:06 | ldlework | Nim allows me to directly exercise my sixth cortical layer. |
| 19:51:51 | ldlework | (where the highest-order invariant representations of your knowledge exists, before patters are kicked off to the hypothalamus for short-term memory processing) |
| 19:52:30 | FromGitter | <Varriount> <3 Psychology |
| 19:53:13 | ldlework | Varriount, Jeff Hawkins' _On Intelligence_ and Michael Graziano's _The Social Brain_ are the two of the four most important non-fiction books I've ever read. |
| 20:00:52 | * | hcorion quit (Quit: Konversation terminated!) |
| 20:01:05 | * | libman quit (Quit: Connection closed for inactivity) |
| 20:07:21 | * | vivus joined #nim |
| 20:08:49 | vivus | are there any libs for log-analysis in nim ? |
| 20:11:09 | ldlework | I don't see anything on the package listing |
| 20:12:16 | * | rokups quit (Quit: Connection closed for inactivity) |
| 20:13:32 | vivus | ldlework: I just need to match x-thousand IPs from the log against a set of IPs. any idea of a way to store those IPs and match them efficiently ? |
| 20:16:30 | demi- | lol |
| 20:18:23 | ldlework | vivus: I mean just implement it. Nim is fast, and then you can profile your implementation. |
| 20:19:00 | vivus | ldlework: that is true, but I am asking for ways to store the IP. would a seq be good enough? |
| 20:19:16 | ldlework | You could calculate how much memory it will cost you |
| 20:19:33 | ldlework | Also, "good enough" is an answer of profiling |
| 20:19:52 | ldlework | make a naive implementation who's code cares to expose what you're doing rather than care about speed |
| 20:20:00 | ldlework | maybe its already wayyyy faster than you care about |
| 20:20:08 | ldlework | maybe it needs slight optimization |
| 20:20:11 | ldlework | maybe you have to rewrite it |
| 20:20:18 | vivus | I guess you're right, first build, then optimize |
| 20:26:04 | * | libman joined #nim |
| 20:31:47 | FromGitter | <TiberiumPY> @Varriount maybe I can try the simplest way - add echo to every proc so this echo would output proc name |
| 20:32:14 | FromGitter | <TiberiumPY> So I would know which proc was called last or which is called many times |
| 20:32:45 | dom96 | vivus: I think you might be looking for a set |
| 20:32:51 | * | Matthias247 joined #nim |
| 20:33:48 | ldlework | My friend who knows rust thinks that rust could accomplish the same feat as the concept example above but I think they are confused |
| 20:37:35 | ldlework | the real special sauce in this example is that the `when` blocks take place at compile time, and are run for each implementation expansion. And so you get multiple implementations of `set` each one with the exact code to handle the type. |
| 20:38:16 | ldlework | In other languages you need to dispatch either at runtime, or you need to write "setWithValue" "setWithValueAndMin" "setWithValueAndMax" |
| 20:38:53 | ldlework | And likely you need to create second-order traits the capture each unique combination of the first order traits |
| 20:39:02 | ldlework | I'm not a Rust expert but I don't think its even close. |
| 20:39:12 | cheatfate | vivus, this is not true `first build, then optimize` :) |
| 20:40:02 | cheatfate | vivus, if you need only IPv4 without port information the best way to store it is uint32/int32 |
| 20:40:10 | ldlework | cheatfate: good thinking |
| 20:40:23 | cheatfate | if it has port information, then you can use uint64 |
| 20:40:55 | cheatfate | and maybe its better to start from tree structure |
| 20:41:00 | cheatfate | not sequence |
| 20:41:01 | dom96 | ldlework: ask your friend to implement it in Rust :) |
| 20:41:11 | ldlework | dom96: ya. |
| 20:42:21 | dom96 | So I'm thinking about how to best prevent cheating the high score in my poor little Snake game. |
| 20:42:40 | ldlework | dom96: hahahahaha |
| 20:43:01 | ldlework | dom96: it doesn't matter what the game is |
| 20:43:05 | ldlework | the answers are the same |
| 20:43:17 | dom96 | Yeah. |
| 20:43:20 | ldlework | dom96: does Nim have a threadless goroutine like thing? run each game as a simulation on the server |
| 20:43:33 | dom96 | But I don't want to put the simulation on the server. |
| 20:43:43 | ldlework | Well that's what the answer is... |
| 20:43:58 | ldlework | You could further obsfucate your javascript |
| 20:44:02 | ldlework | but then I can just look at the wire |
| 20:44:07 | ldlework | what now? |
| 20:44:23 | dom96 | I'm considering storing a replay and submitting that |
| 20:44:39 | ldlework | What will that do |
| 20:44:40 | FromGitter | <TiberiumPY> Use http over TCP over websockets :D |
| 20:44:46 | ldlework | run it as a simulation on the server? |
| 20:44:50 | ldlework | XD |
| 20:44:51 | dom96 | That way I can at least verify manually whether it's a cheat or not |
| 20:45:13 | ldlework | sure but now I can just generate a replay |
| 20:45:18 | ldlework | which sounds like a fun challenge |
| 20:45:21 | dom96 | lol |
| 20:45:35 | dom96 | yeah, but it's more difficult :P |
| 20:45:35 | FromGitter | <TiberiumPY> This is not a joke btw |
| 20:45:38 | FromGitter | <TiberiumPY> https://github.com/n1nj4sec/pupy/blob/master/README.md |
| 20:45:42 | ldlework | in the end, writing an AI for snake is very easy |
| 20:45:46 | FromGitter | <Varriount> ldlework: We have a Go GC backend, with Goroutines |
| 20:45:48 | dom96 | precisely |
| 20:45:55 | ldlework | I saw a snake AI implemented as a CA before |
| 20:46:02 | FromGitter | <TiberiumPY> "All transports in pupy are stackable. This mean that by creating a custom transport conf (pupy/network/transport/<transport_name>/conf.py), you can make you pupy session looks like anything. For example you could stack HTTP over HTTP over base64 over HTTP over AES over obfs3 :o)" |
| 20:46:02 | dom96 | In the end, even a server-side simulation isn't fool-proof. |
| 20:46:10 | FromGitter | <TiberiumPY> I don't know how it works |
| 20:46:15 | ldlework | dom96: yes but at least you are teaching people AI |
| 20:46:21 | ldlework | so the cheating has value |
| 20:47:02 | ldlework | heh for generating the replay |
| 20:47:17 | dom96 | I want the game to work even if the server is down though |
| 20:47:23 | ldlework | you can just have the snake go around the outside in a spiral going inwards, generating the food infront of their face on each turn |
| 20:47:23 | * | bjz joined #nim |
| 20:47:27 | * | nhywyll quit (Quit: nhywyll) |
| 20:47:56 | FromGitter | <TiberiumPY> Make offline version without score submitting |
| 20:47:58 | dom96 | Yes, but like I said, I can verify that myself. |
| 20:47:59 | ldlework | I suppose any curve filling pattern would work |
| 20:48:13 | FromGitter | <TiberiumPY> Or with later submitting via replay |
| 20:48:24 | dom96 | Tiberium: yes, that's my plan currently. |
| 20:48:42 | dom96 | I want to ensure that if the server crashes, that I can bring it back and let people reconnect. |
| 20:48:59 | ldlework | dom96: write a convolutional network to review the replays for a while before the cheaters get started |
| 20:49:04 | dom96 | Without losing their high score |
| 20:49:24 | dom96 | a convolutional network eh? What is that? :) |
| 20:49:28 | ldlework | dom96: whaat? |
| 20:49:45 | ldlework | I figured you'd be all over deep learning |
| 20:50:07 | FromGitter | <Varriount> The most I know about convolution is that it's a kind a image filter. :/ |
| 20:50:23 | ldlework | Same principle is used in some learning networks |
| 20:50:37 | ldlework | https://www.youtube.com/watch?v=FmpDIaiMIeA |
| 20:50:50 | dom96 | I probably would be if I didn't spend so much time working on Nim things |
| 20:50:51 | ldlework | They learn higher and higher order features |
| 20:51:27 | ldlework | Seriously just order _On Intelligence_ and read it |
| 20:51:29 | FromGitter | <TiberiumPY> Make neural networking library for Nim :) |
| 20:51:42 | ldlework | you wont regret it and it will update your neuroscience real good |
| 20:51:55 | ldlework | It will teach you the general cortical learning algorithm |
| 20:52:39 | ldlework | how regions of cortical columns work together to store invariant representations of memories to create all the new-brain knowledge you have |
| 20:53:01 | ldlework | how actually remembering how to move is what causes you to move |
| 20:53:43 | ldlework | ugh it kinda gives me strange internal vertigo thinking about it |
| 20:54:10 | * | dom96 adds it to his Amazon wishlist |
| 20:58:15 | FromGitter | <TiberiumPY> Is it a good idea for me to create something like terraria (but simpler) in Nim for self education? |
| 20:58:45 | dom96 | sure, sounds like a fun project. |
| 20:59:02 | FromGitter | <TiberiumPY> And what's game framework I need to choose? Something like nimgame2? |
| 20:59:04 | dom96 | Then move on to a Minecraft clone :) |
| 20:59:47 | dom96 | That I cannot say, I never used it. |
| 21:00:05 | dom96 | Although if you want to learn you should probably just go with sdl2 |
| 21:00:30 | FromGitter | <TiberiumPY> (terraria because my friend was doing simple terraria-style game with blocks with python and pygame, and then he moved to Java because of performance) |
| 21:00:52 | FromGitter | <TiberiumPY> Probably it's because pygame uses sdl1 |
| 21:00:58 | dom96 | ahh, so you want to beat his performance? :D |
| 21:00:58 | FromGitter | <TiberiumPY> Which is very old |
| 21:01:25 | dom96 | More likely because Python is just darn slow |
| 21:01:52 | FromGitter | <TiberiumPY> I didn't create any real games yet, so I need to star |
| 21:03:01 | FromGitter | <TiberiumPY> *start |
| 21:04:34 | * | nightmared joined #nim |
| 21:06:27 | ldlework | TiberiumPY wanna get acquainted with Dadren? |
| 21:06:49 | ldlework | TiberiumPY, that's my SDL2 game library for Nim |
| 21:08:30 | FromGitter | <TiberiumPY> I've never made any real game, so I'm like a noob there, but sure :) (also I'm not good at Nim for now) |
| 21:08:59 | FromGitter | <TiberiumPY> Well I can use Nim, but no big metaprogramming etc |
| 21:09:44 | ldlework | TiberiumPY well that's good if we make it easy for you we make it easy for everyone else too |
| 21:09:54 | ldlework | I think I have a good sense for API design but you never know |
| 21:11:04 | FromGitter | <stisa> Idlework : do you have a link? |
| 21:13:32 | ldlework | https://github.com/dustinlacewell/dadren |
| 21:13:39 | ldlework | ignore the readme, which is actually for a game I want to write |
| 21:13:49 | ldlework | some minimal docs here, http://dadren.github.io/ |
| 21:14:03 | ldlework | I put it down for a long time since the first period of progess |
| 21:14:10 | ldlework | But I recently updated it for latest nim |
| 21:14:38 | ldlework | so you can clone it and build the hatchet example which includes an example of biome generation and tilemap and camera, etc |
| 21:21:04 | FromGitter | <TiberiumPY> By the way, waiting for wasm so we can enjoy Nim speeds in browser :) |
| 21:31:37 | FromGitter | <TiberiumPY> Wait |
| 21:32:10 | FromGitter | <TiberiumPY> There's seems to be new GCC back end ⏎ Without emscripten |
| 21:36:00 | dom96 | no support for marshal in JS target? D: |
| 21:37:52 | FromGitter | <TiberiumPY> I believe in 3-5 years almost all modern programming languages will support wasm |
| 21:38:06 | FromGitter | <TiberiumPY> Including interpreted ones |
| 21:38:24 | FromGitter | <TiberiumPY> So rip JS :d |
| 21:38:33 | dom96 | I wouldn't be so sure |
| 21:38:38 | ldlework | heh |
| 21:38:38 | dom96 | Keep in mind what happened with asm.js |
| 21:39:55 | * | Jesin quit (Quit: Leaving) |
| 21:40:37 | ldlework | TiberiumPY let me know if you take a look over Dadren and the hatchet example |
| 21:41:58 | FromGitter | <TiberiumPY> Ok, only tomorrow, after school :D |
| 21:42:25 | dom96 | Araq: Any ideas why string streams aren't supported in the JS target? |
| 21:43:43 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
| 21:45:00 | dom96 | le sigh |
| 21:46:28 | ldlework | lol |
| 21:46:50 | dom96 | I recall flyx running into the same problem |
| 21:49:41 | dom96 | IRC logs sure are handy :) https://irclogs.nim-lang.org/04-09-2016.html#14:51:52 |
| 21:50:00 | dom96 | Sadly it doesn't help me |
| 21:50:59 | * | rauss quit (Quit: WeeChat 1.7) |
| 21:51:14 | ldlework | dom96: why don't you simply offer a procedure that accepts a string? |
| 21:51:22 | dom96 | lol |
| 21:51:57 | dom96 | ldlework: a) Stream seams more versatile and b) marshal needs a Stream |
| 21:52:02 | ldlework | hehe |
| 21:57:49 | Araq | dom96: not sure, make it work |
| 22:00:13 | dom96 | Araq: how do I implement copyMem for the JS target? |
| 22:00:34 | Araq | a for loop? |
| 22:03:09 | dom96 | is it safe to just use `=`, or do I need to copy somehow? |
| 22:03:15 | * | devted quit (Quit: Sleeping.) |
| 22:03:42 | Araq | = should be fine |
| 22:11:14 | dom96 | Looks likeI can't simply write: pointer[0] :/ |
| 22:16:57 | * | Sembei quit (Ping timeout: 240 seconds) |
| 22:17:57 | * | bjz joined #nim |
| 22:19:50 | * | zachcarter joined #nim |
| 22:21:39 | dom96 | lib/core/typeinfo.nim(513, 35) Error: internal error: genDeref |
| 22:21:45 | dom96 | oh well |
| 22:21:49 | dom96 | good night] |
| 22:25:34 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
| 22:26:45 | * | zachcarter_ joined #nim |
| 22:27:47 | * | zachcarter quit (Ping timeout: 240 seconds) |
| 22:27:47 | * | zachcarter_ is now known as zachcarter |
| 22:42:22 | * | Nobabs27 joined #nim |
| 22:45:12 | * | krux02 joined #nim |
| 22:46:04 | * | PMunch quit (Quit: leaving) |
| 22:47:34 | * | nsf joined #nim |
| 22:49:46 | fredrik92 | Araq, I needed some instant gratification, so I went ahead and picked one of the Easy marked issues on GitHub from 2015... https://github.com/nim-lang/Nim/pull/5663 |
| 22:50:25 | * | fredrik92 is now known as couven92 |
| 22:51:23 | Araq | cool. the next time learn to type 'template' instead of CRTL+C CTRL+V |
| 22:52:34 | couven92 | oops :D |
| 22:53:18 | * | Jesin joined #nim |
| 22:53:42 | Araq | Nim is not Java, you don't need a never ending clusterfuck of boilerplate because there is no control flow abstraction available. |
| 22:54:07 | krux02 | Araq: i kind of want to implement sizeof/alignof, but I have problems |
| 22:55:10 | krux02 | I tried to find out how sizeof actually works, but I am very puzzled |
| 22:55:30 | couven92 | ok, I'll read up on templates on the plane tomorrow... Good night. :) |
| 22:56:24 | krux02 | I have a working version based on macros, but it misses one single bit of information, the knowledge if an object is packed |
| 22:56:28 | * | couven92 quit (Quit: Client Disconnecting) |
| 22:58:46 | Araq | krux02: can you patch the compiler please? |
| 22:59:24 | krux02 | well that is what I want to do, but I can't do it, because I don't understand the sourcecode |
| 22:59:42 | Araq | tfPacked in t.flags |
| 23:00:30 | krux02 | ok |
| 23:00:32 | * | nsf quit (Quit: WeeChat 1.7) |
| 23:00:57 | krux02 | I still don't know where the sizeof that is executed on the vm is implemented |
| 23:01:33 | krux02 | when I grep for SizeOf, I found caseof branch with this line: |
| 23:01:49 | krux02 | globalError(n.info, errCannotInterpretNodeX, renderTree(n)) |
| 23:02:27 | Araq | the vm expects this to be already evaluated in this stage of the compiler pipeline |
| 23:02:43 | Araq | types.computeSize is what you're looking for |
| 23:04:12 | krux02 | ok thanks |
| 23:04:20 | * | rauss joined #nim |
| 23:04:40 | krux02 | now I have something to work with |
| 23:06:26 | libman | http://libman.org/img/scr/20170404-nake.png |
| 23:09:21 | * | vlad1777d quit (Quit: Leaving) |
| 23:10:02 | krux02 | I am a bit puzzled about compileSizeAux, it has a var parameter for the result, but also a result |
| 23:13:06 | krux02 | ok I think a is for the alignment |
| 23:18:57 | libman | ... but `cd ~/.nimble/pkgs/nake-1.9 && nimble install` works. |
| 23:20:17 | libman | But then all files in that directory except "nimblemeta.json" become 0 bytes. |
| 23:21:58 | libman | Should I file this as a nimble issue on github? |
| 23:24:43 | * | winnebagel joined #nim |
| 23:24:47 | * | Matthias247 quit (Read error: Connection reset by peer) |
| 23:40:01 | FromGitter | <Varriount> krux02: Exploring the compiler source code? I hope you've brought along a torch and a map. |
| 23:42:00 | krux02 | Varriount: well I first clean up a bit the code that I am going to change |
| 23:42:07 | krux02 | I hope Araq likes it |
| 23:44:10 | FromGitter | <Varriount> krux02: There's only one person who knows what Araq likes. ;P |
| 23:44:20 | ldlework | ^^ |
| 23:56:09 | * | arnetheduck joined #nim |