00:00:22 | FromGitter | <Varriount> Quelklef: Looks like one. Isn't an empty object invalid though? |
00:00:37 | FromGitter | <Quelklef> That's not the issue; adding fields doesn't fix it |
00:00:52 | FromGitter | <Quelklef> But I'll put fields in the bug report for clarity, ty |
00:01:55 | FromGitter | <Quelklef> Hm, plain `type Union[X: static[int]] = object \n\t discard` works fine so I guess empty objects are allowed |
00:02:20 | FromGitter | <Quelklef> Gotta have singletons somehow! |
00:07:55 | stefanos82 | without knowing much about it, I have tried typetraits module and variable k is of type Union[0] |
00:08:16 | stefanos82 | therefore f(k) is not of type Union[0] |
00:08:36 | stefanos82 | f[0](k) though is, because f[0] matches the type of Union[0] |
00:08:43 | stefanos82 | I hope I'm not wrong |
00:09:11 | FromGitter | <Quelklef> I'm not quite following |
00:09:19 | FromGitter | <Quelklef> of course `f(k)` is not `Union[0]`; it's `void` |
00:09:23 | stefanos82 | f(k) is not of type X |
00:09:33 | stefanos82 | thus, the error message |
00:09:45 | FromGitter | <Quelklef> Of course; it's `void` |
00:09:45 | * | BitPuffin quit (Remote host closed the connection) |
00:12:38 | stefanos82 | OK, so what you don't understand with this code Quelklef? |
00:13:24 | FromGitter | <Quelklef> `k` is of type `Union[0]`, so calling `f(k)` should be able to deduce that the free `X` is `0`, since `Union[X]` must be `Union[0]` because it's `k`'s type. |
00:14:36 | stefanos82 | what about the way f() has been defined? |
00:14:50 | FromGitter | <Quelklef> what about it |
00:14:57 | stefanos82 | look closer to the restriction it had added to its arguments |
00:15:05 | stefanos82 | to accept only of type static int |
00:15:53 | FromGitter | <Quelklef> Yes, and `0` is a static int. The program doesn't work even if it's `f[X](...`, anyway |
00:16:02 | FromGitter | <Quelklef> Without `: static[int]` |
00:16:07 | stefanos82 | therefore, without the explicit use of [0] it won't work |
00:16:39 | FromGitter | <Quelklef> Can a static int not be inferred from a type? |
00:17:04 | stefanos82 | that is something I cannot understand as I have very limited knowledge around Nim...for *now*! lol |
00:17:50 | FromGitter | <Quelklef> So, perhaps it should work, perhaps it shouldnt. |
00:17:51 | stefanos82 | to give you a use, replace f[0] with f[10] |
00:18:05 | stefanos82 | it's complaining about type mismatch |
00:19:46 | FromGitter | <Quelklef> ...it should infer the 0 |
00:19:51 | FromGitter | <Quelklef> (theoretically) |
00:26:06 | stefanos82 | actually no |
00:26:14 | stefanos82 | you can try something if you want |
00:26:33 | stefanos82 | use import typetraits |
00:26:58 | stefanos82 | then right after let k add an echo k.type.name |
00:27:28 | stefanos82 | and as your last line after f[0](k), try echo f.type.name |
00:27:31 | stefanos82 | and see what it prints |
00:27:43 | FromGitter | <Quelklef> `Union[0]`... |
00:27:51 | stefanos82 | then, add [] right next to f and see the new message |
00:28:04 | FromGitter | <Quelklef> Come again? |
00:28:14 | FromGitter | <Quelklef> `f0 (k)`? `f (k)`? |
00:28:27 | FromGitter | <Quelklef> Oh i missed some of your messages, sorry |
00:28:52 | stefanos82 | your Union is of a Generic type |
00:28:58 | stefanos82 | thus the use of [] before () |
00:29:31 | FromGitter | <Quelklef> Wait I have `echo(k.ype.name)` (Union[0]) |
00:29:33 | stefanos82 | by telling it X: static[int], you are limiting the value input this function gets |
00:29:38 | FromGitter | <Quelklef> Right |
00:30:11 | stefanos82 | therefore f.type.name != f[0].type.name |
00:30:18 | FromGitter | <Quelklef> Right, I agree |
00:30:19 | stefanos82 | as it expects a generic type |
00:30:25 | FromGitter | <Quelklef> One is instantiated |
00:30:58 | stefanos82 | if you mean variable k, yes |
00:31:09 | stefanos82 | don't forget; your f is not a variable, but a proc |
00:31:27 | stefanos82 | therefore, you need to use the whole signature |
00:31:30 | FromGitter | <Quelklef> I mean, can I not consider it a variable referring to a procedure? |
00:31:41 | stefanos82 | which one, the k variable? |
00:31:46 | FromGitter | <Quelklef> `f` |
00:31:56 | FromGitter | <Quelklef> Also I mean by "One is instantiated" that `f[0]` is and `f` isn't |
00:31:59 | stefanos82 | f is not a variable, it's the name of your proc f() |
00:32:28 | FromGitter | <Quelklef> `let f = proc(...` though |
00:32:40 | stefanos82 | you didn't use let f in your gist |
00:33:24 | FromGitter | <Quelklef> Oh shoot you can't do `let f = proc ...` for generic procs can you |
00:34:06 | stefanos82 | I have no idea; I'm checking the manual right now |
00:34:13 | FromGitter | <Quelklef> Seems like no |
00:34:35 | FromGitter | <Quelklef> I'm just having trouble seeing why `f` being a "name of a function" vs "a reference" is important. But I guess I'll see, please continue |
00:34:55 | FromGitter | <Quelklef> Or "an identifier" rather |
00:36:05 | stefanos82 | I didn't find anything about anonymous proc in generics |
00:36:18 | stefanos82 | therefore prefer to use the original code you shared in your gist example |
00:36:23 | FromGitter | <Quelklef> ok |
00:38:11 | FromGitter | <Quelklef> Using a let doesn't seem to work anyway |
00:38:46 | stefanos82 | with generics, no...unless there is some special magic somewhere that is either not documented or well-hidden and cannot find it. |
00:39:12 | FromGitter | <Quelklef> By the way, before we continue, I want to note that the following code does compile: |
00:39:52 | FromGitter | <Quelklef> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b56755832fa1b74086021e4] |
00:40:11 | FromGitter | <Quelklef> I don't know if that contradicts your explanation or not; if not, please continue |
00:45:11 | stefanos82 | this is interesting |
00:45:14 | stefanos82 | let me analyze it a bit |
00:45:17 | FromGitter | <Quelklef> Sure |
00:45:27 | FromGitter | <Quelklef> I'll get some cake in the meantime |
00:49:22 | FromGitter | <Varriount> Quelklef: Quit poking the Type Theory, you're only going to annoy it. :P |
00:51:03 | * | dddddd quit (Remote host closed the connection) |
00:51:05 | FromGitter | <Quelklef> haha |
00:52:09 | stefanos82 | Quelklef: I guess the reason it works it's because X can be of any type |
00:52:23 | FromGitter | <Quelklef> Araq's gonna hunt be down if I keep submitting static[T] bug reports |
00:52:44 | stefanos82 | whereas the X: static[int] limits your generic's use to a static integer type |
00:52:47 | FromGitter | <Quelklef> @stefanos82, no; run it with `f[X: static[int]]`. It also works |
00:53:03 | stefanos82 | yes because it will work with your original type |
00:53:19 | FromGitter | <Quelklef> What do you mean? |
00:53:31 | FromGitter | <Quelklef> I mean change the code to read `func fX: static[int (v: Union[X]) = ...` |
00:53:34 | FromGitter | <Quelklef> It'll still compile |
00:53:51 | stefanos82 | I use proc, not func |
00:53:56 | stefanos82 | I have no idea what func is |
00:54:08 | FromGitter | <Quelklef> `func X` just stands for `proc X {.noSideEffect.}`. Shouldn't make a difference |
00:54:25 | FromGitter | <Quelklef> I just use it out of habit at this point |
00:54:26 | stefanos82 | OK, tell me again what to check? |
00:54:36 | FromGitter | <Quelklef> Here, I'll just paste the code |
00:54:43 | stefanos82 | sure |
00:55:24 | stefanos82 | LOL "@dom96: banned" |
00:55:31 | stefanos82 | what the hell did you do man? :D |
00:55:37 | FromGitter | <Quelklef> ```code paste, see link``` ⏎ ⏎ Compiles fine [https://gitter.im/nim-lang/Nim?at=5b5679099ddf5f4aad0419f8] |
00:58:41 | stefanos82 | yes, because you are not using the when limitations |
00:59:00 | FromGitter | <Quelklef> Why would that matter |
00:59:29 | FromGitter | <Quelklef> Either way, I assume that it fully instantiates `f` |
00:59:39 | * | stefanos82 processes it while drinking wotta! |
01:00:00 | FromGitter | <Quelklef> It must, unless it does something fancy like figuring out that `X` does nothing and just removing it from the `Union` definition |
01:00:08 | FromGitter | <Quelklef> oh hey cheers I got some water here too |
01:01:08 | stefanos82 | indeed the problem is with when |
01:01:36 | FromGitter | <Quelklef> Evidently, since that's the only time the compiler fails.. |
01:01:40 | stefanos82 | by using the when statement and testing it against 0, you are limiting it to accept only 0 as its static int value |
01:01:49 | stefanos82 | the rest discards them anyway |
01:01:57 | FromGitter | <Quelklef> ...no |
01:02:07 | FromGitter | <Quelklef> `X` may be any int, with or without the when |
01:02:36 | stefanos82 | I didn't say the opposite; I said "the rest discards them anyway" |
01:02:38 | stefanos82 | meaning |
01:02:55 | stefanos82 | no matter what value or what type, it discards them as they don't pass the matching criteria in when |
01:03:08 | FromGitter | <Quelklef> Ok.. |
01:03:26 | stefanos82 | try f[1](k) which matches the type |
01:03:28 | stefanos82 | it won't compile |
01:03:28 | FromGitter | <Quelklef> Then why does this compile: |
01:03:36 | FromGitter | <Quelklef> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b567ae8c86c4f0b472cf89a] |
01:04:12 | FromGitter | <Quelklef> If the error happens because `X` is actually used |
01:04:26 | FromGitter | <Quelklef> Also, of course `f1 (k)` won't work, `k` is of `Union[0]`, not `Union[1]` |
01:04:37 | stefanos82 | OK, let me test this as well |
01:07:48 | stefanos82 | it compiles because you are not using the data array |
01:07:57 | FromGitter | <Quelklef> no |
01:07:59 | FromGitter | <Quelklef> no that's |
01:08:02 | FromGitter | <Quelklef> no |
01:08:32 | FromGitter | <Quelklef> ```code paste, see link``` ⏎ ⏎ Also compiles [https://gitter.im/nim-lang/Nim?at=5b567c10f9ffc4664bfa0dfd] |
01:12:09 | stefanos82 | I think I got it |
01:12:21 | stefanos82 | yep, it must be it |
01:12:36 | stefanos82 | X inside data is of type static int |
01:13:01 | stefanos82 | and int it's the value input array accepts |
01:13:18 | stefanos82 | thus it works |
01:13:23 | FromGitter | <Quelklef> dude |
01:13:26 | stefanos82 | it echoes empty array, but works |
01:13:38 | FromGitter | <Quelklef> like |
01:13:41 | FromGitter | <Quelklef> you're trolling right |
01:14:14 | stefanos82 | you mean I'm wasting my time instead of sleeping to troll you for fun? yeah, sure...as if I don't have other important things to do! |
01:14:33 | FromGitter | <Quelklef> ok, do me a favor |
01:14:49 | FromGitter | <Quelklef> change it from `array[X, int]` to `array[X, array[10, char]]` |
01:14:58 | FromGitter | <Quelklef> an `array[10, char]` is NOT an `int`, but it still compiles |
01:15:17 | FromGitter | <Quelklef> Next you'll say that the issue is there's nothing in the array |
01:15:20 | FromGitter | <Quelklef> OK, I'll add something |
01:16:25 | FromGitter | <Quelklef> ```code paste, see link``` ⏎ ⏎ Still compiles [https://gitter.im/nim-lang/Nim?at=5b567de9b2411177a2682fb3] |
01:16:32 | FromGitter | <Quelklef> Let me guess. The issue is there's only one nested array? |
01:16:44 | FromGitter | <Quelklef> Please, let me fix that |
01:17:16 | FromGitter | <Quelklef> ```code paste, see link``` ⏎ ⏎ Still compiles [https://gitter.im/nim-lang/Nim?at=5b567e1ce06d7e74099a5937] |
01:17:43 | FromGitter | <Quelklef> OK, I'm being mean |
01:17:58 | FromGitter | <Quelklef> But if you get any more theories about why it's working, please test them first |
01:18:08 | FromGitter | <Quelklef> I really can't help but think you're a troll at this point |
01:18:16 | FromGitter | <Quelklef> So if you're not, test your theories |
01:18:20 | FromGitter | <Quelklef> And if you are, well, ok |
01:22:18 | stefanos82 | I have tried to figure out what's going on and indeed seems there's an issue with generics mechanism. Anyhow, I won't continue any further, because you are too exhausted and irritated right now and blasting offenses to me even though I'm doing my best to help you out. Feel free to report your cases to Araq in the form of a ticket with all the necessary steps for reproduction |
01:24:29 | FromGitter | <Varriount> stefanos82: Don't forget that generics are a tricky part of the compiler. |
01:24:44 | stefanos82 | Varriount: I know mate...I know -_- |
01:25:07 | FromGitter | <Varriount> It could be worse, you could be trying to debug closure/lambda lifting. >:D |
01:26:36 | stefanos82 | I'm alright, I have enough traumas from C++'s metaprogramming |
01:27:38 | FromGitter | <Quelklef> sorry @stefanos82 |
01:27:56 | stefanos82 | no worries, you need to rest your mind |
01:28:24 | stefanos82 | and I think as it is, the code works because the test checks *X only* for validation inside data |
01:28:30 | stefanos82 | the rest it ignores it |
01:28:38 | stefanos82 | think of it as in C++ |
01:29:02 | stefanos82 | f<T>(T, std::array()) |
01:29:20 | FromGitter | <Quelklef> Unfortunately, I haven't learned C++ |
01:29:54 | stefanos82 | T is of type static[int] in our case and the rest is not of template's concern, *unless* T is used behind the scenes by std::array() |
01:31:51 | stefanos82 | in other words, the generics validation takes place *only for X*, for nothing else |
01:31:58 | stefanos82 | that's why it works as it works |
01:32:12 | stefanos82 | now...does it work correctly, that is as it should? I have no idea |
01:32:24 | stefanos82 | but based on what I'm reading, I think it's correct |
01:32:31 | stefanos82 | I hope I'm wrong, because indeed it looks confusing |
01:37:39 | FromGitter | <gogolxdong> @zacharycarter I didn't expect the layout feature that doesn't work to work but merely to try and see , just want to know how does layout and transition works with wasm , there is little reference mentioned this. |
01:38:23 | stefanos82 | goodnight people |
01:38:24 | * | stefanos82 quit (Quit: Quitting for now...) |
01:38:31 | FromGitter | <Quelklef> night |
01:38:33 | FromGitter | <gogolxdong> good night. |
01:43:27 | FromGitter | <gogolxdong> 1) the elements will be created the upon the first render, but the dynamic part has been moved out of the cached children, and is executed on every render. This is the core concept Imba uses for it's lightning fast rendering* |
02:13:13 | * | yglukhov[i] joined #nim |
02:17:27 | * | yglukhov[i] quit (Ping timeout: 240 seconds) |
02:19:19 | FromGitter | <asampal> @gogolxdong what did you mean with that reference from the Imba docs? |
02:21:56 | * | dorelix quit (Remote host closed the connection) |
02:22:15 | * | dorelix joined #nim |
03:02:44 | FromGitter | <gogolxdong> share its core concept which I don't know. |
03:03:00 | FromGitter | <gogolxdong> and don't understand. |
03:04:28 | FromGitter | <gogolxdong> How to split with re module to split by CreateEnumType(...), CreateDataType(...),CreateManagedType(...) , this `CreateEnumType|CreateDataType|CreateManagedType (*)` doesn't work. |
03:06:48 | FromGitter | <gogolxdong> oh ,it should be escaped `[CreateEnumType|CreateDataType|CreateManagedType]\(*)` |
03:10:34 | FromGitter | <gogolxdong> no, needs a pair of parenthesis. |
03:11:04 | FromGitter | <gogolxdong> this doesn't work. |
03:12:57 | FromGitter | <gogolxdong> or scanf* works? |
03:25:04 | * | erratic quit (Quit: this server has gone to sleep) |
03:34:44 | FromGitter | <Varriount> @gogolxdong Doesn't a square bracket indicate a type class? |
03:36:08 | * | erratic joined #nim |
03:39:57 | * | endragor joined #nim |
03:43:11 | FromGitter | <gogolxdong> re"(CreateEnumType|CreateDataType|CreateManagedType)+.*" |
03:43:33 | FromGitter | <gogolxdong> it's a re match not generic |
03:44:44 | FromGitter | <Varriount> Yes, but I mean a regular expression type class. |
03:46:04 | FromGitter | <Varriount> `re"[123abc]"` will match a single character that is equal to a character between the square brackets. |
04:05:58 | FromGitter | <gogolxdong> like how to get the content in parenthesis CreateDataType("vim.fault.CpuCompatibilityUnknown", "CpuCompatibilityUnknown", "vim.fault.CpuIncompatible", "vim.version.version1", None) |
04:08:45 | FromGitter | <Varriount> Eh, matching parenthesis with reference can't actually be done, not if they're nested. The regular expression will either stop at the last parentheses in the string or it will stop at th first one |
04:09:17 | FromGitter | <Varriount> You might be better off using the peg module. |
04:09:31 | * | death916 is now known as death916_ |
04:09:52 | * | death916_ is now known as death916 |
04:13:59 | FromGitter | <gogolxdong> good to know, what's the difference between peg and re? |
04:20:37 | FromGitter | <gogolxdong> then how to do it in peg? |
04:25:58 | FromGitter | <Varriount> @gogolxdong Do you just need to match, or do you need to extract the contents between parenthesis? |
04:31:31 | FromGitter | <gogolxdong> first match ,then extract the content between parenthesis. |
04:31:43 | FromGitter | <gogolxdong> I tried 'if l =~ peg"CreateEnumType'('@,')'":' |
04:34:55 | FromGitter | <gogolxdong> no documentation describe @ in peg? |
04:36:09 | FromGitter | <gogolxdong> as in `assert match("(a b c)", peg"'(' @ ')'")` |
04:47:40 | FromGitter | <Varriount> @gogolxdong you need to create a rule which matches parenthesis and the contents between them. That role will need to be conditionally recursive. |
04:47:45 | FromGitter | <Varriount> *rule |
05:05:39 | * | bozaloshtsh quit (Remote host closed the connection) |
05:05:47 | * | bozaloshtsh joined #nim |
05:05:47 | * | bozaloshtsh quit (Changing host) |
05:05:47 | * | bozaloshtsh joined #nim |
05:11:34 | * | nsf joined #nim |
05:14:28 | FromGitter | <gogolxdong> yeah,it's hard. |
05:17:52 | FromGitter | <gogolxdong> What does @ mean in peg |
05:23:33 | FromGitter | <gogolxdong> ```if "(a b c)" =~ peg"'(' @ ')'": ⏎ echo matches``` [https://gitter.im/nim-lang/Nim?at=5b56b7d563cf1636bde9e025] |
05:23:40 | FromGitter | <gogolxdong> ```import pegs ⏎ if "(a b c)" =~ peg"'(' @ ')'": ⏎ echo matches``` [https://gitter.im/nim-lang/Nim?at=5b56b7dc9ddf5f4aad0495a4] |
05:24:52 | * | donotturnoff joined #nim |
05:25:01 | FromGitter | <gogolxdong> [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil] |
05:35:39 | * | donotturnoff quit (Ping timeout: 244 seconds) |
05:42:22 | FromGitter | <Varriount> Why are you using "@"? |
05:45:04 | FromGitter | <Varriount> @gogolxdong Are these function calls? If so, what language are they? |
05:51:32 | * | donotturnoff joined #nim |
05:53:17 | * | donotturnoff quit (Client Quit) |
05:59:29 | FromGitter | <Varriount> @gogolxdong https://gist.github.com/Varriount/0cabcc4998f6f784b554bbe31ea16f37 |
06:06:28 | * | xylef joined #nim |
06:11:47 | FromGitter | <gogolxdong> It's https://raw.githubusercontent.com/vmware/pyvmomi/master/pyVmomi/ServerObjects.py. |
06:38:10 | * | Vladar joined #nim |
06:55:53 | * | yglukhov[i] joined #nim |
07:13:41 | FromGitter | <gogolxdong> Can I match and extract at the same time? |
07:30:16 | FromGitter | <mratsim> @gogolxdong maybe this would help? https://nim-lang.org/docs/strscans.html |
07:58:35 | * | thor77 quit (Quit: ZNC 1.7.0 - https://znc.in) |
07:58:52 | * | thor77 joined #nim |
08:22:09 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b56e1b126bfd636be4535a4] |
08:23:07 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
08:23:11 | FromGitter | <gogolxdong> props and methods are array . |
08:23:43 | * | yglukhov[i] joined #nim |
08:23:49 | FromGitter | <gogolxdong> like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b56e21526bfd636be45365d] |
08:31:42 | FromGitter | <gogolxdong> scanf took `[("activePartition"` as props and the rest to the next right parenthesis as methods. |
08:35:43 | FromGitter | <gogolxdong> it has to find the matched parenthesis and square bracket which could be nested. |
08:36:39 | FromGitter | <gogolxdong> Is this the only capability peg has? |
08:41:57 | * | Vladar quit (Quit: Leaving) |
08:45:46 | FromGitter | <mratsim> I’m pretty sure you can parse CreateManagedType and then use the JSON module to parse everything else. |
08:46:05 | FromGitter | <mratsim> but to be honest this sounds like Perl programming :P |
08:46:50 | FromGitter | <mratsim> this seems like stuff that would come from a .cfg or a .yaml file |
08:47:18 | FromGitter | <mratsim> parsecfg or nimyaml would be much better and easier to maintain for this. |
08:52:06 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
08:56:29 | * | Tanger quit (Quit: Leaving) |
08:56:59 | * | yglukhov[i] joined #nim |
09:09:22 | * | Entropic quit (Ping timeout: 245 seconds) |
09:09:51 | FromGitter | <gogolxdong> Will scanp be better? |
09:13:58 | * | Entropic joined #nim |
09:17:07 | FromGitter | <mratsim> if you need to parse something that is not fixed with potentially recursive brackets, it’s probably much more robust to implement your own, by following the json module lexer/parser |
09:17:18 | FromGitter | <gogolxdong> scanf is straightforward and easy to understand but might not be capable to deal with complex nested structured string, scanp resembles EBNF or PEG grammars in which an ordered choice may help. |
09:18:55 | FromGitter | <gogolxdong> sadly not familiar enough with PEG. |
09:19:26 | FromGitter | <mratsim> alternatively, instead of parsing, if the data comes from your own environment, you can create a domain specific language instead: ⏎ ⏎ https://github.com/mratsim/glyph/blob/master/glyph/snes/opcodes.nim#L8-L23 |
09:19:42 | * | gangstacat quit (Quit: Ĝis!) |
09:19:54 | FromGitter | <mratsim> this way you leverage the Nim parser |
09:20:14 | FromGitter | <mratsim> macro that parses this language: https://github.com/mratsim/glyph/blob/master/glyph/snes/private/macros_opcodes.nim#L9 |
09:21:40 | FromGitter | <mratsim> maybe you can use parseStmt on this string? https://nim-lang.org/docs/macros.html#parseStmt,string |
09:24:06 | FromGitter | <mratsim> @gogolxdong try this, it works ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b56f03632fa1b740861495e] |
09:26:51 | FromGitter | <gogolxdong> This is encouraging . |
09:28:14 | FromGitter | <gogolxdong> we can generate object directly from the result. |
09:33:20 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b56f2604b880b3e6a458664] |
09:33:28 | FromGitter | <gogolxdong> Error: request to generate code for .compileTime proc: parseStmt |
09:37:05 | FromGitter | <mratsim> parseStmt needs data at compile time, let lines should be a const, and for l in lines should be either in a macro or in a static context |
09:54:59 | * | gangstacat joined #nim |
09:58:27 | FromGitter | <gogolxdong> ```code paste, see link``` ⏎ ⏎ Error: attempt to access a nil address at line of parsestmt. [https://gitter.im/nim-lang/Nim?at=5b56f84363cf1636bdea9768] |
10:00:49 | FromGitter | <gogolxdong> firstly write found lines to *ServerObjects* file then staticRead. |
10:11:38 | FromGitter | <mratsim> I wonder if staticRead can be used in a static context. Try to assign it to a const first then use the const in static. |
10:25:54 | FromGitter | <codem4ster> hi, I have a code like this; ```nim import net proc processClient(client: Socket) {.thread.} = while true: # I want this line as blocking echo client.recv(4096).repr proc main = var socket = newSocket() socket.bindAddr(Port(12345)) socket.listen() var address = "" while true: var client = new Socket socket.acceptAddr(client, address) echo("Client connected from: ", address) processClient client main() ``` how can I |
10:25:54 | FromGitter | ... make that line as blocking? İs there any method like readBytes or smt? |
10:26:44 | FromGitter | <codem4ster> hi, I have a code like this; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b56fee49ddf5f4aad0558f2] |
10:27:52 | FromGitter | <codem4ster> I have a code like this; ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ how can I make that line blocking [https://gitter.im/nim-lang/Nim?at=5b56ff28c579673e6b8f0c76] |
10:29:37 | * | NimBot joined #nim |
10:32:32 | FromGitter | <gogolxdong> ```code paste, see link``` ⏎ ⏎ the same. [https://gitter.im/nim-lang/Nim?at=5b570040c331e0355213e6fd] |
10:33:33 | * | BitPuffin joined #nim |
10:33:51 | FromGitter | <mratsim> and if instead of static you use a macro |
10:35:05 | * | nc-x joined #nim |
10:36:18 | nc-x | @codem4ster Sorry if I misunderstood your question but isn't it already blocking? It returns the data only when it gets 4096 bytes since it does not have any timeout specified. |
10:39:18 | FromGitter | <codem4ster> nope nc-x it prints empty data like this `while true:` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b5701d626bfd636be459691] |
10:41:32 | euantor | Anybody know why `nimble install serial` installs v1.0.0 when there is a `v1.1.0` tag which is greater? https://github.com/euantorano/serial.nim/releases |
10:42:33 | nc-x | @codem4ster Which nim version are you on? And OS? It does not do that for me. Once it has all 4096 bytes it prints it all out at once then (for me). |
10:50:43 | * | Vladar joined #nim |
10:56:17 | * | nc-x quit (Quit: Page closed) |
10:57:35 | FromGitter | <codem4ster> windows10, stable 0.18.0 |
10:59:13 | * | nc-x joined #nim |
10:59:29 | nc-x | Try devel. (I am on W10, nim devel) |
11:04:14 | * | nc-x quit (Quit: Page closed) |
11:08:44 | * | yglukhov[i] quit (Ping timeout: 260 seconds) |
11:14:17 | * | yglukhov[i] joined #nim |
11:15:31 | * | craigger quit (Quit: bye) |
11:18:06 | * | craigger joined #nim |
11:21:41 | * | xylef quit (Quit: WeeChat 2.2) |
11:26:30 | * | xet7 joined #nim |
11:26:36 | FromGitter | <codem4ster> I'm giving up :( I don't want to compile devel version to Win10 as it is time consuming and complicated for me. I wrote this code in Rust, Ruby, Crystal before but couldn't succeeded in Nim. I found socket programming in Nim is hard and buggy. I think this leads to a slow or buggy http server implementation thus httpbeast and jester is slow in benchmark and not support multiplatform. Also I think http server |
11:26:36 | FromGitter | ... implementation must be threaded not async. From my side I found Nim's web capabilities in this manner is below average, sorry. May be Nim is not the right tool for the web as it claims that its a systems programming language :( |
11:33:49 | * | nc-x joined #nim |
11:34:41 | nc-x | From where did you get the idea that compiling nim is hard? It is essentially a 2 minute process where you just have to copy paste commands from the github readme |
11:35:30 | nc-x | I have no experience with socket programming in general so can't comment on that part. |
11:38:12 | FromGitter | <codem4ster> where is that 2min readme? |
11:39:22 | federico3 | dom96: ^^^ |
11:39:45 | * | nc-x quit (Ping timeout: 252 seconds) |
11:40:05 | FromGitter | <codem4ster> https://github.com/nim-lang/Nim#compiling talking about this? |
11:40:38 | FromGitter | <codem4ster> how can I run this in windows: `sh build.sh` |
11:41:24 | * | nc-x joined #nim |
11:41:25 | nc-x | (in the place of sh build.sh you should substitute build.bat on x86 Windows or build64.bat on x86_64 Windows): |
11:42:11 | nc-x | BTW i can reproduce your issue now. After the client quits, it runs into an infinite loop and prints empty string. |
11:42:28 | FromGitter | <Varriount> codem4ster: Or you can just download the latest stable version of Nim https://nim-lang.org/install_windows.html |
11:43:31 | FromGitter | <codem4ster> @Varriount we are talking about compiling devel. I have already have lastest stable. |
11:43:37 | FromGitter | <Varriount> I generally download the latest stable version, then use that to compile the latest development version. |
11:44:14 | FromGitter | <Varriount> Well then all you need to do is download the development version of the repository, run `nim c koch`, in the devel repository, then run `koch boot`. |
11:45:38 | * | nc-x quit (Client Quit) |
11:46:08 | FromGitter | <Varriount> Regarding socket programming you appear to be using a lower-ish level library (the net module). I don't know what problems you encountered with async, since I've had fairly good success with it. |
11:46:44 | FromGitter | <Varriount> httpbeast wasn't written for cross-platform use, if I recall correctly. |
11:47:52 | FromGitter | <Varriount> codem4ster: Are you writing an HTTP client/server? |
11:47:55 | * | stefanos82 joined #nim |
11:47:59 | FromGitter | <codem4ster> Async uses only one core. |
11:48:14 | FromGitter | <codem4ster> I need true power of multithreads :) |
11:50:58 | FromGitter | <codem4ster> I'm trying to understand socket implementation. Then I will write a TCP tunnel (Socks server) to my server which will tunnel data Browser -> MyLocal -> MyServer and vice versa. |
11:53:51 | FromGitter | <mratsim> For IO you will also need async, otherwise you will block your threads. |
11:55:10 | FromGitter | <codem4ster> threads are for that purpose, they can block themselves but the main program will continue to work. |
11:55:19 | FromGitter | <mratsim> On Windows the easiest way to get Nim devel and switch between devel and stable is via choosenim: https://github.com/dom96/choosenim#windows |
11:55:25 | FromGitter | <Varriount> You really don't want to base your entire model on threads. |
11:55:55 | FromGitter | <mratsim> after you just need to do `choosenim devel` or `choosenim stable` |
11:56:22 | dom96 | Rust is easier when it comes to sockets? Really? |
11:56:37 | dom96 | That sucks. But what code are you writing? |
11:57:12 | FromGitter | <codem4ster> @dom96 sorry but really it is. :( |
11:57:25 | FromGitter | <mratsim> @dom96 ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b57142505e1cc355308da0a] |
11:57:35 | FromGitter | <Varriount> codem4ster: https://corbinsimpson.com/entries/take-a-bow.html |
11:57:57 | FromGitter | <codem4ster> this is only the initial part |
11:58:31 | dom96 | Why don't you simply use async? |
11:58:49 | FromGitter | <Varriount> He want's to use a threaded model. |
12:00:01 | FromGitter | <codem4ster> hard part in Rust threads are Arc type mutexes. |
12:00:17 | dom96 | So how did you get this working on Crystal? |
12:00:23 | dom96 | It doesn't support Windows |
12:00:28 | dom96 | and it also doesn't support parallelism |
12:00:51 | FromGitter | <Varriount> dom96: Oh, does Crystal have a global interpreter lock type thing? |
12:01:09 | dom96 | No, it just doesn't support parallelism right now |
12:01:21 | FromGitter | <codem4ster> im here because it has only concurrency :) |
12:01:54 | FromGitter | <Varriount> dom96: Is it possible to start multiple async loops on different threads? |
12:02:06 | dom96 | Yeah |
12:02:19 | FromGitter | <Varriount> And they can accept incoming connections from the same port? |
12:02:19 | dom96 | That's precisely how you should parallelise in Nim |
12:02:25 | FromGitter | <mratsim> @codem4ster : https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/server.nim#L25-L28 |
12:02:42 | dom96 | On Linux, yes. |
12:02:53 | dom96 | I haven't looked at doing it in Windows yet |
12:03:07 | FromGitter | <codem4ster> I tried this but it doesn't work with threads or I couldn't manage it work |
12:03:21 | FromGitter | <codem4ster> I made it in Rust in Windows |
12:03:30 | FromGitter | <codem4ster> https://doc.rust-lang.org/std/net/struct.TcpListener.html |
12:03:45 | FromGitter | <mratsim> iirc dom96 had a “isReady” workaround to use async with threadpool. |
12:04:12 | dom96 | codem4ster: Are you sure you even need this to be parallel? |
12:04:13 | FromGitter | <Varriount> Ugh, threadpool |
12:04:14 | FromGitter | <mratsim> But I’m also interesting in a canonical M:N threading example. (I asked on Sunday but no reply). |
12:04:30 | FromGitter | <Varriount> I dislike threadpool because it's locked to a global resource. |
12:04:45 | FromGitter | <codem4ster> I'm here for this. @dom96 :) |
12:04:48 | FromGitter | <Varriount> All you need is one bad library that spawns long-running processes on it, and it becomes useless. |
12:06:05 | FromGitter | <codem4ster> I already made this on Crystal with one threaded Fibers. |
12:06:18 | dom96 | codem4ster: I know, but please explain why you need this to be parallel |
12:06:22 | dom96 | Why isn't one thread enough? |
12:07:41 | FromGitter | <gogolxdong> how to catch the exception in macro? |
12:07:53 | FromGitter | <codem4ster> In global manner, and for Nim, all the best benchmarked web servers use the full power of the processors of the server. |
12:08:55 | FromGitter | <codem4ster> I'm working in a very big traffic sited company, and I want to make some tests about speed. |
12:09:48 | dom96 | okay, and where will your program be hosted? |
12:09:54 | dom96 | Will it be on a Windows server? |
12:10:20 | * | dorelix_ joined #nim |
12:12:05 | FromGitter | <codem4ster> and for my specific reason for that, I'm using a tunnel to bypass my internet provider's restricted sites. Firefox sends me large amount binary data and I encrypt them on my local computer, and decrypt on my personal server. My local computer is windows and linux. |
12:12:27 | * | dorelix quit (Ping timeout: 240 seconds) |
12:14:05 | dom96 | If you're happy to target Unix (which Win10 supports too with WSL) then you can follow the same approach as httpbeast |
12:15:39 | FromGitter | <codem4ster> Browser (Firefox on windows or linux) -> [socks5 data] -> Encrypter(.exe) on my local machine-> [encrypted socks5 data] -> decrypter on my server(linux) -> decrypted data to host (google.com etc...) ...... and going back to my browser with the reverse progress. |
12:17:25 | FromGitter | <codem4ster> we have also windows servers in company also (for the first reason I mention) |
12:21:12 | FromGitter | <Varriount> dom96: Is httpbeast on TechEmpower? |
12:23:05 | dom96 | Yes, and in 4 hours we'll have the results: https://tfb-status.techempower.com/ |
12:23:14 | FromGitter | <Varriount> :O |
12:23:17 | dom96 | You can already see how well httpbeast did by looking at the raw results |
12:23:33 | dom96 | If my calculations are correct it's doing well :) |
12:24:40 | FromGitter | <codem4ster> it looks like this in Rust; ⏎ https://pastebin.com/Gd0L6C6a |
12:25:37 | FromGitter | <Varriount> Hm, this says httpbeast had problems starting/stopping. https://tfb-status.techempower.com/results/a684944d-1888-4467-8155-92d782d42a25 |
12:25:51 | dom96 | .unwrap().unwrap() |
12:26:02 | dom96 | Varriount: Yes, that's an older run |
12:26:05 | dom96 | I fixed it |
12:26:56 | FromGitter | <codem4ster> if you don't want to catch the exceptions you must write .unwrap() :( Ugly :) |
12:27:58 | dom96 | From what I can see you can totally do the exact same thing in Nim |
12:28:07 | dom96 | just use threadpool's spawn |
12:29:48 | dom96 | although hrm, currently threadpool is limited to a set amount of threads so that might not work |
12:29:49 | FromGitter | <codem4ster> is .recv blocking? I need that info. |
12:31:02 | FromGitter | <codem4ster> I saw in other language tcp implementations like read, get, recv, bufferedRead etc... |
12:31:34 | FromGitter | <codem4ster> every method doing a different read type. |
12:31:47 | dom96 | it is, but you can also set a socket to be non-blocking: sock.getFd.setBlocking(false) |
12:31:56 | dom96 | (You'll need to import net, nativesockets for that |
12:32:24 | FromGitter | <codem4ster> I need blocking buffered read for 4096 bytes |
12:32:56 | dom96 | https://nim-lang.org/docs/net.html#recv,Socket,string,int |
12:33:21 | dom96 | var data = newString(4096); socket.recv(data, 4096) |
12:35:01 | * | nsf quit (Quit: WeeChat 2.1) |
12:35:10 | FromGitter | <codem4ster> what happens if client send 3 bytes and started to wait data? |
12:37:45 | dom96 | I'm not 100% sure, but I think it will wait until it gets 4096 bytes |
12:40:25 | euantor | If it's a buffered socket, it waits until client disconnect or full requested amount is received I believe |
12:43:28 | FromGitter | <codem4ster> or until it reaches timeout |
12:43:32 | * | livcd quit (Ping timeout: 276 seconds) |
12:43:34 | * | CcxWrk quit (Ping timeout: 264 seconds) |
12:44:53 | * | livcd joined #nim |
12:51:04 | * | CcxWrk joined #nim |
13:03:47 | FromGitter | <codem4ster> I tried non-blocking but getting this; `Error: unhandled exception: A non-blocking socket operation could not be completed immediately. ⏎ [OSError]` |
13:04:00 | FromGitter | <codem4ster> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b5723c04b880b3e6a462291] |
13:08:27 | * | halirc joined #nim |
13:17:03 | stefanos82 | codem4ster: where's {.async.} in your main proc? |
13:18:45 | dom96 | codem4ster: that's not needed |
13:18:56 | dom96 | er, s/codem4ster/stefanos82/ |
13:19:11 | stefanos82 | ah OK |
13:19:27 | dom96 | codem4ster: You're calling `recv` on a non-blocking socket |
13:19:33 | dom96 | The data isn't there |
13:19:35 | dom96 | that's why you get the error |
13:20:42 | FromGitter | <mratsim> @yglukhov : https://forum.nim-lang.org/t/4071 |
13:21:47 | * | xylef joined #nim |
13:28:12 | FromGitter | <codem4ster> this look likes working: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b57296cf02a0977a3f7f205] |
13:32:28 | FromGitter | <codem4ster> there is an article here: ⏎ https://www.scottklement.com/rpg/socktut/nonblocking.html |
13:33:34 | FromGitter | <codem4ster> is this the error: `Operation Would Block! == Error: unhandled exception: A non-blocking socket operation could not be completed immediately. [OSError]` |
13:34:59 | dom96 | yes |
13:35:27 | dom96 | You don't need {.async.} in there |
13:35:35 | FromGitter | <codem4ster> ok I will try to handle this |
13:35:53 | dom96 | In your code at least it doesn't do anything |
13:36:11 | dom96 | You can check whether a socket is readable using either async or the selectors module |
13:37:20 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
13:37:56 | * | yglukhov[i] joined #nim |
13:39:19 | stefanos82 | dom96: do you have any blog or website that you use it to share useful tips and tricks around Nim's advanced topics, such as metaprogramming? |
13:39:34 | dom96 | nope, just nim-lang.org |
13:39:44 | stefanos82 | can I suggest something then? |
13:40:28 | stefanos82 | how about having a place in official docs that you, the core members, share your thoughts on specific topics? |
13:41:27 | stefanos82 | this way, each author could compliment others' articles by either completing specific concepts or building on top of them |
13:43:24 | stefanos82 | dom96: much like what nim-lang.org/blog is all about, but more active around programming, than official announcements |
13:43:39 | stefanos82 | they could be place under a different sub-category |
13:43:57 | stefanos82 | such as nim-lang.org/announcements |
13:44:06 | stefanos82 | and blog be clear for discussion |
13:49:01 | FromGitter | <codem4ster> `var selector: Selector[???] = newSelector()` |
13:49:20 | FromGitter | <codem4ster> how can I use selectors any example? |
13:49:52 | * | endragor quit (Remote host closed the connection) |
13:51:14 | dom96 | type Data = object |
13:51:17 | dom96 | Selector[Data] |
13:51:26 | dom96 | selector.register(socket.getFd) |
13:51:54 | dom96 | echo selector.select(1000) |
14:05:18 | FromGitter | <codem4ster> `.register(fd: AsyncFD)` |
14:05:25 | Calinou | https://hastebin.com/afecokutih.nim |
14:05:51 | Calinou | so I'm adding support for 32-bit Windows cross-compilation, however Nim is adding an .exe extension to the GCC path which breaks compilation, but *only* when specifying --cpu:i386 |
14:06:00 | Calinou | it works if I don't specify (which uses amd64) |
15:05:01 | * | ftsf quit (Ping timeout: 244 seconds) |
15:10:37 | * | planetis[m] left #nim ("Kicked by @appservice-irc:matrix.org : removing from IRC because user idle on matrix for 30+ days") |
15:11:49 | * | couven92 joined #nim |
15:22:00 | * | Jipok[m] quit (Quit: removing from IRC because user idle on matrix for 30+ days) |
15:32:00 | * | tyrion[m] quit (Quit: removing from IRC because user idle on matrix for 30+ days) |
15:38:03 | * | Trustable joined #nim |
15:45:29 | * | couven92 quit (Read error: Connection reset by peer) |
15:51:21 | * | marszym[m] quit (Quit: removing from IRC because user idle on matrix for 30+ days) |
15:52:32 | * | libman[m] quit (Quit: removing from IRC because user idle on matrix for 30+ days) |
15:55:03 | FromGitter | <gogolxdong> How to re match ` CreateEnumType(...), CreateDataType(...),CreateManagedType(...) ` |
15:55:44 | * | Flox[m] quit (Quit: removing from IRC because user idle on matrix for 30+ days) |
15:57:52 | * | ng0 joined #nim |
15:57:52 | * | sroecker[m] quit (Quit: removing from IRC because user idle on matrix for 30+ days) |
15:58:50 | FromGitter | <Varriount> @gogolxdong Use the pegs module. |
15:59:00 | FromGitter | <Varriount> I posted that gist that matches the function calls. |
16:12:41 | * | Ven`` joined #nim |
16:29:41 | dom96 | https://www.techempower.com/benchmarks/#section=test&runid=2a8f2912-c4a2-4c32-a576-b1e2e932a906&hw=ph&test=json |
16:30:00 | dom96 | #17 |
16:30:12 | dom96 | and wow, apparently my jester optimisations are pretty freaking awesome |
16:30:18 | dom96 | because it's #18 |
16:30:38 | FromGitter | <Vindaar> awesome work, congrats! :) |
16:31:05 | dom96 | far more overhead evident in plaintext for Jester |
16:31:11 | dom96 | #8 vs. #25 |
16:31:54 | dom96 | For plaintext I think the top 13 are basically tied |
16:32:08 | dom96 | They're all IO bound |
16:32:22 | dom96 | In the last run officefloor-raw was #1 |
16:32:37 | dom96 | So I wonder what happened there |
16:33:16 | FromGitter | <Varriount> dom96: Huh, why do the results not show up in the "latest round" tab? |
16:33:35 | dom96 | Because the latest round was done a month ago |
16:33:46 | dom96 | Rounds are rarer |
16:33:57 | dom96 | They have a CI that runs the benchmarks too |
16:34:00 | dom96 | which is what you're seeing |
16:34:14 | FromGitter | <Varriount> Also, shouldn't JSON be slower than plaintext? |
16:34:22 | dom96 | it is? |
16:41:27 | * | Sembei quit (Ping timeout: 240 seconds) |
16:41:49 | * | Pisuke joined #nim |
16:46:50 | FromGitter | <rayman22201> Congrats @dom96! |
16:48:13 | dom96 | Thanks :D |
16:51:47 | Calinou | https://hastebin.com/afecokutih.nim |
16:51:47 | Calinou | so I'm adding support for 32-bit Windows cross-compilation, however Nim is adding an .exe extension to the GCC path which breaks compilation, but *only* when specifying --cpu:i386 |
16:51:47 | Calinou | it works if I don't specify (which uses amd64) |
17:16:08 | Calinou | nevermind, it was my fault… I had 64-bit GCC symlinked to the .exe name but not the 32-bit one |
17:16:19 | Calinou | I just checked, the produced binary is 32-bit so it's working :) |
17:18:10 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
17:18:46 | * | yglukhov[i] joined #nim |
17:19:52 | FromGitter | <alehander42> wow very nice results @dom96 |
17:20:33 | FromGitter | <alehander42> why are java libs so far ahead in those :O |
17:27:58 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:36:00 | Calinou | Java is still pretty fast today |
17:36:14 | Calinou | it does power that voxel game :) even though it uses significant native (C) parts thanks to LWJGL |
17:37:26 | zacharycarter[m] | not anymore |
17:37:31 | zacharycarter[m] | they rewrote it in C++ |
17:38:02 | zacharycarter[m] | xbox one / ps4 won't run java anyway so there was no way it was going to those platforms as a java app |
17:38:23 | Calinou | well, it depends on whether you still consider the Java Edition the prime option for playing Minecraft |
17:38:26 | zacharycarter[m] | or iOS for that matter |
17:38:30 | Calinou | (for the vast majority of power Minecrafters… it is :P) |
17:38:42 | zacharycarter[m] | it's the shitty edition |
17:38:43 | zacharycarter[m] | because notch wrote it |
17:38:52 | Calinou | I've never played any other edition |
17:39:06 | zacharycarter[m] | I've never played minecraft |
17:39:10 | Calinou | heh |
17:39:11 | zacharycarter[m] | so I can beat you there |
17:39:47 | Yardanico | you can go to #nim-offtopic btw:) |
17:42:59 | * | thomasross quit (Remote host closed the connection) |
17:43:23 | * | thomasross joined #nim |
17:47:10 | Yardanico | https://github.com/dylanbeattie/rockstar currently trending on github :D |
17:53:35 | FromGitter | <rayman22201> so, @dom96, what bottlenecks are left in httpbeast? what needs to happen to get it into the top 10? :-D |
17:54:35 | Calinou | https://gitlab.com/Calinou/clr/-/jobs/84073188 :| |
17:54:41 | Calinou | it's calling the 64-bit compiler on CI, but it works locally |
17:55:07 | dom96 | rayman22201: no idea :) |
17:56:11 | FromGitter | <rayman22201> time to break out the profiler :-) |
18:01:24 | * | TheLemonMan joined #nim |
18:02:23 | dom96 | It's fast enough. I'm happy with those results :) |
18:02:40 | TheLemonMan | hello people, I wrote a small lib to detect if your cpu supports a given set of features (eg AVX or SSE), you can find it here https://github.com/LemonBoy/cpu_featuredet |
18:03:36 | TheLemonMan | as usual I winged the windows/vcc part so feel free to test it (at least before I submit this to the package central) |
18:11:57 | Yardanico | TheLemonMan, does it work for osx? https://github.com/jackmott/nim_simd had issues with osx |
18:16:26 | FromGitter | <Varriount> dom96: Why isn't it present in the single-request/multi-request categories? |
18:16:28 | TheLemonMan | Yardanico, I think so, unless Apple botched the cpuid implementation :) |
18:17:53 | dom96 | Varriount: Because I didn't implement that |
18:17:58 | dom96 | It requires a DB |
18:27:01 | * | halirc quit (Quit: Leaving) |
18:44:20 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
18:57:48 | * | xylef quit (Quit: WeeChat 2.2) |
19:05:17 | * | dddddd joined #nim |
19:07:31 | Calinou | new version is up, with 32-bit Windows binaries :) I had to symlink the 32-bit MinGW compiler to the 64-bit one so that Nim picked the right one :| |
19:07:31 | Calinou | https://github.com/Calinou/clr/releases |
19:08:04 | Calinou | I know 32-bit Windows is very uncommon, but surely someone has a 32-bit Windows Vista machine they love to use for color manipulation /s |
19:08:12 | Calinou | (it's uncommon in developer circles at least) |
19:25:23 | FromGitter | <Varriount> Calinou: Most games are distributed as 32-bit binaries. |
19:45:57 | * | Vladar quit (Quit: Leaving) |
19:49:23 | Calinou | that's not true for modern AAA or even indie releases :) |
19:49:33 | Calinou | indies often still distribute 32-bit binaries, but many AAAs already went 64-bit only |
19:49:38 | Calinou | Battlefield 4 was one of the first, in 2013 |
19:49:47 | Calinou | they also don't support Windows XP anymore for the most part |
19:50:27 | Calinou | of course, many games have a significant userbase using 32-bit Windows or even Windows XP, so these are going to keep working on those platforms for a while |
20:04:45 | FromGitter | <Quelklef> Is the behavior of `shr` and `shl` dependent on endianness? |
20:05:04 | * | yglukhov[i] quit (Read error: Connection reset by peer) |
20:05:38 | * | yglukhov[i] joined #nim |
20:06:42 | FromGitter | <Quelklef> I'm little endian, but `1 shl 2 == 4`. So... no? |
20:07:15 | * | Trustable quit (Remote host closed the connection) |
20:11:35 | * | stefanos82 quit (Ping timeout: 240 seconds) |
20:14:14 | FromGitter | <Quelklef> `18 shr 4` is giving `0` in certain situations, what the hell? |
20:14:52 | FromGitter | <Quelklef> `18'u64` to be precise |
20:15:59 | * | iffy joined #nim |
20:16:09 | FromGitter | <Varriount> What situations would this be? |
20:18:53 | FromGitter | <Quelklef> Wait, this is probably my error |
20:18:59 | iffy | Coming from Python. What's the equivalent of ["a","b","c"][1:]? (I have a seq[string] and I want a new seq[string] with all but the first element). Also, is this the place to ask? |
20:19:10 | FromGitter | <Quelklef> But to be sure @Varriount, does shr/shl depend on endianness? |
20:19:30 | FromGitter | <Quelklef> I'm trying to understand precisely how they work, and I think my misuse of them is causing the error |
20:24:26 | Araq | iffy: right place and it's ["a", "b", "c"][1 .. ^1] |
20:25:49 | iffy | Araq: ah, ^1, not ^0 :) Thanks |
20:28:24 | * | stefanos82 joined #nim |
20:42:28 | * | arecacea1 quit (Read error: Connection reset by peer) |
20:42:52 | * | arecacea1 joined #nim |
20:47:08 | * | nekits joined #nim |
20:49:57 | * | ieatnerds quit (Ping timeout: 240 seconds) |
20:57:00 | * | yglukhov[i] quit (Remote host closed the connection) |
20:57:35 | * | yglukhov[i] joined #nim |
21:02:02 | * | yglukhov[i] quit (Ping timeout: 244 seconds) |
21:03:43 | * | Jesin quit (Quit: Leaving) |
21:05:53 | * | Jesin joined #nim |
21:17:25 | * | iffy quit (Quit: Leaving.) |
21:25:57 | * | yglukhov[i] joined #nim |
21:38:03 | FromGitter | <Quelklef> !eval 8'u64 shl 64 |
21:38:13 | FromGitter | <Quelklef> !eval echo(8'u64 shl 64) |
21:38:21 | FromGitter | <Quelklef> uhh |
21:38:33 | NimBot | Compile failed: <no output> |
21:38:45 | NimBot | Compile failed: <no output> |
21:38:55 | FromGitter | <Quelklef> !eval echo(int(8'u64 shl 64)) |
21:39:26 | NimBot | Compile failed: <no output> |
21:39:53 | FromGitter | <Quelklef> Ok, whatever. With `nim secret`, it gives `8`. Is that a bug? |
21:44:35 | * | yglukhov[i] quit (Remote host closed the connection) |
21:58:10 | * | BitPuffin quit (Remote host closed the connection) |
22:01:02 | * | Jesin quit (Quit: Leaving) |
22:02:40 | * | beatmox quit (Remote host closed the connection) |
22:03:10 | * | beatmox joined #nim |
22:12:59 | dom96 | https://play.nim-lang.org/ is down again it seems |
22:13:26 | dom96 | zacharycarter[m]: do I need to implement a feature in NimBot that highlights you when this happens? |
22:15:53 | stefanos82 | Quelklef: I tested it with numpy's uint64 and it returns 8 |
22:16:03 | stefanos82 | so I guess it's the correct output |
22:17:27 | FromGitter | <Quelklef> ...odd |
22:17:48 | FromGitter | <Quelklef> Maybe it's a C detail |
22:17:52 | FromGitter | <Quelklef> that leaked into Nim? |
22:19:02 | stefanos82 | I have also tried it with C's uint64_t and returns 8 as well |
22:20:30 | FromGitter | <Quelklef> This post: https://www.experts-exchange.com/questions/28219698/How-to-left-or-right-shift-all-the-bits-in-a-64-bit-unsigned-integer.html seems to say that it's undefined behavior |
22:20:36 | FromGitter | <Quelklef> Hm |
22:34:29 | * | icebattle joined #nim |
22:45:07 | FromGitter | <honewatson> Well done on your improved benchmarks @dom96 |
22:48:20 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
22:59:57 | FromDiscord | <2vg> wow, httpbeast is god speed 😃 |
23:05:47 | FromGitter | <gogolxdong> How to transform NimNode which repr is [...] to seq or array? |
23:08:22 | FromGitter | <Quelklef> @gogolxdong |
23:08:48 | FromGitter | <Quelklef> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b57b17f6dd1ab572339f856] |
23:09:33 | FromGitter | <Quelklef> Ah cool the `{.compileTime.}` pragma doesn't need to be explicitely mentioned |
23:19:20 | FromGitter | <gogolxdong> Yes ,it works. I tried newLit repr n[4] ,which n[4] repr is like ["singleHost", "multiHost"] |
23:19:50 | FromGitter | <Quelklef> Come again? |
23:20:10 | FromGitter | <gogolxdong> and I'm trying to make enum `newEnum(typeIdent,n[4], true,true)` |
23:21:17 | FromGitter | <Quelklef> I've no idea what you're talking about |
23:21:44 | * | Jesin joined #nim |
23:34:50 | FromGitter | <gogolxdong> I'm trying to make enum using newEnum(typeIdent,n[4], true,true), which n[4] repr is like ["singleHost", "multiHost"], wondering whether there is a one line transform to do like what it does as your func. |
23:36:06 | FromGitter | <gogolxdong> actually it's ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b57b7e6c0fa8016e7355f4e] |
23:36:27 | * | ftsf joined #nim |
23:36:56 | FromGitter | <gogolxdong> to strip double quote mask. |
23:38:11 | FromGitter | <Quelklef> what's wrong with just using my function and `newEnum(typeIdent, @n[4], true, true)`? |
23:41:25 | FromGitter | <Quelklef> How can I use bash escape codes like `\033[1A` with `echo` or `stdout.write`? |
23:41:55 | FromGitter | <gogolxdong> n[4] is NimNode, I think this is the only way. |
23:42:32 | FromGitter | <Quelklef> `newEnum(typeIdent, @(n[4]), true, true)` should do exactly what you want @gogolxdong |
23:43:05 | FromGitter | <Quelklef> Oh fantastic, the terminal module lets me set the cursor position. Never mind! |
23:43:33 | FromGitter | <gogolxdong> type mismatch: got <NimNode> |
23:43:49 | FromGitter | <Quelklef> Right, you have to put my `@` definition as well |
23:48:27 | FromGitter | <gogolxdong> what's the trick of `func` ,does it allow you to overload operator? |
23:48:48 | FromGitter | <gogolxdong> without warning. |
23:48:50 | FromGitter | <Quelklef> No, `func X` just means `proc X {.noSideEffect.}` |
23:52:11 | FromGitter | <gogolxdong> what does this mean `This means that the proc/iterator only changes locations that are ⏎ reachable from its parameters and the return value only depends on the ⏎ arguments.` |
23:53:00 | FromGitter | <Quelklef> Essentially, `func` means "I keep to my signature" |
23:53:14 | FromGitter | <Quelklef> so if `func` has a `var` parameter, it's allowed to modify that. If it doesn't, it's not |
23:53:19 | FromGitter | <Quelklef> It's not allowed to modify any globals |
23:53:25 | FromGitter | <Quelklef> It can't print to screen |
23:53:26 | FromGitter | <Quelklef> etc etc etc |
23:56:02 | FromGitter | <gogolxdong> then debug for `func` is tricky. |
23:57:54 | FromGitter | <rayman22201> there is `debugEcho` for that |