00:00:13 | FromDiscord | <awr> as far as i'm aware |
00:03:50 | * | rockcavera quit (Remote host closed the connection) |
00:04:05 | * | Sentreen quit (Ping timeout: 240 seconds) |
00:05:04 | FromGitter | <data-man> Some useful links :) ⏎ https://github.com/MicrosoftDocs/winrt-api ⏎ https://github.com/Microsoft/cppwinrt |
00:06:12 | FromDiscord | <awr> there may be some overlap with win32 but a lot of the stuff is removed |
00:08:49 | FromDiscord | <awr> like, for example, i don't think you can use VirtualAlloc() anymore in WinRT, but instead its like VirtualAllocFromApp() |
00:09:57 | * | arecaceae quit (Remote host closed the connection) |
00:10:21 | * | arecaceae joined #nim |
00:10:41 | FromDiscord | <awr> there's lots of weird other things too |
00:11:26 | FromDiscord | <awr> e.g. i don't think you can do arbitrary file I/O anywhere unless its user-mediated with a dialog thing that WinRT provides |
00:15:05 | FromGitter | <data-man> sqlite3.c have a lot a stuff related to WinRT |
00:17:27 | * | Sentreen joined #nim |
00:28:54 | PMunch | What does --opt:none do? |
00:39:14 | FromGitter | <data-man> @PMunch: After checking projectName.json I assume, that default gcc's options. But I can be wrong. :) |
00:40:33 | * | smt` quit (Ping timeout: 248 seconds) |
00:41:15 | PMunch | Hmm, okay |
00:41:25 | PMunch | And --opt:speed is -O3 or something like that? |
00:42:59 | FromGitter | <data-man> -O3 -fno-strict-aliasing for me |
00:45:04 | PMunch | Right |
01:00:25 | FromGitter | <data-man> @PMunch: Try experimenting with ```-Ofast``` and ```-faggressive-loop-optimizations``` ⏎ https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Optimize-Options.html |
01:15:58 | PMunch | What is gc:regions? |
01:17:47 | FromGitter | <data-man> When is defined then uses https://github.com/nim-lang/Nim/blob/devel/lib/system/gc_regions.nim |
01:19:10 | FromGitter | <Varriount> Araq: Ah, thanks for the heads up. |
01:19:42 | FromGitter | <Varriount> Do you have any other comments on that code? |
01:20:49 | FromGitter | <data-man> @Varriount: Which code? I want to see. :) |
01:21:09 | PMunch | Hmm, it uses a lot of memory.. |
01:23:16 | FromGitter | <Varriount> @data-man https://gist.github.com/Varriount/edfaf064fa17658f2d88c1d740a7070b |
01:23:47 | FromGitter | <Varriount> @data-man it's the http query generation code for the AWS API |
01:23:56 | FromGitter | <data-man> Thanks! |
01:24:15 | * | endragor joined #nim |
01:24:39 | FromGitter | <Varriount> The most nowhere noteworthy thing about it is that it uses toOpenArray extensively to avoid string copying |
01:26:25 | FromGitter | <Varriount> Also, rather than using sequence's of strings, it uses single, concatenated strings and sequences of objects |
01:30:25 | FromGitter | <data-man> You can get cmp from memfiles `==` |
01:35:26 | Araq | https://github.com/Araq/packedjson btw help me with my awesome project |
01:39:28 | FromGitter | <data-man> @Araq what you need? |
01:40:00 | Araq | the []= accessor for objects needs to be implemented |
01:40:11 | Araq | and testing, testing, testing and then more testing |
01:40:36 | * | FuntDobra joined #nim |
01:40:52 | FromGitter | <data-man> It isn't important thing for me :) |
01:41:45 | FromGitter | <data-man> But thanks for varint! I have many optimizations. :) |
01:46:49 | FromGitter | <data-man> Sadly, that current json don't passed all tests from JSONTestSuite :( |
01:51:07 | * | endragor quit (Remote host closed the connection) |
01:51:10 | * | ARCADIVS joined #nim |
02:05:34 | * | gangstacat quit (Remote host closed the connection) |
02:09:47 | * | gangstacat joined #nim |
02:16:47 | * | PMunch quit (Quit: leaving) |
02:26:09 | * | FuntDobra quit (Ping timeout: 248 seconds) |
02:41:30 | FromGitter | <data-man> Steps for reproduce: ⏎ ```git clone --depth 1 git://github.com/nst/JSONTestSuite.git``` ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5b00e05ae1cf621dba328bef] |
03:21:18 | FromDiscord | <emekoi> is it a bug that Nim can't store procs that take or return type classes? |
03:21:45 | FromDiscord | <emekoi> is it a bug that Nim can't store procs that take or return type classes in arrays or seqs? |
03:22:35 | FromGitter | <data-man> Some code? |
03:27:25 | FromDiscord | <emekoi> the code |
03:27:53 | FromDiscord | <emekoi> ``` |
03:27:53 | FromDiscord | <emekoi> type |
03:27:53 | FromDiscord | <emekoi> Indicator = proc(): int | uint |
03:27:53 | FromDiscord | <emekoi> |
03:27:53 | FromDiscord | <emekoi> var |
03:27:53 | FromDiscord | <emekoi> indicators = newSeq[Indicator]() |
03:27:54 | FromDiscord | <emekoi> ``` |
03:28:03 | FromDiscord | <emekoi> gives this error |
03:28:12 | FromDiscord | <emekoi> ``` |
03:28:12 | FromDiscord | <emekoi> Hint: system [Processing] |
03:28:13 | FromDiscord | <emekoi> Hint: debug [Processing] |
03:28:13 | FromDiscord | <emekoi> Error: internal error: mapType |
03:28:13 | FromDiscord | <emekoi> No stack traceback available |
03:28:13 | FromDiscord | <emekoi> To create a stacktrace, rerun compilation with ./koch temp c <file> |
03:28:14 | FromDiscord | <emekoi> ``` |
03:31:04 | * | skrylar quit (Remote host closed the connection) |
03:31:22 | * | skrylar joined #nim |
03:32:04 | FromGitter | <data-man> Works for ```Indicator = proc(): int``` |
03:32:06 | * | rauss quit (Quit: WeeChat 2.1) |
03:33:07 | FromDiscord | <emekoi> and |
03:33:07 | FromDiscord | <emekoi> ``` |
03:33:07 | FromDiscord | <emekoi> type |
03:33:07 | FromDiscord | <emekoi> Indicator = proc(arr: SomeNumber) |
03:33:07 | FromDiscord | <emekoi> |
03:33:07 | FromDiscord | <emekoi> var |
03:33:08 | FromDiscord | <emekoi> indicators = newSeq[Indicator]() |
03:33:09 | FromDiscord | <emekoi> ``` |
03:33:11 | FromDiscord | <emekoi> gives this error |
03:33:11 | FromDiscord | <emekoi> ``` |
03:33:13 | FromDiscord | <emekoi> test.nim(12, 33) Error: expression 'newSeq(Natural(0))' has no type (or is ambiguous) |
03:33:14 | FromDiscord | <emekoi> ``` |
03:33:30 | * | rauss joined #nim |
03:35:14 | FromGitter | <data-man> It's correct. Key words are ```is ambiguous``` |
03:36:25 | FromDiscord | <emekoi> so in order to store a proc in a seq or array it's arguments and return values must be concrete types? |
03:36:45 | FromGitter | <data-man> Yes. |
03:38:46 | FromGitter | <data-man> Not only for proc. For any non concrete type. |
03:40:09 | FromDiscord | <emekoi> okay |
03:41:28 | FromGitter | <data-man> Try to use object variant with proc fields. |
03:47:47 | FromDiscord | <emekoi> well thats not a problem anymore because i had my types switched around so a different type of proc was supposed to be stored in a seq. |
03:48:38 | FromGitter | <data-man> Good. :) |
03:49:14 | FromGitter | <arnetheduck> playing around with a nim result type, feel free to comment: https://github.com/arnetheduck/nim-result/pull/1 |
03:52:13 | leorize | arnetheduck: you might want to use the `unittest` module for testing |
03:52:54 | FromGitter | <data-man> Yes, it's out of the box :) |
03:55:13 | FromGitter | <arnetheduck> @leorize, I'm kind of more hoping for comments on the result type itself (implementation, tricks, api, etc) :) |
03:56:31 | FromGitter | <data-man> "Jives well" -> "Lives well" ? |
03:58:18 | * | xkapastel quit (Quit: Connection closed for inactivity) |
03:59:33 | * | FuntDobra joined #nim |
04:07:25 | * | arecaceae quit (Read error: Connection reset by peer) |
04:07:37 | * | skrylar quit (Remote host closed the connection) |
04:07:49 | * | arecaceae joined #nim |
04:18:12 | FromGitter | <arnetheduck> hm, should be `jibes`, though can also be `jives` sometimes |
04:18:37 | leorize | arnetheduck: why aren't there any API to unwrap a result without checking for errors? |
04:19:00 | * | xkapastel joined #nim |
04:21:39 | * | FuntDobra quit (Ping timeout: 260 seconds) |
04:23:26 | FromDiscord | <citycide> I haven't been able to make a small repro yet - I've got an `iterator` that I then have a `proc`/`accumulateResult` wrapper around. when I then use `sequtils.mapIt` on the resulting `seq`, an echo for example within the iterator will run twice |
04:23:32 | FromDiscord | <citycide> normal `map` seems fine |
04:23:58 | leorize | citycide: are you using devel? |
04:24:09 | FromDiscord | <citycide> also the type on hover of my `accumulateResult` proc is `Error Type` which is strange |
04:24:35 | FromDiscord | <citycide> 0.18 actually - is this a fix in devel? |
04:26:41 | leorize | IIRC there were some fixes for sequtils in devel, so you might want to try using it |
04:27:31 | FromGitter | <data-man> @citycide: https://github.com/nim-lang/Nim/issues/7187 ? |
04:33:12 | FromDiscord | <citycide> @data-man seems relevant at least, especially when following that to https://github.com/nim-lang/Nim/pull/7513 |
04:33:32 | FromDiscord | <citycide> I'll try devel |
04:41:26 | FromGitter | <data-man> Also try https://github.com/alehander42/zero-functional |
04:44:18 | FromDiscord | <citycide> still happens on devel actually |
04:44:28 | FromDiscord | <citycide> I'm assuming it's the same underlying problem |
04:46:27 | FromDiscord | <citycide> actually scratch that I think it may be solved on devel, I forgot to switch back to `mapIt` before testing |
04:47:03 | FromGitter | <data-man> @skilchen's fix isn't solve this problem? |
04:48:40 | * | yglukhov joined #nim |
04:49:06 | FromDiscord | <citycide> @data-man pretty sure his/her PR #7513 did fix it |
04:50:00 | FromGitter | <data-man> No, from his comment in #7187 |
04:50:38 | FromDiscord | <citycide> @data-man oh, I don't know I'm not affected by that one currently |
04:51:56 | FromDiscord | <citycide> how about this type hint? `t.resultList: Error Type` |
04:52:51 | FromGitter | <data-man> More code, please. :) |
04:53:05 | * | yglukhov quit (Ping timeout: 256 seconds) |
04:56:47 | FromDiscord | <citycide> I'll be putting the whole repo up soon so will do more about that then 😄 |
04:57:05 | FromGitter | <data-man> Ok. |
04:58:59 | FromGitter | <data-man> And thanks for fugitive! :) |
05:07:25 | * | cavariux quit (Quit: WeeChat 2.1) |
05:17:36 | FromDiscord | <citycide> @data-man ah for sure haha. surprised it gets used by someone else 😆 |
05:20:47 | FromGitter | <data-man> I prefer pure Nim tools! :) |
05:45:49 | * | miran joined #nim |
05:46:51 | * | nolanv joined #nim |
05:46:56 | FromGitter | <kayabaNerve> ```type myType* = ref object of RootObj ⏎ start: uint32 ⏎ end: string``` ⏎ ⏎ Error: cannot instantiate DoublyLinkedList ⏎ got: <void> ⏎ but expected: <T> ... [https://gitter.im/nim-lang/Nim?at=5b010bd052194a4a67fbf91c] |
05:47:18 | FromGitter | <kayabaNerve> I did try making the members of myType public in case it just thought it was an empty type |
05:47:26 | FromGitter | <kayabaNerve> I did triple check my spelling |
05:49:27 | FromGitter | <kayabaNerve> (thanks in advance; ```myVar:``` is part of a type, that's why I didn't put var in front of it ) |
05:54:40 | leorize | kayabaNerve: `end` is a keyword, you have to escape it |
06:12:42 | * | dddddd quit (Remote host closed the connection) |
06:19:32 | FromGitter | <arnetheduck> @leorize, you have the `[]` operator to unwrap |
06:20:52 | leorize | arnetheduck: oh, I missed that somehow :P |
06:20:53 | FromGitter | <arnetheduck> or you can just access `value` which is the same as "unwrap" with no error checking whatsoever (well, in nim, you'll get a `FieldError` or some such) |
06:23:04 | leorize | I kind of hope that the `[]` operator would convert error into a string then raise it. |
06:24:27 | FromGitter | <arnetheduck> the idea was that it would raise the error with a `ResultError` and give the actual error value in the exception object (could do string as well I guess), but compiler is broken :) |
06:25:20 | FromGitter | <arnetheduck> also, if you're using `Result` to capture an existing exception, it will simply reraise that, which probably makes sense (like future) |
06:26:31 | FromGitter | <data-man> @arnetheduck: Awesome! |
06:28:18 | * | xkapastel quit (Quit: Connection closed for inactivity) |
06:43:17 | FromGitter | <xmonader> Do you guys know of any logic engine written in nim? |
06:47:46 | * | leorize quit (Quit: WeeChat 2.1) |
06:55:19 | * | nsf joined #nim |
07:07:26 | * | CodeVance joined #nim |
07:12:34 | FromGitter | <data-man> @xmonader: Which logic? Fuzzy? |
07:22:44 | FromGitter | <xmonader> @data-man like prolog or datalog languages implemented as DSLs |
07:24:15 | * | miran quit (Quit: Konversation terminated!) |
07:29:45 | FromGitter | <data-man> Rule-based logic engine, right? ⏎ I don't know prolog. But for Nim such package not exist, I'm sure. :) ⏎ If you know Ruby, try port it's library. |
07:35:51 | FromGitter | <xmonader> yeah i'd like to do some experiments with a logic engine in nim specially nim is really good in dsls |
07:39:55 | FromGitter | <data-man> https://github.com/search?q=logic+engine&type=Repositories ⏎ 392 available repository for now :) |
07:42:14 | * | xet7 joined #nim |
07:43:10 | * | yglukhov joined #nim |
07:43:36 | FromGitter | <kayabaNerve> leorize: The actual fields are start and difficulty |
07:43:55 | FromGitter | <kayabaNerve> I renamed it to end because it was the first thing I thought of. Didn't realize it would affect the diagnosis. Sorry |
07:46:20 | FromGitter | <kayabaNerve> Difficulty.nim ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b0127cb8c24fe61eafc39ce] |
07:47:35 | FromGitter | <kayabaNerve> Oh. I misread it. That line works fine. It's the blocks line that doesn't work fine. |
07:47:47 | FromGitter | <kayabaNerve> Error: cannot instantiate DoublyLinkedList ⏎ got: <void> ⏎ but expected: <T> |
07:48:16 | FromGitter | <kayabaNerve> The Block type is also imported and is ⏎ `type Block* = ref object of RootObj ⏎ ⏎ ```nonce*: uint32 ⏎ time*: uint32 ⏎ miner*: string ⏎ proof*: string ⏎ hash*: string```` [https://gitter.im/nim-lang/Nim?at=5b0128401cfca775e1225c52] |
07:48:46 | FromGitter | <kayabaNerve> And it may be the difficulty line but the compiler's line number is blocks (no idea if it's carrying over) |
07:49:35 | * | jaco60 joined #nim |
07:52:35 | FromGitter | <kayabaNerve> Found the issue. The files had the same name... |
07:53:07 | * | rockcavera joined #nim |
07:54:30 | * | yglukhov quit (Remote host closed the connection) |
07:55:32 | * | yglukhov joined #nim |
07:56:51 | FromGitter | <xmonader> I did that course before http://composingprograms.com/pages/45-unification.html |
07:57:53 | FromGitter | <data-man> @kayabaNerve: So, now all works? |
07:59:11 | FromGitter | <kayabaNerve> Yep |
08:00:05 | * | yglukhov quit (Ping timeout: 256 seconds) |
08:03:54 | * | gmpreussner_ quit (Ping timeout: 260 seconds) |
08:05:14 | * | gmpreussner joined #nim |
08:07:39 | FromGitter | <mratsim> @kayabaNerve yes using proc with the same name as files might give you strange errors because Nim supports (?) higher-order modules |
08:08:05 | FromGitter | <mratsim> also if you ever want to use nim reserved keyword like block you can use backtick like here: https://github.com/status-im/nimbus/issues/13 |
08:10:20 | * | FuntDobra joined #nim |
08:14:16 | FromGitter | <kayabaNerve> Thanks |
08:27:58 | FromGitter | <kayabaNerve> So if I have a ref object (type myTypeRef = ref myType), and want to pass it to a function, I create the ref object by calling new(myVar) (if myVar is of type myTypeRef), right? ⏎ ⏎ Because that's what I'm doing but I'm getting illegal storage access errors. |
08:32:27 | FromGitter | <mratsim> yes |
08:32:45 | FromGitter | <mratsim> or (ref myType)(field1: foo, field2: bar) |
08:33:35 | FromGitter | <mratsim> short example: https://github.com/mratsim/golem-prime/blob/master/src/core/c_boardstate.nim#L70-L72 |
08:35:18 | FromGitter | <kayabaNerve> @mratsim ⏎ ⏎ ```new(result) ⏎ result.creation = getTime()``` ⏎ ⏎ SIGSEGV: Illegal storage access. (Attempt to read from nil?) [https://gitter.im/nim-lang/Nim?at=5b01334641f54f22e2436939] |
08:35:49 | FromGitter | <mratsim> BlockchainObj should be “object of RootObj" |
08:35:58 | FromGitter | <mratsim> you have double ref indirection here |
08:36:07 | FromGitter | <mratsim> Blickchain is ref ref object of RootObj |
08:36:33 | FromGitter | <kayabaNerve> Got it |
08:36:44 | FromGitter | <kayabaNerve> Do I need to use 2 objects? |
08:36:45 | FromGitter | <mratsim> or you can just use `Blockchain = ref object of RootObj` |
08:36:49 | FromGitter | <kayabaNerve> Got it |
08:37:08 | FromGitter | <kayabaNerve> That wouldn't work though with ⏎ (blockchain: ref Blockchain) though |
08:37:30 | FromGitter | <mratsim> Here is an example where I use 2 objects, but that’s because I use both ptr FooObj and ref FooObj: https://github.com/mratsim/Arraymancer/blob/master/src/autograd/ag_data_structure.nim#L20-L40 |
08:37:41 | FromGitter | <mratsim> (blockchain: Blockchain) |
08:37:48 | FromGitter | <mratsim> no problem ;) |
08:38:10 | FromGitter | <kayabaNerve> So I was trying to edit the variable passed |
08:38:19 | FromGitter | <kayabaNerve> And thought I was smart by looking it up and using ref |
08:38:20 | FromGitter | <ephja> T(...) where T is a 'ref' will call 'new' implicitly |
08:38:23 | FromGitter | <mratsim> it will work fine |
08:38:24 | FromGitter | <kayabaNerve> But it was ok all along? |
08:38:25 | FromGitter | <kayabaNerve> Yep |
08:40:00 | FromGitter | <mratsim> basically for stack/seq/string objects: ⏎ ⏎ 1) want to mutate the value: pass as var ⏎ for ref/ptr objects: ⏎ 2) want to mutate the content: pass normally ... [https://gitter.im/nim-lang/Nim?at=5b01345fb84be71db91f2564] |
08:46:06 | * | SenasOzys joined #nim |
09:01:51 | * | rauss quit (Read error: Connection reset by peer) |
09:03:45 | * | rauss joined #nim |
09:05:17 | FromGitter | <tim-st> shouldnt `sequtils` have the same standard procs like string, e.g. `find(a, b)` and `contains(a, b)` |
09:09:12 | FromGitter | <ephja> the implementations in the system module works for sequences though |
09:09:38 | FromGitter | <tim-st> really? |
09:09:55 | FromGitter | <tim-st> tried it with custom type and didnt |
09:11:26 | FromGitter | <tim-st> nope doesnt work for std types: |
09:11:27 | FromGitter | <tim-st> var a = @[1,2,3] ⏎ var b = @[1,2,3,4] ⏎ echo a in b |
09:12:35 | FromGitter | <tim-st> here is my approach, but maybe it matches to many generics: https://pastebin.com/ZCZEZHB0 |
09:12:59 | FromGitter | <ephja> oh right, the openarray overload is for individual elements only |
09:13:58 | FromGitter | <tim-st> I think this should be changed, I didnt expected to have to write this procs for seq |
09:16:04 | * | eldiz joined #nim |
09:16:53 | FromGitter | <tim-st> my guess was, that strutils and sequtils can share nearly all procs e.g. `startsWith`, `endsWith` and even `editDistance` |
09:18:04 | FromGitter | <tim-st> or atleast the std procs that are semantically not bound to text |
09:36:28 | * | yglukhov joined #nim |
09:46:49 | * | yglukhov quit (Remote host closed the connection) |
09:48:50 | * | eldiz quit (Quit: Leaving) |
09:52:07 | * | yglukhov joined #nim |
09:53:13 | * | FuntDobra quit (Ping timeout: 256 seconds) |
09:57:19 | * | CodeVance quit (Read error: Connection reset by peer) |
09:59:04 | * | CodeVance joined #nim |
10:02:10 | * | PMunch joined #nim |
10:14:42 | PMunch | Hmm, when creating a template that creates procedures Nim adds a bunch of numbers to each argument name |
10:15:44 | PMunch | So for example "proc name*(table: TomlTableRef, address: string): t" get's turned into "proc getInt(table228426: TomlTableRef; address228428: string): int64". Note that `name` and `t` comes from the template |
10:17:04 | PMunch | Is there a way to avoid this? |
10:19:37 | * | nsf quit (Quit: WeeChat 2.1) |
10:28:11 | * | Vladar joined #nim |
10:38:50 | * | Trustable joined #nim |
10:42:24 | Araq | PMunch: use a .dirty template |
10:43:53 | PMunch | Ah |
11:04:04 | * | yglukhov quit (Remote host closed the connection) |
11:05:35 | * | yglukhov joined #nim |
11:08:47 | crem | Where should I put that {. gcsafe .} to silence that warning? |
11:09:17 | crem | No way to silence it if in library it's not gcsafe?.. |
11:10:23 | crem | PMunch: Are you author of parsetoml? |
11:10:42 | crem | I forgot who was the author.. |
11:10:50 | PMunch | Current maintainer I guess |
11:10:58 | PMunch | Author is no longer using Nim |
11:11:13 | PMunch | He changed the authorship to an organization called NimParsers |
11:11:55 | crem | There is this: https://github.com/nim-lang/Nim/issues/7847 :) |
11:14:29 | PMunch | Hmm |
11:20:00 | dom96 | crem: I wouldn't worry about this warning |
11:20:15 | dom96 | are you even using threads? |
11:20:24 | FromGitter | <kayabaNerve> @mratsim I have something you might like |
11:21:10 | FromGitter | <kayabaNerve> https://github.com/kayabaNerve/Currency/blob/master/lib/Binary.nim |
11:21:13 | PMunch | Hmm, just running the parsetoml file with verbosity 2 it complains on line 413: "let newValue = parseValue(state)" |
11:21:32 | FromGitter | <kayabaNerve> I'm submitting a Linux kernel patch to replace GMP with that. I plan on it being accepted instantly /s |
11:22:19 | PMunch | No idea why that's GC-unsafe though |
11:22:43 | crem | Ok, my 10 lines of code do sigsegv... What was it again?.. Do I have to do new() for strings? |
11:22:52 | crem | Don't remember.. |
11:23:20 | crem | Ah no, it's inside parsetoml.. |
11:23:28 | FromGitter | <kayabaNerve> (if you couldn't tell, it's a Native Nim unlimited precision Binary UInt class) |
11:23:36 | PMunch | It seems that every passing of state is declared not GC-safe.. |
11:23:49 | PMunch | crem, code? |
11:24:01 | crem | It does sigsegv when I do parseFile() for non-existing file. |
11:24:07 | crem | I expected it to throw exception... |
11:24:24 | crem | Or, maybe another toml library then. |
11:25:02 | PMunch | Ah, yeah it creates a nil stream |
11:25:05 | PMunch | I'll fix it |
11:25:21 | PMunch | I didn't write the original, only updated it to v0.4.0 of the TOML specification |
11:27:31 | crem | Other toml libs don't write.. Ok, so have to check if file exists then. |
11:28:44 | * | yglukhov quit (Remote host closed the connection) |
11:28:49 | PMunch | You should do that anyways :P |
11:30:53 | crem | I relied on library to do that for me. Because between my check and library opens the file, file can be gone. |
11:32:49 | PMunch | I have added a check there now |
11:32:54 | PMunch | Not pushed yet |
11:33:02 | PMunch | Still trying to figure out this GC thing.. |
11:33:56 | crem | What's idiomatic way to check if string is empty? Is there something else that if mystr != "" ? |
11:35:11 | crem | ..every half a year I decide to write something in nim and ask the same noob questions. |
11:35:40 | FromGitter | <tim-st> If you want to know if string is not nil and string.len == 0; I think there was a proc that checks len == 0 without checking if string is nil |
11:37:31 | PMunch | not myStr.isNil and myStr.len == 0 |
11:37:39 | FromGitter | <tim-st> its called `mystr.xlen == 0` |
11:37:46 | FromGitter | <tim-st> xlen tests without checking nil |
11:37:52 | dom96 | myStr.len != 0 is enough |
11:37:56 | dom96 | .len return 0 on nil |
11:37:58 | FromGitter | <mratsim> @kayabaNerve Aha, good luck with that. To properly model currencies I’ve started to use Mpdecimal: https://github.com/status-im/nim-decimal |
11:38:00 | PMunch | Ah, cool |
11:38:26 | crem | Wow, pretty verbose. :) |
11:38:34 | FromGitter | <tim-st> @dom96 it seems he wanted to know the dfference between "" and nil thats not seen with only checking len == 0 |
11:38:51 | FromGitter | <mratsim> Ideally currencies will be added as a distinct type, and there will be a converter that can be plugged to Bloomberg, so that adding USD and EUR is either an compile-time error or a proper conversion. |
11:39:23 | dom96 | crem: How does the language you're familiar with handle this? |
11:40:10 | FromGitter | <tim-st> @mratsim ideally the complete http://cldr.unicode.org/ will be added |
11:40:22 | PMunch | Hmm, I really can't figure out this GC error thing.. |
11:40:50 | FromGitter | <mratsim> @tim-st my last sentence was for @kayabaNerve not you ;) |
11:41:22 | crem | Empty strings? In C++ it's mystr.empty(), in python it's "if mystr:", in javascript it's "if (mystr)", in perl it's if ($mystr).. What else.. In bash it's if [[ -n "$x" ]] |
11:41:24 | FromGitter | <tim-st> ok^^, I thought it was a general guess |
11:42:11 | FromGitter | <tim-st> `str.len == 0` is safe and the same as pythons if str:... |
11:42:27 | crem | Even in C it's if (*str) :) |
11:43:30 | PMunch | What's wrong with myString.len == 0? |
11:44:46 | crem | Next question: how to exit process? There are some "exitnow" in posix, and terminateProcess for winlean, but is there something that will work both in windows and posix systems? |
11:45:08 | crem | Ah!, it's quit, not exit. |
11:48:11 | dom96 | crem: and all of those I consider implicit and therefore risky :) |
11:48:28 | dom96 | If you want risk just add: converter toBool(x: string): bool = x.len == 0 :P |
11:49:25 | crem | Ok, I'm not complaining, just wanted to check if I write something non-idiomatic. |
11:50:04 | crem | PMunch: How can I write toml file? http://parsetoml.readthedocs.io/en/latest/introduction.html <- I could find nothing about writing there. |
11:50:17 | PMunch | Yeah those docs are old.. |
11:50:29 | * | CodeVance quit (Read error: Connection reset by peer) |
11:50:44 | PMunch | toTomlString |
11:51:21 | crem | Is there toTomlFile? |
11:52:34 | crem | Hm.. Is there writeStringToFile?.. |
11:53:00 | PMunch | writeFile("filename.toml", tomlData) |
11:53:07 | crem | Thanks! |
11:53:12 | PMunch | https://peterme.net/handling-files-in-nim.html |
11:53:12 | * | CodeVance joined #nim |
11:53:37 | PMunch | So for you it would be writeFile("output.toml", tomlData.toTomlString) |
11:56:21 | crem | How can I modify it?.. Is there setString() similar to getString()? |
11:56:54 | * | CodeVance quit (Read error: Connection reset by peer) |
12:00:26 | crem | hm.. maybe yaml is a better choice. |
12:01:36 | * | dddddd joined #nim |
12:01:54 | dom96 | I'd suggest JSON |
12:03:05 | crem | It's a bit less human-friendly. With forbidden trailing commas and having to balance parentheses. |
12:03:08 | PMunch | crem, modify the TOML? |
12:03:50 | crem | I need that tool urgently, till tomorrow evening. And that makes me think that I should probably just fall back to C++. |
12:05:16 | crem | It's taking more than a day for me for "Read username from config. If it's not there, ask and save to a config". |
12:05:30 | crem | At this rate I'm not going to finish on time. |
12:06:52 | PMunch | var b = table.getValueFromFullAddr("input.flags"); b.boolVal = false |
12:06:57 | PMunch | That's how you can set a value |
12:07:48 | crem | https://nimyaml.org/ yaml seems to be cleaner. Will try to do it for another hour or so, then decide. |
12:10:58 | PMunch | Okay, just pushed a new version of parsetoml |
12:11:12 | PMunch | It adds a nil check and fixes a little bug I found in toTomlString |
12:11:15 | * | yglukhov joined #nim |
12:11:27 | PMunch | I'll add some setter procs now |
12:15:43 | crem | yaml doesn't work too, it seems. Or at least error message says nothing how to fix it. https://gist.github.com/mooskagh/95aa30f924528240f3b3839f26a25ccf |
12:15:47 | crem | Ok, json then. |
12:15:53 | crem | ARRRR |
12:16:10 | crem | That's frustrating. Nothing works. :) |
12:16:48 | crem | I thought if it has own website, it should work.. |
12:23:37 | * | nsf joined #nim |
12:23:51 | dddddd | maybe just keep it simple. Store the username in its own file, crem |
12:24:17 | PMunch | crem, what do you mean JSON doesn't work? |
12:24:20 | crem | It's not just username, it's config. But I start with username. |
12:24:31 | crem | yaml doesn't work, not json |
12:24:32 | dddddd | a file per config, then |
12:24:47 | crem | trying json. |
12:26:18 | PMunch | JSON is a safe bet |
12:26:26 | PMunch | Trying to add what you need to TOML as we speak |
12:28:26 | crem | json module can unmarshal but cannot marshal?.. |
12:29:58 | PMunch | What do you mean? |
12:30:17 | crem | there is nice to() macro, but no from() macro. |
12:31:11 | PMunch | Why would you need that? |
12:31:20 | PMunch | Just work on the JSON object |
12:31:30 | dom96 | from = % |
12:31:37 | PMunch | I implemented a whole database that way :) |
12:31:55 | dom96 | https://nim-lang.org/docs/json.html#creating-json |
12:32:16 | crem | %* is cryptic. :) |
12:32:20 | crem | Ok, trying, thanks. |
12:36:03 | crem | It worked! Magically. :) |
12:37:30 | PMunch | Yeah, JSON in great |
12:49:17 | FromGitter | <kayabaNerve> @mratsim Why use decimals at all? Just use UInts. Decimals should only be a UX thing. |
12:49:59 | FromGitter | <kayabaNerve> And it's not really a good luck thing as more than a completed code thing (the binary file) :P I tested it out. It works. |
12:50:04 | * | CodeVance joined #nim |
12:50:09 | FromGitter | <kayabaNerve> I do have yet to do conversions/reversions though. Adding that next |
12:50:10 | FromGitter | <mratsim> mpdecimal has everythin, is the default since Python 3.4 and is fast. |
12:50:13 | FromGitter | <kayabaNerve> And no idea on the speed |
12:50:25 | FromGitter | <kayabaNerve> Will that work on Nim stable? :P |
12:50:40 | FromGitter | <mratsim> yes, but the current wrapper is super low-level |
12:51:12 | FromGitter | <kayabaNerve> I'll stick with my own code unless it slows down with priv keys/addresses |
12:51:48 | FromGitter | <mratsim> usually that’s the best thing to do I think. |
12:51:59 | FromGitter | <kayabaNerve> I'm actually quite proud of it |
12:52:24 | FromGitter | <kayabaNerve> I got the conversion/reversion algos off the internet but I did binary addition/subtraction myself, with the first try for subtraction |
12:52:33 | FromGitter | <kayabaNerve> Of course, that means it's probably slow as hell |
12:53:59 | FromGitter | <kayabaNerve> I'm just using a string and methods for it... probably should update it |
12:54:22 | FromGitter | <kayabaNerve> 32 8 bit ints... |
13:00:02 | * | FuntDobra joined #nim |
13:19:22 | * | FuntDobra quit (Ping timeout: 256 seconds) |
13:37:25 | * | yglukhov quit (Remote host closed the connection) |
13:41:10 | euantor | The Nix package for Nim is finally up to date! https://github.com/NixOS/nixpkgs/pull/40556 - should be easier to update in the future too, hopefully |
13:41:55 | * | smt joined #nim |
13:47:43 | * | dkncgtik6mr0 joined #nim |
13:51:48 | PMunch | crem, new version of parsetoml. It now has `add` and `set` procs so you can update fields in your table :) |
13:57:03 | dom96 | euantor: Nice, but why run the tests? |
14:01:25 | * | gokr joined #nim |
14:02:13 | euantor | dom96: it appears to be the convention. They already had a package for 0.17.2 which ran the tests in the check phase, now it targets 0.18.0 and most of the tests actually pass (except one on ARM doing float equality checks) |
14:08:37 | Notkea | also, running the tests enabled us to spot some problems :p |
14:11:11 | euantor | Yep |
14:15:21 | * | FuntDobra joined #nim |
14:28:03 | * | FuntDobra quit (Ping timeout: 256 seconds) |
14:38:21 | crem | https://gist.github.com/mooskagh/e112a05a1fc37c67753a219edb4833d1 Why GcUnsafe warning this time? |
14:39:20 | FromGitter | <krux02> crem |
14:39:37 | FromGitter | <krux02> you use proc and method at the same time for Update |
14:39:41 | FromGitter | <krux02> why that |
14:39:47 | FromGitter | <krux02> maybe that is the reason |
14:40:08 | crem | proc Update is not for this hierarchy |
14:40:42 | crem | I've updated the code |
14:40:56 | crem | or order not to be confusing |
14:40:59 | crem | still the same |
14:41:56 | crem | It's worrying that for every seemingly basic question people start to guess. Makes me think that unless you developed that language, you don't really understand how to use it. |
14:45:06 | FromGitter | <krux02> Well I know how to use the subset of the langugae that I use |
14:45:23 | FromGitter | <krux02> but I try to stay away from weird awkward features that I don't fully understand |
14:45:37 | FromGitter | <krux02> and "method" is one of them |
14:46:16 | FromGitter | <krux02> OO hierarchies I do understand I just don't think they are useful |
14:47:02 | FromGitter | <krux02> or better said "very useful", there might be a few corner cases where it is actually the right fit |
14:48:17 | crem | https://nim-lang.org/docs/terminal.html#setCursorXPos,File,int setCursorXPos needs some File. Where to get it? |
14:49:30 | FromGitter | <krux02> stdin? |
14:50:04 | crem | why not stdout? |
14:50:45 | FromGitter | <krux02> well you said it, stout is probably the correct solution |
14:51:04 | FromGitter | <krux02> I just think it's weird |
14:57:19 | crem | Works with stdout indeed. Thanks. (although it's weird). Still not clear wiat to do with GcUnsafe warning. |
14:57:36 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
14:58:37 | crem | How can I call parent's method? |
14:58:45 | FromGitter | <stisa> crem: mark the method with `gcsafe` ? |
14:59:00 | FromGitter | <ephja> I compiled 32-bit and 64-bit libui dll's with vs 2015 and neither loads -.- |
14:59:44 | crem | Well, what does that do? How do I know if it's gcsafe or not gcsafe? |
15:00:18 | crem | It's like compiler saying "Warning: your code is incorrect" unless you add {. correct .} |
15:00:23 | FromGitter | <ephja> the Dependencies app doesn't display any errors, and who knows if it should do that just like depends.exe does, which does not work well on newer windows versions |
15:00:48 | PMunch | Hmm, any ideas for a `%` and consequently a `%*` operator for TOML? |
15:01:02 | PMunch | What operator suits it best |
15:01:38 | FromGitter | <stisa> crem: https://nim-lang.org/docs/manual.html#threads-gc-safety basically if it doesn't access globals it's safe |
15:02:19 | FromGitter | <ephja> NiGui doesn't work for me on windows 10. termbox is linux only. nimx should be fine though if you don't care much about the layout. js+dom takes care of that though |
15:03:09 | PMunch | ephja, wxWidgets? |
15:03:10 | crem | So do I have to add gcsafe to all functions?. It complains at almost all of them. |
15:03:29 | FromGitter | <kayabaNerve> @mratsim I made the base 10 equivalent |
15:03:32 | crem | That's silly. I don't know what I'm doing. |
15:03:39 | FromGitter | <kayabaNerve> But I'm encountering an edge case bug on the subtract function |
15:05:45 | FromGitter | <kayabaNerve> https://github.com/kayabaNerve/Currency/blob/master/lib/UInt.nim#L67 10001 and 9999 returns 11, not 2. The test values of 10/8, 8/6, 10011/1000 all worked |
15:06:21 | * | FuntDobra joined #nim |
15:09:46 | FromGitter | <mratsim> it’s probably a borrow issue |
15:10:38 | FromGitter | <kayabaNerve> L67 is the edge case where the digit of b is bigger than the digit of a |
15:10:53 | FromGitter | <kayabaNerve> So yes, it's a carry issue :) |
15:11:23 | dom96 | PMunch: The same one? |
15:11:32 | * | yglukhov joined #nim |
15:11:40 | FromGitter | <kayabaNerve> I'd appreciate any insights you have if you have a few seconds |
15:11:43 | dom96 | crem: Honestly, just ignore this warning |
15:12:02 | FromGitter | <kayabaNerve> Same for anyone here, of course :P |
15:12:13 | FromGitter | <kayabaNerve> I'll be working on it on my own either way |
15:12:13 | dom96 | Create your software instead of worrying about a warning that only shows up when the verbosity is 2 |
15:12:23 | crem | But nimlime keeps on throwing that warning to me. |
15:12:36 | crem | In a popup! |
15:12:48 | dom96 | wtf |
15:12:49 | dom96 | Why |
15:13:02 | FromGitter | <mratsim> @kayabaNerve I’m swamped now, trying to get ahead in a data science competition. However I’m saw several char-based bigint decimal library, some related to Project Euler to solve the project euler problems |
15:13:10 | dom96 | Maybe add --threadAnalysis:off to a nim.cfg file and it'll stop |
15:13:12 | FromGitter | <mratsim> I saw* |
15:13:12 | FromGitter | <kayabaNerve> I'll look them up |
15:13:22 | dom96 | and ask Varriount to fix this |
15:13:24 | dom96 | it's ridiculous |
15:13:25 | crem | You just Ctrl+S to save file, and there is a popup with this warning. :) |
15:13:32 | PMunch | dom96, wouldn't that collide with things if you want to use both? |
15:13:39 | FromGitter | <kayabaNerve> Also, quick math. This is one bit per array entry. There are 2^32 possible array entries. That means, since there's 2^32 bits, the max value is 2^2^32. Right? |
15:14:06 | FromGitter | <mratsim> one byte per array no? |
15:14:10 | dom96 | PMunch: Better yet, maybe you could map JsonNode to TOML? |
15:14:20 | FromGitter | <kayabaNerve> @mratsim Well. Thats for the Binary lib |
15:14:33 | FromGitter | <mratsim> you should pack them then |
15:14:36 | FromGitter | <kayabaNerve> For UInt, it's 10 possibilities or... 3.5 bits |
15:14:50 | FromGitter | <kayabaNerve> The point wasn |
15:15:04 | FromGitter | <kayabaNerve> It was checking its 2^2^32 |
15:15:05 | dom96 | PMunch: If we use different operators for each format we'll run out of operators very quickly |
15:15:20 | dom96 | If someone needs to use both then they can write json.`%`. |
15:15:52 | FromGitter | <mratsim> Each array element takes 1 byte, if you have a 2^32 array that’s 2^32 bytes needed. |
15:15:59 | FromGitter | <kayabaNerve> Not the question |
15:16:24 | FromGitter | <kayabaNerve> The question is the max possible value if the there's 1 bit per array element and 2^32 possible entries |
15:16:25 | FromGitter | <mratsim> you want to now the max value you can represent? |
15:16:28 | FromGitter | <kayabaNerve> 2^2^32, right? |
15:16:29 | FromGitter | <kayabaNerve> Yes |
15:16:50 | FromGitter | <mratsim> 2^32 - 1 |
15:16:52 | Notkea | I have a question about constants and static blocks evaluation order: which is evaluated first? |
15:17:05 | FromGitter | <mratsim> @notkea order of appearance |
15:17:08 | FromGitter | <kayabaNerve> A 32 bit system with 32 bits represents that many |
15:17:19 | Notkea | thanks |
15:17:24 | FromGitter | <kayabaNerve> So that means, if one entry is one bit, that an array has a cap of 32 entries |
15:17:27 | FromGitter | <kayabaNerve> Unless my math is wrong |
15:17:33 | FromGitter | <kayabaNerve> *math/logic/understanding |
15:17:40 | FromGitter | <mratsim> you lost me :P |
15:17:42 | FromGitter | <kayabaNerve> I thought so too at first. |
15:17:53 | FromGitter | <kayabaNerve> 32 bits makes 2^32 max value |
15:18:02 | FromGitter | <mratsim> minus 1 |
15:18:02 | PMunch | dom96, what do you mean "map" |
15:18:19 | FromGitter | <kayabaNerve> 1 bit per array entry, with 2^32 possible entries, makes the max value not 2^32, but 2^2^32-1 |
15:18:22 | FromGitter | <kayabaNerve> Right? |
15:18:29 | dom96 | PMunch: I mean provide a proc that converts a JsonNode to TOML |
15:18:42 | * | yglukhov quit (Remote host closed the connection) |
15:18:52 | FromGitter | <kayabaNerve> Dude. This is trippy. I also thought 2^32 and was pissed I made a complex uint32 until my friend pointed out it was 2^2^32 |
15:18:55 | FromGitter | <kayabaNerve> (yes. -1.) |
15:18:57 | FromGitter | <mratsim> no, uint32, is 32 bits with value of 0 or 1. And the max uint32 is 2^32 - 1 |
15:19:04 | FromGitter | <kayabaNerve> Yes |
15:19:09 | FromGitter | <kayabaNerve> So if you have 2^32 bits |
15:19:14 | FromGitter | <mratsim> ah |
15:19:15 | FromGitter | <kayabaNerve> The max value is 2^2^32 |
15:19:16 | FromGitter | <mratsim> right |
15:19:22 | FromGitter | <kayabaNerve> And if you have 1 bit per entry |
15:19:26 | FromGitter | <kayabaNerve> And 2^32 entries |
15:19:29 | PMunch | dom96, that already exists :) |
15:19:33 | FromGitter | <kayabaNerve> Then yes, 2^2^32 |
15:19:37 | FromGitter | <kayabaNerve> Yes? |
15:19:40 | FromGitter | <mratsim> yes |
15:19:49 | FromGitter | <kayabaNerve> Trippy math |
15:19:57 | FromGitter | <kayabaNerve> Not trying to teach you an answer. Actually checking |
15:20:12 | FromGitter | <kayabaNerve> Because it's a weird as hell equation |
15:22:44 | * | gokr quit (Ping timeout: 265 seconds) |
15:23:22 | FromGitter | <kayabaNerve> @mratsim Why can't math be easy |
15:23:43 | FromGitter | <kayabaNerve> a+b=c. Done. Solved the Bermuda Triangle. Instant TX cryptocurrency built. UDP/TCP combined for amazingness. |
15:33:22 | FromGitter | <krux02> @kayabaNerve why can't we all be super intelligent genies like they are shown in Hollywood movies, and can fill blackboards with formulas in just one fading scene |
15:35:56 | FromGitter | <kayabaNerve> @krux02 Turns out if everyone was a genius we wouldn't have anything to do and nobody would be special and we'd lose all sense of emotions and humanity |
15:39:39 | * | FuntDobra quit (Ping timeout: 265 seconds) |
15:40:02 | * | edcragg quit (Quit: ZNC - http://znc.in) |
15:40:15 | * | edcragg joined #nim |
15:44:08 | * | smt quit (Remote host closed the connection) |
15:44:35 | * | smt joined #nim |
15:45:06 | FromGitter | <mratsim> The worse thing in movies are the super resolution zooms I think :P |
15:46:54 | crem | Is there a shorthand for object initialization instead of assigning values to every field individually? |
15:50:22 | crem | Are ref object parameters mutable by default? |
15:51:15 | PMunch | crem, yes and yes |
15:51:26 | PMunch | Or well, the data pointed to by the ref is mutable |
15:51:29 | PMunch | The ref itself is not |
15:51:45 | PMunch | shorthand is just "SomeObject(hello: 100)" |
15:54:32 | * | PMunch quit (Quit: leaving) |
15:56:31 | crem | No way to make them immutable? |
15:56:41 | FromGitter | <kayabaNerve> Don't make them public out of the file |
15:56:49 | FromGitter | <kayabaNerve> Make a constructor function and getters |
15:57:27 | * | yglukhov joined #nim |
15:57:37 | FromGitter | <kayabaNerve> Actual question: Did I help? If so, yay. If not, should I be quiet or try again/explain more. |
16:14:53 | * | jaco60 quit (Quit: Textual IRC Client: www.textualapp.com) |
16:15:59 | * | yglukhov quit (Remote host closed the connection) |
16:22:11 | * | Jipok[m] joined #nim |
16:31:52 | * | yglukhov joined #nim |
16:38:49 | * | yglukhov quit (Remote host closed the connection) |
16:40:15 | * | yglukhov joined #nim |
16:40:17 | * | yglukhov quit (Remote host closed the connection) |
16:45:58 | * | rockcavera quit (Remote host closed the connection) |
16:49:15 | * | FuntDobra joined #nim |
17:00:24 | Notkea | I'm trying to use json {de,}serialisation macros with generics, but I obtain the following error: lib/pure/json.nim(814, 14) template/generic instantiation from here; lib/pure/json.nim(807, 42) Error: undeclared field: 'val' |
17:00:32 | Notkea | is this actually supported? |
17:06:53 | dom96 | This happens because there is no `%` for Option[T] |
17:07:13 | dom96 | There is a PR for it, you can steal that code and place it in your code base for now |
17:12:13 | Notkea | thanks |
17:23:11 | * | yglukhov joined #nim |
17:27:27 | * | yglukhov quit (Ping timeout: 240 seconds) |
17:31:58 | * | yglukhov joined #nim |
17:33:33 | * | yglukhov quit (Read error: Connection reset by peer) |
17:34:09 | * | yglukhov joined #nim |
17:34:37 | * | yglukhov quit (Client Quit) |
17:39:42 | * | yglukhov joined #nim |
17:40:03 | Notkea | I'm having an issue with tuples of function that I don't understand: Error: type mismatch: got <tuple of (proc (event: Event): JsonNode{.noSideEffect, gcsafe, locks: 0.}, proc (jsonNode: JsonNode): Event{.noSideEffect, gcsafe, locks: 0.})> but expected 'EventSerialiser = tuple[serialiser: proc (event: Event): JsonNode{.closure.}, deserialiser: proc (jsonNode: JsonNode): Event{.closure.}]' |
17:42:13 | * | qwertfisch is now known as kugelfisch |
17:44:00 | dom96 | Notkea: mark your proc with {.closure.} |
17:45:01 | Notkea | I get: Error: '.closure' calling convention for top level routines is invalid |
17:46:09 | dom96 | alternatively you can mark your type with {.nimcall.} I think |
17:48:11 | Notkea | it gives the first error again :/ |
17:51:10 | * | yglukhov quit (Read error: Connection reset by peer) |
17:51:50 | * | yglukhov joined #nim |
17:51:53 | dom96 | :/ |
17:51:58 | dom96 | gist? |
17:55:26 | Notkea | https://paste.gnugen.ch/raw/WFvp |
17:56:45 | * | FuntDobra quit (Ping timeout: 264 seconds) |
17:58:53 | dom96 | serialiser: proc(event: Event): JsonNode {.nimcall.}, |
17:58:55 | dom96 | That's what I meant |
17:58:59 | dom96 | Works for me |
17:59:50 | * | xkapastel joined #nim |
18:00:10 | Notkea | doesn't for me, even after adding the annotation at line 30 |
18:00:14 | Notkea | (I'm using 0.18.0) |
18:01:07 | Notkea | I'll try with unstable |
18:06:26 | * | leorize joined #nim |
18:08:15 | Notkea | still no luck O.O |
18:09:50 | Notkea | oh I was adding it only to one of the functions |
18:10:46 | Notkea | works now, thanks! |
18:12:04 | FromGitter | <kayabaNerve> This is interesting. ⏎ ⏎ I have two uint32s. This if statement fails. ⏎ if firstUint > secondUint: [https://gitter.im/nim-lang/Nim?at=5b01ba731cfca775e123ed76] |
18:12:16 | FromGitter | <kayabaNerve> Sometimes it works. Sometimes it doesn't. |
18:13:22 | FromGitter | <Varriount> @kayabaNerve What do you mean by "sometimes"? |
18:13:27 | FromGitter | <kayabaNerve> Hash is too low: 1250173748 (secondUint) ⏎ Must be at least: 1145324612 (firstUint) ⏎ ⏎ Like with these. The second is obviously greater yet the if statement still triggers [https://gitter.im/nim-lang/Nim?at=5b01bac7b84be71db9209312] |
18:14:12 | FromGitter | <Varriount> Hm, can you look and see what the generated C code is doing? |
18:14:13 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ 4 passes, no idea if valid, one that should pass, one that shouldn't. Pass = doesn't trigger the if statement [https://gitter.im/nim-lang/Nim?at=5b01baf5b84be71db920932f] |
18:14:29 | FromGitter | <kayabaNerve> Sure |
18:14:37 | FromGitter | <kayabaNerve> Been a while varriount |
18:14:39 | FromGitter | <kayabaNerve> How are you? |
18:14:46 | FromGitter | <Varriount> You can see what C lines correspond to Not loves using `--lineDir:on` |
18:15:07 | FromGitter | <Varriount> *Nim lines |
18:15:29 | FromGitter | <Varriount> I'm good. Currently trying to debug this AWS API code |
18:15:58 | dom96 | Varriount: You should probably get rid of the --verbosity:2 in NimLime |
18:16:08 | dom96 | especially if people get popups for those gc safety warnings :( |
18:17:41 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b01bbc58c24fe61eafdd0b0] |
18:17:49 | FromGitter | <Varriount> @kayabaNerve What are you working on? |
18:17:57 | FromGitter | <kayabaNerve> A blockchain |
18:18:13 | FromGitter | <kayabaNerve> Sort of |
18:18:42 | FromGitter | <kayabaNerve> I'm building a PoW local blockchain. There's no TXs or networking. |
18:18:54 | FromGitter | <kayabaNerve> There is rotating difficulties. |
18:18:55 | federico3 | a what? |
18:19:08 | FromGitter | <kayabaNerve> https://github.com/kayabaNerve/Currency/Reputation |
18:19:29 | FromGitter | <kayabaNerve> Proof of Work. Blocks are only added if they pass a mathematical question that verify work was done |
18:19:51 | FromGitter | <kayabaNerve> In this case, the question is if part of the hash is greater than the difficulty |
18:19:58 | FromGitter | <kayabaNerve> And currently, it's insecure as hell |
18:20:03 | FromGitter | <kayabaNerve> I'm just testing what I have |
18:20:13 | FromGitter | <kayabaNerve> 1) https://github.com/kayabaNerve/Currency/tree/master/Reputation |
18:20:46 | FromGitter | <kayabaNerve> It's only using the hash of the proof so if you find a valid proof, you can use it infinitely. I understand that. I'm working on it. |
18:21:57 | FromGitter | <kayabaNerve> @Varriount Any ideas? |
18:22:40 | FromGitter | <kayabaNerve> I can upload a larger C fragment if necessary. That just looks to be the proper section. Obfuscated as hell... (yet I'm sure a obfuscator would be way worse) |
18:24:58 | Araq | using -d:release helps to clean up the C code fwiw |
18:25:18 | FromGitter | <kayabaNerve> Clean up for efficiency or readability? |
18:25:24 | FromGitter | <kayabaNerve> Or both? |
18:25:26 | Araq | readability |
18:25:37 | FromGitter | <kayabaNerve> Thanks. That seems... backwards but I'll take it |
18:25:37 | Araq | well efficiency is its primary goal |
18:25:47 | Araq | but readability improves as a side effect |
18:26:32 | FromGitter | <kayabaNerve> Got it. Thanks for the tip |
18:26:38 | FromGitter | <kayabaNerve> Now it's: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b01bdddb84be71db9209a17] |
18:27:07 | FromGitter | <kayabaNerve> Nope. I messed up, Didn't reload the file. |
18:27:15 | FromGitter | <kayabaNerve> Sorry |
18:27:40 | * | metaden92[m] quit (*.net *.split) |
18:27:40 | * | planetis[m] quit (*.net *.split) |
18:27:40 | * | libman[m] quit (*.net *.split) |
18:27:40 | * | endes[m] quit (*.net *.split) |
18:27:40 | * | TheManiac quit (*.net *.split) |
18:27:40 | * | stisa quit (*.net *.split) |
18:27:41 | * | skrzyp quit (*.net *.split) |
18:27:41 | * | craigger quit (*.net *.split) |
18:27:41 | * | cornfeedhobo quit (*.net *.split) |
18:27:43 | * | kugelfisch is now known as qwertfisch |
18:27:49 | * | craigger joined #nim |
18:28:34 | FromGitter | <kayabaNerve> It doesn't change at all. Even when I use -d:release and also -f |
18:30:09 | * | skrzyp joined #nim |
18:31:29 | FromGitter | <kayabaNerve> I also tried wrapping it into my... in progress String based number class, which goes digit by digit to compare (ASCII codes), and had similar results. I don't see any... truncation? Printing issues? Overflows? In the values though. |
18:36:35 | Araq | raise newException(IndexError, "key not in object") |
18:36:35 | Araq | # :-( |
18:36:42 | Araq | that's a KeyError then... |
18:37:10 | Araq | also, not sure this should raise at all... |
18:38:38 | FromGitter | <Varriount> dom96: I have a major improvement to NimLime in the works. |
18:39:05 | FromGitter | <Varriount> Araq: Is this for a table? |
18:39:10 | dom96 | Varriount: great, but maybe you could make this quick fix? |
18:39:44 | Araq | varriount, that's json.nim |
18:40:07 | FromGitter | <Varriount> dom96: https://github.com/Varriount/NimLime/blob/master/NimLime.sublime-settings#L167 |
18:40:22 | dom96 | crem ^ |
18:40:34 | * | cornfeedhobo joined #nim |
18:40:44 | * | gokr joined #nim |
18:41:05 | FromGitter | <Varriount> I love it when I go to great lengths for configurability, and then no-one reads the actual settings. :/ |
18:41:16 | * | stisa joined #nim |
18:41:30 | Araq | configurability is no substitute for good defaults |
18:42:46 | * | metaden92[m] joined #nim |
18:42:46 | * | planetis[m] joined #nim |
18:42:46 | * | endes[m] joined #nim |
18:43:36 | * | libman[m] joined #nim |
18:43:58 | * | rauss quit (*.net *.split) |
18:43:58 | * | m712 quit (*.net *.split) |
18:43:58 | * | crem quit (*.net *.split) |
18:43:59 | * | narimiran[m] quit (*.net *.split) |
18:43:59 | * | tersec quit (*.net *.split) |
18:43:59 | * | def- quit (*.net *.split) |
18:43:59 | * | ketralnis quit (*.net *.split) |
18:44:05 | FromDiscord | <citycide> Araq: sounds like a quote fit for the top of one of Nims docs pages 😉 |
18:44:08 | * | m712 joined #nim |
18:44:13 | * | def- joined #nim |
18:44:16 | * | rauss joined #nim |
18:44:23 | FromGitter | <Varriount> The default is needed to show hints. It just so happens that GC hints are included (but not wanted) |
18:44:25 | * | crem joined #nim |
18:44:26 | FromGitter | <kayabaNerve> How is Nim Atom while editors are up? |
18:44:33 | * | ketralnis joined #nim |
18:44:44 | * | tersec joined #nim |
18:44:48 | FromGitter | <kayabaNerve> I've only used Aporia for Nim but I've used Atom for the past 6 months or so and would like to stick with it |
18:46:04 | FromGitter | <Varriount> Meh, I'm sticking with Sublime Text, if only on the grounds that it's more efficient with my computer's resources and battery. |
18:46:17 | FromDiscord | <citycide> @kayabaNerve I haven't used anything else but vscode's is top notch |
18:47:26 | FromGitter | <kayabaNerve> I just hate VS :P |
18:47:54 | FromGitter | <kayabaNerve> Varriount: I got a Razer Blade just so I could run editors. browsers, and apps at once |
18:47:58 | FromGitter | <kayabaNerve> Not really an issue for me |
18:48:15 | FromGitter | <kayabaNerve> That said, it doesn't fix my bugs.... still looking over this if statement |
18:48:23 | FromGitter | <kayabaNerve> I can't tell if it's me, Nim, or C |
18:48:48 | FromDiscord | <citycide> @kayabaNerve not VS, VS Code. very different |
18:48:59 | FromGitter | <kayabaNerve> I hate every Visual Studio product |
18:49:05 | FromGitter | <kayabaNerve> Every product in the VS Suite |
18:49:18 | FromDiscord | <citycide> really wouldn't put VS code in that category at all but ok |
18:49:23 | FromGitter | <kayabaNerve> I have both on my laptop due to dependencies |
18:49:30 | FromGitter | <kayabaNerve> They both infuriate me |
18:50:11 | * | narimiran[m] joined #nim |
18:50:25 | FromGitter | <kayabaNerve> Also, what's the FromDiscord bit? Is there a Nim channel on a server or a Nim Discord? |
18:51:24 | FromGitter | <Varriount> @kayabaNerve Ah, I tried one of those. How's the battery life on that? |
18:51:26 | FromGitter | <ephja> wasn't there a flag to get more detailed dll loading errors? |
18:51:50 | FromGitter | <Varriount> I sent mine back and got a dell XPS, as the battery life wasn't what I needed. |
18:52:03 | FromGitter | <kayabaNerve> @Varriount Not going to lie, I use it as a Desktop most of the time. I just occasionally travel and didn't want to use the external GPU thingy |
18:52:14 | FromGitter | <Varriount> Ah, makes sense then. |
18:52:26 | FromDiscord | <citycide> @kayabaNerve there's a Discord, Gitter & irc and they're all bridged together |
18:52:26 | FromGitter | <kayabaNerve> I also don't see that big of a difference with the Stealth in size/weight. Sure it's moticeable but not if I'm moving around |
18:52:38 | FromGitter | <Varriount> @kayabaNerve Oh, you got the stealth? |
18:52:42 | FromGitter | <kayabaNerve> Can I lift it with 2 fingers? No. Can I put in a backpack without bending over? Yes |
18:52:45 | FromGitter | <kayabaNerve> No |
18:52:48 | FromGitter | <kayabaNerve> I got the regular |
18:52:53 | FromGitter | <Varriount> Ah, ok. |
18:53:06 | FromGitter | <kayabaNerve> I wanted the internal GPU. Stealth just has Intel Integrated |
18:53:09 | FromGitter | <kayabaNerve> GTX 1060 FTW |
18:53:14 | FromGitter | <Varriount> Yep. :D |
18:53:17 | FromGitter | <kayabaNerve> citycide: Link me? |
18:53:31 | FromGitter | <kayabaNerve> The 17" pro is ridiculous though |
18:53:50 | FromDiscord | <citycide> @kayabaNerve https://discord.gg/YUTdxG |
18:53:50 | FromGitter | <kayabaNerve> That's a desktop with a UPS and everything it needs built in (monitor, keyboard, mouse) |
18:54:04 | * | TheManiac joined #nim |
18:54:05 | FromGitter | <kayabaNerve> Same for all the MSI 18" dual power brick monstrosities |
18:54:11 | FromGitter | <Varriount> 17" laptops tend to be too heavy for me. |
18:54:13 | FromGitter | <kayabaNerve> Razer Blade is a nice mix of power and mobility |
18:54:16 | FromGitter | <kayabaNerve> Agreed |
18:54:44 | FromDiscord | <Kayaba> @citycide Thanks citycide |
18:54:48 | FromDiscord | <Kayaba> @citycide Thanks |
18:54:58 | FromDiscord | <citycide> 👍 |
18:54:58 | FromGitter | <kayabaNerve> Edits count as a new message? Weird |
18:55:29 | FromGitter | <Varriount> @kayabaNerve `(NU32)(T9_) < (NU32)(T10_)` -> You're compiling on a 32 bit machine? |
18:55:34 | FromGitter | <kayabaNerve> I understand why. The discord.js lib has a hook for message(msg), and messageUpdate(oldMsg, newMsg) |
18:55:49 | FromGitter | <kayabaNerve> @Varriount Nope. 64 bit thick and through. All the software is too IIRC |
18:55:55 | FromGitter | <kayabaNerve> I just want 32 bit ints |
18:56:07 | FromGitter | <Varriount> And you're sure they aren't just wrapping around? |
18:56:07 | FromGitter | <kayabaNerve> I'm changing to a multiprecision setup soon |
18:56:20 | FromGitter | <kayabaNerve> For now my hack was uint32 though |
18:56:25 | FromGitter | <kayabaNerve> I'm converting a 8 digit hex string |
18:56:30 | FromGitter | <ephja> the libui examples work when generated with VS. I shouldn't have to compile with gcc for nim, right? |
18:56:50 | FromGitter | <Varriount> @kayabaNerve By the way, have you looked at the NimCrypto library? |
18:57:20 | FromGitter | <kayabaNerve> So I'm at the max value of a 32 bit int if I hit ffffffff |
18:57:22 | FromGitter | <kayabaNerve> And yes |
18:57:28 | FromGitter | <kayabaNerve> It didn't have what I wanted |
18:57:45 | FromGitter | <kayabaNerve> Well it did. It just also had a ton of stuff I didn't want, and I had better ways of getting access to what I wanted |
18:58:21 | FromGitter | <Varriount> Ah, just wanted to make sure. I'm using it's md5 and hashing stuff for this AWS library. |
18:58:38 | FromDiscord | <Kayaba> Isn't there a standard lib for md5? |
18:58:43 | FromDiscord | <Kayaba> And thanks for checking |
18:58:56 | FromGitter | <Varriount> I need SHA and MAC stuff |
18:59:08 | FromDiscord | <Kayaba> Got it |
18:59:48 | FromDiscord | <Kayaba> I used C for SHA512. It was my test dummy for loading c libs from Nim as I need a few |
19:00:17 | FromDiscord | <Kayaba> I also just liked the c code better. I found some unlicensed code with horrible formatting that I cleaned up. Just a couple hundred lines... |
19:00:33 | FromDiscord | <Kayaba> I think Nim SHA is 600. Maybe because it has multiple bit sizes? |
19:00:48 | FromDiscord | <Kayaba> Also, for the Nim behind this messed up if statement: https://github.com/kayabaNerve/Currency/blob/master/Reputation/Difficulty.nim |
19:01:22 | FromDiscord | <Kayaba> L19 |
19:02:13 | FromGitter | <tim-st> is it possible to add `likely` to a specific case instead of if? |
19:03:15 | FromGitter | <tim-st> of should I replace the case by likely if and elif ? |
19:15:32 | federico3 | any way to get an object type as a string e.g. $type(foo) ? |
19:21:50 | FromGitter | <mratsim> import typetraits foo.type.name? |
19:26:02 | federico3 | oh, there's "name" - thanks mratsim |
19:34:23 | FromDiscord | <ZarsBranchkin> Also that library has `$` operator as alias for name, so `$type(foo)` with it imported would work as well |
19:37:08 | FromDiscord | <awr> wrt the laptop discussion I've heard a lot of praise about the XPS * series |
19:42:09 | FromDiscord | <awr> it's pretty cool that laptops now can have desktop-class graphics and not just something "a step behind" |
19:42:27 | * | smt` joined #nim |
19:44:33 | * | smt quit (Ping timeout: 248 seconds) |
19:46:49 | * | FuntDobra joined #nim |
19:57:09 | * | sherjilozair joined #nim |
20:09:57 | * | Zevv joined #nim |
20:10:22 | Zevv | Hi - how do I await on more then one future in parallel? |
20:11:43 | * | sherjilozair left #nim ("Leaving...") |
20:15:28 | FromGitter | <krux02> awr: laptops will never have the same level graphis as desktop, just alone because of the power consumption |
20:16:27 | FromGitter | <krux02> there is a price you have to pay to be mobile. |
20:17:29 | FromGitter | <kayabaNerve> @krux02 Which is why I also bought a Desktop :P Threadripper, 1080 Ti, 32gb of RAM... |
20:19:57 | FromGitter | <krux02> @kayabaNerve: for a time I had a desktop with four times that spec |
20:21:05 | * | FuntDobra quit (Ping timeout: 245 seconds) |
20:22:00 | FromGitter | <kayabaNerve> @krux02 2 Xeons, Titan Xs in SLI, 128gb of RAM? |
20:22:09 | FromGitter | <kayabaNerve> The Threadrpper is two Ryzens |
20:22:14 | FromGitter | <kayabaNerve> I'm getting another 32GB soon |
20:24:18 | FromGitter | <mratsim> @krux02 GTX 1060 for laptops is actually slightly overclocked compared to the desktop version and has better perf |
20:25:07 | FromGitter | <krux02> I don't know the exact spec anymore, because I just don't remember those GPU names, but it was 4 GPUs and 128gb of RAM |
20:25:40 | FromGitter | <krux02> and I think it was 2 CPU with 8 cores each plus hyperthreading |
20:25:49 | FromGitter | <krux02> so 32 virtual cores |
20:26:56 | FromGitter | <kayabaNerve> 32 threads |
20:27:02 | FromGitter | <kayabaNerve> And that's 2x, not 4x :P |
20:27:40 | FromGitter | <kayabaNerve> (well. Likely. GPU performance doesn't scale directly, 1080 Ti is likely better performing, I have 16 threads and likely a better clockrate) |
20:27:44 | FromGitter | <krux02> @mratsim people always say that "now we really have the same performance of laptops as on desktops" people said that 10 years ago, 20 years ago, whatever time you put |
20:27:52 | FromGitter | <krux02> things are always improving |
20:27:59 | * | nsf quit (Quit: WeeChat 2.1) |
20:28:06 | FromGitter | <kayabaNerve> It's close though |
20:28:09 | FromGitter | <tim-st> when I define a array of tuple with values like `10u8` should I write every single link the `u8` suffix or does the compiler understand that the first line should be applied to all lines? |
20:28:18 | FromGitter | <tim-st> *line |
20:28:30 | FromGitter | <mratsim> I’m not sure the compiler can do nested inference |
20:28:35 | FromGitter | <mratsim> try to use mapLiterals |
20:28:45 | FromGitter | <tim-st> how does it work? |
20:29:02 | FromGitter | <krux02> but the performance of that desktop machine was ASS. It had great specs on the paper, but really starting anything was crap. |
20:29:06 | FromGitter | <mratsim> there is an example in sequtils, I’m not sure it works for arrays though. |
20:29:30 | FromGitter | <krux02> It used windows 10 and something called "mosaic" I think to connect to 15 connected monitors |
20:29:58 | FromGitter | <tim-st> @mratsim yes, could work, thank you |
20:30:24 | FromGitter | <krux02> but you can't just assume software that is written for one GPU to just scale to 4 GPUs connected to 15 monitors |
20:30:46 | FromGitter | <krux02> I really didn't like to work on that machine. |
20:31:03 | FromGitter | <kayabaNerve> I hear POSTing that much RAM takes forever |
20:31:17 | FromGitter | <krux02> (mostly because of windows, but also because everything fels so slow even though it should have felt awesomely fast) |
20:31:26 | FromGitter | <mratsim> My “desktop” (actually server) only has a Xeon E3-1230v5 (equivalent Skylake i7-6600 without GPU) + 1070 + 16GB ECC RAM. |
20:31:28 | FromGitter | <kayabaNerve> (literal minutes; compare that to a fraction of a second though with 16gb of RAM) |
20:31:37 | FromGitter | <krux02> POSTing? |
20:31:37 | FromGitter | <kayabaNerve> That's still a great build @mratsim |
20:31:50 | FromGitter | <kayabaNerve> https://en.wikipedia.org/wiki/Power-on_self-test |
20:31:54 | FromGitter | <mratsim> It has up to 14 SATA ports though :D |
20:32:05 | FromGitter | <kayabaNerve> @mratsim Where do you live? |
20:32:10 | FromGitter | <kayabaNerve> When will you be out of the house? |
20:32:13 | FromGitter | <mratsim> France |
20:32:15 | FromGitter | <kayabaNerve> Are you human and can you be shanked? |
20:32:30 | FromGitter | <mratsim> I’m out almost everyday of the week to dance =) |
20:32:31 | FromGitter | <kayabaNerve> Do you prefer your gut or your neck looking pretty? |
20:32:40 | FromGitter | <kayabaNerve> #AskingTheRealQuestions |
20:32:52 | FromGitter | <ephja> will trade for APU from 2013. much value |
20:33:05 | FromGitter | <kayabaNerve> Lol |
20:33:27 | * | Zevv left #nim (#nim) |
20:34:05 | Araq | Zevv: by using 'or' for the Futures |
20:34:24 | Araq | too bad he already left, maybe he will read it in the logs though |
20:35:33 | FromGitter | <kayabaNerve> People leave? Sounds like a poor decision |
20:35:49 | Araq | I mean he left IRC |
20:36:00 | FromGitter | <kayabaNerve> Yeah |
20:36:03 | FromGitter | <kayabaNerve> Leaving at all |
20:36:16 | FromGitter | <kayabaNerve> We got genius people here with great personalities |
20:36:42 | FromGitter | <kayabaNerve> A mix of quality help, quality progress, and quality offtopic discussions |
20:39:09 | Araq | thanks |
20:40:29 | FromGitter | <tim-st> it wont work (tested with mapLiterals too) :( |
20:40:29 | FromGitter | <tim-st> const highPrimaryWeights = @[ ⏎ (0u16, 0u16), ⏎ (1, 1), ⏎ ] [https://gitter.im/nim-lang/Nim?at=5b01dd3d1cfca775e124532a] |
20:41:10 | FromGitter | <tim-st> (without declaring u16 on every line) |
20:43:05 | FromGitter | <mratsim> const highPrimaryWeights: array[2, (uint16, uint16)] = [ ⏎ (0, 0), ⏎ (1, 1), ⏎ ] ⏎ Does this work? I don’t think nested literals would be converted automatically though [https://gitter.im/nim-lang/Nim?at=5b01ddd9b84be71db921008f] |
20:44:12 | FromGitter | <tim-st> @mratsim no :( I tried the same, it doesnt, although it's perfectly well defined |
20:44:13 | FromGitter | <ephja> don't think so. reported a similar limitation for ranges |
20:45:32 | FromGitter | <ephja> it can get especially verbose for ranges |
20:45:32 | FromGitter | <mratsim> I think you’re out of luck, use an editor with multi cursor. |
20:46:22 | Araq | iirc mapLiterals works recursively |
20:46:24 | FromGitter | <mratsim> Don’t worry it would still be better than go’s poor man generics: https://qph.ec.quoracdn.net/main-qimg-dd2dc3bc72b058b85774ee804a521165 |
20:46:40 | FromGitter | <tim-st> ok, thanks, it's just bad to have 130_000 times uX written where the file size of source gets much higher |
20:47:27 | FromGitter | <mratsim> if those are known at compile-time you can always pass those to a macro. |
20:47:48 | FromGitter | <tim-st> thats too much work and increases compile time, I think |
20:48:11 | * | yglukhov quit (Read error: Connection reset by peer) |
20:48:44 | * | yglukhov joined #nim |
20:51:50 | * | Vladar quit (Quit: Leaving) |
21:06:53 | FromGitter | <kayabaNerve> @mratsim I think Ifixed my UInt lib |
21:07:04 | FromGitter | <kayabaNerve> Max value of 2^3.3^32 -1 |
21:07:06 | FromGitter | <kayabaNerve> Or so |
21:07:12 | FromGitter | <kayabaNerve> It might be 3.3^2 |
21:07:16 | FromGitter | <kayabaNerve> I don't actually know |
21:11:56 | FromGitter | <mratsim> lol |
21:12:42 | FromGitter | <kayabaNerve> 1) 3^2^32 -1 ofc |
21:12:46 | FromGitter | <kayabaNerve> Not just 3.3^2 |
21:13:06 | FromGitter | <mratsim> why 3.3 ? |
21:13:15 | FromGitter | <kayabaNerve> That's roughly the needed bits for 10 values |
21:13:21 | FromGitter | <mratsim> ah I see |
21:13:23 | FromGitter | <kayabaNerve> 2^3.3 |
21:13:52 | FromGitter | <kayabaNerve> Yeah. the mod function is slow as hell, and broken |
21:13:53 | FromGitter | <kayabaNerve> BUT |
21:13:56 | FromGitter | <kayabaNerve> The rest works |
21:14:11 | FromGitter | <kayabaNerve> Solution? Delete the mod function |
21:14:14 | FromGitter | <kayabaNerve> What mod function |
21:14:56 | FromGitter | <kayabaNerve> Enjoy https://github.com/kayabaNerve/Currency/blob/master/lib/UInt.nim |
21:18:57 | * | CodeVance quit (Quit: Leaving.) |
21:19:36 | * | CodeVance joined #nim |
21:26:09 | FromGitter | <Varriount> @kayabaNerve So it was the mod function? |
21:33:28 | FromGitter | <mratsim> crypto without mod? that’s hardcore :P |
21:34:39 | FromGitter | <mratsim> I spent something like 2~3 days to implement the fastest mod possible in Stint. Even finding issues in the paper I implemented :/ |
21:41:03 | * | CodeVance quit (Quit: Leaving.) |
21:41:25 | * | CodeVance joined #nim |
21:45:33 | * | PMunch joined #nim |
21:46:08 | PMunch | crem, forgot to drop you a note but I made some extensive changes to parsetoml: https://github.com/NimParsers/parsetoml/issues/18 |
21:46:46 | PMunch | Oh woops, that was supposed to be #19 |
21:47:10 | FromGitter | <kayabaNerve> @Varriount What? |
21:47:26 | FromGitter | <kayabaNerve> @mratsim I had to add it back in and I'm not using this for keygen |
21:47:29 | FromGitter | <kayabaNerve> Just balance handling |
21:47:38 | FromGitter | <kayabaNerve> Whats the best way to insert a character? |
21:47:50 | FromGitter | <kayabaNerve> I found insertSep but I only want to insert it once 3 places in from the right |
21:48:03 | FromGitter | <kayabaNerve> (abcdefghi.jkl) |
21:48:35 | FromGitter | <kayabaNerve> Use substrings and &? |
21:49:43 | FromGitter | <mratsim> not familiar with strutils (who needs strings?) but there should be an insert function, don’t slice and & that would allocate extra fluff |
21:50:07 | FromGitter | <kayabaNerve> Like this? strRate.substr(0, strRate.len-3) & "." & strRate.substr(strRate.len-3, 3) |
21:50:17 | FromGitter | <kayabaNerve> I checked strutils; only found insertSep |
21:50:40 | FromGitter | <kayabaNerve> system.nim proc insert(x: var string; item: string; i = 0.Natural) {..} |
21:50:41 | FromGitter | <kayabaNerve> Thanks |
22:06:40 | FromGitter | <tim-st> Is it ok to store data in an array when only ~30% is used? the total size would be 260kb |
22:07:05 | * | ARCADIVS quit (Ping timeout: 240 seconds) |
22:14:58 | * | Trustable quit (Remote host closed the connection) |
22:18:13 | FromGitter | <mratsim> That’s over 10% of your stack on Unix. I would use a ref array or a seq for that. |
22:19:09 | FromGitter | <tim-st> it's const memory, the other choice would be use minimal perfect hash function, but this would slow down quite a bit |
22:19:33 | FromGitter | <mratsim> if it’s known at compile-time it’s fine, it will be stored in the BSS of your program. |
22:19:53 | FromGitter | <mratsim> https://en.wikipedia.org/wiki/.bss |
22:20:19 | FromGitter | <tim-st> thx, what would be the max size of an array that would be ok with "bss" |
22:20:34 | FromGitter | <tim-st> and would it still be quick like stack access? |
22:20:35 | FromGitter | <mratsim> any size, it just increase your binary size. |
22:20:44 | FromGitter | <mratsim> probably faster. |
22:21:23 | FromGitter | <tim-st> nice, thanks, would you prefer this way to have 260kb with 30% only used or size 80kb with slower runtime? |
22:21:30 | FromGitter | <mratsim> the first access would have to be done from disk, but further access would be as fast as stack if data is kept in L2~L3 cache |
22:21:49 | FromGitter | <tim-st> L2 is only 2mb or not? |
22:22:39 | FromGitter | <mratsim> L2 is 256KB on Haswell |
22:22:55 | PMunch | "lib/pure/random.nim(176, 3) Error: cannot evaluate at compile time: state" can't random be used at compile-time? |
22:23:10 | FromGitter | <mratsim> @PMunch, there is a var state |
22:23:22 | FromGitter | <mratsim> it’s seeded with /dev/urandom or the current time |
22:23:43 | PMunch | Yeah I tried to call randomize(0) to avoid that |
22:23:49 | FromGitter | <tim-st> ok, thanks, so only the retrieved items are stored in L2 not the whole const array of 260kb? |
22:23:51 | FromGitter | <mratsim> but if you set an initial see you can use it at compile-time iirc |
22:24:14 | * | ARCADIVS joined #nim |
22:24:17 | FromGitter | <mratsim> @tim-st basically the CPU will retrieve by cache-line, i.e. 64B by 64B |
22:25:00 | FromGitter | <tim-st> ok, thanks, I think my first version can use it this way then^^ |
22:25:09 | FromGitter | <mratsim> @Pmunch compile-time random: https://github.com/mratsim/golem-prime/blob/master/src/montecarlo/mc_zobristhash.nim#L13-L27 |
22:25:39 | PMunch | Ah right, so I basically need to keep my own state |
22:25:54 | FromGitter | <mratsim> you have to set your own random seed, and pass it to all compile-time random library calls: var rng = initRand(0x1337DEEDBEAF) # Completely arbitrary random seed |
22:26:15 | FromGitter | <mratsim> arf I manage to make a typo |
22:34:02 | PMunch | Hmm, damn.. I need to use the same seed as it uses by default.. |
22:37:52 | PMunch | Eh, I was just trying to make "main_cheating.nim" for the completely unscientific benchmark :P |
22:38:17 | PMunch | Basically doing all the compilation on compile-time and just output the result on runtime |
22:40:42 | * | sz0 joined #nim |
22:46:22 | * | leorize quit (Quit: WeeChat 2.1) |
22:46:41 | * | tefter joined #nim |
22:48:53 | PMunch | Hmm, peculiar: http://ix.io/1aUU/Nim this gives a wrong result of 81, removing the {.compileTime.} pragma makes it produce the correct result of 331665 |
23:09:11 | dom96 | sounds like a VM bug |
23:10:58 | FromGitter | <mratsim> seems like C++ took back the crown |
23:11:13 | FromGitter | <mratsim> with pool allocation |
23:16:29 | FromDiscord | <Aearnus> hey, I've got a bit of a problem. I'm trying to define a ```nim |
23:16:29 | FromDiscord | <Aearnus> proc `$`[T](x: Ordinal[T])``` |
23:16:29 | FromDiscord | <Aearnus> but I can't figure out how to convert an ordinal back to an int |
23:18:14 | FromDiscord | <Aearnus> (also, on an unrelated note: how can I upload packages to nimble? i wrote an `either` type that would be useful to contribute) |
23:20:50 | FromDiscord | <citycide> @Aearnus https://github.com/nim-lang/nimble#publishing-packages |
23:21:05 | FromDiscord | <Aearnus> ah, `int(x)`. that was waay harder to find than necessary |
23:21:07 | FromDiscord | <Aearnus> and thanks! |
23:21:29 | FromDiscord | <citycide> TLDR `nimble publish` |
23:21:49 | FromDiscord | <Aearnus> `nimble publish` automatically makes a PR? |
23:21:55 | FromDiscord | <citycide> yup! |
23:22:02 | FromDiscord | <Aearnus> that's strange |
23:22:10 | FromDiscord | <Aearnus> but I guess I'll take it ¯\_(ツ)_/¯ |
23:22:57 | FromDiscord | <citycide> I'm guessing the plan in the future is to move to a registry separate from github |
23:23:38 | FromDiscord | <Aearnus> that'd probably be smart |
23:23:48 | FromDiscord | <Aearnus> Nix uses github though and they seem to not have issues |
23:24:07 | FromDiscord | <citycide> most package managers have as a start. npm did and probably a few others |
23:24:19 | PMunch | mratsim, yeah I saw |
23:24:29 | PMunch | Considering to add pools to the Nim version as well |
23:24:37 | PMunch | dom96, hmm that's not good |
23:24:55 | FromDiscord | <Aearnus> that just doesn't _feel_ right |
23:25:15 | * | chris_ joined #nim |
23:25:24 | * | chris_ is now known as sworah |
23:26:04 | FromDiscord | <citycide> why am I being warned by nimble about the `pkg` suffix on Windows, I thought that was the standard |
23:28:54 | FromDiscord | <Aearnus> how do you add a docstring to a function? |
23:29:06 | FromDiscord | <Aearnus> how do you add a docstring to a proc? |
23:29:35 | FromDiscord | <Aearnus> unless that's not a thing -- but I assume it is, having read module docs |
23:29:48 | FromDiscord | <citycide> ```nim |
23:29:48 | FromDiscord | <citycide> proc foo () = |
23:29:48 | FromDiscord | <citycide> ## This is a docstring |
23:29:48 | FromDiscord | <citycide> discard |
23:29:48 | FromDiscord | <citycide> ``` |
23:29:49 | FromDiscord | <Aearnus> unless that's not a thing -- but I assume it is, having read autogenerated module docs |
23:33:04 | FromDiscord | <Aearnus> here's a strange question: should I put my real name or my handle in the `author` field for the package? some communities are strict about stuff like this |
23:36:49 | * | tefter quit (Remote host closed the connection) |
23:37:20 | Araq | real name is way more common afaict |
23:42:07 | * | sworah quit (Quit: leaving) |
23:43:34 | FromDiscord | <Aearnus> Alright cool |
23:43:54 | FromDiscord | <Aearnus> Any particular reason why Nim doesn't come with an either type? It's strange, considering it comes with a maybe type |
23:44:34 | * | sworah joined #nim |
23:45:06 | * | sworah quit (Client Quit) |
23:45:31 | FromDiscord | <Aearnus> I'm a Haskell guy so that was one of the first things I needed to use haha |
23:45:36 | * | xet7 quit (Remote host closed the connection) |
23:51:03 | FromGitter | <Varriount> What exactly do you mean by "either type"? |
23:51:58 | FromDiscord | <citycide> like Rust's `Result`, it either contains an error or the value |
23:53:46 | FromGitter | <data-man> ```code paste, see link``` ⏎ ⏎ @Araq: If proc a () it's not used, the compiler in any case processes «bigdata.inc»? [https://gitter.im/nim-lang/Nim?at=5b020a895666c42eb6286ec0] |
23:54:58 | FromDiscord | <Aearnus> ```nim |
23:54:59 | FromDiscord | <Aearnus> type |
23:54:59 | FromDiscord | <Aearnus> EitherKind = enum |
23:54:59 | FromDiscord | <Aearnus> leftKind, rightKind |
23:54:59 | FromDiscord | <Aearnus> Either[L,R] = object |
23:54:59 | FromDiscord | <Aearnus> case kind: |
23:55:00 | FromDiscord | <Aearnus> of leftKind: |
23:55:00 | FromDiscord | <Aearnus> left: L |
23:55:01 | FromDiscord | <Aearnus> of rightKind: |
23:55:02 | FromGitter | <Araq> sure |
23:55:03 | FromDiscord | <Aearnus> right: R |
23:55:04 | FromDiscord | <Aearnus> ``` |
23:57:17 | FromGitter | <data-man> Hmm, compiler could be more smarter. :) |
23:57:58 | FromGitter | <data-man> Oh, "smart" was deprecated. |