<< 10-04-2020 >>

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:33FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hoY awr1, I think this would be the issue 🤔
00:58:32*flaviu joined #nim
01:08:21flaviuhttps://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:50FromDiscord<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:48flaviuwell 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:54FromGitter<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:56ryukopostinganyone else getting "undeclared identifier" when trying to use the capture macro from sugar?
01:44:00ryukoposting1.0.6
01:44:32companion_cubeif I have a `x: var Foo` with Foo a ref object, does x.addr point to the foo, or to x itself?
01:45:28ryukopostingx itself, I believe
01:45:39ryukopostingI could be wrong though
01:46:17companion_cubehow do I get the address of the object itself? (if I want to compare or hash by address)
01:46:50FromGitter<iffy> `.repr` will get you the address usually -- or `.addr` or `.unsafeAddr`
01:48:06ryukopostingcompanion_cube https://nim-lang.org/docs/system.html#addr%2CT seems to indicate how to use repr and addr together
01:49:43companion_cubeso p.addr is like &p, and p[] is like *p in C?
01:49:57ryukopostingyup
01:51:21companion_cubethanks!
01:51:51ryukopostingno problem, what are you working on?
01:57:30companion_cubetrying my hand at a small CLI tool, a proof checker
01:59:54*oculuxe quit (Quit: blah)
02:00:56ryukopostingthat'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:58companion_cubeoh in this case no, it's just because I'm implementing a DAG structure and comparing addresses
02:08:07companion_cubesame way I'd do in C
02:08:23companion_cubewhen I create an object with a table inside, do I need to initialize it automatically?
02:08:31companion_cubemanually*
02:10:01companion_cube(also: is there a way to derive $ for a simple object?)
02:12:10companion_cubeok so it doesn't initialize tables...
02:15:12*zacharycarter quit (Ping timeout: 256 seconds)
02:18:43FromGitter<sealmove> so I've got a gcc 5.4.0 ...
02:18:56FromGitter<sealmove> Does Nim 1.0.0 support it?
02:19:37*endragor quit (Ping timeout: 258 seconds)
02:22:31FromGitter<sealmove> actually it might be even older, 4.8
02:22:47FromGitter<sealmove> 🤮
02:22:47leorize@sealmove: yes
02:23:12leorizeyou need newer gcc for nim 1.2 without -d:nimEmulateOverflowChecks
02:23:23leorizethough I'll see if I can make it so that you don't have to
02:24:25FromGitter<sealmove> nice
02:24:35companion_cubethere'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:53companion_cubeso I have to create this table in `newFoo` and it's error prone since the default behavior is `nil`
02:25:01leorizedo you have a failing example?
02:25:13leorizejust `= newFoo`?
02:25:14companion_cubedeclare the type, `proc newFoo(): Foo = init(result)`
02:25:22FromGitter<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:30companion_cubeI mean, I'd like the compiler to tell me I didn't initialize a field
02:25:40leorize@sealmove: you can use it
02:25:46companion_cube`not nil` should be the default :/
02:25:52leorizecompanion_cube: tag the field with `{.requiresInit.}`
02:25:56companion_cube:o nice
02:27:03companion_cubenot nil would be nice, but well
02:27:21leorizenot nil will work once we iron out all the bugs :P
02:28:03companion_cubeis it "safe" to enable the experimental not nil?
02:28:07leorizehttps://github.com/nim-lang/RFCs/pull/169 <- here's a related RFC
02:28:25leorizecompanion_cube: "safe" in the sense that there won't be memory errors, yes
02:28:39leorize"safe" in the sense that it actually work well, no :P
02:29:01leorizethe thing is so terrible you gotta pretty print all the checks if you want it to actually function
02:29:09companion_cubein the sense that it won't disappear in the future
02:29:10companion_cubeah :/
02:30:06leorizewe 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:35leorizewell it's pretty low on the list, even in our surveys
02:31:09companion_cube"faster horses" and all that :)
02:31:37companion_cube(`type Foo = ref object not nil …` isn't valid. btw)
02:31:57leorizeit's vaild, you just gotta be a bit creative
02:32:06*muffindrake joined #nim
02:32:08leorizetype Foo = (ref object) not nil
02:32:11companion_cube:DDDD nice
02:33:02companion_cubeah yeah, but I meant, to declare the fields afterwards
02:33:26leorizeit will work once someone report a bug related to it :P
02:33:38companion_cube`cannot prove 'newTable(64)' is not nil` ahhh right
02:34:13leorizeyou gotta do a lot of spoon feeding just to prove it to the compiler
02:34:26leorizewe have a CFG that can analyze these kinds of things
02:34:46leorizebut it's a new technology in the compiler, and not nil is an old one, so it's not hooked into it
02:37:38FromDiscord<tjpalmer> I have a question. The following code builds without `--gc:arc`, but not with arc:
02:37:38FromDiscord<tjpalmer> ```nim
02:37:38FromDiscord<tjpalmer> func call_me(n: int32): cstring {.exportc.} =
02:37:39FromDiscord<tjpalmer> let hi = "hi"
02:37:39FromDiscord<tjpalmer> system.GC_ref(hi)
02:37:39FromDiscord<tjpalmer> hi
02:37:40FromDiscord<tjpalmer> ```
02:37:41FromDiscord<tjpalmer> The error I get is:
02:37:42FromDiscord<tjpalmer> ```
02:37:44FromDiscord<tjpalmer> Error: type mismatch: got <string>
02:37:45FromDiscord<tjpalmer> but expected one of:
02:37:47FromDiscord<tjpalmer> proc GC_ref[T](x: ref T)
02:37:49FromDiscord<tjpalmer> first type mismatch at position: 1
02:37:50FromDiscord<tjpalmer> required type for x: ref T
02:37:52FromDiscord<tjpalmer> but expression 'hi' is of type: string
02:37:53FromDiscord<tjpalmer>
02:37:55FromDiscord<tjpalmer> expression: system.GC_ref(hi)
02:37:56FromDiscord<tjpalmer> ```
02:38:02FromDiscord<tjpalmer> Any thoughts?
02:38:50companion_cubeleorize: thanks, opened an issue
02:41:57*endragor joined #nim
02:43:59FromDiscord<Varriount> This is interesting.. how is `x == 'a' or x == 'b'` slower than `x in {'a', 'b'}`?
02:44:37FromDiscord<Varriount> I ran some benchmarks, and the latter solution was slightly slower
02:44:45FromDiscord<Varriount> *former
02:46:28*zacharycarter joined #nim
02:50:41*zacharycarter quit (Ping timeout: 250 seconds)
02:50:56companion_cube`{'a', 'b'}` is a bitset, I think
02:51:06companion_cubeso that's just a mask operation and != 0
02:51:25companion_cubeah maybe a bit more, but still
02:51:36companion_cubeless 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:20companion_cubehmm 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:48FromDiscord<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:31FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hps
03:10:42FromDiscord<KingDarBoja> And been looking for some issues / posts about it
03:11:38*nekits joined #nim
03:13:17FromDiscord<KingDarBoja> So far the only thing requires type casting ...
03:16:53FromDiscord<KingDarBoja> https://matthiashager.com/nim-object-oriented-programming Hummm
03:17:18FromDiscord<Varriount> You need to have a parent ref object
03:17:35FromDiscord<Varriount> Er, parent ref type
03:17:55FromGitter<dumjyl> Just upconv them, https://play.nim-lang.org/#ix=2hpu
03:20:53FromDiscord<KingDarBoja> @Varriount at the example, it is supposed to be "Foo" the parent ref object
03:20:53FromDiscord<KingDarBoja> While Bar is the derived class which stores a property as `seq[Foo]`
03:22:56*zacharycarter joined #nim
03:23:31FromDiscord<Varriount> What are you trying to model? Show me the Python code.
03:24:27FromDiscord<KingDarBoja> awr1 helped me but we stomped on some weird (or maybe we are wrong) behaviour
03:24:29FromDiscord<KingDarBoja> Hold on
03:26:13FromDiscord<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:45FromDiscord<KingDarBoja> I did pretty much the same on Nim -> https://github.com/KingDarBoja/Phosphate/blob/master/src/error/graphql_error.nim#L73
03:27:29FromDiscord<KingDarBoja> The problem is that you can pass a `SelectionNode` type to that init parameter (`Node`)
03:27:56FromDiscord<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:41FromDiscord<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:04FromDiscord<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:16FromDiscord<KingDarBoja> awr1 pointed out some possible fix -> https://play.nim-lang.org/#ix=2hoN
03:31:17FromDiscord<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:28FromDiscord<Varriount> @KingDarBoja Is the Node type an object, or a reference?
03:36:14FromDiscord<KingDarBoja> It is a ref -> type TypeNode* = ref object of Node
03:37:15FromDiscord<KingDarBoja> -> type Node* = ref object of RootObj
03:40:42FromDiscord<KingDarBoja> https://github.com/KingDarBoja/Phosphate/blob/master/src/language/ast.nim#L86
03:41:03companion_cubehow to return `something or nil`? as a type?
03:41:25companion_cubeah wait, nevermind
03:44:29*waleee-cl quit (Quit: Connection closed for inactivity)
04:01:12FromDiscord<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:25FromDiscord<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:29FromDiscord<Varriount> @KingDarBoja Would methods work? https://nim-lang.github.io/Nim/manual.html#multiminusmethods
04:21:01FromDiscord<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:28FromDiscord<KingDarBoja> So methods allow dynamic parameters, in this case, pass derived objects if parent object type is specified?
04:23:18FromDiscord<KingDarBoja> Also, should I worry about this note -> _Note: Starting from Nim 0.20, generic methods are deprecated._
04:24:33FromDiscord<Varriount> Are you using generics?
04:24:39FromDiscord<Varriount> (and if so, why?)
04:25:59FromDiscord<KingDarBoja> No, not using generic on my code
04:26:08FromDiscord<KingDarBoja> If you mean passing [T]
04:28:35FromDiscord<KingDarBoja> But looks like if I want to pass a derived type I MUST provide proc calls for each derived type lol
04:28:53FromDiscord<KingDarBoja> Not really want I want lol
04:28:57FromDiscord<Varriount> Well, yes. That's presumably why you're deriving types
04:29:14FromDiscord<Varriount> You don't have to provide a new call, unless you want to change behavior.
04:29:33FromDiscord<Varriount> Child types will inherit parent methods that haven't been overridden.
04:33:01FromDiscord<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:33FromDiscord<Varriount> Yes
04:38:06kungtottehttps://play.nim-lang.org/#ix=2hpH
04:38:34FromDiscord<Varriount> Though, your when statements won't work. `when` is for compile-time evaluation.
04:39:01FromDiscord<KingDarBoja> You're right... D:
04:41:04*endragor quit (Remote host closed the connection)
04:44:02*endragor joined #nim
04:48:08FromGitter<awr1> i don't really understand what you're trying to do here
04:48:25FromDiscord<KingDarBoja> Arrghh hard to test, changing stuff but looks like Option module could be ruining it
04:48:36FromDiscord<Varriount> awr1: They are trying to model an AST using inheritance.
04:49:04FromDiscord<KingDarBoja> What variount said
04:49:13FromGitter<awr1> this sort of thing is why i like variants more often than not
04:51:17FromDiscord<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:25FromDiscord<KingDarBoja> I want to hang myself
04:52:05FromDiscord<KingDarBoja> Probably as I said, the Options thing messing
04:53:12kungtotteawr1: 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:31FromGitter<awr1> variants do have their limitation
04:53:42FromGitter<awr1> s
04:53:42FromDiscord<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:17FromGitter<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:21FromGitter<awr1> a few days ago
04:54:30kungtotteNode vs. seq[Node] is fixed more easily with overloading I think
04:54:53FromGitter<awr1> maybe make Node a typeclass
04:55:02FromGitter<awr1> /shrug
04:55:05FromDiscord<KingDarBoja> A typeclass?
04:55:23FromGitter<awr1> well
04:55:51FromGitter<awr1> you can have a inheritance tree, RootNode, SpecialNode, ExprNode, whatever it is you have
04:56:09FromGitter<awr1> and then `type Node = RootNode or SpecialNode or ExprNode`
04:56:28FromDiscord<KingDarBoja> Node is my root Node lol
04:57:57FromDiscord<KingDarBoja> But I feel like I have seen that before
04:58:07leorize@Varriount: it's a bitset, so checking took one operation instead of two.
05:01:57FromDiscord<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:58FromDiscord<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:53FromDiscord<Varriount> @KingDarBoja https://github.com/Varriount/commandant/blob/master/commandant/parser.nim#L5
05:04:22FromDiscord<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:10leorize@Varriount: what does that even mean :P
05:08:09leorizehere'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:23FromDiscord<KingDarBoja> Okay I gave up for todat
05:12:26FromGitter<awr1> @leorize did you get a chance to see this? https://github.com/nimterop/nimterop/issues/177
05:13:18FromDiscord<Varriount> KingDarBoja: What do you mean? All my nodes have the 'token' and 'unlinked' fields.
05:13:52leorize@awr1: can't you not do this already with `cPlugin`?
05:14:47FromGitter<awr1> cPlugin isn't advanced enough to my knowledge, unless i'm missing something
05:14:51leorizeI'm all in for a way to better transform things though
05:15:12FromGitter<awr1> you get a collection of node kinds, but no real node tree
05:16:09shashlickWe can certainly add the ability to manipulate the resulting ast
05:16:16shashlickWill share my thoughts tomorrow
05:16:33FromDiscord<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:00FromDiscord<KingDarBoja> kungtotte: Yeah, it is the options module -> https://play.nim-lang.org/#ix=2hpP
05:22:23FromDiscord<KingDarBoja> Check the second error message
05:23:01*Knaque quit (Remote host closed the connection)
05:24:37kungtotteThe 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:14kungtotteIt errors out on two.print() because it can't match print(ChildTwo) to either print(ChildOne) or print(Option[BaseObj])
05:32:25FromDiscord<KingDarBoja> So if providing the pragma to the second method and chaning its type signature to use Option too, it still fails
05:32:32FromDiscord<KingDarBoja> Just curious right now why
05:32:42FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hpQ
05:33:25kungtotteBecause 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:15Yardanicois there a way to make Nim not pass "-g" to the C compiler?
05:34:44Yardanicoah, debuginfo probablyh
05:35:17Yardanicoor not
05:36:08leorizeYardanico: just don't pass `-g` to Nim?
05:36:12FromDiscord<KingDarBoja> Ohhh, so wrapping in Option[] is different that letting those be without it
05:36:17Yardanicoleorize: I don't?
05:36:34kungtotteKingDarBoja: yes, why wouldn't it be? It's a different type after all.
05:36:35leorizeare you passing --debugger:native or anything like that?
05:36:38Yardanicono
05:36:40FromDiscord<KingDarBoja> That's why your first example works with type inheritance
05:36:46Yardanicowait let me check if -g is actually there or not
05:36:48leorizemaybe check your config then?
05:37:00FromDiscord<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:32FromDiscord<Varriount> Yes
06:00:12FromDiscord<Varriount> `Option[ChildRefType]` cannot be converted to `Option[ParentRefType]`
06:02:01Yardanicoohh I'm bashing my head against the wall
06:02:15*leorize-M left #nim (#nim)
06:02:33Yardanicowhen 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:48Yardanicowhen I compile it in termux itself (it has nim in its repos) it works just fine
06:02:59Yardanicomaybe it's due to me using musl, not sure
06:03:43Yardanicohttps://androidsavvydev.wordpress.com/2020/01/28/getaddrinfo-from-musl-does-not-work-on-android-try-again/
06:03:44Yardanicooh
06:03:56*zacharycarter joined #nim
06:04:02leorizemusl needs /etc/resolv.conf :P
06:04:18leorizeandroid certainly don't have that
06:04:54Yardanicowell I can try to create it to try xd
06:05:04Yardanico(since i have root on my phone)
06:05:05Yardanicojust to test
06:06:06Yardanicoyeah you're right it works
06:06:19*solitudesf joined #nim
06:07:17leorizedid dom96 quiet all unindentified users?
06:08:37*zacharycarter quit (Ping timeout: 264 seconds)
06:17:16FromDiscord<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:48kungtotteI would make two procs instead
06:18:45kungtotteproc 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:13FromDiscord<KingDarBoja> And how you would handle múltiple params that uses union types ? More procs?
06:25:29FromDiscord<KingDarBoja> Would you*
06:25:33Yardanicoyou can have them in same proc but use "when" to differentiate
06:25:44kungtottev0v it all depends on your overall design
06:25:47Yardanicobut can't you design your program so it's easier to understand rather than use union types? :P
06:26:10kungtotteI get anxious when the number of params go above ~4
06:26:17FromDiscord<KingDarBoja> I like your thinking Yardanicco
06:27:44FromDiscord<KingDarBoja> Can you provide an example of that Yardanicco? Using the when and two parameters with Union Types?
06:29:27FromDiscord<KingDarBoja> Like so: proc sample(a: int or seq[int], b: Foo or seq[Foo])
06:30:15FromDiscord<Rika> the body of the proc is just a `when a is int and b is Foo: dosmth` and `else: dosmth`
06:31:08Yardanico@KingDarBoja https://play.nim-lang.org/#ix=2hpX
06:31:47leorize[m]that looks like a mess :P
06:31:47Yardanicoof course you don't have to put ALL code in the "when", you can have common code for different branches
06:31:54Yardanicoleorize[m]: yeah I agree
06:31:57leorize[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:37moermHello everyone
06:38:38kungtotteI tend to use something like the bottom version here: https://play.nim-lang.org/#ix=2hq0
06:40:01kungtotteIf 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:50kungtotteAnd if you have so many parameters that doing that becomes unwieldy, maybe you have too many parameters
06:41:02supakeenmoerm: Good morning!
06:44:07FromDiscord<KingDarBoja> Oh yeah, a mess as I thought lol
06:44:20*zacharycarter joined #nim
06:44:25FromDiscord<KingDarBoja> Last question before going to bed
06:45:11FromDiscord<KingDarBoja> Doesn't matter if I set as default parameter a nil value for Unión Types?
06:46:21Yardanico seqs and strings can't be nil anymore
06:48:34*zacharycarter quit (Ping timeout: 240 seconds)
06:52:05FromDiscord<KingDarBoja> Yikes
06:52:08FromDiscord<KingDarBoja> Okok
06:55:05FromDiscord<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:15FromDiscord<KingDarBoja> And not just nil
06:56:03Yardanicoso just use procedure overloading please
06:57:03Yardanicoalso I found a codegen bug right now, xD
06:57:08Yardanicojust 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:29moermMaybe till later ... cu
07:22:37*moerm quit (Quit: Leaving)
07:31:57*Vladar joined #nim
07:38:54PrestigeAnyone know of wrappers for xlib or xcb? I haven't found any, but it would be awesome
07:38:59YardanicoPrestige: yeah there is
07:39:11Yardanicohttps://github.com/nim-lang/x11
07:40:10PrestigeOh very nice, thanks Yardanico
07:40:18Yardanico"nimble install x11"
07:41:24YardanicoYou can use https://nimble.directory/ for finding Nim packages
07:41:44Yardanicoor "language:nim query" in github search since almost all Nim libraries are hosted on github
07:41:54Yardanicohttps://github.com/search?q=language%3Anim+x11
07:42:00PrestigeI was just searching specifically for xcb and xlib, ty
07:42:16PrestigeAh that's handy
08:41:35*natrys joined #nim
08:54:37dom96Good morning everyone
08:56:03Yardanicogood morning
09:00:20FromGitter<t1273446_twitter> Morning
09:05:23FromGitter<sealmove> morning
09:08:49FromGitter<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:40FromGitter<faulander> good morning! :)
09:16:55FromGitter<faulander> although it's already almost lunchtime in central europe ;)
09:19:43FromGitter<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:14FromGitter<Vindaar> @faulander my notes? Are you thinking about @kaushalmodi's notes?
09:22:26FromGitter<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:52FromGitter<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:39FromGitter<sealmove> guys, where is the usual place to put stuff you install manually on travis, or linux in general for that matter?
10:07:57FromGitter<sealmove> /opt?
10:08:01*xcm joined #nim
10:09:05FromGitter<Vindaar> @sealmove kinda depends, but either /opt or /usr/local are the most common I think
10:14:11FromGitter<sealmove> thanks
10:15:48Yardanicohttps://github.com/nikku/works-on-my-machine
10:15:52Yardanicohttps://github.com/auchenberg/volkswagen
10:19:28FromDiscord<Rika> LMAO
10:19:32FromDiscord<Rika> that volkswagen one
10:27:25FromGitter<sealmove> how does one deal with prompts like `Prompt: No local packages.json found, download it from internet? [y/N]` on CI?
10:28:08FromDiscord<Rika> i think it was a flag, -y maybe
10:30:12FromGitter<Vindaar> yes, most tools have flags to auto yes those things. And yes, it's -y for nimble too
10:30:33FromGitter<sealmove> I am running ./build_all.sh
10:30:47FromGitter<sealmove> and nimble install
10:31:16FromDiscord<Rika> `nimble install -y` isnt it?
10:31:25FromDiscord<Rika> package name ofc forgot that
10:36:30FromGitter<sealmove> nice
10:38:41FromGitter<sealmove> finally fixed this hell X_X kaitai ci is so complicated
10:45:27Amun_Rais there a way to check if the given value is in enum?
10:47:02Amun_RaI mean other than use 'case'
10:52:01FromDiscord<__ibrahim__> sorry to interrupt, what does this error mean?
10:52:01FromDiscord<__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698123113384378398/unknown.png
10:52:20FromDiscord<__ibrahim__>
10:52:20FromDiscord<__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698123191616274522/unknown.png
10:52:41*abm joined #nim
10:54:50FromGitter<Vindaar> @Amun_Ra can you give an example?
10:56:04narimiranAmun_Ra: `typeof(myEnum)`
11:05:25FromDiscord<Rika> @__ibrahim__ seems like youre missing some stuff for glfw?
11:18:50FromDiscord<__ibrahim__> yeah seems like some directx library
11:19:50FromGitter<sealmove> 1) 9% https://ci.kaitai.io/ :)
11:22:41Amun_RaVindaar: narimiran: http://dpaste.com/0CSDXTB
11:23:36narimiranAmun_Ra: https://nim-lang.github.io/Nim/strutils.html#parseEnum%2Cstring ?
11:26:19FromGitter<Vindaar> yeah, since you have strings already anyways, just use `parseEnum`
11:27:19Amun_Rathat enum is an int
11:30:09FromGitter<Vindaar> hm, for a second there I thought It'd work anyways, but yeah you're right
11:30:41Amun_Rabut looking at the parseEnum gave me an idea
11:32:21FromDiscord<Rika> Amun_Ra
11:32:28FromDiscord<Rika> are you trying to make a bitset?
11:32:45FromDiscord<Rika> ah
11:32:49FromDiscord<Rika> never mind haha
11:33:27FromGitter<Vindaar> @Amun_Ra: you can do this: https://play.nim-lang.org/#ix=2hro
11:34:17FromGitter<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:01Amun_RaI writing a BMP reader and I thought I'd use Enum instead of an uint32 filed and a bunch of consts
11:38:13Amun_Rahttp://dpaste.com/2XTZ507
11:38:36Amun_Rathe only drawback it does not skip gaps
11:38:54Amun_Ra(the real enum does not contain only fields of (1<<n))
11:39:21FromGitter<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:41Amun_Ramacro 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:18FromGitter<Vindaar> spoiler: https://play.nim-lang.org/#ix=2hrx
11:47:29*ehmry joined #nim
11:51:28Amun_Rawow, thanks Vindaar
11:53:07FromGitter<Vindaar> :)
11:53:33Amun_RaI'm quite new to the whole macro world, it'd take me much more than that :)
11:56:58*SebastianM joined #nim
11:57:31FromGitter<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:05Zevvmacros 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:10FromGitter<Vindaar> I don't they're that bad, but you have a point.
12:30:28Zevvwell, 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:50FromDiscord<Rika> Macros are great
12:41:01FromDiscord<Rika> They're at least more understandable than regex at a glance
12:42:18krux02Rika: macros and regex are completely different things.
12:42:36FromDiscord<Rika> Zevv compared them lol
12:42:47FromDiscord<Rika> Check them logs yo
12:48:09*zacharycarter joined #nim
12:51:30FromDiscord<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:53FromDiscord<__ibrahim__> can someone explain this to me?
12:51:53FromDiscord<__ibrahim__> ```
12:51:54FromDiscord<__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:54FromDiscord<__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:09FromDiscord<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:19companion_cubeAraq: 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:35FromGitter<alehander92> hey!
13:33:39FromGitter<alehander92> indeed they are not
13:33:53planetis[m]<companion_cube "Araq: hmm, `object` and `ref obj"> that's right, and for the latter you need to instantiate it
13:33:54FromGitter<alehander92> ref is a managed pointer
13:34:24planetis[m]this is done with ``new(result)`` or with ``let foo = Foo()``
13:34:48FromGitter<alehander92> i prefer Foo() as its the same for objects/ref objects
13:35:02FromGitter<alehander92> but iirc `new` is also useful in some generic cases
13:35:37companion_cubeplanetis[m]: with `new(result)` or the likes, ritght?
13:35:37planetis[m]me too
13:36:07companion_cubeI wanted ref semantics, so the object could be shared easily (should really not be copied), is all
13:36:22planetis[m]yes
13:38:45companion_cubefor now I dropped the `not nil`
13:39:11companion_cubeso far the lack of nil safety is the thing that worries me a bit in nim, otherwise it's quite nice
13:42:11FromGitter<alehander92> it is supposed
13:42:13FromGitter<alehander92> to be added soon
13:42:42FromGitter<alehander92> it's even planned ref to be `not nil` by default
13:42:51companion_cubeyeah that's good.
13:43:04*Spy653 joined #nim
13:43:12companion_cubethe other thing is better safety when using case structs
13:43:20FromGitter<alehander92> can you give an example?
13:43:27FromGitter<alehander92> of case unsafety
13:43:38Spy653so this is what irc looks like
13:43:46companion_cubewhen using `case` on the tag, one can access the wrong fields without warnings
13:43:57planetis[m]what does this mean though? the compiler will insert ``if foo != nil: foo.member = 8`` ?
13:45:30zacharycarterI 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:05zacharycarteris there a way to install nim from a specific commit hash with choosenim?
13:48:15krux02Spy653, IRC is the future
13:48:25FromGitter<alehander92> planetis[m]: what?
13:48:42krux02all these hip technologies will fade away, but IRC with stay with us until the end of time.
13:48:46FromGitter<alehander92> companion_cube hm, this shouldn't be the case
13:49:09companion_cubealehander92: I tested last week, and it's not checked by the compiler
13:49:19krux02zacharycarter, git checkout <hash> && koch boot -d:release
13:49:25krux02zacharycarter, git checkout <hash> && koch boot -d:danger
13:49:57zacharycarteryeah 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:16zacharycarterbut 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:45krux02yea
13:51:37krux02I never used choosenim. I never heard people telling how awesome choosenim is, only how they have problems with it.
13:51:52zacharycarterit's pretty nice IMO
13:52:18krux02and effectively it replaces "git checkout my-branch && ./koch boot -d:danger"
13:52:27krux02often I don't even use koch boot
13:52:29krux02I use koch temp
13:52:44krux02`koch temp c -r scritch.nim`
13:52:48zacharycarterbut you can also switch between versions of Nim which is nice
13:53:06zacharycarterit's also a version manager
13:53:18krux02bit it can't switch to hashes or branches, which is most important for me.
13:53:28zacharycarteryeah - I don't think it's great for folks hacking the compiler
13:53:31zacharycarterbut for end users of Nim it's nice
13:53:40krux02a version is just a number, I don't need a manager for that.
13:54:00krux02maybe it is nice
13:54:19krux02I would prefer though, if it wasn't necessary to swtich between different version of Nim.
13:55:00planetis[m]test
13:55:01zacharycarterthe only time I've really found doing ^ necessary these days is when I want to see if something is broken in devel
13:55:14planetis[m]finally works
13:55:14krux02I am always on devel
13:55:33krux02anyway, good luck, I will be back soon. Get some food now
13:55:37FromGitter<alehander92> sometimes one needs different branches/versions for different projects
13:55:41FromGitter<alehander92> this is normal, come on :D
13:55:41planetis[m]sorry alehander42: i was talking about not nil
13:55:53planetis[m]if it works at compiletime or runtime
13:56:00FromGitter<alehander92> but yeah i also usually use repos and git easier for maintaining patches
13:56:10FromGitter<alehander92> planetis[m]: sorry, yes, it works on compiletime
13:56:27planetis[m]nice
13:56:29*Vladar quit (Quit: Leaving)
13:56:45FromGitter<alehander92> https://github.com/nim-lang/RFCs/pull/169
13:57:00planetis[m]matrix doesn't work well maybe its time to switch back to irc
13:57:29FromGitter<alehander92> the rfc is a bit rough, but at least this was the original idea
13:57:33FromGitter<alehander92> after some discussions
13:57:42FromGitter<alehander92> now i am not sure if this is how it's gonna be implemented
13:57:55planetis[m]thanks for the link
13:58:15FromGitter<alehander92> there exists an example implementation actually
13:58:31FromGitter<alehander92> but it's still not clear if it's going to be the accepted one + it needs some optimization
13:58:47FromGitter<alehander92> no problem
13:58:54zacharycarterwell nevermind - that branch does not fix the `--gc:arc` issue I posted yesterday
14:00:24FromDiscord<KingDarBoja> Good morning
14:00:38FromDiscord<KingDarBoja> Couldn't sleep well due to doubts at my head lol
14:01:33FromGitter<alehander92> about programming? dude :D
14:01:51FromGitter<alehander92> don't sweat it
14:03:07FromDiscord<KingDarBoja> Happens to me sometimes lol xD
14:03:14FromDiscord<KingDarBoja> But today is friday, I will relax
14:03:18FromGitter<alehander92> good!
14:04:34FromDiscord<KingDarBoja> Just copied all the suggestions and stuf that I discussed yesterday on a notepad file lol
14:04:49FromDiscord<KingDarBoja> I will analyze it later, now working a bit
14:15:49leorize[m]planetis[m]: if you're still on matrix.org, switch to another homeserver
14:16:30leorize[m]also switching the bridge to the kde one is also a good move :p
14:18:12planetis[m]i will try the kde bridge
14:18:20FromGitter<alehander92> guys
14:18:28FromGitter<alehander92> so iterators are coroutines right
14:18:34planetis[m]thanks for the suggestion
14:18:43FromGitter<alehander92> like, i know people don't call them coroutines and have more specific definition
14:18:56FromGitter<alehander92> but i can't understand how is it exactly defined
14:19:40FromDiscord<KingDarBoja> I just noticed Araq is Nim creator D:
14:20:13FromGitter<alehander92> basically, coroutines can yield
14:20:15FromGitter<alehander92> cooperatively
14:20:50FromGitter<alehander92> and coro.nim seems to me to be about .. preemptiveness?
14:21:21leorize[m]technically, only closures are
14:21:21FromGitter<alehander92> as it seems you can `suspend`
14:21:53leorize[m]and when they say coroutines they usually imples having automated task scheduling
14:22:04leorize[m]which we don't have
14:22:37krux02@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:05FromGitter<alehander92> i dont think so
14:24:46FromGitter<alehander92> from what i find they are about yielding
14:24:49FromGitter<alehander92> and cooperativeness
14:25:12FromGitter<alehander92> you can use them to implement task scheduling of course
14:25:28FromGitter<alehander92> the difference i find in wikipedia(eh sorry)
14:25:44FromGitter<alehander92> is that coroutines yield to particular next locations
14:26:01FromGitter<alehander92> and semicoroutines/generators just yield but dont control to where
14:26:59*opal quit (Remote host closed the connection)
14:27:18FromGitter<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:15planetis-Mryukoposting: hi! are you a kate user? https://github.com/ryukoposting/NimKate
14:37:39*NimBot joined #nim
14:38:07krux02I used Kate a lot when it was still KDE3
14:39:39Guest86017still use kate for small text files
14:44:28planetis-Mnope it's not a bridge issue, my messages are stuck at sent but don't get delivered
14:45:13planetis-Mbut now it works!!
14:48:25Guest86017I 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:31Guest86017one, 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:37Guest86017go 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:43Guest86017least 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:17Yardaniconimterop exists :P
14:49:48*planetis joined #nim
14:49:49Guest86017Yardanico: 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:14YardanicoI 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:35Guest86017I was under the impression this channel had logs?
14:52:56Yardanicoyes, but if you post it on the forum it will get much more exposure
14:53:22FromGitter<alehander92> yeah its very very easy to miss stuff in the irc logs
14:53:29FromGitter<alehander92> even you take a look there from time to time
14:54:44shashlickIf i can get some help, it can come sooner
14:55:06shashlicki was able to rebuild C support with nim compiler backend in 3 months part time
14:55:52shashlickand it is more feature rich than the legacy algorithm
14:56:21Guest86017shashlick: what do you mean by legacy algorithm?
14:56:53*fputs joined #nim
14:59:08shashlickthe original C -> Nim algorithm which is shipping today in 0.4.4
15:00:42shashlicki 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:43shashlicki'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:45Guest86017shashlick: swig supports very advanced C++ features, and new ones are planned https://github.com/swig/swig/pull/1678
15:02:45leorize[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:23Guest86017shashlick: 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:38leorize[m]doesn't swig require integration into the project itself?
15:03:53leorize[m]the last time I tried to use it to generate wrappers for pascal that was my biggest blocker
15:04:18FromGitter<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:28FromGitter<Yardanico> emailed them already, hope they don't take too long to unban me :D
15:04:37Guest86017leorize[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:18shashlickI don't doubt it might be impossible, even 4raq has that opinion
15:06:35shashlickbut i'm going to try nonetheless and see how far we can go
15:06:54leorize[m]Guest86017: I mean exactly what you just said, you gotta write a swig module :P
15:07:05Guest86017shashlick: did you ever read the swig 4.0 extensions documentation, it does seem straighforward, apart from being loads of work
15:07:28Guest86017leorize[m]: why would that be a bad thing?
15:07:30leorize[m]not all upstream is open to the idea, though I don't doubt it's a good tool
15:08:03FromGitter<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:17shashlickquite frankly, i'd rather write Nim than C++
15:08:37Guest86017Yardanico: definitely, swig is wrapper generator, once it has run, you can use the generated wrappers, so yes
15:08:59leorize[m]Guest86017: don't you mean that I have to write a module to push to the target project's upstream?
15:10:46Guest86017leorize[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:03FromGitter<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:14Guest86017these are all swig modules https://github.com/swig/swig/tree/master/Source/Modules
15:13:31Guest86017and all we need is someone to write a nim.cxx
15:16:38FromGitter<Vindaar> @faulander: tried https://github.com/SolitudeSF/imageman ?
15:16:51leorize[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:20Guest86017this is a good read on what would need to be done approximately http://www.swig.org/Doc4.0/SWIGDocumentation.html#Extending
15:20:10Guest86017leorize[m]: understood
15:35:39shashlickGuest86017: do you know swig well?
15:35:52*Prestige quit (Quit: Prestige)
15:36:26*Prestige joined #nim
15:37:03Guest86017shashlick: 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:34shashlickhow does it handle preprocessor declarations?
15:38:38*Kaivo quit (Quit: WeeChat 2.7.1)
15:39:15Guest86017shashlick: 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:31shashlickso 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:08FromGitter<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:44Guest86017shashlick: read Execution Model 39.4 http://www.swig.org/Doc4.0/SWIGDocumentation.html#Extending
15:42:10shashlickpulling #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:39shashlickwhich is why nimterop relies on these build tools and preprocessors to do their job before getting involved
15:42:49FromGitter<Vindaar> @faulander good to hear
15:46:26Guest86017there's #swig by the way
15:53:25Guest86017this 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:26FromGitter<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:08solitudesfthats not how you resize an image
16:21:02solitudesfthere are magnify/minify procs
16:21:59FromGitter<faulander> i just saw them, yes. i'll try that next
16:22:11*sigmapie8 quit (Remote host closed the connection)
16:22:47solitudesfyou should never assign height and width manually, unless you also modify underlying data/know what you're doing
16:22:57Yardanico@faulander also you shouldn't use "cast"
16:23:05Yardanicoyou can for example do float(myintvar)
16:23:35Yardanicoalso "float64" is same thing as "float"
16:24:15solitudesfyes, 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:15leorize[m]you definitely should not use cast
16:26:14leorize[m]float and int have different memory representation
16:26:49FromGitter<faulander> ok, forgive me - i am coming from python, no need for conversion there. still a beginner
16:28:32FromGitter<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:18Yardanicointeger scale, and no, you don't set 90
16:29:34Yardanicoif you want to minify you use minifyBy2
16:29:37Yardanicosorry "minify"
16:30:06FromGitter<faulander> bullshit. the scale is how many times it divides the width/height by 2
16:30:31Yardanicoyes, but you don't set it to 90 if you want to get 0.9 of original
16:30:40FromGitter<faulander> so if i want 25% i call minify(image,4)
16:30:52solitudesf2
16:31:35FromGitter<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:48Yardanicoyeah that's more complicated
16:31:52FromGitter<faulander> my code calculates the new width and height correctly
16:33:08FromGitter<faulander> with pillow in python i just do: ⏎ image.thumbnail((maxsizeHeight, maxsizeWidth), Image.ANTIALIAS)
16:33:43Yardanico thumbnail in pillow is not for RESIZING an image though
16:33:49Yardanicoit's for making a thumbnail
16:34:13FromGitter<faulander> doesn't matter, it works perfectly - i have resized a few hundred thousand pictures that way
16:34:51FromGitter<faulander> is there no lib in nim which can do that resizing?
16:34:56Yardanicoalso if you're looking for performance gains they might be much less than you expect since pillow is written in C
16:35:30Yardanicoi mean all the number cruncing stuff
16:36:11Yardanicosadly 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:28leorize[m]@treeform
16:36:38leorize[m]don't know if this work or if you gotta get on discord to ping him :P
16:36:51Yardanicoyeah I'll ping him from discord
16:37:02FromDiscord<Yardanico> @treeform
16:37:14Yardanicosee messages above pls :)
16:37:25FromGitter<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:44FromGitter<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:18solitudesfdont use bicubic if you need speed
16:45:52*Zectbumo joined #nim
16:46:28FromGitter<faulander> but?
16:48:23ZevvBilinear is faster
16:52:21*skrylar[m] quit (Ping timeout: 246 seconds)
16:52:30*skrylar[m] joined #nim
16:55:27FromDiscord<treeform> hey what?
16:55:35FromGitter<faulander> works good, but the size is 70% higher. before it was 9mb, now it's 16mb
16:55:43Yardanico@faulander was asking how to resize an image with flippy
16:55:47Yardanicowith custom width/height
16:56:29FromDiscord<treeform> hmm, I don't think I have a method for that.
16:57:02FromDiscord<treeform> I have minify/magnify but they take integer scale
16:57:23FromGitter<faulander> yes, i've read the source.
16:57:45FromGitter<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:07FromDiscord<treeform> I need to write a method for that
16:58:32FromDiscord<treeform> there are different resize mods like Bicubic bilinear...
16:59:09*lritter joined #nim
16:59:12solitudesf@flaunder, are you saving as jpeg?
16:59:27FromDiscord<treeform> oh wow BIcubic is not simple!
16:59:31FromDiscord<treeform> https://blog.demofox.org/2015/08/15/resizing-images-with-bicubic-interpolation/
17:00:30solitudesf*@faulander (wtf am i typing)
17:01:28FromGitter<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:05FromDiscord<treeform> sorry I don't support jpg yet
17:03:01FromGitter<faulander> yes you do @treeform if you compile with -d:useStl ;)
17:03:57FromDiscord<treeform> thats true stb does support it
17:06:02FromGitter<faulander> just missing a function like imageman has :)
17:07:10FromGitter<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:38FromDiscord<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:46FromDiscord<treeform> Yeah imageman looks great.
17:15:38solitudesfthere is also per file config
17:16:27FromDiscord<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:43Yardanicowhy though?
17:16:55Yardanicobut I think it should be possible since cfg supports @if
17:17:12Yardanicosee https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg
17:17:19Yardanicofor an example of .cfg usage
17:17:34FromDiscord<queersorceress> @solitudesf these aren't bound to particular files, as i'm working on additive tooling
17:18:46FromDiscord<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:00FromDiscord<treeform> solitudesf, did you run into problem with unicode with stb? https://github.com/treeform/flippy/issues/5
17:19:17Yardanico@queersorceress ah, sorry, I misunderstood your question
17:19:19FromDiscord<treeform> I see you use the open call: https://github.com/SolitudeSF/imageman/blob/master/src/imageman/images.nim#L293
17:19:47FromDiscord<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:58FromDiscord<queersorceress> no worries, i'm just asking 🙂
17:23:38solitudesf@treeform, i dont see unicode in the issue snippet. just tried opening image with emoji in filename and it worked.
17:24:04FromDiscord<treeform> solitudesf, are you on windows? only happens on windows.
17:24:40solitudesfnope, never tried it on windows
17:25:17FromDiscord<treeform> I found a work around to always read it into memory with nim and then have stb load it.
17:26:14solitudesfyeah, errors under wine. i want to switch from stb to libpng and libjpeg-turbo anyway.
17:26:48FromDiscord<treeform> yeah that is what I did, but libpng does not work with --gc:arc
17:27:04FromDiscord<treeform> so I am in the middle now... supporting both stb and libpng
17:28:18solitudesfyou mean nimPNG?
17:28:30FromDiscord<treeform> sorry yes nimPNG.
17:31:51Yardanicowait, since when code like "var x, y, z = 3" works?
17:32:00YardanicoI thought I can't do that in Nim 🤔
17:32:23FromDiscord<treeform> looks like a bug to me
17:32:49Yardanicowell it works correctly
17:32:57Yardanico!eval var x, y, z = 3; echo x, y, z
17:33:00NimBot333
17:33:24*rockcavera joined #nim
17:35:19FromDiscord<treeform> !eval var x, y, z = "na "; echo x, y, z
17:35:22NimBotna na na
17:36:03YardanicoI'm honestly really surprised since I didn't see this anywhere in the manual
17:36:17*Hexeratops joined #nim
17:36:34Yardanicoseems like it was in Nim since forever though, it works on 0.13.0
17:36:56FromDiscord<treeform> !eval var x, y, z = @["na "]; echo x, y, z
17:36:59NimBot@["na "]@["na "]@["na "]
17:37:21FromDiscord<treeform> !eval var x, y, z = "na "; x.add("oh"); echo x, y, z
17:37:24NimBotna ohna na
17:37:37FromDiscord<treeform> strange!
17:38:09FromGitter<alehander92> where is disruptek
17:38:20FromGitter<alehander92> disbot tell me
17:38:23Yardanico!last disruptek
17:38:29FromGitter<alehander92> oh i forgot the command
17:38:29Yardanico!seen disruptek
17:38:33Yardanicowait which one is it
17:38:38FromGitter<alehander92> is disbot even here
17:38:42Yardanicohe's not :O
17:38:42FromDiscord<treeform> !where disruptek
17:38:53Zevv"disruptek, [09.04.20 20:05]
17:38:54ZevvMy router finally shit the bed so I probably won’t be properly online for a few days."
17:38:55FromGitter<alehander92> !repo nim
17:39:08FromGitter<alehander92> ah i see
17:40:14ZevvI can also do some rambling and obscene remarks for you if you want
17:44:50FromGitter<alehander92> please do rambling
17:44:55FromGitter<alehander92> no obscene remarks
17:45:09FromGitter<alehander92> i just saw a bot printing weird stuff
17:45:12FromGitter<alehander92> and it reminded me of him
17:45:47FromDiscord<Skaruts> What is `Impl` for?
17:45:51Yardanicowhere?
17:45:58Yardanicoah, it stands for "Implementation"
17:46:01Yardanicoif that's what you wanted to ask
17:46:03FromDiscord<Skaruts> I've seen some people using that in quite a few places
17:46:23FromDiscord<Skaruts> as a suffix
17:50:29Yardanicoin nim?
17:50:39Yardanicowell for example streams module uses it for procedures
17:50:42Yardanico"closeImpl" and stuff
17:51:23FromGitter<alehander92> yeah its almost a convention
17:51:26FromGitter<alehander92> but i forget to use it
17:52:31FromDiscord<Skaruts> NiGui uses ControlImpl as a ref object of Control
17:53:46FromDiscord<Skaruts> what confuses me is that it seems to me that Control also is an implementation
17:55:09FromDiscord<Skaruts> I think what I'm trying to understand now is when to use this and why
17:57:59shashlicklooking for feedback and ideas on https://github.com/nimterop/nimterop/issues/177
17:58:45FromGitter<alehander92> i think its used when you have a public api like
17:58:50FromGitter<alehander92> mymacro or myproc
17:59:05FromGitter<alehander92> and actual more hairy implementation in mymacroImpl
17:59:24FromGitter<alehander92> e.g. useful for recursion maybe if you need to pass an initial value and other args which are not public
17:59:32FromGitter<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:51FromDiscord<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:55FromDiscord<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:39FromDiscord<Skaruts> araq once told me methods are about 6x slower
18:18:56*ryukoposting joined #nim
18:18:58FromDiscord<Skaruts> (than procs)
18:20:00*planetis quit (Quit: Konversation terminated!)
18:21:57kungtotteHave you profiled your code to see if it's slow?
18:22:44FromDiscord<Skaruts> no, and it doesn't seem slow. but I also never made the variant type to compare
18:22:58kungtotteI'm sure you can make slow object variant code and fast dynamically dispatch code, but in theory dynamic dispatch will be slower
18:23:06FromDiscord<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:40FromDiscord<Skaruts> you mean slower than static dispatch or slower than variant type?
18:24:22kungtotteBoth
18:24:31FromDiscord<Skaruts> oh
18:25:33FromDiscord<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:55shashlickYes you can silence specific hints
18:26:33Yardanicois 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:45kungtottequeersorceress: --hint:XDeclaredButNotUsed:off
18:26:46Yardanicoabout all these PRNG and hashes
18:28:46FromDiscord<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:04kungtotteSkaruts: 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:19companion_cubeis there someone working on nimsuggest/LSP ?
18:29:36FromDiscord<Skaruts> @queersorceress see the compiler notices to know which name to put inside the [..]
18:30:20FromDiscord<queersorceress> @Skaruts do i need to push+pop that or does the presence on a single line only count for said line?
18:30:23kungtottequeersorceress: 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:46FromDiscord<Skaruts> I usually place the pragma at the top of a file
18:30:53FromDiscord<queersorceress> @kungtotte ah, right; that is what i want then
18:30:54FromDiscord<Skaruts> above the imports
18:31:12*Zectbumo quit (Remote host closed the connection)
18:31:29*Zectbumo joined #nim
18:34:01FromDiscord<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:46FromDiscord<Skaruts> That's what I was hoping to find out anyway
18:35:41kungtotteIf you're really curious you could write a toy example with both versions and inspect the generated C code
18:35:58kungtotteAnd better still, write a benchmarking program for it to see how it shakes out
18:36:19FromDiscord<Skaruts> not be a bad idea
18:37:14*sz0 joined #nim
18:38:20FromGitter<sealmove> why this doesn't work?selector must be of an ordinal type, float or string
18:38:28FromGitter<sealmove> sorry: https://play.nim-lang.org/#ix=2huj
18:39:31FromGitter<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:58FromDiscord<Skaruts> well if you do `case ord(x)` it works
18:44:32FromDiscord<Skaruts> no idea if that's desirable though
18:48:30leorizecompanion_cube: PMunch is working on nimlsp
18:48:45leorizeyou can query me for any questions about nimsuggest though, I got a lot of experience with it
18:49:00companion_cubeit doesn't seem to do completion (in vim at least), is that right?
18:49:06companion_cubethe error reporting is cool, though.
18:49:13leorizenimlsp should do completion
18:49:18leorizeif it doesn't then that's a bug
18:49:41companion_cubeI didn't succeed in installing it
18:50:07companion_cube('build failed for [email protected]')
18:50:27leorizeah, the ultimate nimble descriptive error messages
18:50:38*DaG joined #nim
18:50:46leorizerun nimble --verbose --debug build
18:50:52leorizeit 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:58companion_cubeindeed :D
18:52:16companion_cubeah, it cannot open `/usr/nimsuggest/nimsuggest.nim`
18:52:21companion_cubeno idea why that would be a thing
18:53:12companion_cube(same kind of error when I tried to use nim doc… maybe the package is low quality)
18:53:36leorizeI think I know why it doesn't work
18:53:54*dagrin quit (Remote host closed the connection)
18:54:06companion_cubenothing urgent, really, I'm at work
18:54:11leorizejust nimlsp being nimlsp :P
18:54:35leorizeif you use neovim then my nim.nvim plugin is better than trying to setup nimlsp :P
18:54:45leorizethe issue with nimlsp is that it needs nimsuggest as a package
18:54:55leorizeand well, no one actually set it up correctly
18:55:23leorizeso it just assumes that your nim resides inside the compiler source code
18:55:43leorizeworks about 90% of the time since a lot of people compile Nim themselves
18:55:56leorizethe last 10% is anyone that installs nim
18:56:25companion_cubeit's in /usr/lib/nim/compiler/suggest.nim apparently
18:56:36companion_cubebut yeah, assumptions about packages… oh well
18:56:52leorizenah, not even that one :)
18:56:53companion_cubeand I do use nim.nvim :)
18:56:57FromDiscord<Varriount> Araq: Is there any spec on what happens if you give different parameters to a closure iterator between calls?
18:57:09leorizecompanion_cube: then completion should work for you if you set it up
18:57:23leorizeyou don't really need nimlsp if you use nim.nvim
18:57:48leorizenimlsp is nimsuggest but translated to LSP lingo :P
18:58:01companion_cubewhich is sane, but well
18:58:20companion_cubehow 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:40leorizeyou forgot that everything is typed :)
18:58:47companion_cubewell still!
18:59:17leorizeeverything is typed :)
18:59:39companion_cubeahh I use ALE, that's why I may not have completion
18:59:52leorizefor example, how many times do you actually call a proc like this: foo(a)?
19:00:10companion_cubeall the `new` and `init` stuff I guess?
19:00:12leorizeand how likely is it to even have procs colliding with foo() :)
19:00:12companion_cubeI'm very new
19:00:29leorizewell you can see a clear pattern in new and init API
19:00:34leorizetheir names are unique :)
19:00:38companion_cubesure, sure
19:00:52leorizeand there are only a few of them :P
19:01:07leorizeit's not like you'll be showered by 1k symbols to choose from :)
19:01:15companion_cubewho knows… :)
19:01:16leorizeyou type init and you filtered 80% of them away
19:01:21companion_cube`new<tab>` and bim!
19:01:36leorizearound 20 symbols
19:01:48leorizebe a little more specific and you cut that amount by half
19:02:01FromGitter<alehander92> i'd write Type.new
19:02:13FromGitter<alehander92> but i am used to it from ruby
19:02:17FromGitter<alehander92> maybe
19:03:36companion_cubeyeah, there's no namespacing in nim, it feels a bit like C
19:04:01FromGitter<alehander92> you can use optional namespacing
19:04:05FromGitter<alehander92> e.g. mymodule.myfunc(b)
19:04:18FromGitter<alehander92> and you can almost enforce it by from mymodule import nil
19:04:53leorizewe do have namespacing, just optional
19:05:08leorizeto experience Nim I recommend not using from-import-nil
19:05:16FromGitter<alehander92> namespacing , whitespacing, we're big on space
19:05:22FromDiscord<Skaruts> alehander92: that makes it required to do `module.foo`?
19:05:33FromDiscord<Skaruts> the import nil thing
19:05:37leorizeyes, but if you're new, don't use it
19:05:39FromGitter<alehander92> in principle yes, but i am not sure if there aren't exceptions
19:06:01FromDiscord<Skaruts> I gotta play around with it 🙂
19:06:25leorizetoo many people come to Nim from Python and they expect Nim to be like Python :p
19:06:58companion_cubeheh, gotcha
19:07:13leorizethey were taught that global namespaces are evil in python then they just assume the same to nim
19:07:57leorizethis is why I tend to avoid introducing from-import-nil to people until they're familiar with how to write nim :P
19:08:35leorize~imports
19:08:44leorizeoh disbot is offline :(
19:09:57PrestigeGoing 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:08leorizenim in action is still a recommended book (i mean it's the only one :P)
19:11:20leorizehttps://nim-lang.org/learn.html
19:11:38leorizewe also have third-party links in here too, so be sure to explore them all :)
19:11:47PrestigeThanks leorize :)
19:19:55*tefter joined #nim
19:21:21*Tyresc joined #nim
19:30:30*solitudesf quit (Ping timeout: 256 seconds)
19:32:11FromGitter<awr1> i don't really get the global namespace stigma that much
19:32:46FromGitter<awr1> i know in idiomatic C++ land people get very particular with namespaces sometimes
19:33:10FromGitter<awr1> a lot of people cringe at the basic hello world examples for using `using namespace std;`
19:33:32FromDiscord<__ibrahim__> hi, how can i debug this?
19:33:32FromDiscord<__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698254357048590406/unknown.png
19:34:17*ryukoposting quit (Ping timeout: 260 seconds)
19:34:31FromGitter<alehander92> hmmm
19:35:22FromGitter<alehander92> try to run the <path to ... >\test.exe
19:35:31FromGitter<alehander92> but i am not sure what `--app:gui` does
19:36:20FromDiscord<__ibrahim__> without --appgui, a bit better
19:36:20FromDiscord<__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698255062065086474/unknown.png
19:36:30FromDiscord<__ibrahim__> without `--app:gui`, a bit better
19:36:30FromDiscord<__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698255062065086474/unknown.png
19:36:42FromDiscord<__ibrahim__> sorry im day 2 nim
19:37:35FromDiscord<__ibrahim__> same with `<path_to>`
19:37:35FromDiscord<__ibrahim__> https://cdn.discordapp.com/attachments/371759389889003532/698255377292197898/unknown.png
19:40:24FromGitter<alehander92> welcome !
19:40:33FromGitter<alehander92> no problem, it seems that
19:40:43FromGitter<alehander92> maybe you need to debug it somehow
19:40:55FromGitter<alehander92> you can run it under gdb or windbg i guess
19:41:05FromDiscord<__ibrahim__> my code could be bad, but in mac it runs fine. on win, many problems
19:41:12FromGitter<alehander92> but you need to `nim c --debugInfo --lineDir:on -r stuff`
19:41:27FromGitter<alehander92> yeah what is supposed to happen
19:41:28FromGitter<alehander92> if it works
19:41:35*nekits quit (Read error: Connection reset by peer)
19:41:52*solitudesf joined #nim
19:42:02FromDiscord<__ibrahim__> nice that gave me something to go on from
19:42:05*nekits joined #nim
19:42:15FromDiscord<__ibrahim__> ```
19:42:15FromDiscord<__ibrahim__> Hint: C:\Dev\nimrodev\staticglfw\test\test.exe [Exec]
19:42:15FromDiscord<__ibrahim__> HELLO GL
19:42:16FromDiscord<__ibrahim__> Traceback (most recent call last)
19:42:16FromDiscord<__ibrahim__> C:\Dev\nimrodev\staticglfw\test\test.nim(20) test
19:42:16FromDiscord<__ibrahim__> SIGSEGV: Illegal storage access. (Attempt to read from nil?)
19:42:18FromDiscord<__ibrahim__> Error: execution of an external program failed: 'C:\Dev\nimrodev\staticglfw\test\test.exe '
19:42:20FromDiscord<__ibrahim__> PS C:\Dev\nimrodev\staticglfw\test>
19:42:21FromDiscord<__ibrahim__> ```
19:42:32Yardanicopls don't do big pastes, people here in IRC suffer a bit :)
19:42:36Yardanicouse services like bpaste.net
19:43:04FromDiscord<__ibrahim__> im sorry, i didnt know. even images?
19:43:11Yardanicowell, images will be as links
19:43:18FromDiscord<__ibrahim__> sir yes sir
19:47:00FromGitter<alehander92> images are kinda ok
19:47:08FromGitter<alehander92> but if you send code, send it as pastes
19:47:14FromDiscord<__ibrahim__> roger that
19:47:17FromGitter<alehander92> as people cant edit/copy it otherwise
19:49:21FromGitter<alehander92> yeah you need to generally add
19:49:29FromGitter<alehander92> --stacktrace:on --linetrace:on maybe
19:49:36FromGitter<alehander92> to see if this gives a better traceback
19:49:45FromGitter<alehander92> but maybe its one line actually
19:50:43*nsf quit (Quit: WeeChat 2.8)
19:50:44FromDiscord<__ibrahim__> cool, im trying some glad + glfw. ill try those commands right now. trying to translate from C++ to nim
19:51:34FromGitter<alehander92> you need them + your --debugInfo stuff but maybe
19:51:39FromGitter<alehander92> you can just setup a nim.cfg
19:51:46FromGitter<alehander92> and write the flags there
19:52:57FromDiscord<__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:38companion_cubehum, c2nim segfaults…
20:10:22FromDiscord<__ibrahim__> i must be misusing the function
20:12:27FromDiscord<Chiqqum_Ngbata> How to prevent nimble from installing develop branch?
20:19:47Yardanicoit always installs the develop branch if you have to releases/tags
20:19:58Yardanicoyou should create a tag so it will install the latest tag
20:20:54FromDiscord<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:48FromDiscord<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:56leorizeif you can't do it by hand, macros won't safe you :P
20:30:13leorizemacros however, does let you iterate through items of arbitary types
20:30:14FromDiscord<Skaruts> can a macro not generate proc overloads or something like that?
20:30:32leorizesave*
20:30:38leorizewell yes, but why?
20:31:22leorizeit's possible, but I think it's better if you present the problem out
20:31:36leorizethere might be some idioms to solve it without having to touch macros
20:31:49leorizebecause they are not that easy to deal with
20:33:21FromDiscord<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:00leorizeyou can have an overload without any arguments
20:34:41FromDiscord<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:54leorizeuse generics?
20:35:25leorizeit's kinda hard to imagine without some example of how you'd want to use it :p
20:35:33FromDiscord<Skaruts> hmm.. I guess that might work for a limited amount of arguments
20:36:53FromDiscord<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:37FromDiscord<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:03FromDiscord<Skaruts> but that can be preset, it's on the user side of things that it's unpredictable
20:39:03leorizeI'm not sure of how you architectured your system
20:39:36leorizebut usually this can be done by having all signal emitters inherit from a base ref object
20:39:51leorizethen you can use the `of` operator to verify if something is of the type you want
20:44:50FromDiscord<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:15FromDiscord<Skaruts> there is no signal object
20:47:53FromDiscord<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:55FromDiscord<Skaruts> (the self on connect is just a way to reference the caller, to make the hash more unique -- it gets stringified)
20:49:53leorizethis reminds me of gtk :p
20:50:42FromDiscord<Skaruts> I can't remember the name of this kind of thing, but I heard some other libs use it, yea
20:51:57FromDiscord<Skaruts> but then a file loading popup, for example, might want to call `self.emit("accepted", self.selected_file)`
20:52:49leorizewhy strings though, can't it use enums instead?
20:53:08FromDiscord<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:09FromDiscord<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:09FromDiscord<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:00FromGitter<dawkot> Why doesn't Karax's `redraw()`... redraw?
21:10:37leorizeit should?
21:14:51FromGitter<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:02FromDiscord<__ibrahim__> what could be causing the 'could not load glfw3.dll` on windows?
21:36:11FromDiscord<__ibrahim__> what could be causing the `could not load glfw3.dll` on windows?
21:36:32FromGitter<awr1> is the DLL in the same folder as exe
21:36:37FromDiscord<__ibrahim__> yes
21:36:50*tane quit (Quit: Leaving)
21:37:24Yardanico@__ibrahim__ is it the same bitness as the .exe itself?
21:37:32Yardanicoe.g. if you have a 64-bit exe the DLL should also be 64-bit
21:37:42Yardanicoand also the DLL should also have all its dependencies in the same folder too
21:39:13leorizeif 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:41leorizematching the architecture is much more important
21:40:13FromDiscord<__ibrahim__> im trying to check the bitness
21:42:03FromGitter<awr1> perhaps the Nim DLL loader should check for the appropriate magic and give a more detailed error
21:42:03FromGitter<awr1> https://superuser.com/a/889267
21:42:13FromGitter<awr1> this seems to be a common issue
21:42:58FromDiscord<__ibrahim__> i tried to drap and drop into sublime but all i got was binary 😹
21:43:03*natrys quit (Quit: natrys)
21:45:37FromDiscord<__ibrahim__> oh ok need to drop in notepad.exe
21:46:14leorize@awr1: we can't actually
21:46:37leorizewindows have it's own searching logic
21:46:49FromDiscord<__ibrahim__> okay they are different in bitness
21:47:00Yardanicowhich one is which?
21:47:05Yardanicoglfw is 32-bit and your app is 64-bit?
21:47:17FromDiscord<__ibrahim__> other way around
21:47:18FromGitter<awr1> doesn't LoadLibrary() give an HRESULT or something that is more useful
21:47:21Yardanicostrange
21:47:28Yardanicoah choosenim uses 32bit by default
21:47:34*krux02 quit (Remote host closed the connection)
21:47:35Yardanicoon windows
21:47:37Yardanicoor something like that
21:48:45FromDiscord<__ibrahim__> must I tweak something in the nim.cfg?
21:49:00leorize@awr1: welcome to windows, where the returned result is never documented, ever :)
21:49:30FromDiscord<__ibrahim__> ive been trying to make it work on windows all day long. on my macbook air from 2008 it just works
21:49:34FromGitter<awr1> https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya#security-remarks
21:50:01Yardanicoleorize: might check reactos and wine for info :)
21:50:28leorizeplaying the guessing game with microsoft is never fun
21:50:33leorizeit's best to just avoid it
21:50:39FromDiscord<__ibrahim__> linux?
21:50:58leorize?
21:51:19FromDiscord<__ibrahim__> i meant, is linux better :D
21:51:19Yardanico@__ibrahim__ well the easiest way to you is probably to find a 32-bit glfw
21:51:25Yardanicowell yes, linux is better
21:51:26FromGitter<awr1> looks like GetLastError() can give you STATUS_DLL_MIGHT_BE_INCOMPATIBLE
21:51:28FromDiscord<__ibrahim__> yeah totally doing that
21:51:34Yardanicoat least you can have some docs or check the src :P
21:51:40FromDiscord<__ibrahim__> lmao
21:52:07FromDiscord<__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:37leorize> 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:46leorize@awr1: even microsoft gives up :P
21:53:37FromGitter<awr1> idk, if its documented here its probably good enough
21:53:46FromGitter<awr1> in any case the alternative is to use SearchPath fisrt
21:53:54FromGitter<awr1> and then check the magic
21:54:22leorizewe should only use SearchPath when we fail
21:54:36leorizeor maybe try piping the error code into FormatMessage
21:54:44leorizemaybe 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:27FromGitter<awr1> FormatMessage gives nothing interesting, i just tried it with a 32-bit SDL2.dll
22:01:52FromGitter<awr1> or wait maybe i'm being dumb
22:03:50FromGitter<awr1> i'm dumb, i was using "SDL2.h" as the string
22:04:00FromGitter<awr1> when loading a 32-bit DLL from 64-bit EXE
22:04:10FromGitter<awr1> FormatMessage() gives "%1 is not a valid Win32 application."
22:04:25FromGitter<awr1> if it can't find anything it gives "The specified module could not be found."
22:04:35Yardanicowhat if you try to load a 64-bit dll from 32-bit app 🤔
22:05:05*ljoonal quit (Ping timeout: 250 seconds)
22:05:53FromGitter<awr1> same thing
22:06:08Yardanicocool, now make a PR :P
22:08:09FromGitter<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:20FromDiscord<KingDarBoja> I am back guys 😄
22:12:02*couven92 quit (Quit: Client Disconnecting)
22:12:07FromDiscord<KingDarBoja> Hi there awr1
22:14:15*hax-scramper quit (Ping timeout: 260 seconds)
22:14:31*hax-scramper joined #nim
22:16:55FromGitter<awr1> hello
22:17:35FromDiscord<KingDarBoja> What's up? I feel free today 😄
22:24:30FromDiscord<__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:15FromDiscord<KingDarBoja> I got lost at the manual searching for my own custom `$` proc for my custom types lol
22:30:26FromDiscord<KingDarBoja> I mean how to do it * I have read it before
22:31:26leorizejust make a `$`(o: YourType): string
22:31:44Yardanicoalso don't forget to export it with *
22:32:04leorizeexporting is only for outside modules to use it
22:32:09leorizeif it's internal you don't have to export
22:32:45FromDiscord<KingDarBoja> It is for outsiders 😄 Thanks
22:36:24FromDiscord<KingDarBoja> Do you have any suggestion of how should be the format of a custom type? Like the stringified version when calling ``$``
22:36:57Yardanicousually I do like "MyObject(field1: value1, field2: value2)" kinda like repr :P
22:37:01Yardanicobut you're free to do however you like
22:37:56FromDiscord<KingDarBoja> Thinking on something like json
22:38:00FromDiscord<Avatarfighter> Hello everyone 😄
22:38:21FromDiscord<KingDarBoja> But now I remember the tables module is what I am looking for
22:38:32leorize@KingDarBoja: you don't just implement `$` for fun :P
22:40:29FromDiscord<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:43FromDiscord<KingDarBoja> What do you mean leorize? 😛
22:42:28*pbb joined #nim
22:44:47FromDiscord<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:13leorize@KingDarBoja: that means you should implement it with an actual use case in mind :P
22:46:24*pbb quit (Excess Flood)
22:46:39leorizefor example for Duration, it's `$` prints out the duration like: 2 seconds 110 milliseconds
22:47:12FromDiscord<KingDarBoja> I want to use it for debugging my types, instead of relying on repr
22:47:36*pbb joined #nim
22:47:37leorizeAvatarfighter: it's a terrible way to do it :P
22:47:53FromDiscord<KingDarBoja> But just did a search for json module and found the `*%` operator
22:48:01FromDiscord<KingDarBoja> %*
22:48:20FromDiscord<KingDarBoja> Which gives me a nice output string
22:48:23leorizerepr is the best debugger :P
22:49:06FromDiscord<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:01FromGitter<awr1> did the PR https://github.com/nim-lang/Nim/pull/13950
22:51:27FromGitter<awr1> i'll check for CI fails later, i need to finish this soup
22:51:48FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hwg leorize 😄
22:53:44leorize@Avatarfighter: https://play.nim-lang.org/#ix=2hwh
22:54:32*ksandvik joined #nim
22:56:41leorizehttps://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:32leorize@KingDarBoja: I'd recommend repr instead :P
22:59:39leorize`%*` is not that efficient
23:00:03leorizeit builds a JSON tree at runtime, then print it
23:00:34*hax-scramper quit (Read error: Connection reset by peer)
23:00:57FromDiscord<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:41FromDiscord<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:25FromDiscord<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:39leorizeyou can try to introduce endians2 into endians and make a PR :)
23:09:46leorizethe folks at status would thank you :P
23:16:25*ksandvik quit (Quit: WeeChat 2.8)
23:19:23FromDiscord<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:45leorizewell, practice makes perfect :)
23:20:35FromDiscord<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:17FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hwt
23:21:19FromDiscord<KingDarBoja> Wut?
23:21:20*gmpreussner quit (Quit: kthxbye)
23:21:37*gmpreussner joined #nim
23:21:44FromDiscord<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:23leorize@KingDarBoja: s/=/:/ on line 8 lol
23:30:25*hax-scramper quit (Ping timeout: 265 seconds)
23:31:02leorizealso 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:38FromDiscord<KingDarBoja> 🤦
23:38:45FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hwA
23:44:05FromDiscord<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:09FromDiscord<KingDarBoja> https://play.nim-lang.org/#ix=2hwC Why the test that runs after adding the JSON operator is more verbose? lol
23:48:33leorizeit tries to bind `$` if available
23:48:59FromDiscord<KingDarBoja> Intriging
23:49:11FromDiscord<KingDarBoja> Intriguing*