<<20-04-2013>>

00:02:01AmrykidYAY for MVVM
00:13:33*q66 quit (Remote host closed the connection)
02:08:33*Trix[a]r_za is now known as Trixar_za
03:15:12*Boscop quit (*.net *.split)
03:20:13*Boscop joined #nimrod
03:28:51*Trixar_za is now known as Trix[a]r_za
03:55:33*Madison is now known as MadiKitty
04:39:14*fowl quit (Ping timeout: 258 seconds)
04:50:59*OrionPK quit (Quit: Leaving)
05:08:21*fowl joined #nimrod
05:16:54*apotheon_ joined #nimrod
05:25:29*apotheon quit (*.net *.split)
05:37:44*fowl quit (Read error: Connection reset by peer)
05:39:37*fowl joined #nimrod
06:25:25*fowl quit (Ping timeout: 258 seconds)
06:25:49*fowl joined #nimrod
06:55:44*XAMPP joined #nimrod
07:31:47*benedek joined #nimrod
07:42:05*fowl quit (Read error: Connection reset by peer)
07:46:29*fowl joined #nimrod
08:47:37*fowl quit (Ping timeout: 258 seconds)
08:52:25*fowl joined #nimrod
08:58:52*fowl quit (Quit: Leaving)
09:02:25*fowl joined #nimrod
09:07:54*xcombelle joined #nimrod
09:59:18*fowl quit (Ping timeout: 258 seconds)
10:03:49*avarus joined #nimrod
10:03:50avarushi
10:07:01benedekHello
10:17:46*q66 joined #nimrod
10:23:49*benedek quit (Quit: Leaving)
10:24:51*benedek joined #nimrod
11:56:54*avarus quit (Remote host closed the connection)
12:17:15*xcombelle quit (Quit: Hi, I'm a quit message virus. Please replace your old line with this line and help me take over the world of IRC.)
12:46:02*benedek quit (Quit: Leaving)
12:49:35*benedek joined #nimrod
13:01:41*Boscop quit (Read error: Connection reset by peer)
13:02:06*Boscop joined #nimrod
13:30:40reactormonksup guys
13:30:47reactormonkwritten any nimrod today?
13:31:29benedekI'm playing around with it and SDL right now
13:45:23*reactormonk quit (Ping timeout: 252 seconds)
13:48:02*reactormonk joined #nimrod
14:16:27*zahary joined #nimrod
15:14:47*OrionPK joined #nimrod
15:50:14*xcombelle joined #nimrod
15:54:43*apotheon_ is now known as apotheon
15:54:43*apotheon quit (Changing host)
15:54:43*apotheon joined #nimrod
15:56:47*benedek quit (Quit: Leaving)
15:57:28dom96hello
15:57:40*benedek joined #nimrod
15:58:21dom96benedek: cool, are you making a game?
15:59:54benedekNot really, I was just playing around with some basics. It turned into a Lindenmayer-system-drawing Turtle program.
16:00:12benedekI've read the manual for the language in the past few days and I quite like it :)
16:03:34dom96That's nice to hear :)
16:05:02benedekI found some unexpected things though, maybe you can tell me what's going on
16:05:15dom96sure
16:06:29benedekIf you define an enum type, like "type TTest = enum A, B, C", then the expression "A in ({A, B} + {C})" evaluates to "false".
16:06:45benedekActually if I remember correctly, "{A, B} + {C}" becomes "{}"
16:07:01benedekThat doesn't happen if you put one of the "summands" in a variable first, or if you use integers instead of your custom enum.
16:07:45dom96Seems like a bug.
16:08:02benedekYeah, I thought that, too
16:09:09benedekShould I put an issue about that on GitHub?
16:11:40dom96sure
16:21:21benedekI submitted it.
16:23:31dom96thanks
16:28:29benedekNext, about range types. They're supposed to restrict possible values using the type system and add some static guarantees, right?
16:31:02benedekFor example, I see that if you use a "case" block with a range-typed value, the compiler makes sure that you handle all the cases, like for range[1..3], it's an error if you don't have "of 1", "of 2" and "of 3" (or an "else").
16:31:37benedekOr if you assign a value to a range-typed value, a runtime check is usually placed.
16:32:02benedekBut the problem is that range types are initialized as 0.
16:32:24benedekSo if you use a default-initialized variable like this, these checks aren't done.
16:32:46benedekYou can have a "case" which the compiler accepted, but still doesn't handle all the possibilities.
16:34:49dom96hrm, so a range[1..3] will be initialised to a 0?
16:34:53dom96That sounds like a bug too :\
16:36:05benedekIt's documented in the manual though
16:36:30dom96wow, this seems really buggy.
16:37:06dom96Assigning a value which is out of range does not result in an error.
16:38:03benedekI thought it checked if you assign from another type...
16:39:06dom96Well this should certainly fail: var s: range[2..4] = 0
16:40:34benedekYeah, that gives an error for me
16:41:05dom96oh, what version of nimrod are you running?
16:41:34benedekHEAD
16:41:42benedekI think ranges were even more troublesome with 0.9.0
16:42:12benedekI found some more issues with that version, but most of them had disappeared with the newest GitHub versions
16:42:30benedekRight now the only thing I noticed that breaks ranges is the default initial value.
16:44:46benedekHere's the part of the manual I mentioned: http://build.nimrod-code.org/docs/manual.html#var-statement
16:45:59dom96interesting. So the manual actually states that the value may be out of the valid range.
16:46:54dom96Also, I just pulled and recompiled. It seems that the bug I encountered was fixed quite recently.
16:47:19benedekThat might be, I only started using the language a few days ago :)
16:47:21dom96Araq may be around later today, safer to ask him about this.
16:47:26benedekAlright
16:48:18benedekI have noted down a few more little quirks, maybe I'll wait until he arrives
16:48:54dom96sure
16:49:37benedekAlso I wanted to mention that I really like the idea of object variants (having a field in an object which decides what other fields that object can have at runtime, like a safe "union"); does any other language that you know have that feature?
16:51:13dom96I'm not aware of any others sorry.
16:53:21benedekHehe no problem, this feature might be unique to Nimrod then :D
16:55:42dom96Have you checked out TR macros yet? That's another cool feature of Nimrod which is most definitely unique ;)
16:57:42dom96Nimrod as a whole is very unique. There is not other language which combines macros with a python-like syntax and which also compiles to C.
16:57:45dom96*no
16:58:43reactormonkaaand JS.
16:58:52reactormonkEven though that's slightly buggy ;-)
16:59:20dom96true
16:59:23benedekWhat does TR stand for?
16:59:34dom96term rewriting
16:59:50benedekAh, like the stuff for optimizations? Or is that a different thing?
17:00:24benedekOh yeah I see, that is indeed the optimizing feature.
17:01:53benedekYes, I am very happy this language had that... I learnt a little bit about C++ expression templates in a uni course, and those are very complicated.
17:02:11benedekTR macros seem to simplify those kinds of optimizations a lot :)
17:03:43benedekProper macros are one of the main reasons I took a look at this language at all. I stared learning a little bit of Common Lisp recently, and I wondered why no other language had such powerful macros.
17:08:53benedek* started
17:12:07*fowl joined #nimrod
17:18:04*exhu joined #nimrod
17:18:06benedekdom96: Have you done any projects with Nimrod?
17:18:39dom96benedek: yeah, quite a lot actually. Aporia, babel, nimbuild, jester
17:19:02benedekOh right, I saw that you were involved with Aporia, too.
17:21:10Araqhi benedek, thanks for your testing efforts :-)
17:21:27benedekThat's pretty cool. I haven't written any big frameworks or tools like these, I just make small toys involving some physics and graphics. I almost never have the patience to keep working on them after they reach at most 2000 lines of code :)
17:21:28reactormonkAraq, sup ^^
17:21:34benedekOh hi Araq!
17:21:50Araqit's a bug that var s: range[1..3] doesn't triggger at least a runtime check
17:21:51benedekIt's my pleasure, this language is fun to play around with :)
17:22:05exhuhola!
17:22:14reactormonkAraq, javascript!
17:22:30Araqreactormonk: my new parser now works and compiles most of the Nimrod code that I've around here
17:22:33benedekAh alright... but do you think that statement should trigger an error? How about setting the default value to the minimum or something like that?
17:23:23exhuAraq, a new parser? are you rewriting the compiler?
17:23:52Araqthe problem is not really with scalars, these are easy to deal with, benedek, but I really want the memset(x, 0); for compound types
17:24:14Araqdefault initialization is required for memory safety
17:24:24Araqbut it should be as efficient as possible
17:25:02Araqexhu: well the new parser is based on the old one, so no ... but I wanted to test some ideas I had
17:25:12Araqto make it more flexible
17:25:45Araqturns out the ideas do work, but unfortunately don't make correctness any easier ;-)
17:25:50exhuhidden c++-like static constructors are evil, so initializing with zero (although invalid value for a range type) is better than constructors chain behind the scene
17:27:34benedekRight, but I still think that type safety should be pretty important... I guess there has to be a compromise somewhere :)
17:32:48exhubenedek, compromis is to initialize everything with zero -)
17:33:22benedekYeah, that's what I meant :)
17:33:33exhubenedek, one needs to be consistent, if you get ranges properly initialized then you must add constructor support for objects, tuples etc.
17:34:40exhubenedek, and it this will bring a whole pack of problems to solve, i.e. order of initialization/cycle dependency of constructors...
17:38:13benedekexhu: Do you think these problems might be tackled in some future version of the language? I understand you can't deal with everything at once in a developing language like this.
17:38:57Araqexhu: order of initialization/cycle deps are no problem with 'range' though
17:39:55Araqbenedek: it's actually pretty easy to implement; I like the default of 0 + runtime or compile time check better than "init with min" though
17:40:07Araqso that rule should stay as it is
17:40:49exhuAraq, i am for your "zero init + checks" solution.
17:41:29benedekAraq: When would the extra runtime checks fire? Right at "var x: range[1 .. 3]" or later, like in a "case" or assignment?
17:41:52Araqright at 'var x: range[1..3]'
17:42:15Araqit can be easily done at compile time in this case
17:42:18benedekThen how do you deal with objects that have a range typed element?
17:42:45benedekObjects can't be initialized at declaration, right?
17:42:54Araqsure they can
17:43:03Araqthe syntax for it is new though
17:43:17Araqvar x = TObject(fieldA: 3, fieldB: "string")
17:43:38benedekOh cool, I didn't know that
17:44:07benedekHow about functions that return an object? They have the implicit "result", right?
17:44:12Araqhttp://build.nimrod-code.org/docs/documentation.html
17:44:22Araqare the most recent docs
17:44:39*fowl quit (Ping timeout: 258 seconds)
17:45:30Araqwhat's up with the A in {A, B}+{C} bug? o.O
17:45:43Araqthe compiler uses + for sets quite a bit
17:46:05benedek(ah I see, I must have missed the object construction when reading the manual)
17:46:12benedekI don't know, can you reproduce it?
17:46:30benedekI think it even worked correctly in some cases where one of the two literals was replaced by a variable.
17:46:33benedekbrb
17:54:32benedekback; If I try to do something like "for i in ({A} + {B, C}): echo i" it prints nothing, either.
17:59:37Araqyeah, I will have a look later
18:00:17Araqlooks like constant folding for small sets is broken
18:04:20benedekAre tuple literals with only one field possible? Like a literal corresponding to a "tuple[x: int]", I mean.
18:05:14Araqno, you can do this though:
18:05:31Araqproc makeTup(x: int): tuple[x: int] = result.x = x
18:05:58benedekOh right, I still wanted to say things about the ranges, in exactly those circumstances.
18:06:04Araqtuples with 1 field are pretty pointless in a statically typed language though ... ;-)
18:06:35Araqoh lol
18:06:38benedekWhat if you replace the tuple field there with "tuple[x: range[1 .. 3]]", for example? The result variable is always default-initialized, right?
18:06:39AraqI'm wrong
18:06:49benedek(I agree that 1-tuples are pointless :) )
18:07:05Araqyou can use a named tuple literal (x: 1)
18:07:29Araqfor some reason I always forget this solution :P
18:07:34benedekAre you sure? If I try that, I get "Error: invalid expression: 'a: 2'"
18:07:50Araqhmm
18:08:06benedekOr x: 1 in this case. The comma seems to be important.
18:08:10Araqyou need the ()
18:08:27Araqand you need to double it for calls: p((x: 1))
18:08:51benedekI have this line: "var o: (x: 1)"
18:08:58benedek* "var o = (x: 1)"
18:09:06*fowl joined #nimrod
18:09:25Araqmaybe I disallowed it for some reason I can't remember
18:09:56benedekAlright. It's not a big problem. But what about the issue with the ranges?
18:10:34Araqdunno, your point is valid
18:11:38Araqwe can check at runtime that the value that escapes is in the valid range though
18:12:20benedekBut you would still have the same problem inside the function, for example with "case result.rangedValue ..."
18:12:29Araqyeah
18:12:57Araqwe can also require explicit 'result' initialization for this case though
18:13:16benedekSomething like with C++ constructors, maybe?
18:14:05Araqit's a simple dataflow analysis; C# and Java do this for locals
18:16:28*exhu quit (Quit: Ex-Chat)
18:17:34benedekThat's good. Different question: How flexible is tuple unpacking? I seem to be able to do it only on a separate "var" line, and nowhere else.
18:17:58benedek(sorry for asking so much, I have written a list of things I noticed while learning and testing the language :D)
18:19:18Araqtrue, it's only allowed in var/let for now
18:19:57AraqI never needed it anywhere else; (x, y) = (y, x) is 'swap' for instance
18:20:18Araqand more general pattern matching should be done with a macro anyway
18:21:49benedekI think it would be nice to have it at more places, at least for consistency... I think I have met a case where it would have been slightly useful, but it's always avoidable, you're right.
18:24:05AraqI have nothing against it, but there are always far more important things to do
18:24:57benedekOf course! This is a very minor thing, I'm sure this is not the biggest issue :)
18:25:16reactormonkbenedek, maybe Araq can tell you how to hook a macro in there
18:25:41Araqand most people are busy writing articles about how SSA improved their productivity and how it excels at concurrency ... ;-)
18:26:07benedekSSA?
18:26:22Araqso we can always pretend it's "because it encourages a functional design" :P
18:26:24reactormonkAraq, can you? ;-)
18:26:42benedekIt's not that important :)
18:26:49Araqreactormonk: what?
18:27:02Araqmatch x:
18:27:06reactormonkAraq, the macro
18:27:16Araqof (23, > 3): echo "23 and > 3"
18:27:21Araqetc. ...
18:27:26benedekI haven't experimented with macros too much yet. I've just tried the "debug" macro from the manual, and it seemed to not work with literals...
18:27:35*fowl quit (Ping timeout: 258 seconds)
18:28:24Araqoh damn, I didn't update the example
18:28:29benedekAnyways, I want to ask about the indexing operators, `[]` and `[]=`.
18:29:03Araqadd an {.immediate.} to the macro definition and it should work
18:29:13benedekAh alright, I'll try that later.
18:29:56benedekSay you want to write a custom vector object which allows syntax like "echo v[2]", "v[2] = 23", but also "(v[2]) = 42".
18:30:37benedekI can get the first two to work if I override `[]`(v: TVector ...) and `[]=`(v: var TVector ...).
18:31:03benedekOr I can get the last two to work if I just override `[]`(v: var TVector ...).
18:31:31benedekBut if I override both `[]`(v: TVector...) and `[]`(v: var TVector), I get an ambiguity error.
18:32:02benedek(the first, of course, is necessary to index r-values)
18:32:16Araqcurrently you need both [] and []= but it's a known issue
18:32:47Araq [](v: var TVector): var T # should be enough for '=' support
18:33:01Araqbut yeah I know it doesn't work yet
18:33:20Araqyou are supposed to get around the ambiguity error with AST based overloading
18:33:24benedekYeah, that what I've been thinking... C++ does it that way, too, right? The only problem in Nimrod with that is that it clashes with the non-var variant, correct?
18:34:12Araq[](v: (var TVector){lvalue}) # should be preferred over v: TVector then
18:35:46Araqbtw 'range' is supposed to work for floating point types too
18:36:02Araqbut admittedly it's even less tested for floats :-/
18:36:49Araqthe AST based overloading also makes 'move' operators like C++ superfluous
18:39:31benedekI'm playing around with it, trying to understand it :)
18:42:24AraqAST based overloading evolved from TR macros and I don't think any other language has it :P
18:43:19benedekI can't say I know too many languages, but may things in Nimrod seem very unique to me!
18:43:47benedekI also mentioned object variants to dom96; do other languages have that?
18:45:45benedekHm, is a `[]=` necessary if you already have a `[]` with "var"?
18:45:49*gradha joined #nimrod
18:46:18benedekWithout the `[]=`, I can do "(v[2]) = 7", but not "v[2] = 7".
18:47:01Araqyeah I know it's buggy
18:47:48Araqit gets worse when combined with macros ;-)
18:48:25benedekThe executable also seems to crash when I try to do this with a "distinct array" :]
18:49:43dom96Araq: Is there any documentation regarding how exactly params are passed to procedures? (whether it is by-ref or by-val)
18:49:56Araqobject variants are copied over from Ada/Delphi
18:50:12AraqDelphi's are much more like C's unions though
18:50:34*fowl joined #nimrod
18:51:07Araqdom96: it's "use what's more efficient for the type"
18:51:43*zahary quit (Quit: Leaving.)
18:51:46dom96Araq: Yeah, but is the full behaviour documented anywhere?
18:51:59Araqyou can use the bycopy or byref pragmas to override it per type
18:52:17Araqit's in the manual and in the tutorial I think
18:52:44benedekAraq: I see. Alright, I have one final question, then I'll leave you guys alone. Have you considered building in the `&=` for the seq type? I know there's "add", but seq already has `&`, and it might be more consistent with the string type if it had `&=` also :)
18:53:13dom96Araq: I couldn't find anything about it in the manual, in the tutorial all I found was this: "Parameters are constant in the procedure body. Their value cannot be changed because this allows the compiler to implement parameter passing in the most efficient way."
18:53:57Araqbenedek: object variants are quite like "sum types" in functional programming languages, however they are more flexible at the cost of checking at runtime vs. checking at compile time
18:54:43Araqdom96: that's the paragraph I meant though
18:55:46Araqbenedek: you can easily do: template `&=`(x, y: expr) = add(x, y) ;-)
18:56:04dom96Araq: Want me to document this fully in the manual?
18:56:06AraqI considered &= but found 'add' easier to type :P
18:56:22dom96IMO that paragraph in the tutorial is a bit vague
18:57:05Araqhmm sure but why is it important?
18:57:24benedekI know I know, but I'm thinking about the consistency with strings :]. Strings seem very much like seqs, so I would assume them to have the same basic operations.
18:58:04Araqthere is a &= for strings? o.O
18:58:26benedekhttp://build.nimrod-code.org/docs/system.html#687
18:59:45Araqalright then 'seq' should have it for consistency ...
18:59:58benedekYay!
19:00:02Araqoh and please report the crash you got with a distinct array
19:00:41Araqwe could also deprecate &= for strings now that I know of its existance ... :P
19:00:57dom96Araq: I think some people may be worried that their params will be passed by-val. Others may be interested to know how exactly the compiler determines whether to pass by-val or by-ref, like myself :)
19:01:25fowlbenedek: hey if you're looking for some code examples https://github.com/Araq/Nimrod/wiki/Community-Projects
19:01:28benedekThat would be possible, too :)
19:01:42benedekAlthough I like &=.
19:01:53benedekfowl: Thanks!
19:02:09fowlAraq: when nimrod hits 1.0 will you get the stdlib tattooed across your body so the api cant change? :p
19:04:45AraqI always thought we never ever need to change the API :P
19:06:11benedekI have submitted the issue with the distinct arrays. The program actually segfaults.
19:06:47Araqthe program or the compiler?
19:07:41Araqdom96: why would they worry? the tut sayst the compiler knows better ... ;-)
19:08:01benedekThe executable program, not the compiler fortunately :)
19:09:12dom96Araq: Alright. But i'm still curious how it works exactly. :P
19:10:14benedekI have to go now. I might come back in an hour or so. Bye!
19:10:19Araqbye
19:10:51Araqdom96: it's actually not that simple and may change again ... :P
19:11:18dom96lol
19:11:23dom96That explains why it's not documented :P
19:12:05Araqfor instance, any type containing a type that refers to GC'ed memory, is passed by reference iirc
19:14:48*benedek quit (Ping timeout: 252 seconds)
19:16:38dom96ahh, so we're at the mercy of the almighty compiler :P
19:17:58Araqwell check out ccgtypes.nim and document it :P
19:23:04dom96Sounds fun. I should be reading more of the compiler source code.
19:26:25fowlit intimidates me every time i look in there o.o
19:26:42dom96yeah, same.
19:26:59dom96ccgtypes so far looks pretty simple
19:27:22dom96Araq: What does this new parser of yours improve?
19:28:03Araqfor a start, it should fix the 'do' parsing bug ...
19:28:25Araqand it allows for things like:
19:28:32Araqp(if x: a
19:28:35Araq else: b)
19:28:50Araqnote that 'else' is enforced to be aligned on the 'if'
19:29:10Araqwell that's not implemented as it would break code
19:29:20dom96that makes sense
19:29:27Araqbut it could trigger a warning for the next version
19:29:27fowlis that allowed currently?
19:29:37gradhacount me against enforcing visual indentation, I use logical indentation
19:29:38fowli never tried to break an inline if into newlines
19:29:57Araqfowl: I think it works nowadays :P
19:30:09Araqgradha: what do you mean?
19:31:07gradhap could be very long
19:31:20Araqso you prefer:
19:31:27Araqp(if x: a
19:31:31gradhareallylongsomething(if x: a
19:31:33gradha else: b)
19:31:37Araq<any indent>else: b)
19:32:02gradhaof course I can't comment on this particular case, as I still don't know how would I use it, but I just prefer logic indentation
19:32:12gradhaif something "overflows", you add indentation, when you finish, you reduce
19:32:13dom96but then what happens with more complicated nested if expressions?
19:32:32gradhain fact, I might do
19:32:35gradhareallylongsomething(
19:32:38gradha if x: a
19:32:40gradha else: b
19:32:47Araqbut that would be fine then
19:32:52gradhaoh, forgot the closing brace, now some lisp user is dying
19:33:00Araqas the 'else' is aligned to the 'if'
19:34:24Araqanyway, I'll take your opinion into account, gradha; I'm not sure if the idea is a good one yet
19:36:17Araqactually the main goal of the new parser was that the grammar is easier to write down in the spec; this failed as the new way is as complex to document as the old way
19:45:54dom96cool. I think I found it. Everything is passed by-val except for objects which are not {.final.} and tuples (depending on their size?)
19:47:02Araqthat sounds wrong
19:47:19Araqby-val always depends on the size
19:47:47dom96hrm, perhaps the function I am reading is only a small part of some other function
19:49:32*xcombelle quit (Remote host closed the connection)
19:50:28Araqfowl: I don't mind it to be intimidating and of course I'm biased; however I think the nimrod compiler's sources are much easier to follow than any other production compiler that I've seen
19:51:56Araqmost compilers produce (optimized) assembler and this fact alone makes them much harder
19:52:51dom96Araq: hrm, I dunno. I think the proc I found is the only one used.
19:53:12gradhathe interblags are full of comments saying gcc is dying, partially because it's difficult to integrate with other stuff
19:53:29gradhathe other part is ego, but doesn't everything come to that at some point?
19:53:46dom96Araq: I'm looking at the ccgIntroducedPtr proc
19:54:38fowlyeah i think i understand it a bit more every time i check it out
19:56:12Araqdom96: you're right
19:56:36Araqhowever, for 'tyObject' it contains: or (getSize(pt) > platform.floatSize * 2)
19:56:59Araqso size plays a role for objects too
19:57:18dom96ahh, yes, of course. Forgot to mention that.
19:58:56Araqgcc might be dying but if so, it lived for 3 decades or something
19:59:24Araqand it's a VERY successful project but most measures
19:59:34Araq*by most
20:00:37Araqand I'm almost more concerned about GCC's shitty build system than about the actual source
20:01:12gradhahah, precisely one of the recent comments I saw was about how it's impossible to build
20:01:14Araqyou can treat most of the source as a black box; you can't do the same with the build system
20:01:18fowlAraq: hey are you planning to add array[X, Y] as a shortcut for array[0..X-1, Y]
20:01:29fowlwhere X is an int
20:01:42Araqmake a feature request, I keep forgetting it
20:02:19fowlcan this be done with a term rewriting macro?
20:02:27Araqno
20:02:45AraqTR macros are very bad at changing semantics
20:03:04Araqit's however perhaps 3 lines in the compiler
20:09:20gradhacan a macro "inspect" the current global variables and get their names? say, I write some const PREFIX_blah and I want a macro to "extract" all PREFIX_blah constants
20:09:44gradhaand of course, the macro would do something with these PREFIX_blah consts, hopefully something useful
20:09:51Araqno
20:10:00Araqyou can do:
20:10:05Araqregister:
20:10:12Araq const PREFIX_Blah = ...
20:10:28Araqand then in 'register' add them to some compiletime global
20:10:41Araqand then query this global later
20:10:43gradhaso register is another macro working with the following one using its results
20:10:50gradhawill do
20:11:22fowlin that case you would just scan the body passed and do result = body
20:12:38Araqgradha: I'm not a fan of this though, why not pass a larger block to the macro instead?
20:13:03gradhano idea, the question popped in my mind
20:14:00gradhamaybe it could be useful for cases involving includes
20:14:12Araqaccess to the symbol table could be provided via an API
20:14:32Araqthough I like to see valid use cases before exposing that
20:14:52gradhaotherwise it's lifetime support, like the unofficial macro api
20:17:00Araqit also makes code REALLY hard to read
20:17:26Araqconst yeah_you_cant_rename_reliably_anymore = "argh"
20:17:52Araqit's as bad as .NET's reflection
20:18:19Araqwhere you also can't rename as some fool might access the field via reflection
20:19:12gradhatalking about .net, recently heard the stackoverflow podcast, they had some guy from the C# team
20:19:26gradhahe said he regreted baking non-nillable types later into the language rather than at the beginning
20:20:18Araqit would be nice if these non-nillable guys would in fact starting to describe how to solve the problem for systems programming language
20:20:40Araqbecause for now I haven't seen any impressive solution
20:21:12gradhano idea, I like nilable types, though they are a pain in languages were things crash if they find a nil
20:22:00gradhathe podcast is this one http://blog.stackoverflow.com/2013/03/podcast-45-keeping-it-sharp/
20:22:16fowlI can trust myself to not hit a nil, or if nil is ok as a value I can trust myself to guard usage of it
20:22:55gradhathe key there is "trust myself", I rarely code against only my code
20:23:29fowlnow, in ruby, nil can pop up and bite you in the ass at any time
20:23:29Araq1) we already have 'not nil' as an annotation in the language
20:23:51Araq2) I'm however interested in how it would prevent compiler bugs
20:24:01gradhafowl: really? that's awesome
20:24:05Araqit turns out 'not nil' is mostly useless in the compiler
20:24:19Araqas I can't use it in the interesting cases
20:24:50Araqthings are a bit different if you make 'class' a reference type as it's done in C# and Java
20:25:20Araqbecause then you end up using references anywhere and then not nullable types help more
20:29:21dom96Araq: Use Maybe instead :P
20:30:07Araqdom96: the problem is that you have a nilable type but know it can't be 'nil' in that context
20:30:26Araqand yet the compiler forces you to check against 'nil'
20:30:58Araqand then you do: if x.isNil: crash("can't happen")
20:31:29fowlvar s: string not nil; echo s.isNil #=> true
20:31:53Araqfowl: I know it's not implemented for now :P
20:32:47Araqhowever the 'if' is exactly what old school pointer types gave you for free
20:32:49gradhacome on Araq, that's old fashioned, now you would if x.isNil: newException(ESomethingUnCatchable, "Sorry!")
20:32:51fowlah
20:33:40gradhais there something you can raise but can't catch?
20:33:48Araqyeah
20:33:48dom96Araq: Have you seen this? http://nickknowlson.com/blog/2013/04/16/why-maybe-is-better-than-null/
20:34:07dom96There is!?! My world is shattered.
20:34:52gradhain early versions of python not all exceptions inherited from the same base, so it was fun catching against a "base" type, only there were many of them
20:35:29Araqdom96: no, but the article doesn't contain anything new
20:36:18Araqlets look at the compiler ... node.typ is the type; that can be 'nil' in general, however for expressions after semantic checking it's not nil
20:36:35Araqso ... how do I deal with that at the type system level?
20:36:56Araqyou can't really without introducing dependent typing
20:37:17Araqwhich is a very complex thing
20:37:31Araqhow do the blog posts deal with this issue?
20:37:35Araqthey don't
20:38:17Araqgradha: you're not supposed to catch EInvalidIndex for instance as the array indexing is not checked in release mode
20:38:44Araqyou're supposed to write code that doesn't access invalid array elements instead, believe it or not ;-)
20:39:08gradhayou had me at "you're supposed to write code"
20:40:13gradhaI don't understand what's the adavantage of wrapping nil in another object, you can still ignore it and crash
20:41:00dom96gradha: You can't. If you forget to handle it you will get a compiler error.
20:41:06dom96*compile time error
20:42:01Araqyeah and thus it forces you to write some guard like 'if x.isNil' everywhere
20:42:13Araqso ... lets make it non nillable instead
20:42:17gradhaif maybe.isNotNil: doSomethingTo(maybe.data) else: doSomethingTo(maybe.data)
20:42:44gradhadoes maybe work that way? what magic does it do to trust you don't use the data in the wrong branch?
20:42:47Araqgradha: a proper type system won't be fooled by that
20:43:18Araqit knows you can acess it in the isNotNil branch and not in the other
20:43:34gradhaah, I forget the key here is the maybe gets transformed to the non nil type
20:43:49Araqso ... how do we make it non nilable for our real world example?
20:44:18Araqeasy: we'll have a dummy type object and initialize every node with that instead
20:44:22Araqand voila!
20:44:31Araqwhat was once a crash is now a logical bug
20:44:43Araqgood luck fnding those instead
20:44:43dom96Araq: so your example requires that a field can be null at some point in time, but it cannot be in some other point in time?
20:44:51Araqdom96: yes.
20:44:55Araq'time' is key here
20:44:58dom96sounds fun
20:45:04gradhajust like object variants
20:45:06Araqtype systems don't model time well
20:45:21dom96Why not have two different types?
20:45:43Araqgradha: except that Nimrod's object variants DO not force you to check the discriminant everywhere either
20:45:50Araqand now you know why ... :P
20:46:37Araqdom96: that's actually a very good idea but then you lose some polymorphism
20:46:50Araqand I tried it in practice for the transf.nim pass
20:47:06Araqit complicates the code and found no bug
20:48:11Araqand btw
20:48:28Araqhow come nobody uses ATS, the one language that in fact implements dependent typing? :P
20:48:42gradhaso that's this ATS?
20:49:43gradhawell, it uses a not-like-c-or-java-syntax, that's why nobody uses it
20:50:37Araqone guy that I spoke with knows it intimately
20:50:55Araqand said the type sytem really starts to suck for strings ... :P
20:53:27gradhasounds like fun for sql interaction
20:54:07Araqor anything web related for that matter
20:54:49gradhadom96: my idea wasn't that crazy about storing json in sql, people are actually using it http://backchannel.org/blog/friendfeed-schemaless-mysql
20:55:09gradhas/sql/full relational database/
20:56:26Araq"Yes, in Scala you can still get NullPointerExceptions. Scala doesn’t have non-nullable reference types because Martin Odersky (for what were probably good reasons - I’m guessing related to java interop) decided to include null in his language. "
20:56:43Araqok, I decided to include 'nil' for C interop :p
20:57:19Araqseriously ... what's up with these guys? F# has null too
20:57:32Araqthey didn't manage to get rid of it
20:57:49Araqeven though it's a new very functional language
20:58:07gradhamaybe they didn't consider nil to be the devil?
20:58:46Araqmaybe they think crashes are easier to debug than logical errors?
20:58:50Araq;-)
20:59:50gradhaprogramming in objc taught me to stop worrying and love the nil
21:00:19dom96Does haskell have nil?
21:01:20gradhadom96: weren't you the one who knew haskell?
21:02:08dom96Yeah. But I haven't used it enough to warrant dealing with C interop in it.
21:02:27dom96I can only see it using nil for that.
21:02:28Araqdom96: http://stackoverflow.com/questions/3962939/whats-the-difference-between-undefined-in-haskell-and-null-in-java
21:03:15dom96Also i'm too lazy to google ^^ :P
21:16:02JStokerWhy does nimrod ban use of tabs? I get that you might want all code contributed to nimrod itself using spaces or whatever, but why ban them entirely?
21:17:23Araqmixing tabs and spaces doesn't work well
21:17:51Araqand yet that's what people want to do, "use tabs for indentation, spaces for alignment, dammit"
21:18:48Araqhowever I have yet to encounter a single code base where this has been done consistently
21:19:01OrionPKfuckin tabbers
21:19:14AraqGuido himself said if he were to do Python again, he forbid tabs
21:20:01Araqmost code I see however uses tabs as a compression for 8 spaces
21:20:30Araqand so I can't change my editor settings
21:21:39gradhaAraq: whole allegro library uses 8 column hard tabs but logical indentation of 3
21:21:53gradhaI know because I contributed to it
21:22:10JStokerSurely if they want to have horrific codebase, that's their own problem? (I don't like using spaces for alignment, but do prefer using tabs for indentation.)
21:22:52Araqso what would be your solution?
21:23:27Araqpython treats tabs as 8 spaces too (or rather that mod 8 thing)
21:24:58JStokerTreating it as 8 spaces would be fine, 4 spaces, 1, whatever. I don't mix them in code (for indentation, at least.) so I don't know. :-)
21:25:04gradhait's hard to take a stand in spaces vs tabs: people who care about them usually have power editors, the kind which can be configured to work in any situation without problem
21:26:19AraqJStoker: what's wrong with making your TAB key produce spaces?
21:26:43Araqit's not that I dislike the key ... ;-)
21:27:07JStokerAraq: I use tabs in all other languages, and don't really want to fork my editor to support adjusting tabs vs spaces based upon the language of the file currently open.
21:27:59Araqwhich editor is that btw?
21:28:09JStokernano
21:28:53fowlJStoker: are you sure nano wont do this? i know you can do syntax highlighting, per-language tab settings like one step away from that
21:28:55JStokerI also just prefer tabs anyway, means backspace just gets rid of a level of indentation with only one press, but you know <lazy>
21:29:38JStokerfowl: I'm not 100% sure, I know it supports the syntax highlighting, but as far as i'm aware, it's only supports the colouring stuff in the language specific files... Might have a test.
21:30:21JStokerError in /home/jstoker/.nano/nimrod.nanorc on line 18: Command "set" not allowed in included file
21:30:28JStokerDamnit, nope, doesn't like it. Awww.
21:31:50fowlJStoker: there are cli options for it http://www.nano-editor.org/dist/v2.3/nano.html
21:32:09*zahary joined #nimrod
21:32:24fowl-T and -E
21:32:28fowlset tabsize "n"
21:32:31JStokerfowl: However, I need to remember to go tell it that i'm wanting to use spaces every time i open a file, heh.
21:32:32fowlset tabstospaces
21:33:01JStokerAnd that does it across all files I open, including the ones I want to edit with tabs (vast majority of them ;p)
21:35:05fowlalias nimname="nano -T -E"
21:35:09fowlnimnano
21:35:31fowlthis if the first time i've met someone committed to nano lol:p
21:36:34JStokerNano is just brilliant though! :p
21:39:26gradhahttp://alleg.sourceforge.net/stabledocs/en/ahack.html K&R, with 3 space indentation. On disk, though, tab stops are 8 spaces, so if for example a line was indented by 12 spaces, this would be saved out as either 12 space characters or 1 tab and 4 spaces, not as 4 tabs
21:40:08gradhaI'm positive the 5.x codebase doesn't mix spaces and tabs
21:40:38Araqgradha: yeah, lets compress spaces on 100GB HDs ...
21:41:08gradhaI think the reson for hard tabs was console output
21:41:20fowlwhat does this mean? 3 space indentation, but tabs count as 8
21:41:27fowlhow does one indent one level?
21:41:31gradhabut then, UNLIKE other stuff, Allegro supported DOS 8.3 and was copied on disks
21:42:37gradhaI remember downloading the 1Mb tar.gz on a 28Kb modem
21:43:06gradhafowl: it means you need to have a really special editor for the tab key to do the right thing
21:43:39gradhaI was using setedit at that time
21:43:58fowlgradha: allegro is old and dusty, you should try sdl2 :)
21:43:59gradhasince rhide got old
21:44:41gradhafowl: I'm not so much into games now, more about command line parsing and stuff
21:47:39fowlgradha: what made you turn from games to command line parsing? are you depressed?
21:48:03gradhapretty much that
21:48:30fowloh:(
21:49:02gradhait's been like that for the past seven yers, don't think I'll recover
21:52:17fowlhm this is awkward
21:52:56Araqgradha: you know what helps against a depression? checking out new technologies
21:53:15Araqport Nimrod to NaCl :P
21:53:22gradhalol
21:57:30dom96ugh, screw NaCL
21:57:38dom96He should write a OpenGL game in Nimrod instead.
22:05:30*fowl quit (Ping timeout: 264 seconds)
22:10:51OrionPKthey're not mutually exclusive :P
22:10:57OrionPK(nimrod and nacl)
22:11:16gradhaneither opengl and nacl i would hope
22:11:40OrionPKu could use webGL, dunno about full openGL
22:14:30Araqhmm
22:14:36Araqwe still need a websockets module
22:16:32*gradha quit (Quit: bbl, have youtube videos to watch)
22:16:56OrionPKthat'd be pretty spiff
22:18:56*fowl joined #nimrod
23:03:43reactormonkAraq, socket.io wrapper?
23:20:13*fowl quit (Ping timeout: 240 seconds)
23:28:43*fowl joined #nimrod
23:46:04*fowl quit (Ping timeout: 256 seconds)
23:57:19*fowl joined #nimrod