<< 17-08-2018 >>

00:06:32*stefanos82 quit (Quit: Quitting for now...)
00:10:56*vosper joined #nim
00:21:31*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
00:41:11*Holo17 joined #nim
00:43:20*ltr__ joined #nim
00:43:44*Holo17 quit (Remote host closed the connection)
00:50:07*vosper joined #nim
01:07:48*S1t1Schu joined #nim
01:11:21*xet7 quit (Quit: Leaving)
01:11:46*S1tiSchu quit (Ping timeout: 265 seconds)
01:13:57*vivus quit (Ping timeout: 240 seconds)
01:19:08*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:30:50*endragor joined #nim
01:35:52*endragor quit (Ping timeout: 272 seconds)
01:55:16*Auctus15 joined #nim
01:57:12*Auctus15 quit (Remote host closed the connection)
01:59:48*ltr__ quit (Quit: leaving)
02:16:58*sotrhraven joined #nim
02:17:09sotrhraveno/
02:17:40*sotrhraven quit (Client Quit)
02:39:55*Globalirc0 joined #nim
02:40:38*dddddd quit (Remote host closed the connection)
02:43:35*Globalirc0 quit (Remote host closed the connection)
02:49:10*Menche12 joined #nim
02:51:43*Menche12 quit (Remote host closed the connection)
02:52:12*wildlander quit (Quit: Konversation terminated!)
02:54:06*vosper joined #nim
02:56:29*Perkol joined #nim
02:57:13*vosper quit (Client Quit)
02:57:44PerkolHi. Is there a way to suppress dialog boxes when I compile with --app:gui flag?
02:58:00PerkolSimilar to SetErrorMode(SEM_NOGPFAULTERRORBOX)
03:11:04FromGitter<Varriount> Perkol: importc and call SetErrorMode(SEM_NOGPFAULTERRORBOX)?
03:11:19*deech quit (Remote host closed the connection)
03:17:28*endragor joined #nim
03:18:35*shashlick joined #nim
03:26:50*S1t1Schu quit (Ping timeout: 244 seconds)
03:28:31*S1tiSchu joined #nim
03:36:07PerkolVarriount: maybe, but would it work correctly? I mean, Nim have it's own error handling, right?
04:20:10*arecaceae quit (Remote host closed the connection)
04:20:29*arecaceae joined #nim
04:26:33*shashlick quit (Remote host closed the connection)
04:27:00*shashlick joined #nim
04:41:30*hiya6 joined #nim
04:43:01*shashlick quit (Remote host closed the connection)
04:43:30*shashlick joined #nim
04:45:29*Perkol quit (Remote host closed the connection)
04:49:43*hiya6 quit (Ping timeout: 260 seconds)
05:28:38*leorize quit (Ping timeout: 256 seconds)
05:30:11*nsf joined #nim
05:30:36*qmr9 joined #nim
05:31:18*qmr9 quit (Remote host closed the connection)
05:31:50*gangstacat quit (Quit: Ĝis!)
05:36:41*miran_ joined #nim
05:39:24*gangstacat joined #nim
05:54:27*leorize joined #nim
06:02:53FromGitter<imdaveho> @data-man has there been more progress with updating keyboard/mouse events on terminals? ⏎ ⏎ I'd like to implement something like termbox and just starting to explore capturing modifier keys. I'm also looking into what *<shashlick>* created in his/her snip library, but it seems like to support multiple terminals, it's a mess....but just wondering how to get more familiar and see where I could contribute. Also,
06:02:53FromGitter... would you happen to know how to DM someone on the IRC side? eg. DM'ing *<shashlick>*
06:07:12FromGitter<imdaveho> @FromIRC /msg shashlick looking at your snip lib, what is the reason you had to rewrite getch?
06:07:27*cspar quit (Ping timeout: 240 seconds)
06:23:39FromGitter<gogolxdong> I'm wondering how to configure production with Jester ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b7669eb796f7b601d535e98]
06:23:52FromGitter<gogolxdong> It used to work.
06:24:11FromGitter<imdaveho> sorry newb question...what does the .inline. pragma do?
06:46:57*miran_ quit (Ping timeout: 240 seconds)
06:50:25*cspar joined #nim
06:55:33*vosper joined #nim
06:56:03*vosper quit (Client Quit)
07:16:26*xet7 joined #nim
07:23:52*Vladar joined #nim
07:27:19*TBloemink2 joined #nim
07:31:00*TBloemink2 quit (Remote host closed the connection)
07:34:21FromGitter<survivorm> AFAIK it's more a hint for compiler to inline code, rather than call it as a proc, BUT it may easily be ignored by it. It's completely compiler's decision
07:48:57*Perkol joined #nim
07:51:17FromGitter<timotheecour> anyone knows how to detect when we’re at compile time? eg to avoid a code path that would cause importc
07:51:36leorizewhen defined(nimvm)?
07:52:54Araqhttps://nim-lang.org/docs/manual.html#statements-and-expressions-when-nimvm-statement
07:53:26*cspar quit (Ping timeout: 244 seconds)
07:54:15Araqwatch out for its restrictions
07:55:21TangerHey folks, is it possible to pass a tuple as an argument to a proc that accepts multiple parameters and unpack it?
07:55:55Araqyeah, but you will probably need to use a macro
07:56:13TangerCool, thanks Araq
08:00:02*PMunch joined #nim
08:02:54PerkolIs there verbose tutorial on Nim'c FFI? The one in standart documentation is too basic, I want something with more examples, and also listing different c types
08:03:59*gmpreussner_ joined #nim
08:04:35*gmpreussner quit (Ping timeout: 240 seconds)
08:05:22AraqPerkol, the docs are out there, somewhere, I'm sure but also give c2nim a try
08:08:14*vosper joined #nim
08:13:56FromGitter<timotheecour> > `when defined(nimvm)` didn’t work, but `when nimvm` is the thing, thanks!
08:17:33FromGitter<imdaveho> how do I declare a union type? eg. var foo: char | int ?
08:18:08Araquse a 'case object', it's verbose, but it works
08:18:30Araqin your case though, 'int' seems to be able to cover 'char' too, no need for a union
08:21:03*insidious15 joined #nim
08:21:10*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:21:26FromGitter<imdaveho> @Araq you mean as is stated here: https://nim-lang.org/docs/manual.html#types-object-variants
08:21:52Araqyeah
08:22:16FromGitter<imdaveho> damn that is verbose
08:23:00FromGitter<imdaveho> is this not something to support: `var foo: [T: char or int]`
08:24:16Araqit's not on our roadmap
08:24:37*insidious15 quit (Remote host closed the connection)
08:25:03Araqit also doesn't come up that often once you accepted static typing as your lord and saviour
08:26:47FromGitter<imdaveho> yeah I guess with generics and multimethods...it doesn't really become that necessary -- anyway I was simply using for some hacky code to detect modifier keys along with that @shashlick was doing with his/her snip lib
08:27:15*Sagan7 joined #nim
08:27:31PerkolI aa trying to use this function, https://msdn.microsoft.com/en-us/library/windows/desktop/ms680621, yet It doesnt compile
08:28:15*Sagan7 quit (Remote host closed the connection)
08:37:07PMunch!eval echo 100
08:37:10NimBot100
08:37:17PMunch!ping
08:37:17NimBotpong
08:37:26PMunch@NimBot, you there?
08:40:23*information1 joined #nim
08:41:13*information1 quit (Killed (Unit193 (Spam is not permitted on freenode.)))
08:42:50*dimi34ka28 joined #nim
08:45:00leorizeI think NimBot isn't logged in
08:45:06leorizeas a result it's muted
08:45:07Araqlol
08:45:59leorizeAraq: I think dom96 left a guide with IRC commands to whitelist somewhere...
08:51:25*dimi34ka28 quit (Ping timeout: 265 seconds)
08:52:30PMunch!eval echo 100
08:52:33NimBot100
08:52:34PMunch!ping
08:52:34NimBotpong
08:52:54PMunchAh yes, he is just quieted :P
08:53:11Araq!eval echo 9
08:53:13NimBot9
08:53:24PMunchYou need to be op to see his messages
08:53:40*Perkol quit (Quit: Leaving)
08:53:43Araqok
08:55:39PMunch#nim has channel mode +z, so moderators can see quited users
08:55:49PMunchquiet-ed
08:59:54Araqok, I don't care but it's good to know you're an operator
09:01:34PMunchYeah dom96 made me an operator a while back when we had a ton of spammers
09:02:31*arlen joined #nim
09:02:45PMunchBut I think I'm just on when the trolls are asleep :P Barely had to kick anyone
09:02:48*arlen quit (Killed (Unit193 (Spam is not permitted on freenode.)))
09:09:53*leorize quit (Ping timeout: 260 seconds)
09:10:13*Tanger quit (Remote host closed the connection)
09:11:46PMunchHmm, trying to do something with Jester. Has the error messages always been this bad?
09:13:54Araqplease give an example
09:14:25PMunchhttp://ix.io/1kq1/
09:15:01Araqwhat's bad about it?
09:15:31PMunchIt doesn't tell me anything about what in my route is wrong
09:15:51PMunchLine 4 is the only reference to my code, and that's the "routes:" line
09:16:12Araqwell it's a server, it got a bad request
09:16:22Araqit doesn't have to be in your code
09:16:25PMunchNo the request is fine
09:16:45PMunchI posted a request to the server and had it spit out what it got and return an okay
09:16:58PMunchI changed something in my code, then sent the exact same request, and now I get that error
09:17:07PMunchSo it's something in my route that has changed
09:17:33Araqthat's not true :-)
09:17:42Araqcould have been lucky before
09:17:56PMunchWhat do you mean lucky?
09:18:09Araqtry it again and see if it's reproducible
09:18:39Araqand then chance that it was caused by you change raises
09:24:08PMunchI already tried it three times
09:24:46*^Phantom^29 joined #nim
09:25:08Araqok, sorry. then show us the diff please
09:25:15Araqand summon dom96
09:26:29PMunchDamn it, tried to update my devel and now I get this error: /home/peter/.nimble/pkgs/httpbeast-0.2.0/httpbeast.nim(58, 44) Error: type mismatch: got <nil> but expected 'string'
09:26:44*^Phantom^29 quit (Killed (Sigyn (Spam is off topic on freenode.)))
09:26:55Araqcompile with --nilseqs:on
09:27:04Araqwe're still figuring out a good migration path :P
09:27:11PMunchAh right
09:27:20PMunchSo seqs can't be nil any longer?
09:27:26PMunchMakes sense
09:27:27Araqnope
09:27:48Araqhttps://github.com/nim-lang/Nim/issues/8668 ideas welcome
09:29:36AraqI think we need to update as many projects as possible as soon as possible
09:30:22Araqthe good news is that the changes are usually backwards compatible, 's.len == 0' works when s is nil even for 0.17 or something like that
09:31:10PMunchAh, that's good
09:31:41PMunchI guess the only things that actually need to be updated then is those that differentiate between being set and not
09:31:50PMunchMostly for default parameters I would guess
09:32:06PMunchproc something(x: seq[int] = nil)
09:32:38PMunchMaybe not so relevant for sequences, but for strings that could cause trouble
09:33:28PMunchproc format(fmtString: string = nil): string = if fmtString == nil: return "Default format"; else: return "Using fmtString"
09:33:34FromGitter<data-man> @imdaveho: Sorry, no progress. There is more important things. :)
09:34:13PMunchHow is this for performance by the way Araq. I'm assuming allocating an empty sequence or string as the default parameter is more costly than just defaulting it to nil
09:36:45dom96hi
09:37:23AraqPMunch, codegen improvements are still not complete but the idea is to map @[] to nil, @[] won't allocate
09:38:16Araqand then there is this whole --gc:destructors thing that changes the performance in all sort of good and bad ways
09:38:22PMunchOh, that's nifty
09:39:08PMunchSo "var x: seq[int] = @[]; x.add(100)" wouldn't actually create a sequence before x.add
09:39:18PMunchHi dom96 :)
09:39:23dom96Araq: Ignoring my suggestion? https://github.com/nim-lang/Nim/pull/8414
09:39:35PMunchNoticed that NimBot is silenced
09:39:46dom96!ping
09:39:46NimBotpong
09:39:53dom96Fixed?
09:39:58PMunchHmm, yup
09:40:00dom96good
09:40:05PMunchDid you log him in=
09:40:12Araqdom96, can happen, sorry, I'm doing too many things
09:40:13PMunchs/=/?
09:40:14dom96no
09:40:21dom96* dom96 sets exempt on NimBot!*@*
09:40:32dom96Can't you see this?
09:40:33Araqhowever, I don't mind the explicit .importcpp
09:40:58Araq!eval echo "I'm the Lord Marshal"
09:41:00NimBotI'm the Lord Marshal
09:41:05dom96Araq: It's much cleaner to use {.push.} appropriately, especially when that was used initially.
09:41:07PMunchUhm, nope
09:41:19dom96PMunch: What's your IRC client?
09:41:24PMunchHexChat
09:41:48PMunchMight just be that those are turned off by default
09:42:16PMunchOr that you must be op to see them
09:42:27Araqdom96, ok, but let's give Gulpf a break, it was tested this way and we can go back to this problem later
09:43:26Araqthat PR list never goes down :-/
09:44:05*BitPuffin joined #nim
09:45:20FromGitter<gogolxdong> does defer work now?
09:51:45FromGitter<mratsim> @gogolxdong yes, and if you mean does it work in async, yes since a month ago
09:52:15FromGitter<timotheecour> => https://github.com/nim-lang/Nim/issues/3877#issuecomment-408658085 hard to interpret, the bug is still shown as open
09:52:21Araqargh... I wanted to remove it though. Oh well
09:52:43FromGitter<mratsim> @Araq, can you use patch isNil to check if len == 0 instead and print a deprecation warning?
09:52:55*noonien joined #nim
09:52:57FromGitter<timotheecour> some ppl here actually love `defer`, to avoid deeply nested and more verbose try/except
09:53:29Araqpeople need to use `=destroy` but ok, we can deprecate that once destructors are battle tested
09:53:52Araqmratsim: I can do that but it would hide bugs
09:54:56FromGitter<mratsim> Print a warning in bold, 3 lines before, 3 lines after so that there is a big blank space :P
09:55:05FromGitter<mratsim> 3 empty lines*
09:55:51Araqfyi all db_ modules are broken because they mapped 'nil' strings to NULL and nil strings are gone
09:56:03Araqso there is no way to insert NULL into a database anymore :-)
09:56:27Araqregexes and pegs have problems too, 'nil' meant "No match" and that's different from an empty match
09:56:48FromGitter<mratsim> *cough* Options *cough*
09:56:52Araqit's the biggest breaking change since quite some time
09:57:21FromGitter<timotheecour> would Options cause any kind of overhead ?
09:57:30FromGitter<mratsim> didn’t you have this SQL DSL idea that would be hardened against injections with fancy checks.
09:57:48Araqthat's in Ormin
09:58:06FromGitter<mratsim> @timotheecour I think so but there was some optimisations taken from the now dead “opt"
09:58:13FromGitter<mratsim> for ref types.
09:58:16Araqbut I'm patching the db_ modules to accept Json too
10:00:43Araqmratsim: I prefer to store this "optional" information in a side-channel
10:01:13Araqmy regex matches cannot be empty most of the time and I don't use NULL in databases
10:01:51*matze29 joined #nim
10:02:13FromGitter<xmonader> Hi guys, would you be interested in a series of articles on data structures/algorithms using Nim language?
10:02:24*GigabytePro13 joined #nim
10:02:38FromGitter<xmonader> I'll be off for national holiday next week and I'd like to have more adventures in with Nim
10:02:42FromGitter<mratsim> I think so, good excuse to get those impressionable CS student using Nim for their classes :P
10:03:31*Silversword19 joined #nim
10:03:40Araqxmonader: sure and we enjoy hosting guest articles on the webite too
10:04:10FromGitter<mratsim> I find this kind of repo quite interesting for example: https://github.com/raywenderlich/swift-algorithm-club
10:04:39FromGitter<xmonader> actually I believe Nim is a really good fit for doing this branch perfectly more than those who teach it in java or C++ (more concise and expressive than both)! @mratsim
10:04:39FromGitter<mratsim> or this: https://github.com/BaReinhard/Hacktoberfest-Data-Structure-and-Algorithms
10:05:16FromGitter<xmonader> @Araq thanks ^_^
10:05:55FromGitter<xmonader> @mratsim this is super nice!
10:06:41*GigabytePro13 quit (Remote host closed the connection)
10:06:43FromGitter<xmonader> btw, how can nimbus be utilized for other blockchains than ethereum ?
10:09:59FromGitter<timotheecour> @araq ⏎ ⏎ > regexes and pegs have problems too, 'nil' meant "No match" and that's different from an empty match ⏎ ⏎ FWIW this is how nim-regex does, see https://nitely.github.io/nim-regex/: ... [https://gitter.im/nim-lang/Nim?at=5b769ef7796f7b601d5491d4]
10:10:06*Silversword19 quit (Remote host closed the connection)
10:10:35*matze29 quit (Ping timeout: 240 seconds)
10:13:10AraqTimothee, the idea is to split seq[Option[string]] into (seq[string], seq[bool]) so that it's easier to ignore the 2nd tuple component
10:13:22FromGitter<mratsim> @xmonader, it can’t, maybe Ethereum Classic in time but otherwise you can’t. ⏎ ⏎ However in th very near future we will decouple Nimbus "Virtual Machine" from Nimbus “Networking”, so you can use Nimbus VM as an execution engine and with Go/Rust to handle the networking. ⏎ ⏎ If some blockchains also use the same virtual machine as Ethereum, they could use Nimbus VM in that case. But I wouldn’t hold my
10:13:22FromGitter... breath. ... [https://gitter.im/nim-lang/Nim?at=5b769fc1a158fd0ea36e3e93]
10:17:30dom96Araq: seq[Option[string]]? What?
10:18:01FromGitter<timotheecour> @araq since we have to introduce a breaking change anyway in `re.nim`because if nilseq, how about revisiting that API a notch: IMO the right thing to do is to be lazy, ie return an iterator instead of a seq[string] or seq[Option[string]] or (seq[string],seq[bool])
10:18:42dom96Can you match some pattern groups and not others in regex?
10:19:18FromGitter<timotheecour> if user wants a seq, he could via `mapIt` or toSeq and handle the check for “” vs empty himself. Note, I have a PR in pipeline that will make toSeq universal and work with UFCS
10:19:23dom96I suppose you can have optional groups
10:19:47FromGitter<xmonader> @mratsim thanks for the elaborate respones ^_^
10:22:26FromGitter<gogolxdong> Does it mean the same with Golang defer?
10:23:06FromGitter<timotheecour> dom96 at least in nim-regex yes; idk about `re.nim` ; but this discussion (i think!!??) was about handling nil vs “” for regex match, not about optional groups
10:23:55dom96Optional[string] is /the/ replacement for `nil` in strings
10:24:18dom96`(seq[string], seq[bool])` is just... I don't even
10:24:40dom96Anyway, we want to adopt nim-regex into the stdlib, maybe it's time to do that?
10:25:23FromGitter<timotheecour> ya, it’d also avoid the re vs nre confusion https://xkcd.com/927/
10:26:25FromGitter<mratsim> @timotheecour can we even return inline iterators? Or are you talking about returning closure iterators?
10:27:00FromGitter<timotheecour> returning closure iterators; the overhead should be minimal in proportion to what regex does
10:27:48FromGitter<gogolxdong> How to wait on spawn procs ? sync() or ^?
10:28:11FromGitter<mratsim> ^
10:28:44FromGitter<xmonader> out of curiosity, were any of you asked to implement kmp in interview?
10:29:07FromGitter<alehander42> @Araq what's the point of ignoring the second component, that would be buggy
10:29:30FromGitter<alehander42> the whole point is that you need to know if the i-th element is there anyway, and Option forces you to check it
10:29:46FromGitter<gogolxdong> what does sync() do ?
10:29:48FromGitter<mratsim> kmp? I never did programming interviews to be honest. I’m not even sure what the point is.
10:29:49FromGitter<timotheecour> I’d vote for `iterator Option[RegexMatch]` output
10:30:25FromGitter<gogolxdong> I'm using like this: ⏎ spawn awsDescribeRegions() ⏎ spawn alibabaDescribeRegion() ⏎ spawn tencentDescribeRegion() ⏎ spawn ibmGetAvailableLocations() ... [https://gitter.im/nim-lang/Nim?at=5b76a3c10825690ea2e18974]
10:30:47FromGitter<alehander42> the side channel idea is nice, but I think Option is better in the regex case
10:30:59FromGitter<mratsim> you wait but you don’t return anything @gogolxdong
10:31:45FromGitter<mratsim> this is useful if you are doing shared memory computations for example and you need the memory in a certain state before continuing.
10:31:52FromGitter<gogolxdong> does work the same with ^ but for no return type?
10:31:57FromGitter<timotheecour> knuth morris prat; but that’d be a dumb interview question IMO
10:33:10FromGitter<xmonader> because I was asked that question and I actually felt it was very challenging to ask such theoretical in initial coding interview?
10:33:32FromGitter<gogolxdong> It seems stuck after the last proc.
10:33:49dom96xmonader: what company asked this?
10:34:15FromGitter<mratsim> for dumb interview questions I want to use dumb answers. See using deep learning to “solve" FizzBuzz: http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/ ⏎ ⏎ (I ported that to Nim/Arraymancer: https://github.com/mratsim/Arraymancer/blob/master/examples/ex04_fizzbuzz_interview_cheatsheet.nim)
10:35:31FromGitter<timotheecour> @mratsim that’s really cool… will definitely read when i have time. and lol!
10:35:43*Bock joined #nim
10:36:14*Bock quit (Killed (Unit193 (Spam is not permitted on freenode.)))
10:36:40FromGitter<timotheecour> although what you want here is neural turing machines ...
10:36:49FromGitter<xmonader> @dom96 not sure if that would be leaking interviews questions of companies policies?
10:39:08Araqalehander42: It's not buggy at all, it's good design as the type ideally depends on the subpattern. ([a-z]+) cannot be empty
10:39:50FromGitter<Clyybber> What is the default capacity of a seq?
10:43:00FromGitter<mratsim> 50?
10:43:22dom96Araq: an Option[T] forces a check
10:43:29dom96your weird tuple doesn't
10:45:34Araqthat's the point
10:45:37FromGitter<alehander42> @Araq well, it's about false negatives vs false positives
10:45:48FromGitter<alehander42> better to unwrap it sometimes even if you know it's always non empty
10:45:51FromGitter<mratsim> @Clyybber you can probably check what is behind https://github.com/nim-lang/Nim/blob/2da0341b4d6828479c5dc75a233b47732f53cf6c/compiler/ccgexprs.nim#L1313 It is the magic for @ and `@[]`
10:45:53FromGitter<alehander42> than to change the regex and forget
10:45:58AraqI don't need the check, I know the patterns better than the type system does
10:46:13FromGitter<alehander42> and you also make one usecase very hairy
10:46:24FromGitter<alehander42> because you want to optimize another probably less usual usecase
10:47:01FromGitter<mratsim> and relevant @Clyybber https://github.com/nim-lang/Nim/issues/8642
10:48:08FromGitter<Clyybber> @mratsim Thank you, I'm having a proc that returns a sequence, and I'm wondering what the capacity of result is, with the new no-nil changes.
10:48:12FromGitter<timotheecour> > I know the patterns better than the type system does ⏎ ⏎ what if it’s a runtime pattern?
10:48:51FromGitter<alehander42> ok, I admit it's not very hairy, but the "force a check is good in general" argument stays
10:49:04FromGitter<alehander42> also, another thing is that it's cool to have consistent optional api-s
10:49:20FromGitter<alehander42> if I know that everything that is optional in stdlib is Option[T], it's easy to work with it
10:49:29FromGitter<timotheecour> ya, that’s what Option is for.
10:49:30FromGitter<mratsim> @Clyybber, I say 50 but it’s a joke, I’m pretty sure it’s a multiple of 2 and it doubles when the seq needs to grow.
10:49:31FromGitter<alehander42> if i have to remember that A is some tuple combination
10:49:33FromGitter<alehander42> B is Option
10:49:40FromGitter<alehander42> C is return code + something else
10:49:46Araqruntime patterns already force me to handle the ValueError/RegexError exception
10:49:48FromGitter<Clyybber> @mratsim I thought so :P
10:49:50FromGitter<alehander42> that's making life harder
10:50:42FromGitter<alehander42> and if you want to ignore the optionallity
10:51:01FromGitter<alehander42> you still can have a very simple generic "unwrap" or something
10:51:17FromGitter<alehander42> which works with `Option[T]` `seq[Option[T]]` etc
10:51:31FromGitter<Clyybber> @mratsim What is the difference between an unitialised proc of length n and an seqence with length 0 and capacity n? Are both allocated the same amount of memory on creation?
10:51:37Araqit really doesn't but I don't want to have this conversation again.
10:51:59FromGitter<alehander42> consistency is underrated
10:52:30Araqconsistency is super overrated and leads to bugs
10:52:40FromGitter<alehander42> meh
10:52:43FromGitter<timotheecour> meh also
10:53:06FromGitter<mratsim> in the first case (newSeqUnitialized) the memory contains random data, in the second case (newSeqOfCap) the memory is zero-ed. In both case you can’t access the memory though.
10:53:18FromGitter<timotheecour> consistency (where it makes sense) concentrates the bug in 1 place, easier to find / fix (same as refactoring)
10:53:25FromGitter<alehander42> I mean, it's not a fair thing to say
10:53:27FromGitter<mratsim> consistency leads to easier learning
10:54:14FromGitter<mratsim> ah @Clyybber sorry, newSeqOfCap doesn’t zero the memory anymore.
10:54:38FromGitter<Clyybber> @mratsim I thought so because the implementation of newSeqUninitialized uses newSeqOfCap
10:54:44dom96I would even prefer seq[string] rather than this weird tuple
10:54:46FromGitter<alehander42> ignoring usecase ⏎ ⏎ ```matches = f(regex).unwrap ⏎ ⏎ vs ⏎ ⏎ (matches, _) = f(regex)``` [https://gitter.im/nim-lang/Nim?at=5b76a976e2e48a20b46fb19d]
10:55:00FromGitter<alehander42> exactly the same, I'd even say the first one is kind simpler
10:55:06*pwntus quit (Ping timeout: 272 seconds)
10:55:07FromGitter<alehander42> because you don't have the `_` () stuff
10:55:20FromGitter<mratsim> @Clyybber check this to get the capacity btw: https://github.com/nim-lang/Nim/issues/6403
10:55:36dom96I would prefer "" be used to mean "Nothing for this group" than having a string + bool
10:56:33FromGitter<timotheecour> also, `matches = f(regex).unwrap` can be used in UFCS chains, but not `(matches, _) = f(regex)` (without some auxiliary project function)
10:56:51FromGitter<mratsim> so newSeqUnitialized: you can access with array indexing but it contains random values. newSeqOfCqp, memory is reserved but cannot be accessed.
10:57:21FromGitter<Clyybber> @mratsim So I need to call add, thats what I figured thx
10:57:25FromGitter<mratsim> with newSeqOfCap you use “add”
10:57:29FromGitter<Clyybber> yep
10:57:30Araqthat's now an 'unwrap' that unwraps a seq[Option[T]]. You need these liftings everywhere
10:57:40FromGitter<alehander42> normal usecase ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76aa24157b9d34ef9c96ed]
10:57:43FromGitter<mratsim> cough *Monad* cough
10:57:49FromGitter<alehander42> ok @Araq tell me how the second loop is better
10:57:55Araqand once you have them, there is no problem. except for the terrible performance
10:58:01FromGitter<alehander42> i in 0 ..< groups.len *
10:58:02FromGitter<mratsim> normally you use map/flatmap to work with options
10:58:14Araqand the cognitive overhead.
10:58:18FromGitter<alehander42> because it's not a seq of tuples, but it's a tuple of seq-s
10:58:27FromGitter<alehander42> and it's very painful to loop through
10:58:59FromGitter<alehander42> there is much more cognitive overhead in writing all those indices correctly, come on
11:00:05Araqname me a single successful library that uses Matrix[Option[float]] instead of Matrix[float]
11:00:26dom96Name me a single library that uses (Matrix[float], Matrix[bool])
11:00:29FromGitter<alehander42> or the other option is ⏎ ⏎ ```for (match, exist) in zip(matches, e): ⏎ ...``` ⏎ ⏎ and here we need a faster zip, again, overhead [https://gitter.im/nim-lang/Nim?at=5b76aacd0825690ea2e1b25f]
11:01:02Araqby your logic 0 * 4 shouldn't be 0, because 0 shouldn't compile with *
11:01:44Araqor maybe it should but with an 'unwrap' for the 0, who knows
11:02:06FromGitter<timotheecour> I’ve suggested using a lazy variant, returning an iterator instead of seq[Option[string]]; that would avoid all these issues (and be more efficient for most applications because we don’t need to store `seq` temporaries that may not be needed)
11:02:51AraqI don't see how an iterator could work, if I extract key, value pairs out of a string, do you want me to iterate over 0..1 ?
11:03:17dom96Just think about the code this will create: if matches[1][i]: echo(matches[0][i]) vs. if matches[i].isSome(): echo(matches.get())
11:03:28dom96With pattern matching the latter will be even better
11:03:43dom96How will anyone understand wtf `1` vs. `0` means?
11:03:51Araqyeah, I just use 'echo(matches[i])', that's the point
11:04:12FromGitter<alehander42> but the point is that you want the second usecase to also work well
11:04:21FromGitter<alehander42> otherwise why even providing seq[bool]
11:04:21dom96And you can still use that, even with an Option[T] ;)
11:04:23AraqI don't have a seq of tuples, I have a tuple of seqs and ignore the 2nd component altogether because it adds no value
11:05:04FromGitter<alehander42> so basically, you don't want the overhead of unwrapping the options when ignoring
11:05:08FromGitter<alehander42> that's the only possible issue
11:05:29FromGitter<alehander42> and the only pro of the tuple approach
11:06:24FromGitter<alehander42> then honestly, it's still a better API to just have a function that returns seq[string] and another one that returns seq[Option[string]]
11:06:50Araqyeah but now try to implement one API in terms of the other
11:06:50dom96yeah
11:07:01Araqand you'll see why my idea is good
11:07:13Araqbut whatever, I don't care enough to fight for this.
11:07:30AraqI'll end with a remark that I don't use regexes when I care about correctness. :P
11:07:47FromGitter<Clyybber> Is it more efficient to use add() n number of times on a seq or to use setLen(n) and then just set them?
11:08:15dom96Clyybber: the latter
11:08:54FromGitter<Clyybber> Ok thank you.
11:09:37*dave49254 joined #nim
11:10:03*dave49254 quit (Killed (Sigyn (Spam is off topic on freenode.)))
11:18:38Araqhttps://github.com/nim-lang/Nim/pull/8670 that's what consistency brings us, bloat everywhere and for consistency in system.nim
11:19:18Araqand I'm not blaming the contributor.
11:19:42Araqthis whole consistency thing needs to be rethought.
11:20:07PMunchConsistency makes the language a whole lot easier to work with though..
11:21:47dom96Araq: What's wrong with that?
11:22:39PMunchIf you want system.nim to be easier to read I guess adding a system_tostr.nim and `include` that into system would be a good option
11:23:00PMunchThen you would have all the $ procedures in one place
11:23:41PMunchCould even make it disable-able by throwing a switch around the include --disableStringification
11:24:14dom96no, a lot of stuff in system shouldn't be there
11:24:16dom96FFI
11:24:20dom96GC_* functions
11:24:25dom96memory management functions
11:24:35dom96These things are rarely used and so should be in their own module
11:30:01*roger_rabbit8 joined #nim
11:30:27*roger_rabbit8 quit (Killed (Sigyn (Spam is off topic on freenode.)))
11:31:11FromGitter<alehander42> sorry Araq
11:32:56*Logan529 joined #nim
11:34:47*leorize joined #nim
11:34:47*^Phantom^11 joined #nim
11:36:40*^Phantom^11 quit (Killed (Sigyn (Spam is off topic on freenode.)))
11:37:21FromGitter<alehander42> otherwise something iterator-based like timothee suggested can be used by both api-s ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76b371dd0b74601e1dca7e]
11:37:25*Logan529 quit (Killed (Unit193 (Spam is not permitted on freenode.)))
11:39:00PMunchdom96, is this expected to work: curl -X POST -d '{"code":"echo 100", "compileTarget":"c"}' -H "Content-Type: application/json" https://play.nim-lang.org/compile
11:39:23dom96no idea
11:39:32dom96Don't see anything wrong with it
11:39:42PMunchI get a bad gateway 502 error
11:40:03PMunchI'm just trying to create a simple local-only mock of the playground so I can try out my Nim tour thing
11:40:19PMunchBut I don't know what it responds with
11:40:44dom96!eval echo "dead?"
11:40:47NimBotdead?
11:40:52dom96Seems to be working
11:41:02PMunchThat's how I noticed he was quiet earlier :P
11:43:13*ldlework quit (Read error: Connection reset by peer)
11:43:36*ldlework joined #nim
11:44:21*dddddd joined #nim
11:46:24FromGitter<mratsim> @Araq, Option\[float\] are usually mapped to nan but Pandas which is one of the top Python lib is in a dire need of options for integers. (It cheats with float nan for integers).
11:53:44AraqNan is just one possibility, there is also zero, negative zero, infinities
11:54:43FromGitter<alehander42> is there a value of Nim int's that can be safely used as NaN ?
11:54:55Araqit's true that 'float' is in fact a hacky sum type but it's unclear if explicit pattern matching over the sym type would be feasible, it certainly isn't done
11:56:02Araqand there is some beauty in the fact that all functions over float are "lifted" to work with the sum type (unless they throw exceptions, maybe...)
11:58:00Araqlow(int) should be int's NaN, but isn't.
11:58:19Araqit's a bad value that has no positive counterpart.
11:58:28FromGitter<alehander42> e.g. if we know that negative zero is NaN, can the nim compiler optimize `Option[int]` to int values internally and `.isSome` to `== NaNValue` etc
11:58:52AraqI want to optimize Option[Natural] to use -1 for None
11:58:59FromGitter<alehander42> exactly
12:00:35PMunchIs there an actual manual for Jester somewhere?
12:02:18*montag4512 joined #nim
12:03:54*echotangoecho joined #nim
12:03:55FromGitter<mratsim> @alehander42 there is no negative zero
12:04:22*pwntus joined #nim
12:04:41*pwntus quit (Changing host)
12:04:41*pwntus joined #nim
12:04:45FromGitter<alehander42> ah sad, it would've been handy
12:05:50FromGitter<mratsim> low(int) can be used instead as Araq said
12:05:59*cmk_zzz quit (Ping timeout: 256 seconds)
12:06:42*montag4512 quit (Remote host closed the connection)
12:06:54FromGitter<mratsim> -low(int) throws underflow error because you can represent it’s additive inverse with the same precision
12:06:57*cmk_zzz joined #nim
12:07:04FromGitter<mratsim> cannot*
12:07:23FromGitter<mratsim> more info in the tables on the right side of https://en.wikipedia.org/wiki/Two%27s_complement
12:18:20PMunchUgh, this CORS thing is driving me nuts..
12:22:00FromGitter<Clyybber> If I use unsafeAddr in a for loop like here: https://github.com/nim-lang/Nim/issues/8630 and use that address to modify its value, is it undefined behaviour?
12:22:27dom96PMunch: the readme :)
12:29:30FromGitter<mratsim> @Clyyber it is not, it is you promising not to do bad things with the memory pointer, and doing it anyway.
12:30:05FromGitter<mratsim> use mitems if you want to modify.
12:31:57FromGitter<Clyybber> @mratsim So essentially it is illegal/undefined behaviour?
12:32:47FromGitter<mratsim> it’s not undefined, what you write will stay, it won’t be optimized away by the compiler or anything like that
12:34:14FromGitter<mratsim> it’s more like “with great power comes great responsibility” and you didn’t step up. You are basically mutating an immutable variable by passing `let`, `items` with a direct pointer.
12:34:23FromGitter<mratsim> by bypassing*
12:36:48PMunchdom96, :(
12:37:02PMunchThe readme doesn't cover everything..
12:37:20dom96alltest.nim is a good source of examples too
12:37:58PMunchYeah, but it's a shame to have to go there for examples..
12:38:08PMunchWould be nice to have an actual tutorial/manual
12:41:05*echotangoecho quit (Quit: Lost terminal)
12:41:23*revi0 joined #nim
12:42:21FromGitter<Clyybber> @mratsim Ok thanks!
12:42:59*revi0 quit (Killed (Sigyn (Spam is off topic on freenode.)))
12:53:31PMunchzacharycarter[m], are you still working on playground?
13:06:16FromGitter<xmonader> btw are there any updates on the nim survey? when will it be released?
13:10:55dom96no idea
13:13:30*francisl joined #nim
13:17:22FromGitter<xmonader> wow :D aren't you who is managing that @dom96 ?
13:17:31dom96yep :P
13:18:16FromGitter<xmonader> hahahahahaha it's been almost a month now
13:19:09FromGitter<xmonader> the guys in rust communties are almost spreading the news of every sneeze someone have
13:25:45FromGitter<imdaveho> I'm starting to realize that I like the philosophy or the premise/promise of Nim more than Rust because at the end of the day, most software has already been written in C/C++ and to scrap that and start from scratch, even under the premise of safety...doesn't seem practical to me. Also, I do believe that Rust is great and I'd still want to learn it, but I'm sure the problem with unsafe code is not necessarily with
13:25:45FromGitter... compilers or the language...really it has to do with people. So I'd rather have a language that is easily more understandable, like Nim, than something that has gotten pretty verbose, like Rust. Though, Rust will have it's use cases...I don't think what they are doing with their push into web tech is the right thing.. ... [https://gitter.im/nim-lang/Nim?at=5b76ccd90825690ea2e2878d]
13:26:20FromGitter<imdaveho> It's also the reason I like Clojure and Rich Hickey's rationale of leveraging the JVM -- it's just practical
13:34:58FromGitter<xmonader> @imdaveho well I see their point, and I agree with you, who cares if u use language without garbagecollection for web .. there we days we went by just index.php huge file and that's it! ⏎ ⏎ I like Nim, but there's always something i feel missing in the essence of the language itself, and no not monads ;P
13:37:41FromGitter<imdaveho> well...I think it's OK for a young language... TBH I like how Go started out as trying to be as bare as possible...but maybe a bit too bare... ⏎ ⏎ for libs and languages, I like to be barebones first...and slowly add new things -- the recent Elm Conf, their creator Evan spoke about Elm and also the early days of Python with Guido -- it's a good watch because it really puts the techbros and tech hipsters in their
13:37:41FromGitter... place and focuses on trying to build a long lasting language
13:44:35*ltr__ joined #nim
13:44:48ltr__hello
13:45:49FromGitter<xmonader> is that video available @imdaveho
13:46:43FromGitter<imdaveho> https://www.youtube.com/watch?v=uGlzRt-FYto&t=0s&index=2&list=PL-cYi7I913S-VgTSUKWhrUkReM_vMNQxG
13:46:53ltr__can someone help me with a little problem i have running some examples on nim?, i cant find a solution by my own =/
13:49:20FromGitter<xmonader> thanks a lot
13:49:44ltr__i cant get my code using db_sqlite module running, it does not find libsqlite3.so, and i cant get the binary to find the lib that lives in the same directory as the binary, i cant force to use the static version of the lib either.
13:52:09*echotangoecho joined #nim
13:53:35*endragor quit (Remote host closed the connection)
13:53:38Araqltr__: if you're on Linux copy it to /usr/lib
13:55:50*miran_ joined #nim
13:57:39ltr__yes i know, but how can i use sqlite static? or the amalgamated .c file, its posible to tell nim that i want to link sqlite statically
13:57:43ltr__?
13:59:46ltr__i want a selfcontained binary, sqlite is not really used that much as a dynamic lib
13:59:58federico3ltr__: why?
14:01:34ltr__i dont want to make the user to install libsqlite3, for example my distro does not have that package (nixos)
14:02:17ltr__sqlite3 is designed to be embedded as a single .c file, it usually used that way
14:02:18dom96Araq: Any chance {.experimental.} could be made to apply to only the current module?
14:02:54dom96Otherwise any library wanting to use experimental features will infect everybody's codebase
14:02:57Araqdom96: it does that
14:03:07ltr__anyways, theres an option to link sqlite3 statically? or in any case to distribute libsqlite3.so with my binary?
14:03:20Araqltr__: try --dynlibOverride and add some linking command
14:03:38federico3ltr__: https://forum.nim-lang.org/t/1951
14:03:50dom96Araq: oh, was this changed recently?
14:04:15ltr__federico3: it does not work with sqlite, it still ask for libsqlite3.so
14:04:38federico3ltr__: even with the dynlib override flag?
14:04:43ltr__yes
14:04:51FromGitter<retsyo> any help to do regular expression on unicode string? Thanks. So sorry https://forum.nim-lang.org/ is hard for me to reach ⏎ import re ⏎ import unicode ⏎ ⏎ var txt = "自我 我们 我" ... [https://gitter.im/nim-lang/Nim?at=5b76d603e026575f0f87dc0e]
14:05:46FromGitter<retsyo> any help to do regular expression on unicode string? Thanks. So sorry https://forum.nim-lang.org/ is hard for me to reach ⏎ import re ⏎ import unicode ⏎ ⏎ var txt = "自我 我们 我" ... [https://gitter.im/nim-lang/Nim?at=5b76d63ae026575f0f87ddb3]
14:05:58dom96ltr_: it's not just `--dynlibOverride` you need to specify --dynlibOverride:db_sqlite (I think?)
14:06:01FromGitter<mratsim> nice flash @retsyo
14:06:08dom96https://nim-lang.org/docs/nimc.html#dynliboverride
14:06:13FromGitter<retsyo> any help to do regular expression on unicode string? Thanks. So sorry https://forum.nim-lang.org/ is hard for me to reach ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76d655a158fd0ea36f9080]
14:06:39FromGitter<retsyo> sorry, I use gitter seldom
14:06:47FromGitter<mratsim> I’m joking ;)
14:07:08Araqdom96: no but it's complicated, it depends on the .experimental feature
14:07:36Araqfor example, if concept were under .experimental
14:07:47Araqyou can only declare concepts with .experimental
14:07:55Araqbut you can use them everywhere
14:08:10dom96Araq: That's bad
14:08:32Araqusually it's connected with the declaration
14:08:59FromGitter<mratsim> @ltr this is my code for static linking: https://github.com/mratsim/Arraymancer/blob/master/nim.cfg#L72-L82
14:12:05Araqdom96: the newer experimental stuff checks for usages
14:12:10ltr__ok ill give that a try
14:16:24ltr__ that is the same that passing the arguments in the command line i guess
14:18:15*atk3 joined #nim
14:20:16FromGitter<tim-st> @retsyo Do you want to split your string by words?
14:21:02FromGitter<retsyo> no, I want to find characters based on regular expression
14:21:34*ninsei joined #nim
14:22:07ltr__FromGitter: that worked!, thanks you very much
14:22:08FromGitterltr__, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim
14:22:09FromGitter<tim-st> you can also input characters by unicocode codepoint I think with someting like `\u{...}` maybe that works?
14:22:33ltr__mratsim : it worked!
14:22:39ltr__thanks you
14:23:06ltr__now sqlite3 compiles statically, another question, can i compile .c files along with nim files with nimble?
14:24:00FromGitter<retsyo> the input are read from files. how can I convert every characters to `\u{...}`?
14:24:35*atk3 quit (Ping timeout: 240 seconds)
14:24:55FromGitter<tim-st> you use `for rune in str.runes: var hex = rune.ord.toHex` then `\X{hexStr}`
14:25:00FromGitter<tim-st> I imagine that could work
14:26:01FromGitter<tim-st> maybe also the direct ord number works
14:28:19FromGitter<tim-st> another thing that is helpful and I prefer over regex is fo each rune generate the unicodeType (`unicodedb/types`) can do it, then you can do a case and if it fits you chinese symbol you can do manual case, thats more flexible
14:29:18FromGitter<retsyo> let me try. I am new to nim
14:29:30FromGitter<tim-st> sure
14:31:12*ninsei quit (Ping timeout: 265 seconds)
14:31:18dom96ltr_: so what was it that you were missing?
14:31:25dom96how did you get it to statically link?
14:32:31ltr__the way i compiled sqlite3
14:32:36*PMunch quit (Quit: Leaving)
14:32:48ltr__it wasnt a static lib, just 'ar' it and it worked
14:33:04ltr__my distro does not have libsqlite3, dont know why
14:33:39ltr__it just have a debug version of it
14:34:01ltr__can i compile c files with nimble?
14:34:22ltr__so for example compile sqlite3 in static mode and then proceed to compile the rest of my project
14:35:52*nirel joined #nim
14:37:10*nirel quit (Killed (Unit193 (Spam is not permitted on freenode.)))
14:39:12dom96right... but did you just use --dynlibOverride to get it working with Nim?
14:39:28dom96You can use the {.compile.} pragma for that
14:39:54FromGitter<retsyo> @tim-st , where can I find the usage of \u \x?
14:40:52FromGitter<tim-st> I think it's normal pcre syntax
14:41:54FromGitter<retsyo> I misunderstood it is in nim's string ;)
14:42:53FromGitter<data-man> @ltr: E.g. https://github.com/NimCompression/nimsnappyc/blob/master/nimsnappyc/snappyc.nim
14:42:57FromGitter<tim-st> ok, I cannot find a good example on the nim page though, maybe just try with regex tester
14:43:03FromGitter<mratsim> @ltr, yes you can compile/include C file in a nimble project. Example: https://github.com/status-im/nim-decimal
14:43:06FromGitter<tim-st> https://regex101.com/
14:44:18ltr__mratsim, data-map: thanks! ill check those examples
14:50:49*yglukhov[i] joined #nim
14:51:25*yglukhov[i] quit (Client Quit)
14:52:40FromGitter<retsyo> After a short consideration, I don't think the `re` module can support unicode, since this module seems to accept `string` only
14:55:17FromGitter<tim-st> string is unicode
14:56:07FromGitter<tim-st> Does someone knows when I open a global var in a lib and import from some other module it will be opened again?
14:56:15FromGitter<tim-st> e.g. database?
14:57:00dom96tim-st: It will be opened once AFAIK. But test it to be sure.
14:57:47FromGitter<tim-st> ok, thanks, because I saw there is the `once` template
14:58:52FromGitter<retsyo> ```var a: string = "我" # the Chinese character means "me" ⏎ echo len(a)``` ⏎ ⏎ displays 3, but I want to treat it as one character. otherwise re"." will find 3 characters in "我" [https://gitter.im/nim-lang/Nim?at=5b76e2abe2e48a20b4712728]
14:59:22FromGitter<tim-st> use `var me = a.runeAt(0)`
15:00:02FromGitter<tim-st> or `var me = a.toRunes.len`
15:03:02FromGitter<tim-st> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76e3a6087c4c20b5f6ff25]
15:03:57FromGitter<retsyo> guys, I want use string/unicode_string for regular expression treatment, so ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76e3dd7a178641253d10ba]
15:04:34FromGitter<tim-st> yes, if you really want to use regex you have to search by unicode not by `.`
15:04:57FromGitter<tim-st> `.` searches for a single 8-bit char, you want `\w` w is basically the same as Rune
15:05:27FromGitter<tim-st> So I said test your regex on the website I posted above and you will find a working regex
15:07:53FromGitter<retsyo> thanks. it is time for bed. I will check it later
15:08:20FromGitter<tim-st> ok, but your problem is the regex is currently wrong, that has nothing to do with nim
15:10:58*BitPuffin quit (Ping timeout: 272 seconds)
15:11:02FromGitter<retsyo> (https://files.gitter.im/nim-lang/Nim/5Td9/image.png)
15:14:10FromGitter<data-man> @retsyo: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76e642a158fd0ea36ff662]
15:25:21FromGitter<gogolxdong> How to debug ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76e8e1157b9d34ef9e2836]
15:29:23FromGitter<Varriount> @gogolxdong Look at publicresource.nim(27)
15:32:15FromGitter<gogolxdong> yes, I forget to uncomment thread pools.
15:45:11*echotangoecho quit (Quit: Lost terminal)
15:49:55*NimBot joined #nim
15:51:40*vivus joined #nim
15:53:37FromGitter<mratsim> by the way @gogolxdong is this used in prod at Tencent: https://github.com/Tencent/ncnn?
16:05:45*Trustable joined #nim
16:06:02*echotangoecho joined #nim
16:07:10*fsamareanu1 joined #nim
16:07:45*fsamareanu1 quit (Killed (Unit193 (Spam is not permitted on freenode.)))
16:13:26*S1tiSchu quit (Quit: Leaving)
16:21:57FromGitter<Clyybber> How would I read a file at compile time and store the buffer in a seq to be used at runtime?
16:22:24dom96const file = staticRead("filename")
16:22:34dom96You can also create a proc that turns that into a seq or whatever you want
16:23:27FromGitter<mratsim> @data-man, I gues this one is for you https://forum.nim-lang.org/t/4137
16:34:46*Texou2 joined #nim
16:35:45*Texou2 quit (Read error: Connection reset by peer)
16:36:04FromGitter<data-man> @mratsim: Thanks! I replied.
16:57:31*wildlander joined #nim
16:57:45*echotangoecho quit (Quit: Lost terminal)
16:59:02*nsf quit (Quit: WeeChat 2.2)
17:03:05shashlickany ideas why my libui wrapper test code exits with -1073741511
17:05:53leorizesigsegv?
17:16:37*vosper joined #nim
17:50:11*ltr__ quit (Quit: leaving)
17:54:05*pwntus quit (Ping timeout: 240 seconds)
17:57:44*niko12 joined #nim
17:58:29*pwntus joined #nim
17:59:30*niko12 quit (Killed (Sigyn (Spam is off topic on freenode.)))
18:07:52*zachk joined #nim
18:08:23*zachk quit (Changing host)
18:08:23*zachk joined #nim
18:13:06*francisl quit (Quit: francisl)
18:23:38*vanous joined #nim
18:38:31*cryptocat1094 joined #nim
18:43:46*jhesketh25 joined #nim
18:46:51*jhesketh25 quit (Killed (Sigyn (Spam is off topic on freenode.)))
19:06:25FromGitter<mratsim> @shashlick maybe something similar to https://github.com/nim-lang/Nim/issues/8432 ⏎ ⏎ I have Arraymancer failing with exit code 35584, due to closure + generics regression
19:06:58*vanous quit (Ping timeout: 268 seconds)
19:07:15FromGitter<mratsim> the exit code is irrelevant, it’s the compiler quitting in the middle of compilation, and unittest is summoning a random exit code out of thin air
19:07:35FromGitter<Clyybber> dom96 Thank you!
19:11:30*Warped26 joined #nim
19:13:04*Warped26 quit (Remote host closed the connection)
19:15:10FromGitter<Clyybber> Why do we have gorge and slurp as aliases for staticExec and staticRead?
19:15:27FromGitter<Clyybber> It doesn't bother me I just find it funny
19:19:27shashlick@mratsim: my compilation actually succeeds and an EXE is created
19:19:37shashlickit's when you run the executable, it returns that value
19:22:05*endragor joined #nim
19:26:50*endragor quit (Ping timeout: 272 seconds)
19:28:09livcdshashlick: what example ?
19:32:44*Jesin quit (Remote host closed the connection)
19:37:21*ibiza joined #nim
19:38:31*ibiza quit (Killed (Sigyn (Spam is off topic on freenode.)))
19:40:23FromGitter<ivanflorentin> hello, I'm having lib/system.nim(396, 10) Error: usage of '==' is a user-defined error with devel branch right now, are there changes that i have to do in my code or is it a bug?
19:42:10shashlicklivcd: I am wrapping libui using nimgen - compiling all source into the generated binary - it builds fine but doesn't run correctly
19:42:48FromGitter<ivanflorentin> ```template `!=`*(x, y: untyped): untyped = ⏎ ## unequals operator. This is a shorthand for ``not (x == y)``. ⏎ not (x == y)```
19:42:53shashlickhere's a gist: https://gist.github.com/genotrance/2839cb49b3855c91aa835e4379ac73a5
19:43:13shashlickneed libui source checked out in the nimui directory as well
19:51:46*Guest68713 joined #nim
19:52:32*cryptocat1094 quit (Quit: later)
19:54:10FromGitter<mratsim> @ivanflorentin do you have a small example to reproduce that?
19:54:29*Guest68713 quit (Remote host closed the connection)
19:55:08FromGitter<ivanflorentin> ill make one, i tested with 2 project thar were compiling previously
20:00:38FromGitter<ivanflorentin> the problem is when comparing to nil: ```if a != nil```
20:00:39zachkwas nimble around in 0.17?
20:04:51FromGitter<mratsim> @zachk, it’s much older
20:06:19FromGitter<mratsim> @ivanflorentin, is a a seq or string?
20:07:45FromGitter<mratsim> Normally the "not nil” enforcement is behind {.experimental: “notnil”.} since a couple of hours but maybe part of it was missed (see changeling https://github.com/nim-lang/Nim/blob/devel/changelog.md) or you have an outdated devel :P.
20:11:20FromGitter<ivanflorentin> @mratsim it is an element in a row returned by db_postgres
20:11:59FromGitter<ivanflorentin> i will check and adapt, thenks for the tips
20:12:15FromGitter<mratsim> ah pretty sure Araq was talking that this afternoon. You can file a bug.
20:12:30*nsf joined #nim
20:19:21*miran_ quit (Quit: Konversation terminated!)
20:21:12FromGitter<ivanflorentin> i will first read the changelog, i think i may be hitting this: *** *nil for strings/seqs is finally gone. Instead the default value for these is "" / @[]. Use --nilseqs:on for a transition period.***
20:24:24*Steinsplitter8 joined #nim
20:28:56*Steinsplitter8 quit (K-Lined)
20:30:22Araqsorry... what's the problem?
20:33:37FromGitter<timotheecour> related question @araq: how will we make `var s = “”` not allocate in the future? what’s the rough plan/idea ?
20:35:50FromGitter<mratsim> and @[], and the need for `{.noInit.}`, cf https://github.com/frol/completely-unscientific-benchmarks/pull/17 and Arraymancer 3x speed {.noinit.} regression
20:36:07FromGitter<mratsim> https://github.com/nim-lang/Nim/issues/7743
20:36:55FromGitter<mratsim> I’d like to work on it because, it impacts all benchmarks with seq (and string?) result value.
20:43:23FromGitter<timotheecour> I know of 1 solution, which I already suggested in https://github.com/nim-lang/Nim/issues/8370, which is to make string mean immutable slice of chars; in which case `var s = “”` or even `var s = “foobar”` will not allocate; but I want to know what you guys have in mind
20:43:49Araqhuh? It produces NimString s = NULL; roughly.
20:44:01Araqalready in devel, what's hard about it
20:44:55FromGitter<timotheecour> so “var s=“”` doesn’t allocate in devel currently?
20:45:12Araqcheck it, I haven't
20:50:20*Trustable quit (Remote host closed the connection)
20:51:54*Patrick16 joined #nim
20:52:06*Patrick16 quit (Killed (Sigyn (Spam is off topic on freenode.)))
21:03:53*Vladar quit (Remote host closed the connection)
21:08:54FromGitter<treeform> I have added word clipping and alignment to my pure-nim typography library:
21:09:02FromGitter<treeform> (https://files.gitter.im/nim-lang/Nim/NDUg/Screen-Shot-2018-08-17-at-2.07.50-PM.png)
21:09:22FromGitter<treeform> Any one doing any UI projects in nim and needs text?
21:10:35FromGitter<Clyybber> Me possibly, for my game engine
21:11:09FromGitter<treeform> Cool what does your game engine use?
21:11:19FromGitter<Clyybber> vulkan
21:11:23FromGitter<treeform> nice
21:11:43FromGitter<treeform> Do you want to support CJK text?
21:12:04FromGitter<Clyybber> Perhaps
21:12:14*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:12:24FromGitter<treeform> If you don't support them you can precompute all glyphs ahead of time.
21:12:28FromGitter<Clyybber> I dont really know, its not really needed, since I dont plan on translating
21:12:35FromGitter<Clyybber> Oh thats nice
21:12:38FromGitter<treeform> If you want to support CJK you have do it at runtime.
21:12:47FromGitter<Clyybber> Why?
21:13:04FromGitter<treeform> there are too many CJK characters to precompute
21:13:08FromGitter<Clyybber> Oh
21:13:37FromGitter<treeform> the character tables might dwarf your other game assets
21:13:47FromGitter<treeform> the CJK font from google is 1.5GB
21:14:11FromGitter<treeform> I found an older font though, that I use, only 20MB
21:14:20FromGitter<treeform> usually fonts are like 100k
21:14:21FromGitter<Clyybber> Ah, yes, on my system my CJK font uses 2,4 GB
21:15:08FromGitter<treeform> https://github.com/treeform/typography/blob/master/tests/ch.png
21:15:16FromGitter<Clyybber> Btw, in your readme theres a typo: It should say `rely` instead of `relay`
21:15:22FromGitter<treeform> I can do CJK though its just you kind of have to plan ahead.
21:15:31FromGitter<treeform> thanks!
21:15:37Araqtreeform: which backend(s) do you support?
21:16:33FromGitter<treeform> I guess none? the backend is up to you. I can give you the Glyph bitmaps and Layout structures where they should go, its up to you to draw them.
21:16:47FromGitter<treeform> I have a test backend that just draws to pngs.
21:17:16FromGitter<treeform> You basically need to re implement this in the engine for your choice:
21:17:17FromGitter<treeform> https://github.com/treeform/typography/blob/master/src/typography/layout.nim#L173
21:17:37FromGitter<treeform> Its only 11 lines so it should not be super hard?
21:18:12FromGitter<treeform> I have my own 3d engine (which reimplements this) but it also uses atlases and textures and openGL crap that is not part of glyphs and types.
21:18:27FromGitter<treeform> I am trying to keep this library a pure library.
21:18:39FromGitter<Clyybber> Which I think is very nice!
21:18:49AraqI'm asking how to make this work with SDL2
21:19:00FromGitter<Clyybber> I think render it to a texture
21:19:00FromGitter<treeform> oh probably trivial
21:19:04FromGitter<Clyybber> and then draw it
21:19:12FromGitter<treeform> just replace my blit with their blit ...
21:19:23AraqI don't mind writing code, but I need to know what to write ;-)
21:19:54FromGitter<treeform> https://github.com/treeform/typography/blob/master/src/typography/layout.nim#L179
21:20:05FromGitter<treeform> on this line just take my image and turn it into SDL surface
21:20:17FromGitter<treeform> then on the next line blit with SDL blit to your own SDL serface
21:20:22FromGitter<treeform> and thats all the changes you need?
21:20:35FromGitter<treeform> If its slow you might want to cache the SDL surfaces
21:20:42FromGitter<timotheecour> araq what’s the equivalent of C++’s std::string ’s.data()’ to get address of 1st element of a string?
21:20:52Araqaddr s[0]
21:21:11FromGitter<timotheecour> well that doesn’t work with `s=“”` I tried
21:21:31FromGitter<treeform> "" does not have a char 0, so it has not address.
21:21:43Araqyup, you need to setLen it first
21:21:47FromGitter<timotheecour> wait so `“”` is not null terminated?
21:21:56FromGitter<Clyybber> Nim strings are not null terminated
21:22:00FromGitter<Clyybber> afaik
21:22:05dom96They are
21:22:13FromGitter<timotheecour> Huh?? i thought they were
21:22:21FromGitter<treeform> but "" is new type of nil string
21:22:22FromGitter<Clyybber> I may be wrong...
21:22:36FromGitter<treeform> in C you NULL is not a valid string but now in nim it is.
21:22:54*pilottage joined #nim
21:23:27Araqwell yes, "" is not zero terminated, but cstring(x) knows about this edge case
21:23:45*vosper joined #nim
21:23:45FromGitter<timotheecour> hence my question… so now if we pass a string litteral to a C function that expects null termination, it may or may not work depending on special case of `””` ?
21:24:00FromGitter<treeform> you should always use cstring(x) for that
21:24:13Araqas I said, the cstring conversion knows about it
21:24:17FromGitter<treeform> you should not use addr x[0]
21:24:33Araqand yes the implicit cstring conversions know this too
21:24:40dom96treeform: why not?
21:25:18FromGitter<Clyybber> @treeform It is needed for passing seqs as C arrays
21:25:20FromGitter<timotheecour> @dom96, `addr x[0]` throws for `“”`
21:25:33FromGitter<treeform> while cstring(x) does not
21:25:47FromGitter<treeform> Araq, do you need help converting my image to SDL surface?
21:26:02Araqnot now, I'll come back to you
21:26:03dom96oh, because it's now mapped to `nil`?
21:26:20FromGitter<treeform> Araq, my image format is really simple https://github.com/treeform/flippy/blob/master/src/flippy.nim#L7
21:26:21Araqyeah, and because accessing the \0 is now invalid
21:26:28FromGitter<treeform> just grab width, height and data.
21:26:38FromGitter<timotheecour> in devel, `var s:string` and `var s=“”` behave differently.
21:27:43FromGitter<treeform> I think it should be nil now?
21:27:52FromGitter<timotheecour> nil disappeared for string
21:28:08FromGitter<treeform> well nil is "" so "" is the default?
21:29:07*FromDiscord joined #nim
21:29:26FromGitter<treeform> @Clyybber For text in a 3d engine I recommend starting with just rendering them all to a texture first, then use my layout system to lay the text out at runtime.
21:29:29FromGitter<Varriount> zacharycarter: Do you still need me?
21:29:36*kaniini_ joined #nim
21:29:41dom96That's gonna be a fun gotcha :/
21:29:47FromGitter<treeform> @Clyybber once you get that working, you can think about CJK issues.
21:29:58*kaniini_ quit (Killed (Unit193 (Spam is not permitted on freenode.)))
21:30:16FromGitter<Clyybber> @treeform Thats what I figured
21:30:32FromGitter<Clyybber> My game is 2D though, but that shouldn't matter
21:31:04FromGitter<Clyybber> @timotheecour How do they behave differently?
21:31:16*pilottage quit (Ping timeout: 268 seconds)
21:32:46FromGitter<treeform> @Clyybber it does matter a little bit. It just makes it easier.
21:33:11FromGitter<Clyybber> Vulkan doesn't have the concept of 2D
21:33:12FromGitter<treeform> If you want to render text in 3d world, you have to use fancy texture sampling thingy.
21:33:17FromGitter<Clyybber> Ah
21:33:20FromGitter<treeform> I don
21:33:26FromGitter<treeform> I don't support that yet.
21:34:02FromGitter<Clyybber> Do you mean something like mipmapping?
21:34:13FromGitter<Clyybber> Or anitaliasing?
21:34:29FromGitter<Clyybber> Or any other magic?
21:34:31FromGitter<treeform> This: https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf
21:34:38FromGitter<treeform> "Other magic"
21:34:52FromGitter<treeform> 2d does not need this though
21:34:56FromGitter<treeform> might even make it look worse
21:34:58FromGitter<Clyybber> Ah distant fields
21:35:00FromGitter<timotheecour> `let s=“”` calls `rawNewStringNoInit` (which I’m assuming allocates); `var s:string` doesn’t
21:35:05FromGitter<Clyybber> I read about that some time ago
21:35:56FromGitter<Clyybber> @timotheecour So the difference should be in their capacity?
21:36:18FromGitter<Clyybber> Nvrmd now i get it
21:36:21FromGitter<mratsim> no, allocation is delayed in the second case
21:36:21FromGitter<timotheecour> well, allocation vs no allocation is a big deal.
21:37:11FromGitter<Clyybber> Being able to enforce allocation through `let s=""` could be useful though
21:37:12FromGitter<timotheecour> Honestly, if `string` we just pointer + length (with low level ways to expose), there would be no edge cases, efficiency etc
21:37:24FromGitter<mratsim> There are 2 costly thing: allocating memory, and zero-ing memory. ⏎ rawNewStringNoInit allocates and doesn’t zero (hopefully) ⏎ `var s:string` delays both
21:38:30FromGitter<timotheecour> one bandaid we could do is special case `var s = Foo` where Foo is known at CT to be of length 0
21:38:33*sjums joined #nim
21:39:09*sjums quit (Killed (Unit193 (Spam is not permitted on freenode.)))
21:40:37FromGitter<mratsim> @timotheecour you also need to avoid genericResetAux like the plague (called by resetLoc in compiler code) see: https://github.com/nim-lang/Nim/commit/88cf6573e04bd7ee8762aa336460b9748f0d4644
21:41:19FromGitter<Clyybber> Looks like 0.19 will have to wait a little bit
21:41:23FromGitter<mratsim> but I think this should be tackled after or at the same time as destructors, and no-GC string/seq
21:42:19AlexMaxhey zacharycarter[m] - how stable are your nuklear nim bindings
21:42:20FromGitter<timotheecour> I’m positive we can come up with a better string and seq design ; that’s one point in which D shines.
21:42:23AlexMaxand do you take pull requests
21:43:08FromGitter<Clyybber> How would I transform a string to a seq[uint32] so that 4 chars convert to one uint32?
21:43:22*MeiR8 joined #nim
21:43:33FromGitter<timotheecour> cast?
21:43:47FromGitter<Clyybber> Can I cast a string to uint32?
21:43:51FromGitter<Clyybber> Ill have to try
21:43:53FromGitter<Clyybber> that
21:44:11*MeiR8 quit (Killed (Unit193 (Spam is not permitted on freenode.)))
21:44:49FromGitter<krux02> no you have to parse it
21:45:06*echotangoecho joined #nim
21:45:07FromGitter<krux02> you have to parse an integer and cast that integer
21:45:13FromGitter<kayabaNerve> You should be able to cast a char.
21:45:31FromGitter<Clyybber> Casting a char will give me only a fourth of an uint32
21:45:43FromGitter<kayabaNerve> Just commenting if you don't care about "100" -> 100 but rather the bits of "100" -> some number
21:45:46FromGitter<Clyybber> So how would I bit-concatenate those casted chars?
21:45:58FromGitter<krux02> you can cast the seq
21:46:00FromGitter<Clyybber> I need the bits
21:46:13FromGitter<krux02> castseq[uint32 (charseq)
21:46:14FromGitter<Clyybber> @krux02 Ok
21:46:24FromGitter<Clyybber> Thank you, will try that
21:46:27FromGitter<krux02> but the length field of thet casted seq will be wrong
21:46:39*Pyrrhic joined #nim
21:47:21*Pyrrhic quit (Killed (Sigyn (Spam is off topic on freenode.)))
21:48:33FromGitter<treeform> @CLyybber this is how i decode strings into glyphs:
21:48:47FromGitter<treeform> https://github.com/treeform/typography/blob/master/src/typography/layout.nim#L78
21:48:53FromGitter<treeform> Rune is basically a uint32
21:49:22FromGitter<treeform> it is:
21:49:22FromGitter<treeform> https://github.com/nim-lang/Nim/blob/master/lib/pure/unicode.nim#L18
21:49:47*^MillerBoss joined #nim
21:51:12*^MillerBoss quit (Remote host closed the connection)
21:53:31FromGitter<treeform> nim strings are all in utf8, which is good, but you want utf32, so it requires decoding to utf32
21:53:48FromGitter<treeform> its very similar to compression.
21:53:52FromGitter<Clyybber> I actually dont care about the text itself, the file im reading is binary
21:53:54FromGitter<Clyybber> SPIRV
21:54:07FromGitter<treeform> oh why do you need uint32???
21:54:16FromGitter<Clyybber> For vulkan
21:54:29FromGitter<treeform> why does that need uint32?
21:54:34FromGitter<treeform> cast it then
21:54:39FromGitter<Clyybber> I did
21:54:42FromGitter<Clyybber> and it works
21:54:45FromGitter<treeform> great
21:54:57FromGitter<treeform> really strange it wants uint32, not uint8 or char
21:54:58FromGitter<Clyybber> I asked because I thought it would be more complicated
21:55:24FromGitter<krux02> the casting is not perfect though
21:55:26FromGitter<mratsim> probably better to cast to ptr UncheckedArray than casting to seq to avoid wrong length issue
21:55:49FromGitter<Clyybber> Cant I just use setLen?
21:55:57*captainkraft quit (Ping timeout: 240 seconds)
21:55:59FromGitter<krux02> the casted seq has wrong length, and you don't deal with byte order
21:56:02FromGitter<mratsim> setLen might move the data
21:56:05FromGitter<krux02> (endian)
21:56:06FromGitter<Clyybber> setLen(originalstringlenth/4)
21:56:11FromGitter<Clyybber> Oh ok
21:56:45FromGitter<krux02> when I think about it, casting is a horrible idea
21:56:50FromGitter<krux02> but yea, it works
21:56:55FromGitter<krux02> :shrug:
21:57:15FromGitter<Clyybber> It seems like magic to me that castseq[uint32 (somestring) works
21:57:34FromGitter<mratsim> ^ use ptr UncheckedArray, you can combine that with littleEndian32/bigEndian32 to deal with endianness as well
21:58:10FromGitter<mratsim> `castptr UncheckArray[uint32 (somestring)` is probably better to avoid length issues.
21:58:32FromGitter<mratsim> usability-wise it supports indexing like array/seq.
21:58:42FromGitter<Clyybber> Why do I have to worry about endianness?
21:58:45FromGitter<krux02> ``castptr UncheckArray[uint32 (somestring[0].addr)``
21:59:03FromGitter<krux02> @Clyybber because endianness sucks
21:59:04FromGitter<mratsim> and you’re sure data won’t be moved somewhere, and there is no GC issues that can arise
21:59:19FromGitter<mratsim> sorry yes forgot about addr
21:59:35FromGitter<Clyybber> Im doing all of that in a static block if that matters.
21:59:39FromGitter<Clyybber> Oh,
21:59:53FromGitter<krux02> static block?
21:59:56FromGitter<Clyybber> I think that will matter, since casting is only allowed between same sizes in the VM
22:00:04FromGitter<Clyybber> @krux02 Yes
22:00:15FromGitter<mratsim> bigEndian 0xAABBCCDD = littleEndian 0xDDCCBBAA
22:00:15FromGitter<Clyybber> `static:
22:00:25FromGitter<krux02> at compile type all values are stored in heap objects
22:00:32FromGitter<krux02> so not very memory efficient
22:00:35FromGitter<mratsim> ah, in nimvm you can’t use ptr UncheckArray
22:00:41FromGitter<Clyybber> Yeah
22:01:09FromGitter<krux02> what do you do exactly?
22:01:13FromGitter<krux02> at compile time?
22:01:29FromGitter<Clyybber> And I think casting wont work too, but I'll have to try. Related Issue: https://github.com/nim-lang/Nim/issues/7903
22:01:57FromGitter<mratsim> you can only cast int at compile-time
22:02:01FromGitter<mratsim> not seq
22:02:08FromGitter<Clyybber> @krux02 I read SPIRV binary code and want to store it in a seq[uint32] for use in runtime
22:02:30FromGitter<krux02> I don't recommend to do it like that
22:02:40FromGitter<mratsim> store it in a string and use a ptr UncheckedArray at runtime?
22:02:57FromGitter<krux02> creating a seq[uint32] has a lot of overhead
22:03:08FromGitter<krux02> seq[uint32] is not a flat data structure on the vm
22:03:23FromGitter<mratsim> he is using staticRead I suppose
22:03:24FromGitter<krux02> you should better try to link the binary in the program
22:03:30FromGitter<Clyybber> @mratsim Yes
22:03:36FromGitter<krux02> in gcc you can link data in your program
22:03:47FromGitter<Clyybber> How would I access that data then?
22:04:28FromGitter<Clyybber> So does a vm seq[] get converted to a flat seq[] after compilation/at runtime?
22:04:39FromGitter<mratsim> no to an array
22:04:50FromGitter<mratsim> but a string becomes a string literal
22:05:00*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:05:02FromGitter<Clyybber> Ok
22:05:04FromDiscord<exelotl> oh the bridge is back!
22:05:04FromGitter<mratsim> I think you can take its address.
22:05:14FromGitter<Clyybber> Hello
22:05:31FromGitter<Clyybber> @mratsim So your approach would be the simplest one I suppose
22:05:31FromDiscord<exelotl> yo
22:06:08FromGitter<mratsim> you will need to use `mystring[0].unsafeAddr`
22:06:31FromGitter<Clyybber> Because I cant cast a const string?
22:06:39FromGitter<mratsim> or you might have to store it in a “var"
22:06:47*vosper joined #nim
22:07:41FromGitter<mratsim> it will be in the binary .bss for sure this way, because Nim might try to inline const usage so you won’t have an address in that case
22:07:52*echotangoecho quit (Quit: Lost terminal)
22:07:57FromGitter<timotheecour> we really should have a way to get address of 1st element of a string; as I mentioned above, `mystring[0].unsafeAddr` doesn’t work dependending on string size. For empty string (not nil terminated), that address would be 0
22:09:22FromGitter<krux02> @Clyybber you can read a binary file at compile time and create an array literal from it at compile time. But I don't recommend it. Just load the binary at runtime.
22:09:27FromGitter<Clyybber> @mratsim Ok that should work. @krux What would be the advantage of your approach using gcc?
22:09:28FromGitter<krux02> that is the best you can do.
22:10:10FromGitter<Clyybber> Ok thank you
22:10:13FromGitter<krux02> the advantage of linking a binary is that the binary is copied over into the binary without actually doing some computations for every byte
22:10:29FromGitter<krux02> it just copies a binary blob into the executable and you can get the address of it.
22:11:17FromGitter<krux02> this way the files cannot be missed when you distribute the binary, but it is also compiler specific, and I think Nim does not have a frontend for it yet
22:11:26*enyc4 joined #nim
22:11:46FromGitter<Clyybber> So the pure nim way is basically doing the same thing, but I need to cast a little bit at runtime?
22:11:58FromGitter<krux02> but the monkey2 language (and BlitzBasic) have this as a core language feature
22:12:08*pwntus quit (Ping timeout: 244 seconds)
22:12:10*enyc4 quit (Killed (Unit193 (Spam is not permitted on freenode.)))
22:12:41FromGitter<krux02> with binary files, this casting a little bit at runtime can really be a lot of cost at compile time
22:12:51FromGitter<Clyybber> How so?
22:13:05FromGitter<krux02> binary files can get big without you knowing of it.
22:13:38FromGitter<Clyybber> Yep, I might have to try compiling the shaders at runtime
22:13:54FromGitter<Clyybber> well ill see what works better.
22:14:56FromGitter<krux02> for every byte a node on the cpu is allocated, initialized, referenced, and eventually garbage collected. Then every node is then transformed to other nodes for the uint32. then you generate the literal. that literal is compiled to a C literal. And then the c literal is compiled into a data section
22:15:09FromGitter<krux02> vs a simple fast copy into the data section
22:15:25FromGitter<krux02> but I have to go
22:15:42FromGitter<Clyybber> Good bye and thank you
22:16:10FromGitter<Clyybber> Would casting to a string to a ptr uint32 be simpler?
22:16:39FromGitter<Clyybber> @mratsim Isn't a uncheckedArray[uint32] basically the same as a ptr uint32 with a length?
22:16:40Araqhow would a len, ptr pair help in accessing the first element?
22:16:52*pwntus joined #nim
22:17:02FromGitter<Clyybber> I need the length
22:17:04Araqit wouldn't. but you're getting this string representation with --gc:destructors
22:18:12FromGitter<mratsim> @Clyybber, no it’s ptr uint32 with array indexing
22:18:18Araqyou want to access s[0], you give s a lenght that is not zero, seems fair to me
22:18:24FromGitter<mratsim> len = mystring.len * 4
22:18:40FromGitter<Clyybber> / 4
22:18:41FromGitter<Clyybber> ?
22:18:45FromGitter<mratsim> right
22:18:47FromGitter<mratsim> yes
22:18:51FromGitter<mratsim> div 4
22:18:59FromGitter<mratsim> you can make it a const for efficiency
22:19:22FromGitter<Clyybber> Wouldn't that invoke the VM?
22:19:29FromGitter<Clyybber> And make the cast impossible?
22:19:39FromGitter<Clyybber> Or do you mean the length field only?
22:19:41FromGitter<mratsim> yes and no
22:19:48FromGitter<mratsim> yes length field only
22:19:55FromGitter<Clyybber> Ah, ok
22:21:48FromGitter<Clyybber> Araq I think timotheecour meant a ptr pair would help with the difference between var somestring = "" and var somestring: string
22:23:18FromGitter<mratsim> you might need some ugly code to have both len as const and being able to take an address though: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b774ad67a178641253f87d4]
22:24:16FromGitter<Clyybber> Ugly code is alright, Im coming from C
22:24:20FromGitter<Clyybber> :P
22:24:44FromGitter<mratsim> C is OK, C++ is >—>
22:25:34FromGitter<mratsim> namespace::doSmth<int8>(a, b){ … };
22:26:48FromGitter<Clyybber> modern C++ is ok
22:26:53FromGitter<Clyybber> but C rules
22:27:03FromGitter<Clyybber> Do what you want cuz a pirate is free
22:27:18FromGitter<Clyybber> *a caster is free
22:29:13shashlickfor some reason, my 32-bit program is linking to the wrong comctl32.dll in the c:\windows\winsxs folder
22:31:37FromGitter<Clyybber> since `static:` was changed to introduce a new scope, I cant have a global static var anymore
22:32:13FromGitter<mratsim> var foo{.compileTime.} = bar()
22:32:31FromGitter<Clyybber> oh didn't know about compileTime pragma
22:32:34FromGitter<Clyybber> thanks
22:32:56FromGitter<mratsim> example: https://github.com/status-im/nimbus/blob/4b5eada3222fbfa5780602b42ad27816990aca4d/nimbus/vm/interpreter_dispatch.nim#L18
22:33:45FromGitter<mratsim> I think it was added to variable to replace the static block? I asked the same question at the time.
22:36:59FromGitter<Clyybber> And then to use them at runtime I would just do `const cfoo = foo`?
22:40:26*captainkraft joined #nim
22:44:45FromGitter<mratsim> good question, I don’t know
22:48:03FromGitter<Clyybber> Yep this works.
22:50:16*tigrmesh7 joined #nim
22:50:40FromGitter<Clyybber> Araq Should I report an issue that nim doesn't catch that it is invalid to access a `{.compileTime.}` variable at runtime? It currently causes a gcc error.
22:50:46zachkhow do I get nim working with msys2, the builtin package is missing nimble, I built nim from source and got it working but nimble is broken looking for crypto libraries, and I supposedly have everything installed
22:50:46*pwntus quit (Ping timeout: 272 seconds)
22:51:12*tigrmesh7 quit (K-Lined)
22:52:52FromGitter<Clyybber> !eval echo "does this work?"
22:52:54NimBotdoes this work?
22:53:03FromGitter<Clyybber> Cool
22:54:44Araqclybber already reported
22:55:03*vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:58:09*vosper joined #nim
22:59:57*nsf quit (Quit: WeeChat 2.2)
23:01:36FromGitter<Clyybber> Ok
23:02:21FromGitter<Clyybber> @mratsim Im getting expression cannot be converted to UncheckedArray[system.uint32]
23:03:01FromGitter<Clyybber> I cannot cast a string to UncheckedArray[uint32] and neither to UncheckedArray[char]
23:03:04*pwntus joined #nim
23:03:44FromGitter<Clyybber> Casting to a seq[uint32] works
23:08:52FromGitter<Clyybber> So I can't actually cast a `ptr sometype` to an `UncheckedArray[sometype]`?
23:09:56FromGitter<krux02> you cast to ``ptr uncheckedArray[sometype]``
23:18:58AlexMaxoof, nuklear-nim isn't a mimble package
23:19:27*benoliver9990 joined #nim
23:22:29*benoliver9990 quit (Killed (Sigyn (Spam is off topic on freenode.)))
23:25:27*guardian6 joined #nim
23:25:39*guardian6 quit (Killed (Unit193 (Spam is not permitted on freenode.)))
23:28:58*Taylor15 joined #nim
23:33:04FromGitter<Clyybber> @krux02 @mratsim When I do `var pcode = castptr UncheckedArray[uint32 (shaderString)` , pcode only contains 2 elements, the first being the first 4 bytes as a uint32 and the second being zero
23:33:26FromGitter<Clyybber> Or is that repr not being able to deal with UncheckedArray?
23:35:44*Taylor15 quit (Ping timeout: 272 seconds)
23:37:46FromGitter<Clyybber> Nvrmind, Im actually dumb
23:41:49pigmejHmm, When should be await and when asyncCheck used?
23:42:06pigmejI struggle to see a difference
23:48:33*xet7 quit (Quit: Leaving)