|
Read a book?
I am reading "Enter the Dawniverse"!
This inspired by true events. It's an account of survival and daring do, that follows a bronze age tribe, as it takes on a galactic apex predator!
Both moving and informative!
modified 4-May-21 20:45pm.
|
|
|
|
|
"Proper" is in the eye of the beholder, I think. I don't know why anyone has never made a movie of any of the Isaac Asimov books. "I Robot" was an abomination. The only thing it had in common with the book was the title.
I like some humor in my SF movies too. "Repo Man", "Buckaroo Banzai Across the Eighth Dimension", "Earth Girls Are Easy", the whole "Men in Black" series, just to name a few.
I too, think that "Blade Runner", and "RoboCop" were terrific. "Jurassic Park" was worth seeing just for the visual effects.
I believe the problem with movies made from SF books is twofold.
First, it is extremely difficult to condense a book, any book, down to Movie length. Truly exceptional screen writers are necessary, and there are not many of them out there.
Second the unexceptional screen writers think they can write better than the author of the book. "I Robot" is a perfect example.
For that reason, movies made from original scripts are far superior to adaptations of books.
Isaac Asimov's Foundation series would make a great TV series. Almost any of William Gibson's books, particularly "Agency" and or "The Peripheral" would too. Any of Robert Heinlein's books "Stranger in a Strange Land" or "Friday" too. Terry Pratchett and his co-author's "Long Earth" series of books, likewise.
Finally, a 50's movie not mentioned, is "Creature from the Black Lagoon" which I saw when I was 8 years old and gave me nightmares for months after.
BTW: I really hated the movie "I Robot".
Science Fiction Rules!
|
|
|
|
|
I found one aspect of the film "I Robot" rather interesting and enjoyable. Namely the logical reason the robots attempted to overcome humanity.
|
|
|
|
|
Quote: Isaac Asimov's Foundation series would make a great TV series.
It will be available soon on Apple TV+
|
|
|
|
|
that's enough to make me get Apple TV!
|
|
|
|
|
The difference may be slight but one of the conundrums I find myself in is using a ternary operator to handle a default vs non-default assignment.
Simplified:
function whatEver(inVal=NULL) {
if(inVal==NULL)
inVal = internalDefault;
inVal = (inVal==NULL)?internalDefault:inVal;
}
The first should be a touch more efficient as it only does an assignment when necessary, but generally an insignificant difference.
So - what would you do, and, do you ever pause and consider it before choosing?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Make it sexy.
Keep code as clean and readable as possible.
In the grand scheme of things, the compiler will make it efficient whatever the way you write it.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Seen to many times where efficiency is the winning choice for code that is only hit a few times. Efficiency usually only matters on code that is hit 100s of thousands of times or more.
Clean Code Rules!!!!!
|
|
|
|
|
if(inVal==NULL)
{
inVal = internalDefault;
}
|
|
|
|
|
I love the matching braces! When did they invent that???
|
|
|
|
|
Rusty Bullet wrote: I love the matching braces! When did they invent that??? Probably 'they' invented it c1970 but I suspect it had been used earlier. See Indentation style - Wikipedia[^] for Allman braces and match the date with BSD Berkeley Software Distribution - Wikipedia[^]
It is definitely the way I was shown for Algol 60 (although the braces were then tokens called begin and end) and the one that I have used ever since. Many other folks have independently 'invented' it. If K&R's bracing is TOOTBS (The One and Only True Brace Style, Allman's bracing is TOOLBS (The One and Only Logical Brace Style) or TOOSBS (The One and Only Sensible Brace Style). Much, much, much easier for matching starts and ends of blocks; much, much, much easier for finding mismatched braces.
|
|
|
|
|
TOOTBS is for me. Staggered braces were invented by publishers trying to squeeze more code on a page to save paper. It was anti-readable. The problem with squeezing the code for publishing was that people learned from books, and learned the wrong style. Publishing should remain as publishing and readable code should be the norm for actual coding, but then I am opinionated toward readability and maintainability.
|
|
|
|
|
C# has the null coalescing operator
inVal = inVal ?? internalDefault;
Or with C# 8+
inVal ??= internalDefault;
It doesn’t get much cleaner and clearer that that.
|
|
|
|
|
I like the question colon, you can use it inline like
printf("You have " + count + " new email" + (count <> 1 ? "s" : "" ));
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
This is a problem for internationalisation (== i18n). Not all languages behave like English re plurals.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Twas just the easiest example I could think of.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
I usually write:
void whatEver (int inval = internalDefault) I want to let users see what the function does in case of a NULL value. Otherwise I would have to document what happens when parameter is NULL.
function whatever(inval=NULL) is simply not C/C++.
Quote: do you ever pause and consider it before choosing
I consider every line in my programs. This would be no exception.
EDIT: Note that in C++ default value is written in the header file or wherever the function is declared not in the implementation as your code seems to suggest.
Mircea
|
|
|
|
|
This was not intended to be a C++ only question. The C++ on the top of the block is incidental to my picking a code block (should have used plain code).
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Besides my uncalled for nitpicking on syntax, the more important point of my answer was the idea of avoiding arbitrary "flag" values in parameters.
This goes along the lines of "Principle of least astonishment"[^] or "minimum surprise principle" as I prefer to call it, of not forcing the user of your code to remember artificial conventions. For instance, if you have in your .h file a function:
string find_question (int answer=-1);
You have to go to the source file (or the docs) to find behind it some code like:
string find_question (int answer)
{
if (answer == -1)
answer = 42;
...
} Sometimes use of such "flag" values is hard to avoid but in many cases, specially with templetized languages, it is just laziness. One good example of such lazy design is the basic_string class in C++. IMO there is no excuse for using -1 (fancifully disguised as string::npos ) as a flag for last position in string.
Mircea
|
|
|
|
|
I addressed this somewhere else but, as an example, a variable arg list is possible (and often very desirable) in, for example, php (very much C-like except for no strong typing).
It allows one to create a function with a default value and still not be stuck with just that value. An ease of use thing. The example I gave in what is really a style-preference question, can be called either as whatEver(inVal) or whatEver() with the latter not giving a 'missing argument' error but rather defaulting to what was in the declaration.
An example of use: initializing a random function: with a value it uses that; without a value it can internally pick the current time of day. It's related somewhat to C++ overloading functions.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
TBH, if it is something we have to do a lot of, I prefer wrapping it with a #defined function...
void fx(int intVal)
{
intVal = COALESCE( intVal, intValDefault );
intVal = COALESCE( intVal, intValDefault );
intVal = COALESCE( intVal, intValDefault );
intVal = COALESCE( intVal, intValDefault );
intVal = COALESCE( intVal, intValDefault );
}
Stealing the syntax from SQL gets the point across.
Sometimes, doing something 5 times in a row, changes your interpretation of the value of the choice.
|
|
|
|
|
I agree with this. If your default parameter is only going to be replaced anyway, just go straight to the replacement.
Of course, you still need to allow for null actually being passed (assuming the parameter is of a nullable type), so you'll need the check internally.
I'm ambivalent on the question of ternary vs 'standard' here. The ternary is small and uncomplicated enough to be readable. Personal/team preference there.
|
|
|
|
|
May I inquire why you would not write "whatEver(inVal=internalDefault)" - Cheerio
|
|
|
|
|
Because of this:
whatEver(NULL);
|
|
|
|
|
I meant to agree w/ Monsieur Mircea Neacsu - Professional Profile[^] in his post The Lounge[^] I simply do not understand the purpose of passing in a value only to discard and replace it. In hopes of becoming a better programmer or is it "coder" or is it "app author" I now know it is not "progamer" a full and lengthy explanation would be most appreciated. I am afraid I am too dim witted to understand how your brief quote "whatEver(NULL)" is an explanation as to why one would not declare it as Monsier Mircea Neacsu suggested. I await your kind reply. - Cheerio
|
|
|
|