unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: 11198@debbugs.gnu.org, guile-devel <guile-devel@gnu.org>
Subject: bug#11198: prefab structs in guile
Date: Thu, 05 Jul 2012 23:06:56 +0200	[thread overview]
Message-ID: <878vex534f.fsf__23295.983442995$1341522505$gmane$org@pobox.com> (raw)
In-Reply-To: <87ipe2dizn.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 05 Jul 2012 22:57:00 +0200")

On Thu 05 Jul 2012 22:57, ludo@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo@pobox.com> skribis:
>
>>   Then you would modify the reader to call out to (ice-9 prefab) with
>> the list after #s, e.g. the (foo ...) in #s(foo ...).  (ice-9 prefab)
>> would return the record, creating the RTD if needed.
>
> The problem with this is that one could precisely forge instances of a
> given record type, thereby breaking the type safety we currently have
> (each instance of a record type is genuine, in the sense of Rees’ “A
> Security kernel Based on the Lambda-Calculus”.)
>
> Does Racket address this somehow?

See:

  http://docs.racket-lang.org/guide/define-struct.html?q=record&q=structs&q=records#(part._prefab-struct)

Specifically:

  Every prefab structure type is transparent—but even less abstract than
  a transparent type, because instances can be created without any
  access to a particular structure-type declaration or existing
  examples. Overall, the different options for structure types offer a
  spectrum of possibilities from more abstract to more convenient:

    Opaque (the default) : Instances cannot be inspected or forged without
    access to the structure-type declaration. As discussed in the next
    section, constructor guards and properties can be attached to the
    structure type to further protect or to specialize the behavior of its
    instances.

    Transparent : Anyone can inspect or create an instance without access
    to the structure-type declaration, which means that the value printer
    can show the content of an instance. All instance creation passes
    through a constructor guard, however, so that the content of an
    instance can be controlled, and the behavior of instances can be
    specialized through properties. Since the structure type is generated
    by its definition, instances cannot be manufactured simply through the
    name of the structure type, and therefore cannot be generated
    automatically by the expression reader.

    Prefab : Anyone can inspect or create an instance at any time, without
    prior access to a structure-type declaration or an example
    instance. Consequently, the expression reader can manufacture
    instances directly. The instance cannot have a constructor guard or
    properties.

  Since the expression reader can generate prefab instances, they are
  useful when convenient serialization is more important than
  abstraction. Opaque and transparent structures also can be serialized,
  however, if they are defined with define-serializable-struct as
  described in Datatypes and Serialization.

Andy
-- 
http://wingolog.org/





  parent reply	other threads:[~2012-07-05 21:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-07 20:16 bug#11198: problems reading data with a "read-hash-extend" registered reader Klaus Stehle
2012-04-09 21:10 ` Ludovic Courtès
2012-04-11 19:07   ` Klaus Stehle
2012-04-11 19:33   ` Mark H Weaver
2012-04-11 20:34     ` Klaus Stehle
2012-04-22 13:43       ` Mark H Weaver
2012-04-22 18:01         ` Ludovic Courtès
2012-04-24  8:11           ` Andy Wingo
2012-04-24 11:24             ` Noah Lavine
2012-04-24 11:38               ` Noah Lavine
2012-04-24 16:22               ` Ludovic Courtès
2012-07-05  8:00 ` bug#11198: prefab structs in guile Andy Wingo
     [not found] ` <877gui7i3y.fsf@pobox.com>
2012-07-05 20:57   ` Ludovic Courtès
     [not found]   ` <87ipe2dizn.fsf@gnu.org>
2012-07-05 21:06     ` Andy Wingo [this message]
     [not found]     ` <878vex534f.fsf@pobox.com>
2012-07-05 21:55       ` Ludovic Courtès
     [not found]       ` <874npldga9.fsf@gnu.org>
2012-07-05 22:03         ` Andy Wingo
2012-07-05 22:06         ` Andy Wingo
     [not found]         ` <87ipe13lya.fsf@pobox.com>
2012-07-05 22:14           ` Ludovic Courtès
     [not found]           ` <87a9zdc0tc.fsf@gnu.org>
2012-11-27 21:52             ` Ludovic Courtès

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to='878vex534f.fsf__23295.983442995$1341522505$gmane$org@pobox.com' \
    --to=wingo@pobox.com \
    --cc=11198@debbugs.gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).