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:09 | sotrhraven | o/ |
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:44 | Perkol | Hi. Is there a way to suppress dialog boxes when I compile with --app:gui flag? |
02:58:00 | Perkol | Similar to SetErrorMode(SEM_NOGPFAULTERRORBOX) |
03:11:04 | FromGitter | <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:07 | Perkol | Varriount: 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:53 | FromGitter | <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:53 | FromGitter | ... would you happen to know how to DM someone on the IRC side? eg. DM'ing *<shashlick>* |
06:07:12 | FromGitter | <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:39 | FromGitter | <gogolxdong> I'm wondering how to configure production with Jester ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b7669eb796f7b601d535e98] |
06:23:52 | FromGitter | <gogolxdong> It used to work. |
06:24:11 | FromGitter | <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:21 | FromGitter | <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:17 | FromGitter | <timotheecour> anyone knows how to detect when we’re at compile time? eg to avoid a code path that would cause importc |
07:51:36 | leorize | when defined(nimvm)? |
07:52:54 | Araq | https://nim-lang.org/docs/manual.html#statements-and-expressions-when-nimvm-statement |
07:53:26 | * | cspar quit (Ping timeout: 244 seconds) |
07:54:15 | Araq | watch out for its restrictions |
07:55:21 | Tanger | Hey folks, is it possible to pass a tuple as an argument to a proc that accepts multiple parameters and unpack it? |
07:55:55 | Araq | yeah, but you will probably need to use a macro |
07:56:13 | Tanger | Cool, thanks Araq |
08:00:02 | * | PMunch joined #nim |
08:02:54 | Perkol | Is 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:22 | Araq | Perkol, the docs are out there, somewhere, I'm sure but also give c2nim a try |
08:08:14 | * | vosper joined #nim |
08:13:56 | FromGitter | <timotheecour> > `when defined(nimvm)` didn’t work, but `when nimvm` is the thing, thanks! |
08:17:33 | FromGitter | <imdaveho> how do I declare a union type? eg. var foo: char | int ? |
08:18:08 | Araq | use a 'case object', it's verbose, but it works |
08:18:30 | Araq | in 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:26 | FromGitter | <imdaveho> @Araq you mean as is stated here: https://nim-lang.org/docs/manual.html#types-object-variants |
08:21:52 | Araq | yeah |
08:22:16 | FromGitter | <imdaveho> damn that is verbose |
08:23:00 | FromGitter | <imdaveho> is this not something to support: `var foo: [T: char or int]` |
08:24:16 | Araq | it's not on our roadmap |
08:24:37 | * | insidious15 quit (Remote host closed the connection) |
08:25:03 | Araq | it also doesn't come up that often once you accepted static typing as your lord and saviour |
08:26:47 | FromGitter | <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:31 | Perkol | I 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:07 | PMunch | !eval echo 100 |
08:37:10 | NimBot | 100 |
08:37:17 | PMunch | !ping |
08:37:17 | NimBot | pong |
08:37:26 | PMunch | @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:00 | leorize | I think NimBot isn't logged in |
08:45:06 | leorize | as a result it's muted |
08:45:07 | Araq | lol |
08:45:59 | leorize | Araq: I think dom96 left a guide with IRC commands to whitelist somewhere... |
08:51:25 | * | dimi34ka28 quit (Ping timeout: 265 seconds) |
08:52:30 | PMunch | !eval echo 100 |
08:52:33 | NimBot | 100 |
08:52:34 | PMunch | !ping |
08:52:34 | NimBot | pong |
08:52:54 | PMunch | Ah yes, he is just quieted :P |
08:53:11 | Araq | !eval echo 9 |
08:53:13 | NimBot | 9 |
08:53:24 | PMunch | You need to be op to see his messages |
08:53:40 | * | Perkol quit (Quit: Leaving) |
08:53:43 | Araq | ok |
08:55:39 | PMunch | #nim has channel mode +z, so moderators can see quited users |
08:55:49 | PMunch | quiet-ed |
08:59:54 | Araq | ok, I don't care but it's good to know you're an operator |
09:01:34 | PMunch | Yeah dom96 made me an operator a while back when we had a ton of spammers |
09:02:31 | * | arlen joined #nim |
09:02:45 | PMunch | But 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:46 | PMunch | Hmm, trying to do something with Jester. Has the error messages always been this bad? |
09:13:54 | Araq | please give an example |
09:14:25 | PMunch | http://ix.io/1kq1/ |
09:15:01 | Araq | what's bad about it? |
09:15:31 | PMunch | It doesn't tell me anything about what in my route is wrong |
09:15:51 | PMunch | Line 4 is the only reference to my code, and that's the "routes:" line |
09:16:12 | Araq | well it's a server, it got a bad request |
09:16:22 | Araq | it doesn't have to be in your code |
09:16:25 | PMunch | No the request is fine |
09:16:45 | PMunch | I posted a request to the server and had it spit out what it got and return an okay |
09:16:58 | PMunch | I changed something in my code, then sent the exact same request, and now I get that error |
09:17:07 | PMunch | So it's something in my route that has changed |
09:17:33 | Araq | that's not true :-) |
09:17:42 | Araq | could have been lucky before |
09:17:56 | PMunch | What do you mean lucky? |
09:18:09 | Araq | try it again and see if it's reproducible |
09:18:39 | Araq | and then chance that it was caused by you change raises |
09:24:08 | PMunch | I already tried it three times |
09:24:46 | * | ^Phantom^29 joined #nim |
09:25:08 | Araq | ok, sorry. then show us the diff please |
09:25:15 | Araq | and summon dom96 |
09:26:29 | PMunch | Damn 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:55 | Araq | compile with --nilseqs:on |
09:27:04 | Araq | we're still figuring out a good migration path :P |
09:27:11 | PMunch | Ah right |
09:27:20 | PMunch | So seqs can't be nil any longer? |
09:27:26 | PMunch | Makes sense |
09:27:27 | Araq | nope |
09:27:48 | Araq | https://github.com/nim-lang/Nim/issues/8668 ideas welcome |
09:29:36 | Araq | I think we need to update as many projects as possible as soon as possible |
09:30:22 | Araq | the 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:10 | PMunch | Ah, that's good |
09:31:41 | PMunch | I guess the only things that actually need to be updated then is those that differentiate between being set and not |
09:31:50 | PMunch | Mostly for default parameters I would guess |
09:32:06 | PMunch | proc something(x: seq[int] = nil) |
09:32:38 | PMunch | Maybe not so relevant for sequences, but for strings that could cause trouble |
09:33:28 | PMunch | proc format(fmtString: string = nil): string = if fmtString == nil: return "Default format"; else: return "Using fmtString" |
09:33:34 | FromGitter | <data-man> @imdaveho: Sorry, no progress. There is more important things. :) |
09:34:13 | PMunch | How 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:45 | dom96 | hi |
09:37:23 | Araq | PMunch, codegen improvements are still not complete but the idea is to map @[] to nil, @[] won't allocate |
09:38:16 | Araq | and then there is this whole --gc:destructors thing that changes the performance in all sort of good and bad ways |
09:38:22 | PMunch | Oh, that's nifty |
09:39:08 | PMunch | So "var x: seq[int] = @[]; x.add(100)" wouldn't actually create a sequence before x.add |
09:39:18 | PMunch | Hi dom96 :) |
09:39:23 | dom96 | Araq: Ignoring my suggestion? https://github.com/nim-lang/Nim/pull/8414 |
09:39:35 | PMunch | Noticed that NimBot is silenced |
09:39:46 | dom96 | !ping |
09:39:46 | NimBot | pong |
09:39:53 | dom96 | Fixed? |
09:39:58 | PMunch | Hmm, yup |
09:40:00 | dom96 | good |
09:40:05 | PMunch | Did you log him in= |
09:40:12 | Araq | dom96, can happen, sorry, I'm doing too many things |
09:40:13 | PMunch | s/=/? |
09:40:14 | dom96 | no |
09:40:21 | dom96 | * dom96 sets exempt on NimBot!*@* |
09:40:32 | dom96 | Can't you see this? |
09:40:33 | Araq | however, I don't mind the explicit .importcpp |
09:40:58 | Araq | !eval echo "I'm the Lord Marshal" |
09:41:00 | NimBot | I'm the Lord Marshal |
09:41:05 | dom96 | Araq: It's much cleaner to use {.push.} appropriately, especially when that was used initially. |
09:41:07 | PMunch | Uhm, nope |
09:41:19 | dom96 | PMunch: What's your IRC client? |
09:41:24 | PMunch | HexChat |
09:41:48 | PMunch | Might just be that those are turned off by default |
09:42:16 | PMunch | Or that you must be op to see them |
09:42:27 | Araq | dom96, ok, but let's give Gulpf a break, it was tested this way and we can go back to this problem later |
09:43:26 | Araq | that PR list never goes down :-/ |
09:44:05 | * | BitPuffin joined #nim |
09:45:20 | FromGitter | <gogolxdong> does defer work now? |
09:51:45 | FromGitter | <mratsim> @gogolxdong yes, and if you mean does it work in async, yes since a month ago |
09:52:15 | FromGitter | <timotheecour> => https://github.com/nim-lang/Nim/issues/3877#issuecomment-408658085 hard to interpret, the bug is still shown as open |
09:52:21 | Araq | argh... I wanted to remove it though. Oh well |
09:52:43 | FromGitter | <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:57 | FromGitter | <timotheecour> some ppl here actually love `defer`, to avoid deeply nested and more verbose try/except |
09:53:29 | Araq | people need to use `=destroy` but ok, we can deprecate that once destructors are battle tested |
09:53:52 | Araq | mratsim: I can do that but it would hide bugs |
09:54:56 | FromGitter | <mratsim> Print a warning in bold, 3 lines before, 3 lines after so that there is a big blank space :P |
09:55:05 | FromGitter | <mratsim> 3 empty lines* |
09:55:51 | Araq | fyi all db_ modules are broken because they mapped 'nil' strings to NULL and nil strings are gone |
09:56:03 | Araq | so there is no way to insert NULL into a database anymore :-) |
09:56:27 | Araq | regexes and pegs have problems too, 'nil' meant "No match" and that's different from an empty match |
09:56:48 | FromGitter | <mratsim> *cough* Options *cough* |
09:56:52 | Araq | it's the biggest breaking change since quite some time |
09:57:21 | FromGitter | <timotheecour> would Options cause any kind of overhead ? |
09:57:30 | FromGitter | <mratsim> didn’t you have this SQL DSL idea that would be hardened against injections with fancy checks. |
09:57:48 | Araq | that's in Ormin |
09:58:06 | FromGitter | <mratsim> @timotheecour I think so but there was some optimisations taken from the now dead “opt" |
09:58:13 | FromGitter | <mratsim> for ref types. |
09:58:16 | Araq | but I'm patching the db_ modules to accept Json too |
10:00:43 | Araq | mratsim: I prefer to store this "optional" information in a side-channel |
10:01:13 | Araq | my 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:13 | FromGitter | <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:38 | FromGitter | <xmonader> I'll be off for national holiday next week and I'd like to have more adventures in with Nim |
10:02:42 | FromGitter | <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:40 | Araq | xmonader: sure and we enjoy hosting guest articles on the webite too |
10:04:10 | FromGitter | <mratsim> I find this kind of repo quite interesting for example: https://github.com/raywenderlich/swift-algorithm-club |
10:04:39 | FromGitter | <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:39 | FromGitter | <mratsim> or this: https://github.com/BaReinhard/Hacktoberfest-Data-Structure-and-Algorithms |
10:05:16 | FromGitter | <xmonader> @Araq thanks ^_^ |
10:05:55 | FromGitter | <xmonader> @mratsim this is super nice! |
10:06:41 | * | GigabytePro13 quit (Remote host closed the connection) |
10:06:43 | FromGitter | <xmonader> btw, how can nimbus be utilized for other blockchains than ethereum ? |
10:09:59 | FromGitter | <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:10 | Araq | Timothee, 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:22 | FromGitter | <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:22 | FromGitter | ... breath. ... [https://gitter.im/nim-lang/Nim?at=5b769fc1a158fd0ea36e3e93] |
10:17:30 | dom96 | Araq: seq[Option[string]]? What? |
10:18:01 | FromGitter | <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:42 | dom96 | Can you match some pattern groups and not others in regex? |
10:19:18 | FromGitter | <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:23 | dom96 | I suppose you can have optional groups |
10:19:47 | FromGitter | <xmonader> @mratsim thanks for the elaborate respones ^_^ |
10:22:26 | FromGitter | <gogolxdong> Does it mean the same with Golang defer? |
10:23:06 | FromGitter | <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:55 | dom96 | Optional[string] is /the/ replacement for `nil` in strings |
10:24:18 | dom96 | `(seq[string], seq[bool])` is just... I don't even |
10:24:40 | dom96 | Anyway, we want to adopt nim-regex into the stdlib, maybe it's time to do that? |
10:25:23 | FromGitter | <timotheecour> ya, it’d also avoid the re vs nre confusion https://xkcd.com/927/ |
10:26:25 | FromGitter | <mratsim> @timotheecour can we even return inline iterators? Or are you talking about returning closure iterators? |
10:27:00 | FromGitter | <timotheecour> returning closure iterators; the overhead should be minimal in proportion to what regex does |
10:27:48 | FromGitter | <gogolxdong> How to wait on spawn procs ? sync() or ^? |
10:28:11 | FromGitter | <mratsim> ^ |
10:28:44 | FromGitter | <xmonader> out of curiosity, were any of you asked to implement kmp in interview? |
10:29:07 | FromGitter | <alehander42> @Araq what's the point of ignoring the second component, that would be buggy |
10:29:30 | FromGitter | <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:46 | FromGitter | <gogolxdong> what does sync() do ? |
10:29:48 | FromGitter | <mratsim> kmp? I never did programming interviews to be honest. I’m not even sure what the point is. |
10:29:49 | FromGitter | <timotheecour> I’d vote for `iterator Option[RegexMatch]` output |
10:30:25 | FromGitter | <gogolxdong> I'm using like this: ⏎ spawn awsDescribeRegions() ⏎ spawn alibabaDescribeRegion() ⏎ spawn tencentDescribeRegion() ⏎ spawn ibmGetAvailableLocations() ... [https://gitter.im/nim-lang/Nim?at=5b76a3c10825690ea2e18974] |
10:30:47 | FromGitter | <alehander42> the side channel idea is nice, but I think Option is better in the regex case |
10:30:59 | FromGitter | <mratsim> you wait but you don’t return anything @gogolxdong |
10:31:45 | FromGitter | <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:52 | FromGitter | <gogolxdong> does work the same with ^ but for no return type? |
10:31:57 | FromGitter | <timotheecour> knuth morris prat; but that’d be a dumb interview question IMO |
10:33:10 | FromGitter | <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:32 | FromGitter | <gogolxdong> It seems stuck after the last proc. |
10:33:49 | dom96 | xmonader: what company asked this? |
10:34:15 | FromGitter | <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:31 | FromGitter | <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:40 | FromGitter | <timotheecour> although what you want here is neural turing machines ... |
10:36:49 | FromGitter | <xmonader> @dom96 not sure if that would be leaking interviews questions of companies policies? |
10:39:08 | Araq | alehander42: 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:50 | FromGitter | <Clyybber> What is the default capacity of a seq? |
10:43:00 | FromGitter | <mratsim> 50? |
10:43:22 | dom96 | Araq: an Option[T] forces a check |
10:43:29 | dom96 | your weird tuple doesn't |
10:45:34 | Araq | that's the point |
10:45:37 | FromGitter | <alehander42> @Araq well, it's about false negatives vs false positives |
10:45:48 | FromGitter | <alehander42> better to unwrap it sometimes even if you know it's always non empty |
10:45:51 | FromGitter | <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:53 | FromGitter | <alehander42> than to change the regex and forget |
10:45:58 | Araq | I don't need the check, I know the patterns better than the type system does |
10:46:13 | FromGitter | <alehander42> and you also make one usecase very hairy |
10:46:24 | FromGitter | <alehander42> because you want to optimize another probably less usual usecase |
10:47:01 | FromGitter | <mratsim> and relevant @Clyybber https://github.com/nim-lang/Nim/issues/8642 |
10:48:08 | FromGitter | <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:12 | FromGitter | <timotheecour> > I know the patterns better than the type system does ⏎ ⏎ what if it’s a runtime pattern? |
10:48:51 | FromGitter | <alehander42> ok, I admit it's not very hairy, but the "force a check is good in general" argument stays |
10:49:04 | FromGitter | <alehander42> also, another thing is that it's cool to have consistent optional api-s |
10:49:20 | FromGitter | <alehander42> if I know that everything that is optional in stdlib is Option[T], it's easy to work with it |
10:49:29 | FromGitter | <timotheecour> ya, that’s what Option is for. |
10:49:30 | FromGitter | <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:31 | FromGitter | <alehander42> if i have to remember that A is some tuple combination |
10:49:33 | FromGitter | <alehander42> B is Option |
10:49:40 | FromGitter | <alehander42> C is return code + something else |
10:49:46 | Araq | runtime patterns already force me to handle the ValueError/RegexError exception |
10:49:48 | FromGitter | <Clyybber> @mratsim I thought so :P |
10:49:50 | FromGitter | <alehander42> that's making life harder |
10:50:42 | FromGitter | <alehander42> and if you want to ignore the optionallity |
10:51:01 | FromGitter | <alehander42> you still can have a very simple generic "unwrap" or something |
10:51:17 | FromGitter | <alehander42> which works with `Option[T]` `seq[Option[T]]` etc |
10:51:31 | FromGitter | <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:37 | Araq | it really doesn't but I don't want to have this conversation again. |
10:51:59 | FromGitter | <alehander42> consistency is underrated |
10:52:30 | Araq | consistency is super overrated and leads to bugs |
10:52:40 | FromGitter | <alehander42> meh |
10:52:43 | FromGitter | <timotheecour> meh also |
10:53:06 | FromGitter | <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:18 | FromGitter | <timotheecour> consistency (where it makes sense) concentrates the bug in 1 place, easier to find / fix (same as refactoring) |
10:53:25 | FromGitter | <alehander42> I mean, it's not a fair thing to say |
10:53:27 | FromGitter | <mratsim> consistency leads to easier learning |
10:54:14 | FromGitter | <mratsim> ah @Clyybber sorry, newSeqOfCap doesn’t zero the memory anymore. |
10:54:38 | FromGitter | <Clyybber> @mratsim I thought so because the implementation of newSeqUninitialized uses newSeqOfCap |
10:54:44 | dom96 | I would even prefer seq[string] rather than this weird tuple |
10:54:46 | FromGitter | <alehander42> ignoring usecase ⏎ ⏎ ```matches = f(regex).unwrap ⏎ ⏎ vs ⏎ ⏎ (matches, _) = f(regex)``` [https://gitter.im/nim-lang/Nim?at=5b76a976e2e48a20b46fb19d] |
10:55:00 | FromGitter | <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:07 | FromGitter | <alehander42> because you don't have the `_` () stuff |
10:55:20 | FromGitter | <mratsim> @Clyybber check this to get the capacity btw: https://github.com/nim-lang/Nim/issues/6403 |
10:55:36 | dom96 | I would prefer "" be used to mean "Nothing for this group" than having a string + bool |
10:56:33 | FromGitter | <timotheecour> also, `matches = f(regex).unwrap` can be used in UFCS chains, but not `(matches, _) = f(regex)` (without some auxiliary project function) |
10:56:51 | FromGitter | <mratsim> so newSeqUnitialized: you can access with array indexing but it contains random values. newSeqOfCqp, memory is reserved but cannot be accessed. |
10:57:21 | FromGitter | <Clyybber> @mratsim So I need to call add, thats what I figured thx |
10:57:25 | FromGitter | <mratsim> with newSeqOfCap you use “add” |
10:57:29 | FromGitter | <Clyybber> yep |
10:57:30 | Araq | that's now an 'unwrap' that unwraps a seq[Option[T]]. You need these liftings everywhere |
10:57:40 | FromGitter | <alehander42> normal usecase ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76aa24157b9d34ef9c96ed] |
10:57:43 | FromGitter | <mratsim> cough *Monad* cough |
10:57:49 | FromGitter | <alehander42> ok @Araq tell me how the second loop is better |
10:57:55 | Araq | and once you have them, there is no problem. except for the terrible performance |
10:58:01 | FromGitter | <alehander42> i in 0 ..< groups.len * |
10:58:02 | FromGitter | <mratsim> normally you use map/flatmap to work with options |
10:58:14 | Araq | and the cognitive overhead. |
10:58:18 | FromGitter | <alehander42> because it's not a seq of tuples, but it's a tuple of seq-s |
10:58:27 | FromGitter | <alehander42> and it's very painful to loop through |
10:58:59 | FromGitter | <alehander42> there is much more cognitive overhead in writing all those indices correctly, come on |
11:00:05 | Araq | name me a single successful library that uses Matrix[Option[float]] instead of Matrix[float] |
11:00:26 | dom96 | Name me a single library that uses (Matrix[float], Matrix[bool]) |
11:00:29 | FromGitter | <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:02 | Araq | by your logic 0 * 4 shouldn't be 0, because 0 shouldn't compile with * |
11:01:44 | Araq | or maybe it should but with an 'unwrap' for the 0, who knows |
11:02:06 | FromGitter | <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:51 | Araq | I 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:17 | dom96 | Just 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:28 | dom96 | With pattern matching the latter will be even better |
11:03:43 | dom96 | How will anyone understand wtf `1` vs. `0` means? |
11:03:51 | Araq | yeah, I just use 'echo(matches[i])', that's the point |
11:04:12 | FromGitter | <alehander42> but the point is that you want the second usecase to also work well |
11:04:21 | FromGitter | <alehander42> otherwise why even providing seq[bool] |
11:04:21 | dom96 | And you can still use that, even with an Option[T] ;) |
11:04:23 | Araq | I 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:04 | FromGitter | <alehander42> so basically, you don't want the overhead of unwrapping the options when ignoring |
11:05:08 | FromGitter | <alehander42> that's the only possible issue |
11:05:29 | FromGitter | <alehander42> and the only pro of the tuple approach |
11:06:24 | FromGitter | <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:50 | Araq | yeah but now try to implement one API in terms of the other |
11:06:50 | dom96 | yeah |
11:07:01 | Araq | and you'll see why my idea is good |
11:07:13 | Araq | but whatever, I don't care enough to fight for this. |
11:07:30 | Araq | I'll end with a remark that I don't use regexes when I care about correctness. :P |
11:07:47 | FromGitter | <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:15 | dom96 | Clyybber: the latter |
11:08:54 | FromGitter | <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:38 | Araq | https://github.com/nim-lang/Nim/pull/8670 that's what consistency brings us, bloat everywhere and for consistency in system.nim |
11:19:18 | Araq | and I'm not blaming the contributor. |
11:19:42 | Araq | this whole consistency thing needs to be rethought. |
11:20:07 | PMunch | Consistency makes the language a whole lot easier to work with though.. |
11:21:47 | dom96 | Araq: What's wrong with that? |
11:22:39 | PMunch | If 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:00 | PMunch | Then you would have all the $ procedures in one place |
11:23:41 | PMunch | Could even make it disable-able by throwing a switch around the include --disableStringification |
11:24:14 | dom96 | no, a lot of stuff in system shouldn't be there |
11:24:16 | dom96 | FFI |
11:24:20 | dom96 | GC_* functions |
11:24:25 | dom96 | memory management functions |
11:24:35 | dom96 | These 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:11 | FromGitter | <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:21 | FromGitter | <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:00 | PMunch | dom96, 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:23 | dom96 | no idea |
11:39:32 | dom96 | Don't see anything wrong with it |
11:39:42 | PMunch | I get a bad gateway 502 error |
11:40:03 | PMunch | I'm just trying to create a simple local-only mock of the playground so I can try out my Nim tour thing |
11:40:19 | PMunch | But I don't know what it responds with |
11:40:44 | dom96 | !eval echo "dead?" |
11:40:47 | NimBot | dead? |
11:40:52 | dom96 | Seems to be working |
11:41:02 | PMunch | That'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:24 | FromGitter | <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:44 | Araq | Nan is just one possibility, there is also zero, negative zero, infinities |
11:54:43 | FromGitter | <alehander42> is there a value of Nim int's that can be safely used as NaN ? |
11:54:55 | Araq | it'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:02 | Araq | and 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:00 | Araq | low(int) should be int's NaN, but isn't. |
11:58:19 | Araq | it's a bad value that has no positive counterpart. |
11:58:28 | FromGitter | <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:52 | Araq | I want to optimize Option[Natural] to use -1 for None |
11:58:59 | FromGitter | <alehander42> exactly |
12:00:35 | PMunch | Is there an actual manual for Jester somewhere? |
12:02:18 | * | montag4512 joined #nim |
12:03:54 | * | echotangoecho joined #nim |
12:03:55 | FromGitter | <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:45 | FromGitter | <alehander42> ah sad, it would've been handy |
12:05:50 | FromGitter | <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:54 | FromGitter | <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:04 | FromGitter | <mratsim> cannot* |
12:07:23 | FromGitter | <mratsim> more info in the tables on the right side of https://en.wikipedia.org/wiki/Two%27s_complement |
12:18:20 | PMunch | Ugh, this CORS thing is driving me nuts.. |
12:22:00 | FromGitter | <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:27 | dom96 | PMunch: the readme :) |
12:29:30 | FromGitter | <mratsim> @Clyyber it is not, it is you promising not to do bad things with the memory pointer, and doing it anyway. |
12:30:05 | FromGitter | <mratsim> use mitems if you want to modify. |
12:31:57 | FromGitter | <Clyybber> @mratsim So essentially it is illegal/undefined behaviour? |
12:32:47 | FromGitter | <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:14 | FromGitter | <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:23 | FromGitter | <mratsim> by bypassing* |
12:36:48 | PMunch | dom96, :( |
12:37:02 | PMunch | The readme doesn't cover everything.. |
12:37:20 | dom96 | alltest.nim is a good source of examples too |
12:37:58 | PMunch | Yeah, but it's a shame to have to go there for examples.. |
12:38:08 | PMunch | Would be nice to have an actual tutorial/manual |
12:41:05 | * | echotangoecho quit (Quit: Lost terminal) |
12:41:23 | * | revi0 joined #nim |
12:42:21 | FromGitter | <Clyybber> @mratsim Ok thanks! |
12:42:59 | * | revi0 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
12:53:31 | PMunch | zacharycarter[m], are you still working on playground? |
13:06:16 | FromGitter | <xmonader> btw are there any updates on the nim survey? when will it be released? |
13:10:55 | dom96 | no idea |
13:13:30 | * | francisl joined #nim |
13:17:22 | FromGitter | <xmonader> wow :D aren't you who is managing that @dom96 ? |
13:17:31 | dom96 | yep :P |
13:18:16 | FromGitter | <xmonader> hahahahahaha it's been almost a month now |
13:19:09 | FromGitter | <xmonader> the guys in rust communties are almost spreading the news of every sneeze someone have |
13:25:45 | FromGitter | <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:45 | FromGitter | ... 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:20 | FromGitter | <imdaveho> It's also the reason I like Clojure and Rich Hickey's rationale of leveraging the JVM -- it's just practical |
13:34:58 | FromGitter | <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:41 | FromGitter | <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:41 | FromGitter | ... place and focuses on trying to build a long lasting language |
13:44:35 | * | ltr__ joined #nim |
13:44:48 | ltr__ | hello |
13:45:49 | FromGitter | <xmonader> is that video available @imdaveho |
13:46:43 | FromGitter | <imdaveho> https://www.youtube.com/watch?v=uGlzRt-FYto&t=0s&index=2&list=PL-cYi7I913S-VgTSUKWhrUkReM_vMNQxG |
13:46:53 | ltr__ | 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:20 | FromGitter | <xmonader> thanks a lot |
13:49:44 | ltr__ | 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:38 | Araq | ltr__: if you're on Linux copy it to /usr/lib |
13:55:50 | * | miran_ joined #nim |
13:57:39 | ltr__ | 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:43 | ltr__ | ? |
13:59:46 | ltr__ | i want a selfcontained binary, sqlite is not really used that much as a dynamic lib |
13:59:58 | federico3 | ltr__: why? |
14:01:34 | ltr__ | i dont want to make the user to install libsqlite3, for example my distro does not have that package (nixos) |
14:02:17 | ltr__ | sqlite3 is designed to be embedded as a single .c file, it usually used that way |
14:02:18 | dom96 | Araq: Any chance {.experimental.} could be made to apply to only the current module? |
14:02:54 | dom96 | Otherwise any library wanting to use experimental features will infect everybody's codebase |
14:02:57 | Araq | dom96: it does that |
14:03:07 | ltr__ | anyways, theres an option to link sqlite3 statically? or in any case to distribute libsqlite3.so with my binary? |
14:03:20 | Araq | ltr__: try --dynlibOverride and add some linking command |
14:03:38 | federico3 | ltr__: https://forum.nim-lang.org/t/1951 |
14:03:50 | dom96 | Araq: oh, was this changed recently? |
14:04:15 | ltr__ | federico3: it does not work with sqlite, it still ask for libsqlite3.so |
14:04:38 | federico3 | ltr__: even with the dynlib override flag? |
14:04:43 | ltr__ | yes |
14:04:51 | FromGitter | <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:46 | FromGitter | <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:58 | dom96 | ltr_: it's not just `--dynlibOverride` you need to specify --dynlibOverride:db_sqlite (I think?) |
14:06:01 | FromGitter | <mratsim> nice flash @retsyo |
14:06:08 | dom96 | https://nim-lang.org/docs/nimc.html#dynliboverride |
14:06:13 | FromGitter | <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:39 | FromGitter | <retsyo> sorry, I use gitter seldom |
14:06:47 | FromGitter | <mratsim> I’m joking ;) |
14:07:08 | Araq | dom96: no but it's complicated, it depends on the .experimental feature |
14:07:36 | Araq | for example, if concept were under .experimental |
14:07:47 | Araq | you can only declare concepts with .experimental |
14:07:55 | Araq | but you can use them everywhere |
14:08:10 | dom96 | Araq: That's bad |
14:08:32 | Araq | usually it's connected with the declaration |
14:08:59 | FromGitter | <mratsim> @ltr this is my code for static linking: https://github.com/mratsim/Arraymancer/blob/master/nim.cfg#L72-L82 |
14:12:05 | Araq | dom96: the newer experimental stuff checks for usages |
14:12:10 | ltr__ | ok ill give that a try |
14:16:24 | ltr__ | that is the same that passing the arguments in the command line i guess |
14:18:15 | * | atk3 joined #nim |
14:20:16 | FromGitter | <tim-st> @retsyo Do you want to split your string by words? |
14:21:02 | FromGitter | <retsyo> no, I want to find characters based on regular expression |
14:21:34 | * | ninsei joined #nim |
14:22:07 | ltr__ | FromGitter: that worked!, thanks you very much |
14:22:08 | FromGitter | ltr__, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim |
14:22:09 | FromGitter | <tim-st> you can also input characters by unicocode codepoint I think with someting like `\u{...}` maybe that works? |
14:22:33 | ltr__ | mratsim : it worked! |
14:22:39 | ltr__ | thanks you |
14:23:06 | ltr__ | now sqlite3 compiles statically, another question, can i compile .c files along with nim files with nimble? |
14:24:00 | FromGitter | <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:55 | FromGitter | <tim-st> you use `for rune in str.runes: var hex = rune.ord.toHex` then `\X{hexStr}` |
14:25:00 | FromGitter | <tim-st> I imagine that could work |
14:26:01 | FromGitter | <tim-st> maybe also the direct ord number works |
14:28:19 | FromGitter | <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:18 | FromGitter | <retsyo> let me try. I am new to nim |
14:29:30 | FromGitter | <tim-st> sure |
14:31:12 | * | ninsei quit (Ping timeout: 265 seconds) |
14:31:18 | dom96 | ltr_: so what was it that you were missing? |
14:31:25 | dom96 | how did you get it to statically link? |
14:32:31 | ltr__ | the way i compiled sqlite3 |
14:32:36 | * | PMunch quit (Quit: Leaving) |
14:32:48 | ltr__ | it wasnt a static lib, just 'ar' it and it worked |
14:33:04 | ltr__ | my distro does not have libsqlite3, dont know why |
14:33:39 | ltr__ | it just have a debug version of it |
14:34:01 | ltr__ | can i compile c files with nimble? |
14:34:22 | ltr__ | 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:12 | dom96 | right... but did you just use --dynlibOverride to get it working with Nim? |
14:39:28 | dom96 | You can use the {.compile.} pragma for that |
14:39:54 | FromGitter | <retsyo> @tim-st , where can I find the usage of \u \x? |
14:40:52 | FromGitter | <tim-st> I think it's normal pcre syntax |
14:41:54 | FromGitter | <retsyo> I misunderstood it is in nim's string ;) |
14:42:53 | FromGitter | <data-man> @ltr: E.g. https://github.com/NimCompression/nimsnappyc/blob/master/nimsnappyc/snappyc.nim |
14:42:57 | FromGitter | <tim-st> ok, I cannot find a good example on the nim page though, maybe just try with regex tester |
14:43:03 | FromGitter | <mratsim> @ltr, yes you can compile/include C file in a nimble project. Example: https://github.com/status-im/nim-decimal |
14:43:06 | FromGitter | <tim-st> https://regex101.com/ |
14:44:18 | ltr__ | 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:40 | FromGitter | <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:17 | FromGitter | <tim-st> string is unicode |
14:56:07 | FromGitter | <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:15 | FromGitter | <tim-st> e.g. database? |
14:57:00 | dom96 | tim-st: It will be opened once AFAIK. But test it to be sure. |
14:57:47 | FromGitter | <tim-st> ok, thanks, because I saw there is the `once` template |
14:58:52 | FromGitter | <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:22 | FromGitter | <tim-st> use `var me = a.runeAt(0)` |
15:00:02 | FromGitter | <tim-st> or `var me = a.toRunes.len` |
15:03:02 | FromGitter | <tim-st> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76e3a6087c4c20b5f6ff25] |
15:03:57 | FromGitter | <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:34 | FromGitter | <tim-st> yes, if you really want to use regex you have to search by unicode not by `.` |
15:04:57 | FromGitter | <tim-st> `.` searches for a single 8-bit char, you want `\w` w is basically the same as Rune |
15:05:27 | FromGitter | <tim-st> So I said test your regex on the website I posted above and you will find a working regex |
15:07:53 | FromGitter | <retsyo> thanks. it is time for bed. I will check it later |
15:08:20 | FromGitter | <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:02 | FromGitter | <retsyo> (https://files.gitter.im/nim-lang/Nim/5Td9/image.png) |
15:14:10 | FromGitter | <data-man> @retsyo: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76e642a158fd0ea36ff662] |
15:25:21 | FromGitter | <gogolxdong> How to debug ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b76e8e1157b9d34ef9e2836] |
15:29:23 | FromGitter | <Varriount> @gogolxdong Look at publicresource.nim(27) |
15:32:15 | FromGitter | <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:37 | FromGitter | <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:57 | FromGitter | <Clyybber> How would I read a file at compile time and store the buffer in a seq to be used at runtime? |
16:22:24 | dom96 | const file = staticRead("filename") |
16:22:34 | dom96 | You can also create a proc that turns that into a seq or whatever you want |
16:23:27 | FromGitter | <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:04 | FromGitter | <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:05 | shashlick | any ideas why my libui wrapper test code exits with -1073741511 |
17:05:53 | leorize | sigsegv? |
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:25 | FromGitter | <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:15 | FromGitter | <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:35 | FromGitter | <Clyybber> dom96 Thank you! |
19:11:30 | * | Warped26 joined #nim |
19:13:04 | * | Warped26 quit (Remote host closed the connection) |
19:15:10 | FromGitter | <Clyybber> Why do we have gorge and slurp as aliases for staticExec and staticRead? |
19:15:27 | FromGitter | <Clyybber> It doesn't bother me I just find it funny |
19:19:27 | shashlick | @mratsim: my compilation actually succeeds and an EXE is created |
19:19:37 | shashlick | it'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:09 | livcd | shashlick: 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:23 | FromGitter | <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:10 | shashlick | livcd: I am wrapping libui using nimgen - compiling all source into the generated binary - it builds fine but doesn't run correctly |
19:42:48 | FromGitter | <ivanflorentin> ```template `!=`*(x, y: untyped): untyped = ⏎ ## unequals operator. This is a shorthand for ``not (x == y)``. ⏎ not (x == y)``` |
19:42:53 | shashlick | here's a gist: https://gist.github.com/genotrance/2839cb49b3855c91aa835e4379ac73a5 |
19:43:13 | shashlick | need 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:10 | FromGitter | <mratsim> @ivanflorentin do you have a small example to reproduce that? |
19:54:29 | * | Guest68713 quit (Remote host closed the connection) |
19:55:08 | FromGitter | <ivanflorentin> ill make one, i tested with 2 project thar were compiling previously |
20:00:38 | FromGitter | <ivanflorentin> the problem is when comparing to nil: ```if a != nil``` |
20:00:39 | zachk | was nimble around in 0.17? |
20:04:51 | FromGitter | <mratsim> @zachk, it’s much older |
20:06:19 | FromGitter | <mratsim> @ivanflorentin, is a a seq or string? |
20:07:45 | FromGitter | <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:20 | FromGitter | <ivanflorentin> @mratsim it is an element in a row returned by db_postgres |
20:11:59 | FromGitter | <ivanflorentin> i will check and adapt, thenks for the tips |
20:12:15 | FromGitter | <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:12 | FromGitter | <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:22 | Araq | sorry... what's the problem? |
20:33:37 | FromGitter | <timotheecour> related question @araq: how will we make `var s = “”` not allocate in the future? what’s the rough plan/idea ? |
20:35:50 | FromGitter | <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:07 | FromGitter | <mratsim> https://github.com/nim-lang/Nim/issues/7743 |
20:36:55 | FromGitter | <mratsim> I’d like to work on it because, it impacts all benchmarks with seq (and string?) result value. |
20:43:23 | FromGitter | <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:49 | Araq | huh? It produces NimString s = NULL; roughly. |
20:44:01 | Araq | already in devel, what's hard about it |
20:44:55 | FromGitter | <timotheecour> so “var s=“”` doesn’t allocate in devel currently? |
20:45:12 | Araq | check 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:54 | FromGitter | <treeform> I have added word clipping and alignment to my pure-nim typography library: |
21:09:02 | FromGitter | <treeform> (https://files.gitter.im/nim-lang/Nim/NDUg/Screen-Shot-2018-08-17-at-2.07.50-PM.png) |
21:09:22 | FromGitter | <treeform> Any one doing any UI projects in nim and needs text? |
21:10:35 | FromGitter | <Clyybber> Me possibly, for my game engine |
21:11:09 | FromGitter | <treeform> Cool what does your game engine use? |
21:11:19 | FromGitter | <Clyybber> vulkan |
21:11:23 | FromGitter | <treeform> nice |
21:11:43 | FromGitter | <treeform> Do you want to support CJK text? |
21:12:04 | FromGitter | <Clyybber> Perhaps |
21:12:14 | * | vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:12:24 | FromGitter | <treeform> If you don't support them you can precompute all glyphs ahead of time. |
21:12:28 | FromGitter | <Clyybber> I dont really know, its not really needed, since I dont plan on translating |
21:12:35 | FromGitter | <Clyybber> Oh thats nice |
21:12:38 | FromGitter | <treeform> If you want to support CJK you have do it at runtime. |
21:12:47 | FromGitter | <Clyybber> Why? |
21:13:04 | FromGitter | <treeform> there are too many CJK characters to precompute |
21:13:08 | FromGitter | <Clyybber> Oh |
21:13:37 | FromGitter | <treeform> the character tables might dwarf your other game assets |
21:13:47 | FromGitter | <treeform> the CJK font from google is 1.5GB |
21:14:11 | FromGitter | <treeform> I found an older font though, that I use, only 20MB |
21:14:20 | FromGitter | <treeform> usually fonts are like 100k |
21:14:21 | FromGitter | <Clyybber> Ah, yes, on my system my CJK font uses 2,4 GB |
21:15:08 | FromGitter | <treeform> https://github.com/treeform/typography/blob/master/tests/ch.png |
21:15:16 | FromGitter | <Clyybber> Btw, in your readme theres a typo: It should say `rely` instead of `relay` |
21:15:22 | FromGitter | <treeform> I can do CJK though its just you kind of have to plan ahead. |
21:15:31 | FromGitter | <treeform> thanks! |
21:15:37 | Araq | treeform: which backend(s) do you support? |
21:16:33 | FromGitter | <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:47 | FromGitter | <treeform> I have a test backend that just draws to pngs. |
21:17:16 | FromGitter | <treeform> You basically need to re implement this in the engine for your choice: |
21:17:17 | FromGitter | <treeform> https://github.com/treeform/typography/blob/master/src/typography/layout.nim#L173 |
21:17:37 | FromGitter | <treeform> Its only 11 lines so it should not be super hard? |
21:18:12 | FromGitter | <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:27 | FromGitter | <treeform> I am trying to keep this library a pure library. |
21:18:39 | FromGitter | <Clyybber> Which I think is very nice! |
21:18:49 | Araq | I'm asking how to make this work with SDL2 |
21:19:00 | FromGitter | <Clyybber> I think render it to a texture |
21:19:00 | FromGitter | <treeform> oh probably trivial |
21:19:04 | FromGitter | <Clyybber> and then draw it |
21:19:12 | FromGitter | <treeform> just replace my blit with their blit ... |
21:19:23 | Araq | I don't mind writing code, but I need to know what to write ;-) |
21:19:54 | FromGitter | <treeform> https://github.com/treeform/typography/blob/master/src/typography/layout.nim#L179 |
21:20:05 | FromGitter | <treeform> on this line just take my image and turn it into SDL surface |
21:20:17 | FromGitter | <treeform> then on the next line blit with SDL blit to your own SDL serface |
21:20:22 | FromGitter | <treeform> and thats all the changes you need? |
21:20:35 | FromGitter | <treeform> If its slow you might want to cache the SDL surfaces |
21:20:42 | FromGitter | <timotheecour> araq what’s the equivalent of C++’s std::string ’s.data()’ to get address of 1st element of a string? |
21:20:52 | Araq | addr s[0] |
21:21:11 | FromGitter | <timotheecour> well that doesn’t work with `s=“”` I tried |
21:21:31 | FromGitter | <treeform> "" does not have a char 0, so it has not address. |
21:21:43 | Araq | yup, you need to setLen it first |
21:21:47 | FromGitter | <timotheecour> wait so `“”` is not null terminated? |
21:21:56 | FromGitter | <Clyybber> Nim strings are not null terminated |
21:22:00 | FromGitter | <Clyybber> afaik |
21:22:05 | dom96 | They are |
21:22:13 | FromGitter | <timotheecour> Huh?? i thought they were |
21:22:21 | FromGitter | <treeform> but "" is new type of nil string |
21:22:22 | FromGitter | <Clyybber> I may be wrong... |
21:22:36 | FromGitter | <treeform> in C you NULL is not a valid string but now in nim it is. |
21:22:54 | * | pilottage joined #nim |
21:23:27 | Araq | well yes, "" is not zero terminated, but cstring(x) knows about this edge case |
21:23:45 | * | vosper joined #nim |
21:23:45 | FromGitter | <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:00 | FromGitter | <treeform> you should always use cstring(x) for that |
21:24:13 | Araq | as I said, the cstring conversion knows about it |
21:24:17 | FromGitter | <treeform> you should not use addr x[0] |
21:24:33 | Araq | and yes the implicit cstring conversions know this too |
21:24:40 | dom96 | treeform: why not? |
21:25:18 | FromGitter | <Clyybber> @treeform It is needed for passing seqs as C arrays |
21:25:20 | FromGitter | <timotheecour> @dom96, `addr x[0]` throws for `“”` |
21:25:33 | FromGitter | <treeform> while cstring(x) does not |
21:25:47 | FromGitter | <treeform> Araq, do you need help converting my image to SDL surface? |
21:26:02 | Araq | not now, I'll come back to you |
21:26:03 | dom96 | oh, because it's now mapped to `nil`? |
21:26:20 | FromGitter | <treeform> Araq, my image format is really simple https://github.com/treeform/flippy/blob/master/src/flippy.nim#L7 |
21:26:21 | Araq | yeah, and because accessing the \0 is now invalid |
21:26:28 | FromGitter | <treeform> just grab width, height and data. |
21:26:38 | FromGitter | <timotheecour> in devel, `var s:string` and `var s=“”` behave differently. |
21:27:43 | FromGitter | <treeform> I think it should be nil now? |
21:27:52 | FromGitter | <timotheecour> nil disappeared for string |
21:28:08 | FromGitter | <treeform> well nil is "" so "" is the default? |
21:29:07 | * | FromDiscord joined #nim |
21:29:26 | FromGitter | <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:29 | FromGitter | <Varriount> zacharycarter: Do you still need me? |
21:29:36 | * | kaniini_ joined #nim |
21:29:41 | dom96 | That's gonna be a fun gotcha :/ |
21:29:47 | FromGitter | <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:16 | FromGitter | <Clyybber> @treeform Thats what I figured |
21:30:32 | FromGitter | <Clyybber> My game is 2D though, but that shouldn't matter |
21:31:04 | FromGitter | <Clyybber> @timotheecour How do they behave differently? |
21:31:16 | * | pilottage quit (Ping timeout: 268 seconds) |
21:32:46 | FromGitter | <treeform> @Clyybber it does matter a little bit. It just makes it easier. |
21:33:11 | FromGitter | <Clyybber> Vulkan doesn't have the concept of 2D |
21:33:12 | FromGitter | <treeform> If you want to render text in 3d world, you have to use fancy texture sampling thingy. |
21:33:17 | FromGitter | <Clyybber> Ah |
21:33:20 | FromGitter | <treeform> I don |
21:33:26 | FromGitter | <treeform> I don't support that yet. |
21:34:02 | FromGitter | <Clyybber> Do you mean something like mipmapping? |
21:34:13 | FromGitter | <Clyybber> Or anitaliasing? |
21:34:29 | FromGitter | <Clyybber> Or any other magic? |
21:34:31 | FromGitter | <treeform> This: https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf |
21:34:38 | FromGitter | <treeform> "Other magic" |
21:34:52 | FromGitter | <treeform> 2d does not need this though |
21:34:56 | FromGitter | <treeform> might even make it look worse |
21:34:58 | FromGitter | <Clyybber> Ah distant fields |
21:35:00 | FromGitter | <timotheecour> `let s=“”` calls `rawNewStringNoInit` (which I’m assuming allocates); `var s:string` doesn’t |
21:35:05 | FromGitter | <Clyybber> I read about that some time ago |
21:35:56 | FromGitter | <Clyybber> @timotheecour So the difference should be in their capacity? |
21:36:18 | FromGitter | <Clyybber> Nvrmd now i get it |
21:36:21 | FromGitter | <mratsim> no, allocation is delayed in the second case |
21:36:21 | FromGitter | <timotheecour> well, allocation vs no allocation is a big deal. |
21:37:11 | FromGitter | <Clyybber> Being able to enforce allocation through `let s=""` could be useful though |
21:37:12 | FromGitter | <timotheecour> Honestly, if `string` we just pointer + length (with low level ways to expose), there would be no edge cases, efficiency etc |
21:37:24 | FromGitter | <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:30 | FromGitter | <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:37 | FromGitter | <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:19 | FromGitter | <Clyybber> Looks like 0.19 will have to wait a little bit |
21:41:23 | FromGitter | <mratsim> but I think this should be tackled after or at the same time as destructors, and no-GC string/seq |
21:42:19 | AlexMax | hey zacharycarter[m] - how stable are your nuklear nim bindings |
21:42:20 | FromGitter | <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:23 | AlexMax | and do you take pull requests |
21:43:08 | FromGitter | <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:33 | FromGitter | <timotheecour> cast? |
21:43:47 | FromGitter | <Clyybber> Can I cast a string to uint32? |
21:43:51 | FromGitter | <Clyybber> Ill have to try |
21:43:53 | FromGitter | <Clyybber> that |
21:44:11 | * | MeiR8 quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
21:44:49 | FromGitter | <krux02> no you have to parse it |
21:45:06 | * | echotangoecho joined #nim |
21:45:07 | FromGitter | <krux02> you have to parse an integer and cast that integer |
21:45:13 | FromGitter | <kayabaNerve> You should be able to cast a char. |
21:45:31 | FromGitter | <Clyybber> Casting a char will give me only a fourth of an uint32 |
21:45:43 | FromGitter | <kayabaNerve> Just commenting if you don't care about "100" -> 100 but rather the bits of "100" -> some number |
21:45:46 | FromGitter | <Clyybber> So how would I bit-concatenate those casted chars? |
21:45:58 | FromGitter | <krux02> you can cast the seq |
21:46:00 | FromGitter | <Clyybber> I need the bits |
21:46:13 | FromGitter | <krux02> castseq[uint32 (charseq) |
21:46:14 | FromGitter | <Clyybber> @krux02 Ok |
21:46:24 | FromGitter | <Clyybber> Thank you, will try that |
21:46:27 | FromGitter | <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:33 | FromGitter | <treeform> @CLyybber this is how i decode strings into glyphs: |
21:48:47 | FromGitter | <treeform> https://github.com/treeform/typography/blob/master/src/typography/layout.nim#L78 |
21:48:53 | FromGitter | <treeform> Rune is basically a uint32 |
21:49:22 | FromGitter | <treeform> it is: |
21:49:22 | FromGitter | <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:31 | FromGitter | <treeform> nim strings are all in utf8, which is good, but you want utf32, so it requires decoding to utf32 |
21:53:48 | FromGitter | <treeform> its very similar to compression. |
21:53:52 | FromGitter | <Clyybber> I actually dont care about the text itself, the file im reading is binary |
21:53:54 | FromGitter | <Clyybber> SPIRV |
21:54:07 | FromGitter | <treeform> oh why do you need uint32??? |
21:54:16 | FromGitter | <Clyybber> For vulkan |
21:54:29 | FromGitter | <treeform> why does that need uint32? |
21:54:34 | FromGitter | <treeform> cast it then |
21:54:39 | FromGitter | <Clyybber> I did |
21:54:42 | FromGitter | <Clyybber> and it works |
21:54:45 | FromGitter | <treeform> great |
21:54:57 | FromGitter | <treeform> really strange it wants uint32, not uint8 or char |
21:54:58 | FromGitter | <Clyybber> I asked because I thought it would be more complicated |
21:55:24 | FromGitter | <krux02> the casting is not perfect though |
21:55:26 | FromGitter | <mratsim> probably better to cast to ptr UncheckedArray than casting to seq to avoid wrong length issue |
21:55:49 | FromGitter | <Clyybber> Cant I just use setLen? |
21:55:57 | * | captainkraft quit (Ping timeout: 240 seconds) |
21:55:59 | FromGitter | <krux02> the casted seq has wrong length, and you don't deal with byte order |
21:56:02 | FromGitter | <mratsim> setLen might move the data |
21:56:05 | FromGitter | <krux02> (endian) |
21:56:06 | FromGitter | <Clyybber> setLen(originalstringlenth/4) |
21:56:11 | FromGitter | <Clyybber> Oh ok |
21:56:45 | FromGitter | <krux02> when I think about it, casting is a horrible idea |
21:56:50 | FromGitter | <krux02> but yea, it works |
21:56:55 | FromGitter | <krux02> :shrug: |
21:57:15 | FromGitter | <Clyybber> It seems like magic to me that castseq[uint32 (somestring) works |
21:57:34 | FromGitter | <mratsim> ^ use ptr UncheckedArray, you can combine that with littleEndian32/bigEndian32 to deal with endianness as well |
21:58:10 | FromGitter | <mratsim> `castptr UncheckArray[uint32 (somestring)` is probably better to avoid length issues. |
21:58:32 | FromGitter | <mratsim> usability-wise it supports indexing like array/seq. |
21:58:42 | FromGitter | <Clyybber> Why do I have to worry about endianness? |
21:58:45 | FromGitter | <krux02> ``castptr UncheckArray[uint32 (somestring[0].addr)`` |
21:59:03 | FromGitter | <krux02> @Clyybber because endianness sucks |
21:59:04 | FromGitter | <mratsim> and you’re sure data won’t be moved somewhere, and there is no GC issues that can arise |
21:59:19 | FromGitter | <mratsim> sorry yes forgot about addr |
21:59:35 | FromGitter | <Clyybber> Im doing all of that in a static block if that matters. |
21:59:39 | FromGitter | <Clyybber> Oh, |
21:59:53 | FromGitter | <krux02> static block? |
21:59:56 | FromGitter | <Clyybber> I think that will matter, since casting is only allowed between same sizes in the VM |
22:00:04 | FromGitter | <Clyybber> @krux02 Yes |
22:00:15 | FromGitter | <mratsim> bigEndian 0xAABBCCDD = littleEndian 0xDDCCBBAA |
22:00:15 | FromGitter | <Clyybber> `static: |
22:00:25 | FromGitter | <krux02> at compile type all values are stored in heap objects |
22:00:32 | FromGitter | <krux02> so not very memory efficient |
22:00:35 | FromGitter | <mratsim> ah, in nimvm you can’t use ptr UncheckArray |
22:00:41 | FromGitter | <Clyybber> Yeah |
22:01:09 | FromGitter | <krux02> what do you do exactly? |
22:01:13 | FromGitter | <krux02> at compile time? |
22:01:29 | FromGitter | <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:57 | FromGitter | <mratsim> you can only cast int at compile-time |
22:02:01 | FromGitter | <mratsim> not seq |
22:02:08 | FromGitter | <Clyybber> @krux02 I read SPIRV binary code and want to store it in a seq[uint32] for use in runtime |
22:02:30 | FromGitter | <krux02> I don't recommend to do it like that |
22:02:40 | FromGitter | <mratsim> store it in a string and use a ptr UncheckedArray at runtime? |
22:02:57 | FromGitter | <krux02> creating a seq[uint32] has a lot of overhead |
22:03:08 | FromGitter | <krux02> seq[uint32] is not a flat data structure on the vm |
22:03:23 | FromGitter | <mratsim> he is using staticRead I suppose |
22:03:24 | FromGitter | <krux02> you should better try to link the binary in the program |
22:03:30 | FromGitter | <Clyybber> @mratsim Yes |
22:03:36 | FromGitter | <krux02> in gcc you can link data in your program |
22:03:47 | FromGitter | <Clyybber> How would I access that data then? |
22:04:28 | FromGitter | <Clyybber> So does a vm seq[] get converted to a flat seq[] after compilation/at runtime? |
22:04:39 | FromGitter | <mratsim> no to an array |
22:04:50 | FromGitter | <mratsim> but a string becomes a string literal |
22:05:00 | * | vosper quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:05:02 | FromGitter | <Clyybber> Ok |
22:05:04 | FromDiscord | <exelotl> oh the bridge is back! |
22:05:04 | FromGitter | <mratsim> I think you can take its address. |
22:05:14 | FromGitter | <Clyybber> Hello |
22:05:31 | FromGitter | <Clyybber> @mratsim So your approach would be the simplest one I suppose |
22:05:31 | FromDiscord | <exelotl> yo |
22:06:08 | FromGitter | <mratsim> you will need to use `mystring[0].unsafeAddr` |
22:06:31 | FromGitter | <Clyybber> Because I cant cast a const string? |
22:06:39 | FromGitter | <mratsim> or you might have to store it in a “var" |
22:06:47 | * | vosper joined #nim |
22:07:41 | FromGitter | <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:57 | FromGitter | <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:22 | FromGitter | <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:27 | FromGitter | <Clyybber> @mratsim Ok that should work. @krux What would be the advantage of your approach using gcc? |
22:09:28 | FromGitter | <krux02> that is the best you can do. |
22:10:10 | FromGitter | <Clyybber> Ok thank you |
22:10:13 | FromGitter | <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:29 | FromGitter | <krux02> it just copies a binary blob into the executable and you can get the address of it. |
22:11:17 | FromGitter | <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:46 | FromGitter | <Clyybber> So the pure nim way is basically doing the same thing, but I need to cast a little bit at runtime? |
22:11:58 | FromGitter | <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:41 | FromGitter | <krux02> with binary files, this casting a little bit at runtime can really be a lot of cost at compile time |
22:12:51 | FromGitter | <Clyybber> How so? |
22:13:05 | FromGitter | <krux02> binary files can get big without you knowing of it. |
22:13:38 | FromGitter | <Clyybber> Yep, I might have to try compiling the shaders at runtime |
22:13:54 | FromGitter | <Clyybber> well ill see what works better. |
22:14:56 | FromGitter | <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:09 | FromGitter | <krux02> vs a simple fast copy into the data section |
22:15:25 | FromGitter | <krux02> but I have to go |
22:15:42 | FromGitter | <Clyybber> Good bye and thank you |
22:16:10 | FromGitter | <Clyybber> Would casting to a string to a ptr uint32 be simpler? |
22:16:39 | FromGitter | <Clyybber> @mratsim Isn't a uncheckedArray[uint32] basically the same as a ptr uint32 with a length? |
22:16:40 | Araq | how would a len, ptr pair help in accessing the first element? |
22:16:52 | * | pwntus joined #nim |
22:17:02 | FromGitter | <Clyybber> I need the length |
22:17:04 | Araq | it wouldn't. but you're getting this string representation with --gc:destructors |
22:18:12 | FromGitter | <mratsim> @Clyybber, no it’s ptr uint32 with array indexing |
22:18:18 | Araq | you want to access s[0], you give s a lenght that is not zero, seems fair to me |
22:18:24 | FromGitter | <mratsim> len = mystring.len * 4 |
22:18:40 | FromGitter | <Clyybber> / 4 |
22:18:41 | FromGitter | <Clyybber> ? |
22:18:45 | FromGitter | <mratsim> right |
22:18:47 | FromGitter | <mratsim> yes |
22:18:51 | FromGitter | <mratsim> div 4 |
22:18:59 | FromGitter | <mratsim> you can make it a const for efficiency |
22:19:22 | FromGitter | <Clyybber> Wouldn't that invoke the VM? |
22:19:29 | FromGitter | <Clyybber> And make the cast impossible? |
22:19:39 | FromGitter | <Clyybber> Or do you mean the length field only? |
22:19:41 | FromGitter | <mratsim> yes and no |
22:19:48 | FromGitter | <mratsim> yes length field only |
22:19:55 | FromGitter | <Clyybber> Ah, ok |
22:21:48 | FromGitter | <Clyybber> Araq I think timotheecour meant a ptr pair would help with the difference between var somestring = "" and var somestring: string |
22:23:18 | FromGitter | <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:16 | FromGitter | <Clyybber> Ugly code is alright, Im coming from C |
22:24:20 | FromGitter | <Clyybber> :P |
22:24:44 | FromGitter | <mratsim> C is OK, C++ is >—> |
22:25:34 | FromGitter | <mratsim> namespace::doSmth<int8>(a, b){ … }; |
22:26:48 | FromGitter | <Clyybber> modern C++ is ok |
22:26:53 | FromGitter | <Clyybber> but C rules |
22:27:03 | FromGitter | <Clyybber> Do what you want cuz a pirate is free |
22:27:18 | FromGitter | <Clyybber> *a caster is free |
22:29:13 | shashlick | for some reason, my 32-bit program is linking to the wrong comctl32.dll in the c:\windows\winsxs folder |
22:31:37 | FromGitter | <Clyybber> since `static:` was changed to introduce a new scope, I cant have a global static var anymore |
22:32:13 | FromGitter | <mratsim> var foo{.compileTime.} = bar() |
22:32:31 | FromGitter | <Clyybber> oh didn't know about compileTime pragma |
22:32:34 | FromGitter | <Clyybber> thanks |
22:32:56 | FromGitter | <mratsim> example: https://github.com/status-im/nimbus/blob/4b5eada3222fbfa5780602b42ad27816990aca4d/nimbus/vm/interpreter_dispatch.nim#L18 |
22:33:45 | FromGitter | <mratsim> I think it was added to variable to replace the static block? I asked the same question at the time. |
22:36:59 | FromGitter | <Clyybber> And then to use them at runtime I would just do `const cfoo = foo`? |
22:40:26 | * | captainkraft joined #nim |
22:44:45 | FromGitter | <mratsim> good question, I don’t know |
22:48:03 | FromGitter | <Clyybber> Yep this works. |
22:50:16 | * | tigrmesh7 joined #nim |
22:50:40 | FromGitter | <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:46 | zachk | how 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:52 | FromGitter | <Clyybber> !eval echo "does this work?" |
22:52:54 | NimBot | does this work? |
22:53:03 | FromGitter | <Clyybber> Cool |
22:54:44 | Araq | clybber 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:36 | FromGitter | <Clyybber> Ok |
23:02:21 | FromGitter | <Clyybber> @mratsim Im getting expression cannot be converted to UncheckedArray[system.uint32] |
23:03:01 | FromGitter | <Clyybber> I cannot cast a string to UncheckedArray[uint32] and neither to UncheckedArray[char] |
23:03:04 | * | pwntus joined #nim |
23:03:44 | FromGitter | <Clyybber> Casting to a seq[uint32] works |
23:08:52 | FromGitter | <Clyybber> So I can't actually cast a `ptr sometype` to an `UncheckedArray[sometype]`? |
23:09:56 | FromGitter | <krux02> you cast to ``ptr uncheckedArray[sometype]`` |
23:18:58 | AlexMax | oof, 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:04 | FromGitter | <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:26 | FromGitter | <Clyybber> Or is that repr not being able to deal with UncheckedArray? |
23:35:44 | * | Taylor15 quit (Ping timeout: 272 seconds) |
23:37:46 | FromGitter | <Clyybber> Nvrmind, Im actually dumb |
23:41:49 | pigmej | Hmm, When should be await and when asyncCheck used? |
23:42:06 | pigmej | I struggle to see a difference |
23:48:33 | * | xet7 quit (Quit: Leaving) |