What do you think?

closed account (iAk3T05o)
Just wondering. Say you wanted to create a calculator program and then you start your ide which presents an empty form with absolutely nothing on it. You then divide the form into different parts and then specify the names and functions of each of those parts.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Name: close_button
Function: end
background_color: red

Name: textbox
function: {
display,
read_in
}
access:
{
add_button,
subtract_button,
multiply_button,
divide_button

operator (+, -, /, *)
}

name: add_button
function: add{int, double, float}
operator: +

name: subtract_button
function: subtract {
int, double, float}
operator: -

name: multiply_button
function: multiply {
int, double, float}

name: divide_button
function: multiply{
int, float, double}
operator: *

Say that's a calculator with a gui created in a software like Qt, is it too verbose?
Last edited on
You lost me. What are you trying to do?
closed account (iAk3T05o)
@resident: Imagining what a programming language would look like if i were to make in the future
This is kind of how CSS is...
You really ought to check out Tcl/Tk. For example, here is a compete (but really simple) calculator program, written by RS (for his WinCE device, but it works fine on any wish interpreter).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 package require Tk
 wm title . Calculator
 grid [entry .e -textvar e -just right] -columnspan 5
 bind .e <Return> =
 set n 0
 foreach row {
    {7 8 9 + -}
    {4 5 6 * /}
    {1 2 3 ( )}
    {C 0 . =  }
 } {
    foreach key $row {
        switch -- $key {
            =       {set cmd =}
            C       {set cmd {set clear 1; set e ""}}
            default {set cmd "hit $key"}
        }
        lappend keys [button .[incr n] -text $key -command $cmd]
    }
    eval grid $keys -sticky we ;#-padx 1 -pady 1
    set keys [list]
 }
 grid .$n -columnspan 2 ;# make last key (=) double wide
 proc = {} {
    regsub { =.+} $::e "" ::e ;# maybe clear previous result
    if [catch {lappend ::e = [set ::res [expr 1.0*$::e]]}] {
        .e config -fg red
    }
    .e xview end
    set ::clear 1
 }
 proc hit {key} {
    if $::clear {
        set ::e ""
        if ![regexp {[0-9().]} $key] {set ::e $::res}
        .e config -fg black
        .e icursor end
        set ::clear 0
    }
    .e insert end $key
 }
 set clear 0
 focus .e           ;# allow keyboard input
 wm resizable . 0 0

See http://wiki.tcl.tk/1270

:O)
He is trying to get a wide opinion of his idea. GDNet http://www.gamedev.net/topic/653552-programming-method-what-do-you-think/

Just take it slow and try not to get lost in a infinite design process loop (make it, hate it, redesign, hate, redesign, etc.).
closed account (iAk3T05o)
Thanks BHX.
@duoas: that code contains one of the things i hate the most. $ signs. Why put that in a language?
Why not? There is a large number of things that use dollar signs, and because it almost always refers to the same thing, its a consistent and easy way to refer to a variable. This also allows you to split up languages with large numbers of keywords or a large standard library without namespaces to prevent name clashes. It also signifies that the variables are generic. As for why '$' in particular, as I said earlier, why not? Would '%' or '@' be better choices? Or even something like '_' or '~'? There is no real benefits to any of these over the others (though '_' could get confusing...).
well also, %, ~, !, #, &, *, | wouldnt work because they are widely used as other things. (well & and * do refer to variables but you dont have to use them). @ is the only one that doesnt seem to be widely used (with the exception of obj-c)
@Nathan2222

Are you being serious here on GDNET:
Nathan2222 wrote:
In my thoughts, i've created a google chrome style browser with less than 300 lines of code.


http://www.gamedev.net/topic/653503-just-another-thought-designing-a-fast-but-powerful-language/page-2#entry5132498
Last edited on
closed account (iAk3T05o)
Not absolutely but it would be fun to do
Topic archived. No new replies allowed.