Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Perl 11. Parent comment
Class theStringClass = String.class;
Class[] myArrayOfClasses = new Class[1];
myArrayOfClasses[0] = theStringClass;
callSomeOtherMethod(theStringClass);
> You can't call `String.toString()`
String.class.toString() => "class java.lang.String"
theStringClass.toString() => "class java.lang.String"
myArrayOfClasses[0].toString() => "class java.lang.String"
somethingThatReturnsAClass().toString() => "class java.lang.String"
> `String` isn't an instance of something that inherits from `Object`
Class theObjectClass = Object.class;
theObjectClass.isAssignableFrom(theStringClass) => true
> I'd say Java classes are almost purely lexical constructs
They aren't - here's the source code for the Class class.
https://github.com/Project-Skara/jdk/blob/c2105ced865fba11fb...
Here's the source code for the toString method we were calling
There are no comments on this comment yet.
Class theStringClass = String.class;
Class[] myArrayOfClasses = new Class[1];
myArrayOfClasses[0] = theStringClass;
callSomeOtherMethod(theStringClass);
> You can't call `String.toString()`
String.class.toString() => "class java.lang.String"
theStringClass.toString() => "class java.lang.String"
myArrayOfClasses[0].toString() => "class java.lang.String"
somethingThatReturnsAClass().toString() => "class java.lang.String"
> `String` isn't an instance of something that inherits from `Object`
Class theObjectClass = Object.class;
theObjectClass.isAssignableFrom(theStringClass) => true
> I'd say Java classes are almost purely lexical constructs
They aren't - here's the source code for the Class class.
https://github.com/Project-Skara/jdk/blob/c2105ced865fba11fb...
Here's the source code for the toString method we were calling
https://github.com/Project-Skara/jdk/blob/c2105ced865fba11fb...