1. user types vs built-ins
- Posted by katsmeow Sep 21, 2016
- 1274 views
I have two small code blocks:
-- code1 -- object h1 h1 = "10"
-- code2 -- type test(object x) return x end type test h1 h1 = "10"
Code1 runs, but code2 crashes with a type error. Why doesn't code 2 run?
2. Re: user types vs built-ins
- Posted by euphoric (admin) Sep 21, 2016
- 1251 views
Looks like your type() function is not returning true, so it's going to fail the type check.
Try something like:
return object(x)
or the result of whatever you're testing x for.
"10" does not resolve to 'true,' so that's why it's failing (I suspect).
3. Re: user types vs built-ins
- Posted by mattlewis (admin) Sep 21, 2016
- 1236 views
I have two small code blocks:
-- code1 -- object h1 h1 = "10"
-- code2 -- type test(object x) return x end type test h1 h1 = "10"
Code1 runs, but code2 crashes with a type error. Why doesn't code 2 run?
A type function should return 1 or 0. It's meant for type checking.
Matt
4. Re: user types vs built-ins
- Posted by katsmeow Sep 21, 2016
- 1257 views
I have two small code blocks:
-- code1 -- object h1 h1 = "10"
-- code2 -- type test(object x) return x end type test h1 h1 = "10"
Code1 runs, but code2 crashes with a type error. Why doesn't code 2 run?
A type function should return 1 or 0. It's meant for type checking.
Matt
Thanks, Matt, that was it. I read User-defined types section in the OE-315.pdf help file, that bit of data isn't explicitly there.