Which modern language does typing really well? I would love to try a language in which it isn't frustrating to work with types.
I use types at work in Typescript and Swift but honestly I'm not very convinced it's worth the hassle in most projects. I feel that if the build tool already can tell me what type I should be using, why do I need to pedantically add them everywhere?
I don't have a lot of experience with it and you would have to make the jump over to functional programming but I really like how Ocaml does types. It's all completely inferred by the compiler. This means you have to write very explicit code when it comes to casting--you can't even add an integer and a float without casting--but I don't think this is a bad thing. You can also explicitly type things if you want, and in that case it appears on its own line as opposed to mixed in with the function args. I vastly prefer this. I can't remember exactly what it looks like in Ocaml but in Elixir it looks like:
@spec full_name(String.t, String.t) :: String.t
def full_name(first_name, last_name) do
"#{first_name} #{last_name}"
end
As someone who historically hasn't done any typing, I still find this a little noisy, but it lets me read the function as normal and can look at the spec only if there is any confusion.
The same in The Netherlands. However from what I understand in the EU it’s a lot easier. For example between France and The Netherlands the company doesn’t need a full office. You just need to register with the countries tax office and pay taxes.
In a lot of cases the taxes are mostly the same just paid to the employees country instead of the companies one.
It’s mostly knowns in administration what companies seems scared of
You can with at many android phones. The only big brand I know of is Samsung, but I use an iPhone, so I haven't bothered to look into how widely this is among Android devices.
It feels like we’re a long way from that but headed in that direction with everything being on the same architecture now. This was much harder to see with intel in the picture.
Apple is diametrically opposed to cannibalizing their own hardware market. If such a product ever does exist, it will likely exist in the form of an arbitrary $600 accessory.
While calling C a typed language is technically correct, I struggle to think of any typed language that's more weakly-typed than C. Arguably, Python has a stronger type system than C.
The C preprocessor is a siren song, lures people in with the promise of "extra performance/features/structures for zero runtime cost!" but murders any readability or rationality within your codebase.
Cool concept, but once you've dealt with any legacy codebase that has used it extensively, it feels like an anti-pattern/footgun. Ultimately you just want the language to do those things directly and for the compiler to be smart enough to optimize it later.
I do like the preprocessor and my major pet peeve with C is that the preprocessor has been stagnant for ages. Like, why the hell can't i do something like
#define BASE hey
#define HEADERS foo bar baz
#append HEADERS bad bal bah
#push OSSUFFIX
#ifdef WIN32
#define OSSUFFIX win32
#else
#define OSSUFFIX unknown
#endif
#foreach H HEADERS
#eval include "$(BASE)/$(OSSUFFIX)/$(HEADERS)"
#endfor
#pop OSSUFFIX
People go to great lengths making all sorts of weird structures from x-macros, repeated statements, defines that only exist to be used by other defines, etc all to work around existing preprocessor limitations - and many of them would simply become unnecessary if the preprocessor could do things like variable editing, loops and being able to eval its own commands.
Even though some stuff can be done via language features, it is often necessary and more flexible to work with the source code itself.
One alternative is to just write a C code generator, which lets you mix C and some sensible language, eg. python. Then use that to generate the code which is then sent to gcc.
Not really? They're part of compilation and obey all the type rules & syntax of the language. They're not textual replacements that run in a distinctly different phase like macros are.
Its not too clever for its own good,
its programmers that are too clever for C, and desperately need basic features, and its the only way to get them unless you switch language.
Its also surreally poorly designed, encouraging worse habits than C itself. Avoiding definition collisions and lack of namespaces alone make it horrific for any moderate sized project and up. Combine that with the near complete lack of static analysis tools, and its a recipe for disaster.
Yeah, I do agree. Interestingly, you could argue that it's fairly strongly typed; at least according to some definitions (and btw "type-strength" is not a rigidly defined term, so the definition itself is somewhat debatable).
I don't claim to be an expert in knowing what is/isn't in the various standards; I just look at the build errors and static analysis alarms. That said, I think the argument is that in the vast majority of cases it's not actually possible to change the type of a variable; off the top of my head, I can only think of pointer co-erosion. Otherwise, if you define an unsigned int, it stays an unsigned int.
Now strong/weak typing isn't necessarily the same thing as type safety. C has always seemed astonishingly bad on that front. It's like they try to trick novice developers into thinking they have a robust type system sometimes.
If you define functions implicitly they will link to any symbol, EVEN A VARIABLE... this is bananas. I think I sort of understand why compilers work this way, but it really feels like a bug in the language. Under some compilers you might not even get a warning for implicit function, either! TI had a compiler that hid them by default.
Enums are garbage in C. Again, you can misuse them, and may not even get a warning. You can pass an enum for color to a function that takes an enum for kittens and the compiler will be happy as a clam. The way they're often used can cause constant implicit conversions every time there's an assign/compare. May not be a problem for most positive values, but it's annoying if you're trying to develop standard compliant code. MISRA defines an "essential type system" and normal enums usage violates it.
I'm probably forgetting a TON of deficiencies. Please add them or correct me where I'm wrong.
That’s a good question, it’s not fair that you’re being downvoted.
It’s the C preprocessor that causes a mess. Tooling for C and C++, like automatic refactoring, lags behind tooling for languages like Java, C#, and Go. Refactoring tools have to deal with macros, conditionals inside #if/#else blocks, and header search paths.
In this case, the refactoring involves removing a variable from the enclosing scope of a macro invocation. The most likely way to automatically refactor it would be to write a custom check in clang-tidy.
Whether something is (statically) typed or not is more of a continuum than a binary.
Eg C tracks whether a variable is an int or a char. Haskell also tracks whether a function causes side effects or not. More sophisticated systems also track whether a function has to return eventually or could run forever.
Atomically flipping a version is still difficult, as anything that needs to rely on the other version has to be fixed forward. If you instead make 5000 (or 500) small changes that affect 10-15 uses, you can solve the unique cases or roll-back and forward.
On a side note I always find it interesting to see the static type and algorithm fans taut how correct code is. Great we now got typescript everywhere… it’s still amazingly difficult to test and validate user interfaces, styles and layouts.
Here's a convenient map for just the US's involvement in Latin America[1]. African countries are harder to quantify due to the number of European powers involved, but I think it's safe to say that the majority of African countries experienced significant instability during the post-colonial period.
I wonder if the drug cartels destabilize the region more than United States interference or if the U.S. is more destabilizing?
For example if you did a survey of the people of some of these countries that were destabilized if they think the United States or the drug cartels cause more problems for them.
I wonder what they would say. My suspicions lean towards the drug cartels just reading about how they treat reporters and students and police.
The US, famously, funded many of the early drug cartels and trafficking networks in Latin America as part of its goal of destabilizing Latin American governments[1].
The even more extreme (and somewhat, but not completely, publicly substantiated) claim is that the USG used those illicit funding networks to additionally destabilize minority communities in the US by introducing heroin and "crack" cocaine.
There is no "either/or" with US foreign meddling and drug cartels. They're two sides of the same foreign policy.
Edit: The above focuses on Iran-Contra. Here's a link to broader allegations of drug trafficking/support for cartels in LatAm[2].
You're using isolated incidents from the 60 and 80's to claim the U.S. is responsible for the entire modern multi billion dollar international drug trade?
So to be clear.
The blame is on the U.S. for the entire drug trade.
The blame is on the west for colonialism causing African countries problems in modern times.
The blame is on racial repression for minority groups problems in the U.S.
The trend seems to be that minority groups are at complete mercy of western repression.
So if both african countries and one of the large most power country actively destabilize a nation. Why would smaller and less powerful nations be the primary cause instead of the big one? but yeah, the one does not rule out the other
Well I just mean that if you look at a country like Poland which has been invaded literally dozens of times, either being severely destabilized or completely conquered in the process but yet is still doing quite well for itself, I don't see how you can solely blame foreign interference for a country's current state.
I mean, look at Ethiopia. Forget Western powers, Ethiopia has never been successfully invaded by any foreign power. Despite this, it is one of the poorest countries on the planet today.
why does the west feel its their job alone to write the history of African countries instead of letting them research and write their own history instead?