00:23:40 -!- CakeProphet has quit ("haaaaaaaaaa"). 00:38:30 -!- RedDak has quit (Remote closed the connection). 01:50:23 -!- duerig has joined. 01:51:11 \ 01:51:15 Hello? 01:52:05 Anybody here? 01:52:50 Hello 01:53:09 Hi. 01:53:43 I just had a crazy programming-language idea, and I'd like to know why it is dumb. :) 01:53:49 Care to listen and comment? 01:54:15 I would listen 01:54:21 I may not have any valuable comment though 01:55:10 Well, the idea is about failure control. There are two types of failures: External (cannot connect to server), and Internal (Whoops, just de-referenced that null pointer). 01:56:08 I think that current ideas about exceptions map well to internal exceptions. If something like that happens, then it is useful to print or log or pop-up an error message, then resume from a high level. 01:56:35 But they don't seem to map well to external failures. It does me no good to know that my connection failed on line 30. 01:57:15 So, what if instead, any function which can fail returns two distinct types. With no odd stack unwinding. A normal type and a failure type. 01:57:30 And you add a new control structure. So you might be able to code something like: 01:57:59 attempt (file.open("foo.txt", for_input)) 01:58:01 { 01:58:06 // do stuff with file 01:58:06 } 01:58:13 fail 01:58:13 { 01:58:16 whoops 01:58:38 fail (int file_failure) 01:58:39 { 01:58:48 // Handle failure (retry, etc.) 01:58:49 } 01:59:20 And the compiler would force you to use functions that might fail in such a control structure. 01:59:28 Rather than just ignoring them. 01:59:36 So that is the idea. 01:59:47 In what ways do you think it is broken? 02:00:03 It's a fine idea 02:00:16 We already do this in programming though, so I don't think it's something new? 02:00:46 #define if attempt 02:00:47 #define fail else 02:00:48 Well, it is not something that is part of the language. So if you return an error code, say, then you cannot return a file descriptor. 02:00:57 attempt(f(a, b, c, &output)) { 02:01:01 output.left; 02:01:02 } 02:01:10 fail { do something with output.right; } 02:01:36 I guess the idea is to formalize this in the language and to make it easy. 02:01:40 And to enforce it. 02:01:50 what is the host language? 02:01:53 Because even if you have carefully defined f() with several failure types. 02:02:08 Then they might just say f() and not attempt(f()) in, say, C. 02:02:19 I'm envisioning a c++ or java-like language variant for this idea. 02:02:30 C basically doesn't have a type system 02:02:44 it would (like C++) be a bad choice 02:02:48 Well, it definitely doesn't enforce it outside of translation units. 02:02:53 you could do it as a preprocessor for java yeah 02:04:29 But I guess that the difference would be that the compiler, or preprocessor, or whatever, would *enforce* this. You might have an empty fail{} part, but you couldn't just ignore the error altogether. 02:04:50 have you use any ML or haskell? 02:05:15 And it would be easier to be disciplined because the compiler would tell you if you didn't live up to the requirement. :) 02:05:22 I've used OCaml and SML a bit. 02:05:27 Not Haskell yet. 02:07:25 well I think you describe an either type, like datatype 'l 'r either = LEFT of 'l | RIGHT of 'r 02:07:39 so when you match against it, you know what you're getting.. 02:07:58 Ah. Yeah. And this is like Maybe types that I've heard about as well. 02:09:15 One thing is that you often want to do a number of things in series that can each fail. So a write can fail, but you might want to do a loop around it. 02:09:23 So you might have another keyword: 02:09:26 attempt_all 02:09:27 { 02:09:32 f_can_fail() 02:09:36 g_can_fail() 02:09:36 } 02:09:44 fail (f_type || g_type) 02:09:47 { 02:09:53 match on type: 02:09:55 } 02:10:00 That kind of thing. 02:10:49 This kind of structure would be much harder with simple matching on return type. 02:11:10 But is more of an exception-type mechanism. Except that it does not unwind the stack past multiple functions. 02:12:26 maybe with Haskell (esp. lists and other monads), you may be able to implement these ideas 02:13:05 Hmm. Maybe. Does Haskell have lisp-style macros? 02:15:09 no 02:16:01 Hmm. Maybe I could also do it using one of the syntax-extenders for Java. 02:39:35 Thanks for your comments. 02:39:37 Take care. 02:39:39 -!- duerig has left (?). 02:56:37 -!- mtve has quit (Read error: 110 (Connection timed out)). 04:05:48 -!- Sgeo has joined. 06:04:23 -!- Sgeo has quit (Read error: 110 (Connection timed out)). 06:12:51 * pikhq flings a goblin at you 06:22:22 -!- weilawei has joined. 06:28:33 * faxathisia whacks it back at pikhq with a racket 06:29:58 * pikhq wonders what card you have that lets you do that 06:55:49 anybody plays violin here? 06:56:56 i used to 06:57:10 what stopped you? 06:57:48 laziness 07:00:58 why? 07:05:05 ah. 07:06:01 -!- oerjan has joined. 07:56:49 -!- mtve has joined. 07:59:59 -!- clog has quit (ended). 08:00:00 -!- clog has joined. 09:55:58 -!- helios24 has quit (Read error: 104 (Connection reset by peer)). 09:56:15 -!- helios24 has joined. 10:03:16 -!- helios24_ has joined. 10:04:00 -!- helios24 has quit (Read error: 113 (No route to host)). 10:39:07 ooh, irregular webcomic christmas special. not for the weak. 10:39:19 or the sane, for that matter. 10:39:25 -!- helios24 has joined. 10:41:06 -!- helios24_ has quit (Read error: 113 (No route to host)). 10:43:26 -!- helios24 has quit (Read error: 113 (No route to host)). 10:43:34 -!- helios24 has joined. 10:49:56 -!- jix has joined. 11:21:20 -!- faxathisia has quit ("Leaving"). 11:42:40 -!- Sgeo has joined. 12:18:45 -!- sebbu has quit (Read error: 110 (Connection timed out)). 12:19:19 -!- sebbu has joined. 12:35:57 -!- RedDak has joined. 12:36:32 -!- dak has joined. 12:36:55 -!- dak has quit (Read error: 104 (Connection reset by peer)). 14:59:41 -!- RedDak has quit (Remote closed the connection). 15:00:29 -!- meta7 has joined. 15:05:16 -!- meta7 has left (?). 15:49:23 -!- sebbu has quit (Connection timed out). 15:55:03 -!- sebbu has joined. 16:14:55 -!- sebbu has quit (Read error: 60 (Operation timed out)). 16:16:12 -!- jix has quit ("CommandQ"). 16:22:38 -!- oerjan has quit ("Dinner"). 16:32:19 -!- sebbu has joined. 16:36:30 -!- Sgeo has quit (Remote closed the connection). 16:39:23 -!- Sgeo has joined. 16:40:43 -!- sebbu2 has joined. 16:56:42 -!- sebbu has quit (Read error: 110 (Connection timed out)). 17:09:27 -!- jix has joined. 19:12:39 -!- oerjan has joined. 19:41:09 -!- dgm has joined. 19:51:09 -!- AnMaster has quit ("rebooting to older kernel, 2.6.23 breaks with usb after a few days"). 20:57:41 -!- jix has quit (Nick collision from services.). 20:57:51 -!- jix has joined. 21:16:46 -!- sebbu2 has quit (No route to host). 21:20:58 -!- sebbu has joined. 21:49:58 -!- dgm has quit (Read error: 104 (Connection reset by peer)). 21:51:42 -!- oerjan has quit ("leaving"). 21:53:34 -!- sebbu has quit (Read error: 113 (No route to host)). 21:55:06 -!- sebbu has joined. 23:13:52 -!- Slereah- has joined. 23:25:07 -!- RedDak has joined. 23:30:26 -!- Slereah has quit (Read error: 110 (Connection timed out)). 23:37:40 -!- RedDak has quit (Remote closed the connection). 23:58:33 -!- jix has quit ("CommandQ").