rfc:ripples
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:ripples [2013/10/30 09:22] – created krakjoe | rfc:ripples [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 22: | Line 22: | ||
try { | try { | ||
- | while (($buffer = $socket-> | + | while (($buffer = $transcoder-> |
} | } | ||
- | } catch (SocketTranscodeException | + | } catch (DataDecodeException |
| | ||
} | } | ||
- | } catch (SocketReadException $sex) { | + | } catch (SocketReadException $sre) { |
} | } | ||
} | } | ||
- | } catch (SocketDisconnectedException $se) { | + | } catch (SocketDisconnectedException $sde) { |
} | } | ||
Line 40: | Line 40: | ||
This is, horrible. It's horrible because the flow of execution is fragmented and broken. None of us design code to be fragmented or broken, but we cannot deny that " | This is, horrible. It's horrible because the flow of execution is fragmented and broken. None of us design code to be fragmented or broken, but we cannot deny that " | ||
- | If you disagree, questions: | + | // |
- | - what is an exception ? | + | - what is an exception ? |
- | - what does it signify ? | + | - what does it signify ? |
- | Answers: | + | //Answers//: |
- | - an exception encapsulates or describes an error | + | - an exception encapsulates or describes an error |
- | - an exception signifies the the flow of execution must be _broken_, and that the vm must jump to another | + | - an exception signifies the the flow of execution must be //broken//, and that the vm must jump to another |
- | So, that's exceptions dealt with, they create fragmented and broken flow. | + | So, that's exceptions dealt with, //they create fragmented and broken flow.// |
- | Warnings have an even bigger problem in that they do not affect your code _at all_; you only see them during development, | + | Warnings have an even bigger problem in that they do not affect your code //at all//; you only see them during development, |
- | What constitutes a warning currently, does not necessarily constitute an exception; take the arbitrary example of a socket timeout, | + | Our code can only detect |
- | But our code can only detect such conditions deductively by extrapolating it from the current state of the program; inferring | + | What constitutes a warning currently, does not necessarily constitute an exception; take the arbitrary example |
So, that's warnings, they don't affect anything in any useful way and cause us to undertake more work than is necessary. | So, that's warnings, they don't affect anything in any useful way and cause us to undertake more work than is necessary. | ||
Line 60: | Line 60: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | A *Ripple* will encapsulate or describe conditions on the scale from warning to exception, a *dam* will deal with those conditions and, if no exceptions/ | + | A //Ripple// will encapsulate or describe conditions on the scale from warning to exception, a //dam// will deal with those conditions and, if no exceptions/ |
<code php> | <code php> | ||
Line 69: | Line 69: | ||
try { | try { | ||
- | while (($buffer = $socket-> | + | while (($buffer = $transcoder-> |
- | | + | |
} | } | ||
- | + | ||
- | } catch (SocketTranscodeException | + | } catch (DataDecodeException |
/* this is exceptional */ | /* this is exceptional */ | ||
/* nothing can be done to recover execution */ | /* nothing can be done to recover execution */ | ||
} | } | ||
- | | + | |
- | | + | |
} | } | ||
} | } | ||
- | } damn (SocketDisconnectRipple $se) { | + | } dam (SocketDisconnectRipple $sd) { |
+ | |||
} | } | ||
</ | </ | ||
- | The flow of this program could be described as fragmented, but it is *not* broken, execution | + | Dropping ripples may look like: |
+ | |||
+ | <code php> | ||
+ | /* ... */ | ||
+ | drop new SocketReadRipple($this); | ||
+ | /* ... */ | ||
+ | </ | ||
+ | |||
+ | The flow of this program could be described as fragmented, but it is //not// broken, execution | ||
+ | We throw exceptions to be caught, unconditionally altering the flow of execution; we can drop ripples to be dammed, allowing execution to recover. | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 124: | Line 133: | ||
Do we have in ripples a viable replacement for warnings and notices ? | Do we have in ripples a viable replacement for warnings and notices ? | ||
- | ===== Proposed Voting Choices | + | ===== Preempted Opinions |
- | You are crazy | + | * You are crazy |
- | Write it an we will come | + | |
- | I love warnings and notices and don't see the problem | + | |
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Oh no, not yet. Let us discuss the idea first. | Oh no, not yet. Let us discuss the idea first. |
rfc/ripples.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1