<< 16-07-2014 >>

00:04:08*saml_ joined #nimrod
00:05:37*icebattle joined #nimrod
00:07:17*boydgreenfield quit (Quit: boydgreenfield)
00:20:40Varriount_Araq: Ping
00:20:45*Varriount_ is now known as Varriount
00:20:55def-Varriount: 01:14 < Araq> good night
00:21:06VarriountAw...
00:41:31*bjz quit (Read error: Connection reset by peer)
00:41:45*bjz joined #nimrod
00:55:41*xenagi|2 joined #nimrod
00:56:08*xenagi|2 quit (Client Quit)
00:58:48*xenagi quit (Ping timeout: 260 seconds)
00:59:51*superfun1 quit (Ping timeout: 256 seconds)
01:01:03*brson quit (Ping timeout: 240 seconds)
01:36:40Varriountdom96: There needs to be some per-overlapped flag which controls whether the refcount for the overlapped struct is decreased by one when it's recieved by poll
01:36:47Varriountdom96: It's causing problems.
01:38:21*q66 quit (Quit: Leaving)
02:18:48*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
02:41:02*superfun1 joined #nimrod
02:46:33*superfun1 quit (Ping timeout: 240 seconds)
02:54:23*xenagi joined #nimrod
03:08:18*BitPuffin quit (Ping timeout: 240 seconds)
03:14:06*ARCADIVS quit (Quit: WeeChat 0.4.3)
03:14:59*kshlm joined #nimrod
03:31:50*saml_ quit (Quit: Leaving)
03:51:17*xenagi quit (Quit: Leaving)
03:58:04*BitPuffin joined #nimrod
03:59:09*kemet joined #nimrod
04:29:18*BitPuffin quit (Ping timeout: 240 seconds)
04:35:44*kemet quit (Quit: Instantbird 1.5 -- http://www.instantbird.com)
04:50:20*BitPuffin joined #nimrod
04:50:33*bjz joined #nimrod
04:50:36*superfun1 joined #nimrod
04:54:50*BitPuffin quit (Ping timeout: 250 seconds)
04:55:44*ics joined #nimrod
05:05:30*Demos_ quit (Read error: Connection reset by peer)
05:16:09*BitPuffin joined #nimrod
05:18:18*flaviu quit (Ping timeout: 240 seconds)
05:18:55*Varriount|Mobile quit (Read error: Connection reset by peer)
05:19:13*Varriount|Mobile joined #nimrod
05:29:33*superfun1 quit (Quit: leaving)
05:36:33*BitPuffin quit (Ping timeout: 240 seconds)
05:48:35*Lorxu joined #nimrod
05:49:32*Varriount|Mobile quit (Read error: No route to host)
06:10:45*gsingh93 joined #nimrod
06:16:27*btiffin quit (Ping timeout: 272 seconds)
06:29:26*btiffin joined #nimrod
07:07:41*BitPuffin joined #nimrod
07:08:31*kunev joined #nimrod
07:16:03*BitPuffin quit (Ping timeout: 240 seconds)
07:20:10*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
07:22:42*BitPuffin joined #nimrod
07:25:54*nande quit (Remote host closed the connection)
07:28:38*BitPuffin quit (Ping timeout: 240 seconds)
07:39:26*pafmaf joined #nimrod
07:41:53*q66 joined #nimrod
07:46:15*pafmaf quit (Quit: This computer has gone to sleep)
07:48:17*Zuchto quit (Ping timeout: 272 seconds)
07:54:26*Zuchto joined #nimrod
08:07:25*BitPuffin joined #nimrod
08:16:46*BitPuffin quit (Ping timeout: 264 seconds)
08:20:45*BitPuffin joined #nimrod
08:30:34*BitPuffin quit (Ping timeout: 264 seconds)
08:33:26*BitPuffin joined #nimrod
08:39:35*BitPuffin quit (Ping timeout: 272 seconds)
08:49:37*BitPuffin joined #nimrod
08:54:58*BitPuffin quit (Ping timeout: 240 seconds)
08:57:11*BitPuffin joined #nimrod
09:01:07*ics quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
09:05:27*Mat3 joined #nimrod
09:05:38Mat3hello
09:15:38NimBotAraq/Nimrod devel 4dc2925 Araq [+0 ±2 -0]: JS compilation works again
09:42:57*Matthias247 joined #nimrod
09:47:25*kunev_ joined #nimrod
09:50:33*kunev quit (Ping timeout: 240 seconds)
09:57:18*kunev_ quit (Ping timeout: 240 seconds)
09:57:35*Matthias247 quit (Ping timeout: 264 seconds)
10:10:51*kunev joined #nimrod
10:20:41Araqhi Mat3
10:56:10Mat3hi Araq
10:57:22Mat3I have finished the compiler generator and implement at current my algorithm for automatic parallelization
10:58:57Mat3beside, I will take a look at the C code generation in Nimrod
10:59:07Mat3what files are relevant for this ?
11:01:07Araqcgen.nim, cgendata.nim, ccg*.nim
11:01:44Mat3thanks
11:02:46Mat3hmm, how can I export a whole module (I do not want to mark all statements with '*') ?
11:08:50Mat3ciao
11:08:56*Mat3 quit (Quit: Verlassend)
11:09:27*Matthias247 joined #nimrod
11:30:11*Lorxu quit (Read error: No route to host)
12:04:22*Matthias247 quit (Read error: Connection reset by peer)
12:13:59*Matthias247 joined #nimrod
12:32:59*untitaker quit (Ping timeout: 264 seconds)
12:38:50*untitaker joined #nimrod
12:47:20*Matthias247 quit (Read error: Connection reset by peer)
12:51:14*BlameStross quit (Quit: BlameStross)
13:06:06*Matthias247 joined #nimrod
13:16:37*Matthias247 quit (Read error: Connection reset by peer)
13:27:51*darkf quit (Quit: Leaving)
13:38:35*Demos joined #nimrod
13:39:03*kshlm quit (Ping timeout: 240 seconds)
13:57:55*BlameStross joined #nimrod
14:22:52*kshlm joined #nimrod
14:27:03*reactormonk quit (Ping timeout: 240 seconds)
14:29:10*bjz joined #nimrod
14:50:33*BitPuffin quit (Ping timeout: 240 seconds)
15:05:14*BitPuffin joined #nimrod
15:28:49*reactormonk joined #nimrod
16:05:38*ics joined #nimrod
16:16:42*nnn_ joined #nimrod
16:16:56*nnn_ is now known as pown5
16:17:43pown5cint*cint = ?
16:18:24pown5let num_items = info.channels * info.frames
16:18:30pown5here I multiply 2 cint
16:18:51pown5seems num_items becomes an int64, which - true - could be the case.. so is that the rule?
16:22:03*superfunc quit (Ping timeout: 240 seconds)
16:28:09pown5trying with: let num_items: cint = info.channels * info.frames
16:28:25pown5gives: sndfile.nim(71, 36) Error: type mismatch: got (int64) but expected 'cint'
16:31:05pown5OK so I do: let num_items = cast[cint](info.channels * info.frames)
16:31:44pown5problem solved. I suppose if this was not a wrapper, that cast would be a code-smell and a change of type on e.g. channels would probably be suitable
16:32:02pown5correct?
16:32:53*mwbrown joined #nimrod
16:38:11flyxwhy not: let num_items: cint = info.channels * info.frames
16:38:42flyxoh
16:38:45flyxyou did that
16:38:53*flyx needs to read everything before commenting
16:39:58*pown5 quit (Remote host closed the connection)
16:41:05*enurlyx1 joined #nimrod
16:47:57flyxwell, as cint is an int32, I don't see why num_items becomes an int64
16:48:05flyxpossibly a bug
16:50:34*kunev quit (Quit: Lost terminal)
16:51:46*Trustable joined #nimrod
16:55:36*Lorxu joined #nimrod
17:05:44*superfunc joined #nimrod
17:05:47*Lorxu quit (Read error: Connection reset by peer)
17:05:59*Lorxu joined #nimrod
17:06:07*brson joined #nimrod
17:07:44*Lorxu quit (Client Quit)
17:11:21Araqbug report
17:11:32Araqin no way int32*int32 should produce an int64
17:14:29*Jesin quit (Quit: Leaving)
17:25:58*bjz quit (Read error: Connection reset by peer)
17:26:31*bjz joined #nimrod
17:27:07*bjz quit (Read error: Connection reset by peer)
17:27:23*bjz joined #nimrod
17:31:14*flaviu joined #nimrod
17:33:02*Ven joined #nimrod
17:37:35*Jesin joined #nimrod
17:57:12dom96hi
17:57:39NimBotnimrod-code/csources master 805ce61 Marin [+0 ±1 -0]: fix url in readme
17:57:39NimBotnimrod-code/csources master 7d454fb Dominik Picheta [+0 ±1 -0]: Merge pull request #4 from hoffoo/patch-1... 2 more lines
17:58:42def-hi dom96
18:01:55*Jesin quit (Quit: Leaving)
18:10:20*pown5 joined #nimrod
18:10:50pown5Hi! ok next issue
18:10:59pown5let buffer = newSeq[cint](num_items)
18:10:59pown5var test: ptr int = cast[ptr cint](addr(buffer[0]))
18:11:17pown5=> sndfile.nim(74, 35) Error: expression has no address
18:12:10pown5I'm not sure I understand why? What would be the correct way to allocate a dynamic array and pass it as a pointer to a wrapped c func?
18:13:09pown5typo, should be cint not int, but still same error: var test: ptr cint = cast[ptr cint](addr(buffer[0]))
18:15:31*bjz quit (Read error: Connection reset by peer)
18:16:00*bjz joined #nimrod
18:16:39def-pown5: var buffer
18:16:54def-pown5: otherwise you can't even fill the buffer
18:17:11def-and hi!
18:17:16*bjz quit (Read error: Connection reset by peer)
18:17:33*bjz joined #nimrod
18:18:41Araqdon't use 'cast'
18:18:46Araquse a type conversion instead
18:18:48pown5def! thanks!
18:20:18pown5great!!
18:20:22pown5Thanks and Hi!
18:20:26*pown5 quit (Remote host closed the connection)
18:29:08def-Araq: nice, didn't know you can do typesafe type conversions to ptrs
18:29:42Araq"typesafe" is a strong word ;-)
18:30:29def-at least the compiler complained a few times!
18:30:57Araqbtw do you really run into all these bugs or do you stress test things?
18:31:28def-Araq: I solved half the Rosetta Code tasks in nimrod in the last days
18:31:48def-so I actually ran into them
18:31:57Araqyay
18:35:14def-was a nice way to test the standard library and compiler
18:35:56Araqthe amount of bugs is depressing
18:36:45Skrylaryou need that crazy stp solver thing from a while back
18:36:46Skrylarlol
18:37:05Araqwould be easy though if it at least the compiler was feature complete
18:43:47*Jesin joined #nimrod
18:47:19*Johz joined #nimrod
18:51:07dom96def-: Damn, well done. http://rosettacode.org/wiki/Nimrod that is a loootttt
18:51:14dom96brb
18:51:35def-dom96: they are also here: https://github.com/def-/nimrod-unsorted
19:04:59*springbok joined #nimrod
19:06:09*Mat3 joined #nimrod
19:06:11Mat3hello
19:06:22def-hi Mat3
19:06:32Mat3hi def-
19:07:22*leru joined #nimrod
19:07:52Araqhi Mat3. you can't export everything at once, but you can use include instead of import to get a similar effect
19:10:30dom96def-: Have you considered writing some examples for nimrod-by-example?
19:11:12def-dom96: not really, but now I am considering
19:12:04dom96def-: Cool.
19:17:06*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:19:43*enurlyx1 quit (Quit: Leaving.)
19:19:52Mat3Araq: thanks, I include the file then
19:20:57Araqofc you should only include it once ;-)
19:21:44Mat3By the way: Any chance for some more Pascalism like 'INTERFACE' and 'IMPLEMENTATION' ?
19:23:21leruDo I get it right? It is not possible to increment a value by "++" ?
19:23:56flaviuleru: try `inc foo`
19:24:18*brson quit (Ping timeout: 240 seconds)
19:24:37leruThank you!
19:27:05AraqMat3: I hated these ... what's the advanage?
19:28:55Mat3I guessed it. There is only one advantage: Implicitly seperation of public and hidden declarations (so a programmer does not need to mark public declarations)
19:29:42flaviuMat3: Are you complaining about having to type '*'? I think you should check out java, much more fun there!
19:30:13leruCan I tell the compiler where the cache should be? If yes, what flag or whatever can I use?
19:30:28Araq--nimcache:foo/bar
19:30:42leruThanks!
19:30:43Araqyou can also put it into your config
19:30:54flaviuSo a global nimcache would work?
19:32:08Mat3flaviu: Yes, the same procedure. I'm constantly struggling because forget to mark public declarations in larger source files
19:32:55AraqMat3: ok but how does copying these into an interface section help with that?
19:34:16flaviuMat3: I still don't see the use, the compiler tells you what it needs to be exported. Of course, it isn't up to me, others may see the utility.
19:34:32flaviuIs there a way to genericly check if a value is nil?
19:34:47AraqisNil ?
19:35:15def-flaviu: or == nil?
19:35:28flaviutype mismatch for both
19:35:32flaviuint can never be nil
19:35:45Araqproc isNil*(x: int): bool = false
19:35:46def-when compiles: isNil x
19:35:48Mat3Araq: with common Pascal, declarations (complete procedures for example) in the interface block are visible, declarations in the implementation block not
19:36:06def-when compiles(isNil x)*
19:36:16def-but i guess that's not good style
19:36:38Mat3(however this is uncommon style)
19:37:16flaviudef-: Thanks, that works
19:37:37AraqMat3: that doesn't answer my question at all
19:37:56Araqprocedure foo; begin end; // oops, forgot to export it
19:38:01Araqso ... I put
19:38:10Araqprocedure foo; into the interface section
19:38:10leruSomehow this does not work: "--nimcache:G:\\nimcache\\". I'm on Windows and using this in Sublime Text 2. Someone know, what I need to do?
19:38:32def-leru: what error do you get?
19:38:46Araqleru: --nimcache:"G:\nimcache" perhaps
19:38:49Mat3I do not need to mark the procedure as 'visible'
19:38:53leruNo error. It just still creates the cache in the same folder.
19:39:10AraqMat3: well yes, you need to copy the whole header instead
19:40:24Mat3I can copy the complete procedure instead (however, this is not possible with Borland's Pascal dialect if I remember correctly)
19:40:40Araqleru: try putting it into a myproject.cfg file which is in the same folder as your myproject.nim
19:41:20AraqMat3: er ... I've never seen that done in Pascal
19:41:41Mat3as written, it is somewhat uncommon style
19:41:41AraqI'm pretty sure Borland and FPC don't allow that
19:42:30Mat3that's right
19:43:33*Ven joined #nimrod
19:43:53Mat3the reason for this is: Borland and FPC should be single-pass compilers
19:44:52Mat3so interface delcarations are handled like (public) prototypes
19:46:30Mat3^declarations and I restrict that to procedure or function declarations
19:46:32flaviuAraq: Can we get gotos?
19:46:38Araqflaviu: never
19:46:45mwbrownwhat about come-from?
19:46:45Mat3*lol*
19:47:25flaviuWell, I guess I'll have to make a macro for them when I need them...
19:47:40flaviu;P
19:47:50Araqflaviu: it's pretty easy to do
19:48:15Araqbut I won't tell you the solution :P
19:48:24flaviuWhile loops and break
19:49:11flaviuactually, break statements would work even better
19:49:53flaviu*block
19:58:48flaviuAh, switch statements in a while loop
20:01:07*askatasuna quit (Quit: WeeChat 0.4.3)
20:01:20Araqwe call it "case", but yes
20:02:31leruOkay, I still don't get it. How does this thing with myproject.cfg work?
20:04:45Araqwhat file do you pass to the compiler?
20:09:31leruI found the problem. It's sitting in front of the screen. I accidently was in the wrong line. Yay!
20:21:15mwbrownDoes anyone know if there is any termios style raw-terminal functionality in Nimrod's library yet?
20:21:32mwbrowni.e. something you would use to implement curses-style terminal manipulation / raw access?
20:21:42def-mwbrown: i looked 10 minutes ago and found nothing
20:22:19mwbrownmaybe it would be easier to wrap something like Curses in that case
20:22:31dom96The only thing we have is http://build.nimrod-lang.org/docs/terminal.html
20:22:33def-i saw some pdcurses, but couldn't get it working
20:22:34dom96As far as I know.
20:22:35flaviumwbrown: Definitely easier
20:22:40*Johz quit (Ping timeout: 260 seconds)
20:22:51Araqwe have a pdcurses wrapper
20:23:00Araqthat used to work I think
20:23:54Mat3mwbrown: Un*x like termios structures share a raw flag
20:24:24Mat3combine that with setted noecho flag and read from stdin
20:24:28*leru quit (Ping timeout: 246 seconds)
20:25:38*Johz joined #nimrod
20:27:50Mat3ciao
20:27:56*Mat3 quit (Quit: Verlassend)
20:29:35*gsingh93 quit (Quit: Connection closed for inactivity)
20:32:25NimBotAraq/Nimrod devel ed226eb Araq [+0 ±4 -0]: added stack overflow prevention
20:32:40Araqdom96: please try it with this patch
20:36:03*Jehan_ joined #nimrod
20:38:20dom96will do
20:40:15def-Araq: now the stack overflows so much earlier!
20:40:45Araqdef-: the limit of 1000 suffices for the compiler itself which is quite recursive
20:40:54AraqI set the limit to 2000
20:41:07def-calldepth is always fixed to 2000 now? I used to get up to 87000 before
20:41:12AraqI don't think this will cause any problems out there
20:41:38flaviuAraq: Is there an option to increase it for people that want to?
20:42:10Araqno, it's a quick hack to see if async causes some bad recursions
20:42:36Araqthe limit is gone in release builds btw
20:43:19Araqbut thinking about it ... the check can be made much smarter
20:46:25*enurlyx joined #nimrod
20:55:01*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:57:07*brson joined #nimrod
21:11:00*Ven joined #nimrod
21:15:12*Ven quit (Client Quit)
21:23:13dom96Araq: Makes no difference.
21:29:23Araqwell it does
21:29:31Araqnow we know it's no stack overflow :P
21:29:33flaviuHmm, generics are basically structural typing!
21:29:55Araqactually it's basically a type based macro system
21:30:08Araqon top of another macro system
21:30:15Araqwith strange interactions ...
21:30:29reactormonkand unicorns?
21:30:32Araqbut hey I still don't know how to do better
21:30:39flaviuI don't really understand what you're trying to say, but to the user it looks like structural typing
21:31:17Araqit's only a design mistake as soon as I figured out a better design
21:31:19Araq;-)
21:32:34flaviuWhats wrong with them? Only issue I can see is that error messages display the internals of whatever you just described.
21:32:57*Matthias247 joined #nimrod
21:34:58*Matthias247 quit (Read error: Connection reset by peer)
21:35:33Araqflaviu: the caching mechanism the compiler uses for generics is unsound
21:36:13Araqbut fortunately nobody notices and the people who dislike nimrod are already busy complaining about indentation based syntax
21:37:10flaviuAraq: I cover braces in http://nimrod-by-example.github.io/block/
21:37:14flaviuLast paragraph
21:44:48*io2 joined #nimrod
21:47:32*enurlyx quit (Quit: Leaving.)
21:48:14Jehan_flaviu: Structural typing for parametric polymorphism is pretty widespread and easy. What is a bit trickier to do is structural subtyping, i.e. where you need dynamic dispatch (it's not hard in principle, the tricky parts come from supporting separate compilation and/or optimizing performance).
21:51:09reactormonkJehan_, subtyping is a bit more masty if consider value-types
21:52:02Jehan_reactormonk: Yes, I know. From pretty direct experience, as a matter of fact. :)
21:52:51reactormonkJehan_, no experience here, but Araq made a pretty lasting impression. I've only messed around with surface stuff
21:53:55Jehan_reactormonk: For parametric polymorphism, specialization is a relatively straightforward solution. That, unfortunately, doesn't apply to subtype polymorphism.
21:54:50reactormonkJehan_, how come about the subtype stuff?
21:55:04*Demos quit (Read error: Connection reset by peer)
21:55:13Jehan_Because for parametric polymorphism, you know how to dispatch at compile time.
21:55:22*Demos joined #nimrod
21:55:45*Demos is now known as Guest41403
21:55:51Jehan_When you're using dynamic dispatch, you need a way to treat value and reference types uniformly.
21:56:16reactormonkso it's a not-known-at-compile-time problem
21:56:20Jehan_One way is to box value types, but that means overhead.
21:57:15Jehan_Difference in assignment semantics make the problem a bit thornier than just that, too.
21:57:40reactormonkCan you give me an example on assignment semantics?
21:58:25Jehan_Umm, simple. Assume that a function accepts any argument conforming to signature S (that's structural subtyping).
21:58:43Jehan_The function assigns that argument to another variable.
21:59:06Jehan_If the argument is a reference, then you just assign the reference. Otherwise, you need to do a structural assignment.
22:00:02flaviuDoes inc really need to be magic? The definition is straightfoward.
22:00:07Jehan_So, in order to support value types, you need to carry extra information and basically incur extra overhead for every assignment.
22:01:10Jehan_You can do better for the special cases of value types that fit in a reference-sized word, by basically treating the parameter as a union. But that has its own annoyances.
22:01:17flaviuNot that big of a deal anyway, but it seems odd
22:01:59reactormonkJehan_, so you basically carry a type tag around as well?
22:02:26Jehan_That's the other thing, how do you do dynamic dispatch?
22:03:54Jehan_You can encode the dispatch table/information in the object, or you can turn objects into (object, dispatcher) pairs.
22:04:48Jehan_Oh, I forgot to say: functional languages do have an easier time with the value vs. reference type thing, since stuff is immutable, so structural copy vs. reference assignment is not an issue.
22:05:31Jehan_Which also means that the problem goes away for immutable value types.
22:09:31reactormonkWhat's the difference betwen stuff in the object and pairs?
22:10:31Jehan_Well, it's basically where the dispatch table pointer is placed (assuming you use dispatch tables).
22:10:56Jehan_You can either put it in the object itself, or pass it separately.
22:11:16Jehan_The latter is also similar to how Glasgow Haskell and OCaml implement type classes.
22:11:41*Guest41403 is now known as Demos_
22:13:06flaviuOverloads can't be resolved upon their return types it looks like
22:14:06reactormonkflaviu, been there, asked for that
22:16:12flaviuWell, another vote for that then. `proc zero(res: var int) = (res = 0)` is ugly as hell
22:16:51Jehan_flaviu: Yes, you can, though it's a bit cumbersome to do.
22:17:11Araqyeah ask for new features
22:17:17Jehan_proc foo(x: int): int = x
22:17:17Jehan_proc foo(x: int): string = "<" & $x & ">"
22:17:17Jehan_let a: proc(x: int): string = foo
22:17:17Jehan_echo a(1)
22:17:22Araqthis is the way to get this thing stable
22:19:15reactormonk>:)
22:19:39reactormonkflaviu, for every feature you implement from the issues list, you can ask for another one. Or make that two for one ;-)
22:20:23*darkf joined #nimrod
22:20:26Jehan_Hmm, looking at it, you can put it inside a template, too.
22:21:30flaviuJehan_: I don't think that would work for me. I want `proc zero(): int`, and `proc zero(): string`
22:22:01flaviuoverloading variables also doesn't work for obvious reasons
22:22:12Jehan_flaviu: let actualZero: proc(): int = zero
22:22:14reactormonkflaviu, no mands for you
22:22:22reactormonk*monads
22:22:25dom96flaviu: Just use different names
22:22:44flaviudom96: then the entire idea becomes totally worthless
22:23:30flaviureactormonk: Actually, I'm doing abelian groups
22:23:37flaviuTIL that word exists
22:23:57dom96flaviu: what idea? What are you trying to do?
22:24:31flaviuIts ridiculous, silly, and unsound, but I'm trying to make a ring with both strings and ints
22:24:55Jehan_flaviu: Interesting exercise, but be warned that most type systems are too weak for practical computer algebra.
22:25:19reactormonkgotta do haskell?
22:25:26flaviuI'm not doing computer algebra, lol
22:25:30dom96A ring?
22:25:30Jehan_reactormonk: That includes Haskell.
22:25:39flaviudom96: https://en.wikipedia.org/wiki/Ring_%28mathematics%29#Definition
22:25:48Jehan_If you write programs for rings, you're doing computer algebra. :)
22:26:16flaviuJehan_: I just want to do `"a" * 2` and `1 * 2` with a single function
22:26:22flaviuseverely limited
22:26:51Jehan_dom96: A ring is basically a structure that knows addition, subtraction, multiplication, and the distributive laws, but not necessarily division.
22:27:03Jehan_flaviu: That looks like a module, not a ring, for what it's worth.
22:27:22dom96Jehan_: What use cases do they have?
22:27:26Jehan_(Module in abstract algebra meaning something entirely different from what it's used for in computer science.)
22:27:29flaviuJehan_: I haven't gotten to modules yet
22:28:03Jehan_Modules are basically like vector spaces, except with rings instead of fields for scalar values.
22:28:27flaviuYou aren't really making it clearer ;P
22:28:53Jehan_flaviu: Sorry. :)
22:29:32reactormonkJehan_, so a module is an n-dimensional ring?
22:29:42Jehan_flaviu: In any event, what you'd probably need in Nimrod is user-defined type-classes.
22:30:37Jehan_reactormonk: Not really. A module is something whose elements you can multiply by ring values obeying similar laws as when you're multiplying R^n vectors by real numbers.
22:31:34Jehan_Vectors over integers are an example of an integer module, for instance.
22:31:44reactormonkok
22:32:00Jehan_Not a vector space, because you don't have division for the elements.
22:45:33*EXetoC joined #nimrod
22:46:22Jehan_flaviu: One other way to deal with overloading results is to use a `var` parameter to return them.
22:46:43Jehan_That's often a bit on the ugly side, though.
22:47:35flaviuYeah, thats what I was thinking
22:48:21flaviuMain disadvantage is that getting an immediate value is ugly
22:50:48Jehan_Well, you can do this:
22:50:53Jehan_proc zero: int = 0
22:50:53Jehan_proc zero: float = 0.0
22:50:53Jehan_proc zero(T: typedesc): expr =
22:50:53Jehan_ let z: proc: T = zero
22:50:53Jehan_ z()
22:51:28Jehan_Then you can use zero(int) or zero(float) or whatever you have an overload for.
22:51:43VarriountMeep.
22:51:59flaviuI don't care enough anyway, given that I just wanted it for some experimental throwaway code
22:52:09EXetoCreturn-type overloading?
22:52:15flaviuEXetoC: Yes
22:53:15flaviuJava has a big secret here: its possible if you skip the semantic checking :D
22:53:46flaviuof the java code, not bytecode
22:53:53VarriountWoah, Nimrod just got stack overflow protection?
22:53:57VarriountO_o
22:54:34AraqVarriount: yeah and it could easily be much better
22:54:43Araqbut it works
22:55:32reactormonkAraq, what about making a constant out of that 2000?
22:55:36*Johz quit (Quit: Leaving)
22:56:17Araqreactormonk: what's the point? it's only used in one place
22:58:00reactormonkAraq, I don't know, some knee-jerk reaction ot magic values.
22:58:47*mwbrown quit (Ping timeout: 264 seconds)
22:59:04flaviuAraq: You should make the constant a magic and make it configurable with flags
22:59:47flaviuI don't know whats come over me, I'm suggesting increasing magic O_O
23:00:35EXetoCmake it a functor
23:03:52*superfun1 joined #nimrod
23:04:02*Demos__ joined #nimrod
23:06:57VarriountIs it possible, on a low level, to actually 'catch' a stack overflow?
23:07:16VarriountI mean, isn't it just a kind of out-of-memory error?
23:07:47*Demos_ quit (Ping timeout: 264 seconds)
23:08:00reactormonkVarriount, basically
23:09:15flaviuUnless the function that is being caught is doesn't expose its side effects to the world until it returns, catching the exception would cause big problems
23:10:01Jehan_Varriount: Usually, it's an out of control recursion.
23:10:29Jehan_And since the stack is being unrolled for exception handling, it should work in most cases.
23:11:22VarriountWhat part of a program actually 'throws' a stack overflow exception (say, a C program)?
23:11:44reactormonkVarriount, in C? probably nothing.
23:11:45Jehan_Varriount: A C program doesn't. It'll trigger a signal.
23:12:06Jehan_You get a stack overflow in C by running into a protected page of memory.
23:12:17Jehan_=> signal
23:12:32flaviuI pretty sure the spec doesn't even specify that stack overflows exist
23:12:39reactormonkJehan_, or a good old OOM error
23:12:51Jehan_reactormonk: In C? How?
23:12:53reactormonk... which is a signal again
23:12:57VarriountHm. But a signal handler would have to create a stack frame somehow..
23:13:00Jehan_Calling a function in C doesn't allocate memory.
23:13:22VarriountJehan_: Doesn't it allocate memory on the stack?
23:13:28reactormonk"kill process or sacrifice child"
23:13:50reactormonkJehan_, the stack uses memory though, incae of a recursion, correcT?
23:14:20Jehan_Varriount: See sigaltstack()
23:14:36Jehan_reactormonk: Preallocated memory.
23:15:12reactormonkJehan_, so there's a finite number of recursions?
23:15:15Jehan_Varriount: Though I honestly don't know at the moment what happens if you don't do that.
23:15:20Jehan_reactormonk: Correct.
23:15:32Jehan_In C, that is.
23:15:43Jehan_Other languages can and do allocate stack frames on the heap.
23:16:25Jehan_Mind you, "finite" is usually a pretty big number.
23:16:26flaviuVarriount: “./stackoverflow” terminated by signal SIGSEGV (Address boundary error)
23:16:52reactormonkok
23:17:12Jehan_flaviu: Yeah, but that's for default behavior.
23:17:14flaviuTurns out the limit on my computer is 129024 empty frames deep lol
23:17:21Jehan_Not sure what would happen if you set a signal handler.
23:18:40Jehan_flaviu: setrlimit(), ulimit can adjust that.
23:19:44flaviudef-: Rosetta code is really useful, thanks
23:19:51Varriounthttp://stackoverflow.com/questions/7067357/catching-stack-overflow
23:23:41*io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist)
23:27:51*Jesin quit (Quit: Leaving)
23:30:05def-flaviu: you're welcome
23:34:46Araqgood night
23:35:38dom96same
23:35:50*superfun1 quit (Quit: leaving)
23:36:30VarriountAraq: How could stack overflow detection be improved? Do you have an idea?
23:37:11*Jesin joined #nimrod
23:38:10*Trustable quit (Quit: Leaving)
23:47:31flaviuI think I'll post nimrod by example on reddit tomorrow, since everyone is asleep
23:47:46VarriountI'm not asleep
23:48:01def-flaviu: it's finished already?
23:48:17flaviuI just have OOP to do, that'll be really fast
23:48:23def-flaviu: i was thinking that an introduction page would be nice
23:48:32flaviuOf course, there's still plenty for expansion
23:48:41def-Like "What is this? What is Nimrod? Why should I even read this?"
23:49:33Varriount1) It's an introduction page; 2) A super-fun programming language; 3) Because reading is fun and broadens your horizons
23:50:23flaviudef-: Sorry, I'm not too good at writing fluffery. I'd be open to a patch though ;)
23:50:45VarriountCan I have a link to said prose?
23:50:57def-flaviu: Generics page doesn't work also
23:51:06*askatasuna joined #nimrod
23:51:18def-Methods and First Class Functions are empty
23:52:25flaviudef-: I haven't pushed yet
23:52:32flaviuI'm going to skip generics for now though
23:52:48flaviuI put a short version of generics into procs
23:52:56VarriountCan I please have a link?
23:53:14flaviuhttp://nimrod-by-example.github.io/
23:57:02Varriountflaviu: http://nimrod-by-example.github.io/lambdas/ 404's
23:58:07flaviuOk, fixed, just wait a few seconds