From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Basa Centro Newsgroups: gmane.lisp.guile.user Subject: Re: Transient environment with standard functions Date: Sat, 11 Jun 2016 15:15:42 +0000 Message-ID: References: <30B0B35B-F6B0-4FD4-A35D-3E6542C3871F@gmail.com> <7B7BC3F7-A25D-427D-8E21-D3583C3C7DEA@gmail.com> <87twh0wxzn.fsf@T420.taylan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1465658168 14633 80.91.229.3 (11 Jun 2016 15:16:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jun 2016 15:16:08 +0000 (UTC) Cc: guile-user@gnu.org To: Matthew Keeter Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jun 11 17:16:07 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bBkdr-0007OY-JK for guile-user@m.gmane.org; Sat, 11 Jun 2016 17:16:07 +0200 Original-Received: from localhost ([::1]:47445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBkdq-0004oc-U7 for guile-user@m.gmane.org; Sat, 11 Jun 2016 11:16:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBkdW-0004oO-19 for guile-user@gnu.org; Sat, 11 Jun 2016 11:15:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBkdT-0006BP-J6 for guile-user@gnu.org; Sat, 11 Jun 2016 11:15:44 -0400 Original-Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:36083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBkdT-0006BL-BV for guile-user@gnu.org; Sat, 11 Jun 2016 11:15:43 -0400 Original-Received: by mail-oi0-x22b.google.com with SMTP id p204so152477579oih.3 for ; Sat, 11 Jun 2016 08:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xsPoKzDYrjfOQXPB1dvudHFnIr5eChhYNVzFWX8N6Ds=; b=lbCyWyHWgfBLQVlYJX0Qdgkg/bAdobavzA3Tvy02kMV2qpCHFp6J8grNOlpNS5npOC 0LBZ6K2H8pC6+XQ8Vvxwb3bG7jI9BjWn0Sc+OzCnjwdt/X5wOWjKjXUH8d8Qqj2X215L FfdyGsSSXj9H1wf74G5h7R08mEYBg8k/CtY4MntO7HchmDEZP8KfpPmvDjD6RVaJBogH blWqOuGU0VQFZtx84PNJS0VAS4z+Ufr3DSnlxg9VVIvCwvco/JxDAk2mEHKg2bdQgE15 IA0qQXwsR8KoArGK+8tn0Uu+CFkwphgm65QdYxbpVLfbIVpEtE3C2T1pqborMfLJyki8 3sNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xsPoKzDYrjfOQXPB1dvudHFnIr5eChhYNVzFWX8N6Ds=; b=WDsK8qwTY7A4KQWuPFZTu/bPLafF0ODl2w5ePllVJ73IjCYnAdaZrx4jiM58FhpEFD aTdYT/uKF7PYkFgeXSBqHrmCK9olFTTQjHdk6CSwem7W8pqcpzd2niPfR5A2CQCoengg NMLlFVJ3VAeRJKeN5MLWrQmUwagfQqWZUPjn7AjSoz0dfRN9hMxBdNgmMl8aphuW4qxU JXxUXlwoHJB226G6rHFgghTe+9BJ8Lx52I0g4ztxEch34lKRYoo6yHsP4HKXiRa4WC1w eG9r9tHPOybwl26zI/36oaxqqnzh3M1td4IIy+rIYEOQzmvkXEveuZ2RDQdkDjLMuUuD epEA== X-Gm-Message-State: ALyK8tINKnrttfJSpX9iJav8d83HsNcrXPdeueNUgq3L+k76FwZUjdCmRfYEfqYsa9Z3AZzIjnrhgPW2GIyU/Q== X-Received: by 10.157.5.148 with SMTP id 20mr4026017otd.60.1465658142707; Sat, 11 Jun 2016 08:15:42 -0700 (PDT) Original-Received: by 10.202.104.150 with HTTP; Sat, 11 Jun 2016 08:15:42 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22b X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12623 Archived-At: It seems in essence you are building up a Scheme expression using the graph and the code snippets and evaluating that expression. If this is the case, do you even need to use a module system and/or to explicitly create environments? Prima facie, it looks like you are trying to reinvent the wheel. Is your graph really just equivalent to an S-exp? Scheme is lexically scoped, and creates a "transient environment" for you through the use of lambdas. Your use of thunks suggests that you are doing caching or lazy-eval. I'm not sure this helps, but I hope so. When thinking about this topic, I had this mental image of a GUI for building Scheme expressions--like "Visual Scheme". :) (Basa) On 6/10/16, Matthew Keeter wrote: > The specific use case is for dataflow graphs, where you=E2=80=99re evalua= ting a > bunch of small > snippets of code that can refer to each other by name. > > I=E2=80=99d like to make an environment in which the variables in the sam= e subgraph > are > exposed as no-argument thunks. > > For example, let=E2=80=99s say I have one subgraph that contains > a =3D =E2=80=9C12=E2=80=9D =3D> evaluates to 12 > b =3D =E2=80=9C(+ 1 (a))=E2=80=9D =3D> evaluates to 13, since the (a)= thunk evaluates to 12 > > and another subgraph which contains > x =3D =E2=80=9C1=E2=80=9D =3D> evaluates to 1 > y =3D =E2=80=9C(* (x) 2)=E2=80=9D =3D> evaluates to 2 > > If I insert the thunks into (scheme-report-environment 5), they leak from > one graph > to another =E2=80=93 and to be fair, the docs to say that assigning into = this > environment is > undefined behavior. > > However, if I make an empty environment with (null-environment), it doesn= =E2=80=99t > have > useful functions like + and *; looks like (make-module) has the same issu= e. > > I'm sure that this is possible in Guile, but I got tired of reading throu= gh > the source > files to hunt down undocumented function that do what I need [1]. > > -Matt > > [1] Another recent incident: How do you programmatically list all of the > variables in a module? > You search the web, find http://www.draketo.de/proj/guile-basics/#sec-3-2= , > see a a reference to > module-map, which doesn=E2=80=99t exist in the documentation, dig it up i= n the > source to see its > arguments, etc=E2=80=A6 > > On Jun 10, 2016, at 6:11 PM, Basa Centro wrote: > >>> First of all: is the "sandboxing" aspect of these environment important= ? >> >> Taylan, >> >> Thanks, that's exactly what I meant by "motivation" in my first reply. >> (There was a recent, 6 months ago or so, thread on sandboxing in >> guile-user by the way.) >> >> Was Matt trying to prevent _access_ (inaccessible vs. read-only vs. >> read/write) to data? Or was he trying to prevent only _visibility_ >> (e.g. for hygeine)? >> >> I think we need to know more about "what" and "why" to answer his >> question, rather than just "how"--if that makes any sense. Does >> Racket [1] even _really_ achieve what he needs to do (_prevent_ access >> for example)? We don't even know if we don't understand the >> higher-level purpose. >> >> (Basa) >> >> [1] Disclaimer: I like Racket too--it is a great project. I just hate >> to see someone leave Guile because of a minor technicality. > >