00:00:01 | BlaXpirit_ | not funny -_- |
00:00:27 | Triplefox | ah yeah, it does cover that case where many apis will return a -1 if missing |
00:04:02 | Triplefox | ah yeah, it does cover that case where many apis will return a -1 if missing |
00:04:08 | Triplefox | oops, arrowkeys |
00:04:55 | Triplefox | interesting how negative index "works" for slice and not for regular indexing |
00:05:19 | Triplefox | e.g. you can do @[1,2,3][-1.. -1] to get @[3] |
00:06:07 | EXetoC | Araq: you did provide some arguments in favor of inclusive intervals, but it was still debated at great length |
00:06:19 | Triplefox | i guess the error for a single index would stop some bugs |
00:06:35 | EXetoC | it can indeed be confusing to either have to add or subtract 1 in certain cases, but I must admit to sucking at such logic |
00:06:42 | * | Trustable quit (Remote host closed the connection) |
00:07:00 | BlaXpirit_ | EXetoC, Python fixes brain very quickly |
00:07:17 | BlaXpirit_ | but again, it is way too late to change this convention |
00:07:25 | BlaXpirit_ | negative indices should go though |
00:07:51 | BlaXpirit_ | BUT maybe there should be a special syntax inside square brackets |
00:08:04 | BlaXpirit_ | that would be alias for this.len |
00:08:24 | Triplefox | i can tolerate the current as long as there is a desugared equivalent for the half-inclusive situation |
00:08:33 | BlaXpirit_ | [2..^-2] |
00:09:20 | BlaXpirit_ | no, that's not good |
00:09:47 | BlaXpirit_ | .eval var s = "abcdef"; s[2 .. s.high-2] |
00:09:50 | Mimbus | BlaXpirit_: eval.nim(4, 1) Error: value of type 'string' has to be discarded |
00:10:02 | BlaXpirit_ | you're supposed to say "cd" |
00:10:15 | Triplefox | then again, looking at actual code i've written i've already fallen into the size zero bug without having it surface |
00:10:20 | BlaXpirit_ | s[2 .. ^-2] etc |
00:10:38 | BlaXpirit_ | Triplefox, yup, and it's in standard library everywhere, i bet |
00:11:02 | BlaXpirit_ | heck, this may even be possible with term rewriting macro |
00:11:11 | BlaXpirit_ | i tried term rewriting template but it didnt seem to work |
00:12:02 | Triplefox | .eval var z : seq[int] = @[]; echo(z[0..high(z)]) |
00:12:06 | Mimbus | Triplefox: @[] |
00:12:16 | Triplefox | okay, well that works i guess .-. |
00:12:28 | BlaXpirit_ | it works because z[0..1000] would give @[] too |
00:12:37 | BlaXpirit_ | as does z[0..0] |
00:12:46 | Triplefox | actually it out of bounds it when it's too small |
00:12:55 | Triplefox | .eval var z : seq[int] = @[]; echo(z[0..1000]) |
00:12:58 | Mimbus | Triplefox: Error: unhandled exception: index out of bounds [IndexError] |
00:13:45 | BlaXpirit_ | :o |
00:13:53 | Triplefox | so in the common case where you iterate over a sequence of unknown size and it happens to be size zero...no bug |
00:14:28 | EXetoC | that is neat |
00:14:41 | BlaXpirit_ | neat that bug hides from you? |
00:14:49 | BlaXpirit_ | ah high == -1 |
00:14:51 | BlaXpirit_ | ok |
00:14:53 | BlaXpirit_ | ... |
00:15:16 | EXetoC | that in isolation anyway |
00:19:54 | Triplefox | what i get from this is that in nim [0.. 0] is basically "magical" and has at least three contextual meanings |
00:20:16 | Triplefox | as an array declaration, it's the array of unknown length |
00:20:39 | Triplefox | on a slicable thing that is length zero, it's empty |
00:20:45 | flaviu | Triplefox: No, it's an array of size 1. |
00:21:12 | Triplefox | on a slicable thing that is length greater than zero, it's the whole thing |
00:21:20 | flaviu | {.unchecked.} is of unknown length. |
00:21:52 | Triplefox | okay, then it has four meanings and who knows why you'd ever have an array of size 1 |
00:21:55 | BlaXpirit_ | .eval echo(newSeq[int]()[0..0]) |
00:21:59 | Mimbus | BlaXpirit_: Error: unhandled exception: index out of bounds [IndexError] |
00:22:07 | BlaXpirit_ | Triplefox, it's not magical |
00:22:20 | BlaXpirit_ | you wrote 0 .. -1 before thinking its 0 .. 0 |
00:22:38 | Triplefox | oh, you're right |
00:22:57 | BlaXpirit_ | inclusive indices :> |
00:23:13 | BlaXpirit_ | i did it! |
00:23:18 | BlaXpirit_ | term rewriting template |
00:23:46 | EXetoC | are they not supposed to keep the semantics? |
00:24:03 | BlaXpirit_ | term rewriting template in case negative indices are removed |
00:24:06 | flaviu | Yeah, the solution is worse than the problem IMO |
00:24:55 | BlaXpirit_ | imagine we removed negative indices. if you had s[1 .. -1], you make that s[1 .. ^ -1] |
00:25:27 | Triplefox | so then it's... array of size 1, array of unknown length(unchecked), whole if not empty, error if empty |
00:30:11 | Triplefox | good when you want an entire slice, then ugly in the case where you control the slice variables and have to insert emptyslice checks |
00:30:53 | Triplefox | "entire" = (everything in the original) |
00:31:35 | Triplefox | although it is still consistent... |
00:31:59 | Triplefox | .eval echo(@[1,2,3][1.. 0]) |
00:32:03 | Mimbus | Triplefox: @[] |
00:32:45 | dtscode | hey Araq... how do you get the compiler to compile .tmpl files/ |
00:33:53 | dom96 | dtscode: Just include them. |
00:34:09 | dtscode | thats it? huh |
00:34:15 | dtscode | thanks dom96 |
00:34:41 | BlaXpirit_ | https://gist.github.com/BlaXpirit/f063fe6706201504580d |
00:34:48 | BlaXpirit_ | "Replacement for negative indices" |
00:35:28 | dtscode | dom96, is there a page documenting .tmpl files? |
00:35:39 | dom96 | http://nim-lang.org/filters.html |
00:35:44 | dtscode | ty |
00:36:21 | BlaXpirit_ | so guys, what do you think? |
00:36:52 | flaviu | I don't like it, I think the better option is to use exclusive upper bounds. |
00:37:31 | def- | BlaXpirit_: looks like an abuse of Term rewriting. If you used this in a library, the user could disable TR. |
00:37:36 | BlaXpirit_ | flaviu, and break all existing code? |
00:37:51 | flaviu | BlaXpirit_: ye. |
00:37:57 | BlaXpirit_ | def-, whatever, then add it to compiler -___- |
00:38:17 | flaviu | I'm not actually proposing that the stdlib be changed |
00:39:03 | def- | BlaXpirit_: I'd just write a proc "sub" that behaves as you want |
00:39:15 | BlaXpirit_ | explain |
00:39:28 | BlaXpirit_ | ah x.sub |
00:39:29 | BlaXpirit_ | whatever |
00:39:44 | gunn | what am I doing wrong here? or is it a bug? https://gist.github.com/gunn/27e8ae56e5ffebc05a26 |
00:39:48 | BlaXpirit_ | the point of that thing i sent is to easily fix code |
00:40:02 | BlaXpirit_ | you can just add 1 symbol and everything is fixed |
00:40:29 | flaviu | did someone just get bitten by inclusive ranges? |
00:40:37 | BlaXpirit_ | nah it's just empty array |
00:41:08 | flaviu | gunn: 1 sec, let me check the source |
00:41:23 | BlaXpirit_ | flaviu, -_- |
00:41:54 | BlaXpirit_ | i'm telling you, just 0-row result |
00:42:33 | dtscode | oh wow... so this is kind of like c's preprocessor system |
00:44:25 | flaviu | BlaXpirit_: ah, "row number 0 is out of range 0..-1" is coming directly from postgres |
00:46:11 | Triplefox | i've now lost interest in thinking about slices |
00:47:27 | BlaXpirit_ | Araq, please do consider removing negative indices and introducing something like this syntax https://gist.github.com/BlaXpirit/f063fe6706201504580d to easily fix code that needs it |
00:47:52 | flaviu | please, not another symbol. |
00:48:04 | Varriount | ^ |
00:48:18 | BlaXpirit_ | yes, yes, ^ :p |
00:48:27 | BlaXpirit_ | can be anything else though |
00:48:39 | def- | gunn: the code looks ok to me. you don't need to pass user and pw? |
00:49:03 | BlaXpirit_ | def-, looks like 0 rows result |
00:49:15 | BlaXpirit_ | or maybe it's just because of previous error |
00:49:32 | gunn | def-, flaviu, BlaXpirit_: yes, the tweets table was empty, explaining most of the result |
00:49:34 | Varriount | Alternately, we could allow negative indices only for literals. |
00:49:41 | gunn | it works fine on a populated table |
00:49:47 | BlaXpirit_ | Varriount, naaah, that won't do |
00:50:00 | Varriount | Too much magic, I guess. |
00:50:02 | BlaXpirit_ | people sometimes need to just count from end -_- |
00:50:22 | BlaXpirit_ | all i'm saying is, these negative indices should be explicit |
00:50:30 | def- | gunn: still a strange error for an empty table |
00:50:49 | BlaXpirit_ | requiring a '^' is just one of the countless ways to achieve it |
00:52:10 | flaviu | ranges could also be less stupid. |
00:52:27 | BlaXpirit_ | no, they couldn't without breaking all the code |
00:52:28 | flaviu | ie, say if it should be exclusive or inclusive and if bounds wrap |
00:52:34 | BlaXpirit_ | for sure |
00:52:43 | BlaXpirit_ | that's what's good |
00:52:49 | * | brson quit (Quit: Lost terminal) |
00:52:50 | BlaXpirit_ | but it is impossible to introduce now |
00:52:55 | BlaXpirit_ | (not literally) |
00:52:57 | * | brson joined #nim |
00:53:08 | flaviu | rewrite rewrite :P |
00:54:08 | gunn | def: yes, it looks like it's returning an empty row as per https://github.com/Araq/Nim/blob/master/lib/impure/db_postgres.nim#L162-L163 I wonder why it would SIGSEV on trying to iterate over it? |
00:54:33 | BlaXpirit_ | you have 0 rows |
00:54:42 | BlaXpirit_ | you take the first of the 0 rows |
00:54:45 | BlaXpirit_ | do i need to continue |
00:55:03 | BlaXpirit_ | i probably do |
00:55:07 | gunn | BlaXpirit_: row.len == 11? |
00:55:13 | BlaXpirit_ | the pointer to 0 rows is not initialized |
00:55:23 | BlaXpirit_ | gunn, row.len is taken from database columns |
00:55:36 | BlaXpirit_ | it is stored separately for efficiency probably |
00:56:13 | BlaXpirit_ | so yeah, when you take uninitializedpointer[0] - that's where the error happens |
00:56:22 | gunn | So is this wrong: "If the query doesn't return any rows, this proc will return a TRow with empty strings for each column." ? |
00:56:36 | BlaXpirit_ | no, wait, i'm completely wrong here |
00:56:43 | Varriount | that was changed, I think |
00:56:49 | BlaXpirit_ | gunn, that may indeed be a bug |
00:57:24 | Varriount | IIRC, something was changed so that something regarding databases returned 'nil' instead of a string. I can't remember specifics |
00:57:33 | BlaXpirit_ | forget the part i said about pointers |
00:57:57 | flaviu | Varriount: When the DB contains null, it returns nil. |
00:58:01 | flaviu | instead of returning "" |
00:58:08 | Varriount | Ah, that was it, yeah. |
00:58:42 | * | BlaXpirit_ quit (Quit: Quit Konversation) |
01:27:26 | * | Demon_Fox joined #nim |
01:33:58 | * | JinShil joined #nim |
01:51:49 | dtscode | what does the standard filter do? |
01:56:03 | EXetoC | isn't it documented? |
01:57:36 | dtscode | i couldnt find it |
01:57:40 | dtscode | ill look again though |
01:58:39 | EXetoC | you mean stdtmpl here http://nim-lang.org/filters.html ? |
01:58:51 | EXetoC | oh, that |
01:59:05 | EXetoC | no idea. don't bother I guess |
01:59:20 | dtscode | ok. awesome |
01:59:42 | dtscode | and yeah i know what stdtmpl does. i was wondering what stdtmpl | standard does |
01:59:52 | dtscode | standardizes the html maybe. idk. oh well |
02:01:22 | EXetoC | the only reference I've found seems to indicate that it simply uses the standard syntax (rather than begin/end for example) |
02:01:34 | EXetoC | does |standard work? |
02:01:58 | dtscode | what do you mean? like appended to stdtmpl? or just |standard |
02:02:23 | EXetoC | stdtmpl|standard |
02:02:38 | EXetoC | strongspaces might work too |
02:03:03 | dtscode | itmight. let me finish and ill try to compile it |
02:04:07 | * | flaviu quit (Read error: Connection reset by peer) |
02:04:07 | * | Mimbus quit (Read error: Connection reset by peer) |
02:06:21 | * | flaviu joined #nim |
02:10:12 | * | Hakaslak joined #nim |
02:15:03 | * | Hakaslak quit (Ping timeout: 264 seconds) |
02:20:14 | * | phi_freenode is now known as phira |
02:25:17 | * | jefus__ joined #nim |
02:28:53 | * | jefus_ quit (Ping timeout: 246 seconds) |
02:38:00 | dtscode | can someone tell me why this repo https://github.com/DTSCode/dtscodeio is causing: https://bpaste.net/show/44b831bf7e8c |
02:39:00 | EXetoC | I dunno but it is known |
02:40:03 | Araq | dtscode: title or content that you pass to genHTMLPage is nil? |
02:40:11 | dom96 | dtscode: You need to init result inside genHtmlPage |
02:40:26 | * | VinceAddons quit (Read error: Connection reset by peer) |
02:40:28 | dom96 | result = "" on line 3 |
02:40:31 | dom96 | in the .tmpl |
02:41:20 | Araq | ah dom96 is right |
02:41:30 | Araq | and I should sleep |
02:41:32 | Araq | good night |
02:41:40 | dtscode | ah, forgot to do that. thanks :) |
02:50:21 | * | skyfex quit (Read error: Connection reset by peer) |
02:50:22 | * | JinShil quit (Read error: Connection reset by peer) |
02:50:58 | * | skyfex joined #nim |
02:52:18 | * | vendethiel quit (Ping timeout: 265 seconds) |
02:53:35 | * | JinShil joined #nim |
02:54:54 | * | vendethiel joined #nim |
02:56:57 | * | darkf joined #nim |
03:01:47 | * | keyle quit (Quit: leaving) |
03:03:08 | gmoore | dom96: if you're still here i had a debugging question. i've been trying nim out this week and really like it so far. one of the things ill need to evaluate shortly is how well i can debug a runtime problem. we're a microsoft shop so everything needs to play nice in MSVC more or less. |
03:03:55 | gmoore | what's the workflow for "oh no my program is doing weird things" for nim code? is there a way to get a sane mapping of the generated C code to your lines of nim and walk through line by line? |
03:03:55 | dom96 | i'm still here |
03:04:37 | dom96 | The compiler can generate line numbers for debuggers like gdb via the --lineDir:on option. |
03:06:02 | * | kapil__ joined #nim |
03:07:00 | dom96 | good night |
03:07:40 | gmoore | ah ok so embedded #line is the primary way to debug the running C code then. i believe msvc does support that. i'll give it a shot tomorrow. thanks! |
03:08:49 | flaviu | gmoore: I do --debuginfo --linedir:on |
03:08:55 | flaviu | and then it runs fine in GDB, excluding some mangling. |
03:10:03 | gmoore | do you find that you're able to get enough info back to debug easily? i'm exploring nim as an alternative to writing C code when we don't need to, so everyone is very familiar with C, but the generated code is pretty unfriendly looking |
03:12:58 | flaviu | Easily enough for me. You have to use C syntax in print and some of the local variables are named LOC1, LOC2, ... |
03:13:29 | flaviu | Structure members are normally named |
03:13:36 | gmoore | so i take it there is a bit of a learning curve in deciphering the generated code |
03:13:45 | flaviu | yep, definitely. |
03:14:09 | flaviu | but GDB shows you the nim code and nim line numbers |
03:14:24 | gmoore | imo i'd rather spend a day writing some crap and 2 more days debugging it than spend an entire week just to do the code writing in C. just a matter of convincing my team, hah |
03:14:36 | gmoore | right ill have to see if i can get the same functionality out of msvc |
03:15:42 | * | vendethiel quit (Ping timeout: 245 seconds) |
03:17:05 | * | vendethiel joined #nim |
03:19:00 | * | gunn_ joined #nim |
03:20:17 | * | gunn quit (Ping timeout: 245 seconds) |
03:33:40 | * | NimrodBot joined #nim |
03:34:58 | * | NimrodBot quit (Remote host closed the connection) |
03:35:01 | * | Demon_Fox quit (Ping timeout: 272 seconds) |
03:38:56 | * | brson quit (Ping timeout: 244 seconds) |
03:39:39 | * | vendethiel quit (Ping timeout: 256 seconds) |
03:40:17 | * | johnsoft quit (Ping timeout: 245 seconds) |
03:40:53 | * | johnsoft joined #nim |
03:41:59 | * | Mimbus joined #nim |
03:51:24 | * | yonson quit (Read error: Connection reset by peer) |
03:54:18 | ldlework | flaviu: can you write up a short thing on how you do debugging? |
04:01:09 | flaviu | ldlework: Sure, I'll do it tomorrow. |
04:21:11 | dtscode | just dont write bugs |
04:22:03 | fowlmouth | If debugging is the process of removing bugs, then programming must be the process of putting them in. |
04:22:55 | dtscode | hmmm... i dont like this default font my site uses. i might fix that |
04:33:06 | * | JinShil quit (Quit: Konversation terminated!) |
04:53:17 | * | ARCADIVS joined #nim |
05:00:26 | dtscode | is aporia still being worked on? |
05:04:39 | EXetoC | dtscode: slowly |
05:05:02 | dtscode | damn :/ |
05:09:36 | * | gunn_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
05:11:14 | * | lws joined #nim |
05:12:08 | fowlmouth | 4 npc sidewinders calling me a dreg |
05:21:51 | * | vendethiel joined #nim |
05:23:13 | dtscode | hrmmmm jester doesnt want to see my favicon... |
05:24:18 | ldlework | hi lws welcome :) |
05:25:00 | lws | hello |
05:25:13 | lws | ldlework: Don't get too excited, I'm not a convert yet :D |
05:25:25 | dtscode | thats what they all say |
05:26:11 | dtscode | then they see the UFC and they are like ZOMG GET ME NIM NOW |
05:26:18 | lws | UFC? |
05:26:25 | dtscode | uniform function call |
05:26:32 | lws | What is that? |
05:26:40 | dtscode | basically x(y) is the same as y.x() |
05:27:09 | dtscode | and, you can also do x y (ie if the function has 0 or 1 arguments, you dont need the ()'s) |
05:27:14 | lws | UFCS is what that's called in other systems BTW |
05:27:33 | fowlmouth | the S is for syntax.. |
05:28:13 | dtscode | meh. ive seen it called ufs as well |
05:28:23 | ldlework | what would that stand for |
05:28:34 | fowlmouth | universal function call syntax |
05:28:45 | ldlework | that would be ufcs |
05:28:50 | dtscode | uniform function syntax |
05:28:55 | ldlework | aha |
05:29:10 | fowlmouth | unifunctax |
05:29:43 | fowlmouth | lws, what programming language do you most often use |
05:29:48 | dtscode | i was going to say imo its like procs/routines/functions/etc, and then you said that and now really want to call functions funkytions |
05:29:54 | lws | At work, or for pleasure? |
05:30:04 | dtscode | both |
05:30:18 | ldlework | lws is a D contributor |
05:30:22 | lws | I use to use C# for work, just started at a Go shop, and D is my hobby language |
05:30:44 | dtscode | >D |
05:30:44 | lws | contributor is being generous. Haha :) |
05:30:56 | fowlmouth | go shops exist? my soul just shrunk a little bit |
05:31:02 | ldlework | fowlmouth: Docker :/ |
05:31:04 | lws | fowlmouth: Yes, unfortunately. |
05:31:08 | dtscode | >Go |
05:32:03 | lws | Go makes me miss C#.. |
05:32:20 | lws | And that statement makes me really sad. |
05:32:31 | dtscode | i dont like go :} |
05:32:35 | dtscode | or D for that matter |
05:32:43 | ldlework | I found Nim because as a Python programmer I yearned for a nice language like C# in the FOSS space |
05:32:44 | dtscode | but thats just because im a n00b |
05:32:45 | ldlework | tada, Nim |
05:33:03 | lws | C# is nice because of the framework behind it |
05:33:12 | ldlework | That isn't the core reason no. |
05:33:13 | fowlmouth | lws, C# seems nice (i've only used it with visual studio though, intelliwhatever helps a lot) |
05:33:14 | lws | Although it's a pretty decent language in it's own right. |
05:33:25 | fowlmouth | i was able to jump right into it |
05:33:32 | ldlework | C# is nice because not only does each feature work well, all the features seem to work well together. |
05:34:15 | ldlework | intellisense does help a lot |
05:34:34 | ldlework | I tried to get into Mono .. but meh |
05:34:35 | lws | The reason all those features work well is that the standard library is tightly coupled to the language... |
05:34:55 | dtscode | can someone tell me why my favicon isnt working? https://github.com/DTSCode/dtscodeio |
05:35:05 | lws | The language syntax is aware of specific interfaces in .NET and if you support those, you get lots of nice syntactic sugar. |
05:35:49 | fowlmouth | dtscode, put http in the href or use a relative url (/images/favicon.ico) |
05:36:05 | fowlmouth | is my guess |
05:36:10 | dtscode | hmmm ill try that |
05:37:09 | lws | dtscode: FYI: http://www.drdobbs.com/cpp/uniform-function-call-syntax/232700394 |
05:37:21 | lws | I'm pretty sure that article coined the term. Note the author. |
05:37:50 | dtscode | lws, im not saying im write. im just saying ive seen it called all 3 before. |
05:37:53 | dtscode | slang if you will |
05:38:34 | lws | dtscode: I'm not arguing with you, I was pointing out the inventor of the concept. |
05:38:53 | dtscode | ag |
05:39:00 | dtscode | ah* |
05:39:05 | dtscode | thanks for the article btw |
05:39:26 | dtscode | fowlmouth, didnt work :/ |
05:39:51 | lws | dtscode: I don't blame you for not liking D. There's a lot of really cool stuff in the language and some of it was sort of "discovered by accident" such as UFCS. I like that Nim takes these ideas and designs with many of them in mind from the start. |
05:40:42 | lws | I would actually encourage you guys to hang out in the D usenet forum for reference. Because some of the features actually are causing a lot of heated debates due to bugs they cause in code. |
05:40:56 | lws | It would be good to be aware of those types of things when making those features first class citizens. |
05:41:52 | lws | e.g. Optional () around functions that take no parameters actually causes ambiguity when you want to refer to the function itself. |
05:41:59 | fowlmouth | dtscode, this says you should use rel="icon" http://www.w3.org/2005/10/howto-favicon |
05:42:33 | lws | Caused a lot of debate in the D forums. Optional () are going to be deprecated in D because of it, and they will only apply to @property methods and then they will not be allowed. |
05:43:41 | ldlework | .eval proc foo() = echo "hello"; foo |
05:43:44 | Mimbus | ldlework: eval.nim(4, 0) Error: value of type 'proc ()' has to be discarded |
05:44:07 | ldlework | wut |
05:44:13 | * | vendethiel quit (Ping timeout: 272 seconds) |
05:44:25 | ldlework | .eval proc foo() = echo "hello";foo |
05:44:28 | Mimbus | ldlework: eval.nim(4, 0) Error: value of type 'proc ()' has to be discarded |
05:44:33 | fowlmouth | nim requires parens if there are no arguments |
05:44:43 | ldlework | ah I see, it wants me to discard foo itself |
05:45:09 | dtscode | fowlmouth, oops my mistake. i dont know why i thought it was 0 or 1 arguments |
05:45:09 | lws | fowlmouth: ? Parents are option if there ARE arguments? |
05:45:16 | lws | parens* |
05:45:21 | dtscode | lws, only if there is one |
05:45:27 | dtscode | ie: |
05:45:54 | dtscode | .eval proc foo(x: int) echo x; foo 1; foo(2); |
05:45:57 | Mimbus | dtscode: eval.nim(3, 21) Error: invalid indentation |
05:46:05 | ldlework | no spaces |
05:46:10 | dtscode | .eval proc foo(x: int) echo x; foo 1;foo(2); |
05:46:13 | Mimbus | dtscode: eval.nim(3, 21) Error: invalid indentation |
05:46:13 | dtscode | oops |
05:46:16 | lws | .eval proc foo(x: string) = echo "hello"; foo("hello") |
05:46:17 | fowlmouth | lws, yes but only for the outtermost expression |
05:46:20 | Mimbus | lws: hello |
05:46:27 | fowlmouth | .eval echo 1,2,3 |
05:46:28 | dtscode | .eval proc foo(x: int) = echo x; foo 1;foo(2); |
05:46:30 | lws | .eval proc foo(x: string) = echo "hello"; "hello".foo |
05:46:30 | Mimbus | fowlmouth: 123 |
05:46:33 | Mimbus | dtscode: 1 |
05:46:36 | Mimbus | lws: hello |
05:46:44 | lws | .eval proc foo(x: string) = echo "hello"; echo &"hello".foo |
05:46:46 | Mimbus | lws: eval.nim(4, 13) Error: expression 'foo("hello")' has no type (or is ambiguous) |
05:46:56 | dtscode | & is string catting in nim |
05:46:56 | lws | .eval proc foo(x: string) auto = return "hello"; echo &"hello".foo |
05:46:59 | Mimbus | lws: eval.nim(3, 24) Error: invalid indentation |
05:47:53 | lws | .eval proc foo(x: string):string = return "hello"; echo "hello".foo |
05:47:56 | Mimbus | lws: hello |
05:47:56 | lws | how do I take an address? |
05:48:19 | fowlmouth | lws, addr, but you couldn't do it that way |
05:48:23 | lws | .eval proc foo(x: string):string = return "hello"; echo addr "hello".foo |
05:48:26 | Mimbus | lws: eval.nim(4, 5) Error: expression has no address |
05:48:36 | lws | wah? |
05:49:06 | lws | Ah, I need to make foo a method on a struct to see the behavior |
05:49:08 | fowlmouth | .eval var x = "hello"; x.addr.echo |
05:49:10 | Mimbus | fowlmouth: eval.nim(4, 2) Error: type mismatch: got (ptr string) |
05:49:17 | fowlmouth | .eval var x = "hello"; x.addr.repr.echo |
05:49:20 | Mimbus | fowlmouth: ref 0x645b20 --> 0x7f6ae4543050"hello" |
05:49:20 | lws | .eval proc foo(x: string):string = return "hello"; echo addr "hello".foo.addr |
05:49:23 | Mimbus | lws: eval.nim(4, 22) Error: expression has no address |
05:49:27 | lws | .eval proc foo(x: string):string = return "hello"; echo "hello".foo.addr |
05:49:30 | Mimbus | lws: eval.nim(4, 17) Error: expression has no address |
05:49:38 | lws | Interesting |
05:49:47 | lws | How does nimbus work? Is it compiling to javascript or something? |
05:49:51 | lws | mimbus |
05:50:23 | ldlework | lws: why do you think it must be compiling to js? |
05:50:41 | lws | There's a direct nim interpreter? |
05:51:14 | ldlework | lws: Nim compiles very fast |
05:51:32 | fowlmouth | lws, you can only get address of an l-value, not an r-value, and inside the proc you can't get x's address |
05:51:53 | lws | ldlework: Seems like a bad idea to compile nim to C and C -> asm and then execute it and give me the result here? |
05:52:13 | lws | What's it doing, firing up a container real quick to sandbox it too? |
05:52:21 | ldlework | it is sandboxed, yes |
05:53:33 | ldlework | lws: try to write something |
05:55:58 | lws | .eval echo system.open("/dev/urandom").readLine |
05:56:01 | Mimbus | lws: |
05:56:13 | lws | :( |
05:56:26 | lws | .eval echo system.open("/etc/hosts").readLine |
05:56:29 | Mimbus | lws: # |
05:56:36 | lws | .eval echo system.open("/etc/shadow").readLine |
05:56:39 | Mimbus | lws: Error: unhandled exception: cannot open: /etc/shadow [IOError] |
05:56:43 | lws | :( |
05:56:46 | lws | lol |
05:59:51 | lws | .eval echo osproc.execCmd("mount") |
05:59:54 | Mimbus | lws: eval.nim(3, 5) Error: undeclared identifier: 'osproc' |
05:59:56 | lws | .eval osproc.execCmd("mount") |
05:59:59 | Mimbus | lws: eval.nim(3, 0) Error: undeclared identifier: 'osproc' |
06:00:08 | lws | .eval import osproc; osproc.execCmd("mount") |
06:00:11 | Mimbus | lws: eval.nim(4, 14) Error: value of type 'int' has to be discarded |
06:00:18 | lws | .eval import osproc; echo osproc.execCmd("mount") |
06:00:22 | Mimbus | lws: proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) |
06:00:22 | * | Mimbus quit (Excess Flood) |
06:00:29 | * | Mimbus joined #nim |
06:01:15 | * | gunn joined #nim |
06:02:03 | lws | .eval import osproc; var x, y = osproc.execCmdEx("mount"); echo x |
06:02:07 | Mimbus | lws: (output: proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) |
06:02:07 | * | Mimbus quit (Excess Flood) |
06:02:13 | * | Mimbus joined #nim |
06:03:31 | lws | .eval import osproc; import strutils; var x = osproc.execCmdEx("mount"); echo x.output.splitLines[2] |
06:03:35 | Mimbus | lws: dev on /dev type devtmpfs (rw,nosuid,relatime,size=4052072k,nr_inodes=1013018,mode=755) |
06:03:39 | lws | mwahaha |
06:03:43 | lws | .eval import osproc; import strutils; var x = osproc.execCmdEx("mount"); echo x.output.splitLines[3] |
06:03:46 | Mimbus | lws: run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755) |
06:03:49 | lws | .eval import osproc; import strutils; var x = osproc.execCmdEx("mount"); echo x.output.splitLines[4] |
06:03:52 | Mimbus | lws: /dev/mapper/linux on / type btrfs (rw,nodev,relatime,compress=lzo,space_cache) |
06:04:36 | lws | Seems like a neat language |
06:05:03 | lws | Very easy to get some stuff working |
06:05:57 | lws | ldlework: Is mimbus your bot? |
06:06:04 | ldlework | lws: no dts |
06:06:31 | ldlework | dtscode |
06:07:01 | lws | It seems like it'd be possible to overwrite mimbus with a .eval though |
06:07:09 | lws | Which would just be annoying I suppose |
06:07:20 | dtscode | hmmmm? |
06:07:28 | lws | I assume the bot is running in the same container? |
06:07:31 | dtscode | .eval and Mimbus: do the same thing |
06:07:34 | Mimbus | dtscode: eval.nim(3, 3) Error: expression expected, but found 'keyword and' |
06:07:39 | ldlework | hehe |
06:07:44 | dtscode | oh you tricked me |
06:07:49 | dtscode | im suing |
06:07:56 | ldlework | dtscode: he's saying that you could get Mimbus to overwrite itself |
06:08:01 | dtscode | how so? |
06:08:17 | lws | Is mimbus in the same container as what it's evaling? |
06:08:22 | ldlework | dtscode: is Mimbus running in a Docker container? |
06:08:47 | fowlmouth | .eval echo(hostOS, " ", hostCPU) |
06:08:51 | Mimbus | fowlmouth: linux amd64 |
06:08:58 | dtscode | ldlework, not yet. its kind of on the backburner right now due to more important projects |
06:09:07 | ldlework | just wondering |
06:09:09 | dtscode | lws, no its not |
06:09:39 | lws | .eval echo system.open("/proc/cgroup").readLine |
06:09:42 | Mimbus | lws: Error: unhandled exception: cannot open: /proc/cgroup [IOError] |
06:09:54 | lws | .eval echo system.open("/proc/self/cgroup").readLine |
06:09:57 | Mimbus | lws: 8:memory:/ |
06:10:45 | lws | .eval var f = system.open("/proc/self/cgroup"); f.readLine; echo f.readLine |
06:10:48 | Mimbus | lws: eval.nim(4, 1) Error: value of type 'TaintedString' has to be discarded |
06:11:03 | lws | .eval var f = system.open("/proc/self/cgroup"); var x = f.readLine; echo f.readLine |
06:11:06 | Mimbus | lws: 7:devices:/user.slice |
06:11:31 | lws | memory is not capped? |
06:11:49 | fowlmouth | can we move the Mimbus spamming to #nim-offtopic |
06:11:55 | dtscode | uhhh no. it looks like flaviu is running a very early release |
06:11:55 | lws | Sorry :) |
06:45:04 | lws | dtscode: Early release of? |
06:48:02 | vegai | 3 overlapping ways to make function calls? |
06:48:18 | vegai | oops, sorry. Commented on something in the backlog |
06:55:13 | dtscode | lws, Nimbus |
07:08:55 | dtscode | fowlmouth, that didnt work eitehr |
07:09:04 | dtscode | Araq, dom96 do either of you have an idea? |
07:11:53 | * | nande quit (Remote host closed the connection) |
07:36:57 | * | vendethiel joined #nim |
07:39:03 | * | gour joined #nim |
07:42:25 | * | Demon_Fox joined #nim |
07:52:00 | * | SplinterOfChaos quit (Ping timeout: 264 seconds) |
07:58:48 | * | valberg quit (Changing host) |
07:58:48 | * | valberg joined #nim |
07:59:51 | * | vendethiel quit (Ping timeout: 244 seconds) |
08:08:02 | * | rkj-b joined #nim |
08:08:30 | * | BlaXpirit joined #nim |
08:12:48 | * | rkj-b quit (Quit: ChatZilla 0.9.91.1 [Firefox 34.0.5/20141126041045]) |
08:20:56 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
08:34:46 | * | Sphax joined #nim |
08:41:44 | ekarlso | c2nim --header foo.h -o foo isn't that correct ? |
08:44:08 | * | Sphax quit (Quit: ZZZZZzzzzz) |
08:44:43 | EXetoC | no, you're missing the inputfile parameter as you can see in the help output |
08:45:29 | dtscode | any day now linus will be finding out about c2nim and will be like "Fuck yeah. i can port the kernel to nim now." |
08:48:00 | ekarlso | EXetoC: so you pass it .c files ? ^ |
08:49:15 | ekarlso | ahh |
08:49:16 | ekarlso | nice |
08:49:49 | EXetoC | headers too |
08:50:59 | * | Sphax joined #nim |
09:07:46 | * | vendethiel joined #nim |
09:11:12 | * | Trustable joined #nim |
09:14:51 | * | seemsindie joined #nim |
09:30:25 | * | vendethiel quit (Ping timeout: 256 seconds) |
09:33:49 | * | EXetoC quit (Ping timeout: 252 seconds) |
09:45:38 | * | vendethiel joined #nim |
09:45:55 | BlaXpirit | just realized it's impossible to extend `re` library to have the functionality I need |
09:45:57 | BlaXpirit | sigh |
09:46:02 | * | Demon_Fox quit (Quit: Leaving) |
09:50:09 | ekarlso | hmm, is there a way to have a object that inherits from Table ? |
09:50:19 | ekarlso | like Claims = Table[string, JsonNode] ? |
09:50:52 | ekarlso | I tried that but then when I do var claims = Claims(); claims["foo"] = %"foo" it goes invalid storage |
09:51:01 | BlaXpirit | ekarlso, heh, i wanted almost exactly the same thing yesterday |
09:51:06 | BlaXpirit | but i wanted to inherit from seq |
09:51:21 | BlaXpirit | ah ekarlso, wait |
09:51:27 | BlaXpirit | you actually can extend from it? |
09:51:34 | BlaXpirit | you probably need to call "new" |
09:51:37 | BlaXpirit | or newtable |
09:51:39 | BlaXpirit | or whatever it is |
09:51:50 | BlaXpirit | show code tho |
09:51:54 | BlaXpirit | always show code |
09:53:07 | BlaXpirit | ok whatever |
09:54:06 | ekarlso | BlaXpirit: was getting coffee :p |
09:54:19 | ekarlso | https://bpaste.net/show/03debcdf211a |
09:54:43 | BlaXpirit | ekarlso, basically my rule of thumb is |
09:54:48 | BlaXpirit | never create objects directly |
09:54:55 | BlaXpirit | always use a constructor function |
09:55:53 | BlaXpirit | TableRef... sigh |
09:55:57 | ekarlso | BlaXpirit: yeah, was wondering if I should just proc newclaims that returned a table.. |
09:56:24 | BlaXpirit | but it doesn't look like Table is a ref object, so "new" is probably not needed for it itself |
09:56:44 | BlaXpirit | however, it contains a seq, which does need to be initialized |
09:56:53 | BlaXpirit | basically call v |
09:56:55 | BlaXpirit | inittable |
09:57:26 | ekarlso | ? |
09:57:29 | BlaXpirit | ekarlso, oh to generalize a bit more |
09:57:38 | BlaXpirit | this type you created is not the problem here |
09:57:47 | BlaXpirit | you wouldn't be able to use a normal table like this too |
09:57:58 | BlaXpirit | because you should not create it directly! |
09:58:01 | BlaXpirit | initTable is the thing |
09:58:41 | ekarlso | I guess I can just skip declaring the claims type vs just creating a new table |
09:59:57 | ekarlso | yap, worked wonderfully |
09:59:59 | ekarlso | :D |
10:00:16 | ekarlso | it's allmost stupid how easy nim is sometimes.. |
10:00:40 | BlaXpirit | easy? |
10:00:50 | BlaXpirit | i wouldn't say it's so easy |
10:00:59 | ekarlso | BlaXpirit: I mean, for me coming from a dynamic languages background vs learning C |
10:16:21 | * | VinceAddons joined #nim |
10:58:24 | * | matkuki joined #nim |
10:59:20 | * | ARCADIVS quit (Quit: ARCADIVS) |
10:59:57 | * | JinShil joined #nim |
11:15:32 | * | akir joined #nim |
11:16:50 | akir | Hi, a username "akiradeveloper" is kicked by ChanServ. Did I do anything wrong? |
11:18:03 | akir | plz let "akiradeveloper" join this chat. I am not sure why I am kicked out |
11:18:39 | * | gour_ joined #nim |
11:18:48 | * | gour quit (Read error: Connection reset by peer) |
11:19:44 | * | jm116_ quit (Quit: Leaving) |
11:20:51 | akir | I am going out for an hour but keep this connection. Please tell me if I did bad thing for kicking |
11:22:25 | * | gour_ is now known as gour |
11:34:45 | * | gokr quit (Ping timeout: 276 seconds) |
11:41:01 | BlaXpirit | ok i think i have found a bug here |
11:41:13 | BlaXpirit | minimal example time! |
11:43:29 | BlaXpirit | damn, cant reproduce |
11:49:20 | flaviu | akir: I checked the logs, and I see no reason why you would be banned. It's probably a mistake, glitch, or misunderstanding; hopefully dom96 can figure out how to fix it whenever he comes back. |
11:51:21 | ekarlso | so flaviu yes a jwt needs to be decoded on the server side.. |
11:51:26 | ekarlso | hs256 that is. |
11:51:52 | ekarlso | flaviu: unless alg is none that is |
11:51:59 | flaviu | ekarlso: sorry, I can't stay and chat. I've got to go. |
11:52:08 | ekarlso | flaviu: ok :) |
11:52:45 | ekarlso | how do I get the compiler to know of a library path ? |
12:05:28 | dom96 | akir: I don't see you being kicked anywhere. |
12:12:33 | * | Sphax quit (Quit: ZZZZZzzzzz) |
12:14:09 | akir | I am back now |
12:14:09 | * | keyle_ joined #nim |
12:15:12 | akir | dom96: really? I am using web IRC chatting. When I try to log into this room, ChanServ kicks me out |
12:15:18 | akir | I will try again |
12:15:21 | * | akir left #nim (#nim) |
12:16:38 | * | akir joined #nim |
12:16:50 | akir | [21:15] == akiradeveloper was kicked from #nimlang by ChanServ [Invite only channel] |
12:16:56 | akir | this is the log |
12:17:25 | dom96 | Join #nim instead. |
12:17:36 | * | akir left #nim (#nim) |
12:18:20 | * | akiradeveloper joined #nim |
12:18:26 | akiradeveloper | Yeah |
12:18:49 | akiradeveloper | Thanks. Changed from nimlang to nim? |
12:19:06 | * | Sphax joined #nim |
12:19:14 | * | gokr joined #nim |
12:19:18 | dom96 | yes |
12:20:57 | akiradeveloper | I see.. |
12:24:09 | akiradeveloper | Please tell me why is this code compiled? T isn't obviously a subclass of float https://gist.github.com/akiradeveloper/2a5a6fed3246fc30a565 |
12:24:30 | * | keyle_ is now known as keyle |
12:28:35 | BlaXpirit | does anyone know how to make function "any"? |
12:28:42 | BlaXpirit | and why it is not in standard lib |
12:29:11 | BlaXpirit | akiradeveloper, seems to me that ldlework brought this up yesterday |
12:30:16 | BlaXpirit | http://irclogs.nim-lang.org/15-01-2015.html 05:45:42 |
12:30:54 | BlaXpirit | 21:06:47 better |
12:35:13 | akiradeveloper | BlaXpirit: I use = instead of : but the same problem per se? |
12:35:24 | BlaXpirit | probably |
12:35:35 | BlaXpirit | i dont know this stuff |
12:38:22 | akiradeveloper | it's not a big thing for me and ok |
12:45:51 | * | BitPuffin joined #nim |
12:46:13 | BlaXpirit | what is up with json module |
12:46:41 | BlaXpirit | i hoped it would be so clever |
12:46:51 | BlaXpirit | to learn from it |
12:50:19 | BlaXpirit | how to get argv? |
12:51:33 | BlaXpirit | commandLineParams |
12:52:00 | * | gour quit (Remote host closed the connection) |
12:59:32 | * | gour joined #nim |
12:59:45 | Triplefox | Feeling pretty good about this spritesheet library... I think I've got the internal data sorted now so I'm starting work on some algorithms |
12:59:49 | * | gour quit (Changing host) |
12:59:49 | * | gour joined #nim |
13:00:17 | Triplefox | It's designed so that you will be able to write little scripts to do whatever is needed |
13:00:39 | * | EXetoC joined #nim |
13:06:02 | * | keyle quit (Quit: Morbo: Chitchat achieved!) |
13:11:14 | * | matkuki quit (Quit: ChatZilla 0.9.91.1 [Firefox 34.0.5/20141126041045]) |
13:14:22 | * | BitPuffin quit (Ping timeout: 240 seconds) |
13:19:38 | gokr | Btw, for optparsing - I did tweak and get Lapp going (similar to docopt, but probably less advanced). |
13:20:24 | gokr | I am using it in my blimp utility. Here is Lapp: https://gitlab.3dicc.com/gokr/lapp |
13:23:16 | * | Demon_Fox joined #nim |
13:24:02 | * | BitPuffin joined #nim |
13:30:13 | gokr | Who controls nim-lang.com? Is it you Araq? |
13:30:22 | gokr | Eh, nim-lang.org I mean |
13:31:45 | * | jpoirier quit (Quit: Leaving) |
13:33:38 | BlaXpirit | type Argument = ref object of LeafPattern |
13:33:47 | BlaXpirit | why can't I convert Argument(leafpattern) |
13:35:04 | ekarlso | is it 2 spaces or 4 spaces that's wanted in .nim files ? |
13:35:10 | ekarlso | I see some with 2 and some with 4.. |
13:35:26 | EXetoC | 2 is more common |
13:36:15 | BlaXpirit | please explain to me: https://bpaste.net/show/cae091e63e53 |
13:38:35 | BlaXpirit | what can I do to make this work? |
13:40:34 | BlaXpirit | pls |
13:42:13 | BlaXpirit | :( |
13:42:19 | BlaXpirit | this halts all my work |
13:43:10 | BlaXpirit | T_T |
13:44:57 | EXetoC | by keeping another reference? but I assume it shouldn't be needed. do you really want to downcast though? |
13:45:20 | BlaXpirit | you call it "down"? |
13:45:24 | BlaXpirit | yes, well, i do really want |
13:46:52 | EXetoC | works with a nil base object apparently :p |
13:47:30 | BlaXpirit | EXetoC, inheritance only works with non-final objects -__- |
13:47:56 | BlaXpirit | or i don't know what you mean |
13:50:03 | BlaXpirit | this works in c++ |
13:52:37 | EXetoC | BlaXpirit: casting seems to work |
13:52:50 | BlaXpirit | but it's bad, mkay |
13:52:59 | BlaXpirit | what if there is non-empty memory |
13:53:08 | BlaXpirit | im pretty sure it writes trash to other members or something |
13:53:14 | BlaXpirit | although that shouldnt be a problem |
13:53:24 | BlaXpirit | no wait |
13:53:28 | BlaXpirit | writing to extra members |
13:53:33 | BlaXpirit | will write to uncharted territory |
13:57:04 | BlaXpirit | http://ideone.com/x17i0X vs https://bpaste.net/show/430a86cd7859 |
13:57:06 | EXetoC | you might be right |
14:00:17 | EXetoC | but it's not a 'B' to begin with |
14:01:15 | EXetoC | compare your statement with this: "discard B(A(B()))", which works |
14:02:06 | BlaXpirit | EXetoC, but c++ does something with it |
14:02:06 | EXetoC | you don't want an object variant though? just asking because of the downcast. it's discouraged I think, but I don't know what your code is doing |
14:02:25 | * | BlaXpirit is trying to port a Python library to Nim without understanding it |
14:02:25 | ekarlso | hmm, can you go from varargs > seq ? |
14:02:32 | BlaXpirit | @ |
14:02:40 | EXetoC | right, because it's a static cast, and not a dynamic cast |
14:02:45 | BlaXpirit | facepalm |
14:02:55 | EXetoC | well |
14:03:01 | BlaXpirit | so what if i want a static cast |
14:03:17 | BlaXpirit | c++ crashes, makes sense |
14:03:36 | akiradeveloper | I have two files a.nim b.nim. b is the main file and a has library function. What compile option do I need to import a from b? |
14:03:41 | BlaXpirit | crashes on dynamic_cast, that is |
14:03:47 | EXetoC | then you cast like I said, which I'm not encouraging now that I know a little more about this, and hope that it doesn't explode |
14:03:56 | BlaXpirit | akiradeveloper, why not import or include it?? |
14:04:13 | EXetoC | yes, and B(A()) can be considered a failed dynamic cast |
14:04:21 | EXetoC | there's also the "x of y" test |
14:04:25 | * | gokr_ joined #nim |
14:04:32 | BlaXpirit | ok, EXetoC, then let me put this differently |
14:04:33 | * | askatasuna joined #nim |
14:04:55 | akiradeveloper | BlaXpirit: what do you mean? I want to import a.nim from b.nim |
14:04:58 | BlaXpirit | how to inherit constructor of ref object? |
14:05:14 | BlaXpirit | akiradeveloper, then write import a |
14:05:55 | akiradeveloper | We don't need to create .o file like in C? |
14:05:58 | EXetoC | you must explicitly upcast and then pass it to the base "constructor", which is one aspect that OOP macros simplify I think |
14:06:07 | BlaXpirit | EXetoC, https://bpaste.net/show/39b65bf105f6 |
14:06:30 | EXetoC | that's what I recall for my brief use of inheritance over a year ago |
14:06:48 | BlaXpirit | this is one of the problematic places |
14:06:57 | akiradeveloper | yeah succeed, thanks |
14:07:36 | EXetoC | BlaXpirit: I think you must start by constructing the leaf class |
14:07:55 | EXetoC | since it does indeed encompass the base type as well |
14:08:10 | akiradeveloper | maybe, I am ready to implement nim-fuse. since I am newbie, it will be a long fight. |
14:08:59 | EXetoC | this can be tested by adding a field to each class and then stringifying a base class object (dereference first) |
14:09:56 | BlaXpirit | D: |
14:10:00 | BlaXpirit | I don't understand |
14:10:49 | * | akiradeveloper left #nim (#nim) |
14:11:12 | BlaXpirit | but don't try too hard to explain, i just might not need this all stuff |
14:11:25 | BlaXpirit | just gonna rewrite constructors, big deal |
14:11:33 | EXetoC | hence why "B(A(B()))" works, but "B(A())" doesn't, because the runtime type of the object passed to B in the latter case is an A and not a B |
14:11:39 | BlaXpirit | and hope it is not anywhere else in the code |
14:11:52 | BlaXpirit | EXetoC, well, yes, that totally makes sense |
14:12:05 | BlaXpirit | thank you |
14:13:06 | BlaXpirit | next up, attempt to read from nil |
14:16:10 | * | jefus__ is now known as jefus |
14:23:23 | ekarlso | https://bpaste.net/show/b627c94b1743 < does that API seem fair ? |
14:25:57 | * | jefus_ joined #nim |
14:28:54 | * | jefus quit (Ping timeout: 244 seconds) |
14:32:52 | ekarlso | https://bpaste.net/show/0fbb41758be5 < shouldn't #72 work there ? claims.nim(72, 24) Error: type expected |
14:35:05 | * | jefus_ is now known as jefus |
14:35:23 | EXetoC | EXP is not a type. perhaps you want T:static[ClaimKind]. it might or might not work, as static is experimental |
14:35:37 | EXetoC | but why is it not a normal parameter? |
14:36:46 | EXetoC | the variant type can be selected at run-time |
14:37:02 | ekarlso | good call |
14:37:11 | EXetoC | it can be done statically by making the type generic as well |
14:37:23 | * | Sphax quit (Quit: ZZZZZzzzzz) |
14:38:20 | ekarlso | that worked more nicely EXetoC :) |
14:38:21 | * | Sphax joined #nim |
14:38:35 | EXetoC | c(:)|< |
14:38:51 | * | sillesta joined #nim |
14:40:48 | * | gokr_ quit (Ping timeout: 245 seconds) |
14:42:14 | * | Demos joined #nim |
14:46:51 | * | Demos quit (Ping timeout: 264 seconds) |
14:51:04 | Araq | gokr: yes. why? |
14:51:15 | * | gokr_ joined #nim |
14:57:19 | Araq | BlaXpirit: I'm willing to do something about negative indexing (never liked it too much in the first place), but less noise from you can only help you as I'm about to /ignore you. |
14:59:54 | gokr | Hey guys |
15:00:06 | gokr | Araq: I am itching to set up a planet for Nim |
15:01:57 | Araq | gokr: nice :D |
15:07:53 | * | Guest51690 is now known as adam12 |
15:33:14 | novist | a planet? |
15:34:52 | * | SplinterOfChaos joined #nim |
15:44:53 | * | faineance joined #nim |
15:49:25 | gokr | novist: Yeah. A blog aggregator. At say planet.nim-lang.org |
15:49:50 | gokr | I think I will use the Pluto tool - it seems the most maintained variant these days. |
15:50:06 | gokr | Will set one up this weekend I think. |
15:50:21 | novist | never heard of such things ^_^ |
15:50:42 | * | nimnoob joined #nim |
15:50:51 | gokr | There are TONS of them: http://www.planetplanet.org |
15:51:16 | gokr | Here is the one for the Mono people: http://www.go-mono.com/monologue |
15:52:16 | gokr | And here is one using the software I will use: http://planetruby.herokuapp.com |
15:53:34 | novist | last one reminds me of hackernews |
15:55:20 | EXetoC | is there a planet-planet-planet too? |
15:56:58 | * | jpoirier joined #nim |
15:59:18 | * | faineance quit (Quit: leaving) |
16:00:13 | * | darkf quit (Quit: Leaving) |
16:00:38 | * | faineance joined #nim |
16:01:35 | * | kapil__ quit (Quit: Connection closed for inactivity) |
16:04:45 | * | nimnoob quit (Remote host closed the connection) |
16:08:51 | * | MajorWork joined #nim |
16:20:39 | * | nimnoob joined #nim |
16:22:44 | * | brson joined #nim |
16:23:29 | * | UberLambda joined #nim |
16:33:17 | * | nimnoob quit (Ping timeout: 252 seconds) |
16:43:22 | * | seemsindie quit (Ping timeout: 240 seconds) |
16:54:36 | * | BlaXpirit quit (Read error: Connection reset by peer) |
16:54:59 | * | BlaXpirit joined #nim |
17:05:27 | * | gokr_ quit (Ping timeout: 264 seconds) |
17:29:35 | * | JinShil quit (Quit: Konversation terminated!) |
17:29:50 | * | Sphax quit (Quit: CYA!!) |
17:45:48 | * | gmpreussner___ joined #nim |
17:49:37 | * | gmpreussner___ is now known as gmpreussner |
17:53:17 | * | faineance quit (Remote host closed the connection) |
17:54:44 | * | gsingh93 joined #nim |
17:54:55 | * | UberLambda quit (Quit: Leaving the Matrix) |
17:55:54 | * | MajorWork quit (Quit: Leaving) |
18:23:46 | def- | Is this the first time Nim(rod) appeared on this Programming Language Rankings?: http://redmonk.com/sogrady/2015/01/14/language-rankings-1-15/ |
18:25:38 | * | yonson joined #nim |
18:25:48 | gmpreussner | def-: wohoo... gonna be number one soon |
18:26:13 | gmpreussner | Araq: maybe i'm doing it wrong, but the endians module seems rather inconvenient to use since it requires pointers |
18:26:41 | gmpreussner | i often have proc parameters (int16 etc.) that need to be converted |
18:27:01 | gmpreussner | but the addr operator doesn't accept those, so i have to copy to local vars first? |
18:27:12 | Araq | yes |
18:27:45 | Araq | well it just needs some more convenience procs |
18:28:22 | gmpreussner | if you tell me what they should be, i can add them and submit a PR |
18:28:31 | gmpreussner | but i'd like it to not require an extra copy |
18:29:02 | ekarlso | how would u go about doing something like >https://github.com/square/go-jose/blob/master/shared.go#L79 in nim + |
18:29:15 | gmpreussner | especially since the values will just be passed through a lot of times |
18:30:00 | Araq | gmpreussner: unsafeAddr is planned to allow taking the address of a parameter but for scalars at least the copy is optimized away anyway |
18:30:08 | def- | ekarlso: type SignatureAlgorithm = distinct string? |
18:30:09 | gmpreussner | ekarlso: type SignatureAlgorithm = string |
18:30:14 | ldlework | def-: I don't see Nim on that page |
18:30:22 | gmpreussner | or distinct, yes |
18:30:31 | def- | ldlework: it's on the picture, bottom left corner, as Nimrod |
18:30:44 | gmpreussner | Araq: ok, i will copy then |
18:50:49 | dom96 | def-: nope |
18:51:17 | * | yonson quit (Quit: Leaving) |
18:59:23 | EXetoC | Araq: as in a parameter that is not annotated with 'var'? |
19:00:31 | Araq | EXetoC: yes exactly |
19:01:29 | EXetoC | great |
19:09:59 | EXetoC | anyone using nim for DSP? |
19:11:30 | gmpreussner | how do i properly do pointer arithmetic? i have to convert some C crap... i need to add sizeof(SomeType)' to some 'ptr uchar' and return the new 'ptr uchar' |
19:12:31 | BlaXpirit | gmpreussner, i did something here https://github.com/BlaXpirit/nim-csfml/blob/55b09f6c3251cd963790bcd71c217b03b6534b77/src/csfml_graphics.nim#L217 |
19:13:00 | BlaXpirit | gmpreussner, basically u cast to int, then add, then cast back |
19:13:10 | gmpreussner | ah ok, cool thx |
19:13:15 | BlaXpirit | there are other, maybe better ways |
19:13:23 | BlaXpirit | if you plan to extensively use pointer arithmetic |
19:13:30 | * | Varriount|Busy joined #nim |
19:13:31 | BlaXpirit | there was a library https://github.com/fowlmouth/nimlibs/blob/master/fowltek/pointer_arithm.nim |
19:13:35 | gmpreussner | nah, it's just a few one offs |
19:13:48 | Varriount|Busy | Hi guys! |
19:13:54 | gmpreussner | o hai |
19:17:30 | * | rpag joined #nim |
19:38:51 | * | Guest70720 quit (Quit: WeeChat 1.0.1) |
19:44:10 | * | Demos joined #nim |
19:46:36 | * | sampwing joined #nim |
19:48:12 | * | joecodes joined #nim |
19:56:25 | gmpreussner | can someone tell me what this C syntax is? http://pastebin.com/mJJrZKiM |
19:56:30 | gmpreussner | is 'bar' a dynamic array? |
19:56:40 | gmpreussner | how would i translate this to nim? |
19:59:01 | * | Fusion_Gaming is now known as FusionGaming |
20:00:36 | Araq | gmpreussner: .unchecked pragma, look it up, it's documented |
20:01:06 | Araq | it's an array of unspecified length, valid only as last element in a struct |
20:01:29 | gmpreussner | interesting, i have never seen that before |
20:01:49 | gmpreussner | thanks Araq, the docs have what i need |
20:05:46 | * | nande joined #nim |
20:09:07 | * | NimBot joined #nim |
20:11:59 | dtscode | hey dom96... i did as you said, and moved the image to a public folder (so now its under $SiteRoot/public/images), but the favicon still isnt showing up |
20:36:58 | BlaXpirit | dtscode, i can look at it if it isn't something uncommon |
20:45:33 | * | sampwing quit (Ping timeout: 252 seconds) |
20:49:17 | * | Mat4 joined #nim |
20:49:31 | Mat4 | hello |
20:49:39 | Varriount|Busy | Hi Mat4 |
20:50:01 | Mat4 | Hi Varriount, what's new ? |
20:51:02 | Varriount|Busy | Mat4: Well, I'm writing a string based linked-list of strings, using xor and tags to save memory |
20:51:19 | Varriount|Busy | It's interesting work. |
20:51:37 | dtscode | BlaXpirit, ok. give me a sec to update the repo |
20:53:14 | Mat4 | Varriount|Busy: Reads nice |
20:53:32 | Mat4 | I'm fighting with the bochs emulator and its debugger today |
20:54:15 | Mat4 | (it's really a primitive monitor intended for OS development) |
20:54:25 | dtscode | https://github.com/DTSCode/dtscodeio BlaXpirit |
20:55:35 | BlaXpirit | ok, gonna pm you |
20:56:00 | ekarlso | do we have something like play.rust-lang.org ? |
20:56:19 | Varriount|Busy | ekarlso: Not really. |
20:56:25 | ekarlso | -,,- |
20:56:30 | ekarlso | maybe something to create :D |
20:57:29 | flaviu | dtscode: Do you have a new version of Nimbus? |
20:58:05 | dtscode | flaviu, no not yet :/ its kind of on the backburner right now. |
20:59:30 | flaviu | dtscode: Ok. I saw "dtscode | uhhh no. it looks like flaviu is running a very early release" in the logs, is that something I should fix or.. ? |
21:00:04 | * | yonson joined #nim |
21:00:16 | * | wan joined #nim |
21:01:20 | * | gour left #nim ("Leaving") |
21:01:52 | dtscode | it doesnt do gists |
21:02:05 | dtscode | which is why i thought that |
21:02:11 | ekarlso | Mimbus: is irc only atm no ? |
21:02:27 | dtscode | what else would it be? |
21:02:39 | flaviu | gokr: lapp looks cool, can you add it to nimble? It might also be a good idea to paste the example in the README so it's readily accessible. |
21:02:48 | flaviu | ekarlso: It's very tightly coupled to IRC. |
21:02:59 | ekarlso | shouldn't be that hard to make it be both.. |
21:03:08 | ekarlso | dtscode: do you do somekind of isolation atm with it ? |
21:03:29 | flaviu | ekarlso: I would be the correct person to ask that, and I've set it up in it's own linux account, with ulimit. |
21:03:31 | dtscode | ekarlso, not yet. flaviu has managed it. when i get back to it nimbus will run with docker |
21:03:53 | ekarlso | hmm, does docker have cbindings ? |
21:03:59 | * | askatasuna quit (Ping timeout: 245 seconds) |
21:04:00 | dtscode | what other platform would nimbus run on? |
21:04:05 | dtscode | cbindings? |
21:04:16 | flaviu | I've set filesystem permissions so that it can't access anything sensitive, and ulimit manages memory usage and CPU time. |
21:05:34 | * | rpag quit (Quit: Leaving) |
21:09:13 | ekarlso | dtscode: yeah if docker has bindings for C |
21:09:15 | ekarlso | .. |
21:09:21 | ekarlso | so you could call docker from nim |
21:09:58 | dtscode | no. thats not what docker really is |
21:10:06 | dtscode | its a program not a library |
21:11:53 | gokr | flaviu: Yeah, I will add lapp to nimble. I also use it in blimp, which I also should add to nimble I guess. |
21:12:40 | dtscode | what is lapp? |
21:12:59 | * | dtscode is guessing it has something to do with smalltalk |
21:13:25 | gokr | https://gitlab.3dicc.com/gokr/lapp |
21:13:49 | gokr | And no, its a Nim library. I just revived it, was written by Steve Donovan (Lua fame) - he ported it from Lua. |
21:14:10 | dtscode | ooo this looks nice |
21:14:17 | gokr | The idea is to let the help text for a command line utility double as the parser grammar. |
21:14:31 | gokr | I tweaked it a bit also. |
21:14:37 | gokr | I use it in blimp |
21:14:43 | * | sampwing joined #nim |
21:14:51 | gokr | https://gitlab.3dicc.com/gokr/blimp |
21:14:51 | dtscode | why is it called LAPP? |
21:14:56 | gokr | Dunno :) |
21:15:16 | gokr | I checked with Steve and he was fine with me taking over that code. |
21:15:41 | dom96 | gokr: add it to nimble :) |
21:15:58 | gokr | It can be improved - but its already quite nice. |
21:16:13 | gokr | And blimp is a utility I wrote in Nim to handle big files in git. |
21:16:32 | gokr | Its very similar to git-fat. |
21:17:13 | * | irrequietus joined #nim |
21:17:14 | gokr | We use blimp for some of our own git repos and it works great. |
21:17:44 | gokr | dom96: Yeah, I will. |
21:18:30 | dom96 | gokr: I can do it for you if you'd like :) |
21:18:41 | gokr | dom96: Yeah, sure |
21:18:43 | ekarlso | would be easier with pkgs :P |
21:18:49 | Varriount|Busy | Hm.. What is that hack that you can use to change the discriminant of an object variant? |
21:18:50 | ekarlso | nimble register foo |
21:19:01 | Araq | dom96: can you also add the compiler's source code as a nimble package for me? |
21:19:38 | Araq | Varriount|Busy: assign it the new value |
21:19:45 | dom96 | Araq: perhaps |
21:19:54 | dom96 | Araq: I'm assuming this is for c2nim? |
21:19:54 | Araq | but if debug mode complains then you really MUST not do it |
21:20:01 | Araq | yup |
21:20:02 | gokr | dom96: I actually made nimble files for both those utilities. |
21:20:08 | Varriount|Busy | Araq: Why not? |
21:20:29 | dom96 | gokr: Want me to add blimp too? |
21:20:38 | gokr | Yeah, go ahead |
21:20:49 | Araq | Varriount|Busy: because you change how the GC sees the data structure, you will get nice memory corruptions |
21:21:28 | Varriount|Busy | Araq: Oh... yay |
21:22:34 | * | shodan45 joined #nim |
21:23:04 | Varriount|Busy | Araq: What if the object variant is, at bottom, just a struct with an int8 and an int64 member? |
21:23:09 | Varriount|Busy | Araq: https://gist.github.com/Varriount/ea6fec5a0558e81b433f |
21:25:05 | Araq | Varriount|Busy: you can modify the discriminant with pointer hacking. that said you data structure is completely pointless as it's always 16 bytes. |
21:25:16 | Araq | *your |
21:25:30 | Varriount|Busy | Araq: Yes, I know that. But not in when encoded. |
21:25:57 | Araq | then you can always decode it to int64 |
21:26:13 | Araq | and save 8 bytes per entry |
21:28:06 | sillesta | StringStream from the 'streams' module is deprecated. is there any other way to get a empty string with defined size? |
21:28:36 | Araq | it's not deprecated |
21:28:47 | sillesta | maybe i misread.. |
21:29:06 | dom96 | Araq: I will make a package called "compiler", that means c2nim will need to import compiler/ast instead of just ast for the compiler modules. |
21:29:07 | dom96 | Sound good? |
21:29:26 | Araq | yup |
21:29:29 | ldlework | cool |
21:30:52 | def- | sillesta: newString(size)? |
21:30:59 | Araq | sillesta: however there is also system.newStringOfCap() and system.newString() |
21:31:16 | sillesta | gotcha |
21:31:39 | Araq | dom96: beware that the compiler also depends on doc/*.txt though |
21:32:03 | dom96 | Araq: why? |
21:32:06 | Araq | since we read the command line argument descriptions at compile time |
21:32:45 | dom96 | That complicates things. |
21:33:21 | dom96 | What directory prefix does it to try to read those files from? |
21:34:00 | Araq | doc/ |
21:34:41 | Araq | dom96: well we can move the 2 files to compiler/doc |
21:34:49 | Araq | and adapt the docgen instead |
21:35:11 | dom96 | Where will the compiler look for those files? |
21:35:18 | dom96 | $moduleDir/../doc? |
21:35:49 | dom96 | if that's the case then it will work |
21:36:40 | Araq | nah it's --path:"$projectPath/.." |
21:37:13 | Araq | and then I do slurp("doc/basicopt.txt") and slurp("doc/advopt.txt") iirc |
21:37:24 | ekarlso | why is there both map and mapIt ? |
21:37:33 | def- | ekarlso: mapIt is more convenient to use |
21:37:44 | def- | but map can be used with regular procs |
21:37:45 | dom96 | Araq: That's unfortunate. |
21:38:30 | flaviu | ekarlso: map(proc (val: T): R = ...) is a huge pita |
21:38:47 | Araq | dom96: actually it's not. this means we can move these 2 files to compiler/doc and 'koch boot' should continue to work |
21:38:48 | ekarlso | .mao(|s| {}) |
21:38:50 | ekarlso | would be awesome |
21:39:42 | dom96 | Araq: alright |
21:40:27 | def- | ekarlso: you have seen the future module? |
21:40:56 | def- | .map((s) => ...) should work |
21:41:22 | onionhammer | (sometimes) |
21:41:29 | def- | yes |
21:41:32 | flaviu | def-: I honestly spend more time wrestling with bugs in that module than just writing out the proc... |
21:42:08 | Araq | I'm not aware of any unfixed (!) bugs for => |
21:42:16 | ekarlso | one thing that would be even more cool .map((s) => (var i = foo; foo...)) |
21:42:41 | onionhammer | .map((s:type) => ...) |
21:43:00 | onionhammer | vs .map((s) => ...) |
21:43:03 | * | jokra joined #nim |
21:43:25 | Araq | onionhammer: we have better type inference now. :type is not necessary |
21:43:34 | onionhammer | since today? |
21:43:38 | onionhammer | because its still happening for me |
21:43:49 | Araq | since months |
21:44:06 | onionhammer | welp, then i guess i should submit a but |
21:44:08 | onionhammer | bug* |
21:44:17 | dtscode | please dont submit a butt |
21:44:29 | onionhammer | test2.nim(14, 4) Error: type mismatch: got (seq[int], proc (GenericParam): auto) |
21:44:32 | onionhammer | but expected one of: |
21:44:34 | onionhammer | system.map(data: var openarray[T], op: proc (var T){.closure.}) |
21:44:36 | onionhammer | system.map(data: openarray[T], op: proc (T): S{.closure.}): seq[S] |
21:44:47 | ekarlso | +1 to onionhammer |
21:45:05 | flaviu | https://gist.github.com/029cc41dc59c6f0758ba |
21:45:39 | onionhammer | yeah, I get that error with flaviu's code snippet |
21:45:49 | * | sillesta quit (Read error: Connection reset by peer) |
21:49:48 | * | sillesta joined #nim |
21:50:20 | * | nimnoob joined #nim |
21:51:09 | Araq | hrm strange. maybe I misremember |
21:51:30 | Araq | I saw code in the compiler to infer these things |
21:51:48 | onionhammer | it works sometimes |
21:51:50 | onionhammer | .filter(x => x mod 2 == 1) |
21:51:54 | onionhammer | but not map() |
21:52:00 | * | superfunc joined #nim |
21:55:27 | Araq | aha, it's because 'map' itself is generic |
21:55:37 | Araq | for a concrete mymap it works ... yay |
21:56:23 | * | rpag joined #nim |
21:56:31 | gmpreussner | i have a C function that takes a pointer to an array of Foo: void Foobar(Foo*** foo); what would be the best way to map this to nim? pointer to an unchecked array? |
21:56:56 | gmpreussner | or do unchecked arrays have some special format, i.e. a count in front? |
21:57:21 | Araq | they do not, but they are not pointers either |
21:57:53 | gmpreussner | is there a way to express this? |
21:57:56 | Araq | is that 3 or 2 stars? |
21:58:00 | gmpreussner | three |
21:58:08 | gmpreussner | it's an array out parameter |
21:58:29 | Araq | 2 dimensional array then? |
21:58:37 | gmpreussner | nope |
21:58:48 | gmpreussner | i know, it's gross |
21:59:15 | gmpreussner | http://libusb.sourceforge.net/api-1.0/group__dev.html#gac0fe4b65914c5ed036e6cbec61cb0b97 |
22:00:14 | Araq | ah so it's a pointer to an array of pointers to Foo |
22:00:31 | gmpreussner | yep |
22:00:43 | gmpreussner | array of Foo* |
22:00:59 | gmpreussner | i forgot the star above |
22:01:40 | gmpreussner | well, let me ask you this first: how would i model an array of Foo*? |
22:01:51 | gmpreussner | i think the next step would then just be a ptr to that |
22:02:45 | gmpreussner | it would be nice if it mapped to some array type in Nim. but if that's not possible, that's ok, too. then i just need to know how to access the values. |
22:03:24 | dom96 | Araq: nimble install c2nim@#head, try it. |
22:03:44 | Araq | ptr UncheckedArray[ptr Foo] perhaps |
22:04:21 | BlaXpirit | dom96, c2nim installed successfully |
22:04:24 | BlaXpirit | and works |
22:04:31 | Araq | where type UncheckedArray {.unchecked.} [T] = array [10_000, T] |
22:04:43 | dom96 | BlaXpirit: :) |
22:04:47 | BlaXpirit | thx |
22:05:08 | sillesta | okay, maybe i'm missing something, but isn't this supposed to print something out? https://gist.github.com/sillesta/af314983eab9865af89d |
22:05:19 | sillesta | just getting a newline |
22:05:34 | BlaXpirit | sillesta, sey hello to unicode :( |
22:05:44 | BlaXpirit | å is 2 bytes |
22:05:49 | BlaXpirit | reversing them gives gibberish |
22:05:51 | sillesta | removed them, same thing |
22:06:31 | def- | i have a pull request for reversing unicode strings |
22:06:31 | gmpreussner | Araq: ok, i'll try that |
22:06:31 | Araq | sillesta: use countdown(size-1, 0) |
22:06:35 | def- | it's even performant! |
22:06:49 | * | superfunc quit (Ping timeout: 246 seconds) |
22:07:15 | BlaXpirit | utf-8 strings? |
22:07:25 | sillesta | Araq: nada |
22:07:29 | BlaXpirit | bah, I just wish Rune was more ubiquitous |
22:07:30 | def- | BlaXpirit: yes |
22:08:01 | * | nimnoob quit (Remote host closed the connection) |
22:08:06 | ldlework | utf-8 != unicode |
22:08:42 | gokr | sillesta: In this article I also play with reversed, and also notice the unicode issue: http://goran.krampe.se/2014/10/29/nim-and-oo/ |
22:08:49 | def- | https://github.com/Araq/Nim/pull/1842/files |
22:09:02 | Araq | gmpreussner: though it's possible that there is a codegen bug lurking here as 'ptr array' is mapped to a single star iirc |
22:09:08 | * | yonson quit (Ping timeout: 245 seconds) |
22:09:33 | Araq | gmpreussner: maybe you need to use 'ptr ptr ptr Foo' then ... |
22:10:15 | BlaXpirit | sillesta, there are mistakes in indices |
22:10:25 | Araq | or ptr ptr UncheckedArray[ptr Foo] ... |
22:10:54 | BlaXpirit | sillesta, this works :| https://bpaste.net/show/e273ff5ddffa |
22:11:15 | gmpreussner | Araq: ok, so 'ptr UncheckedArray[ptr Foo]' maps to 'Foo**' ? |
22:11:16 | ldlework | Araq: lol |
22:11:26 | sillesta | BlaXpirit: works for me too |
22:11:41 | sillesta | suspecting i may have copied the null terminator to the start maybe ;)? |
22:11:43 | * | Varriount|Busy quit (Ping timeout: 246 seconds) |
22:11:53 | BlaXpirit | sillesta, that is actually most likely the case |
22:11:58 | BlaXpirit | I haven't considered this |
22:13:33 | * | Demon_Fox quit (Quit: Leaving) |
22:15:51 | sillesta | gokr: interesting article, is there a way to treat utf8 characters as a single entity? |
22:16:09 | BlaXpirit | unicode module; Rune |
22:16:33 | gokr | Well, def- just pointed out his pull request that handles it. |
22:16:57 | gokr | sillesta: I do have more articles btw: http://goran.krampe.se/category/nim |
22:16:57 | Araq | Rune is just as wrong as char iirc |
22:17:02 | BlaXpirit | that's not wise to implement all character-based algorithms on bytes |
22:17:18 | sillesta | hehe, i'm not used to seeing "live" changes to languages |
22:17:26 | BlaXpirit | Araq, how is it wrong? what then? |
22:19:13 | ekarlso | sillesta: try Rust on for size :p |
22:19:32 | Araq | something like é can be 2 utf-32 characters |
22:19:36 | sillesta | i did, wasn't my style |
22:19:42 | ekarlso | sillesta: +1 |
22:19:44 | Araq | and when you reverse it you get ´e |
22:19:49 | sillesta | couldn't get past lifetimes |
22:20:18 | def- | Araq: that should be fixed in my reverse |
22:20:31 | def- | ah, if you reverse runes |
22:20:39 | Araq | yep. |
22:20:45 | def- | yeah, has to be "blocks of runes" |
22:20:54 | def- | because each character can have a number of combining characters |
22:21:11 | def- | not like any software handles this correctly |
22:21:16 | BlaXpirit | as if that wasn't difficult enough, you attempt it on utf-8 :p |
22:21:30 | def- | BlaXpirit: first i did it with runes, but it was terribly slow |
22:21:47 | Araq | BlaXpirit: with utf-8 it's at least obviously wrong when you test it with ü |
22:22:15 | flaviu | It's easiest to never reverse any strings. |
22:22:39 | def- | flaviu: but you see that 2 people just tried it and ran into problems |
22:22:43 | * | nimnoob joined #nim |
22:22:45 | BlaXpirit | let's just console outselves with the fact that in real world you never need to reverse strings (and that's when I remembered right-to-left script) |
22:23:17 | ekarlso | what does the "distinct" mean ? |
22:23:36 | def- | ekarlso: http://nim-lang.org/manual.html#distinct-type |
22:23:56 | Araq | BlaXpirit: how about you blame me instead for not copying Java/C# blindly? or maybe another ramble of how the stdlib is useless |
22:24:35 | Araq | *rant |
22:25:06 | BlaXpirit | Araq, Java/C# is irrelevant here because they use unicode strings |
22:25:26 | renesac | def-: by the way, shouldn't you use 'distinct tuple' for your rational numbers library? |
22:25:29 | Araq | they use utf16... |
22:25:36 | gokr | In Pharo there is actually quite advanced support for multibyte strings - and it turns out, Unicode is not the whole answer. |
22:25:40 | renesac | now that tuples are more compabile with each other |
22:26:36 | def- | renesac: i don't know |
22:26:38 | BlaXpirit | Araq, well congrats, the situation is already better than C# and Java. nothing to rant about in such case |
22:28:02 | BlaXpirit | i don't pick these languages as examples anyway o.o |
22:28:20 | flaviu | Araq: There's no reason to flame, it won't take the discussion anywhere useful. |
22:28:22 | renesac | I think yes, as your type isn't any 2 integer tuple |
22:29:32 | renesac | and I think the shuffle and other random things would be better in a dedicated random library |
22:29:50 | renesac | of course, right now it don't exists |
22:29:54 | BlaXpirit | renesac, what shuffle are you talking about? |
22:29:57 | BlaXpirit | renesac, it exists |
22:30:04 | BlaXpirit | just that nobody knows about it and nobody cares |
22:30:11 | renesac | https://github.com/Araq/Nim/pull/1840/files |
22:30:19 | renesac | BlaXpirit: that one you did based on python? |
22:30:26 | BlaXpirit | yes |
22:30:38 | BlaXpirit | what is that shuffle doing there? :D |
22:30:53 | BlaXpirit | nim's random() is not even usable |
22:31:12 | renesac | ok |
22:31:18 | renesac | found my integer log function |
22:31:22 | def- | BlaXpirit: why not? |
22:31:39 | Araq | sillesta: btw you need to iterate up to 'len div 2' |
22:31:45 | BlaXpirit | https://github.com/Araq/Nim/issues/1506 "Problems with random number generation" |
22:31:49 | renesac | BlaXpirit: what behaviour you want when the operand is zero? |
22:32:01 | renesac | for the log base 2 function |
22:32:30 | fowlmouth | BlaXpirit, dont get discouraged if nobody uses your libraries, instead write things that you use |
22:32:58 | BlaXpirit | fowlmouth, yeah, just gonna finish up 3rd and final library nobody's gonna use :D |
22:33:00 | fowlmouth | if someone else finds it useful thats just a bonus |
22:35:14 | BlaXpirit | the gist of "Problems with random number generation" is random() will give a random number between 0 and 32767 even if you ask it for a random number between 0 and a billion |
22:35:14 | renesac | BlaXpirit: can't you make a random function that accepts a typedesc as parameter? |
22:35:30 | EXetoC | what libs again? |
22:35:33 | BlaXpirit | renesac, that's... not good |
22:35:39 | renesac | instead of many different functions |
22:35:40 | renesac | why? |
22:35:46 | EXetoC | just advertise, add readme's and so on |
22:35:47 | BlaXpirit | ifyou mean what i think you mean |
22:36:10 | EXetoC | 3. ?????? 4. PROFIT |
22:36:21 | * | flaviu quit (Remote host closed the connection) |
22:39:08 | Araq | BlaXpirit: we mostly just wrapped ansi C here, so you're complaining about libc's implementation as far as I'm concerned |
22:39:21 | BlaXpirit | no, Araq |
22:39:34 | BlaXpirit | libc's implementation just gives you a random number between 0 and RAND_MAX |
22:39:39 | BlaXpirit | no strings attached, no hard feelings |
22:40:07 | BlaXpirit | Nim's functions based on it, however, are inherently bugged |
22:42:56 | * | flaviu joined #nim |
22:43:02 | def- | BlaXpirit: they can be fixed though? |
22:43:12 | def- | BlaXpirit: worst case, by getting multiple random numbers? |
22:43:13 | BlaXpirit | https://github.com/Araq/Nim/blob/3119fe087d28344a34f296f1548cd8d852aea2f8/lib/pure/math.nim#L221 for reference |
22:43:18 | BlaXpirit | workarounds are possible, yes |
22:43:27 | dom96 | BlaXpirit: please fix it |
22:43:28 | ekarlso | would anyone wanna add base64url support for base64 ? |
22:43:46 | renesac | def-: you are better off implementing a better random number generator yourself |
22:43:47 | BlaXpirit | dom96, cryptographers will cringe |
22:43:56 | BlaXpirit | but sure, i can try |
22:44:17 | dom96 | cryptographers should create specialised libraries |
22:44:58 | dom96 | The current random's use case is basic things like card games. |
22:45:04 | dom96 | It works ok for that I think. |
22:45:10 | renesac | dom96: right now, no |
22:45:19 | def- | shuffle is good for card games too :P |
22:45:19 | BlaXpirit | you can't have seeded games, for instance |
22:45:21 | renesac | or badly |
22:45:53 | dom96 | Is there some other problem apart from it only generating random numbers between 0 and MAX_RAND? |
22:45:55 | * | Demos quit (Quit: Leaving) |
22:46:07 | BlaXpirit | yes |
22:46:11 | BlaXpirit | horrible inconsistency |
22:46:34 | dom96 | inconsistency with what? |
22:46:44 | BlaXpirit | across systems and compilers |
22:46:59 | BlaXpirit | inconsistency with itself |
22:47:00 | dom96 | ahh, MAX_RAND is always different. |
22:47:11 | dom96 | Change it so that it doesn't use libc then. |
22:47:16 | BlaXpirit | not only it, the algorithm itself can be different and whatnot |
22:47:23 | BlaXpirit | dom96, well, that requires a dedicated library! |
22:47:36 | BlaXpirit | which i have made a long time ago |
22:47:41 | dom96 | Add it to the stdlib then. |
22:47:44 | dom96 | Call it random. |
22:47:48 | renesac | dom96: not so fast |
22:47:51 | BlaXpirit | i suggested that in september |
22:48:01 | BlaXpirit | but first people must review it and improve it |
22:48:04 | Araq | dom96: not so fast |
22:48:20 | dom96 | That is what PRs are for. |
22:48:26 | BlaXpirit | it is not ready |
22:48:32 | BlaXpirit | it was the first thing i wrote in nim basically |
22:48:36 | EXetoC | not so fast |
22:48:38 | ekarlso | flaviu: u ot a clue on decoding hs256 ? |
22:48:39 | dom96 | then what are we arguing about? |
22:48:54 | dom96 | EXetoC: not so slow |
22:49:12 | BlaXpirit | i'm arguing about lack of action on the problems with math.random |
22:49:26 | BlaXpirit | i should indeed at least fix the glaring bug |
22:49:30 | renesac | I'm trying to write the integer log 2 function for BlaXpirit replace the float one in his library |
22:49:51 | Araq | tbh I don't really agree it's a bug. but that's just me. nobody should use this for anything serious anyway. and the fact that it says 'int' is rather meaningless |
22:49:54 | * | saml quit (Quit: Leaving) |
22:49:57 | flaviu | ekarlso: I'm not sure what you're asking. |
22:50:06 | BlaXpirit | Araq, please don't be like this |
22:50:14 | Araq | it's obviously underspecified, or is -4 a valid value for it? |
22:50:40 | BlaXpirit | returns a value in range "a .. b-1" |
22:50:56 | BlaXpirit | okay, maybe it does, but some values are impossible to obtain |
22:51:09 | gokr | For random I think this is brilliant: http://xkcd.com/221/ |
22:51:21 | ekarlso | flaviu: so you're supposed to encrypt a string with hs256 but also supposed to decrypt / decode it ye ? |
22:51:46 | * | tinAndi joined #nim |
22:51:56 | flaviu | ekarlso: let me bring this into PM, it's not directly about nim |
22:52:08 | ekarlso | ok |
22:52:09 | BlaXpirit | but can we at least agree that shuffle() shouldn't be added to math, and that it shouldn't be based on random()? |
22:52:46 | renesac | https://github.com/Araq/Nim/issues/936 <-- Araq: have you read my last answer to this topic? |
22:52:49 | Araq | yes, we can agree on that |
22:53:04 | renesac | do you think what I propose to do with int literal is possible? |
22:53:35 | dom96 | BlaXpirit: You're upset that Araq is not making random his priority when he has lots of other things to do? |
22:54:08 | gokr | gnite folks |
22:54:11 | EXetoC | "one year ought to be enough for the design and implementation of a programming language" - Bill Gates |
22:54:30 | dom96 | We don't have a big company backing us. In the open source world if you want to get something fixed then in most cases you need to do it yourself. |
22:54:51 | ldlework | I think we should all take BlaXpirit not so seriously |
22:54:57 | ldlework | err that came out wrong |
22:55:07 | ldlework | I mean his immediacy and hand-waving |
22:55:22 | ldlework | he just cares. I think he knows Araq is busy. |
22:55:41 | BlaXpirit | something like that... |
22:55:46 | Araq | renesac: cannot see where this solution differs from what we do |
22:56:04 | EXetoC | just need to express it more calmly |
22:56:12 | BlaXpirit | i always start calm |
22:56:15 | Araq | 5 already has the type 'int literal(5)' and is compatible with uint8, 300 is not |
22:56:16 | ldlework | lol |
22:56:22 | gokr | BlaXpirit: You wrote a different PRNG in Nim or did I misunderstand? |
22:56:30 | renesac | Araq: humm |
22:56:41 | renesac | I will try to run skyfex fork then |
22:56:44 | BlaXpirit | it's just that people always try to argue with my obviously correct statements :p |
22:56:49 | renesac | and add those proc overloads |
22:57:10 | renesac | but I will be away for a week first |
22:57:14 | BlaXpirit | gokr, i made a library that utilizes the same Mersenne Twister that Python uses |
22:58:07 | gokr | BlaXpirit: Neat. I also saw a huge number of other langs relying on the twister. Which apparently is good for simulation, albeit worthless for crypto I think I read. |
22:58:07 | ldlework | BlaXpirit: nice |
22:58:10 | BlaXpirit | and it should support different implementations of PRNG but i can't be sure the API is good enough for that |
22:58:23 | Araq | BlaXpirit: I'd fix it by s/int/range[0..10_000] |
22:58:27 | gokr | Julia uses it for one newish language. |
22:58:50 | flaviu | I'd like to post www.pcg-random.org |
22:58:56 | flaviu | That website is excellent. |
22:58:56 | BlaXpirit | Araq, if you want to make assumptions about RAND_MAX, yeah, that's not so bad |
22:58:57 | gokr | BlaXpirit: Guess this is it: http://forum.nim-lang.org/t/533 |
22:59:16 | renesac | flaviu: I wanted to make a random library based on that xorshift* |
22:59:18 | BlaXpirit | yes. i mention it in https://github.com/Araq/Nim/issues/1506 too |
22:59:25 | dtscode | fowlmouth, wheres your ircd again? |
22:59:31 | renesac | but I had other priorities |
22:59:35 | flaviu | renesac: I'm excited about PCG these days! |
22:59:35 | BlaXpirit | renesac, there is no problem with having both |
22:59:52 | EXetoC | use several popular engines and pick a default |
22:59:54 | flaviu | Mersenne Twister actually fails a few statistical tests. |
23:00:18 | fowlmouth | dtscode, https://github.com/fowlmouth/nimlibs/tree/master/fowltek/musings |
23:00:27 | flaviu | LCG 96/32 is higher quality, smaller, and faster, but I can't find the multiplier anywhere. |
23:00:39 | renesac | BlaXpirit: yeah, the ideal is a library where you can use a uniform interface for different types of random number generators |
23:00:42 | renesac | that is what you tried to do |
23:00:49 | BlaXpirit | yes |
23:01:11 | Araq | "Which apparently is good for simulation, albeit worthless for crypto" gokr +10 |
23:01:13 | renesac | I'm just not sure if it is the best interface (only looked quickly) |
23:01:14 | BlaXpirit | the library did kinda get abandoned (due to lack of attention and time) |
23:01:14 | dtscode | ty |
23:01:34 | renesac | BlaXpirit: some things you copied too much from python |
23:01:51 | renesac | by default, the random function spits a float |
23:01:56 | renesac | not an int that would be expected |
23:02:03 | ldlework | why would an int be expected? |
23:02:04 | BlaXpirit | Araq, my library exposes operating system's random byte source |
23:02:18 | EXetoC | have an engine interface |
23:02:18 | renesac | that kinda makes sense in python, because python don't have fixed lenght integers |
23:02:20 | BlaXpirit | which is "worthy" for crypto |
23:02:24 | EXetoC | but you probably know more than me |
23:02:41 | Araq | so then the stdlib is good for simulation but perhaps bad for crypto ... and this is exactly why a stldib's random is a toy IMHO |
23:02:42 | ldlework | renesac: Python is by far the only language that defaults to floats for random functions... |
23:02:43 | gokr | flaviu: Squeak has (since the dawn of time) an LCG variant (http://en.wikipedia.org/wiki/Lehmer_random_number_generator) |
23:03:01 | BlaXpirit | Araq, it can be a toy but without bugs at least |
23:03:39 | Araq | BlaXpirit: ok, but more elaborate stuff HAS to be a nimble package |
23:03:49 | BlaXpirit | probably |
23:03:54 | Araq | otherwise nobody trusts it anyway |
23:04:01 | Araq | well shouldn't trust it. |
23:04:05 | gokr | flaviu: Nice site you found. |
23:04:32 | flaviu | gokr: Thanks, that's interesting! re. the site, the paper is also excellent reading. I found it very accessible. |
23:05:26 | flaviu | The idea that it's possible to just change c to some arbitrary number to obtain a new sequence sounds useful. |
23:07:02 | def- | t |
23:07:11 | def- | (oops) |
23:07:17 | BlaXpirit | I sure would like to keep up the topic of RNG, but it's sleepy time |
23:09:23 | fowlmouth | def-, can you pull that big sdl2 PR |
23:09:29 | renesac | ldlework: do you mean "not the only"? |
23:09:54 | fowlmouth | merge* |
23:11:46 | def- | fowlmouth: huh? |
23:11:48 | * | brson quit (Quit: leaving) |
23:12:38 | fowlmouth | def-, https://github.com/nim-lang/sdl2/pull/17 |
23:13:15 | def- | fowlmouth: into my own fork or what? |
23:13:45 | sillesta | are TType and PType legacy code? |
23:14:00 | sillesta | (the naming) |
23:14:02 | Araq | sillesta: yes. |
23:14:47 | fowlmouth | def-, i'll make you a contributor 1 sec |
23:14:59 | Araq | I don't think I'll ever update the compiler itself to get rid of T/P though |
23:16:34 | dtscode | ircd.nim(378, 8) Error: invalid indentation |
23:16:42 | sillesta | no magical regex to save the day ;)? |
23:16:43 | dtscode | do you know why it would be saying that? |
23:16:50 | dtscode | since it looks proper to me |
23:17:36 | dtscode | oh wait never mind |
23:17:40 | BlaXpirit | dtscode, it's often unmatched brackets on prev lines |
23:18:00 | dtscode | BlaXpirit, in this case it was an empty of |
23:18:10 | fowlmouth | dtscode, that section needs a discard |
23:18:22 | dtscode | yeah. just realized :/ silly me |
23:20:18 | * | BlaXpirit quit (Quit: Quit Konversation) |
23:22:02 | * | JinShil joined #nim |
23:23:45 | dtscode | ircd.nim(423, 34) Error: type mismatch: got (proc (AsyncSocket){.closure.}) but expected 'proc (AsyncSocket){.closure, gcsafe.}' # does this mean that i just need to find the function and add the gcsafe pragma to it? |
23:24:24 | Mat4 | ciao |
23:24:28 | * | Mat4 left #nim (#nim) |
23:24:33 | * | sillesta quit (Ping timeout: 276 seconds) |
23:24:48 | * | nimnoob quit (Ping timeout: 265 seconds) |
23:27:43 | * | sillesta joined #nim |
23:28:28 | dtscode | fowlmouth, |
23:29:36 | * | zahary_ quit (Ping timeout: 246 seconds) |
23:29:41 | fowlmouth | yea that probably work |
23:30:47 | def- | fowlmouth: should be fine, i hope |
23:30:58 | dtscode | hmmm for whatever reason there isnt anything like that on that line |
23:31:03 | dtscode | no functions or anything |
23:31:26 | * | akiradeveloper joined #nim |
23:32:26 | def- | fowlmouth: my examples still don't compile though, can I pull in my pull request as well? |
23:33:11 | flaviu | `"abc".match(re"abc", endpos = 0)`, "Error: invalid expression: 'endpos = 0'" |
23:33:11 | fowlmouth | sure |
23:33:28 | flaviu | I'm I don't understand why that's an error. |
23:33:42 | flaviu | endpos is the correct name. |
23:34:52 | fowlmouth | def-, btw that importc wasnt missing, there was a {.push importc: "SDL_$1".} before it (those can go away now since the function names are lowercase) |
23:40:52 | rpag | fowlmouth, ive never seen you be so serious |
23:41:08 | * | tinAndi quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0/20150108202552]) |
23:42:14 | Araq | flaviu: report it |
23:44:15 | def- | fowlmouth: hm, the big PR broke the gfx.nim |
23:46:11 | fowlmouth | def-, did he not update that file? |
23:47:01 | * | brson joined #nim |
23:47:20 | def- | fowlmouth: or it was broken even before, huh |
23:47:46 | fowlmouth | rpag, stop spying on me >_> |
23:48:45 | rpag | fowlmouth, i'm not, i check this channel from time to time and you happened to be speaking. |
23:51:14 | flaviu | looks like a unittest bug. |
23:51:24 | def- | fowlmouth: he renamed aapolygonColor to aaPolygonColor for example, now the importc fails. I'm fixing the importc instead of renaming back, ok? |
23:52:31 | dtscode | can someone tell me what is going on here? |
23:52:50 | dtscode | oops |
23:52:51 | dtscode | https://bpaste.net/show/543a78511efc |
23:53:19 | fowlmouth | def-, thats fine thank you, feel free to make any fixes you like |
23:55:23 | fowlmouth | dtscode, add gcsafe to that function? cant tellwhich it is |