Update page 'Future P# Versions'
@@ -3,32 +3,24 @@ This document describes an ideas for future versions of P# language specificatio
|
|||||||
|
|
||||||
* Pointers support
|
* Pointers support
|
||||||
* Turn void data-type into a general purpose pointer variable
|
* Turn void data-type into a general purpose pointer variable
|
||||||
* Enumeration support
|
|
||||||
* Namespace support
|
* Namespace support
|
||||||
* Operator overloading
|
* Operator overloading
|
||||||
|
|
||||||
## Enumerators
|
|
||||||
<%
|
|
||||||
enum color = {'red', 'green', 'blue'};
|
|
||||||
color $mycol = 'red';
|
|
||||||
switch($mycol) {
|
|
||||||
case 'red':
|
|
||||||
case 'green':
|
|
||||||
case 'blue':
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
||||||
## Structures
|
### Data Structures
|
||||||
|
A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures can be declared in P# using the following syntax:
|
||||||
|
|
||||||
<%
|
<%
|
||||||
struct data {
|
struct data {
|
||||||
string fname;
|
string fname;
|
||||||
string lname;
|
string lname;
|
||||||
int age;
|
int age;
|
||||||
}
|
} $person1, $person2;
|
||||||
data $person;
|
struct data $person3;
|
||||||
|
|
||||||
$person.fname = 'Martin';
|
$person.fname = 'Martin';
|
||||||
$person.lname = 'Smith';
|
$person.lname = 'Smith';
|
||||||
$person.age = 27;
|
$person.age = 27;
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
Structure members can be access by using a dot operator (.). The arrow operator cannot be used because a structure is not an object.
|
||||||
|
|||||||
Reference in New Issue
Block a user