1,356 karma · joined Jun 19, 2017 (9y ago) · 591 submissions
comment 5y ago · link · parent
I've been having a blast these past few days exploring the vast world.
There's nothing that Google can tell me about it. There's still people playing (and building) it, so I can ask for help - my old clan is still going even - but there's no instant fix on everything.
I don't know how long it'll last, and the time it will take is too much to fully immerse, but I've already started making some maps and trying to tackle some quests.
comment 5y ago · link · parent
Morality changes in time and space, and is a product of culture. Consider what other behaviours have been or still are a strong central part of cultures that we would find distasteful or abhorrent - cannibalism, for example, was still practiced by a tribe in PNG as recently as 2012, for cultural reasons.
(Which could expand into a broad discussion on moral relativism, I suppose; suffice to say for now that eating meat is, from my perspective, a matter for each to form their own personal moral position on rather than one in which a collective position should be reached or enforced.)
Chefs make beautiful art, sometimes with meat. Painters make beautiful art, sometimes with lead-based paint. We moved on from lead-based paint, and we still have beautiful art.
comment 5y ago · link · parent
Java, Python, Perl, Ruby, and a host of others say this isn't a dead technique.
Another reason for it back then was to only need to port the interpreter to each different architecture and platform, an important consideration in the 80s with the bloom of CPUs and machines.
comment 5y ago · link · parent
Just in case you get the wrong idea: I'm very grateful that you put CP/Mish out there. My Z80 retroboard project benefited from it (I used the ZCPR1/ZSDOS .rel outputs directly in my board's emulator, plus the project served as a useful reference source) with no contribution back.
I don't think it would have helped anyone if I'd tried to make it support my board in your build process. There's one of my board in the world, with zero users now I'm working with its replacement design. I already had a BIOS written for zasm, and no removable storage (socketed ROM might count as removable I guess) so I wasn't trying to build a bootable disk image.
If, say, I had a vintage Model IV and wanted to make disks for it, it might be a different story, but for a retrobrew z80 machine it's a good reference but IMO not a good basis for the software part of the project.
comment 5y ago · link · parent
It's only a mistake one makes once but having defaults set for 1980s fab capabilities is annoying.
comment 5y ago · link · parent
But A$120 got me two partially assembled boards, in a few weeks, which isn't terrible at all.
(I used EasyEDA for this design, to get better access to JLC's parts catalogue, but it was a worse overall experience than using KiCAD, and I still had to fix up some parts' rotation anyway.)
comment 5y ago · link · parent
Many of the applications have platform specific code and need to be ported as well.
A project like this is a useful reference point, but rarely directly usable.
comment 5y ago · link · parent
(It's only an upper bound because energy isn't perfectly fungible.)
Renewable energy is also better than fossil energy in terms of environmental damage, but it's not free from damage. A dam is a massive localised environmental impact, and a huge amount of concrete. A solar farm requires (holes-in-ground) mining and significant industrial processing to build. The lower bound on environmental harm is the cost of building renewable energy sources that are used for something so unproductive.
comment 5y ago · link · parent
You can't put 10k people behind each IP and not have problems. That's 6.5 ports per person, you need one for each connection. Pretty much any website will have issues with that little connectivity.
comment 5y ago · link · parent
https://meetings.apnic.net/32/pdf/Miyakawa-APNIC-KEYNOTE-IPv...
Slides 12-15 show the degradation of Maps in action. 20 connections per user is a heavily over-committed CGNAT, but that level of port sharing does happen.
comment 5y ago · link · parent
A malicious website could open up 256 websockets and as many HTTP connections as the browser allows, and that might be enough to swamp cheaper NATs.
See https://bugs.chromium.org/p/chromium/issues/detail?id=12066 for some 2009 discussion about people having troubles using the web when background tabs held connections open for polling. That wasn't a NAT issue, but it does highlight that a decade or two ago we all thought we only needed to manage tens of connections for a host to be online but that rapidly spiralled into hundreds.
comment 5y ago · link · parent
UDP is connectionless, but typically a UDP communication is bidirectional. This means a NAT needs to inspect UDP packets and retain a mapping to direct incoming UDP packets to the right place. With no connection information this can only be done as an LRU cache or similar.
TCP is connection oriented, and a NAT might rapidly free up resources when a connection is closed (ie, when the final FIN has been ACKed). But if there's no FIN, the NAT is in the same case as it is with UDP. Making a lot of connections without closing them fills up NAT buffers.
When you have a home NAT and a carrier-grade NAT you may get an impedance mismatch of sorts. The CGNAT might have insufficient ports allocated to your service to keep up with your home NAT, resulting in timeouts or dropped mappings. Your home NAT will have one set of mappings and the CGNAT another, and the two sets probably won't be exactly the same. This means some portion of the mappings held in memory are useless.
As a specific example, many years ago Google Maps would routinely trigger failures. Using Maps would load many tile images, which could overwhelm a NAT or CGNAT. The result was a map with holes in it where some tiles failed to load.
Browsers have long had limits on concurrent connections per domain. Total concurrent connection limits are also old news, but are not quite as old as per-domain limits. You probably can't make a NAT choke with just simple web requests (even AJAX) any more. You might be able to do it using, eg, WebRTC APIs, though I would be surprised if those aren't also subject to limits.
comment 5y ago · link · parent
Nevertheless, there's two answers I can think of here. The first is simple (but IMO probably not right): 3-SAT is (probably) exponential, but the language definition document qualifies the linear claim by saying that macro expansion can also be exponential.
The second is probably more accurate, though. General 3-SAT is (probably) exponential, but we're dealing with 3-SAT for a constant number of variables. You can solve 3-SAT by producing all combinations of values for the variables and testing the expression for each one, but while testing an expression should be linear there's an exponential number of combinations. If your combination count is constant, though, the whole complexity becomes linear ... with a shockingly bad constant factor.
comment 5y ago · link · parent
Recursion in a pushdown automata (the equivalent machine for a CFL) is bounded by the input words being consumed, since each state transition consumes one input token. Since all input words are finite, indefinite recursion is excluded.
comment 5y ago · link · parent
The risk there is you (or someone else less disciplined on your team) doesn't make the medium size change. They instead hack in the smallest possible size change they can get away with to satisfy the current problem.
After a few changes like that, you have a complicated system and all changes are major.
comment 6y ago · link · parent
One of those two is easier to spot, either by the original programmer, or by a code reviewer, or by someone trying to track down a fault.
If all the type system does is make semantic errors easier to spot and fix, it's still offering a lot of value.
comment 6y ago · link · parent
R process<R, E extends Exception>(ThrowingFunction<Long, R, E> processor) throws E { ... }
You could write "process" to the Exception base class, but it still can't handle a "processor" that doesn't throw at all.Checked exceptions a "bolted on" effect that sits outside the usual type system in Java, and their presence on a method signature "colours" it in a way that an effect described inside a type system would not. More of a stain than a tint, if you will.
Java 8 resolved it by quietly pretending checked exceptions never happened, which works fine until (1) you get unhandled unchecked exceptions in all their glory at runtime, and (2) you want to use one of the Java 7 or earlier methods as a "processor" but, oh no, it throws an exception.
(It's a deeper colouring than JavaScript's async/await keyword, which is just syntactic sugar around continuations in callbacks and returning promises - you can pass an async "processor" function to a "process" function that has no idea what it's getting and get back the promise you'd expect from it.)
comment 6y ago · link · parent
The expensive part is labour. If you're willing to risk some time and money on failure you can have a go yourself, there are excellent guides online.
I have an iPad 2 that I bought new long ago and have since given to my young children. Unsurprisingly one of them dropped it and the screen stopped working. I ordered the kit, opened it up, and reseated the LCD. Would have gone flawlessly if I'd been more careful while opening it up, as it stands I now need to replace the digitiser, but it's still much cheaper than a new tablet, especially while my elder daughter is in a phase of thinking she is smarter than us and can ignore warnings like "if you balance that on your knees it will fall off and break."
comment 6y ago · link · parent
https://en.wikibooks.org/wiki/Ada_Programming/Types/range
As you can see from that link, it's bounds checked at runtime. You could have a modulo type that wraps on overflow, which is of course what most numeric types are in most programming languages, including Haskell, but the modulus is fixed at some power of two for obvious reasons.
There's only one thing I truly value out of a good type (or static analysis) system, and that's enabling fearless refactoring. I want the type system to pick up on any downstream consequences of a change I make rather than finding out by phone call at 3am the day after a deploy that some edge case got overlooked.
Dependent types can (in theory) give that over smart constructors. If my parser should leave me with, say, a sorted vector, or an assertion that if one field is some value then some other field is Just something, then I'd like to be able to rely on those facts in downstream code making use of the results of the parser. If it's just a smart constructor as we usually write them a later refactor (sorting on a different key, for example) doesn't change anything that any other bit of code can be verified against.
A dependent type carrying a proof that a vector is sorted based on some criteria and an assertion about the existed of some value can be verified at compile time.
I'm not sure what the status is of dependent types for Haskell. You could do similar propositional assertions now with Ghosts of Departed Proofs, and LiquidHaskell exists for these sorts of assertions, so dependent types aren't the only path to this kind of static safety, either. I won't claim that this is practical - though I would be surprised if it's not practical to do in small doses.
Nevertheless, I would still just be reaching for smart constructors in current day Haskell.
comment 6y ago · link · parent
There are type systems that let you declare a new type to be a sub-range of an existing type, but Haskell's is not one of them.
comment 6y ago · link · parent
It's real-world data, which is rarely 100% clean and correct. If you can only represent clean and correct data, you probably can't handle all the data you'll need to.
For an email, a "newtype Email = Text" is, IMO, correct. You can break it down as far as you need though: "data Email = Email (Maybe Name) LocalPart Domain" eg, with the three sub-types being newtypes of text. If you try to go further you'll run into problems that the best definition of "valid" is "works when used."
The situation for URLs is similar.
ZIP codes is an even trickier one - if you can only represent genuine ZIP codes, what happens if you need to represent an address where someone's accidentally transposed two digits and wound up with an unused ZIP code? If you're not US domestic only, what do you do for the four billion or so humans who don't have a structured address at all?
(There's a reason vCard gave up on forcing structured addresses and added a "just whatever this text chunk here says" alternative).
If you want to represent "validated version" data then IMO it's sufficient to use a "data ValidatedEmail = ValidatedEmail Email" with a non-exported constructor and a "validateEmail :: Email -> Maybe ValidatedEmail" function.
If you're, say, the USPS and really must represent valid ZIP codes and only valid ZIP codes, you'll perhaps wind up in the rabbit hole of defining a hierarchical hot mess of sum types. Or pragmatically accept you will risk invalid ZIP codes to avoid needing to do that.
comment 6y ago · link · parent
Having a Magnitude newtype over Int doesn't change the range of permissible values but does prevent using a Length where a Magnitude was expected, for example.
In all typed languages you'll eventually see a function with multiple arguments of the same type and have to check the documentation (or worse, implementation) to know what each is for. Having a zero cost type alias to make it clear is an improvement and IMO is a form of type safety.
Having a data type that can hold illegal values is a bad idea. Using an Int for Length implies you know what to do with negative lengths, for example. A newtype won't help there.