magic.lambda.slots 17.2.1

dotnet add package magic.lambda.slots --version 17.2.1
NuGet\Install-Package magic.lambda.slots -Version 17.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="magic.lambda.slots" Version="17.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add magic.lambda.slots --version 17.2.1
#r "nuget: magic.lambda.slots, 17.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install magic.lambda.slots as a Cake Addin
#addin nuget:?package=magic.lambda.slots&version=17.2.1

// Install magic.lambda.slots as a Cake Tool
#tool nuget:?package=magic.lambda.slots&version=17.2.1

magic.lambda.slots - Creating and administering dynamic Hyperlambda slots

The magic.lambda.slots project provides the ability to create, invoke (signal), modify, inspect, and delete dynamic slots in Hyperlambda. More specifically, this project provides the following slots.

  • [signal] - Invokes a dynamically create slot that has been created with the [slots.create] slot
  • [execute] - Alias for [signal] except it will [unwrap] all descendant nodes explicitly
  • [try-signal] - Invokes a dynamically create slot that has been created with the [slots.create] slot, but will not throw exceptions if the slot doesn't exist
  • [slots.create] - Creates a dynamic slot, that can be invoked with the [signal] slot
  • [function] - Alias for [slots.create]
  • [slots.get] - Returns the entire lambda object for a slot that has been previously created with the [slots.create] slot
  • [slots.delete] - Deletes a slot that has been previously created with the [slots.create] slot
  • [slots.exists] - Returns true of the given slot exists
  • [return-nodes] - Returns a bunch of nodes to caller from inside of your slot
  • [return-value] - Returns a single value to caller from inside of your slot
  • [return] - Returns either a list of nodes, or a single value, or both, depending upon the results of its expression, or whether or not it has a static value, or a list of nodes
  • [yield] - Alias for [return-nodes] but similarly to [execute] it will [unwrap] all descendant nodes explicitly
  • [slots.vocabulary] - Returns the names of all dynamically created slots
/*
 * First we create a dynamic slot.
 */
slots.create:foo
   return-value:int:57

/*
 * Then we invoke it.
 */
signal:foo

After evaluation of the above Hyperlambda, the value of the [signal] node will be 57. Notice, if you invoke [slots.create] for a slot that has already been created, the old slot will be overwritten with the new lambda object you pass into it. Also notice that if you try to invoke a slot that doesn't exist, or you try to get its content, an exception will be thrown.

Also realize that when you create a slot, it is not persisted in any ways - Implying if the web server process is restarted, your slot will disappear. To avoid this, put the creation of your slot inside a file in a folder called "magic.startup" in your module's folder, e.g. "/files/modules/foo-module/magic.startup/create-slot.hl". All files inside of modules that exists within a "magic.startup" folder will be executed every time your web server restarts for some reasons.

How to use [slots.create]

Creates a dynamic slot that can be invoked using [signal]. Below is an example.

slots.create:foo
   return-value:int:57

Notice, the above slot aren't persisted in any ways, implying if your web server restarts its process, your slot is removed. If you want to make sure your slots becomes a permanent part of your application, you need to make sure you are somehow creating it during server startup, which can normally be done on a per module basis, by putting a Hyperlambda file into your module's "magic.startup" folder, which makes sure the code is executed during startup of your web app.

How to use [signal]

Invokes a previously created dynamic slot. Assuming you have created the foo slot from the create slot example, you can invoke the slot using the following Hyperlambda.

signal:foo

After evaluating the above Hyperlambda, the [signal] node will end up having a value of "57".

Notice - This slot obeys by the rules of [whitelist] invocations from magic.lambda, allowing you to declare a list of dynamic slots, which are exclusively allowed to be invoked temporarily inside of an invocation to whitelist, allowing you to restrict some piece of potentially unsafe code to only signal a pre-defined list of dynamically created slots. Below is an example.

slots.create:foo1
   return-value:Safe

slots.create:foo2
   return-value:Unsafe

whitelist

   vocabulary
      signal
      signal:foo1

   .lambda

      // Assuming you have a [foo1] slot created, this will work
      signal:foo1

      // This will throw, since [foo2] is not whitelisted
      signal:foo2

Basically, only the slots declared in the above [vocabulary] will be allowed to be invoked inside of the above [.lambda] object. You must have your dynamic slots declared as signal:slot-name, such as the above illustrates. And in order to signal dynamic slots at all, you'll need to (obviously) whitelist [signal] itself, as illustrated in the above code. Read more about [whitelist] in the magic.lambda project. Inside your slots though any [whitelist] invocations will simply be ignored, allowing you to whitelist a single dynamic slot, for then to ignore what the slot itself is doing internally. This might create security issues for you if you have dynamically created slots that for some reasons execute lambda object supplied to them. Hence as a general rule of thumb, you should avoid whitelisting slots that executes lambda objects supplied to them.

