Next generation name is FB++ ?

For other topics related to the FreeBASIC project or its community.
marcov
Posts: 2793
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Next generation name is FB++ ?

Postby marcov » Jun 21, 2018 9:00

Tourist Trap wrote:
marcov wrote:Or FC (one ascii value increase like C->D)

To be honest, such wordplay trying to imitate 1980's lore sounds a bit stale IMHO.

True. But it seems to be a constant jurisprudence that adding classes to a language makes a substantial jump. Take Python 2 -> 3. VB6 -> VB.Net. C -> C++ ..etc... (pascal -> delphi)


C and C++ were by different people teams (in different eras), Pascal went to Object Pascal (also different people and eras).

Borland later renamed it to Delphi because "pascal" had too many "old" connotations (though critics say that Delphi was trademarkable, and (Object) Pascal not)

Maybe anyway in the case of FB, classes have always been a part of the plan, so it's more as we were running a temporary FB--, but it would lead erroneously to think that the current versions miss really anything, which is not right.


Object support has been worked on for a while. I think one could argue for a major version update when you receive a milestone, but I don't see a reason to rename the language. Even if some other languages did.

Tourist Trap wrote:I only hope that 1.07 will bring us some overloadable FOR EACH instruction.

About FOR EACH x IN y,
A- if y is an array of T, and x a variable of type T, then the array should be read from its lowest bound to the uppers one.
B- if y is a pointer of type T ptr, then the last chunk of bits of the type T should be the next address. This means that this T type should be structured like this. Or the x will not know where to jump next. So the type T that fits well, in my opinion, is made of 2 chunks, a chunk of data, and an integer representative of an address in memory.

I see that like this! I may well be fooled totally ;)


We have this in FPC (also .NET copycatism), note that you should think about if x should be assignable or not. It really complicates the overloadable concept
Tourist Trap
Posts: 2768
Joined: Jun 02, 2015 16:24

Re: Next generation name is FB++ ?

Postby Tourist Trap » Jun 21, 2018 12:46

marcov wrote:We have this in FPC (also .NET copycatism), note that you should think about if x should be assignable or not. It really complicates the overloadable concept

Yes assigning a value to x inside the loop may make things a little tricky, but funny ;)
I often have to use VBA, which is of the same family as FB. It would help me adapting code from the one to the other if we had a standard collection type and some for each ability. I think that for each is one of the most popular instruction ever created. Perfectly meaningful without any effort. Of course it doesn't come without overhead, but it's not in my opinion a performance tool, it's above all for making easier the code design.
marcov
Posts: 2793
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Next generation name is FB++ ?

Postby marcov » Jun 21, 2018 13:21

Tourist Trap wrote:
marcov wrote:We have this in FPC (also .NET copycatism), note that you should think about if x should be assignable or not. It really complicates the overloadable concept

Yes assigning a value to x inside the loop may make things a little tricky, but funny ;)
I often have to use VBA, which is of the same family as FB. It would help me adapting code from the one to the other if we had a standard collection type and some for each ability. I think that for each is one of the most popular instruction ever created. Perfectly meaningful without any effort. Of course it doesn't come without overhead, but it's not in my opinion a performance tool, it's above all for making easier the code design.


Despite that it is copycattism and syntactic sugar, I'm not against it. (and I'm usually Mr no-no in such cases)

  • optimizes a really common (daily or more) pattern
  • It reduces code by more than a few keystrokes,
  • is not easily solved with IDE extensions.
angros47
Posts: 1535
Joined: Jun 21, 2005 19:04

Re: Next generation name is FB++ ?

Postby angros47 » Jun 21, 2018 23:11

Tourist Trap wrote:
marcov wrote:I only hope that 1.07 will bring us some overloadable FOR EACH instruction.

About FOR EACH x IN y,
A- if y is an array of T, and x a variable of type T, then the array should be read from its lowest bound to the uppers one.
B- if y is a pointer of type T ptr, then the last chunk of bits of the type T should be the next address. This means that this T type should be structured like this. Or the x will not know where to jump next. So the type T that fits well, in my opinion, is made of 2 chunks, a chunk of data, and an integer representative of an address in memory.

I see that like this! I may well be fooled totally ;)


FOR ...EACH, to work properly, should not be implemented like in BlitzBasic (where it cycles on all the elements of a given type), because I might want to cycle on only a part of them (for example, in a videogame, all characters might be stored using the same UDT, but a cycle might be used only on the characters of one alignment/team). Also, FOR...EACH could be useful for regular types, too.

