[e-lang] Announcing Release Candidate 0.8.33a: experimental extra
sweet when-catch syntaxes
Mark Miller
markm at cs.jhu.edu
Tue Dec 21 01:07:24 EST 2004
At http://www.erights.org/download/0-8-33/index.html
eBrowser and the standard capDesk demo (capDesk, capEdit, the darpaBrowser
(evil & regular, confined & not) the web server), all still work.
But the when-catch error cases and the new extra-sweetened syntaxes are only
very lightly tested. Use at your own risk, and *please* let me know of any
problems.
Here's an example test case. I am unhappy with the size of the expansion. I
hope to provide a semantically equivalent but smaller & clearer expansion at
some point.
$ rune
? pragma.enable("easy-return")
? pragma.disable("explicit-result-guard")
? pragma.enable("easy-when")
? pragma.enable("when-sequence")
? def [p1,r1] := Ref.promise()
# value: [<Promise>, <Resolver>]
? interp.setExpand(true)
? def p3 := when (p1) -> (def p2 := (p1 + 3) <- add(1)) -> { println(p2) }
# expansion: def p3 := {
# Ref.whenResolved(p1, /** when-catch 'done' function */
# def "__main$1" {
#
# /** Invoke as a function */
# method run(resolution__15) {
# escape __return {
# try {
# def _ := Ref.fulfillment(resolution__15)
# {
# Ref.whenResolved(def p2 := \
# E.send(p1.add(3), "add", __makeList.run(1)), \
# /** when-catch 'done' function */
# def "__main$1$1" {
#
# /** Invoke as a function */
# method run(resolution__11) {
# escape __return {
# try {
# def _ := \
# Ref.fulfillment(resolution__11)
# println.run(p2)
# } catch ex__9 {
# throw.run(ex__9)
# }
# null
# }
# }
# })
# }
# } catch ex__13 {
# throw.run(ex__13)
# }
# null
# }
# }
# })
# }
# value: <Promise>
? r1.resolve(66)
# expansion: r1.resolve(66)
# stdout: 70
? p3
# expansion: p3
? p3 == null
# expansion: __equalizer.sameEver(p3, null)
# value: true
? interp.setExpand(false)
# expansion: interp.setExpand(false)
? def [p1,r1] := Ref.promise()
# value: [<Promise>, <Resolver>]
? def p3 := when (p1) -> (def p2 := (p1 + 3) <- add(1)) -> { println(p2) }
# value: <Promise>
? r1.smash("foo")
# value: true
***-----------------------***
*** Trace data written to ***
'C:/Documents and Settings/MILLERM1/.e/etrace/etrace.2004-12-21T05_33_58.968Z.txt'
***-----------------------***
? p3
# value: <ref broken by problem: foo>
?
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list