00:04:08 | * | saml_ joined #nimrod |
00:05:37 | * | icebattle joined #nimrod |
00:07:17 | * | boydgreenfield quit (Quit: boydgreenfield) |
00:20:40 | Varriount_ | Araq: Ping |
00:20:45 | * | Varriount_ is now known as Varriount |
00:20:55 | def- | Varriount: 01:14 < Araq> good night |
00:21:06 | Varriount | Aw... |
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:40 | Varriount | dom96: 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:47 | Varriount | dom96: 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:38 | Mat3 | hello |
09:15:38 | NimBot | Araq/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:41 | Araq | hi Mat3 |
10:56:10 | Mat3 | hi Araq |
10:57:22 | Mat3 | I have finished the compiler generator and implement at current my algorithm for automatic parallelization |
10:58:57 | Mat3 | beside, I will take a look at the C code generation in Nimrod |
10:59:07 | Mat3 | what files are relevant for this ? |
11:01:07 | Araq | cgen.nim, cgendata.nim, ccg*.nim |
11:01:44 | Mat3 | thanks |
11:02:46 | Mat3 | hmm, how can I export a whole module (I do not want to mark all statements with '*') ? |
11:08:50 | Mat3 | ciao |
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:43 | pown5 | cint*cint = ? |
16:18:24 | pown5 | let num_items = info.channels * info.frames |
16:18:30 | pown5 | here I multiply 2 cint |
16:18:51 | pown5 | seems 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:09 | pown5 | trying with: let num_items: cint = info.channels * info.frames |
16:28:25 | pown5 | gives: sndfile.nim(71, 36) Error: type mismatch: got (int64) but expected 'cint' |
16:31:05 | pown5 | OK so I do: let num_items = cast[cint](info.channels * info.frames) |
16:31:44 | pown5 | problem 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:02 | pown5 | correct? |
16:32:53 | * | mwbrown joined #nimrod |
16:38:11 | flyx | why not: let num_items: cint = info.channels * info.frames |
16:38:42 | flyx | oh |
16:38:45 | flyx | you 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:57 | flyx | well, as cint is an int32, I don't see why num_items becomes an int64 |
16:48:05 | flyx | possibly 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:21 | Araq | bug report |
17:11:32 | Araq | in 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:12 | dom96 | hi |
17:57:39 | NimBot | nimrod-code/csources master 805ce61 Marin [+0 ±1 -0]: fix url in readme |
17:57:39 | NimBot | nimrod-code/csources master 7d454fb Dominik Picheta [+0 ±1 -0]: Merge pull request #4 from hoffoo/patch-1... 2 more lines |
17:58:42 | def- | hi dom96 |
18:01:55 | * | Jesin quit (Quit: Leaving) |
18:10:20 | * | pown5 joined #nimrod |
18:10:50 | pown5 | Hi! ok next issue |
18:10:59 | pown5 | let buffer = newSeq[cint](num_items) |
18:10:59 | pown5 | var test: ptr int = cast[ptr cint](addr(buffer[0])) |
18:11:17 | pown5 | => sndfile.nim(74, 35) Error: expression has no address |
18:12:10 | pown5 | I'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:09 | pown5 | typo, 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:39 | def- | pown5: var buffer |
18:16:54 | def- | pown5: otherwise you can't even fill the buffer |
18:17:11 | def- | and hi! |
18:17:16 | * | bjz quit (Read error: Connection reset by peer) |
18:17:33 | * | bjz joined #nimrod |
18:18:41 | Araq | don't use 'cast' |
18:18:46 | Araq | use a type conversion instead |
18:18:48 | pown5 | def! thanks! |
18:20:18 | pown5 | great!! |
18:20:22 | pown5 | Thanks and Hi! |
18:20:26 | * | pown5 quit (Remote host closed the connection) |
18:29:08 | def- | Araq: nice, didn't know you can do typesafe type conversions to ptrs |
18:29:42 | Araq | "typesafe" is a strong word ;-) |
18:30:29 | def- | at least the compiler complained a few times! |
18:30:57 | Araq | btw do you really run into all these bugs or do you stress test things? |
18:31:28 | def- | Araq: I solved half the Rosetta Code tasks in nimrod in the last days |
18:31:48 | def- | so I actually ran into them |
18:31:57 | Araq | yay |
18:35:14 | def- | was a nice way to test the standard library and compiler |
18:35:56 | Araq | the amount of bugs is depressing |
18:36:45 | Skrylar | you need that crazy stp solver thing from a while back |
18:36:46 | Skrylar | lol |
18:37:05 | Araq | would 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:07 | dom96 | def-: Damn, well done. http://rosettacode.org/wiki/Nimrod that is a loootttt |
18:51:14 | dom96 | brb |
18:51:35 | def- | 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:11 | Mat3 | hello |
19:06:22 | def- | hi Mat3 |
19:06:32 | Mat3 | hi def- |
19:07:22 | * | leru joined #nimrod |
19:07:52 | Araq | hi Mat3. you can't export everything at once, but you can use include instead of import to get a similar effect |
19:10:30 | dom96 | def-: Have you considered writing some examples for nimrod-by-example? |
19:11:12 | def- | dom96: not really, but now I am considering |
19:12:04 | dom96 | def-: Cool. |
19:17:06 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:19:43 | * | enurlyx1 quit (Quit: Leaving.) |
19:19:52 | Mat3 | Araq: thanks, I include the file then |
19:20:57 | Araq | ofc you should only include it once ;-) |
19:21:44 | Mat3 | By the way: Any chance for some more Pascalism like 'INTERFACE' and 'IMPLEMENTATION' ? |
19:23:21 | leru | Do I get it right? It is not possible to increment a value by "++" ? |
19:23:56 | flaviu | leru: try `inc foo` |
19:24:18 | * | brson quit (Ping timeout: 240 seconds) |
19:24:37 | leru | Thank you! |
19:27:05 | Araq | Mat3: I hated these ... what's the advanage? |
19:28:55 | Mat3 | I 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:42 | flaviu | Mat3: Are you complaining about having to type '*'? I think you should check out java, much more fun there! |
19:30:13 | leru | Can I tell the compiler where the cache should be? If yes, what flag or whatever can I use? |
19:30:28 | Araq | --nimcache:foo/bar |
19:30:42 | leru | Thanks! |
19:30:43 | Araq | you can also put it into your config |
19:30:54 | flaviu | So a global nimcache would work? |
19:32:08 | Mat3 | flaviu: Yes, the same procedure. I'm constantly struggling because forget to mark public declarations in larger source files |
19:32:55 | Araq | Mat3: ok but how does copying these into an interface section help with that? |
19:34:16 | flaviu | Mat3: 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:32 | flaviu | Is there a way to genericly check if a value is nil? |
19:34:47 | Araq | isNil ? |
19:35:15 | def- | flaviu: or == nil? |
19:35:28 | flaviu | type mismatch for both |
19:35:32 | flaviu | int can never be nil |
19:35:45 | Araq | proc isNil*(x: int): bool = false |
19:35:46 | def- | when compiles: isNil x |
19:35:48 | Mat3 | Araq: with common Pascal, declarations (complete procedures for example) in the interface block are visible, declarations in the implementation block not |
19:36:06 | def- | when compiles(isNil x)* |
19:36:16 | def- | but i guess that's not good style |
19:36:38 | Mat3 | (however this is uncommon style) |
19:37:16 | flaviu | def-: Thanks, that works |
19:37:37 | Araq | Mat3: that doesn't answer my question at all |
19:37:56 | Araq | procedure foo; begin end; // oops, forgot to export it |
19:38:01 | Araq | so ... I put |
19:38:10 | Araq | procedure foo; into the interface section |
19:38:10 | leru | Somehow 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:32 | def- | leru: what error do you get? |
19:38:46 | Araq | leru: --nimcache:"G:\nimcache" perhaps |
19:38:49 | Mat3 | I do not need to mark the procedure as 'visible' |
19:38:53 | leru | No error. It just still creates the cache in the same folder. |
19:39:10 | Araq | Mat3: well yes, you need to copy the whole header instead |
19:40:24 | Mat3 | I can copy the complete procedure instead (however, this is not possible with Borland's Pascal dialect if I remember correctly) |
19:40:40 | Araq | leru: try putting it into a myproject.cfg file which is in the same folder as your myproject.nim |
19:41:20 | Araq | Mat3: er ... I've never seen that done in Pascal |
19:41:41 | Mat3 | as written, it is somewhat uncommon style |
19:41:41 | Araq | I'm pretty sure Borland and FPC don't allow that |
19:42:30 | Mat3 | that's right |
19:43:33 | * | Ven joined #nimrod |
19:43:53 | Mat3 | the reason for this is: Borland and FPC should be single-pass compilers |
19:44:52 | Mat3 | so interface delcarations are handled like (public) prototypes |
19:46:30 | Mat3 | ^declarations and I restrict that to procedure or function declarations |
19:46:32 | flaviu | Araq: Can we get gotos? |
19:46:38 | Araq | flaviu: never |
19:46:45 | mwbrown | what about come-from? |
19:46:45 | Mat3 | *lol* |
19:47:25 | flaviu | Well, I guess I'll have to make a macro for them when I need them... |
19:47:40 | flaviu | ;P |
19:47:50 | Araq | flaviu: it's pretty easy to do |
19:48:15 | Araq | but I won't tell you the solution :P |
19:48:24 | flaviu | While loops and break |
19:49:11 | flaviu | actually, break statements would work even better |
19:49:53 | flaviu | *block |
19:58:48 | flaviu | Ah, switch statements in a while loop |
20:01:07 | * | askatasuna quit (Quit: WeeChat 0.4.3) |
20:01:20 | Araq | we call it "case", but yes |
20:02:31 | leru | Okay, I still don't get it. How does this thing with myproject.cfg work? |
20:04:45 | Araq | what file do you pass to the compiler? |
20:09:31 | leru | I found the problem. It's sitting in front of the screen. I accidently was in the wrong line. Yay! |
20:21:15 | mwbrown | Does anyone know if there is any termios style raw-terminal functionality in Nimrod's library yet? |
20:21:32 | mwbrown | i.e. something you would use to implement curses-style terminal manipulation / raw access? |
20:21:42 | def- | mwbrown: i looked 10 minutes ago and found nothing |
20:22:19 | mwbrown | maybe it would be easier to wrap something like Curses in that case |
20:22:31 | dom96 | The only thing we have is http://build.nimrod-lang.org/docs/terminal.html |
20:22:33 | def- | i saw some pdcurses, but couldn't get it working |
20:22:34 | dom96 | As far as I know. |
20:22:35 | flaviu | mwbrown: Definitely easier |
20:22:40 | * | Johz quit (Ping timeout: 260 seconds) |
20:22:51 | Araq | we have a pdcurses wrapper |
20:23:00 | Araq | that used to work I think |
20:23:54 | Mat3 | mwbrown: Un*x like termios structures share a raw flag |
20:24:24 | Mat3 | combine 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:50 | Mat3 | ciao |
20:27:56 | * | Mat3 quit (Quit: Verlassend) |
20:29:35 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
20:32:25 | NimBot | Araq/Nimrod devel ed226eb Araq [+0 ±4 -0]: added stack overflow prevention |
20:32:40 | Araq | dom96: please try it with this patch |
20:36:03 | * | Jehan_ joined #nimrod |
20:38:20 | dom96 | will do |
20:40:15 | def- | Araq: now the stack overflows so much earlier! |
20:40:45 | Araq | def-: the limit of 1000 suffices for the compiler itself which is quite recursive |
20:40:54 | Araq | I set the limit to 2000 |
20:41:07 | def- | calldepth is always fixed to 2000 now? I used to get up to 87000 before |
20:41:12 | Araq | I don't think this will cause any problems out there |
20:41:38 | flaviu | Araq: Is there an option to increase it for people that want to? |
20:42:10 | Araq | no, it's a quick hack to see if async causes some bad recursions |
20:42:36 | Araq | the limit is gone in release builds btw |
20:43:19 | Araq | but 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:13 | dom96 | Araq: Makes no difference. |
21:29:23 | Araq | well it does |
21:29:31 | Araq | now we know it's no stack overflow :P |
21:29:33 | flaviu | Hmm, generics are basically structural typing! |
21:29:55 | Araq | actually it's basically a type based macro system |
21:30:08 | Araq | on top of another macro system |
21:30:15 | Araq | with strange interactions ... |
21:30:29 | reactormonk | and unicorns? |
21:30:32 | Araq | but hey I still don't know how to do better |
21:30:39 | flaviu | I don't really understand what you're trying to say, but to the user it looks like structural typing |
21:31:17 | Araq | it's only a design mistake as soon as I figured out a better design |
21:31:19 | Araq | ;-) |
21:32:34 | flaviu | Whats 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:33 | Araq | flaviu: the caching mechanism the compiler uses for generics is unsound |
21:36:13 | Araq | but fortunately nobody notices and the people who dislike nimrod are already busy complaining about indentation based syntax |
21:37:10 | flaviu | Araq: I cover braces in http://nimrod-by-example.github.io/block/ |
21:37:14 | flaviu | Last paragraph |
21:44:48 | * | io2 joined #nimrod |
21:47:32 | * | enurlyx quit (Quit: Leaving.) |
21:48:14 | Jehan_ | 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:09 | reactormonk | Jehan_, subtyping is a bit more masty if consider value-types |
21:52:02 | Jehan_ | reactormonk: Yes, I know. From pretty direct experience, as a matter of fact. :) |
21:52:51 | reactormonk | Jehan_, no experience here, but Araq made a pretty lasting impression. I've only messed around with surface stuff |
21:53:55 | Jehan_ | reactormonk: For parametric polymorphism, specialization is a relatively straightforward solution. That, unfortunately, doesn't apply to subtype polymorphism. |
21:54:50 | reactormonk | Jehan_, how come about the subtype stuff? |
21:55:04 | * | Demos quit (Read error: Connection reset by peer) |
21:55:13 | Jehan_ | 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:51 | Jehan_ | When you're using dynamic dispatch, you need a way to treat value and reference types uniformly. |
21:56:16 | reactormonk | so it's a not-known-at-compile-time problem |
21:56:20 | Jehan_ | One way is to box value types, but that means overhead. |
21:57:15 | Jehan_ | Difference in assignment semantics make the problem a bit thornier than just that, too. |
21:57:40 | reactormonk | Can you give me an example on assignment semantics? |
21:58:25 | Jehan_ | Umm, simple. Assume that a function accepts any argument conforming to signature S (that's structural subtyping). |
21:58:43 | Jehan_ | The function assigns that argument to another variable. |
21:59:06 | Jehan_ | If the argument is a reference, then you just assign the reference. Otherwise, you need to do a structural assignment. |
22:00:02 | flaviu | Does inc really need to be magic? The definition is straightfoward. |
22:00:07 | Jehan_ | So, in order to support value types, you need to carry extra information and basically incur extra overhead for every assignment. |
22:01:10 | Jehan_ | 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:17 | flaviu | Not that big of a deal anyway, but it seems odd |
22:01:59 | reactormonk | Jehan_, so you basically carry a type tag around as well? |
22:02:26 | Jehan_ | That's the other thing, how do you do dynamic dispatch? |
22:03:54 | Jehan_ | You can encode the dispatch table/information in the object, or you can turn objects into (object, dispatcher) pairs. |
22:04:48 | Jehan_ | 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:31 | Jehan_ | Which also means that the problem goes away for immutable value types. |
22:09:31 | reactormonk | What's the difference betwen stuff in the object and pairs? |
22:10:31 | Jehan_ | Well, it's basically where the dispatch table pointer is placed (assuming you use dispatch tables). |
22:10:56 | Jehan_ | You can either put it in the object itself, or pass it separately. |
22:11:16 | Jehan_ | 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:06 | flaviu | Overloads can't be resolved upon their return types it looks like |
22:14:06 | reactormonk | flaviu, been there, asked for that |
22:16:12 | flaviu | Well, another vote for that then. `proc zero(res: var int) = (res = 0)` is ugly as hell |
22:16:51 | Jehan_ | flaviu: Yes, you can, though it's a bit cumbersome to do. |
22:17:11 | Araq | yeah ask for new features |
22:17:17 | Jehan_ | proc foo(x: int): int = x |
22:17:17 | Jehan_ | proc foo(x: int): string = "<" & $x & ">" |
22:17:17 | Jehan_ | let a: proc(x: int): string = foo |
22:17:17 | Jehan_ | echo a(1) |
22:17:22 | Araq | this is the way to get this thing stable |
22:19:15 | reactormonk | >:) |
22:19:39 | reactormonk | flaviu, 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:26 | Jehan_ | Hmm, looking at it, you can put it inside a template, too. |
22:21:30 | flaviu | Jehan_: I don't think that would work for me. I want `proc zero(): int`, and `proc zero(): string` |
22:22:01 | flaviu | overloading variables also doesn't work for obvious reasons |
22:22:12 | Jehan_ | flaviu: let actualZero: proc(): int = zero |
22:22:14 | reactormonk | flaviu, no mands for you |
22:22:22 | reactormonk | *monads |
22:22:25 | dom96 | flaviu: Just use different names |
22:22:44 | flaviu | dom96: then the entire idea becomes totally worthless |
22:23:30 | flaviu | reactormonk: Actually, I'm doing abelian groups |
22:23:37 | flaviu | TIL that word exists |
22:23:57 | dom96 | flaviu: what idea? What are you trying to do? |
22:24:31 | flaviu | Its ridiculous, silly, and unsound, but I'm trying to make a ring with both strings and ints |
22:24:55 | Jehan_ | flaviu: Interesting exercise, but be warned that most type systems are too weak for practical computer algebra. |
22:25:19 | reactormonk | gotta do haskell? |
22:25:26 | flaviu | I'm not doing computer algebra, lol |
22:25:30 | dom96 | A ring? |
22:25:30 | Jehan_ | reactormonk: That includes Haskell. |
22:25:39 | flaviu | dom96: https://en.wikipedia.org/wiki/Ring_%28mathematics%29#Definition |
22:25:48 | Jehan_ | If you write programs for rings, you're doing computer algebra. :) |
22:26:16 | flaviu | Jehan_: I just want to do `"a" * 2` and `1 * 2` with a single function |
22:26:22 | flaviu | severely limited |
22:26:51 | Jehan_ | dom96: A ring is basically a structure that knows addition, subtraction, multiplication, and the distributive laws, but not necessarily division. |
22:27:03 | Jehan_ | flaviu: That looks like a module, not a ring, for what it's worth. |
22:27:22 | dom96 | Jehan_: What use cases do they have? |
22:27:26 | Jehan_ | (Module in abstract algebra meaning something entirely different from what it's used for in computer science.) |
22:27:29 | flaviu | Jehan_: I haven't gotten to modules yet |
22:28:03 | Jehan_ | Modules are basically like vector spaces, except with rings instead of fields for scalar values. |
22:28:27 | flaviu | You aren't really making it clearer ;P |
22:28:53 | Jehan_ | flaviu: Sorry. :) |
22:29:32 | reactormonk | Jehan_, so a module is an n-dimensional ring? |
22:29:42 | Jehan_ | flaviu: In any event, what you'd probably need in Nimrod is user-defined type-classes. |
22:30:37 | Jehan_ | 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:34 | Jehan_ | Vectors over integers are an example of an integer module, for instance. |
22:31:44 | reactormonk | ok |
22:32:00 | Jehan_ | Not a vector space, because you don't have division for the elements. |
22:45:33 | * | EXetoC joined #nimrod |
22:46:22 | Jehan_ | flaviu: One other way to deal with overloading results is to use a `var` parameter to return them. |
22:46:43 | Jehan_ | That's often a bit on the ugly side, though. |
22:47:35 | flaviu | Yeah, thats what I was thinking |
22:48:21 | flaviu | Main disadvantage is that getting an immediate value is ugly |
22:50:48 | Jehan_ | Well, you can do this: |
22:50:53 | Jehan_ | proc zero: int = 0 |
22:50:53 | Jehan_ | proc zero: float = 0.0 |
22:50:53 | Jehan_ | proc zero(T: typedesc): expr = |
22:50:53 | Jehan_ | let z: proc: T = zero |
22:50:53 | Jehan_ | z() |
22:51:28 | Jehan_ | Then you can use zero(int) or zero(float) or whatever you have an overload for. |
22:51:43 | Varriount | Meep. |
22:51:59 | flaviu | I don't care enough anyway, given that I just wanted it for some experimental throwaway code |
22:52:09 | EXetoC | return-type overloading? |
22:52:15 | flaviu | EXetoC: Yes |
22:53:15 | flaviu | Java has a big secret here: its possible if you skip the semantic checking :D |
22:53:46 | flaviu | of the java code, not bytecode |
22:53:53 | Varriount | Woah, Nimrod just got stack overflow protection? |
22:53:57 | Varriount | O_o |
22:54:34 | Araq | Varriount: yeah and it could easily be much better |
22:54:43 | Araq | but it works |
22:55:32 | reactormonk | Araq, what about making a constant out of that 2000? |
22:55:36 | * | Johz quit (Quit: Leaving) |
22:56:17 | Araq | reactormonk: what's the point? it's only used in one place |
22:58:00 | reactormonk | Araq, I don't know, some knee-jerk reaction ot magic values. |
22:58:47 | * | mwbrown quit (Ping timeout: 264 seconds) |
22:59:04 | flaviu | Araq: You should make the constant a magic and make it configurable with flags |
22:59:47 | flaviu | I don't know whats come over me, I'm suggesting increasing magic O_O |
23:00:35 | EXetoC | make it a functor |
23:03:52 | * | superfun1 joined #nimrod |
23:04:02 | * | Demos__ joined #nimrod |
23:06:57 | Varriount | Is it possible, on a low level, to actually 'catch' a stack overflow? |
23:07:16 | Varriount | I mean, isn't it just a kind of out-of-memory error? |
23:07:47 | * | Demos_ quit (Ping timeout: 264 seconds) |
23:08:00 | reactormonk | Varriount, basically |
23:09:15 | flaviu | Unless 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:01 | Jehan_ | Varriount: Usually, it's an out of control recursion. |
23:10:29 | Jehan_ | And since the stack is being unrolled for exception handling, it should work in most cases. |
23:11:22 | Varriount | What part of a program actually 'throws' a stack overflow exception (say, a C program)? |
23:11:44 | reactormonk | Varriount, in C? probably nothing. |
23:11:45 | Jehan_ | Varriount: A C program doesn't. It'll trigger a signal. |
23:12:06 | Jehan_ | You get a stack overflow in C by running into a protected page of memory. |
23:12:17 | Jehan_ | => signal |
23:12:32 | flaviu | I pretty sure the spec doesn't even specify that stack overflows exist |
23:12:39 | reactormonk | Jehan_, or a good old OOM error |
23:12:51 | Jehan_ | reactormonk: In C? How? |
23:12:53 | reactormonk | ... which is a signal again |
23:12:57 | Varriount | Hm. But a signal handler would have to create a stack frame somehow.. |
23:13:00 | Jehan_ | Calling a function in C doesn't allocate memory. |
23:13:22 | Varriount | Jehan_: Doesn't it allocate memory on the stack? |
23:13:28 | reactormonk | "kill process or sacrifice child" |
23:13:50 | reactormonk | Jehan_, the stack uses memory though, incae of a recursion, correcT? |
23:14:20 | Jehan_ | Varriount: See sigaltstack() |
23:14:36 | Jehan_ | reactormonk: Preallocated memory. |
23:15:12 | reactormonk | Jehan_, so there's a finite number of recursions? |
23:15:15 | Jehan_ | Varriount: Though I honestly don't know at the moment what happens if you don't do that. |
23:15:20 | Jehan_ | reactormonk: Correct. |
23:15:32 | Jehan_ | In C, that is. |
23:15:43 | Jehan_ | Other languages can and do allocate stack frames on the heap. |
23:16:25 | Jehan_ | Mind you, "finite" is usually a pretty big number. |
23:16:26 | flaviu | Varriount: “./stackoverflow” terminated by signal SIGSEGV (Address boundary error) |
23:16:52 | reactormonk | ok |
23:17:12 | Jehan_ | flaviu: Yeah, but that's for default behavior. |
23:17:14 | flaviu | Turns out the limit on my computer is 129024 empty frames deep lol |
23:17:21 | Jehan_ | Not sure what would happen if you set a signal handler. |
23:18:40 | Jehan_ | flaviu: setrlimit(), ulimit can adjust that. |
23:19:44 | flaviu | def-: Rosetta code is really useful, thanks |
23:19:51 | Varriount | http://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:05 | def- | flaviu: you're welcome |
23:34:46 | Araq | good night |
23:35:38 | dom96 | same |
23:35:50 | * | superfun1 quit (Quit: leaving) |
23:36:30 | Varriount | Araq: 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:31 | flaviu | I think I'll post nimrod by example on reddit tomorrow, since everyone is asleep |
23:47:46 | Varriount | I'm not asleep |
23:48:01 | def- | flaviu: it's finished already? |
23:48:17 | flaviu | I just have OOP to do, that'll be really fast |
23:48:23 | def- | flaviu: i was thinking that an introduction page would be nice |
23:48:32 | flaviu | Of course, there's still plenty for expansion |
23:48:41 | def- | Like "What is this? What is Nimrod? Why should I even read this?" |
23:49:33 | Varriount | 1) It's an introduction page; 2) A super-fun programming language; 3) Because reading is fun and broadens your horizons |
23:50:23 | flaviu | def-: Sorry, I'm not too good at writing fluffery. I'd be open to a patch though ;) |
23:50:45 | Varriount | Can I have a link to said prose? |
23:50:57 | def- | flaviu: Generics page doesn't work also |
23:51:06 | * | askatasuna joined #nimrod |
23:51:18 | def- | Methods and First Class Functions are empty |
23:52:25 | flaviu | def-: I haven't pushed yet |
23:52:32 | flaviu | I'm going to skip generics for now though |
23:52:48 | flaviu | I put a short version of generics into procs |
23:52:56 | Varriount | Can I please have a link? |
23:53:14 | flaviu | http://nimrod-by-example.github.io/ |
23:57:02 | Varriount | flaviu: http://nimrod-by-example.github.io/lambdas/ 404's |
23:58:07 | flaviu | Ok, fixed, just wait a few seconds |