The Great Coding Language Thread

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
Although that may cause an import loop...you may just want to declare Stop in the original file as a global
 

einsteinsci

New Member
Jul 29, 2019
109
0
0
I'm full OOP on this. C# as my favorite, with all the built-in language features and the fact there are almost no special cases (like int being a struct like any other type). I also like C++ and Java, but the lack of a root type in C++ and no operator overloading in Java, as well as C#'s extension methods keep me running back to .NET.

Functional languages kinda scare me. I'm so used to imperative languages that I've never been willing to try Python, F# or JavaScript.
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
I'm full OOP on this. C# as my favorite, with all the built-in language features and the fact there are almost no special cases (like int being a struct like any other type). I also like C++ and Java, but the lack of a root type in C++ and no operator overloading in Java, as well as C#'s extension methods keep me running back to .NET.
OOP is great. Separating concerns is a good thing
Functional languages kinda scare me. I'm so used to imperative languages that I've never been willing to try Python, F# or JavaScript.
JS and Python aren't functional languages...

Anyway, you should take a crack at functional languages. Try something like Scala first to make the transition easier
 

CapJackH

New Member
Jul 29, 2019
70
0
1
I'm full OOP on this. C# as my favorite, with all the built-in language features and the fact there are almost no special cases (like int being a struct like any other type). I also like C++ and Java, but the lack of a root type in C++ and no operator overloading in Java, as well as C#'s extension methods keep me running back to .NET.

Functional languages kinda scare me. I'm so used to imperative languages that I've never been willing to try Python, F# or JavaScript.
Just dive right it. Do LISP, that will get your feet wet.
 
  • Like
Reactions: Strikingwolf

Someone Else 37

Forum Addict
Feb 10, 2013
1,876
1,440
168
I might recommend Clojure over the other LISP dialects, mainly because it compiles to Java bytecode for platform independence and all that jazz.

Also, there's an excellent guide to Haskell here, if you'd rather learn that.
 
  • Like
Reactions: Strikingwolf

1SDAN

New Member
Jul 29, 2019
1,189
-15
0
So I'm working on a system so that players may load Scenarios from their Scenarios folder. It is to be able to load any amount of Scenarios and I believe I'm not doing too badly. Problem is that I can't figure out how to check if what the player typed is equal to any of the Scenario files.

My code:
Code:
def listMenu_Main22():
    ScenarioNumber = 0
    for file in glob.glob("Scenarios/*.scn"):
        Scenarios.append(file)
        ScenarioNumber += 1

    menuInput = ""
    print ""
    print ""
   
    ScenariosListed = ScenarioNumber
    while ScenariosListed > 0:
        print Scenarios[ScenariosListed - 1]
        ScenariosListed -= 1
   
    print "Back"
    print ""
   
    selectMenu_Main22()
   
#Process Play Scenario Menu
def selectMenu_Main22():
    menuInput = raw_input("")
    ScenariosListed = ScenarioNumber
   
    if str(menuInput.lower()) == "back":
        MainMenu.listMenu_Main20()
    else:
        print "Please select one of the above"
        selectMenu_Main22()

As you can see, the Process Play Scenario Menu is pretty much a dead end atm. Is there any way to make it so that it checks to see that you typed in a file that is present in the list Scenarios?
 
  • Like
Reactions: Strikingwolf

trajing

New Member
Jul 29, 2019
3,091
-14
1
According to StackOverflow,
Code:
import os.path
if os.path.exists(file_path):
    # Not sure if isfile causes an error if the file doesn't exist but playing it safe
    if os.path.isfile(file_path):
        file_type = "file"
    else:
        file_type = "dir"
else:
    file_type = "nonexistent"
 
  • Like
Reactions: Strikingwolf

1SDAN

New Member
Jul 29, 2019
1,189
-15
0
According to StackOverflow,
Code:
import os.path
if os.path.exists(file_path):
    # Not sure if isfile causes an error if the file doesn't exist but playing it safe
    if os.path.isfile(file_path):
        file_type = "file"
    else:
        file_type = "dir"
else:
    file_type = "nonexistent"
What exactly will that do? I ask as I see nothing that will help designate an inputted string as a command
 
  • Like
Reactions: Strikingwolf

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
Just dive right it. Do LISP, that will get your feet wet.
I might recommend Clojure over the other LISP dialects, mainly because it compiles to Java bytecode for platform independence and all that jazz.

Also, there's an excellent guide to Haskell here, if you'd rather learn that.
*hugs*
Clojure is awesome. If you don't mind a quick transition to no mutability go for it
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
TIL that in Ruby, everything is a reference to an object and the objects are nearly completely hidden.
...I've been using pointers all this time without even knowing it.
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
TIL that in Ruby, everything is a reference to an object and the objects are nearly completely hidden.
...I've been using pointers all this time without even knowing it.
Yep. I think that is how it is in most high-level languages if I'm not mistaken
 

Someone Else 37

Forum Addict
Feb 10, 2013
1,876
1,440
168
TIL that in Ruby, everything is a reference to an object and the objects are nearly completely hidden.
...I've been using pointers all this time without even knowing it.
Java does that, too. All the things, save primitive data types (int, float, char, boolean, etc.), are pointers.