[REBOL] Re: Getting username under windows
From: anton::wilddsl::net::au at: 20-Mar-2007 10:09
To explain what the following means...
> integer-struct: make struct! [
> value [integer!]
> ] none
> WNetGetUser: make routine! compose/deep [
> lpLength [struct! [(first integer-struct)]]
> ] win-lib "WNetGetUserA"
If you type this in the rebol console:
integer-struct: make struct! [value [integer!]] none
first integer-struct
The result is:
== [value [integer!]]
It is the spec block of INTEGER-STRUCT that we just defined.
Now this:
compose/deep [
lpLength [struct! [(first integer-struct)]]
]
COMPOSE/DEEP finds parens at any level of nesting, so the
result is:
== [
lpLength [struct! [value [integer!]]]
]
The INTEGER-STRUCT spec has been composed into the routine spec,
ready to be made into a routine.
It's just a way of reusing structure definitions. In this case,
it didn't save us much, but a structs can have a very long spec,
so then it would save us many lines of code each time it is
referenced.
Regards,
Anton.