Reputation
4,543
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
10 19
Newest
 Nice Answer
Impact
~397k people reached

  • 0 posts edited
  • 0 helpful flags
  • 195 votes cast
Feb
13
comment For web apps (vs web pages) why not put scripts and css inline?
If everything can fit in one file which is completely static I would think there are some advantages to having a single "does everything" file that can be used directly, as opposed to requiring that a bunch of files be bundled together, delivered, and suitably unpacked before use.
Feb
13
comment Why no client-side HTML include tag?
@bobince: As I would want it implemented, an attempt to include any resource from a server which didn't respond to a request "Page XX wants to include resource YY" with "Here's resource YY, which I want to make availabe to page XX" would be blocked by the browser. If the server explicitly wants to make something available for client-side includes, I don't see how that should cause problems with client-side request forging if servers don't accept include requests for content which shouldn't be freely available.
Feb
13
comment Why is Math.Sqrt() a static function?
@MichaelT: What should be the effect of int foo = Math.round(123456789);? How about long foo=Math.round(12345678901234L);?
Feb
13
comment Why is Math.Sqrt() a static function?
I find #4 unconvincing. Math.sqrt() was created at the same time as the rest of Java, so when the decision was made to put sqrt() in Math there was no historical inertia of Java users who "like it that way". While there isn't much of a problem with sqrt(), the overloading behavior of Math.round() is atrocious. Being able to use member syntax with values of type float and double would have avoided that problem.
Feb
13
comment Why is Math.Sqrt() a static function?
Nothing would prevent a language from allowing a static method to be called either using member syntax (as with C# or vb.net extension methods) or with a variation of member sequence (I would have liked to have seen a double-dot syntax, so as to allow the Intellisense advantages of being able to list only functions that were suitable for the primary argument, but avoid ambiguity with real member operators).
Feb
13
comment Why did BASIC use line numbers?
Long before the Apple ][ etc. came on the scene, the HP-2000 had time-sharing BASIC as its sole operating system.
Feb
13
comment Why did BASIC use line numbers?
Actually, card readers (accompanied by keypunches) and line printer were better I/O devices than a teleprinter, but teleprinters were a lot cheaper.
Feb
10
comment Is it bad practice to use an interface for categorization only?
...IList<T> is List<T> than to guess that a good implementation of List<T> is ArrayList<T>.
Feb
10
comment Is it bad practice to use an interface for categorization only?
@JarrodRoberson: If it were possible to say List foo = new List(); and have foo receive an instance of a class specified by a List interface as the "default" implementation, that would IMHO be the cleanest pattern, but both Java and .NET would require such a statement to use two different type names. C# decorates the interface name; Java adds unnecessary specificity to the type name [code should really only have to specify ArrayList in cases where no other implementation of List would suffice]. I prefer the .NET approach, since it's easier to guess that a good implementation of...
Feb
10
comment Is it bad practice to use an interface for categorization only?
Downvoter: Care to comment? There are times inheriting an interface without adding anything new is silly, but that doesn't mean there aren't times when it's a good (and IMHO underused) technique.
Feb
3
comment Why encapsulate container variables?
It's too bad this question was closed as a duplicate, since objects which encapsulate containers are often a special case. If an object is specified to do everything a bunch of fields could do (including assigning arbitrary values to fields in arbitrary order, without side-effects, and having every read request yield the last value written), I would say regard the exposure of public fields as a good way to make that expectation clear.
Feb
3
comment Why is chaining setters unconventional?
VB.NET also has a usable "With" keyword which creates a compiler-temporary reference so that e.g. [using / to represents line break] With Foo(1234) / .x = 23 / .y = 47 would be equivalent to Dim temp=Foo(1234) / temp.x = 23 / temp.y = 47. Such syntax does not creating ambiguity since .x by itself can have no meaning other than to bind to the immediately surrounding "With" statement [if there is none, or the object there has no member x, then .x is meaningless]. Oracle hasn't included anything like that in Java, but such a construct would fit smoothly in the language.
Feb
1
comment What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?
@JanHudec: Fair point that unless the last reference is getting overwritten there's no need to go into the tree. The point I'd meant to make was that code which overwrites a reference in Java or .NET doesn't need to worry about the internals of the target of that reference but C++ code does; I neglected to consider that since it the scan only happens once per object lifetime, it's not a performance drain on ref-copies that don't end an object's lifetime, but it can still add complexity.
Feb
1
comment What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?
@JanHudec: How efficiently do C++ and Rust handle immutable trees or other such structures? In a scanning GC framework, the time to copy a reference to an immutable tree with N nodes can be O(1). Is that true with any smart-pointer types in C++ or Rust?
Feb
1
comment What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?
...that nothing trashes it before foo's last attempt to access it using the passed reference. Omitting the reference-count updates would usually be safe, but I don't know how often it can be statically verified as being safe.
Feb
1
comment What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?
@JanHudec: In Java or .net, given foo(someObject.someField), a compiler can simply read the field and pass it with no other overhead; even if that field held the last reference to an object and gets overwritten by foo (using a reference to someObject stored elsewhere), metadata will allow the GC to know about the copy of reference that was created by the function call. By my understanding, C++ would have to either atomically update the reference count before and after the call, or else hope that if someObject.somefield held the last surviving pointer to an object...
Feb
1
comment What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?
@JanHudec: In a GC framework, references to shared immutable objects may be manipulated without any locking or extra overhead provided that the GC can freeze everything long enough to determine what references exist. The amortized overhead of stopping everything for the GC will in many cases be less than the overhead required to acquire locks every time a reference is copied or overwritten.
Jan
31
comment What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?
@JanHudec: It seems a shame that no language seems to include clear concepts of both "owned" and "unowned" objects. C++ does a good job of handling objects with clear owners, but has some difficulty efficiently handling owner-less objects in multi-threaded code (since even things like pointer assignments require thread synchronization) but GC languages fail to provide concepts of object ownership.
Jan
30
comment What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?
@JanHudec: I've not used Python much; you're saying it can support C++-style RAII? That would be cool. Too bad there's no way (so far as I know) to distinguish between "I want to update a property I expect something to have" versus "I want to create a new property"; it my limited experience, as with JavaScript, typos are prone to yielding programs that are valid but wrong, rather than compilation errors.
Jan
30
comment Benefit of non-volatile access to volatile objects being undefined?
The problem isn't with the language that people actually use--it's with the failure of the standard to acknowledge reality. If some particular platform has a weird hardware reason why a non-qualified access to a volatile variable should have some consequence beyond being unsequenced relative to other volatile accesses, I see no reason such a platform shouldn't be allowed to have a conforming C compiler if that quirk is documented, but there's a huge gap between that and saying that compilers can do whatever they want without having to document anything.