List Info

Thread: Re: "ocaml_beginners"::[] delayed initialization




Re: "ocaml_beginners"::[] delayed initialization
country flaguser name
United States
2007-09-17 20:28:03

> As the matter of fact, I don't need checking for None, but since the
> type now is 'a option, it looks like I have to.

Why don't you need it? You are trying to write to a channel (option)
that is possibly None. What would you mean in this case? If you're
working at a point in your code that is guaranteed to have opened the
channel, then why not just pass around the channel (in that area of
your code), instead of the optional channel.

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] delayed initialization
country flaguser name
Canada
2007-09-17 20:38:21

>>&gt;>> "AA&quot; == Ashish Agarwal < agarwal1975%40gmail.com">agarwal1975gmail.com> writes:

>> As the matter of fact, I don't need checking for None, but
>> since the type now is 'a option, it looks like I have to.

AA> Why don't you need it? You are trying to write to a channel
AA> (option) that is possibly None. What would you mean in this
AA> case? If you're working at a point in your code that is
AA> guaranteed to have opened the channel, then why not just pass
AA> around the channel (in that area of your code), instead of the
AA> optional channel.

That's the point, I don't want it to be an option. I want it to be a
global variable set at the time of "module initialization", not at the
time of variable declaration. It would be possible in scheme, where
types are not the issue, I believe.

I agree that what I want is a bit impure, just trying to understand
the capabilities of the language.

Thanks,

--
Viktor

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )