8,088 reputation
865127
bio website br.linkedin.com/in/maniero
location Brazil
age 44
visits member for 4 years, 2 months
seen 2 days ago

Conecte me no Linkedin.

former Moderator on Programmers.SE

  • Fala Português? Do you want learn portuguese? Siga a proposta/Follow the proposal Portuguese Language.

Oct
30
comment Why can't Java/C# implement RAII?
I totally understand now.
Oct
30
comment Why can't Java/C# implement RAII?
Yes, exactly what I said. I understand you now. There are problems for other situations, sure. Probably the compiler would need to forbid some constructs. Compilers do this every time. If this is good or bad is matter of discussion which doesn't fit here. I'm not sure if this new example is unsolvable (I have no enough information to discuss this). So you could say write using is easier and I can agree, but the point of this question it is if is is feasible. If you ask me if I want get rid of using on C#, I say a big NO. I'm talking by language design pov.
Oct
30
comment Why can't Java/C# implement RAII?
@RobertHarvey IMHO your answer is not wrong either, just it was not fit in this question. For me it's about language design. I agree with you that C# or even Java team shouldn't waste resources in that feature. I see the usefulness of this feature and I see the cost for the language and for the implementation.
Oct
30
comment Why can't Java/C# implement RAII?
My understanding, changing you example to just a return, is that the compiler would insert a try just before the resource acquisition (line 3 at your example) and the finally-dispose block just before the end of scope (line 6). No problem here, agree? Back to your example. The compiler see a transfer, it couldn't insert try-finally here but the caller will receive a (pointer to) File object and assuming the caller is not transferring this object again, compiler will insert try-finally pattern there. In other words every IDisposable object not transferred need to apply try-finally pattern.
Oct
30
comment Why can't Java/C# implement RAII?
I fail to see what you said now (i'm not saying you are wrong). The object has a resource, not the reference.
Oct
30
comment Why can't Java/C# implement RAII?
@mike20 but if you need to be aware that a type is a resource and you are forced to write something to tell to compiler to do a proper work you're explicit. I disagree with Robert in almost everything he says in this question but he is right saying this answer just get rid of braces and a nested scope and when he's saying the using is not a sugar.
Oct
30
comment Why can't Java/C# implement RAII?
blogs.msdn.com/b/oldnewthing/archive/2010/08/10/10048150.aspx is a relevant page to this question.
Oct
30
comment Why can't Java/C# implement RAII?
I fail to see implicitness which is the original requirement from OP. "more implicit than" is strange to me, or it is implicit or it is explicit. Disclaimer: I am just interested in language design here, I'm not saying that C# or Java should implement this.
Oct
30
comment Why can't Java/C# implement RAII?
It's similar, not exact duplicate.
Oct
30
comment Why can't Java/C# implement RAII?
Why you need copy/move constructor? File stills a reference type. In that situation f which is a pointer is copied to the caller and it is responsible to dispose the resource (the compiler implicitly would put a try-finally-dispose pattern in the caller instead)
Jan
24
comment Does OOP fulfill the promise of code reuse? What alternatives are there to achieve code reuse?
@j_random_hacker: read the comments.
Jan
23
comment
Aaronaught would be a good candidate here :) @Jon: Peter likes the mess on PSE, he probably likes the mess on his topic :)
Jan
23
comment
@Orbling: Democracy is not anarchy or dictatorship. I understand wrong or you defending that is good to vote spontaneously on candidates that will ignore rules like Kim Jong-il, Saddam Hussein, Hugo Chaves and others dictators?
Jan
22
comment
I could just up-vote Pierre's comment but I need to express my joy to see some users like Josh running here.
Jan
22
comment
One of the greatest names so far.
Jan
22
comment
Since I have no spare time this year, Mark was my recommendation to integrate the pro tem moderator team and obviously he has my support and vote not just because his job on moderation but his dedication and understanding about PSE since day one. Anyone that believes on an organized community should reserve one vote for Mark even if you disagree with him as Mr. CRT did say it.
Jan
22
comment
I needn't to say that ChrisF has my support and one of my three votes. Great job so far.
Jan
20
comment What's your favourite quote about programming?
All these comments fails to reach the goal of the Quote. They're right but do it and your budget will go crazy because you expected just 1 baby.
Jan
8
comment Monitor aspect ratio; Does the difference matter?
It's common to see 5:4 (1280x1024).
Jan
7
comment How to explain OOP concepts to a non technical person?
Related or duplicated: programmers.stackexchange.com/questions/4123/…