Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

Dot Product Operator

We may introduce a dot product operator in a future revision as follows:

The Dot Product Operator

Symbol *. denotes the dot product operator. It is left associative and requires two operands.

Example:

 dotProduct := v1 *. v2; (* dot product *)

The operator always represents the dot product operation. Its operands must be of a vector type with a cardinality of three and they must be type compatible. Its result type is the vector's component type. Any use of the operator with operands that do not meet these conditions shall cause a compile time error. The dot product operator is bindable.

The operator might have precedence level-4, or an additional precedence level might be required above level-3 as it is a currently unresolved problem to have a dot product operator and an exponentiation operator both on the same precedence level because dot product cannot be repetitive, while exponentiation should ideally be repetitive. Potential solutions/alternatives are best tried out in a working compiler.