00:05:27 | * | ryan_ joined #nim |
00:07:45 | * | number_one quit (Ping timeout: 250 seconds) |
00:18:23 | * | opal quit (Ping timeout: 240 seconds) |
00:20:06 | * | opal joined #nim |
00:25:23 | * | opal quit (Ping timeout: 240 seconds) |
00:28:54 | * | opal joined #nim |
00:34:33 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hoY awr1, I think this would be the issue 🤔 |
00:58:32 | * | flaviu joined #nim |
01:08:21 | flaviu | https://play.nim-lang.org/#ix=2hp1 -- I'm almost certain that this worked in 2014, but it doesn't seem to work anymore. thoughts? Been having a lot of trouble bisecting and so on. |
01:09:50 | FromDiscord | <Rika> that shouldnt work i dont think |
01:15:33 | * | ryan__ joined #nim |
01:15:44 | * | chemist69 quit (Ping timeout: 246 seconds) |
01:17:54 | * | chemist69 joined #nim |
01:18:12 | * | ryan_ quit (Ping timeout: 256 seconds) |
01:18:48 | flaviu | well I think it's debatable whether it should work or not, but it doesn't. I'm just hoping one of the folks that's been around for a while to tell me I screwed up back then :) |
01:34:54 | FromGitter | <iffy> When the compiler complains that you discard a Future, how does it know you did that? And can I make the compiler fail if callers discard my own custom return type? |
01:36:49 | * | lritter quit (Ping timeout: 264 seconds) |
01:37:11 | * | lritter joined #nim |
01:43:56 | ryukoposting | anyone else getting "undeclared identifier" when trying to use the capture macro from sugar? |
01:44:00 | ryukoposting | 1.0.6 |
01:44:32 | companion_cube | if I have a `x: var Foo` with Foo a ref object, does x.addr point to the foo, or to x itself? |
01:45:28 | ryukoposting | x itself, I believe |
01:45:39 | ryukoposting | I could be wrong though |
01:46:17 | companion_cube | how do I get the address of the object itself? (if I want to compare or hash by address) |
01:46:50 | FromGitter | <iffy> `.repr` will get you the address usually -- or `.addr` or `.unsafeAddr` |
01:48:06 | ryukoposting | companion_cube https://nim-lang.org/docs/system.html#addr%2CT seems to indicate how to use repr and addr together |
01:49:43 | companion_cube | so p.addr is like &p, and p[] is like *p in C? |
01:49:57 | ryukoposting | yup |
01:51:21 | companion_cube | thanks! |
01:51:51 | ryukoposting | no problem, what are you working on? |
01:57:30 | companion_cube | trying my hand at a small CLI tool, a proof checker |
01:59:54 | * | oculuxe quit (Quit: blah) |
02:00:56 | ryukoposting | that's pretty sweet, the pointers are to interface with a C library presumably? |
02:01:14 | * | endragor joined #nim |
02:02:09 | * | oculux joined #nim |
02:07:58 | companion_cube | oh in this case no, it's just because I'm implementing a DAG structure and comparing addresses |
02:08:07 | companion_cube | same way I'd do in C |
02:08:23 | companion_cube | when I create an object with a table inside, do I need to initialize it automatically? |
02:08:31 | companion_cube | manually* |
02:10:01 | companion_cube | (also: is there a way to derive $ for a simple object?) |
02:12:10 | companion_cube | ok so it doesn't initialize tables... |
02:15:12 | * | zacharycarter quit (Ping timeout: 256 seconds) |
02:18:43 | FromGitter | <sealmove> so I've got a gcc 5.4.0 ... |
02:18:56 | FromGitter | <sealmove> Does Nim 1.0.0 support it? |
02:19:37 | * | endragor quit (Ping timeout: 258 seconds) |
02:22:31 | FromGitter | <sealmove> actually it might be even older, 4.8 |
02:22:47 | FromGitter | <sealmove> 🤮 |
02:22:47 | leorize | @sealmove: yes |
02:23:12 | leorize | you need newer gcc for nim 1.2 without -d:nimEmulateOverflowChecks |
02:23:23 | leorize | though I'll see if I can make it so that you don't have to |
02:24:25 | FromGitter | <sealmove> nice |
02:24:35 | companion_cube | there's a syntax for default values, right? can't seem to be able to declare a field of type `TableRef[A,B]` with an initializer |
02:24:53 | companion_cube | so I have to create this table in `newFoo` and it's error prone since the default behavior is `nil` |
02:25:01 | leorize | do you have a failing example? |
02:25:13 | leorize | just `= newFoo`? |
02:25:14 | companion_cube | declare the type, `proc newFoo(): Foo = init(result)` |
02:25:22 | FromGitter | <sealmove> meanwhile, is there a convenient way to download an install a previous version? currently I use the recommended `curl https://nim-lang.org/choosenim/init.sh -sSf | sh` |
02:25:30 | companion_cube | I mean, I'd like the compiler to tell me I didn't initialize a field |
02:25:40 | leorize | @sealmove: you can use it |
02:25:46 | companion_cube | `not nil` should be the default :/ |
02:25:52 | leorize | companion_cube: tag the field with `{.requiresInit.}` |
02:25:56 | companion_cube | :o nice |
02:27:03 | companion_cube | not nil would be nice, but well |
02:27:21 | leorize | not nil will work once we iron out all the bugs :P |
02:28:03 | companion_cube | is it "safe" to enable the experimental not nil? |
02:28:07 | leorize | https://github.com/nim-lang/RFCs/pull/169 <- here's a related RFC |
02:28:25 | leorize | companion_cube: "safe" in the sense that there won't be memory errors, yes |
02:28:39 | leorize | "safe" in the sense that it actually work well, no :P |
02:29:01 | leorize | the thing is so terrible you gotta pretty print all the checks if you want it to actually function |
02:29:09 | companion_cube | in the sense that it won't disappear in the future |
02:29:10 | companion_cube | ah :/ |
02:30:06 | leorize | we got the tech to get it rolling, just that no one spent time to do so |
02:30:23 | * | muffindrake quit (Ping timeout: 265 seconds) |
02:30:35 | leorize | well it's pretty low on the list, even in our surveys |
02:31:09 | companion_cube | "faster horses" and all that :) |
02:31:37 | companion_cube | (`type Foo = ref object not nil …` isn't valid. btw) |
02:31:57 | leorize | it's vaild, you just gotta be a bit creative |
02:32:06 | * | muffindrake joined #nim |
02:32:08 | leorize | type Foo = (ref object) not nil |
02:32:11 | companion_cube | :DDDD nice |
02:33:02 | companion_cube | ah yeah, but I meant, to declare the fields afterwards |
02:33:26 | leorize | it will work once someone report a bug related to it :P |
02:33:38 | companion_cube | `cannot prove 'newTable(64)' is not nil` ahhh right |
02:34:13 | leorize | you gotta do a lot of spoon feeding just to prove it to the compiler |
02:34:26 | leorize | we have a CFG that can analyze these kinds of things |
02:34:46 | leorize | but it's a new technology in the compiler, and not nil is an old one, so it's not hooked into it |
02:37:38 | FromDiscord | <tjpalmer> I have a question. The following code builds without `--gc:arc`, but not with arc: |
02:37:38 | FromDiscord | <tjpalmer> ```nim |
02:37:38 | FromDiscord | <tjpalmer> func call_me(n: int32): cstring {.exportc.} = |
02:37:39 | FromDiscord | <tjpalmer> let hi = "hi" |
02:37:39 | FromDiscord | <tjpalmer> system.GC_ref(hi) |
02:37:39 | FromDiscord | <tjpalmer> hi |
02:37:40 | FromDiscord | <tjpalmer> ``` |
02:37:41 | FromDiscord | <tjpalmer> The error I get is: |
02:37:42 | FromDiscord | <tjpalmer> ``` |
02:37:44 | FromDiscord | <tjpalmer> Error: type mismatch: got <string> |
02:37:45 | FromDiscord | <tjpalmer> but expected one of: |
02:37:47 | FromDiscord | <tjpalmer> proc GC_ref[T](x: ref T) |
02:37:49 | FromDiscord | <tjpalmer> first type mismatch at position: 1 |
02:37:50 | FromDiscord | <tjpalmer> required type for x: ref T |
02:37:52 | FromDiscord | <tjpalmer> but expression 'hi' is of type: string |
02:37:53 | FromDiscord | <tjpalmer> |
02:37:55 | FromDiscord | <tjpalmer> expression: system.GC_ref(hi) |
02:37:56 | FromDiscord | <tjpalmer> ``` |
02:38:02 | FromDiscord | <tjpalmer> Any thoughts? |
02:38:50 | companion_cube | leorize: thanks, opened an issue |
02:41:57 | * | endragor joined #nim |
02:43:59 | FromDiscord | <Varriount> This is interesting.. how is `x == 'a' or x == 'b'` slower than `x in {'a', 'b'}`? |
02:44:37 | FromDiscord | <Varriount> I ran some benchmarks, and the latter solution was slightly slower |
02:44:45 | FromDiscord | <Varriount> *former |
02:46:28 | * | zacharycarter joined #nim |
02:50:41 | * | zacharycarter quit (Ping timeout: 250 seconds) |
02:50:56 | companion_cube | `{'a', 'b'}` is a bitset, I think |
02:51:06 | companion_cube | so that's just a mask operation and != 0 |
02:51:25 | companion_cube | ah maybe a bit more, but still |
02:51:36 | companion_cube | less branching I guess, especially as the set goes bigger |
02:54:53 | * | arecaceae quit (Remote host closed the connection) |
02:55:21 | * | arecaceae joined #nim |
03:03:20 | companion_cube | hmm seems like my distro (arch) has a bad packaging, `nim doc` can't find the css file |
03:04:19 | * | NimBot joined #nim |
03:05:48 | FromDiscord | <KingDarBoja> Arrrghhh been struggling with this thing, it is not possible to the compiler to assign a derived class type to a base class type on some type property? |
03:06:31 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hps |
03:10:42 | FromDiscord | <KingDarBoja> And been looking for some issues / posts about it |
03:11:38 | * | nekits joined #nim |
03:13:17 | FromDiscord | <KingDarBoja> So far the only thing requires type casting ... |
03:16:53 | FromDiscord | <KingDarBoja> https://matthiashager.com/nim-object-oriented-programming Hummm |
03:17:18 | FromDiscord | <Varriount> You need to have a parent ref object |
03:17:35 | FromDiscord | <Varriount> Er, parent ref type |
03:17:55 | FromGitter | <dumjyl> Just upconv them, https://play.nim-lang.org/#ix=2hpu |
03:20:53 | FromDiscord | <KingDarBoja> @Varriount at the example, it is supposed to be "Foo" the parent ref object |
03:20:53 | FromDiscord | <KingDarBoja> While Bar is the derived class which stores a property as `seq[Foo]` |
03:22:56 | * | zacharycarter joined #nim |
03:23:31 | FromDiscord | <Varriount> What are you trying to model? Show me the Python code. |
03:24:27 | FromDiscord | <KingDarBoja> awr1 helped me but we stomped on some weird (or maybe we are wrong) behaviour |
03:24:29 | FromDiscord | <KingDarBoja> Hold on |
03:26:13 | FromDiscord | <KingDarBoja> https://github.com/graphql-python/graphql-core/blob/master/src/graphql/error/graphql_error.py#L95 This line defines some property on the class GraphQLError, in this case, the `nodes` property is what you looking for |
03:26:45 | FromDiscord | <KingDarBoja> I did pretty much the same on Nim -> https://github.com/KingDarBoja/Phosphate/blob/master/src/error/graphql_error.nim#L73 |
03:27:29 | FromDiscord | <KingDarBoja> The problem is that you can pass a `SelectionNode` type to that init parameter (`Node`) |
03:27:56 | FromDiscord | <KingDarBoja> It's not big deal on Python as SelectionNode is the derived type of Node base type (AST file) |
03:28:22 | * | zacharycarter quit (Ping timeout: 265 seconds) |
03:28:41 | FromDiscord | <KingDarBoja> But here, when trying to run the test, looks like it gets mad because the passed type isn't "Node" but "SelectionNode" |
03:29:04 | FromDiscord | <KingDarBoja> https://github.com/KingDarBoja/Phosphate/blob/master/tests/error/test_graphql_error.nim#L51 This tests. |
03:30:41 | * | oculux quit (Quit: blah) |
03:31:16 | FromDiscord | <KingDarBoja> awr1 pointed out some possible fix -> https://play.nim-lang.org/#ix=2hoN |
03:31:17 | FromDiscord | <KingDarBoja> I tried it and didn't worked out, also tried this -> https://play.nim-lang.org/#ix=2hpy |
03:31:28 | * | oculux joined #nim |
03:35:28 | FromDiscord | <Varriount> @KingDarBoja Is the Node type an object, or a reference? |
03:36:14 | FromDiscord | <KingDarBoja> It is a ref -> type TypeNode* = ref object of Node |
03:37:15 | FromDiscord | <KingDarBoja> -> type Node* = ref object of RootObj |
03:40:42 | FromDiscord | <KingDarBoja> https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L86 |
03:41:03 | companion_cube | how to return `something or nil`? as a type? |
03:41:25 | companion_cube | ah wait, nevermind |
03:44:29 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:01:12 | FromDiscord | <KingDarBoja> @Varriount Seems to be something that I can't avoid as seen on this sample -> https://play.nim-lang.org/#ix=2hpE |
04:01:25 | FromDiscord | <KingDarBoja> The part that says _With reference objects, we must treat it as a Node before using it as one_ |
04:06:02 | * | supakeen quit (Quit: WeeChat 1.9.1) |
04:06:41 | * | supakeen joined #nim |
04:20:29 | FromDiscord | <Varriount> @KingDarBoja Would methods work? https://nim-lang.github.io/Nim/manual.html#multiminusmethods |
04:21:01 | FromDiscord | <Varriount> I think the part about requiring a compiler flag might be erroneous, but otherwise that looks correct. |
04:21:22 | * | narimiran joined #nim |
04:22:28 | FromDiscord | <KingDarBoja> So methods allow dynamic parameters, in this case, pass derived objects if parent object type is specified? |
04:23:18 | FromDiscord | <KingDarBoja> Also, should I worry about this note -> _Note: Starting from Nim 0.20, generic methods are deprecated._ |
04:24:33 | FromDiscord | <Varriount> Are you using generics? |
04:24:39 | FromDiscord | <Varriount> (and if so, why?) |
04:25:59 | FromDiscord | <KingDarBoja> No, not using generic on my code |
04:26:08 | FromDiscord | <KingDarBoja> If you mean passing [T] |
04:28:35 | FromDiscord | <KingDarBoja> But looks like if I want to pass a derived type I MUST provide proc calls for each derived type lol |
04:28:53 | FromDiscord | <KingDarBoja> Not really want I want lol |
04:28:57 | FromDiscord | <Varriount> Well, yes. That's presumably why you're deriving types |
04:29:14 | FromDiscord | <Varriount> You don't have to provide a new call, unless you want to change behavior. |
04:29:33 | FromDiscord | <Varriount> Child types will inherit parent methods that haven't been overridden. |
04:33:01 | FromDiscord | <KingDarBoja> https://github.com/KingDarBoja/Phosphate/blob/master/src/error/graphql_error.nim#L71 so this proc can be turned into method and any node parameter that is a derived type of `Node` should work? |
04:33:33 | * | nsf joined #nim |
04:37:33 | FromDiscord | <Varriount> Yes |
04:38:06 | kungtotte | https://play.nim-lang.org/#ix=2hpH |
04:38:34 | FromDiscord | <Varriount> Though, your when statements won't work. `when` is for compile-time evaluation. |
04:39:01 | FromDiscord | <KingDarBoja> You're right... D: |
04:41:04 | * | endragor quit (Remote host closed the connection) |
04:44:02 | * | endragor joined #nim |
04:48:08 | FromGitter | <awr1> i don't really understand what you're trying to do here |
04:48:25 | FromDiscord | <KingDarBoja> Arrghh hard to test, changing stuff but looks like Option module could be ruining it |
04:48:36 | FromDiscord | <Varriount> awr1: They are trying to model an AST using inheritance. |
04:49:04 | FromDiscord | <KingDarBoja> What variount said |
04:49:13 | FromGitter | <awr1> this sort of thing is why i like variants more often than not |
04:51:17 | FromDiscord | <KingDarBoja> Without changing the when and using "method" instead of "proc" -> required type for nodes: Option[seq[Node]] or Option[ast.Node] but expression 'fieldNode' is of type: SelectionNode |
04:51:25 | FromDiscord | <KingDarBoja> I want to hang myself |
04:52:05 | FromDiscord | <KingDarBoja> Probably as I said, the Options thing messing |
04:53:12 | kungtotte | awr1: variants are easier if you're making something that's for internal use only, or something where you expect consumers of your library to add many new uses of your types but no new types. If you're making something that's supposed to be extendable, variants become a pain in the butt |
04:53:31 | FromGitter | <awr1> variants do have their limitation |
04:53:42 | FromGitter | <awr1> s |
04:53:42 | FromDiscord | <KingDarBoja> if I remove it, I have to deal with `Node or seq[Node]` and that thing seems to be another pain in the a** |
04:54:17 | FromGitter | <awr1> i was talking about this sort of thing in regards to nim's macro systems, that i wish we could have StmtList, Expr, etc. types instead of passing around NimNodes everywhere |
04:54:21 | FromGitter | <awr1> a few days ago |
04:54:30 | kungtotte | Node vs. seq[Node] is fixed more easily with overloading I think |
04:54:53 | FromGitter | <awr1> maybe make Node a typeclass |
04:55:02 | FromGitter | <awr1> /shrug |
04:55:05 | FromDiscord | <KingDarBoja> A typeclass? |
04:55:23 | FromGitter | <awr1> well |
04:55:51 | FromGitter | <awr1> you can have a inheritance tree, RootNode, SpecialNode, ExprNode, whatever it is you have |
04:56:09 | FromGitter | <awr1> and then `type Node = RootNode or SpecialNode or ExprNode` |
04:56:28 | FromDiscord | <KingDarBoja> Node is my root Node lol |
04:57:57 | FromDiscord | <KingDarBoja> But I feel like I have seen that before |
04:58:07 | leorize | @Varriount: it's a bitset, so checking took one operation instead of two. |
05:01:57 | FromDiscord | <KingDarBoja> https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L86 This is it, sitting as my Base type for all the rest of types on the AST |
05:01:58 | FromDiscord | <Varriount> leorize: But wouldn't the character need to be converted to a bit representation? |
05:02:47 | * | ryan__ quit (Remote host closed the connection) |
05:02:53 | FromDiscord | <Varriount> @KingDarBoja https://github.com/Varriount/commandant/blob/master/commandant/parser.nim#L5 |
05:04:22 | FromDiscord | <KingDarBoja> There is a flaw to that approach and it is related to not being able to use the same parameter name for multiple derived kinds |
05:05:10 | leorize | @Varriount: what does that even mean :P |
05:08:09 | leorize | here's how it's implemented: https://github.com/nim-lang/Nim/blob/devel/compiler/bitsets.nim#L39 |
05:10:53 | * | Knaque joined #nim |
05:12:23 | FromDiscord | <KingDarBoja> Okay I gave up for todat |
05:12:26 | FromGitter | <awr1> @leorize did you get a chance to see this? https://github.com/nimterop/nimterop/issues/177 |
05:13:18 | FromDiscord | <Varriount> KingDarBoja: What do you mean? All my nodes have the 'token' and 'unlinked' fields. |
05:13:52 | leorize | @awr1: can't you not do this already with `cPlugin`? |
05:14:47 | FromGitter | <awr1> cPlugin isn't advanced enough to my knowledge, unless i'm missing something |
05:14:51 | leorize | I'm all in for a way to better transform things though |
05:15:12 | FromGitter | <awr1> you get a collection of node kinds, but no real node tree |
05:16:09 | shashlick | We can certainly add the ability to manipulate the resulting ast |
05:16:16 | shashlick | Will share my thoughts tomorrow |
05:16:33 | FromDiscord | <KingDarBoja> But what if one of your Nodes requires a diferent type for let's say, `unlinked` being a integer instead of bool for `NKCommandSub` |
05:22:00 | FromDiscord | <KingDarBoja> kungtotte: Yeah, it is the options module -> https://play.nim-lang.org/#ix=2hpP |
05:22:23 | FromDiscord | <KingDarBoja> Check the second error message |
05:23:01 | * | Knaque quit (Remote host closed the connection) |
05:24:37 | kungtotte | The first warning gives you a clue about the issue. It's telling you that the second method is a baseless method (base method without {.base.} pragma), meaning that it sees the two methods as separate base methods due to differing type signatures |
05:25:56 | * | Knaque joined #nim |
05:26:31 | * | Knaque quit (Remote host closed the connection) |
05:27:14 | kungtotte | It errors out on two.print() because it can't match print(ChildTwo) to either print(ChildOne) or print(Option[BaseObj]) |
05:32:25 | FromDiscord | <KingDarBoja> So if providing the pragma to the second method and chaning its type signature to use Option too, it still fails |
05:32:32 | FromDiscord | <KingDarBoja> Just curious right now why |
05:32:42 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hpQ |
05:33:25 | kungtotte | Because you're mixing different type signatures, BaseObj and ChildOne are wrapped in Option[] but ChildTwo isn't, so it's not matched against the same type signature |
05:34:15 | Yardanico | is there a way to make Nim not pass "-g" to the C compiler? |
05:34:44 | Yardanico | ah, debuginfo probablyh |
05:35:17 | Yardanico | or not |
05:36:08 | leorize | Yardanico: just don't pass `-g` to Nim? |
05:36:12 | FromDiscord | <KingDarBoja> Ohhh, so wrapping in Option[] is different that letting those be without it |
05:36:17 | Yardanico | leorize: I don't? |
05:36:34 | kungtotte | KingDarBoja: yes, why wouldn't it be? It's a different type after all. |
05:36:35 | leorize | are you passing --debugger:native or anything like that? |
05:36:38 | Yardanico | no |
05:36:40 | FromDiscord | <KingDarBoja> That's why your first example works with type inheritance |
05:36:46 | Yardanico | wait let me check if -g is actually there or not |
05:36:48 | leorize | maybe check your config then? |
05:37:00 | FromDiscord | <KingDarBoja> And this one with Options[] don't |
05:37:49 | * | FromDiscord <KingDarBoja> Please tell me this is it |
05:41:25 | * | lritter quit (Ping timeout: 250 seconds) |
05:50:00 | * | leorize[m] left #nim ("Kicked by @appservice-irc:matrix.org : issued !quit command") |
05:55:40 | * | leorize[m] joined #nim |
05:58:00 | * | leorize-M joined #nim |
05:58:32 | FromDiscord | <Varriount> Yes |
06:00:12 | FromDiscord | <Varriount> `Option[ChildRefType]` cannot be converted to `Option[ParentRefType]` |
06:02:01 | Yardanico | ohh I'm bashing my head against the wall |
06:02:15 | * | leorize-M left #nim (#nim) |
06:02:33 | Yardanico | when cross-compiling a binary from my PC to aarch64 (to test in termux) it can't do address resolution (getaddrinfo fails with EAI_AGAIN ) |
06:02:48 | Yardanico | when I compile it in termux itself (it has nim in its repos) it works just fine |
06:02:59 | Yardanico | maybe it's due to me using musl, not sure |
06:03:43 | Yardanico | https://androidsavvydev.wordpress.com/2020/01/28/getaddrinfo-from-musl-does-not-work-on-android-try-again/ |
06:03:44 | Yardanico | oh |
06:03:56 | * | zacharycarter joined #nim |
06:04:02 | leorize | musl needs /etc/resolv.conf :P |
06:04:18 | leorize | android certainly don't have that |
06:04:54 | Yardanico | well I can try to create it to try xd |
06:05:04 | Yardanico | (since i have root on my phone) |
06:05:05 | Yardanico | just to test |
06:06:06 | Yardanico | yeah you're right it works |
06:06:19 | * | solitudesf joined #nim |
06:07:17 | leorize | did dom96 quiet all unindentified users? |
06:08:37 | * | zacharycarter quit (Ping timeout: 264 seconds) |
06:17:16 | FromDiscord | <KingDarBoja> ARGH, @Varriount well I will keep using Option as I am dumb to know how to handle Union types as proc parameters, e.g. `int or seq[int]` |
06:17:48 | kungtotte | I would make two procs instead |
06:18:45 | kungtotte | proc foo(num: int) = discard and proc foo(nums: seq[int]) = discard |
06:18:48 | * | leorize[m] is now known as Guest54101 |
06:18:48 | * | Guest54101 quit (Killed (niven.freenode.net (Nickname regained by services))) |
06:18:54 | * | Guest54101 joined #nim |
06:23:54 | * | leorize[m] joined #nim |
06:25:13 | FromDiscord | <KingDarBoja> And how you would handle múltiple params that uses union types ? More procs? |
06:25:29 | FromDiscord | <KingDarBoja> Would you* |
06:25:33 | Yardanico | you can have them in same proc but use "when" to differentiate |
06:25:44 | kungtotte | v0v it all depends on your overall design |
06:25:47 | Yardanico | but can't you design your program so it's easier to understand rather than use union types? :P |
06:26:10 | kungtotte | I get anxious when the number of params go above ~4 |
06:26:17 | FromDiscord | <KingDarBoja> I like your thinking Yardanicco |
06:27:44 | FromDiscord | <KingDarBoja> Can you provide an example of that Yardanicco? Using the when and two parameters with Union Types? |
06:29:27 | FromDiscord | <KingDarBoja> Like so: proc sample(a: int or seq[int], b: Foo or seq[Foo]) |
06:30:15 | FromDiscord | <Rika> the body of the proc is just a `when a is int and b is Foo: dosmth` and `else: dosmth` |
06:31:08 | Yardanico | @KingDarBoja https://play.nim-lang.org/#ix=2hpX |
06:31:47 | leorize[m] | that looks like a mess :P |
06:31:47 | Yardanico | of course you don't have to put ALL code in the "when", you can have common code for different branches |
06:31:54 | Yardanico | leorize[m]: yeah I agree |
06:31:57 | leorize[m] | what kind of use case are we striving for here? |
06:32:42 | * | leorize[m] quit (Quit: authenticating) |
06:32:49 | * | leorize[m] joined #nim |
06:38:32 | * | moerm joined #nim |
06:38:37 | moerm | Hello everyone |
06:38:38 | kungtotte | I tend to use something like the bottom version here: https://play.nim-lang.org/#ix=2hq0 |
06:40:01 | kungtotte | If your algorithm doesn't work with sequence of len == 1, then I don't think it should be the same proc. You should have a processOne and a processMany proc if the algorithm is sufficiently different for int vs seq[int] |
06:40:50 | kungtotte | And if you have so many parameters that doing that becomes unwieldy, maybe you have too many parameters |
06:41:02 | supakeen | moerm: Good morning! |
06:44:07 | FromDiscord | <KingDarBoja> Oh yeah, a mess as I thought lol |
06:44:20 | * | zacharycarter joined #nim |
06:44:25 | FromDiscord | <KingDarBoja> Last question before going to bed |
06:45:11 | FromDiscord | <KingDarBoja> Doesn't matter if I set as default parameter a nil value for Unión Types? |
06:46:21 | Yardanico | seqs and strings can't be nil anymore |
06:48:34 | * | zacharycarter quit (Ping timeout: 240 seconds) |
06:52:05 | FromDiscord | <KingDarBoja> Yikes |
06:52:08 | FromDiscord | <KingDarBoja> Okok |
06:55:05 | FromDiscord | <KingDarBoja> So you are forced to provide some value to Union Types in case of passing a sequence of some type or the type itself, i.e `myHumbleType or seq[myHumbleType]` |
06:55:15 | FromDiscord | <KingDarBoja> And not just nil |
06:56:03 | Yardanico | so just use procedure overloading please |
06:57:03 | Yardanico | also I found a codegen bug right now, xD |
06:57:08 | Yardanico | just modified that code I gave you a bit |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:03:17 | * | hoffentlichja quit (Ping timeout: 256 seconds) |
07:04:47 | * | gmpreussner joined #nim |
07:16:45 | * | rockcavera quit (Remote host closed the connection) |
07:22:29 | moerm | Maybe till later ... cu |
07:22:37 | * | moerm quit (Quit: Leaving) |
07:31:57 | * | Vladar joined #nim |
07:38:54 | Prestige | Anyone know of wrappers for xlib or xcb? I haven't found any, but it would be awesome |
07:38:59 | Yardanico | Prestige: yeah there is |
07:39:11 | Yardanico | https://github.com/nim-lang/x11 |
07:40:10 | Prestige | Oh very nice, thanks Yardanico |
07:40:18 | Yardanico | "nimble install x11" |
07:41:24 | Yardanico | You can use https://nimble.directory/ for finding Nim packages |
07:41:44 | Yardanico | or "language:nim query" in github search since almost all Nim libraries are hosted on github |
07:41:54 | Yardanico | https://github.com/search?q=language%3Anim+x11 |
07:42:00 | Prestige | I was just searching specifically for xcb and xlib, ty |
07:42:16 | Prestige | Ah that's handy |
08:41:35 | * | natrys joined #nim |
08:54:37 | dom96 | Good morning everyone |
08:56:03 | Yardanico | good morning |
09:00:20 | FromGitter | <t1273446_twitter> Morning |
09:05:23 | FromGitter | <sealmove> morning |
09:08:49 | FromGitter | <Vindaar> good morning :) |
09:10:35 | * | krux02 joined #nim |
09:10:46 | * | nsf quit (Quit: WeeChat 2.7) |
09:12:39 | * | hoffentlichja joined #nim |
09:16:40 | FromGitter | <faulander> good morning! :) |
09:16:55 | FromGitter | <faulander> although it's already almost lunchtime in central europe ;) |
09:19:43 | FromGitter | <faulander> @Vindaar can you give me the link to your notes once again please? forgot to save it and can't find it here and in my history :/ |
09:22:14 | FromGitter | <Vindaar> @faulander my notes? Are you thinking about @kaushalmodi's notes? |
09:22:26 | FromGitter | <Vindaar> https://scripter.co/notes/nim |
09:25:56 | * | Zectbumo quit (Remote host closed the connection) |
09:34:17 | * | neceve joined #nim |
09:40:27 | * | chemist69 quit (Ping timeout: 260 seconds) |
09:41:21 | * | chemist69 joined #nim |
09:46:52 | FromGitter | <faulander> ah yes, sorry and thank you |
09:47:47 | * | Vladar quit (Quit: Leaving) |
09:52:29 | * | oculux quit (Quit: blah) |
09:53:01 | * | oculux joined #nim |
09:57:18 | * | Vladar joined #nim |
10:05:53 | * | couven92 joined #nim |
10:06:06 | * | xcm quit (Remote host closed the connection) |
10:07:39 | FromGitter | <sealmove> guys, where is the usual place to put stuff you install manually on travis, or linux in general for that matter? |
10:07:57 | FromGitter | <sealmove> /opt? |
10:08:01 | * | xcm joined #nim |
10:09:05 | FromGitter | <Vindaar> @sealmove kinda depends, but either /opt or /usr/local are the most common I think |
10:14:11 | FromGitter | <sealmove> thanks |
10:15:48 | Yardanico | https://github.com/nikku/works-on-my-machine |
10:15:52 | Yardanico | https://github.com/auchenberg/volkswagen |
10:19:28 | FromDiscord | <Rika> LMAO |
10:19:32 | FromDiscord | <Rika> that volkswagen one |
10:27:25 | FromGitter | <sealmove> how does one deal with prompts like `Prompt: No local packages.json found, download it from internet? [y/N]` on CI? |
10:28:08 | FromDiscord | <Rika> i think it was a flag, -y maybe |
10:30:12 | FromGitter | <Vindaar> yes, most tools have flags to auto yes those things. And yes, it's -y for nimble too |
10:30:33 | FromGitter | <sealmove> I am running ./build_all.sh |
10:30:47 | FromGitter | <sealmove> and nimble install |
10:31:16 | FromDiscord | <Rika> `nimble install -y` isnt it? |
10:31:25 | FromDiscord | <Rika> package name ofc forgot that |
10:36:30 | FromGitter | <sealmove> nice |
10:38:41 | FromGitter | <sealmove> finally fixed this hell X_X kaitai ci is so complicated |
10:45:27 | Amun_Ra | is there a way to check if the given value is in enum? |
10:47:02 | Amun_Ra | I mean other than use 'case' |
10:52:01 | FromDiscord | <__ibrahim__> sorry to interrupt, what does this error mean? |
10:52:01 | FromDiscord | <__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698123113384378398/unknown.png |
10:52:20 | FromDiscord | <__ibrahim__> |
10:52:20 | FromDiscord | <__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698123191616274522/unknown.png |
10:52:41 | * | abm joined #nim |
10:54:50 | FromGitter | <Vindaar> @Amun_Ra can you give an example? |
10:56:04 | narimiran | Amun_Ra: `typeof(myEnum)` |
11:05:25 | FromDiscord | <Rika> @__ibrahim__ seems like youre missing some stuff for glfw? |
11:18:50 | FromDiscord | <__ibrahim__> yeah seems like some directx library |
11:19:50 | FromGitter | <sealmove> 1) 9% https://ci.kaitai.io/ :) |
11:22:41 | Amun_Ra | Vindaar: narimiran: http://dpaste.com/0CSDXTB |
11:23:36 | narimiran | Amun_Ra: https://nim-lang.github.io/Nim/strutils.html#parseEnum%2Cstring ? |
11:26:19 | FromGitter | <Vindaar> yeah, since you have strings already anyways, just use `parseEnum` |
11:27:19 | Amun_Ra | that enum is an int |
11:30:09 | FromGitter | <Vindaar> hm, for a second there I thought It'd work anyways, but yeah you're right |
11:30:41 | Amun_Ra | but looking at the parseEnum gave me an idea |
11:32:21 | FromDiscord | <Rika> Amun_Ra |
11:32:28 | FromDiscord | <Rika> are you trying to make a bitset? |
11:32:45 | FromDiscord | <Rika> ah |
11:32:49 | FromDiscord | <Rika> never mind haha |
11:33:27 | FromGitter | <Vindaar> @Amun_Ra: you can do this: https://play.nim-lang.org/#ix=2hro |
11:34:17 | FromGitter | <Vindaar> And note that `Enum(someVal)` (from your code) will fail anyways, if you compile in debug mode. So you could also just activate the flag that checks enums instead |
11:37:01 | Amun_Ra | I writing a BMP reader and I thought I'd use Enum instead of an uint32 filed and a bunch of consts |
11:38:13 | Amun_Ra | http://dpaste.com/2XTZ507 |
11:38:36 | Amun_Ra | the only drawback it does not skip gaps |
11:38:54 | Amun_Ra | (the real enum does not contain only fields of (1<<n)) |
11:39:21 | FromGitter | <Vindaar> which is why I'd use a case statement. If you had many, many elements in that enum, you could generate the case statement with a macro instead of writing it manually |
11:39:41 | Amun_Ra | macro seems to be a nice idea |
11:45:27 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
11:46:24 | * | dddddd joined #nim |
11:47:18 | FromGitter | <Vindaar> spoiler: https://play.nim-lang.org/#ix=2hrx |
11:47:29 | * | ehmry joined #nim |
11:51:28 | Amun_Ra | wow, thanks Vindaar |
11:53:07 | FromGitter | <Vindaar> :) |
11:53:33 | Amun_Ra | I'm quite new to the whole macro world, it'd take me much more than that :) |
11:56:58 | * | SebastianM joined #nim |
11:57:31 | FromGitter | <Vindaar> I was the same at some point, don't worry. You'll get there if you want to |
12:01:56 | * | SebastianM left #nim (#nim) |
12:06:02 | * | supakeen quit (Quit: WeeChat 1.9.1) |
12:06:43 | * | supakeen joined #nim |
12:14:05 | Zevv | macros is just like regular expressions. Write them once, and hope you'll never have to read and understand them at any later point in life |
12:15:14 | * | Guest46432 quit (Ping timeout: 240 seconds) |
12:17:02 | * | dadada joined #nim |
12:17:26 | * | dadada is now known as Guest86017 |
12:20:10 | FromGitter | <Vindaar> I don't they're that bad, but you have a point. |
12:30:28 | Zevv | well, as soon as types are involved I'm easiliy lost. Too bad that my most important macros all make extensive use of types :( |
12:40:50 | FromDiscord | <Rika> Macros are great |
12:41:01 | FromDiscord | <Rika> They're at least more understandable than regex at a glance |
12:42:18 | krux02 | Rika: macros and regex are completely different things. |
12:42:36 | FromDiscord | <Rika> Zevv compared them lol |
12:42:47 | FromDiscord | <Rika> Check them logs yo |
12:48:09 | * | zacharycarter joined #nim |
12:51:30 | FromDiscord | <Recruit_main707> ` Error: 'export' is only allowed at top level` why am i getting this error (code is not even mine, its the python3 wrapper) |
12:51:53 | FromDiscord | <__ibrahim__> can someone explain this to me? |
12:51:53 | FromDiscord | <__ibrahim__> ``` |
12:51:54 | FromDiscord | <__ibrahim__> C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `C:\Users\Administrator\nimcache\game_d\stdlib_assertions.nim.c.o' is incompatible with i386:x86-64 output |
12:51:54 | FromDiscord | <__ibrahim__> ``` |
12:53:27 | * | zacharycarter quit (Ping timeout: 250 seconds) |
13:00:19 | * | zacharycarter joined #nim |
13:02:06 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
13:02:37 | * | ehmry joined #nim |
13:03:09 | FromDiscord | <Recruit_main707> i fixed the error by deleting an `static:` block in the source code, i will include it in the issue i opened i guess |
13:05:59 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
13:06:31 | * | hax-scramper quit (Ping timeout: 256 seconds) |
13:07:05 | * | pbb joined #nim |
13:28:19 | companion_cube | Araq: hmm, `object` and `ref object not nil` are not the same, are they? the latter is on heap? |
13:28:39 | * | narimiran quit (Quit: leaving) |
13:31:28 | * | liblq-dev joined #nim |
13:31:35 | FromGitter | <alehander92> hey! |
13:33:39 | FromGitter | <alehander92> indeed they are not |
13:33:53 | planetis[m] | <companion_cube "Araq: hmm, `object` and `ref obj"> that's right, and for the latter you need to instantiate it |
13:33:54 | FromGitter | <alehander92> ref is a managed pointer |
13:34:24 | planetis[m] | this is done with ``new(result)`` or with ``let foo = Foo()`` |
13:34:48 | FromGitter | <alehander92> i prefer Foo() as its the same for objects/ref objects |
13:35:02 | FromGitter | <alehander92> but iirc `new` is also useful in some generic cases |
13:35:37 | companion_cube | planetis[m]: with `new(result)` or the likes, ritght? |
13:35:37 | planetis[m] | me too |
13:36:07 | companion_cube | I wanted ref semantics, so the object could be shared easily (should really not be copied), is all |
13:36:22 | planetis[m] | yes |
13:38:45 | companion_cube | for now I dropped the `not nil` |
13:39:11 | companion_cube | so far the lack of nil safety is the thing that worries me a bit in nim, otherwise it's quite nice |
13:42:11 | FromGitter | <alehander92> it is supposed |
13:42:13 | FromGitter | <alehander92> to be added soon |
13:42:42 | FromGitter | <alehander92> it's even planned ref to be `not nil` by default |
13:42:51 | companion_cube | yeah that's good. |
13:43:04 | * | Spy653 joined #nim |
13:43:12 | companion_cube | the other thing is better safety when using case structs |
13:43:20 | FromGitter | <alehander92> can you give an example? |
13:43:27 | FromGitter | <alehander92> of case unsafety |
13:43:38 | Spy653 | so this is what irc looks like |
13:43:46 | companion_cube | when using `case` on the tag, one can access the wrong fields without warnings |
13:43:57 | planetis[m] | what does this mean though? the compiler will insert ``if foo != nil: foo.member = 8`` ? |
13:45:30 | zacharycarter | I think - https://github.com/nim-lang/Nim/pull/13897 - might fix the --gc:arc sigsev issue I raised yesterday |
13:46:02 | * | ryukoposting quit (Ping timeout: 260 seconds) |
13:48:05 | zacharycarter | is there a way to install nim from a specific commit hash with choosenim? |
13:48:15 | krux02 | Spy653, IRC is the future |
13:48:25 | FromGitter | <alehander92> planetis[m]: what? |
13:48:42 | krux02 | all these hip technologies will fade away, but IRC with stay with us until the end of time. |
13:48:46 | FromGitter | <alehander92> companion_cube hm, this shouldn't be the case |
13:49:09 | companion_cube | alehander92: I tested last week, and it's not checked by the compiler |
13:49:19 | krux02 | zacharycarter, git checkout <hash> && koch boot -d:release |
13:49:25 | krux02 | zacharycarter, git checkout <hash> && koch boot -d:danger |
13:49:57 | zacharycarter | yeah I know I can do that krux02 but since I'm already using choosenim I wanted to continue to use it if possible |
13:50:16 | zacharycarter | but it doesn't look like the commit hash feature works? or I'm using it improperly - so I guess I'll go with your suggestion :) |
13:50:45 | krux02 | yea |
13:51:37 | krux02 | I never used choosenim. I never heard people telling how awesome choosenim is, only how they have problems with it. |
13:51:52 | zacharycarter | it's pretty nice IMO |
13:52:18 | krux02 | and effectively it replaces "git checkout my-branch && ./koch boot -d:danger" |
13:52:27 | krux02 | often I don't even use koch boot |
13:52:29 | krux02 | I use koch temp |
13:52:44 | krux02 | `koch temp c -r scritch.nim` |
13:52:48 | zacharycarter | but you can also switch between versions of Nim which is nice |
13:53:06 | zacharycarter | it's also a version manager |
13:53:18 | krux02 | bit it can't switch to hashes or branches, which is most important for me. |
13:53:28 | zacharycarter | yeah - I don't think it's great for folks hacking the compiler |
13:53:31 | zacharycarter | but for end users of Nim it's nice |
13:53:40 | krux02 | a version is just a number, I don't need a manager for that. |
13:54:00 | krux02 | maybe it is nice |
13:54:19 | krux02 | I would prefer though, if it wasn't necessary to swtich between different version of Nim. |
13:55:00 | planetis[m] | test |
13:55:01 | zacharycarter | the only time I've really found doing ^ necessary these days is when I want to see if something is broken in devel |
13:55:14 | planetis[m] | finally works |
13:55:14 | krux02 | I am always on devel |
13:55:33 | krux02 | anyway, good luck, I will be back soon. Get some food now |
13:55:37 | FromGitter | <alehander92> sometimes one needs different branches/versions for different projects |
13:55:41 | FromGitter | <alehander92> this is normal, come on :D |
13:55:41 | planetis[m] | sorry alehander42: i was talking about not nil |
13:55:53 | planetis[m] | if it works at compiletime or runtime |
13:56:00 | FromGitter | <alehander92> but yeah i also usually use repos and git easier for maintaining patches |
13:56:10 | FromGitter | <alehander92> planetis[m]: sorry, yes, it works on compiletime |
13:56:27 | planetis[m] | nice |
13:56:29 | * | Vladar quit (Quit: Leaving) |
13:56:45 | FromGitter | <alehander92> https://github.com/nim-lang/RFCs/pull/169 |
13:57:00 | planetis[m] | matrix doesn't work well maybe its time to switch back to irc |
13:57:29 | FromGitter | <alehander92> the rfc is a bit rough, but at least this was the original idea |
13:57:33 | FromGitter | <alehander92> after some discussions |
13:57:42 | FromGitter | <alehander92> now i am not sure if this is how it's gonna be implemented |
13:57:55 | planetis[m] | thanks for the link |
13:58:15 | FromGitter | <alehander92> there exists an example implementation actually |
13:58:31 | FromGitter | <alehander92> but it's still not clear if it's going to be the accepted one + it needs some optimization |
13:58:47 | FromGitter | <alehander92> no problem |
13:58:54 | zacharycarter | well nevermind - that branch does not fix the `--gc:arc` issue I posted yesterday |
14:00:24 | FromDiscord | <KingDarBoja> Good morning |
14:00:38 | FromDiscord | <KingDarBoja> Couldn't sleep well due to doubts at my head lol |
14:01:33 | FromGitter | <alehander92> about programming? dude :D |
14:01:51 | FromGitter | <alehander92> don't sweat it |
14:03:07 | FromDiscord | <KingDarBoja> Happens to me sometimes lol xD |
14:03:14 | FromDiscord | <KingDarBoja> But today is friday, I will relax |
14:03:18 | FromGitter | <alehander92> good! |
14:04:34 | FromDiscord | <KingDarBoja> Just copied all the suggestions and stuf that I discussed yesterday on a notepad file lol |
14:04:49 | FromDiscord | <KingDarBoja> I will analyze it later, now working a bit |
14:15:49 | leorize[m] | planetis[m]: if you're still on matrix.org, switch to another homeserver |
14:16:30 | leorize[m] | also switching the bridge to the kde one is also a good move :p |
14:18:12 | planetis[m] | i will try the kde bridge |
14:18:20 | FromGitter | <alehander92> guys |
14:18:28 | FromGitter | <alehander92> so iterators are coroutines right |
14:18:34 | planetis[m] | thanks for the suggestion |
14:18:43 | FromGitter | <alehander92> like, i know people don't call them coroutines and have more specific definition |
14:18:56 | FromGitter | <alehander92> but i can't understand how is it exactly defined |
14:19:40 | FromDiscord | <KingDarBoja> I just noticed Araq is Nim creator D: |
14:20:13 | FromGitter | <alehander92> basically, coroutines can yield |
14:20:15 | FromGitter | <alehander92> cooperatively |
14:20:50 | FromGitter | <alehander92> and coro.nim seems to me to be about .. preemptiveness? |
14:21:21 | leorize[m] | technically, only closures are |
14:21:21 | FromGitter | <alehander92> as it seems you can `suspend` |
14:21:53 | leorize[m] | and when they say coroutines they usually imples having automated task scheduling |
14:22:04 | leorize[m] | which we don't have |
14:22:37 | krux02 | @timotheecour: are you around in chat? |
14:22:54 | * | planetis[m] left #nim ("User left") |
14:23:32 | * | planetis-M joined #nim |
14:23:41 | * | hax-scramper joined #nim |
14:24:05 | FromGitter | <alehander92> i dont think so |
14:24:46 | FromGitter | <alehander92> from what i find they are about yielding |
14:24:49 | FromGitter | <alehander92> and cooperativeness |
14:25:12 | FromGitter | <alehander92> you can use them to implement task scheduling of course |
14:25:28 | FromGitter | <alehander92> the difference i find in wikipedia(eh sorry) |
14:25:44 | FromGitter | <alehander92> is that coroutines yield to particular next locations |
14:26:01 | FromGitter | <alehander92> and semicoroutines/generators just yield but dont control to where |
14:26:59 | * | opal quit (Remote host closed the connection) |
14:27:18 | FromGitter | <alehander92> and indeed async probably uses something like that |
14:27:19 | * | kungtotte quit (Read error: Connection reset by peer) |
14:28:46 | * | kungtotte joined #nim |
14:32:03 | * | opal joined #nim |
14:33:45 | * | ryukoposting joined #nim |
14:37:15 | planetis-M | ryukoposting: hi! are you a kate user? https://github.com/ryukoposting/NimKate |
14:37:39 | * | NimBot joined #nim |
14:38:07 | krux02 | I used Kate a lot when it was still KDE3 |
14:39:39 | Guest86017 | still use kate for small text files |
14:44:28 | planetis-M | nope it's not a bridge issue, my messages are stuck at sent but don't get delivered |
14:45:13 | planetis-M | but now it works!! |
14:48:25 | Guest86017 | I wish someone would write a swig module for nim, the go module should be comparable, so it would be around of 7000 lines of code, the best bet probably would be to hire a long-time swig developer to do it, but we would need a fund-raiser for that, my rationale is that C++ support for nimterop is a long-time away (if it ever comes), and a clang-based solution won't be easier to develop than a swig-based |
14:48:31 | Guest86017 | one, once a nim module is accepted into swig upstream, it would be maintained there, the swig 4.0 extensions documentation (how to write a module) is pretty good (on a quick read), it's not an impossible task at all, it's just a lot of work, swig is looking to support c++20 features (currently they're at c++17), and they existed since 1996, it looks like they're not going away anytime soon, judging by the |
14:48:37 | Guest86017 | go module you need a scary amount of special knowledge to get everything just right, but on the other hand there're shorter modules like the perl5 one (2500 lines), so a initial nim module that doesn't support all features might be doable in a shorter amount of time ... I'd definitely chip in if there was a fundraiser for someone to do this work, I'm offering 100 bucks, although I'm aware this would be at |
14:48:43 | Guest86017 | least a full month of work for a good developer, so we'd need a bit more, the pay-off for the community is that we'd get really good wrappers for most C/C++ libs at almost no additional costs |
14:49:17 | Yardanico | nimterop exists :P |
14:49:48 | * | planetis joined #nim |
14:49:49 | Guest86017 | Yardanico: the author of nimterop admitted that full C++ support is years away, if it ever comes, it's not even at full C support, and C++ is infinitely more complex |
14:52:14 | Yardanico | I suggest you to make the 4 messages before this one a forum post, that'd be much better since IRC is a real-time chat so your messages will get lost eventually :) |
14:52:35 | Guest86017 | I was under the impression this channel had logs? |
14:52:56 | Yardanico | yes, but if you post it on the forum it will get much more exposure |
14:53:22 | FromGitter | <alehander92> yeah its very very easy to miss stuff in the irc logs |
14:53:29 | FromGitter | <alehander92> even you take a look there from time to time |
14:54:44 | shashlick | If i can get some help, it can come sooner |
14:55:06 | shashlick | i was able to rebuild C support with nim compiler backend in 3 months part time |
14:55:52 | shashlick | and it is more feature rich than the legacy algorithm |
14:56:21 | Guest86017 | shashlick: what do you mean by legacy algorithm? |
14:56:53 | * | fputs joined #nim |
14:59:08 | shashlick | the original C -> Nim algorithm which is shipping today in 0.4.4 |
15:00:42 | shashlick | i was basically experimenting to see how feasible the idea was to leverage tree-sitter |
15:01:33 | * | Yardanico quit (Killed (Sigyn (Spam is off topic on freenode.))) |
15:01:50 | * | opal quit (Remote host closed the connection) |
15:02:04 | * | opal joined #nim |
15:02:43 | shashlick | i've since rewritten the backend to use the Nim compiler AST and this implementation is a lot simpler, reusable and easy to enhance |
15:02:45 | Guest86017 | shashlick: swig supports very advanced C++ features, and new ones are planned https://github.com/swig/swig/pull/1678 |
15:02:45 | leorize[m] | planetis: you should move away from matrix.org, [here](https://www.anchel.nl/matrix-publiclist/) is a good list to look for one |
15:03:23 | Guest86017 | shashlick: this is why I have doubts that you'll be able to pull of a similar feat of feature completeness with treesitter, when swig is purposebuilt for the task |
15:03:38 | leorize[m] | doesn't swig require integration into the project itself? |
15:03:53 | leorize[m] | the last time I tried to use it to generate wrappers for pascal that was my biggest blocker |
15:04:18 | FromGitter | <Yardanico> So I decided to leave some IRC channels I don't really read and "Yardanico (~quassel@2a01:4f8:c2c:df22::2) has quit (Killed (Sigyn (Spam is off topic on freenode.)))" lol |
15:04:28 | FromGitter | <Yardanico> emailed them already, hope they don't take too long to unban me :D |
15:04:37 | Guest86017 | leorize[m]: you mean into nim? no! you need to write a swig module, that can become upstream part of swig if it fullfills testcases |
15:06:18 | shashlick | I don't doubt it might be impossible, even 4raq has that opinion |
15:06:35 | shashlick | but i'm going to try nonetheless and see how far we can go |
15:06:54 | leorize[m] | Guest86017: I mean exactly what you just said, you gotta write a swig module :P |
15:07:05 | Guest86017 | shashlick: did you ever read the swig 4.0 extensions documentation, it does seem straighforward, apart from being loads of work |
15:07:28 | Guest86017 | leorize[m]: why would that be a bad thing? |
15:07:30 | leorize[m] | not all upstream is open to the idea, though I don't doubt it's a good tool |
15:08:03 | FromGitter | <Yardanico> @Guest86017 but assuming we have a nim backend for swig, can you for example generate a wrapper (with swig) which will NOT depend on swig? |
15:08:17 | shashlick | quite frankly, i'd rather write Nim than C++ |
15:08:37 | Guest86017 | Yardanico: definitely, swig is wrapper generator, once it has run, you can use the generated wrappers, so yes |
15:08:59 | leorize[m] | Guest86017: don't you mean that I have to write a module to push to the target project's upstream? |
15:10:46 | Guest86017 | leorize[m]: no, only one swig module for the swig project itself, the targets don't need individual swig modules, swig generates wrappers automagically, there's the possibility of finetuning wrapper generation with additional swig interface files, but you won't need that for generating most wrappers I'd assume |
15:12:03 | FromGitter | <faulander> hi guys, anyone know if flippy only support PNG and not JPG? Which library can open JPG, get dimensions, resize and save? |
15:13:14 | Guest86017 | these are all swig modules https://github.com/swig/swig/tree/master/Source/Modules |
15:13:31 | Guest86017 | and all we need is someone to write a nim.cxx |
15:16:38 | FromGitter | <Vindaar> @faulander: tried https://github.com/SolitudeSF/imageman ? |
15:16:51 | leorize[m] | Guest86017: well you should also pitch that on the forum, more people hangs around there and someone may be interested :) |
15:17:14 | * | fputs quit (Quit: WeeChat 2.8) |
15:19:15 | * | fputs joined #nim |
15:19:20 | Guest86017 | this is a good read on what would need to be done approximately http://www.swig.org/Doc4.0/SWIGDocumentation.html#Extending |
15:20:10 | Guest86017 | leorize[m]: understood |
15:35:39 | shashlick | Guest86017: do you know swig well? |
15:35:52 | * | Prestige quit (Quit: Prestige) |
15:36:26 | * | Prestige joined #nim |
15:37:03 | Guest86017 | shashlick: can't say that, I've read some of the documentation (like the link above), skimmed some source code of swig modules, and was a user of swig a couple of times |
15:37:34 | shashlick | how does it handle preprocessor declarations? |
15:38:38 | * | Kaivo quit (Quit: WeeChat 2.7.1) |
15:39:15 | Guest86017 | shashlick: it has it's own preprocessor parser, all of the information is transformed to swigs own AST format, and then it does a series of transformations, that you (the swig module writer) can control to produce the wrappers dynamically |
15:40:31 | shashlick | so the generated wrapper ends up with all the preprocessor defs and you need to influence it approriately with Nim -d:xxx statements for example |
15:40:40 | * | Yardanico joined #nim |
15:41:08 | FromGitter | <faulander> @Vindaar Thanks, but i found a way. i need to compile flippy with -d:useStb then it handles jpg aswell ... I learn additional things by the minute! |
15:41:44 | Guest86017 | shashlick: read Execution Model 39.4 http://www.swig.org/Doc4.0/SWIGDocumentation.html#Extending |
15:42:10 | shashlick | pulling #ifdef equivalent stuff into the target language means also pulling in all the discovery that tools like autoconf/cmake etc do into Nim |
15:42:39 | shashlick | which is why nimterop relies on these build tools and preprocessors to do their job before getting involved |
15:42:49 | FromGitter | <Vindaar> @faulander good to hear |
15:46:26 | Guest86017 | there's #swig by the way |
15:53:25 | Guest86017 | this provides a good overview too http://www.swig.org/compare.html |
15:59:57 | * | solitudesf quit (Ping timeout: 265 seconds) |
16:02:18 | * | endragor quit (Remote host closed the connection) |
16:02:58 | * | solitudesf joined #nim |
16:06:40 | * | fputs quit (Quit: WeeChat 2.8) |
16:11:25 | * | sigmapie8 joined #nim |
16:15:03 | * | nsf joined #nim |
16:16:26 | FromGitter | <faulander> i know it's not really a Nim-Issue, but can someone maybe still help? https://github.com/treeform/flippy/issues/14 |
16:20:08 | solitudesf | thats not how you resize an image |
16:21:02 | solitudesf | there are magnify/minify procs |
16:21:59 | FromGitter | <faulander> i just saw them, yes. i'll try that next |
16:22:11 | * | sigmapie8 quit (Remote host closed the connection) |
16:22:47 | solitudesf | you should never assign height and width manually, unless you also modify underlying data/know what you're doing |
16:22:57 | Yardanico | @faulander also you shouldn't use "cast" |
16:23:05 | Yardanico | you can for example do float(myintvar) |
16:23:35 | Yardanico | also "float64" is same thing as "float" |
16:24:15 | solitudesf | yes, cast are not safe conversions, they reinterpret underlying memory as different type https://nim-lang.github.io/Nim/manual.html#statements-and-expressions-type-casts |
16:24:47 | * | Trustable joined #nim |
16:25:15 | leorize[m] | you definitely should not use cast |
16:26:14 | leorize[m] | float and int have different memory representation |
16:26:49 | FromGitter | <faulander> ok, forgive me - i am coming from python, no need for conversion there. still a beginner |
16:28:32 | FromGitter | <faulander> i have read the sourcecode of flippy, it seems the scale is a factor right? so if i want 90% size, i set it to 90. it does a for 1 ... scale loop, which itself calls minify by 2. i don't get it. |
16:29:18 | Yardanico | integer scale, and no, you don't set 90 |
16:29:34 | Yardanico | if you want to minify you use minifyBy2 |
16:29:37 | Yardanico | sorry "minify" |
16:30:06 | FromGitter | <faulander> bullshit. the scale is how many times it divides the width/height by 2 |
16:30:31 | Yardanico | yes, but you don't set it to 90 if you want to get 0.9 of original |
16:30:40 | FromGitter | <faulander> so if i want 25% i call minify(image,4) |
16:30:52 | solitudesf | 2 |
16:31:35 | FromGitter | <faulander> i have a maxsize setting for width and height and depending on which of them is bigger, i want to resize exactly to that size. don't know how i can do that, i don't think it'll work. |
16:31:48 | Yardanico | yeah that's more complicated |
16:31:52 | FromGitter | <faulander> my code calculates the new width and height correctly |
16:33:08 | FromGitter | <faulander> with pillow in python i just do: ⏎ image.thumbnail((maxsizeHeight, maxsizeWidth), Image.ANTIALIAS) |
16:33:43 | Yardanico | thumbnail in pillow is not for RESIZING an image though |
16:33:49 | Yardanico | it's for making a thumbnail |
16:34:13 | FromGitter | <faulander> doesn't matter, it works perfectly - i have resized a few hundred thousand pictures that way |
16:34:51 | FromGitter | <faulander> is there no lib in nim which can do that resizing? |
16:34:56 | Yardanico | also if you're looking for performance gains they might be much less than you expect since pillow is written in C |
16:35:30 | Yardanico | i mean all the number cruncing stuff |
16:36:11 | Yardanico | sadly I don't know how to use flippy to resize an image, but treeform is here quite often so he'll of course reply to your issue |
16:36:28 | leorize[m] | @treeform |
16:36:38 | leorize[m] | don't know if this work or if you gotta get on discord to ping him :P |
16:36:51 | Yardanico | yeah I'll ping him from discord |
16:37:02 | FromDiscord | <Yardanico> @treeform |
16:37:14 | Yardanico | see messages above pls :) |
16:37:25 | FromGitter | <faulander> yes, i was looking for performance and to train my nim skill ... that python script is horrible slow, mostly due to io though |
16:40:44 | FromGitter | <faulander> hmm imageman can do that it seems: ⏎ import imageman ⏎ let img = loadImageColorRGBU ("sample.png") ⏎ let img2 = img.resizedBicubic(512, 512) ⏎ img2.savePNG("out_resize_bicubic.png") [https://gitter.im/nim-lang/Nim?at=5e90a18c1aaf8e4b8e741562] |
16:41:18 | solitudesf | dont use bicubic if you need speed |
16:45:52 | * | Zectbumo joined #nim |
16:46:28 | FromGitter | <faulander> but? |
16:48:23 | Zevv | Bilinear is faster |
16:52:21 | * | skrylar[m] quit (Ping timeout: 246 seconds) |
16:52:30 | * | skrylar[m] joined #nim |
16:55:27 | FromDiscord | <treeform> hey what? |
16:55:35 | FromGitter | <faulander> works good, but the size is 70% higher. before it was 9mb, now it's 16mb |
16:55:43 | Yardanico | @faulander was asking how to resize an image with flippy |
16:55:47 | Yardanico | with custom width/height |
16:56:29 | FromDiscord | <treeform> hmm, I don't think I have a method for that. |
16:57:02 | FromDiscord | <treeform> I have minify/magnify but they take integer scale |
16:57:23 | FromGitter | <faulander> yes, i've read the source. |
16:57:45 | FromGitter | <faulander> @treeform i have a maxsize setting for width and height and depending on which of them is bigger, i want to resize exactly to that size. don't know how i can do that, i don't think it'll work. |
16:58:07 | FromDiscord | <treeform> I need to write a method for that |
16:58:32 | FromDiscord | <treeform> there are different resize mods like Bicubic bilinear... |
16:59:09 | * | lritter joined #nim |
16:59:12 | solitudesf | @flaunder, are you saving as jpeg? |
16:59:27 | FromDiscord | <treeform> oh wow BIcubic is not simple! |
16:59:31 | FromDiscord | <treeform> https://blog.demofox.org/2015/08/15/resizing-images-with-bicubic-interpolation/ |
17:00:30 | solitudesf | *@faulander (wtf am i typing) |
17:01:28 | FromGitter | <faulander> yes, i am using JPG but the PNG was even bigger. I set the quality to 75% and still only got down to 7mb from 9mb. Pillow gets down to roughly 1mb |
17:02:05 | FromDiscord | <treeform> sorry I don't support jpg yet |
17:03:01 | FromGitter | <faulander> yes you do @treeform if you compile with -d:useStl ;) |
17:03:57 | FromDiscord | <treeform> thats true stb does support it |
17:06:02 | FromGitter | <faulander> just missing a function like imageman has :) |
17:07:10 | FromGitter | <faulander> @SolitudeSF : It must've been that test image, with my usual images i get down to 1mb aswell ... so far so good. |
17:08:25 | * | ryukoposting quit (Ping timeout: 265 seconds) |
17:09:53 | * | waleee-cl joined #nim |
17:14:38 | FromDiscord | <queersorceress> Hi, I was wondering if there is a proper way to include multiple build configuration files beyond the default language level config, user level config, and project level config files. |
17:14:46 | FromDiscord | <treeform> Yeah imageman looks great. |
17:15:38 | solitudesf | there is also per file config |
17:16:27 | FromDiscord | <queersorceress> it looks like it is possible with using `.nims` and using the `import`/`include` directives, but i'm specifically asking about it with regards to the `.cfg` variety. |
17:16:43 | Yardanico | why though? |
17:16:55 | Yardanico | but I think it should be possible since cfg supports @if |
17:17:12 | Yardanico | see https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg |
17:17:19 | Yardanico | for an example of .cfg usage |
17:17:34 | FromDiscord | <queersorceress> @solitudesf these aren't bound to particular files, as i'm working on additive tooling |
17:18:46 | FromDiscord | <queersorceress> @Yardanico i don't see how the existance of the `@if` and companion directives relate to having the nim compiler include the contents of another, separate, `.cfg` file. |
17:19:00 | FromDiscord | <treeform> solitudesf, did you run into problem with unicode with stb? https://github.com/treeform/flippy/issues/5 |
17:19:17 | Yardanico | @queersorceress ah, sorry, I misunderstood your question |
17:19:19 | FromDiscord | <treeform> I see you use the open call: https://github.com/SolitudeSF/imageman/blob/master/src/imageman/images.nim#L293 |
17:19:47 | FromDiscord | <queersorceress> i would rather not have a single massive (and hard to parse) configuration file that has to be evaluated as part of the build vs multiple smaller files that wouldn't take as long. |
17:19:58 | FromDiscord | <queersorceress> no worries, i'm just asking 🙂 |
17:23:38 | solitudesf | @treeform, i dont see unicode in the issue snippet. just tried opening image with emoji in filename and it worked. |
17:24:04 | FromDiscord | <treeform> solitudesf, are you on windows? only happens on windows. |
17:24:40 | solitudesf | nope, never tried it on windows |
17:25:17 | FromDiscord | <treeform> I found a work around to always read it into memory with nim and then have stb load it. |
17:26:14 | solitudesf | yeah, errors under wine. i want to switch from stb to libpng and libjpeg-turbo anyway. |
17:26:48 | FromDiscord | <treeform> yeah that is what I did, but libpng does not work with --gc:arc |
17:27:04 | FromDiscord | <treeform> so I am in the middle now... supporting both stb and libpng |
17:28:18 | solitudesf | you mean nimPNG? |
17:28:30 | FromDiscord | <treeform> sorry yes nimPNG. |
17:31:51 | Yardanico | wait, since when code like "var x, y, z = 3" works? |
17:32:00 | Yardanico | I thought I can't do that in Nim 🤔 |
17:32:23 | FromDiscord | <treeform> looks like a bug to me |
17:32:49 | Yardanico | well it works correctly |
17:32:57 | Yardanico | !eval var x, y, z = 3; echo x, y, z |
17:33:00 | NimBot | 333 |
17:33:24 | * | rockcavera joined #nim |
17:35:19 | FromDiscord | <treeform> !eval var x, y, z = "na "; echo x, y, z |
17:35:22 | NimBot | na na na |
17:36:03 | Yardanico | I'm honestly really surprised since I didn't see this anywhere in the manual |
17:36:17 | * | Hexeratops joined #nim |
17:36:34 | Yardanico | seems like it was in Nim since forever though, it works on 0.13.0 |
17:36:56 | FromDiscord | <treeform> !eval var x, y, z = @["na "]; echo x, y, z |
17:36:59 | NimBot | @["na "]@["na "]@["na "] |
17:37:21 | FromDiscord | <treeform> !eval var x, y, z = "na "; x.add("oh"); echo x, y, z |
17:37:24 | NimBot | na ohna na |
17:37:37 | FromDiscord | <treeform> strange! |
17:38:09 | FromGitter | <alehander92> where is disruptek |
17:38:20 | FromGitter | <alehander92> disbot tell me |
17:38:23 | Yardanico | !last disruptek |
17:38:29 | FromGitter | <alehander92> oh i forgot the command |
17:38:29 | Yardanico | !seen disruptek |
17:38:33 | Yardanico | wait which one is it |
17:38:38 | FromGitter | <alehander92> is disbot even here |
17:38:42 | Yardanico | he's not :O |
17:38:42 | FromDiscord | <treeform> !where disruptek |
17:38:53 | Zevv | "disruptek, [09.04.20 20:05] |
17:38:54 | Zevv | My router finally shit the bed so I probably won’t be properly online for a few days." |
17:38:55 | FromGitter | <alehander92> !repo nim |
17:39:08 | FromGitter | <alehander92> ah i see |
17:40:14 | Zevv | I can also do some rambling and obscene remarks for you if you want |
17:44:50 | FromGitter | <alehander92> please do rambling |
17:44:55 | FromGitter | <alehander92> no obscene remarks |
17:45:09 | FromGitter | <alehander92> i just saw a bot printing weird stuff |
17:45:12 | FromGitter | <alehander92> and it reminded me of him |
17:45:47 | FromDiscord | <Skaruts> What is `Impl` for? |
17:45:51 | Yardanico | where? |
17:45:58 | Yardanico | ah, it stands for "Implementation" |
17:46:01 | Yardanico | if that's what you wanted to ask |
17:46:03 | FromDiscord | <Skaruts> I've seen some people using that in quite a few places |
17:46:23 | FromDiscord | <Skaruts> as a suffix |
17:50:29 | Yardanico | in nim? |
17:50:39 | Yardanico | well for example streams module uses it for procedures |
17:50:42 | Yardanico | "closeImpl" and stuff |
17:51:23 | FromGitter | <alehander92> yeah its almost a convention |
17:51:26 | FromGitter | <alehander92> but i forget to use it |
17:52:31 | FromDiscord | <Skaruts> NiGui uses ControlImpl as a ref object of Control |
17:53:46 | FromDiscord | <Skaruts> what confuses me is that it seems to me that Control also is an implementation |
17:55:09 | FromDiscord | <Skaruts> I think what I'm trying to understand now is when to use this and why |
17:57:59 | shashlick | looking for feedback and ideas on https://github.com/nimterop/nimterop/issues/177 |
17:58:45 | FromGitter | <alehander92> i think its used when you have a public api like |
17:58:50 | FromGitter | <alehander92> mymacro or myproc |
17:59:05 | FromGitter | <alehander92> and actual more hairy implementation in mymacroImpl |
17:59:24 | FromGitter | <alehander92> e.g. useful for recursion maybe if you need to pass an initial value and other args which are not public |
17:59:32 | FromGitter | <alehander92> not entirely sure |
17:59:35 | * | sirikon quit (*.net *.split) |
17:59:36 | * | vycb[m] quit (*.net *.split) |
17:59:37 | * | BitPuffin quit (*.net *.split) |
18:03:50 | * | sirikon joined #nim |
18:03:50 | * | vycb[m] joined #nim |
18:03:50 | * | BitPuffin joined #nim |
18:16:51 | FromDiscord | <Skaruts> this has been bugging me to ask: while I was making a retained mode GUI, at first I considered making Control a variant type. I decided not to because that would force me to use `case of`s to determine which procs to call for each kind of Control object, BUT... |
18:17:55 | FromDiscord | <Skaruts> as I delved into it in an OOP way, I learned about dynamic dispatch, and while I've been keeping the number of methods to a minimum, I'm wondering: is dynamic dispatch faster than a `case of`? |
18:18:39 | FromDiscord | <Skaruts> araq once told me methods are about 6x slower |
18:18:56 | * | ryukoposting joined #nim |
18:18:58 | FromDiscord | <Skaruts> (than procs) |
18:20:00 | * | planetis quit (Quit: Konversation terminated!) |
18:21:57 | kungtotte | Have you profiled your code to see if it's slow? |
18:22:44 | FromDiscord | <Skaruts> no, and it doesn't seem slow. but I also never made the variant type to compare |
18:22:58 | kungtotte | I'm sure you can make slow object variant code and fast dynamically dispatch code, but in theory dynamic dispatch will be slower |
18:23:06 | FromDiscord | <queersorceress> another compiler question: is there a way to silence particular hints ,specifically the "declared but not used" hint from showing up in the build log? |
18:23:40 | FromDiscord | <Skaruts> you mean slower than static dispatch or slower than variant type? |
18:24:22 | kungtotte | Both |
18:24:31 | FromDiscord | <Skaruts> oh |
18:25:33 | FromDiscord | <Skaruts> I would assume though that if the variant type has many kinds, at some point it'll be slower, no? |
18:25:55 | * | tane joined #nim |
18:25:55 | shashlick | Yes you can silence specific hints |
18:26:33 | Yardanico | is it just me or I feel like most of the discussion in https://github.com/nim-lang/Nim/issues/11764 is too complex for me to understand :P |
18:26:45 | kungtotte | queersorceress: --hint:XDeclaredButNotUsed:off |
18:26:46 | Yardanico | about all these PRNG and hashes |
18:28:46 | FromDiscord | <Skaruts> @queersorceress you can silence hints like `{.hint[XDeclaredButNotUsed]: off.}` and warnings in the same way `{.warning[UnusedImport]: off.}`, iirc that affects only the code in the file where it's used |
18:29:04 | kungtotte | Skaruts: Yes, that's what I meant by making slow object variant code. Slow/fast is meaningless without measurements though. Measure if it's slow first, then profile to see where the performance is lost |
18:29:19 | companion_cube | is there someone working on nimsuggest/LSP ? |
18:29:36 | FromDiscord | <Skaruts> @queersorceress see the compiler notices to know which name to put inside the [..] |
18:30:20 | FromDiscord | <queersorceress> @Skaruts do i need to push+pop that or does the presence on a single line only count for said line? |
18:30:23 | kungtotte | queersorceress: You can also silence that particular complaint by exporting the symbol, or by using the {.used.} pragma. I tend to go with option #2 there when testing since I'll be trying stuff out |
18:30:46 | FromDiscord | <Skaruts> I usually place the pragma at the top of a file |
18:30:53 | FromDiscord | <queersorceress> @kungtotte ah, right; that is what i want then |
18:30:54 | FromDiscord | <Skaruts> above the imports |
18:31:12 | * | Zectbumo quit (Remote host closed the connection) |
18:31:29 | * | Zectbumo joined #nim |
18:34:01 | FromDiscord | <Skaruts> @Kungtotte well I was thinking one might be able to tell what would be expected to work faster in terms of raw performance if one knows how both work under the hood, I know specific cases will make a difference, but fundamentally one might be expected to be faster than the other |
18:34:32 | * | sz0 quit (Ping timeout: 246 seconds) |
18:34:46 | FromDiscord | <Skaruts> That's what I was hoping to find out anyway |
18:35:41 | kungtotte | If you're really curious you could write a toy example with both versions and inspect the generated C code |
18:35:58 | kungtotte | And better still, write a benchmarking program for it to see how it shakes out |
18:36:19 | FromDiscord | <Skaruts> not be a bad idea |
18:37:14 | * | sz0 joined #nim |
18:38:20 | FromGitter | <sealmove> why this doesn't work?selector must be of an ordinal type, float or string |
18:38:28 | FromGitter | <sealmove> sorry: https://play.nim-lang.org/#ix=2huj |
18:39:31 | FromGitter | <sealmove> I see in manual "For reasons of simplicity of implementation the types uint and uint64 are not ordinal types. (This will be changed in later versions of the language.)" |
18:43:58 | FromDiscord | <Skaruts> well if you do `case ord(x)` it works |
18:44:32 | FromDiscord | <Skaruts> no idea if that's desirable though |
18:48:30 | leorize | companion_cube: PMunch is working on nimlsp |
18:48:45 | leorize | you can query me for any questions about nimsuggest though, I got a lot of experience with it |
18:49:00 | companion_cube | it doesn't seem to do completion (in vim at least), is that right? |
18:49:06 | companion_cube | the error reporting is cool, though. |
18:49:13 | leorize | nimlsp should do completion |
18:49:18 | leorize | if it doesn't then that's a bug |
18:49:41 | companion_cube | I didn't succeed in installing it |
18:50:07 | companion_cube | ('build failed for [email protected]') |
18:50:27 | leorize | ah, the ultimate nimble descriptive error messages |
18:50:38 | * | DaG joined #nim |
18:50:46 | leorize | run nimble --verbose --debug build |
18:50:52 | leorize | it will be much much more useful |
18:51:02 | * | DaG is now known as Guest83845 |
18:51:35 | * | Guest83845 is now known as dagrin |
18:51:58 | companion_cube | indeed :D |
18:52:16 | companion_cube | ah, it cannot open `/usr/nimsuggest/nimsuggest.nim` |
18:52:21 | companion_cube | no idea why that would be a thing |
18:53:12 | companion_cube | (same kind of error when I tried to use nim doc… maybe the package is low quality) |
18:53:36 | leorize | I think I know why it doesn't work |
18:53:54 | * | dagrin quit (Remote host closed the connection) |
18:54:06 | companion_cube | nothing urgent, really, I'm at work |
18:54:11 | leorize | just nimlsp being nimlsp :P |
18:54:35 | leorize | if you use neovim then my nim.nvim plugin is better than trying to setup nimlsp :P |
18:54:45 | leorize | the issue with nimlsp is that it needs nimsuggest as a package |
18:54:55 | leorize | and well, no one actually set it up correctly |
18:55:23 | leorize | so it just assumes that your nim resides inside the compiler source code |
18:55:43 | leorize | works about 90% of the time since a lot of people compile Nim themselves |
18:55:56 | leorize | the last 10% is anyone that installs nim |
18:56:25 | companion_cube | it's in /usr/lib/nim/compiler/suggest.nim apparently |
18:56:36 | companion_cube | but yeah, assumptions about packages… oh well |
18:56:52 | leorize | nah, not even that one :) |
18:56:53 | companion_cube | and I do use nim.nvim :) |
18:56:57 | FromDiscord | <Varriount> Araq: Is there any spec on what happens if you give different parameters to a closure iterator between calls? |
18:57:09 | leorize | companion_cube: then completion should work for you if you set it up |
18:57:23 | leorize | you don't really need nimlsp if you use nim.nvim |
18:57:48 | leorize | nimlsp is nimsuggest but translated to LSP lingo :P |
18:58:01 | companion_cube | which is sane, but well |
18:58:20 | companion_cube | how do you do completion, if I may ask? given that everything is in the global namespace it seems like a hard(er) problem |
18:58:40 | leorize | you forgot that everything is typed :) |
18:58:47 | companion_cube | well still! |
18:59:17 | leorize | everything is typed :) |
18:59:39 | companion_cube | ahh I use ALE, that's why I may not have completion |
18:59:52 | leorize | for example, how many times do you actually call a proc like this: foo(a)? |
19:00:10 | companion_cube | all the `new` and `init` stuff I guess? |
19:00:12 | leorize | and how likely is it to even have procs colliding with foo() :) |
19:00:12 | companion_cube | I'm very new |
19:00:29 | leorize | well you can see a clear pattern in new and init API |
19:00:34 | leorize | their names are unique :) |
19:00:38 | companion_cube | sure, sure |
19:00:52 | leorize | and there are only a few of them :P |
19:01:07 | leorize | it's not like you'll be showered by 1k symbols to choose from :) |
19:01:15 | companion_cube | who knows… :) |
19:01:16 | leorize | you type init and you filtered 80% of them away |
19:01:21 | companion_cube | `new<tab>` and bim! |
19:01:36 | leorize | around 20 symbols |
19:01:48 | leorize | be a little more specific and you cut that amount by half |
19:02:01 | FromGitter | <alehander92> i'd write Type.new |
19:02:13 | FromGitter | <alehander92> but i am used to it from ruby |
19:02:17 | FromGitter | <alehander92> maybe |
19:03:36 | companion_cube | yeah, there's no namespacing in nim, it feels a bit like C |
19:04:01 | FromGitter | <alehander92> you can use optional namespacing |
19:04:05 | FromGitter | <alehander92> e.g. mymodule.myfunc(b) |
19:04:18 | FromGitter | <alehander92> and you can almost enforce it by from mymodule import nil |
19:04:53 | leorize | we do have namespacing, just optional |
19:05:08 | leorize | to experience Nim I recommend not using from-import-nil |
19:05:16 | FromGitter | <alehander92> namespacing , whitespacing, we're big on space |
19:05:22 | FromDiscord | <Skaruts> alehander92: that makes it required to do `module.foo`? |
19:05:33 | FromDiscord | <Skaruts> the import nil thing |
19:05:37 | leorize | yes, but if you're new, don't use it |
19:05:39 | FromGitter | <alehander92> in principle yes, but i am not sure if there aren't exceptions |
19:06:01 | FromDiscord | <Skaruts> I gotta play around with it 🙂 |
19:06:25 | leorize | too many people come to Nim from Python and they expect Nim to be like Python :p |
19:06:58 | companion_cube | heh, gotcha |
19:07:13 | leorize | they were taught that global namespaces are evil in python then they just assume the same to nim |
19:07:57 | leorize | this is why I tend to avoid introducing from-import-nil to people until they're familiar with how to write nim :P |
19:08:35 | leorize | ~imports |
19:08:44 | leorize | oh disbot is offline :( |
19:09:57 | Prestige | Going to deep dive into nim in a couple hours after work, pretty excited. Any tutorials/guides aside from the official docs that anyone recommends? |
19:11:08 | leorize | nim in action is still a recommended book (i mean it's the only one :P) |
19:11:20 | leorize | https://nim-lang.org/learn.html |
19:11:38 | leorize | we also have third-party links in here too, so be sure to explore them all :) |
19:11:47 | Prestige | Thanks leorize :) |
19:19:55 | * | tefter joined #nim |
19:21:21 | * | Tyresc joined #nim |
19:30:30 | * | solitudesf quit (Ping timeout: 256 seconds) |
19:32:11 | FromGitter | <awr1> i don't really get the global namespace stigma that much |
19:32:46 | FromGitter | <awr1> i know in idiomatic C++ land people get very particular with namespaces sometimes |
19:33:10 | FromGitter | <awr1> a lot of people cringe at the basic hello world examples for using `using namespace std;` |
19:33:32 | FromDiscord | <__ibrahim__> hi, how can i debug this? |
19:33:32 | FromDiscord | <__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698254357048590406/unknown.png |
19:34:17 | * | ryukoposting quit (Ping timeout: 260 seconds) |
19:34:31 | FromGitter | <alehander92> hmmm |
19:35:22 | FromGitter | <alehander92> try to run the <path to ... >\test.exe |
19:35:31 | FromGitter | <alehander92> but i am not sure what `--app:gui` does |
19:36:20 | FromDiscord | <__ibrahim__> without --appgui, a bit better |
19:36:20 | FromDiscord | <__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698255062065086474/unknown.png |
19:36:30 | FromDiscord | <__ibrahim__> without `--app:gui`, a bit better |
19:36:30 | FromDiscord | <__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698255062065086474/unknown.png |
19:36:42 | FromDiscord | <__ibrahim__> sorry im day 2 nim |
19:37:35 | FromDiscord | <__ibrahim__> same with `<path_to>` |
19:37:35 | FromDiscord | <__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698255377292197898/unknown.png |
19:40:24 | FromGitter | <alehander92> welcome ! |
19:40:33 | FromGitter | <alehander92> no problem, it seems that |
19:40:43 | FromGitter | <alehander92> maybe you need to debug it somehow |
19:40:55 | FromGitter | <alehander92> you can run it under gdb or windbg i guess |
19:41:05 | FromDiscord | <__ibrahim__> my code could be bad, but in mac it runs fine. on win, many problems |
19:41:12 | FromGitter | <alehander92> but you need to `nim c --debugInfo --lineDir:on -r stuff` |
19:41:27 | FromGitter | <alehander92> yeah what is supposed to happen |
19:41:28 | FromGitter | <alehander92> if it works |
19:41:35 | * | nekits quit (Read error: Connection reset by peer) |
19:41:52 | * | solitudesf joined #nim |
19:42:02 | FromDiscord | <__ibrahim__> nice that gave me something to go on from |
19:42:05 | * | nekits joined #nim |
19:42:15 | FromDiscord | <__ibrahim__> ``` |
19:42:15 | FromDiscord | <__ibrahim__> Hint: C:\Dev\nimrodev\staticglfw\test\test.exe [Exec] |
19:42:15 | FromDiscord | <__ibrahim__> HELLO GL |
19:42:16 | FromDiscord | <__ibrahim__> Traceback (most recent call last) |
19:42:16 | FromDiscord | <__ibrahim__> C:\Dev\nimrodev\staticglfw\test\test.nim(20) test |
19:42:16 | FromDiscord | <__ibrahim__> SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
19:42:18 | FromDiscord | <__ibrahim__> Error: execution of an external program failed: 'C:\Dev\nimrodev\staticglfw\test\test.exe ' |
19:42:20 | FromDiscord | <__ibrahim__> PS C:\Dev\nimrodev\staticglfw\test> |
19:42:21 | FromDiscord | <__ibrahim__> ``` |
19:42:32 | Yardanico | pls don't do big pastes, people here in IRC suffer a bit :) |
19:42:36 | Yardanico | use services like bpaste.net |
19:43:04 | FromDiscord | <__ibrahim__> im sorry, i didnt know. even images? |
19:43:11 | Yardanico | well, images will be as links |
19:43:18 | FromDiscord | <__ibrahim__> sir yes sir |
19:47:00 | FromGitter | <alehander92> images are kinda ok |
19:47:08 | FromGitter | <alehander92> but if you send code, send it as pastes |
19:47:14 | FromDiscord | <__ibrahim__> roger that |
19:47:17 | FromGitter | <alehander92> as people cant edit/copy it otherwise |
19:49:21 | FromGitter | <alehander92> yeah you need to generally add |
19:49:29 | FromGitter | <alehander92> --stacktrace:on --linetrace:on maybe |
19:49:36 | FromGitter | <alehander92> to see if this gives a better traceback |
19:49:45 | FromGitter | <alehander92> but maybe its one line actually |
19:50:43 | * | nsf quit (Quit: WeeChat 2.8) |
19:50:44 | FromDiscord | <__ibrahim__> cool, im trying some glad + glfw. ill try those commands right now. trying to translate from C++ to nim |
19:51:34 | FromGitter | <alehander92> you need them + your --debugInfo stuff but maybe |
19:51:39 | FromGitter | <alehander92> you can just setup a nim.cfg |
19:51:46 | FromGitter | <alehander92> and write the flags there |
19:52:57 | FromDiscord | <__ibrahim__> ill look up the docs for nim.cfg |
20:00:43 | * | ryukoposting joined #nim |
20:01:25 | * | oculux quit (Quit: blah) |
20:02:33 | * | oculux joined #nim |
20:09:38 | companion_cube | hum, c2nim segfaults… |
20:10:22 | FromDiscord | <__ibrahim__> i must be misusing the function |
20:12:27 | FromDiscord | <Chiqqum_Ngbata> How to prevent nimble from installing develop branch? |
20:19:47 | Yardanico | it always installs the develop branch if you have to releases/tags |
20:19:58 | Yardanico | you should create a tag so it will install the latest tag |
20:20:54 | FromDiscord | <Chiqqum_Ngbata> I see. So as long as there tags, it gets the latest |
20:21:32 | * | ryukoposting quit (Ping timeout: 260 seconds) |
20:27:48 | FromDiscord | <Skaruts> is it possible via macros to create a proc with lua-style varargs, like `foo(...)`, which could then take an arbitrary amount of arguments of arbitrary types? |
20:29:56 | leorize | if you can't do it by hand, macros won't safe you :P |
20:30:13 | leorize | macros however, does let you iterate through items of arbitary types |
20:30:14 | FromDiscord | <Skaruts> can a macro not generate proc overloads or something like that? |
20:30:32 | leorize | save* |
20:30:38 | leorize | well yes, but why? |
20:31:22 | leorize | it's possible, but I think it's better if you present the problem out |
20:31:36 | leorize | there might be some idioms to solve it without having to touch macros |
20:31:49 | leorize | because they are not that easy to deal with |
20:33:21 | FromDiscord | <Skaruts> I mimic'ed Godot's signal system, but one problem is that I can't call `emit_signal` with arguments, because those could be anything or nothing at all |
20:34:00 | leorize | you can have an overload without any arguments |
20:34:41 | FromDiscord | <Skaruts> yea but the problem is the overloads with arguments, they could be anything... currently no arguments is the way I have it |
20:34:54 | leorize | use generics? |
20:35:25 | leorize | it's kinda hard to imagine without some example of how you'd want to use it :p |
20:35:33 | FromDiscord | <Skaruts> hmm.. I guess that might work for a limited amount of arguments |
20:36:53 | FromDiscord | <Skaruts> I've been using it without arguments lately, so real use cases aren't fresh in my mind atm... but when coding in Godot I've come across many times where I wanted a button to return an id, or an index number, or something like that |
20:37:37 | FromDiscord | <Skaruts> well in godot's api itself, some signals return certain properties from the class emitting the signal, like ray_trace info, camera info, normal from collision, etc |
20:38:03 | FromDiscord | <Skaruts> but that can be preset, it's on the user side of things that it's unpredictable |
20:39:03 | leorize | I'm not sure of how you architectured your system |
20:39:36 | leorize | but usually this can be done by having all signal emitters inherit from a base ref object |
20:39:51 | leorize | then you can use the `of` operator to verify if something is of the type you want |
20:44:50 | FromDiscord | <Skaruts> well, I figured this out on my own, so it may not be the most ideal, (and this is on the UI part of my code) but my signals are just sort of hashed into a sequence along with a closure that is invoked by `emit_signal` |
20:45:15 | FromDiscord | <Skaruts> there is no signal object |
20:47:53 | FromDiscord | <Skaruts> and each widget stores its own signals, so you do e.g `button.connect("released", self, "on_released", proc() = self.on_released)` (which is slightly more complex than in Godot, but works), and then within the button you call `self.emit_signal("released")` |
20:48:55 | FromDiscord | <Skaruts> (the self on connect is just a way to reference the caller, to make the hash more unique -- it gets stringified) |
20:49:53 | leorize | this reminds me of gtk :p |
20:50:42 | FromDiscord | <Skaruts> I can't remember the name of this kind of thing, but I heard some other libs use it, yea |
20:51:57 | FromDiscord | <Skaruts> but then a file loading popup, for example, might want to call `self.emit("accepted", self.selected_file)` |
20:52:49 | leorize | why strings though, can't it use enums instead? |
20:53:08 | FromDiscord | <Skaruts> currently I can only do `self.emit("accepted")` and the closure that was sent to this signal has no information about the file, so I have to workaround it |
20:54:09 | FromDiscord | <Skaruts> tbh I can't remember why I chose strings. It's how godot does it, so maybe that had something to do with it |
20:55:50 | * | ryukoposting joined #nim |
20:57:09 | FromDiscord | <Skaruts> gonna mess around with generics then, to see if I can get it to work with at least a limited number of arbitrary args |
20:57:24 | * | abm quit (Quit: Leaving) |
21:10:00 | FromGitter | <dawkot> Why doesn't Karax's `redraw()`... redraw? |
21:10:37 | leorize | it should? |
21:14:51 | FromGitter | <dawkot> Nevermind, it's actually working fine |
21:19:03 | * | planetis-M left #nim ("User left") |
21:28:26 | * | solitudesf quit (Ping timeout: 256 seconds) |
21:31:08 | * | Trustable quit (Remote host closed the connection) |
21:36:02 | FromDiscord | <__ibrahim__> what could be causing the 'could not load glfw3.dll` on windows? |
21:36:11 | FromDiscord | <__ibrahim__> what could be causing the `could not load glfw3.dll` on windows? |
21:36:32 | FromGitter | <awr1> is the DLL in the same folder as exe |
21:36:37 | FromDiscord | <__ibrahim__> yes |
21:36:50 | * | tane quit (Quit: Leaving) |
21:37:24 | Yardanico | @__ibrahim__ is it the same bitness as the .exe itself? |
21:37:32 | Yardanico | e.g. if you have a 64-bit exe the DLL should also be 64-bit |
21:37:42 | Yardanico | and also the DLL should also have all its dependencies in the same folder too |
21:39:13 | leorize | if a deps of the dll is not met, it will scream, so we don't have to worry too much about that part |
21:39:41 | leorize | matching the architecture is much more important |
21:40:13 | FromDiscord | <__ibrahim__> im trying to check the bitness |
21:42:03 | FromGitter | <awr1> perhaps the Nim DLL loader should check for the appropriate magic and give a more detailed error |
21:42:03 | FromGitter | <awr1> https://superuser.com/a/889267 |
21:42:13 | FromGitter | <awr1> this seems to be a common issue |
21:42:58 | FromDiscord | <__ibrahim__> i tried to drap and drop into sublime but all i got was binary 😹 |
21:43:03 | * | natrys quit (Quit: natrys) |
21:45:37 | FromDiscord | <__ibrahim__> oh ok need to drop in notepad.exe |
21:46:14 | leorize | @awr1: we can't actually |
21:46:37 | leorize | windows have it's own searching logic |
21:46:49 | FromDiscord | <__ibrahim__> okay they are different in bitness |
21:47:00 | Yardanico | which one is which? |
21:47:05 | Yardanico | glfw is 32-bit and your app is 64-bit? |
21:47:17 | FromDiscord | <__ibrahim__> other way around |
21:47:18 | FromGitter | <awr1> doesn't LoadLibrary() give an HRESULT or something that is more useful |
21:47:21 | Yardanico | strange |
21:47:28 | Yardanico | ah choosenim uses 32bit by default |
21:47:34 | * | krux02 quit (Remote host closed the connection) |
21:47:35 | Yardanico | on windows |
21:47:37 | Yardanico | or something like that |
21:48:45 | FromDiscord | <__ibrahim__> must I tweak something in the nim.cfg? |
21:49:00 | leorize | @awr1: welcome to windows, where the returned result is never documented, ever :) |
21:49:30 | FromDiscord | <__ibrahim__> ive been trying to make it work on windows all day long. on my macbook air from 2008 it just works |
21:49:34 | FromGitter | <awr1> https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya#security-remarks |
21:50:01 | Yardanico | leorize: might check reactos and wine for info :) |
21:50:28 | leorize | playing the guessing game with microsoft is never fun |
21:50:33 | leorize | it's best to just avoid it |
21:50:39 | FromDiscord | <__ibrahim__> linux? |
21:50:58 | leorize | ? |
21:51:19 | FromDiscord | <__ibrahim__> i meant, is linux better :D |
21:51:19 | Yardanico | @__ibrahim__ well the easiest way to you is probably to find a 32-bit glfw |
21:51:25 | Yardanico | well yes, linux is better |
21:51:26 | FromGitter | <awr1> looks like GetLastError() can give you STATUS_DLL_MIGHT_BE_INCOMPATIBLE |
21:51:28 | FromDiscord | <__ibrahim__> yeah totally doing that |
21:51:34 | Yardanico | at least you can have some docs or check the src :P |
21:51:40 | FromDiscord | <__ibrahim__> lmao |
21:52:07 | FromDiscord | <__ibrahim__> i have a centos8 installed i have yet to dive into it, i couldnt even make the ~/.bash_profile to work properly xD |
21:52:37 | leorize | > The error codes returned by a function are not part of the Windows API specification and can vary by operating system or device driver. For this reason, we cannot provide the complete list of error codes that can be returned by each function |
21:52:46 | leorize | @awr1: even microsoft gives up :P |
21:53:37 | FromGitter | <awr1> idk, if its documented here its probably good enough |
21:53:46 | FromGitter | <awr1> in any case the alternative is to use SearchPath fisrt |
21:53:54 | FromGitter | <awr1> and then check the magic |
21:54:22 | leorize | we should only use SearchPath when we fail |
21:54:36 | leorize | or maybe try piping the error code into FormatMessage |
21:54:44 | leorize | maybe it'd spit out better errors |
21:56:03 | * | neceve quit (Ping timeout: 260 seconds) |
21:57:40 | * | Zectbumo quit (Remote host closed the connection) |
22:00:27 | FromGitter | <awr1> FormatMessage gives nothing interesting, i just tried it with a 32-bit SDL2.dll |
22:01:52 | FromGitter | <awr1> or wait maybe i'm being dumb |
22:03:50 | FromGitter | <awr1> i'm dumb, i was using "SDL2.h" as the string |
22:04:00 | FromGitter | <awr1> when loading a 32-bit DLL from 64-bit EXE |
22:04:10 | FromGitter | <awr1> FormatMessage() gives "%1 is not a valid Win32 application." |
22:04:25 | FromGitter | <awr1> if it can't find anything it gives "The specified module could not be found." |
22:04:35 | Yardanico | what if you try to load a 64-bit dll from 32-bit app 🤔 |
22:05:05 | * | ljoonal quit (Ping timeout: 250 seconds) |
22:05:53 | FromGitter | <awr1> same thing |
22:06:08 | Yardanico | cool, now make a PR :P |
22:08:09 | FromGitter | <awr1> sure, after i cook this tomato basil soup |
22:08:32 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
22:09:51 | * | zacharycarter quit (Ping timeout: 250 seconds) |
22:10:20 | FromDiscord | <KingDarBoja> I am back guys 😄 |
22:12:02 | * | couven92 quit (Quit: Client Disconnecting) |
22:12:07 | FromDiscord | <KingDarBoja> Hi there awr1 |
22:14:15 | * | hax-scramper quit (Ping timeout: 260 seconds) |
22:14:31 | * | hax-scramper joined #nim |
22:16:55 | FromGitter | <awr1> hello |
22:17:35 | FromDiscord | <KingDarBoja> What's up? I feel free today 😄 |
22:24:30 | FromDiscord | <__ibrahim__> the 32-bit dll worked |
22:25:06 | * | tefter quit (Quit: WeeChat 2.8) |
22:27:45 | * | liblq-dev quit (Quit: WeeChat 2.7.1) |
22:30:15 | FromDiscord | <KingDarBoja> I got lost at the manual searching for my own custom `$` proc for my custom types lol |
22:30:26 | FromDiscord | <KingDarBoja> I mean how to do it * I have read it before |
22:31:26 | leorize | just make a `$`(o: YourType): string |
22:31:44 | Yardanico | also don't forget to export it with * |
22:32:04 | leorize | exporting is only for outside modules to use it |
22:32:09 | leorize | if it's internal you don't have to export |
22:32:45 | FromDiscord | <KingDarBoja> It is for outsiders 😄 Thanks |
22:36:24 | FromDiscord | <KingDarBoja> Do you have any suggestion of how should be the format of a custom type? Like the stringified version when calling ``$`` |
22:36:57 | Yardanico | usually I do like "MyObject(field1: value1, field2: value2)" kinda like repr :P |
22:37:01 | Yardanico | but you're free to do however you like |
22:37:56 | FromDiscord | <KingDarBoja> Thinking on something like json |
22:38:00 | FromDiscord | <Avatarfighter> Hello everyone 😄 |
22:38:21 | FromDiscord | <KingDarBoja> But now I remember the tables module is what I am looking for |
22:38:32 | leorize | @KingDarBoja: you don't just implement `$` for fun :P |
22:40:29 | FromDiscord | <Avatarfighter> Stupid question for you guys but I'm converting the endianness of int16s that I'm reading from a StringStream and I was wondering if my current solution is written in a "clean" way. https://dsh.re/c7f6b |
22:40:43 | FromDiscord | <KingDarBoja> What do you mean leorize? 😛 |
22:42:28 | * | pbb joined #nim |
22:44:47 | FromDiscord | <Avatarfighter> Is converting string data to an int via a cast the best way of doing it? E.g: cast[int16]("\x00\x15") ? |
22:46:13 | leorize | @KingDarBoja: that means you should implement it with an actual use case in mind :P |
22:46:24 | * | pbb quit (Excess Flood) |
22:46:39 | leorize | for example for Duration, it's `$` prints out the duration like: 2 seconds 110 milliseconds |
22:47:12 | FromDiscord | <KingDarBoja> I want to use it for debugging my types, instead of relying on repr |
22:47:36 | * | pbb joined #nim |
22:47:37 | leorize | Avatarfighter: it's a terrible way to do it :P |
22:47:53 | FromDiscord | <KingDarBoja> But just did a search for json module and found the `*%` operator |
22:48:01 | FromDiscord | <KingDarBoja> %* |
22:48:20 | FromDiscord | <KingDarBoja> Which gives me a nice output string |
22:48:23 | leorize | repr is the best debugger :P |
22:49:06 | FromDiscord | <Avatarfighter> leorize I was expecting it to be a terrible way haha 😄 Is there a better you know of ? I couldn't think of anything else off the top of my head |
22:51:01 | FromGitter | <awr1> did the PR https://github.com/nim-lang/Nim/pull/13950 |
22:51:27 | FromGitter | <awr1> i'll check for CI fails later, i need to finish this soup |
22:51:48 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hwg leorize 😄 |
22:53:44 | leorize | @Avatarfighter: https://play.nim-lang.org/#ix=2hwh |
22:54:32 | * | ksandvik joined #nim |
22:56:41 | leorize | https://github.com/status-im/nim-stew/blob/master/stew/endians2.nim <- status endians2 have a much much better API for this that doesn't look confusing |
22:59:32 | leorize | @KingDarBoja: I'd recommend repr instead :P |
22:59:39 | leorize | `%*` is not that efficient |
23:00:03 | leorize | it builds a JSON tree at runtime, then print it |
23:00:34 | * | hax-scramper quit (Read error: Connection reset by peer) |
23:00:57 | FromDiscord | <Avatarfighter> Leorize: you're a wizard I had tried something similar by casting stuff to pointers without using "addr"(lmfao) and was getting scary error thank you very much |
23:01:15 | * | hax-scramper joined #nim |
23:04:41 | FromDiscord | <Avatarfighter> Yeah status' apis look super nice but I'm trying to keep my bittorrent library free of as many external libraries as possible atm |
23:05:00 | * | Zectbumo joined #nim |
23:05:35 | * | hax-scramper quit (Ping timeout: 260 seconds) |
23:06:12 | * | hax-scramper joined #nim |
23:07:25 | FromDiscord | <Avatarfighter> oh jeez you shouldn't have shown me nim-stew now I might have to retract what I just said of keeping my lib free of external libraries lol |
23:09:39 | leorize | you can try to introduce endians2 into endians and make a PR :) |
23:09:46 | leorize | the folks at status would thank you :P |
23:16:25 | * | ksandvik quit (Quit: WeeChat 2.8) |
23:19:23 | FromDiscord | <Avatarfighter> I actually really like how status does their endians tbh and I would definitely do a PR but I'm not exactly the best when it comes to making them |
23:19:45 | leorize | well, practice makes perfect :) |
23:20:35 | FromDiscord | <Avatarfighter> I'm about to get roasted lmfao |
23:20:56 | * | hax-scramper quit (Read error: Connection reset by peer) |
23:21:09 | * | hax-scramper joined #nim |
23:21:17 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hwt |
23:21:19 | FromDiscord | <KingDarBoja> Wut? |
23:21:20 | * | gmpreussner quit (Quit: kthxbye) |
23:21:37 | * | gmpreussner joined #nim |
23:21:44 | FromDiscord | <Avatarfighter> I'll make two variants of my lib one using status' lib and the other the std one and if there is truly an advantage to using the status one I'm making a PR haha 🙂 |
23:30:23 | leorize | @KingDarBoja: s/=/:/ on line 8 lol |
23:30:25 | * | hax-scramper quit (Ping timeout: 265 seconds) |
23:31:02 | leorize | also it doesn't work since we don't have a default `$` for ref object, dereference it first |
23:31:15 | * | hax-scramper joined #nim |
23:33:38 | FromDiscord | <KingDarBoja> 🤦 |
23:38:45 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hwA |
23:44:05 | FromDiscord | <KingDarBoja> Hold on, I think I found something |
23:44:53 | * | Guest54101 left #nim ("Kicked by @appservice-irc:matrix.org : issued !quit command") |
23:47:09 | FromDiscord | <KingDarBoja> https://play.nim-lang.org/#ix=2hwC Why the test that runs after adding the JSON operator is more verbose? lol |
23:48:33 | leorize | it tries to bind `$` if available |
23:48:59 | FromDiscord | <KingDarBoja> Intriging |
23:49:11 | FromDiscord | <KingDarBoja> Intriguing* |