<<27-11-2012>>

00:33:29*q66 quit (Quit: Quit)
00:33:34*Trix[a]r_za is now known as Trixar_za
01:22:11*Trixar_za is now known as Trix[a]r_za
05:16:36*XAMPP quit (Read error: Connection reset by peer)
11:50:54*Trix[a]r_za is now known as Trixar_za
12:08:55*Araq_ joined #nimrod
12:15:07*Araq_ quit (Quit: ChatZilla 0.9.89 [Firefox 16.0.2/20121024073032])
13:07:10*q66 joined #nimrod
13:38:55*FreeArtMan joined #nimrod
14:01:08*apriori| joined #nimrod
14:01:12apriori|hi guys
14:01:23apriori|for an array constructor, is it possible to declare the element type?
14:01:32apriori|something like [ 0, 1, 3 ]:char ?
14:03:14fowlapriori|: [char(0), 1, 3]
14:07:09*apriori|| joined #nimrod
14:07:21*apriori| quit (Ping timeout: 244 seconds)
14:10:36apriori||fowl: not working
14:10:44apriori||it will then complain about element 2 not matching the type
14:11:13apriori||seems like every element would need to be a proper char literal :/
14:12:40fowlo.. i thought it worked before
14:12:42fowl>_>
14:18:33*apriori|| quit (Ping timeout: 244 seconds)
14:19:05*apriori|| joined #nimrod
14:19:39fowlapriori||: https://gist.github.com/4154437 :>
14:21:22apriori||fowl: you are insane :P
14:27:20*apriori|| quit (Ping timeout: 244 seconds)
14:39:35*apriori|| joined #nimrod
15:50:41*apriori|| quit (Ping timeout: 244 seconds)
16:09:54*apriori|| joined #nimrod
16:28:48dom96I've tried this: array[0..2, char]([0,1,3])
16:28:52dom96Sadly, it does not work.
16:51:06*FreeArtMan quit (Ping timeout: 264 seconds)
16:51:41*FreeArtMan joined #nimrod
16:53:21apriori||dom96: fowls solution worked...
16:53:30apriori||although.. something like that should really be available in the language
16:53:39dom96yes, I agree.
16:53:42apriori||other example... can we specify the basetype of an enum?
16:53:57dom96Not as far as I know.
16:54:02apriori||hrm
16:54:21apriori||and..well, so far I'm not that happy with arithmetics involving chars and ints
16:54:37apriori||something like auto-widening should be possible and also include char
16:56:18apriori||and, something like this doesn't quite work:
16:56:34apriori||var bla:int32 = someValue
16:56:46apriori||type SomeEnum = enum
16:56:58apriori||someEnumVal = 0x0123'i32
16:57:03apriori||bla and someEnumVal
16:57:14apriori||or bla and SomeEnum.someEnumVal
16:57:20fowlapriori||: use a converter toi32*(some: enum): int32 = int32(some)
16:57:39apriori||I know, Araq would say, use a bit set.. but this is a mixed case.. a bit set (flagging) + some other values not covered by the enum
16:57:59apriori||fowl: I thought about converters, too, but there seem to be cases in which they're just ignored
16:58:26apriori||e.g., when trying to use a char code as an index in array access
16:58:51apriori||fowl: and that converter shouldn't be necessary, if the basetype of the enum matches
17:03:05fowltr00
17:39:28*apriori|| quit (Quit: Konversation terminated!)
18:21:46Araqer ... you're all wrong :P
18:22:14dom96That's nice to hear
18:22:19Araq[ '\0', '\1', '\2']
18:22:31Araqif too verbose use a template/macro
18:22:57Araqand there is a way to set the enum's basetype via the .size pragma
18:23:17Araqand there are no implicit conversions because of this thing called "type safety" ...
18:23:37Araqyou know, the feature which actually improves productivity over assembler ...
18:34:30Araqaprioria should learn to use 'const' instead of 'enum' ... Nimrod is not D ...
18:36:57dom96hrm, interesting. Is it convention to use 'put' for setting a value for a key?
18:37:51Araqyeah or []=
18:38:00Araqbut []= is more like 'update'
18:38:23dom96ok
18:48:56*apriori_ joined #nimrod
18:50:29Araqhi apriori_, read the logs
18:51:11apriori_on it
18:51:12Araqsorry for the tone, was an annoying day
18:52:05apriori_Araq: no problem.. got used to it :P
18:52:28apriori_anyway... I prefer to use enum to "group" constants.. at least I think thats one of its purposes
18:52:53Araqbut it's not
18:52:59Araqit creates a new type
18:53:06apriori_well, yeah, I know
18:53:11Araqthe underlying integer type is mostly an implementation detail
18:53:35apriori_but.. in what way is implicitly converting (in one direction) to the basetype type unsafe?
18:54:11Araqwell the fewer types you have the more type unsafe your code is
18:54:25Araqpython for instance has only 1 type
18:54:58apriori_well, maybe a matter of taste..
18:55:02Araqimplicit conversions weaken the type system
18:55:17Araqproc p(x: int; e: someenum)
18:55:24Araqp(1, 0) # really?
18:55:31Araqmaybe you meant:
18:55:35Araqp(0, 1)
18:55:47apriori_but, I dont only care for types to be a value constraint but also that types may share a representation.. in which case it makes no sense to me, that e.g. the named implicit conversion does not work (at least in the named direction)
18:56:18reactormonkAraq, scala uses implicits for kinda monkey-patching
18:56:23apriori_because, it will result in tons of typecasts in quite common situations
18:56:27Araqwhat is a "named implicit" conversion?
18:57:35apriori_Araq: I mean the enum with some base type T -> T conversion
18:58:02Araqwell you a converter to get that (yeah I know it's buggy)
18:58:17apriori_yup, converters seem indeed to be buggy
18:58:17Araqbut if you want that, why have an enum in the first place?
18:58:29Araq'const' introduces a section for a reason
18:58:32apriori_as already mentioned.. because of the grouping of constants
18:58:57apriori_yeah.. as said.. .matter of taste.. or matter of "getting used to"
18:59:06apriori_enum is definetly used differently in other languages
18:59:25Araqwell I'd argue it's completely broken in C-like languages
18:59:39Araqand all the others do it like Nimrod does
19:01:00apriori_well, maybe
19:01:46apriori_another thing feeling somehow strange (although it _might_ even make sense) is that char may not be used for array.[]
19:02:03Araqbut it can:
19:02:23Araqtype tarray = array[char, int]
19:02:32Araqa['a'] # perfectly fine then
19:02:57Araqmaybe you need to read about nimrod's notion of ordinal types
19:03:15Araqyou can even do:
19:03:15apriori_well, that might work...
19:03:26apriori_but I can say, you get into weird mixed cases in OS dev
19:03:30Araqtype tarray = array['A'..'Z', int]
19:03:41apriori_which inherently shows how broken some stuff even is...
19:04:04apriori_yeah, I got that
19:04:51apriori_in OS dev though, one got really mixed up semantics of e.g. the ascii codes for the keyboard
19:05:48apriori_depending on the state, the fetched code is an offset in one of 5 tables
19:05:56*XAMPP joined #nimrod
19:06:54Araqyeah you end up with stuff like const upperA = int32('A') in the X11 interfaces
19:07:58Araqbut *shrug* a key press 'a' is not the same as the character 'a' anyway
19:08:16apriori_yup
19:08:26Araqwhen I press TAB I don't want to produce \t :P
19:08:39apriori_the issue really seems to be with the design of this keyboard controller stuff, in the os designed by my professor
19:10:36apriori_btw.. some random bullshit in hardware design:
19:10:40apriori_ (cast[ptr uint16](0x472))[] = 0x1234
19:10:50apriori_this tells the bios the following reboot was "intentional"
19:11:19apriori_and hardware stuff is full of such "magic" constants
19:11:36Araqyeah, but what would be the alternative?
19:12:05apriori_well.. a little bit more structure, maybe.. for such flags
19:12:26apriori_the 0x472 feels really random
19:13:00Araqbut any mapping to a binary number is arbitrary
19:13:02apriori_and it's still funny, that the keyboard controller does the actual reboot
19:13:24Araqit feels random because it is random ;-)
19:13:32apriori_yeah, maybe...
19:13:38Araqmaybe you'd prefer 0xCAFEBABE?
19:13:42apriori_^^
19:14:16apriori_or the solaris style: "0xdefec8ed"
19:17:10Araqbtw is anybody on windows?
19:17:26Araqissue #263 looks troublesome
19:20:33*gradha joined #nimrod
19:23:10apriori_Araq: btw, one thing I also like, when you use enums to group constants...
19:23:31apriori_you can qualify their name with EnumName.ValueName.. which I think, often improves readability
19:23:40apriori_and gets rid of usual prefixed stuff
19:23:59AraqI prefer the prefixes ;-)
19:24:08Araqbut you can get that with .pure enums
19:24:30apriori_huh? get what?
19:26:27dom96Araq: Seems most of the docs for the osproc module are missing, doc2 bug?
19:26:47Araqthe compiler enforces typ.value then, apriori_
19:26:53apriori_Araq: ok
19:27:07Araqdom96: hrm yeah quite possible
19:28:55AraqI consider enumName.valueName annoyingly verbose, but this 'std.array.array' stuff is worse ;-)
19:29:15apriori_it might be verbose
19:29:18apriori_but its precise...
19:29:36apriori_I prefer that, for names, which might be used more often...
19:30:53AraqI never know where to find anything in .NET ... System.Diagnostics.Process? wtf?
19:31:19Araqfortunately the IDE mitigates the problem
19:31:20apriori_^^
19:35:48Araq // Get the application configuration file.
19:35:49Araq System.Configuration.Configuration config =
19:35:51Araq ConfigurationManager.OpenExeConfiguration(
19:35:52Araq ConfigurationUserLevel.None);
19:36:43Araqor my new favorite:
19:37:04AraqSystem.Configuration.ConfigurationSettings.AppSettings :P
19:37:11apriori_Araq: I didnt say I always prefer qualified names..
19:37:18Araqyeah sure
19:37:23apriori_just for "random constants" whose name might be used more often
19:37:42Araqno, might *not* be used often
19:37:49apriori_say, one got an enum for operations.. and one is called something very commonly used as "start"
19:38:04Araqif it's used often, the verbosity becomes annoying
19:42:01dom96hrm, are the following paths not equivalent? "/home/dom/" "/home/dom"
19:42:52gradhathere might be a difference if dom is a symlink, the former "dereferences" it, the latter points to the symlink
19:42:57dom96I suppose the former is said to refer to a directory, whereas the latter to a file.
19:44:13*FreeArtMan quit (Read error: Operation timed out)
19:44:24dom96in that case shouldn't splitFile("/home/dom/file").dir be "/home/dom/"?
19:44:43Araqperhaps
19:44:55Araqbut code would break :P
19:45:20Araqand the trailing / is subtle
19:45:24gradhaAFAIK the convention is to never have an API return a path with a trailing path separator
19:45:39Araqyeah
19:45:52Araqbrb
19:46:17dom96alright
19:46:47gradhaalso, to know the difference in that case you would need to stat the path previously, which is slower, and might be problematic in itself
19:47:20gradhausually you are just dealing with strings, which ignore symlinks and their implementation
19:48:32gradhaI've seen programs dereference the parent directory through "..", but that is even more problematic
19:48:48gradhaif you just followed a symlink, going "back" might give you a totally different path
19:50:37dom96Thankfully I think I should be fine without resolving symlinks.
19:51:49gradhausually you only have to take them into consideration if you are writing some sort of recursive fs tree algorithm due to cycles
19:55:13*Trixar_za is now known as Trix[a]r_za
20:06:45*apriori_ quit (Ping timeout: 255 seconds)
20:09:40gradhahaving a prototype like this proc openDatabase*(path: string): TDbConn {.cdecl, exportc.} =
20:09:50gradhacreates a weird exportation naming problem
20:10:11gradhadue to the TDbConn not marked with {.exportc.} nimrod generates a random name
20:10:25gradhaI get N_CDECL(tsqlite371300*, openDatabase)(NimStringDesc* path);
20:11:18gradhaI wonder about the guarantees of the naming for tsqlite371300, maybe on a different machine the source would not work?
20:14:31Araqhu?
20:16:05Araqin the header that would be something like:
20:16:19Araqtypedef struct tsqlite371300 tsqlite371300;
20:16:27Araqhow is that machine dependent?
20:16:28gradhayes
20:16:41gradhawell, where does that number come from? is it random generated?
20:16:51Araqit's a global ID
20:17:09Araqwhich however can change between compilation runs should you ever change something ...
20:17:26gradhaindeed, so it can't be used reliably
20:17:33Araqso yeah, exporting the type explicitly is a good idea
20:18:03gradhaso it's time to mark all nimrod types as exportc just in case? seems a PITA
20:18:17Araqwhy all? only the exported ones ...
20:18:37Araqbtw you can now 'push exportc: "prefix$1" '
20:19:16gradhawouldn't it make sense then to have nimrod exportc automatically all types marked with *?
20:20:04Araqno
20:20:21AraqI dislike these conflations
20:20:45Araqotherwise you would __dllexport those identifiers too in DLL generation, I suppose?
20:20:53Araqfor "convenience" ...
20:21:54Araqthe export marker * is not a stable property anyway, often I end up exporting stuff only for some single other module
20:24:20gradhasay module a defines a type, and module b imports a, can module b "re-mark" a's type with exportc?
20:25:16gradhaor in other words, can I mark types with explicit exportc even if they originally didn't?
20:25:46gradhaAFAICS it's just to have a stable name during C exportation
20:36:48Araqwell you could 'include' a to hijack it
20:37:01Araqthe problem with a stable name is that's hard to generate one in general
20:37:17Araqand I'm more concerned about accidental name clashes
20:37:34Araqespecially since C has no namespaces
20:37:40gradhaI tried creating an alias for the type but nimrod still uses the "deepest" type, so my renamed alias exportc is ignored
20:38:01Araqthese type aliases are a pita to handle in the compiler
20:38:24Araq"what do you mean the types are identical but one has some other external identifier?"
20:38:49Araqwe should get rid of them instead of embracing them
20:48:18Araqargh strange connection problems
20:48:49*Vladar joined #nimrod
20:50:57gradhawrt to the "convenience" of exporting identifiers, it is not so much for convenience as for situations where a module in nimrod doesn't mark a type with exportc (say db_sqlite), then you are stuck with random names which can change from version to version and can't use the type in C code directly. Maybe in the future somebody will be bitten by this, when nimrod is so popular and successful everybody wants to interface with it
20:52:09Araqmaybe we will have it fixed by then :P
20:52:41Araqit's not hard to write a patch script to fix the generated header though
20:53:03Araqbut I know, I know, programmers don't ever program these days ...
20:53:24gradhain my case I've decided to avoid the whole situation creating another layer on top, layers upon layers, of layers upon layers.
20:53:31gradhaaka layer.layer.layer.layer.hello
20:54:04gradhawhat are CPU cycles for if you can't enjoy them
20:54:35Araq;-)
20:56:50gradhaah, what was the cake name for this anti-pattern of layers
20:57:31Araqlasagne?
20:57:50gradhalasagne is a cake were you live? wow! I want that
20:58:19Araqha ha, very funny
20:58:46gradhain spanish the cake is milhojas, let's see if google translates that
20:59:19gradhahmm.. strudel?
20:59:45gradhanah, that's from northern europe
20:59:52gradhamilhojas is from italy I think
21:01:07gradhaok, this is the closest I've gotten http://en.wikipedia.org/wiki/Mille-feuille
21:01:15gradhawon't search more, I'm salivating too much
21:14:53Araqso ... if we have:
21:15:01Araqfrom module import * except a, b
21:15:08Araqand not:
21:15:12Araqfrom module import *
21:15:23Araqpeople will complain endlessly, right?
21:15:33Araqfrom module import *
21:15:36Araqis the same as:
21:15:39Araqimport module
21:16:26gradhais the except to avoid having two conflicting names in the same namespace and to avoid having to use module.thingy?
21:16:38Araqyep
21:17:03Araqimport module except a, b
21:17:10Araqis maybe a better solution
21:17:23Araqthe * currently has no meaning in imports
21:17:35gradhacan you do in nimrod "import module; something = module.something"?
21:18:01Araqno
21:18:14Araqit's often requested, but somewhat hard to implement
21:18:45Araqbut a template can provide this feature mostly
21:20:02gradhaI like the import module except a, b, despite having the concept of layer.layer.layer.layer.layer integrated deep inside of me
21:20:46Araqreally? I thought you've programmed in objective C :P
21:21:26gradhaunfortunately I also have to do java
21:21:50gradhasee how popular java is that obj-c adopted the dot syntax
21:22:11Araqdid it?
21:22:23gradhainstead of [obj method] you can do obj.method
21:22:30Araqsince when?
21:22:37gradhalike objc 2.0
21:22:49Araqintesting, didn't know that
21:23:23Araqthat makes 'importobjc' superfluous, right?
21:23:32gradhait makes properties more user-friendly to people coming from other languages
21:23:49Araqoh so it's only for properties?
21:23:57Araqno obj.method(a, b) ?
21:24:15*apriori_ joined #nimrod
21:24:16gradhanope
21:24:28Araqwell Java has no properties :P
21:24:36Araqso it copied C# :P
21:25:11gradhaobjc "properties" are just syntax sugar for the compiler creating setters/getters for you
21:25:21gradhait's still all messages down below
21:25:48gradhawhen you write obj.property that translates to [objc property]
21:26:04Araqyeah got it
21:26:04gradhaif you write obj.property = 4, that translates to [obj setProperty:4]
21:26:16gradhathat's why it doesn't work with more parameters
21:27:25Araqapriori_: 'from module import * except a, b' or 'import module except a,b ' ?
21:27:42AraqVladar: same question
21:27:46Araqdom96: same question
21:29:06dom96hrm, hard decision.
21:29:35dom96The former is nicer to read, the latter is more concise.
21:29:47Araqwell you better hurry, I'm implementing it
21:30:54VladarAraq, I like second more
21:31:40dom96'import module excluding a,b'
21:31:46AraqI could also support 'import path.module' but then people will become confused when it wouldn't work elsewhere
21:32:18apriori_hm...
21:32:20apriori_prefering 2nd
21:32:27AraqI won't add 'excluding' as a keyword
21:32:30apriori_but one should get rid of that string literal variant
21:32:41AraqI know you dislike it
21:32:42apriori_or enforce string literals throughout.. I just think its inconsistent
21:33:10Araqwhat about: 'import path/module' then?
21:33:54dom96and then will you allow 'import ../path/module' too? :P
21:34:11Vladaryeah, that would be better, cause you can have dots in the name itself
21:34:14apriori_Araq: ok for me
21:34:24Araqwell it does parse as an expression, dom96, so why not
21:34:50Araqyou can have dots in the name? that's news for me ...
21:35:22Vladari mean, directory structure
21:35:41Araqok, so it's 'import module except ...', good
21:35:49Araqand quite consistent
21:42:36gradhahow do I convert from cstring to string? casting is not working
21:42:43Araq$
21:43:10gradhathanks
21:49:22Araq# module A
21:49:47Araqtemplate fakeMod: expr = [B, C]
21:49:54Araq# module Z:
21:50:01Araqimport A, fakeMod
21:50:04Araq--> produces
21:50:09Araqimport A, B, C
21:50:25Araqshould we allow these things?
21:50:35Araqfowl would love them I suppose
21:50:49dom96Maybe only in a separate import statement?
21:51:04dom96Also, only when the template is exported :P
21:51:16Araqif we allow for fakes me may as well do it properly ;-)
21:51:23Araq(yeah, missed the *)
21:52:08dom96hrm, this could allow for some nice things for babel.
21:53:50dom96Feels like magic though. Might confuse users no?
21:54:08Araqsure
21:55:40fowldom96: i think aporia cut off my custom command
21:55:59fowl$findExe(nimrod) c --path: does me no good :<
21:57:24Araqfowl: I'd like your opinion on these 'import' features
21:57:30dom96fowl: Missing a $#?
21:57:50dom96'$findExe(nimrod) c --path:... $#'
21:57:53gradhaAraq: shouldn't nimrod export procs with non var parameters as const?
21:58:52dom96fowl: Do you mean that it was reloaded incorrectly after restarting aporia?
21:58:58Araqnimrod doesn't like C++'s const
21:59:04fowldom96: i think so
21:59:08Araqand mostly pretends it doesn't exist
21:59:19fowlAraq: the import stuff sounds useful
22:00:30fowlit would be useful if in c++, let declared things as const
22:01:01Araqwe need to do something about 'const', yes
22:01:10AraqI'm not sure what though
22:01:12fowlapparently if a function returns const you can't assign it to a non-const
22:01:32dom96fowl: Works for me.
22:02:00dom96fowl: Need more specific steps to reproduce, I guess.
22:03:47fowldom96: i think it got reset somehow, i just restarted it and it stayed set
22:04:01dom96weird
22:24:05VladarIt seems I figured out what causes that crashes in windows binary of libtcod. One of the crashes�
22:24:58gradhalooks like I can't build documentation locally on mac, fsmonitor is not supported
22:25:13gradhaHint: fsmonitor [Processing]
22:25:13gradhalib/pure/fsmonitor.nim(25, 10) Error: Your platform is not supported.
22:25:15gradhaHint: inotify [Processing]
22:25:17gradha...Hint: math [Processing]
22:25:18gradhalib/pure/fsmonitor.nim(113, 15) Error: undeclared identifier: 'read'
22:25:20gradhaexternal program failed
22:25:20gradhaError: execution of an external program failed
22:25:21gradhaFAILURE
22:26:05AraqVladar: well?
22:26:30*Trix[a]r_za is now known as Trixar_za
22:26:31Araqand can you have a look at bug #263
22:28:19dom96mmm, perhaps fsmonitor should check for defined(nimdoc).
22:28:50VladarAraq, I testing it yet, but I pretty sure it glitch out on windows if you declare callback function in const. When I changed const to var _this_ bug was gone
22:37:08Araqcan't follow, do you mean 'const p = proc () = ....' ? o.O
22:37:39VladarAraq, I'm not sure yet. Trying to replicate bug in separate file.
22:37:58VladarWhen I'm be totally sure I'll post a bugreport
22:39:21Araqinstead of producing a new bug report, fix #263 instead ;-)
22:40:44VladarAraq, I built nimrod under wine yesterday pretty smooth
22:41:27*apriori_ quit (Quit: Konversation terminated!)
22:51:03*gradha quit (Quit: gradha)
23:15:49*Zor joined #nimrod
23:18:01Araqwelcome Zor :-)
23:18:22Zoro hai!
23:20:56dom96hello Zor!
23:29:36*Vladar quit (Remote host closed the connection)
23:29:41*Trixar_za is now known as Trix[a]r_za