The Great Coding Language Thread

trajing

New Member
Jul 29, 2019
3,091
-14
1
not as far as LISP :p Also, no actual first-class functions is bad
Not really, or at least I haven't run into a problem I can't fix. When you define top-level methods, you're defining private methods of class Object. If you need to avoid namespace pollution, you subclass BasicObject. Defining new methods for BasicObject itself is considered bad style, as that can break stuff.
A lot.
 

Strikingwolf

New Member
Jul 29, 2019
3,709
-26
1
Not really, or at least I haven't run into a problem I can't fix. When you define top-level methods, you're defining private methods of class Object. If you need to avoid namespace pollution, you subclass BasicObject. Defining new methods for BasicObject itself is considered bad style, as that can break stuff.
A lot.
Well I just prefer actual first-class functions. So you know. Also, making private methods are on Object as all Ruby methods...that is weird
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
Well I just prefer actual first-class functions. So you know. Also, making private methods are on Object as all Ruby methods...that is weird
Okay, explanation. When you make a class, by default it's a subclass of Object. Private methods, in Ruby, cannot be called with an explicit receiver. In any event, you can therefore use any method defined at the top level in your code in classes subclassed from Object (or at least has Object as an ancestor). If I subclass from BasicObject...
Code:
def test
  return 'hi'
end
class Test < BasicObject
  def test_method
    return test
  end
end
Test.new.test_method
That generates a NoMethodError or something along those lines. This is because you don't have access to private methods of Object.
Also, Striking, not every method is a method of Object. Only the ones defined at the top level are. Also, puts is a method in the module Kernel, which is included in class Object. So, this will generate an error as well:
Code:
class Test < BasicObject
  def test
    puts "testing"
  end
end
Test.new.test
Side note: In Ruby, include adds a module's methods as instance methods, extend adds them as class methods. Interesting little bit of info.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
And here I am, just doing my thing with lua ,php and javascript+jquery.:(
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
At least use Opal or Coffeescript or something else that compiles to JS.

Well as much I want to, I am not the only one working on it and as it is almost done switching right now is probably not a smart idea.
 

FyberOptic

New Member
Jul 29, 2019
524
0
0
Turbo Pascal 7 will always hold a special place in that code construct of my heart. It was the first compilable language I was able to get my hands on as a teen, having used stuff like Basic and QBasic for ages beforehand. It was even more special to me to be able to learn at the time because it was the same language Legend of the Red Dragon was written in. And if it was good enough for Seth Able, it was good enough for me. Not to mention, it meant I would be able to write IGMs (In-Game Modules) for his games.

The language was often ridiculed at the time by the more elitist folks, particularly for its performance due to the amount of overhead that could end up in your code (mostly depending on what you were doing and how you did it). It had a proper String type, for example. But there was literally nothing you couldn't do to improve performance, all the way down to the native support for including blocks of assembly code (since it was made by Borland, who did everything from Turbo Assembler to Turbo C). I literally learned how to use I/O ports, hardware memory addressing, and assembly thanks to what some would have referred to as a junk language.

Being made by Borland, you could count on an extensive built-in help feature as well. I would literally sit there sometimes and just read through the different entries for different functions or topics, excited to learn new things to do or different ways to do them. You just can't learn languages like that anymore. Nothing I've seen since has ever been as good as the help in most of the old Borland products.

Eventually I moved to C and that was that, but I still consider Pascal to be a great language to learn with. These days they call it Delphi, but I never looked at it again by that point. The closest I came was when I used the knowledge I have today to completely disassemble and analyze/label the assembly code for LORD, just to see what secrets or interesting things I could find. Even from that I learned new stuff, like how the old code overlay files used to work. But not even Free Pascal could pull me back in after all this time.
 
  • Like
Reactions: Strikingwolf

trajing

New Member
Jul 29, 2019
3,091
-14
1
I'm still of the same opinion I was earlier. Ruby is amazing. Using Rust to write C extensions for Ruby is even more amazing.
 

kikisp

New Member
Jul 29, 2019
18
0
0
hey guys is anybody here willing to help me with my java assignment problem? please let me know so i can pm details. am studying java and need to discus something with more experienced coders :)
 

kikisp

New Member
Jul 29, 2019
18
0
0
ok. so yea we started working with swing and timers,and now i need to create window that has two colors alternating on certain interval.its all fine an good but timer takes interval and actionListener or what to to after that interval.I can set one color that way.Part that is troubling for me is how to switch between two colors.Because when you set timer it goes like delay set color1.Then i need same delay set color2.. its probably something very easy but i cant get my head around it..
 

trajing

New Member
Jul 29, 2019
3,091
-14
1
Code:
while (true) {
  Thread.sleep(switchInterval)
  if (colorOneIsOn) {
    // switch color to color2
    colorOneIsOn = false;
  } else {
    // switch color to color1
    colorOneIsOn = true;
  }
}