Recent

Author Topic: Re: language improvement suggestions (the spin off)  (Read 16944 times)

440bx

  • Hero Member
  • *****
  • Posts: 4993
Re: language improvement suggestions (the spin off)
« Reply #105 on: November 29, 2019, 04:57:59 am »
Don't forget to mention https://en.wikipedia.org/wiki/Apple_Lisa  :-X and its successor Classic Mac OS.
Don't forget to mention that the entire graphics subsystem (QuickDraw) was _entirely_ written in assembler because their Pascal couldn't produce fast enough code.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10792
  • Debugger - SynEdit - and more
    • wiki
Re: language improvement suggestions (the spin off)
« Reply #106 on: November 29, 2019, 04:59:42 am »
Don't forget to mention https://en.wikipedia.org/wiki/Apple_Lisa  :-X and its successor Classic Mac OS.
Don't forget to mention that the entire graphics subsystem (QuickDraw) was _entirely_ written in assembler because their Pascal couldn't produce fast enough code.
Yes assembler is my secret to faster code too.

I compile all my Pascal code with -al to asm, and then build my exe from that, so it will be as fast as possible ;) ;)

440bx

  • Hero Member
  • *****
  • Posts: 4993
Re: language improvement suggestions (the spin off)
« Reply #107 on: November 29, 2019, 05:09:20 am »
I compile all my Pascal code with -al to asm, and then build my exe from that, so it will be as fast as possible ;) ;)
You should have shared that tip with Apple ;)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

del

  • Sr. Member
  • ****
  • Posts: 258
Re: language improvement suggestions (the spin off)
« Reply #108 on: November 29, 2019, 06:33:03 am »

Awright - first thing Monday morning I'll ask around: "Hey guys, done an operating system lately?". "Nah - we just use the store bought ones".
Don't forget to mention https://en.wikipedia.org/wiki/Apple_Lisa  :-X and its successor Classic Mac OS.

Um ... they're not funny if you have to explain them. But here goes: we don't do operating systems where I work. We do other stuff. That runs on operating systems. But we don't do operating systems. It's a subtle distinction - but it explains why nobody does C except for guys who are way past their shelf life - and they hand over their raggedy assed spaghetti code to the C++ guys, who transform it into something elegant, and beautiful. Anyway - we don't do operating systems. Thus the joke.

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: language improvement suggestions (the spin off)
« Reply #109 on: December 21, 2019, 11:43:30 am »
For more readable, can we have underscores in numeric literals?
at a cost of StringReplace

https://kotlinlang.org/docs/reference/basic-types.html

Code: Pascal  [Select][+][-]
  1. program test_underscore_literals;
  2. {$mode objfpc}
  3. {$h+}
  4. {$j-}
  5. uses SysUtils;
  6. {
  7. // ???
  8. const
  9.    RED   = $FF_00_00;
  10.    GREEN = $00_FF_00;
  11.    BLUE  = $00_00_FF;
  12. }  
  13. // for helper Parse or TryParse
  14. function Parse(const AString :String) :Int64;
  15.   var Check :Int32;
  16.   begin      
  17.          Val(StringReplace(AString, '_', '', [rfReplaceAll]), Result, Check);
  18.     if Check <> 0 then Result := 0;
  19.   end;
  20.  
  21. begin
  22.   WriteLn(Parse('1_000_000'));               // a million
  23.   WriteLn(Parse('1234_5678_9012_3456'));     // credit card number
  24.  
  25.   WriteLn(Parse('&755'));                    // chmod
  26.   WriteLn(Parse('%111_101_101'));            
  27.  
  28.   WriteLn(Parse('4_275_878_552'));                                // dec
  29.   WriteLn(Parse('$FE_DC_BA_98'));                                 // hex
  30.   WriteLn(Parse('&37_667_135_230'));                              // oct
  31.   WriteLn(Parse('%11111110_11011100_10111010_10011000'));         // bin
  32.   WriteLn(Parse('%1111_1110_1101_1100_1011_1010_1001_1000'));     // nible
  33. end.
  34.  

MarkMLl

  • Hero Member
  • *****
  • Posts: 8190
Re: language improvement suggestions (the spin off)
« Reply #110 on: December 21, 2019, 01:16:38 pm »
Quote
const
   RED   = $FF_00_00;
   GREEN = $00_FF_00;
   BLUE  = $00_00_FF;

As a slightly more general one, please can we have _ (with whitespace on both sides) as a secondary concatenation operator, so that applications can redefine + for array addition and _ for array concatenation.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12028
  • FPC developer.
Re: language improvement suggestions (the spin off)
« Reply #111 on: December 21, 2019, 02:08:46 pm »
Don't forget to mention https://en.wikipedia.org/wiki/Apple_Lisa  :-X and its successor Classic Mac OS.
Don't forget to mention that the entire graphics subsystem (QuickDraw) was _entirely_ written in assembler because their Pascal couldn't produce fast enough code.

Yeah, but in (IT) prehistoric times, this was also more worthwhile, since both the compilers and the processors were respectively less able and imposed stiff penalties. As said in the oberon/modula2 thread, in 386/486 times I even did the date time routines in assembler (though I have to mention that my main app at the time was a log processing one, with a datetimestamp on every line).

Just avoiding multiply and division (e.g. shifts or AAM or strength reduction changing multiply with repeated addition) and manual register allocation were usually the bulk of the gains.

However for graphics, assembler is still the norm. Most of my whole image conversions are done in SSE. A simple form, I don't try to optimize it too much, just try to do the core transformation in straightforward SSE.

E.g. a primitive for 8-bit image rotate

« Last Edit: December 21, 2019, 02:11:50 pm by marcov »

 

TinyPortal © 2005-2018