evincarofautumn / Hap

Licence: other
A simple concurrent programming language.

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects
shell
77523 projects
perl
6916 projects

Projects that are alternatives of or similar to Hap

public-speaking
🎤 List of presentation, volunteer and initiatives
Stars: ✭ 11 (-42.11%)
Mutual labels:  events
snap
Snap Programming Language
Stars: ✭ 20 (+5.26%)
Mutual labels:  asynchronous-programming
GoblinDB
Fear the Goblin! - An amazing, simple and fun database for humans
Stars: ✭ 54 (+184.21%)
Mutual labels:  events
go-observer
Go package for simplifying channel-based broadcasting of events from multiple publishers to multiple observers
Stars: ✭ 66 (+247.37%)
Mutual labels:  events
hertzy
Event bus channel
Stars: ✭ 48 (+152.63%)
Mutual labels:  events
SocketIOUnity
A Wrapper for socket.io-client-csharp to work with Unity.
Stars: ✭ 69 (+263.16%)
Mutual labels:  events
continuous-analytics-examples
A collection of examples of continuous analytics.
Stars: ✭ 17 (-10.53%)
Mutual labels:  events
agones-event-broadcaster
Broadcast Agones GameServers and Fleets states to the external world
Stars: ✭ 22 (+15.79%)
Mutual labels:  events
ngx-event-modifiers
Event Modifiers for Angular Applications https://netbasal.com/implementing-event-modifiers-in-angular-87e1a07969ce
Stars: ✭ 14 (-26.32%)
Mutual labels:  events
SEPA
Get notifications about changes in your SPARQL endpoint.
Stars: ✭ 21 (+10.53%)
Mutual labels:  events
asyncoro
Python framework for asynchronous, concurrent, distributed, network programming with coroutines
Stars: ✭ 50 (+163.16%)
Mutual labels:  asynchronous-programming
event-emitter
Event Emitter module for Nest framework (node.js) 🦋
Stars: ✭ 102 (+436.84%)
Mutual labels:  events
VLCTechHub-site
VLCTechHub site
Stars: ✭ 23 (+21.05%)
Mutual labels:  events
sse
HTML5 Server-Sent-Events for Go
Stars: ✭ 84 (+342.11%)
Mutual labels:  events
dom-locky
🙈🙉🙊 - the best way to scope a scroll, or literally any other event.
Stars: ✭ 18 (-5.26%)
Mutual labels:  events
PoShLog
🔩 PoShLog is PowerShell cross-platform logging module. It allows you to log structured event data into console, file and much more places easily. It's built upon great C# logging library Serilog - https://serilog.net/
Stars: ✭ 108 (+468.42%)
Mutual labels:  events
watermill-amqp
AMQP Pub/Sub for the Watermill project.
Stars: ✭ 27 (+42.11%)
Mutual labels:  events
fs2-es
Event sourcing utilities for FS2
Stars: ✭ 75 (+294.74%)
Mutual labels:  events
ShenScript
Shen for JavaScript
Stars: ✭ 40 (+110.53%)
Mutual labels:  asynchronous-programming
PSEventViewer
PSEventViewer (Get-Events) is really useful PowerShell wrapper around Get-WinEvent. One of the features you may be interested in is a simple way of getting “hidden” events data
Stars: ✭ 74 (+289.47%)
Mutual labels:  events

Hap

Hap is a dynamically typed, asynchronous, imperative programming language.

This is the original C++ prototype, which is no longer maintained; it’s superseded by the new Haskell implementation of Hap, which has an improved performance model and a graphical mode.

Here is a simple example of Hap’s syntax and semantics:

var health = 100;

when (health <= 0) {
  print("Goodbye, cruel world!");
  exit;
}

print("Hello, sweet world!");

while (true)
  health = health - 1;

Hap code reads much like code in other imperative languages. Its syntax is reminiscent of JavaScript. However, note the use of when: this is an asynchronous conditional. The above code prints:

Hello, sweet world!
Goodbye, cruel world!

Synchronous flow control statements such as if, while, and for are evaluated immediately. If the condition is true when the statement is reached, then the body is evaluated immediately, before proceeding to subsequent statements.

Asynchronous flow control statements such as when are evaluated concurrently. The flow of control proceeds to subsequent statements immediately; only when the conditional actually becomes true is the body evaluated.

This allows programs to be structured implicitly in terms of events and time-based constraints. You are not forced to subscribe to event handlers for predefined conditions—rather, you can create ad-hoc conditions as needed, and this is syntactically lightweight.

Types

TypeExamples
int
0
1234
bool
false
true
text
""
"scare"
list
[]

[1, 2, 3, 4, 5]

[ "this", "that", "and", "the", "other", "thing", ]

[ [ +cos(x), -sin(x) ], [ +sin(x), +cos(x) ] ]

[0, false, ""]

map
{}

{ "one": 1, "two": 2, "three": 3 }

[ { en: "one", fr: "un", }, { en: "two", fr: "deux", }, { en: "three", fr: "trois", }, ]

Statements

General

StatementDescription
var NAME;
var NAME = EXPR;
Creates a lexically scoped variable named NAME. Initializes it to EXPR, or gives it an initial value of undef if EXPR is not specified.
fun NAME(PARAM, PARAM, ...) STAT
Creates a lexically scoped function named NAME with a body given by STAT using the given parameters.
EXPR;
Synchronous. Evaluates EXPR and discards the result.
{ STAT... }
Synchronous. Evaluates a block of statements as a unit. Introduces a new lexical scope.
exit
Exits the program entirely.
last
Exits the current loop.
next
Jumps to the next iteration of the current loop, re-evaluating the loop condition.
redo
Redoes the current iteration of the current loop, without re-evaluating the loop condition (or step, in the case of for).

Flow Control

Statement Synchronicity How many times STAT is evaluated When STAT is evaluated
if EXPR STAT
Synchronous Once If EXPR is true when the statement is reached.
when EXPR STAT
Asynchronous Once The first time EXPR becomes true; immediately if EXPR is already true.
whenever EXPR STAT
Asynchronous Once Every time EXPR becomes true; immediately if EXPR is already true.
while EXPR STAT
Synchronous Repeatedly As long as EXPR remains true; never if EXPR is already false.
for (INIT; COND; STEP) STAT
Synchronous Repeatedly

Equivalent to:

INIT;
while (COND) {
  STAT;
  STEP;
}

Except that variables declared in INIT are local to the loop, and STEP is evaluated even when the next statement is used.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].