Skip to content

Commit

Permalink
#171 @call : initial design considerations
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 7, 2024
1 parent fcf03f8 commit 56e06eb
Showing 1 changed file with 52 additions and 5 deletions.
57 changes: 52 additions & 5 deletions docs/@call.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@

# @call
## Naming: `@call` vs `@calls`

TODO

## Do we allow both `@call` and `@depends_on` on the same level?
```shell
@goal a
@call b
@depends_on c
```

We could but the execution model would be this (`@depends_on` go first):
```shell
@goal a
@depends_on c
"$MAKESURE" b
```

Answer: No, should result in error in the first iteration.

## Do we allow both `@call` and non-empty goal body?

```shell
@goal a
@call b
echo 'a body'
```

No, should result in error
Should be relatively easy.

## Do we allow `@call goal_name @args 'arg'`?

Expand All @@ -29,6 +56,26 @@ Maybe, but let's do the easiest for the first iteration

In the first iteration let's not generate a subtree.

## `@call` operational semantics

Let's implement the simplest strategy of passthrough to `./makesure` invocation

```shell
@goal a
@call b
```

desugars to

```shell
@goal a
"$MAKESURE" [--define ...] b
```

Do we need `--file 'path/to/Makesurefile'`?

No. Even if we run `./makesure path/to/Makesurefile` path resolution is relative to the `Makesurefile` location, so internal makesure invocation now doesn't need explicit Makesurefile reference. But let's add a test for this case.

## the `@define` inheritance

Since we implement this in terms of running the external `./makesure` we need to repeat the variables passed via `-D`.
Expand Down Expand Up @@ -62,10 +109,10 @@ desugars to
echo "a2: $A"

@define b
"$MAKESURE" -D A="$A" a1
"$MAKESURE" -D A="$A" a2
"$MAKESURE" --define A="$A" a1
"$MAKESURE" --define A="$A" a2

@define c
"$MAKESURE" -D A="$A" a1
"$MAKESURE" -D A="$A" a2
"$MAKESURE" --define A="$A" a1
"$MAKESURE" --define A="$A" a2
```

0 comments on commit 56e06eb

Please sign in to comment.