How to use [execute]

The [execute] slot is an alias for [signal], but it will [unwrap] all children nodes, automatically transform any expressions to their static value equivalents, allowing you to combine [unwrap] and [signal] into one invocation. This makes usage slightly less verbose for cases such as the following.

.args
   foo1:bar1
   foo2:bar2
execute:whatever-slot
   arg1:x:@.args/*/foo1
   arg2:x:@.args/*/foo2

In the above example both arguments to our "whatever-slot" invocation will be evaluated before the slot is invoked, resulting in [arg1] and [args2] having the values of "bar1" and "bar2" respectively.

If you pass in a node named [node_reference] using the above syntax, this node will be especially handled, and passed in by reference instead of evaluated as a single expression value. Consider the following alternative to the above.

.args
   foo1:bar1
   foo2:bar2
execute:whatever-slot
   node_reference:x:@.args

Inside your above "whatever-slot" you will now have access to the entire [.args] node by reference. It might help to execute the following to understand.

.args
   foo1:howdy
   foo2:world
slots.create:foo
   lambda2hyper:x:../*
   return:x:-
execute:foo
   node_reference:x:@.args/*

How to use [try-signal]

Invokes a previously created dynamic slot. This slots works exactly the same as [signal] except it does not throw an exception if the slot does not exist. Assuming you have created the foo slot from the create slot example, you can invoke the slot using the following Hyperlambda.

try-signal:foo

How to use [slots.get]

Returns the entire lambda code for a previously created dynamic slot. Example can be found below.

slots.create:foo
   return-value:int:57

slots.get:foo

How to use [slots.delete]

Deletes a previously created dynamic slot. The following example will throw an exception.

slots.create:foo
   return-value:int:57

slots.delete:foo

// Throws exception, since [foo] no longer exists.
slots.get:foo

How to use [return-nodes]

Returns a bunch of nodes (lambda) from your slot. Can only be invoked from the inside of a dynamically created slot, and other slots explicitly creating a return context. An example can be found below.

slots.create:foo
   return-nodes
      integer-value:int:57
      string-value:Foo bar

signal:foo

How to use [return-value]

Returns a single value from your slot. Can only be invoked from the inside of a dynamically created slot, and other slots explicitly creating a return context. An example can be found below.

slots.create:foo
   return-value:This becomes the returned value from your slot

signal:foo

How to use [slots.exists]

Returns true if the specified slot exists. Example can be found below.

slots.create:foo
   return-value:Blah, blah, blah ...

slots.exists:foo
slots.exists:DOES-NOT-EXISTS

How to use [slots.vocabulary]

Returns the names of all dynamically created slots to caller. Example can be found below.

slots.vocabulary

Magic's GitHub project page

Magic is 100% Open Source and you can find the primary project GitHub page here.

Project website for magic.lambda.slots

The source code for this repository can be found at github.com/polterguy/magic.lambda.slots, and you can provide feedback, provide bug reports, etc at the same place.

  • Build status
  • Quality Gate Status
  • Bugs
  • Code Smells
  • Coverage
  • Duplicated Lines (%)
  • Lines of Code
  • Maintainability Rating
  • Reliability Rating
  • Security Rating
  • Technical Debt
  • Vulnerabilities

The projects is copyright Thomas Hansen 2023 - 2024, and professionally maintained by AINIRO.IO.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on magic.lambda.slots:

Package Downloads
magic.library

Helper project for Magic to wire up everything easily by simply adding one package, and invoking two simple methods. When using Magic, this is (probably) the only package you should actually add, since this package pulls in everything else you'll need automatically, and wires up everything sanely by default. To use package go to https://polterguy.github.io

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
17.2.1 253 1/22/2024
17.2.0 82 1/22/2024
17.1.7 145 1/12/2024
17.1.6 115 1/11/2024
17.1.5 133 1/5/2024
17.0.1 172 1/1/2024
17.0.0 322 12/14/2023
16.11.5 315 11/12/2023
16.9.0 330 10/9/2023
16.7.0 532 7/11/2023
16.4.1 363 7/2/2023
16.4.0 352 6/22/2023
16.3.1 329 6/7/2023
16.3.0 308 5/28/2023
16.1.9 641 4/30/2023
15.10.11 467 4/13/2023
15.9.1 587 3/27/2023
15.9.0 462 3/24/2023
15.8.2 527 3/20/2023
15.7.0 390 3/6/2023
15.5.0 1,576 1/28/2023
15.2.0 698 1/18/2023
15.1.0 1,150 12/28/2022
14.5.7 712 12/13/2022
14.5.5 795 12/6/2022
14.5.1 654 11/23/2022
14.5.0 600 11/18/2022
14.4.5 704 10/22/2022
14.4.1 727 10/22/2022
14.4.0 634 10/17/2022
14.3.1 1,234 9/12/2022
14.3.0 631 9/10/2022
14.1.3 923 8/7/2022
14.1.2 637 8/7/2022
14.1.1 670 8/7/2022
14.0.14 691 7/26/2022
14.0.12 667 7/24/2022
14.0.11 634 7/23/2022
14.0.10 625 7/23/2022
14.0.9 667 7/23/2022
14.0.8 718 7/17/2022
14.0.5 767 7/11/2022
14.0.4 783 7/6/2022
14.0.3 714 7/2/2022
14.0.2 641 7/2/2022
14.0.1 673 7/2/2022
14.0.0 649 6/25/2022
13.4.0 2,001 5/31/2022
13.3.4 1,402 5/9/2022
13.3.0 906 5/1/2022
13.2.0 1,130 4/21/2022
13.1.0 1,008 4/7/2022
13.0.0 705 4/5/2022
11.0.7 1,108 3/10/2022
11.0.5 805 3/2/2022
11.0.4 732 2/22/2022
11.0.3 783 2/9/2022
11.0.2 758 2/6/2022
11.0.1 776 2/5/2022
10.0.21 742 1/28/2022
10.0.20 723 1/27/2022
10.0.19 743 1/23/2022
10.0.18 715 1/17/2022
10.0.15 960 12/31/2021
10.0.14 587 12/28/2021
10.0.8 1,210 12/22/2021
10.0.7 583 12/22/2021
10.0.5 725 12/18/2021
9.9.9 1,623 11/29/2021
9.9.3 898 11/9/2021
9.9.2 616 11/4/2021
9.9.0 790 10/30/2021
9.8.9 674 10/29/2021
9.8.7 636 10/27/2021
9.8.6 630 10/27/2021
9.8.5 656 10/26/2021
9.8.0 1,334 10/20/2021
9.7.9 582 10/19/2021
9.7.5 1,459 10/14/2021
9.7.0 814 10/9/2021
9.6.6 1,204 8/14/2021
9.2.0 6,158 5/26/2021
9.1.4 1,272 4/21/2021
9.1.0 1,003 4/14/2021
9.0.0 887 4/5/2021
8.9.9 1,021 3/30/2021
8.9.3 1,531 3/19/2021
8.9.2 1,038 1/29/2021
8.9.1 1,000 1/24/2021
8.9.0 1,104 1/22/2021
8.6.9 3,063 11/8/2020
8.6.6 1,972 11/2/2020
8.6.0 3,996 10/28/2020
8.5.0 1,881 10/23/2020
8.4.2 3,456 10/16/2020
8.4.1 1,200 10/16/2020
8.4.0 1,991 10/13/2020
8.3.1 2,648 10/5/2020
8.3.0 1,247 10/3/2020
8.2.2 2,008 9/26/2020
8.2.1 1,312 9/25/2020
8.2.0 1,369 9/25/2020
8.1.17 6,765 9/13/2020
8.1.16 546 9/13/2020
8.1.15 1,225 9/12/2020
8.1.11 3,154 9/11/2020
8.1.10 674 9/6/2020
8.1.9 1,971 9/3/2020
8.1.8 1,293 9/2/2020
8.1.7 1,197 8/28/2020
8.1.4 1,187 8/25/2020
8.1.3 1,287 8/18/2020
8.1.2 1,183 8/16/2020
8.1.1 1,244 8/15/2020
8.1.0 569 8/15/2020
8.0.1 2,708 8/7/2020
8.0.0 1,220 8/7/2020
7.0.1 1,294 6/28/2020
7.0.0 1,312 6/28/2020
5.0.1 2,083 5/30/2020
5.0.0 6,048 2/25/2020
4.0.4 7,901 1/27/2020
4.0.3 1,198 1/27/2020
4.0.2 1,342 1/16/2020
4.0.1 1,363 1/11/2020
4.0.0 1,350 1/5/2020
3.1.1 4,184 12/4/2019
3.1.0 2,772 11/10/2019
3.0.0 3,839 10/23/2019
2.0.3 4,373 10/18/2019
2.0.2 1,808 10/18/2019
2.0.1 3,373 10/15/2019
2.0.0 1,623 10/13/2019
1.1.9 1,353 10/11/2019
1.1.8 1,292 10/10/2019
1.1.7 602 10/9/2019
1.1.6 593 10/7/2019
1.1.5 600 10/6/2019
1.1.4 549 10/6/2019
1.1.2 583 10/5/2019