Re: Crash!
[Thread Prev] | [Thread Next]
- Subject: Re: Crash!
- From: Ori Bernstein <ori@xxxxxxxxxxxxxx>
- Date: Sun, 15 Nov 2015 15:29:45 -0800
- To: Ryan Gonzalez <rymg19@xxxxxxxxx>
- Cc: myrddin-dev@xxxxxxxxxxxxxx
So, the correct way to implement that is:
/*
the missing bit was 'mytype(@a)', which defines the
parameters for the type.
*/
type mytype(@a) = struct
value : @a
;;
const main = {
var x : mytype(int)
var y : mytype(byte[:])
x.value = 123
y.value = "a string"
}
> Type @a :: numeric,integral does not have size; why did it get down to here?
> Aborted (core dumped)
Taking a look -- that really should have failed in the frontend, since
the type you defined isn't parameterized, and has no '@a' in the environment,
meaning it won't know what '@a' is.
On Sun, 15 Nov 2015 15:23:18 -0600, Ryan Gonzalez <rymg19@xxxxxxxxx> wrote:
> I was trying to see if I could create a wrapper type like this in C++:
>
>
> template <typename T>
> struct mytype {
> T value;
> };
>
>
> So I tried this:
>
>
> type mytype = struct
> value : @a
> ;;
>
> const main = {
> var x : mytype
> x.value = 123
> }
>
>
> 6m said:
>
>
> @a missing traits numeric,integral for $39 :: numeric,integral near
> <mytype>.value
>
>
> Well, I didn't really want to restrict it to integral types...but I did it
> anyway. I changed the declaration of mytype.value to:
>
>
> value : @a::(numeric,integral)
>
>
> And got:
>
>
> Type @a :: numeric,integral does not have size; why did it get down to here?
> Aborted (core dumped)
>
>
> :(
> --
> Ryan
> [ERROR]: Your autotools build scripts are 200 lines longer than your
> program. Something’s wrong.
> http://kirbyfan64.github.io/
--
Ori Bernstein
| Crash! | Ryan Gonzalez <rymg19@xxxxxxxxx> |
- Prev by Date: Re: Crash!
- Next by Date: Re: Some fixes for building on Linux and Clang
- Previous by thread: Re: Crash!
- Next by thread: Re: Crash!
- Index(es):