the static term is overly applied.

38 views
Skip to first unread message

Brandon Barker

unread,
Jan 24, 2014, 2:28:35 AM1/24/14
to ats-lan...@googlegroups.com
I have a function definition (a c interface) that (currently) looks like:

fun
newmodel
{n,nv:nat} (
env
: env, model: &model, mname: String (n),
numvars
: int (nv), obj: cPtr0(double),
lb
: cPtr0(double), ub: cPtr0(double),
vtype
: String, varnames: stringlst_vt): int


The String (n) argument gives the error "the static term is overly applied."

Somewhat unrelatedly, I'm almost sure I can't directly past stringlst_vt to something that expects char** - I'll probably try to use templates to convert each string to a concatenated sequence of chars.

Brandon Barker

unread,
Jan 24, 2014, 9:06:15 AM1/24/14
to ats-lan...@googlegroups.com
It means the type I'm using doesn't take additional sorts as arguments: I should be using just string, which can be equivalent to strint_int_type (n: int) :

abstype
string_type = ptr // = char* in C
abstype
string_int_type (n: int) = string_type
//
stadef string0 = string_type
stadef string1 = string_int_type
stadef string = string1 // 2nd-select
stadef string = string0 // 1st-select
typedef String = [n:int] string_int_type (n)
typedef String0 = [n:int | n >= 0] string_int_type (n)
typedef String1 = [n:int | n >= 1] string_int_type (n)

Brandon Barker
brandon...@gmail.com


--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/b39f6dc6-cc29-427d-af57-d22f308b1937%40googlegroups.com.

Brandon Barker

unread,
Jan 24, 2014, 9:18:07 AM1/24/14
to ats-lan...@googlegroups.com
Anyway, I think at this low-level, since I'm already using cPtr for other args, and especially for this argument where there any size string will do, it really doesn't make sense to use a string (n), so I just switched back to String.



Brandon Barker
brandon...@gmail.com

gmhwxi

unread,
Jan 24, 2014, 9:45:50 AM1/24/14
to ats-lan...@googlegroups.com
Should use 'string' instead of 'String'; string is a non-dependent type.

gmhwxi

unread,
Jan 24, 2014, 10:30:58 AM1/24/14
to ats-lan...@googlegroups.com
Here is my guess:


abstype varname
= string

fun
newmodel
{nv:int}
(
env
: env,
model
: &model, mname: string,

numvars
: int (nv), obj: cPtr0(double), lb: cPtr0(double), ub: cPtr0(double),

vtype
: string, varnames: &array(varname, nv)
): int



If a string value can be NULL, then use stropt instead.
Reply all
Reply to author
Forward
0 new messages