9,428 karma · joined Jul 10, 2015 (11y ago) · 3,276 submissions
comment 10y ago · link · parent
comment 10y ago · link · parent
2764.
Ask HN: Why on God's beautiful Earth does std::string not have a trim()?
2 points · by hellofunk · 10y ago · 3 comments
2766.
ClojureSwift: a Clojure dialect on top of Apple's Swift language and LLVM bitcode(github.com ↗)
5 points · by hellofunk · 10y ago · 1 comment
2770.
Ask HN: Will Apple continue to be a major disruptor?
12 points · by hellofunk · 10y ago · 15 comments
comment 10y ago · link · parent
comment 10y ago · link · parent
Also like the "lesswrong" folks who use statistics to make grand claims. Statistics is not a looking glass. It is a math that is only as useful as the wisdom of its practitioner, and can lead to false confidence.
2778.
Nim on iOS(programmingthomas.com ↗)
2 points · by hellofunk · 10y ago · discuss
comment 10y ago · link · parent
1) You have to actually write the assertion/:pre all the time, which is not a trivial step in my opinion. A basic type system just removes this chore altogether. Writing these little assertions really breaks the wonderful flow of elegance.
2) Any errors are only caught with a specific input that would violate the assertion; some inputs might pass, and others not. Therefore, you may not know there is a possible bug that will crash your app or lead to unexpected behavior, even if it runs fine for a long time.
3) You have to keep flipping the assertions switch on and off as you move from testing to deployment, or, just leave them on and suffer the runtime overhead of their checking everything all the time.
4) You will typically write more unit tests to make-up for the tests a type system does for you.
comment 10y ago · link · parent
I will be spending some time reading about this, since it's definitely the most disruptive aspect to Nim, considering that GC in a systems language is not a "solved problem" in general. Coming from C and C++ I'd most need to know exactly how the GC was working to be comfortable with the idea.
comment 10y ago · link · parent
comment 10y ago · link · parent
>Is this standard well supported by now? I'll change it to 'C' in any case.
The standard is 5 years old this year and nearly every major compiler has supported it for years, and the big ones supported it before the standard was officially in place. So changing it to C would be much more accurate.
That's not to say that each platform's unique tools, i.e. Apple's own GCD for multithreading, are not still available and widely-used. But C++ lets you not worry about platform-specific multithreading any more, and it's quite nice! In addition to multithreading primitives in the standard, there are also higher-level task-based tools like futures and promises that are cross-platform also.
comment 10y ago · link · parent
>Nim allows you to use snake_case even if the identifier has been defined using camelCase, and vice versa.
Can you also just write it all lowercase, and same synonym effect? i.e. snakecase
> The default garbage collector is real-time so it allows you to specify the amount of time it should spend on collecting memory.
Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it actually just adding calls to free for you?
> This applies to languages such as C++, Pascal and Ada. But these languages still require platform specific code when dealing with more specialised features of the operating system, such as creating new threads ...
Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading.
>The speed of a programming language is one characteristic that is often used to compare multiple programming languages
Since this statement is in the book, it would be nice to see Nim programs participating in the online benchmarks game.
>Table 1.2 Common programming language features
A little misleading or perhaps just incorrect to place a No in C++'s box for metaprogramming. Entire books have been written on C++ metaprogramming.
comment 10y ago · link · parent
1) It changed how I think about programming, big time. I came from Objective-C and pre-2011 C++, and the functional paradigm blew my mind open. It is now the first habit approach I have when working in any language.
2) I really miss types. While I understand the argument about "fighting the type system", I'd still prefer to occasionally tweak my line of code to satisfy an average type system like C++ rather than deal with the lack of safety and clarity that functions with no type specification for input or output provide. I've recently started doing much more in C++, but this time the modern variant (where I'm using lambdas and the algorithm library all over the place, thanks to what Clojure taught me), and it's been a wash of relief to use my brain for things other than remembering what to feed a function I wrote days, weeks, or months ago: just let the compiler tell me, verify that I've done it right. The ability to quickly test an idea in Clojure is great, but I feel like a large dynamically-typed code base is tremendous opportunity for significant run-time problems, since no compiler has verified that a big category of easy-to-make bugs aren't in there. I'm often having to look at the actual implementation of functions that I don't want to study any more, just so I can remember what types to give them, and what to expect back from them. Run-time assertions and :pre/:post are great, but still not the same thing at all -- and verbose, and added runtime overhead. I don't consider Core.Typed to be the solution to this problem; really, this is something that should be at a core language level, and Clojure is dynamically typed, that's its ball-game, and that's fine for many folks. But I'm slowly moving on towards an exploration of static languages like OCaml, Modern C++, and others.
That said, the elegance of Clojure syntax is extraordinary. I don't think it can be beat. It is a joy to use. So all languages have their unique characteristics. I've come to learn what characteristics are important to me, and adjusting my workflow and choices accordingly. But I can't imagine the programming landscape without Clojure.
2786.
A lightweight C++ signals and slots implementation(github.com ↗)
93 points · by hellofunk · 10y ago · 38 comments