some thoughts in language

compiler image

// c++ ruby and rust like I don't know
import@[<std>,<std_interface>,"some.ch","some.ci"]//<std>, coolheader,coolimpl

// class view, class needs end and fn and decl data needs end
cls Some
pub Some()

end [default]// no with is ok as well when 1 provided
pub Some(name:string):name{name}//pre decl type for constructor 
//this.name = name;
end

pub Some(Some &&rval)// not support not post decl for constructor
//    core_move(rval);
%%notimpl
end

self Some(Some &rhs) // private constructor
// not impl
end with [delete,deprecate] //if more than 1 attribute use with
   pub fn say:()->() // 
      print("some obj calls")
   end fn
   self fn say_helper:()->()
      print()// fn call
   end fn
       
   decl data // decl data is keywork that work for cls data section
   self name:str // self is private or None pre decl is ok as well
   pub id:int with[get] // pub is pub
   pub(self) p_addr with[get]// pub(self) is protected that means this data can be inherited 
   end decl
end cls

// include , import, attribute can have [...]
cls Derive(include [Some,Cloneable,Printable])// support for derive 1 cls and more than 1 able    
    pub fn debug_print :(Derive &)->()
    %%notimpl //%% is say that this func will deprecate when compile 
    end fn
end cls

// cls can have range (enum) (struct) (c/c++have)
    cls(enum) What
    end cls
    
// usage of cls

// when in fn main, needs ;
    fn main:()->int
    if __name__ == "main" {
	    print("ok")
	    
	}
// decl a obj
Some s{}
Some s{Some{}} //use Some(Some &&rhs)
s.say()
print(s.id)

Derive d{}
d.say()
print(d.p_addr)

    end fn 

// decl a interface
interface Cloneable
%%notimpl// when some end code have %%notimpl that code will not compile
pub fn clone:()->()
%%notimpl
end fn
end interface
// I dont knoe how to design a language


// dynamic momory management
Some ds{core_new(Some{})}// let core_new be a fn in core,when Some impl Dropable no need for delete
core_delete(s); // when you have to explictlly delete

// generic type

- GT for CLS // pre decl class HCLS is generic class
- T:Cloneable,U:Countable// this sectino says what is GT,and you can make it more spec
cls CLS
%%notimpl
end cls

// ctrl flow is rust like pass

// functional programming yet should be include
	
// comment is // and /**/

// std and std_interface or std_math or some lib like c++ have

// link to c or c++ should be include
// builtin design pattern should be include 
	
// tool chain I think that is not needed

// project structure
/*
  cheader/**.ch
  cimpl/**.ci
  main.ci
  scripts/{**.bat,**.sh}
*/

I won’t go to impl, I just image some thing

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值