Bug 144185 - Clarification needed about scope/lifetime of different types of variables
Summary: Clarification needed about scope/lifetime of different types of variables
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-30 13:43 UTC by Mike Kaganski
Modified: 2022-05-25 13:32 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2021-08-30 13:43:42 UTC
Documentation for Global keyword [1] is wrong, stating that the keyword is for scope ("the variable and the array are valid in all libraries and modules for the current session"). The "for the current session" might attempt to express the idea of keeping its value between different macro invocations - but in fact, this is completely unclear from the text, unless you know that yourself.

OTOH, documentation on "Using Procedures, Functions and Properties" [2] tells that there are differences between scope of Global/Public/Private/Dim variables - and it obviously has problems. It doesn't discuss scope of the Global variable (only it keeping its value - but is it visible across modules? across libraries? between macros in shared libraries and document-defined ones (and in the opposite direction)?) It tells that Private and Dim variables are only visible in the module it's defined in - but in fact, it's visible also outside.

This needs clarification (and *maybe* fixing, if some types actually have wrong scope).

[1] https://help.libreoffice.org/7.3/en-US/text/sbasic/shared/03103450.html?DbPAR=BASIC
[2] https://help.libreoffice.org/latest/en-US/text/sbasic/shared/01020300.html?DbPAR=BASIC