Format deklaratywny to taki, w którym użytkownik deklaruje zamiar/wynik końcowy programu, a nie sposób jego uzyskania. Zasadniczo jest to rozróżnienie między plikiem konfiguracyjnym a fragmentem kodu. Porównaj:
CC=gcc
CFLAGS=-I.
DEPS = hellomake.h
%.o: %.c $(DEPS)
$(CC) -c -o [email protected] $< $(CFLAGS)
hellomake: hellomake.o hellofunc.o
gcc -o hellomake hellomake.o hellofunc.o -I.
vs. coś podobnego (python-Pseudokod):
CC = "gcc"
CFLAGS = "-I."
DEPS = ["hellomake.h"]
def make_o_file(o_file, deps):
#don't recompile if it exists & is current
c_file = "%s.c" % os.path.splitext(o_file)[0]
if (os.path.exists(o_file)
and is_newer(o_file, c_file)
and all(is_newer(o_file, dep) for dep in deps)):
return
#else actually compile it
compile_c_file(CC, code_file, o_file, CFLAGS)
if target == "hellomake":
make_o_file("hellomake.o", DEPS)
make_o_file("hellofunc.o", DEPS)
link_o_files("hellomake", ["hellomake.o", "hellofunc.o"])
Były może być dużo łatwiejsze dla ludzi, aby przetworzyć jeśli format jest dobrze zaprojektowany. Przydatna może być Wikipedia pod adresem declarative programming.
Kilka tysięcy dolarów dla autorów. –