FreeBASIC Dialects
 

FreeBASIC version 0.17b introduces a -lang command-line option, used to change the language compatibility mode for different dialects of the basic language.

Starting with version 0.18.3b the -lang qb dialect has been further restricted to only allow what would have been allowed in QuickBASIC.

In version 0.18.4b the -lang fblite dialect was added, intended to replace -lang deprecated in future.

In version 0.20.0b the #lang directive and $Lang metacommand were added to specify a dialect from source.

-lang optiondescription
fbFreeBASIC compatibility (default)
qbqbasic compatibility
fbliteFreeBASIC language compatibility, with a more QBASIC-compatible coding style
deprecatedcompatibility with FB 0.16


The -lang option was needed to allow FreeBASIC to support object-orientation and other features in the future, without crippling the QuickBASIC support or breaking compatibility with old FreeBASIC sources, and without making FreeBASIC difficult to maintain with many different versions of very similar packages. The QuickBASIC support can continue to be improved, if needed, without breaking the sources written specifically for FreeBASIC.

To compile old GW-BASIC or QuickBASIC/QBasic sources without too many changes, use the -lang qb option on the command-line when running fbc. This option will evolve into a better compatibility with QuickBASIC/QBasic code.

To compile FreeBASIC sources from 0.16b, use the -lang deprecated option. This option is maintained for compatibility and will not evolve in the future, and it's likely to disappear when FreeBASIC reaches a non-beta release.

For programmers who want to access some of FreeBASIC's newer features, but want to retain a more QBASIC-friendly programming style, use the -lang fblite option. This dialect will not undergo significant changes in the future, but will continue to be maintained and supported.
This option is also the most compatible with sources that were made using older versions of FreeBASIC.

It is recommended to use -lang fb for new projects, as new features (object classes, inheritance..) will be added exclusively to this dialect.


-lang fb (the default mode)
Not supported:

1) implicit variable declaration
2) type suffixes (!, #, $, %, &)
    • They are only allowed for numeric literals, but it's recommended to use Cast or the f (single), d (double), ll (longint), ul (uinteger), ull (ulongint) numeric literal suffixes to resolve overloading.

    • An explicit type ("As T") is needed when declaring variables using Dim, ReDim, Extern or Common. Variables declared using Var or Const have their types inferred from an initialization value (an explicit type is optional using Const).

4) all parameters passed by reference by default
    • By default, all intrinsic scalar types - numeric and pointer types - are passed by value (ByVal). Any other type - String or user-defined type - is passed by reference (ByRef).
    • Use the -w pedantic command-line option to have parameters without explicit ByVal or ByRef reported.

5) OPTIONs of any kind (no context-sensitivity)
6) periods in symbol names
    • Use namespaces instead.
    • Nested procedures may be allowed in future.

    • Use SELECT expr AS CONST for the latter.

    • Most runtime and graphics library procedures now return an error code, like: IF OPEN( "text" FOR INPUT AS #1 ) <> 0 THEN error...

10) '$DYNAMIC, '$STATIC, '$INCLUDE meta-commands embedded in comments
    • See item 5 about Option Dynamic.
    • Use #include "filename" instead of '$include.

11) Call or Let
    • Just remove them.

12) numeric labels
    • No comment.

13) global symbols with the same name as keywords
    • Declare them inside a namespace.


-lang deprecated

Supported: Anything allowed in version 0.16b, but:

1) GOSUB/RETURN and ON ... GOSUB (even at module-level)
    • so the GOSUB implementation could be thread-unsafe in the -lang qb mode, allowing fast execution (-lang qb doesn't support multi-threading, while -lang deprecated does).

Not supported:

1) Classes
    • Periods allowed in symbol names make it too difficult and/or ambiguous.

2) Operator overloading
    • Periods allowed in symbol names make it too difficult and/or ambiguous.

3) Constructors, destructors and methods in TYPEs.
    • Periods allowed in symbol names make it too difficult and/or ambiguous.


-lang fblite

Supported: Anything allowed in the -lang deprecated dialect, plus..

