<<11-07-2012>>

00:00:55*KarmaScript quit (Ping timeout: 250 seconds)
00:25:27*zahary quit (Read error: Connection reset by peer)
00:56:05*Trixar_za is now known as Trix[a]r_za
06:51:04*Trix[a]r_za is now known as Trixar_za
07:25:26*Trixar_za is now known as Trix[a]r_za
09:18:17*zahary joined #nimrod
09:21:27*XAMPP quit (Read error: Connection reset by peer)
12:38:36Araqping zahary
13:51:55zaharyhi Araq
14:42:37*SchalaZeal joined #nimrod
14:42:59SchalaZealWell it looks like I flubbed a little on that PCRE wrapper
14:56:37SchalaZealhmm... the SSL functionality of sockets module... should I be able to call s.wrapSocket(protTLSv1) if s is a TSocket?
14:58:07SchalaZealoh wait
14:58:13SchalaZealneed to define ssl
14:59:03SchalaZealIs there a way I can programmatically define symbols? Passing them over command line every compilation is getting annoying
15:03:12TasserSchalaZeal, symbols?
15:05:38SchalaZeallike... for example, sockets module requires "ssl" to be defined
15:06:16SchalaZealWhy can't I just put something like define(ssl) instead of having to pass -d:ssl every compile?
15:06:40SchalaZealerr SSL features of the module require it I mean
15:08:18SchalaZealsomething like C's define
15:08:23SchalaZealerr #define
15:08:42Tasseryou could use a projectfile
15:08:57SchalaZealhow?
15:10:38Tasserehm
15:11:26*XAMPP joined #nimrod
15:14:26SchalaZealWell a bit of good news... just made a client for the Wired P2P protocol
15:16:21SchalaZealall it does is fetch and echo server info currently
15:16:52Tasserc2nim? :-)
15:17:32SchalaZealdoesn't c2nim just transform #define ssl into const ssl = true?
15:18:24SchalaZealI don't think that counts as a define, does it?
15:22:59SchalaZeal...oh nuts.......
15:23:40SchalaZealApparently I now have to find some way of getting Nimrod to read an image file into a Base64 encoded strong
15:23:42SchalaZealstring*
15:24:15SchalaZeallucky me...
15:24:44TasserSchalaZeal, readfile + base64 encoding?
15:27:56SchalaZealyou mean like store an entire PNG file as a string?
15:30:54SchalaZeal.......in terms of saving settings, that's gonna be a big .cfg file lol
15:37:45TasserSchalaZeal, what's the difference between a png file and a string?
15:38:05SchalaZeal..........I don't know...heh
15:38:59SchalaZealin terms of sending a Base64 encoded image over a socket though, I'm a bit worried if the wrong line length will bork the image
15:42:58SchalaZealor is that for readability?
15:53:40SchalaZealah nvmd... I'll test it
15:54:44*SchalaZeal quit (Quit: Konversation terminated!)
16:15:53Araqping zahary (again)
16:16:01zaharypong
16:17:49Araqah finally
16:22:01Araqso any opinion on the new integer promotion rules?
16:33:42dom96hello
16:34:04dom96ok, so I am off work tomorrow.
16:34:10dom96So, Nimrod time!
16:34:20Araqhi dom96, cool
16:34:27Araqmy connection is getting worse again
16:34:44dom96Well as long as you have a BNC you should be fine.
16:35:14Araqno ... it's *very* annoying
16:35:41dom96Call your ISP and complain?
16:36:04Araqwell they warned me ...
16:36:15Araqto use a new router for DSL "3000" or whatever ...
16:37:26dom96lol?
16:37:55dom96Get a new router then :P
16:40:15dom96hrm, so I guess I misspelled the deprecated pragma in ssl.nim?
16:45:05Araqyeah ...
16:45:10Araqand the tester still doesn't test that at least every module compiles :-/
16:48:51dom96Araq: Yay. Your changes didn't break jester :)
16:49:12Araqwebapps don't do much integer math I suppose
16:49:22dom96yep :P
17:08:18*fowl quit (Ping timeout: 246 seconds)
17:11:03zaharyAraq, I haven't tried to write code agains the new rules yet - do you have some doubts about them now?
17:17:05Araqzahary: I have 2 doubts:
17:17:42Araq1) compiler now disallows implicit conversion from int to int32
17:17:50Araqwhich can be annoying for C interfacing
17:18:14Araq2) var x = 90 mod 2
17:18:26Araqmakes 'x' of type 'range[0..1]'
17:18:43Araqwith the resulting range check errors should 'x' be re-assigned
17:18:57Araqmaybe you wanted 'x' to have type 'int' instead ...
17:20:07Araqbut it's the proper behaviour for 'let'
17:20:28Araqand I don't want to have different type inference rules for 'var' and 'let'
17:21:32Araqhowever I don't think (2) is an issue; it's quite common that the constraint for the 'var' should also hold for re-assignments
17:38:38zaharyhmm, range[0..1] sounds useful in theory if it allows for detection of errors in array indexing and ommiting range checks in sequence checks
17:40:01zaharyI guess, there are two types of range types tho - open ranges that can "grow" by subsequence oprations like assignment and closed ranges that follow the current behavior
17:41:52zaharyI originally have imagined such types as dependent type properties and with dependent types it's perfectly fine to know something at some point and then to revert to "unknown" state
17:42:16Araqyes it's the beginning of dependent typing
17:42:28Araqit quite useful to be able to do:
17:42:41Araqproc random(n: int): range[0.. n-1]
17:42:52Araqbut that's of course not supported
17:42:59Araqinstead you have to make 'random' a template
17:43:06zaharydid you understood my point - I think I used too many words :)
17:45:19AraqI'm not sure I got your point
17:45:55Araqbut I knew we both want dependent typing :-)
17:47:03zaharywhen a variable is typed range[0..1], this just means that the compiler have proven that at this point in the program these are the possible values. I think it's perfectly fine the type to be relaxed later to range[unknown] if the variable is reassigned (the compiler no longer knows anything about it)
17:47:32AraqI see
17:47:44Araqthat's not good
17:47:55Araqvar x = 4 mod 2
17:48:06Araqp(x) # pass to uint8 implicitely
17:48:14Araqx = 400 # argh
17:48:39Araq'range' affects type compatibility
17:48:54Araqyou can't pass an 'int' to an uint8 implicitely
17:49:22Araqand I don't want to re-typecheck
17:50:14AraqI'd rather make the compiler promote an implicit range back to 'int' for variables
17:50:25Araqand only keep the range for 'let'
17:50:31Araq(and 'const' of course...)
17:50:35zaharywell, the way I imagined it previously, the range part is ortogonal to the real machine type
17:51:01Araqsure but it's just too cool to allow:
17:51:08AraqpassToByte(x and 0xff)
17:51:25Araqso I conflated these notions
17:53:26Araqwell to be honest
17:53:51AraqI'd simply disallow any kind of implicit conversion between integer types
17:54:07Araqas it only leads to sloppy coding
17:54:14Araqbut people don't accept that I hink
17:56:46zaharyif range[0..1] is the begging of dependent typing, try to imagine how you'd like ints to work when dependent typing is fully supported
17:57:39Araqwell for a start we'd allow variables as bounds range[n..m]
17:57:46zaharyshouldn't my "range relaxing" scenario work then?
17:59:22Araqmaybe :-)
17:59:46Araqit's easy to oversee something
18:00:05Araqas we already have some fixpoint computations planned
18:00:27zaharymaybe you should treat the range as appendix to the int type
18:00:27zaharyx and 0xff produces (int, range[0..ff]) which is implicitly convertible to byte
18:00:53Araqwell that's how it is implemented already
18:01:02Araqunless I misunderstand you?
18:01:16Araqa 'range' has a base type
18:01:23Araqrange[0..1] of type int
18:01:25zaharywell, then x = 400 just reassigns the type to (int, range[400..400])
18:01:57Araqbut it's too late then
18:02:15Araqthe compiler already let 'x' be passed to the proc
18:02:32zaharymaybe we're imagining how dependent typing should work in different ways
18:03:08Araqwell apparently you also want flow analysis here
18:06:42zaharyyes, in my mind the dependent properties are updated by the statements in the program - each op/proc call has a runtime part and compile time part indicating how the dependent type variables of the participating symbols are to be updated
18:08:07Araqwell that's what an optimizer does
18:08:35Araqthey always tend to have lots of cool stuff that you really want in the frontend in the first place ...
18:09:04Araq"optimizing" and "proving properties of the program" is really the same
18:09:16Araqit doesn't make too much sense to only have it in a backend
18:09:27Araqand then lose all the nice warnings etc.
18:10:30zaharywell, here again range checks are the most common type of analysis and maybe some optimizers already care about them, but I imagine all sort of domain specific analysis that can be performed by libraries - the obvious ones are things like "you should not call function X, before you have done Y"
18:10:57Araqsounds like type state to me :-)
18:11:20zaharywell, yes - if you remember that's how I originally was calling the whole feature :)
18:11:36Araqyou?
18:11:46AraqI thought it was "Rust" ;-)
18:11:55Araqwell the authors of the paper really
18:12:00Araq(forgot the names)
18:14:00Araqanyway: I plan to have a new field in an AST node
18:14:09Araqthat's "constraint: PNode"
18:14:16zaharyI meant I was advertising the rust type state system to you (which is less general btw) and a bit later we settled on calling it dependent typing
18:14:43Araqfor all sorts of analyses
18:15:11Araqbut I'd prefer to get rid of the "comment" field so memory usage stays the same :-)
18:15:20Araqbefore that
18:15:24zaharyI think these are just variables attached to symbols - I also used to call them symbol-attached properties
18:15:46zaharyevery type defines what kind of compile-time variables it has
18:16:05Araqah yeah I thought about this too:
18:16:24Araqif x >= 0 and x <= 10:
18:16:38Araq # x's constraint in this branch is range[0..10]
18:16:45zaharyyes, exactly
18:17:04Araqjust a mapping from PSym to some constraint in PContext, right?
18:17:15Araqin fact, a shadow symbol table ...
18:18:31Araqbtw do you have any experience with coq?
18:18:43zaharywhy do you say "constraint in PContext"? I think here x is of type int and it has maxValue and minValue compile time properties, so the symbol x just holds a bag of properties
18:19:18Araqbut you need to push and pop properties
18:19:30zaharyit's up to the int library to define how maxValue and minValue will be used - well, obviously here the "int library" is the compiler itselft
18:19:46Araqand these stack operations can be attached to the scoping rules
18:20:07Araqthat's what I mean by "shadow symbol table"
18:20:30Araqthe constraint only holds over some statements
18:20:39Araqit's not only a property of 'x'
18:22:41zaharyalright, I see what you mean, but I see this as implementation detail - I actually imagined a implementation where the updates (and restores to previous values) of these properties are intermingled with the regular code that opens and closes scopes
18:35:48AraqI thought we're already talking about the implementation :-)
18:36:07Araqbut I have to go soon, some final remarks:
18:36:37Araq1) we really need a better notion of construction to get rid of 'nil', for instance
18:37:14Araq2) control flow analysis should be simpler than in other languages as we have no 'goto'
18:38:03zaharywell, we need default contructors - strings are sequence are quite a trap to newcomers
18:38:27Araqyeah I know
18:38:43Araqbut maybe a warning for a start suffices
18:38:53Araq(which requires control flow analysis)
18:39:01zaharyI also want to get some of the C++ partial construction unrolling behavior
18:40:03Araqugh I don't ...
18:40:13Araqtoo much magic for my taste ...
18:40:28zaharyresult.foo = bar()
18:40:28zaharycode code
18:40:28zaharyshould be transformed
18:40:28zaharyresult.foo = bar()
18:40:28zaharytry:
18:40:28zaharycode code
18:40:28zaharyexcept:
18:40:29zaharydestroy result.foo
18:40:29zaharyraise
18:40:44zaharybut it's hard to write correct code without these
18:41:40Araqmaybe ...
18:41:44zaharyhere is the classic C++ paper that took several years to disprove in C++
18:41:45zaharyhttp://ptgmedia.pearsoncmg.com/images/020163371x/supplements/Exception_Handling_Article.html
18:42:13zaharyand the only solutions heavily rely on partial unrolling behavior
18:47:06dom96s/is/are/
18:47:07dom96DAMN IT
18:51:13AraqI dunno
18:51:15Tasserdom96, git push --force
18:51:37Araqthese examples are always about transactions in a way
18:51:59Araq"the object is still in a valid state should 'push' throw an exception"
18:52:28Araqtransactions are hard and also expensive
18:52:40Araqor better: *and thus
18:53:27AraqI haven't made up my mind yet what's the best approach to solve the transaction problem
18:53:54Araqbut the constructor becomes too special if its does partical unrolling behind your back IMO
18:54:56Araqthis feature may push people to use heavy constructors that do much work
18:55:04Araqto get this nice partial unrolling feature
18:58:06zaharyevery function is a contructor - that was a valid point of yours
18:58:46Araqyeah
18:58:50dom96Tasser: hrm?
19:00:07AraqI'm not against unrolling, but we should think if we can't detach that from constructors
19:00:07zaharyso, it's just a rule about how the constructed bits of the result variable are automatically destroyed if the proc is left with an exception
19:00:26Araqit might turn out to be:
19:00:27Tasserdom96, change history, push :-)
19:00:40Araqproc x(obj: T) {.unroll.} = ...
19:00:46dom96Tasser: meh, it's not that important :P
19:00:50Araqinstead of 'destroy' ...
19:00:52TasserAraq, welcome to reversable programming?
19:01:31zaharyer, destroy is for destructors only, and we care about construction here
19:01:43Araqmake that:
19:01:50Araq'in addition to destroy'
19:01:58zaharybut if you dislike unrolling by default, pragma is good enough for me
19:06:14Araqzahary: yeah sure
19:06:55Araqhowever what about 'except: unroll(x)'?
19:10:31zaharyit's bassically what the proposed solution is doing automatically
19:11:06Araqnot really
19:11:13Araqif I understood it correctly
19:11:16zaharyfor every destructable variable that is field of the result, insert the except exit code
19:11:25AraqC++ writes the 'unroll' code for you
19:12:06zaharyyes, if you used the initializer list properly
19:12:29AraqI suppose you then write 'removeFile(f)' in the destructor?
19:12:43AraqI'm thinking about a proper transaction
19:12:45zaharywhat is removeFile here?
19:12:49Araqwhich involves file creation
19:13:09zaharysay you want to create 2 files in a constructor
19:14:15zaharyyou'll have to implement a separate File class and have 2 members of it
19:14:15zaharyyou have to initilize them like this: CompoundCreation(f1, f2: path): file1(f1), file2(f2) {}
19:14:37zaharythen C++ will erase file1 if something happened during file2 initialization
19:16:53Araqalright
19:16:57Araqthat's what I thought
19:23:15Araqit's also not correct IMHO ;-)
19:23:36Araqas a destructor should close the file on success, not erase it
19:23:45Araq'unroll' is not 'destroy'
19:24:01Araqit's an "in case of error, do this"
19:24:35Araqin C++ you likely have a bool and then a distinction in the destructor
19:24:53Araqas it needs to do different things
19:35:00zaharywell, what's the goal of the class? to temporarily create 2 files that should be deleted on program exit? then the members type will be something like TempFile
19:35:19zaharyor is the goal to either create 2 file or none
19:35:36Araqactually the goal is to write immediately in a transaction log
19:35:54Araqand to delete these on success
19:36:07Araq(or something like that)
19:36:45Araqmaybe you wouldn't put the "success" operation in a destructor though
19:38:23Araqhowever, my point is:
19:38:38Araqconstruction fails -> C++'s invokes a destructor
19:38:50Araqbut in the destructor the information is lost
19:39:01Araqthat it's run because of an *exception*
19:39:10Araqso you need to reconstruct this information somehow
19:39:14Araqin the destructor
19:39:48Araqinformation is thrown away
19:39:52Araqnot good
19:40:36zaharyI don't follow - if there was exception during construction, the destructor *wont* be called - the point is that it's not safe to call it, because the object may be in incomplete and arbitrary state
19:41:01zaharybut if you have constructed parts of the objects, you have to destroy them somehow, otherwise there may be leaked resources
19:41:31Araqin your example, file1's destructor is invoked
19:41:43Araqif CompoundCreation fails
19:45:59zaharyyes - and I asked what's the goal of the CompoundCreation? if it's not an object holding 2 temporary files, but rather have to represent a transaction of "either create 2 files or none", then you have to use something like FileCreationGuard that has a "discharge" method or you can use regular try/catch blocks
19:49:58zaharyif your point is that there can be another class of destructors that only trigger during exceptions that's interesting idea
19:50:37zaharyit's easily handled with a template tho
19:51:06zaharytemplate createFileInTransaction =
19:51:11zaharycreateFile
19:51:20zaharyexcept: deleteFile
19:52:05Araq"if your point is that there can be another class of destructors that only trigger during exceptions that's interesting idea"
19:52:06Araqthat is my point, yes
19:56:31Araqoh and I know that C++'s way is sufficient btw
19:56:41AraqI'm trying to find an IMHO cleaner solution though
19:57:03zaharyalright, but for leak prevention the partial unrolling is very helpful
19:57:20*fowl joined #nimrod
19:58:19AraqI'd think so as these are C++'s major pain point :-)
20:10:01fowlis there an example use of the json parser
20:11:57fowlhow come TJsonNode/JFloat/fnum isnt exported, it is the only value in TJsonNode that isnt
20:12:46Araqit is exported in the github version
20:12:48dom96They are exported.
20:12:56Araqwas just a typo in the old version I think
20:13:01fowlah
20:13:26Araqmarshal.nim uses the json parser
20:19:29fowlwtf i added the * locally but i still get Error: unhandled exception: fnum is not accessible [EInvalidField]
20:22:33Araqlol
20:22:56Araqif it's runtime error, it's no visibility issue
20:23:11Araqyou try to access the field even though it doesn't exist
20:23:33fowloh
20:23:45fowlso its probably not a float but an int
20:24:02Araqn.kind will tell you
20:26:27dom96Araq: https://github.com/nimrod-code/nimbuild/issues/3 Thoughts?
20:27:55Araqsounds good but there are more important things to do
20:28:10dom96I know.
20:28:15dom96Just trying to organise my ideas :)
20:29:05Araqand I would not use jester for it, frankly
20:29:17Araqit's not really a webapp
20:29:25Araqplus jester has to change quite a bit
20:29:35Araqonce we have a better templating system in place
20:29:47AraqI mean a better macro system
20:30:13dom96It's a website.
20:30:18dom96It can use jester :P
20:31:16Araqwhat?
20:31:37Araqit's mostly a backend system with a static "results" page, right?
20:32:07dom96Read my ideas again
20:33:10AraqI see
20:33:20Araqyou're about to make it a real webapp
20:33:43AraqI hope you keep security in mind then ;-)
20:34:45dom96No, I want to let everyone rebootstrap at will :P
20:37:35Araqgood :D
21:13:09Araqah there is another idea I had, zahary
21:13:32Araqwe have extended string literals right now
21:13:49Araqand we now have 0i32 (without the ')
21:14:13AraqI want to support 0ms
21:14:26Araqthat would be transformed to:
21:14:37Araq`? ms`(0)
21:14:41Araqby the compiler
21:15:23Araqso you don't need to have a proc named 'ms' (which is short enough to collide with something)
21:16:33Araqbut then for consistency the raw string identifiers should be transformed to:
21:16:47Araq`re ?`("[a-z]")
21:23:25zaharyI had similar idea for my hypolang - there were supposed to be namespaces there and 2ms is mapped to units.ms(2)
21:23:25zaharyfor a nimrod-based solution I considered mapping it to unit(static{"ms"}, 2)
21:23:45zahary... with another helper that creates such overloads more easily
21:25:30zahary`? ms` looks nice too
21:27:41Araqalright
21:27:48Araqstill unsure to break code again
21:27:48zaharyI spent quite some time thinking whether 12ms2 (as in miliseconds squared) should be mapped to ms(12, 2) or to ms2(12)
21:28:09Araqmap it to ms2
21:28:38zaharythere are some possible generalizations when playing with the powers
21:28:47AraqI know
21:28:53Araqbut I think it's overkill
21:29:54Araqand you really want ms² anyway
21:30:09Araqand nimrod's unicode support should allow for that
21:31:29zaharywell, the IDE is supposed to provide the pretty printing
21:31:57Araqafaik the clay guys had 0i16 and now have 0s (for 'short' I think)
21:32:06Araqas it's ugly to look at
21:32:42AraqI like 0i16 better though
21:32:49Araqas 'short' is arbitrary
21:32:58zaharyand s even more
21:33:01Araqand 0s means "0 seconds" anyway
21:33:08Araq;-)
21:33:15zaharyyep :)
21:36:33Araqbut the string literals are problematic
21:36:48Araqre("abc") # common too
21:37:05Araqand we also have:
21:37:16Araqsql"select ..."
21:37:25Araqsql(dynamicQuery)
21:37:33Araqand TaintedString""
21:37:57zaharyyeah, I don't think you should change the prefix form
21:38:53Araqyeah the consistency is not worth it
21:39:04Araqunits are different from extended string literals anyway
21:39:17Araq(a bit)
21:42:13zaharyI once considered this too
21:42:13zaharyproc milliseconds(x: int): TTime[..., 1000] {.shorthand: 'ms'.}=
21:53:17Araqhm as names 're' and 'sql' are already "optimized" for string literal usage
21:53:19Araqso maybe "shorthand" is the way to go
21:53:22Araqbut I need to sleep now
21:53:28Araqgood night
22:16:06*XAMPP[0] joined #nimrod
22:16:41*XAMPP_ joined #nimrod
22:17:22*Trix[a]r_za is now known as Trixar_za
22:20:30*XAMPP quit (Ping timeout: 264 seconds)
22:20:37*XAMPP[0] quit (Ping timeout: 246 seconds)
22:26:06*XAMPP_ quit (Quit: There is no such thing as coincidence, only the inevitable.)
22:42:06*XAMPP joined #nimrod