Thread: An idea that's out of my reach of knowledge

  1. #1
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717

    An idea that's out of my reach of knowledge

    I didn't know in what forum to place this, so I choose this one...

    Well, an idea stroke my mind. An idea for a language, since I've seen people making nw 'languages' on here, and I thought this would be a nice idea. But this is only a small fragment of an idea for a whole language tho...

    So, is it possible to make a language that defines variables in such a manner
    Code:
    var# NumericVariable = 5;
    var StringVariable = "Some text";
    var CharVariable = 'v';
    I've never seen # being used before, but my knowledge of programming isn't wise eather :S
    So this can be done? For me it looks kinda easy and obvious for a programming language, and might indeed be a nice idea for someone who want's to make one...
    Currently research OpenGL

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Akkernight
    I didn't know in what forum to place this, so I choose this one...
    Moved to the tech board. I suppose general discussions would have been good too.

    Quote Originally Posted by Akkernight
    So, is it possible to make a language that defines variables in such a manner
    What manner is that, exactly?

    Quote Originally Posted by Akkernight
    I've never seen # being used before, but my knowledge of programming isn't wise eather
    Given that you already know C and C++, I believe you have seen # being used for preprocessor macros. Some languages use it as a comment marker.

    Quote Originally Posted by Akkernight
    So this can be done?
    I would guess a "yes", but frankly, I do not know what is "this". If you are asking if it is possible for your code snippet to be a code snippet of a programming language, then yes, of course.
    Last edited by laserlight; 04-05-2009 at 07:25 AM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    seems to me like some Basic dialect or even BasicScript
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    57
    Turing???
    Go to the keyword var,(using the scrolling thing on the side) and it shows you can declare a string variable like this:
    Code:
    var StringVar := "string"
    The language is kind of dead though, and is only taught in Canadian High schools I think.

  5. #5
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    woops! xD
    I'm ashamed now, I know the # being used :S
    Well, still it seems as a good idea?
    And I'm not looking for such a language
    Currently research OpenGL

  6. #6
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    > Well, still it seems as a good idea?
    To be honest, it seems half-baked, like you don't know what this language is good at doing.

    Syntax is largely up to the author most of the time (the example where it's usually not being stack based languages like chef or brain..........).

    I don't think anyone's opinion matters right now, until you know what this is.

  7. #7
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Change 'var' to 'auto' and get rid of the hash and you've got one of the proposed C++0x features. Nothing new here.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  8. #8
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    So, is it possible to make a language that defines variables in such a manner
    As long as you can define it and write a compiler for it, sure. I would recommend you think it out more though - someone mentioned the idea of a language being good at something.

    For instance - Java tried to be really good at the whole Object-Oriented and platform-independent thing. Ruby does a really good job of being simple, easy, and quick. What do you want your language to do, exactly? How could you write a syntax that lends itself to that task?

  9. #9
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    I don't want to make a language, I just wanted to share the idea incase someone else wanted to So in basics the idea is to make # assign a numeric 'value' or so... Like if you make a function, it can return numeric or characteristic (?)... Dunno how to explain nicely xP
    Variables and other stuff that don't have # are characteristic(?), those with # are numeric, just like in any other typing... #1 = Number One and 1 = One.
    Code:
    var# NumericVar = 5;
    var# CharacteristicVar1 = "Hello", CharacteristicVar2 = 'c';
    
    var# NumericFunc(); //returns numeric value
    var CharacteristicFunc(); //returns characteristic value
    
    vector<var#> num_vec; //vector to hold numeric values
    vector<var> char_vec; //vector to hold characteristic values
    And so on...
    Still not a good idea?
    Currently research OpenGL

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Akkernight
    So in basics the idea is to make # assign a numeric 'value' or so... Like if you make a function, it can return numeric or characteristic (?)... Dunno how to explain nicely xP
    Variables and other stuff that don't have # are characteristic(?), those with # are numeric, just like in any other typing... #1 = Number One and 1 = One.
    By "characteristic" you mean "pertaining to characters and strings"? If so, then it sounds like you are thinking of a programming language where there are two broad classes of types: numbers and characters/strings, and types default to the latter. The use of # to denote numeric types is just syntax, and while I would be fine with it, it does not particularly excite me.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    It seems a tad backwards to me - because numerical data is more natural to the computer. In BASIC, the $ symbol is used to denote strings the same way you're using the # for numbers. Combining the two would make it look less confusing I think. var$ means a string and var # means a number. I agree with laserlight - you could make it work, but I don't think much would be gained from it.

  12. #12
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    meh, it just came to mind and I decided to share it
    I wouldn't use it even tho someone made it, or maybe since it was my idea and I wanted to see the result, but I'm gonna stay with C++! xP
    Currently research OpenGL

  13. #13
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    sean's comparison with BASIC's string variable suffix '$' is quite apt. The '#' would be similar... But why have suffixes at all? Some languages don't have any differentiation between variable names whether they store strings or numeric arrays. C for example. But the keywords 'char' or 'int' told the compiler what's what up front. Other languages are even more dynamic - where the variables could change their types on-the-fly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Have an idea?
    By B0bDole in forum Projects and Job Recruitment
    Replies: 46
    Last Post: 01-13-2005, 03:25 PM
  2. A little problem about an idea, help please
    By louis_mine in forum C++ Programming
    Replies: 3
    Last Post: 09-10-2004, 09:52 PM
  3. Terrain engine idea
    By VirtualAce in forum Game Programming
    Replies: 15
    Last Post: 04-03-2004, 01:30 AM
  4. Just to give you an idea of what we're going through...
    By rick barclay in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 09-13-2001, 02:09 PM
  5. totally screwed up idea
    By iain in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 08-17-2001, 12:09 PM