dtrg avatar dtrg committed adc042f

Rearrange so the interfaces are at the top.

Comments (0)

Files changed (1)

include/Stdlib.ch

 
 /* This file must always be included first; defines the various primitive
  * types everything else uses. */
- 
+
+/* Interfaces which the cowbel primitive types adhere to. Note that boxing
+ * and unboxing isn't support yet; don't try to implement these in your own
+ * code. It won't work. */
+  
 type int = {
 	function - (): int;
 	function + (o: int): int;
 	function toReal(): real;
 };
 
+type real = {
+	function - (): real;
+	function + (o: real): real;
+	function - (o: real): real;
+	function * (o: real): real;
+	function / (o: real): real;
+	
+	function == (o: real): boolean;
+	function != (o: real): boolean;
+	function < (o: real): boolean;
+	function <= (o: real): boolean;
+	function > (o: real): boolean;
+	function >= (o: real): boolean;
+	
+	function toString(): string;
+};
+
+type string = {
+	function + (o: string): string;
+	
+	function == (o: string): boolean;
+	function != (o: string): boolean;
+	function < (o: string): boolean;
+	function <= (o: string): boolean;
+	function > (o: string): boolean;
+	function >= (o: string): boolean;
+};
+
+type boolean = {
+	function == (o: boolean): boolean;
+	function != (o: boolean): boolean;
+	
+	function ! (): boolean;
+	function & (o: boolean): boolean;
+	function | (o: boolean): boolean;
+	function ^ (o: boolean): boolean;
+	
+	function toString(): string;
+};
+
+type __extern = {
+	function isNull(): boolean;
+};
+
+/* ----------------------------------------------------------------------- */
+
+/* Implementations of the above. The variable names are magic and are 
+ * used internally by the compiler. */
+ 
 var int = {
 	type extern "s_int_t";
 	implements int;
 		{ r=extern(real); extern "${r} = self;"; }
 };
 
-type real = {
-	function - (): real;
-	function + (o: real): real;
-	function - (o: real): real;
-	function * (o: real): real;
-	function / (o: real): real;
-	
-	function == (o: real): boolean;
-	function != (o: real): boolean;
-	function < (o: real): boolean;
-	function <= (o: real): boolean;
-	function > (o: real): boolean;
-	function >= (o: real): boolean;
-	
-	function toString(): string;
-};
-
 var real = {
 	type extern "s_real_t";
 	implements real;
 		{ r=extern(string); extern "S_METHOD_REAL_TOSTRING(self, &${r});"; }
 };
 
-type string = {
-	function + (o: string): string;
-	
-	function == (o: string): boolean;
-	function != (o: string): boolean;
-	function < (o: string): boolean;
-	function <= (o: string): boolean;
-	function > (o: string): boolean;
-	function >= (o: string): boolean;
-};
-
 var string = {
 	type extern "s_string_t*";
 	implements string;
  		{ r=extern(boolean); extern "${r} = s_string_cmp(self, ${o}) >= 0;"; }
 };
 
-type boolean = {
-	function == (o: boolean): boolean;
-	function != (o: boolean): boolean;
-	
-	function ! (): boolean;
-	function & (o: boolean): boolean;
-	function | (o: boolean): boolean;
-	function ^ (o: boolean): boolean;
-	
-	function toString(): string;
-};
-
 var boolean = {
 	type extern "s_boolean_t";
 	implements boolean;
 		{ r = extern(string); extern "${r} = self ? &s_true_label : &s_false_label;"; }
 };
 
-type __extern = {
-	function isNull(): boolean;
-};
-
 var __extern = {
 	type extern "void*";
 	implements __extern;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.