GNU bug report logs - #53765
[PATCH 00/17] Remove limitations on clojure-tools

Previous Next

Package: guix-patches;

Reported by: Reily Siegel <mail <at> reilysiegel.com>

Date: Fri, 4 Feb 2022 00:23:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Reily Siegel <mail <at> reilysiegel.com>
To: Maxime Devos <maximedevos <at> telenet.be>, 53765 <at> debbugs.gnu.org
Subject: [bug#53765] [PATCH 13/17] gnu: Add clojure-com-cognitect-aws-api.
Date: Mon, 07 Feb 2022 14:31:35 -0500
Maxime Devos <maximedevos <at> telenet.be> writes:

> OK, though I don't see how it can be declarative -- it's a library
> for ‘invoking AWS APIs’, which seems rather imperative, at least
> procedural.
Let me compare this library and the official Java AWS SDK.

#+BEGIN_SRC java
// Create a GetItemRequest instance
GetItemRequest request = GetItemRequest.builder()
                       .key(keyToGet)
                       .tableName(tableName)
                       .build();

// Invoke the DynamoDbAsyncClient object's getItem
java.util.Collection<AttributeValue> returnedItem = client.getItem(request)
                                                  .join()
                                                  .item()
                                                  .values();
#+END_SRC

#+BEGIN_SRC clojure
(aws/invoke s3 {:op :GetObject :request {:Bucket bucket-name :Key "hello.txt"}})
#+END_SRC

The Java API programatically creates a Request object, when is then
modified by several methods to set the options, before being invoked.
The Clojure API, on the other hand, specifies the operation
declaratively using plain Clojure data structures (in this case,
keywords, strings, and maps), before calling invoke on that
specification. The declarative part is in how the API is interacted
with, not necessarily what happens in the library internals or over the
wire.

Examples from the respective documentations of each project.
-- 
Reily Siegel




This bug report was last modified 3 years and 59 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.