…where you’re doing lazy construction of something that is an immutable singleton. If creating more than one isn’t an issue (and since the object created is fixed it shouldn’t generally be) then the creation /initialization race isn’t relevant.
The garbage collector will clean up any duplicates that get made. The callers will have valid objects until they’re done. Whichever object gets stored last will become the object that is served to all subsequent customers.
This avoids the costs of locking a mutex (or something similar) and should result in simpler code. Once you have established the static reference, all subsequent requests just get that object.
I’m working on a project that uses significant amounts of C# and thus I’m refreshing my knowledge of the language. I’ve just noticed that C# lacks any sort of ‘real’ const as provided by C++.
As I was digging into this, I ran across (didn’t save the URL though) a page that appeared to be from one of the language developers that claimed that broad-based read only-ness couldn’t be implemented because other CLR languages wouldn’t have to respect it. This seems to be the same sort of junk argument that both .NET and Java proponents threw at generics before those languages implemented support. Other languages don’t have to respect protected and private tags either (and in C++ any other language can do terrible things through a const &).
The point is to help developers create safe code and allow mutable things to be tagged as immutable in appropriate contexts.
The work around suggested for C# is to implement a full set of parallel interfaces with ‘ReadOnly’ tagged onto the end of their names and all of their methods adjusted to only perform actions that don’t change the object.
To my eyes, this results in cluttered and error prone design. You now have to have IFoo and IFooReadOnly along IBar and IBarReadOnly. The developer must remember that if there’s an IFooReadOnly and they need IBar capabilites they need to select IBarReadOnly when they cast. C++ works hard to provide the ability to tag methods as ‘const safe’ and allow variables and returned references (and pointers) to acquire immutability with const.
I’m going to miss this capability and it seems as if the C# designers are making excuses at this point. They either missed the time for implementing full function read-only (perhaps CIL is missing features that would support this) or they have some religious dislike for supporting it.
In addition to the items on my plate previously, I’m now covering another role at work. I’m not sure when I’ll be able to play with any of the VR hardware/software at this point.
This will almost certainly keep me away from the blog quite a bit as it is work stuff and I can’t talk in anything but broad generalities here. I may try posting general observations about the tech and such if time permits…so far time isn’t much permitting.
I’ve shipped the flaky Gigabyte motherboard back to Amazon for a refund. I saw enough items in the review threads that suggested people have seen similar problems with this board that I wasn’t inclined to try a replacement. The ASUS board should do as well for my needs and seemed to have good reviews.
I’ll likely try to work in basic system integration tonight around base molding work on the floors. I’d like to see this come up and work reliably as soon as possible even though it will likely be a couple of weeks before I have the free time to do much beyond the basics.
This machine is ultimately going to live in the finished part of the basement where we have a large expanse of free space to work with an the room-scale VR can show its stuff without excess opportunities to trip over furniture.
I still need to get the GFI outlets installed down there to support the TV and computer before things can really be set up properly. I’m hoping to also have a second (probably core-2 level) computer down there to enable head-to-head gaming if the people aspect can be made to work. Network drops are already in place and should be working at this point.
Things are going to be a bit difficult until the office floor is done and the bookcases and furniture is back together. I’m planning on refinishing the top of my old desk before I’m done so this is likely to be further in the future than I’d really prefer.
I’ve just filled out a return form for the Gigabyte motherboard I’ve been trying to use in my VR development system. Half of the DDR4 slots seem to be flaky in the system. Much of the time it boots and recognizes both slots and then within a few hours of run time it hangs unrecoverably. The best runs I’ve had with it appear to happen when it completely ignores the second stick of memory and runs crippled in single channel mode with only 8 GB of memory.
Continue reading Giving up on the Gigabyte branded motherboard… →
Final phone swap…
I’ve successfully ordered a 128 GB Pixel XL to replace my replacement Note 7. I’ll be sticking with the Note 7 until the new phone arrives and just treating it carefully in the interim. Looks like the Pixel will likely meet most of my needs. I’ll miss the stylus and external SD card but I can work with 128 GB of storage.
The new computer I’ve been building to support writing VR code and testing it is not behaving well. I’ve had the machine loaded with software twice now and it is proving flaky. It runs for hours to tens of hours but sporadically hangs, often in nasty seeming ways. I have not changed any of the BIOS settings since I received the hardware and have done no overclocking.
Continue reading VR Computer woes and going Pixel-XL to replace the Note 7 →
I’ve had a Samsung series note phone for a long time. I like the size and I rather like having a high quality stylus for non-text notes.
I’m sad to see that as of this morning, the Note-7 has been discontinued and the replacement phones recalled. Now I’ll be looking for an alternative . I’m guessing that the galaxy S7 edge and the new google pixel XL 128 GB may be reasonable possibilities.
Continue reading Looks like the Note-7 is done for… →
I took a break from laying hardwood flooring upstairs to get the parts for the VR computer bolted together and loaded with an OS. All went pretty smoothly (though this morning I found that one of the cats knocked all of the loose screws onto the floor overnight). Loaded up the NVidia drivers this morning and just Steam needed to get this on its feet.
Continue reading New VR Computer is up… →
Didn’t get much on the software/sandbox side done this last weekend. Got my main computer temporarily moved from the office to the dining room so I have access to it while I’m putting the flooring down. Things are up and running, but most of the effort was on the flooring activities. The VR headset is once again packed up. It probably won’t come out again until the new system (parts on the way, to be placed where there’s more room to move around than my crowded office) is built and operating in the basement as that is a much better spot for room-scale activities in any case.
Got a copy of Introduction to Game Design, Prototyping, and Development: From Concept to Playable Game with Unity and C# as Unity looks like the easiest on-ramp to get playing with VR. I expect that OpenGL/OpenVR will better suit my interests in the long run but I want to get started without burying myself in the low level details.
I really wish that speech recognition was in a better place. Looking at that tech a bit as it seems like something that would be a nice adjunct for VR…you have limited input capability as you’re not likely to be using a keyboard…being able to talk to the system, even if only in simple ways, would be nice. I’ll keep digging deeper. So far I’ve fond a lot of low level descriptions of the tech underneath (interesting but not immediately useful) and there are tools like cortana and such that seem a bit too packaged.
I’m hoping there may be some way to tap into these facilities and get access to a textual version of a voice stream and generate speech as well. Looking around and will update as I find things.