IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesCorel ParadoxLanguage Details  Print This     

Cross Ref > Language Details

By Mike Prestwood

Corel Paradox versus JavaScript: A side by side comparison between Corel Paradox and JavaScript.

 
Language Details
 

Language Details is kind of a catch all for stuff that didn't make it into language basics nor any other category.

Custom Routines

[Other Languages] 

Languages Focus

For non-OOP languages, a custom routine is a function, procedure, or subroutine and for pure OOP languages, a custom routine is a class method. Hybrid languages (both non-OOP and OOP) combine both.

Corel Paradox:   method, procedure

ObjectPAL is a non-OOP language (an object-based language) that offers custom methods and custom procedures. When you create a custom method, you associate it with an existing object like a button, form, or library.

When calling a custom method or procedure that has a by reference parameter (uses var), then you cannot use a literal value. this is different than in many other languages which do allow you to pass literals by reference.

Syntax Example:
method sayHello(var pName String)
 msgInfo("", "Hello " + pName)
endMethod

method add(p1 Number, p2 Number) Number
 Return p1 + p2
endMethod
JavaScript:   function

JavaScript uses functions and loosely typed parameters. Function definitions must come before their usage so the usual preference when adding JavaScript to HTML pages is to include them between the head tags.

Syntax Example:
function SayHello(pName) {
 document.write("Hello " + pName + "<br>");
}
 
function add(p1, p2) {
 var result;
 
 result = p1 + p2;
 return result;
}




Event Handler

[Other Languages] 

In computer programming, an event handler is part of event driven programming where the events are created by the framework based on interpreting inputs. Each event allows you to add code to an application-level event generated by the underlying framework, typically GUI triggers such as a key press, mouse movement, action selection, and an expired timer. In addition, events can represent data changes, new data, etc. Specifically, an event handler is an asynchronous callback subroutine that handles inputs received in a program.

A custom event is a programmer created event. For example, you can contrast an event handler with a member event, an OOP concept where you add an event to a class.

Languages Focus

Many development environments and compilers provide for event driven programming, a standard set of application events such as startup, end, on click of a button, etc. This section documents the applicaton event handler or an overview for each language.

For OOP languages, do not confuse this section with class member events discussed in the OOP Details section of our Cross Reference Coding Encyclopedia.

[Not specified yet. Coming...]
JavaScript: 

The JavaScript event handler contains events centered around the Document Object Model (DOM). Common events include onMouseOver and onMouseOut, onFocus and onBlur, onClick and onDblClick, onChange and onSelect, onLoad and onUnload.

For example, onMouseOver and onMouseOut are frequently used with websites to change an image when your mouse moves over it. The onClick event is used to trigger code upon a mouse click.

Syntax Example:

In the following example, we use a standard image tag set to an image, change it on mouse over, then set it back on mouse out.

<img id="Image1" src="i_search.gif"
 onmouseover="document.images['Image1'].src='i_coat.gif';"
 onmouseout="document.images['Image1'].src='i_search.gif';">




Inline Code

[Other Languages] 

Languages Focus

Also known as embedded code where you embed another syntax language within the native code of the development environment you are using. The inline code can be compiled by the current development's compiler or by an external compiler.

Do not confuse with inlining which is a coding technique where custom routines are moved inline where the code is executed either by you, by a compiler directive, or automatically by the compiler.

Corel Paradox:   Not Supported
[Not specified yet. Coming...]




Inlining

[Other Languages] 

General Info: Inline Routines

Instead of calling a routine, you move the code from the routine itself and expand it in place of the call. In addition to manual inlining, some languages support automatic inlining where the compiler or some other pre-compiler decides when to inline a code routine. Also, some languages allow for developer defined inlining where the developer can suggest and/or force the inlining of a code routine. Inlining can optimize your code for speed by saving a call and return, and parameter management.

Languages Focus

Does it support inlining? If so, does it support developer defined inlining? Does it support automatic inlining? Both?

Corel Paradox:   Not Supported
JavaScript:   Not Supported




Overloading

[Other Languages] 

Types of overloading include method overloading and operator overloading.

Method Overloading is where different functions with the same name are invoked based on the data types of the parameters passed or the number of parameters. Method overloading is a type of polymorphism and is also known as Parametric Polymorphism.

Operater Overloading allows an operator to behave differently based on the types of values used. For example, in some languages the + operator is used both to add numbers and to concatenate strings. Custom operator overloading is sometimes referred to as ad-hoc polymorphism.

Corel Paradox: 

Paradox & Overloading

  • Operator - No.
  • Method - No.

However, you can have the same named method or procedure so long as they are in different libraries. This is important if you use libraries in a class-like OOP way and wish to implement some form of polymorphism (i.e. libMember.Open and libVendor.Open). This is an OOP-like technique for implementing a subtyping-like polymorphism which is also known as inclusion polymorphism.

Also, some developers like to pass an array and then handle the array for a pseudo technique. Although not overloading, it's useful.

JavaScript: 

JavaScript Overloading

  • Operator - No.
  • Method -
Syntax Example:

 





Parameters

[Other Languages] 
Corel Paradox:   var, const

By Reference or Value (and by constant)
The default for parameters is by value. For by reference, add var in front of the parameter. ObjectPAL also offers constant parameters where you add const in front of the parameter. A constant parameter is like a read-only parameter the compiler can optimize. You cannot assign a value to a constant parameter.

Syntax Example:  
method cmCode(s String) ;...s is by value.
endMethod
 
  
method pushButton(var eventInfo Event)
  ;...eventInfo is by reference.
endMethod
  
method cmCode(Const s String)
  ;...s is a constant read-only parameter.
endMethod
  
proc cpNever() String
  return "Never duplicate a line of code!"
endProc

[Not specified yet. Coming...]




Self Keyword

[Other Languages] 
Corel Paradox:   Self

A built-in object variable that represents the UIObject to which the currently executing code is attached.

Syntax Example:  
method pushButton(var eventInfo Event)
  msgInfo("", self.Name)
endMethod
[Not specified yet. Coming...]




Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]