Mike Simmons

Master Rancher
+ Follow
since Mar 05, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Simmons

Thanks for the correction, Rob.  I knew there was a 3 in there somewhere.
1 hour ago

Tim Holloway wrote:Forward deprecation. What a concept.

Maybe they need an @Experimental or @Unstable annotation.

Agreed, that would be much clearer.  Guava's @Beta annotation works well...
2 hours ago
Yeah, nowadays every 3rd release is supposed to be a long-term support release, starting with Java 8, then Java 11, and presumably Java 14 when it comes out.  Java 10 is out of its official support period, which would concern me if any critical vulnerability is exposed, for example.  For any paid work I'd at least get to Java 11 (or even back to 8).  After that, I wouldn't worry too much until 14 comes out.  But, it's fun to see what's coming, checking out the other releases.
2 hours ago
This is making less sense to me as we go.  "Code blocks" are something else, which has been in the language since the beginning.  I assume you meant text blacks, as your link indicates.  And the fact remains that, as far as I know, text blocks were never part of Java 12, which is no longer planned but out; it's old news.  Perhaps text blocks were once planned for 12 but pushed to 13?  I'm not sure what you're saying here.
3 hours ago

Campbell Ritchie wrote:I couldn't get it to work in Java12, not even with the --enable flag. I did get the new form of switch to work in Java12 with --enable however.

By "it", do you mean the new text blocks?  That was never a Java 12 feature; it's only a preview feature in Java 13.  Whereas the new switch was a preview feature in Java 12 and (in altered form) in Java 13.

Java 12 features
Java 13 features
22 hours ago
They haven't finalized the feature in general - whether it's the format, or the implementation, or the documentation, or something else.  It's a preview feature that must be enabled with the --enable-preview flag.  This is their way of including not-yet-fully-final-and-official code in a release, so people can have access to it, but with the caveat that some details may change.
1 day ago
I expect they will leave it in - they're just warning us that things might change.  The most likely scenario is that in Java 14 they will simply remove the @Deprecated tags, possibly also with minor API revision.
1 day ago

salvin francis wrote:Those new String deprecated methods seem to be directed towards programmers. But I wonder why would they add new deprecated methods in a new release. Perhaps these methods are used in the java source somewhere.

I see three new String methods which are also deprecated: formatted(), stripIndent(), and translateEscapes().  All three have the following comment in javadoc:

Deprecated, for removal: This API element is subject to removal in a future version.
This method is associated with text blocks, a preview language feature. Text blocks and/or this method may be changed or removed in a future release.

1 day ago
Liutaras is pointing in the right direction.  I would be inclined to use a when statement (Kotlin's version of switch):

or a Map:
2 weeks ago

Campbell Ritchie wrote:

Mike Simmons wrote:. . . more common to see formulas using (sin (θ))^2 . . .

I was taught that as sin²θ.

Me too - but for purposes here I wanted to show explicit parentheses to avoid any misunderstanding. Also I was too lazy to look up more specialized character codes.
2 weeks ago
Good point about steradians - there are real applications for θ².  Taylor series of trig functions would be another, e.g. cos(θ) = 1 - θ^2 / 2 + θ^4 / 24  - θ^6 / 720 ...  (using radians of course).

But, I can't think of any real-world reason to ever calculate the sine of θ².

It seems like the point of the exercise was to give various examples of functions composed of two or more functions, f(g(x)), which is useful to know about, even if the specific example used doesn't make a lot of sense.
2 weeks ago

frosenberger wrote: We were asked to compute sin (θ^2).

This seems unambiguous as far as precedence.  However, it's also worth noting that I don't think I've ever seen such a formula actually used for anything, e.g. for physics.  It's far, far more common to see formulas using (sin (θ))^2 - that comes up all over the place.  But sin (θ^2) - not really.  If it's just a made-up example the instructor was using, fine... but it may reflect a mis-transcription of the actual problem.
2 weeks ago
The error is using degrees. . Do it all in radians and you're good, as you've seen.

The problem when you do it in degrees is that while you may understand the units of θ as degrees, what is θ^2?  It's degrees squared.  What's that?  Well, to make sense of it you need to convert it back to degrees, or to radians.

You may wonder, why didn't we have this problem with radians squared?  Well, radians are really dimensionless - it's an arc length divided by a radius.  Units cancel out.  
3 weeks ago

Junilu Lacar wrote:I prefer the general approach used by Spring to handle checked vs unchecked: wrap low-level checked exceptions with unchecked exceptions and let the developers decide where they want to handle it. If nobody handles it, the exception just keeps getting propagated back up the application stack where it either stops the application or gets handled by a generic catch-all exception handler.

Which, in my opinion, is basically our way of working around the inconvenience of checked exceptions.  Previously I listed languages that don't use Java, but there are also frameworks and libraries in Java that convert checked to unchecked exceptions as much as possible - Spring and Hibernate are the biggest examples I know of.
3 weeks ago