00:00:08 | FromGitter | <cavariux> I agree with the idea of lockfiles |
00:00:10 | * | tmm1_ joined #nim |
00:02:21 | * | tmm1 quit (Ping timeout: 265 seconds) |
00:05:14 | * | tmm1 joined #nim |
00:05:21 | * | tmm1_ quit (Ping timeout: 240 seconds) |
00:06:10 | kinkinkijkin | I can't find anything on this, how do I import a neighbouring .nim ? |
00:06:21 | * | aguspiza quit (Ping timeout: 240 seconds) |
00:08:04 | FromGitter | <cavariux> import <path without .nim> |
00:08:16 | FromGitter | <cavariux> be sure to export the proc/var with * like proc name*() = |
00:10:47 | kinkinkijkin | that is, if I want to be able to use it in the importing file? |
00:14:06 | FromGitter | <zacharycarter> include file.nim |
00:14:31 | FromGitter | <zacharycarter> I don't know what you're trying to do - import is different from include |
00:14:47 | kinkinkijkin | I meant import in a different way sorry |
00:14:56 | kinkinkijkin | I meant "how do I use procs in another .nim" |
00:15:27 | FromGitter | <zacharycarter> what @cavariux said |
00:15:44 | FromGitter | <zacharycarter> expose them with `*` and `import ./module.nim` |
00:16:07 | FromGitter | <zacharycarter> you might not even need the .nim extensnion |
00:16:39 | * | dgwana quit (Quit: Leaving) |
00:20:41 | FromGitter | <cavariux> Hi @zacharycarter , I was going to ask you what do you think about |
00:20:42 | FromGitter | <cavariux> https://github.com/cavariux/nimgl/blob/master/src/nimgl/opengl.nim |
00:21:02 | FromGitter | <cavariux> I have 90% opengl support, still some extensions and fix some bugs with the autogenerator |
00:23:47 | kinkinkijkin | having a weird issue |
00:24:19 | kinkinkijkin | in the line " if timeFloat < atk:", the compiler is saying it's expecting : where < is |
00:24:27 | kinkinkijkin | timeFloat is a float |
00:24:41 | kinkinkijkin | intialization is var timeFloat: float = time.float |
00:25:20 | FromGitter | <cavariux> and atk is also a float? |
00:25:27 | FromGitter | <cavariux> what other code do you have above? |
00:25:58 | kinkinkijkin | proc GenAHD(atk: float, hld: float, dcy:float, time:int): float = |
00:26:08 | kinkinkijkin | is the only thing above the var statement for timeFloat |
00:26:13 | kinkinkijkin | for this proc |
00:27:29 | FromGitter | <cavariux> could you share a snippet of your code in pastebin or something similar to have a better look? |
00:27:38 | kinkinkijkin | sure |
00:28:56 | kinkinkijkin | https://dpaste.de/YmmR here is the whole thing (the problem bit is at 84, 16) |
00:30:27 | FromGitter | <cavariux> you don't have to call return at the end of the proc if you are using result btw (not the issue a side note) |
00:30:40 | kinkinkijkin | I know |
00:30:44 | kinkinkijkin | it's part of my code styling |
00:31:08 | kinkinkijkin | explicitly returning tells the uninformed reader that returning is being done |
00:33:42 | FromGitter | <cavariux> I think you used instead of a space a unicode character because I rewrote the code the same as it was and it works, but if I copy paste there's an error |
00:33:47 | FromGitter | <cavariux> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ab9916b35dd17022ea319ab] |
00:34:03 | kinkinkijkin | hmm |
00:34:07 | kinkinkijkin | I'll try again |
00:34:39 | kinkinkijkin | that was it |
00:34:39 | FromGitter | <cavariux> sure, because I don't see anything wrong |
00:34:39 | kinkinkijkin | thanks |
00:37:40 | FromGitter | <cavariux> great haha, one of those errors that are pretty weird |
00:39:45 | kinkinkijkin | is there a way to check if the executable is being compiled with thread support? |
00:42:16 | FromGitter | <cavariux> The pragma thread |
00:42:20 | FromGitter | <cavariux> {.thread.} |
00:42:48 | kinkinkijkin | idk how to use that for what I want |
00:43:15 | kinkinkijkin | I want to perform a certain set of actions if thread support is on, and a different set if it is off |
00:48:11 | FromGitter | <cavariux> Oh, I have no clue then sry |
01:05:35 | FromGitter | <zacharycarter> @cavariux - I'll have a look in a bit |
01:07:46 | FromGitter | <zacharycarter> kinkinkijkin: !eval compileOption("threads") |
01:07:56 | FromGitter | <zacharycarter> !eval compileOption("threads") |
01:07:58 | NimBot | Compile failed: in.nim(1, 14) Error: expression 'compileOption("threads")' is of type 'bool' and has to be discarded |
01:08:06 | FromGitter | <zacharycarter> !eval echo compileOption("threads") |
01:08:08 | NimBot | false |
01:24:29 | * | find0x90 quit (Quit: find0x90) |
01:32:02 | * | dddddd quit (Read error: Connection reset by peer) |
02:26:06 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
02:46:35 | * | yglukhov joined #nim |
02:48:31 | * | Lord_Nightmare quit (Ping timeout: 268 seconds) |
02:51:05 | * | yglukhov quit (Ping timeout: 240 seconds) |
02:53:53 | * | Lord_Nightmare joined #nim |
02:57:57 | * | r2 quit (Ping timeout: 264 seconds) |
03:13:13 | * | BitPuffin joined #nim |
03:25:14 | * | endragor joined #nim |
03:26:15 | * | tiocavera joined #nim |
03:26:15 | * | rockcavera is now known as Guest64747 |
03:26:15 | * | Guest64747 quit (Killed (livingstone.freenode.net (Nickname regained by services))) |
03:26:16 | * | tiocavera is now known as rockcavera |
04:06:46 | * | krux02 quit (Remote host closed the connection) |
04:26:08 | * | cspar_ quit (Ping timeout: 276 seconds) |
04:58:12 | * | Elronnd is now known as we |
04:58:39 | * | we is now known as Elronnd |
05:15:08 | * | r3d9u11 joined #nim |
05:26:33 | * | rockcavera quit (Remote host closed the connection) |
05:28:50 | * | rockcavera joined #nim |
06:02:03 | * | SenasOzys quit (Read error: Connection reset by peer) |
06:06:06 | * | r3d9u11 quit (Remote host closed the connection) |
06:15:40 | * | nsf joined #nim |
06:55:36 | * | rokups joined #nim |
07:09:47 | * | yglukhov joined #nim |
07:20:25 | * | PMunch joined #nim |
07:21:39 | * | gokr joined #nim |
07:23:23 | * | Vladar joined #nim |
07:27:16 | * | user1101 joined #nim |
07:48:08 | * | dddddd joined #nim |
07:52:31 | * | gokr left #nim (#nim) |
07:57:49 | * | timotheecour quit (Ping timeout: 260 seconds) |
07:57:58 | * | pwntus_ quit (Ping timeout: 264 seconds) |
08:00:48 | Araq | can I add ``--define:ssl`` to Nim's standard config? it's 2018, everything is HTTPS |
08:09:15 | Zevv | Yes, please |
08:09:20 | * | floppydh joined #nim |
08:09:22 | Zevv | for what my vote is worth |
08:12:47 | FromGitter | <Vindaar> Yup, I agree |
08:29:37 | PMunch | I'm good with that, just make it possible to disable it in the few scenarios were you don't want it |
08:30:22 | PMunch | Hmm, I get "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" when trying to read a field from a type with a case of when it's the wrong time. This is at compile time. I remember this having a better error message before, but is that only on runtime? |
08:33:00 | * | r3d9u11 joined #nim |
08:33:37 | * | jaco60 joined #nim |
08:39:21 | * | r3d9u11 quit (Ping timeout: 265 seconds) |
08:42:51 | euantor | yes, definitely agree to SSL by default! |
08:44:59 | Araq | PMunch, case object branch transitions are with a loophole, check the issue tracker |
08:45:29 | PMunch | Well they're not transitioning |
08:45:48 | PMunch | I just copied some code from one place to another and it was trying to access a field that wasn't there |
08:46:33 | PMunch | By the way, did anything happen to the proposal of letting the different branches share type names? |
08:51:15 | * | r3d9u11 joined #nim |
08:51:28 | Araq | I like my proposal best but it's not planned for v1. |
08:55:43 | FromGitter | <phrmoy> Howdy, just learned about Nim. And I am just kinda angry it took me this long.. |
08:56:05 | FromGitter | <Vindaar> Hey there! Better late than never :) |
08:56:14 | FromGitter | <phrmoy> Amen. |
08:57:07 | FromGitter | <yglukhov> @Araq, how about `--threads:on` as well? ;) |
08:57:08 | euantor | Welcome :) |
08:57:33 | FromGitter | <phrmoy> Thank you, looking forward to being part of this community! |
08:57:50 | FromGitter | <phrmoy> Hate to drop in and ask this, but do we expect Nim v1.0 before 2019? |
09:01:53 | FromGitter | <narimiran> hey @phrmoy, i recognize your name from julia gitter :) |
09:02:37 | FromGitter | <narimiran> there's one rule of nim gitter - WE. DON'T. ASK. ABOUT. v1.0 :D :D :D |
09:03:07 | FromGitter | <phrmoy> Yes, ive been flooding there ^^ |
09:03:10 | FromGitter | <narimiran> everytime somebody asks that question, v1.0 is postponed for another month :D |
09:03:23 | FromGitter | <phrmoy> Oh no, sorry for what I have just done =P |
09:03:37 | Araq | ah that is a good explanation |
09:04:33 | FromGitter | <phrmoy> I have been porting my trading algo from Python to Julia, and now will start experimenting with Nim for the project as well. |
09:05:21 | FromGitter | <narimiran> i've done some simple comparison between python (+ numpy + numba), julia and nim. nim was the fastest |
09:05:58 | FromGitter | <narimiran> i plan to do some more "benchmarks" and write about it, but have no idea when that might be published, lots of other stuff for me to do.... |
09:06:53 | FromGitter | <phrmoy> I am eager to see Nim in action (literally)! đ |
09:09:36 | FromGitter | <narimiran> if you're coming from python, it will take couple of weeks to get used to some stuff in nim ("why can't i do X like in python?", "oh, there's another way to do Y"), but after that - nim will feel natural :) |
09:10:16 | FromGitter | <mratsim> oh another finance + math guy :P |
09:16:22 | FromGitter | <mratsim> Be sure to check the mpdecimal wrapper I just release last week if you want arbitrary precision floating point numbers: https://github.com/status-im/nim-decimal I still have to add a high level API on top of it (`+`, `-` âŚ) and also a currency package but itâs already a good start |
09:16:46 | FromGitter | <Varriount> @narimiran ^ |
09:18:45 | FromGitter | <mratsim> oh @miran, bluenote added a basic tensor plotting tool to Arraymancer: https://github.com/mratsim/Arraymancer/pull/206 (itâs in python though) |
09:19:02 | FromGitter | <Varriount> @mratsim I assume you aren't using GMP because of its license? |
09:19:14 | FromGitter | <mratsim> Yes, we canât use GPL on App Store |
09:19:20 | FromGitter | <narimiran> @Varriount why tagging me, what am i missing? |
09:19:51 | FromGitter | <mratsim> and GMP is not a decimal library. You need to use MPFR actually (which is build on top of it) |
09:20:55 | FromGitter | <Varriount> @narimiran Woops, I meant to tag @phrmoy |
09:21:00 | FromGitter | <mratsim> decimal library should be in radix 10 instead of radix 2, because we and the whole currency exchange world work in radix 10. This avoids rounding stuff like 0.1 |
09:21:27 | FromGitter | <narimiran> @mratsim both plotting and .csv export are great additions!! bravo @bluenote10 ! |
09:22:33 | FromGitter | <phrmoy> Excuse me, what is GMP? |
09:22:48 | FromGitter | <mratsim> Gnu Multi Precision library |
09:22:59 | FromGitter | <mratsim> for arbitrary precision arithmetics |
09:25:09 | FromGitter | <phrmoy> thank you |
09:26:38 | FromGitter | <Varriount> @mratsim What would you recommend for arbitrary precision integers? |
09:26:40 | FromGitter | <phrmoy> and thanks for sharing about ur package! |
09:27:25 | FromGitter | <phrmoy> licensing wouldnt be an issue for me per se at the moment, but it's good to keep in mind |
09:27:26 | FromGitter | <mratsim> @Varriount for now ttmath, thatâs what weâre using at Status: https://github.com/status-im/nim-ttmath itâs arbitrary but fixed (like Uint256) |
09:28:03 | FromGitter | <mratsim> Iâm working hard into bringing a pure Nim library in usable state: https://github.com/status-im/mpint |
09:28:10 | FromGitter | <mratsim> ttmath requires C++ compilation |
09:28:27 | FromGitter | <Varriount> Hm |
09:29:16 | FromGitter | <Varriount> @mratsim |
09:29:45 | FromGitter | <mratsim> yes? |
09:30:19 | FromGitter | <Varriount> Gah, sorry, gitter app posts the contents of my type box when I trap outside the keyboard. |
09:30:28 | FromGitter | <mratsim> trap? :P |
09:30:35 | FromGitter | <Varriount> *tap |
09:30:39 | FromGitter | <mratsim> do you have a mouse on your keyboard :P |
09:30:48 | FromGitter | <mratsim> (the living kind) |
09:31:04 | FromGitter | <Varriount> I'm on my phone (android) |
09:31:49 | FromGitter | <mratsim> Gitter doesnât work on my phone anymore since I updated to 7.1 ⌠|
09:32:05 | FromGitter | <Varriount> When I tap a link in the message window, the contents of the chat box is automatically posted for some reason. |
09:33:28 | FromGitter | <Varriount> @mratsim Neat, libmpdec is also used by Python 3.3+ |
09:36:57 | * | SenasOzys joined #nim |
09:42:19 | PMunch | Araq, what was your proposal? |
09:47:10 | Araq | it's in the issue |
09:48:18 | Yardanico | mratsim: strange, it always worked for me |
09:48:29 | Yardanico | Varriount: official Gitter client for mobile is honestly garbage |
09:49:44 | FromGitter | <Varriount> What's the alternative? |
09:51:27 | * | NimBot joined #nim |
09:53:00 | Yardanico | Varriount: the only decent alternative is probably https://github.com/apiko-dev/GitterMobile , but it's not in active development |
09:54:53 | * | Arrrr joined #nim |
09:54:59 | * | Arrrr quit (Changing host) |
09:54:59 | * | Arrrr joined #nim |
09:55:27 | PMunch | Araq, I kinda like your approach even though some people seemed to really hate it :P But for consistence it would then also make sense to allow the same in regular case statements (although their return value would be very hard to reason about). |
09:55:37 | FromGitter | <Varriount> Yardanico: You were talking about https://github.com/nim-lang/Nim/issues/3629 ? |
09:56:18 | Araq | PMunch, or we allow 'if' in objects |
09:56:42 | Araq | and then we have the consistency back |
09:57:11 | Yardanico | Varriount: when? If you mean in the issue itself - I just gave my "+1", nothing more :) |
09:57:39 | PMunch | Well case is the better construct for all the cases where this wouldn't be used |
09:57:46 | Yardanico | and if you mean about case expressions - it's now possible to use case statements where "discard" exits the program or throws an error |
09:57:49 | PMunch | Could you mix then? |
09:58:34 | PMunch | Have a "if kind in {FirstKind, SecondKind}: sharedField: string" and then have a case statement that differentiates all the other cases below? |
09:59:51 | Araq | unlikely :-) |
10:00:45 | PMunch | Ugh, that would be ugly then. Those long if elif chains :s |
10:01:15 | FromGitter | <Varriount> I'd rather |
10:01:43 | PMunch | How about nested cases on the same type? |
10:01:50 | FromGitter | <Varriount> I'd rather go with the obvious choice - duplicate fields in `of` blocks |
10:02:08 | FromGitter | <Varriount> That's what people first try to do. |
10:03:21 | PMunch | http://ix.io/13k3/ |
10:03:25 | PMunch | Like that |
10:04:01 | Yardanico | PMunch, so it won't be possible to have shared field for some of kinds, not for all of them? |
10:04:23 | PMunch | Huh, yes it would? |
10:04:39 | PMunch | In my example first and second field share the "sharedField" field |
10:04:53 | PMunch | Then thirdField only has the exclusiveField |
10:05:06 | PMunch | Man I should have named the enum types differently :P |
10:05:16 | Yardanico | PMunch, ah sorry, didn't see it because indentation is very small :) |
10:05:20 | PMunch | And first and second also have their exclusize fields |
10:05:58 | PMunch | Varriount, not sure why people would try that first since it doesn't work anywhere else.. |
10:06:24 | PMunch | Would be cool to have though for all case statements, but would probably just be a mess |
10:06:42 | FromGitter | <mratsim> ah thatâs one of the reason I donât use object variants, coming up with names is already hard. It forces us to create even more even though they are the same :P |
10:11:14 | FromGitter | <Varriount> PMunch: That's what I see most newcomers first try, when they run into this problem. |
10:12:19 | PMunch | Weird.. |
10:12:36 | PMunch | I mean it's a cool syntax |
10:12:49 | PMunch | But that it's inconsistent with regular case statements is a bit odd |
10:12:57 | * | sleepyqt joined #nim |
10:13:29 | PMunch | So either regular case statements should behave the same, or this should be solved in another way IMO |
10:16:02 | * | xkapastel quit (Quit: Connection closed for inactivity) |
10:17:02 | FromGitter | <Varriount> PMunch: Huh? I don't see how it's that far fetched. |
10:17:40 | dom96 | What's the problem with Varriount's suggestion? |
10:17:50 | FromGitter | <Varriount> case kind: SomeKind: |
10:18:20 | FromGitter | <Varriount> of A: fieldOne, fieldTwo: int |
10:18:42 | FromGitter | <Varriount> of B: fieldTwo, fieldThree: int |
10:19:10 | PMunch | Oh right |
10:19:17 | PMunch | I misunderstood what you meant |
10:19:25 | PMunch | Yeah that is indeed the most obvious solution |
10:19:45 | FromGitter | <Varriount> That's what people usually try first. |
10:19:50 | PMunch | Yeah |
10:19:55 | Araq | it's not obvious at all. |
10:20:19 | Araq | echo x.fieldTwo # what does it imply? x.kind in {A, B} |
10:20:27 | Araq | so say that in the object declaration. |
10:20:44 | Yardanico | Araq, honestly when I was new to the language I firstly tried Varriount's example :P |
10:21:42 | FromGitter | <Varriount> I tried that method too, at first. |
10:22:13 | Araq | it is not obvious, no matter how many people tried it. |
10:22:27 | Araq | are there two fields with happen to have the same name or not? |
10:22:34 | Araq | *which |
10:22:38 | PMunch | Yeah, it does help not introduce bugs if you managed to name a field the same that shouldn't be named the same |
10:23:03 | Araq | note that some proposals want to re-use the name, but not the type |
10:23:08 | FromGitter | <Varriount> As long as the "shared" field has the same type across cases, type inference should still be possible. |
10:23:27 | Araq | case k |
10:23:33 | Araq | of kInt: val: int |
10:23:38 | Araq | of kFloat: val: float |
10:23:44 | Araq | of kString: val: string |
10:23:51 | FromGitter | <mratsim> different type should be an error |
10:23:53 | Araq | also was requested |
10:23:59 | Araq | and also is "obvious". |
10:24:18 | FromGitter | <Varriount> But it is also much more complex to implement. |
10:24:57 | Araq | it's not about implementation complexity, duplicating the field name is bad syntax. |
10:25:02 | Araq | it really is. |
10:25:15 | FromGitter | <mratsim> canât we just generate different sym names in C anyway? |
10:25:40 | FromGitter | <mratsim> like itâs done for shadowed variables |
10:25:42 | Araq | mratsim: we can do that easily but it's not the point. |
10:25:48 | Araq | it is bad design. |
10:26:26 | Araq | and I have just explained why. |
10:26:29 | FromGitter | <mratsim> I donât know at all about the implication, just that at the very least, there should be an educating tutorial on that (why we donât do it, and what the alternative) |
10:27:30 | FromGitter | <mratsim> Maybe having VTables would provide an alternative ;) |
10:28:21 | FromGitter | <Varriount> Araq: I also like your proposal. |
10:29:45 | FromGitter | <mratsim> I like it too, isnât it the same as kirbyâs except on a single line? |
10:30:16 | FromGitter | <Varriount> Though the thought of yet another special case in a language construct makes me nervous. |
10:30:38 | FromGitter | <mratsim> You can already use when in objects ... |
10:30:43 | Araq | field name duplication would be a special case too. |
10:31:05 | FromGitter | <Varriount> Howzo |
10:31:13 | FromGitter | <mratsim> https://github.com/status-im/mpint/blob/2b47647019408b6642250cc6b542a9045031588b/src/private/uint_type.nim#L60-L64 |
10:31:28 | Araq | it's nowhere else in Nim, aka a "special case". |
10:31:29 | * | r3d9u11 quit (Remote host closed the connection) |
10:31:36 | FromGitter | <mratsim> I could add special fields with when as well. |
10:31:37 | FromGitter | <Varriount> *Howso? Field declaration only occurs in type blocks |
10:31:58 | Araq | tuple[a, a: int] is invalid. |
10:33:04 | Araq | for consistency we can allow it and it means "merge these fields" but we don't and so field name duplication for case objects is a special case. |
10:33:37 | dom96 | Anyone have a link handy to the related issue on GH you guys are discussing |
10:33:38 | dom96 | ? |
10:34:23 | FromGitter | <Varriount> https://github.com/nim-lang/Nim/issues/3629#comment-173529871 |
10:34:32 | * | vlad1777d joined #nim |
10:34:50 | FromGitter | <Varriount> @Araq ^ That's your proposal, right? |
10:35:08 | dom96 | This seems to be the correct link: https://github.com/nim-lang/Nim/issues/3629#issuecomment-173529871 |
10:35:16 | dom96 | I guess you're on mobile |
10:35:58 | dom96 | So if you implement this solution, will you let us do the same outside an object variant context? :) |
10:37:36 | dom96 | FWIW if we aren't going to support the same field names with different types, then Araq's solution makes more sense |
10:37:54 | dom96 | The other one implies that it is possible to specify a different type, and we'll have people complaining about that immediately |
10:40:32 | FromGitter | <survivorm> And another brick into that wall - wouldn't it be handy to share the same syntax with regular case, not making it object variant only? |
10:41:28 | FromGitter | <survivorm> What are the downsides of that solution for the regular case? |
10:42:35 | Araq | field name duplication also means we lose the ability to enforce object case branches and only require unique names per branch. |
10:42:44 | Araq | as done in ML, Haskell, Rust ... |
10:43:32 | FromGitter | <survivorm> @Araq is this unrelated to my question? |
10:44:09 | Araq | and since all these languages do not have the "object case transition" problems it's fair to say Nim should follow them. |
10:44:27 | Araq | survivorm: I don't understand your question. |
10:46:29 | FromGitter | <survivorm> @Araq You said your proposal should be applied for case in object varian syntax only. Why? Why not set it case syntax in general, not only object variant's? |
10:47:03 | Araq | I'm not sure what it would mean. |
10:47:40 | Araq | turns the case into a series of 'if's, not 'elif's? |
10:49:19 | FromGitter | <mratsim> the âcaseâ statement/expr in the general case is exhaustive, that wouldnât work if you could have of {Foo1, Foo2}: stuff() of Foo1: stuff2() |
10:49:44 | FromGitter | <mratsim> 2 branches would match Foo1 |
10:51:03 | FromGitter | <mratsim> but to be honest, I think if/case is one of Nim weak points compared to pattern matching in ML/Haskell. The Rust `match` also is a better I think (but not as nice as in FP lang) |
11:00:04 | dom96 | Yes, Haskell is a good model for this, but at the same time Nim wasn't designed as an ML language |
11:00:31 | dom96 | Implementing ML-like pattern matching now will really make Nim feel like a bit of a frankenstein :) |
11:01:09 | Araq | maybe but let's not close doors by introducing duplicated field names :P |
11:01:35 | Araq | or by overlapping object fields for that matter. |
11:02:29 | * | Snircle joined #nim |
11:05:53 | * | aguspiza joined #nim |
11:11:59 | FromGitter | <survivorm> And what's the end opinion? I think almost all say yes to @Araq 's suggestion on the object variant's case. What about making it general, not specific to object variants? |
11:13:15 | Araq | my end opinion is to do nothing until v1 is out and the case branch transition problems are settled. |
11:14:04 | * | riidom quit (Remote host closed the connection) |
11:15:47 | FromGitter | <survivorm> :) |
11:16:43 | FromGitter | <survivorm> Sitting by the river awaiting you'll eventually have your enemie's corpse float by :) |
11:17:06 | FromGitter | <mratsim> @dom96, This boat has sailed, Nim is already a Frankenstein. Introducing move and borrow checker + 4 kinds of GCs + VTables + Lisp-like metaprogramming + low level pragma (OpenMP, codegendecl) already settled that |
11:17:39 | Araq | my Nim has no VTables |
11:17:42 | FromGitter | <mratsim> oh, did I mentionned compiling to Javascript? :P |
11:17:56 | Araq | compiler targets do not count. |
11:18:12 | FromGitter | <mratsim> I would reply âyour manual would disagreeâ but you took that down :/ |
11:18:19 | Araq | otherwise C would be super mega frankenstein because it supports every CPU under the sun |
11:18:44 | FromGitter | <mratsim> I donât have any issue with Frankenstein, heâs just misunderstood :P |
11:19:05 | dom96 | lol |
11:19:24 | FromGitter | <zacharycarter> question - I'm working on this cross platform file notification lib, and I'm using kqueues for osx |
11:19:28 | Araq | and my borrow checker went by unnoticed :P |
11:20:01 | Zevv | dom96: are there any specific patterns to mix threads and async in Nim, or is this a typical "just don't do that" area? |
11:20:19 | FromGitter | <zacharycarter> I ran across - https://github.com/nim-lang/Nim/blob/master/lib/pure/selectors.nim - not sure what this module is for... is it basically doing what I'm trying to do already? |
11:21:29 | dom96 | Zevv: There are genuine reasons for it. But I think it's something that can easily be used because people want an easy solution which is invalid. |
11:22:06 | dom96 | If you're using QML with async then you shouldn't need a separate thread. Perhaps QML is an odd UI framework, but most of them provide some way to hook into their event loop |
11:22:42 | dom96 | Genuine reasons for async with threads is to take advantage of multiple CPU cores |
11:23:07 | Zevv | I'm asking for the getaddrinfo() case I ran into. I'm now fiddling with a local solution but I end up with a loop doing a async sleep and channel poll until the results are in |
11:23:22 | Zevv | My obvious solution would be to put a pipe between the thread and the event loop |
11:23:46 | Zevv | but that's a bit of a hassle because of the complex structured data going over the pipe |
11:24:09 | Zevv | or a pipe and a channel, but it's all the same mess you run into when mixing threads and async I/O |
11:24:58 | dom96 | Yes, so 'FlowVar' should be compatible with async |
11:25:03 | dom96 | This is something that's on the roadmap |
11:25:11 | dom96 | The ability to 'await' a FlowVar |
11:25:11 | FromGitter | <alehander42> the "shared field" syntax is not bad, but then you can miss a field while reading the case definition |
11:25:33 | FromGitter | <alehander42> still, whatever is needed to be able to have field: T in several branches is great |
11:25:55 | dom96 | I still can't remember how Araq was intending to implement this. Maybe Araq can point you in the right direction and you can create a PR |
11:27:03 | FromGitter | <alehander42> @mratsim I think pattern matching can be very useful for the variant objects, but I think macro-based libs can deliver that(I think patty seems not far away) |
11:28:36 | * | riidom joined #nim |
11:29:32 | FromGitter | <alehander42> hm, nested pattern matching is "todo", but if it gets impl, it would be very pleasant |
11:30:47 | FromGitter | <mratsim> Iâd rather have pattern matching in âsugar.nimâ ;) |
11:31:19 | FromGitter | <zacharycarter> here's my osx file monitor code so far using kqueues - â â ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aba2b87e4ff28713a7b52ce] |
11:31:43 | Araq | dom96, I don't really know either. make it inherit from Future[T] and set the callback to ... something |
11:31:48 | FromGitter | <zacharycarter> it works (kind of) - events are raised but the events don't seem to be correct |
11:32:27 | dom96 | Araq: Last time we discussed it you didn't know either, and then 2 minutes later you remembered something :) |
11:33:22 | dom96 | zacharycarter: nice, but that 'spy' name makes me anxious :) |
11:33:40 | FromGitter | <zacharycarter> :P |
11:34:42 | FromGitter | <alehander42> @mratsim well, one can add some patty's matching dsl to sugar.nim if it becomes useful enough |
11:39:15 | euantor | Regarding the `getaddrinfo()` issue, what are the current thoughts - better to write a simpel DNS client in Nim, or use `DnsQueryEx` on Windows and something else on other platforms? |
11:40:06 | euantor | I was considering looking at doing name resolution async a while back, but never got a chance to look at it too much |
11:40:13 | Araq | the OS specific stuff tends to be better |
11:40:22 | * | jaco60 quit (Quit: Textual IRC Client: www.textualapp.com) |
11:41:01 | * | nsf quit (Quit: WeeChat 2.0.1) |
11:41:08 | euantor | Linux has `getaddrinfo_a()`: http://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html |
11:41:34 | * | Arrrr quit (Read error: Connection reset by peer) |
11:42:14 | FromGitter | <zacharycarter> nevermind the kqueue code is working :/ I'm so stupid in the mornings sometimes |
11:42:26 | FromGitter | <zacharycarter> and at night I guess too - since I was working on this last night lol |
11:42:53 | FromGitter | <zacharycarter> I need to remember that when files are moved to the trash on osx, it isn't really a delete operation lol |
11:43:45 | euantor | And OpenBSD seems to have some stuff using `asr_run()`: https://man.openbsd.org/asr_run.3 |
11:43:55 | euantor | I'm going to add these to the issue |
11:46:40 | Araq | different topic, what about 'implicit' parameters. |
11:46:51 | dom96 | what are those? |
11:47:16 | Araq | I just invented them but I've probably seen similar things in Lisp. |
11:47:27 | Zevv | euantor: the problem is that getaddrinfo() does so much more |
11:48:20 | Zevv | and you probably want to preserve that behaviour to prevent surprises. So my guess would be that putting getaddrinfo() in a thread would be the solution with the preferred behaviour |
11:48:20 | euantor | @Zevv But is it used in the stdlib, or is it simply used to resolve host names to A/AAA records? |
11:48:25 | Araq | implicit db: DbConn |
11:48:46 | Araq | proc foo(db: DbConn) = bar() # if 'bar' has a 'db' parameter it's passed implicitly |
11:48:58 | * | vlad1777d quit (Ping timeout: 264 seconds) |
11:49:25 | Araq | to pass a different argument to bar, use an explicit keyword parameter |
11:49:31 | FromGitter | <alehander42> I can imagine that with `ctx` parameters in visitors too |
11:49:33 | Araq | bar(db = otherConnection) |
11:49:35 | Zevv | it's used to resolve names, which *might* result in doing a DNS query with A or AAAA records. It might also do a lookup in resolv.conf, query your ldap server or write a letter to your aunt, depending on the implementation of the host C library |
11:50:01 | Araq | happens all the time in refactorings, parameter lists are pretty fragile |
11:50:04 | euantor | yes, so it'd be preferrable to use a pre-existing tool |
11:50:17 | euantor | https://github.com/nim-lang/Nim/issues/7422#issuecomment-376496331 |
11:51:06 | FromGitter | <alehander42> very useful sometimes, but also very magical |
11:51:46 | FromGitter | <alehander42> it reminds me of `using` |
11:51:58 | Araq | indeed, which I killed :-) |
11:52:32 | Araq | problem is you don't want to pass implicits to 'echo' |
11:52:35 | Zevv | euantor: the glibc implementation is no fun to use, as it depends on signals, iirc. Under water, it simply does the thread thing as well. getaddrinfo() sync is available on all platforms, so it seems like a sane idea to fix the asynchronousitiy (is that a word) on the Nim side instead of depending on all kinds of OS specific functions with very different interfaces |
11:55:13 | FromGitter | <alehander42> and `{.this.}` ? what did this do |
11:55:16 | FromGitter | <alehander42> it sounded similar |
11:55:29 | FromGitter | <alehander42> well, I used `using` somewhere in nimbus :D |
11:55:44 | dom96 | Araq: Too magical. What I would like is way to reduce the noise of: proc initFoo(a,b,c: int): Foo = Foo(a: a, b: b, c: c) |
11:55:56 | FromGitter | <alehander42> i didn't know it's killed |
11:56:15 | dom96 | The amount of times I have to type that is so annoying |
11:56:19 | dom96 | We need syntax sugar for it |
11:57:15 | FromGitter | <zacharycarter> +1 |
11:58:12 | FromGitter | <alehander42> honestly at that point you can just auto generate `newFoo` constructor if there are none of those supplied by the user |
11:58:51 | dom96 | alehander42: yes, but I want to keep the ability to easily customise one of the parameters |
11:58:53 | FromGitter | <zacharycarter> maybe a pragma that does this? |
11:58:55 | FromGitter | <data-man> @zacharycarter : Maybe it's useful to you https://github.com/facebook/watchman/tree/master/watcher â For OS X 10.7+ uses FSEvents, and kqueue for earlier versions. |
11:59:01 | FromGitter | <alehander42> yes that's important |
11:59:15 | FromGitter | <alehander42> maybe Foo(<field>, <label>: <differentexpression>) ? |
11:59:25 | dom96 | yeah, that would already be better |
11:59:29 | FromGitter | <alehander42> like `{e: 2, f}` in js ? |
11:59:34 | FromGitter | <zacharycarter> thx @data-man |
11:59:35 | dom96 | yep |
12:00:05 | FromGitter | <narimiran> offtopic: there seems to be some interest in Nim down there at Julia's gitter :) maybe we'll have some new scientists here soon :) |
12:00:13 | dom96 | And a 'constructor' pragma would be nice too |
12:00:22 | dom96 | proc initFoo(a,b,c: int): Foo {.constructor.} |
12:00:27 | FromGitter | <alehander42> yeah, that would be nice (and some people would already know it from js, so it wouldn't be very surprising) |
12:00:30 | dom96 | that could easily be a macro |
12:00:56 | * | PMunch quit (Remote host closed the connection) |
12:01:14 | * | PMunch joined #nim |
12:03:02 | dom96 | so let's make sugar.nim happen and create a constructor macro in there :) |
12:03:05 | dom96 | PRs welcome D: |
12:03:07 | dom96 | *:D |
12:04:08 | FromGitter | <alehander42> :D isn't the new-old-future sugar.nim already there? |
12:06:39 | dom96 | narimiran: Awesome :D Guess I should check out the discussion |
12:14:58 | PMunch | Araq, did you ask zahary about the quote thing? |
12:20:30 | FromGitter | <mratsim> How big can stuff in sugar be? Macros are great for sugar but they take a lot of space |
12:20:52 | FromGitter | <mratsim> can we actually depend on the macros module? |
12:24:14 | PMunch | Hmm, someone in the Telegram channel is asking if you can use case with object types |
12:25:04 | FromGitter | <mratsim> With enum only I think |
12:25:09 | FromGitter | <mratsim> âkind types" |
12:25:50 | PMunch | Yeah |
12:27:00 | PMunch | This was his example: https://pastebin.com/FU9uXXzV |
12:36:07 | FromGitter | <diegogub> Hello! I'm trying to build a list of events like this: â â `````` [https://gitter.im/nim-lang/Nim?at=5aba3ab7c574b1aa3e39d79a] |
12:37:19 | FromGitter | <diegogub> I was using Event instead of LinkClicked...but link_id get lost and only have Event types.. |
12:37:52 | FromGitter | <data-man> New dir: sugar? sugar/macro.nim, sugar/seqs.nim, sugar/string.nim, ..., sugar/everything.nim, sugar/godmode.nim |
12:38:16 | FromGitter | <mratsim> sugar/compiler.nim :P |
12:38:33 | FromGitter | <diegogub> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aba3b495f188ccc15003db8] |
12:38:43 | FromGitter | <diegogub> also this is not workin.. |
12:38:51 | FromGitter | <diegogub> somebody could help me? |
12:41:52 | FromGitter | <diegogub> where should I use typedesc type" |
12:41:53 | FromGitter | <diegogub> ? |
12:44:49 | Araq | use 'if x of ObjectType', case is not a type switch |
12:44:52 | FromGitter | <mratsim> @diegogub â â ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aba3cc4012ff2bf681de8f3] |
12:45:16 | * | pwntus joined #nim |
12:45:32 | * | pwntus quit (Changing host) |
12:45:32 | * | pwntus joined #nim |
12:45:43 | * | pwntus is now known as Pwntus |
12:46:47 | PMunch | Wooo, my protobuf library just wrote and read it's first protobuf message! |
12:47:19 | FromGitter | <mratsim> there is a competing thread in the forum ;) though I think it uses protoc. |
12:47:23 | Yardanico | PMunch, great! congrats! |
12:50:20 | FromGitter | <diegogub> @mratsim thanks..also, may be not having interfaces is quite confusing..How do I write a list of events in general? |
12:51:23 | PMunch | mratsim, competition is always good :) |
12:51:34 | PMunch | And yeah, I know of at least two protobuf implementations already |
12:51:39 | FromGitter | <zetashift> Is there a way I can use the ASCII null code is a value for a char variable? |
12:51:53 | Yardanico | let nul = '\0' or just let nul = char(0) ? |
12:52:30 | FromGitter | <zetashift> ayy thanks, sometimes I make things more complicated than they are |
12:52:44 | PMunch | But one wraps libprotobuf-c which is a runtime library for protobuf in C, and the other uses protoc |
12:53:06 | Yardanico | PMunch, protoc outputs very big code chunks |
12:53:10 | Yardanico | even in python |
12:53:22 | FromGitter | <data-man> @diegogub: Try https://github.com/xomachine/metaevents |
12:53:28 | FromGitter | <mratsim> @diegogub Iâm not much of an interface developer, Iâm more into numerical computing so I canât say but maybe this would help you: https://github.com/andreaferretti/interfaced |
12:53:52 | FromGitter | <mratsim> @Pmunch and there is the Flatbuffer pure nim implementation from Skrylar as well |
12:54:34 | FromGitter | <mratsim> anyway i will have to use a serialization lib in Arraymancer and HDF5 looks so so so I was looking into Protobuf, FlatBuffer and Capânâproto. |
12:54:51 | Yardanico | diegogub: you may also learn another way of writing things (without using interfaces or classes) :P |
12:55:02 | FromGitter | <mratsim> Iâm waiting for the FlatâCapânâ lib :D |
12:56:28 | PMunch | Yeah I'm writing protobuf mostly for compatibility, don't even have anything in particular I'm going to use it for :P |
12:56:58 | * | athenot joined #nim |
12:57:14 | FromGitter | <Vindaar> <- likes HDF5 :P |
12:58:28 | FromGitter | <diegogub> @data-man thanks, I will check that â @mratsim looks like a macro library to create interface type in nim..I think I should follow @Yardanico advice..but I cannot see it so far. I come from Go programming, so I used interfaces everywhere.. |
12:58:57 | Araq | PMunch, zahary says it's too much of a hack. you need to live with your workaround for now |
13:01:18 | FromGitter | <data-man> @PMunch: Are you skipped it? ;) https://github.com/oswjk/protobuf-nim |
13:02:06 | * | athenot_ joined #nim |
13:02:21 | FromGitter | <zetashift> Aren't Nim concepts close to interfaces/traits? |
13:02:53 | FromGitter | <mratsim> Concepts cannot be put in a heterogeneous countainer at the moment, pending VTables |
13:02:59 | FromGitter | <mratsim> container* |
13:03:31 | * | athenot quit (Ping timeout: 245 seconds) |
13:04:56 | FromGitter | <mratsim> @diegogub maybe use methods? |
13:05:39 | FromGitter | <mratsim> if you need run-time polymorphism, thatâs the best way today. and it will be much faster than a âif foo ofâ in all your proc |
13:06:09 | FromGitter | <zetashift> Getting that to work was planning for 1.0, no? I remember reading it in the roadmap on the github wiki, can't seem to find it now |
13:06:34 | FromGitter | <mratsim> Zah is working on it but I guess he was delayed by static[T] |
13:07:05 | FromGitter | <mratsim> I remember Araq telling me itâs just around the corner back in June ;) |
13:07:05 | * | dgwana joined #nim |
13:08:03 | FromGitter | <zetashift> That's alright, even though I'm looking forward to 1.0, asking what or when won't help me that much hehe |
13:09:36 | FromGitter | <mratsim> What you can do is creating more and more libraries that depends on devel so that they have to release faster :D. |
13:09:55 | FromGitter | <diegogub> @mratsim I was thinking about creating a method to return event type.. and use case |
13:11:22 | PMunch | data-man, huh I haven't seen that one before |
13:11:46 | FromGitter | <mratsim> method can be overloaded on run-time types so you can have â â ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aba431201a2b40f382e383f] |
13:11:47 | PMunch | Araq, too bad. Now I have to use a hack in order to not use a hack.. |
13:12:03 | PMunch | It's a bit hacky, but it doesn't break anything.. |
13:12:10 | FromGitter | <diegogub> @mratsim first day with nim, Im trying to implement kind of cqrs ...I was thinking may be templates could avoid lot of code and repeat code with other languages..but not sure yet |
13:12:26 | FromGitter | <diegogub> @mratsim sound amazing..for what I want to do.. |
13:12:29 | PMunch | data-man, ah but that uses protoc as well |
13:12:31 | FromGitter | <mratsim> cqrs? |
13:12:42 | PMunch | So I still have the really pure protobuf thing for myself :) |
13:12:47 | FromGitter | <diegogub> command query responsability segregation |
13:12:55 | PMunch | Theoretically this should even work on the JS target |
13:13:15 | FromGitter | <diegogub> @mratsim basically, functional programming...that kind of method overload looks good |
13:13:41 | FromGitter | <diegogub> I could write every event handler on a object (aggregate) |
13:14:06 | FromGitter | <diegogub> I will try it.. |
13:14:32 | PMunch | But I noticed that my parser is crashing the compiler a bit with "lib/system.nim(3559, 14) Error: interpretation requires too many iterations" |
13:15:10 | FromGitter | <mratsim> I thought following jzakiya request it was increased to 1 billion? |
13:16:58 | FromGitter | <diegogub> @mratsim thanks |
13:17:09 | FromGitter | <mratsim> youâre welcome |
13:18:20 | PMunch | mratsim, it doesn't actually say.. |
13:18:22 | FromGitter | <mratsim> As a newcomer Nim will be a bit daunting and you will spent a lot of time googling various stuff, but for boilerplate squashing I assure you that it is the best language ever =). |
13:18:28 | PMunch | But I hope it's not 1 billion already :P |
13:22:49 | FromGitter | <diegogub> @mratsim great! May be with templates right? |
13:23:15 | PMunch | Hmm, building from a branch I built not too long ago to implement the quote do thing it works |
13:23:31 | PMunch | Maybe it has been upped to 1 billion between the version I currently have installed and then? |
13:23:36 | FromGitter | <zetashift> seems some D users have questions about Nim following the recent github repo: https://forum.dlang.org/thread/[email protected] |
13:23:42 | PMunch | diegogub, or macros |
13:25:54 | FromGitter | <mratsim> @diegogub yes, basically templates can be though of âcopy pastingâ code. |
13:29:30 | dom96 | zetashift: thanks for the link :) |
13:30:49 | FromGitter | <mratsim> @diegogub here is an example of template use: https://github.com/timotheecour/D_vs_nim/issues/12 itâs quite low-level as Iâm basically copy-pasting C++ code but you can do the same with Nim code |
13:31:06 | Yardanico | PMunch, it's in devel only AFAIK |
13:32:10 | PMunch | Ah, yeah I did "choosenim update devel" and now it compiles fine |
13:32:15 | PMunch | What was the old limit? |
13:33:09 | FromGitter | <mratsim> âif username == âPMunch": raise newEception(IterationError, âYou are over the limitâ)" |
13:33:37 | PMunch | Haha, this is actually the first time I've run into it :P |
13:33:50 | FromGitter | <mratsim> there is a forum thread in the past 3-4 days with the info iirc |
13:35:12 | FromGitter | <zetashift> @PMunch, the limit was `MaxLoopIterations* = 1500_000` |
13:35:23 | FromGitter | <zetashift> according to: https://github.com/nim-lang/Nim/commit/4301744e49f4b3758cc7a777c2d78c827bfbb344 |
13:36:04 | dom96 | oh man, all this talk of not allowing writeFile at compile-time in that D thread |
13:36:58 | PMunch | zetashift, thanks :) |
13:37:45 | PMunch | Quite crazy that it even takes 1_500_000 iterations as it is now :S |
13:37:52 | PMunch | And it's not even slow |
13:38:10 | PMunch | Sub-second compile time for the entire project (of which the parsing that causes this is only a part) |
13:40:09 | dom96 | "no heap-allocated runtime type at compile-time." is that really a case for Nim? |
13:40:27 | * | aguspiza quit (Ping timeout: 240 seconds) |
13:41:24 | Araq | nah, it's wrong. |
13:41:36 | Araq | you can't put refs in a 'const' |
13:41:41 | Araq | but for different reasons. |
13:42:12 | dom96 | can I use a TableRef inside a compileTime proc? |
13:43:48 | Araq | sure |
13:43:51 | Yardanico | dom96, it works for me in static block |
13:44:01 | dom96 | yeah, so that's misleading |
13:44:10 | FromGitter | <diegogub> @mratsim I will continue trying with templates.. |
13:47:09 | FromGitter | <zetashift> I don't get the `the ability to generate C breaks type system guarantees like memory safety. It's like how inline assembly breaks optimizers and type system, and is annoying to implement. It makes the language more "powerful" hence less easy to reason about.` |
13:47:23 | FromGitter | <zetashift> in the dlang thread, second post |
13:47:54 | Araq | Nim is more memory safe than D, if there is such a thing. |
13:48:04 | Yardanico | let's talk about how mir directly uses LLVM :P |
13:48:22 | Araq | D doesn't even distinguish between GC'ed pointers and non-GC'ed pointers. |
13:48:29 | dom96 | It's the usual "compiles to C" scaremongering. |
13:48:35 | dom96 | Sorry to use that term, but IMO this is pure FUD |
13:48:37 | FromGitter | <zetashift> well let's not make it a language war but rather way that actually is wrong |
13:49:00 | Yardanico | dom96, they just don't need to forget that C++ used to compile to C |
13:49:10 | dom96 | Even LLVM has undefined behaviour |
13:49:13 | FromGitter | <zetashift> ah yea I thought so, I found the 'how inline assembly..implement.' weird |
13:49:25 | FromGitter | <zetashift> wouldn't that make a lot of stuff unstable? |
13:49:41 | Yardanico | dom96, yeah, for nim there's no difference - there's already an LLVM backend, and it's not different from any other backend |
13:50:05 | Araq | UB is a sad fact of life but within a code generator you can enumerate the UB cases and protect against them. |
13:50:14 | Araq | Which is exactly what Nim does. |
13:50:14 | FromGitter | <zetashift> IIRC even Rust had a point where it had a uncomfortable LLVM IR problem |
13:50:27 | Yardanico | and arnetheduck is still updating llvm backend from time to time :) https://github.com/arnetheduck/nlvm |
13:50:53 | Araq | code generation is intrisically different from using the codegen target directly. |
13:51:05 | Araq | I don't understand why it is so hard to understand. |
13:51:16 | FromGitter | <zetashift> props to that, LDC(D's LLVM target) is neat but they have dedicated people on it |
13:51:21 | Araq | ASM has an "undefined opcode" exception. |
13:51:26 | Araq | C doesn't. |
13:51:33 | dom96 | yep |
13:51:35 | FromGitter | <zetashift> Araq: probably the current trend of 'C is evil, kill it with fire' |
13:51:40 | Araq | the C compiler doesn't generate undefined opcodes. |
13:51:46 | Araq | end of story. |
13:51:57 | Araq | how hard is it to understand... |
13:52:05 | dom96 | We honestly should write a quick article about this |
13:52:08 | FromGitter | <zetashift> Add it to the FAQ? |
13:52:29 | dom96 | "The fallacy of the dangers of C compilation" or "Compilation to C considered dangerous" |
13:52:57 | FromGitter | <zetashift> Considerations of compiling to C? |
13:53:06 | FromGitter | <narimiran> yeah, stuff like that should be written / added to FAQ |
13:53:36 | dom96 | yeah, I might write this as an article |
13:53:43 | dom96 | maybe with Araq's help if he's willing |
13:53:59 | euantor | R4d1sh&> |
13:54:15 | euantor | weird, stupid Windows |
13:54:17 | dom96 | euantor: That's a nice prompt lol |
13:54:32 | euantor | it's a copy from an SSH session |
13:54:38 | euantor | We have some... interesting... host names |
13:54:52 | * | noonien joined #nim |
13:55:00 | * | jaco60 joined #nim |
13:55:43 | dom96 | lol |
13:56:43 | PMunch | Hmm, the XDeclaredButNotUsed hint, how do I disable that for a proc or a block of procs? |
13:57:24 | euantor | probabl;y using the `{.hint.}` pragma |
13:57:44 | euantor | An example for the line too long hint: `{.hint[LineTooLong]: off.}` |
13:58:17 | PMunch | I tried to do {.push hint[XDeclaredButNotUsed]: off.} but that didn't appear to work |
13:58:47 | FromGitter | <narimiran> just export that proc? :) |
13:59:01 | Araq | dom96, cool, let's do it |
13:59:15 | dom96 | Araq: :D |
13:59:23 | dom96 | After I come back from Tesco though :) |
13:59:36 | FromGitter | <narimiran> two days ago i found out that putting * at the end of the proc name solves that warning :) |
13:59:41 | Yardanico | honestly I've never encountered problems with nim C codegen (well, only if I deliberately tried to do something very-very wrong) |
14:00:07 | Yardanico | I don't remember last time I got C compiler error related to nim codegen |
14:00:18 | Araq | it's true that Nim does not protect against some UB of C. in particular related to NULL derefs. |
14:00:36 | Araq | but that's just something we didn't spend effort on, because |
14:00:55 | euantor | having an article to point people at when this comes up againa nd again would certianly help |
14:01:02 | Araq | a) it only comes up in code especially crafted to bring it up. |
14:01:16 | Yardanico | but we'll probably still need to fix cpp+clang codegen issue (you can't compile openssl module with that combo) |
14:01:20 | Araq | b) clang and GCC have options to fight it. |
14:01:33 | Araq | we don't have to reimplement that clang and GCC already offer. |
14:01:38 | Araq | *what |
14:01:45 | PMunch | narimiran, well yeah that works |
14:02:26 | PMunch | But this is in a macro. And I don't necessarily want to export the ouput of it if the user doesn't want me to.. |
14:03:13 | FromGitter | <narimiran> it was a semi-joke :) |
14:05:19 | FromGitter | <mratsim> âCompilation to C considered harmfulâ is a much better clickbaity title |
14:06:22 | Yardanico | "10 reasons why your language sucks if it doesn't compile to C" :D |
14:06:46 | Yardanico | (not to offend anyone, just a joke) |
14:07:23 | FromGitter | <mratsim> nah, Compilation to C considered harmful would be taking the opposite position at first to attract either the hackernews crowd or the ban hammer. :P |
14:07:59 | Yardanico | dom96, btw, should we change strutils to strformat on first example here? https://nim-lang.org/features.html |
14:08:34 | dom96 | sure |
14:08:53 | dom96 | PRs welcome : |
14:08:54 | dom96 | :) |
14:09:04 | Yardanico | I knew you will said that :P |
14:09:07 | Yardanico | *say |
14:09:16 | dom96 | mratsim: yeah, maybe a little too clickbaity |
14:09:25 | Yardanico | dom96, oh, hmm |
14:09:26 | Yardanico | https://github.com/nim-lang/website/commit/1360883785d75db5969b1869e47b569b2119d793 |
14:09:27 | Yardanico | :D |
14:09:30 | dom96 | But it actually reflects the reality |
14:10:19 | Yardanico | maybe website wasn't recompiled after this commit? |
14:11:07 | dom96 | yep |
14:11:10 | dom96 | Let me update |
14:12:09 | dom96 | done |
14:12:24 | Yardanico | dom96, wow, that was fast! |
14:12:35 | FromGitter | <narimiran> btw, @mratsim, arraymancer website also needs recompiling, last time i checked :) |
14:12:53 | dom96 | Literally just: cd ~/projects/website && git pull && git push live ;) |
14:13:09 | dom96 | the beauty of git hooks |
14:13:20 | FromGitter | <mratsim> @narimiran I should release a new version actually :P |
14:13:28 | dom96 | bbl |
14:13:52 | Araq | dom96, otherwise you would run deploy.sh, not much of an improvement :P |
14:13:57 | FromGitter | <mratsim> for me itâs just git checkout gh-pages && nimble gendoc && git push. |
14:14:25 | FromGitter | <mratsim> except that I realize that I must update all comments afterwards :P |
14:18:28 | federico3 | something like http://paste.debian.net/1016962/ could be part of nimble gendoc |
14:19:35 | FromGitter | <mratsim> My gendoc is a bit involved: https://github.com/mratsim/Arraymancer/blob/068075dce61a88f4cf038d3c0035d5f84921983e/arraymancer.nimble#L172-L215 |
14:20:21 | Yardanico | mratsim: https://github.com/nim-lang/Nim/issues/6910 is closed :) |
14:21:11 | FromGitter | <mratsim> itâs closed wonât fix ;) |
14:22:01 | FromGitter | <mratsim> The offending doc is generated from c2nim so probably it should be a c2nim issue |
14:29:36 | FromGitter | <mratsim> Is that normal that unsigned ints donât throw a DivByZeroError but a SIGFPE. â â ```let a = 10'u â let b = 0'u â echo a div b``` [https://gitter.im/nim-lang/Nim?at=5aba55507685a046389d106b] |
14:45:12 | * | r3d9u11 joined #nim |
14:46:20 | PMunch | Is there really no way to silence the XDeclaredButNotUsed dint for a specific proc? |
14:46:39 | FromGitter | <alehander42> you can silence it for your whole project |
14:47:09 | FromGitter | <alehander42> or export it? or put it in `when false:` ? |
14:47:54 | PMunch | Well putting it in a when false defeats the purpose of generating it in the first place :P |
14:48:10 | FromGitter | <alehander42> well isn't it exported ? :D |
14:48:24 | PMunch | No, it's generated for the user based on input. |
14:48:30 | PMunch | So it will already be in their scope |
14:48:54 | PMunch | But the macro generates a lot of procedures, some that the user might not be interested in |
14:49:39 | FromGitter | <alehander42> ahh |
14:50:33 | FromGitter | <alehander42> @Varriount this nimlime new tab with output thing is so weird :D I can never reproduce it with some pattern |
14:52:07 | FromGitter | <alehander42> I wish there was a sublime plugin to autoclose files with certain names, it will solve this bug in an instant :D |
15:01:16 | * | miran joined #nim |
15:04:20 | PMunch | Code is now up on GitHub, and protobuf parsing is actually working: https://github.com/PMunch/protobuf-nim/blob/master/protobuf.nim#L1047-L1076 |
15:04:37 | PMunch | Disclaimer: if you try to do anything with it it will probably break |
15:04:51 | * | uran[m] joined #nim |
15:04:57 | PMunch | If you do try it though make sure to create issues so I know what's not working and what is :) |
15:05:10 | * | PMunch quit (Quit: Leaving) |
15:06:08 | * | xkapastel joined #nim |
15:06:17 | FromGitter | <alehander42> I adapted a plugin from stack overflow to a auto remove file with a certain name command, now nimlime will be invincible for me <3 |
15:06:47 | FromGitter | <alehander42> well done @PMunch ! :D the space protobuf race is hot today |
15:10:21 | * | r3d9u11 quit (Remote host closed the connection) |
15:17:30 | * | xet7 quit (Ping timeout: 246 seconds) |
15:17:59 | * | xet7 joined #nim |
15:19:06 | * | Trustable joined #nim |
15:19:07 | Araq | PMunch: there is a .used pragma exactly for this purpose... |
15:19:29 | FromGitter | <Vindaar> yay, finally managed to write my first (for me) non trivial macros :D |
15:33:35 | * | endragor quit (Remote host closed the connection) |
15:35:42 | miran | Vindaar: congrats! :) |
15:41:17 | FromGitter | <zetashift> How do I turn a char intro a str? |
15:41:20 | FromGitter | <zetashift> string* |
15:41:36 | FromGitter | <zetashift> doing string(ch) still gives me a type error |
15:42:01 | subsetpark | zetashift - you can just use `$` |
15:42:08 | subsetpark | $'c' == "c" |
15:43:15 | FromGitter | <zetashift> thanks :D |
15:43:31 | * | SenasOzys quit (Read error: Connection reset by peer) |
15:45:18 | * | uran[m] left #nim ("User left") |
15:54:39 | enthus1a1t | what is the correct value for nimble "Package type"? https://gist.github.com/enthus1ast/50d2e65776fda702c18a07763107f7ef |
15:55:18 | miran | enthus1a1t: lib |
15:55:49 | enthus1a1t | thx miran |
15:56:02 | FromGitter | <Vindaar> lib/bin means to say either 'lib' or 'bin' |
15:56:12 | enthus1a1t | oh |
15:56:17 | enthus1a1t | totally misunderstood |
16:02:08 | FromGitter | <alehander42> do we have a lib that can serialize every kind of nim value? |
16:02:45 | FromGitter | <alehander42> I am adding auto save of failing tests to quicktest and I wanted to go with json for the first try |
16:02:54 | enthus1a1t | i've played with NESM |
16:03:04 | enthus1a1t | and marshal |
16:03:07 | FromGitter | <alehander42> (ok, every reasonable kind) |
16:04:15 | FromGitter | <Varriount> NimYAML might work too |
16:08:44 | FromGitter | <alehander42> ugh, can I somehow stop unittest from testfiltering its command args |
16:10:34 | FromGitter | <dom96> Marshal module in stdkib? |
16:10:49 | enthus1a1t | yes |
16:10:57 | FromGitter | <dom96> Yay gutter for Android. Sending message while I'm trying to fix it |
16:11:02 | FromGitter | <dom96> *gitter... |
16:11:07 | Yardanico | yeah, it's shit :P |
16:13:19 | FromGitter | <alehander42> yeah marshal looks very good! |
16:13:49 | FromGitter | <alehander42> ahh, I think I can almost stop unittest from misusing my cli args if testFilters is exported |
16:13:52 | FromGitter | <alehander42> `testsFilters = initSetstring ()` |
16:14:19 | enthus1a1t | but marshal might use another serializer (other than json) in the future |
16:15:15 | FromGitter | <alehander42> @dom96 can I add a proc `disableParamFilter()` to unittest.nim? |
16:15:38 | FromGitter | <alehander42> `disableParamFiltering` maybe |
16:16:29 | FromGitter | <alehander42> actually I don't even have to do that |
16:16:50 | FromGitter | <alehander42> I can just rewrite the logic, so testsFilters don't include *every* arg, but only those without `:` |
16:16:59 | FromGitter | <alehander42> I'll open a PR |
16:17:04 | jxy | Can anybody point me to the direction where nim prepares ansi color for output |
16:17:30 | jxy | I'm trying to mute the color when it's output is not a tty |
16:17:39 | Araq | compiler/msgs.nim |
16:17:52 | Araq | there is --colors:off, I hope it works |
16:18:09 | FromGitter | <alehander42> ah, still `stuff::` is possible |
16:22:49 | jxy | my mistake. It's not nim. It's nimble, which always print color even if redirected to a file. |
16:23:50 | jxy | i guess somewhere nimble needs an isatty test |
16:24:04 | enthus1a1t | a cool compiler feature/flag would be to show in which file and line a `echo` appears, so one could easily get rid of old debug echos |
16:25:13 | FromGitter | <alehander42> @enthus1a1t we have such a feature in our unfinished nim debugger |
16:25:30 | FromGitter | <alehander42> very useful indeed, I have 10-s of echo-s sometimes |
16:25:38 | enthus1a1t | nim debugger? |
16:28:16 | enthus1a1t | do you have the code released alredy? alehander42 |
16:28:23 | FromGitter | <alehander42> @Araq does this sound reasonable https://github.com/nim-lang/Nim/pull/7423 |
16:29:30 | FromGitter | <alehander42> @enthus1a1t yeah, I am working on a visual debugger environment which will have Nim support, (I doubt it will be open source tho) |
16:36:17 | * | floppydh quit (Quit: WeeChat 2.1) |
16:55:03 | * | Vladar quit (Quit: Leaving) |
16:56:39 | * | FromGitter quit (Remote host closed the connection) |
16:56:39 | * | oprypin quit (Quit: Bye) |
16:56:56 | * | FromGitter joined #nim |
16:57:02 | * | oprypin joined #nim |
17:12:51 | * | Vladar joined #nim |
17:24:50 | * | arecaceae quit (Remote host closed the connection) |
17:25:14 | * | arecaceae joined #nim |
17:29:07 | FromGitter | <diegogub> @mratsim multi method is working perfect. I just need to see how to share data between calls â â `````` [https://gitter.im/nim-lang/Nim?at=5aba7f632b9dfdbc3a2a9eb8] |
17:29:20 | * | athenot joined #nim |
17:29:27 | * | athenot_ quit (Read error: Connection reset by peer) |
17:29:47 | FromGitter | <alehander42> ok it seems marshal is working fine, quicktest can now repro tests automatically |
17:30:51 | FromGitter | <diegogub> @mratsim thanks for your help |
17:34:34 | miran | can i create a tuple (or something else) in which one element will sometimes be a char and sometimes an int? |
17:35:30 | FromGitter | <Varriount> @alehander42 marshal is a great module, as long as you treat the format like a black box |
17:35:51 | dom96 | miran: You can use an object variant for that |
17:36:30 | miran | i'm thinking of having extra fields - sometimes i'll use fieldX (int), and sometimes fieldY (char). !? |
17:37:37 | miran | dom96: ok, i'm looking at object variants, will see if i can use that |
17:38:56 | Yardanico | miran, yes, it allows exactly that |
17:51:50 | * | nsf joined #nim |
18:00:10 | miran | ok, i managed to make it work. now is the time to make it less ugly :) |
18:05:50 | FromGitter | <mratsim> ugliness is a feature Ada⢠|
18:06:27 | FromGitter | <mratsim> @PMunch I think I raised a bug about XDeclaredButNotUsed that didnât shut up, that was 1 year ago or something |
18:10:23 | FromGitter | <mratsim> @diegogub no problem, my pleasure |
18:10:55 | * | natrys joined #nim |
18:14:46 | Zevv | Is it possible to override functions from the stdlib in Nim, I believe they call this 'monkeypatching' in some languages |
18:18:13 | Zevv | or let me ask what I'm actually trying to do: I'd like to replace proc dial from include/asynccommon.nim in a local implementation without having to change the Nim stdlib code |
18:26:50 | * | find0x90 joined #nim |
18:27:49 | * | find0x90_ joined #nim |
18:28:32 | * | athenot_ joined #nim |
18:29:19 | * | find0x90_ quit (Client Quit) |
18:29:51 | * | athenot quit (Ping timeout: 240 seconds) |
18:31:28 | * | find0x90 quit (Ping timeout: 260 seconds) |
18:31:56 | Yardanico | Zevv, you can import every proc from that module except dial |
18:31:59 | Yardanico | and write your own dial |
18:32:02 | Yardanico | that's one of the ways |
18:32:42 | * | geocar joined #nim |
18:34:17 | Zevv | that makes sense |
18:36:42 | * | tiocavera joined #nim |
18:36:42 | * | tiocavera quit (Changing host) |
18:36:42 | * | tiocavera joined #nim |
18:36:42 | * | rockcavera quit (Killed (leguin.freenode.net (Nickname regained by services))) |
18:36:42 | * | tiocavera is now known as rockcavera |
18:37:18 | Zevv | 4.549 GB |
18:37:22 | Zevv | alsof het weer niks is |
18:37:31 | Zevv | mijn PS4 wordt een BF1-o-Matic |
18:37:34 | Zevv | kan straks niks anders meer |
18:39:42 | FromGitter | <Varriount> Zevv: ? |
18:40:24 | Zevv | ow sorry, wrong window |
18:40:33 | FromGitter | <Varriount> Google translate says you're typing Dutch, however it doesn't make a lot of sense |
18:41:02 | Zevv | it doesn't :) |
18:41:25 | Zevv | apologies for the noise |
18:43:38 | * | xet7 quit (Quit: Leaving) |
18:46:27 | * | nsf quit (Quit: WeeChat 2.0.1) |
19:07:47 | FromGitter | <zetashift> Good time to be dutch hehe |
19:11:57 | * | BitPuffin quit (Remote host closed the connection) |
19:31:42 | FromGitter | <tim-st> When I have a pure enum cant I use a name that is the same as a keyword? |
19:32:09 | Araq | with backticks at the declaration site |
19:32:17 | Araq | and Foo.keyword is supported iirc |
19:32:27 | FromGitter | <tim-st> Thanks! |
19:33:43 | * | athenot joined #nim |
19:34:51 | * | athenot_ quit (Ping timeout: 240 seconds) |
19:45:41 | * | athenot quit (Read error: Connection reset by peer) |
19:46:47 | * | athenot joined #nim |
19:59:16 | * | kunev_ joined #nim |
19:59:32 | * | kunev quit (Ping timeout: 276 seconds) |
20:06:05 | * | rokups quit (Quit: Connection closed for inactivity) |
20:15:21 | * | athenot quit (Ping timeout: 240 seconds) |
20:16:16 | * | athenot joined #nim |
20:25:33 | FromGitter | <AjBreidenbach> is there a way to get bitness at compile time? |
20:27:56 | * | dgwana quit (Quit: Leaving) |
20:31:04 | FromGitter | <AjBreidenbach> I mean other than importing NIM_INTBITS |
20:33:26 | FromGitter | <AjBreidenbach> or hostCPU could work I suppose |
20:33:59 | * | miran quit (Ping timeout: 276 seconds) |
20:42:56 | dom96 | https://nim-lang.org/docs/system.html#cpuEndian |
20:53:25 | FromGitter | <AjBreidenbach> sorry no I want sizeof(int) :| |
20:54:48 | dom96 | oh, there is a PR for that |
20:56:29 | Araq | sizeof(int) works at compile-time, always has. |
20:57:22 | FromGitter | <AjBreidenbach> oh, I'm just stupid |
20:57:35 | FromGitter | <AjBreidenbach> got it :) |
20:59:07 | * | Trustable quit (Remote host closed the connection) |
20:59:07 | * | aziz joined #nim |
21:12:00 | * | jaco60 quit (Quit: My MacBook has gone to sleep. ZZZzzzâŚ) |
21:25:09 | FromGitter | <cavariux> @dom96 nimble pulls submodules as well or do it just treat them as empty folders? |
21:25:31 | dom96 | it pulls them |
21:26:44 | FromGitter | <cavariux> thanks, also I'm having a problem where I cannot get the len of a ```ref seq``` or a ```ptr seq``` and I cannot convert a seq to a ptr/ref seq because I'm asking it as an argument in a function |
21:29:50 | * | Cthalupa quit (Max SendQ exceeded) |
21:30:04 | * | Cthalupa joined #nim |
21:32:43 | * | endragor joined #nim |
21:35:07 | Araq | your function is likely wrong |
21:35:29 | Araq | if it needs to mutate the seq, the parameter's type should be 'var seq[T]' |
21:36:07 | FromGitter | <cavariux> https://pastebin.com/47JrMLBk |
21:36:21 | FromGitter | <cavariux> I have to give both the length and the seq as different arguments |
21:36:32 | * | vlad1777d joined #nim |
21:36:39 | FromGitter | <cavariux> because I need to give the addr of the first value in the seq to a C library (opengl) |
21:36:51 | * | endragor quit (Ping timeout: 240 seconds) |
21:37:30 | FromGitter | <cavariux> and I cannot use a normal ```seq[float32]``` as an argument because when I use nameofseq[0].addr it tells me that it has no address |
21:37:52 | FromGitter | <cavariux> unless I use ref/ptr seq |
21:38:12 | Araq | not true, use unsafeAddr(s[0]) |
21:38:25 | dom96 | yeah, or use 'var seq' |
21:38:58 | dom96 | you should use 'ptr' at the very lowest level: almost always only for FFI |
21:39:12 | dom96 | and if you're finding yourself writing 'ref seq' then you're likely doing something wrong too :) |
21:39:13 | FromGitter | <krux02> dom96 unsafeAddr is the correct way here |
21:39:32 | dom96 | krux02: yes, but there are cases where it's not correct |
21:39:37 | FromGitter | <krux02> put i would use openarray |
21:39:37 | dom96 | so it's useful to know |
21:39:55 | FromGitter | <cavariux> damn, thank you |
21:39:58 | FromGitter | <krux02> in that example it is correct |
21:40:43 | FromGitter | <cavariux> I wasn't aware of unsafeAddr and unsafeNew will read docs, thanxs again |
21:45:22 | FromGitter | <cavariux> And is there an easy way to convert an object to a ref of the same object? |
21:47:18 | * | PMunch joined #nim |
21:50:01 | FromGitter | <krux02> nope you can't convert anything to a ref, but you can basically convert anything to a ptr |
21:50:16 | FromGitter | <krux02> a ref is like a shared pointer in c++ |
21:50:46 | FromGitter | <krux02> it owns the object and when all `ref` to an objecd die the object gets collected by the GC. |
21:51:43 | FromGitter | <krux02> I just use value types and pointers for everything. `ref` is overrated and not necessary for anything and only useful for very few things. |
21:52:01 | dom96 | You can actually: var a: Foo; var b: ref Foo; new b; b[] = a |
21:52:08 | FromGitter | <cavariux> oh thanks, I guess I was thinking of it as a c++ way, thanks for clarifying it |
21:52:46 | FromGitter | <cavariux> but when I ask for an argument in a function in nim the variable is copied like in c++ or it is passed as a reference? |
21:52:59 | FromGitter | <krux02> dom96: that does a copy. It is not a ref to the same object. |
21:53:38 | FromGitter | <krux02> it is passed as a pointer or value depending on what is more efficient |
21:53:41 | dom96 | yes, but it does allow you to "convert" to a ref |
21:53:48 | FromGitter | <krux02> or what the compiler things it is more efficient. |
21:54:00 | FromGitter | <krux02> the pointer is hidden though. |
21:54:20 | FromGitter | <cavariux> okay, so the only way of warrantying that it is not copied is to ask for a ptr right? |
21:54:33 | FromGitter | <krux02> You can see it in the generated source code, or if you print the addr of an object both from the calling and called function |
21:54:43 | FromGitter | <krux02> not really |
21:55:09 | FromGitter | <krux02> `var` for an argument is like a c++ reference |
21:55:18 | FromGitter | <krux02> it's a hidden pointer |
21:55:26 | FromGitter | <krux02> `ptr` is an explicit pointer. |
21:55:50 | FromGitter | <krux02> and last but not least there is {.byref.} pragma at the type |
21:56:09 | Araq | parameter passing does NOT copy. |
21:56:09 | FromGitter | <krux02> and {.byval.} i think is the opposite of it. |
21:56:22 | FromGitter | <krux02> Araq: int float double is copied |
21:56:44 | FromGitter | <krux02> sorry I mean int float32 float64 |
21:56:45 | Araq | sure, teach me how my own compiler works. |
21:56:58 | Araq | the important point is it DOES NOT COPY :P |
21:57:16 | FromGitter | <cavariux> Araq hahaha |
21:57:22 | Araq | it does copy when it's faster but people are always concerned about the copies |
21:57:31 | FromGitter | <krux02> It's not about teaching you, it is how you say "parameter passing does NOT copy". Which is not entirely true |
21:57:45 | FromGitter | <krux02> object parametrs do not copy |
21:57:50 | Araq | it's imprecise to better get the point across. |
21:58:08 | FromGitter | <krux02> yea you might be right |
21:58:30 | FromGitter | <krux02> sometimes it's better to oversimplify things and let the details for later |
21:58:58 | FromGitter | <cavariux> so there's no way of modifying the value passed as an argument in a procedure? |
21:59:18 | Araq | there is. use a 'var' parameter. |
21:59:24 | FromGitter | <krux02> well, there is unsaveAddr, and `var`. |
21:59:33 | Araq | but don't use 'var' for speed. |
21:59:33 | FromGitter | <cavariux> I mean, modifying the original value like in C |
21:59:35 | FromGitter | <krux02> (don't use unsafeAddr for this) |
21:59:48 | Araq | use 'var' when you need to mutate. |
22:00:06 | Araq | don't use 'var' otherwise, parameter passing does not copy either way. |
22:00:57 | FromGitter | <krux02> I think it is named a bit confusingly.`var` is a reference that lets you modify the original variable. Wher `ref` is a pointer type. |
22:02:16 | FromGitter | <krux02> `ref` is a gc tracked pointer and `ptr` is just a raw pointer like you know them from C. |
22:02:23 | Araq | nobody ever came up with better names |
22:02:35 | FromGitter | <cavariux> okay okay, that yous clarified everything up |
22:02:39 | FromGitter | <krux02> I think it's to late to change that now. |
22:02:42 | FromGitter | <cavariux> thanks to both of you |
22:03:00 | FromGitter | <krux02> and it doesn't really matter that much how it is named. |
22:03:16 | FromGitter | <cavariux> I think the name ref and var should be the other way around? |
22:03:21 | FromGitter | <cavariux> but too late to change it |
22:03:25 | Araq | yeah, we won't change it, the names are pretty good IMO. |
22:03:48 | Araq | but I wonder what you guys would come up with |
22:04:44 | FromGitter | <cavariux> so, what should I use ```var``` or ``unsafeAddr``` and why haha? |
22:04:46 | FromGitter | <krux02> well I like var for the reference, because there is already a var keyword for mutability. |
22:05:04 | FromGitter | <krux02> but I don't really like `ref` for the gc pointer |
22:06:17 | FromGitter | <krux02> I would call it ridiculously long, something like garbageCollectedPointer[T]. Just to make people not want to use it, but yea that is just me. I don't like gc. |
22:06:32 | FromGitter | <cavariux> safePointer would be allright too |
22:06:34 | dom96 | cavariux: if your proc modifies the parameter then use 'var' |
22:06:35 | FromGitter | <cavariux> or even sptr |
22:06:46 | FromGitter | <krux02> no safePointer is a very bad name |
22:06:55 | dom96 | `var` is a great name |
22:06:58 | FromGitter | <cavariux> @dom96 and if I just want to get the addr? |
22:07:03 | FromGitter | <krux02> what is it safe for? |
22:07:06 | dom96 | cavariux: then use unsafeAddr |
22:07:26 | FromGitter | <krux02> safe for cryptography? safe for access control? safe for what? |
22:07:32 | FromGitter | <krux02> And how safe is it? |
22:07:32 | FromGitter | <cavariux> great, thanks @dom96 sry for the bother everyone |
22:07:33 | dom96 | Do make sure the C function you're calling doesn't mutate the parameter though |
22:07:45 | FromGitter | <cavariux> @dom96 why is it? |
22:08:03 | dom96 | why is what? |
22:08:24 | FromGitter | <krux02> it is just for semantics in the language |
22:08:26 | FromGitter | <cavariux> why shouldn't they mutate the value with unsafeAdrr but it's okay with addr? |
22:08:58 | FromGitter | <krux02> when you have a parametr not marked as var, you promise not to modify it. But you could hack and modify it anyway, and that is not nice |
22:09:20 | FromGitter | <krux02> it's like a c++ const reference and then in the function you const cast he const away and then modify the argument. |
22:09:28 | FromGitter | <cavariux> oh, okay so it's just for semantics but still good thanks |
22:09:39 | FromGitter | <krux02> when you modify the argument the argument should be `var` in the parameter list. |
22:14:50 | shashlick | is it possible to use currentSourcePath() in a template and have it give you source path for the file the template is used in rather than the file where the template is written |
22:15:13 | * | SenasOzys joined #nim |
22:15:28 | * | vlad1777d quit (Ping timeout: 260 seconds) |
22:15:28 | * | Senketsu quit (Ping timeout: 260 seconds) |
22:16:38 | Araq | fyi these names were taken from Modula 3. 'var', 'ref', 'untraced ref' |
22:16:55 | Araq | I replaced 'untraced ref' by 'ptr' because I thought it to make more sense |
22:16:56 | * | Senketsu joined #nim |
22:17:15 | Araq | and to make it a consistent 3 letter term. |
22:17:41 | Araq | 'var' is also used in Modula 2 and Pascal. |
22:18:15 | Araq | it's not my fault you kids don't know rock-solid archaic technology :P |
22:21:56 | shashlick | or is it possible to get the working directory during compile time? |
22:22:24 | Araq | shashlick, no but you can patch the compiler to allow for getCurrentDir at compile-time |
22:23:28 | shashlick | I'm really tempted to add all the os procs into the VM |
22:23:46 | * | aziz quit (Quit: Ex-Chat) |
22:23:59 | Araq | that won't be accepted. but getCurrentDir will. |
22:24:29 | shashlick | there's 29 procs in os that aren't in nimscript already |
22:25:53 | * | vlad1777d joined #nim |
22:26:49 | shashlick | which of these do you think is fair to add? https://pastebin.com/Qgia8ApX |
22:29:20 | dom96 | May as well post this here too: https://hnleaderboard.com/? |
22:31:03 | FromGitter | <zetashift> 85, not bad |
22:31:20 | dom96 | I think it's funny that Rust is #1 |
22:32:07 | FromGitter | <zetashift> Is it really that funny though? During their blogposting initiative I saw almost every post on the frontpage |
22:32:38 | FromGitter | <zetashift> Also for a while I saw anything that rust had in the title skyrocketing up there :P |
22:33:36 | dom96 | Maybe funny is the wrong word, but it proves to me that Rust really is on HN too much :) |
22:34:04 | FromGitter | <Varriount> @alehander42 Can you try something for me? |
22:34:57 | FromGitter | <Varriount> With sublime open, shut your computer down. Make sure the "reopen windows when logging back on" box is checked |
22:35:45 | * | vlad1777d quit (Ping timeout: 248 seconds) |
22:37:44 | FromGitter | <Varriount> @zetashift I find it annoying. I want a more "fair" reality. |
22:39:09 | FromGitter | <cavariux> I truly want Nim to get popular :,c |
22:39:50 | FromGitter | <zetashift> Unimportant message from me: I just wrote a simple lexer in Nim! whoop whoop |
22:41:36 | FromGitter | <zetashift> And yeah, I also found it strange that some of those blogposts which didn't contain any real news but basically saying "Hey Rust is nice because C++ gave me PTSD" and got automatic votes for that |
22:41:52 | FromGitter | <cavariux> Hey Nim is nice because C++ gave me PTSD |
22:42:36 | FromGitter | <zetashift> yea but muh no GC and muh 10000% memory safety |
22:42:52 | FromGitter | <zetashift> Rust did a lot of right though no hate on that |
22:46:25 | dom96 | Rust has some great marketing behind it |
22:53:25 | * | Vladar quit (Remote host closed the connection) |
22:54:05 | FromGitter | <cavariux> I thought nimble only ran the files under tests that started with a t |
22:56:52 | FromGitter | <cavariux> @dom96 but when I run a test all the files under tests regardless of the filename runs |
22:57:38 | FromGitter | <mratsim> youâre mixing nimble with koch (the compiler bootstrap/test tool) |
22:57:57 | FromGitter | <cavariux> Nimble README: Nimble offers a pre-defined test task which compiles and runs all files in the tests directory beginning with 't' in their filename. |
22:58:39 | dom96 | readme could be wrong :) |
23:00:00 | FromGitter | <cavariux> oh okay, well might PR later |
23:02:03 | * | natrys quit (Quit: natrys) |
23:11:21 | shashlick | araq: if you add an op to vmops.nim, do you need to add it to scriptconfig/nimscript as well? |
23:11:28 | FromGitter | <krux02> Araq: `ref` could be called `traced ptr` |
23:11:58 | FromGitter | <krux02> I go to bed now, good night. |
23:12:35 | Araq | shashlick, depends on how you did it. in general, no. |
23:14:42 | shashlick | okay I tried scriptconfig first but then it didn't work in macros so figured vmops is the place |
23:15:04 | * | athenot_ joined #nim |
23:15:05 | * | athenot quit (Ping timeout: 276 seconds) |
23:19:52 | * | find0x90 joined #nim |
23:21:58 | FromGitter | <mratsim> I donât see whatâs wrong with var ref and ptr |
23:22:49 | FromGitter | <cavariux> that var is a weird name, it's just a hypothetical talk, there's no way that it can change now |
23:23:07 | FromGitter | <mratsim> var is something that can vary? |
23:23:14 | FromGitter | <mratsim> i.e. mutable? |
23:23:46 | FromGitter | <cavariux> I know, but it is a ref but ref is already taken and var is used to setup variables so it's weird |
23:24:17 | FromGitter | <mratsim> Itâs not, value objects and primitives can be mutated even though they are not refs |
23:24:26 | shashlick | araq: nope, adding getCurrentDir() to vmops works in macros but not in nim script |
23:24:57 | FromGitter | <mratsim> a ref has reference semantics, this is orthogonal to being mutable/var |
23:25:59 | FromGitter | <cavariux> I guess, my only point is that var is already used to create variables but that's all I really don't care haha it works fine and looks fine just it could become confusing |
23:26:55 | FromGitter | <mratsim> var is used for mutable variables, I find it consistent. Otherwise itâs let. You canât pass a let to a var parameter, you need to pass something created by var |
23:27:51 | FromGitter | <mratsim> I think your feedback as a new user is important so that we can add new things in the tutorials or in âNim for the C++â programmer. |
23:28:36 | * | gokr joined #nim |
23:28:49 | FromGitter | <cavariux> Yeah it would be useful for new users |
23:28:56 | FromGitter | <mratsim> Rust people would just think var == let mut (for variable creation) or var == mut (for parameter passing) for example |
23:29:20 | FromGitter | <mratsim> ML people would think, âhuh variables are not immutable?" |
23:30:14 | FromGitter | <mratsim> itâs hard to cater to everyone :/ |
23:30:55 | FromGitter | <cavariux> But well, there's truly nothing we can do, they are already set and they work fine as they are |
23:36:07 | FromGitter | <phrmoy> Question, is the intent of having Nim transpile to javascript is so we can deploy things a server like node? |
23:37:48 | FromGitter | <zacharycarter> not really |
23:38:23 | FromGitter | <zacharycarter> but there is a flag to target nodejs with the js backend |
23:39:32 | FromGitter | <zacharycarter> the js target is so you can write javascript with Nim - it's analogous to writing javascript with TypeScript |
23:39:43 | FromGitter | <zacharycarter> or ES6 + Babel |
23:39:52 | FromGitter | <zacharycarter> or whatever crazy S compiles to JS these days |
23:40:44 | FromGitter | <zacharycarter> I hooked up gitlab to kubernetes running on AWS today :shipit: |
23:41:01 | FromGitter | <zacharycarter> well kubernetes was running on AWS - gitlab was not |
23:44:38 | * | noonien quit (Quit: Connection closed for inactivity) |
23:45:24 | FromGitter | <mratsim> I think Araq didnât like to write javascript and preferred to write Nim so here comes your JS backend. â Also the first target was the browser and node came after ;). |
23:45:59 | FromGitter | <zacharycarter> I don't even think node is really a target per se |
23:46:14 | FromGitter | <phrmoy> Who likes to write JS? ;) |
23:46:17 | * | athenot_ quit (Ping timeout: 276 seconds) |
23:46:18 | FromGitter | <zacharycarter> I think it just imports some node related libraries |
23:46:39 | FromGitter | <zacharycarter> well - I don't think JS is going anywhere |
23:46:43 | FromGitter | <mratsim> @phrmoy, these days it seems like half the dev on Github are JS devs :P |
23:46:53 | FromGitter | <phrmoy> well but thats what I asked about |
23:46:59 | FromGitter | <mratsim> Iâm always amazed of the number of stars JS repo can gather. |
23:47:00 | FromGitter | <zacharycarter> everything compiles to JS that runs on the web |
23:47:11 | FromGitter | <phrmoy> who likes to write assembly? |
23:47:20 | FromGitter | <phrmoy> ^^ |
23:47:24 | FromGitter | <zacharycarter> my dad |
23:47:31 | FromGitter | <zacharycarter> I'd like to know how to |
23:47:38 | * | athenot joined #nim |
23:47:43 | FromGitter | <phrmoy> tuche, and he is a brave man and so are you =] |
23:47:53 | FromGitter | <zacharycarter> well he gets paid to do it so :P |
23:47:54 | FromGitter | <mratsim> I like to read assembly. And then carefully massage into producing the assembly I want. |
23:48:04 | FromGitter | <zacharycarter> yeah I want to assemblyfu |
23:48:06 | FromGitter | <mratsim> massage the compiler* |
23:48:16 | FromGitter | <zacharycarter> yeah baby |
23:48:18 | FromGitter | <phrmoy> i am starting to read assembly to figure out my Julia shortcomings |
23:48:22 | FromGitter | <phrmoy> so it's helpful |
23:48:36 | FromGitter | <phrmoy> but i certainly dont write in it, even tho its compiled to it |
23:48:42 | FromGitter | <zacharycarter> but erm - I haven't found the JS backend terribly useful |
23:48:44 | FromGitter | <phrmoy> thats the same mentality i have about JS |
23:48:50 | FromGitter | <zacharycarter> but it's pretty cool - you can bind to existing JS relatively easily |
23:48:59 | FromGitter | <phrmoy> thats what I wanted to know |
23:49:06 | FromGitter | <phrmoy> can we use react with Nim? |
23:49:10 | FromGitter | <zacharycarter> sure |
23:49:11 | FromGitter | <mratsim> you can use importcpp |
23:49:19 | FromGitter | <zacharycarter> https://github.com/andreaferretti/react.nim |
23:49:24 | FromGitter | <mratsim> and yes there was a electron+react+Nim shell |
23:49:34 | FromGitter | <zacharycarter> just use karax though IMO |
23:49:51 | FromGitter | <cavariux> nim + electron would be interesting |
23:49:55 | FromGitter | <phrmoy> As long as we can do things with react and electron |
23:50:02 | FromGitter | <zacharycarter> I'm starting to produce tooling for the js side of Nim |
23:50:07 | FromGitter | <phrmoy> the JS target is worth it |
23:50:11 | FromGitter | <zacharycarter> right now I'm working on a library to power something like nodemon |
23:50:20 | FromGitter | <cavariux> but I guess a good native gui library is still neaded |
23:50:33 | FromGitter | <phrmoy> in fact, the JS target is worth it one way or another |
23:50:35 | FromGitter | <zacharycarter> every language needs a "good" native gui library :) |
23:50:39 | FromGitter | <zacharycarter> that's why electron exists |
23:50:54 | FromGitter | <phrmoy> like someone already said, its the web, what you gonna do about it? ^^ |
23:51:01 | FromGitter | <zacharycarter> the web is the worst |
23:51:06 | FromGitter | <zacharycarter> but yeah |
23:51:12 | FromGitter | <zacharycarter> what are you going to do about it.... |
23:51:24 | FromGitter | <phrmoy> not use JS |
23:51:34 | FromGitter | <zacharycarter> that makes the web suck a bit less |
23:51:38 | FromGitter | <zacharycarter> still sucks |
23:51:39 | FromGitter | <mratsim> Every language is struggling with good GUI ... |
23:52:02 | FromGitter | <phrmoy> agreed, JS tho, something else in the world of languages with struggles |
23:52:07 | FromGitter | <zacharycarter> @phrmoy I recently made - https://github.com/zacharycarter/nim-sass |
23:52:10 | FromGitter | <cavariux> I feel that Java was one of the few that made it right |
23:52:22 | FromGitter | <zacharycarter> so we can compile sass with Nim now ⨠|
23:52:32 | FromGitter | <phrmoy> that's awesome |
23:52:50 | FromGitter | <phrmoy> im still stunned it took me this long to uncover u guys |
23:52:52 | FromGitter | <mratsim> I put Java in the same basket as electron, a huge memory hog for 4 buttons and 1 menu |
23:52:53 | FromGitter | <phrmoy> hide much? |
23:52:59 | FromGitter | <cavariux> Nice, does that mean Nim -> Sass -> Css? |
23:53:20 | FromGitter | <zacharycarter> @cavariux no - it just means you can write a sass compiler in Nim |
23:53:52 | FromGitter | <mratsim> @phrmoy, itâs more like drowned in information overload |
23:54:03 | FromGitter | <zacharycarter> @mratsim there are ppl writing electron apps with very thin JS layers and majority of impl in Rust, claiming it's speedy |
23:54:09 | FromGitter | <phrmoy> information? you mean marketing overload |
23:54:10 | FromGitter | <zacharycarter> but I mean... |
23:54:36 | FromGitter | <phrmoy> which you could also call, disinformation |
23:54:50 | FromGitter | <mratsim> both I think |
23:55:21 | FromGitter | <mratsim> just check on quora âLooking for a new languageâ or anything in that vein |
23:55:31 | FromGitter | <zacharycarter> https://github.com/onivim/oni |
23:55:58 | FromGitter | <phrmoy> Red also seems like a great project (am I forbidden to express thoughts on other languages here?) |
23:56:08 | FromGitter | <zacharycarter> looks nice |
23:56:09 | shashlick | @zacharycarter: i just tried oni yesterday, looks great but 300MB for opening 2 small files |
23:56:12 | FromGitter | <phrmoy> different purpose to Nim |
23:56:14 | FromGitter | <zacharycarter> ouch |
23:56:45 | FromGitter | <zacharycarter> um no you can talk about Red but if you talk about Ponylang we'll cut your finger tips off one by one |
23:57:01 | FromGitter | <mratsim> @phrmoy, itâs not forbidden, only thing forbidden is trolling and saying that Nim transpires to C/JS ;) |
23:57:19 | FromGitter | <zacharycarter> I'm kidding I <3 ponies |
23:57:40 | FromGitter | <mratsim> we regularly talk about Haskell, Pony, Rust, D, whatever is the new language of the month (Zig?) |
23:57:48 | FromGitter | <zacharycarter> nooooo |
23:57:59 | FromGitter | <zacharycarter> the languages of the month (which you guys keep ignoring) are... |
23:58:27 | FromGitter | <zacharycarter> https://bitbucket.org/duangle/scopes/wiki/Home â and â https://plg.uwaterloo.ca/~cforall/ |
23:58:37 | FromGitter | <phrmoy> @mratsim haha |
23:58:42 | FromGitter | <mratsim> Na itâs https://futhark-lang.org/ |
23:59:04 | FromGitter | <zacharycarter> if you're a data scientist |
23:59:06 | FromGitter | <mratsim> actually it might be interesting for you @phrmoy since youâre coming from Julia |
23:59:26 | FromGitter | <zacharycarter> I think for all game programmers scopes is super interesting |
23:59:30 | FromGitter | <zacharycarter> and cforall is interesting forall |
23:59:52 | FromGitter | <phrmoy> ohhh this is kinda dangerous |