Live data from Hacker News

The Makefile I use with JavaScript projects

olioapps.com

311–320 of 525 posts

Re: The Makefile I use with JavaScript projects

#311

Earlier quoted context omitted.

To clarify our views: The words and sentences are inside the file. The filenames are identifiers to the files. Identifiers' purpose is mainly to identify, rather than to communicate. On the other hand, we could imagine a user interface that users don't see (actual) filenames at all.

Identification is a form of communication. The identifier assigned to me at birth contains two spaces. Most people use one of the shorthand forms, but still.

I'm intrigued. Your first name has two spaces in it?

That is, I think it is safe to say that we expect we can include spaces in the names of things. The movie is named "Star Wars", after all. That seems natural.

For people, though, we have grown used to someone having multiple parts of their name separated by a space. If given out of order, a comma.

Even in the "naming things" category. We are used to having to put quotes around names that have spaces. Or otherwise using a convention like Capitalized Identifiers to show something goes together. Probably isn't a clearcut rule.

Re: The Makefile I use with JavaScript projects

#312
post #241

Earlier quoted context omitted.

I'm bemused by this repeated insistence that supporting spaces in file names is somehow difficult.

And nulls? And quotes? And dollars? And any unicode char?

I expect you mean NUL (ASCII 0) - but that's typically not a good choice, because POSIX decrees it invalid, along with '/'. But anything else is fair game, sure. Handling every Unicode char might be a pain, but that's the filing system's job, not yours!

Most programming languages manage to get this right. You have a quoting syntax with an escape character that lets you express the quotes, the escape character, and any arbitrary character (as a byte sequence, as a Unicode codepoint in some encoding, etc.) as well. Now you can do everything. Why not do this?

I'm not going to say this won't be a pain if you decide to write out every file name possible, because it will be, inevitably. But you can supply alternative syntaxes by way of more convenient (if limiting) shorthand - Python has its r"""...""" notation, for example, allowing you to express the majority of interesting strings without needing to escape anything.

You might argue that I've just punted the problem on to the text editor and the filing system. You'd be quite right.

Re: The Makefile I use with JavaScript projects

#313

Earlier quoted context omitted.

If fixing things in this makefile is not your job, then it really is amazing.

Honestly its like any other tool we use: once you know the rules governing its behavior it really isn't that hard to debug issues. Make is very consistent in most cases. There are plenty of traps, and they're made easier to fall into given the archaic syntax, but you don't typically have to fall into them over and over again :).

Yes but some tools have... shall we say, irregular rules. Tell me how CMake's argument quoting works for example.

Re: The Makefile I use with JavaScript projects

#314

Earlier quoted context omitted.

Demanding the support of spaces in filenames significantly complicates code as simple space delimination no longer works and other delimination schemes are much more error prone -- forgetting balancing quotes, any one? While you are allowing spaces, you probabaly are allowing all possible code points or maybe even a null byte? Thinking about it gives me headaches. I hate hearing people using 21st century or modern as…

> And there are solutions. One solution, from those who don't code, seems to demand ("developers", paid or not) that every tool that deal with files should handle this additional complexity, regardless of their context and what they think. Users expect computers to work in a non-surprising ways. It isn't natural to use dashes or underscore in file names. Training users to be afraid of spaces is just teaching them one…

> Users expect computers to work in a non-surprising ways.

"Users" is a very broad category with a bunch of partitioning.

The particular subgroup in question are authors of build automation systems for medium to large scale software projects. They (we) have a rather different perspective on "surprising".

Re: The Makefile I use with JavaScript projects

#315
post #312

Earlier quoted context omitted.

And nulls? And quotes? And dollars? And any unicode char?

I expect you mean NUL (ASCII 0) - but that's typically not a good choice, because POSIX decrees it invalid, along with '/'. But anything else is fair game, sure. Handling every Unicode char might be a pain, but that's the filing system's job, not yours! Most programming languages manage to get this right. You have a quoting syntax with an escape character that lets you express the quotes, the escape character, and an…

Depends very much on your programming environment: on Python I don"t care, but when doing bash scripting or makefiles (very often) I very much care.

I have recently decided to stop using $ in passwords (defined by me) for that same reason: of course they are valid char, but they are such a big pain to support in usual contexts that it is simply not worth it.

Re: The Makefile I use with JavaScript projects

#316

Earlier quoted context omitted.

Everybody I know found it confusing at first, but its logical, and modular . I don't know a language with a better type declaration syntax. It gets impractical when you define function that return functions that return... because these expression grow on the left and right simultaneously. But realistically, you don't do that in C, and other than that, I find it easy to read the type of any expression... const int *x[…

> But realistically, you don't do that in C IMHO, that's a self-fulfilling prophecy. If it were reasonably easy to do that in C, it would be done more.

C is a systems programming language. It doesn't have closures or other features from functional programming. In other words, you can't "create functions at runtime". That is why you basically never see a function returning another function.

Re: The Makefile I use with JavaScript projects

#317
post #6

After going through a few build systems for Javascript, I realized they were all reinventing the wheel in one way or the other, and pulled out venerable Make from the closet. It turned out to be way more expressive and easy to read. One target to build (prod), another to run with fsevents doing auto-rebuild when a file is saved (instant gratification during dev), then a few targets for cleaup & housekeeping. All said…

The reason I don't like doing this is portability. Since the steps within the makefile are going to be run through a shell, it is going to behave differently on different systems. If your makefile fixes up a file using sed and your system has gnu sed, your makefile may fail on a system with BSD sed (e.g., a mac). If you rely on bash-isms, your makefile may not work on a debian system where it will be run with dash in…

I say, you JS guys doth protest a bit too much.

If you look in your package.json, you'll surely see a dozen or so "scripts" lines that run through the same shell that make does and have all the problems you just mentioned.

I'd also like to point out that Linux and almost certainly your production environment (because it's most likely *ix) will be case sensitive. Your macOS or Windows file system? Not so much. Point is, you're already up to your neck in portability issues. My macOS coworkers often forget this detail.

Re: The Makefile I use with JavaScript projects

#318
post #312

Earlier quoted context omitted.

And nulls? And quotes? And dollars? And any unicode char?

I expect you mean NUL (ASCII 0) - but that's typically not a good choice, because POSIX decrees it invalid, along with '/'. But anything else is fair game, sure. Handling every Unicode char might be a pain, but that's the filing system's job, not yours! Most programming languages manage to get this right. You have a quoting syntax with an escape character that lets you express the quotes, the escape character, and an…

And regarding slashes: are you bemused that unix does not support them in filenames?

(Thanks for correcting the nul reference)

Re: The Makefile I use with JavaScript projects

#320
post #282
post #23

Make's interface is horrible. Significant tabs. Syntax which relies on bizarre punctuation... If only whoever authored Make 40 years ago had had the design acumen of a Ken Thompson or a Dennis Ritchie! We're stuck with Make because of network effects. I wish that it could just become "lost" forever and a different dependency-based-programming build tool could replace it... but that's just wishful thinking. The pace o…

I'm really glad software development has largely moved away from the terse names and symbols that used to be so common. I mean patsubst? What a terrible function name! At the very least I would have added the 'h' in path.

> I mean patsubst? What a terrible function name! At the very least I would have added the 'h' in path.

The "pat" in "patsubst" means pattern, not path, so adding an h would be incorrect. (https://www.gnu.org/software/make/manual/html_node/Text-Func...)

Post reply on HN