Also, Try and util.control.Exception should probably be unified. I think that was an oversight. Try is coming in from Twitter. util.control.Exception is what we all used before its existence, and still has some nicer features.What you're seeing could be akin to "experimentation" but I like to think of it as "progress". I'm hoping in 2.11 to get a chance to clean up the standard library (i.e. a ton of deprecations, pointing people at the 'current best practice' way to do things. Essentially the language has gotten better (macros, anyval, etc.) and we need to move our own standard library in that direction. That will come, but it's going to take time for full deprecation periods and such.SO, what you're seeing is essentially the history of 'best practice' in the library. We should do a better job of cleaning it up and documentating (yes, that's now a word).
That is helpful, thanks. Are either Try and/or Exception reasonable substitutes for handling Some/None?
This is a falsity promoted by people that don't really understand the
Maybe/Option type. Don't let yourself be fooled by them.
My reading was that Option was for preventing null pointer exceptions by converting the result of using a potentially null pointer into Some or None.
"p is not true." is rude? Please explain.
I'm not really sure why it's somehow controversial to tell people to mind their manners. It's not a question of pedagogical style - if you're going to speak to other people, be polite. That's just the bare minimum expectation of civility. Knowing more about a topic (or thinking you know more) than others is not an excuse for rudeness. There is nothing "respectful" about being rude to people. Being polite is not an attempt to manipulate someone, it's just the way that people are supposed to talk to each other...
There is a difference between "p is not true" and "p is a falsity promoted by people who do not understand ..."
The former is a comment on p alone, the latter is also a comment about other people and their actions.
in a way, tony's way is actually *more* respectful than packaging the message nicely to convince more people. he's saying "i give you some facts, now think or stay ignorant" instead of mixing facts while also trying to please the audience.
i never liked commercials. i tend to not buy the things they try to sell because they try to make me associate positive feelings with their products, which is a totally obvious act of de-respecting me.
On Thu, Aug 23, 2012 at 11:51 AM, Rex Kerr <ich...@gmail.com> wrote:Oh good. So I get a free pass? Because the only indication that
> That doesn't make any sense. Almost everyone can--in addition to accurately
> parsing the literal truth of a message--infer many things about tone and
> attitude based upon choice of words. Pretending that your readers are
> unable to understand implication and tone is quite condescending given that
> most people can.
>
there was anything rude or offensive in my original statement is
everyone telling me so. No matter how many times I read it, I cannot
find anything that could be misconstrued as insulting to the reader -
unless you are one of the people holding onto the false belief, but I
was not addressing those people.
This is a falsity promoted by people that don't really understand the
Maybe/Option type. Don't let yourself be fooled by them.
"This is a falsity promoted by people that don't really understand the Maybe/Option type. Don't let yourself be fooled by them."
That's the thing, there was no condescension. That others might perceive
this is because if they had used these words, that's what they would be
intending. This is a projection bias
and it gives away *an awful lot*
about a person when they do this.
On Thu, Aug 23, 2012 at 12:43 PM, Naftoli GugenheimOption is orthogonal to NPEs. Look at a language like Haskell, it
<nafto...@gmail.com> wrote:
> Hmm, how about this: Option prevents NPE (or some of them);
does not have nulls or NPEs, but it does have the Maybe type. It
doesn't have to have the Maybe type, it is just the most generic
solution to the problem.
On Thu, Aug 23, 2012 at 3:47 PM, Richard Wallace <rwal...@thewallacepack.net> wrote:
On Thu, Aug 23, 2012 at 12:43 PM, Naftoli GugenheimOption is orthogonal to NPEs. Look at a language like Haskell, it
<nafto...@gmail.com> wrote:
> Hmm, how about this: Option prevents NPE (or some of them);
does not have nulls or NPEs, but it does have the Maybe type. It
doesn't have to have the Maybe type, it is just the most generic
solution to the problem.
Sure. But in practice it ends up preventing NPEs from happening, since it gives you an alternative way to represent "unavailable" that does not involve null, so you use null less, so the NPEs that hypothetically might have occurred had you used null never happened.No?
You guys genuinely fail to realise how many people (of very high quality intellectual discussion) refuse to use the scala mailing lists because of these ridiculous, offensive, disgusting, soft attitudes toward intellectualism. The funny part comes when I am bombarded with lectures on how to "stop scaring people away" or rewording so that "your audience would be more receptive." What a joke. Seriously, you have no idea how fucking hilarious that is, to me anyway.
Richard just happened to pop his head out of a hole; many others are not so brave. Heads back in the sand now.
"p is not true." is rude? Please explain.
On Thu, Aug 23, 2012 at 8:47 AM, Luke Vilnis <lvi...@gmail.com> wrote:
> I'm not really sure why it's somehow controversial to tell people to mind
> their manners. It's not a question of pedagogical style - if you're going to
> speak to other people, be polite. That's just the bare minimum expectation
> of civility. Knowing more about a topic (or thinking you know more) than
> others is not an excuse for rudeness. There is nothing "respectful" about
> being rude to people. Being polite is not an attempt to manipulate someone,
> it's just the way that people are supposed to talk to each other...
>
> On Thu, Aug 23, 2012 at 11:43 AM, Dennis Haupt <h-s...@gmx.de> wrote:
>>
>> once you start investing energy into the delivery itself instead of the
>> pure content of the message, you might be more successful - but you're also
>> no longer seeing the recipient as a being that can think for itself. you are
>> seeing it a an automaton that you can manipulate if you just deliver the
>> correct input.
>>
>> in a way, tony's way is actually *more* respectful than packaging the
>> message nicely to convince more people. he's saying "i give you some facts,
>> now think or stay ignorant" instead of mixing facts while also trying to
>> please the audience.
>>
>> i never liked commercials. i tend to not buy the things they try to sell
>> because they try to make me associate positive feelings with their products,
>> which is a totally obvious act of de-respecting me.
>> -------- Original-Nachricht --------
>> > Datum: Thu, 23 Aug 2012 09:46:28 -0400
>> > Von: Josh Berry <tae...@gmail.com>
>> > An: scala-...@googlegroups.com
>> > Betreff: Re: [scala-debate] So many ways to handle errors ...
>>
>> > On Thu, Aug 23, 2012 at 8:27 AM, Dennis Haupt <h-s...@gmx.de> wrote:
>> > > in my opinion, knowing that there is something you don't know is as
>> > valuable as getting told something new directly . yes, that information
>> > can be
>> > presented in a nicer way than saying: "the one who said this does not
>> > fully
>> > understand the possibilities of the underlying concept". but the one
>> > hearing this could also try not to interpret it as "you are stupid" but
>> > as "take
>> > a closer look at this". i never felt offended by elitism. i accept the
>> > fact that there might be *large* differences in the quality/quantity of
>> > knowledge and skill one could acquire and one might have at the moment.
>> > of you
>> > guys think I am the nutter on my lonesome who harbours these
>> >
>> > There is also the entirely effective and large fields of propaganda
>> > and advertising that show delivery matters. To believe otherwise
>> > seems just as foolhardy as the alternative. That is, the message of
>> > "please think. Seriously, stop posting messages that are easily
>> > construed as offensive" is just as valid as "Please stop taking
>> > offence." More so, as the actor in the former is proclaiming (often
>> > rightly so) superior knowledge.
>> >
>> > Could there be an ideal world where delivery was less important? I
>> > certainly wish it were so. If the belief is that one can browbeat
>> > people into that world, have at it. There seems to be little evidence
>> > of that compared to the contrary, though.
>> >
>> > Of course, I'm writing this as an outsider, so fully expecting to get
>> > (rightly) lambasted here. When does the term idiocy actually kick in?
>> > :)
>
>
Bruce
A better way to think of Option is as a list with a maximum length of one. To think of Option in the context of "what we already know", in this case, null pointer exceptions, is perilous. I sincerely advise against it and I think others have already.
Just a list, no more than one element. Notice that its map/flatMap/filter methods work just like List. No need to talk about null or pointers or exceptions.
It also gets *way* more attention than is deserved. It is just an algebraic data type, like hundreds of others. Algebraically, it stands for "adding one/unit to a value." This is another useful way to think of Option.
That is helpful, thanks. Are either Try and/or Exception reasonable substitutes for handling Some/None?
My reading was that Option was for preventing null pointer exceptions by converting the result of using a potentially null pointer into Some or None. I assume Try has some way to deal with null pointers -- is it special or just another exception?
It's just an ongoing issue with a vocal minority believing they have it all worked out, but are completely incapable of analytical thinking on the matter. Welcome.
This whole debacle is going to have the opposite effect on me. If the
truth cannot be plainly stated without offense being taken, and I must
find a way to make it palatable to a large group of unknown people
whose mind set is impossible to determine at any given time, then I
probably just won't bother. I have little time or energy for such
things.
This is true. Option is about optionally values. A simple truism.
You can handle failures using option, but you can also use validation or now Try. Try is more about avoiding error handling in a 'staged computation' until later. Validation is about collecting error messages (well, it can be more generic), and Option is about return values that may or may not exist. Like "what value is stored at this key in a map."
Now, as to the rest of the discussions -
Teaching requires successful communication. I do not want to moderate the list, but will do so if required for successful communication. messages that throw up emotional barriers to learning are unhelpful. I realize, tony, that it is arrogant of me to make judgment calls he. I am an imperfect being. However it is my responsibility and I do so to the best of my ability. I will make mistakes.
Emotions can be used to block a message, or to ram one home. I want scala ml to be free of this so we have a free exchange of ideas, and people are willing to ask "dumb" questions and receive patient guidance.
The truth will stand up in the end. Weigh my actions as you see fit. Judge me as you will. I'm one of those responsible for this ML so if you don't like my judgment, find another place to communicate.
However if this thread continues not to discuss option I will shut it down and force conversation to occur on something that won't show when googling for "scala error handling".
This has gone far too long. Tony/Richard, we can take this up privately if you want.
What if the speaker didn't knowingly cause these feelings. These
feelings are purely a byproduct of the readers mental state? I think
this is where I become most confused as I can't possibly know what
will cause these feelings in anyone, much less _everyone_.
I just got hooked on Try (via Future), and now I'll use it for dirty scripty things like
Try(args.head.toInt) filter (_ > 0) recover { ... } foreach (...)
Is that venial? Wikipedia says a mortal sin must be a grave matter and also committed with full knowledge and complete consent. So with Scala, I'm safe, because I'll never possess full knowledge, which is one of its pleasures.
type Option[A] = Either[Unit, A]
No, to say it has nothing to do with null pointer exceptions is to make: a) a statement of fact
It is indeed true that where one might have used null, one instead uses the Option data type
Option has `None` to "do with" NullPointerExceptions
It is an arbitrary relationship. You could similarly argue that there is
a relationship between giraffes and cauliflower because they are both
things.
Put the goal posts in place, then let's talk. I understand it is
confusing, which is why this should be avoided in any introduction.
The phrase "has nothing to do with" does not commute at least when I use
it. The English language sucks balls.