3 ms·
> This blurs the meaning of "declarative" to the point of meaningless The alternative is to draw a clear line where there is none. > One of the things which m
by strogonoff 3y ago
> This blurs the meaning of "declarative" to the point of meaningless
The alternative is to draw a clear line where there is none.
> One of the things which makes Dockerfiles imperative is the sequence of Dockerfile commands is significant; if you swap the order of a COPY, RUN to a RUN, COPY, the result changes significantly.
By that logic you can call every Nix program “imperative”. They are sequences of strings, the order of which matters. The horror!
A Docker image is a stack of layers. Every layer points to a preceding layer. It’s not a huge leap from that structure to a fairly elegant sugar of a string array, where each string is a declaration that applies to preceding layer thus describing the next one. I don’t see anything fundamentally imperative about it; it can be used in imperative ways, but anything can.
- rgoulter 3y ago> The alternative is to draw a clear line where there is none. I'd say that more/less "imperative" refers to describing sequences of actions that take place (especially those which might modify some state), whereas "declarative" is more about a structure of what the result should be. I can agree that a Docker image can be considered as a structure, and that it's possible to construct one declaratively. Whereas I'd say a Dockerfile is an imperative construction of that.
- strogonoff 3y agoDockerfile describes a set of immutable layers. Whether you model it in your head as a sequence of commands or as a description of a set of immutable layers, is up to you.