News for hackers. Stuff that matters.
Re:The Unix-Haters Handbook (1994) [pdf] by problems on Friday March 03, 2017 @08:56AM (#13782821)
How does one use a Mac without grep or piping?

I bought a macbook thinking I'd learn how to use it... but after 3 years, all I can do on a Mac is open a web browser and terminal.

Re:The Unix-Haters Handbook (1994) [pdf] by Gracana on Friday March 03, 2017 @09:00AM (#13782840)
This book was written long before Mac OS X.
Re:The Unix-Haters Handbook (1994) [pdf] by mcguire on Friday March 03, 2017 @10:26AM (#13783440)
I thought OSX was a weird Mach/BSD amalgam. In which case, not so much.
Re:The Unix-Haters Handbook (1994) [pdf] by pjmlp on Friday March 03, 2017 @09:51AM (#13783197)
> How does one use a Mac without grep or piping?

Using Finder, XCode, Objective-C and Swift frameworks,...

Re:The Unix-Haters Handbook (1994) [pdf] by problems on Friday March 03, 2017 @10:18AM (#13783385)
Bluh, don't get me started on Finder. Icons in directories would randomly be overlapping just because I hadn't been in them in a while and new files were added, they added this weird tagging system with colors that just doesn't make sense to me at all, it randomly thinks I want to view some sort of "recently used files and some random shit" list instead of my homedir. I don't know what the devs of it were thinking. Even bone stock Windows Explorer seems better. Easier to understand what's going on at least. I don't know why people seem to think Apple is some sort of UI god when they can't even make a usable file manager.

Objective-C looks like a clusterfuck and I never want to touch it. Swift seems like a quite good solution to that and I hope it eventually becomes the full replacement - but now more non-Apple laptops have high DPI screens, so I don't think I'll be around to see it happen.

Re:The Unix-Haters Handbook (1994) [pdf] by dahart on Friday March 03, 2017 @11:52AM (#13784118)
> Objective-C looks like a clusterfuck and I never want to touch it.

This is pretty much moot now, the Apple world is abandoning Obj-C, but AFAIK it's just old, not bad. Like, came out at the same time as C++ old, and has seen fewer changes to the language than C++ has. It's a compiled, C-like language, so yeah, hard to use and very easy to crash, just like C & C++.

Interested to hear your point of view on what makes it seem like a cluster, if you want to share. (And I'm only interested in hearing and understanding your opinion, not on debating or contradicting your experience.)

Obj-C had a pretty cool calling mechanism underneath, known as "message passing" -- more or less the analogy to C++'s virtual member functions. But it is the only compiled language I know where you can actually call functions by name, like construct a string dynamically and call, and you get those dynamic calls at the same speed as compiled code (minus a fast function lookup you can usually do once).

I used that mechanism in some games to build a nice state machine class for actor behavior. I did the same in C++, and the Objective-C code was way nicer & easier to use.

Re:The Unix-Haters Handbook (1994) [pdf] by seanp2k2 on Friday March 03, 2017 @12:18PM (#13784349)
I remember trying to do the "construct a function name as a string and call it" thing in VB6 many years ago before I "knew better". Any idea what that functionality is called? I always wondered why languages wouldn't let you do that.
Re:The Unix-Haters Handbook (1994) [pdf] by vram22 on Friday March 03, 2017 @02:51PM (#13785727)
>I remember trying to do the "construct a function name as a string and call it" thing in VB6 many years ago before I "knew better". Any idea what that functionality is called?

It's called by various names - not sure if there is an official one - such as dispatch tables, jump tables, dynamic dispatch, etc. It's a pretty old technique, I would say it probably dates from the time of early high-level languages, and I seem to remember that it was used in assembly languages too (so probably even earlier), by using various addressing modes (indexed, indirect indexed, etc. (those terms are from long-forgotten 6502 instruction set BTW), storing the address of a function at a location and then jumping to that address (where the address is dynamically set at run time by some other bit of code based on some condition), etc.

Here is a simple example in Python:

Simulating the C switch statement in Python:

https://jugad2.blogspot.in/2016/12/simulating-c-switch-state...

Edit: Googled and got a couple of relevant links:

https://en.wikipedia.org/wiki/Dispatch_table

https://en.wikipedia.org/wiki/Branch_table

Re:The Unix-Haters Handbook (1994) [pdf] by akiselev on Friday March 03, 2017 @12:44PM (#13784566)
I don't think there's another widely used name for it except dynamic or virtual dispatching (with inline caching of the lookup table). C is too low level and simple a language to have it in the string lookup form and in C++/Rust name mangling, symbol stripping from binaries, and generics would make the feature very difficult to implement and rather unergonomic. C#/F# and CLR C++/VB probably already have this in the form of the reflection/.Net runtime APIs (including JIT for generics) but implementing it in C++ or Rust would be very complex and it would be yet another feature that bifurcates the language ecosystem (like heap allocation for embedded). Python and Javascript do have this feature but you still have to have access to the scope to do it (self['fn_name'] or this['fn_name']) and this implementation exists in one way or another in most dynamic languages.

You can do this as a hack in most compiled languages by exporting symbols from a shared library and just using the OS specific dynamic linker but this is ugly, slow, and pointless in a static language.

Re:The Unix-Haters Handbook (1994) [pdf] by chaosite on Friday March 03, 2017 @12:37PM (#13784492)
You usually get that through either reflection or an "eval" command.
Re:The Unix-Haters Handbook (1994) [pdf] by dahart on Friday March 03, 2017 @12:05PM (#13784247)
The finder is a wart. Apple does have a lot of good UI elsewhere, but the finder needs an overhaul so bad it hurts.

Know what drives me the most nuts? That there's a single default key (Enter) to rename a folder, while you have to use a key chord (Command-O) to enter a folder. It's so backwards, renaming is not something I spend even remotely as much time doing as moving around. That's not to mention the so completely obvious missed opportunity to let the Enter key do what it says and Enter the folder.

Re:The Unix-Haters Handbook (1994) [pdf] by cmrdporcupine on Friday March 03, 2017 @12:37PM (#13784493)
What's ridiculously annoying is how good the Finder was under classic Mac OS compared to what exists now. The new Finder is a bad translation of some of the classic functionality overtop of the NeXT workspace manager. And it's a bad fusion of the two, in my opinion.
Re:The Unix-Haters Handbook (1994) [pdf] by derefr on Friday March 03, 2017 @01:58PM (#13785215)
> (Command-O) to enter a folder.

I use Command+Down, which opens Finder shell-objects generally. It's the "descend" to Command+Up's "ascend."

Re:The Unix-Haters Handbook (1994) [pdf] by dahart on Friday March 03, 2017 @02:38PM (#13785591)
Not sure why I haven't been using that, but that is better than Command+O for sure, thanks!

Still, all navigating should be single-key-able, right? I guess it is technically, with left & right arrow keys in the List & Columns views, but I don't use those or like those as much, for whatever reason.

Re:The Unix-Haters Handbook (1994) [pdf] by mustacheemperor on Friday March 03, 2017 @02:29PM (#13785520)
Finder is absolutely boggling to me. I've considered switching to Mac as a mobile development platform a few times, but every time I sit down to actually USE one I realize I'd rather just put Ubuntu on a windows laptop or something.

>I don't know why people seem to think Apple is some sort of UI god when they can't even make a usable file manager.

I know! I ask myself how this is possible every time.

Re:The Unix-Haters Handbook (1994) [pdf] by rileymat2 on Friday March 03, 2017 @11:11AM (#13783810)
I completely agree with you, the "All My Files" view that it defaults to seems to not fit me very well.

The nice thing is that it is configurable.

Re:The Unix-Haters Handbook (1994) [pdf] by DonHopkins on Friday March 03, 2017 @10:57AM (#13783694)
From day one, they should have called it the "Loser" instead of the "Finder".
Re:The Unix-Haters Handbook (1994) [pdf] by seanp2k2 on Friday March 03, 2017 @12:22PM (#13784385)
for anyone unaware, mdfind foo on Mac does the same as locate foo on Linux. CLI spotlight search. Also, open bar will open a thing (file, folder, application, whatever) in the associated application. I typically do open . to pop a finder if I want a GUI to mess with files in the current dir.
Re:The Unix-Haters Handbook (1994) [pdf] by BatFastard on Friday March 03, 2017 @09:02AM (#13782853)
As most developers do. Most everything else a pain in the Asteroid.