Update page 'Future P# Versions'
@@ -3,32 +3,24 @@ This document describes an ideas for future versions of P# language specificatio
|
||||
|
||||
* Pointers support
|
||||
* Turn void data-type into a general purpose pointer variable
|
||||
* Enumeration support
|
||||
* Namespace support
|
||||
* 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 {
|
||||
string fname;
|
||||
string lname;
|
||||
int age;
|
||||
}
|
||||
data $person;
|
||||
} $person1, $person2;
|
||||
struct data $person3;
|
||||
|
||||
$person.fname = 'Martin';
|
||||
$person.lname = 'Smith';
|
||||
$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