Not only has this been heavily requested, it would improve ease of use and it isn't too tricky to implement.
Allow vbLet | vbSet: set a.b = something, let a.c = true
One of the downfalls of lambdas so far is the inability to trigger vbLet/vbSet There are 2 options here:
Have a let operator e.g. :=
a.b := something
This is probably the easiest to implement:
if consume() = eObjectGetter and peak(2) = eObjectSetter then
beginLetExpression()
else
beginGetExpression()
end if
Introduce a let an set keyword:
Not entirely sure how this would work internally but this would be the typical VBA approach.
set a.b = something
let a.c = 1
Allow column syntax [Some column] and include row property
Say you are looping through rows of a csv, it would be nice if we had a good way of accessing the columns of each row. The current easiest way to do this is with dictionaries:
This change proposes the addition of a row variable on stdLambda instances.
Dim lambda as stdLambda: set lambda = stdLambda.Create("[column 1] + [col2]")
for each row in csv
set lambda.row = row
if lambda() > 5 then
'...
end if
next
Add try-catch
Say we are using stdWindow to search for ProcessIDs e.g.
set eOut = wnds.Filter(stdLambda.Create("$2.ProcessID = $1").bind(proc.id))
stdWindow is built in such a way that if the window no longer exists ProcessID will throw an error. This can be worked around with if statements to catch the error:
set eOut = wnds.Filter(stdLambda.Create("if $2.exists then $2.ProcessID = $1 else false").bind(proc.id))
but it would be nice to have a try catch also:
set eOut = wnds.Filter(stdLambda.Create("Try $2.ProcessID = $1 Catch false").bind(proc.id))
Add short circuiting out of OR and AND
if a or b then should immediately skip to then if a is true, without needing to check b.
if a and b then ... else ... should immediately skip to else if a is false.
Tasks
(a,b,c)=> ...
let a.b = ...
a.b := ...
(Is this still required?)[Some column]
and includerow
propertyAllow parameter names:
stdLambda.Create("(a,b,c) => a*b+c")
Not only has this been heavily requested, it would improve ease of use and it isn't too tricky to implement.
Allow vbLet | vbSet:
set a.b = something
,let a.c = true
One of the downfalls of lambdas so far is the inability to trigger vbLet/vbSet There are 2 options here:
Have a
let
operator e.g.:=
This is probably the easiest to implement:
Introduce a
let
anset
keyword:Not entirely sure how this would work internally but this would be the typical VBA approach.
Allow column syntax
[Some column]
and includerow
propertySay you are looping through rows of a csv, it would be nice if we had a good way of accessing the columns of each row. The current easiest way to do this is with dictionaries:
This change proposes the addition of a
row
variable onstdLambda
instances.Add try-catch
Say we are using stdWindow to search for ProcessIDs e.g.
stdWindow is built in such a way that if the window no longer exists
ProcessID
will throw an error. This can be worked around with if statements to catch the error:but it would be nice to have a try catch also:
Add short circuiting out of
OR
andAND
if a or b then
should immediately skip to then ifa
istrue
, without needing to checkb
.if a and b then ... else ...
should immediately skip to else ifa
isfalse
.