00:12:20 | * | yglukhov joined #nim |
00:16:38 | * | yglukhov quit (Ping timeout: 255 seconds) |
00:30:50 | * | j_rod_s quit (Quit: j_rod_s) |
00:36:31 | * | endragor joined #nim |
00:37:20 | * | gokr quit (Ping timeout: 276 seconds) |
00:38:42 | Demos[m] | yeah vscode is where it's at |
00:39:16 | Demos[m] | which is kinda unfortunate since I don't consider vscode to be that free |
00:39:57 | Demos[m] | well, I guess my main problem is that the C/C++ plugin is totally non-free |
00:57:53 | * | j_rod_s joined #nim |
01:03:27 | * | j_rod_s quit (Ping timeout: 248 seconds) |
01:15:36 | FromGitter | <Varriount> My problem is that vscode is memory-hungry |
01:29:15 | FromGitter | <honewatson> Yup I'm not a fan of vscode but its the best option at the moment |
01:29:29 | * | steve joined #nim |
01:30:00 | FromGitter | <honewatson> YouCompleteMe has good support for c family languages https://github.com/Valloric/YouCompleteMe |
01:30:14 | FromGitter | <honewatson> And setting up a completer for nim shouldn't be difficult |
01:30:26 | FromGitter | <honewatson> lack of time is my major issue |
01:30:44 | FromGitter | <honewatson> Rename in nvim-nim is decent |
01:30:47 | girvo | `brew install nim`, `brew cask install vscode`, then done lol |
01:31:34 | * | Jinai joined #nim |
01:34:58 | * | endragor quit (Ping timeout: 256 seconds) |
01:35:22 | * | steve quit (Quit: Page closed) |
01:43:06 | * | francisl joined #nim |
01:58:22 | * | Jinai quit (Quit: Page closed) |
02:04:30 | * | francisl quit (Ping timeout: 260 seconds) |
02:05:36 | * | j_rod_s joined #nim |
02:19:07 | * | francisl joined #nim |
02:36:44 | * | chemist69 quit (Ping timeout: 256 seconds) |
02:42:22 | * | endragor joined #nim |
02:42:48 | * | endragor quit (Remote host closed the connection) |
02:43:24 | * | endragor joined #nim |
02:45:10 | * | endragor quit (Remote host closed the connection) |
02:45:48 | * | vlad1777d quit (Ping timeout: 256 seconds) |
02:50:27 | * | chemist69 joined #nim |
03:03:40 | * | endragor joined #nim |
03:04:54 | * | endragor_ joined #nim |
03:05:55 | * | endragor_ quit (Remote host closed the connection) |
03:08:00 | * | vivus quit (Quit: Leaving) |
03:08:13 | * | endragor quit (Ping timeout: 256 seconds) |
03:08:25 | * | endragor joined #nim |
03:09:53 | Demos[m] | yeah so I don't like vim because it doesn't support variable pitch text or scrolling by less than one line |
03:14:15 | * | rinzai quit (Ping timeout: 265 seconds) |
03:21:35 | * | rauss quit (Read error: Connection reset by peer) |
03:22:11 | * | rauss joined #nim |
03:24:03 | * | rinzai joined #nim |
03:27:29 | * | j_rod_s quit (Ping timeout: 248 seconds) |
03:28:45 | * | rinzai quit (Ping timeout: 265 seconds) |
03:38:07 | * | MyMind joined #nim |
03:38:41 | * | Sembei quit (Ping timeout: 276 seconds) |
03:42:03 | FromGitter | <honewatson> Ok what do you prefer @Demos[m]? |
03:43:27 | shashlick | I was quite thrilled with vscode until I realized I was using 75% of my VM's RAM on two windows |
03:43:50 | shashlick | back to vim |
03:47:09 | * | dddddd quit (Remote host closed the connection) |
03:59:29 | * | d10n-work quit (Quit: Connection closed for inactivity) |
04:03:08 | * | Pisuke joined #nim |
04:03:29 | * | MyMind quit (Ping timeout: 260 seconds) |
04:17:55 | * | rinzai joined #nim |
04:18:09 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
04:21:48 | * | endragor quit (Remote host closed the connection) |
04:22:20 | * | endragor joined #nim |
04:22:24 | * | rinzai quit (Ping timeout: 265 seconds) |
04:27:02 | * | francisl quit (Quit: francisl) |
04:54:46 | FromGitter | <Varriount> Subliiiime Teeeext |
04:55:04 | FromGitter | <Quelklef> ayyy ST crew |
05:11:43 | * | rinzai joined #nim |
05:16:19 | * | rinzai quit (Ping timeout: 268 seconds) |
05:29:45 | girvo | Ram is for usage ;) |
05:29:51 | girvo | (I kid I kid, its my annoyance too) |
05:41:25 | * | endragor quit (Remote host closed the connection) |
05:50:47 | * | girvo quit (Quit: Catch you later! - https://jgirvin.com) |
06:05:30 | * | rinzai joined #nim |
06:09:35 | * | rinzai quit (Ping timeout: 240 seconds) |
06:11:25 | * | sz0 joined #nim |
06:11:35 | * | endragor joined #nim |
06:13:28 | * | yglukhov joined #nim |
06:18:08 | * | yglukhov quit (Ping timeout: 255 seconds) |
06:24:48 | * | nsf joined #nim |
06:35:29 | * | SenasOzys joined #nim |
06:59:43 | * | rinzai joined #nim |
07:03:48 | * | rinzai quit (Ping timeout: 240 seconds) |
07:16:30 | * | PMunch joined #nim |
07:20:52 | * | gokr joined #nim |
07:31:13 | * | skrylar joined #nim |
07:43:42 | * | BitPuffin joined #nim |
07:52:49 | * | yglukhov joined #nim |
07:53:29 | * | dd__ joined #nim |
07:53:37 | * | rinzai joined #nim |
07:54:35 | * | dd__ quit (Client Quit) |
07:56:42 | * | solitudesf joined #nim |
07:57:53 | * | rinzai quit (Ping timeout: 248 seconds) |
08:16:07 | * | sz0 quit (Quit: Connection closed for inactivity) |
08:16:33 | * | yglukhov quit (Remote host closed the connection) |
08:20:07 | * | yglukhov joined #nim |
08:25:03 | * | yglukhov quit (Remote host closed the connection) |
08:34:17 | * | endragor quit (Remote host closed the connection) |
08:34:35 | * | endragor joined #nim |
08:45:14 | * | floppydh joined #nim |
08:47:29 | * | rinzai joined #nim |
08:50:27 | PMunch | Hmm, question about the type system |
08:51:01 | PMunch | When using combparser I often want to check if I have thing A or B |
08:51:26 | Araq | ok |
08:51:33 | PMunch | But since Nim is type-safe the or operator can only return one type, so both have to be the same kind |
08:52:06 | Araq | yeah, typically you use an object variant |
08:52:09 | * | rinzai quit (Ping timeout: 268 seconds) |
08:52:16 | PMunch | I solved this with protobuf by creating a rather huge type with case kind: ProtoKind |
08:52:32 | PMunch | Exactly |
08:52:50 | PMunch | So now I have this: https://github.com/PMunch/protobuf-nim/blob/master/protobuf.nim#L125 |
08:53:15 | PMunch | A 27 line type with 7 different variants (and a subvariant) |
08:53:39 | FromGitter | <tim-st> @Araq Is it really not possible to set the start position of a `var string` like I can set the end position using `setLen`? |
08:53:54 | FromGitter | <alehander42> that sounds as a pretty standard variant type to me |
08:54:12 | FromGitter | <tim-st> (I mean without calling delete()) |
08:54:15 | FromGitter | <alehander42> I think just the current variant syntax might make it seem a bit bigger |
08:54:24 | PMunch | Which is fine, a bit inconvenient, but fine. Problem is that now type checking is out the window for anything that wants to use this. My verification stuff for example is littered with assert statements: https://github.com/PMunch/protobuf-nim/blob/master/protobuf.nim#L359 |
08:54:32 | FromGitter | <alehander42> e.g. with something like patty's dsl it should look good |
08:55:32 | FromGitter | <alehander42> yeah, I wondered about that, can we have something like overload on kind? e.g. for two different kinds you generate the same function with the bodies in a case branch ? |
08:56:54 | * | Arrrr joined #nim |
08:56:54 | * | Arrrr quit (Changing host) |
08:56:54 | * | Arrrr joined #nim |
08:57:08 | Araq | tim-st: no, there isn't. |
08:57:16 | PMunch | I tried to split them into separate types: https://github.com/PMunch/protobuf-nim/blob/newtype/protobuf.nim#L121 |
08:57:25 | FromGitter | <tim-st> @Araq ok, thanks |
08:58:00 | PMunch | Well you could always do myString = myString[10..^1] |
08:58:08 | Araq | PMunch: seems ok with me. it's a complex data model. |
08:58:09 | PMunch | But that would probably copy it |
08:58:30 | Araq | you can cheat and use JsonNode instead :-) |
08:58:31 | PMunch | And then use `or` types to get the parser to handle different types, but that didn't work either |
08:58:48 | Araq | since there is not much static checking going on, as you noticed. |
08:59:29 | PMunch | Well, protobuf is meant to work on compile-time. So all this parsing would be done it a macro and output the code to interface with the protobuf objects directly |
08:59:45 | FromGitter | <tim-st> @ PMunch that returns a slice, calling substr which calls `CopyStr` |
09:01:24 | Araq | PMunch: yeah, so do that instead :-) |
09:01:43 | PMunch | Huh, do what instead? |
09:02:33 | PMunch | Wait a sec, doesn't regexes work on compile-time either? |
09:03:09 | PMunch | lib/impure/re.nim(84, 28) Error: VM is not allowed to 'cast' |
09:06:42 | Araq | no why would they. |
09:07:53 | FromGitter | <data-man> @PMunch: Try https://github.com/nitely/nim-regex :) |
09:08:34 | PMunch | Araq, I just vaguely remember using regexes instead of pegs for something compile-time as pegs didn't work on compile-time |
09:10:54 | * | vlad1777d joined #nim |
09:13:38 | PMunch | data-man, interesting! Does it have something like findBounds from the re module? |
09:14:13 | PMunch | I need to match as much as possible from the front of a string |
09:14:25 | Araq | regexes for parsing is usually not a good idea |
09:14:27 | PMunch | And just get the match and the rest as strings |
09:14:46 | PMunch | Araq, I know. This is just for parsing things like "number", "string", etc. |
09:15:03 | Araq | ok |
09:15:11 | PMunch | The actual grammar parsing is not using regexes |
09:15:21 | Araq | good |
09:16:18 | PMunch | https://github.com/PMunch/protobuf-nim/blob/newtype/protobuf.nim#L84 |
09:16:34 | PMunch | Down to about #L120 uses regexes |
09:23:34 | FromGitter | <tim-st> imo the `removeSuffix` behaves strange: https://gist.github.com/anonymous/3f75d1ff9a7c147cc7c87604b7eb05aa |
09:24:12 | FromGitter | <tim-st> I think most users would assume, if it strips for char and charset than it will strip (while loop) for string, too |
09:24:45 | FromGitter | <tim-st> the same of course for `removePrefix` |
09:24:57 | Araq | so read their docs. |
09:25:12 | Araq | there is no intuitive meaning of suffix/prefix |
09:25:42 | FromGitter | <tim-st> exactly, because of this I would make it clean like Python: just call ist `strip`, `rstrip`, `lstrip` |
09:25:57 | Araq | your meaning is as strange as mine, it is not a regex, it removes the substring. not a repeated substring |
09:27:05 | FromGitter | <data-man> @PMunch: Maybe find & boundaries? https://nitely.github.io/nim-regex/#find,string,Regex,int |
09:27:17 | FromGitter | <tim-st> hm, I just want `rstrip` and `lstrip` in place, and I never wanted something like remove a suffix only once |
09:28:53 | PMunch | data-man, definitely looks promising |
09:38:06 | PMunch | tim-st, I think couven92 was doing something with rstrig lstrip |
09:41:19 | * | rinzai joined #nim |
09:42:45 | FromGitter | <tim-st> Ok, the main problem I was showing here, is that the first example in fact removes all `b`s the second one (overloaded same proc) does not. I think two proc should exist: `removePrefix` for *only* removing a prefix and than all overloaded procs should behave the same (now they dont!). The second one would be `strip` (with `lstrip`, `rstrip` overloaded as insitu and returning new string) that remove all sequences of |
09:42:45 | FromGitter | ... prefixes/suffixes in a row. |
09:45:47 | * | rinzai quit (Ping timeout: 260 seconds) |
09:47:19 | Araq | pretty sure it's consistent with the rest of strutils though |
09:48:49 | FromGitter | <andreaferretti> what is random deprecated in favour of? |
09:49:30 | Araq | rand |
09:49:34 | PMunch | Araq, did you plan on fixing the same name for different variation types by the way? |
09:49:50 | PMunch | It would be nice to have things like "name" for more than one of the variations |
09:50:07 | * | Vladar joined #nim |
09:54:18 | FromGitter | <andreaferretti> ok thanks |
09:54:52 | FromGitter | <andreaferretti> > **<PMunch>** It would be nice to have things like "name" for more than one of the variations 👍 |
10:07:21 | FromGitter | <tim-st> Is it possible in nim that two functions call each other? |
10:07:28 | * | Vladar quit (Quit: Leaving) |
10:07:32 | FromGitter | <tim-st> (procs) |
10:08:36 | FromGitter | <data-man> https://github.com/tree-sitter How did I miss this project? Lacks tree-sitter-nim :-D |
10:20:27 | FromGitter | <tim-st> it seems it is possible in c: https://en.wikipedia.org/wiki/Recursive_descent_parser#C_implementation |
10:23:52 | Araq | tim-st: how do you think Nim's parser works? |
10:24:05 | FromGitter | <alehander42> yeah I watched their talk on FOSDEM (tree sitter), I think they said they plan to support all langs that are in use in atom/github |
10:25:06 | * | surma quit () |
10:25:23 | * | surma joined #nim |
10:28:12 | FromGitter | <data-man> @alehander42: FOSDEM-2018? |
10:28:25 | FromGitter | <tim-st> Ok, I found out how it works: one has to write the signature at top level... I thought the compiler can do it itself |
10:29:06 | FromGitter | <andreaferretti> It should do that, but I think it has to be enabled explicitly |
10:29:23 | FromGitter | <tim-st> So my question wasnt that dumb... |
10:30:08 | FromGitter | <alehander42> yeah, the last fosdem |
10:31:06 | Araq | tim-st not dumb, but covered by tut1 iirc |
10:32:09 | FromGitter | <tim-st> Ok, now I see: https://nim-lang.org/docs/tut1.html#procedures-forward-declarations |
10:32:44 | FromGitter | <alehander42> araq can I use currentSourceDir in compileTime ? |
10:33:59 | FromGitter | <andreaferretti> @tim-st what I mean is that devel version of the compiler does allow mutually recursive functions without forward declarations |
10:34:23 | FromGitter | <tim-st> I have a devel version (7 days old) and it doesnt allow it |
10:34:23 | FromGitter | <andreaferretti> but I cannot recall whether an explicit pragma has to be used to enable the feature |
10:34:42 | FromGitter | <tim-st> ok |
10:35:09 | * | rinzai joined #nim |
10:35:47 | Araq | it's {.reorder: on.} but I doubt it introduces forward decls |
10:36:36 | FromGitter | <andreaferretti> ah ok that was it |
10:36:58 | FromGitter | <andreaferretti> I thought that was its aim |
10:37:08 | FromGitter | <tim-st> I think it works with `{.reorder: on.} ` at top level |
10:37:12 | FromGitter | <andreaferretti> otherwise one can just put the procs in the right order to begin with |
10:37:18 | FromGitter | <tim-st> will try now |
10:39:31 | FromGitter | <tim-st> at least I know that this works, thanks! |
10:39:35 | * | rinzai quit (Ping timeout: 255 seconds) |
10:56:20 | * | gokr left #nim (#nim) |
11:03:25 | * | rinzai joined #nim |
11:10:32 | * | SenasOzys quit (Ping timeout: 252 seconds) |
11:24:40 | * | SenasOzys joined #nim |
11:25:45 | * | Yardanico_ joined #nim |
11:26:16 | PMunch | mratsim, do you have any example code for the stuff you told me about performance in Julia without type hints? |
11:26:39 | PMunch | I remember you told me to get good performance you needed to use type hints |
11:34:36 | PMunch | Hmm, a guy on Telegram: "btw, is it normal that the Matrix example shown here (the manual, section on static[T]) does not compile (saying that Number is undeclared)? Do I have to import it somehow?" |
11:34:47 | PMunch | Seems like a "bug" in the manual |
11:39:39 | FromGitter | <sclee15> Hello i am a nim beginner. I wonder how is your overall experiences when you using nim js backend |
11:40:28 | PMunch | sclee15, Hi! Haven't used the JS backend much but what I have tried have been very good |
11:40:44 | PMunch | s/have/has |
11:43:46 | Arrrr | "`newNativeSocket`` is now named ``createNativeSocket``" why nit ``initNativeSocket``? is far more popular https://nim-lang.org/docs/apis.html |
11:43:51 | * | tyrion-mx joined #nim |
11:43:54 | Arrrr | *not |
11:44:51 | * | Yardanico_ quit (Read error: Connection reset by peer) |
11:45:30 | FromGitter | <mratsim> @Pmunch will look in my bookmarks |
11:48:14 | tyrion-mx | Hello, does anybody know if it is possible to extend the Matrix example given here ( https://nim-lang.org/docs/manual.html#special-types-static-t ) to work with an arbitrary number of dimensions? i.e. varargs of ints instead of M,N |
11:48:16 | * | euantor quit () |
11:48:32 | FromGitter | <mratsim> Probably this: http://www.stochasticlifestyle.com/7-julia-gotchas-handle/ @Pmunch |
11:48:34 | * | euantor joined #nim |
11:49:09 | FromGitter | <mratsim> @tyrion-mx, you can but the max number must still be set at compile-time |
11:49:17 | tyrion-mx | The example is this: `type Matrix[M,N: static[int]; T: Number] = array[0..(M*N - 1), T]` |
11:50:05 | FromGitter | <mratsim> otherwise use a Matrix[T] with the shape stored in a seq |
11:50:32 | tyrion-mx | mratsim: ok, cool! Could you please show me an example? |
11:50:34 | FromGitter | <mratsim> depending on your use case you probably should use my library Arraymancer: https://github.com/mratsim/Arraymancer |
11:51:01 | tyrion-mx | I think I read all your blog ahah |
11:51:25 | FromGitter | <mratsim> Here is the “Matrix” type: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/data_structure.nim#L32-L48 |
11:52:05 | FromGitter | <tyrion> (I am switching to gitter, since apparently you're using it) |
11:52:11 | FromGitter | <mratsim> And dimensions are stored at compile time there: https://github.com/mratsim/Arraymancer/blob/10b3c898746ff7652b7f581e2b17b5455dd6dc02/src/tensor/backend/metadataArray.nim#L17-L22 |
11:52:27 | PMunch | tyrion-mx, Hi :) |
11:52:33 | PMunch | I'm Peter from Telegram |
11:52:39 | FromGitter | <mratsim> MAXRANK = 7 for Arraymancer |
11:53:07 | * | rokups joined #nim |
11:53:15 | tyrion-mx | hey PMunch :) |
11:54:52 | FromGitter | <mratsim> You might also want to look into the v0.1.0 which is much easier to grasp as I was also discovering Nim: https://github.com/mratsim/Arraymancer/blob/30c8a2ff9ac3771db63a2a4e94cfe009dce83a45/src/arraymancer/data_structure.nim#L25-L35 |
11:56:43 | FromGitter | <tyrion> @mratsim since I am super new to the language (I started reading the tutorial yesterday) and I am already digging in some complex parts of the language, could you help understand this better? ⏎ Is it possible to specify the shape and dtype in the type itself? Are you doing it with Arraymancer and why? (apparently not if I understand correctly) |
11:57:34 | FromGitter | <mratsim> It is possible to have the shape and dtype part of the type. For me dtype is part of the type but the shape is not. |
11:58:37 | FromGitter | <mratsim> shape is not because it makes it much harder for concatenation, stuff like “squeeze” and “unsequeeze” (remove and add all singleton dimensions) |
11:59:04 | * | yglukhov joined #nim |
11:59:19 | * | yglukhov quit (Remote host closed the connection) |
11:59:24 | FromGitter | <mratsim> dtype is part of it because it’s essential for optimization purposes. Numpy also works like that. |
11:59:55 | FromGitter | <mratsim> If you’re thinking of pandas, each column is actually a different numpy array hence why they can have a different dtype |
12:00:06 | FromGitter | <tyrion> you mean at the C level? because at the python level, every array is ndarray I guess |
12:00:39 | FromGitter | <mratsim> For the shape to be part of the type you can look into final: https://github.com/unicredit/linear-algebra/blob/master/linalg/private/types.nim#L21-L23 |
12:01:31 | FromGitter | <mratsim> or alternative the PR I did for linalg which is even more generic: https://github.com/mratsim/linear-algebra/blob/float-parametric/linalg/private/types.nim#L15-L24 |
12:02:04 | FromGitter | <mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a82d3bb51915d962aff364f] |
12:02:11 | * | odc quit () |
12:02:32 | * | odc joined #nim |
12:02:51 | FromGitter | <mratsim> In the end Andrea also choose not to continue with the shape (N, M) being part of the type and created neo instead |
12:04:16 | FromGitter | <tyrion> Ok, thanks for the explanation. I guess the safety that you gain is not worth the effort |
12:04:59 | FromGitter | <mratsim> In summary, if we take the examples of arrays array[10, int] both 10 (number of elements) and int (types of the elements) are part of the type and must be known at compile-time |
12:05:34 | PMunch | for field in (if field.kind == Field: @[field] else: field.oneof): |
12:05:40 | PMunch | Gotta love Nim one-liners :P |
12:09:26 | FromGitter | <mratsim> @tyrion, yes. But the biggest issue I think is that you cannot infer the dimension after `np.squeeze` at compile-time |
12:10:18 | FromGitter | <mratsim> (bumpy uses squeeze implicitly after lots of function like sum, product, max along axis …) |
12:10:27 | FromGitter | <mratsim> numpy* |
12:11:22 | * | radagast_04 joined #nim |
12:11:30 | FromGitter | <sclee15> @PMunch thanks |
12:12:32 | radagast_04 | What's the Nim idom for a pointer of a pointer? for example: `void fn(int** arr, size_t n); |
12:12:39 | FromGitter | <tyrion> @mratsim so, I understood that the shape can be part of the type as well but both you and @andreaferretti chose not to include it into the type for a valid reason. However I am still curious about how would go on implementing an ndimensional array with shape in the type. Something like `Array[float, 3, 4, 5, 1]` or `Array[float, [3,4,5,1]]` |
12:13:25 | radagast_04 | proc fn(arr: var arrref; n: uint) |
12:13:32 | * | SenasOzys quit (Read error: Connection reset by peer) |
12:13:41 | * | SenasOzys joined #nim |
12:15:08 | FromGitter | <mratsim> for example: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a82d6cc97cedeb0482f2a1a] |
12:15:39 | * | Snircle joined #nim |
12:16:12 | FromGitter | <tyrion> umh, ok, so it isn't possible to have a single declaration for every N-dimensional array |
12:16:16 | FromGitter | <mratsim> M, N, P, Q are the dimensions, static means they are required and known at compile-time. T: SomeNumber —> our type is only valid for int32, int64, float32, uint32, float64, etc |
12:16:34 | PMunch | radagast_04, it depends. What are you trying to do? |
12:16:49 | FromGitter | <tyrion> like `Array[T: SomeNumber, S: varargs[static[int]]]` |
12:17:06 | FromGitter | <mratsim> ref —> because the stack is limited and such an array would take much more than the few MB that we have on the stack |
12:17:44 | * | Vladar joined #nim |
12:18:27 | * | couven92 joined #nim |
12:18:28 | radagast_04 | PMunch: for example implementing a prepend function of a linked list. The head node needs to be changed. Of course, I passed a var ref of the head object |
12:19:14 | Araq | array[5, array[6, int]] |
12:19:50 | Araq | hard to create an alias for it but so what. you don't need to re-implement what a little type recursion gives you |
12:20:35 | PMunch | radagast_04, just a var should work with that |
12:21:00 | PMunch | Or, hmm |
12:23:48 | FromGitter | <mratsim> Untested ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a82d8d497cedeb0482f2a38] |
12:25:05 | PMunch | radagast_04, like this? https://play.nim-lang.org/?gist=8798aa3477a42a51666bfbe4c3ca44ef |
12:25:27 | FromGitter | <mratsim> Might even need: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a82d93781cd9a5d7ea3f4be] |
12:25:56 | FromGitter | <mratsim> not sure if we can use static on the right hand side to enforce dimensions at compile-time |
12:26:25 | PMunch | radagast_04, of course if you only want a linked list you can use the linked list module :) |
12:30:14 | FromGitter | <mratsim> but @tyrion to be honest, Andrea and me tried to push the static part of Nim quite far but it’s one of the rougher edge of Nim with 43 bugs still open |
12:30:53 | FromGitter | <tyrion> The first example does not compile. It says `] expected` on line 3 https://play.nim-lang.org/?gist=a94127a232dfff95cdadc431931d8ead ⏎ (also I am not sure if on the second line `ndims` and `Ndim` should be written the same?) |
12:31:10 | Araq | report this properly please. |
12:31:18 | FromGitter | <mratsim> oh yeah, I wrote that directly in Gitter ;) |
12:31:43 | Araq | we now have a testing infrastructure for the examples in the manual |
12:31:46 | FromGitter | <mratsim> it shouldd be ndims everywhere |
12:31:53 | Araq | I only patched the tutorials for now though :-) |
12:32:20 | Araq | static[T] well... I still think it's a bit misdesigned. |
12:32:45 | Araq | is '4' of type 'int' or 'static[int]'? |
12:33:34 | Araq | static[static[T]] is the same as static[T] which smells like "not a type" to me |
12:33:38 | * | vlad1777d quit (Ping timeout: 276 seconds) |
12:33:52 | FromGitter | <mratsim> could that be a Concept? ⏎ ⏎ `static[x] = concept x when x.knownAtCompileTime` |
12:34:13 | Araq | but *shrug* I had to repeat this mistake with 'sink T' |
12:34:20 | FromGitter | <tyrion> Like that it compiles: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a82db4ce217167e2c7aeae4] |
12:34:23 | Araq | type systems suck :-) |
12:35:08 | FromGitter | <mratsim> heh you’re better than me @tyrion, congrats :P |
12:36:11 | Araq | is seq[static[T]] the same as static[seq[T]]? |
12:36:46 | Araq | what is an object with static[T] fields? fields that have no runtime representation? |
12:36:56 | FromGitter | <tyrion> @mratsim :°D |
12:39:22 | FromGitter | <tyrion> Now, if there is a way to multiply the elements of `Shape[N]` together I could use `ref array[prod(S), T]` instead of seq |
12:42:02 | * | Pisuke quit (Read error: Connection reset by peer) |
12:42:17 | FromGitter | <mratsim> you can use a compile-time proc |
12:43:08 | * | Pisuke joined #nim |
12:44:15 | FromGitter | <mratsim> @Araq did you consider the “PhantomType” as an alternative to Static to store data with no runtime representation? |
12:45:38 | FromGitter | <tyrion> ok, still using the seq ... I made it compile, but I have no idea how to create a variable of type `NdArray` 😄 . Any hint? |
12:50:31 | FromGitter | <andreaferretti> @Araq I don't think static is misdesigned |
12:50:56 | FromGitter | <andreaferretti> one just needs to enforce the rule that static can only be used as a global qualifier of a type |
12:51:22 | FromGitter | <andreaferretti> cannot be put into seq, object fields, tuples and so on |
12:51:53 | FromGitter | <andreaferretti> and it is very useful to store data that can be precomputed at compile time, with the compiler helping propagating this information |
12:52:19 | FromGitter | <andreaferretti> unfortunately, it is also the buggiest part of Nim :-( |
12:54:24 | Araq | mratsim: I forgot what PhantomType means |
12:54:49 | Araq | andreaferretti: IMO the bugs are a symptom of an unclear design |
12:55:35 | * | couven92 quit (Ping timeout: 240 seconds) |
12:55:53 | FromGitter | <mratsim> https://doc.rust-lang.org/std/marker/struct.PhantomData.html |
12:56:21 | FromGitter | <mratsim> seems like I'm confusing rust PhantomType and PhantomData |
12:56:21 | FromGitter | <andreaferretti> a phantom type is just a generic parameter that has no runtime effect |
12:56:35 | FromGitter | <andreaferretti> used just to distinguish types |
12:58:48 | Araq | so ... static[T] is a phantom type? |
12:58:54 | FromGitter | <andreaferretti> for instance `type ButtonState = enum Clicked, NotClicked; type Button[ButtonState] = object width, height: int` |
12:59:21 | FromGitter | <andreaferretti> `static[T]` is more powerful than a phantom type as usually intended |
12:59:40 | FromGitter | <andreaferretti> in that it can also carry arbitrary data (`T`) |
13:00:11 | FromGitter | <andreaferretti> other languages just use generics and can usually carry only a finite amount of information in the type in this way |
13:01:11 | FromGitter | <andreaferretti> a typical example of phantom types is tagging strings |
13:01:42 | FromGitter | <andreaferretti> `type Tag = Id, Password, Url; type TaggedString[Tag] = string` |
13:02:01 | FromGitter | <andreaferretti> this way different kinds of strings do not get mixed up |
13:03:13 | FromGitter | <andreaferretti> sorry I am writing things that do not make sense: here I am using enums, which are runtime stuff |
13:03:44 | FromGitter | <andreaferretti> but still, one can use inheritance to model this at the type level |
13:04:53 | FromGitter | <andreaferretti> `type Id = object; type Password = object; type Url = object; type Tag = Id or Password or Url; type TaggedString[Tag] = string` |
13:05:13 | FromGitter | <andreaferretti> this should be correct, no runtime info or static[T] needed |
13:05:42 | * | francisl joined #nim |
13:07:02 | * | rinzai quit (Ping timeout: 260 seconds) |
13:16:31 | * | rinzai joined #nim |
13:20:54 | * | rinzai quit (Ping timeout: 256 seconds) |
13:22:48 | FromGitter | <mratsim> I’m trying to get term-rewriting macro to apply to thes but I don’t understand why it doesn’t match: https://play.nim-lang.org/?gist=584b47fbf7095f5e34a6023adb78b223 and https://gist.github.com/584b47fbf7095f5e34a6023adb78b223. Bug? |
13:27:11 | FromGitter | <alehander42> @sclee15 if you have nim js questions, ask, I have some prolonged xp with it |
13:32:50 | * | tyrion-mx quit (Quit: Leaving) |
13:36:15 | FromGitter | <mratsim> mmmh I think it’s a bug, getting the TRM out of the template makes it work |
13:40:40 | * | rinzai joined #nim |
13:40:41 | FromGitter | <mratsim> https://github.com/nim-lang/Nim/issues/7214 |
13:48:11 | * | francisl quit (Quit: francisl) |
13:49:54 | * | Arrrr quit (Quit: Leaving.) |
13:50:26 | * | rinzai quit (Ping timeout: 276 seconds) |
13:51:03 | * | rinzai joined #nim |
13:52:04 | FromGitter | <sclee15> @alehander42 is nim js backed good for making ajax centered javascript app? (i mean wonder that i can use async await and json serialization from nimobject to jsobject) |
13:55:21 | * | rinzai quit (Ping timeout: 256 seconds) |
13:55:42 | FromGitter | <alehander42> you can now use async/await with the js backend too , we implemented this just several months ago |
13:56:05 | FromGitter | <sclee15> without babel? |
13:56:23 | FromGitter | <alehander42> the json module also works well, my only problems have been serializing variant objects, but that's a niche case |
13:57:27 | FromGitter | <sclee15> so using json module is idiomatic way of using js backend not importc JSON |
13:57:32 | FromGitter | <alehander42> we generate directly async/await js code, |
13:57:50 | FromGitter | <alehander42> it depends, for modern browsers & electron, this syntax is already supported |
13:57:59 | FromGitter | <alehander42> otherwise you can add babel in your build process, yeah |
13:58:24 | FromGitter | <alehander42> I am not sure what you mean with `importc` |
13:58:27 | FromGitter | <alehander42> in this case |
13:59:15 | dom96 | You can just use the json module directly for the js backend |
13:59:28 | dom96 | I would say the async stuff is a little more experimental right now |
14:00:20 | FromGitter | <sclee15> @alehander42 i saw some code like in the forum. ⏎ ⏎ ```var console {. importc, nodecl .}: JsObject``` [https://gitter.im/nim-lang/Nim?at=5a82ef748c71e5e01d8d3a63] |
14:01:17 | FromGitter | <sclee15> thanks @dom96 |
14:02:30 | dom96 | If you want to use the JS backend then you will have to get comfortable with {.importc.}, but it's easy. Take a look at chapter 8 of my book: https://book.picheta.me/ (It's free) |
14:03:57 | FromGitter | <sclee15> @dom96 I've already a copy of your book. |
14:04:14 | dom96 | Awesome :) |
14:04:21 | dom96 | Then take a look at the JS section of Chapter 8 |
14:05:07 | FromGitter | <sclee15> I thought the async await might be a killer feature for nim js backend. |
14:07:04 | FromGitter | <sclee15> For now, I should be satisfied with good syntax of Nim. |
14:14:51 | PMunch | Okay, now I think I have the parsing and validation of Protobuf down. Just need to figure out how to represent these things as Nim types and procedures.. |
14:17:23 | PMunch | Especially the nested types.. |
14:17:24 | PMunch | http://ix.io/GOM/ |
14:20:12 | FromGitter | <alehander42> @sclee15 you should be able to use async/await anyway, I don't know of any major problems with it currently |
14:20:24 | * | francisl joined #nim |
14:20:46 | * | SenasOzys quit (Ping timeout: 265 seconds) |
14:21:09 | PMunch | Hmm, C++ seems to use SearchRequest_SubType |
14:22:49 | PMunch | Wowzer, C++ generates almost 2k lines of code for that snippet |
14:27:20 | PMunch | Hmm, can macros return docstrings? With something of this size it would be nice to have the macro capable of creating documentation as well |
14:28:10 | * | SenasOzys joined #nim |
14:43:49 | Araq | mratsim: I doubt scoped TR macros are supported :-) |
14:44:02 | Araq | probably the compiler should simply forbid them |
14:44:56 | * | rinzai joined #nim |
14:46:03 | Araq | oh I see, you figured it out already |
14:46:17 | PMunch | https://github.com/PMunch/protobuf-nim/blob/master/proto3.prot -> https://github.com/PMunch/protobuf-nim/blob/master/proto3.nim input? |
14:46:28 | PMunch | Leaving work now but will be back on-line in not too long |
14:49:49 | * | rinzai quit (Ping timeout: 268 seconds) |
14:49:56 | * | Pisuke quit (Read error: Connection reset by peer) |
14:51:05 | * | Pisuke joined #nim |
14:51:07 | * | ieatnerds quit (Remote host closed the connection) |
14:51:24 | * | ieatnerds joined #nim |
14:52:00 | FromGitter | <mratsim> @Araq Yeah through macros, except that I’m having some trouble to interpolate with the argument: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I get got (int, int, NimNode) and I can’t find a way to do that cleanly [https://gitter.im/nim-lang/Nim?at=5a82fb9051915d962aff3866] |
14:55:46 | * | yglukhov joined #nim |
14:58:00 | * | PMunch quit (Quit: Leaving) |
15:04:23 | FromGitter | <zetashift> @dom86 or anybody else with a lobster account mind informing this young fellow about the wonders of Nim: https://lobste.rs/s/hhmlfh/spry_language_inspired_by_rebol_lisp#c_ggqtbc |
15:05:06 | FromGitter | <mratsim> Spry is writtne in Nim |
15:05:09 | * | j_rod_s joined #nim |
15:07:45 | FromGitter | <Quelklef> Why does ⏎ ⏎ ```when defined(test): ⏎ echo("a") ⏎ else: ⏎ echo("b")``` ⏎ ⏎ Result in `b` when run with `-d:test`? Am I misunderstanding `-d:`/`defined()`? [https://gitter.im/nim-lang/Nim?at=5a82ff418c71e5e01d8da898] |
15:16:52 | * | d10n-work joined #nim |
15:17:11 | FromGitter | <mratsim> I get a |
15:17:27 | * | endragor quit (Remote host closed the connection) |
15:17:40 | * | rinzai joined #nim |
15:18:37 | FromGitter | <Quelklef> Turns out `-d` needs to come before `-r` I think |
15:19:02 | FromGitter | <Quelklef> Was trying `nim c -r file -d:test` |
15:19:18 | FromGitter | <mratsim> no, it’s the file |
15:19:21 | FromGitter | <mratsim> after file everything else is ignored |
15:19:50 | FromGitter | <Quelklef> Oh, because they're passed as arguments. Dug |
15:22:08 | * | rinzai quit (Ping timeout: 248 seconds) |
15:22:20 | * | endragor joined #nim |
15:24:53 | * | j_rod_s quit (Ping timeout: 256 seconds) |
15:27:26 | * | endragor quit (Ping timeout: 268 seconds) |
15:35:08 | * | endragor joined #nim |
15:39:45 | * | endragor quit (Ping timeout: 248 seconds) |
15:41:01 | radagast_04 | What does it mean to have a thread-unsafe GC? What implications and restrictions does it come with? |
15:46:25 | FromGitter | <mratsim> race condition, where data needed by one thread might have been collected because it wasn’t needed in another I suppose. |
15:50:08 | * | yglukhov quit (Remote host closed the connection) |
16:02:52 | * | Arrrr joined #nim |
16:03:11 | * | rinzai joined #nim |
16:07:38 | * | rinzai quit (Ping timeout: 255 seconds) |
16:13:28 | * | yglukhov joined #nim |
16:14:38 | * | rinzai joined #nim |
16:15:56 | * | yglukhov quit (Remote host closed the connection) |
16:15:56 | * | miran_ joined #nim |
16:19:14 | * | rinzai quit (Ping timeout: 268 seconds) |
16:19:34 | * | rinzai joined #nim |
16:21:15 | * | j_rod_s joined #nim |
16:27:07 | * | endragor joined #nim |
16:28:02 | * | yglukhov joined #nim |
16:29:02 | * | rinzai quit (Ping timeout: 276 seconds) |
16:30:13 | * | natrys joined #nim |
16:30:53 | * | rinzai joined #nim |
16:34:57 | * | rinzai quit (Ping timeout: 240 seconds) |
16:35:06 | * | TakeYourFreedom joined #nim |
16:35:31 | * | miran_ quit (Remote host closed the connection) |
16:35:44 | * | gokr joined #nim |
16:35:50 | * | stisa quit (Remote host closed the connection) |
16:38:37 | * | rinzai joined #nim |
16:40:42 | * | tefter quit (Remote host closed the connection) |
16:41:34 | * | miran_ joined #nim |
16:42:46 | miran_ | @andreaferretti - are you here maybe? |
16:43:19 | FromGitter | <andreaferretti> yup |
16:43:27 | * | rinzai quit (Ping timeout: 256 seconds) |
16:44:46 | miran_ | i have just installed neo, and before that `blas` and `lapack` from my package manager (on manjaro linux) and now i got `could not import: cblas_sscal` when i try to run a simple example |
16:44:54 | * | j_rod_s quit (Ping timeout: 256 seconds) |
16:45:09 | miran_ | i'm reading https://github.com/unicredit/neo#linking-external-libraries but i'm not sure what i need to do |
16:45:30 | FromGitter | <andreaferretti> it may have to be with the way manjaro linux mangles these names |
16:45:43 | FromGitter | <andreaferretti> do you have cblas installed? |
16:46:31 | miran_ | nope. installing it now |
16:47:24 | FromGitter | <andreaferretti> apparently user @konqoro was able to make it work on manjaro https://github.com/unicredit/nimblas/issues/1 |
16:50:03 | miran_ | ok, now i have both blas and cblas, but still the same error |
16:50:11 | * | gokr quit (Read error: No route to host) |
16:50:39 | miran_ | blas is installed in /usr/lib/* |
16:52:59 | miran_ | ok, i have just run `nim c --define:blas filename.nim` and it seems it works |
16:54:16 | miran_ | the default way of compile+run in vscode gives the error mentioned aboce |
16:54:19 | miran_ | *above |
16:55:32 | miran_ | update: it compiles, but when i try to run it: `could not load: libtrue.so(||.3|.2|.1|.0)` |
17:02:48 | * | fvs joined #nim |
17:03:12 | fvs | bug? echo 2^6 |
17:03:27 | fvs | on 17.2 |
17:04:51 | fvs | my bad, forgot to import math |
17:09:18 | * | Trustable joined #nim |
17:10:06 | * | rinzai joined #nim |
17:10:37 | FromGitter | <andreaferretti> libtrue? |
17:11:34 | miran_ | i have no idea :) |
17:11:49 | FromGitter | <andreaferretti> I see, it is `--define:blas` |
17:11:55 | FromGitter | <andreaferretti> it should b |
17:12:04 | FromGitter | <andreaferretti> `--define:blas=something` |
17:12:15 | FromGitter | <andreaferretti> where something is the blas library you want to link to |
17:12:51 | FromGitter | <andreaferretti> `--define:blas=cblas` or `--define:blas=openblas` or `--define:blas=atlas` |
17:12:54 | FromGitter | <andreaferretti> you get the idea |
17:13:26 | miran_ | `-d:blas=cblas` worked! |
17:13:36 | FromGitter | <andreaferretti> great! |
17:13:51 | * | Arrrr quit (Read error: Connection reset by peer) |
17:13:57 | miran_ | thank you very much!! |
17:14:04 | FromGitter | <andreaferretti> If you want to make a small PR to clarify this |
17:14:15 | FromGitter | <andreaferretti> and add a suggestion for manjaro here https://github.com/unicredit/neo/blob/master/neo.nimble#L16-L24 |
17:14:23 | miran_ | looking forward to converting some numpy code to see if there are any speed improvements |
17:14:24 | FromGitter | <andreaferretti> it would be useful! |
17:14:32 | * | rinzai quit (Ping timeout: 255 seconds) |
17:14:46 | FromGitter | <andreaferretti> numpy also uses blas and lapack under the hood |
17:15:08 | FromGitter | <andreaferretti> unless python is our bottleneck, you won't see speedups |
17:15:10 | FromGitter | <andreaferretti> but |
17:15:32 | FromGitter | <andreaferretti> if you have a GPU and can run this on CUDA - you may get a speedup as well |
17:15:45 | miran_ | there are lots of loops (numerical integration), so i hope to see some improvement there |
17:16:20 | * | BitPuffin quit (Remote host closed the connection) |
17:16:22 | miran_ | re PR: i'm not sure what should be added/modified for manjaro in the code you have linked |
17:16:32 | FromGitter | <andreaferretti> please, ask here if something is hard to do or slower than you expect! |
17:16:56 | miran_ | will do, thank you once again! |
17:17:17 | FromGitter | <andreaferretti> well, there is this detectOs function in nimscript which is useful to give suggestions |
17:17:24 | shashlick | wow a nim native regex - thanks for sharing |
17:17:32 | shashlick | i wish there were more examples of using pegs in nim |
17:17:44 | FromGitter | <andreaferretti> but I am not sure what dependencies are need on manjaro |
17:18:02 | FromGitter | <andreaferretti> elif detectOs(Manjaro): |
17:18:13 | FromGitter | <andreaferretti> foreignDep something |
17:18:26 | FromGitter | <andreaferretti> where something are the libraries you needed to install |
17:18:58 | miran_ | well, i have installed blas, lapack and cblas. but i guess only blas and cblas would be enough? |
17:19:18 | FromGitter | <andreaferretti> no lapack is needed for some operations |
17:19:20 | FromGitter | <andreaferretti> btw, for speed use openblas, it is much faster (it could be you default blas implementation or not) |
17:20:19 | miran_ | i don't see openblas in the manjaro repo :/ |
17:21:01 | miran_ | but there are `openblas` and `openblas-lapack` packages on AUR |
17:21:44 | miran_ | for the latter, it says "Optimized BLAS library based on GotoBLAS2 1.13 BSD (providing blas, lapack, and cblas)" - i guess this is the one to use |
17:22:35 | FromGitter | <andreaferretti> great |
17:23:31 | * | j_rod_s joined #nim |
17:32:05 | * | miran_ quit (Remote host closed the connection) |
17:39:00 | * | miran_ joined #nim |
17:39:29 | miran_ | some of these installations have broken my system.... |
17:39:38 | miran_ | `/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/cc1: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory` |
17:39:52 | FromGitter | <andreaferretti> :-( |
17:40:05 | FromGitter | <andreaferretti> I don't see why they would |
17:40:19 | FromGitter | <andreaferretti> they are just numerical libraries after all |
17:40:43 | FromGitter | <andreaferretti> I have zero experience with Manjaro, though, sorry I cannot help you |
17:40:43 | miran_ | i have no idea what happenend, but now even regular nim won't compile |
17:41:11 | Araq | wow that's actually quite unheard of :-) |
17:41:22 | Araq | you have unique trouble here, congrats |
17:42:33 | miran_ | Araq: thank you, i'm quite proud of myself and have no idea how to fix it |
17:43:01 | Araq | uninstall the broken packages? |
17:43:16 | Araq | reinstall Linux? |
17:43:17 | * | floppydh quit (Quit: WeeChat 2.0.1) |
17:43:25 | Araq | buy a new computer? |
17:43:29 | Araq | pull the plug? |
17:43:54 | miran_ | set the whole flat on fire and run |
17:44:15 | Araq | https://www.youtube.com/watch?v=q8SWMAQYQf0 |
17:44:57 | miran_ | sorry, no time for laughs currently. i'm busy banging my head on the wall |
17:46:27 | radagast_04 | Install base-devel package |
17:46:40 | Araq | https://youtu.be/vtn2fAe_kZI?t=636 |
17:48:22 | Araq | ok, enough of this |
17:49:21 | miran_ | radagast_04: `base-devel-multilib` from AUR? |
17:50:58 | radagast_04 | why multilib? I was hoping reinstalling base-devel would help |
17:51:31 | miran_ | radagast_04: because thats the only thing showing up? :) |
18:03:56 | * | rinzai joined #nim |
18:05:51 | * | Take_Your_Freedo joined #nim |
18:07:27 | * | TakeYourFreedom quit (Ping timeout: 260 seconds) |
18:07:56 | * | Take_Your_Freedo quit (Client Quit) |
18:08:03 | * | Take_Your_Freedo joined #nim |
18:09:00 | * | rinzai quit (Ping timeout: 268 seconds) |
18:13:11 | * | miran_ quit (Quit: Konversation terminated!) |
18:15:30 | * | miran_ joined #nim |
18:16:40 | miran_ | fixed! |
18:17:26 | Araq | how? |
18:17:29 | miran_ | remember kids - don't install libraries if your system isn't updated because this is how you get partially updated system and bad things can happen! |
18:17:59 | miran_ | note to self - try to be less stupid in the future |
18:20:55 | * | endragor quit (Remote host closed the connection) |
18:21:11 | * | endragor joined #nim |
18:21:57 | * | endragor quit (Remote host closed the connection) |
18:22:37 | * | chemist69 quit (Ping timeout: 260 seconds) |
18:25:41 | * | chemist69 joined #nim |
18:26:58 | miran_ | @andreaferretti - now i was able to install the mentioned `openblas-lapack` from AUR - it replaces (removes) the manjaro versions of blas and lapack. and now everything seems to work |
18:27:13 | miran_ | even the regular compile+run in vscode |
18:27:18 | Araq | miran_, shouldn't the package manager prevent this thing from happening? |
18:28:14 | miran_ | Araq: well, there was a red icon warning me that i'm not updated, but i have decided to ignore it. |
18:31:35 | Araq | report it on manjaro's issue tracker anyway |
18:33:14 | planetis[m] | this stuff happens when you haven't pdated your system in a while and try to install a package |
18:33:42 | * | yglukhov quit (Remote host closed the connection) |
18:36:16 | FromGitter | <dandevelo> Can you use .importc with types? |
18:42:34 | Araq | certainly but it's usually better to not do this |
18:42:58 | * | yglukhov joined #nim |
18:43:02 | Araq | so that the Nim only depends on the DLL and not C header files |
18:48:10 | miran_ | planetis[m]: that is *exactly* the thing that happened. i was 2 system updates behind, i think |
18:49:11 | * | gokr joined #nim |
18:50:29 | * | Take_Your_Freedo quit (Remote host closed the connection) |
18:54:35 | * | PMunch joined #nim |
18:57:37 | * | bl4rk joined #nim |
18:57:47 | * | rinzai joined #nim |
18:58:29 | PMunch | Okay, not too long turned into a while :P |
18:58:34 | miran_ | Araq: you know when you have a tuple with x and y fields, you can define it as (x:2.0, y:3.0), but you can't as (x:-2.0, y:3.0)? |
18:58:51 | miran_ | but putting space between : and - makes it ok |
18:59:05 | PMunch | Probably it maches something on :- |
18:59:06 | miran_ | bug or a feature? |
18:59:12 | PMunch | Not sure what that would be :P |
18:59:18 | Araq | do you really think I don't know? :-) |
18:59:28 | Araq | :- is an operator in its own right |
18:59:33 | Araq | it's a feature. |
18:59:44 | bl4rk | Hi folks, I have a question about using winim and VirtualAlloc, I am just trying to figure out the correct syntax. |
18:59:45 | PMunch | What does :- do? |
19:00:02 | miran_ | starts a smiley? :D |
19:00:14 | PMunch | Or is it just a possible operator and those match first regardless of if they are implemented |
19:00:23 | PMunch | miran_, partially applied smileys :P |
19:00:32 | bl4rk | anyone got a sec for my noob questions? :) |
19:00:32 | Araq | bl4rk, look at lib/system/osalloc.nim for an example |
19:00:41 | bl4rk | Thanks Araq~ |
19:01:54 | Araq | PMunch, it is an operator you can define |
19:02:01 | PMunch | Right |
19:02:45 | * | rinzai quit (Ping timeout: 264 seconds) |
19:04:29 | Araq | :- in Prolog is "implies" |
19:05:58 | bl4rk | Araq: ok I was just a dummy I was trying to echo the result of VirtualAlloc and getting an error but it was still working lol |
19:06:09 | bl4rk | thanks |
19:06:22 | * | couven92 joined #nim |
19:17:27 | miran_ | @andreaferretti - is it posible to assign a matrix to a slice of a bigger matrix? e.g. A[0 .. 2, 0 .. 2] = B |
19:26:21 | * | Sargun quit (Quit: leaving) |
19:28:40 | FromGitter | <tyrion> Hello, I am playing a bit with the type system and static. Here I get `got: (N) but expected: (N)` which seems a bit weird. https://play.nim-lang.org/?gist=5498907a2604ffa88b01e214cb4fded8 ⏎ The first implementation using `array` works, the one using `IntArray` does not |
19:29:37 | FromGitter | <tyrion> (not sure if it's better to paste the code directly or to send a link) |
19:30:03 | bl4rk | This might be a dumb question but I've allocated 4 bytes of memory using tmp = VirtualAlloc(nil, DWORD(4), allocType, flProtect) now I want to write the var someCode (array[0x10, uint8]) to it. What's the best way? I am having trouble figuring out he sytax between win and nim |
19:30:14 | def- | @tyrion: line 14: IntArray[N: static[int]] |
19:30:29 | bl4rk | sorry that should read 16 bytes |
19:30:39 | bl4rk | 0x10 not 4 |
19:31:20 | def- | bl4rk: copyMem? |
19:31:38 | FromGitter | <tyrion> def-: I will try, but shouldn't it work anyway? I just wanted IntArray[N] to be an alias for Array[N, int] |
19:32:06 | def- | @tyrion well, it's necessary for int types, not sure why |
19:34:32 | bl4rk | def-: here's the question i had, copyMem is a nim function and VirtualAlloc returns a LPVOID - can I pass that right to copyMem or do I need to convert it? |
19:34:43 | bl4rk | i am a noob thanks for your patience |
19:39:03 | FromGitter | <dom96> Hah https://twitter.com/steveklabnik/status/963494075830857730 |
19:40:27 | PMunch | Haha! |
19:40:59 | * | fvs left #nim ("ERC (IRC client for Emacs 25.3.1)") |
19:41:06 | PMunch | We should create a "programming Nim" boyband or something |
19:41:10 | * | gokr quit (Ping timeout: 240 seconds) |
19:41:15 | PMunch | To tweak the scales |
19:41:55 | planetis[m] | evil laugh! |
19:43:28 | def- | bl4rk: dunno about windows api, copyMem takes pointers |
19:43:35 | bl4rk | looks like it works |
19:49:06 | bl4rk | i did copyMem using the LPVOID and then equalMem(tmp, someCode, 0x10) and got true so i guess the LPVOID is seen as a ptr by nim, but I couldn't do repr(tmp) so I wasn't sure |
19:49:36 | * | francisl quit (Quit: francisl) |
19:51:36 | * | rinzai joined #nim |
19:55:37 | FromGitter | <mratsim> libtool is an exercise in insanity ... |
19:56:09 | * | rinzai quit (Ping timeout: 264 seconds) |
20:08:52 | * | natrys quit (Quit: natrys) |
20:09:22 | * | dddddd joined #nim |
20:14:05 | * | francisl joined #nim |
20:14:23 | * | yglukhov quit (Read error: Connection reset by peer) |
20:15:03 | * | yglukhov joined #nim |
20:17:29 | * | Trustable quit (Remote host closed the connection) |
20:21:40 | bl4rk | question: is there any difference between p: pointer = a.addr and p = a.addr |
20:21:50 | bl4rk | other than explicitly setting the type? |
20:23:40 | * | rinzai joined #nim |
20:26:48 | PMunch | Well a.addr probably is of type ptr <a's type> |
20:26:55 | PMunch | So there is an implicit type cast there |
20:32:08 | * | rinzai quit (Ping timeout: 256 seconds) |
20:36:13 | * | gokr joined #nim |
20:37:10 | * | icebattle joined #nim |
20:38:14 | * | mrshu joined #nim |
20:47:46 | * | Vladar quit (Remote host closed the connection) |
20:56:30 | * | rokups quit (Quit: Connection closed for inactivity) |
20:58:46 | * | francisl quit (Ping timeout: 256 seconds) |
21:00:19 | * | yglukhov quit (Read error: Connection reset by peer) |
21:01:00 | * | yglukhov joined #nim |
21:02:36 | FromGitter | <tyrion> def-: I tried a bit more, but I cannot make it work. I am not sure if it is a bug of the compiler. The following code, in my opinion produces the wrong return type `IntArray[N+1]` instead of `IntArray[4]` (it works as expected for normal arrays). And also, uncommenting the last line makes the compiler hang forever (apparently): https://play.nim-lang.org/?gist=b29328a457b6e3d95ad3af129dff86ec |
21:17:54 | * | rinzai joined #nim |
21:21:43 | * | xkapastel joined #nim |
21:24:49 | * | rinzai quit (Ping timeout: 248 seconds) |
21:31:01 | * | miran_ quit (Quit: Konversation terminated!) |
21:31:17 | * | superbia joined #nim |
21:31:29 | * | PMunch quit (Quit: leaving) |
21:31:37 | superbia | is this the light side |
21:39:46 | superbia | is it ok to install nim first from my distro repo, and after that install choosenim (if i decide i like nim) |
21:45:32 | * | vlad1777d joined #nim |
21:51:47 | def- | @tyrion well, the type name sounds unfortunate. hanging compiler is a bug, make an issue on github pleae |
21:56:04 | * | nsf quit (Quit: WeeChat 2.0.1) |
21:56:29 | FromGitter | <tyrion> def-: Ok, but what about the fact that I get an `IntArray[N+1]` instead of `IntArray[4]`, is that correct? If I annotate v4 at line 22 as `v4: IntArray[4] = ...` I get a type mismatch |
21:59:02 | * | Pisuke quit (Quit: WeeChat 2.1-dev) |
21:59:55 | * | Sembei joined #nim |
22:06:10 | bl4rk | Hey folks. So I am plodding through trying to execute some extremely simple shellcode with VirtualAlloc and CreateThread using Nim. I have got to the point where I'm allocating memory, copying code to it and then attempting to execute CreateThread but nim gives me a type error. |
22:06:14 | bl4rk | https://pastebin.com/TkR5LFmK |
22:06:32 | bl4rk | I am not sure why, I've looked around but there isn't much in terms of examples that are helping |
22:06:42 | bl4rk | The full code and error is in that paste |
22:07:13 | bl4rk | If anyone cares to help, I'd certainly appreciate it! |
22:12:04 | * | rinzai joined #nim |
22:16:39 | * | rinzai quit (Ping timeout: 260 seconds) |
22:21:46 | Araq | bl4rk, use Nim devel to get much more helpful error messages from the compiler |
22:23:31 | bl4rk | ty Araq |
22:24:27 | * | rinzai joined #nim |
22:28:05 | * | huonw quit (Ping timeout: 240 seconds) |
22:29:12 | * | huonw joined #nim |
22:33:51 | Araq | btw you should use Nim's thread support |
22:39:29 | bl4rk | yep, i have been thanks. |
22:40:01 | * | solitudesf quit (Ping timeout: 248 seconds) |
22:40:08 | bl4rk | i've been pouring over examples in other languages and can't make sense of why this isn't working. compiling dev now. I know it's just something dumb |
22:58:12 | * | couven92 quit (Read error: Connection reset by peer) |
23:04:32 | * | onionhammer quit (Quit: WeeChat 1.9.1) |
23:06:21 | * | onionhammer joined #nim |
23:24:27 | * | gokr left #nim (#nim) |
23:44:07 | * | superbia quit (Quit: WeeChat 2.0.1) |
23:59:59 | * | yglukhov quit (Remote host closed the connection) |