00:04:05 | * | heinrich5991 quit (Ping timeout: 240 seconds) |
00:04:36 | * | Widdershins joined #nim |
00:04:55 | AlexMax | (and I'd really rather not the Nim GCC be in my path, because I have several GCC's on my system) |
00:05:27 | shashlick | ya if you set the CC environment variable, nimgen will use that instead |
00:06:40 | * | heinrich5991 joined #nim |
00:09:18 | AlexMax | shashlick: gcc -E runs the preprocessor, right and gives you nothing but macro expansions, right? |
00:11:10 | AlexMax | I guess that means that you get whatever defines are in the header already... |
00:11:50 | AlexMax | unwrapped |
00:12:17 | * | vqrs quit (Ping timeout: 255 seconds) |
00:12:51 | AlexMax | Sorry - I think I knew at some level that your solution would involve nimgen, but I'm not sure I understood all of the ramifications of it ahead-of-time |
00:13:06 | AlexMax | I might still use my own homespun library |
00:13:23 | AlexMax | dunno, haven't gotten to the part where I actually _need_ it yet |
00:13:33 | AlexMax | just thought I'd mess around with it for funsies |
00:13:42 | AlexMax | and now at least I know how to add in .c files |
00:14:30 | shashlick | okay |
00:14:38 | shashlick | but does setting CC allow the install? |
00:17:37 | AlexMax | https://paste.ee/p/D2dAU |
00:18:39 | * | vqrs joined #nim |
00:20:18 | shashlick | CC=xyz\gcc.exe |
00:20:40 | * | skelett1 quit (Read error: Connection reset by peer) |
00:22:21 | * | skelett1 joined #nim |
00:24:22 | AlexMax | shashlick: That's how you set localized environment variables in powershell |
00:24:27 | AlexMax | $env:CC |
00:25:52 | shashlick | no but you are setting it to the path and no the binary |
00:25:55 | AlexMax | oh |
00:26:10 | AlexMax | *john cleese agitha christie head thump* |
00:26:43 | AlexMax | Success: nimtess2 installed successfully. |
00:26:46 | AlexMax | there we go |
00:28:17 | shashlick | đź‘Ť |
00:32:16 | AlexMax | okay, i import it as nimtess2/tesselator which is a bit strange, but oh well |
00:32:24 | AlexMax | var x = tesselator.tessNewTess |
00:32:24 | AlexMax | echo repr(x) |
00:32:32 | AlexMax | gives me a memory address |
00:32:41 | AlexMax | so I suppose it at least didn't fly apart at the hinges? |
00:32:46 | AlexMax | thanks |
00:37:31 | shashlick | 🙂 |
00:40:49 | * | ftsf joined #nim |
00:42:27 | shashlick | if you import, you don't really need the full `tesselator.tessNewTess()`, you can just do `tessNewTess()` |
00:45:16 | shashlick | Unless you do `from x import nil` |
00:47:40 | AlexMax | I prefer namespaced functions |
00:47:51 | AlexMax | ...except if the namespace is in the identifier itself |
00:47:58 | AlexMax | which in this case it is |
00:48:18 | AlexMax | So I do sdl2.glSetAttribute |
00:48:30 | AlexMax | but then I turn around and glVertexAttribPointer |
01:08:22 | * | fredrik92 quit (Quit: Client Disconnecting) |
01:13:23 | * | wildlander quit (Quit: Konversation terminated!) |
01:17:05 | * | thomasross quit (Remote host closed the connection) |
01:17:32 | * | thomasross joined #nim |
01:32:00 | * | cspar quit (Ping timeout: 272 seconds) |
02:11:48 | FromGitter | <ephja> is `template foo(...) {.pragma.}` the only supported user pragma application right now? |
02:15:56 | AlexMax | https://puu.sh/BiO1L/c0e789294b.png |
02:16:05 | AlexMax | Nim is good for OpenGL programming, I guess :) |
02:16:36 | shashlick | nice work 🙂 |
02:17:06 | AlexMax | I'm saving the tesselator for the floors and ceilings |
02:22:28 | * | msmorgan_ joined #nim |
02:22:45 | * | odc_ joined #nim |
02:29:31 | * | syntonym[m] quit (*.net *.split) |
02:29:31 | * | zacharycarter[m] quit (*.net *.split) |
02:29:31 | * | sg-james[m] quit (*.net *.split) |
02:29:31 | * | narimiran[m] quit (*.net *.split) |
02:29:32 | * | codevance[m] quit (*.net *.split) |
02:29:32 | * | dyce[m] quit (*.net *.split) |
02:29:32 | * | msmorgan quit (*.net *.split) |
02:29:32 | * | odc quit (*.net *.split) |
02:33:02 | * | cspar joined #nim |
02:33:03 | * | heinrich5991 quit (Ping timeout: 252 seconds) |
02:34:34 | * | heinrich5991 joined #nim |
02:35:47 | * | sg-james[m] joined #nim |
02:35:51 | * | codevance[m] joined #nim |
02:35:56 | * | zacharycarter[m] joined #nim |
02:35:59 | * | syntonym[m] joined #nim |
02:36:42 | * | riidom_ joined #nim |
02:37:00 | * | dddddd quit (Remote host closed the connection) |
02:37:43 | * | narimiran[m] joined #nim |
02:38:18 | * | riidom quit (Ping timeout: 264 seconds) |
02:38:21 | * | dyce[m] joined #nim |
02:41:47 | * | druonysus quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
03:00:17 | * | damon-kwok joined #nim |
03:07:35 | * | damon-kwok quit (Ping timeout: 240 seconds) |
03:07:48 | * | damon-kwok joined #nim |
03:24:50 | * | damon-kwok quit (Remote host closed the connection) |
03:25:36 | * | damon-kwok joined #nim |
03:28:48 | * | damon-kwok quit (Remote host closed the connection) |
03:29:28 | * | damon-kwok joined #nim |
03:29:46 | * | endragor joined #nim |
03:34:22 | * | damon-kwok quit (Remote host closed the connection) |
03:36:35 | * | damon-kwok joined #nim |
03:42:23 | * | damon-kwok quit (Ping timeout: 260 seconds) |
03:43:43 | * | kapil____ joined #nim |
03:47:59 | * | Erenzie15 joined #nim |
03:50:28 | * | Erenzie15 quit (Remote host closed the connection) |
03:50:57 | * | druonysus joined #nim |
03:50:57 | * | druonysus quit (Changing host) |
03:50:57 | * | druonysus joined #nim |
04:00:01 | FromDiscord_ | <awr> ugh im so stupid |
04:00:06 | FromDiscord_ | <awr> fucked up my PR lol |
04:17:05 | * | damon` joined #nim |
04:20:17 | * | damon` quit (Remote host closed the connection) |
04:20:46 | * | damon` joined #nim |
04:30:40 | FromDiscord_ | <awr> ok lol i fixed it |
04:31:13 | FromDiscord_ | <awr> accidentally did my branch on top of another branch when i meant to do it on top of devel |
04:31:49 | FromDiscord_ | <awr> but fixed it now! |
04:32:57 | * | stefanos82 joined #nim |
05:05:52 | * | nsf joined #nim |
05:08:57 | * | heinrich5991 quit (Ping timeout: 240 seconds) |
05:12:22 | * | heinrich5991 joined #nim |
05:26:52 | * | ftsf quit (Ping timeout: 252 seconds) |
05:34:10 | * | damon` quit (Remote host closed the connection) |
05:59:29 | * | tzekid joined #nim |
06:05:52 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
06:08:30 | * | heinrich5991 joined #nim |
06:14:57 | * | heinrich5991 quit (Ping timeout: 240 seconds) |
06:18:12 | * | heinrich5991 joined #nim |
06:29:50 | * | tzekid quit (Ping timeout: 255 seconds) |
06:43:07 | FromGitter | <bung87> `let re_han = re(r"(*UTF)([\p{Han}]+)") split(line,re_han)`I found it very slow,it takes 3 seconds,all word segments takes 4.5 seconds in my test case. |
06:44:24 | * | Vladar joined #nim |
06:46:45 | * | tzekid joined #nim |
06:47:54 | * | tzekid quit (Remote host closed the connection) |
06:50:42 | stefanos82 | I have played with a silly example and got me confused. I have tried "var x: bool" which defaults to false. then I have tried "if x: echo x" and printed false as expected. then I have tried "if x: x = true" and tried to echoed x. To my surprise x is still false |
06:51:03 | stefanos82 | now, if I say "if x == false: x = true", then "echo x" prints true |
06:51:24 | stefanos82 | my question is: how does if statement evaluates the aforementioned example? |
06:54:51 | FromGitter | <narimiran> stefanos: the first example shouldn't print anything |
06:56:25 | FromGitter | <narimiran> this one: http://ix.io/1l0k/ |
06:56:45 | FromGitter | <narimiran> it is definitely not "expected to print false" |
06:58:11 | FromGitter | <narimiran> in the second example (`if x: x = true`) it is also working as expected - x is still false because `x = true` is not executed |
06:58:44 | FromGitter | <narimiran> `if x` is the same as if you have written `if x == true` |
06:59:01 | FromGitter | <narimiran> ^ stefanos82 |
06:59:30 | stefanos82 | much like C-domain languages then |
06:59:37 | stefanos82 | phew...I thought I got it all wrong |
07:00:01 | stefanos82 | I read such examples in various Nim tickets and thought that maybe something's different with Nim |
07:00:11 | stefanos82 | much like we can have a right associative operators |
07:26:19 | * | PMunch joined #nim |
07:35:43 | * | heinrich5991 quit (Ping timeout: 260 seconds) |
07:37:50 | * | heinrich5991 joined #nim |
07:44:19 | * | floppydh joined #nim |
07:57:33 | * | Entropic quit (Ping timeout: 252 seconds) |
07:59:52 | * | Entropic joined #nim |
08:01:49 | * | gangstacat joined #nim |
08:03:56 | * | gmpreussner_ joined #nim |
08:04:27 | * | gmpreussner quit (Ping timeout: 240 seconds) |
08:05:29 | * | gangstacat quit (Client Quit) |
08:18:57 | * | cspar quit (Ping timeout: 240 seconds) |
08:36:19 | * | qenthus1ast joined #nim |
08:55:48 | * | krux02 joined #nim |
08:56:47 | * | TheLemonMan joined #nim |
09:03:14 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
09:04:01 | * | odc_ quit () |
09:04:23 | * | odc joined #nim |
09:05:28 | * | heinrich5991 joined #nim |
09:09:21 | * | Arrrr joined #nim |
09:09:52 | Arrrr | Is ""/@[] now an alias for 'nil' ? |
09:14:08 | dom96 | yep |
09:15:04 | Arrrr | And I assume setting the len to 0 won't have the same effect, right? |
09:15:13 | FromGitter | <tim-st> dom96: is that also needed if my global var is read only? https://stackoverflow.com/a/49225758/3646022 |
09:15:56 | dom96 | Arrrr: no. 'nil' for string/seq is effectively gone |
09:16:06 | dom96 | It's just used as an optimisation in the background |
09:17:35 | Arrrr | I see. Thank you. |
09:18:03 | dom96 | tim-st: define it using `let`? |
09:18:52 | FromGitter | <tim-st> no, because it gets filled one time before server is started |
09:18:59 | FromGitter | <tim-st> would that allow it? |
09:19:22 | * | qenthus1ast quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
09:20:12 | FromGitter | <tim-st> the same using `let` |
09:20:30 | FromGitter | <tim-st> it's a table from which I only read |
09:20:59 | TheLemonMan | the real question is, should newSeq/newSeqOfCap(0) be optimized to nil? |
09:22:18 | FromGitter | <tim-st> When I create a global database handle it doesnt complain^^ |
09:25:54 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
09:26:14 | * | gangstacat joined #nim |
09:26:46 | * | heinrich5991 joined #nim |
09:32:25 | dom96 | tim-st: It might be better if you pass this data around instead of putting it in a global |
09:34:13 | PMunch | Hmm, just realized that Ruby has the `or` and `and` syntax I tried to implement for options. Although it works with nil and they're called `||` and `&&` like in bash. |
09:34:27 | FromGitter | <tim-st> dom96: it's a hashtable used as in memory database; I cant copy it :\ |
09:34:46 | FromGitter | <tim-st> (*as readonly in memory db) |
09:34:50 | dom96 | use a 'ref'? |
09:35:28 | FromGitter | <tim-st> but still I have to define it somewhere, this needs to be the global scope I think |
09:36:50 | dom96 | hm |
09:37:21 | FromGitter | <tim-st> from my tests it seems to work; but I often hear: "DONT DO IT" shring this between threads... |
09:37:30 | FromGitter | <tim-st> *sharing |
09:38:00 | dom96 | yeah, with Jester I suppose you need globals |
09:38:15 | dom96 | The forum uses globals too |
09:38:37 | FromGitter | <tim-st> also a shared table, seq, string or set? |
09:38:59 | FromGitter | <tim-st> I think only these are the trouble maker |
09:46:14 | FromGitter | <tim-st> ok, I see I could annotate the proc that accesses the global as `{.gcsafe.}` but for this I need to know if global readonly hashtable is allowed to access between threads or what could go wrong |
09:52:46 | * | seni joined #nim |
09:57:45 | * | theaetetus joined #nim |
10:01:05 | * | heinrich5991 quit (Ping timeout: 240 seconds) |
10:02:54 | * | heinrich5991 joined #nim |
10:03:07 | FromGitter | <tim-st> Is the same true for nims table? https://stackoverflow.com/a/1312389/3646022 |
10:04:23 | PMunch | @tim-st, no |
10:04:25 | * | theaetetus quit (Ping timeout: 268 seconds) |
10:04:36 | PMunch | Nim doesn't have a "Global Interpreter Lock" |
10:05:14 | FromGitter | <tim-st> yes, I know, I meant if read only access from a dict is safe like in python when using threads in nim |
10:05:18 | PMunch | Oh wait, nims |
10:05:19 | PMunch | Hmm |
10:05:25 | FromGitter | <tim-st> 1) from a table |
10:06:05 | PMunch | Well, if you have a table that no-one is writing to at the same time it should be safe to read from it from multiple threads |
10:06:23 | PMunch | Unless it does some strange caching things |
10:06:37 | FromGitter | <tim-st> PMunch: Thanks, that was my guess too, but I cannot find a source that confirms it |
10:06:41 | PMunch | Basically it's safe as long as no-one modifies anything while you're using a shared resource |
10:06:47 | PMunch | As a general rule |
10:07:06 | PMunch | It's not implicitly unsafe to read from the same static block of memory |
10:07:09 | FromGitter | <tim-st> ok, so I can try to ignore the global var hint |
10:07:22 | FromGitter | <tim-st> ok, thanks! |
10:07:34 | PMunch | I can't guarantee it though, but it should be safe |
10:07:49 | PMunch | And don't write to it! |
10:08:00 | FromGitter | <tim-st> Yes, it seems it's a topic where no one really knows in all languages^^ |
10:08:39 | FromGitter | <tim-st> I write to a file database and read from a hashmap |
10:08:51 | FromGitter | <tim-st> the file database is locked with transactions |
10:10:45 | PMunch | Well threading is still a bit of an open problem |
10:11:32 | PMunch | And most code is written with the expectation that it should be used only in a synchronous manner |
10:11:52 | FromGitter | <tim-st> ok, thanks for the answer, I will stay with my current global read only implementation unless tests fail |
10:12:40 | * | federico3 joined #nim |
10:13:18 | PMunch | You also have this though: https://nim-lang.org/docs/sharedtables.html |
10:13:38 | PMunch | But you need to use non-GC keys and values, so it's a bit limited |
10:14:48 | FromGitter | <tim-st> also this implementation allows read and write, since I only want to read I think I dont need locks |
10:15:19 | FromGitter | <tim-st> I meant delete and write |
10:17:48 | FromGitter | <GULPF> not sure but I think even reading readonly memory is unsafe if it's tracked by the GC |
10:19:04 | FromGitter | <GULPF> e.g see my question here: https://github.com/nim-lang/Nim/pull/8527#discussion_r207578319 |
10:21:04 | FromGitter | <tim-st> I think the gc only collects memory from the table if the table is not used anymore, since the table is open forever, the gc shouldnt remove memory at all |
10:23:09 | * | kobi7 joined #nim |
10:23:16 | kobi7 | hello |
10:23:43 | kobi7 | where can I read about the keyword 'static' ? is it the same as in c# / java ? |
10:26:36 | * | kobi7 quit (Client Quit) |
10:27:04 | * | kobi7 joined #nim |
10:27:53 | * | heinrich5991 quit (Ping timeout: 252 seconds) |
10:27:54 | FromGitter | <tim-st> kobi7: https://nim-lang.org/docs/manual.html#statements-and-expressions-static-statement-expression |
10:28:49 | kobi7 | thank you |
10:29:20 | kobi7 | What would I use for a static variable, you know, one that is not connected to an object, but to the type itself. |
10:30:05 | kobi7 | just put variables in the root level, maybe? |
10:30:11 | kobi7 | (I mean no indentation) |
10:30:30 | kobi7 | but that would associate them with the module, not the type. |
10:30:31 | * | heinrich5991 joined #nim |
10:30:58 | kobi7 | if it's not supported, what is the nim way for it? |
10:31:13 | * | justache2 joined #nim |
10:32:19 | kobi7 | What do you think tim-st? |
10:32:43 | FromGitter | <tim-st> I think this question is similar to one that was asked here before, either you put it in root level or you write a hack where you explicitly bind it to a type using a proc like: |
10:34:02 | FromGitter | <tim-st> ```type A = object ⏎ proc someValueForA*(_: typedesc[A]): int = 134 ⏎ echo A.someValueForA``` [https://gitter.im/nim-lang/Nim?at=5b7e8d9acff55e56174c1adb] |
10:34:46 | FromGitter | <tim-st> or was that exactly what you didnt want?^^ |
10:35:05 | kobi7 | oh, yeah, you showed me that last time. |
10:35:20 | kobi7 | so typedesc is a way to bind the variables? it's not very clear from the docs |
10:35:44 | kobi7 | I think docs should definitely present "how to do X" if you're coming from language Z |
10:35:50 | * | justache2 quit (Remote host closed the connection) |
10:35:53 | FromGitter | <tim-st> no, it's only a hack, I think it's not normal in nim; mostly you put it at module level |
10:37:55 | kobi7 | so more idiomatic would be to just prefix with the type name, at module level? |
10:39:08 | kobi7 | yea, it actually makes sense .. it's like a global. |
10:39:15 | FromGitter | <tim-st> I think without prefix; but if you want to translate a source code base 1:1 I think the way like in the source code above is prefered |
10:39:49 | kobi7 | at least a first iteration should be 1:1 as much as possible, imo |
10:40:54 | kobi7 | so instance vars are within the type decl, other vars are basically global, and procs are "static" unless have a first argument with the type name. |
10:41:07 | FromGitter | <tim-st> yes, the way above isnt bad, it's clear and you should prefer what is better to read and easy to understand |
10:41:51 | FromGitter | <tim-st> afaik procs are static, always, `method`s are not static |
10:42:04 | kobi7 | there is a problem with the code you put, it is that you can't write to the variable this way |
10:42:48 | FromGitter | <tim-st> yes, it's a getter; what is the code from the other language you want to achieve? |
10:43:20 | FromGitter | <tim-st> if you want to write you normaly do `proc writeToA*(a: var A, value: int) = ...` |
10:43:27 | kobi7 | just a simple static variable, in a class |
10:43:59 | kobi7 | ok, i'll just prefix. it's simpler |
10:44:15 | kobi7 | sorry for all the beginner questions. |
10:44:19 | FromGitter | <tim-st> you can also write the code as `proc someValueForA*(_: A): int = 134` then you can call it from the object |
10:44:54 | FromGitter | <tim-st> so you have the choice between `A.someValueForA` and `let a = A(); a.someValueForA` |
10:45:25 | kobi7 | what is the difference between a proc and a method |
10:46:22 | FromGitter | <tim-st> I think a method has "dynamic dispatch"; but if you want to achive a static var for a type; the normal nim way is naming a getter proc the same, i think |
10:47:21 | kobi7 | dynamic dispatch -- is that a runtime thing, like Dynamic ? |
10:47:47 | kobi7 | untyped? |
10:47:50 | FromGitter | <tim-st> yes, proc is better |
10:48:29 | kobi7 | but I can still do object oriented with proc |
10:48:58 | FromGitter | <tim-st> sure, it's the normal way to do object oriented using procs |
10:49:31 | FromGitter | <tim-st> just name the object as first param, then you can call like a.procName(b, c) |
10:49:36 | kobi7 | I see, so method isn't used much, unless it's for handling unknown types at runtime, maybe parsing text to code, etc. |
10:49:55 | FromGitter | <tim-st> yes, I dont use it |
10:50:09 | kobi7 | ok, awesome, thanks a lot |
10:50:25 | FromGitter | <gogolxdong> Is there a reference type string? |
10:50:57 | FromGitter | <gogolxdong> without quite breaking current code? |
10:52:46 | kobi7 | https://nim-lang.org/docs/nimc.html#optimizing-for-nim-optimizing-string-handling |
10:53:02 | kobi7 | is it for memory conserving purposes? |
10:53:43 | kobi7 | I think you can just make a ref type of string |
10:54:08 | * | dadabidet joined #nim |
10:58:04 | FromGitter | <mratsim> a.foo(b) is not object oriented programming, that’s method call syntax. |
10:58:21 | FromGitter | <gogolxdong> yes |
10:58:42 | FromGitter | <gogolxdong> without breaking stdlib. |
10:59:08 | FromGitter | <mratsim> type MyString {.shallow.} = object ⏎ data: string ⏎ ⏎ ^ @gogolxdong, this avoids pointer indirection [https://gitter.im/nim-lang/Nim?at=5b7e937cac25fd11b582013e] |
10:59:32 | FromGitter | <mratsim> or use shallow(myString) and allow future usage will be shallow |
10:59:40 | FromGitter | <mratsim> all future usages* |
11:00:33 | FromGitter | <mratsim> but you will probably have stdlib issue, because it assumes that strings deep copy. |
11:01:06 | * | kobi7 quit (Ping timeout: 256 seconds) |
11:01:38 | FromGitter | <gogolxdong> like body proc in httpclient.nim assignment once : |
11:01:53 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b7e942138a12915e4e4d81a] |
11:02:23 | * | heinrich5991 quit (Ping timeout: 268 seconds) |
11:02:48 | * | zachcart1r quit (Ping timeout: 260 seconds) |
11:02:55 | * | heinrich5991 joined #nim |
11:03:55 | * | ftsf joined #nim |
11:16:14 | * | noonien joined #nim |
11:20:01 | FromGitter | <tim-st> @mratsim do you have a guess about whether using a global readonly Table is safe to share between threads in nim? |
11:25:32 | FromGitter | <Araq> @tim-st: It's not safe |
11:25:44 | TheLemonMan | everything is safe if you're brave enough |
11:26:27 | FromGitter | <Araq> I just noticed the bridge is down again and you didn't see my messages :-( |
11:28:55 | * | NeddySeagoon28 joined #nim |
11:28:57 | FromGitter | <tim-st> @Araq thanks, oh, no nothing from you today^^ |
11:30:00 | * | ftsf quit (Ping timeout: 256 seconds) |
11:30:43 | * | NeddySeagoon28 quit (Remote host closed the connection) |
11:30:49 | TheLemonMan | Araq, what about transforming newSeq/newString(0) and <string/seq>.setLen(0) into literals so that we take advantage of the nil representation? yay or nay? (No matter what you say I already have a patch ready :) |
11:30:57 | * | Arrrr quit (Quit: Arrrr) |
11:33:33 | * | Vladar quit (Remote host closed the connection) |
11:38:55 | FromGitter | <Araq> as I said, we map @[] to nil and don't touch newSeq() etc. seemed fair to me |
11:53:13 | * | SenasOzys quit (Ping timeout: 265 seconds) |
11:56:21 | * | dddddd joined #nim |
11:57:36 | * | SenasOzys joined #nim |
11:59:48 | FromGitter | <ephja> where do nnkCommentStmt nodes go in types? |
12:08:54 | FromGitter | <mratsim> @Araq I added 4 test cases for the noInit issues with perf impact from 30% to 6x (yes 500%) between naive and noInit version: https://github.com/nim-lang/Nim/issues/8745 |
12:14:09 | stefanos82 | Araq: what kind of characters are forbidden to be used with a .nim file? |
12:18:58 | * | abm joined #nim |
12:23:34 | * | cyberzeus24 joined #nim |
12:25:32 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
12:26:47 | * | cyberzeus24 quit (Remote host closed the connection) |
12:28:29 | * | heinrich5991 joined #nim |
12:33:10 | * | elrood joined #nim |
12:38:54 | TheLemonMan | mratsim, you could've used criterion.nim for your timings :P |
12:39:27 | FromGitter | <mratsim> make it a part of the stdlib ;) |
12:40:50 | TheLemonMan | I'm against all-in-one stdlibs, probably due to the exposure to too much scheme heh |
12:41:15 | TheLemonMan | nimble is nice enough IMO |
12:41:44 | FromGitter | <mratsim> well for reproduceable test cases, it’s better if it depends on just Nim and stdlib. |
12:42:23 | * | hsiktas19 joined #nim |
12:42:58 | TheLemonMan | one could argue that nimble is part of Nim proper, and it does depend only on the stdlib |
12:44:30 | FromGitter | <mratsim> Anyway, I think genericResets should be fixed before 1.0, otherwise that would be a benchmark horror story. |
12:45:21 | TheLemonMan | so much to fix, so few people (and time, stupid time) |
12:45:36 | * | hsiktas19 quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
12:46:52 | FromGitter | <mratsim> fix glaring usability issues, publish 1.0, attract usability oriented people ⏎ fix glaring perf issues, publish 1.0, attract perf oriented people ⏎ fix whatever, publish 1.0, attract whatever people. ⏎ ⏎ Chicken and egg :P [https://gitter.im/nim-lang/Nim?at=5b7eacbcd8d36815e57b8045] |
12:49:05 | * | nsf quit (Quit: WeeChat 2.2) |
12:49:32 | copygirl | Mhh.. there's no go-to way to delete a specific item from a sequence? |
12:50:05 | copygirl | And for that matter, no way to get the index of an item within a seq. |
12:50:52 | TheLemonMan | copygirl, `find` ? |
12:51:43 | FromGitter | <mratsim> @copygirl, `filter` in sequels? |
12:51:48 | FromGitter | <mratsim> sequtils |
12:51:59 | FromGitter | <mratsim> ah no string |
12:52:21 | FromGitter | <mratsim> you can use replace |
12:52:44 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
12:52:48 | FromGitter | <mratsim> argh I don’t know what I’m reading, it’s not string, its seq, so filter it is |
12:53:33 | * | grubles22 joined #nim |
12:54:57 | copygirl | Or keepIf, I suppose. I am just confused why there's no straight-forward way to delete a single item. I'd do `let i = s.indexOf(item); s.delete(i)` but even indexOf doesn't exist :o |
12:55:14 | * | heinrich5991 joined #nim |
12:55:28 | TheLemonMan | that's because it's called `find`? |
12:55:37 | copygirl | I can't find "find". |
12:56:12 | TheLemonMan | it's in system.nim |
12:56:23 | copygirl | Oooh |
12:56:46 | FromGitter | <mratsim> @copygirl, feel free to add a remove proc in sequtils |
12:57:39 | * | grubles22 quit (Remote host closed the connection) |
12:57:39 | copygirl | That would be confusing. I'd rather have removeAt(index) and remove(item) (or delete) |
12:58:06 | FromGitter | <mratsim> delete is in system.nim |
12:58:06 | copygirl | Or removeIndex? |
12:58:27 | copygirl | Yeah but delete takes an index. |
12:58:38 | FromGitter | <mratsim> yes, and remove takes a value, like in Python |
12:58:39 | copygirl | Perhaps deleteItem..? |
12:59:20 | copygirl | So you have to be familiar with python to know the difference at a glance? |
12:59:25 | FromGitter | <mratsim> I think having a by value and by index convention for delete/remove is fine. It can be added to NEP-1 |
13:00:33 | FromGitter | <mratsim> no, you have to be familiar with Nim, but it’s fine if Nim adopts the same convention as Python. |
13:02:52 | FromGitter | <Araq> @mratsim the new runtime has no genericReset() |
13:03:14 | FromGitter | <Araq> it's the one thing that solves all issues once and forever *cough* |
13:03:34 | FromGitter | <mratsim> *cough* famous last words *cough* |
13:04:15 | * | endragor quit (Remote host closed the connection) |
13:05:08 | copygirl | Would it be possible somehow to pass a non-closure proc to a method that takes a proc? |
13:05:13 | FromGitter | <mratsim> even tuple of ref objects won’t? Like the tree examples from 2 days ago? |
13:05:52 | FromGitter | <mratsim> @copygirl, yes you can, but Nim might complain in that case, tag both the parameter type as {.nimcall.} |
13:06:14 | FromGitter | <mratsim> and you might need to tag the proc as well. |
13:06:16 | copygirl | Would it still allow closures, then? |
13:06:43 | FromGitter | <mratsim> use an overload if that doesn’t work |
13:07:17 | FromGitter | <mratsim> note that builtin “magic” proc like `+` cannot be passed as a proc argument (procvar) |
13:10:11 | FromGitter | <Araq> > fix glaring usability issues, publish 1.0, attract usability oriented people ⏎ > fix glaring perf issues, publish 1.0, attract perf oriented people ⏎ > fix whatever, publish 1.0, attract whatever people. ⏎ ⏎ I think both perf and usability are getting pretty solid with only a modest amount of improvements. I'm really pleased how much better the language is without 'nil' for strings and seqs :-) |
13:10:11 | FromGitter | ... [https://gitter.im/nim-lang/Nim?at=5b7eb23260f9ee7aa47e1f41] |
13:11:06 | FromGitter | <mratsim> btw what is this escapes in `proc wrapper(s: seq[int]): proc () {.escapes: [s].}` mentioned here https://github.com/nim-lang/Nim/issues/3377#issuecomment-146106240 ⏎ ⏎ Is taht really a thing? |
13:13:23 | copygirl | Mhhr.. |
13:14:23 | copygirl | So I have a stop() proc and to use it with setControlCHook it needs to be {.noconv.}, but then it's not compatible with my method that takes a {.nimcall.} proc? |
13:14:39 | FromGitter | <Clyybber> Github was just down for me... for like 1 minute |
13:15:03 | FromGitter | <mratsim> you can use {.noconv.} as parameter |
13:15:17 | FromGitter | <mratsim> addQuitProc uses this for example |
13:15:20 | copygirl | An nvmd it still didn't work. Mh. |
13:15:37 | FromGitter | <mratsim> otherwise, use a template. |
13:15:37 | copygirl | Nvmd that nvmd. |
13:15:41 | FromGitter | <mratsim> lol |
13:15:57 | FromGitter | <Araq> using too many abbrevs sucks |
13:16:35 | PMunch | Araq, by the way, now that strings and seqs can't be nil and the Option type is more likely to be used I think this should be merged: https://github.com/nim-lang/Nim/pull/8358 |
13:16:39 | FromGitter | <ephja> "nvm" is more cmmn I thnk |
13:17:07 | PMunch | I remember you mentioning something about .? could you add a comment to the git issue so that I can look at that? |
13:17:22 | PMunch | If that's what's holding it back |
13:18:05 | * | heinrich5991 quit (Ping timeout: 240 seconds) |
13:19:04 | * | heinrich5991 joined #nim |
13:23:15 | FromGitter | <Araq> well I have to review it properly. I used to hate the saying "what you don't have cannot be broken" but nowadays I appreciate it. The default should always be YAGNI |
13:23:54 | FromGitter | <Araq> '.?' is different enough from '.' to make people trip over it. |
13:24:29 | FromGitter | <mratsim> seems to work fine for Rust, though it’s less than a year old iirc |
13:24:35 | PMunch | YAGNI? |
13:24:44 | FromGitter | <mratsim> you aren’t gonna need it |
13:24:49 | PMunch | Ah |
13:25:20 | FromGitter | <mratsim> typically the `==?` are YAGNI I think. |
13:25:20 | FromGitter | <Araq> I'm not familiar with Rust but for Nim it would mean a spec change so that some "dot like operators" are really parsed as the dot is |
13:25:32 | PMunch | Hmm, I think =? should possibly be added as well. Assign the inner value if it is a some |
13:25:46 | FromGitter | <mratsim> ah, this would break Arraymancer badly. |
13:26:21 | FromGitter | <mratsim> I use .* vs * for element-wise matrix multiplication vs true matrix multiplication |
13:26:24 | PMunch | Araq, hmm. How so? |
13:26:49 | FromGitter | <Araq> I've told you. 'a.b[c]' is (a.b)[c] |
13:27:06 | FromGitter | <Araq> a.?b[c] is a .? (b[c]) |
13:27:34 | FromGitter | <Araq> I can count the hours until somebody would complain about this gotcha. |
13:28:22 | * | xet7 joined #nim |
13:28:42 | PMunch | Hmm, I need to test that |
13:32:25 | FromGitter | <Araq> and finally, if it's not dead-simple stuff it should start its life as a nimble package and then be adopted into the stdlib when enough people demand it. But we cannot do that for Option[T] as it would lead to incompatible Option[T] types. Solution: Only offer a barebones Option[T] and let others provide the sugar |
13:32:58 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
13:32:59 | FromGitter | <Araq> Nim's design of not attaching procs to types really helps this design, we should make use of Nim's strengths. |
13:34:16 | FromGitter | <Araq> in fact, I thought about adding Rect, Point, Matrix etc types to the stdlib for the same reason. Matrix is too complex to get right though. |
13:36:09 | * | heinrich5991 joined #nim |
13:39:07 | PMunch | Trying to test this a.b[c] thing, but I can't really think of an example that would break |
13:39:29 | PMunch | I can see your point about packages though |
13:40:08 | PMunch | I just feel like this seq/string not nil thing will be more controversial without a good built-in way to handle optional value |
13:40:45 | FromGitter | <Araq> I'd also like to add a `keyboard.nim` |
13:41:40 | FromGitter | <Araq> colors, keys, rects, points -- every library does its own thing, a stdlib can try to unify these |
13:42:30 | * | dadabidet quit (Quit: Leaving) |
13:44:46 | FromGitter | <Araq> probably nobody cares though, text is good enough and computers are not about graphics or input devices or any of that fluffy stuff that was invented after 1970 |
13:45:24 | * | elrood quit (Quit: Leaving) |
13:45:24 | PMunch | I'd love to see rects, points, colors implemented in stdlib |
13:45:33 | PMunch | I ran into this issue with SDLGamelib |
13:45:46 | PMunch | Wanted to make it generic but I used the SDL library point and rect types |
13:45:57 | PMunch | Not sure what you mean by key though? |
13:46:13 | FromGitter | <Araq> mostly an enum that describes the typical keys on a keyboard |
13:46:30 | copygirl | But they're different depending on layout, right? |
13:47:01 | stefanos82 | @Araq: is it illegal to name a nim module as some-thing.nim? |
13:47:04 | FromGitter | <Araq> yes and no, they are mapped to the a-z and control keys |
13:50:44 | FromGitter | <ephja> scancodes! :p |
13:51:29 | FromGitter | <ephja> but yeah don't specialize the official modules too much |
13:56:18 | PMunch | Problem is that now people can't use nil the options module will be a lot more used. It's not really that special any longer, and I feel it should be more ergonomic to use it, otherwise people will just be annoyed they can't use != nil |
13:58:23 | FromGitter | <Araq> well I ported thousands of lines and 'nil' vs "" is just almost never required. |
13:58:33 | FromGitter | <Araq> "" is fine, no need for Option[string] |
13:59:19 | FromGitter | <Araq> the biggest problem are the db_ modules which will get support for Json in the hope it also makes the integers case faster |
14:01:15 | FromGitter | <Araq> but let's assume you're right, why not have `==`(x: Option[T]; T): bool to make the comparisons easier? who asked for ==? and .? ? |
14:03:57 | PMunch | The .? people asked explicitly for in the PR |
14:04:51 | PMunch | The other question marks were added as the options returned a new option, but those are gone now |
14:05:49 | PMunch | The only stuff that's added now is .?, allSome, and some wrappers |
14:06:06 | PMunch | And I split out some of what used to be options into the new optionutils module |
14:06:21 | * | Vladar joined #nim |
14:06:26 | FromGitter | <Araq> your `either` template evaluates the first parameter twice |
14:07:14 | PMunch | Ah yes |
14:07:14 | FromGitter | <Araq> I'm not saying this PR is bad, I'm trying to explain how the stdlib should be designed in the future, IMO. |
14:07:37 | PMunch | It used to be a proc, forgot to add the let statement |
14:08:12 | FromGitter | <Araq> there is now an evaluateOnce in sequtils... |
14:08:24 | FromGitter | <Araq> should probably be in macros.nim instead |
14:09:45 | * | kapil____ quit (Quit: Connection closed for inactivity) |
14:11:38 | PMunch | I'll fix the either bug later today. Have to go now |
14:11:39 | * | PMunch quit (Quit: Leaving) |
14:18:42 | TheLemonMan | should we support or reject pragmas on for loop variables? |
14:19:41 | FromGitter | <Araq> reject them, except for .inject and .gensym |
14:19:50 | FromGitter | <Araq> which is why they were added |
14:29:00 | dom96 | Araq: Can we merge this? https://github.com/nim-lang/Nim/pull/8727 |
14:29:58 | shashlick | dom96: had a question around nimble packages - right now there's already 15 nimgen wrappers and there's many more we are looking into - do you have any recommendations on scaling these wrappers? right now they are all in separate repos which is its own maintenance headache. Any feedback around having all of them in one repo instead of maintaining a separate repo each? Any other i <message clipped> |
14:30:30 | dom96 | "<message clipped>" lol? |
14:31:42 | TheLemonMan | you have to pay to see the remaining part |
14:32:02 | dom96 | Nimble supports multiple packages in one repo now: https://github.com/nim-lang/nimble/blob/master/tests/tester.nim#L703 |
14:32:09 | dom96 | so you can do that if it helps |
14:32:18 | FromGitter | <ephja> what a cautious client :p |
14:32:44 | FromGitter | <Araq> @dom96 what's your opinion on Rect, Point, Key? |
14:32:58 | dom96 | I bet the message was "Any other ideas?" and it was clipped to a longer message hah |
14:33:15 | dom96 | Araq: Key? |
14:33:24 | FromGitter | <ephja> keyboard key |
14:33:54 | FromGitter | <ephja> hmm, rect. x,y,w,h or center, halfSize? :p |
14:34:54 | shashlick | meh - must be matterbridge being conservative |
14:35:01 | shashlick | at least it should send the rest |
14:35:44 | dom96 | from what I've seen matterbridge is frustratingly bad at dealing with long messages |
14:35:51 | FromGitter | <ephja> hopefully it's letting you know about it |
14:35:59 | dom96 | to the point of "how the hell did the developers not implement this as a first-thing?" |
14:36:24 | shashlick | didn't tell me squat on this side |
14:37:02 | dom96 | Yeah... time to write a relay bot in Nim |
14:37:22 | shashlick | i see that nimble allows multi package repos but am curious if any feedback around putting too much into one repo |
14:37:34 | shashlick | if we end up with 100 wrappers, is it sensible to have it in one repo |
14:37:53 | shashlick | curious if it helps around maintenance, issues, etc |
14:37:56 | dom96 | I'd say no, but it depends what you need to maintain |
14:38:38 | shashlick | like after our discussion on nimble install of nimgen dependency, I need to update the nimble file for every package, create tags, etc. |
14:38:46 | shashlick | times 15 now but times 40 in a year? |
14:38:57 | FromGitter | <data-man> @Arag: Rename #7062 to input events :) |
14:40:35 | FromGitter | <ephja> terminal only? :p |
14:40:42 | * | heinrich5991 quit (Ping timeout: 260 seconds) |
14:41:09 | shashlick | tomorrow you add the task require feature and i'll have to change everything again, though that may not be backwards compatible so will have to hold off for a few years |
14:41:41 | dom96 | hm |
14:41:54 | dom96 | You've just surfaced a problem with my multi-package approach |
14:42:02 | FromGitter | <data-man> @ephja: Now the concept has changed. :-D |
14:42:14 | dom96 | a single git repo will have only one list of tags |
14:42:26 | dom96 | so the packages inside the repo all need to have the same version |
14:42:34 | dom96 | I dunno, maybe that's not a problem in practice |
14:42:50 | shashlick | ya I was just thinking about that |
14:43:08 | * | heinrich5991 joined #nim |
14:43:35 | shashlick | it doesn't help when we get to a point where you can lock a wrapper tag to a specific upstream tag |
14:43:46 | * | Xe quit (Ping timeout: 268 seconds) |
14:44:20 | dom96 | I don't really think there is much I can do about that |
14:46:51 | shashlick | ya don't think it is nimble specific but just general feedback |
14:47:30 | FromGitter | <Araq> monorepos rule. :-) |
14:50:40 | TheLemonMan | Araq, wrt #8746 should I amend it or drop it alltogether? |
14:51:50 | FromGitter | <Araq> your choice -- I think it's unnecessary |
14:56:51 | shashlick | I guess I just need to write scripts to simplify making mass updates and git commit/push |
15:00:11 | FromGitter | <bung87> anyone could improve `nre` module performance? the `nre.split` 3-4 times slower than python |
15:01:00 | FromGitter | <bung87> or may wrap https://github.com/google/re2 to nim |
15:03:40 | TheLemonMan | Araq, compiling with -d:release doesn't seem to allow the compiler to elide the copystrings |
15:04:59 | * | kapil____ joined #nim |
15:05:57 | * | Xe joined #nim |
15:06:17 | FromGitter | <Araq> huh, why not, missing .inline? |
15:08:00 | FromGitter | <Araq> bung87 `nre` is deprecated though and splitting with a regex is a poor man's parser |
15:08:32 | dom96 | Seriously? https://travis-ci.org/nim-lang/Nim/builds/419684345?utm_source=email&utm_medium=notification |
15:09:44 | * | heinrich5991 quit (Ping timeout: 276 seconds) |
15:09:47 | TheLemonMan | Araq, yeah, inline is missing |
15:09:48 | FromGitter | <bung87> @Araq then what package else can use? I checked re,nre,regex. |
15:11:02 | FromGitter | <Araq> `regex` is pretty cool |
15:11:18 | * | heinrich5991 joined #nim |
15:13:36 | FromGitter | <bung87> `re_han = re(r"(*UTF)([\p{Han}]+)")` cant find a example like this |
15:14:47 | * | Trustable joined #nim |
15:15:45 | pigmej | dom96: am I wrong or asyncnet.connect doesn't handle properly initial connection timeouts ? |
15:16:21 | dom96 | What do you mean? |
15:16:23 | pigmej | OR the default timeout is somehow crazy |
15:16:39 | pigmej | what's the default timeout for socket connect? |
15:18:03 | pigmej | or should I handle *all* sockets ops with withTimeout ? (sounds bit strange though) |
15:21:53 | dom96 | That's up to the OS AFAIK |
15:24:23 | dom96 | Seems you can set SO_RCVTIMEO/SO_SNDTIMEO on the socket to control this |
15:24:23 | * | pwntus quit (Read error: Connection reset by peer) |
15:25:28 | FromGitter | <Araq> how did that happen? https://travis-ci.org/nim-lang/Nim/jobs/419684346 |
15:25:36 | FromGitter | <Araq> travis was green when I merged that PR! |
15:25:53 | dom96 | Yes |
15:25:57 | dom96 | I'm as annoyed as you |
15:26:09 | * | rayman22201 quit (Remote host closed the connection) |
15:27:08 | * | pwntus joined #nim |
15:27:57 | dom96 | I'll fix it |
15:28:00 | dom96 | The test is flaky |
15:28:48 | FromGitter | <Araq> ok, thanks |
15:29:33 | * | pwntus quit (Changing host) |
15:29:33 | * | pwntus joined #nim |
15:29:42 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
15:30:17 | * | heinrich5991 joined #nim |
15:37:53 | * | floppydh quit (Quit: WeeChat 2.2) |
15:38:48 | FromGitter | <Araq> what does `\p{Han}` mean? |
15:40:44 | FromGitter | <Araq> never mind, found it |
15:41:20 | FromGitter | <Araq> should be covered by `regex`, please ask on its github issue tracker |
15:44:23 | dom96 | How does HeapQueue determine the length of its elements? |
15:45:03 | dom96 | i.e. how does it know which element is the "smallest"? |
15:45:14 | TheLemonMan | hardcoded cmp using < |
15:49:33 | dom96 | bah, heapqueue module should really be called heapqueues |
15:50:42 | * | k6ka25 joined #nim |
15:52:22 | * | heinrich5991 quit (Ping timeout: 256 seconds) |
15:52:58 | dom96 | lol what |
15:53:00 | dom96 | !eval echo((epochTime() + 5, "foobar") < (epochTime() + 10, "alberta")) |
15:53:02 | NimBot | Compile failed: in.nim(1, 7) Error: undeclared identifier: 'epochTime' |
15:53:04 | * | k6ka25 quit (Remote host closed the connection) |
15:53:11 | dom96 | !eval import times; echo((epochTime() + 5, "foobar") < (epochTime() + 10, "alberta")) |
15:53:15 | NimBot | true |
15:53:51 | dom96 | Araq: Why is there a `<` for tuples? |
15:54:53 | * | heinrich5991 joined #nim |
15:56:23 | TheLemonMan | consistency™ probably, but it makes no sense |
15:57:04 | dom96 | Python does it too |
15:57:15 | dom96 | !eval echo((5.5, 30) < (10.0, 25)) |
15:57:18 | NimBot | true |
15:57:18 | FromGitter | <kaushalmodi> dom96: For version compares |
15:57:42 | dom96 | A tuple containing a float and a string? |
15:57:54 | dom96 | Okay, sure, if the tuple is all numbers then I can deal with that |
15:58:02 | dom96 | But it just compares the first position and calls it a day |
15:58:18 | dom96 | !eval echo((5.5, 30) < (10.0, 25, 56, 123123)) |
15:58:19 | NimBot | Compile failed: in.nim(1, 16) Error: type mismatch: got <tuple of (float64, int), tuple of (float64, int, int, int)> |
15:58:31 | dom96 | !eval echo((5.5, 30, 102131023213, 124124) < (10.0, 25, 56, 123123)) |
15:58:32 | NimBot | Compile failed: in.nim(1, 38) Error: type mismatch: got <tuple of (float64, int, int64, int), tuple of (float64, int, int, int)> |
15:58:47 | dom96 | !eval echo((5.5, 30, 102131023213, 124124) < (10.0, 25, 56'i64, 123123)) |
15:58:47 | FromGitter | <kaushalmodi> https://scripter.co/notes/nim/#tuple-comparison |
15:58:49 | NimBot | true |
15:59:30 | FromGitter | <kaushalmodi> dom96: It keeps on going till the first non-equal match from the left |
16:00:06 | FromGitter | <kaushalmodi> agreed that the < should be made to works on tuples where it made sense |
16:01:46 | FromGitter | <kaushalmodi> More than those tuple compares, I find the string compares strange: https://scripter.co/notes/nim/#string-comparison |
16:05:33 | FromGitter | <GULPF> the tuple thing can be used to sort on multiple fields, e.g `lst.sortedByIt((it.field1, it.field2))` |
16:17:22 | FromGitter | <bung87> @Araq thanks! I posted a issue to `regex ` just now. |
16:19:04 | FromGitter | <kaushalmodi> Talking about regex, where can I find good examples of replace from nre module? |
16:22:56 | dom96 | The nre module is deprecated |
16:25:03 | FromGitter | <kaushalmodi> So what's the best way for search/replace using regex? |
16:30:50 | FromGitter | <data-man> I think the best way to replace PCRE with PCRE2. PCRE2 has very cool https://www.pcre.org/current/doc/html/pcre2_substitute.html |
16:31:55 | FromGitter | <kaushalmodi> I believe we don't have a Nim wrapper for that, right? |
16:32:14 | FromGitter | <kaushalmodi> I was just playing with regex and replacements and was trying to figure out the current best way to do it |
16:32:34 | FromGitter | <kaushalmodi> As a side note, where are the older changelogs saved on the devel branch? |
16:32:46 | FromGitter | <kaushalmodi> I was trying to find the version where nre got deprecated |
16:35:47 | shashlick | @kaushalmodi: look at nimgen source code - using regex extensively there |
16:36:08 | FromGitter | <kaushalmodi> regex is the nimble package, right? |
16:36:17 | shashlick | I used nre a lot in the past but have started using nim-regex now cause it is pure nim |
16:36:31 | shashlick | I believe @data-man is looking into a PCRE2 wrapper |
16:36:41 | * | SenasOzys quit (Remote host closed the connection) |
16:37:00 | FromGitter | <kaushalmodi> shashlick: Thanks! |
16:37:17 | FromGitter | <kaushalmodi> Until nim-regex gets into core, the re module is the best way? |
16:37:24 | dom96 | kaushalmodi: the 're' module |
16:38:02 | shashlick | if you are bothered by the pcre.dll requirement, check out nimpcre |
16:38:03 | FromGitter | <bung87> could use https://github.com/genotrance/nimgen wrap pcre or https://github.com/google/re2 I think,but I dont have that skill. |
16:38:32 | shashlick | pcre is already wrapped by `re` and you can use nimpcre to build it into your binary |
16:38:38 | shashlick | pcre2 - data-man is looking into it |
16:38:39 | * | SenasOzys joined #nim |
16:38:42 | FromGitter | <kaushalmodi> I just tried out https://ptpb.pw/S6Of/nim .. works fine |
16:39:28 | FromGitter | <kaushalmodi> .. was basically writing a reply to https://mstdn.io/@xahlee/100600228333192182 |
16:39:33 | shashlick | google/re2 - looks like C++ so might be harder to wrap, but will check it out |
16:40:59 | FromGitter | <kaushalmodi> btw I use the `(?i)` syntax from nre in that example using re |
16:41:02 | FromGitter | <kaushalmodi> and it worked |
16:41:11 | FromGitter | <kaushalmodi> but that is not documented anywhere on https://nim-lang.org/docs/re.html |
16:42:03 | shashlick | that's just pcre syntax right? |
16:42:19 | FromGitter | <kaushalmodi> hmm.. TIL |
16:42:59 | FromGitter | <kaushalmodi> yup, https://pcre.org/pcre.txt |
16:43:05 | FromGitter | <bung87> in mine case I use `let re_han = re(r"(*U)([\p{Han}]+)")` split string,` re` much slower than `nre` and both much slower than python ... so I will keep looking for aternative |
16:44:50 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
16:48:30 | FromDiscord_ | <awr> yo |
16:49:02 | FromGitter | <ephja> what up |
16:49:06 | FromDiscord_ | <awr> nm |
16:49:36 | FromDiscord_ | <awr> what linux distro is good if you need bleeding-edge packages and are uninterested in manually compiling things all the time |
16:49:40 | FromDiscord_ | <awr> arch? |
16:50:35 | FromGitter | <kaushalmodi> Who from here is active on Mastodon? |
16:50:43 | FromGitter | <kaushalmodi> Here was my reply to that Go lang snippet: https://mastodon.technology/@kaushalmodi/100600552586424281 |
16:51:06 | * | Perkol joined #nim |
16:53:44 | FromDiscord_ | <awr> nim needs one of those human readable regex libraries |
16:53:51 | FromDiscord_ | <awr> for ex: https://github.com/VerbalExpressions/elm-verbal-expressions |
16:56:18 | * | captainkraft quit (Ping timeout: 264 seconds) |
16:58:50 | FromGitter | <kaushalmodi> awr: Yeah, Emacs/Emacs-Lisp has this "rx" library. This blog post introduces that lib well: https://francismurillo.github.io/2017-03-30-Exploring-Emacs-rx-Macro/ |
16:59:37 | FromGitter | <data-man> High-performance regular expression matching library by Intel: https://github.com/intel/hyperscan Wrap it! :) |
17:00:17 | FromGitter | <mratsim> @shashlick, I’m always saying this but it would be really helpful if the wrapper proc signature was available in the github repo: for example: https://github.com/genotrance/nimbass |
17:00:49 | FromGitter | <mratsim> I know you have an external site but people go on Github first. And there is no git diff on external websites |
17:05:03 | * | byte512_ quit (Ping timeout: 260 seconds) |
17:12:11 | * | heinrich5991 quit (Ping timeout: 268 seconds) |
17:13:20 | shashlick | @mratsim: right - https://github.com/genotrance/nimgen/issues/37 |
17:13:30 | shashlick | please add your comments and suggestions |
17:14:38 | * | heinrich5991 joined #nim |
17:18:47 | Perkol | Is there any library to work with clipboard? |
17:19:01 | shashlick | nimclipboard |
17:19:20 | * | zachk joined #nim |
17:19:40 | * | zachk quit (Read error: Connection reset by peer) |
17:20:22 | FromDiscord_ | <awr> added the WASM PR last night so idk if any of y'all wanna take a look at it |
17:26:34 | * | heinrich5991 quit (Ping timeout: 268 seconds) |
17:28:17 | * | heinrich5991 joined #nim |
17:38:56 | Perkol | Thanks |
17:40:23 | * | captainkraft joined #nim |
17:48:09 | * | zachk joined #nim |
17:48:24 | * | zachk quit (Changing host) |
17:48:24 | * | zachk joined #nim |
17:48:28 | FromDiscord_ | <treeform> Is there a wrapper for JavaScripts Regex? |
17:49:23 | * | Trustable quit (Remote host closed the connection) |
18:03:16 | FromDiscord_ | <treeform> https://gist.github.com/treeform/a0a6da00fa0dc18ed05a5923a25dbd1e |
18:03:20 | FromDiscord_ | <treeform> Does any one have anything better? |
18:04:13 | FromDiscord_ | <treeform> awr link to WASM pr? |
18:04:20 | FromDiscord_ | <treeform> @awr link to WASM pr? |
18:07:34 | * | NimBot joined #nim |
18:10:08 | * | Perkol quit (Remote host closed the connection) |
18:12:55 | * | aOssed26 joined #nim |
18:15:01 | * | aOssed26 quit (Remote host closed the connection) |
18:21:49 | * | SenasOzys quit (Quit: Leaving) |
18:22:02 | * | SenasOzys joined #nim |
18:22:56 | * | SenasOzys quit (Remote host closed the connection) |
18:23:03 | * | SenasOzys__ joined #nim |
18:23:25 | * | SenasOzys__ quit (Remote host closed the connection) |
18:23:36 | * | SenasOzys joined #nim |
18:24:34 | * | SenasOzys quit (Client Quit) |
18:24:43 | * | SenasOzys joined #nim |
18:30:30 | * | SenasOzys quit (Ping timeout: 268 seconds) |
18:35:19 | * | nsf joined #nim |
18:37:24 | FromGitter | <mratsim> @treeform: https://github.com/nim-lang/Nim/pull/8738 |
18:37:43 | * | SenasOzys joined #nim |
18:42:38 | FromDiscord_ | <treeform> thanks! |
18:43:03 | * | Croepha4 joined #nim |
18:49:28 | * | Croepha4 quit (Ping timeout: 260 seconds) |
18:52:10 | FromGitter | <mratsim> Seems like a good target for a Nim wrapper: https://github.com/GPUOpen-LibrariesAndSDKs/V-EZ |
18:55:11 | shashlick | wow 3 days old |
19:13:54 | FromGitter | <zetashift> @mratsim I don't really get it, is it just some interfaces to make the API easier? |
19:14:34 | FromGitter | <mratsim> I suppose, I didn’t dive into vulkan at all |
19:25:29 | * | a_b_m joined #nim |
19:27:57 | * | stefanos82 quit (Quit: Quitting for now...) |
19:29:17 | * | abm quit (Ping timeout: 268 seconds) |
19:39:01 | FromGitter | <Araq> @treeform wanna patch NimEdit to use your font renderer? |
19:39:37 | FromGitter | <kayabaNerve> I think I found a bug |
19:39:53 | FromGitter | <kayabaNerve> My function has just `ref` in the signature |
19:40:18 | FromGitter | <kayabaNerve> I couldn't cast an address to a raw ref so I casted to ref bool (it was a bool) |
19:40:46 | FromGitter | <kayabaNerve> Nim now expects all return values to be of ref bool |
19:42:00 | FromGitter | <Araq> just `ref`? that would be a typeclass |
19:42:12 | FromGitter | <kayabaNerve> I'm not saying this should be allowed; looks like I have to use pointers; my comment was that the finding signature changed |
19:42:19 | FromGitter | <kayabaNerve> *function signature |
19:42:55 | FromGitter | <kayabaNerve> (that's probably an inaccurate term; it said ref; first return was of ref bool; everything was then expected to be of ref bool) |
19:43:24 | FromGitter | <kayabaNerve> Again. Not saying I should be allowed to use ref/ref bool/ref int. Saying the signature changed. |
19:46:20 | FromGitter | <Bennyelg> How I can implement list of procs |
19:46:31 | FromGitter | <Araq> I don't think it "changed", you got multiple instantiations of the implicit generic |
19:47:57 | FromGitter | <Bennyelg> seq[proc1, proc2, proc3] |
19:48:03 | FromGitter | <Bennyelg> any way to do it ? |
19:49:54 | * | krux02 quit (Remote host closed the connection) |
19:51:30 | FromGitter | <Araq> these all have to have the same signature then and usually you're better off with a macro |
19:51:53 | FromGitter | <Araq> but it's entirely possible: seq[proc () {.closure.}] |
19:52:01 | FromGitter | <Araq> watch out for the calling conventions |
19:52:24 | FromGitter | <Bennyelg> I dont want them to have the same signature :/ |
19:54:34 | FromGitter | <Araq> usually you can hide the type differences in the closure's environment |
19:57:01 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b7f118dcff55e56174f70ed] |
20:02:52 | FromGitter | <Araq> can't work, you need |
20:03:06 | FromGitter | <Araq> m.beforeMove.add(proc () = fun args) |
20:05:25 | FromGitter | <Bennyelg> same error :( |
20:06:41 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b7f13d1fd3c641b06fd81e5] |
20:08:28 | FromGitter | <tim-st> I think it's not needed at all (in general) to save procs in a collection; most likely you can easily implement this using a `case` |
20:08:49 | FromGitter | <Bennyelg> example will be great |
20:13:17 | FromGitter | <tim-st> I dont know what you want to achieve, I just say you can always translate it using a case |
20:13:38 | FromGitter | <Bennyelg> adding proc into a variable and use it later |
20:14:15 | FromGitter | <tim-st> but why do you add a proc? a proc is known at compile time; instead you could add an int, or some unique identifier |
20:16:33 | FromGitter | <Araq> check how Ormin does it |
20:21:33 | * | PMunch joined #nim |
20:37:37 | * | nsf quit (Quit: WeeChat 2.2) |
20:39:45 | * | kapil____ quit (Quit: Connection closed for inactivity) |
20:45:26 | dom96 | Sooo the test I have written passes locally |
20:45:30 | dom96 | and I tested it on Linux too |
20:45:37 | dom96 | But for some reason travis fails on it |
20:47:21 | FromGitter | <Araq> that PR queue ... it kills me. |
20:47:44 | PMunch | Getting more and more popular is both a blessing and a curse |
20:47:59 | FromGitter | <Araq> nah, it's only a blessing, it's awesome |
20:48:21 | FromGitter | <mratsim> @tim-st, it’s fine to add proc to a collection, but you need to make sure you use {.nimcall.} or {.closure.} everywhere |
20:48:36 | PMunch | Well that PR queue won't shrink the more people who gets interested in Nim :) |
20:48:43 | FromGitter | <mratsim> closure if you carry environment around, nimcall if you want to use it like a normal proc |
20:49:20 | FromGitter | <Araq> also .nimcall if you need the speed |
20:49:27 | FromGitter | <mratsim> that’s basically dynamic dispatch |
20:49:42 | FromGitter | <mratsim> if you need the speed use a template and inline everything :P |
20:50:03 | dom96 | PMunch: More people means more reviewers, hopefully :) |
20:50:20 | FromGitter | <mratsim> it first means more requests and complaints |
20:51:14 | PMunch | dom96, that's true |
20:52:14 | PMunch | But I guess that effort could be better organized. Set some stricter guidelines on what's to be accepted and not for example. |
20:52:28 | PMunch | It feels like a bit of a hit or miss if things are going to be accepted or not |
21:10:02 | * | a__b__m joined #nim |
21:14:07 | * | a_b_m quit (Ping timeout: 268 seconds) |
21:14:51 | * | seni quit (Quit: Leaving) |
21:22:59 | * | arecaceae quit (Remote host closed the connection) |
21:23:16 | * | arecaceae joined #nim |
21:29:11 | * | PMunch quit (Remote host closed the connection) |
21:38:58 | * | Vladar quit (Remote host closed the connection) |
21:40:09 | * | Jesin quit (Quit: Leaving) |
21:50:45 | * | Jesin joined #nim |
21:58:20 | FromGitter | <Araq> I'm thinking about principles of how to grow this thing without it becoming more of a mess all day long |
21:59:13 | zachk | how do I do a for loop over a sequence? |
22:01:25 | FromGitter | <Araq> via a for loop |
22:03:03 | * | SenasOzys quit (Ping timeout: 252 seconds) |
22:15:52 | FromGitter | <zetashift> @zack `for element in yoursequence: ` |
22:16:36 | * | noonien quit (Quit: Connection closed for inactivity) |
22:20:02 | FromGitter | <kayabaNerve> for wronglyNamedElement in notASequence: |
22:20:24 | FromGitter | <kayabaNerve> Use preprocessor rules to redefine in as out :thinking: |
22:20:58 | FromGitter | <kayabaNerve> There's also `for i in 0 ..< seq.len:` which is useful if you don't just care about the values but the order they're in/their count |
22:23:59 | zachk | so I don't need to use 'for item in s.items:'? |
22:24:15 | FromGitter | <kayabaNerve> Nope. |
22:25:11 | FromGitter | <Araq> actually in a generic context, you still do... (somewhat hard to fix...) |
22:25:30 | FromGitter | <kayabaNerve> Oh. You can use `for i, element in mySeq:`. Cool |
22:29:40 | FromGitter | <ephja> `for i in foo` -> `for i in items(foo)`, `for i, x in foo` -> `for i, x in pairs(foo)` |
22:33:50 | FromDiscord_ | <awr> ugh this emscripten+wasm stuff is killing me |
22:33:59 | FromDiscord_ | <awr> i need to try the clang wasm stuff again |
22:37:01 | FromDiscord_ | <awr> i keep getting an error about __wait being an unresolved symbol in emcc |
22:42:33 | AlexMax | hey shashlick, want a challenge? |
22:42:39 | AlexMax | wrap dear imgui :P |
22:53:17 | FromDiscord_ | <awr> also i need to stop trying to code outside |
22:53:35 | FromDiscord_ | <awr> computer bugs are enough i don't need real bugs on top of them |
22:54:30 | FromDiscord_ | <awr> [audience laughter] |
22:55:11 | FromGitter | <zetashift> be one with nature dawg |
22:55:37 | FromDiscord_ | <awr> i said i wanted was*m* not a was*p* |
22:57:49 | shashlick | Worth a try @AlexMax |
22:58:06 | shashlick | Wasn't there already a wrapper? |
22:58:53 | FromDiscord_ | <awr> since emcc isn't providing me with useful error messages and i'm just gonna hold this off until tomorrow and then start commenting stuff out of the nimcache and seeing what sticks |
22:58:58 | shashlick | https://github.com/lmariscal/nimgl/blob/master/src/nimgl/imgui.nim |
23:01:28 | FromDiscord_ | <awr> emcc's wasm output for nim code doesn't validate correctly against the wasm suite, plus when you tell it to produce an html file it produces asmjs instead even when you tell binaryen "please please just give me wasm and just fail if you can't do that instead of an asmjs fallback" |
23:02:17 | * | test__ joined #nim |
23:03:44 | FromDiscord_ | <awr> basic C programs output just fine to wasm. Chrome can be a little pedantic on the HTML output though so you'll need a local HTTP server or something. I remember it used to be like that for asm.js but I think it changed |
23:04:12 | * | SenasOzys joined #nim |
23:05:04 | FromDiscord_ | <awr> once i'm done with emcc i'll move my attention to clang |
23:09:02 | FromDiscord_ | <awr> also @zetashift wrt V-EZ there's been some desire to create a simpler, somewhat less low-level interface to vulkan on top of vulkan, think the way D3D11 is to D3D12 |
23:10:47 | FromDiscord_ | <awr> and yes people are still using D3D11 Microsoft is not going to kill it. they've been adding features to it since D3D12 came out, positioning it as a "low-level but not that low-level" API to counterpart D3D12. |
23:12:02 | * | test__ quit (Quit: Leaving) |
23:19:47 | * | zachcarter joined #nim |
23:21:24 | AlexMax | So this is a little confusing |
23:21:35 | AlexMax | I have a proc that has the following signature |
23:21:38 | AlexMax | proc persist*(atlas: var Atlas, p: PersistProc) = |
23:21:56 | AlexMax | Persist Proc is a type PersistProc* = proc(data: ptr, x, y, w, h: uint32) |
23:22:28 | AlexMax | But when I actually try passing a proc to the function... |
23:22:30 | AlexMax | atlas.persist(proc (data: ptr, x, y , w, h: uint32) = |
23:22:41 | AlexMax | it says there's a type mismatch |
23:22:54 | AlexMax | Do I have to cast the proc somehow? |
23:28:24 | FromGitter | <zetashift> @awr thanks I heard vulkan was really low level |
23:28:46 | AlexMax | Finally, got it |
23:28:58 | AlexMax | well, not really, let me try the exported type again |
23:29:38 | AlexMax | Yeah, got it |
23:41:24 | FromDiscord_ | <hcorion> woah when did Nim get a discord |
23:41:47 | FromGitter | <zetashift> quite a while ago |
23:41:58 | AlexMax | using discord for programming stuff feels yucky :P |
23:42:07 | AlexMax | even though I do prefer it to slack and gitter |
23:42:38 | FromDiscord_ | <hcorion> I have it up all the time for other projects I work on |
23:42:46 | FromDiscord_ | <hcorion> haven't hung around Nim in a while |
23:43:06 | FromGitter | <zetashift> welcome back ! |
23:46:58 | * | cow_2001 quit (Quit: cow_2001) |
23:51:20 | AlexMax | oof |
23:51:33 | AlexMax | I can't take the address of the first character of a string passed to an anonymous proc |
23:51:49 | AlexMax | without assigning the string to a local variable and taking the address of that |
23:54:00 | AlexMax | https://paste.ee/p/oXo2z |
23:57:54 | * | zachk quit (Quit: Leaving) |
23:58:22 | FromGitter | <kayabaNerve> Discord ftw |
23:58:42 | FromGitter | <kayabaNerve> I was on too many servers/have some Gitter exclusive servers anyways though |