Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Allow "unsafe" code (structs and arrays in structs) #29

Open
ForsakenShell opened this issue Oct 25, 2023 · 0 comments

Comments

@ForsakenShell
Copy link

ForsakenShell commented Oct 25, 2023

The only reason there is the restriction is because of bad coders and lazy GC. However, I'd like there to be an option to explicitly allow this. Certain things simply cannot be accomplished due to actual VM limitations but can be bypassed by encapsulating data.

One cannot do this:

function doFoo( int[] bar )
   ; blah
endfunction

function threadFoo( int[] bar )
   var[] varpar = new var[ 1 ]
   varpar[ 0 ] = bar
   callfunctionnowait( "doFoo", varpar )
endfunction

However, one could encapsulate that:

struct __FooParams
   int[] bar
endstruct

function __FooParamsDispose( __FooParams params )
   params.bar = None
endfunction

function __doFoo( __FooParams params )
   ; blah
   __FooParamsDispose( params )
endfunction

function doFoo( int[] bar )
   __FooParams params = new __FooParams
   params.bar = bar
   __doFoo( params )
endfunction

function threadFoo( int[] bar )
   __FooParams params = new __FooParams
   params.bar = bar
   var[] varpar = new var[ 1 ]
   varpar [ 0 ] = params 
   callfunctionnowait( "__doFoo", varpar  )
endfunction

Was able to do this with Fallout 4 and the CK Compiler Patch - would be great if Caprica supported this too. The VM doesn't care, it's just doing instructions, as I said - this restriction is just due to bad coders and lazy GC.

Edit: fixed typos and added code tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant