Re: Question about porting mzscheme code

"Scott G. Miller" <[email protected]> Wed, 18 Feb 2009 11:08:27 -0600
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
--===============5807558441445135559==
Content-Type: multipart/alternative; boundary=0016364ee022dad8cf04633477cd

--0016364ee022dad8cf04633477cd
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Wed, Feb 18, 2009 at 10:28 AM, D. O'Keeffe <[email protected]> wrote:

> Hey Scott, Yes that helps a bit, thanks. I thought load would do the
> importing for me. However when I checked again I noticed I am now getting
> the same error when I try to use the constructor function for the record
> i.e. (make-ce-definition 'e 'f) gives: Error undefined variable
> 'make-ce-definition'
>
> I assume that this is because what ever way the module exporting works, it
> doesn't export the constructor, accessor and predicate functions created by
> define-struct? Any ideas how to get around this? As an aside, it would be
> nice if the module export provided some way to export all definitions in
> the module (e.g. mzscheme has (provide (all-defined))), as opposed to
> having to list them all explicitly. Thanks, Dan



Correct.  The module only exports what you ask it too, you would need to
explicitly export the other functions created implicitly by define-struct.
I agree a provide-all would be nice, but the point of the Chez-style modules
is to hide implementation functions, not as a code organization or
deployment tool.  R6RS's modules try to do both.

Scott


> On Feb 18 2009, Scott G.
> Miller wrote:
>
> >>
> >> My module definition goes something like:
> >> (module cep-structs
> >>   (ce-definition ce-inst)
> >>   (import record)
> >>
> >>    (define-struct ce-definition (a b))
> >>    (define-struct ce-inst (c d))
> >> )
> >>
> >> I load the class cep-structs.scm, which seems to work, but when I then
> >> try and use the loaded definitions (e.g. (display ce-definition)), it
> >> says Error: undefined variable 'ce-definition' I'm using the Sisc
> >> interpreter that comes as part of SchemeScript, an Eclipse plugin for
> >> scheme.
> >
> >
> >Did you issue an (import cep-structs) before the display?
> >
> >Scott
> >
>
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Sisc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sisc-users
>

--0016364ee022dad8cf04633477cd
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 18, 2009 at 10:28 AM, D. O&#39;Keeffe <span dir=3D"ltr">&lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt;</span> wrote:<br><d=
iv class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"border-=
left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left=
: 1ex;">
Hey Scott, Yes that helps a bit, thanks. I thought load would do the<br>
importing for me. However when I checked again I noticed I am now getting<b=
r>
the same error when I try to use the constructor function for the record<br=
>
i.e. (make-ce-definition &#39;e &#39;f) gives: Error undefined variable<br>
&#39;make-ce-definition&#39;<br>
<br>
I assume that this is because what ever way the module exporting works, it<=
br>
doesn&#39;t export the constructor, accessor and predicate functions create=
d by<br>
define-struct? Any ideas how to get around this? As an aside, it would be<b=
r>
nice if the module export provided some way to export all definitions in<br=
>
the module (e.g. mzscheme has (provide (all-defined))), as opposed to<br>
having to list them all explicitly. Thanks, Dan </blockquote><div><br><br>C=
orrect.&nbsp; The module only exports what you ask it too, you would need t=
o explicitly export the other functions created implicitly by define-struct=
.&nbsp; I agree a provide-all would be nice, but the point of the Chez-styl=
e modules is to hide implementation functions, not as a code organization o=
r deployment tool.&nbsp; R6RS&#39;s modules try to do both.<br>
<br>Scott<br>&nbsp;</div><blockquote class=3D"gmail_quote" style=3D"border-=
left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left=
: 1ex;">On Feb 18 2009, Scott G.<br>
<div><div></div><div class=3D"Wj3C7c">Miller wrote:<br>
<br>
&gt;&gt;<br>
&gt;&gt; My module definition goes something like:<br>
&gt;&gt; (module cep-structs<br>
&gt;&gt; &nbsp; (ce-definition ce-inst)<br>
&gt;&gt; &nbsp; (import record)<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; &nbsp;(define-struct ce-definition (a b))<br>
&gt;&gt; &nbsp; &nbsp;(define-struct ce-inst (c d))<br>
&gt;&gt; )<br>
&gt;&gt;<br>
&gt;&gt; I load the class cep-structs.scm, which seems to work, but when I =
then<br>
&gt;&gt; try and use the loaded definitions (e.g. (display ce-definition)),=
 it<br>
&gt;&gt; says Error: undefined variable &#39;ce-definition&#39; I&#39;m usi=
ng the Sisc<br>
&gt;&gt; interpreter that comes as part of SchemeScript, an Eclipse plugin =
for<br>
&gt;&gt; scheme.<br>
&gt;<br>
&gt;<br>
&gt;Did you issue an (import cep-structs) before the display?<br>
&gt;<br>
&gt;Scott<br>
&gt;<br>
<br>
<br>
<br>
</div></div><div><div></div><div class=3D"Wj3C7c">-------------------------=
-----------------------------------------------------<br>
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, C=
A<br>
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterpris=
e<br>
-Strategies to boost innovation and cut costs with open source participatio=
n<br>
-Receive a $600 discount off the registration fee with the source code: SFA=
D<br>
<a href=3D"http://p.sf.net/sfu/XcvMzF8H" target=3D"_blank">http://p.sf.net/=
sfu/XcvMzF8H</a><br>
_______________________________________________<br>
Sisc-users mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]=
forge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/sisc-users" target=
=3D"_blank">https://lists.sourceforge.net/lists/listinfo/sisc-users</a><br>
</div></div></blockquote></div><br>

--0016364ee022dad8cf04633477cd--


--===============5807558441445135559==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
--===============5807558441445135559==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Sisc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisc-users

--===============5807558441445135559==--