<< 27-11-2013 >>

00:01:47Araqgradha: funny that's exactly what I meant
00:02:09AraqI deliberately allowed this because the python rule of 1 empty line is annoying
00:03:13gradhaIIRC there are also annoying warnings if you don't nest properly the list, like using one space instead of two
00:06:14gradhaadded another case I found in another project
00:06:34gradhathis one caught me writing incorrect links, since I was meaning to rename the extension and forgot
00:07:25gradhawell, if you want to close the issue that's ok, it's nothing serious
00:08:12gradhamay be worth adding somewhere to the rst docs that the supported syntax has been improved
00:10:43gradhagood night, badgers
00:10:55*gradha quit (Quit: bbl, need to watch https://www.youtube.com/watch?v=2IzR_ClTE8Y again)
00:12:06*mflamer_ joined #nimrod
00:21:29*BitPuffin quit (Ping timeout: 252 seconds)
00:21:47*MFlamer quit (Ping timeout: 272 seconds)
00:35:37*OrionPK quit (Quit: Leaving)
01:00:41*mflamer_ quit (Ping timeout: 272 seconds)
01:57:23*mflamer joined #nimrod
02:05:08*DAddYE_ joined #nimrod
02:05:23*DAddYE_ quit (Remote host closed the connection)
02:08:12*DAddYE quit (Read error: Operation timed out)
02:15:16*Varriount joined #nimrod
02:22:43*Varriount is back
02:37:35*mflamer quit (Ping timeout: 272 seconds)
03:06:29*DAddYE joined #nimrod
03:11:02*DAddYE quit (Ping timeout: 264 seconds)
03:14:07VarriountAraq, is lambda lifting done on generics before they are instanciated?
04:07:22*DAddYE joined #nimrod
04:11:50*DAddYE quit (Ping timeout: 240 seconds)
04:36:56*brson joined #nimrod
05:09:18*DAddYE joined #nimrod
05:13:26*DAddYE quit (Ping timeout: 240 seconds)
06:03:14*OrionPKM quit (Remote host closed the connection)
06:08:37*OrionPKM joined #nimrod
06:09:47*OrionPKM quit (Remote host closed the connection)
06:09:48*DAddYE joined #nimrod
06:13:31*DAddYE_ joined #nimrod
06:13:40*DAddYE_ quit (Remote host closed the connection)
06:13:46*DAddYE_ joined #nimrod
06:15:02*DAddYE quit (Ping timeout: 240 seconds)
06:20:07*DAddYE_ quit (Remote host closed the connection)
07:14:57*fowl quit (Ping timeout: 246 seconds)
07:21:27*DAddYE joined #nimrod
07:25:58*DAddYE_ joined #nimrod
07:26:02*DAddYE_ quit (Remote host closed the connection)
07:26:07*Varriount quit (Ping timeout: 272 seconds)
07:26:08*DAddYE_ joined #nimrod
07:27:08*DAddYE quit (Remote host closed the connection)
07:32:59*brson quit (Quit: leaving)
07:40:46*DAddYE_ quit ()
08:41:23*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
09:39:37*CarpNet joined #nimrod
10:08:16*Boscop quit (Ping timeout: 264 seconds)
10:34:31Araqping zahary, zahary_
10:36:49zahary_pong Araq
10:37:20Araqresult = semConv(c, n, symFromType(destType, n.info))
10:37:28Araqin semexprs:741
10:37:42Araqany idea why this is necessary?
10:38:10Araqand in particular symFromType looks suspicious
10:38:28Araqit generates an anon symbol if the type lacks one
10:42:18AraqsemConv doesn't even use 's'
10:42:34Araqoh well never mind, the bug I'm hunting comes from something else
10:43:56*TimNN joined #nimrod
10:44:14Araqhi TimNN welcome
10:44:39zahary_can't quite recall. I remember the commit where this is introduced, but this semConv part eludes me now
10:44:47TimNNhi.
10:46:02Araqwell it comes from this:
10:46:05Araq of tyTypeDesc:
10:46:07Araq # The result so far is a tyTypeDesc bound
10:46:08Araq # a tyGenericBody. The line below will substitute
10:46:10Araq # it with the instantiated type.
10:46:11Araq result = symNodeFromType(c, semTypeNode(c, n, nil), n.info)
10:46:43Araqthis means range[0..2] is replaced by AnonType and so is range[0..1]
10:47:03Araqso they compare equal in parameter lists
10:47:53Araqarguably parameter lists equality shouldn't be based on the resulting AST but still
10:48:49Araqtransforming T[A] into B is bad for the docgen too
10:48:56zahary_well, the Anon symbol attached to the type is just required for other parts of the compiler expecting nkSym typedesc params
10:49:25zahary_the fact that we have created such a symbol should not affect the procs that compare types
10:50:29zahary_the point of the skAnon flag is exactly to enable "structural" printing of the type in error messages and the doc generator
10:52:44zahary_which one is the range params bugs? I can take a look
11:01:22*MFlamer joined #nimrod
11:04:38TimNNI'm currently updating / rewriting the libuv wrapper and came across a small problem with (I think) the nimrod compiler:
11:04:46TimNNlibuv simulates a class like hierachy in c using macros e.g.:
11:05:08TimNN#define FIELDS_A ...
11:05:08TimNN#define FIELDS_B ...
11:05:08TimNNstruct A { FIELDS_A };
11:05:10TimNNstruct B { FIELDS_A; FIELDS_B };
11:05:19TimNNI translated this to nimrod like so:
11:05:46TimNNtype TA* {.pure, inheritable, importc: "A", header: "c.h"} = object
11:05:55TimNN # Fields of A
11:06:01TimNNtype TB* {.pure, final, importc: "B", header: "c.h"} = object of TA
11:06:11TimNN # Fields of B
11:06:20TimNNNow the nimrod compiler is happy, however if I have an instance of TB and try to access a field of class TA or pass it to a proc that expects an argument of type TA it generates code like b.Sup, which makes the c compiler very unhappy.
11:06:31TimNNSo I think that the nimrod compiler should either refuse to compile code like this, or, preferably, generate instead code like (A)b, ie. cast the instance of TB to TA, expecting the user to know what he does.
11:11:08zahary_any attempt to fix this would work only in the particular situation employing macros to simulate a base: derived relationship
11:13:30zahary_and the proposed casting solution would be wrong as it will create a copy of the A sub-object of B; it may be possible to add a special pragma telling nimrod that the C imported types should act as C++ hierarchy (i.e. the fields of the base type are accessible through a derived object)
11:14:16zahary_btw, a bit more up-to-date wrapper of libuv is available here:
11:14:17zahary_https://github.com/DAddYE/node.nim
11:16:08zahary_when I was creating the first libuv wrapper, to better deal with these macro tricks I ran the code through the C preprocessor, before giving it to c2nim
11:17:56*MFlamer quit (Read error: Connection reset by peer)
11:19:23TimNNFirst, thanks for the link to the wrapper, this looks very good! The casting worked in my case, because I was working with pointers.
11:19:37zahary_yes, it's ok for pointers
11:23:55Araqzahary_: https://github.com/Araq/Nimrod/issues/686
11:27:22AraqTimNN:
11:27:42Araqthe way to wrap libuv is to not use "header"
11:28:10Araqthen the discrepancies between nimrod's way and C's way don't matter
11:28:52zahary_the problem is that this would be more fragile, because they have "private" fields
11:28:59TimNN? that's how it's currently done.
11:28:59Araqalso afaik libuv creates a background thread for the event loop processing which is a pita for nimrod's threading model
11:29:16zahary_there is no binary distribution of libuv yet I think
11:30:08zahary_the background thread is only for disk I/O - the event loop runs in your thread
11:30:38Araqwell daddye surely had problems with it, though maybe he wrapped some other event lib and I'm confused
11:31:24zahary_what are the problems you imagine?
11:32:29Araqthe GC scans the wrong stack; the stack where the action doesn't happen
11:32:52Araqthanks to callbacks being invoked by some other thread that the C library created
11:33:06zahary_that shouldn't happen as no nimrod code will be running in the background thread
11:33:31Araqthat depends on the library design, in theory it's very possible
11:33:42zahary_yes, I meant in libuv in particular
11:33:43AraqI gotta go, see you later
11:33:46TimNNRegardless of the specific libuv problem, I think the compiler should at least print a warning, if it can't guarantee that a .Sup field exists in an object.
11:39:38*TimNN quit ()
12:10:39*BitPuffin joined #nimrod
12:11:20*BitPuffin quit (Client Quit)
12:17:00*BitPuffin joined #nimrod
12:19:27*BitPuffin quit (Client Quit)
12:20:17*Jackneill joined #nimrod
12:22:05*BitPuffin joined #nimrod
12:37:07BitPuffindom96: I am not sure setCookie actually sets a cookie
12:37:33BitPuffinThe server prints 303 Moved {Set-Cookie: useremail="[email protected]"; Expires=Wed, 04 Dec 2013 12:35:09 UTC, Location: /}
12:37:54BitPuffinbut alerting document.cookie shows nothing at all
12:48:55*Varriount joined #nimrod
12:54:11*Varriount quit (Ping timeout: 272 seconds)
13:26:38*dymk quit (Ping timeout: 264 seconds)
13:41:25*dymk joined #nimrod
13:55:32*fowl joined #nimrod
14:23:03Araqzahary_ any idea what breaks when I replace the line with:
14:23:22Araqn.typ = semTypeNode(c, n, nil)
14:23:35Araqwhich seems to me what the code should do instead
14:25:41zahary_it should be at least makeTypeDesc(semTypeNode)
14:26:13zahary_but otherwise, I think I haven't tried this one. seems more logical to me to return a nkSym from there
14:26:37BitPuffinhey guyses
14:26:46BitPuffinAraq: whatchu working on? :D
14:26:55Araqalright. well symNodeFromType seems wrong to me for every case
14:27:22Araqas semTypeNode returns a PType
14:27:25Araqbrb
14:30:10zahary_not returning nkSym will likely trigger additional work somewhere else in the compiler the next time someone calls semX on the same expression
14:32:39Araqyeah but either we re-eval the type or we don't
14:33:01Araqthrowing information away thanks to an anon symbol can't help, can it?
14:33:04zahary_and if some other code breaks because of receiving nkSym, wouldn't we just postpone the problem by not producing a symbol in this particular place
14:33:29zahary_it doesn't throw any information away - it just cached the result of the analysis into a symbol
14:33:31Araqwell I argue symNodeFromType is wrong everywhere
14:33:43zahary_all the information is still accessible through the symbol
14:33:56Araqhmm how so?
14:34:10zahary_it's stored in the typ field of the symbol
14:34:13Araqyou only set the type, not the ast
14:34:34Araqyou don't set typ.n either
14:39:19zahary_hmm, maybe you have a point if there is some value in the particular expression that produced the type? with these generic aliases and macros returning types it's not clear whether error messages should show you the "root" or the most "surface" type
14:40:08zahary_I opted for the root so far, but I have thought in the past the an IDE could offer you some interface to "peel" the layers of such macro expansions and aliases
14:41:17Araqwell we also have to support array [c.low .. c.high] where 'c' is a generic
14:41:37Araqand it seems keeping the ast around is the key to victory here
14:41:43Araqfor partial instantiations
14:42:14zahary_well, the current system doesn't really work well - have you seen my thardcases test?
14:42:28Araqnope
14:42:43zahary_https://github.com/Araq/Nimrod/blob/master/tests/compile/tgenericshardcases.nim
14:43:13zahary_these compile with my experimental "late processing of generics", but not otherwise
14:43:23zahary_but the experimental code breaks other stuff
14:43:44zahary_and I'm still not sure it's a good idea, so I'll try to work something out with the current approach
14:48:51AraqI keep wondering whether trees for types would work
14:49:05Araqthat would vastly simplify the compiler
14:49:39zahary_what do you mean exactly? give some example of a tree
14:50:36Araqinstead of tuple [x: ^] we have tuple [x: tyId] and then don't follow tyId except when really necessary
14:50:48Araq^ is the cycle here
14:51:34zahary_tyId being a special marker?
14:51:49Araqyes
14:52:04Araqholding the id of the type
14:52:55zahary_why does this make things simpler?
14:53:18Araqbecause most type related algorithms don't need the recursion check anymore
14:54:24zahary_are you after reducing control-flow complexity (reasoning about the code) or just after this as an optimization?
14:54:45Araqboth
14:55:38zahary_but wouldn’t the recursive checks be replaced with tyId checks?
14:55:55Araqwell reasoning about the code is primary goal
14:56:02Araqbut I'm sure it ends up being faster too
14:56:39*mflamer joined #nimrod
14:57:33Araqwell if you have to instantiate T[A, B] and T is recursive it's a pita to get these algorithms right
14:57:49Araqif T[A, B ] is not recursive it seems much easier
14:58:26Araqso .. you don't touch tyId but tyId is a "self reference" so it still produces the correct instantiation
14:58:59Araqbut cycles don't have to be self cycles and so I'm not sure my idea works
15:00:17zahary_semtypinst is indeed one of the most convoluted places in compiler
15:03:44BitPuffintuples hmm, mustn't be related to my bug :P
15:16:52*OrionPKM joined #nimrod
15:19:43dom96BitPuffin: Maybe you are setting it wrong, I dunno. It works for nimforum, maybe you could look at it for an example.
15:31:54BitPuffindom96: hmm
15:32:16BitPuffinsetCookie(userCookie, email, daysForward(7))
15:32:24BitPuffindom96: but the console outputs that it was set :/
15:32:38BitPuffinbrb
15:32:39*BitPuffin quit (Quit: WeeChat 0.4.2)
15:33:50OrionPKMwhat's wrong with cookies?
15:44:35*BitPuffin joined #nimrod
16:19:08NimBotnimrod-code/packages master 01bd225 Grzegorz Adam Hankiewicz [+0 ±1 -0]: Adds dropbox_filename_sanitizer binary package.
16:19:08NimBotnimrod-code/packages master e52ecb1 Dominik Picheta [+0 ±1 -0]: Merge pull request #33 from gradha/pr_adds_dropbox_filename_sanitizer... 2 more lines
16:31:08*BitPuffin quit (Quit: WeeChat 0.4.2)
16:57:07*shodan45 quit (Read error: Connection reset by peer)
16:57:26*shodan45 joined #nimrod
17:15:07*mflamer quit (Ping timeout: 272 seconds)
17:22:31*CarpNet quit (Quit: Leaving)
17:27:13*MFlamer joined #nimrod
17:44:29*DAddYE joined #nimrod
17:45:38Araqhi DAddYE what's up?
17:45:57DAddYEhey dude!!!!!!
17:46:13DAddYEhow are u?
17:47:40Araqfine but tired
17:47:58DAddYEdon't tell me that, here quite an hell
17:48:06DAddYEdo u know thanksgiving thing
17:48:09DAddYE-.-'
18:24:56*Varriount joined #nimrod
18:26:48Araqhi Varriount
18:27:03Araqgeneric instantiation comes before lambda lifting
18:27:16Araqlambda lifting only deals with concrete routines
18:27:52Araqalso congrats for bringing up honey badgers. I really like the idea of using a honey badger for a mascot.
18:31:07*Varriount quit (Ping timeout: 272 seconds)
18:31:33EXetoC:p
18:32:51Araqsee? that happens when I'm friendly :P
18:35:47OrionPKMwe need a stylized mascot though
19:03:45*OrionPKM quit (Remote host closed the connection)
19:06:22*ics joined #nimrod
19:12:33*OrionPKM joined #nimrod
19:29:30*shodan45 quit (Quit: Konversation terminated!)
19:35:38*Jackneill quit (Ping timeout: 272 seconds)
19:40:23*OrionPKM quit (Remote host closed the connection)
19:44:12*OrionPKM joined #nimrod
19:45:02*BitPuffin joined #nimrod
19:47:32*Jackneill joined #nimrod
19:59:19AraqBitPuffin: that discussion was about your bug, don't worry
20:17:09MFlamerAraq: I sucessfully have Just(25) working as an enum constructor! (Another little milestone for me)
20:17:30Araqmflamer: cool :-)
20:19:56MFlameractually...I have var x = 25, var test = Just(x) working. I need to figure out how to create a heap copy of the value (25) in the ast now
20:20:17MFlamerbefore I pack it into the enum
20:27:48BitPuffinAraq: :D
20:32:39Araqmflamer: that's not your business. you can transform K(x) to T(kind: K, value: x) and let the code generator deal with a familiar thing
20:37:19MFlamerhmm..I don't understand
20:39:55*CarpNet joined #nimrod
20:41:21Araqbrb
20:43:33BitPuffinAraq: I appreciate you taking the time to fix it :)
20:43:40BitPuffinhelps me out a ton
20:48:25MFlamerI need something I can get the address of
20:54:16MFlamerAraq: what is the T in T(kind: K, value: x)?
20:55:08EXetoCname of the type that is to be initialised?
20:55:45EXetoCI assume that T is a type parameter :>
20:58:38MFlameryeah, but is this a proc?
20:59:12MFlameris that constructor syntax and I'm stupid?
21:01:59EXetoCyeah, but you can also assign to individual fields
21:03:42EXetoCit's often wrapped in a proc, so it's easy to miss
21:16:03Araqyeah T is a type here
21:16:23Araqand for your case it should be the hidden 'ref object' that your enum created :P
21:24:55MFlamerI'm sorry Araq, I still don't get it.Is T(kind: K, value: x) going to create a ref or ptr copy of the object or do something else with it? My thought was to check if the x in Just(x) is a symbol, if not and it is a value like (25) or whatever, then I would convert to the equivalent of new(x.typ) and so on
21:25:52Araqit would new() a ref object and then set its fields
21:26:00Araqand so copy the value
21:26:19Araqyou seem to have in mind some optimized representation?
21:27:42MFlamerso if I "int(nkPtr, 25)" in the ast, codegen is gonna handle the rest and give me a node I can take the addr of?
21:29:17*Varriount joined #nimrod
21:30:40*Jackneill quit (Remote host closed the connection)
21:31:41MFlamerhttps://gist.github.com/mflamer/7683587 maybe that will help you understand where I'm comming from
21:31:56Araqno, int(nkPtr, 25) is some optimization you have in mind
21:32:28Araqthe T(a: v) syntax onyl works when T is an object or a ref object
21:32:43Araqso any syntactic transformation that I describe here only works for that
21:33:36MFlamerOK, I just want to turn a value like "25" into a symbol of something I can take the addr of for now
21:35:05Araqwell you need to do the equivalent of nkStmtExpr(var x = value; x)
21:35:25Araqit's not trivial to turn a value into something that has an address
21:35:38MFlamerok, thats the ticket.
21:36:08Araqcan you elaborate how your enum is supposed to work?
21:36:14Araqyour gist is confusing
21:36:28MFlamerI'm sure it is
21:36:41AraqVarriount: please read the logs
21:45:01*boydgreenfield joined #nimrod
21:46:02MFlamerAraq: The idea is to combine an address and the variant in the word that makes up an enum(i'm forcing to a word size). The type associated with the variant is also kept around so I can cast out of the enum when the user tries to deref
21:46:31MFlamerSo its just a tagged pointer
21:47:32boydgreenfieldHi – quick question from a first-time nimrod user. I'm trying to learn nimrod and one simple program I want to put together is a Bloom filter implementation. What is the most efficient/idiomatic way to represent the underlying bit array? In Python, I've seen implementaitons in Python/Cython/C with just a malloc'd piece of memory and also using the bitarray package. Thanks in advance for any help and look forward to trying out
21:47:32boydgreenfieldnimrod! – Boyd
21:48:05MFlamerand eventually I will add more space to the enum to handle more variants
21:49:01MFlamerSo the gist is transforming Just(x) into "Just.ord or x.addr"
21:49:34Varriountboydgreenfield, in nimrod, you can have an array of bits. That would probably be the most efficient. You could also create a new type (Say, BloomBits) to hold the array, and associated data, and create procs to manipulate the data.
21:50:28VarriountAraq, any specific time span, or the entirety of the time I was disconnected?
21:51:39VarriountBy the way, the reason I'm being disconnected is because of a defective battery backup module attached to the unit that translates fiber optic signals from my isp to ethernet signals for the house.
21:52:05MFlamerhttps://gist.github.com/mflamer/7591727 here would be a a simple use example
21:54:44boydgreenfieldVarriount: Thanks! Is there a built-in bit type I've missed? Or should one use either the bool type or an integer and set the individual bits using bitwise operators on the array elements?
21:54:51VarriountAraq, I got disconnected earlier because the replacement battery lost power (it's not be charged, because the battery backup is defective)
21:56:09Varriountboydgreenfield, you could probably use the bool type, although my knowledge of low level bit operations is somewhat sketchy. I think someone around here recently made a raytracer in nimrod, they might have more experience.
21:57:12Varriountboydgreenfield, either bool or int, depending on which one you know how to manipulate the most.
21:57:24boydgreenfieldVarriount: Got it, thanks. Perhaps I'll start with bools (which is simple) and then look towards a more complex, but efficient implementation
22:00:45Araqnah, don't use bools, look at the "intsets" module
22:01:15Araqit uses a hash table of bitvectors
22:01:30Araqyou only need the bitvector part I guess
22:01:53AraqVarriount: just the recent history where I praise you ;-)
22:02:29Araqhi boydgreenfield welcome
22:03:23boydgreenfieldAraq: Thanks! (And I just saw that a bool uses a whole byte, so obviously that's not appropriate here).
22:03:54Araqmflamer: bitpacked pointers also require GC adaptions. However for your example you don't need any pointers
22:04:50MFlamerOnly refs, right? GC should ignore ptrs
22:05:00Araqwell you could store the 25 in a global and take its address
22:05:23MFlamerBut, I do want to use refs eventually
22:05:46Araqright only refs but ptrs would leak unless you add destructors and some automatic storage reclamation strategy
22:06:32MFlamerYes, I just want to get it working with ptrs, leaks and all. Then look into refs and GC
22:06:46Araqk
22:08:04MFlamerso, I'll try something along the lines of nkStmtExpr(var x = value; x)
22:33:15BitPuffindom96: cookies are just a string right?
22:34:52*CarpNet quit (Quit: Leaving)
22:43:33fowleverything is strings in tcl and string theory
22:47:59dom96BitPuffin: I can't remember.
23:11:06OrionPKManyone know of any examples of zlib usage in nim?
23:14:37dom96you basically use compress() and uncompress()
23:17:19Varriountcompress(OrionPKM)
23:18:07fowlOrionPKM, i used it in keineschweine
23:20:32Varriountfowl, ... no pigs?
23:20:44fowlyes
23:21:06Varriount...?
23:21:09OrionPKMah, thanks guys
23:21:24VarriountHow do you compress a pig?
23:22:50fowlVarriount, files are compressed by the server and uncompressed by the user when they recieve them
23:29:33BitPuffindom96: :/
23:29:44BitPuffingotta narrow down where the error is
23:34:41OrionPKMdom96 is there any way to inject a header into a ./public static file?
23:34:44OrionPKM(in jester)
23:36:10dom96you can create a route to that file, set the header and serve the static file manually
23:36:31OrionPKMwell, obviously :P
23:36:47OrionPKMwas hoping to do it a bit more dynamically
23:37:10dom96like how?
23:38:03OrionPKMperhaps something like an overload on setStaticDir that lets you input arbitrary headers
23:43:05dom96yeah, there is no way then :P
23:44:06*webskipper joined #nimrod
23:46:23BitPuffingoodnight guys!
23:50:42*BitPuffin quit (Ping timeout: 246 seconds)