Is there any way to declare a function call-by-reference but not allow
it to modify its arguments? Similarly, is there a way to pass a value
(not a variable) to such a function?
For my particular use case, I want to wrap the bind function, which
takes a const pointer to a struct sockaddr, and there’s no inherent
reason why a program shouldn’t be able to declare one as a val.
Would there be any way (possibly with unsafe features under the hood?)
to get a pointer to a value?On Thu, Sep 04, 2014 at 01:04:06PM -0700, gmhwxi wrote:
Conceptually, this is easy to do:
absvtype RD (a:t@ype, l:addr) = ptr(l)
fun{a:t@ype} read{l:agz} (x: !RD (a, l)): a
Doing so means you need to write a lot of “administrative”
proof code.
On Thursday, September 4, 2014 3:04:43 PM UTC-4, Shea Levy wrote:
Hi all,
Is there any way to declare a function call-by-reference but not allow
it to modify its arguments? Similarly, is there a way to pass a value
(not a variable) to such a function?
For my particular use case, I want to wrap the bind function, which
takes a const pointer to a struct sockaddr, and there’s no inherent
reason why a program shouldn’t be able to declare one as a val.
I guess it won’t hurt if I repeat myself one more time:
Learning how to use unsafe features in ATS is essential for the purpose
of practical
programming, that is, writing code that you and others can really use (and
also want to use).
The real world is far more complex than any type systems :)On Thursday, September 4, 2014 8:26:30 PM UTC-4, gmhwxi wrote:
On Thursday, September 4, 2014 8:19:38 PM UTC-4, Shea Levy wrote:
Would there be any way (possibly with unsafe features under the hood?)
to get a pointer to a value?
On Thu, Sep 04, 2014 at 01:04:06PM -0700, gmhwxi wrote:
Conceptually, this is easy to do:
absvtype RD (a:t@ype, l:addr) = ptr(l)
fun{a:t@ype} read{l:agz} (x: !RD (a, l)): a
Doing so means you need to write a lot of “administrative”
proof code.
On Thursday, September 4, 2014 3:04:43 PM UTC-4, Shea Levy wrote:
Hi all,
Is there any way to declare a function call-by-reference but not
allow
it to modify its arguments? Similarly, is there a way to pass a value
(not a variable) to such a function?
For my particular use case, I want to wrap the bind function, which
takes a const pointer to a struct sockaddr, and there’s no inherent
reason why a program shouldn’t be able to declare one as a val.
Would there be any way (possibly with unsafe features under the hood?)
to get a pointer to a value?
On Thu, Sep 04, 2014 at 01:04:06PM -0700, gmhwxi wrote:
Conceptually, this is easy to do:
absvtype RD (a:t@ype, l:addr) = ptr(l)
fun{a:t@ype} read{l:agz} (x: !RD (a, l)): a
Doing so means you need to write a lot of “administrative”
proof code.
On Thursday, September 4, 2014 3:04:43 PM UTC-4, Shea Levy wrote:
Hi all,
Is there any way to declare a function call-by-reference but not allow
it to modify its arguments? Similarly, is there a way to pass a value
(not a variable) to such a function?
For my particular use case, I want to wrap the bind function, which
takes a const pointer to a struct sockaddr, and there’s no inherent
reason why a program shouldn’t be able to declare one as a val.
Doing so means you need to write a lot of “administrative”
proof code.On Thursday, September 4, 2014 3:04:43 PM UTC-4, Shea Levy wrote:
Hi all,
Is there any way to declare a function call-by-reference but not allow
it to modify its arguments? Similarly, is there a way to pass a value
(not a variable) to such a function?
For my particular use case, I want to wrap the bind function, which
takes a const pointer to a struct sockaddr, and there’s no inherent
reason why a program shouldn’t be able to declare one as a val.