caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ollie Frolovs <ollie.frolovs.2012@my.bristol.ac.uk>
To: Gabriel Kerneis <gabriel@kerneis.info>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Modules and record fields
Date: Sun, 25 May 2014 13:46:49 +0100	[thread overview]
Message-ID: <15117B8E-A404-4911-AC68-769CDF00B22E@my.bristol.ac.uk> (raw)
In-Reply-To: <20140525105906.GB7716@kerneis.info>

It does, but I am rather disturbed by the compiler warning. I usually aim not to have them, particularly when I am new to the language, assuming that they at least hint at unsafe programming techniques.

Update: I’ve put Solarized interface and definitions into separate files (rather than having both as module Solarized = … in the main file)  and there is no warning anymore for some reason. Unless there is something else I’m doing differently without realising it. 

I suppose that solves my problem. Thanks everybody!

solarize.mli:

type colour = {r:int; g:int;  b:int}
val base03 : colour
val orange : colour

(* END *)

solarize.ml:

type colour = {r:int; g:int;  b:int}
let base03 = {r=0x00; g=0x2b; b=0x36}
let orange = {r=0xcb; g=0x4b; b=0x16}

(* END *)

main.ml:

…
Solarized.(Sdl.set_render_draw_color ren orange.r orange.g orange.b 0xff)
… 
(* END *)


On 25 May 2014, at 11:59, Gabriel Kerneis <gabriel@kerneis.info> wrote:

> On Sun, May 25, 2014 at 11:30:20AM +0100, Ollie Frolovs wrote:
>> let module S = Solarized in
>> Sdl.set_render_draw_color ren S.orange.r S.orange.g S.orange.b 0xff
>> (* etc etc *)
> 
> Doesn't this work with the latest version of the compiler? (with a
> warning "r is not visible in the current scope, and will not be
> selected if the type becomes unknown")
> 
> -- 
> Gabriel


  reply	other threads:[~2014-05-25 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-25 10:30 Ollie Frolovs
2014-05-25 10:45 ` Gabriel Scherer
2014-05-25 10:59 ` Gabriel Kerneis
2014-05-25 12:46   ` Ollie Frolovs [this message]
2014-05-25 13:57     ` Gabriel Scherer
2014-05-25 14:56       ` Ollie Frolovs
2014-05-25 15:02         ` Gabriel Scherer
2014-05-26  9:14           ` Goswin von Brederlow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15117B8E-A404-4911-AC68-769CDF00B22E@my.bristol.ac.uk \
    --to=ollie.frolovs.2012@my.bristol.ac.uk \
    --cc=caml-list@inria.fr \
    --cc=gabriel@kerneis.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).