# The DCG // syntax + aliasing loses meta\_predicate behavior?

**URL:** <https://swi-prolog.discourse.group/t/the-dcg-syntax-aliasing-loses-meta-predicate-behavior/7692>\
**Category:** Help!\
**Created:** [August 15, 2024, 2:58am UTC](https://swi-prolog.discourse.group/t/the-dcg-syntax-aliasing-loses-meta-predicate-behavior/7692 "2024-08-15T02:58:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wenonih](https://avatars.discourse-cdn.com/v4/letter/w/b77776/32.png) [@wenonih](https://swi-prolog.discourse.group/u/wenonih)\
**Post date:** [August 15, 2024, 2:58am UTC](https://swi-prolog.discourse.group/t/the-dcg-syntax-aliasing-loses-meta-predicate-behavior/7692/1 "2024-08-15T02:58:03Z")

</div>

I’m not sure if this is a bug or if I’m making a mistake. I have some workarounds that work for me, but I wanted to report this in case it’s a bug or if anyone has advice.

When I try to `use_module` using the `//` DCG syntax and `as` aliasing the predicate, it loses its `meta_predicate` behavior (it doesn’t prefix it with the module). This _only_ happens when I use both the `//` and `as` aliasing.

I’m using SWI-Prolog version 9.2.4.

### Examples

* * *

#### Using both `//` and `as` is broken

```prolog
:- module(foo).
:- use_module(library(dcg/high_order),
              [ sequence//2 as seq
              ]).

```

`seq(bar, S)` does **not** prefix my predicate with my module.

I get an error that looks like `Unknown procedure: dcg_high_order:bar/3`

* * *

#### DCG `//` only (Good)

```prolog
:- module(foo).
:- use_module(library(dcg/high_order),
              [ sequence//2
              ]).

```

`sequence(bar, S)` **does** prefix my predicate to `foo:bar`.

* * *

#### Alias `as` only (Good)

```prolog
:- module(foo).
:- use_module(library(dcg/high_order),
              [ sequence/4 as seq
              ]).

```

`seq(bar, S)` **does** prefix my predicate to `foo:bar`.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [August 15, 2024, 9:45am UTC](https://swi-prolog.discourse.group/t/the-dcg-syntax-aliasing-loses-meta-predicate-behavior/7692/2 "2024-08-15T09:45:34Z")

</div>

You hit a bug. I pushed a fix to the swipl-devel GIT repo. Note that renaming during import is a SWI-Prolog extension to the de-facto standard module system that is (AFAIK) only shared by YAP.

As a work-around, you can add the meta-predicate declaration for seq//2. That is ugly, but will keep working also after this fix gets into the releases. Alternatively, rebuild from the GIT source 🙂
