Liberty BASIC Community Forum
« Liberty BASIC Rosetta Code Project »

Welcome Guest. Please Login or Register.
Jan 22nd, 2018, 6:00pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1 2 3 4  5 Notify Send Topic Print
 sticky  Author  Topic: Liberty BASIC Rosetta Code Project  (Read 11652 times)
Janet
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 4111
xx Re: Liberty BASIC Rosetta Code Project
« Reply #15 on: Jul 16th, 2010, 09:41am »

An advantage to having Chris taking the lead in this project is that there won't be several people all using their own particular coding styles (capitalization, commas, periods, underscores, etc.) and the entries will all conform to one format.

I'm in favor of using the format in the help file, which is pretty much in agreement with what Rod has just posted.

carOwner
for i = 1 to 3
next i

Using this style will probably also make it clearer that some variables are case specific, eg

WindowWidth
leftButtonUp
BackgroundColor$

We should also come to an agreement on whether to use

print #main, "trapclose [quit]"
or
#main "trapclose [quit]"

(not to say that my own projects won't maintain my peculiar styling, but a community project should remain consistent)

Maybe after we've hashed these out and come to an agreement, Chris can post the final agreed upon format in his original post.
User IP Logged

Windows 7 Professional, SP1, 64 bit Intel Core i5-4200U CPU @ 1.60 GHz 2.30 GHz 6.00 GB

"I am very busy finding out what people mean by what they say." -
Alyce Watson
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 14918
xx Re: Liberty BASIC Rosetta Code Project
« Reply #16 on: Jul 16th, 2010, 09:58am »

I agree with Janet. wink

I understand Dan's reasons for using the dot as a simple separation to make variable names easier to read.

Since the dot has a particular meaning in other languages AND in Liberty BASIC, I think it would confuse things to include it in some variable names.

User IP Logged

Alyce
Liberty BASIC Workshop - a complete IDE for Liberty BASIC


Alyce's Restaurant
for Liberty BASIC code, tools and references
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: Liberty BASIC Rosetta Code Project
« Reply #17 on: Jul 16th, 2010, 11:41am »

Cool, #main "command string" seems to be the slickest way and less typing.

Also, when to use subs and functions? I know the long answer but what is the short answer for building code samples. I would suggest they are used when asked for and not introduced as a matter of course. Clearly these code samples will sit in a sub or function in the real world. We don't however need to force everything into a sub or function just because that demonstrates good practice.

Not sure if I made that point very well.
User IP Logged

Stefan Pendl
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Computers are like babies, you must teach them what you like them to do ...


Homepage PM

Gender: Male
Posts: 5303
xx Re: Liberty BASIC Rosetta Code Project
« Reply #18 on: Jul 16th, 2010, 2:36pm »

I favor #Handle "Command String" too, since the new style introduced in RB and used in LB5 will be similar.

I am in favor of using capitalization instead of dots too.
User IP Logged

Stefan

Make sure to read and follow the Forum Guidelines

Liberty BASIC Pro 4.04, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
tsh73
Moderator
ImageImageImageImageImage


member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1732
xx Re: Liberty BASIC Rosetta Code Project
« Reply #19 on: Jul 16th, 2010, 4:01pm »

Quote:
We don't however need to force everything into a sub or function just because that demonstrates good practice.

Yep.
Using function in [RC] Filter is totally uncalled for.
IMHO, of course wink
User IP Logged

damned Dog in the Manger
Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2294
xx Re: Liberty BASIC Rosetta Code Project
« Reply #20 on: Jul 16th, 2010, 4:05pm »

Very good, I'm going to follow the outline in Janet's post, for now. It'll be better to have consistent code from the beginning. I'll go through what's on the wiki and edit it to match this format.


Although I can see how using the dot can make some variable names easier to read, the fact that the dot does have a special place in LB makes me believe we should avoid use of it unless we're using structs.
User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
Dan Teel
Guru
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1130
xx Re: Liberty BASIC Rosetta Code Project
« Reply #21 on: Jul 16th, 2010, 5:48pm »

Alright, majority rules, no dots.
User IP Logged

ZPtr.net
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: Liberty BASIC Rosetta Code Project
« Reply #22 on: Jul 17th, 2010, 02:55am »

.... oops sorry. oops again.

Ok I never use anything other than the standard IDE. What would we need to use to produce code for Chris that would retain its keyword coloring?

Our stuff looks a tad old fashioned without it.

User IP Logged

Janet
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 4111
xx Re: Liberty BASIC Rosetta Code Project
« Reply #23 on: Jul 17th, 2010, 07:34am »


Searching around the Rosetta site, I came across this page
Village Pump:Home/Syntax Highlighting. The syntax coloring is based upon php code obtained at sourceforge.net 96 languages are supported. It looks like we'd need to have someone write the php code for Liberty BASIC and find how to update the file.
User IP Logged

Windows 7 Professional, SP1, 64 bit Intel Core i5-4200U CPU @ 1.60 GHz 2.30 GHz 6.00 GB

"I am very busy finding out what people mean by what they say." -
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: Liberty BASIC Rosetta Code Project
« Reply #24 on: Jul 17th, 2010, 08:58am »

Good hunting Janet. I find that the necessary PHP script can be created automatically. It seems pretty straightforwards. I have not actioned anything I'll let Chris catch up but it looks like we need a list of keywords and a few questions answered.

Easily redone if we get it wrong. It also appears we should use <lang> tags. Some experimenting to do but not as hard as it first looked.

Go here http://rosettacode.org/geshi/
User IP Logged

Janet
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 4111
xx Re: Liberty BASIC Rosetta Code Project
« Reply #25 on: Jul 17th, 2010, 11:12am »

Gosh, Rod. How did you manage to find that page? I hunted for something similar to (obviously) no avail.

Chris is already using the <lang> tags. This is an example of the Rosetta wiki markup
Code:
=={{header|Liberty BASIC}}==
<lang lb>print "Goodbye, World!"</lang>
 


So, it looks like as soon as the lb markup is added to the library, the syntax coloring will show. Chris was pretty adept at using javascript with Run BASIC. Waiting to see what he knows about php. ;)

