Hacker Newsnew | past | comments | ask | show | jobs | submit | more interactivecode's commentslogin

Can I just say this is such a lovely site design. fast, clean and very readable. Bravo!


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.


So perhaps you should use your power supply instead of the monitor power because it's clearly not getting enough power at peak?


Yep, that's one solution. Another is using X :)


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


I'm waiting for the day where I can plug my iphone into my screen and have a full os show up. Apple seems like the perfect company to build that.


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.


Samsung have Dex which is basically this but for android devices obviously. It's "ok" but its still android underneath.



No, that is not at all what your link says. The article is talking about a specific software named "DeX for PC, Mac", DeX itself is not discontinued.


Whoops! I appreciate the correction; I'll leave the comment there in case someone else thinks the same thing.


Looks like they only discontinued pre-Windows 10 and MacOS support. Windows 10+ still seems to be supported.


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.


If that were true as a general rule, they’d still be trying to sell iPods and you wouldn’t be able to play music from an iPhone…


The confusing, overlapping MacBook lineup at various times is at odds with this assessment, I'd have thought.


I don’t think we’ll ever see that. Without the plug, maybe, but with one? I don’t see that happen.


I thought this was one of the main advantages of typed languages refactoring or renaming is safe and easy. What gives?


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.


"static vs dynamic" and "strong vs weak" are orthogonal coordinates.


It seems GP was talking about the latter.


The C preprocessor is arguably a not type safe language unto itself.


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.

Essentially it is too clever for its own good.


No one likes the preprocessor, but it's practicaly required if you don't want to move to C++ with template metaprogramming.


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.


Well, C++ templates happen on the preprocessor too.


No they don't. Template instantiation happens during compilation, way later than the preprocessor.


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.


where in hell did you learn that, this is entirely false


Well, it is today.

When I first learned C++, using cfront in the late 80's, lots of the language was implemented as C pre-processor macros.


maybe lots of the language, but not templates. Cfront 2 did not have templates, and Cfront 3 did have them without using the preprocessor.

You can even check out how it was done: https://github.com/seyko2/cfront-3/blob/master/src/template....


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.


"arguably" is not needed. Preprocessor destroys most of the semantics and even some syntax of C.


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.


You can still have plenty of issues crop up from code that's not currently in master yet, or forked projects that take patches sparingly, etc.

Typed languages let you know whats broken at compile time and aides in refactoring code you can see. It doesn't help you refactor code you can't see.


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.


I always thought the react programming model could solve most criticisms perfectly with a built in liveview style server part


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.


because the western countries actively dis-stabilizes other countries and continents. Take for example South America and the US


What percentage of the instability in Africa and Latin America in the last 100 years, do you think that western countries caused?


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.

[1]: https://en.wikipedia.org/wiki/United_States_involvement_in_r...


That's an eye opening page.

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].

[1]: https://en.wikipedia.org/wiki/CIA_involvement_in_Contra_coca...

[2]: https://en.wikipedia.org/wiki/Allegations_of_CIA_drug_traffi...


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.


Don't they also actively destabilize each other though? I'm not sure why this should be considered the primary cause behind it.


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.


Yes this is a valid point.

It seems to be the prevailing theory that any misfortune befalling these countries is due primarily to the west.

These countries would be thriving without western interference is the claim.


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?

(write as in write down, not write as invent)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: