This code works in latest SVN:
Code: Select all
type some_important
as integer x, y, z
end type
type some_type
as integer a, b
declare constructor _
( _
byval x as integer = 1, _
byval y as integer = 2, _
byval z as integer = 3 _
)
declare function view_important( ) as const some_important ptr
private:
important as some_important
end type
constructor some_type _
( _
byval x as integer, _
byval y as integer, _
byval z as integer _
)
important = type(x, y, z)
end constructor
function some_type.view_important _
( _
) as const some_important ptr
function = @important
end function
dim as some_type s
? s.view_important->x
'' illegal, can't modify that location
'' s.view_important->x = 0
'' illegal, the destination pointer has to be const
'' dim as some_important ptr si = s.view_important
var si2 = s.view_important
? si2->x
'' nothing magic, still illegal
'' si2->x = 0
sleep
Thanks!