Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror

Comment Re:Because no one else does (Score 1) 260 260

With lambda functions, my lines of code is shorter. I'm write now having to debug my predecessor's code and he wasn't aware of lambdas in C#. Everything becomes a jump point into another awkward function with the intent obfuscated. Rather than just using Linq and Expression trees, he made his own collection classes with tailored search functions on each function. Not every function needs a name and the intent can be inferred by just reading the function definition from the body of the function.

Comment Re:The learning new trends is big (Score 1) 370 370

I can understand that too. I'm delegating tasks to a person 20 years older than me (I'm 31) and with 16 years more experience than my 4 years of experience. I asked him to write a program that connects to a database directly and he's never had that experience. He said he had several years of experience in VB.NET and he could adapt to other programming languages, but he's struggling with C# and I know he didn't try learning the modern features of VB.NET, like using generics. He has difficulty using search engines to solve common program mistakes, and I've suggested that Google should be his first resort to solving problems rather than I being his first resort. He was fired from his previous job and he's already asking for training on programming. My supervisor is aware of the situation and is growing concerned about his performance. It's basically the end of the line for him in the programming world if he gets fired from my current employer.

Comment Re:pointless (Score 1) 434 434

Need to fix some things because of the use of brackets You only have generics of the first kind in C#, so implemented things like monad transformers become difficult. A higher order generic can box an inner generic. Say if you had something like with the higher order generic boxing in the inner generic. That's not possible in C# and in F#. new Foo<G, A> { G<A> member = new G<A>(); } A more concrete example of a .NET class that would be G : System.Collection.Generics.List such that G<A> : System.Collection.Generics.List<A>. But you can't pass G around freely and then box it in later. You can only have G an instance of A so new Foo<System.Collections.Generics.List, A> { System.Collections.Generics.List<A> member = new System.Collections.Generics.List<A>() } is not possible.

Comment Re:pointless (Score 1) 434 434

Well, to be fair, generics are also poorly implemented in C#. If scala can use higher order generics like Haskell can, there's no reason why C# and Java shouldn't be able to.

I'm curious. C# avoided the stupid type-erasure mistake (one that has come back to bite Java, *especially* during the Lambda-J discussions). C# has define-site variance as opposed to use-site variance. What exactly is your problem with C# generics?

You only have generics of the first kind in C#, so implemented things like monad transformers become difficult. A higher order generic can box an inner generic. Say if you had something like with the higher order generic boxing in the inner generic. That's not possible in C# and in F#. new Foo { G member = new G(); } A more concrete example of a .NET class that would be G : System.Collection.Generics.List such that G : System.Collection.Generics.List. But you can't pass G around freely and then box it in later. You can only have G an instance of A so new Foo { System.Collections.Generics.List member = new System.Collections.Generics.List() } is not possible.

Comment Re:Formula for success (Score 1) 264 264

This is what happened during the construction of the Canadian Pacific Railway. Politicians and other speculators would by up land on the pathway to the CPR and ask the CPR for inflated prices when the CPR would build the railway. Of course some speculators got shafted when the CPR chose to redirect their railway away from the speculators' land.

Comment Re:Monads! (Score 1) 536 536

You've got me interested... but how does it work?

I hate to be the lazy bum, but since it is your made-up notation would you mind adding in the return value checks and pseudo-code for handler calls to allow some better understanding? Feel free to add pseudo-annotations if that helps your cause 8)

Thank you for bringing this up! This topic has certainly engaged me more than any other on slashdot in a few months 8)

Here's a quick example of a monad. It's something that wraps a value where the value can be freely generic while the rest of the type is not.
So let's use the Option monad in scala. It has two important functions called map and flatMap (map and bind in Haskell). All monads have these properties.
If I have val a0 = Some(25); val a1 = None;
map has a type signature of def map[Q, B](f: A => B): Option[B]
flatMap has a type signature of def flatMap[Q, B](f: A => Option[B]): Option[B]
a0.map((b: Int) => b + 5) would become Some(30)
a0.map((b: Int) => b + 5).map((c: Int) => c - 10) would become Some(20)
a1.map((b: Int) => b + 5) would become None
a1.map((b: Int) => b + 5).map((c: Int) => c - 10) would become None
a0.flatMap((b: Int) => Some(b + 5)) would become Some(25)
a0.flatMap((b: Int) => Some(b + 5)).flatMap((c: Int) => Some(c - 10)) would become Some(20)
a0.flatMap((b: Int) => None) would become None
a0.flatMap((b: Int) => None).flatMap((c: Int) => Some(c - 10)) would become None
a1.flatMap is always None
There's other monads that also wrap a value. The Promise monad wraps the result of an asynchronous computation so that the maps and flatMaps are chained asynchronously. The Error monad is the useful monad. Instead of having a Java function return a value through the return type or an exception through the throws clause, both return and exception values could be returned through the return type. The error monad is most similar to the option monad, which is called the anonymous exception sometimes. But the error monad doesn't have a zero so it's not quite the same as the option monad with zero of None, or the List monad with the zero of empty list.
Every List is a monad as it's a structure that wraps a generic value. The value just happens to be indeterminate.
Monads are just a way to chain events sequentially without having to deal with the background implementations of the structure we're dealing with.

Comment Re:Seguro Popular -- it's not universal (Score 1) 732 732

There's some areas where the government is simply more efficient because the data shows that the government is more efficient. Health care and fire fighting services are two areas where the public sectors is more efficient than the private sector.

1000 pains = 1 Megahertz

Working...