Recent

Author Topic: list of units without SysUtils/Classes uses  (Read 13819 times)

Awkward

  • Full Member
  • ***
  • Posts: 134
list of units without SysUtils/Classes uses
« on: June 21, 2016, 12:36:24 pm »
i know, it stupid but i don't like to uses Classes, SysUtils, Variants etc units because they adds lot of unusable (for me) crap. How can i easily get list of units/components which don't requires these units? Just to be sure what i can use and what i must to implement by myself.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: list of units without SysUtils/Classes uses
« Reply #1 on: June 21, 2016, 12:43:56 pm »
Refactoring menu has "Unused Units ...". It also offers to remove those unused units for you.
It is so useful feature that I have set a shortcut key for it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: list of units without SysUtils/Classes uses
« Reply #2 on: June 21, 2016, 12:52:22 pm »
i know, i know. but i mean what FPC have a LOT of ready useful things but some units links to SysUtils even for things which can be rewritten without such dependences. (it means what SysUtils REALLY used now)  that why i made small copy of FPC units directory with some source fixes to remove unneded units. and have my own "library" for simple things without "Classes" and "SysUtils" dependences. like "Base64" conversion for example.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: list of units without SysUtils/Classes uses
« Reply #3 on: June 21, 2016, 02:01:48 pm »
Ok, so FPC's library code has those unneeded dependencies. You can remove them and create a patch.
On the other hand it makes no difference really. Linker includes only the used parts from those units into your executable.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: list of units without SysUtils/Classes uses
« Reply #4 on: June 21, 2016, 02:15:42 pm »
Ok, so FPC's library code has those unneeded dependencies. You can remove them and create a patch.
On the other hand it makes no difference really. Linker includes only the used parts from those units into your executable.
you perfectly knows what linker can't do anything (by default) with initialization/finalization sections :(

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #5 on: June 21, 2016, 02:20:57 pm »
No there is no easy way. Most things that do someting will use one of these units.

E.g. base64 uses streams which are defined in classes.

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: list of units without SysUtils/Classes uses
« Reply #6 on: June 21, 2016, 02:26:01 pm »
No there is no easy way. Most things that do someting will use one of these units.

E.g. base64 uses streams which are defined in classes.
i know about streams. but what about base64 realization without streams but with memory buffers only? I mean, base64 algorithm  by itself don't have any SysUtils requirements

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: list of units without SysUtils/Classes uses
« Reply #7 on: June 21, 2016, 09:55:33 pm »
It's kinda hard. Those two units provide too much useful things that most other units have dependencies on. If you're looking for "list of units/components which don't requires these units" I believe the answer is:
  • components: none (components use streaming, streaming is provided by TPersistent, TPersistent is defined in Classes unit)
  • units: most rtl units

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: list of units without SysUtils/Classes uses
« Reply #8 on: June 21, 2016, 10:15:18 pm »
It's kinda hard. Those two units provide too much useful things that most other units have dependencies on. If you're looking for "list of units/components which don't requires these units" I believe the answer is:
  • components: none (components use streaming, streaming is provided by TPersistent, TPersistent is defined in Classes unit)
  • units: most rtl units

That why i got this question. I going mad when i want to use 1-2 functions which implemented in SysUtils or another units already and i know what it safe and don't want to keep lot of useless stuff in my programs

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #9 on: June 21, 2016, 10:29:44 pm »
i know about streams. but what about base64 realization without streams but with memory buffers only?

A TMemoryStream is a memory buffer.

Quote
I mean, base64 algorithm  by itself don't have any SysUtils requirements

Nothing has. You can etch assembler into ice with an old walrus tooth if you want the ultimate minimalism price. There is just no point.

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: list of units without SysUtils/Classes uses
« Reply #10 on: June 21, 2016, 10:57:18 pm »
Assembler  is for critical places ^_^ but why i must to keep exception handler, for example, if i don't need it? why i getting 200+ Kb data+code if i don't use even byte from it? That the problem, what i must write my own code or cut code from otheur units just to avoid useless data

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: list of units without SysUtils/Classes uses
« Reply #11 on: June 21, 2016, 11:14:45 pm »
I going mad when i want to use 1-2 functions which implemented in SysUtils or another units already and i know what it safe and don't want to keep lot of useless stuff in my programs
Are you looking for something like KOL?
http://wiki.freepascal.org/KOL-CE
http://kolmck.net/

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: list of units without SysUtils/Classes uses
« Reply #12 on: June 21, 2016, 11:27:54 pm »
Are you looking for something like KOL?
http://wiki.freepascal.org/KOL-CE
http://kolmck.net/
i tried KOL but don't like some things there. maybe some chaos in sources and some troubles to use it with delphi 5 and fpc? 32 and 64 bit  compilation at same time. and it still not compatible with linux  (not wine).

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: list of units without SysUtils/Classes uses
« Reply #13 on: June 22, 2016, 07:49:28 am »
Assembler  is for critical places ^_^ but why i must to keep exception handler, for example, if i don't need it? why i getting 200+ Kb data+code if i don't use even byte from it? That the problem, what i must write my own code or cut code from otheur units just to avoid useless data

Why would we distribute four versions of units for the various stages of minimalism. A minimalistic mindset that typically people grow out soon as they really have to finish projeccts in time.

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: list of units without SysUtils/Classes uses
« Reply #14 on: June 22, 2016, 09:27:52 am »
Why would we distribute four versions of units for the various stages of minimalism. A minimalistic mindset that typically people grow out soon as they really have to finish projeccts in time.
i don't ask you to rewrite all units to my rules, of course, initially, i just asked, is any instrument to find required functional in units which don't have SysUtils etc dependences at least, just to sort them for my needs. nvm, anyway, if i will need something unusual, more than 50% chance what i will write my own solution or change existing but just for my needs

 

TinyPortal © 2005-2018