So, the right way to implement it is like in C++, with linked lists. Linked lists are possible, in FreeBasic (they are possible in C, too), but to implement them easily, the best solution would be to have templates (they would allow other structures, too, like maps). And templates are still not implemented in FreeBasic
marcov
Posts: 2793
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Next generation name is FB++ ?

Postby marcov » Jun 22, 2018 7:49

angros47 wrote:FOR ...EACH, to work properly, should not be implemented like in BlitzBasic (where it cycles on all the elements of a given type), because I might want to cycle on only a part of them (for example, in a videogame, all characters might be stored using the same UDT, but a cycle might be used only on the characters of one alignment/team). Also, FOR...EACH could be useful for regular types, too.


If you allow non consecutive ranges, it is a shorthand for while, and IMHO doesn't add much (too rare for a productive shorthand).

Free Pascal natively has ranges and sets as types for the "y" though, so that will work by declaring an implicit type. But that is original Pascal type syntax. (e.g. for x in 1..45 do or for x in [0,2,5,7,54,123] do )
dodicat
Posts: 5991
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Next generation name is FB++ ?

Postby dodicat » Jun 22, 2018 14:22

Pascal
I have version 2.4.4 (transferred from Win XP) into win 10
(because I could not locate a .zip file from the FreePascal site for the latest version)
I do not see the keyword IN in the help.
Was it perhaps introduced in a more recent version?

EDIT
OK, I tested with some code, IN seems to be accepted.
Sorry.
ecxjoe
Posts: 83
Joined: Aug 08, 2009 6:01
Contact:

Re: Next generation name is FB++ ?

Postby ecxjoe » Jun 22, 2018 16:36

No thanks. I don't want FB to be associated with C++.

I agree with lizard that it should be updated to support more relevant formats like png and ogg. Keep it simple, but relevant. Remove barriers to entry for newcomers, like complexity and lack of support for commonly used formats.

FB is already on the verge of being too complex. If anything, the syntax should be curbed and refined instead of added upon.
coderJeff
Site Admin
Posts: 3122
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Next generation name is FB++ ?

Postby coderJeff » Jun 23, 2018 16:49

This is going to be a bit wordy, I hope you all are patient enough to read...

In my mind FreeBASIC will always be FreeBASIC; from QB-quirks to OOP and all.

Around 2005 I had already been programming professionally for about 10+ years when microsoft adopted .net framework. I was supporting a dozen customers on multiple windows OS's and now I had to deal with .net? It was too much, and I was dismayed at how dependent my earning a living programming was on microsoft. I am an electrician now. And for several years I have been away from FreeBASIC to build my new career.

I always enjoy programming in FreeBASIC. I like it. And It's open source and I can change it if I want. I use other tools/langs, FreeBASIC is my favourite.

fbc compiler source code itself is a combination of procedural and object-oriented programming design. When you run fbc, it takes actions in a specific order, getting command line options, processing files one at a time, emitting and assembling object files, linking. What's interesting is the compilation step; a compiler object is constructed, which consists of many other objects, like LEXER, PARSER, AST, IR, EMITTER. For compilation, the data (your source code) governs what methods in each object are called.

So, fbc itself is object oriented, by design. At the time it was written, OOP kind of stuff was not "baked in to the language", it didn't exist yet, so there was no formal way to express it, no help or safety checks from the language/compiler. It's up to the programmer (fbc developers) to follow the OOP design pattern.

I don't mind the old QB quirky syntax, while at the same time the new, OOP stuff that has been gradually added to FreeBASIC, is a formal way of expressing what we've already been thinking about for years.

deltarho[1859] wrote:Perhaps we can liven things up a bit with a 1.06 release and get everyone on the same footing. <smile>


Always on my mind as the big picture goal. The side adventures along the way just help me learn about the compiler. Achieving the small goals that leads to the big one.

For me, goals are roughly:
- improve the documentation to reflect current state of compiler
- fix the bugs that make fbc crash
- fix the bugs that make user program crash
- add the VA_ARG support in fbc-64 bit. I think this is important. For about a year I've been working my way towards knowing enough to help with this.
- build a release that just works, every platform. I don't think I can do this on my own, but over last many months, others are stepping up to the challenge.
- get some enthusiastic programmers to help the project
- doing it all because I want to... Not caring what any of you want... ;)

EDIT:
OK, last statement not quite true. I do care. Probably more accurate is not taking the criticism too personally, there's plenty of it...
BasicCoder2
Posts: 3403
Joined: Jan 01, 2009 7:03

