April 20, 2024, 10:39:26 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Design of included libraries

Started by Ionic Wind Support Team, November 01, 2005, 01:22:58 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Ionic Wind Support Team

As we get closer to an alpha release I thought I would mention my design methodology of the Aurora standard libraries.

Aurora itself is a compiler with only 20 or so keywords.  Additional functionality is provided by static libraries of functions.  Much like the C runtime library.  These libraries are included on each build automatically and don't add any code to your executable unless you use any of the included functions.  Actually the compiler scans a directory for '.inc' files and those .inc files has whatever #use statement is necessary to automatically add the static library to the build.  Similar to the Pro compiler include files, but less esoteric.

This was also done for portability.  The "console.lib" library provides a basic set of functions for dealing with shell programs.


cls();
writeln("enter your name >");
name = readln();
writeln("hello " + name + "\n");
writeln("Press any key\n");
while GetKey() = "";


Keeping it simple is key here.   'writeln' for example does just what it implies..writes a string to the console exactly as written.  The problem with a generic PRINT statement is it is up to the designer to guess at all possible forms of output, and how that output shuld be presented.  Formatting output should be the job of more specialized functions like 'using'

writlln(using("###.##\n",myvar));

Which then gives us more control.  Such as when to insert a newline character or not.

All of the Aurora standard library functions follow this methodology.  If there is a function where output, or input, can be represented in multiple forms, then the decision is left up to the programmer, and not the compiler.

Paul.

Ionic Wind Support Team

Steven Picard

I am not sure what kind of string and date functions you plan on having.  One thing I did at work back when I first learned JAVA and JavaScript was to write functions that mimiced VB's.  So I would create MID, LEFT, RIGHT, TRIM, LTRIM, RTRIM, REPLACE, INSTR, DateAdd, DateDiff, etc.  They were very popular and are still used by other programmers to this day (I used the creation of those functions as a learning tool.)  I'd be happy to do the same thing for Aurora and just release it as an .inc file for the benefit of others.

Ionic Wind Support Team

The string library is at least as complete as Pro's.

Still finalizing funciton names.

Paul.
Ionic Wind Support Team