Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Exceptions in sepple

Name: Anonymous 2009-08-28 17:44

How do you manage exceptions in sepple? I experimented this some time ago. I thought it was a good pattern, but it led me to death:


#include <exception>
#include <string>
using namespace std;

/* This one is used for exceptions in memory management */
class MemoryException : public exception {
   private:
     string error;
   public:
     const char *what() {
       return error.c_str()
     }
     virtual ~MemoryException() throw() {};
     MemoryException &setError(string e) {
       error = e;
       return *this;
     }
};


Used as follows:

class HowAreYou {
  private:
    MemoryException error;
  public:
    void some_failing_method() throw (MemoryException) {
      throw error.setError("Oh, crap, I failed!");
    }
}


What do you think about it?

Name: Anonymous 2009-08-28 19:25

sepples
I manage to avoid them by not using sepples.

Name: Anonymous 2009-08-28 20:17

>>1
good pattern
Does. Not. Compute.

Name: Anonymous 2009-08-28 21:09

>>3
Exactly, a design pattern is a fundamental weakness in a language. Real languages would allow you to abstract that pattern away nicely.

Name: Anonymous 2009-08-29 5:16

>>4
Yes, but you know that sepples is not a good language, nevertheless is used in a lot of situations, and I think that collecting good patterns is a good way to face the needing of modifying existent sepples programs.

Name: Anonymous 2009-08-29 5:36

>>5
Just like ``web developers'' collect bits of Javascript and PHP to use?
Design patterns are symptomatic of a poor language, but also of a poor programmer.

Name: Anonymous 2009-08-29 6:17

>>6
Oh, come on Anonymous... Are you telling me that when you was younger and noticed that your code was sucky you kept writing code in the same way? Are you telling me that when you discovered a new way of programming (e.g. callbacks) you didn't say "well, this may be useful"?

I agree on your point if we talk about languages: a poor language requires more design patterns in order to a void language suckyness (and this is expecially true for C++, where IMHO you should avoid references if you can).

Name: Anonymous 2009-08-29 6:25

>>7
when you was

Name: Anonymous 2009-08-29 7:34

>>6
Design patterns are symptomatic of a poor language, but also of a poor programmer.
With the first point I can agree, the second is sort-of-right but up to a point. Average programmers don't see the real reason for which design patterns exist. They see it as a good tool and that's ok. If they use the the pattern correctly, there's no harm done. It's actually beneficial to the whole team because it's a standard everyone can understand (sort of a common denominator). The thing that differentiates a good and average programmer is the deeper meaning behind the pattern: the pattern is a symptom of a language deficiency. There's nothing inherently wrong in using design patterns but there are some people that just couldn't help but take it too far. Those people have created Java and lo and behold it became the most popular enterprise language to date.

Name: Anonymous 2009-08-29 8:19

You should use design patterns because thats the right way and not because they was written down in some book...

Name: Anonymous 2009-08-29 8:20

>>7
when you was younger
>>10
they was written down

Hmm...

Name: Anonymous 2009-08-29 8:32

>>1
What the fuck is you trying to imply?

Name: Anonymous 2009-08-29 8:33

>>11
I'm going to guess that >>10 was making fun of ignorant people.

Name: Anonymous 2009-08-29 13:34

>>12
That you are a n Irish

Name: Anonymous 2009-08-29 14:18

>>14
This thread needs some CROMA

Name: Anonymous 2009-08-29 14:36

>>15
GIVE US THE SOURCE CODE ALREADY YOU GINGER CUNT

Name: Patrick Collision 2009-08-29 16:12

>>16
After I'm done banging the Culver, bitch.

Name: Anonymous 2009-08-29 16:16

>>17
You've been pounding away at that labia for over a year, it must smell like fish by now

Name: Anonymous 2009-08-31 9:50

/prog/, srsly, how do you suggest to write exceptions in sepples?

Name: Anonymous 2009-08-31 10:33

Name: Anonymous 2010-12-26 19:00

Name: Anonymous 2011-02-03 6:46

Name: Anonymous 2011-02-04 18:07


Don't change these.
Name: Email:
Entire Thread Thread List