Re: Next generation name is FB++ ?

Postby BasicCoder2 » Jun 23, 2018 19:08

coderJeff wrote:This is going to be a bit wordy, I hope you all are patient enough to read...

Always interested in the background of other FreeBasic users and why someone who can program professionally actually likes using FreeBASIC.
Tourist Trap
Posts: 2768
Joined: Jun 02, 2015 16:24

Re: Next generation name is FB++ ?

Postby Tourist Trap » Jun 23, 2018 20:36

I also love freebasic. It has hilevel and low level features that you can mix at will. And for some reason I feel that the developers here know that the old qb wasn't bad at all from the user point of view, and the old style still has a powerful attraction. Moreover the team seems very conscious of introducing features in a kind of very selective way (sometimes maybe due also to the need not to waste the energy of the few at the fighting posts) that until now has always surprised me very positively.
It's a nice tool and project.I don't see what is impossible with freebasic. You can make buffers from the very basics so write your data types and their handlers. You have pointers even for procedures, so it's really powerful.
And for reasons almost unknown to me, this compiler is really fast.
angros47
Posts: 1535
Joined: Jun 21, 2005 19:04

Re: Next generation name is FB++ ?

Postby angros47 » Jun 23, 2018 21:12

@Marcov
Personally, I think the only case where FOR .... EACH would be really useful, and easy to use, is in linked lists. FreeBasic doesn't have linked lists (there are several unofficial implementations, but no default solution, so before implementing FOR...EACH, it would be better to implement linked lists. And since linked lists are not the only data structure of that kind (there are also vectors, maps, and so on) I wonder if it would be better to implement them as templates (so, new data structures could be added).
But since FreeBasic has dynamic arrays, and strings, perhaps instead of templates only linked lists and maps could be added, hard coded in the compiler.

@ecxjoe
Adding support to other file formats can be done with external libraries. Also, since at the moment FreeBasic has no way to directly access sound drivers, how is it supposed to support OGG files? Last but not least: if you want to add such support, it must support reading and writing, like it currently does for .BMP
marcov
Posts: 2793
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Next generation name is FB++ ?

Postby marcov » Jun 23, 2018 21:28

angros47 wrote:@Marcov
Personally, I think the only case where FOR .... EACH would be really useful, and easy to use, is in linked lists. FreeBasic doesn't have linked lists (there are several unofficial implementations, but no default solution, so before implementing FOR...EACH, it would be better to implement linked lists. And since linked lists are not the only data structure of that kind (there are also vectors, maps, and so on) I wonder if it would be better to implement them as templates (so, new data structures could be added).


More general, all container types (arrays, sets and strings native, records and class types must have certain methods that return an implicit iterator interface. (ducktyping))

To be honest I never use linked lists anymore. I only used them when starting to program. Cumbersome to program, and slow due to non O(1) access and a murderer of the cache.
angros47
Posts: 1535
Joined: Jun 21, 2005 19:04

Re: Next generation name is FB++ ?

Postby angros47 » Jun 23, 2018 22:15

In FreeBasic arrays are more complex than in C, and dynamic arrays are already supported, so, for example, the vector template used in C++ is not needed. And perhaps, just like a built in feature replaces that template, other built in features could replace other templates, too
caseih
Posts: 1386
Joined: Feb 26, 2007 5:32

Re: Next generation name is FB++ ?

Postby caseih » Jun 23, 2018 23:13

I think you mean lists have an O(n) access time. Arrays and hash tables are O(1), which is very fast.

I've used lists on several occasions when I needed a data structure that I could insert nodes into at arbitrary places. I've also occasionally had the need to implement a kind of stack, and the C++ stl list works well for that. Other structures like trees I use all the time, and they are very similar to linked lists. Back in uni I learned all kinds of data structures that I never thought I'd use. Imagine my surprise one day when I found the Left Child Right Sibling tree to be a perfect fit for something I was working on.
Last edited by caseih on Jun 23, 2018 23:52, edited 1 time in total.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Next generation name is FB++ ?

Postby lizard » Jun 24, 2018 3:41

Why not FreeBASIC², like Profan² did.

Could start with FreeBASIC⁰, then FreeBASIC¹ and FreeBASIC².

Next version then, with more 3D, could be FreeBASIC³.

Then it becomes difficult because keyboard has no ⁴, ⁵, ⁶, ⁷, ⁸, ⁹, ⁴⁵, ⁶⁷, ⁷⁵⁸⁴ and so on...

(Hope this is correctly displayed on your screen)

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest