Page 12 of 22

Re: Blog post !

Posted: Fri Mar 19, 2021 1:20 am
by Danilo
StarBootics wrote:I'm not asking it it will be needed or not. What I'm asking is if it will be possible otherwise 100 000 lines (maybe more) will simply go to waste. That's my point. :evil:
Interfaces are working in SpiderBasic and it is possible in C as well.
It‘s just a struct with vtable with function pointers. ;)

Re: Blog post !

Posted: Fri Mar 19, 2021 1:37 am
by StarBootics
Danilo wrote:Interfaces are working in SpiderBasic and it is possible in C as well.
It‘s just a struct with vtable with function pointers. ;)
That good news. Now the only question I have left was about the C standard types including the unsigned long and unsigned long long

Best regards
StarBootics

Re: Blog post !

Posted: Fri Mar 19, 2021 6:00 am
by Rinzwind
I also never understood the 'PureBasic' is simple comments. Yes, if you constrict yourself to what it can deliver out of the box and stay with basic programs and samples. Go out of that comfort and you soon bump your head into ugly win32 API's or CocoaMessages because of a missing build-in function or this, that, such so or even... POINTERSSSS the scare of many programming textbooks. I always saw PB as C-like with strong standard libraries and safe strings. It's closer to that then let's say VB6. It's syntax isn't as what I considered to be Basic, hence there is not one Basic.

While I'm at it, my 'negatives' (don't take it too negative):
  1. As above, extend structures to support procedures that handle it's data
  2. For one, I dread the many () used for too many things. Wish the compiler also allowed let's say [] in certain cases (arrays?)
  3. Lack of inline arrays declaration are another ouch-point for me which I think would be easy to fix. Apparently not.
  4. ByVal/ByRef choice for procedures (would make it more Basic rrright? No more messing with those dangerous pointers ;))
  5. Recently: gadget library does not support multi-monitor-DPI situations.. pain to handle it yourself.. combo API and PB libraries..
  6. Gadget library could do with a few additions, for one an advanced table control and some modern styled control variations.
  7. Integer-key Map
  8. Maybe some PB libraries could be open sourced to speed up bug fixes and stuff. Just a thought.
  9. Maybe PB could start an official GitHub repository for 3rd party additional maintained libraries, unit tested and all. A lot of the time people are reinventing the wheel or copying old code hoping it works and is stable.
  10. Windows Callback get messy real quick, add support for something like procedure OnHotKey(wp, lp) message #wm_hotkey . SetWindowCallback can only be called once. What if another modules also needs it (there's the window parameter which helps somewhat)? Target easy reusability.
  11. GUI designer is lacking (multi select actions don't do much). Let us add some custom info to a gadget (maybe GadgetData added to the properties table). It also breaks on scale <> 100%.
Anyway, evolve the parts where it matters.

Re: Blog post !

Posted: Fri Mar 19, 2021 9:52 am
by Fred
StarBootics wrote:
We have some questions and no answers yet :cry:

Please Fred ...

Best regards
StarBootics
Why the saddeness ? All PureBasic feature will be supported in the C backend unless proved to be impossible (which is very unlikely). For now, the current limitations are:

- no level to 'Break' (should be resolved somewhen)
- no Gosub (should be resolved soon)
- no label address (?LabelName) outside of Datasection (could be resolved somewhen, not sure if it worths it).

Then that pretty much it, all common stuffs like prototype, interface etc works indeed.

And again: we DON'T plan to drop the current asm backend, plain and simple.

Re: Blog post !

Posted: Fri Mar 19, 2021 11:49 am
by luis
Fred wrote: - no label address (?LabelName) outside of Datasection (could be resolved somewhen, not sure if it worths it).
I'm sure some people is using labels in the body of procedures or outside the data section anyway for many tricks or extensions. I'm one of them, I have at least two uses probably more, one is a sort of poor man try/catch and I've used it extensively.
So please try to keep it if possible.

It was actually implemented after a request from 2010
viewtopic.php?f=3&t=42555&hilit=Implemented
and your own idea of implementing it
viewtopic.php?p=320077#p320077

With the new backend will PB continue to generate a single EXE with no additional dependencies to distribute with it (excluding OGRE) ?

Re: Blog post !

Posted: Fri Mar 19, 2021 11:53 am
by StarBootics
Fred wrote:Why the saddeness ? All PureBasic feature will be supported in the C backend unless proved to be impossible (which is very unlikely). For now, the current limitations are:

- no level to 'Break' (should be resolved somewhen)
- no Gosub (should be resolved soon)
- no label address (?LabelName) outside of Datasection (could be resolved somewhen, not sure if it worths it).

Then that pretty much it, all common stuffs like prototype, interface etc works indeed.

And again: we DON'T plan to drop the current asm backend, plain and simple.
The sadness was due to the fact that big changes into a programming language such as the new C Backend can mean big changes into the language it self. I remember when changes in the language in the earlier version of PureBasic (the introduction of Modules for example) was literally a game changer but it also means that the good old ways of writing code as to change as well. I'm not afraid of change, what I'm afraid is regressions.

And you pointed some out that will probably resolved.

Thanks for your answer. :D

Best regards
StarBootics

Re: Blog post !

Posted: Fri Mar 19, 2021 11:59 am
by User_Russian
Fred wrote:no level to 'Break' (should be resolved somewhen)
Why aren't you using goto?
Bkeak 2 can be translated like this in C.

Code: Select all

for (uint8_t i=0; i<10; i++)
{
    for (uint8_t x=1; x<100; i++)
    {
        goto break2; // This Bkeak 2 in PB.
    }
}
break2:;
Fred wrote:no label address (?LabelName) outside of Datasection (could be resolved somewhen, not sure if it worths it).
Why? GCC allows you to find out the address of the label.
See this screenshot.

Image

The label is located at address 0x2000030E and the variable has the same value. Everything works fine.
Fred wrote:no Gosub (should be resolved soon)
Write what difficulties have arisen. It may be possible to find a solution.

Re: Blog post !

Posted: Fri Mar 19, 2021 1:50 pm
by BarryG
Fred wrote:- no level to 'Break' (should be resolved somewhen)
Hopefully this can be resolved as soon as possible, rather than sometime in the future. It's a major feature to have a Break level, and without this it will ruin a lot of nested loops that currently depend on it. Until this is resolved, I won't even be able to begin testing any new betas because a few of my loops have "Break 2" and "Break 3" in the same processing code.

Re: Blog post !

Posted: Fri Mar 19, 2021 2:32 pm
by skywalk
BarryG wrote:
Fred wrote:- no level to 'Break' (should be resolved somewhen)
Hopefully this can be resolved as soon as possible, rather than sometime in the future. It's a major feature to have a Break level, and without this it will ruin a lot of nested loops that currently depend on it. Until this is resolved, I won't even be able to begin testing any new betas because a few of my loops have "Break 2" and "Break 3" in the same processing code.
Yes, I have many nested loops that Break 2, but no Break 3 as yet.

Re: Blog post !

Posted: Fri Mar 19, 2021 2:51 pm
by Fred
User_Russian wrote:Why aren't you using goto?
Bkeak 2 can be translated like this in C.

Code: Select all

for (uint8_t i=0; i<10; i++)
{
    for (uint8_t x=1; x<100; i++)
    {
        goto break2; // This Bkeak 2 in PB.
    }
}
break2:;
It's the plan, it's just not implemented yet.
User_Russian wrote:
Fred wrote:no label address (?LabelName) outside of Datasection (could be resolved somewhen, not sure if it worths it).
Why? GCC allows you to find out the address of the label.
See this screenshot.

Image

The label is located at address 0x2000030E and the variable has the same value. Everything works fine.
Fred wrote:no Gosub (should be resolved soon)
Write what difficulties have arisen. It may be possible to find a solution.
I know, but it's GCC specific and I would like to avoid this to be able to use other compiler as well. If I get no other choices we could be tied to GCC, but I want to explore all possibilities.

Re: Blog post !

Posted: Fri Mar 19, 2021 3:27 pm
by Saki

Code: Select all

For i=1 To 10000
  For ii=1 To 10000
    If ii=5000
      ; Break 2
      Goto finish
    EndIf
  Next ii
Next i
finish:
Debug "Finished "+ii
Oh no, the Goto police will be upset again :shock:

Re: Blog post !

Posted: Fri Mar 19, 2021 4:49 pm
by BarryG
@Saki: From the manual for the "Goto" command: To exit a loop safely, you always must use Break instead of Goto. Something about releasing the stack correctly, IIRC.

Re: Blog post !

Posted: Fri Mar 19, 2021 5:30 pm
by TI-994A
Conditional While/Wend and Repeat/Until loops could easily and elegantly replace multi-level breaks.

Re: Blog post !

Posted: Fri Mar 19, 2021 5:36 pm
by Saki
@Barry The For next changes only one variable,
if something would be put on the stack, this would give a crash.

Code: Select all

repeat
For i=1 To 10000
  For ii=1 To 10000
    If ii=5000
      ; Break 2
      Goto finish
    EndIf
  Next ii
Next i
finish:
forever

Re: Blog post !

Posted: Fri Mar 19, 2021 5:37 pm
by Tenaja
TI-994A wrote:Conditional While/Wend and Repeat/Until loops could easily and elegantly replace multi-level breaks.
It can be elegant, but if one of the exit conditions is only combined with a handful of other specific conditions (i.e. nested deep in some IF's), placing that whole pile into the conditional loop test can be ugly, confusing, and slower since the condition is tested with every iteration... And is no longer elegant.