|
Be afraid. Be very afraid.
cheers
Chris Maunder
|
|
|
|
|
Ah what a shame, probably wont me the 10 year expertise requirement
|
|
|
|
|
Usually, I'm a big fan of C#. Today it's irritating me a little bit
I have a case where I would like to perform an implicit conversion for my class when a double is assigned to it, but not do one for an int .
Yeah, I know, its an odd requirement! Suffice to say, it would make my life a little simpler, if I could get away with it. Initially, it seems like C# should allow me to do it.
If I mark the operator for int as explicit , I get the error I want. Regrettably, when I then add the operator for double , which is implicit , the error goes away.
I do understand why, and understand that C# "is-what-it-is", which is usually a good thing. However, today, I truly wish the explicit operator took precedence over the implicit operator!
Oh well, there are plenty of work-arounds, but they end up being far less elegant in this particular code base.
For your consideration, here's a code snippet that demonstrates the behavior. Comment out the line with the implicit operator and you get the error I want. Without it, the integer gets implicitly converted to a double and uses that operator, so no error.
namespace ExplicitOperator
{
public class Program
{
public static void Main(string[] args)
{
int value = 5;
Test test = value;
}
public class Test
{
public Test(double value) => Value = value;
public Test(int value) => Value = value;
public double Value { get; }
public static explicit operator Test(int value) => new Test(value);
public static implicit operator Test(double value) => new Test(value);
}
}
}
|
|
|
|
|
I think this would be an excellent post for the C# language forum !
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
How much grief does it cause if you make the double conversion explicit too? Just a random thought.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Unfortunately, it causes quite a bit of grief. The example I provided was the shortest code I could write to share my pain. Thank you for your thought, but not hoping for an actual solution here...simply ranting
Regrettably, the actual problem is a lot more complex. It also involves collection initializers, method signature ambiguity, and the entire zoo of built-in numeric data types. I'm helping consumers of a framework avoid the detritus added by explicit casts / constructor invocations.
I already have a solution...a separate method signature for each data type (in my code). Its not a huge deal, simply repellant to look at. It also snowballs a bit, to a few places, and forces me to carry test cases for each one.
If C# had a different precedence for implicit/explicit, a far more elegant solution would be possible. That, and honestly, it annoys me that it favors an implicit convenience over something I've told it explicitly NOT to do.
|
|
|
|
|
Just got a message from Adobe Acrobat that it needs to restart my computer to apply an update. Holy F***, I thought those days were long past!
Adobe hiring manager: We are creating a piece of software to open a file and display its contents on the screen. How would you do it?
Clueless wonder: Well, how about we create a kernel process, with interlocks and timers and stuff. No, we might need two kernel processes. Or maybe more, now that I'm thinking about it. If we need more, we can just implement them as we need them.
HR: Ooh! Kernel processes! That sounds good!
Its amazing they even got their code to work, given their lack of engineering ability.
|
|
|
|
|
Adobe Acrobat still exists?? Last time I used it it was so slow I tossed it to the curb...that was...let me see 1959?
Got my site back up after my time in the woods!
JaxCoder.com
|
|
|
|
|
I used Foxit for a while, but tried Acrobat again for kicks, and it has been fast. Came across some limitation in Foxit (not that I'm knocking it - it was a GREAT program), and have been using Acrobat ever since. Ten years now? Don't remember.
|
|
|
|
|
When foxit was still young, the drawing of the characters were so bad, straining my eyes, that it caused me a bad headache. I had to go back to Adobe Reader to preserve my health.
Six or seven years later, I picked up foxit again - somebody claimed that it had improved tremendously. That was a lie; it was just as bad as before, but the guy making the claim didn't care about the poor ergonomic quality.
That was a few years ago. Maybe foxit and Adobe Reader today have similar visual qualities, but I don't care any more. The foxit developers for many years proved that they didn't care for visual quality. I got the message. Even if someone has "forced" them to make better display, I assume that it is agains their nature. Next time something similar comes up (say, use of colors or whatever), I expect them not to really care but change it (only) if they are forced to.
|
|
|
|
|
:laughs:
A number of years back, we had some docs that came from ISO. Naturally, they were expensive and appallingly, were time-restricted. But here's where it gets funny - the mechanism used to restrict them was use of javascript to check the date and once past a certain point in time, js was used to draw a dirty big rectangle over the pages, obscuring their content.
The fix?
Use Foxit, since it didn't support JS and thus couldn't hide the content...
Idjits.
|
|
|
|
|
Mike Hankey wrote: Adobe Acrobat still exists?? I had to use the Adobe version of reader to fill out my GA tax return. I tried a few other pdf readers first and none of them worked.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
ZurdoDev wrote: GA tax return
Was it writen on a stone tablet?
Got my site back up after my time in the woods!
JaxCoder.com
|
|
|
|
|
David O'Neil wrote: Adobe Acrobat
You mean that piece of Sssoftware that needs 150Gb of disk space and 3Gb of RAM to open a one-page pdf ?
|
|
|
|
|
It's not quite so bad anymore. Currently have 7 tabs open with only 35 MB being shown used in task manager.
|
|
|
|
|
David O'Neil wrote: Its amazing they even got their code to work, given their lack of engineering ability.
Remember that there's a direct correlation between that statement and the number of updates they're pushing out. You can draw your own conclusions from that.
|
|
|
|
|
It is even funnier/stupider: after it said I needed to reboot (giving the option of 'now' and 'later'), I didn't. Tried to open the file again, and old version opened it! They could have indicated that in the dialog box, or just opened the file after choosing 'later,' but no.... I suppose I should move on from such idiocy. As you said, conclusions.
|
|
|
|
|
On the product page there is the price, the shipping fee to Israel and the estimated arriving date...
So I added to my shopping list to save for later (gathering items slowly for one shipment), but there I see this:
Quote: No sellers are currently shipping this item to your location Come on!!!
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018
|
|
|
|
|
At least you saw it!
|
|
|
|
|
Amazon is evil. If you all don't see it now you will soon enough.
You may say, it's just a shopping site. Oh no, not entirely.
I would hand deliver to Israel if it were possible for me to do so.
God bless Israel.
|
|
|
|
|
Yup, I've seen that too.
It seem that on the product page there's a generic price and arrival date calculated, but it isn't actually checked if they deliver until you add it to your shopping basket. (Except sometimes it is)
Sometimes I wonder how Amazon could become so big.
|
|
|
|
|
I got an email from Amazon recently telling me a new book by one of my favourite authors would be released on 26th November 2019.
When I pre-ordered it, the page said it would be released on 24th March 2020.
The confirmation email said "We'll notify you via e-mail when we have an estimated delivery date for this item".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The author is definitely scared by your desire to buy.
|
|
|
|
|
Amazon keeps emailing me about items that--if I follow their own link and add them to my cart--won't ship to my address with no reason given. Even items that are now in my purchase history (items that I've received from them before).
I don't mind the spam so much (some items are relevant to me); it's the pointless teasing I don't appreciate..."here it is...you just can't have it".
|
|
|
|
|
dandy72 wrote: I don't appreciate..."here it is...you just can't have it". That remember me something with women... but I don't want to brake the KSS Rule
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|