Skip to content

Commit 56941e5

Browse files
committed
revert pipes, push to later release
1 parent 8b5e779 commit 56941e5

File tree

8 files changed

+30
-526
lines changed

8 files changed

+30
-526
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: nanonext
22
Type: Package
33
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
4-
Version: 0.2.0.9007
4+
Version: 0.2.0.9008
55
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
66
a socket library providing high-performance scalability protocols,
77
implementing a cross-platform standard for messaging and communications.

NAMESPACE

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@ S3method(print,nanoListener)
1717
S3method(print,nanoObject)
1818
S3method(print,nanoSocket)
1919
S3method(print,recvAio)
20-
S3method(print,resolvedExpr)
2120
S3method(print,sendAio)
22-
S3method(print,unresolvedExpr)
2321
S3method(print,unresolvedValue)
2422
S3method(setopt,nanoContext)
2523
S3method(setopt,nanoDialer)
2624
S3method(setopt,nanoListener)
2725
S3method(setopt,nanoSocket)
2826
S3method(start,nanoDialer)
2927
S3method(start,nanoListener)
30-
export("%>>%")
31-
export("%~%")
3228
export(.mirai_scm)
3329
export(call_aio)
3430
export(context)

NEWS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# nanonext 0.2.0.9007 (development)
1+
# nanonext 0.2.0.9008 (development)
22

33
#### New Features
44

55
* Aio values `$result`, `$data` and `$raw` now resolve automatically without requiring `call_aio()`. Access the values directly and an 'unresolved' logical NA will be returned if the Aio operation is yet to complete.
66
* `unresolved()` added as an auxiliary function to query whether an Aio is unresolved, for use in control flow statements.
7-
* Implements the Deferred Evaluation Pipe `%>>%` and Meanwhile / Concurrency Pipe `%~%` for working with potentially unresolved values.
87
* Integer error values generated by receive functions are now classed 'errorValue'. `is_error_value()` helper function included.
98
* `is_nul_byte()` added as a helper function for request/reply setups.
109
* `survey_time()` added as a convenience function for surveyor/respondent patterns.

R/pipe.R

Lines changed: 0 additions & 169 deletions
This file was deleted.

README.Rmd

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ Implemented transports:
4747
2. [Interfaces](#interfaces)
4848
3. [Cross-language Exchange](#cross-language-exchange)
4949
4. [Async and Concurrency](#async-and-concurrency)
50-
5. [Deferred Evaluation Pipe](#deferred-evaluation-pipe)
51-
6. [Meanwhile (Concurrency) Pipe](#meanwhile-concurrency-pipe)
52-
7. [RPC and Distributed Computing](#rpc-and-distributed-computing)
53-
8. [Publisher / Subscriber Model](#publisher-subscriber-model)
54-
9. [Surveyor / Repondent Model](#surveyor-respondent-model)
55-
10. [ncurl Minimalist http Client](#ncurl-minimalist-http-client)
56-
11. [Building from source](#building-from-source)
57-
12. [Links](#links)
50+
5. [RPC and Distributed Computing](#rpc-and-distributed-computing)
51+
6. [Publisher / Subscriber Model](#publisher-subscriber-model)
52+
7. [Surveyor / Repondent Model](#surveyor-respondent-model)
53+
8. [ncurl Minimalist http Client](#ncurl-minimalist-http-client)
54+
9. [Building from source](#building-from-source)
55+
10. [Links](#links)
5856

5957
### Installation
6058

@@ -256,84 +254,6 @@ close(s2)
256254

257255
[« Back to ToC](#table-of-contents)
258256

259-
### Deferred Evaluation Pipe
260-
261-
{nanonext} implements a deferred evaluation pipe `%>>%` for working with potentially unresolved values.
262-
263-
Simply pipe the value forward into a function or series of functions and it either evaluates or returns an 'unresolvedExpr'.
264-
265-
The result may be queried at `$data`, which will return another 'unresolvedExpr' whilst unresolved. However when the original value resolves, the 'unresolvedExpr' will simultaneously resolve into a 'resolvedExpr', for which the evaluated result will be available at `$data`.
266-
267-
It is possible to use `unresolved()` around a 'unresolvedExpr' or its `$data` element to test for resolution, as in the example below.
268-
269-
The pipe operator semantics are similar to R's base pipe `|>`:
270-
271-
`x %>>% f` is equivalent to `f(x)` <br />
272-
`x %>>% f()` is equivalent to `f(x)` <br />
273-
`x %>>% f(y)` is equivalent to `f(x, y)`
274-
275-
```{r pipe1}
276-
277-
s1 <- socket("pair", listen = "inproc://dep")
278-
s2 <- socket("pair", dial = "inproc://dep")
279-
280-
# request an aysnc receive with no messages waiting
281-
msg <- recv_aio(s2)
282-
283-
res <- msg$data %>>% c(2, 3) %>>% as.character()
284-
res
285-
unresolved(res$data)
286-
287-
# sending a message causes both 'msg' and 'res' to resolve
288-
s <- send_aio(s1, 1)
289-
unresolved(res)
290-
res
291-
res$data
292-
293-
close(s1)
294-
close(s2)
295-
296-
```
297-
298-
[&laquo; Back to ToC](#table-of-contents)
299-
300-
### Meanwhile (Concurrency) Pipe
301-
302-
The deferred evaluation pipe sequence may be terminated with a meanwhile (or concurrency) pipe `%~%` which:
303-
304-
(i) provides certainty of the return value, which will always be the evaluated result rather than a 'resolvedExpr'
305-
306-
(ii) makes it convenient to write concurrent code which runs whilst the expression is resolving
307-
308-
`x %~% expr`
309-
310-
is equivalent to the following expression, finally returning x:
311-
312-
`if (unresolved(x)) while (unresolved(x <- x$data)) {expr}; x`
313-
314-
Use it in the following way:
315-
316-
```{r pipe2}
317-
318-
s1 <- socket("pair", listen = "inproc://meanwhile")
319-
s2 <- socket("pair", dial = "inproc://meanwhile")
320-
321-
n <- 1L
322-
rec <- recv_aio(s2)
323-
a <- rec$data %>>% identical(data.frame()) %~% {
324-
if (n == 5) send_aio(s1, data.frame())
325-
cat("unresolved", n, "\n")
326-
n <- n + 1
327-
}
328-
a
329-
330-
close(s1)
331-
close(s2)
332-
333-
```
334-
335-
[&laquo; Back to ToC](#table-of-contents)
336-
337257
### RPC and Distributed Computing
338258

339259
{nanonext} implements remote procedure calls (RPC) using NNG's req/rep protocol to provide a basis for distributed computing.

0 commit comments

Comments
 (0)