User IP Logged

Windows 7 Professional, SP1, 64 bit Intel Core i5-4200U CPU @ 1.60 GHz 2.30 GHz 6.00 GB

"I am very busy finding out what people mean by what they say." -
Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2294
xx Re: Liberty BASIC Rosetta Code Project
« Reply #26 on: Jul 17th, 2010, 11:48am »

Oh, sweet, I didn't see AutoGeSHi before, that will probably make it a lot faster! Thanks!


I was already working on the syntax coloring, but like I said, thanks for the link to AutoGeSHi. I'll probably have AutoGeSHi generate a script, then tweak it myself.
« Last Edit: Jul 17th, 2010, 12:00pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: Liberty BASIC Rosetta Code Project
« Reply #27 on: Jul 17th, 2010, 1:38pm »

The boy is on song and on fire!
User IP Logged

Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2294
xx Re: Liberty BASIC Rosetta Code Project
« Reply #28 on: Jul 17th, 2010, 1:54pm »

With AutoGeSHi's help, I was able to complete the syntax highlighting script for LB. I tried to make the colors as close to default LB as possible.


I would appreciate it if people could go to this site:

http://cssource.servegame.org/contrib/example.php


And put in example source code and see if it comes out alright. The ones I've done look ok, but I want to make sure there's no errors before submitting this.


On that link, just copy and paste some source code, and then select "lb" from the dropdown list and hit Highlight Source.
« Last Edit: Jul 17th, 2010, 1:55pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: Liberty BASIC Rosetta Code Project
« Reply #29 on: Jul 17th, 2010, 2:35pm »

Tried a few, looks great. it did highlight an occasional misuse of a keyword like [stop] as a label name but hey ho we shouldn't be using [stop] as a label name anyway.

Good work.
User IP Logged

Pages: 1 2 3 4  5 Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls