Recent

Author Topic: TODO ToDoesn't  (Read 4121 times)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TODO ToDoesn't
« Reply #15 on: July 10, 2019, 05:31:52 pm »
IA question of point of view, I guess ;)
Yes, the extra effort of typing a dollar sign can be a point of view?  :D :D :D :D

Nah, I mean deciding whether something merits a warning from the compiler or a TODO note suffices.
Also, if one looks closely, a TODO is more work than a simple $warning ;D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Kays

  • Hero Member
  • *****
  • Posts: 574
  • Whasup!?
    • KaiBurghardt.de
Re: TODO ToDoesn't
« Reply #16 on: July 10, 2019, 06:19:33 pm »
[…] {$warning this needs to be implemented or is a hack}[…]
Also, there exist hint directives like
  • unimplemented or
  • experimental.
Yours Sincerely
Kai Burghardt

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
Re: TODO ToDoesn't
« Reply #17 on: July 12, 2019, 04:08:57 am »
I actually mean something different: not a {todo}, but using user defined hints, warnings or errors.
Some todo's need a hint, {$hint this is not fully implemented}
Some todo's need a warning, {$warning this needs to be implemented or is a hack}
Some todo's must generate an error. {$error  this is not finished}

See?

If you use these very obvious tools, you can create a "todo'" that the compiler itself warns you for or even stop compiling if the code really needs to be completed.

E.g:
Code: Pascal  [Select][+][-]
  1. program testtodo;
  2. {$mode objfpc}
  3. uses
  4.   Sysutils,Classes;
  5. var
  6.   S: TStringList;
  7.  
  8. begin
  9.   {$hint need explanation}
  10.   S := TStringList.Create;
  11.   S.LoadFromFile('test.pas',TEncoding.Utf8);
  12.   writeln(S.Text);
  13.   {$warning no free yet}
  14.   S.Free;
  15.   {$error this is not finished yet, get back to work}
  16. end.

Outputs:
Code: Bash  [Select][+][-]
  1. Compiling test.pas
  2. test.pas(11,4) Hint: User defined: need explanation
  3. test.pas(15,4) Warning: User defined: no free yet
  4. test.pas(17,4) Error: User defined: this is not finished yet, get back to work
  5. test.pas(19) Fatal: There were 1 errors compiling module, stopping
  6. Fatal: Compilation aborted
  7.  

There's your todo's......

Toodles,

Thaddy


Yes, I know about $Hints, however they can be filtered upon compile.

$Warning is new to me.
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
Re: TODO ToDoesn't
« Reply #18 on: July 12, 2019, 04:12:18 am »
I think both have its uses, depending on the circumstances. If you're not really happy with somethng you can add a:
Code: Pascal  [Select][+][-]
  1. { TODO : Not really happy with this; merits a little more thought for the revision}
but if you added a kluge somewhere because you were in a hurry a
Code: Pascal  [Select][+][-]
  1. {$WARNING Terrible kluge combined with magic here! Set to rights ASAP!}
might be more appropiate.

A question of point of view, I guess ;)

Ahhh, a new term kluge [kludge]. I had to look that up.

ToDos Vs $Hint & $Warning:

* You can click on a ToDo and it will take you to the code.

B
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

 

TinyPortal © 2005-2018