1) GOSUB/RETURN
- Use Option Gosub to enable. This will disable RETURN from exiting a procedure, due to ambiguity.

Not supported:

1) Scope blocks
    • All variables are given procedure scope. Explicit Scope blocks may be added later.

-lang qb
Supported: Everything not supported/allowed in the -lang fb dialect, plus..

1) Call can be used with forward-referenced functions.

2) Shared can be used inside functions. (W.I.P.)

3) All variables, implicitly or explicitly declared, are always allocated in the procedure scope, like in QuickBASIC.

4) The Data statement won't look up symbols, every token is assumed to be a literal string even without quotes, like in QuickBASIC.


Not supported:

1) Multi-threading
    • None of the threading procedures may be used.

2) Classes and Namespaces

3) Procedure and operator overloading

4) Constructors, destructors and other member procedures in Type definitions.

5) Scope blocks

6) Extern blocks

7) Variable initialization
    • All variables are moved to the procedure scope (like in QuickBASIC), making initializing local variables too difficult to support.


Знаете ли Вы, как разрешается парадокс Ольберса?
(Фотометрический парадокс, парадокс Ольберса - это один из парадоксов космологии, заключающийся в том, что во Вселенной, равномерно заполненной звёздами, яркость неба (в том числе ночного) должна быть примерно равна яркости солнечного диска. Это должно иметь место потому, что по любому направлению неба луч зрения рано или поздно упрется в поверхность звезды.
Иными словами парадос Ольберса заключается в том, что если Вселенная бесконечна, то черного неба мы не увидим, так как излучение дальних звезд будет суммироваться с излучением ближних, и небо должно иметь среднюю температуру фотосфер звезд. При поглощении света межзвездным веществом, оно будет разогреваться до температуры звездных фотосфер и излучать также ярко, как звезды. Однако в дело вступает явление "усталости света", открытое Эдвином Хабблом, который показал, что чем дальше от нас расположена галактика, тем больше становится красным свет ее излучения, то есть фотоны как бы "устают", отдают свою энергию межзвездной среде. На очень больших расстояниях галактики видны только в радиодиапазоне, так как их свет вовсе потерял энергию идя через бескрайние просторы Вселенной. Подробнее читайте в FAQ по эфирной физике.

НОВОСТИ ФОРУМА

Форум Рыцари теории эфира


Рыцари теории эфира
 10.11.2021 - 12:37: ПЕРСОНАЛИИ - Personalias -> WHO IS WHO - КТО ЕСТЬ КТО - Карим_Хайдаров.
10.11.2021 - 12:36: СОВЕСТЬ - Conscience -> РАСЧЕЛОВЕЧИВАНИЕ ЧЕЛОВЕКА. КОМУ ЭТО НАДО? - Карим_Хайдаров.
10.11.2021 - 12:36: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от д.м.н. Александра Алексеевича Редько - Карим_Хайдаров.
10.11.2021 - 12:35: ЭКОЛОГИЯ - Ecology -> Биологическая безопасность населения - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> Проблема государственного терроризма - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> ПРАВОСУДИЯ.НЕТ - Карим_Хайдаров.
10.11.2021 - 12:34: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вадима Глогера, США - Карим_Хайдаров.
10.11.2021 - 09:18: НОВЫЕ ТЕХНОЛОГИИ - New Technologies -> Волновая генетика Петра Гаряева, 5G-контроль и управление - Карим_Хайдаров.
10.11.2021 - 09:18: ЭКОЛОГИЯ - Ecology -> ЭКОЛОГИЯ ДЛЯ ВСЕХ - Карим_Хайдаров.
10.11.2021 - 09:16: ЭКОЛОГИЯ - Ecology -> ПРОБЛЕМЫ МЕДИЦИНЫ - Карим_Хайдаров.
10.11.2021 - 09:15: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Екатерины Коваленко - Карим_Хайдаров.
10.11.2021 - 09:13: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вильгельма Варкентина - Карим_Хайдаров.
Bourabai Research - Технологии XXI века Bourabai Research Institution