00:00:07 | * | JinShil joined #nim |
00:03:35 | * | Varriount|Busy joined #nim |
00:05:46 | * | Trustable quit (Remote host closed the connection) |
00:08:08 | ekarlso | hmm, how can I convert a json object to something I can iterate over ? |
00:08:29 | BlaXpirit_ | ekarlso, you can immediately iterate over it |
00:08:40 | BlaXpirit_ | for k, v in my_jobject: |
00:08:55 | Araq | Varriount|Busy: I don't get https://github.com/Araq/Nim/pull/1951 |
00:08:57 | BlaXpirit_ | wait.. i'm actually not 100% sure |
00:09:13 | BlaXpirit_ | yeah, it's correct |
00:09:20 | Araq | it says "build.sh can do the download now" but no such commit is in there |
00:09:50 | Araq | and apart from that, I *really* dislike changing the build nilly willy. it always breaks things for somebody |
00:14:28 | Araq | BlaXpirit_: so what should we do with s[0.. -1] |
00:14:47 | BlaXpirit_ | Araq, haven't I said? |
00:14:52 | ekarlso | hmmms |
00:15:01 | Varriount|Busy | Araq: Want me to revert the commit? |
00:15:03 | ekarlso | can't you pass a seq as a varargs ? |
00:15:14 | BlaXpirit_ | I say, disable the special meaning of negative indices |
00:15:40 | BlaXpirit_ | I don't know what to do with this without adding alternative ranges/functions to half of stdlib |
00:15:44 | Araq | Varriount|Busy: yes. I don't like ./build.sh either. it's sh build.sh so file bits don't matter |
00:15:55 | BlaXpirit_ | Araq, but you're the language designer here :p |
00:16:52 | BlaXpirit_ | it is also... possible to make a generic catch-all wrapper |
00:17:15 | BlaXpirit_ | I just had such a crazy idea for a workaround |
00:17:57 | BlaXpirit_ | make a new operator (`...` or whatever) that will throw exception if you go out of bounds |
00:18:21 | BlaXpirit_ | and best (worst) part of this, it would translate 0...-1 to 1..0 |
00:19:01 | Araq | BlaXpirit_: we can also simply special case 0.. -1, right? |
00:19:13 | BlaXpirit_ | Araq, nah, people rely on it |
00:19:14 | Varriount|Busy | Araq: But special cases are so... icky |
00:19:36 | Araq | it's a strange "slice" anyway |
00:19:38 | BlaXpirit_ | Araq, because it is an alternative way to write x.high |
00:20:04 | BlaXpirit_ | if you are gonna add special cases, it needs to be a different operator |
00:21:21 | BlaXpirit_ | so my idea for a new operator, if b<a it returns slice(1, 0); if a<0 you get an error; if b<-1 it turns into you get (a, -1); |
00:21:52 | Varriount|Busy | I vote for a breaking change. |
00:21:55 | BlaXpirit_ | of course, much better would be to just fix everything, but it ain't gonna happen |
00:21:56 | Araq | these negative slices annoy for 'parallel' as well |
00:22:19 | Araq | for 'parallel' I current I do "not supported" |
00:22:25 | BlaXpirit_ | the smallest breaking change would be [:14:32] <BlaXpirit_> I say, disable the special meaning of negative indices |
00:22:39 | Varriount|Busy | Yes, that one. |
00:22:41 | BlaXpirit_ | if it's out of bounds, it's out of bounds |
00:23:31 | BlaXpirit_ | but i did also describe what I would like to see to help people quickly fix their code in such case |
00:23:52 | Araq | you wrote too much :P |
00:24:08 | Araq | hence I'm asking you for a TL;DR |
00:24:13 | BlaXpirit_ | https://github.com/Araq/Nim/issues/1979 It is impossible to solve this while keeping backwards compatibility. My suggestion is to remove negative indices in slices, and possibly introduce an explicit syntax for them, maybe something like this https://gist.github.com/BlaXpirit/f063fe6706201504580d |
00:24:45 | BlaXpirit_ | i know the implementation is far from ideal. just a demonstration. |
00:26:01 | EXetoC | what about getting a possibly empty slice? |
00:26:43 | BlaXpirit_ | EXetoC, 0..-1 |
00:26:51 | BlaXpirit_ | negative indices special meaning would be removed |
00:27:01 | EXetoC | right ok |
00:29:11 | BlaXpirit_ | Julia has quite a nice syntax. couldn't find a better link than this https://github.com/adambard/learnxinyminutes-docs/blame/master/julia.html.markdown#L197 |
00:29:44 | BlaXpirit_ | all it does is make "end" inside square brackets expand to length of that variable |
00:29:54 | BlaXpirit_ | you can do math on it and whatnot |
00:29:58 | EXetoC | and other issues related to closed intervals? do you think they are less of a problem? having to do "+ 1" here and there for example |
00:30:17 | BlaXpirit_ | yes, that sux, but let's not get into that, because it is too late |
00:31:11 | BlaXpirit_ | EXetoC, < operator is an OK workaround most of the time |
00:31:23 | EXetoC | ok but what were the benefits of half-closed intervals again? |
00:31:37 | BlaXpirit_ | http://www.quora.com/Why-are-Python-ranges-half-open-exclusive-instead-of-closed-inclusive |
00:31:38 | Araq | there are none ;-) |
00:31:42 | BlaXpirit_ | -_- |
00:31:56 | EXetoC | Araq: what was the reason then? |
00:32:25 | BlaXpirit_ | in that article, range(a, b) is basically toSeq(a .. <b) |
00:32:29 | EXetoC | but you mentioned 'a' .. 'z' and such |
00:32:42 | EXetoC | right |
00:33:47 | Araq | again an exclusive range only works when you have a sentinel you don't care about |
00:34:01 | Araq | enums have no such sentinel |
00:34:11 | Araq | python has no typesafe enums |
00:34:18 | Araq | neither has C |
00:34:19 | BlaXpirit_ | we're going offtopic again. thanks, EXetoC :| |
00:34:20 | Araq | or Java |
00:34:47 | flaviu | Java enums are nothing like C enums. |
00:35:03 | BlaXpirit_ | my problem is mostly with standard library enforcing inclusive ranges on you |
00:35:04 | Varriount|Busy | Anyway, *cough* |
00:35:07 | BlaXpirit_ | everywhere |
00:35:22 | BlaXpirit_ | ranges have an easy fix, even now |
00:35:35 | * | tinAndi quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0/20150108202552]) |
00:35:42 | Varriount|Busy | BlaXpirit_: You would prefer that inclusive and non-inclusive be mixed in the stdlib? |
00:35:58 | benji | when designing languages you have to remember that you'll have many, many more user in the future than you have now; you don't want to make the same mistake Stuart Feldman made |
00:36:19 | BlaXpirit_ | ok let's just forget about inclusive ranges |
00:36:24 | Varriount|Busy | benji: Something to live by. |
00:36:24 | BlaXpirit_ | and look at the problem at hand |
00:36:54 | benji | Stuard Feldmen on designing make's syntax: "Why the tab in column 1? [...] I just did something simple with the pattern newline-tab. It worked, it stayed. And then a few weeks later I had a user population of about a dozen, most of them friends, and I didn't want to screw up my embedded base. The rest, sadly, is history." |
00:38:20 | Araq | benji: I'm willing to make the same mistakes that are *required* to be successful. which is: at some point you have to stop deliver stability. |
00:38:36 | Araq | er |
00:38:40 | Araq | stop and deliver |
00:38:46 | EXetoC | which of the OOP macros is the best? |
00:38:47 | benji | Araq: agreed; therein lies art |
00:38:59 | BlaXpirit_ | EXetoC, i feel they are limiting as heck |
00:39:15 | Varriount|Busy | "stop *to* deliver stability"? |
00:39:31 | Araq | Varriount|Busy: yeah whatever |
00:39:58 | EXetoC | BlaXpirit_: what's missing? |
00:40:07 | * | gunn joined #nim |
00:40:15 | Araq | and exclusive ranges are weird anyway. mathematicians have no problem whatsoever with "sum from 0 to n-1" |
00:40:17 | BlaXpirit_ | EXetoC, ability to separate things |
00:40:28 | BlaXpirit_ | Araq, k |
00:40:38 | BlaXpirit_ | [:35:37] <BlaXpirit_> ok let's just forget about inclusive ranges [:35:42] <BlaXpirit_> and look at the problem at hand |
00:41:18 | BlaXpirit_ | I see 2 suggestions: remove special meaning of negative indices. introduce a new weird operator (`...`?) that works around this problem [:20:40] <BlaXpirit_> if b<a it returns slice(1, 0); if a<0 you get an error; if b<-1 it turns into you get (a, -1); |
00:41:39 | BlaXpirit_ | (both suggestions are mine, but i really dont see any others) |
00:42:25 | BlaXpirit_ | wait, that's not gonna work... if b<-1 you get (a, 0) probably |
00:42:32 | EXetoC | BlaXpirit_: none of the macros have any redeeming qualities? I'd just like to discuss getter/setter shortcuts but maybe I'll wait |
00:43:06 | benji | Araq: there is a very narrow pass to navigate; too far on the "don't break things" side and the future is much worse than it could have been (i.e., the gains that an improved design could have made are forfeit), too far on the "do it right" side and the foundations are forever shifting and nothing signficant gets built |
00:47:14 | * | sdw quit (Read error: Connection reset by peer) |
00:47:39 | * | sdw joined #nim |
00:47:39 | * | sdw quit (Changing host) |
00:47:39 | * | sdw joined #nim |
00:49:10 | * | Varriount|Busy_ joined #nim |
00:49:21 | Araq | well I'll announce it on the forum and see what people say |
00:49:35 | Araq | I'm for simply removing negative indexing |
00:49:40 | Varriount|Busy_ | As am I. |
00:49:45 | Araq | as I said, it sucks for 'parallel' too |
00:49:49 | * | Varriount|Busy quit (Disconnected by services) |
00:49:57 | * | Varriount|Busy_ is now known as Varriount|Busy |
00:50:31 | BlaXpirit_ | there is an immediate workaround though |
00:50:33 | dom96 | I'm not. |
00:52:08 | EXetoC | dom96: you often benefit from it? |
00:52:23 | BlaXpirit_ | [:22:50] <BlaXpirit_> but i did also describe what I would like to see to help people quickly fix their code in such case |
00:54:21 | BlaXpirit_ | what's up with Error: cannot instantiate: 'Slice' |
00:54:22 | * | Varriount|Busy quit (Ping timeout: 246 seconds) |
00:57:10 | dom96 | EXetoC: I just think that 0..1 yielding 1 character makes a lot more sense than 2. |
00:57:31 | BlaXpirit_ | ok but we're not gonna break all existing code |
00:58:01 | BlaXpirit_ | and make slices/loops on ordinals impossible |
00:58:13 | dom96 | I already discussed my opinion on the github issue. |
00:58:17 | BlaXpirit_ | i'm all for it, but it's just not realistic |
00:59:16 | BlaXpirit_ | you're opinion is just an opinion, because you're not describing any way to make it real |
00:59:24 | BlaXpirit_ | your* omg |
00:59:30 | * | gsingh93 joined #nim |
00:59:37 | gmpreussner | hi all |
01:00:40 | EXetoC | dom96: but that will remain so, won't it? |
01:01:41 | dom96 | BlaXpirit_: I did. I suggest we implement Python's slice syntax. |
01:01:51 | dom96 | That shouldn't break anything |
01:02:04 | BlaXpirit_ | well if it's separate, sure |
01:02:16 | BlaXpirit_ | go ahead and duplicate every single slice-based operation |
01:02:45 | EXetoC | dom96: the only difference will be that x[0 .. -1] will instead yield [] |
01:03:06 | BlaXpirit_ | EXetoC, no..? |
01:03:25 | dom96 | The difference will be that you will be able to write: x[0:] |
01:03:45 | BlaXpirit_ | [:01:35] <BlaXpirit_> go ahead and duplicate every single slice-based operation |
01:04:04 | Araq | plus the parser updates |
01:04:09 | Araq | plus the grammar updates |
01:04:17 | Araq | plus the AST changes |
01:04:22 | BlaXpirit_ | that's nothing, in comparison |
01:04:33 | Araq | plus the ability to overload such a construct |
01:05:07 | Araq | plus the doc updates |
01:05:30 | Araq | and then we only have the problem with people wondering why both exist |
01:05:38 | EXetoC | dom96: I'm not talking about syntax here. what am I missing? |
01:05:41 | Araq | and if they are different or not |
01:06:03 | dom96 | EXetoC: I am |
01:06:05 | EXetoC | but [0 .. <0] yielding [] would be neat, but we'd need a temporary operator and a migration strategy |
01:06:06 | Araq | and why Nim has 2-4 ways to accomplish everything |
01:06:26 | BlaXpirit_ | ..< operator lel |
01:06:26 | EXetoC | where is [0 .. -n] actually used though? |
01:06:49 | BlaXpirit_ | EXetoC, sequ[2 .. -1] |
01:06:50 | EXetoC | BlaXpirit_: I meant any negative value |
01:07:15 | Araq | s[-1] doesn't work anyway for efficiency |
01:07:22 | EXetoC | BlaXpirit_: yes but how often is it relied upon? |
01:07:35 | Araq | the negative indexing was an alien from the beginning |
01:07:44 | BlaXpirit_ | you can only be sure that people rely on it SOMEWHERE |
01:07:59 | BlaXpirit_ | and i think you underestimate how many people want to write -1 instead of stuff.high |
01:08:04 | dom96 | ok ok, remove the negative indexing. |
01:08:15 | dom96 | It's a pity that our slices won't be as nice as python's though. |
01:08:29 | Araq | BlaXpirit_: sugar for stuff.high can always be added later though |
01:08:39 | BlaXpirit_ | Araq, exactly |
01:08:44 | BlaXpirit_ | but i'm not talking about this |
01:08:50 | EXetoC | my suggestion doesn't appeal to anyone? |
01:08:52 | BlaXpirit_ | i'm talking about how much it may be used in current code |
01:09:07 | BlaXpirit_ | I don't see your suggestion |
01:09:15 | BlaXpirit_ | specialcase 0..-1 ? |
01:10:30 | EXetoC | [0 .. -n] yielding []. the behavior would be similar to how 0 .. -n is iterated through |
01:10:45 | dom96 | BlaXpirit_: That would be horrible. |
01:10:50 | EXetoC | or it might not be so similar |
01:10:51 | BlaXpirit_ | dom96, yup |
01:11:13 | dom96 | Just make ~ equal that len or something |
01:11:20 | BlaXpirit_ | that's not the problem |
01:11:31 | dom96 | or maybe % |
01:11:32 | BlaXpirit_ | that is a useful addition for later |
01:11:43 | BlaXpirit_ | dom96, and i suggested that a long time ago |
01:11:45 | BlaXpirit_ | Y U NO READ |
01:11:56 | dom96 | jesus, calm down. |
01:12:04 | BlaXpirit_ | that's why i get angry and produce "noise" |
01:12:19 | BlaXpirit_ | because i need to repeat over and over and over |
01:12:24 | EXetoC | have a 'slice' proc or something, then apply a migration path |
01:13:07 | * | Varriount|Busy joined #nim |
01:14:14 | Araq | EXetoC: tell me more about your idea |
01:14:24 | Araq | it that because of leading 0? |
01:15:20 | Araq | but the point is that [0.. -4] includes everything (including) the 4th last entry |
01:15:23 | ekarlso | how can I go from time > int ? |
01:15:34 | ekarlso | toSeoncds only gives float :/ |
01:16:07 | Araq | EXetoC: we might as well get rid of negative indexing then |
01:16:26 | Araq | BlaXpirit_: take a guess of how I feel ;-) |
01:16:33 | BlaXpirit_ | so i just produced a workaround that doesnt need any changes whatsoever |
01:17:01 | * | Araq too needs to repeat himself over and over and over |
01:17:56 | BlaXpirit_ | https://gist.github.com/BlaXpirit/3de6485bc57bee074a21 |
01:18:06 | EXetoC | Araq: BlaXpirit_ was annoyed by the verbosity of yielding a slice that is possibly empty [], so that's what I was getting at. a proc could be introduced just for that purpose, but I think he implied that it was a very common operation |
01:18:49 | BlaXpirit_ | here i just make a `...` operator that has non-inclusive right end and doesn't allow negative indices and is based only on `..` |
01:20:00 | EXetoC | returning SomeOtherSliceType? |
01:20:06 | BlaXpirit_ | nope |
01:20:10 | BlaXpirit_ | returning Slice |
01:20:30 | BlaXpirit_ | no idea why : Slice return type doesnt work |
01:20:39 | EXetoC | it's a generic type |
01:20:46 | BlaXpirit_ | oh, what a dummy |
01:20:49 | EXetoC | hm |
01:21:11 | EXetoC | but it works for parameters at least |
01:22:14 | EXetoC | but because of inference |
01:24:09 | BlaXpirit_ | this is so stupid but it works |
01:26:36 | BlaXpirit_ | (i made some adjustments to https://gist.github.com/BlaXpirit/3de6485bc57bee074a21 ) |
01:26:42 | BlaXpirit_ | anyone still here? |
01:27:47 | EXetoC | Araq: [x .. lessThanX] == []? again, with a temporary proc for the sake of migration |
01:29:44 | Araq | BlaXpirit_: well I think having both ... and .. doesn't solve anything. rubyists will love it though |
01:30:13 | BlaXpirit_ | Araq, why doesnt it solve anything |
01:30:28 | EXetoC | but that might introduce other errors. it's a trade-off though |
01:30:35 | BlaXpirit_ | you can make an inclusive version that just prevents negative indices, too |
01:30:54 | EXetoC | (I'm referring to what I said) |
01:33:27 | EXetoC | or make -1 the only allowed negative value, and then you can catch other kinds of error. 'find' procs never return -2 for example after all |
01:34:01 | BlaXpirit_ | -1 is the main problem |
01:34:04 | BlaXpirit_ | what are you thinking |
01:34:57 | EXetoC | with the *current* implementation you mean? because of the questionable semantics |
01:35:11 | Araq | BlaXpirit_: because instead of .. vs .. < the poor programmer has to think about .. vs ... |
01:35:33 | BlaXpirit_ | name it ..< |
01:35:35 | Araq | .. < is nicer, especially once we added: |
01:36:00 | Araq | template `..<` (a, b): expr = a .. < b |
01:36:10 | BlaXpirit_ | oh u did? i havent noticed |
01:36:22 | Araq | no, but we should finally |
01:36:25 | BlaXpirit_ | ..ok |
01:36:34 | BlaXpirit_ | and use my implementation :| |
01:36:39 | BlaXpirit_ | crazy |
01:36:53 | Araq | I already gave the implementation |
01:37:00 | BlaXpirit_ | well it doesnt fix anything then |
01:37:09 | BlaXpirit_ | and is irrelevant |
01:37:18 | Araq | ? |
01:37:26 | Araq | it fixes as much as your ... |
01:37:37 | BlaXpirit_ | wtf no |
01:37:56 | BlaXpirit_ | a[0 ..< 0] remember? |
01:38:16 | BlaXpirit_ | the whole reason why we are talking? |
01:38:42 | EXetoC | but my change would not affect [x .. y], which I'd imagine is very common |
01:39:33 | BlaXpirit_ | EXetoC, this whole time it seems like you're talking about something completely different |
01:40:38 | BlaXpirit_ | the only suggestion that would change .. was suggested by dom96, and it was to completely change it |
01:41:40 | Araq | BlaXpirit_: ok, so your ... is not ..< because it gets rid of negative indexes? |
01:41:50 | EXetoC | I mean, where x is >= 0 and y >= x. making [x .. y] different then would break a lot more code compared to just making [x .. lessThanX] yield [], which is something you got caught up with before |
01:41:53 | Araq | but we are not discussing this anymore :P |
01:42:04 | BlaXpirit_ | then what the heck are we discussing |
01:42:22 | Araq | you brought up ... |
01:43:06 | BlaXpirit_ | please tell me what you think we're discussing |
01:43:30 | Varriount|Busy | Araq: Could you please look at https://github.com/Araq/Nim/pull/1981 ? |
01:43:33 | Araq | a nice syntax for ..< |
01:43:40 | BlaXpirit_ | wat |
01:43:51 | BlaXpirit_ | who cares about that operation if it's useless |
01:43:53 | EXetoC | now I completely forgot about introducing a migration path though, and I guess I'm only referring to your gripe regarding the ugly code needed to possibly yielding an empty slice ([]) |
01:43:55 | BlaXpirit_ | and fixes absolutely nothing |
01:44:49 | Araq | Varriount|Busy: add a test case that has a space in it |
01:46:13 | Araq | looks fine to me |
01:46:44 | Araq | BlaXpirit_: look, IMO we settled on the semantics and so I thought now we were discussing syntax |
01:47:13 | BlaXpirit_ | I wasn't aware that anyone settled on anything |
01:47:19 | Varriount|Busy | Araq: Which directory do I place it in? |
01:47:34 | EXetoC | but [x .. x] yielding [] does indeed have some nice properties, and a migration path could be introduced in any case, but then would you change the semantics of "for x .. y" too? |
01:47:36 | BlaXpirit_ | at least announce what I'm supposed to have settled on |
01:48:43 | Araq | Varriount|Busy: 'misc' |
01:50:31 | BlaXpirit_ | [:29:02] <Araq> BlaXpirit_: well I think having both ... and .. doesn't solve anything. rubyists will love it though [:34:29] <Araq> BlaXpirit_: because instead of .. vs .. < the poor programmer has to think about .. vs ... |
01:50:45 | BlaXpirit_ | where did I miss the statement that we settled on something? |
01:50:49 | BlaXpirit_ | i don't understand |
01:50:54 | BlaXpirit_ | please say what we settled on |
01:50:59 | Araq | you didn't miss anything |
01:51:28 | Araq | we agreed on getting rid of negative indexing |
01:51:47 | Araq | the migration path doesn't concern me much |
01:51:55 | BlaXpirit_ | pffffft okay then |
01:52:12 | BlaXpirit_ | then nothing else needs to be changed, really |
01:52:32 | BlaXpirit_ | except maybe an addition of something that provides "len" inside square brackets |
01:52:44 | EXetoC | you don't really care for a shortcut that might yield [] anymore? |
01:53:15 | BlaXpirit_ | what shortcut |
01:53:20 | BlaXpirit_ | s[i .. <i] |
01:53:21 | BlaXpirit_ | this one? |
01:53:33 | BlaXpirit_ | i dont need anything else for happiness |
01:53:41 | EXetoC | anything that is roughly as compact |
01:53:52 | BlaXpirit_ | well it is already there |
01:54:06 | EXetoC | ok well you said that you *only* wanted to disallow negative indices |
01:54:34 | BlaXpirit_ | [:23:32] <BlaXpirit_> https://github.com/Araq/Nim/issues/1979 It is impossible to solve this while keeping backwards compatibility. My suggestion is to remove negative indices in slices, and possibly introduce an explicit syntax for them, maybe something like this https://gist.github.com/BlaXpirit/f063fe6706201504580d |
01:58:47 | BlaXpirit_ | there. an alternative to `..` that just disallows negative indices and works exactly the same otherwise. https://gist.github.com/BlaXpirit/3de6485bc57bee074a21#file-workaround-nim-L42 |
01:59:08 | BlaXpirit_ | /fixed |
01:59:25 | fowlmouth | how annoying |
01:59:27 | EXetoC | huh |
02:00:34 | * | flaviu quit (Remote host closed the connection) |
02:01:17 | fowlmouth | you want to break all my code |
02:01:26 | EXetoC | so str[x .. <x] where <x is >= 0 yields an empty string now, but s[0 .. -1] yields the whole string |
02:01:46 | BlaXpirit_ | no |
02:01:51 | BlaXpirit_ | oh wait |
02:01:52 | BlaXpirit_ | yes |
02:01:54 | BlaXpirit_ | yes |
02:02:03 | BlaXpirit_ | that is the main problem |
02:02:03 | * | flaviu joined #nim |
02:02:42 | EXetoC | BlaXpirit_: but did you not want str[x .. find(str, "x")] to possibly yield []? that's something we discussed to great length, but then I asked you know and you didn't really seem to care much |
02:02:47 | EXetoC | hence the suggestions I've made today |
02:02:54 | fowlmouth | BlaXpirit_, that is simply how strings work, get over it |
02:03:19 | BlaXpirit_ | fowlmouth, you should familiarize yourself with the subject first. |
02:03:47 | EXetoC | regarding that shortcut in particular (rather than "if idx == -1: [] else: str[0 .. idx]") |
02:04:14 | BlaXpirit_ | well now i made a better, universal shortcut |
02:05:27 | fowlmouth | "better" |
02:05:34 | EXetoC | well I tried to figure out how it relates to the issue regarding a potentially empty slice ([x .. -1]), but couldn't |
02:06:29 | BlaXpirit_ | i'm still trying to do things without breaking backwards compatibility. turning out pretty nice, btw. |
02:06:55 | * | VinceAddons quit (Read error: Connection reset by peer) |
02:07:02 | BlaXpirit_ | but since Araq agrees to just make negative indices act as normal, i can maybe just stop |
02:07:41 | fowlmouth | no BlaXpirit_ you've turned a simple slice into a branching function and introduced exceptions, this will never pass the microbenchmarks |
02:08:20 | BlaXpirit_ | that is the price you pay for backwards compatibility |
02:08:26 | BlaXpirit_ | it can be used RIGHT NOW as well |
02:08:28 | fowlmouth | and if we aren't passing microbenchmarks the blogs will hate on us |
02:08:36 | fowlmouth | and when reddit reads the blogs reddit will hate on us |
02:08:55 | fowlmouth | yes let me go change every ".. <" to "..<" |
02:08:56 | EXetoC | .eval var s = "ohai"; echo s[0 .. s.find("q")] # this would print the empty string with my suggestions, but what with your changes is it that provides such a shortcut? |
02:08:59 | Mimbus | EXetoC: ohai |
02:09:10 | fowlmouth | brb 15 mins lol |
02:09:21 | BlaXpirit_ | EXetoC, this shortcut is stupid |
02:09:33 | BlaXpirit_ | i couldn't care less about it, it's a horrible practice |
02:09:42 | BlaXpirit_ | Araq tried to pose it as useful |
02:10:30 | EXetoC | what are you talking about? when did he propose such changes? he wanted to make s[0 .. -1] yield an empty sequence rather than the whole string such as is the case now? |
02:10:48 | BlaXpirit_ | EXetoC, that suggestion is bad because it will break more things than fix |
02:10:58 | BlaXpirit_ | and it is an exception to already wonky rules |
02:10:59 | EXetoC | you want a shortcut that might yield an empty sequence but you don't want that to be str[0 .. -1]? |
02:11:31 | BlaXpirit_ | str[0 .. -1] is acceptable to me if negative indices are otherwise an error |
02:11:50 | BlaXpirit_ | but. with that weird snippet you can use str[0 .! -1] right now |
02:11:54 | Araq | BlaXpirit_: it IS useful, "natural" even |
02:12:12 | BlaXpirit_ | it is a side effect, and relying on it is bad |
02:12:13 | EXetoC | BlaXpirit_: other indices being less than -1? |
02:12:44 | BlaXpirit_ | btw str[0 .. -4] should probably also return empty string |
02:12:46 | EXetoC | or just any negative value that is not a compile-time value? |
02:13:26 | BlaXpirit_ | the thing is, we already allow slices to go out of bounds |
02:13:32 | EXetoC | BlaXpirit_: that is what I was suggesting |
02:15:12 | Araq | good night |
02:15:16 | BlaXpirit_ | 4:15 AM, it's probably time to go |
02:15:23 | EXetoC | gah |
02:15:36 | BlaXpirit_ | y u do dis, why alwats so late |
02:17:14 | EXetoC | first you say it's stupid and then you basically say the same thing as I do. I'm confused |
02:17:43 | BlaXpirit_ | I understand that you suggest to change only -1 as special case |
02:19:10 | EXetoC | maybe other negative values too, not sure, but I am not referring to any interval changes |
02:22:44 | Varriount|Busy | I dislike 'special cases' like these - they only complicate the mental model programmers have to maintain when writing code. |
02:22:55 | BlaXpirit_ | special cases are not good for sure |
02:25:34 | * | jefus_ joined #nim |
02:27:07 | * | Varriount|Busy quit (Ping timeout: 246 seconds) |
02:27:34 | EXetoC | Varriount|Busy: it's a small change that solves one of his issues that he has, vs a change which might solve a couple of other issues, but is really intrusive, with or without a migration path, imo |
02:28:13 | BlaXpirit_ | EXetoC, you think special-casing -1 is a small change? |
02:29:13 | BlaXpirit_ | I've already said, people are not too unlikely to rely on -1 as well: someSeq[4:-1] # discard first 4 items |
02:29:27 | BlaXpirit_ | I've already said, people are not too unlikely to rely on -1 as well: someSeq[4 .. -1] # discard first 4 items |
02:29:28 | BlaXpirit_ | rather |
02:29:33 | * | jefus quit (Ping timeout: 276 seconds) |
02:29:48 | BlaXpirit_ | this will cause more problems |
02:31:20 | fowlmouth | ..? which people do you speak for exactly |
02:31:35 | EXetoC | true, but you think it's just as intrusive? what about "for x in a .. a" with your proposed interval changes? would this now iterate 0 times? it would be related. Araq barely even discussed changing the intervals though |
02:31:55 | BlaXpirit_ | i do not propose any interval changes |
02:34:25 | BlaXpirit_ | i still recognize only 2 options: completely removing special meaning of negative indices or leaving 100% backwards compatibility and introducing an alternative operator that works correctly |
02:34:38 | fowlmouth | 3. do nothing |
02:34:41 | EXetoC | ok but what is it that will yield an empty string? when slicing |
02:34:58 | BlaXpirit_ | alternative operator |
02:35:14 | BlaXpirit_ | "abc"[0 .! -1] == "" |
02:35:23 | BlaXpirit_ | sure, this is ugly, but just an example |
02:35:55 | BlaXpirit_ | "abc"[0 .! -5] == "" or maybe an error. whatever, doesnt matter |
02:35:56 | EXetoC | ok so then you need a new slice type, right? |
02:36:28 | BlaXpirit_ | EXetoC, that, or workarounds as shown in my gist |
02:36:48 | BlaXpirit_ | you may have seen that branched proc `.!` - it works without any changes to the language |
02:37:18 | BlaXpirit_ | (0 .! -1) == (1 .. 0) |
02:37:28 | BlaXpirit_ | that's the gist of it :s |
02:37:43 | fowlmouth | this all so that str[0 .. find(str,"q")] returns "" if there is no q -_- |
02:37:59 | BlaXpirit_ | it also removes negative indices completely |
02:38:27 | BlaXpirit_ | fowlmouth, that is definitely not what i had in mind |
02:38:31 | fowlmouth | why? the programming languages i'm familiar with work like this |
02:38:39 | EXetoC | so, "for x in 0 .! x.high" too? otherwise it'll get confusing |
02:39:10 | BlaXpirit_ | (0 .! x.high) == (0 .. x.high) for nonnegative indices |
02:39:27 | BlaXpirit_ | fowlmouth, what are u talking about |
02:39:36 | EXetoC | but if x.high yields -1 |
02:39:53 | BlaXpirit_ | then it translates to (1 .. 0) |
02:40:26 | BlaXpirit_ | fowlmouth, there is no language that doesn't let you get an empty slice from the beginning of a string/seq |
02:40:42 | fowlmouth | current behavior is more desirable than having your one-liner work |
02:40:46 | BlaXpirit_ | and that shortcut you've demonstrated is stupid, as i've said on multiple occasions |
02:40:55 | BlaXpirit_ | fowlmouth, why are you doing this to me |
02:40:59 | EXetoC | yes but it affects "iterator `..`" hence why it's a bigger change than mine |
02:41:07 | BlaXpirit_ | i'm almost shouting inside my brain |
02:41:08 | fowlmouth | i dont go in #python and not shutup about the things i want them to change |
02:41:35 | BlaXpirit_ | EXetoC, how can 0 changes to the language change iterator `..` |
02:41:50 | BlaXpirit_ | fowlmouth, you fell for it |
02:41:54 | fowlmouth | you're being annoying BlaXpirit_ , your ideas are "better" mine are "stupid", buzz off |
02:42:11 | BlaXpirit_ | fowlmouth, you're being annoying |
02:42:17 | BlaXpirit_ | [:37:02] <fowlmouth> this all so that str[0 .. find(str,"q")] returns "" if there is no q -_- |
02:42:27 | BlaXpirit_ | no, it is definitely not what we've been talking about |
02:42:37 | fowlmouth | welcome to /ignore, please return the favor |
02:42:39 | BlaXpirit_ | how about you read https://github.com/Araq/Nim/issues/1979 |
02:42:39 | EXetoC | BlaXpirit_: but one must migrate eventually |
02:43:05 | EXetoC | unless you make "for i in 0 .. -1" fail immediately, in which all hell breaks loose |
02:45:47 | BlaXpirit_ | I just wish fowlmouth would actually look at what we're talking about before making things up |
02:48:28 | BlaXpirit_ | so he tries to pose some stupid shortcut as the reason of this whole talk, to pose it as my idea, but i call the supposedly mine idea stupid, and he gets angry at that? i don't get it |
02:49:33 | EXetoC | bad forum or not, eventually I get confused on IRC, but that might just be me |
02:49:41 | * | yonson joined #nim |
02:49:58 | BlaXpirit_ | definitely has been very confusing |
02:50:20 | BlaXpirit_ | but you saw that Araq said he didn't read the issue page |
02:50:24 | BlaXpirit_ | and neither did fowlmouth |
02:50:26 | BlaXpirit_ | so there's that |
02:51:10 | flaviu | I find it best to just take a step back and do something else when someone is being irritating. |
02:51:35 | gmpreussner | o hai. looks like i missed the party! |
02:51:54 | EXetoC | yes. I just get stubborn, but let's talk again tomorrow. just try to make your case in one go with examples and such |
02:52:29 | flaviu | Post it on the forum, it's more convenient than backlogging on IRC. |
02:52:42 | EXetoC | and not a huge stack of individual sentences. I'll do the same |
02:53:19 | BlaXpirit_ | 3rd instance of the discussion is not what we need |
02:53:26 | BlaXpirit_ | issues page is totally fine |
02:53:32 | BlaXpirit_ | if only people actually used it |
02:58:39 | EXetoC | str[0 .! -1] -> "", and then *maybe* eventually str[0 .. -1] -> "" (migration)? ok |
03:00:01 | * | rpag quit (Quit: Leaving) |
03:00:30 | * | darkf joined #nim |
03:00:47 | BlaXpirit_ | i just shouldn't have brought up this workaround, because it introduced way too much confusion |
03:01:07 | BlaXpirit_ | that implementation of .! is definitely ugly |
03:04:52 | EXetoC | well I was talking about the exact same thing, yet you seemed to disagree |
03:05:23 | BlaXpirit_ | confusion on top of confusion |
03:05:39 | EXetoC | -.- |
03:08:46 | * | BlaXpirit_ quit (Quit: Quit Konversation) |
03:21:39 | * | yonson quit (Quit: Leaving) |
03:55:22 | * | brson quit (Quit: leaving) |
03:55:57 | * | brson joined #nim |
03:59:14 | benji | "violent agreement" ;) |
04:27:22 | * | BitPuffin quit (Ping timeout: 240 seconds) |
04:29:05 | dtscode | hey dom96, so i would like to clarify something about your answer to my forum post |
04:30:01 | dtscode | so if i have $ProjectRoot, which contains the nim file with the jester routes, and then i have $ProjectRoot/public/css. that corresponds to site.tld/css? |
04:30:02 | * | saml_ quit (Remote host closed the connection) |
04:37:36 | * | badkins quit (Remote host closed the connection) |
05:15:14 | * | EXetoC quit (Ping timeout: 245 seconds) |
05:38:12 | * | brson quit (Ping timeout: 245 seconds) |
06:14:20 | * | brson joined #nim |
06:57:27 | * | gunn quit (Ping timeout: 272 seconds) |
06:57:36 | * | gunn joined #nim |
07:05:49 | * | gokr quit (Quit: Leaving.) |
07:06:14 | * | SplinterOfChaos quit (Ping timeout: 265 seconds) |
07:28:52 | * | fowlmouth quit (Quit: Leaving) |
08:04:20 | * | gokr joined #nim |
08:04:31 | * | gokr quit (Read error: Connection reset by peer) |
08:04:54 | * | gokr joined #nim |
08:17:30 | * | lws quit (Read error: Connection reset by peer) |
08:19:03 | * | brson quit (Quit: leaving) |
08:29:02 | * | mafm joined #nim |
08:35:30 | * | vendethiel quit (Ping timeout: 246 seconds) |
08:36:54 | * | vendethiel joined #nim |
08:37:25 | Triplefox | is it possible to access the contents of an exception as an object from the except: block? |
08:40:00 | Triplefox | oh, getCurrentException() |
08:42:24 | * | lws joined #nim |
08:42:24 | * | lws quit (Changing host) |
08:42:24 | * | lws joined #nim |
08:51:38 | * | jpoirier quit (Read error: Connection reset by peer) |
09:01:42 | * | gunn quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
09:02:17 | * | mafm quit (Quit: Page closed) |
09:03:30 | * | gokr quit (Quit: Leaving.) |
09:03:58 | * | lws quit (Read error: Connection reset by peer) |
09:05:35 | * | JinShil quit (Read error: No route to host) |
09:08:01 | * | JinShil joined #nim |
09:20:19 | * | akiradeveloper joined #nim |
09:22:30 | akiradeveloper | Hi, some names type, block and end are forbidden to use because they are reserved by compiler. Is there workaround? I use them as members in type (fuse has such types) |
09:24:27 | reactormonk | akiradeveloper, you could always go with End, or rather use end_ |
09:24:45 | reactormonk | so object ... end_: int {.importc: "end".} |
09:25:39 | akiradeveloper | underscore is forbidden too? |
09:25:48 | reactormonk | oh right -.- |
09:26:28 | reactormonk | not sure what the convention is here |
09:27:01 | reactormonk | akiradeveloper, you could go for End for now |
09:27:18 | reactormonk | Araq, what's the convention when you have an {.importc.} variable that's called "end"? |
09:27:27 | akiradeveloper | I tried End for end but it doesn't fit for me |
09:28:04 | akiradeveloper | so now, I stay it m_end |
09:28:10 | reactormonk | kk |
09:29:00 | * | gunn joined #nim |
09:43:16 | akiradeveloper | Adding *(star) to symbol exports it but tedious if all the symbols to be exported. Is there workaround? such as exporting all symbols within the file or in some range. |
09:50:56 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
10:11:46 | reactormonk | akiradeveloper, nope |
10:15:35 | * | MyMind quit (Read error: Connection reset by peer) |
10:16:19 | * | Pisuke joined #nim |
10:33:15 | Araq | akiradeveloper: you can use `end` in backticks, but admittedly it's not very nice to use |
10:44:14 | * | BlaXpirit joined #nim |
10:54:49 | * | gmpreussner_ joined #nim |
10:55:25 | * | gmpreussner quit (Ping timeout: 244 seconds) |
11:12:48 | * | Trustable joined #nim |
11:13:44 | * | yonson joined #nim |
11:19:06 | * | gokr joined #nim |
11:24:32 | gokr | Hey fellas |
11:26:57 | ekarlso | hey gokr :) |
11:27:08 | gokr | Halloj :) |
11:27:21 | gokr | Was just about to set up a Pluto planet for Nim |
11:27:45 | gokr | Sitting in "Leo land" - a play center for kids. So I got 3h I think :) |
11:30:30 | * | akiradeveloper quit (Remote host closed the connection) |
11:30:34 | * | skyfex joined #nim |
11:34:24 | ekarlso | https://bpaste.net/show/1ea8a6fa1252 < should I just change my stuff there |
11:34:33 | ekarlso | to always use "json" vs direct types ? |
11:34:39 | ekarlso | I guess it would simplify it alot |
11:39:45 | Triplefox | sprite packer progress https://vine.co/v/OjpFEzdlFF7 |
11:42:16 | gokr | Oh, you are working on the packing problem? |
11:42:43 | gokr | I once built an advanced tool for optimizing cutting out complicated shapes out of boards. |
11:43:00 | Triplefox | i'm not doing anything original, just taking a simple scanline algorithm recommended by a stackoverflow thread |
11:43:16 | gokr | You only deal with rectangles or? |
11:43:36 | Triplefox | yeah, this is used to make optimal texture atlases for games |
11:43:47 | gokr | Yeah, I get it. |
11:44:00 | gokr | We used ant colony heuristics |
11:44:11 | gokr | As the overall driving algorithm. |
11:44:14 | Triplefox | oh, that sounds interesting |
11:44:28 | gokr | Yeah, a very cool algorithm - and fun to implement. |
11:44:42 | gokr | Imitating how ants find the shortest paths |
11:48:58 | gokr | Triplefox: http://en.wikipedia.org/wiki/Ant_colony_optimization_algorithms |
11:49:23 | gokr | You can google for like "aco ant colony optimization bin packing problem" or something. |
11:49:31 | gokr | Also known as the cutting stock problem |
11:50:52 | gokr | The algorithm we used basically imitates the initially "random search" a swarm of ants do when running around looking for food. Then eventually their dropped pheromone trails will reinforce the shortest paths between the food and the stack - and eventually all the ants will follow that trail. |
11:51:21 | * | gmpreussner__ joined #nim |
11:51:40 | * | VinceAddons joined #nim |
11:51:44 | * | gmpreussner_ quit (Ping timeout: 244 seconds) |
11:52:35 | Triplefox | all this algorithm does is walk left to right, top to bottom, placing rectangles in largest to smallest order. most of the fun in it is optimization but i'm probably going to leave it as is since i'm not aiming for realtime |
11:53:31 | Triplefox | good night |
11:56:33 | gokr | nite |
11:58:43 | * | JinShil quit (Quit: Konversation terminated!) |
12:03:02 | * | JinShil joined #nim |
12:19:00 | * | akiradeveloper joined #nim |
12:29:39 | * | darkf quit (Ping timeout: 246 seconds) |
12:35:37 | dom96 | dtscode: yes |
12:41:12 | akiradeveloper | Thanks Araq. I will go with the backticks solution |
12:42:37 | * | darkf joined #nim |
12:44:34 | dom96 | akiradeveloper: The way we usually get around this is to prefix the field name with 'the', i.e. 'theEnd' |
12:45:41 | BlaXpirit | how dramatic |
12:46:17 | flaviu | I promised to write something to someone in here, but it was a few days and I can't track it down in the logs. |
12:49:12 | akiradeveloper | I like the backticks solution but if Nim compiler eventually discard it, I will settle in the "the" plan |
12:53:41 | * | akiradeveloper quit () |
12:55:02 | * | x4nt quit (Quit: WeeChat 1.0.1) |
12:57:34 | flaviu | How does genmapping work? |
12:58:24 | Araq | it outputs the list of C files for niminst |
12:58:51 | Araq | it used to write some identifier mapping too but iirc I disabled that since it's of no use |
13:31:45 | gokr | Playing with Pluto: http://padme.krampe.se/planetnim/nim.html |
13:32:06 | gokr | So ... anyone with a Nim feed - tell me :) |
13:33:38 | dom96 | oh yay, my blog is there already :) |
13:33:50 | def- | gokr: looks like mine is in as well^^ |
13:34:04 | gokr | def-: Hookrace? |
13:34:07 | def- | yes |
13:34:18 | gokr | I picked those I kinda knew :) |
13:34:35 | gokr | So... this pluto tool is very ... configurable. |
13:34:48 | Araq | ha my blog is not there |
13:34:55 | gokr | I will see where I end up, there are lots of templates - and you can even drive output into Jekyll. |
13:35:04 | gokr | Araq: It would have been if you had a visible feed |
13:35:15 | gokr | I couldn't see the feed |
13:35:17 | Araq | I'm not "blogging" anymore |
13:35:19 | gokr | Perhaps I am blind :) |
13:36:10 | Araq | skyfex: I hope you know about vm.echoDebugCode? |
13:36:45 | skyfex | Araq: No, I didn't. Thanks for the tip :) |
13:37:43 | gokr | dom96: This is a meta planet using pluto - you can try several templates there (upper right corner): http://planetweb.herokuapp.com |
13:38:31 | def- | Araq: I need some pointers to continue tcc-repl |
13:38:35 | dom96 | gokr: You should change the link to the build bot to: http://buildbot.nim-lang.org |
13:38:55 | gokr | Oh, nice :) |
13:39:04 | gokr | I had missed that it was pointing correctly |
13:39:15 | gokr | Which reminds me - we should try to dig out some macs |
13:39:35 | def- | Araq: When I have two lines "var x = 1" and "echo x", how do I get x to be of the right type in the second one? |
13:39:37 | gokr | I have one, but... I use it :) |
13:40:22 | Araq | skyfex: how did you find the bug then? o.O |
13:40:30 | gokr | Ron may have a mac we could use - we will need to have a builder for mac for our purposes anyway. |
13:40:45 | Araq | I enabled echoDebugCode, looked at the bytecode and saw the problem :-) |
13:41:29 | Araq | def-: sem.fitNode |
13:41:38 | Araq | or similar |
13:42:07 | dom96 | Araq: Could you please put these tips onto a "Debugging the compiler" wiki page? |
13:42:39 | skyfex | Araq: Well, the stack trace showed where the bug occured, and I read the code enough to see that instructions that would insert something into a register would sometimes call `myreset`, it was a bit of a guess, which is why I said to review it carefully before merging ;) |
13:43:29 | flaviu | dom96: btw, the syntax cheatsheet on the forum is using the wrong domain. |
13:43:46 | dom96 | flaviu: create an issue |
13:43:53 | dom96 | or better yet a PR |
13:43:59 | Araq | dom96: also the syntax cheatsheet should use forum/rst.html |
13:45:26 | dom96 | https://github.com/nim-lang/nimforum/issues |
13:46:19 | gokr | This is another template btw: http://padme.krampe.se/planetnim/nim.top.html |
13:50:23 | * | BitPuffin joined #nim |
13:51:51 | def- | gokr: looks very different |
13:52:25 | gokr | hehe, yeah. |
13:52:51 | def- | something goes wrong in the first one btw |
13:53:00 | def- | from your second post on everything is monospace |
13:53:44 | ekarlso | yay |
13:53:52 | ekarlso | so jwt auth for packages is now fixed :p |
13:54:01 | ekarlso | all done in nim (: |
13:54:25 | ekarlso | I started hacking on a play.rust-lang.org alike thing for nim also using docker |
13:54:51 | ekarlso | idea could be to have a "executor" that listens for incoming snippets to execute and act as a backend for Mimbus as well as the webpage |
13:57:08 | def- | ekarlso: that would be really useful to have |
13:57:50 | ekarlso | could probably link it to github accounts as well |
13:57:57 | ekarlso | so that people could have their "snippets" show up |
13:57:58 | flaviu | ldlework: https://gist.github.com/487be89b8abfae2612e8 |
13:59:08 | * | benji quit (Quit: leaving) |
14:01:57 | Araq | def-: why do you need to touch semantic checking? |
14:02:37 | def- | Araq: i guess because I don't understand how the whole repl thing would work |
14:03:43 | def- | when the user enters a new piece of code, would I just translate that piece to C? Or that piece and everything before it? |
14:03:55 | def- | Now I guess it's the latter, and I have to goto the right position |
14:04:01 | Araq | that and everything before it |
14:04:14 | Araq | you don't have to go to the right position |
14:05:11 | def- | but you don't want the old lines to be executed when you enter a new one |
14:05:42 | Araq | uh oh, that's a good point lol |
14:05:56 | Araq | that completely escaped me :-) |
14:06:14 | Araq | so yeah |
14:06:42 | Araq | you want to keep procdefs etc but not top level 'echo' statements |
14:07:08 | * | EXetoC joined #nim |
14:07:40 | def- | also don't want to keep calculations |
14:08:04 | Araq | yeah, only declarative stuff |
14:15:09 | Araq | and the stuff in globals need to be kept. most important feature of a REPL |
14:25:20 | * | jefus__ joined #nim |
14:28:43 | * | jefus_ quit (Ping timeout: 245 seconds) |
14:29:18 | * | gokr quit (Quit: Leaving.) |
14:40:13 | sillesta | is there any way to get the number of references a ref variable has? |
14:40:44 | * | JinShil quit (Quit: Konversation terminated!) |
14:43:21 | Araq | sillesta: system.getRefcount but don't use it for anything except debugging |
14:43:43 | Araq | and even then it only counts the references in the heap |
14:57:34 | * | ARCADIVS quit (Quit: ARCADIVS) |
15:01:25 | * | jpoirier joined #nim |
15:51:39 | BlaXpirit | "importcing macros is extremely problematic" - is this still true? |
15:54:48 | * | gokr joined #nim |
16:08:14 | * | gsingh93 joined #nim |
16:12:45 | * | gokr quit (Quit: Leaving.) |
16:15:03 | * | gmpreussner___ joined #nim |
16:15:45 | * | gmpreussner__ quit (Ping timeout: 244 seconds) |
16:31:06 | * | darkf quit (Quit: Leaving) |
16:33:54 | * | sdw quit (Ping timeout: 276 seconds) |
16:35:39 | * | yonson quit (Ping timeout: 252 seconds) |
16:46:57 | Demos | BlaXpirit, probably |
16:47:14 | * | davidhq joined #nim |
16:51:30 | * | gmpreussner joined #nim |
16:51:55 | * | gmpreussner___ quit (Ping timeout: 244 seconds) |
16:53:34 | * | BlaXpirit_ joined #nim |
16:56:33 | * | BlaXpirit quit (Ping timeout: 252 seconds) |
17:02:59 | * | sepisoad joined #nim |
17:11:02 | * | sepisoad quit (Ping timeout: 244 seconds) |
17:17:10 | * | def- quit (Ping timeout: 265 seconds) |
17:33:37 | * | SplinterOfChaos joined #nim |
17:58:13 | * | def- joined #nim |
17:58:40 | flaviu | How about reserving the nimblepkg.ext for unofficial extensions to whatever package that is? |
18:02:36 | * | CARAM__ quit (Ping timeout: 265 seconds) |
18:07:33 | * | CARAM__ joined #nim |
18:11:03 | * | Matthias247 joined #nim |
18:19:27 | ekarlso | flaviu: ? |
18:19:36 | flaviu | ekarlso: hi |
18:25:28 | ekarlso | what about nimblepkg.ext ? ^ |
18:25:32 | Araq | BlaXpirit_: why is that problematic? |
18:26:23 | BlaXpirit_ | Araq, https://github.com/Araq/Nim/blob/devel/lib/pure/math.nim#L210 |
18:27:05 | Araq | BlaXpirit_: ah ok, that's a windows related problem though |
18:28:03 | * | gmoore quit (Ping timeout: 246 seconds) |
18:28:19 | * | silven joined #nim |
18:29:16 | BlaXpirit_ | Araq, so without knowing RAND_MAX I can't do anything |
18:29:24 | BlaXpirit_ | with that int(rand()) mod max |
18:29:52 | def- | BlaXpirit_: export rand_max as a constant in math.nim? |
18:30:16 | BlaXpirit_ | def-, that sure seems good, but it is not available currently, at all |
18:30:30 | BlaXpirit_ | when defined(windows): const rand_max = 32767 |
18:30:38 | BlaXpirit_ | that's all there is. no rand_max on linux |
18:30:51 | flaviu | ekarlso: Create conventions where creating an extension package for a certain nimble package is possible. |
18:30:58 | BlaXpirit_ | although maybe then i could base it on drand48 |
18:31:12 | flaviu | ekarlso: I'm proposing that the *.ext.* namespace be open for that |
18:31:19 | def- | BlaXpirit_: there is a RAND_MAX on other systems too I believe |
18:31:27 | def- | BlaXpirit_: can't you get that into nim? |
18:31:31 | BlaXpirit_ | def-, see [:25:42 |
18:31:46 | def- | aaah |
18:31:55 | BlaXpirit_ | i'm just not sure |
18:32:03 | flaviu | BlaXpirit_: Why do you need to use that random? The spec makes no guarantees on the quality. |
18:32:07 | * | gmoore joined #nim |
18:32:17 | BlaXpirit_ | flaviu, i want to finally fix that random function |
18:32:27 | BlaXpirit_ | so it does not have a glaring bug |
18:32:45 | BlaXpirit_ | having a good RNG library separate from stdlib seems reasonable |
18:36:07 | def- | BlaXpirit_: i guess we can't just assume 2^32-1? |
18:36:35 | BlaXpirit_ | def-, i dunno |
18:37:33 | BlaXpirit_ | it is 2^31-1 here :| |
18:37:51 | Araq | BlaXpirit_: just use range[1..10_000] |
18:38:00 | Araq | you *can* do: |
18:38:02 | BlaXpirit_ | Araq, that's arbitrary |
18:38:16 | Araq | var RAND_MAX {.importc, header: "...".}: cint |
18:38:28 | Araq | but then it's a var and you cannot 'range' over that |
18:38:47 | Araq | so it's worse |
18:39:09 | Araq | it's not arbitrary, you can put it into an assert if you are so concerned |
18:39:19 | BlaXpirit_ | Araq, i was starting to think about gathering more entropy by doing multiple calls to it....... |
18:39:21 | * | CARAM__ quit (Ping timeout: 276 seconds) |
18:39:24 | Araq | assert RAND_MAX >= 10_000 |
18:40:51 | Araq | also for the use cases that I have in mind, I'd rather have random() as fast as possible |
18:41:21 | EXetoC | so a default one with an arbitrary quality? |
18:41:47 | flaviu | Araq: random() is a poor choice for speed. |
18:42:14 | BlaXpirit_ | https://github.com/Araq/Nim/blob/devel/lib/pure/math.nim#L222 - this line is just filled with problems |
18:42:25 | flaviu | Use a LCG with 96-128 bits state instead. |
18:42:41 | BlaXpirit_ | first of all, yeah, RAND_MAX 32k, but it is also not uniformly distributed!!! |
18:43:03 | def- | BlaXpirit_: that sounds like a bad random number generator |
18:43:35 | BlaXpirit_ | random(24000) has twice higher chance to give 10000 than 20000 |
18:43:46 | BlaXpirit_ | approximately.. |
18:43:53 | BlaXpirit_ | on Windows, of course |
18:44:03 | BlaXpirit_ | Araq, so just limiting the range is not good either |
18:45:36 | Araq | BlaXpirit_: so how does Ansi C think the function that returns something in 0..RAND_MAX-1 *should* be used? |
18:45:53 | BlaXpirit_ | no clue |
18:46:01 | BlaXpirit_ | with high enough RAND_MAX it's barely good enough |
18:46:04 | BlaXpirit_ | but 32k is a joke |
18:46:42 | Araq | because modulo that number is what's commonly taught |
18:46:52 | flaviu | Araq: Common teaching is wrong |
18:46:59 | BlaXpirit_ | modulo is sad |
18:47:01 | flaviu | It introduces significant biases |
18:47:17 | Araq | flaviu: yes, I can see why. |
18:47:21 | Araq | hence my question |
18:48:06 | flaviu | I didn't see the question, sorry. I use this code: https://github.com/flaviut/furry-happiness/blob/master/rand.nim#L7-L30 |
18:48:16 | BlaXpirit_ | uh guys, what about http://msdn.microsoft.com/en-us/library/sxtz2fa8.aspx |
18:48:56 | flaviu | BlaXpirit_: What's the point? |
18:49:11 | BlaXpirit_ | then it will work on windows approximately the same as on linux |
18:49:13 | BlaXpirit_ | for a quick fix |
18:49:34 | flaviu | ah, ok. Sounds good. |
18:50:10 | BlaXpirit_ | ahh it's not good probably... it says "cryptographicslly secure random numbers" |
18:50:28 | BlaXpirit_ | that's a different beast, maybe something like CryptGenRandom, which is something like /dev/urandom |
18:50:47 | def- | Araq: I think you're supposed to use it with modulo, but much smaller modulos than rand_max. then it doesn't matter as much |
18:52:01 | flaviu | def-: Modulo is never correct unless except where ln2(n) is an int. |
18:52:19 | BlaXpirit_ | i dunno... what about just exposing rand and RAND_MAX and letting people do whatever they want with this? (deprecate all functions on top of it) |
18:53:11 | Araq | BlaXpirit_: that just pushes the bugs around |
18:53:22 | BlaXpirit_ | the point is, |
18:53:39 | BlaXpirit_ | not to have a function that says it returns a random number from a to b, but actually does something very different |
18:53:57 | Araq | people will use 'mod' then on top and get the same bugs |
18:54:04 | BlaXpirit_ | their problem |
18:54:19 | BlaXpirit_ | at least they will know that RAND_MAX is a thing |
18:54:21 | Araq | that's C's philosophy, not Nim's. |
18:54:36 | flaviu | How about getting rid of rand in that module completely? |
18:54:41 | BlaXpirit_ | well Nim currently has a bug in the implementation and i dont see how to fix it |
18:54:48 | flaviu | and instead tell people to go to nimble. |
18:54:57 | BlaXpirit_ | flaviu, what would people think of a language that can't give them a random number? |
18:55:24 | Araq | flaviu: I like this idea. |
18:55:33 | Araq | random numbers are hard |
18:55:36 | BlaXpirit_ | well sure, it's pretty nice |
18:55:47 | BlaXpirit_ | i didn't think such a suggestion would get any support |
18:55:58 | BlaXpirit_ | (think of existing code, yadda yadda) |
18:56:10 | Araq | BlaXpirit_: well we have .deprecated |
18:56:11 | flaviu | BlaXpirit_: How will people think of a language that claims to give them a random number but instead gives them the RFC 1149.5 random number? |
18:56:29 | def- | BlaXpirit_: if you make a simple interface that works the same way, then the only change required is an additional import, no? |
18:56:58 | BlaXpirit_ | well it definitely doesn't have the same API |
18:58:10 | BlaXpirit_ | but man, i'm starting to doubt my library more and more |
18:58:15 | flaviu | I Java gets along on a shitty 64/48 LCG, I have no idea why people put up with that. |
18:58:37 | * | flan3002 left #nim ("Have an awesome day!") |
19:09:39 | * | CARAM__ joined #nim |
19:10:34 | * | joecodes quit (Remote host closed the connection) |
19:11:58 | * | Matthias247 quit (Quit: Matthias247) |
19:17:55 | * | Matthias247 joined #nim |
19:18:30 | * | nimnoob joined #nim |
19:19:36 | * | alexruf joined #nim |
19:31:17 | * | jefus joined #nim |
19:31:47 | * | nimnoob quit (Remote host closed the connection) |
19:32:45 | * | jefus__ quit (Ping timeout: 252 seconds) |
19:39:05 | * | gmpreussner_ joined #nim |
19:39:50 | * | gmpreussner quit (Ping timeout: 244 seconds) |
19:48:26 | * | nimnoob joined #nim |
20:06:39 | * | johnsoft quit (Ping timeout: 264 seconds) |
20:07:26 | * | johnsoft joined #nim |
20:08:33 | * | Varriount|Laptop joined #nim |
20:08:57 | Varriount|Laptop | dom96, Araq: just so you know, the windows builders might be down for the rest of the day. |
20:09:34 | reactormonk | Araq, how exactly are object: fields different from tuple[fields]? |
20:09:41 | Varriount|Laptop | There's some error on the internal RAID array that my desktop computer runs off of, and I'm trying to find out more about the problem. |
20:10:05 | Araq | Varriount|Laptop: ok... that sound bad |
20:10:22 | Araq | these long running tests crashed your harddrive? |
20:10:48 | Araq | reactormonk: tuple fields are all public. |
20:10:56 | reactormonk | Araq, ok. |
20:11:11 | Araq | also tuples use structural typing, objects use nominal typing rules |
20:11:20 | reactormonk | Which means? |
20:11:45 | Araq | type |
20:11:55 | Araq | T1 = tuple[a: int] |
20:11:58 | Araq | T2 = tuple[a: int] |
20:12:07 | Araq | T1 compatible to T2 |
20:12:09 | Araq | type |
20:12:17 | Araq | O1 = object a: int |
20:12:25 | Araq | O2 = object a: int |
20:12:32 | Araq | O1 not compatible to O2 |
20:12:41 | reactormonk | Ok. |
20:13:23 | * | johnsoft quit (Ping timeout: 256 seconds) |
20:14:26 | * | johnsoft joined #nim |
20:15:27 | reactormonk | Any way I can run code after compiling to C, before invoking the GCC? I considered going via packaging for C and running it by modifing the packaging scripts |
20:16:45 | * | nimnoob quit (Ping timeout: 252 seconds) |
20:17:36 | Araq | reactormonk: I can think of all sorts of workarounds |
20:17:44 | Araq | but you really shouldn't do that |
20:18:19 | Araq | you can always influence compilation with .compile, .link, passL, passC |
20:21:09 | * | Mat4 joined #nim |
20:21:20 | Mat4 | hello |
20:21:33 | * | gmpreussner__ joined #nim |
20:21:41 | * | gmpreussner_ quit (Ping timeout: 244 seconds) |
20:25:22 | Araq | hi Mat4 |
20:25:43 | Mat4 | hi Araq, what's up today ? |
20:26:09 | Araq | bug #1940 is the only interesting bug left :-( |
20:29:20 | Mat4 | what's with the other bugs left ? |
20:29:34 | Araq | they are not interesting :p |
20:29:40 | Mat4 | *g* |
20:31:45 | * | Sphax joined #nim |
20:35:09 | * | Blamestros joined #nim |
20:36:12 | Mat4 | I'm working on kernel development this day |
20:36:56 | skyfex | Araq: I found out why the uint implicit conversion patch caused regressions.. It was because because the operations in the unsigned.nim module is defined using typeclasses instead of concrete types, which causes the uint->int conversion to be prioritized over the uint->SomeUnsignedInt |
20:37:48 | skyfex | Regardless of wether uint conversions should be implemented, that might need to be fixed if you want to define the integer operations in system.nim using typeclasses as well, it should cause similar issues |
20:38:34 | skyfex | *i mean IntLiteral->int over IntLiteral->SomeUnsignedInt |
20:40:04 | * | rpag joined #nim |
20:40:19 | skyfex | I might take a look at wether it's possible to change that prioritization without causing massive regressions |
20:40:39 | Araq | skyfex: I know. |
20:40:50 | skyfex | Ah, mkay :) |
20:41:09 | Araq | skyfex: it's a hard problem though |
20:41:25 | Araq | proc p[T: int](x: T) |
20:41:32 | Araq | matches as good as |
20:41:37 | Araq | proc p(x: int) ? |
20:41:52 | Araq | who knows what problems this causes then |
20:41:57 | * | Sphax quit (Quit: ZZZZZzzzzz) |
20:46:41 | * | Sphax joined #nim |
20:54:05 | flaviu | BlaXpirit_: What was the difference between my and your patches in https://github.com/Araq/Nim/pull/1855 ? |
20:54:45 | BlaXpirit_ | flaviu, ummm |
20:55:12 | Araq | flaviu: BlaXpirit_'s callback looks entirely different |
20:55:21 | BlaXpirit_ | main thing was, the array of matches is of limited size |
20:55:52 | BlaXpirit_ | length of array of matches equals number of matches, not just always 20 or something |
20:55:59 | BlaXpirit_ | otherwise it's pretty much objectively worse |
20:56:04 | flaviu | BlaXpirit_: Right, thanks. |
20:56:11 | Araq | and fyi I find these PRs with multiple commits really hard to follow |
20:57:04 | flaviu | https://github.com/Araq/Nim/pull/1855/files makes it look like it's a single commit. I guess I could squash them, but I'd like to keep BlaXpirit's name in the commit log |
20:57:19 | BlaXpirit_ | i dont care :| |
20:57:33 | Araq | oh nice! |
20:57:38 | Araq | wasn't aware of this view |
20:58:11 | flaviu | BlaXpirit_: Yeah, but when your code turns out to be totally broken, I get to blame you! ;) |
20:58:13 | BlaXpirit_ | it's a big mess, you shouldn't have added my patch :p |
20:58:22 | BlaXpirit_ | i think there is a lot of duplication |
20:58:46 | flaviu | BlaXpirit_: I know, I'm working on it. |
21:01:01 | * | Matthias247 quit (Read error: Connection reset by peer) |
21:05:18 | flaviu | BlaXpirit_: I don't think that code is correct. "a".match(re"(b)?") would return an array of length 0, but length 1 would be correct. |
21:06:50 | flaviu | Pcre does expose that information in fullinfo(pattern, INFO_CAPTURECOUNT) |
21:11:06 | ekarlso | is there plans to introduce namespacing for packages / module ? |
21:11:31 | def- | ekarlso: they have a namespace, you can use module.proc |
21:14:34 | Varriount|Laptop | Araq: I don't know yet. It might be the hard drives, it might be the motherboard or the power supply. |
21:15:17 | Varriount|Laptop | The intel raid firmware reported that a disk wasn't connected yesterday, however a reboot cleared the problem up. |
21:15:43 | Varriount|Laptop | Today, the problem returned, and after a reboot, both disks in the array were reported as disconnected. |
21:24:06 | * | zahary quit (Ping timeout: 246 seconds) |
21:27:53 | ekarlso | def-: but if a package has say a file called "claims.nim" and another dep has that file too then ? ^ |
21:31:50 | def- | ekarlso: import claims as claims2? |
21:39:12 | flaviu | ekarlso: You go an yell at that project. |
21:39:15 | flaviu | *and |
21:40:07 | flaviu | I also wouldn't consider it too harsh to remove it from nimble until it fixes it's namespacing. |
21:40:57 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
21:44:31 | ekarlso | flaviu: how come yell ? ;) |
21:48:41 | * | Trustable quit (Quit: Leaving) |
21:50:10 | * | alexruf quit (Quit: Textual IRC Client: www.textualapp.com) |
21:50:33 | Araq | again |
21:50:56 | Araq | multiple Nimble packages CAN have the same file/module |
21:51:17 | Araq | but within a Nimble package you need unique module names |
21:55:02 | * | rpag quit (Quit: Leaving) |
21:56:20 | Varriount|Laptop | Doesn't this kinda force you to use Nimble? |
21:56:52 | Araq | no, you can create as many fake nimble packages as you want |
21:57:04 | Araq | all it takes is a subdir with a .nimble file in it |
21:57:26 | ekarlso | Araq: so if two packages have the same module then ? how do you determine which one |
21:57:55 | def- | ekarlso: package.module i think |
21:58:06 | Araq | well the directory structure makes that clear |
21:59:39 | ekarlso | Araq: how so ? |
22:01:13 | Araq | packA/m.nim vs packB/m.nim ? how is it not obvious? |
22:01:50 | Araq | within packA when you refer to m guess what m is picked |
22:01:52 | BlaXpirit_ | if we have libA/awesome.nim, we write import awesome |
22:02:09 | BlaXpirit_ | so what would people do if they installed libB with awesome.nim |
22:03:19 | Araq | BlaXpirit_: I think/hope dom96 made it so that you import it as lib/awesome.nim |
22:03:39 | Araq | and not as awesome.nim unless you play with your --path explicitly |
22:03:50 | BlaXpirit_ | umm no |
22:04:36 | def- | i think it should be done as the sdl2 lib does it. there's a main sdl2.nim which you can import with "import sdl2". the sub-modules are in the directory sdl2, so you can "import sdl2.image" and so on |
22:04:56 | Araq | def-: exactly. |
22:04:58 | BlaXpirit_ | is that possible currently? |
22:05:03 | def- | yes |
22:05:14 | def- | libraries do it, just checked sdl2 |
22:05:19 | BlaXpirit_ | oh damn, and i did lame things |
22:05:26 | BlaXpirit_ | csfml, csfml_audio, csfml_graphics |
22:05:35 | def- | oh, i missed that =/ |
22:05:37 | BlaXpirit_ | i guess _ is not that much different from . but whatever |
22:05:43 | def- | yeah, would be a bit cleaner with . |
22:09:20 | * | Blamestros left #nim (#nim) |
22:10:07 | Varriount|Laptop | Hm. That's actually a neat trick. Perhaps it should be officially recommended? |
22:10:21 | def- | i think it was somewhere |
22:10:44 | * | gokr joined #nim |
22:10:58 | def- | http://nim-lang.org/manual.html#module-names-in-imports |
22:11:57 | EXetoC | not that doing sdl2/sdl2 is particularly annoying |
22:13:06 | Varriount|Laptop | def-: But that's the manual. And unfortunately, few people read the manual before writing a package. |
22:13:22 | Varriount|Laptop | Well, read the entire manual, anyway. |
22:13:33 | def- | the manual is pretty interesting though |
22:13:49 | def- | I think I read it top to bottom |
22:14:36 | Araq | the question is *when* did you read it. it's a living document ;-) |
22:14:49 | def- | Araq: yeah, i noticed that, half a year ago |
22:14:58 | def- | should read the git diff again |
22:15:18 | Araq | well not too many things were changed I think |
22:16:20 | Araq | everybody is afraid of touching this holy document for some reason |
22:16:38 | Araq | PRs for the tutorials are much more common |
22:19:13 | flaviu | Can someone merge https://github.com/nim-lang/packages/pulls ? |
22:19:33 | flaviu | #114 and #115 look ready. |
22:20:56 | Araq | why can't you merge it? |
22:21:46 | Varriount|Laptop | flaviu: Done. |
22:22:07 | * | Sphax quit (Quit: CYA!!) |
22:22:34 | Araq | flaviu: want write access? |
22:22:39 | BlaXpirit_ | yay |
22:22:49 | flaviu | Sure |
22:23:21 | Araq | you won't misuse your power, will you? |
22:23:46 | Araq | and you shall not annoy dom96 |
22:24:16 | def- | Araq: not going to stop with the biblical references, are you? |
22:24:38 | flaviu | of course I won't misuse my power, but I make no promises about annoying dom96. |
22:25:05 | flaviu | def-: the bible doesn't hold a monopoly on the world "shall" |
22:25:22 | def- | flaviu: alright |
22:28:17 | Araq | damn you. you're flaviu*t* for github |
22:28:35 | Araq | I invited some stranger instead |
22:28:39 | EXetoC | onoz |
22:29:26 | EXetoC | thou shalt not program in Java by choice |
22:29:41 | * | Boscop_ quit (Quit: Boscop_) |
22:30:49 | ekarlso | so what |
22:30:55 | ekarlso | do u want some kind of approval for packages ? |
22:32:10 | Araq | ekarlso: what do you mean? |
22:32:26 | flaviu | ekarlso: Not really approvals, but a quick glance to make sure everything is namespaced correctly. |
22:32:51 | ekarlso | flaviu: ok |
22:33:05 | ekarlso | flaviu: when you mean namespaced u mean uniq proc names etc + |
22:33:31 | flaviu | no, just that if the package is named foo, there are no files besides foo.* and foo |
22:34:39 | flaviu | Just enough oversight that it doesn't cause name conflicts with other packages. |
22:37:01 | EXetoC | just make sure that everything is in a sub-directory? |
22:38:27 | flaviu | This could and should be automated.. |
22:40:46 | ekarlso | flaviu: how so automated ? |
22:41:12 | * | yonson joined #nim |
22:41:25 | flaviu | ekarlso: https://docs.snap-ci.com/assets/images/non-retina/screenshots/pull-request-14fa4bea.png |
22:41:57 | flaviu | the green checkmarks show if it's valid. |
22:42:10 | ekarlso | flaviu: u mean when adding a new package ? |
22:42:35 | flaviu | yes. If it's not broken when the PR is sent, it's likely to stay non-broken. |
22:53:21 | * | MattAitc_ joined #nim |
22:58:42 | * | kniteli quit (Read error: Connection reset by peer) |
22:58:48 | Araq | hi MattAitc welcome |
23:09:20 | * | MattAitc_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
23:12:15 | * | MattAitc_ joined #nim |
23:32:15 | * | skyfex quit (Quit: (null)) |
23:33:04 | * | Varriount|Laptop quit (Ping timeout: 246 seconds) |
23:39:15 | ekarlso | how can you add a package locally to the compiler path? |
23:40:00 | * | skyfex joined #nim |
23:43:17 | flaviu | ekarlso: You can run nimble install in the directory and it gets added to the nimble package location. |
23:43:36 | ekarlso | flaviu: kewl |
23:45:30 | * | lws joined #nim |
23:45:30 | * | lws quit (Changing host) |
23:45:30 | * | lws joined #nim |
23:46:52 | * | lws_ joined #nim |
23:47:30 | ekarlso | gawd |
23:47:41 | ekarlso | is there a way to have the nim compiler not span binary files all over ? |
23:47:54 | def- | ekarlso: yes, you can specifiy the nimcache directory |
23:47:56 | ekarlso | my .gitignore becomes foobar :/ |
23:48:02 | ekarlso | def-: how ? :P |
23:48:19 | def- | just add nimcache to your .gitignore would also help |
23:48:39 | flaviu | ekarlso: https://github.com/Araq/Nim/blob/devel/.gitignore#L1-L4 |
23:48:41 | ekarlso | def-: it adds binary files to src/foo also for src/foo.nim.. |
23:48:54 | * | lws__ joined #nim |
23:48:58 | def- | nim --nimcache:/my/global/nimcache |
23:49:23 | def- | note that this will fail if you compile two nim programs at the same time |
23:49:26 | * | ekarlso hails flaviu |
23:49:29 | * | lws_ quit (Read error: Connection reset by peer) |
23:50:09 | * | lws quit (Ping timeout: 252 seconds) |
23:54:27 | * | MattAitc_ quit (Quit: Textual IRC Client: www.textualapp.com) |
23:56:03 | ekarlso | hmm, can you do like: let foo = case bar: of "foo": "y" ? |
23:56:21 | BlaXpirit_ | yes |
23:56:43 | ekarlso | awesome |
23:57:00 | BlaXpirit_ | not totally sure though |
23:57:15 | BlaXpirit_ | yup, works... not hard to try this |