unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: guile-user@gnu.org
Subject: Re: Fixing "stringly typed" data structures in Artanis (Was: Learning Guile web. Stuck on returning an image.)
Date: Fri, 11 Dec 2015 08:53:19 +0100	[thread overview]
Message-ID: <20151211075319.GA9474@tuxteam.de> (raw)
In-Reply-To: <CAJ=RwfaYZ=PC4HRtbiZmTLYVcU+jYPiiF7FHLBx9Wa8Fhs+30g@mail.gmail.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Dec 10, 2015 at 05:02:52PM -0500, Thompson, David wrote:
> [ Changing the subject for this little rant below ]
> 
> On Thu, Dec 10, 2015 at 2:44 PM, Martyn Smith
> <martyn.developer@googlemail.com> wrote:
> 
> [snip]
> 
> > (get "/image"
> >      (lambda (rc)
> >        (let* ((port (open-file "s.jpg" "r"))
> >                (bytes (get-bytevector-all port)))
> >      (close-port port)
> >      (response-emit bytes #:headers '((content-type image/jpg))))))
> >
> > (run #:port 1234)
> >
> >
> > For my personal website, I pass in an id (ie "/image/{id}") which returns a
> > record from the database, containing the location of the file in question...
> > plus other things (tags, uploader, etc)  -- once working I stick it inside
> > an image tag - job done!
> 
> I guess this is as good a time as any to voice a concern that I have
> with Artanis before too many people depend on it and its not feasible
> to change it.  In Scheme, we have the luxury of being able to easily
> create embedded domain specific languages or otherwise take advantage
> of s-expressions to avoid the tiring work of writing parsers and
> interpreters for new languages. [...]

I'd like to throw in a word of caution. There are those two worlds
"everything is a string" (excuse me the Tcl pun) and "everything is
a structure". They both have their strengths, and over-committing to
one can immobilize too early.

In Guix this may make more sense, since we're talking about a more or
less controlled environment. But in the WWW, the only currency of exchange
is an URL which is... a string! (it can be interpreted as a serialization
of an intrinsic data structure, but what the RFCs talk about is a
string).

For a current discusion of this kind of topic, see [1]

And yes, David: your concerns about (not only SQL) injection are
definitely valid; I guess this is a force field we'll be living in,
at least in this trade. Too much in one corner and it becomes
too dangerous, too much in the other and it becomes boring. Gödel
or something.

[1] <http://lambda-the-ultimate.org/node/5289>

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlZqgO8ACgkQBcgs9XrR2kZTaQCeM42GhOsKjNJa8xVBGv2D3caS
Y88An0UVbd/zL7HaY3UDhmutbh7byILm
=xwJZ
-----END PGP SIGNATURE-----



  parent reply	other threads:[~2015-12-11  7:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 22:02 Fixing "stringly typed" data structures in Artanis (Was: Learning Guile web. Stuck on returning an image.) Thompson, David
2015-12-11  3:38 ` Fixing "stringly typed" data structures in Artanis Mike Gerwitz
2015-12-11  7:33 ` Fixing "stringly typed" data structures in Artanis (Was: Learning Guile web. Stuck on returning an image.) Nala Ginrut
2015-12-11 15:25   ` Christopher Allan Webber
2015-12-11 19:16     ` tomas
2015-12-11  7:53 ` tomas [this message]
2015-12-11 21:17 ` Fixing "stringly typed" data structures in Artanis Ludovic Courtès
2015-12-13 19:41 ` Amirouche Boubekki
2015-12-13 19:58   ` Thompson, David

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=20151211075319.GA9474@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=guile-user@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).