Re: [fpc-pascal] When are used units recompiled? (wiki page added)

2006-04-10 Thread Tom Verhoeff
On Sun, Apr 09, 2006 at 10:58:09PM +0200, Giovanni Premuda wrote:
> Tom Verhoeff ha scritto:
> >This makes it much less attractive to release units without source
> >code.  That may be understandable from an open-source perspective,
> >but in teaching I find it useful or even necessary to provide units
> >without source code.
> >  
> IN TEACHING?

Why this shouting and bafflement?  Here are two reasons:

  *  In order to teach students to use services (=units) solely based on the
 contract (= specification), we withhold the implementation and
 only provide the compiled unit.  That way the implementation cannot
 be consulted (=abused).

  *  In some cases, the unit incorporates some "secrets", e.g. related
 to grading.  Consider e.g. an assignment where one has to
 develop an algorithm for finding the median of an odd number
 of distinct integers by using only a binary comparison operator.

 To enforce the use of only binary comparisons, we don't give them
 the set directly, but rather give them a unit, which "hides" the
 actual integers and provides the comparison operator.  Of course,
 this hidden set can be made inaccessible from the outside by putting
 it in the implementation part.  In that case, it might seem harmless
 to give away the source code.  However, there are more complications:
 e.g. where does the actual set come from?  It is not built into the unit,
 but read from a file, or generated via a random generator with a
 seed read from a file.  The data in the file is scrambled so that
 the students cannot simply read it and abuse that information.
 Unless you want to use sophisticated encryption techniques, it
 is easier to use a "proprietary" method and not give them the
 source code.

 In fact, the unit need not have a set of numbers to start with, but
 could construct a "worst case" scenario base on the actual sequence
 of operations carried out by the program (a so-called adversary).
 We don't want to give away the strategy of the adversary algorithm.

> Btw. no sane commercial Delphi developer has ever considered using a 
> component without source code at least since Delphi 2.0. Look at the 
> offering of component vendors and you will see that they invariably 
> offer source code licenses.

Most likely because the 'compatibility mechanism' is not very effective.
Compatibility is one of the big problems in component-based development.

Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL | Fac. of Math. & Computing Science
PHONE:  +31 40 247 41 25| Eindhoven University of Technology
FAX:+31 40 247 54 04| PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] When are used units recompiled? (wiki page added)

2006-04-10 Thread Marco van de Voort
> On Sun, Apr 09, 2006 at 10:58:09PM +0200, Giovanni Premuda wrote:
 
> > Btw. no sane commercial Delphi developer has ever considered using a 
> > component without source code at least since Delphi 2.0. Look at the 
> > offering of component vendors and you will see that they invariably 
> > offer source code licenses.
> 
> Most likely because the 'compatibility mechanism' is not very effective.

No, also to be able to maintain the component (fix bugs and look at the
implementation). Both the companies I did Delphi work for professionaly,
mandated full source for the components.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] When are used units recompiled? (wiki page added)

2006-04-10 Thread Michael Van Canneyt



On Mon, 10 Apr 2006, Marco van de Voort wrote:


On Sun, Apr 09, 2006 at 10:58:09PM +0200, Giovanni Premuda wrote:



Btw. no sane commercial Delphi developer has ever considered using a
component without source code at least since Delphi 2.0. Look at the
offering of component vendors and you will see that they invariably
offer source code licenses.


Most likely because the 'compatibility mechanism' is not very effective.


No, also to be able to maintain the component (fix bugs and look at the
implementation). Both the companies I did Delphi work for professionaly,
mandated full source for the components.


I would never buy or use components without sources. All components I
ever bought/downloaded contained bugs, without exception, and we can't
wait for the company to fix them.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] real numbers infinity

2006-04-10 Thread Dimitrios Apostolou

Hello list,

when a real number overflows the program halts with EInvalidOp error. 
How can I make the program behave the more standard way, where the 
variable gets the value "inf" and execution continues normally? This is 
vital for many tasks, like fractal computation.


example program:

$ cat realover.pas
program realover;
Uses variants;
var r:real;
BEGIN
r:=2;
while True do
begin
r:=r**2;
writeLn(r);
end;
END.


current output:

$ ./realover
 4.000E+000
 1.600E+001
 2.560E+002
 6.5536000E+004
 4.29496729600E+009
 1.844674407370955E+019
 3.402823669209385E+038
 1.157920892373162E+077
 1.340780792994260E+154
An unhandled exception occurred at $0805F1C6 :
EInvalidOp : Invalid floating point operation
  $0805F1C6
  $0805F895
  $08053CDF
  $08048182


desired output:

 4.000E+000
 1.600E+001
 2.560E+002
 6.5536000E+004
 4.29496729600E+009
 1.844674407370955E+019
 3.402823669209385E+038
 1.157920892373162E+077
 1.340780792994260E+154
inf
inf
inf

...


Thanks in advance,
Dimitris

P.S. Why when the program doesn't include the variants unit the program 
complains at runtime? What is that unit?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] real numbers infinity

2006-04-10 Thread Sasa Zeman
Dimitris,

> when a real number overflows the program halts with EInvalidOp error.
> How can I make the program behave the more standard way, where the
> variable gets the value "inf" and execution continues normally? This is
> vital for many tasks, like fractal computation.

You can use try..except..end block and switch -Sd when compile:

program realover;
Uses math;
var r:real;
BEGIN
   r:=2;
   while True do
   begin
 try
   r:=r**2;
   writeLn(r);
 except
   r:=infinity;
   writeLn(r);
   // break
 end;
  end;
END.

Or you may take a look IEEE specification if it is necessary to create your
own big float support for larger precision with fractals.

> P.S. Why when the program doesn't include the variants unit the program
> complains at runtime? What is that unit?

At windows, it is not necessary for this example. Variants unit provide new
type definition and supported functions, which can consist any simple type
(integer, string, etc).

Sasa

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Internal linker status

2006-04-10 Thread Sasa Zeman
> No. 2.0.2 is a release and it sources won't change. If the fix proves
> it's stability in 2.1.1, it will be merged back to 2.0.3 which will be
> the base for the next release: 2.0.4.

Yes, that would be necessary. A fix for 4922 is essencial.

> We used the GNU linker on win32 for years and it worked. We know that it
> has it's flaws but it isn't that bad after all.

On Windows platform with small ammount of phisical memory (<=128MB),
compiling is very inconveniente and slow. New internal linker should solve
that problem as well (as mentioned already).

Sasa

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal