00:01:05 | FromGitter | <mratsim> last link I promise: https://www.reddit.com/r/programming/comments/862f7j/article_project_from_hell/dw1ywm2/ |
00:01:45 | FromGitter | <mratsim> If you’re still up for more, just read random stories from here: https://thedailywtf.com/ |
00:05:04 | * | xylef quit (Quit: WeeChat 2.2) |
00:12:48 | * | SenasOzys__ joined #nim |
00:12:57 | * | SenasOzys quit (Ping timeout: 240 seconds) |
00:13:37 | stefanos82 | @mratsim: the project failures link you shared above...it just made me nauseous |
00:36:09 | * | Sembei joined #nim |
00:36:35 | * | Pisuke quit (Ping timeout: 240 seconds) |
01:03:34 | * | stefanos82 quit (Quit: Quitting for now...) |
01:43:33 | * | wildlander quit (Quit: Konversation terminated!) |
02:09:58 | * | Matrixiumn joined #nim |
02:10:54 | * | Matrixiumn quit (Killed (Sigyn (Spam is off topic on freenode.))) |
02:25:31 | * | bthesorceror joined #nim |
02:30:00 | * | lunaaa joined #nim |
02:31:46 | * | lunaaa quit (Remote host closed the connection) |
02:37:57 | * | SenasOzys__ quit (Ping timeout: 240 seconds) |
02:38:18 | * | SenasOzys joined #nim |
02:39:04 | FromGitter | <kayabaNerve> TDWTF is my new favorite site. Thanks @mratsim |
03:00:30 | * | kaushalmodi joined #nim |
03:56:48 | * | krux02 quit (Remote host closed the connection) |
04:06:38 | * | thevdude1 joined #nim |
04:07:07 | * | thevdude1 quit (Remote host closed the connection) |
04:15:42 | * | rockcavera quit (Remote host closed the connection) |
04:25:10 | * | rockcavera joined #nim |
04:35:35 | * | dorelix quit (Ping timeout: 240 seconds) |
04:49:07 | * | dorelix joined #nim |
04:51:05 | * | bthesorceror quit (Ping timeout: 240 seconds) |
05:12:43 | * | kaushalmodi quit (Quit: Connection closed for inactivity) |
05:17:27 | * | smt` quit (Read error: Connection reset by peer) |
05:17:49 | * | smt` joined #nim |
05:23:09 | * | doomsday joined #nim |
05:30:23 | * | Gentle joined #nim |
05:30:27 | * | xylef joined #nim |
05:32:07 | * | Gentle quit (Remote host closed the connection) |
05:38:38 | * | kaushalmodi joined #nim |
05:45:18 | * | Ocdd joined #nim |
05:55:54 | * | xylef quit (Quit: WeeChat 2.2) |
05:56:09 | * | bthesorceror joined #nim |
06:09:44 | * | Trustable joined #nim |
06:09:54 | * | Vladar joined #nim |
06:11:06 | * | doomsday left #nim (#nim) |
06:23:20 | * | dorelix quit (Quit: Leaving) |
06:38:24 | * | kobi_ joined #nim |
06:39:10 | * | kobi_ quit (Client Quit) |
06:39:27 | * | kobi7 joined #nim |
06:43:22 | * | yglukhov[i] joined #nim |
06:57:52 | * | kobi7 quit (Quit: Leaving) |
07:04:19 | * | nsf joined #nim |
07:09:09 | * | yglukhov[i] quit (Remote host closed the connection) |
07:21:34 | * | bthesorceror quit (Quit: Lost terminal) |
07:29:06 | FromGitter | <mratsim> This is pretty: https://github.com/google/filament " ⏎ Filament is a physically based rendering engine for Android, Linux, macOS and Windows. This rendering engine was designed to be as small as possible and as efficient as possible on Android." |
07:52:43 | * | kaushalmodi quit (Quit: Connection closed for inactivity) |
07:55:19 | * | yglukhov[i] joined #nim |
08:03:23 | * | gmpreussner joined #nim |
08:04:34 | * | gmpreussner_ quit (Ping timeout: 264 seconds) |
08:06:08 | * | loppy2 joined #nim |
08:07:55 | * | loppy2 quit (Remote host closed the connection) |
08:14:00 | * | yglukhov[i] quit (Remote host closed the connection) |
08:18:22 | * | yglukhov[i] joined #nim |
08:20:31 | * | syncretism_mbl14 joined #nim |
08:20:34 | * | Ocdd quit (Quit: Leaving) |
08:21:39 | * | syncretism_mbl14 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
08:22:00 | * | echotangoecho joined #nim |
08:28:58 | * | ng0 joined #nim |
09:05:07 | * | echotangoecho quit (Quit: Lost terminal) |
09:33:17 | * | Xgc19 joined #nim |
09:33:32 | * | Xgc19 quit (Remote host closed the connection) |
10:00:56 | * | Randy11 joined #nim |
10:01:23 | * | Randy11 quit (Remote host closed the connection) |
10:03:40 | * | wildlander joined #nim |
11:08:42 | zacharycarter[m] | mratsim: that's the rendering engine they're using for their new OS |
11:09:01 | zacharycarter[m] | I think specifically to power the rendering of specific material design aspects |
11:09:04 | zacharycarter[m] | like their corners etc |
11:09:14 | zacharycarter[m] | so they've integrated it with flutter inside fuschia I believe |
11:11:37 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
11:35:48 | * | raSter^9 joined #nim |
11:40:47 | * | batman427 joined #nim |
11:40:51 | * | raSter^9 quit (Remote host closed the connection) |
11:42:31 | * | batman427 quit (Remote host closed the connection) |
11:53:41 | * | raynold joined #nim |
11:53:57 | * | Vlad17 joined #nim |
11:54:11 | * | raynold quit (Killed (Sigyn (Spam is off topic on freenode.))) |
11:54:18 | * | VampiricPadraig joined #nim |
11:54:58 | * | VampiricPadraig quit (Remote host closed the connection) |
11:55:09 | * | Vlad17 quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
11:59:44 | * | joepie9121 joined #nim |
12:00:25 | * | joepie9121 quit (Remote host closed the connection) |
12:00:42 | * | Krenair13 joined #nim |
12:01:02 | * | Carlos061125 joined #nim |
12:01:07 | * | yglukhov[i] quit (Remote host closed the connection) |
12:02:03 | * | Carlos061125 quit (Read error: Connection reset by peer) |
12:02:34 | * | Krenair13 quit (Remote host closed the connection) |
12:03:51 | * | rtard joined #nim |
12:04:58 | * | Guest83394 joined #nim |
12:05:28 | * | Guest83394 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
12:08:18 | * | RoBz28 joined #nim |
12:09:50 | * | RoBz28 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
12:10:05 | * | ThiefMaster7 joined #nim |
12:11:11 | * | ThiefMaster7 quit (Remote host closed the connection) |
12:11:58 | * | weq28 joined #nim |
12:12:40 | * | weq28 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
12:12:59 | * | sn0wmonster3 joined #nim |
12:13:21 | * | sn0wmonster3 quit (Remote host closed the connection) |
12:14:05 | * | beaver23 joined #nim |
12:18:35 | * | ecks9 joined #nim |
12:18:57 | * | beaver23 quit (Ping timeout: 240 seconds) |
12:19:16 | * | ecks9 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
12:23:20 | * | riidom_ joined #nim |
12:25:34 | * | riidom quit (Ping timeout: 260 seconds) |
12:28:08 | * | gildarts_ joined #nim |
12:28:20 | * | gildarts_ is now known as Guest3376 |
12:29:24 | * | Guest3376 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
12:35:23 | * | Turbo-Folker joined #nim |
12:37:02 | * | xet7 joined #nim |
12:41:05 | * | Turbo-Folker quit (Ping timeout: 240 seconds) |
12:41:41 | * | pointfree3 joined #nim |
12:42:32 | * | pointfree3 quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
13:15:37 | * | Vladar quit (Quit: Leaving) |
13:32:10 | * | Vladar joined #nim |
13:50:54 | * | drazan quit (Remote host closed the connection) |
13:54:12 | * | drazan joined #nim |
13:58:15 | * | BitPuffin joined #nim |
14:01:34 | * | krux02 joined #nim |
14:18:54 | * | rtard quit (Quit: Leaving) |
14:20:51 | * | endragor joined #nim |
14:25:25 | Araq | yay, biggest showstopper bug seems to be fixed |
14:27:49 | * | endragor quit (Remote host closed the connection) |
14:42:50 | * | smt_ joined #nim |
14:44:47 | zacharycarter[m] | 😃 |
14:46:35 | * | smt` quit (Ping timeout: 268 seconds) |
14:52:47 | * | rtarded joined #nim |
14:52:47 | * | MyMind joined #nim |
14:52:54 | rtarded | Hello |
14:53:22 | * | Sembei quit (Ping timeout: 268 seconds) |
14:53:23 | rtarded | Is there a list of value/object types out there? For example, are slices value types or objects? |
14:54:55 | leorize | rtarded: https://nim-lang.org/docs/system.html#HSlice |
14:55:39 | rtarded | ty |
14:55:45 | rtarded | extends object |
14:55:47 | rtarded | so yea |
14:56:21 | rtarded | guys, are there list comprehensions in nim? |
14:57:25 | leorize | it's in the `future` module |
14:58:04 | rtarded | great, ty |
14:59:24 | rtarded | the syntax is terrible though |
14:59:28 | rtarded | not very intuitive |
15:03:07 | krux02 | rtarded, don't use that list comprehension |
15:03:15 | rtarded | krux02 |
15:03:21 | rtarded | which one should one use? |
15:03:53 | krux02 | there is none |
15:04:34 | leorize | then why shouldn't one use that lc? |
15:04:52 | Araq | leorize, cause we like to deprecate it |
15:05:24 | Araq | rtarded, https://nim-lang.org/docs/system.html "Group by type" |
15:06:48 | krux02 | Araq: I think that list comprehension should be deprecated now, just to make a situation like today not happen anymore. |
15:07:03 | rtarded | why do you guys hate them so much? |
15:07:18 | krux02 | Nim has python syntax people assume that there are python like features and then go for that lc |
15:07:18 | Araq | krux02, well better offer something better first. any ideas? |
15:07:51 | Araq | rtarded, cause they are not good enough. |
15:07:55 | krux02 | I can write a marco for that |
15:07:58 | rtarded | got it |
15:08:08 | Araq | krux02, how? :-) |
15:08:20 | Araq | my own attempts failed |
15:08:27 | krux02 | well list comprehenion isn't very special |
15:08:29 | Araq | well I tried to extend the language core |
15:08:40 | Araq | and it was messier than expected |
15:08:44 | krux02 | it is just the special syntax that a macro could not do |
15:09:56 | krux02 | it is just this ``listCoprehension(<expr>, <ident>, <iteratorExpr>)`` |
15:10:34 | krux02 | does everything list comprehension does, except the syntax |
15:10:46 | Araq | toSeq ? |
15:11:01 | krux02 | almost |
15:11:27 | Araq | what does it translate to? |
15:14:10 | krux02 | (var tmp = newSeq[type(<expr>)](); for <ident> in <iteratorExpr>: tmp.add(<expr>)) |
15:14:11 | * | FromGitter quit (Remote host closed the connection) |
15:14:25 | Araq | ok, so it does produce a seq |
15:14:26 | * | FromGitter joined #nim |
15:14:31 | krux02 | yes |
15:14:49 | krux02 | that is the point |
15:15:00 | Araq | what's the difference to toSeq? |
15:16:08 | krux02 | toSeq only has the <iteratorExpr>, list comprecenison has the trasformation in <expr> |
15:16:51 | krux02 | other programming languages have ``map`` that does the exact same thing. |
15:17:09 | krux02 | for example in scala: |
15:17:11 | Araq | sounds like it's a toSeqIt |
15:17:42 | Araq | which is the same as mapIt |
15:17:43 | krux02 | (1 to 100).map(x => sin(x) + cos(x)) |
15:18:32 | krux02 | what is a toSeqIt for you? |
15:19:00 | krux02 | the same as my listComprehension but with <ident> always as `it`? |
15:19:11 | Araq | I think so |
15:20:28 | krux02 | yea I think that would work. |
15:20:31 | Araq | for x in a # if not an iterator, rewritten to 'for x in items(a)' |
15:20:57 | krux02 | isn't that what the compiler automatically does( |
15:20:59 | krux02 | ? |
15:21:00 | Araq | case x # if not known, rewritten to 'case match(x)' |
15:21:21 | Araq | # but the 'match' also gets the of-branches in the second parameter |
15:21:37 | Araq | did I finally sovle pattern matching for Nim? |
15:21:47 | krux02 | I don't know. |
15:21:49 | * | askatasuna left #nim ("WeeChat 2.0.1") |
15:21:53 | krux02 | I really have to think about it. |
15:22:15 | Araq | I think I did. :P |
15:23:08 | krux02 | well maybe |
15:23:28 | krux02 | I think about pattern matching with regular expressions |
15:24:18 | krux02 | I think it would be best when there are multiple patterns, that all regular expressions are joined into a single regular expression, so that matching can be done more efficiently. |
15:24:36 | krux02 | I realized that in my ast pattern matching. |
15:24:54 | Araq | that's a solved problem, look at lexim which tries to follow the state of the art for regexes |
15:25:09 | krux02 | it is not very efficient to look sequential through all patterns, when the patterns could also be joined into a single state machine. |
15:26:18 | krux02 | well it is also not hard to do, it just needs a view of the pattern matching that sees the entire matching tree |
15:26:28 | Araq | yup |
15:26:29 | krux02 | compining regular exprissions isn't hard |
15:26:49 | Araq | it is, but it's also well documented |
15:26:49 | krux02 | (<expr1>)|(<expr2>)|... |
15:27:14 | Araq | Hopcroft's algorithm for DFA optimization |
15:27:20 | krux02 | the hard part is then done in the regular expression library |
15:28:02 | krux02 | I would just need to test which subexpression actually matched. |
15:28:04 | Araq | or you use Lexim which uses the real algorithms, not the NP complete ones |
15:28:12 | * | endragor joined #nim |
15:28:19 | krux02 | I think this regular expression joining is regularly done within emacs. |
15:29:43 | krux02 | NP complete is an attribute of a problem, not an algorithm |
15:30:01 | * | endragor quit (Remote host closed the connection) |
15:30:10 | krux02 | so just doing a different algorithm won't make NP complete to anything else |
15:31:00 | Araq | iirc it's only NP complete when you allow for backreferences |
15:31:01 | krux02 | transforming a NFA into a DFA is potentionally exponential, because every state combination is possible. |
15:31:13 | Araq | which regexes usually do and lexer generators usually don't |
15:32:06 | Araq | NFA to DFA is exponential but it's done at compile-time and then you optimize the DFA to the bare mimimum |
15:32:36 | krux02 | backreferences are not part of computer science regular expressions |
15:32:44 | Araq | NFA to DFA is only possilbe when you don't have backrefs nor submatches iirc |
15:33:06 | Araq | comp-science regexes are totally unlike "real" regexes :P |
15:35:07 | * | themagician joined #nim |
15:35:27 | krux02 | well I still don't think that as a programmer need to do anything but merging the expressions into a bigger expression and then let the regular expression library handle the rest. |
15:35:55 | krux02 | It is not like that regular expression libraries haven't been around for decades reliably. |
15:36:05 | Araq | as I tried to tell you. |
15:36:26 | Araq | a regex library solves a slight different problem. |
15:36:36 | Araq | *slightly |
15:41:29 | krux02 | well apart from that I think I kind of should finish the sizeof alignof thing in the compiler |
15:41:37 | krux02 | there was quite some activity recently. |
15:42:09 | krux02 | Not really helping at actually fixing any problems with it, but it showed people really want it. |
15:42:13 | krux02 | Me included |
15:42:25 | Araq | yeah, go for it |
15:42:58 | krux02 | For it to work correctly, I think I need a pragma for c2nim struct types. |
15:43:20 | Araq | why? |
15:44:11 | rtarded | Could somebody please tell me what this is? proc high*(x: string): int {.magic: "High", noSideEffect.} ... Calling it on a string gives me the index of the last element, but I don't understand how it's implemented |
15:44:14 | krux02 | the problem that the tests are failing is the extreme rare use case of the tuple (float64,float32) on a 32bit architecture on a specific os, I don't know exactly which one it was. |
15:45:07 | krux02 | rtarded, it just gives you the last element, when you want to find the implementation look for the string mhigh in the compiler or look at the generated C source code. |
15:45:13 | krux02 | the implementation depends on the backend used. |
15:45:13 | * | crayon26 joined #nim |
15:46:19 | * | crayon26 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
15:46:19 | krux02 | Araq: the problem is, float64 does align on some platforms to just 4 bytes, even though on those platforms it should better be aligned to 8 bytes for performance reasons. |
15:47:39 | * | zhongfu14 joined #nim |
15:47:59 | krux02 | the problem is, this exceptional adds a lot of complexity to be handled when in reality nobody really cares about it. |
15:48:20 | * | zhongfu14 quit (Remote host closed the connection) |
15:48:31 | krux02 | there is a compier flag for gcc x86 that makes all float64 self aligned (8 bytes) |
15:49:18 | krux02 | that would make dealing with all these weird special cases unnecessary. |
15:49:30 | krux02 | the only problem is, interfacing with C structs |
15:50:23 | krux02 | when a struct is from an actual C version ported over to nim and needs ABI, then the alignment should be like in C. |
15:50:53 | krux02 | for those types I would then say at compile time "can't figure out alignment of C types" |
15:50:56 | * | vdamewood joined #nim |
15:51:17 | krux02 | but that requires a tag for c2nim types |
15:52:05 | * | vdamewood quit (Remote host closed the connection) |
15:52:45 | krux02 | another pragmatic approach would be to just put in the docs "in Nim all basic types are self aligned" |
15:54:01 | krux02 | so when someone wants to use a C type with binary compatibility then it will probably just work because the difference is really a rare thing, But when it matters, they are in hell to find out about this difference |
15:54:58 | * | arecaceae quit (Remote host closed the connection) |
15:55:16 | * | arecaceae joined #nim |
15:57:00 | rtarded | Guys, is there a 'map' function that works on any iterable? string,seq, set, etc |
15:58:44 | rtarded | I guess not |
15:58:51 | Araq | krux02, I fail to see the problem. we know what the C compiler does for the particular platform and need to follow it |
15:59:02 | Yardanico | rtarded, mapIt ? |
15:59:09 | Yardanico | ah, any iterable |
15:59:35 | Yardanico | well, you can create your own using concepts ;) |
16:00:12 | rtarded | Yardanico, is there a "supertype" of all iterables? |
16:00:54 | Yardanico | rtarded, there's not, but a lot of types have `items` proc defined |
16:01:31 | Yardanico | rtarded, so you can create Iterable concept like that - https://github.com/Yardanico/nimpylib/blob/master/src/pylib.nim#L8 |
16:01:38 | Yardanico | (items here is called implicitly) |
16:01:39 | rtarded | can I create a method that only accepts (compile type) calls with objects that have items() defined? |
16:02:00 | Yardanico | yes, but *proc (not method) |
16:02:13 | Yardanico | with concepts you can do that |
16:02:45 | rtarded | oh, nice feature. Saw your code |
16:02:49 | rtarded | yeah, cool |
16:02:59 | * | basic`11 joined #nim |
16:03:03 | rtarded | ty |
16:03:04 | Yardanico | concepts are compile-time only |
16:04:02 | * | tacocat16 joined #nim |
16:04:51 | * | basic`11 quit (Remote host closed the connection) |
16:06:02 | * | tacocat16 quit (Remote host closed the connection) |
16:07:03 | * | Notkea quit (Remote host closed the connection) |
16:07:38 | * | Notkea joined #nim |
16:11:20 | rtarded | Yardanico. You seem to be really advanced in nim. If you don't mind, for how long have you been using the language? |
16:13:02 | Yardanico | rtarded, well, I wouldn't say that I'm really advanced in the languagy (maybe only in some high-level parts), I've been actually using it since the start of 2017 but not always actively, so actually maybe 3-7 months of active usage |
16:13:17 | rtarded | dayum |
16:13:41 | rtarded | how many years of programming experience (any lang) do you have? |
16:14:57 | Yardanico | rtarded, I've been only using Python (for like 1 year, but not always actively) before I learned that Nim exists :) |
16:15:09 | Yardanico | I wouldn't say that I'm actually a pro in Nim |
16:15:48 | rtarded | No, I was basically asking, how many years of programming experience you have in total (no just in nim or nim like langs) |
16:16:45 | krux02 | Araq: I just relized I already implemented that stupid logic: https://github.com/krux02/Nim/blob/7a9419b409f77fd94781d8ced38fe629da3b260a/compiler/sizealignoffsetimpl.nim#L244 |
16:16:51 | krux02 | but then I don't know what is failing |
16:17:08 | * | LooCfur joined #nim |
16:17:23 | Yardanico | rtarded, maybe 1 year of _actual_ programming experience in all languages :) |
16:17:35 | rtarded | that's really impressive |
16:17:39 | rtarded | nice |
16:17:45 | Yardanico | well, nim is very simple :) |
16:18:21 | Araq | that's not true. but you can safely use a simple subset |
16:18:31 | Araq | and more and more gotchas are eliminated. |
16:19:40 | * | LooCfur quit (Remote host closed the connection) |
16:23:54 | rtarded | yea, it's definitely not simple. It's got way too many concepts. It's much more complicated that anything I've toyed with (C#, Kotlin) |
16:25:49 | Araq | dunno about Kotlin but C# is a complex beast too, it's just exceptionally good at hiding its complexity |
16:26:16 | Araq | the superior tooling definitely helps too |
16:28:31 | Araq | rtarded, what would you remove from Nim? |
16:28:53 | Araq | (THE question these days.) |
16:29:13 | * | moigagoo joined #nim |
16:29:57 | Araq | moigagoo, what would you remove from Nim? |
16:30:14 | rtarded | I don't know enough about it to be able to answer that question, but I'm simply scared by the amount of features I've never seen in other languages: pragmas, templates, macros, concepts and more |
16:30:15 | FromDiscord | <treeform> I would remove the bugs 😃 |
16:30:45 | rtarded | lol |
16:30:52 | Araq | treeform: fair enough. |
16:31:16 | Araq | rtarded, pragmas are C#'s annotations |
16:31:35 | Araq | the rest may indeed be new to you. |
16:33:12 | * | CC660 joined #nim |
16:36:36 | Araq | krux02, good news, the GC can finally deal with the new nil/empty strings |
16:36:58 | Araq | so isNil can now be deprecated |
16:38:25 | * | CC660 quit (Ping timeout: 248 seconds) |
16:38:28 | * | moigagoo quit (Quit: Mutter: www.mutterirc.com) |
16:41:02 | * | xboner13 joined #nim |
16:41:42 | * | xboner13 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
16:46:46 | krux02 | you mean all instances of ``isNil``? |
16:48:21 | Araq | obviously not. |
16:48:24 | krux02 | rtarded, the templates are very similar to ``macros`` in C, the generics are very similar to c++ templates, and macros, yea don't worry about it in the beginning it just enables great libraries to exist |
16:48:28 | Araq | the isNil for strings and seqs |
16:49:18 | krux02 | Araq: ``template isNil(x: string | seq): bool = false`` |
16:49:36 | Araq | it's better to deprecate it |
16:49:41 | Araq | code needs to be adapted |
16:49:59 | krux02 | yes, that, too. |
16:51:58 | rtarded | ty krux02, Araq |
16:52:41 | rtarded | Guys. Is there an == operator for custom types? Looked into system but I can only find one for primitive types. Where is the == that is called for seqs, arrays and custom types? |
16:53:45 | * | Tools1 joined #nim |
16:55:06 | krux02 | yes there is |
16:55:16 | krux02 | proc `==`*[T: tuple|object](x, y: T): bool = |
16:55:36 | * | Tools1 quit (Remote host closed the connection) |
16:56:40 | rtarded | yeah, the search function only showed the ones for primitive types for some reason |
16:56:42 | rtarded | silly me |
16:56:57 | * | moigagoo joined #nim |
16:58:27 | rtarded | also. How can I check if two vars point to the same heap object? THe == method seems to compare the fields |
17:01:16 | * | moigagoo quit (Client Quit) |
17:03:20 | * | stefanos82 joined #nim |
17:06:42 | * | nkelly joined #nim |
17:09:39 | * | nekits quit (Ping timeout: 260 seconds) |
17:11:02 | krux02 | rtarded, they don't |
17:11:11 | krux02 | object and tuple are not on the heap |
17:11:37 | krux02 | rtarded, or ref and ptr types you can call ``==`` and that compares the memory location |
17:12:11 | rtarded | krux02, and what if you want to compare the values of two ref type objects? |
17:12:26 | krux02 | you can unref them with [] |
17:12:43 | rtarded | a[] == b[]? Something like that? |
17:12:47 | krux02 | yes |
17:12:47 | * | moigagoo joined #nim |
17:12:49 | rtarded | ty |
17:14:01 | * | EastByte quit (Quit: WeeChat 2.0.1) |
17:15:16 | krux02 | rtarded, something that comes up all the time, people want to prevent memory copies and pass an object type as a point to a function or something like that. Don't do that Nim does that automatically for yout. |
17:15:44 | * | EastByte joined #nim |
17:16:52 | rtarded | so you're saying that passing an int to a method that doesn't declare the param with var doesn't copy the value? |
17:16:59 | rtarded | weird |
17:17:18 | * | moigagoo quit (Client Quit) |
17:18:16 | rtarded | and also, is there any difference between proc x(y: ref int) and proc x(y: var int)? |
17:18:38 | krux02 | an int is passed by valcue |
17:18:40 | krux02 | value |
17:18:53 | krux02 | yes there is a difference |
17:19:20 | krux02 | ref int can only handle ints that are allocated on the heap |
17:19:25 | krux02 | (gc heap) |
17:20:55 | * | Phanes joined #nim |
17:20:59 | * | avsej_ joined #nim |
17:21:00 | * | avsej_ quit (Changing host) |
17:21:00 | * | avsej_ joined #nim |
17:21:10 | * | avsej quit (Ping timeout: 240 seconds) |
17:21:10 | * | avsej_ is now known as avsej |
17:22:27 | * | Phanes quit (Remote host closed the connection) |
17:24:59 | * | rtard joined #nim |
17:26:48 | * | rtarded quit (Disconnected by services) |
17:27:06 | * | rtard left #nim (#nim) |
17:27:18 | * | rtarded joined #nim |
17:27:23 | rtarded | . |
17:27:29 | rtarded | krux02 |
17:27:40 | rtarded | how can I create an int on the heap? |
17:27:45 | rtarded | var nHeap: ref int = new(int(10)) |
17:27:50 | rtarded | something like this doesn't work |
17:28:23 | * | shodan45 quit (Quit: No Ping reply in 180 seconds.) |
17:28:23 | * | federico3 quit (Ping timeout: 256 seconds) |
17:28:26 | rtarded | neither does this |
17:28:27 | rtarded | type CoolInt = ref object of int |
17:29:38 | rtarded | this worked: var nHeap: ref int = new(int) |
17:29:38 | rtarded | nHeap[] = 200 |
17:29:51 | Araq | yeah but it's bad. don't allocate ints on the heap |
17:30:01 | Araq | use a 'var' parameter if you need the mutability |
17:30:09 | * | shodan45 joined #nim |
17:30:33 | Araq | shodan45! SS3 is confirmed! |
17:30:36 | * | federico3 joined #nim |
17:31:57 | * | BitPuffin quit (Ping timeout: 240 seconds) |
17:33:45 | rtarded | I think i've found a bug |
17:35:03 | FromGitter | <kayabaNerve> If I have ⏎ Pointer -> C struct -> Pointer -> ref object ⏎ And I'm deleting the pointer of the struct (which I can't since other objects use it but the GC doesn't track that), but a memcopy doesn't cover the pointer in the struct, is my best bet to use GC_ref and GC_unref to manually add/remove references? |
17:36:06 | FromGitter | <kayabaNerve> Or a custom reference system since I don't care about the ref object but the pointer in the ref object? |
17:36:33 | FromGitter | <kayabaNerve> Currently I'm thinking custom, added ref on \`=\`, removed ref on destruction. |
17:36:40 | rtarded | Araq: is this expected? https://pastebin.com/bABGpbEN |
17:37:11 | Araq | rtarded, yes, refs are not vars |
17:37:32 | rtarded | I am confused |
17:37:33 | Araq | ff2(nHeap[]) works |
17:37:46 | rtarded | didn't I create a ref Animal and a ref int? |
17:37:48 | * | gangstacat quit (Ping timeout: 256 seconds) |
17:37:49 | * | Cthalupa quit (Ping timeout: 256 seconds) |
17:37:57 | FromGitter | <kayabaNerve> The function definition has var int though |
17:38:02 | FromGitter | <kayabaNerve> You have a var ref int |
17:38:04 | rtarded | in the first case, passing a ref Animal to the var method, it works |
17:38:04 | * | to joined #nim |
17:38:20 | FromGitter | <kayabaNerve> Because it's a ref object |
17:38:27 | FromGitter | <kayabaNerve> var Animal = var ref object |
17:38:28 | * | to is now known as Guest70117 |
17:38:48 | FromGitter | <kayabaNerve> But you have var int when you're passing var ref int |
17:38:56 | * | leorize1 joined #nim |
17:38:56 | * | leorize quit (Ping timeout: 256 seconds) |
17:38:59 | Araq | proc ff2(num: var ref int) would work too |
17:39:10 | Araq | and resemble your 'printColor' definition |
17:39:12 | * | Cthalupa joined #nim |
17:39:18 | * | gangstacat joined #nim |
17:39:27 | Araq | it's 100% consistent. |
17:40:12 | rtarded | you are right, it took me some time to understand my stupidity |
17:40:17 | rtarded | proc printColor(animal: var ref Animal) = |
17:40:18 | rtarded | yay |
17:40:23 | rtarded | now the call fails |
17:40:28 | rtarded | which is expected |
17:40:29 | rtarded | ty |
17:41:19 | rtarded | also, is there any difference between "new(Animal); a.color = "red"" and "Animal(color:"red")"? |
17:41:29 | FromGitter | <kayabaNerve> Nope |
17:41:47 | Araq | the latter is much better for the compiler to reason about |
17:43:11 | * | BlaXpirit joined #nim |
17:43:36 | * | Amun_Ra quit (Ping timeout: 256 seconds) |
17:43:36 | * | oprypin quit (Ping timeout: 256 seconds) |
17:43:37 | * | BlaXpirit is now known as oprypin |
17:44:01 | * | Guest70117 quit (Ping timeout: 248 seconds) |
17:44:34 | * | Amun_Ra joined #nim |
17:45:05 | * | moigagoo joined #nim |
17:48:11 | * | Taylor7 joined #nim |
17:48:18 | * | moigagoo quit (Client Quit) |
17:48:41 | * | Taylor7 quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
17:49:41 | * | PMunch joined #nim |
17:53:37 | rtarded | Ty guys. Also: how is proc ff3(num: var ref int) different from proc ff1(num: ref int). proc ff2(num: var int) seems to let me update num, even though it might be on the stack. Is there any added benefit in ff3? |
17:55:57 | Araq | only ff2 is idiomatic. |
17:57:17 | rtarded | yeah. That one seems to work as I would expect, with both stack and head allocated ints. |
17:58:32 | rtarded | but obviously, I have to dereference the ref int in the call |
17:59:14 | * | xet7 quit (Quit: Leaving) |
18:02:27 | * | death916 quit (Ping timeout: 240 seconds) |
18:04:30 | * | Death916 joined #nim |
18:07:41 | rtarded | Guys: why does this work "proc init(): Animal = |
18:07:41 | rtarded | new(result)", but this doesn;t var a1 = new(Animal(color:"")) |
18:08:09 | Araq | because 'new' is not at all as C#'s new |
18:08:16 | Araq | *like |
18:09:50 | * | Thanks joined #nim |
18:09:57 | * | krushia joined #nim |
18:10:09 | rtarded | it's a bit weird though. It seems that at that point (in the call), result is actually null, not an "empty" animal |
18:10:17 | rtarded | but calling new(nil) fails |
18:10:19 | * | Thanks quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
18:10:59 | rtarded | oh |
18:11:01 | Araq | what the heck would 'new(nil)' do? |
18:11:25 | rtarded | why should new(result) when result is nill work? |
18:11:39 | rtarded | I just saw that new actually takes a ref |
18:11:48 | Araq | 'new' takes a 'var ref' :P |
18:11:49 | rtarded | so it probably cares about the type not of the |
18:11:55 | rtarded | value |
18:12:00 | Araq | it cares about both |
18:13:28 | rtarded | does it clone it if it's not nil? |
18:14:35 | * | krushia quit (Ping timeout: 240 seconds) |
18:15:00 | rtarded | anyway. I'm the fact that new(result) works and something like "var a1 = Animal(color:"") |
18:15:01 | rtarded | discard new(a1)" does not |
18:15:28 | * | moigagoo joined #nim |
18:15:45 | rtarded | or even "var a1: Animal= nil |
18:15:45 | rtarded | discard new(a1)" |
18:17:01 | Araq | there is nothing to clone, new(x) sets x to a newly allocated heap object of the type of x |
18:17:42 | Araq | it takes a 'var ref T', so it mutates the ref pointer itself |
18:17:52 | Araq | and not what it may point to. |
18:18:10 | * | moigagoo quit (Remote host closed the connection) |
18:18:36 | rtarded | you previous said that new also cares about the underlying value, not just about the type, so I guessed (wrongly) that if the value exist, it copies the fields |
18:18:43 | Araq | new(x) is the same as x = type(x)() |
18:19:16 | stefanos82 | Araq: is type(T) something like C++'s decltype(T)? |
18:19:18 | Araq | well it cares about the value of the pointer as it needs it to overwrite it ... something like that |
18:19:30 | rtarded | anyways. If new (x) creates a new object based on the type of x, shouldn't "var a1: Animal= nil |
18:19:30 | rtarded | ; discard new(a1)" (outside of proc) also work? |
18:19:30 | Araq | stefanos82, also known as 'typeof' yes |
18:19:40 | stefanos82 | yep, like GCC's typeof() extension |
18:20:08 | Araq | rtarded, 'discard new(a1)' should not work as 'new' does not return anything that could be discarded |
18:20:38 | rtarded | Araq: var a2 = new(a1) then, but it still fails to compile |
18:21:21 | rtarded | "expression new(a1) has no type or is ambiguous" |
18:21:43 | rtarded | for var a2:Animal = new(a1), same err |
18:21:51 | Araq | same err, same reason |
18:22:12 | Araq | 'new' doesn't return a value it mutates the pointer you pass to it |
18:22:26 | Araq | (except for the other variant of 'new' that we will deprecate) |
18:22:44 | rtarded | lmao. I finally understand what you are tying to say. Srry (check out my nickname) |
18:24:06 | Araq | if it helps you, I can tell you, you are not retarded. |
18:24:42 | Araq | 'new' is a confusing beast at first, coming from Delphi and not from C++, C#, Java... |
18:26:10 | * | moigagoo joined #nim |
18:30:37 | * | moigagoo quit (Client Quit) |
18:32:04 | krux02 | Araq: I currently resolve merge conflics for sizeof alignof branch, this is something i noticed: http://ix.io/1jbE |
18:32:26 | krux02 | or a bit more contexthttp://ix.io/1jbF |
18:32:42 | krux02 | did the assignment node change? |
18:33:16 | * | yglukhov[i] joined #nim |
18:33:29 | krux02 | can an assignment be something be a different symbol than `=`? |
18:33:51 | krux02 | wasn't it even that the nnkAsgn doesn't even list the assignment symbol, it just has two children? |
18:42:33 | * | moigagoo joined #nim |
18:47:05 | * | bthesorceror joined #nim |
18:47:54 | * | moigagoo quit (Remote host closed the connection) |
18:56:10 | Araq | well nkAsgn is not mAsgn |
18:56:40 | Araq | nkAsgn has 2 children, mAsgn in the assignment operator `=`(a, b) |
18:56:46 | Araq | and so would have 3 children |
18:59:33 | * | smt_ quit (Ping timeout: 244 seconds) |
18:59:39 | krux02 | Araq: is there another assignment operator than `=`? |
18:59:57 | * | bthesorceror quit (Ping timeout: 240 seconds) |
19:01:49 | * | yglukhov[i] quit (Remote host closed the connection) |
19:02:43 | * | clyybber joined #nim |
19:02:51 | Araq | krux02, it has 2 different representations |
19:03:05 | Araq | a "call of the '=' operator" representation |
19:03:18 | Araq | and then the 'a = b' assignment nkAsgn |
19:03:43 | Araq | same is true for overloaded [], []= operators |
19:04:53 | FromGitter | <imdaveho> hi all, trying to use the terminal from stdlib to create a similar lib as termbox, just two quick questions after toying around...1) can't seem to specify the color to print out with writeStyled, and even without passing in a style, the text output is black not white...2) does getch() also handle modifer keys like shift, alt, and ctrl? |
19:09:36 | Araq | sorry, I don't know |
19:11:47 | clyybber | Araq Would it make sense to implement generic procs as syntactic sugar for typedescs? |
19:11:54 | * | rtarded quit (Quit: Leaving) |
19:12:02 | * | rtarded joined #nim |
19:12:11 | * | rtarded quit (Client Quit) |
19:12:39 | * | yglukhov[i] joined #nim |
19:12:50 | Araq | what do you mean? |
19:13:25 | * | Jesin quit (Remote host closed the connection) |
19:15:06 | * | clyybber quit (Quit: good night) |
19:15:16 | * | endragor joined #nim |
19:16:39 | * | clyybber joined #nim |
19:17:07 | * | moigagoo joined #nim |
19:19:47 | * | moigagoo quit (Client Quit) |
19:20:02 | * | kungtotte joined #nim |
19:20:50 | * | ozy1 joined #nim |
19:20:57 | * | clyybber quit (Ping timeout: 240 seconds) |
19:21:54 | * | rtarded joined #nim |
19:22:13 | rtarded | Guys. Is there an universal way for listing all of the running processes? |
19:23:10 | rtarded | * not those started via Nim |
19:23:20 | rtarded | os process list |
19:23:30 | rtarded | something like ps in linux |
19:23:57 | * | ozy1 quit (K-Lined) |
19:28:32 | FromGitter | <rayman22201> @krux02 thanks for working on the alignof |
19:28:43 | FromGitter | <rayman22201> I'm excited about that pr |
19:33:46 | Araq | rtarded: nah, that's beyond the stdlib's reach |
19:33:55 | rtarded | ok |
19:55:30 | * | clyybber joined #nim |
19:55:52 | * | kaushalmodi joined #nim |
19:59:06 | FromGitter | <Bennyelg> (https://files.gitter.im/nim-lang/Nim/SIHa/image.png) |
19:59:43 | krux02 | rtarded, to list all running processes just run "ps -aux" on the terminal |
19:59:47 | FromGitter | <Bennyelg> (https://files.gitter.im/nim-lang/Nim/mDmv/image.png) |
19:59:55 | FromGitter | <Bennyelg> niming for fun |
20:00:11 | clyybber | Araq I mean the idea that "proc foo[T](a: T)" gets transformed to "proc foo(T: typedesc, a: T)" |
20:00:30 | rtarded | krux02, yes I know. I was looking for a Nim way of getting a list of osproc.Process instances, no matter the platofrm |
20:00:34 | krux02 | clyybber, why would you want that? |
20:00:35 | clyybber | And if it would make sense to implement generics for procs that way |
20:01:05 | krux02 | rtarded, Windows has a linux subsystem now, doesn't it? |
20:01:21 | krux02 | well my hint is probably not very useful |
20:01:35 | krux02 | clyybber, why? |
20:01:36 | rtarded | yes, but I want to list the Windows processes, not those in Ubuntu |
20:01:48 | clyybber | I thought it would make the generics implementation for procs easier. |
20:01:54 | krux02 | I don't know |
20:02:02 | rtarded | anyway. I'll use tasklist in Windows, and parse it via regex |
20:02:08 | krux02 | all programming I did on windows was Basic |
20:02:17 | krux02 | ok not entirely true, but generally |
20:02:51 | clyybber | krux02 I thought it would make the implementation of generic procs simpler |
20:03:10 | krux02 | clyybber, well I don't think so at all |
20:03:38 | clyybber | Yeah thats why I am asking, because I have no idea if thats a good idea |
20:03:47 | krux02 | I think it is better if you treat the type T not as a value expression. |
20:04:01 | krux02 | clyybber, probably not |
20:04:45 | krux02 | ``proc foo[T](a: T)`` is something I understand, ``proc foo(T: typedesc, a: T)`` seems very obscure to me |
20:05:11 | krux02 | typedesc are generic, too |
20:05:23 | krux02 | they have a hidden generic argument |
20:05:36 | krux02 | so if you want the typedescriptor, it is internally something like this |
20:05:53 | krux02 | ``proc foo[T](t: typedesc[T], a: T)`` |
20:06:05 | krux02 | I don't see where that helps you anywherer at all. |
20:06:25 | clyybber | I see, it doesn't |
20:06:45 | rtarded | Guys: is there an easy way of consuming an iterator? Looking for something other that a "for loop" solution if possible. myIt().items() doesn't work |
20:07:10 | clyybber | krux02 How are procs with multiple typedesc arguments represented internally |
20:07:12 | clyybber | ? |
20:07:30 | krux02 | clyybber, with multiple generics |
20:08:27 | krux02 | rtarded, iterators are consumed with a for loop, that is what they are there for. But you write a template/macro that generates the for loop for you if you prefer that. |
20:08:44 | clyybber | krux02 So in essence typedescs are kind of syntactic sugar for generics? |
20:08:49 | rtarded | Went for the loop solution. Ty |
20:09:02 | krux02 | clyybber, ``proc foo[A,B](a: typedesc[A], b: typedesc[B])`` |
20:09:17 | krux02 | clyybber, not really |
20:09:35 | krux02 | not at all I would rather say |
20:10:03 | krux02 | typedesc are one of the weakly designed parts of the Nim language, so it would be nice if you try to avoid them as much as you can. |
20:10:36 | krux02 | what I think typedesc arguments are good far are cases where you want to map from type to some value at compile time |
20:10:41 | krux02 | then you can write a template |
20:10:50 | * | FromGitter quit (Remote host closed the connection) |
20:10:56 | clyybber | krux02 I see |
20:11:05 | * | FromGitter joined #nim |
20:11:16 | krux02 | ``template typeattribute(_ : typedesc[int]): string = "it is an int"`` |
20:11:49 | krux02 | ``template typeattribute(_ : typedesc[float]): string = "wow, it is a float impressive"`` |
20:12:13 | Araq | they are not weakly designed, but they are super subtle |
20:12:15 | krux02 | then you can get the typeattribute with typeattribute(int) |
20:12:24 | krux02 | or typeattribute(type(myvar)) |
20:12:26 | Araq | in fact, I often don't know what to do with them :P |
20:12:34 | Araq | "cannot interpret ..." |
20:12:44 | clyybber | krux02 Can we say that "proc foo(a: typedesc)" is syntactic sugar(/salt) for "proc foo[A](a: typedesc[A])" ? |
20:13:00 | krux02 | clyybber, yes |
20:13:25 | krux02 | you can do that generally in Nim |
20:13:30 | krux02 | not just with typedesc |
20:13:35 | clyybber | krux02 Ok thank you. I think this is implemented very elegant then |
20:13:49 | krux02 | but I prefer to write the generic argument |
20:14:24 | * | Guest65578 joined #nim |
20:14:35 | clyybber | krux02 Yeah it differentiates types from actual values, i guess thats good |
20:15:20 | * | xylef joined #nim |
20:15:47 | clyybber | Araq What do you mean with "cannot interpret ..."? |
20:16:12 | * | Guest65578 quit (Read error: Connection reset by peer) |
20:16:42 | Araq | it's a famous bug error message |
20:19:26 | * | kungtotte quit (Quit: leaving) |
20:20:43 | * | endragor quit (Remote host closed the connection) |
20:22:34 | * | bthesorceror joined #nim |
20:22:47 | krux02 | Araq: how do I get a ContextRef from a PContext? |
20:23:58 | rtarded | Guys. Is import osproc supposed to fail in "nim secret"? |
20:24:46 | krux02 | rtarded, nim secret is a secrat |
20:24:50 | krux02 | so nothing is supported |
20:24:57 | rtarded | okay |
20:25:10 | krux02 | be lucky if something works |
20:31:50 | FromGitter | <kayabaNerve> Can I overload `=` for a ref object or assign a custom destructor/finalizer to an object? |
20:37:29 | * | Vladar quit (Remote host closed the connection) |
20:37:56 | * | Vladar joined #nim |
20:38:53 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
20:39:09 | krux02 | kayabaNerve: well better if you don't do it |
20:39:28 | krux02 | it is again one of the weaker things in Nim. |
20:39:41 | * | yglukhov[i] joined #nim |
20:40:07 | krux02 | it is better if you design your types in a way thet the default assignment works, and that you don't need spcial finalizers. |
20:42:11 | * | rockcavera quit (Remote host closed the connection) |
20:43:07 | FromGitter | <kayabaNerve> ... I can't? It's a wrapper. |
20:44:12 | FromGitter | <kayabaNerve> I solved my ref/destroy issue. Now I'm stuck with `cannot bind another '=' to: BN` |
20:45:20 | * | xet7 joined #nim |
20:46:29 | FromGitter | <kayabaNerve> BN is an `object` defined in that file. It has no other `=` defined anywhere. The function definition is: `proc \`=\`*(x: var BN, y: BN) =` |
20:47:40 | rtarded | Does anybody know how to install the pcre (for regex) dll? Where should I place is so that the nim compiles sees it by default? |
20:47:44 | rtarded | Windows* |
20:48:14 | FromGitter | <kayabaNerve> Next to the EXE or in your OS folders? |
20:48:49 | rtarded | right, but is it possible to somehow include the necessary code in the ninm executable? Static linking? |
20:49:48 | rtarded | well, I tried copying the dll in mingw's bin folder. I'm not getting the expected results |
20:50:04 | * | Sentreen quit (Ping timeout: 256 seconds) |
20:52:49 | FromGitter | <kayabaNerve> 1) That's not the right place at all. ⏎ 2) I'm pretty sure you can't static link a DLL at compile time. ⏎ 3) There are some ways to do it afterwards but not easily. ⏎ 4) This isn't why DLLs exist. ⏎ 5) If you don't use a DLL but instead compile the source into a .a, you can easily. [https://gitter.im/nim-lang/Nim?at=5b66122185278d705e85cb66] |
20:56:53 | * | iDanoo12 joined #nim |
20:59:28 | * | f17 joined #nim |
21:00:17 | * | craigger quit (Quit: bye) |
21:00:22 | * | f17 quit (Remote host closed the connection) |
21:00:22 | * | iDanoo12 quit (Remote host closed the connection) |
21:00:41 | * | craigger joined #nim |
21:07:33 | * | ng0 joined #nim |
21:12:39 | * | Vladar quit (Remote host closed the connection) |
21:12:59 | * | brainproxy quit (Quit: WeeChat 2.2) |
21:16:51 | * | Sentreen joined #nim |
21:18:09 | FromGitter | <mratsim> @krux02 Personally, I care about aligning float32 to 8 bytes, and Intel also recommends it for efficient tensor and matrix computations: https://github.com/mratsim/Arraymancer/issues/102 |
21:20:32 | rtarded | Guys. How do you refer to methods, types in documentation comments? |
21:21:19 | FromGitter | <mratsim> I don’t understand? You mean link to something? doc comments use .rst formatting |
21:21:46 | rtarded | nevermind. found an example online: ## a short form for ``re(r"[abc]")``. |
21:23:21 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
21:24:52 | krux02 | mratsim: well if you want to align float32 to 8 bytes I think you better put in padding bytes |
21:25:22 | krux02 | rtarded, I usually do ``procname``. |
21:25:55 | krux02 | but be aware the procname alone is not uniquely identifying. |
21:26:40 | FromGitter | <mratsim> @krux02, I need to be able to align tensors of millions of float32 |
21:27:05 | FromGitter | <mratsim> i.e. seq\[float32\] as a backend |
21:28:52 | * | ksft28 joined #nim |
21:29:11 | rtarded | Guys. is there something like nameof() in Nim? Method that returns the name of a variable, class, method |
21:29:24 | rtarded | nameof(int) -> "int" |
21:29:31 | rtarded | so that it aids in refactoring |
21:30:06 | * | ksft28 quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
21:32:06 | rtarded | more like nameof(someCustomProc) |
21:33:17 | * | geocar quit (Quit: Connection closed for inactivity) |
21:33:20 | rtarded | cool |
21:33:28 | rtarded | found name in typetraits |
21:33:28 | FromGitter | <mratsim> I’m pretty sure you are trying a dynamic typing idoms here where it is not needed |
21:33:35 | FromGitter | <mratsim> name is for types only |
21:33:40 | rtarded | oh |
21:33:44 | rtarded | yea |
21:33:47 | rtarded | good enough |
21:33:54 | rtarded | is there any for other constructs? |
21:34:08 | * | nsf quit (Quit: WeeChat 2.2) |
21:34:22 | rtarded | C# has it, and it's statically typed |
21:34:28 | rtarded | and compile time |
21:34:46 | * | NimBot joined #nim |
21:34:49 | FromGitter | <mratsim> in a macro you can use $x to print an ident |
21:35:09 | FromGitter | <mratsim> (i.e. the symbol of anything, variable, type, proc) |
21:35:44 | rtarded | haven't looked into macros yet. will probably look into them tomorrow. I was actually looking for a simple, built in function to achieve this. Ty though |
21:36:07 | FromGitter | <mratsim> That’s called reflection iirc, and really it’s probably not needed |
21:37:22 | FromGitter | <mratsim> you can use fields and fieldpairs as well to access the field of an object via an iterator |
21:40:37 | krux02 | seq[float32] is always 4 byte aligned |
21:40:53 | krux02 | mratsim: why do you want float32 to be 8 byte aligned? |
21:41:08 | FromGitter | <mratsim> because it is faster |
21:41:38 | krux02 | rtarded, there is instanciation info for macros |
21:42:06 | krux02 | mratsim I don't think so, it would mean that you would waste 50% of the memory |
21:42:31 | krux02 | so you might end up being memory mound |
21:42:33 | krux02 | bound |
21:43:45 | FromGitter | <mratsim> no, I mean, the first float should start on a 8 byte boundary |
21:43:51 | rtarded | Does anybody know why: assert running("notepad.exe").not() works but assert not(running("notepad.exe")) does not? |
21:43:52 | FromGitter | <mratsim> then everything else is packed |
21:44:06 | krux02 | mratsim: that is something that works by default |
21:44:18 | krux02 | allocation is done in blocks and those are bigger than 8 bytes |
21:44:57 | rtarded | full code: https://pastecode.xyz/view/642d69f7 |
21:45:26 | FromGitter | <mratsim> Are you sure Nim is not aligning seq\[T\] to sizeof T boundaries? |
21:46:44 | rtarded | nvm. I'm a moron |
21:47:35 | krux02 | so it is not aligning to sizeof(T) boundaries, pretty sure |
21:49:05 | krux02 | when you allocate a seq, the heap data will contain some pointer sized capacity at the beginning and after that it will start with your data |
21:49:38 | krux02 | there might come some padding though, depending on the alignment value of T |
21:50:16 | krux02 | so for simd instructions you even might need higher alignment values than 8 bytes |
21:51:02 | krux02 | if you have such data there will be additional padding |
21:53:10 | krux02 | alignof(T) ≤ sizeof(T). always |
21:53:17 | krux02 | unless you are in glsl land |
22:02:16 | * | Trustable quit (Remote host closed the connection) |
22:05:34 | * | kaushalmodi quit (Quit: Connection closed for inactivity) |
22:05:52 | rtarded | Guys. Is it possible to debug Nim code? Preferably in VSCODE |
22:06:11 | rtarded | I'm unable to add breakpoints |
22:06:16 | rtarded | the Nim extension is installed |
22:07:44 | * | khronosschoty27 joined #nim |
22:08:13 | rtarded | not properly supported yet: https://github.com/pragmagic/vscode-nim/issues/65 |
22:08:14 | rtarded | :( |
22:09:05 | * | khronosschoty27 quit (Read error: Connection reset by peer) |
22:10:02 | Calinou | yeah, I use print statement debugging |
22:14:34 | zacharycarter[m] | Most get along fine w/ gdb / lldb |
22:15:46 | * | rtarded quit (Quit: Leaving) |
22:17:10 | * | yglukhov[i] quit (Remote host closed the connection) |
22:17:59 | * | yglukhov[i] joined #nim |
22:19:25 | FromGitter | <zetashift> @rtarded maybe this could help? https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#debugging-nim-code |
22:21:50 | * | brynjar7 joined #nim |
22:22:26 | * | yglukhov[i] quit (Ping timeout: 256 seconds) |
22:22:50 | * | brynjar7 quit (Remote host closed the connection) |
22:32:54 | zacharycarter[m] | figured out a minimal example for one of my issues |
22:33:29 | zacharycarter[m] | https://gist.github.com/zacharycarter/e44274861f211bb2345d4fb2a1bd87a6 |
22:35:10 | krux02 | I try to run the test tsizeof in Nim and I get an error in some parseJson |
22:35:17 | krux02 | wtf? |
22:35:56 | zacharycarter[m] | wnt me to try? |
22:35:59 | zacharycarter[m] | is it in devel? |
22:41:00 | * | PMunch quit (Quit: leaving) |
22:42:52 | * | vok`2 joined #nim |
22:47:02 | krux02 | ok I got the problem |
22:47:15 | krux02 | still weird bug |
22:47:30 | krux02 | the test did not compile and the error messages had nothint to do with it. |
22:47:36 | krux02 | zacharycarter[m], but thanks for the offer |
22:49:04 | * | vok`2 quit (Ping timeout: 256 seconds) |
22:49:40 | zacharycarter[m] | np |
23:33:54 | * | Pugabyte6 joined #nim |
23:40:04 | * | Pugabyte6 quit (Ping timeout: 256 seconds) |
23:40:50 | krux02 | Araq: ast.SpecialSemMagics isn't used anywhere in the compiler, can I just delete it? |
23:48:14 | * | xet7 quit (Quit: Leaving) |
23:51:47 | * | was joined #nim |
23:53:26 | * | was quit (Remote host closed the connection) |
23:56:52 | * | kaushalmodi joined #nim |