Re: fact inquiring questions
- Posted by DerekParnell (admin) Apr 29, 2012
- 1338 views
Hi
A few questions inquiring facts.
1) when I create a type, with its constraints in the body, when will those constraints be checked?
will they be checked whenever an argument is passed to a function?
let's say I have an alphabet type, where all the sequence items should be between a..z
I then modify one of those items to integer -3.
it can be considered corrupted data now. will the next function check the type again, and assert the error? or is it internally marked as a certain type, so the (invariant) checking is only done at constructor time?
The type's function is called when type-checking is not turned off and when any assignment is made to a variable of that type.
type myType (object x) if atom(x) then return 0 end if if length(x) != 3 then return 0 end if if x[2] != 1 then return 0 end if return 1 end type myType A A = {1,1,1} -- Ok A[2] = 2 -- Fails A &= 1 -- Fails
2) let's say i want to use a large library a few mb in size. but only 5 functions are needed from there.
can 'euc' link the library statically to the resulting exe, but without all the unused material?
I assume you are talking about a library of Euphoria routines. The translator (euc) will not include Euphoria routines from Euphoria libraries that the application does not use. The resulting application is statically linked.