I have Delphi and Pascal, and im a 'PRO' in pascal but I know nothing in Delphi!
If the Code of Delphi is like Pascal why when I load a program i made in Pascal it shows alot of errors?? and instead of a form can you use the shell ( Ms-DOS ) as PASCAL does?
Delphi/Pascal?
Started by TcM, Aug 22 2006 03:12 AM
7 replies to this topic
#1
Posted 22 August 2006 - 03:12 AM
|
|
|
#2
Posted 23 August 2006 - 03:49 PM
Delphi the language is two things: a language called Object Pascal (Pascal + OOP), and a library for doing GUI work. Delphie the product is the language plus a RAD environment.
Because Delphi is a descendent of Pascal, it doesn't work the same way, and Pascal code won't compile under a Delphi compiler. They have different expectations.
Because Delphi is a descendent of Pascal, it doesn't work the same way, and Pascal code won't compile under a Delphi compiler. They have different expectations.
#3
Posted 24 August 2006 - 12:44 AM
Oww, so they are not like each other but not exactly! Delphi has some more things!
Thanks!
Thanks!
#4
Posted 24 August 2006 - 04:35 PM
Check out the Lazarus Projectif you'd like to try an open-source clone of Delphi.
#5
Posted 25 August 2006 - 05:15 AM
Thanks I will give it a look!
#6
Posted 04 September 2006 - 12:45 PM
WingedPanther said:
Check out the Lazarus Projectif you'd like to try an open-source clone of Delphi.
Never heard of this until now! I'm looking into it now, looks neat.
#7
Posted 28 March 2007 - 04:43 AM
Hi!
Please give some code. Propably You haven't use libraries. In Delphi You have another lik in pascal. f.eg. you don't use Crt but SysUtils ;)
Please give some code. Propably You haven't use libraries. In Delphi You have another lik in pascal. f.eg. you don't use Crt but SysUtils ;)
#8
Posted 11 April 2007 - 09:23 AM
All variables in Delphi Script are always of Variant type. Typecasting is ignored.
Types in variables declaration are ignored and can be skipped, so these declarations are correct:
var a : integer;
var b : integerr;
var c, d;
Types of parameters in procedure/function declaration are ignored and can be skipped. For example, this code is correct:
function sum(a, b) : integer;
begin
result := a + b;
end;
Type of array elements is ignored and can be skipped so these declarations are equal:
var x : array [1..2] of double;
var x : array [1..2];
These keywords are ignored:
interface, implementation, program, unit
You can use them but they have no effect.
"in" directive in uses is ignored
Delphi Script doesn't support type declarations. It tries to skip them but
complex declarations may cause parser to fail.
^ and @ operators are not supported.
You can't use the function name to set the return value, use Result to do so.
Nested routines are supported but you can't use variables of top level function from the nested one.
The following keywords are not supported:
as, asm, class, dispinterface, exports, finalization, inherited, initialization, inline, interface, is, library, object, out, property, record, resourcestring, set, type
The following directives are not supported (note that some of them are obsolete and aren't supported by Delphi too):
absolute, abstract, assembler, automated, cdecl, contains, default, dispid, dynamic, export, external, far, implements, index, message, name, near, nodefault, overload, override, package, pascal, private
protected, public, published, read, readonly, register, reintroduce, requires, resident, safecall, stdcall, stored, virtual, write, writeonly
These RTL functions aren't supported in Delphi Script:
Abort, Addr, Assert, Dec, FillChar, Finalize, Hi, High, Inc, Initialize, Lo, Low, New, Ptr, SetString, SizeOf, Str, UniqueString, VarArrayRedim, VarArrayRef, VarCast, VarClear, VarCopy
Open array declaration is not supported.
CASE can be used for any types. So you can write
case UserName of
'Alex', 'John' : IsAdministrator := true;
'Peter' : IsAdministrator := false;
else
raise('Unknown user');
end;
Raise can be used without parameters to re-raise the last exception. You can also use Raise with string parameter to raise the exception with the specified message string. For example,
Raise(Format('Invalid value : %d', [Height]));
Threadvar keyword is treated as Var
[...] set constructors are not supported. You can use MkSet to create a set. For example,
Font.Style := MkSet(fsBold, fsItalic);
Set operator In is not supported. Use InSet to check whether a value is a member of set. For example,
if InSet(fsBold, Font.Style) then
ShowMessage('Bold');
Note, that set operators '+', '-', '*', '<=', '>=' don't work correctly. You have to use logical operators. For example,
ASet := BSet + CSet; should be changed to ASet := BSet or CSet;
CreateObject can be used to create objects that will be implicitly freed when no longer used. So instead of
procedure proc;
var l;
begin
l := TList.Create;
try
// do something with l
finally
l.Free;
end;
end;
you can write
procedure proc;
var l;
begin
l := CreateObject(TList);
// do something with l
end;
Built in function Evaluate can be used to interpret string as program code during runtime of a program and execute the code contained in the string. For example, you can write script like Evaluate(ProcNames[ProcIndex]);
and the procedure which name is specified in ProcNames[ProcIndex] will be called.
Built in directive UseUnit can be used to dynamically add to uses section any unit at runtime. For example, the following script
if FileExists('Update.pas') then
begin
UseUnit('Update.pas');
Evaluate('Update.DoUpdate');
end;
checks whether the unit named Update.pas exists and if so calls DoUpdate method from there.
UnloadUnit directive unloads any unit added by "uses" section or with UseUnit call.
Types in variables declaration are ignored and can be skipped, so these declarations are correct:
var a : integer;
var b : integerr;
var c, d;
Types of parameters in procedure/function declaration are ignored and can be skipped. For example, this code is correct:
function sum(a, b) : integer;
begin
result := a + b;
end;
Type of array elements is ignored and can be skipped so these declarations are equal:
var x : array [1..2] of double;
var x : array [1..2];
These keywords are ignored:
interface, implementation, program, unit
You can use them but they have no effect.
"in" directive in uses is ignored
Delphi Script doesn't support type declarations. It tries to skip them but
complex declarations may cause parser to fail.
^ and @ operators are not supported.
You can't use the function name to set the return value, use Result to do so.
Nested routines are supported but you can't use variables of top level function from the nested one.
The following keywords are not supported:
as, asm, class, dispinterface, exports, finalization, inherited, initialization, inline, interface, is, library, object, out, property, record, resourcestring, set, type
The following directives are not supported (note that some of them are obsolete and aren't supported by Delphi too):
absolute, abstract, assembler, automated, cdecl, contains, default, dispid, dynamic, export, external, far, implements, index, message, name, near, nodefault, overload, override, package, pascal, private
protected, public, published, read, readonly, register, reintroduce, requires, resident, safecall, stdcall, stored, virtual, write, writeonly
These RTL functions aren't supported in Delphi Script:
Abort, Addr, Assert, Dec, FillChar, Finalize, Hi, High, Inc, Initialize, Lo, Low, New, Ptr, SetString, SizeOf, Str, UniqueString, VarArrayRedim, VarArrayRef, VarCast, VarClear, VarCopy
Open array declaration is not supported.
CASE can be used for any types. So you can write
case UserName of
'Alex', 'John' : IsAdministrator := true;
'Peter' : IsAdministrator := false;
else
raise('Unknown user');
end;
Raise can be used without parameters to re-raise the last exception. You can also use Raise with string parameter to raise the exception with the specified message string. For example,
Raise(Format('Invalid value : %d', [Height]));
Threadvar keyword is treated as Var
[...] set constructors are not supported. You can use MkSet to create a set. For example,
Font.Style := MkSet(fsBold, fsItalic);
Set operator In is not supported. Use InSet to check whether a value is a member of set. For example,
if InSet(fsBold, Font.Style) then
ShowMessage('Bold');
Note, that set operators '+', '-', '*', '<=', '>=' don't work correctly. You have to use logical operators. For example,
ASet := BSet + CSet; should be changed to ASet := BSet or CSet;
CreateObject can be used to create objects that will be implicitly freed when no longer used. So instead of
procedure proc;
var l;
begin
l := TList.Create;
try
// do something with l
finally
l.Free;
end;
end;
you can write
procedure proc;
var l;
begin
l := CreateObject(TList);
// do something with l
end;
Built in function Evaluate can be used to interpret string as program code during runtime of a program and execute the code contained in the string. For example, you can write script like Evaluate(ProcNames[ProcIndex]);
and the procedure which name is specified in ProcNames[ProcIndex] will be called.
Built in directive UseUnit can be used to dynamically add to uses section any unit at runtime. For example, the following script
if FileExists('Update.pas') then
begin
UseUnit('Update.pas');
Evaluate('Update.DoUpdate');
end;
checks whether the unit named Update.pas exists and if so calls DoUpdate method from there.
UnloadUnit directive unloads any unit added by "uses" section or with UseUnit call.
Like an angel without a sense of mercy.


Sign In
Create Account


Back to top









